@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.
- package/LICENSE +21 -0
- package/README.md +13 -0
- package/dist/index.cjs +199 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +199 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +45043 -0
- package/dist/index.mjs.map +1 -0
- package/dist/vue.css +1 -0
- package/package.json +120 -0
- package/types/__tests__/index.spec.d.ts +1 -0
- package/types/components/YiiEditor.vue.d.ts +701 -0
- package/types/components/buttons/OAiBtn.vue.d.ts +20 -0
- package/types/components/buttons/OAlignDropdown.vue.d.ts +10 -0
- package/types/components/buttons/OAlignGroup.vue.d.ts +11 -0
- package/types/components/buttons/OBackColorDropdown.vue.d.ts +10 -0
- package/types/components/buttons/OEmojiBtn.vue.d.ts +10 -0
- package/types/components/buttons/OFontFamilyDropdown.vue.d.ts +10 -0
- package/types/components/buttons/OForeColorDropdown.vue.d.ts +10 -0
- package/types/components/buttons/OHeadingDropdown.vue.d.ts +10 -0
- package/types/components/buttons/OLinkBtn.vue.d.ts +11 -0
- package/types/components/buttons/OLinkEditBtn.vue.d.ts +13 -0
- package/types/components/buttons/OLinkOpenBtn.vue.d.ts +10 -0
- package/types/components/buttons/OListDropdown.vue.d.ts +10 -0
- package/types/components/buttons/OListGroup.vue.d.ts +13 -0
- package/types/components/buttons/OMoreBubble.vue.d.ts +13 -0
- package/types/components/buttons/OSimpleCommandBtn.vue.d.ts +20 -0
- package/types/components/buttons/OStyleDropdown.vue.d.ts +10 -0
- package/types/components/buttons/OTableBtn.vue.d.ts +10 -0
- package/types/components/buttons/OTableGroup.vue.d.ts +13 -0
- package/types/components/buttons/OTextColorDropdown.vue.d.ts +11 -0
- package/types/components/buttons/OTextFormatDropdown.vue.d.ts +11 -0
- package/types/components/common/OBlockList.vue.d.ts +26 -0
- package/types/components/common/OBlockListItem.vue.d.ts +16 -0
- package/types/components/common/OBlockMenu.vue.d.ts +69 -0
- package/types/components/common/OBlockPlaceholder.vue.d.ts +23 -0
- package/types/components/common/OBlockPopover.vue.d.ts +534 -0
- package/types/components/common/OBlockToolbar.vue.d.ts +593 -0
- package/types/components/common/OCalloutColorBoard.vue.d.ts +36 -0
- package/types/components/common/OCalloutColorDropdown.vue.d.ts +14 -0
- package/types/components/common/OColorBoard.vue.d.ts +36 -0
- package/types/components/common/OCommandBtn.vue.d.ts +196 -0
- package/types/components/common/OCommonBtn.vue.d.ts +214 -0
- package/types/components/common/OContextMenu.vue.d.ts +469 -0
- package/types/components/common/ODocToc.vue.d.ts +68 -0
- package/types/components/common/OEmojiSelect.vue.d.ts +26 -0
- package/types/components/common/OLanguageDropdown.vue.d.ts +18 -0
- package/types/components/common/OMediaInput.vue.d.ts +27 -0
- package/types/components/common/OMenubarBtn.vue.d.ts +179 -0
- package/types/components/common/OMetaInput.vue.d.ts +155 -0
- package/types/components/common/ONodeView.vue.d.ts +213 -0
- package/types/components/common/OTableCellBackground.vue.d.ts +10 -0
- package/types/components/common/OTableGrid.vue.d.ts +6 -0
- package/types/components/common/OTextColorBoard.vue.d.ts +36 -0
- package/types/components/common/OToast.d.ts +11 -0
- package/types/components/common/o-side-menu/AddNode.vue.d.ts +46 -0
- package/types/components/common/o-side-menu/AddNodeView.vue.d.ts +50 -0
- package/types/components/common/o-side-menu/DragNode.vue.d.ts +54 -0
- package/types/components/common/o-side-menu/DragNodeMenu.vue.d.ts +64 -0
- package/types/components/common/o-side-menu/DragNodeView.vue.d.ts +50 -0
- package/types/components/common/o-side-node/AddNode.vue.d.ts +92 -0
- package/types/components/common/o-side-node/AddNodeView.vue.d.ts +96 -0
- package/types/components/common/o-side-node/DragNode.vue.d.ts +96 -0
- package/types/components/common/o-side-node/DragNodeView.vue.d.ts +96 -0
- package/types/components/common/o-side-node/index.vue.d.ts +96 -0
- package/types/components/index.d.ts +37 -0
- package/types/components/menu.d.ts +1 -0
- package/types/components/menus/OAiMenu.vue.d.ts +27 -0
- package/types/components/menus/OBubbleMenu.vue.d.ts +39 -0
- package/types/components/menus/OFloatingMenu.vue.d.ts +39 -0
- package/types/components/menus/OMainMenu.vue.d.ts +59 -0
- package/types/components/menus/OSideMenu.vue.d.ts +23 -0
- package/types/components/menus/side-menu/index.d.ts +2 -0
- package/types/components/ui/OBtn.vue.d.ts +123 -0
- package/types/components/ui/OBtnGroup.vue.d.ts +100 -0
- package/types/components/ui/OCheckbox.vue.d.ts +27 -0
- package/types/components/ui/ODivider.vue.d.ts +14 -0
- package/types/components/ui/OIcon.vue.d.ts +50 -0
- package/types/components/ui/OInput.vue.d.ts +125 -0
- package/types/components/ui/OList.vue.d.ts +56 -0
- package/types/components/ui/OListItem.vue.d.ts +42 -0
- package/types/components/ui/OPopover.vue.d.ts +242 -0
- package/types/components/ui/OTooltip.d.ts +16 -0
- package/types/components/ui/OTooltip.vue.d.ts +119 -0
- package/types/constants/ai.d.ts +6 -0
- package/types/constants/block.d.ts +7 -0
- package/types/constants/color.d.ts +5 -0
- package/types/constants/data.d.ts +4 -0
- package/types/constants/empty-block.d.ts +21 -0
- package/types/constants/index.d.ts +4 -0
- package/types/constants/language.d.ts +1 -0
- package/types/constants/menu.d.ts +31 -0
- package/types/extensions/ai-block/index.d.ts +3 -0
- package/types/extensions/ai-block/view.vue.d.ts +92 -0
- package/types/extensions/blockquote/index.d.ts +3 -0
- package/types/extensions/blockquote/view.vue.d.ts +92 -0
- package/types/extensions/callout/index.d.ts +3 -0
- package/types/extensions/callout/view.vue.d.ts +92 -0
- package/types/extensions/char-command/emoji/suggestion.d.ts +14 -0
- package/types/extensions/char-command/emoji/view.vue.d.ts +72 -0
- package/types/extensions/char-command/slash/suggestion.d.ts +14 -0
- package/types/extensions/char-command/slash/view.vue.d.ts +192 -0
- package/types/extensions/code-block/index.d.ts +3 -0
- package/types/extensions/code-block/view.vue.d.ts +92 -0
- package/types/extensions/dynamic.d.ts +7 -0
- package/types/extensions/heading/index.d.ts +7 -0
- package/types/extensions/heading/view.vue.d.ts +92 -0
- package/types/extensions/horizontal-rule/index.d.ts +2 -0
- package/types/extensions/horizontal-rule/view.vue.d.ts +92 -0
- package/types/extensions/image/index.d.ts +3 -0
- package/types/extensions/image/view.vue.d.ts +92 -0
- package/types/extensions/index.d.ts +49 -0
- package/types/extensions/link/helpers/clickSelectHandler.d.ts +2 -0
- package/types/extensions/link/index.d.ts +3 -0
- package/types/extensions/paragraph/index.d.ts +2 -0
- package/types/extensions/paragraph/view.vue.d.ts +92 -0
- package/types/extensions/side-menu/index.d.ts +2 -0
- package/types/extensions/side-menu/side-menu-plugin.d.ts +72 -0
- package/types/extensions/side-menu/utils.d.ts +50 -0
- package/types/extensions/table-cell/index.d.ts +3 -0
- package/types/extensions/table-cell/view.vue.d.ts +92 -0
- package/types/extensions/table-header/index.d.ts +3 -0
- package/types/extensions/table-header/view.vue.d.ts +92 -0
- package/types/extensions/table-wrapper/index.d.ts +2 -0
- package/types/extensions/table-wrapper/view.vue.d.ts +92 -0
- package/types/extensions/video/index.d.ts +2 -0
- package/types/extensions/video/view.vue.d.ts +92 -0
- package/types/hooks/index.d.ts +5 -0
- package/types/hooks/useAi.d.ts +6 -0
- package/types/hooks/useI18n.d.ts +8 -0
- package/types/hooks/useNodeView.d.ts +6 -0
- package/types/hooks/useTheme.d.ts +6 -0
- package/types/hooks/useTiptap.d.ts +8 -0
- package/types/i18n/index.d.ts +4 -0
- package/types/i18n/messages/en.d.ts +232 -0
- package/types/i18n/messages/pl.d.ts +182 -0
- package/types/i18n/messages/pt-br.d.ts +182 -0
- package/types/i18n/messages/zh-hans.d.ts +230 -0
- package/types/i18n/messages/zh-hant.d.ts +183 -0
- package/types/index.d.ts +11 -0
- package/types/utils/convert.d.ts +1 -0
- package/types/utils/uuid.d.ts +1 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";var $b=Object.defineProperty;var Fb=(t,e,n)=>e in t?$b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Je=(t,e,n)=>Fb(t,typeof e!="symbol"?e+"":e,n);/**
|
|
2
|
+
* Copyright 2025 Yiitap
|
|
3
|
+
* @license MIT
|
|
4
|
+
**/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),Vb=require("openai"),zb=require("markdown-it"),ei=require("@yiitap/util-emoji");function yt(t){this.content=t}yt.prototype={constructor:yt,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 yt(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 yt(n)},addToStart:function(t,e){return new yt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new yt(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 yt(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=yt.from(t),t.size?new yt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=yt.from(t),t.size?new yt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=yt.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}};yt.from=function(t){if(t instanceof yt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new yt(e)};function Zp(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=Zp(r.content,i.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function Qp(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 u=0,d=Math.min(s.text.length,l.text.length);for(;u<d&&s.text[s.text.length-u-1]==l.text[l.text.length-u-1];)u++,n--,o--;return{a:n,b:o}}if(s.content.size||l.content.size){let u=Qp(s.content,l.content,n-1,o-1);if(u)return u}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],u=l+c.nodeSize;if(u>e&&o(c,r+l,i||null,s)!==!1&&c.content.size){let d=l+1;c.nodesBetween(Math.max(0,e-d),Math.min(c.content.size,n-d),o,r+d)}l=u}}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 u=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&&u||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=u},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 Zp(this,e,n)}findDiffEnd(e,n=this.size,o=e.size){return Qp(this,e,n,o)}findIndex(e,n=-1){if(e==0)return Ri(0,e);if(e==this.size)return Ri(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?Ri(o+1,s):Ri(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 Pa={index:0,offset:0};function Ri(t,e){return Pa.index=t,Pa.offset=e,Pa}function fs(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(!fs(t[o],e[o]))return!1}else{for(let o in t)if(!(o in e)||!fs(t[o],e[o]))return!1;for(let o in e)if(!(o in t))return!1}return!0}let He=class kl{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&&fs(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 kl.none;if(e instanceof kl)return[e];let n=e.slice();return n.sort((o,r)=>o.type.rank-r.type.rank),n}};He.none=[];class hs 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=tf(this.content,e+this.openStart,n);return o&&new V(o,this.openStart,this.openEnd)}removeBetween(e,n){return new V(ef(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 ef(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(ef(i.content,e-r-1,n-r-1)))}function tf(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=tf(s.content,e-i-1,n);return l&&t.replaceChild(r,s.copy(l))}function Hb(t,e,n){if(n.openStart>t.depth)throw new hs("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new hs("Inconsistent open depths");return nf(t,e,n,0)}function nf(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=nf(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 Lo(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=Ub(n,t);return Lo(i,rf(t,s,l,e,o))}else return Lo(i,ms(t,e,o))}function of(t,e){if(!e.type.compatibleContent(t.type))throw new hs("Cannot join "+e.type.name+" onto "+t.type.name)}function wl(t,e,n){let o=t.node(n);return of(o,e.node(n)),o}function Io(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 zr(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&&(Io(t.nodeAfter,o),i++));for(let l=i;l<s;l++)Io(r.child(l),o);e&&e.depth==n&&e.textOffset&&Io(e.nodeBefore,o)}function Lo(t,e){return t.type.checkContent(e),t.copy(e)}function rf(t,e,n,o,r){let i=t.depth>r&&wl(t,e,r+1),s=o.depth>r&&wl(n,o,r+1),l=[];return zr(null,t,r,l),i&&s&&e.index(r)==n.index(r)?(of(i,s),Io(Lo(i,rf(t,e,n,o,r+1)),l)):(i&&Io(Lo(i,ms(t,e,r+1)),l),zr(e,n,r,l),s&&Io(Lo(s,ms(n,o,r+1)),l)),zr(o,null,r,l),new A(l)}function ms(t,e,n){let o=[];if(zr(null,t,n,o),t.depth>n){let r=wl(t,e,n+1);Io(Lo(r,ms(t,e,n+1)),o)}return zr(e,null,n,o),new A(o)}function Ub(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 ti{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 He.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 gs(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),u=i-c;if(o.push(s,l,r+c),!u||(s=s.child(l),s.isText))break;i=u-1,r+=c+1}return new ti(n,o,i)}static resolveCached(e,n){let o=Mu.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 Mu.set(e,o=new qb);let r=o.elts[o.i]=ti.resolve(e,n);return o.i=(o.i+1)%Kb,r}}class qb{constructor(){this.elts=[],this.i=0}}const Kb=12,Mu=new WeakMap;class gs{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 Wb=Object.create(null);let An=class El{constructor(e,n,o,r=He.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&&fs(this.attrs,n||e.defaultAttrs||Wb)&&He.sameSet(this.marks,o||He.none)}copy(e=null){return e==this.content?this:new El(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new El(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),u=r.node(s).content.cut(r.pos-l,i.pos-l);return new V(u,r.depth-s,i.depth-s)}replace(e,n,o){return Hb(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 ti.resolveCached(this,e)}resolveNoCache(e){return ti.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()+")"),sf(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=He.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(!He.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}};An.prototype.text=void 0;class bs extends An{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):sf(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 bs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new bs(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 sf(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Uo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let o=new jb(e,n);if(o.next==null)return Uo.empty;let r=af(o);o.next&&o.err("Unexpected trailing text");let i=ey(Qb(r));return ty(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(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:d,next:p}=s.next[u];if(!(d.isText||d.hasRequiredAttrs())&&r.indexOf(p)==-1){r.push(p);let f=i(p,l.concat(d));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
|
+
`)}}Uo.empty=new Uo(!0);class jb{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 af(t){let e=[];do e.push(Gb(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Gb(t){let e=[];do e.push(Yb(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Yb(t){let e=Zb(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=Jb(t,e);else break;return e}function Au(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Jb(t,e){let n=Au(t),o=n;return t.eat(",")&&(t.next!="}"?o=Au(t):o=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function Xb(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 Zb(t){if(t.eat("(")){let e=af(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=Xb(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 Qb(t){let e=[[]];return r(i(t,0),n()),e;function n(){return e.push([])-1}function o(s,l,c){let u={term:c,to:l};return e[s].push(u),u}function r(s,l){s.forEach(c=>c.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((c,u)=>c.concat(i(u,l)),[]);if(s.type=="seq")for(let c=0;;c++){let u=i(s.exprs[c],l);if(c==s.exprs.length-1)return u;r(u,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 u=0;u<s.min;u++){let d=n();r(i(s.expr,c),d),c=d}if(s.max==-1)r(i(s.expr,c),c);else for(let u=s.min;u<s.max;u++){let d=n();o(c,d),r(i(s.expr,c),d),c=d}return[o(c)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function lf(t,e){return e-t}function Ru(t,e){let n=[];return o(e),n.sort(lf);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 ey(t){let e=Object.create(null);return n(Ru(t,0));function n(o){let r=[];o.forEach(s=>{t[s].forEach(({term:l,to:c})=>{if(!l)return;let u;for(let d=0;d<r.length;d++)r[d][0]==l&&(u=r[d][1]);Ru(t,c).forEach(d=>{u||r.push([l,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[o.join(",")]=new Uo(o.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(lf);i.next.push({type:r[s][0],next:e[l.join(",")]||n(l)})}return i}}function ty(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:u}=r.next[l];s.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),o.indexOf(u)==-1&&o.push(u)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function cf(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 uf(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 df(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 pf(t,e){let n=Object.create(null);if(e)for(let o in e)n[o]=new oy(t,o,e[o]);return n}let Bu=class ff{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=pf(e,o.attrs),this.defaultAttrs=cf(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==Uo.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:uf(this.attrs,e)}create(e=null,n,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new An(this,this.computeAttrs(e),A.from(n),He.setFrom(o))}createChecked(e=null,n,o){return n=A.from(n),this.checkContent(n),new An(this,this.computeAttrs(e),n,He.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 An(this,e,n.append(i),He.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){df(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:He.none:e}static compile(e,n){let o=Object.create(null);e.forEach((i,s)=>o[i]=new ff(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 ny(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 oy{constructor(e,n,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?ny(e,n,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class sa{constructor(e,n,o,r){this.name=e,this.rank=n,this.schema=o,this.spec=r,this.attrs=pf(e,r.attrs),this.excluded=null;let i=cf(this.attrs);this.instance=i?new He(this,i):null}create(e=null){return!e&&this.instance?this.instance:new He(this,uf(this.attrs,e))}static compile(e,n){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new sa(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){df(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class hf{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=yt.from(e.nodes),n.marks=yt.from(e.marks||{}),this.nodes=Bu.compile(this.spec.nodes,this),this.marks=sa.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]=Uo.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?Du(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==""?[]:Du(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 Bu){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 bs(o,o.defaultAttrs,e,He.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return An.fromJSON(this,e)}markFromJSON(e){return He.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Du(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 ry(t){return t.tag!=null}function iy(t){return t.style!=null}let lr=class _l{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let o=this.matchedStyles=[];n.forEach(r=>{if(ry(r))this.tags.push(r);else if(iy(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 Lu(this,n,!1);return o.addAll(e,He.none,n.from,n.to),o.finish()}parseSlice(e,n={}){let o=new Lu(this,n,!0);return o.addAll(e,He.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(ly(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=Pu(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=Pu(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new _l(e,_l.schemaRules(e)))}};const mf={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},sy={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},gf={ol:!0,ul:!0},ni=1,Cl=2,ns=4;function Iu(t,e,n){return e!=null?(e?ni:0)|(e==="full"?Cl:0):t&&t.whitespace=="pre"?ni|Cl:n&-5}class Bi{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=He.none,this.match=i||(s&ns?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&ni)){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&&!mf.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Lu{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=Iu(null,n.preserveWhitespace,0)|(o?ns:0);r?i=new Bi(r.type,r.attrs,He.none,!0,n.topMatch||r.type.contentMatch,s):o?i=new Bi(null,null,He.none,!0,null,s):i=new Bi(e.schema.topNodeType,null,He.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&Cl?"full":this.localPreserveWS||(r.options&ni)>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;gf.hasOwnProperty(s)&&this.parser.normalizeLists&&ay(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(c?c.ignore:sy.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 u,d=this.needsBlock;if(mf.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!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),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,c,u,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(u=>!c.clearMark(u)):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=He.none;for(let s of o.concat(e.marks))(r.type?r.type.allowsMarkType(s.type):$u(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=Iu(e,i,s.options);s.options&ns&&s.content.length==0&&(l|=ns);let c=He.none;return o=o.filter(u=>(s.type?s.type.allowsMarkType(u.type):$u(u.type,e))?(c=u.addToSet(c),!1):!0),this.nodes.push(new Bi(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|=ni)}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 u=n[l];if(u==""){if(l==n.length-1||l==0)continue;for(;c>=i;c--)if(s(l-1,c))return!0;return!1}else{let d=c>0||c==0&&r?this.nodes[c].type:o&&c>=i?o.node(c-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))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 ay(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&gf.hasOwnProperty(o)&&n?(n.appendChild(e),e=n):o=="li"?n=e:o&&(n=null)}}function ly(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Pu(t){let e={};for(let n in t)e[n]=t[n];return e}function $u(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:u,next:d}=l.edge(c);if(u==e||i.indexOf(d)<0&&s(d))return!0}};if(s(r.contentMatch))return!0}}class Yo{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},o){o||(o=$a(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 u=s.marks[c];if(!this.marks[u.type.name]){c++;continue}if(!u.eq(i[l][0])||u.type.spec.spanning===!1)break;l++,c++}for(;l<i.length;)r=i.pop()[1];for(;c<s.marks.length;){let u=s.marks[c++],d=this.serializeMark(u,s.isInline,n);d&&(i.push([u,r]),r.appendChild(d.dom),r=d.contentDOM||d.dom)}}r.appendChild(this.serializeNodeInner(s,n))}),o}serializeNodeInner(e,n){let{dom:o,contentDOM:r}=rs($a(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&&rs($a(o),r(e,n),null,e.attrs)}static renderSpec(e,n,o=null,r){return rs(e,n,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Yo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Fu(e.nodes);return n.text||(n.text=o=>o.text),n}static marksFromSchema(e){return Fu(e.marks)}}function Fu(t){let e={};for(let n in t){let o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function $a(t){return t.document||window.document}const Vu=new WeakMap;function cy(t){let e=Vu.get(t);return e===void 0&&Vu.set(t,e=uy(t)),e}function uy(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 rs(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=cy(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),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let p in u)if(u[p]!=null){let f=p.indexOf(" ");f>0?c.setAttributeNS(p.slice(0,f),p.slice(f+1),u[p]):c.setAttribute(p,u[p])}}for(let p=d;p<e.length;p++){let f=e[p];if(f===0){if(p<e.length-1||p>d)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}=rs(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 bf=65535,yf=Math.pow(2,16);function dy(t,e){return t+e*yf}function zu(t){return t&bf}function py(t){return(t-(t&bf))/yf}const vf=1,kf=2,is=4,wf=8;class Sl{constructor(e,n,o){this.pos=e,this.delInfo=n,this.recover=o}get deleted(){return(this.delInfo&wf)>0}get deletedBefore(){return(this.delInfo&(vf|is))>0}get deletedAfter(){return(this.delInfo&(kf|is))>0}get deletedAcross(){return(this.delInfo&is)>0}}class jt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&jt.empty)return jt.empty}recover(e){let n=0,o=zu(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+py(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 u=this.ranges[l+i],d=this.ranges[l+s],p=c+u;if(e<=p){let f=u?e==c?-1:e==p?1:n:n,h=c+r+(f<0?0:d);if(o)return h;let m=e==(n<0?c:p)?null:dy(l/3,e-c),g=e==c?kf:e==p?vf:is;return(n<0?e!=c:e!=p)&&(g|=wf),new Sl(h,g,m)}r+=d-u}return o?e+r:new Sl(e+r,0,null)}touches(e,n){let o=0,r=zu(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 u=this.ranges[l+i],d=c+u;if(e<=d&&l==r*3)return!0;o+=this.ranges[l+s]-u}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),u=this.ranges[r+n],d=this.ranges[r+o];e(l,l+u,c,c+d),i+=d-u}}invert(){return new jt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?jt.empty:new jt(e<0?[0,-e,0]:[0,0,e])}}jt.empty=new jt([]);class oi{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 oi(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 oi;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 Sl(e,r,null)}}const Fa=Object.create(null);class Nt{getMap(){return jt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Fa[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 Fa)throw new RangeError("Duplicate use of step JSON ID "+e);return Fa[e]=n,n.prototype.jsonID=e,n}}class st{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new st(e,null)}static fail(e){return new st(null,e)}static fromReplace(e,n,o,r){try{return st.ok(e.replace(n,o,r))}catch(i){if(i instanceof hs)return st.fail(i.message);throw i}}}function uc(t,e,n){let o=[];for(let r=0;r<t.childCount;r++){let i=t.child(r);i.content.size&&(i=i.copy(uc(i.content,e,i))),i.isInline&&(i=e(i,n,r)),o.push(i)}return A.fromArray(o)}class po extends Nt{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(uc(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 st.fromReplace(e,this.from,this.to,i)}invert(){return new Mn(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 po(n.pos,o.pos,this.mark)}merge(e){return e instanceof po&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new po(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 po(n.from,n.to,e.markFromJSON(n.mark))}}Nt.jsonID("addMark",po);class Mn extends Nt{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(uc(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return st.fromReplace(e,this.from,this.to,o)}invert(){return new po(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 Mn(n.pos,o.pos,this.mark)}merge(e){return e instanceof Mn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mn(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 Mn(n.from,n.to,e.markFromJSON(n.mark))}}Nt.jsonID("removeMark",Mn);class fo extends Nt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return st.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return st.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 fo(this.pos,n.marks[r]);return new fo(this.pos,this.mark)}}return new dr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new fo(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 fo(n.pos,e.markFromJSON(n.mark))}}Nt.jsonID("addNodeMark",fo);class dr extends Nt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return st.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return st.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 fo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new dr(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 dr(n.pos,e.markFromJSON(n.mark))}}Nt.jsonID("removeNodeMark",dr);class pt extends Nt{constructor(e,n,o,r=!1){super(),this.from=e,this.to=n,this.slice=o,this.structure=r}apply(e){return this.structure&&xl(e,this.from,this.to)?st.fail("Structure replace would overwrite content"):st.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new jt([this.from,this.to-this.from,this.slice.size])}invert(e){return new pt(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 pt(n.pos,Math.max(n.pos,o.pos),this.slice)}merge(e){if(!(e instanceof pt)||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 pt(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 pt(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 pt(n.from,n.to,V.fromJSON(e,n.slice),!!n.structure)}}Nt.jsonID("replace",pt);class ft extends Nt{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&&(xl(e,this.from,this.gapFrom)||xl(e,this.gapTo,this.to)))return st.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return st.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,n.content);return o?st.fromReplace(e,this.from,this.to,o):st.fail("Content does not fit in gap")}getMap(){return new jt([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 ft(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 ft(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 ft(n.from,n.to,n.gapFrom,n.gapTo,V.fromJSON(e,n.slice),n.insert,!!n.structure)}}Nt.jsonID("replaceAround",ft);function xl(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 fy(t,e,n,o){let r=[],i=[],s,l;t.doc.nodesBetween(e,n,(c,u,d)=>{if(!c.isInline)return;let p=c.marks;if(!o.isInSet(p)&&d.type.allowsMarkType(o.type)){let f=Math.max(u,e),h=Math.min(u+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 Mn(f,h,p[g])));l&&l.to==f?l.to=h:i.push(l=new po(f,h,o))}}),r.forEach(c=>t.step(c)),i.forEach(c=>t.step(c))}function hy(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 sa){let u=s.marks,d;for(;d=o.isInSet(u);)(c||(c=[])).push(d),u=d.removeFromSet(u)}else o?o.isInSet(s.marks)&&(c=[o]):c=s.marks;if(c&&c.length){let u=Math.min(l+s.nodeSize,n);for(let d=0;d<c.length;d++){let p=c[d],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=u,f.step=i):r.push({style:p,from:Math.max(l,e),to:u,step:i})}}}),r.forEach(s=>t.step(new Mn(s.from,s.to,s.style)))}function dc(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 u=i.child(c),d=l+u.nodeSize,p=o.matchType(u.type);if(!p)s.push(new pt(l,d,V.empty));else{o=p;for(let f=0;f<u.marks.length;f++)n.allowsMarkType(u.marks[f].type)||t.step(new Mn(l,d,u.marks[f]));if(r&&u.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(u.text);)m||(m=new V(A.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new pt(l+f.index,l+f.index+f[0].length,m))}}l=d}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 my(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function _r(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||!my(r,i,s))break}return null}function gy(t,e,n){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),c=s,u=l,d=A.empty,p=0;for(let m=i,g=!1;m>n;m--)g||o.index(m)>0?(g=!0,d=A.from(o.node(m).copy(d)),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++):u++;t.step(new ft(c,u,s,l,new V(d.append(f),p,h),d.size-p,!0))}function pc(t,e,n=null,o=t){let r=by(t,e),i=r&&yy(o,e);return i?r.map(Hu).concat({type:e,attrs:n}).concat(i.map(Hu)):null}function Hu(t){return{type:t,attrs:null}}function by(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 yy(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 u=o;c&&u<r;u++)c=c.matchType(n.child(u).type);return!c||!c.validEnd?null:s}function vy(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 ft(r,i,r,i,new V(o,0,0),n.length,!0))}function ky(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)&&wy(t.doc,t.mapping.slice(i).map(l),o)){let u=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&_f(t,s,l,i),dc(t,t.mapping.slice(i).map(l,1),o,void 0,u===null);let d=t.mapping.slice(i),p=d.map(l,1),f=d.map(l+s.nodeSize,1);return t.step(new ft(p,f,p+1,f-1,new V(A.from(o.create(c,null,s.marks)),0,0),1,!0)),u===!0&&Ef(t,s,l,i),!1}})}function Ef(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 _f(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 wy(t,e,n){let o=t.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}function Ey(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 ft(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new V(A.from(s),0,0),1,!0))}function Yn(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 u=r.depth-1,d=n-2;u>i;u--,d--){let p=r.node(u),f=r.index(u);if(p.type.spec.isolating)return!1;let h=p.content.cutByIndex(f,p.childCount),m=o&&o[d+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[d]||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 _y(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,u=n-1;l>c;l--,u--){i=A.from(r.node(l).copy(i));let d=o&&o[u];s=A.from(d?d.type.create(d.attrs,s):r.node(l).copy(s))}t.step(new pt(e,e,new V(i.append(s),n,n),!0))}function wo(t,e){let n=t.resolve(e),o=n.index();return Cf(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function Cy(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 Cf(t,e){return!!(t&&e&&!t.isLeaf&&Cy(t,e))}function aa(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&&Cf(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 d=s.whitespace=="pre",p=!!s.contentMatch.matchType(r);d&&!p?o=!1:!d&&p&&(o=!0)}let l=t.steps.length;if(o===!1){let d=t.doc.resolve(e+n);_f(t,d.node(),d.before(),l)}s.inlineContent&&dc(t,e+n-1,s,i.node().contentMatchAt(i.index()),o==null);let c=t.mapping.slice(l),u=c.map(e-n);if(t.step(new pt(u,c.map(e+n,-1),V.empty,!0)),o===!0){let d=t.doc.resolve(u);Ef(t,d.node(),d.before(),t.steps.length)}return t}function xy(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 Sf(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),u=o.node(s),d=!1;if(i==1)d=u.canReplace(c,c,r);else{let p=u.contentMatchAt(c).findWrapping(r.firstChild.type);d=p&&u.canReplaceWith(c,c,p[0])}if(d)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function la(t,e,n=e,o=V.empty){if(e==n&&!o.size)return null;let r=t.resolve(e),i=t.resolve(n);return xf(r,i,o)?new pt(e,n,o):new Ny(r,i,o).fit()}function xf(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Ny{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 u=this.findFittable();u?this.placeNodes(u):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 ft(o.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||o.pos!=this.$to.pos?new pt(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=Va(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:u}=this.frontier[l],d,p=null;if(n==1&&(s?u.matchType(s.type)||(p=u.fillBefore(A.from(s),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:p};if(n==2&&s&&(d=u.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Va(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=Va(e,n);if(r.childCount<=1&&n>0){let i=e.size-n<=n+r.size;this.unplaced=new V(Lr(e,n-1,1),n-1,i?n-1:o)}else this.unplaced=new V(Lr(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,u=0,d=[],{match:p,type:f}=this.frontier[n];if(r){for(let g=0;g<r.childCount;g++)d.push(r.child(g));p=p.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;u<l.childCount;){let g=l.child(u),b=p.matchType(g.type);if(!b)break;u++,(u>1||c==0||g.content.size)&&(p=b,d.push(Nf(g.mark(f.allowedMarks(g.marks)),u==1?c:0,u==l.childCount?h:-1)))}let m=u==l.childCount;m||(h=-1),this.placed=Pr(this.placed,n,A.from(d)),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(Lr(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new V(Lr(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!za(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=za(e,n,r,o,i);if(s){for(let l=n-1;l>=0;l--){let{match:c,type:u}=this.frontier[l],d=za(e,l,u,c,!0);if(!d||d.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=Pr(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=Pr(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=Pr(this.placed,this.frontier.length,n))}}function Lr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Lr(t.firstChild.content,e-1,n)))}function Pr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Pr(t.lastChild.content,e-1,n)))}function Va(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Nf(t,e,n){if(e<=0)return t;let o=t.content;return e>1&&(o=o.replaceChild(0,Nf(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 za(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&&!Ty(n,i.content,s)?l:null}function Ty(t,e,n){for(let o=n;o<e.childCount;o++)if(!t.allowsMarks(e.child(o).marks))return!0;return!1}function Oy(t){return t.spec.defining||t.spec.definingForContent}function My(t,e,n,o){if(!o.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),i=t.doc.resolve(n);if(xf(r,i,o))return t.step(new pt(e,n,o));let s=Of(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),u=[],d=o.openStart;for(let f=o.content,h=0;;h++){let m=f.firstChild;if(u.push(m),h==o.openStart)break;f=m.content}for(let f=d-1;f>=0;f--){let h=u[f],m=Oy(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))d=f;else if(m||!h.type.isTextblock)break}for(let f=o.openStart;f>=0;f--){let h=(f+d+1)%(o.openStart+1),m=u[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 k=r.node(b-1),E=r.index(b-1);if(k.canReplaceWith(E,E,m.type,m.marks))return t.replace(r.before(b),y?i.after(b):n,new V(Tf(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 Tf(t,e,n,o,r){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Tf(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 Ay(t,e,n,o){if(!o.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=xy(t.doc,e,o.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new V(A.from(o),0,0))}function Ry(t,e,n){let o=t.doc.resolve(e),r=t.doc.resolve(n),i=Of(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 Of(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 cr extends Nt{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 st.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 st.fromReplace(e,this.pos,this.pos+1,new V(A.from(r),0,n.isLeaf?0:1))}getMap(){return jt.empty}invert(e){return new cr(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 cr(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 cr(n.pos,n.attr,n.value)}}Nt.jsonID("attr",cr);class ri extends Nt{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 st.ok(o)}getMap(){return jt.empty}invert(e){return new ri(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 ri(n.attr,n.value)}}Nt.jsonID("docAttr",ri);let pr=class extends Error{};pr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};pr.prototype=Object.create(Error.prototype);pr.prototype.constructor=pr;pr.prototype.name="TransformError";class fc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new oi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new pr(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=la(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 My(this,e,n,o),this}replaceRangeWith(e,n,o){return Ay(this,e,n,o),this}deleteRange(e,n){return Ry(this,e,n),this}lift(e,n){return gy(this,e,n),this}join(e,n=1){return Sy(this,e,n),this}wrap(e,n){return vy(this,e,n),this}setBlockType(e,n=e,o,r=null){return ky(this,e,n,o,r),this}setNodeMarkup(e,n,o=null,r){return Ey(this,e,n,o,r),this}setNodeAttribute(e,n,o){return this.step(new cr(e,n,o)),this}setDocAttribute(e,n){return this.step(new ri(e,n)),this}addNodeMark(e,n){return this.step(new fo(e,n)),this}removeNodeMark(e,n){if(!(n instanceof He)){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 dr(e,n)),this}split(e,n=1,o){return _y(this,e,n,o),this}addMark(e,n,o){return fy(this,e,n,o),this}removeMark(e,n,o){return hy(this,e,n,o),this}clearIncompatible(e,n,o){return dc(this,e,n,o),this}}const Ha=Object.create(null);class ae{constructor(e,n,o){this.$anchor=e,this.$head=n,this.ranges=o||[new Mf(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:u}=s[l],d=e.mapping.slice(i);e.replaceRange(d.map(c.pos),d.map(u.pos),l?V.empty:n),l==0&&Ku(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),u=c.map(s.pos),d=c.map(l.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,n),Ku(e,o,n.isInline?-1:1))}}static findFrom(e,n,o=!1){let r=e.parent.inlineContent?new ne(e):tr(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?tr(e.node(0),e.node(i),e.before(i+1),e.index(i),n,o):tr(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 Jt(e.node(0))}static atStart(e){return tr(e,e,0,0,1)||new Jt(e)}static atEnd(e){return tr(e,e,e.content.size,e.childCount,-1)||new Jt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Ha[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 Ha)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ha[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ne.between(this.$anchor,this.$head).getBookmark()}}ae.prototype.visible=!0;class Mf{constructor(e,n){this.$from=e,this.$to=n}}let Uu=!1;function qu(t){!Uu&&!t.parent.inlineContent&&(Uu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ne extends ae{constructor(e,n=e){qu(e),qu(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 ae.near(o);let r=e.resolve(n.map(this.anchor));return new ne(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 ne&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ca(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 ne(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=ae.findFrom(n,o,!0)||ae.findFrom(n,-o,!0);if(i)n=i.$head;else return ae.near(n,o)}return e.parent.inlineContent||(r==0?e=n:(e=(ae.findFrom(e,-o,!0)||ae.findFrom(e,o,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new ne(e,n)}}ae.jsonID("text",ne);class ca{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ca(e.map(this.anchor),e.map(this.head))}resolve(e){return ne.between(e.resolve(this.anchor),e.resolve(this.head))}}class oe extends ae{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?ae.near(i):new oe(i)}content(){return new V(A.from(this.node),0,0)}eq(e){return e instanceof oe&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new hc(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new oe(e.resolve(n.anchor))}static create(e,n){return new oe(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}oe.prototype.visible=!1;ae.jsonID("node",oe);class hc{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:o}=e.mapResult(this.anchor);return n?new ca(o,o):new hc(o)}resolve(e){let n=e.resolve(this.anchor),o=n.nodeAfter;return o&&oe.isSelectable(o)?new oe(n):ae.near(n)}}class Jt extends ae{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=ae.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Jt(e)}map(e){return new Jt(e)}eq(e){return e instanceof Jt}getBookmark(){return By}}ae.jsonID("all",Jt);const By={map(){return this},resolve(t){return new Jt(t)}};function tr(t,e,n,o,r,i=!1){if(e.inlineContent)return ne.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&&oe.isSelectable(l))return oe.create(t,n-(r<0?l.nodeSize:0))}else{let c=tr(t,l,n+r,r<0?l.childCount:0,r,i);if(c)return c}n+=l.nodeSize*r}return null}function Ku(t,e,n){let o=t.steps.length-1;if(o<e)return;let r=t.steps[o];if(!(r instanceof pt||r instanceof ft))return;let i=t.mapping.maps[o],s;i.forEach((l,c,u,d)=>{s==null&&(s=d)}),t.setSelection(ae.near(t.doc.resolve(s),n))}const Wu=1,ju=2,Gu=4;class Dy extends fc{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|Wu)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Wu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ju,this}ensureMarks(e){return He.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&ju)>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)||He.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(ae.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|=Gu,this}get scrolledIntoView(){return(this.updated&Gu)>0}}function Yu(t,e){return!e||!t?t:t.bind(e)}class $r{constructor(e,n,o){this.name=e,this.init=Yu(n.init,o),this.apply=Yu(n.apply,o)}}const Iy=[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||ae.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 Ua{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Iy.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 ar{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,u=r?r[s].state:this,d=c<n.length&&l.spec.appendTransaction.call(l,c?n.slice(c):n,u,o);if(d&&o.filterTransaction(d,s)){if(d.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(d),o=o.applyInner(d),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 ar(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 Dy(this)}static create(e){let n=new Ua(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new ar(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 Ua(this.schema,e.plugins),o=n.fields,r=new ar(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 Ua(e.schema,e.plugins),i=new ar(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=An.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=ae.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],u=c.spec.state;if(c.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[s.name]=u.fromJSON.call(c,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function Af(t,e,n){for(let o in t){let r=t[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Af(r,e,{})),n[o]=r}return n}class Ae{constructor(e){this.spec=e,this.props={},e.props&&Af(e.props,this,this.props),this.key=e.key?e.key.key:Rf("plugin")}getState(e){return e[this.key]}}const qa=Object.create(null);function Rf(t){return t in qa?t+"$"+ ++qa[t]:(qa[t]=0,t+"$")}class xe{constructor(e="key"){this.key=Rf(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const vt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ii=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Nl=null;const Kn=function(t,e,n){let o=Nl||(Nl=document.createRange());return o.setEnd(t,n??t.nodeValue.length),o.setStart(t,e||0),o},Ly=function(){Nl=null},qo=function(t,e,n,o){return n&&(Ju(t,e,n,o,-1)||Ju(t,e,n,o,1))},Py=/^(img|br|input|textarea|hr)$/i;function Ju(t,e,n,o,r){for(;;){if(t==n&&e==o)return!0;if(e==(r<0?0:rn(t))){let i=t.parentNode;if(!i||i.nodeType!=1||ki(t)||Py.test(t.nodeName)||t.contentEditable=="false")return!1;e=vt(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?rn(t):0}else return!1}}function rn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function $y(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=rn(t)}else if(t.parentNode&&!ki(t))e=vt(t),t=t.parentNode;else return null}}function Fy(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&&!ki(t))e=vt(t)+1,t=t.parentNode;else return null}}function Vy(t,e,n){for(let o=e==0,r=e==rn(t);o||r;){if(t==n)return!0;let i=vt(t);if(t=t.parentNode,!t)return!1;o=o&&i==0,r=r&&i==rn(t)}}function ki(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 ua=function(t){return t.focusNode&&qo(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Oo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function zy(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Hy(t,e,n){if(t.caretPositionFromPoint)try{let o=t.caretPositionFromPoint(e,n);if(o)return{node:o.offsetNode,offset:Math.min(rn(o.offsetNode),o.offset)}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(e,n);if(o)return{node:o.startContainer,offset:Math.min(rn(o.startContainer),o.startOffset)}}}const Bn=typeof navigator<"u"?navigator:null,Xu=typeof document<"u"?document:null,Eo=Bn&&Bn.userAgent||"",Tl=/Edge\/(\d+)/.exec(Eo),Bf=/MSIE \d/.exec(Eo),Ol=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Eo),Vt=!!(Bf||Ol||Tl),go=Bf?document.documentMode:Ol?+Ol[1]:Tl?+Tl[1]:0,vn=!Vt&&/gecko\/(\d+)/i.test(Eo);vn&&+(/Firefox\/(\d+)/.exec(Eo)||[0,0])[1];const Ml=!Vt&&/Chrome\/(\d+)/.exec(Eo),Ct=!!Ml,Df=Ml?+Ml[1]:0,Bt=!Vt&&!!Bn&&/Apple Computer/.test(Bn.vendor),fr=Bt&&(/Mobile\/\w+/.test(Eo)||!!Bn&&Bn.maxTouchPoints>2),on=fr||(Bn?/Mac/.test(Bn.platform):!1),Uy=Bn?/Win/.test(Bn.platform):!1,jn=/Android \d/.test(Eo),wi=!!Xu&&"webkitFontSmoothing"in Xu.documentElement.style,qy=wi?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ky(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 Vn(t,e){return typeof t=="number"?t:t[e]}function Wy(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 Zu(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=ii(s)){if(s.nodeType!=1)continue;let l=s,c=l==i.body,u=c?Ky(i):Wy(l),d=0,p=0;if(e.top<u.top+Vn(o,"top")?p=-(u.top-e.top+Vn(r,"top")):e.bottom>u.bottom-Vn(o,"bottom")&&(p=e.bottom-e.top>u.bottom-u.top?e.top+Vn(r,"top")-u.top:e.bottom-u.bottom+Vn(r,"bottom")),e.left<u.left+Vn(o,"left")?d=-(u.left-e.left+Vn(r,"left")):e.right>u.right-Vn(o,"right")&&(d=e.right-u.right+Vn(r,"right")),d||p)if(c)i.defaultView.scrollBy(d,p);else{let f=l.scrollLeft,h=l.scrollTop;p&&(l.scrollTop+=p),d&&(l.scrollLeft+=d);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 jy(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:If(t.dom)}}function If(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=ii(o));return e}function Gy({refDOM:t,refTop:e,stack:n}){let o=t?t.getBoundingClientRect().top:0;Lf(n,o==0?0:o-e)}function Lf(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 Xo=null;function Yy(t){if(t.setActive)return t.setActive();if(Xo)return t.focus(Xo);let e=If(t);t.focus(Xo==null?{get preventScroll(){return Xo={preventScroll:!0},!0}}:void 0),Xo||(Xo=!1,Lf(e,0))}function Pf(t,e){let n,o=2e8,r,i=0,s=e.top,l=e.top,c,u;for(let d=t.firstChild,p=0;d;d=d.nextSibling,p++){let f;if(d.nodeType==1)f=d.getClientRects();else if(d.nodeType==3)f=Kn(d).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=d,o=g,r=g&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.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=d,u={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=u,o=0),n&&n.nodeType==3?Jy(n,r):!n||o&&n.nodeType==1?{node:t,offset:i}:Pf(n,r)}function Jy(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=ro(o,1);if(i.top!=i.bottom&&mc(e,i))return{node:t,offset:r+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function mc(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Xy(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Zy(t,e,n){let{node:o,offset:r}=Pf(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 Qy(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 $f(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 u=l[c];if(mc(e,u))return $f(s,e,u)}}if((i=(i+1)%o)==r)break}return t}function ev(t,e){let n=t.dom.ownerDocument,o,r=0,i=Hy(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 u=t.dom.getBoundingClientRect();if(!mc(e,u)||(s=$f(t.dom,e,u),!s))return null}if(Bt)for(let u=s;o&&u;u=ii(u))u.draggable&&(o=void 0);if(s=Xy(s,e),o){if(vn&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let d=o.childNodes[r],p;d.nodeName=="IMG"&&(p=d.getBoundingClientRect()).right<=e.left&&p.bottom>e.top&&r++}let u;wi&&r&&o.nodeType==1&&(u=o.childNodes[r-1]).nodeType==1&&u.contentEditable=="false"&&u.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=Qy(t,o,r,e))}l==null&&(l=Zy(t,s,e));let c=t.docView.nearestDesc(s,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function Qu(t){return t.top<t.bottom||t.left<t.right}function ro(t,e){let n=t.getClientRects();if(n.length){let o=n[e<0?0:n.length-1];if(Qu(o))return o}return Array.prototype.find.call(n,Qu)||t.getBoundingClientRect()}const tv=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ff(t,e,n){let{node:o,offset:r,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=wi||vn;if(o.nodeType==3)if(s&&(tv.test(o.nodeValue)||(n<0?!r:r==o.nodeValue.length))){let c=ro(Kn(o,r,r),n);if(vn&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let u=ro(Kn(o,r-1,r-1),-1);if(u.top==c.top){let d=ro(Kn(o,r,r+1),-1);if(d.top!=c.top)return Ar(d,d.left<u.left)}}return c}else{let c=r,u=r,d=n<0?1:-1;return n<0&&!r?(u++,d=-1):n>=0&&r==o.nodeValue.length?(c--,d=1):n<0?c--:u++,Ar(ro(Kn(o,c,u),d),d<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(n<0||r==rn(o))){let c=o.childNodes[r-1];if(c.nodeType==1)return Ka(c.getBoundingClientRect(),!1)}if(i==null&&r<rn(o)){let c=o.childNodes[r];if(c.nodeType==1)return Ka(c.getBoundingClientRect(),!0)}return Ka(o.getBoundingClientRect(),n>=0)}if(i==null&&r&&(n<0||r==rn(o))){let c=o.childNodes[r-1],u=c.nodeType==3?Kn(c,rn(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(u)return Ar(ro(u,1),!1)}if(i==null&&r<rn(o)){let c=o.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let u=c?c.nodeType==3?Kn(c,0,s?0:1):c.nodeType==1?c:null:null;if(u)return Ar(ro(u,-1),!0)}return Ar(ro(o.nodeType==3?Kn(o):o,-n),n>=0)}function Ar(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 Ka(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 Vf(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 nv(t,e,n){let o=e.selection,r=n=="up"?o.$from:o.$to;return Vf(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=Ff(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=Kn(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<c.length;u++){let d=c[u];if(d.bottom>d.top+1&&(n=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}const ov=/[\u0590-\u08ac]/;function rv(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?!ov.test(o.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:Vf(t,e,()=>{let{focusNode:c,focusOffset:u,anchorNode:d,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&&u==g;try{l.collapse(d,p),c&&(c!=d||u!=p)&&l.extend&&l.extend(c,u)}catch{}return f!=null&&(l.caretBidiLevel=f),b}):o.pos==o.start()||o.pos==o.end()}let ed=null,td=null,nd=!1;function iv(t,e,n){return ed==e&&td==n?nd:(ed=e,td=n,nd=n=="up"||n=="down"?nv(t,e,n):rv(t,e,n))}const sn=0,od=1,Ao=2,Dn=3;class Ei{constructor(e,n,o,r){this.parent=e,this.children=n,this.dom=o,this.contentDOM=r,this.dirty=sn,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>vt(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 Hf){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 zf&&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?vt(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?vt(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],u=s+c.size;if(r==-1&&e<=u){let d=s+c.border;if(e>=d&&n<=u-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,d);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=vt(f.dom)+1;break}e-=f.size}r==-1&&(r=0)}if(r>-1&&(u>n||l==this.children.length-1)){n=u;for(let d=l+1;d<this.children.length;d++){let p=this.children[d];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){i=vt(p.dom);break}n+=p.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=u}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),u=o.root.getSelection(),d=o.domSelectionRange(),p=!1;if((vn||Bt)&&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:vt(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(vn&&d.focusNode&&d.focusNode!=c.node&&d.focusNode.nodeType==1){let h=d.focusNode.childNodes[d.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||p&&Bt)&&qo(l.node,l.offset,d.anchorNode,d.anchorOffset)&&qo(c.node,c.offset,d.focusNode,d.focusOffset))return;let f=!1;if((u.extend||e==n)&&!p){u.collapse(l.node,l.offset);try{e!=n&&u.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),u.removeAllRanges(),u.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?Ao:od,e==l&&n==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Dn:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Ao:Dn}o=s}this.dirty=Ao}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let o=e==1?Ao:od;n.dirty<o&&(n.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class zf extends Ei{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==sn&&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 sv extends Ei{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 Ko extends Ei{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=Yo.renderSpec(document,n.type.spec.toDOM(n,o),null,n.attrs)),new Ko(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Dn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Dn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=sn){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=sn}}slice(e,n,o){let r=Ko.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;n<s&&(i=Rl(i,n,s,o)),e>0&&(i=Rl(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 bo extends Ei{constructor(e,n,o,r,i,s,l,c,u){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,u=l&&l(n,i,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},o,r),d=u&&u.dom,p=u&&u.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:p}=Yo.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!p&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let f=d;return d=Kf(d,o,n),u?c=new av(e,n,o,r,d,p||null,f,u,i,s+1):n.isText?new da(e,n,o,r,d,f,i):new bo(e,n,o,r,d,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==sn&&e.eq(this.node)&&ys(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 cv(this,s&&s.node,e);pv(this.node,this.innerDeco,(u,d,p)=>{u.spec.marks?c.syncToMarks(u.spec.marks,o,e):u.type.side>=0&&!p&&c.syncToMarks(d==this.node.childCount?He.none:this.node.child(d).marks,o,e),c.placeWidget(u,e,r)},(u,d,p,f)=>{c.syncToMarks(u.marks,o,e);let h;c.findNodeMatch(u,d,p,f)||l&&e.state.selection.from>r&&e.state.selection.to<r+u.nodeSize&&(h=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(u,d,p,h,e)||c.updateNextNode(u,d,p,e,f,r)||c.addNode(u,d,p,e,r),r+=u.nodeSize}),c.syncToMarks([],o,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Ao)&&(s&&this.protectLocalComposition(e,s),Uf(this.contentDOM,this.children,e),fr&&fv(this.dom))}localCompositionInfo(e,n){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof ne)||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=hv(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 sv(this,i,n,r);e.input.compositionNodes.push(s),this.children=Rl(this.children,o,o+r.length,e,s)}update(e,n,o,r){return this.dirty==Dn||!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=sn}updateOuterDeco(e){if(ys(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=qf(this.dom,this.nodeDOM,Al(this.outerDeco,this.node,n),Al(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 rd(t,e,n,o,r){Kf(o,e,t);let i=new bo(void 0,t,e,n,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class da extends bo{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==Dn||this.dirty!=sn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=sn||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=sn,!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 da(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=Dn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Hf extends Ei{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==sn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class av extends bo{constructor(e,n,o,r,i,s,l,c,u,d){super(e,n,o,r,i,s,l,u,d),this.spec=c}update(e,n,o,r){if(this.dirty==Dn)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 Uf(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=id(o),r=!0;o=o.nextSibling}else r=!0,t.insertBefore(l,o);if(s instanceof Ko){let c=o?o.previousSibling:t.lastChild;Uf(s.contentDOM,s.children,n),o=c?c.nextSibling:t.firstChild}}for(;o;)o=id(o),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const Hr=function(t){t&&(this.nodeName=t)};Hr.prototype=Object.create(null);const Ro=[new Hr];function Al(t,e,n){if(t.length==0)return Ro;let o=n?Ro[0]:new Hr,r=[o];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&r.push(o=new Hr(s.nodeName));for(let l in s){let c=s[l];c!=null&&(n&&r.length==1&&r.push(o=new Hr(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 qf(t,e,n,o){if(n==Ro&&o==Ro)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=Ro[0]),r=c}lv(r,l||Ro[0],s)}return r}function lv(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 Kf(t,e,n){return qf(t,t,Ro,Al(e,n,t.nodeType!=1))}function ys(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 id(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class cv{constructor(e,n,o){this.lock=n,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=uv(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=sn,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 u=this.top.children[c];if(u.matchesMark(e[i])&&!this.isLocked(u.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=Ko.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 u=this.top.children[l];if(u.matchesNode(e,n,o)&&!this.preMatch.matched.has(u)){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==Dn&&s.dom==s.contentDOM&&(s.dirty=Ao),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 bo){let u=this.preMatch.matched.get(c);if(u!=null&&u!=i)return!1;let d=c.dom,p,f=this.isLocked(d)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=Dn&&ys(n,c.outerDeco));if(!f&&c.update(e,n,o,r))return this.destroyBetween(this.index,l),c.dom!=d&&(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=Ao,p.updateChildren(r,s+1),p.dirty=sn),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)||!ys(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=bo.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=bo.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 zf(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 Ko;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof da)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Bt||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 Hf(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 uv(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 u=n.children[o-1];if(u instanceof Ko)n=u,o=u.children.length;else{l=u,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 dv(t,e){return t.type.side-e.type.side}function pv(t,e,n,o){let r=e.locals(t),i=0;if(r.length==0){for(let u=0;u<t.childCount;u++){let d=t.child(u);o(d,r,e.forChild(i,d),u),i+=d.nodeSize}return}let s=0,l=[],c=null;for(let u=0;;){let d,p;for(;s<r.length&&r[s].to==i;){let b=r[s++];b.widget&&(d?(p||(p=[d])).push(b):d=b)}if(d)if(p){p.sort(dv);for(let b=0;b<p.length;b++)n(p[b],u,!!c)}else n(d,u,!!c);let f,h;if(c)h=-1,f=c,c=null;else if(u<t.childCount)h=u,f=t.child(u++);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 fv(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 hv(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 u=t.child(r++);if(i+=u.nodeSize,!u.isText)break;c+=u.text}if(i>=n){if(i>=o&&c.slice(o-e.length-l,o-l)==e)return o-e.length;let u=l<o?c.lastIndexOf(e,o-l-1):-1;if(u>=0&&u+e.length+l>=n)return l+u;if(n==o&&c.length>=o+e.length-l&&c.slice(o-l,o-l+e.length)==e)return o}}return-1}function Rl(t,e,n,o,r){let i=[];for(let s=0,l=0;s<t.length;s++){let c=t[s],u=l,d=l+=c.size;u>=n||d<=e?i.push(c):(u<e&&i.push(c.slice(0,e-u,o)),r&&(i.push(r),r=void 0),d>n&&i.push(c.slice(n-u,c.size,o)))}return i}function gc(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,u;if(ua(n)){for(c=s;r&&!r.node;)r=r.parent;let p=r.node;if(r&&p.isAtom&&oe.isSelectable(p)&&r.parent&&!(p.isInline&&Vy(n.focusNode,n.focusOffset,r.dom))){let f=r.posBefore;u=new oe(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 d=o.resolve(c);if(!u){let p=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;u=bc(t,d,l,p)}return u}function Wf(t){return t.editable?t.hasFocus():Gf(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Jn(t,e=!1){let n=t.state.selection;if(jf(t,n),!!Wf(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ct){let o=t.domSelectionRange(),r=t.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&qo(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)gv(t);else{let{anchor:o,head:r}=n,i,s;sd&&!(n instanceof ne)&&(n.$from.parent.inlineContent||(i=ad(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=ad(t,n.to))),t.docView.setSelection(o,r,t,e),sd&&(i&&ld(i),s&&ld(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&mv(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const sd=Bt||Ct&&Df<63;function ad(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(Bt&&r&&r.contentEditable=="false")return Wa(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return Wa(r);if(i)return Wa(i)}}function Wa(t){return t.contentEditable="true",Bt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function ld(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function mv(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(()=>{(!Wf(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function gv(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,vt(o)+1):n.setStart(o,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!r&&!t.state.selection.visible&&Vt&&go<=11&&(o.disabled=!0,o.disabled=!1)}function jf(t,e){if(e instanceof oe){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(cd(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else cd(t)}function cd(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function bc(t,e,n,o){return t.someProp("createSelectionBetween",r=>r(t,e,n))||ne.between(e,n,o)}function ud(t){return t.editable&&!t.hasFocus()?!1:Gf(t)}function Gf(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 bv(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return qo(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Bl(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&&ae.findFrom(i,e)}function io(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function dd(t,e,n){let o=t.state.selection;if(o instanceof ne)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 io(t,new ne(o.$anchor,s))}else if(o.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=Bl(t.state,e);return r&&r instanceof oe?io(t,r):!1}else if(!(on&&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?oe.isSelectable(i)?io(t,new oe(e<0?t.state.doc.resolve(r.pos-i.nodeSize):r)):wi?io(t,new ne(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof oe&&o.node.isInline)return io(t,new ne(e>0?o.$to:o.$from));{let r=Bl(t.state,e);return r?io(t,r):!1}}}function vs(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ur(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Zo(t,e){return e<0?yv(t):vv(t)}function yv(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r,i,s=!1;for(vn&&n.nodeType==1&&o<vs(n)&&Ur(n.childNodes[o],-1)&&(s=!0);;)if(o>0){if(n.nodeType!=1)break;{let l=n.childNodes[o-1];if(Ur(l,-1))r=n,i=--o;else if(l.nodeType==3)n=l,o=n.nodeValue.length;else break}}else{if(Yf(n))break;{let l=n.previousSibling;for(;l&&Ur(l,-1);)r=n.parentNode,i=vt(l),l=l.previousSibling;if(l)n=l,o=vs(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}s?Dl(t,n,o):r&&Dl(t,r,i)}function vv(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r=vs(n),i,s;for(;;)if(o<r){if(n.nodeType!=1)break;let l=n.childNodes[o];if(Ur(l,1))i=n,s=++o;else break}else{if(Yf(n))break;{let l=n.nextSibling;for(;l&&Ur(l,1);)i=l.parentNode,s=vt(l)+1,l=l.nextSibling;if(l)n=l,o=0,r=vs(n);else{if(n=n.parentNode,n==t.dom)break;o=r=0}}}i&&Dl(t,i,s)}function Yf(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function kv(t,e){for(;t&&e==t.childNodes.length&&!ki(t);)e=vt(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 wv(t,e){for(;t&&!e&&!ki(t);)e=vt(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 Dl(t,e,n){if(e.nodeType!=3){let i,s;(s=kv(e,n))?(e=s,n=0):(i=wv(e,n))&&(e=i,n=i.nodeValue.length)}let o=t.domSelection();if(!o)return;if(ua(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&&Jn(t)},50)}function pd(t,e){let n=t.state.doc.resolve(e);if(!(Ct||Uy)&&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 fd(t,e,n){let o=t.state.selection;if(o instanceof ne&&!o.empty||n.indexOf("s")>-1||on&&n.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Bl(t.state,e);if(s&&s instanceof oe)return io(t,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof Jt?ae.near(s,e):ae.findFrom(s,e);return l?io(t,l):!1}return!1}function hd(t,e){if(!(t.state.selection instanceof ne))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 md(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Ev(t){if(!Bt||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;md(t,o,"true"),setTimeout(()=>md(t,o,"false"),20)}return!1}function _v(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Cv(t,e){let n=e.keyCode,o=_v(e);if(n==8||on&&n==72&&o=="c")return hd(t,-1)||Zo(t,-1);if(n==46&&!e.shiftKey||on&&n==68&&o=="c")return hd(t,1)||Zo(t,1);if(n==13||n==27)return!0;if(n==37||on&&n==66&&o=="c"){let r=n==37?pd(t,t.state.selection.from)=="ltr"?-1:1:-1;return dd(t,r,o)||Zo(t,r)}else if(n==39||on&&n==70&&o=="c"){let r=n==39?pd(t,t.state.selection.from)=="ltr"?1:-1:1;return dd(t,r,o)||Zo(t,r)}else{if(n==38||on&&n==80&&o=="c")return fd(t,-1,o)||Zo(t,-1);if(n==40||on&&n==78&&o=="c")return Ev(t)||fd(t,1,o)||Zo(t,1);if(o==(on?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function yc(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")||Yo.fromSchema(t.state.schema),l=th(),c=l.createElement("div");c.appendChild(s.serializeFragment(o,{document:l}));let u=c.firstChild,d,p=0;for(;u&&u.nodeType==1&&(d=eh[u.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let m=l.createElement(d[h]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),p++}u=c.firstChild}u&&u.nodeType==1&&u.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 Jf(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=Yo.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=Tv(n),wi&&Ov(s);let u=s&&s.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let p=+d[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")||lr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||d),context:r,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Sv.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)l=Mv(gd(l,+d[1],+d[2]),d[4]);else if(l=V.maxOpen(xv(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=gd(l,p,f)}return t.someProp("transformPasted",p=>{l=p(l,t)}),l}const Sv=/^(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 xv(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),u;if(!c)return s=null;if(u=s.length&&i.length&&Zf(c,i,l,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=Qf(s[s.length-1],i.length));let d=Xf(l,c);s.push(d),r=r.matchType(d.type),i=c}}),s)return A.from(s)}return t}function Xf(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,A.from(t));return t}function Zf(t,e,n,o,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let i=Zf(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(Xf(n,t,r+1))))}}function Qf(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Qf(t.lastChild,e-1)),o=t.contentMatchAt(t.childCount).fillBefore(A.empty,!0);return t.copy(n.append(o))}function Il(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=Il(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 gd(t,e,n){return e<t.openStart&&(t=new V(Il(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new V(Il(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const eh={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 bd=null;function th(){return bd||(bd=document.implementation.createHTMLDocument("title"))}let ja=null;function Nv(t){let e=window.trustedTypes;return e?(ja||(ja=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),ja.createHTML(t)):t}function Tv(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=th().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t),r;if((r=o&&eh[o[1].toLowerCase()])&&(t=r.map(i=>"<"+i+">").join("")+t+r.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=Nv(t),r)for(let i=0;i<r.length;i++)n=n.querySelector(r[i])||n;return n}function Ov(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 Mv(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 Dt={},It={},Av={touchstart:!0,touchmove:!0};class Rv{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 Bv(t){for(let e in Dt){let n=Dt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=o=>{Iv(t,o)&&!vc(t,o)&&(t.editable||!(o.type in It))&&n(t,o)},Av[e]?{passive:!0}:void 0)}Bt&&t.dom.addEventListener("input",()=>null),Ll(t)}function ho(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Dv(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 Ll(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=o=>vc(t,o))})}function vc(t,e){return t.someProp("handleDOMEvents",n=>{let o=n[e.type];return o?o(t,e)||e.defaultPrevented:!1})}function Iv(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 Lv(t,e){!vc(t,e)&&Dt[e.type]&&(t.editable||!(e.type in It))&&Dt[e.type](t,e)}It.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!oh(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(jn&&Ct&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),fr&&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,Oo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",o=>o(t,n))||Cv(t,n)?n.preventDefault():ho(t,"key")};It.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};It.keypress=(t,e)=>{let n=e;if(oh(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||on&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let o=t.state.selection;if(!(o instanceof ne)||!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 pa(t){return{left:t.clientX,top:t.clientY}}function Pv(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}function kc(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 ur(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 $v(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),o=n.nodeAfter;return o&&o.isAtom&&oe.isSelectable(o)?(ur(t,new oe(n)),!0):!1}function Fv(t,e){if(e==-1)return!1;let n=t.state.selection,o,r;n instanceof oe&&(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(oe.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?(ur(t,oe.create(t.state.doc,r)),!0):!1}function Vv(t,e,n,o,r){return kc(t,"handleClickOn",e,n,o)||t.someProp("handleClick",i=>i(t,e,o))||(r?Fv(t,n):$v(t,n))}function zv(t,e,n,o){return kc(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",r=>r(t,e,o))}function Hv(t,e,n,o){return kc(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",r=>r(t,e,o))||Uv(t,n,o)}function Uv(t,e,n){if(n.button!=0)return!1;let o=t.state.doc;if(e==-1)return o.inlineContent?(ur(t,ne.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)ur(t,ne.create(o,l+1,l+1+s.content.size));else if(oe.isSelectable(s))ur(t,oe.create(o,l));else continue;return!0}}function wc(t){return ks(t)}const nh=on?"metaKey":"ctrlKey";Dt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=wc(t),r=Date.now(),i="singleClick";r-t.input.lastClick.time<500&&Pv(n,t.input.lastClick)&&!n[nh]&&(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(pa(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new qv(t,s,n,!!o)):(i=="doubleClick"?zv:Hv)(t,s.pos,s.inside,n)?n.preventDefault():ho(t,"pointer"))};class qv{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[nh],this.allowDefault=o.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let d=e.state.doc.resolve(n.pos);i=d.parent,s=d.depth?d.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:u}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof oe&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&vn&&!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)),ho(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(()=>Jn(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(pa(e))),this.updateAllowDefault(e),this.allowDefault||!n?ho(this.view,"pointer"):Vv(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Bt&&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)?(ur(this.view,ae.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ho(this.view,"pointer")}move(e){this.updateAllowDefault(e),ho(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)}}Dt.touchstart=t=>{t.input.lastTouch=Date.now(),wc(t),ho(t,"pointer")};Dt.touchmove=t=>{t.input.lastTouch=Date.now(),ho(t,"pointer")};Dt.contextmenu=t=>wc(t);function oh(t,e){return t.composing?!0:Bt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Kv=jn?5e3:-1;It.compositionstart=It.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ne&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),ks(t,!0),t.markCursor=null;else if(ks(t,!e.selection.empty),vn&&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}rh(t,Kv)};It.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++,rh(t,20))};function rh(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ks(t),e))}function ih(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=jv());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Wv(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=$y(e.focusNode,e.focusOffset),o=Fy(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 jv(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ks(t,e=!1){if(!(jn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ih(t),e||t.docView&&t.docView.dirty){let n=gc(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 Gv(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 si=Vt&&go<15||fr&&qy<604;Dt.copy=It.cut=(t,e)=>{let n=e,o=t.state.selection,r=n.type=="cut";if(o.empty)return;let i=si?null:n.clipboardData,s=o.content(),{dom:l,text:c}=yc(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",c)):Gv(t,l),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Yv(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Jv(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?ai(t,o.value,null,r,e):ai(t,o.textContent,o.innerHTML,r,e)},50)}function ai(t,e,n,o,r){let i=Jf(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=Yv(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 sh(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," "):""}It.paste=(t,e)=>{let n=e;if(t.composing&&!jn)return;let o=si?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;o&&ai(t,sh(o),o.getData("text/html"),r,n)?n.preventDefault():Jv(t,n)};class ah{constructor(e,n,o){this.slice=e,this.move=n,this.node=o}}const lh=on?"altKey":"ctrlKey";Dt.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(pa(n)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof oe?r.to-1:r.to))){if(o&&o.mightDrag)s=oe.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=oe.create(t.state.doc,p.posBefore))}}let l=(s||t.state.selection).content(),{dom:c,text:u,slice:d}=yc(t,l);(!n.dataTransfer.files.length||!Ct||Df>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(si?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",si||n.dataTransfer.setData("text/plain",u),t.dragging=new ah(d,!n[lh],s)};Dt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};It.dragover=It.dragenter=(t,e)=>e.preventDefault();It.drop=(t,e)=>{let n=e,o=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let r=t.posAtCoords(pa(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=Jf(t,sh(n.dataTransfer),si?null:n.dataTransfer.getData("text/html"),!1,i);let l=!!(o&&!n[lh]);if(t.someProp("handleDrop",m=>m(t,n,s||V.empty,l))){n.preventDefault();return}if(!s)return;n.preventDefault();let c=s?Sf(t.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let u=t.state.tr;if(l){let{node:m}=o;m?m.replace(u):u.deleteSelection()}let d=u.mapping.map(c),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=u.doc;if(p?u.replaceRangeWith(d,d,s.content.firstChild):u.replaceRange(d,d,s),u.doc.eq(f))return;let h=u.doc.resolve(d);if(p&&oe.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new oe(h));else{let m=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((g,b,y,k)=>m=k),u.setSelection(bc(t,h,u.doc.resolve(m)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))};Dt.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())&&Jn(t)},20))};Dt.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)};Dt.beforeinput=(t,e)=>{if(Ct&&jn&&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,Oo(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 It)Dt[t]=It[t];function li(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 ws{constructor(e,n){this.toDOM=e,this.spec=n||Po,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 Ge(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof ws&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&li(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class yo{constructor(e,n){this.attrs=e,this.spec=n||Po}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 Ge(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof yo&&li(this.attrs,e.attrs)&&li(this.spec,e.spec)}static is(e){return e.type instanceof yo}destroy(){}}class Ec{constructor(e,n){this.attrs=e,this.spec=n||Po}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 Ge(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 Ec&&li(this.attrs,e.attrs)&&li(this.spec,e.spec)}destroy(){}}class Ge{constructor(e,n,o){this.from=e,this.to=n,this.type=o}copy(e,n){return new Ge(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 Ge(e,e,new ws(n,o))}static inline(e,n,o,r){return new Ge(e,n,new yo(o,r))}static node(e,n,o,r){return new Ge(e,n,new Ec(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof yo}get widget(){return this.type instanceof ws}}const nr=[],Po={};class Ne{constructor(e,n){this.local=e.length?e:nr,this.children=n.length?n:nr}static create(e,n){return n.length?Es(n,e,0,Po):_t}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==_t||e.maps.length==0?this:this.mapInner(e,n,0,0,o||Po)}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?Xv(this.children,s||[],e,n,o,r,i):s?new Ne(s.sort($o),nr):_t}add(e,n){return n.length?this==_t?Ne.create(e,n):this.addInner(e,n,0):this}addInner(e,n,o){let r,i=0;e.forEach((l,c)=>{let u=c+o,d;if(d=uh(n,l,u)){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,d,u+1):r.splice(i,0,c,c+l.nodeSize,Es(d,l,u+1,Po)),i+=3}});let s=ch(i?dh(n):n,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new Ne(s.length?this.local.concat(s).sort($o):this.local,r||this.children)}remove(e){return e.length==0||this==_t?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 d=0,p;d<e.length;d++)(p=e[d])&&p.from>l&&p.to<c&&(e[d]=null,(s||(s=[])).push(p));if(!s)continue;o==this.children&&(o=this.children.slice());let u=o[i+2].removeInner(s,l+1);u!=_t?o[i+2]=u:(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 Ne(r,o):_t}forChild(e,n){if(this==_t)return this;if(n.isLeaf)return Ne.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 yo){let u=Math.max(i,c.from)-i,d=Math.min(s,c.to)-i;u<d&&(r||(r=[])).push(c.copy(u,d))}}if(r){let l=new Ne(r.sort($o),nr);return o?new lo([l,o]):l}return o||_t}eq(e){if(this==e)return!0;if(!(e instanceof Ne)||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 _c(this.localsInner(e))}localsInner(e){if(this==_t)return nr;if(e.inlineContent||!this.local.some(yo.is))return this.local;let n=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof yo||n.push(this.local[o]);return n}forEachSet(e){e(this)}}Ne.empty=new Ne([],[]);Ne.removeOverlap=_c;const _t=Ne.empty;class lo{constructor(e){this.members=e}map(e,n){const o=this.members.map(r=>r.map(e,n,Po));return lo.from(o)}forChild(e,n){if(n.isLeaf)return Ne.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,n);i!=_t&&(i instanceof lo?o=o.concat(i.members):o.push(i))}return lo.from(o)}eq(e){if(!(e instanceof lo)||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?_c(o?n:n.sort($o)):nr}static from(e){switch(e.length){case 0:return _t;case 1:return e[0];default:return new lo(e.every(n=>n instanceof Ne)?e:e.reduce((n,o)=>n.concat(o instanceof Ne?o:o.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Xv(t,e,n,o,r,i,s){let l=t.slice();for(let u=0,d=i;u<n.maps.length;u++){let p=0;n.maps[u].forEach((f,h,m,g)=>{let b=g-m-(h-f);for(let y=0;y<l.length;y+=3){let k=l[y+1];if(k<0||f>k+d-p)continue;let E=l[y]+d-p;h>=E?l[y+1]=f<=E?-2:-1:f>=d&&b&&(l[y]+=b,l[y+1]+=b)}p+=b}),d=n.maps[u].map(d,-1)}let c=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){c=!0,l[u+1]=-1;continue}let d=n.map(t[u]+i),p=d-r;if(p<0||p>=o.content.size){c=!0;continue}let f=n.map(t[u+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[u+2].mapInner(n,b,d+1,t[u]+i+1,s);y!=_t?(l[u]=p,l[u+1]=h,l[u+2]=y):(l[u+1]=-2,c=!0)}else c=!0}if(c){let u=Zv(l,t,e,n,r,i,s),d=Es(u,o,0,s);e=d.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<d.children.length;p+=3){let h=d.children[p];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,d.children[p],d.children[p+1],d.children[p+2])}}return new Ne(e.sort($o),l)}function ch(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 Ge(r.from+e,r.to+e,r.type))}return n}function Zv(t,e,n,o,r,i,s){function l(c,u){for(let d=0;d<c.local.length;d++){let p=c.local[d].map(o,r,u);p?n.push(p):s.onRemove&&s.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)l(c.children[d+2],c.children[d]+u+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 uh(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 dh(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Es(t,e,n,o){let r=[],i=!1;e.forEach((l,c)=>{let u=uh(t,l,c+n);if(u){i=!0;let d=Es(u,l,n+c+1,o);d!=_t&&r.push(c,c+l.nodeSize,d)}});let s=ch(i?dh(t):t,-n).sort($o);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 Ne(s,r):_t}function $o(t,e){return t.from-e.from||t.to-e.to}function _c(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),yd(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),yd(e,r,o.copy(i.from,o.to)));break}}}return e}function yd(t,e,n){for(;e<t.length&&$o(n,t[e])>0;)e++;t.splice(e,0,n)}function Ga(t){let e=[];return t.someProp("decorations",n=>{let o=n(t.state);o&&o!=_t&&e.push(o)}),t.cursorWrapper&&e.push(Ne.create(t.state.doc,[t.cursorWrapper.deco])),lo.from(e)}const Qv={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ek=Vt&&go<=11;class tk{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 nk{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new tk,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]);Vt&&go<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),ek&&(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,Qv)),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(ud(this.view)){if(this.suppressingSelectionUpdates)return Jn(this.view);if(Vt&&go<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&qo(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=ii(i))n.add(i);for(let i=e.anchorNode;i;i=ii(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)&&ud(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,l=!1,c=[];if(e.editable)for(let d=0;d<n.length;d++){let p=this.registerMutation(n[d],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(vn&&c.length){let d=c.filter(p=>p.nodeName=="BR");if(d.length==2){let[p,f]=d;p.parentNode&&p.parentNode.parentNode==f.parentNode?f.remove():p.remove()}else{let{focusNode:p}=this.currentSelection;for(let f of d){let h=f.parentNode;h&&h.nodeName=="LI"&&(!p||ik(e,p)!=h)&&f.remove()}}}let u=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ua(o)&&(u=gc(e))&&u.eq(ae.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Jn(e),this.currentSelection.set(o)):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),ok(e)),this.handleDOMChange(i,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||Jn(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 d=0;d<e.addedNodes.length;d++){let p=e.addedNodes[d];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(Vt&&go<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:p,nextSibling:f}=e.addedNodes[d];(!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?vt(r)+1:0,l=o.localPosFromDOM(e.target,s,-1),c=i&&i.parentNode==e.target?vt(i):e.target.childNodes.length,u=o.localPosFromDOM(e.target,c,1);return{from:l,to:u}}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 vd=new WeakMap,kd=!1;function ok(t){if(!vd.has(t)&&(vd.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=vn,kd)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."),kd=!0}}function wd(t,e){let n=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return qo(s.node,s.offset,r,i)&&([n,o,r,i]=[r,i,n,o]),{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}}function rk(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return wd(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?wd(t,n):null}function ik(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 sk(t,e,n){let{node:o,fromOffset:r,toOffset:i,from:s,to:l}=t.docView.parseRange(e,n),c=t.domSelectionRange(),u,d=c.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:c.anchorOffset}],ua(c)||u.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],k=y.pmViewDesc;if(y.nodeName=="BR"&&!k){i=b;break}if(!k||k.size)break}let p=t.state.doc,f=t.someProp("domParser")||lr.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:u,ruleFromNode:ak,context:h});if(u&&u[0].pos!=null){let b=u[0].pos,y=u[1]&&u[1].pos;y==null&&(y=b),m={anchor:b+s,head:y+s}}return{doc:g,sel:m,from:s,to:l}}function ak(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Bt&&/^(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||Bt&&/^(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 lk=/^(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 ck(t,e,n,o,r){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let N=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=gc(t,N);if(M&&!t.state.selection.eq(M)){if(Ct&&jn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",G=>G(t,Oo(13,"Enter"))))return;let z=t.state.tr.setSelection(M);N=="pointer"?z.setMeta("pointer",!0):N=="key"&&z.scrollIntoView(),i&&z.setMeta("composition",i),t.dispatch(z)}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,u=sk(t,e,n),d=t.state.doc,p=d.slice(u.from,u.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=pk(p.content,u.doc.content,u.from,f,h);if(m&&t.input.domChangeCount++,(fr&&t.input.lastIOSEnter>Date.now()-225||jn)&&r.some(N=>N.nodeType==1&&!lk.test(N.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",N=>N(t,Oo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof ne&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(u.sel){let N=Ed(t,t.state.doc,u.sel);if(N&&!N.eq(t.state.selection)){let M=t.state.tr.setSelection(N);i&&M.setMeta("composition",i),t.dispatch(M)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof ne&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Vt&&go<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)==" "&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),b=u.doc.resolveNoCache(m.endB-u.from),y=d.resolve(m.start),k=g.sameParent(b)&&g.parent.inlineContent&&y.end()>=m.endA,E;if((fr&&t.input.lastIOSEnter>Date.now()-225&&(!k||r.some(N=>N.nodeName=="DIV"||N.nodeName=="P"))||!k&&g.pos<u.doc.content.size&&!g.sameParent(b)&&(E=ae.findFrom(u.doc.resolve(g.pos+1),1,!0))&&E.head==b.pos)&&t.someProp("handleKeyDown",N=>N(t,Oo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&dk(d,m.start,m.endA,g,b)&&t.someProp("handleKeyDown",N=>N(t,Oo(8,"Backspace")))){jn&&Ct&&t.domObserver.suppressSelectionUpdates();return}Ct&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),jn&&!k&&g.start()!=b.start()&&b.parentOffset==0&&g.depth==b.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,b=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(N){return N(t,Oo(13,"Enter"))})},20));let v=m.start,C=m.endA,_,R,B;if(k){if(g.pos==b.pos)Vt&&go<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Jn(t),20)),_=t.state.tr.delete(v,C),R=d.resolve(m.start).marksAcross(d.resolve(m.endA));else if(m.endA==m.endB&&(B=uk(g.parent.content.cut(g.parentOffset,b.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start()))))_=t.state.tr,B.type=="add"?_.addMark(v,C,B.mark):_.removeMark(v,C,B.mark);else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let N=g.parent.textBetween(g.parentOffset,b.parentOffset);if(t.someProp("handleTextInput",M=>M(t,v,C,N)))return;_=t.state.tr.insertText(N,v,C)}}if(_||(_=t.state.tr.replace(v,C,u.doc.slice(m.start-u.from,m.endB-u.from))),u.sel){let N=Ed(t,_.doc,u.sel);N&&!(Ct&&t.composing&&N.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==v||N.head==_.mapping.map(C)-1)||Vt&&N.empty&&N.head==v)&&_.setSelection(N)}R&&_.ensureMarks(R),i&&_.setMeta("composition",i),t.dispatch(_.scrollIntoView())}function Ed(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:bc(t,e.resolve(n.anchor),e.resolve(n.head))}function uk(t,e){let n=t.firstChild.marks,o=e.firstChild.marks,r=n,i=o,s,l,c;for(let d=0;d<o.length;d++)r=o[d].removeFromSet(r);for(let d=0;d<n.length;d++)i=n[d].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],s="add",c=d=>d.mark(l.addToSet(d.marks));else if(r.length==0&&i.length==1)l=i[0],s="remove",c=d=>d.mark(l.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(c(e.child(d)));if(A.from(u).eq(t))return{mark:l,type:s}}function dk(t,e,n,o,r){if(n-e<=r.pos-o.pos||Ya(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(Ya(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Ya(s,!0,!1)<n?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function Ya(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 pk(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&&_d(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&&_d(t.textBetween(i-1,i+1))&&(i+=c?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function _d(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 fk{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 Rv,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Td),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=xd(this),Sd(this),this.nodeViews=Nd(this),this.docView=rd(this.state.doc,Cd(this),Ga(this),this.dom,this),this.domObserver=new nk(this,(o,r,i,s)=>ck(this,o,r,i,s)),this.domObserver.start(),Bv(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&&Ll(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Td),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&&(ih(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=Nd(this);mk(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ll(this),this.editable=xd(this),Sd(this);let c=Ga(this),u=Cd(this),d=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",p=i||!this.docView.matchesNode(e.doc,u,c);(p||!e.selection.eq(r.selection))&&(s=!0);let f=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&jy(this);if(s){this.domObserver.stop();let h=p&&(Vt||Ct)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&hk(r.selection,e.selection);if(p){let m=Ct?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Wv(this)),(i||!this.docView.update(e.doc,u,c,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=rd(e.doc,u,c,this.dom,this)),m&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&bv(this))?Jn(this,h):(jf(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),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&Gy(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 oe){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Zu(this,n.getBoundingClientRect(),e)}else Zu(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 ah(e.slice,e.move,r<0?void 0:oe.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(Vt){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&&Yy(this.dom),Jn(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 ev(this,e)}coordsAtPos(e,n=1){return Ff(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 iv(this,n||this.state,e)}pasteHTML(e,n){return ai(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ai(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return yc(this,e)}destroy(){this.docView&&(Dv(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ga(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Ly())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Lv(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?Bt&&this.root.nodeType===11&&zy(this.dom.ownerDocument)==this.dom&&rk(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Cd(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"),[Ge.node(0,t.state.doc.content.size,e)]}function Sd(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:Ge.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function xd(t){return!t.someProp("editable",e=>e(t.state)===!1)}function hk(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 Nd(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 mk(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 Td(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")}var vo={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:"'"},_s={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},gk=typeof navigator<"u"&&/Mac/.test(navigator.platform),bk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var kt=0;kt<10;kt++)vo[48+kt]=vo[96+kt]=String(kt);for(var kt=1;kt<=24;kt++)vo[kt+111]="F"+kt;for(var kt=65;kt<=90;kt++)vo[kt]=String.fromCharCode(kt+32),_s[kt]=String.fromCharCode(kt);for(var Ja in vo)_s.hasOwnProperty(Ja)||(_s[Ja]=vo[Ja]);function yk(t){var e=gk&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||bk&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?_s:vo)[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 vk=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function kk(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))vk?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 wk(t){let e=Object.create(null);for(let n in t)e[kk(n)]=t[n];return e}function Xa(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 Ek(t){return new Ae({props:{handleKeyDown:Cc(t)}})}function Cc(t){let e=wk(t);return function(n,o){let r=yk(o),i,s=e[Xa(r,o)];if(s&&s(n.state,n.dispatch,n))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[Xa(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=vo[o.keyCode])&&i!=r){let l=e[Xa(i,o)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const Sc=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function ph(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const fh=(t,e,n)=>{let o=ph(t,n);if(!o)return!1;let r=xc(o);if(!r){let s=o.blockRange(),l=s&&_r(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(Eh(t,r,e,-1))return!0;if(o.parent.content.size==0&&(hr(i,"end")||oe.isSelectable(i)))for(let s=o.depth;;s--){let l=la(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(hr(i,"end")?ae.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):oe.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},_k=(t,e,n)=>{let o=ph(t,n);if(!o)return!1;let r=xc(o);return r?hh(t,r,e):!1},Ck=(t,e,n)=>{let o=gh(t,n);if(!o)return!1;let r=Nc(o);return r?hh(t,r,e):!1};function hh(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 d=r.lastChild;if(!d)return!1;r=d}let s=e.nodeAfter,l=s,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let u=la(t.doc,i,c,V.empty);if(!u||u.from!=i||u instanceof pt&&u.slice.size>=c-i)return!1;if(n){let d=t.tr.step(u);d.setSelection(ne.create(d.doc,i)),n(d.scrollIntoView())}return!0}function hr(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 mh=(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=xc(o)}let s=i&&i.nodeBefore;return!s||!oe.isSelectable(s)?!1:(e&&e(t.tr.setSelection(oe.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function xc(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 gh(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const bh=(t,e,n)=>{let o=gh(t,n);if(!o)return!1;let r=Nc(o);if(!r)return!1;let i=r.nodeAfter;if(Eh(t,r,e,1))return!0;if(o.parent.content.size==0&&(hr(i,"start")||oe.isSelectable(i))){let s=la(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(hr(i,"start")?ae.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):oe.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},yh=(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=Nc(o)}let s=i&&i.nodeAfter;return!s||!oe.isSelectable(s)?!1:(e&&e(t.tr.setSelection(oe.create(t.doc,i.pos)).scrollIntoView()),!0)};function Nc(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 Sk=(t,e)=>{let n=t.selection,o=n instanceof oe,r;if(o){if(n.node.isTextblock||!wo(t.doc,n.from))return!1;r=n.from}else if(r=aa(t.doc,n.from,-1),r==null)return!1;if(e){let i=t.tr.join(r);o&&i.setSelection(oe.create(i.doc,r-t.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},xk=(t,e)=>{let n=t.selection,o;if(n instanceof oe){if(n.node.isTextblock||!wo(t.doc,n.to))return!1;o=n.to}else if(o=aa(t.doc,n.to,1),o==null)return!1;return e&&e(t.tr.join(o).scrollIntoView()),!0},Nk=(t,e)=>{let{$from:n,$to:o}=t.selection,r=n.blockRange(o),i=r&&_r(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},vh=(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 Tc(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 Tk=(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=Tc(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(ae.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},kh=(t,e)=>{let n=t.selection,{$from:o,$to:r}=n;if(n instanceof Jt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=Tc(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(ne.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},wh=(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(Yn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let o=n.blockRange(),r=o&&_r(o);return r==null?!1:(e&&e(t.tr.lift(o,r).scrollIntoView()),!0)};function Ok(t){return(e,n)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof oe&&e.selection.node.isBlock)return!o.parentOffset||!Yn(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,u=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){c=o.end(h)==o.pos+(o.depth-h),u=o.start(h)==o.pos-(o.depth-h),l=Tc(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 d=e.tr;(e.selection instanceof ne||e.selection instanceof Jt)&&d.deleteSelection();let p=d.mapping.map(o.pos),f=Yn(d.doc,p,i.length,i);if(f||(i[0]=l?{type:l}:null,f=Yn(d.doc,p,i.length,i)),d.split(p,i.length,i),!c&&u&&o.node(s).type!=l){let h=d.mapping.map(o.before(s)),m=d.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&d.setNodeMarkup(d.mapping.map(o.before(s)),l)}return n&&n(d.scrollIntoView()),!0}}const Mk=Ok(),Ak=(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(oe.create(t.doc,r))),!0)};function Rk(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||wo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Eh(t,e,n,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,c=r.type.spec.isolating||i.type.spec.isolating;if(!c&&Rk(t,e,n))return!0;let u=!c&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(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 ft(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&&wo(g.doc,b.pos)&&g.join(b.pos),n(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||o>0&&c?null:ae.findFrom(e,1),p=d&&d.$from.blockRange(d.$to),f=p&&_r(p);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(p,f).scrollIntoView()),!0;if(u&&hr(i,"start",!0)&&hr(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 E=m.length-1;E>=0;E--)y=A.from(m[E].copy(y));let k=t.tr.step(new ft(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(k.scrollIntoView())}return!0}}return!1}function _h(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(ne.create(e.doc,t<0?r.start(i):r.end(i)))),!0):!1}}const Bk=_h(-1),Dk=_h(1);function Ik(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i),l=s&&pc(s,t,e);return l?(o&&o(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Od(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,u)=>{if(r)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)r=!0;else{let d=n.doc.resolve(u),p=d.index();r=d.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 Oc(...t){return function(e,n,o){for(let r=0;r<t.length;r++)if(t[r](e,n,o))return!0;return!1}}Oc(Sc,fh,mh);Oc(Sc,bh,yh);Oc(vh,kh,wh,Mk);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Lk(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 Pk(l,s,t,e)?(o&&o(l.scrollIntoView()),!0):!1}}function Pk(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 gs(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new gs(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=pc(i,n,o,e);return l?(t&&$k(t,e,l,r,n),!0):!1}function $k(t,e,n,o,r){let i=A.empty;for(let d=n.length-1;d>=0;d--)i=A.from(n[d].type.create(n[d].attrs,i));t.step(new ft(e.start-(o?2:0),e.end,e.start,e.end,new V(i,0,0),n.length,!0));let s=0;for(let d=0;d<n.length;d++)n[d].type==r&&(s=d+1);let l=n.length-s,c=e.start+n.length-(o?2:0),u=e.parent;for(let d=e.startIndex,p=e.endIndex,f=!0;d<p;d++,f=!1)!f&&Yn(t.doc,c,l)&&(t.split(c,l),c+=2*l),c+=u.child(d).nodeSize;return t}function Fk(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?Vk(e,n,t,i):zk(e,n,i):!0:!1}}function Vk(t,e,n,o){let r=t.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new ft(i-1,s,i,s,new V(A.from(n.create(null,o.parent.copy())),1,0),1,!0)),o=new gs(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=_r(o);if(l==null)return!1;r.lift(o,l);let c=r.doc.resolve(r.mapping.map(i,-1)-1);return wo(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function zk(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,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(l?0:1),d+1,s.content.append(c?A.empty:A.from(r))))return!1;let p=i.pos,f=p+s.nodeSize;return o.step(new ft(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 Hk(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,u=>u.childCount>0&&u.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 u=c.lastChild&&c.lastChild.type==l.type,d=A.from(u?t.create():null),p=new V(A.from(t.create(null,A.from(l.type.create(null,d)))),u?3:1,0),f=i.start,h=i.end;n(e.tr.step(new ft(f-(u?3:1),h,f,h,p,1,!0)).scrollIntoView())}return!0}}function fa(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 ha{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,(...d)=>{const p=c(...d)(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,u=e||i.tr,d=()=>(!c&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),l.every(f=>f===!0)),p={...Object.fromEntries(Object.entries(o).map(([f,h])=>[f,(...g)=>{const b=this.buildProps(u,n),y=h(...g)(b);return l.push(y),p}])),run:d};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,u])=>[c,(...d)=>u(...d)({...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:fa({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,u])=>[c,(...d)=>u(...d)(l)]))}};return l}}class Uk{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 j(t,e,n){return t.config[e]===void 0&&t.parent?j(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?j(t.parent,e,n):null}):t.config[e]}function ma(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 Ch(t){const e=[],{nodeExtensions:n,markExtensions:o}=ma(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=j(s,"addGlobalAttributes",l);if(!c)return;c().forEach(d=>{d.types.forEach(p=>{Object.entries(d.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=j(s,"addAttributes",l);if(!c)return;const u=c();Object.entries(u).forEach(([d,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:d,attribute:f})})}),e}function mt(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 _e(...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(" "):[],u=l.filter(d=>!c.includes(d));o[r]=[...c,...u].join(" ")}else if(r==="style"){const l=i?i.split(";").map(d=>d.trim()).filter(Boolean):[],c=o[r]?o[r].split(";").map(d=>d.trim()).filter(Boolean):[],u=new Map;c.forEach(d=>{const[p,f]=d.split(":").map(h=>h.trim());u.set(p,f)}),l.forEach(d=>{const[p,f]=d.split(":").map(h=>h.trim());u.set(p,f)}),o[r]=Array.from(u.entries()).map(([d,p])=>`${d}: ${p}`).join("; ")}else o[r]=i}),o},{})}function Pl(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)=>_e(n,o),{})}function Sh(t){return typeof t=="function"}function ve(t,e=void 0,...n){return Sh(t)?e?t.bind(e)(...n):t(...n):t}function qk(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Kk(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Md(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):Kk(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...o,...r}}}}function Ad(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&qk(n)?!1:n!=null))}function xh(t,e){var n;const o=Ch(t),{nodeExtensions:r,markExtensions:i}=ma(t),s=(n=r.find(u=>j(u,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(r.map(u=>{const d=o.filter(y=>y.type===u.name),p={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((y,k)=>{const E=j(k,"extendNodeSchema",p);return{...y,...E?E(u):{}}},{}),h=Ad({...f,content:ve(j(u,"content",p)),marks:ve(j(u,"marks",p)),group:ve(j(u,"group",p)),inline:ve(j(u,"inline",p)),atom:ve(j(u,"atom",p)),selectable:ve(j(u,"selectable",p)),draggable:ve(j(u,"draggable",p)),code:ve(j(u,"code",p)),whitespace:ve(j(u,"whitespace",p)),linebreakReplacement:ve(j(u,"linebreakReplacement",p)),defining:ve(j(u,"defining",p)),isolating:ve(j(u,"isolating",p)),attrs:Object.fromEntries(d.map(y=>{var k;return[y.name,{default:(k=y==null?void 0:y.attribute)===null||k===void 0?void 0:k.default}]}))}),m=ve(j(u,"parseHTML",p));m&&(h.parseDOM=m.map(y=>Md(y,d)));const g=j(u,"renderHTML",p);g&&(h.toDOM=y=>g({node:y,HTMLAttributes:Pl(y,d)}));const b=j(u,"renderText",p);return b&&(h.toText=b),[u.name,h]})),c=Object.fromEntries(i.map(u=>{const d=o.filter(b=>b.type===u.name),p={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((b,y)=>{const k=j(y,"extendMarkSchema",p);return{...b,...k?k(u):{}}},{}),h=Ad({...f,inclusive:ve(j(u,"inclusive",p)),excludes:ve(j(u,"excludes",p)),group:ve(j(u,"group",p)),spanning:ve(j(u,"spanning",p)),code:ve(j(u,"code",p)),attrs:Object.fromEntries(d.map(b=>{var y;return[b.name,{default:(y=b==null?void 0:b.attribute)===null||y===void 0?void 0:y.default}]}))}),m=ve(j(u,"parseHTML",p));m&&(h.parseDOM=m.map(b=>Md(b,d)));const g=j(u,"renderHTML",p);return g&&(h.toDOM=b=>g({mark:b,HTMLAttributes:Pl(b,d)})),[u.name,h]}));return new hf({topNode:s,nodes:l,marks:c})}function Za(t,e){return e.nodes[t]||e.marks[t]||null}function Rd(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Mc(t,e){const n=Yo.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const Wk=(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,u;const d=((u=(c=r.type.spec).toText)===null||u===void 0?void 0:u.call(c,{node:r,pos:i,parent:s,index:l}))||r.textContent||"%leaf%";n+=r.isAtom&&!r.isText?d:d.slice(0,Math.max(0,o-i))}),n};function Ac(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class _i{constructor(e){this.find=e.find,this.handler=e.handler}}const jk=(t,e)=>{if(Ac(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 Di(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 u=c.state.doc.resolve(o);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let d=!1;const p=Wk(u)+i;return s.forEach(f=>{if(d)return;const h=jk(p,f.find);if(!h)return;const m=c.state.tr,g=fa({state:c.state,transaction:m}),b={from:o-(h[0].length-i.length),to:r},{commands:y,chain:k,can:E}=new ha({editor:n,state:g});f.handler({state:g,range:b,match:h,commands:y,chain:k,can:E})===null||!m.steps.length||(m.setMeta(l,{transform:m,from:o,to:r,text:i}),c.dispatch(m),d=!0)}),d}function Gk(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:d}=c;typeof d=="string"?d=d:d=Mc(A.from(d),s.schema);const{from:p}=c,f=p+d.length;Di({editor:e,from:p,to:f,text:d,rules:n,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,l){return Di({editor:e,from:i,to:s,text:l,rules:n,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&Di({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?Di({editor:e,from:s.pos,to:s.pos,text:`
|
|
14
|
+
`,rules:n,plugin:o}):!1}},isInputRules:!0});return o}function Yk(t){return Object.prototype.toString.call(t).slice(8,-1)}function Ii(t){return Yk(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function ga(t,e){const n={...t};return Ii(t)&&Ii(e)&&Object.keys(e).forEach(o=>{Ii(e[o])&&Ii(t[o])?n[o]=ga(t[o],e[o]):n[o]=e[o]}),n}class ln{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=ve(j(this,"addOptions",{name:this.name}))),this.storage=ve(j(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ln(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ga(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new ln(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=ve(j(n,"addOptions",{name:n.name})),n.storage=ve(j(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(u=>(u==null?void 0:u.type.name)===n.name))return!1;const c=s.find(u=>(u==null?void 0:u.type.name)===n.name);return c&&o.removeStoredMark(c),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}}function Jk(t){return typeof t=="number"}class Xk{constructor(e){this.find=e.find,this.handler=e.handler}}const Zk=(t,e,n)=>{if(Ac(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 Qk(t){const{editor:e,state:n,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:c,chain:u,can:d}=new ha({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,"");Zk(y,i.find,s).forEach(E=>{if(E.index===void 0)return;const v=g+E.index+1,C=v+E[0].length,_={from:n.tr.mapping.map(v),to:n.tr.mapping.map(C)},R=i.handler({state:n,range:_,match:E,commands:c,chain:u,can:d,pasteEvent:s,dropEvent:l});p.push(R)})}),p.every(h=>h!==null)}let Li=null;const ew=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 tw(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:d,from:p,to:f,rule:h,pasteEvt:m})=>{const g=d.tr,b=fa({state:d,transaction:g});if(!(!Qk({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(d=>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&&(Li=e)},h=()=>{Li&&(Li=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=Li;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"),k=!!y;if(!g&&!b&&!k)return;if(k){let{text:C}=y;typeof C=="string"?C=C:C=Mc(A.from(C),h.schema);const{from:_}=y,R=_+C.length,B=ew(C);return c({rule:d,state:h,from:_,to:{b:R},pasteEvt:B})}const E=f.doc.content.findDiffStart(h.doc.content),v=f.doc.content.findDiffEnd(h.doc.content);if(!(!Jk(E)||!v||E===v.b))return c({rule:d,state:h,from:E,to:v,pasteEvt:s})}}))}function nw(t){const e=t.filter((n,o)=>t.indexOf(n)!==o);return Array.from(new Set(e))}class Bo{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Bo.resolve(e),this.schema=xh(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Bo.sort(Bo.flatten(e)),o=nw(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=j(n,"addExtensions",o);return r?[n,...this.flatten(r())]:n}).flat(10)}static sort(e){return e.sort((o,r)=>{const i=j(o,"priority")||100,s=j(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:Za(n.name,this.schema)},r=j(n,"addCommands",o);return r?{...e,...r()}:e},{})}get plugins(){const{editor:e}=this,n=Bo.sort([...this.extensions].reverse()),o=[],r=[],i=n.map(s=>{const l={name:s.name,options:s.options,storage:s.storage,editor:e,type:Za(s.name,this.schema)},c=[],u=j(s,"addKeyboardShortcuts",l);let d={};if(s.type==="mark"&&j(s,"exitable",l)&&(d.ArrowRight=()=>ln.handleExit({editor:e,mark:s})),u){const g=Object.fromEntries(Object.entries(u()).map(([b,y])=>[b,()=>y({editor:e})]));d={...d,...g}}const p=Ek(d);c.push(p);const f=j(s,"addInputRules",l);Rd(s,e.options.enableInputRules)&&f&&o.push(...f());const h=j(s,"addPasteRules",l);Rd(s,e.options.enablePasteRules)&&h&&r.push(...h());const m=j(s,"addProseMirrorPlugins",l);if(m){const g=m();c.push(...g)}return c}).flat();return[Gk({editor:e,rules:o}),...tw({editor:e,rules:r}),...i]}get attributes(){return Ch(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=ma(this.extensions);return Object.fromEntries(n.filter(o=>!!j(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:mt(o.name,this.schema)},s=j(o,"addNodeView",i);if(!s)return[];const l=(c,u,d,p,f)=>{const h=Pl(c,r);return s()({node:c,view:u,getPos:d,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:Za(e.name,this.schema)};e.type==="mark"&&(!((n=ve(j(e,"keepOnSplit",o)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const r=j(e,"onBeforeCreate",o),i=j(e,"onCreate",o),s=j(e,"onUpdate",o),l=j(e,"onSelectionUpdate",o),c=j(e,"onTransaction",o),u=j(e,"onFocus",o),d=j(e,"onBlur",o),p=j(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),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),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=ve(j(this,"addOptions",{name:this.name}))),this.storage=ve(j(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new De(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ga(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=ve(j(n,"addOptions",{name:n.name})),n.storage=ve(j(n,"addStorage",{name:n.name,options:n.options})),n}}function Nh(t,e,n){const{from:o,to:r}=e,{blockSeparator:i=`
|
|
15
|
+
|
|
16
|
+
`,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(o,r,(c,u,d,p)=>{var f;c.isBlock&&u>o&&(l+=i);const h=s==null?void 0:s[c.type.name];if(h)return d&&(l+=h({node:c,pos:u,parent:d,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,u)-u,r-u))}),l}function Rc(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const ow=De.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ae({key:new xe("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(d=>d.$from.pos)),l=Math.max(...i.map(d=>d.$to.pos)),c=Rc(n);return Nh(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),rw=()=>({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),iw=(t=!1)=>({commands:e})=>e.setContent("",t),sw=()=>({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:u,mapping:d}=e,p=u.resolve(d.map(c)),f=u.resolve(d.map(c+l.nodeSize)),h=p.blockRange(f);if(!h)return;const m=_r(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},aw=t=>e=>t(e),lw=()=>({state:t,dispatch:e})=>kh(t,e),cw=(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 ne(o.doc.resolve(s-1))),!0},uw=()=>({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},dw=t=>({tr:e,state:n,dispatch:o})=>{const r=mt(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),u=i.after(s);e.delete(c,u).scrollIntoView()}return!0}return!1},pw=t=>({tr:e,dispatch:n})=>{const{from:o,to:r}=t;return n&&e.delete(o,r),!0},fw=()=>({state:t,dispatch:e})=>Sc(t,e),hw=()=>({commands:t})=>t.keyboardShortcut("Enter"),mw=()=>({state:t,dispatch:e})=>Tk(t,e);function Cs(t,e,n={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>n.strict?e[r]===t[r]:Ac(e[r])?e[r].test(t[r]):e[r]===t[r]):!0}function Th(t,e,n={}){return t.find(o=>o.type===e&&Cs(Object.fromEntries(Object.keys(n).map(r=>[r,o.attrs[r]])),n))}function Bd(t,e,n={}){return!!Th(t,e,n)}function Cr(t,e,n){var o;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(d=>d.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(d=>d.type===e)||(n=n||((o=r.node.marks[0])===null||o===void 0?void 0:o.attrs),!Th([...r.node.marks],e,n)))return;let s=r.index,l=t.start()+r.offset,c=s+1,u=l+r.node.nodeSize;for(;s>0&&Bd([...t.parent.child(s-1).marks],e,n);)s-=1,l-=t.parent.child(s).nodeSize;for(;c<t.parent.childCount&&Bd([...t.parent.child(c).marks],e,n);)u+=t.parent.child(c).nodeSize,c+=1;return{from:l,to:u}}function _o(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 gw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const i=_o(t,o.schema),{doc:s,selection:l}=n,{$from:c,from:u,to:d}=l;if(r){const p=Cr(c,i,e);if(p&&p.from<=u&&p.to>=d){const f=ne.create(s,p.from,p.to);n.setSelection(f)}}return!0},bw=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 ba(t){return t instanceof ne}function Gn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Oh(t,e=null){if(!e)return null;const n=ae.atStart(t),o=ae.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return o;const r=n.from,i=o.to;return e==="all"?ne.create(t,Gn(0,r,i),Gn(t.content.size,r,i)):ne.create(t,Gn(e,r,i),Gn(e,r,i))}function Mh(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ya(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const yw=(t=null,e={})=>({editor:n,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(ya()||Mh())&&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&&!ba(n.state.selection))return s(),!0;const l=Oh(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},vw=(t,e)=>n=>t.every((o,r)=>e(o,{...n,index:r})),kw=(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Ah=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&&Ah(o)}return t};function Fr(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Ah(n)}function Ss(t,e,n){if(t instanceof An||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),Ss("",e,n)}if(r){if(n.errorOnInvalidContent){let s=!1,l="";const c=new hf({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:u=>(s=!0,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?lr.fromSchema(c).parseSlice(Fr(t),n.parseOptions):lr.fromSchema(c).parse(Fr(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=lr.fromSchema(e);return n.slice?i.parseSlice(Fr(t),n.parseOptions).content:i.parse(Fr(t),n.parseOptions)}return Ss("",e,n)}function ww(t,e,n){const o=t.steps.length-1;if(o<e)return;const r=t.steps[o];if(!(r instanceof pt||r instanceof ft))return;const i=t.mapping.maps[o];let s=0;i.forEach((l,c,u,d)=>{s===0&&(s=d)}),t.setSelection(ae.near(t.doc.resolve(s),n))}const Ew=t=>!("type"in t),_w=(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=Ss(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:u}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},d=!0,p=!0;if((Ew(l)?l:[l]).forEach(m=>{m.check(),d=d?m.isText&&m.marks.length===0:!1,p=p?m.isBlock:!1}),c===u&&p){const{parent:m}=o.doc.resolve(c);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(c-=1,u+=1)}let h;if(d){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,u)}else h=l,o.replaceWith(c,u,h);n.updateSelection&&ww(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},Cw=()=>({state:t,dispatch:e})=>Sk(t,e),Sw=()=>({state:t,dispatch:e})=>xk(t,e),xw=()=>({state:t,dispatch:e})=>fh(t,e),Nw=()=>({state:t,dispatch:e})=>bh(t,e),Tw=()=>({state:t,dispatch:e,tr:n})=>{try{const o=aa(t.doc,t.selection.$from.pos,-1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},Ow=()=>({state:t,dispatch:e,tr:n})=>{try{const o=aa(t.doc,t.selection.$from.pos,1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},Mw=()=>({state:t,dispatch:e})=>_k(t,e),Aw=()=>({state:t,dispatch:e})=>Ck(t,e);function Rh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Rw(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))ya()||Rh()?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 Bw=t=>({editor:e,view:n,tr:o,dispatch:r})=>{const i=Rw(t).split(/-(?!$)/),s=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),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",u=>u(n,l))});return c==null||c.steps.forEach(u=>{const d=u.map(o.mapping);d&&r&&o.maybeStep(d)}),!0};function ci(t,e,n={}){const{from:o,to:r,empty:i}=t.selection,s=e?mt(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,u=l.filter(p=>s?s.name===p.node.type.name:!0).filter(p=>Cs(p.node.attrs,n,{strict:!1}));return i?!!u.length:u.reduce((p,f)=>p+f.to-f.from,0)>=c}const Dw=(t,e={})=>({state:n,dispatch:o})=>{const r=mt(t,n.schema);return ci(n,r,e)?Nk(n,o):!1},Iw=()=>({state:t,dispatch:e})=>wh(t,e),Lw=t=>({state:e,dispatch:n})=>{const o=mt(t,e.schema);return Fk(o)(e,n)},Pw=()=>({state:t,dispatch:e})=>vh(t,e);function va(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Dd(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 $w=(t,e)=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=va(typeof t=="string"?t:t.name,o.schema);return l?(l==="node"&&(i=mt(t,o.schema)),l==="mark"&&(s=_o(t,o.schema)),r&&n.selection.ranges.forEach(c=>{o.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{i&&i===u.type&&n.setNodeMarkup(d,void 0,Dd(u.attrs,e)),s&&u.marks.length&&u.marks.forEach(p=>{s===p.type&&n.addMark(d,d+u.nodeSize,s.create(Dd(p.attrs,e)))})})}),!0):!1},Fw=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Vw=()=>({tr:t,dispatch:e})=>{if(e){const n=new Jt(t.doc);t.setSelection(n)}return!0},zw=()=>({state:t,dispatch:e})=>mh(t,e),Hw=()=>({state:t,dispatch:e})=>yh(t,e),Uw=()=>({state:t,dispatch:e})=>Ak(t,e),qw=()=>({state:t,dispatch:e})=>Dk(t,e),Kw=()=>({state:t,dispatch:e})=>Bk(t,e);function $l(t,e,n={},o={}){return Ss(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}const Ww=(t,e=!1,n={},o={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{var c,u;const{doc:d}=i;if(n.preserveWhitespace!=="full"){const p=$l(t,r.schema,n,{errorOnInvalidContent:(c=o.errorOnInvalidContent)!==null&&c!==void 0?c:r.options.enableContentCheck});return s&&i.replaceWith(0,d.content.size,p).setMeta("preventUpdate",!e),!0}return s&&i.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:d.content.size},t,{parseOptions:n,errorOnInvalidContent:(u=o.errorOnInvalidContent)!==null&&u!==void 0?u:r.options.enableContentCheck})};function Bh(t,e){const n=_o(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 jw(t,e){const n=new fc(t);return e.forEach(o=>{o.steps.forEach(r=>{n.step(r)})}),n}function Gw(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 Fl(t,e){const n=[];return t.descendants((o,r)=>{e(o)&&n.push({node:o,pos:r})}),n}function Yw(t,e,n){const o=[];return t.nodesBetween(e.from,e.to,(r,i)=>{n(r)&&o.push({node:r,pos:i})}),o}function Dh(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 Bc(t){return e=>Dh(e.$from,t)}function Jw(t,e){const n=Bo.resolve(t);return xh(n,e)}function Xw(t,e){const n=Jw(e),o=Fr(t);return lr.fromSchema(n).parse(o).toJSON()}function Ih(t,e){const n={from:0,to:t.content.size};return Nh(t,n,e)}function Zw(t,e){const n=mt(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 Lh(t,e){const n=va(typeof e=="string"?e:e.name,t.schema);return n==="node"?Zw(t,e):n==="mark"?Bh(t,e):{}}function Qw(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 eE(t){const e=Qw(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 tE(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 u=e.slice(i).map(l,-1),d=e.slice(i).map(c),p=e.invert().map(u,-1),f=e.invert().map(d);o.push({oldRange:{from:p,to:f},newRange:{from:u,to:d}})})}),eE(o)}function Dc(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach(r=>{const i=n.resolve(t),s=Cr(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 ss(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 Vl(t,e,n={}){const{empty:o,ranges:r}=t.selection,i=e?_o(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter(p=>i?i.name===p.type.name:!0).find(p=>Cs(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),k=Math.min(m,b+g.nodeSize),E=k-y;s+=E,l.push(...g.marks.map(v=>({mark:v,from:y,to:k})))})}),s===0)return!1;const c=l.filter(p=>i?i.name===p.mark.type.name:!0).filter(p=>Cs(p.mark.attrs,n,{strict:!1})).reduce((p,f)=>p+f.to-f.from,0),u=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+u:c)>=s}function nE(t,e,n={}){if(!e)return ci(t,null,n)||Vl(t,null,n);const o=va(e,t.schema);return o==="node"?ci(t,e,n):o==="mark"?Vl(t,e,n):!1}function Id(t,e){const{nodeExtensions:n}=ma(e),o=n.find(s=>s.name===t);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=ve(j(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function Ic(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&&(Ic(i,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}function Ph(t){return t instanceof oe}function $h(t,e,n){const r=t.state.doc.content.size,i=Gn(e,0,r),s=Gn(n,0,r),l=t.coordsAtPos(i),c=t.coordsAtPos(s,-1),u=Math.min(l.top,c.top),d=Math.max(l.bottom,c.bottom),p=Math.min(l.left,c.left),f=Math.max(l.right,c.right),h=f-p,m=d-u,y={top:u,bottom:d,left:p,right:f,width:h,height:m,x:p,y:u};return{...y,toJSON:()=>y}}function oE(t,e,n){var o;const{selection:r}=e;let i=null;if(ba(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 u=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,c.pos,(d,p,f)=>{if(u)return!1;if(d.isInline){const h=!f||f.type.allowsMarkType(n),m=!!n.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(n));u=h&&m}return!u}),u})}const rE=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=n,{empty:s,ranges:l}=i,c=_o(t,o.schema);if(r)if(s){const u=Bh(o,c);n.addStoredMark(c.create({...u,...e}))}else l.forEach(u=>{const d=u.$from.pos,p=u.$to.pos;o.doc.nodesBetween(d,p,(f,h)=>{const m=Math.max(h,d),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 oE(o,n,c)},iE=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),sE=(t,e={})=>({state:n,dispatch:o,chain:r})=>{const i=mt(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})=>Od(i,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Od(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},aE=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,r=Gn(t,0,o.content.size),i=oe.create(o,r);e.setSelection(i)}return!0},lE=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,{from:r,to:i}=typeof t=="number"?{from:t,to:t}:t,s=ne.atStart(o).from,l=ne.atEnd(o).to,c=Gn(r,s,l),u=Gn(i,s,l),d=ne.create(o,c,u);e.setSelection(d)}return!0},cE=t=>({state:e,dispatch:n})=>{const o=mt(t,e.schema);return Hk(o)(e,n)};function Ld(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 uE=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:c}=i,u=r.extensionManager.attributes,d=ss(u,l.node().type.name,l.node().attrs);if(i instanceof oe&&i.node.isBlock)return!l.parentOffset||!Yn(s,l.pos)?!1:(o&&(t&&Ld(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:Gw(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=p&&f?[{type:f,attrs:d}]:void 0,m=Yn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&Yn(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(m=!0,h=f?[{type:f,attrs:d}]:void 0),o){if(m&&(i instanceof ne&&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&&Ld(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},dE=(t,e={})=>({tr:n,state:o,dispatch:r,editor:i})=>{var s;const l=mt(t,o.schema),{$from:c,$to:u}=o.selection,d=o.selection.node;if(d&&d.isBlock||c.depth<2||!c.sameParent(u))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 k=c.index(-1)?1:c.index(-2)?2:3;for(let B=c.depth-k;B>=c.depth-3;B-=1)y=A.from(c.node(B).copy(y));const E=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,v={...ss(f,c.node().type.name,c.node().attrs),...e},C=((s=l.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(v))||void 0;y=y.append(A.from(l.createAndFill(null,C)||void 0));const _=c.before(c.depth-(k-1));n.replace(_,c.after(-E),new V(y,4-k,0));let R=-1;n.doc.nodesBetween(_,n.doc.content.size,(B,N)=>{if(R>-1)return!1;B.isTextblock&&B.content.size===0&&(R=N+1)}),R>-1&&n.setSelection(ne.near(n.doc.resolve(R))),n.scrollIntoView()}return!0}const h=u.pos===c.end()?p.contentMatchAt(0).defaultType:null,m={...ss(f,p.type.name,p.attrs),...e},g={...ss(f,c.node().type.name,c.node().attrs),...e};n.delete(c.pos,u.pos);const b=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!Yn(n.doc,c.pos,2))return!1;if(r){const{selection:y,storedMarks:k}=o,{splittableMarks:E}=i.extensionManager,v=k||y.$to.parentOffset&&y.$from.marks();if(n.split(c.pos,2,b).scrollIntoView(),!v||!r)return!0;const C=v.filter(_=>E.includes(_.type.name));n.ensureMarks(C)}return!0},Qa=(t,e)=>{const n=Bc(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)&&wo(t.doc,n.pos)&&t.join(n.pos),!0},el=(t,e)=>{const n=Bc(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)&&wo(t.doc,o)&&t.join(o),!0},pE=(t,e,n,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:c,commands:u,can:d})=>{const{extensions:p,splittableMarks:f}=r.extensionManager,h=mt(t,s.schema),m=mt(e,s.schema),{selection:g,storedMarks:b}=s,{$from:y,$to:k}=g,E=y.blockRange(k),v=b||g.$to.parentOffset&&g.$from.marks();if(!E)return!1;const C=Bc(_=>Id(_.type.name,p))(g);if(E.depth>=1&&C&&E.depth-C.depth<=1){if(C.node.type===h)return u.liftListItem(m);if(Id(C.node.type.name,p)&&h.validContent(C.node.content)&&l)return c().command(()=>(i.setNodeMarkup(C.pos,h),!0)).command(()=>Qa(i,h)).command(()=>el(i,h)).run()}return!n||!v||!l?c().command(()=>d().wrapInList(h,o)?!0:u.clearNodes()).wrapInList(h,o).command(()=>Qa(i,h)).command(()=>el(i,h)).run():c().command(()=>{const _=d().wrapInList(h,o),R=v.filter(B=>f.includes(B.type.name));return i.ensureMarks(R),_?!0:u.clearNodes()}).wrapInList(h,o).command(()=>Qa(i,h)).command(()=>el(i,h)).run()},fE=(t,e={},n={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=n,s=_o(t,o.schema);return Vl(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},hE=(t,e,n={})=>({state:o,commands:r})=>{const i=mt(t,o.schema),s=mt(e,o.schema),l=ci(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})},mE=(t,e={})=>({state:n,commands:o})=>{const r=mt(t,n.schema);return ci(n,r,e)?o.lift(r):o.wrapIn(r,e)},gE=()=>({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},bE=()=>({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},yE=(t,e={})=>({tr:n,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,c=_o(t,o.schema),{$from:u,empty:d,ranges:p}=l;if(!r)return!0;if(d&&s){let{from:f,to:h}=l;const m=(i=u.marks().find(b=>b.type===c))===null||i===void 0?void 0:i.attrs,g=Cr(u,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},vE=(t,e={})=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=va(typeof t=="string"?t:t.name,o.schema);return l?(l==="node"&&(i=mt(t,o.schema)),l==="mark"&&(s=_o(t,o.schema)),r&&n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let p,f,h,m;n.selection.empty?o.doc.nodesBetween(u,d,(g,b)=>{i&&i===g.type&&(h=Math.max(b,u),m=Math.min(b+g.nodeSize,d),p=b,f=g)}):o.doc.nodesBetween(u,d,(g,b)=>{b<u&&i&&i===g.type&&(h=Math.max(b,u),m=Math.min(b+g.nodeSize,d),p=b,f=g),b>=u&&b<=d&&(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 k=Math.max(b,u),E=Math.min(b+g.nodeSize,d);n.addMark(k,E,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},kE=(t,e={})=>({state:n,dispatch:o})=>{const r=mt(t,n.schema);return Ik(r,e)(n,o)},wE=(t,e={})=>({state:n,dispatch:o})=>{const r=mt(t,n.schema);return Lk(r,e)(n,o)};var EE=Object.freeze({__proto__:null,blur:rw,clearContent:iw,clearNodes:sw,command:aw,createParagraphNear:lw,cut:cw,deleteCurrentNode:uw,deleteNode:dw,deleteRange:pw,deleteSelection:fw,enter:hw,exitCode:mw,extendMarkRange:gw,first:bw,focus:yw,forEach:vw,insertContent:kw,insertContentAt:_w,joinBackward:xw,joinDown:Sw,joinForward:Nw,joinItemBackward:Tw,joinItemForward:Ow,joinTextblockBackward:Mw,joinTextblockForward:Aw,joinUp:Cw,keyboardShortcut:Bw,lift:Dw,liftEmptyBlock:Iw,liftListItem:Lw,newlineInCode:Pw,resetAttributes:$w,scrollIntoView:Fw,selectAll:Vw,selectNodeBackward:zw,selectNodeForward:Hw,selectParentNode:Uw,selectTextblockEnd:qw,selectTextblockStart:Kw,setContent:Ww,setMark:rE,setMeta:iE,setNode:sE,setNodeSelection:aE,setTextSelection:lE,sinkListItem:cE,splitBlock:uE,splitListItem:dE,toggleList:pE,toggleMark:fE,toggleNode:hE,toggleWrap:mE,undoInputRule:gE,unsetAllMarks:bE,unsetMark:yE,updateAttributes:vE,wrapIn:kE,wrapInList:wE});const _E=De.create({name:"commands",addCommands(){return{...EE}}}),CE=De.create({name:"drop",addProseMirrorPlugins(){return[new Ae({key:new xe("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),SE=De.create({name:"editable",addProseMirrorPlugins(){return[new Ae({key:new xe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),xE=De.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ae({key:new xe("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}}}})]}}),NE=De.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:c,doc:u}=l,{empty:d,$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:ae.atStart(u).from===f;return!d||!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 ya()||Rh()?i:r},addProseMirrorPlugins(){return[new Ae({key:new xe("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=ae.atStart(e.doc).from,u=ae.atEnd(e.doc).to;if(i||!(s===c&&l===u)||!Ic(n.doc))return;const f=n.tr,h=fa({state:n,transaction:f}),{commands:m}=new ha({editor:this.editor,state:h});if(m.clearNodes(),!!f.steps.length)return f}})]}}),TE=De.create({name:"paste",addProseMirrorPlugins(){return[new Ae({key:new xe("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),OE=De.create({name:"tabindex",addProseMirrorPlugins(){return[new Ae({key:new xe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Mo{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 Mo(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 Mo(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 Mo(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 Mo(l,this.editor,r,r?n:null);r&&(c.actualDepth=this.depth+1),e.push(new Mo(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 ME=`.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 AE(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 Zt=class extends Uk{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=AE(ME,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=Sh(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?[SE,ow.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),_E,xE,NE,OE,CE,TE].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 Bo(r,this)}createCommandManager(){this.commandManager=new ha({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=$l(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=$l(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const o=Oh(n,this.options.autofocus);this.view=new fk(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:ar.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 Lh(this.state,e)}isActive(e,n){const o=typeof e=="string"?e:null,r=typeof e=="string"?n:e;return nE(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Mc(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
|
|
91
|
+
|
|
92
|
+
`,textSerializers:o={}}=e||{};return Ih(this.state.doc,{blockSeparator:n,textSerializers:{...Rc(this.schema),...o}})}get isEmpty(){return Ic(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 Mo(n,this)}get $doc(){return this.$pos(0)}};function Wo(t){return new _i({find:t.find,handler:({state:e,range:n,match:o})=>{const r=ve(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/),u=n.from+l.indexOf(s),d=u+s.length;if(Dc(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>u).length)return null;d<n.to&&i.delete(d,n.to),u>n.from&&i.delete(n.from+c,u);const f=n.from+c+s.length;i.addMark(n.from+c,f,t.type.create(r||{})),i.removeStoredMark(t.type)}}})}function ka(t){return new _i({find:t.find,handler:({state:e,range:n,match:o})=>{const r=ve(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 u=o[0].lastIndexOf(o[1]);let d=s+u;d>l?d=l:l=d+o[1].length;const p=o[0][o[0].length-1];i.insertText(p,s+o[0].length-1),i.replaceWith(d,l,c)}else if(o[0]){const u=t.type.isInline?s:s-1;i.insert(u,t.type.create(r)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()}})}function zl(t){return new _i({find:t.find,handler:({state:e,range:n,match:o})=>{const r=e.doc.resolve(n.from),i=ve(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 et(t){return new _i({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 mr(t){return new _i({find:t.find,handler:({state:e,range:n,match:o,chain:r})=>{const i=ve(t.getAttributes,void 0,o)||{},s=e.tr.delete(n.from,n.to),c=s.doc.resolve(n.from).blockRange(),u=c&&pc(c,t.type,i);if(!u)return null;if(s.wrap(c,u),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 d=s.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&wo(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,d))&&s.join(n.from-1)}})}class ze{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=ve(j(this,"addOptions",{name:this.name}))),this.storage=ve(j(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ze(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ga(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new ze(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=ve(j(n,"addOptions",{name:n.name})),n.storage=ve(j(n,"addStorage",{name:n.name,options:n.options})),n}}class RE{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:u}=this.editor,d=e.target,p=d.nodeType===3?(n=d.parentElement)===null||n===void 0?void 0:n.closest("[data-drag-handle]"):d.closest("[data-drag-handle]");if(!this.dom||!((o=this.contentDOM)===null||o===void 0)&&o.contains(d)||!p)return;let f=0,h=0;if(this.dom!==p){const y=this.dom.getBoundingClientRect(),k=p.getBoundingClientRect(),E=(r=e.offsetX)!==null&&r!==void 0?r:(i=e.nativeEvent)===null||i===void 0?void 0:i.offsetX,v=(s=e.offsetY)!==null&&s!==void 0?s:(l=e.nativeEvent)===null||l===void 0?void 0:l.offsetY;f=k.x-y.x+E,h=k.y-y.y+v}(c=e.dataTransfer)===null||c===void 0||c.setDragImage(this.dom,f,h);const m=this.getPos();if(typeof m!="number")return;const g=oe.create(u.state.doc,m),b=u.state.tr.setSelection(g);u.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:u}=this,d=!!this.node.type.spec.draggable,p=oe.isSelectable(this.node),f=e.type==="copy",h=e.type==="paste",m=e.type==="cut",g=e.type==="mousedown";if(!d&&p&&i&&e.target===this.dom&&e.preventDefault(),d&&i&&!u&&e.target===this.dom)return e.preventDefault(),!1;if(d&&c&&!u&&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!(u||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"&&(ya()||Mh())&&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 ko(t){return new Xk({find:t.find,handler:({state:e,range:n,match:o,pasteEvent:r})=>{const i=ve(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 u=n.to;if(l){const d=c.search(/\S/),p=n.from+c.indexOf(l),f=p+l.length;if(Dc(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+d,p),u=n.from+d+l.length,s.addMark(n.from+d,u,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function Fh(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var zt="top",cn="bottom",un="right",Ht="left",Lc="auto",Ci=[zt,cn,un,Ht],gr="start",ui="end",BE="clippingParents",Vh="viewport",Rr="popper",DE="reference",Pd=Ci.reduce(function(t,e){return t.concat([e+"-"+gr,e+"-"+ui])},[]),zh=[].concat(Ci,[Lc]).reduce(function(t,e){return t.concat([e,e+"-"+gr,e+"-"+ui])},[]),IE="beforeRead",LE="read",PE="afterRead",$E="beforeMain",FE="main",VE="afterMain",zE="beforeWrite",HE="write",UE="afterWrite",qE=[IE,LE,PE,$E,FE,VE,zE,HE,UE];function In(t){return t?(t.nodeName||"").toLowerCase():null}function Xt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function jo(t){var e=Xt(t).Element;return t instanceof e||t instanceof Element}function an(t){var e=Xt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Pc(t){if(typeof ShadowRoot>"u")return!1;var e=Xt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function KE(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];!an(i)||!In(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 WE(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,u){return c[u]="",c},{});!an(r)||!In(r)||(Object.assign(r.style,l),Object.keys(i).forEach(function(c){r.removeAttribute(c)}))})}}const Hh={name:"applyStyles",enabled:!0,phase:"write",fn:KE,effect:WE,requires:["computeStyles"]};function Rn(t){return t.split("-")[0]}var Fo=Math.max,xs=Math.min,br=Math.round;function Hl(){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 Uh(){return!/^((?!chrome|android).)*safari/i.test(Hl())}function yr(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var o=t.getBoundingClientRect(),r=1,i=1;e&&an(t)&&(r=t.offsetWidth>0&&br(o.width)/t.offsetWidth||1,i=t.offsetHeight>0&&br(o.height)/t.offsetHeight||1);var s=jo(t)?Xt(t):window,l=s.visualViewport,c=!Uh()&&n,u=(o.left+(c&&l?l.offsetLeft:0))/r,d=(o.top+(c&&l?l.offsetTop:0))/i,p=o.width/r,f=o.height/i;return{width:p,height:f,top:d,right:u+p,bottom:d+f,left:u,x:u,y:d}}function $c(t){var e=yr(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 qh(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Pc(n)){var o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function Xn(t){return Xt(t).getComputedStyle(t)}function jE(t){return["table","td","th"].indexOf(In(t))>=0}function Co(t){return((jo(t)?t.ownerDocument:t.document)||window.document).documentElement}function wa(t){return In(t)==="html"?t:t.assignedSlot||t.parentNode||(Pc(t)?t.host:null)||Co(t)}function $d(t){return!an(t)||Xn(t).position==="fixed"?null:t.offsetParent}function GE(t){var e=/firefox/i.test(Hl()),n=/Trident/i.test(Hl());if(n&&an(t)){var o=Xn(t);if(o.position==="fixed")return null}var r=wa(t);for(Pc(r)&&(r=r.host);an(r)&&["html","body"].indexOf(In(r))<0;){var i=Xn(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 Si(t){for(var e=Xt(t),n=$d(t);n&&jE(n)&&Xn(n).position==="static";)n=$d(n);return n&&(In(n)==="html"||In(n)==="body"&&Xn(n).position==="static")?e:n||GE(t)||e}function Fc(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function qr(t,e,n){return Fo(t,xs(e,n))}function YE(t,e,n){var o=qr(t,e,n);return o>n?n:o}function Kh(){return{top:0,right:0,bottom:0,left:0}}function Wh(t){return Object.assign({},Kh(),t)}function jh(t,e){return e.reduce(function(n,o){return n[o]=t,n},{})}var JE=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,Wh(typeof e!="number"?e:jh(e,Ci))};function XE(t){var e,n=t.state,o=t.name,r=t.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,l=Rn(n.placement),c=Fc(l),u=[Ht,un].indexOf(l)>=0,d=u?"height":"width";if(!(!i||!s)){var p=JE(r.padding,n),f=$c(i),h=c==="y"?zt:Ht,m=c==="y"?cn:un,g=n.rects.reference[d]+n.rects.reference[c]-s[c]-n.rects.popper[d],b=s[c]-n.rects.reference[c],y=Si(i),k=y?c==="y"?y.clientHeight||0:y.clientWidth||0:0,E=g/2-b/2,v=p[h],C=k-f[d]-p[m],_=k/2-f[d]/2+E,R=qr(v,_,C),B=c;n.modifiersData[o]=(e={},e[B]=R,e.centerOffset=R-_,e)}}function ZE(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)||qh(e.elements.popper,r)&&(e.elements.arrow=r))}const QE={name:"arrow",enabled:!0,phase:"main",fn:XE,effect:ZE,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function vr(t){return t.split("-")[1]}var e0={top:"auto",right:"auto",bottom:"auto",left:"auto"};function t0(t,e){var n=t.x,o=t.y,r=e.devicePixelRatio||1;return{x:br(n*r)/r||0,y:br(o*r)/r||0}}function Fd(t){var e,n=t.popper,o=t.popperRect,r=t.placement,i=t.variation,s=t.offsets,l=t.position,c=t.gpuAcceleration,u=t.adaptive,d=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 d=="function"?d({x:h,y:g}):{x:h,y:g};h=b.x,g=b.y;var y=s.hasOwnProperty("x"),k=s.hasOwnProperty("y"),E=Ht,v=zt,C=window;if(u){var _=Si(n),R="clientHeight",B="clientWidth";if(_===Xt(n)&&(_=Co(n),Xn(_).position!=="static"&&l==="absolute"&&(R="scrollHeight",B="scrollWidth")),_=_,r===zt||(r===Ht||r===un)&&i===ui){v=cn;var N=p&&_===C&&C.visualViewport?C.visualViewport.height:_[R];g-=N-o.height,g*=c?1:-1}if(r===Ht||(r===zt||r===cn)&&i===ui){E=un;var M=p&&_===C&&C.visualViewport?C.visualViewport.width:_[B];h-=M-o.width,h*=c?1:-1}}var z=Object.assign({position:l},u&&e0),G=d===!0?t0({x:h,y:g},Xt(n)):{x:h,y:g};if(h=G.x,g=G.y,c){var $;return Object.assign({},z,($={},$[v]=k?"0":"",$[E]=y?"0":"",$.transform=(C.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",$))}return Object.assign({},z,(e={},e[v]=k?g+"px":"",e[E]=y?h+"px":"",e.transform="",e))}function n0(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,u={placement:Rn(e.placement),variation:vr(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,Fd(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:c})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Fd(Object.assign({},u,{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:n0,data:{}};var Pi={passive:!0};function r0(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=Xt(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&u.forEach(function(d){d.addEventListener("scroll",n.update,Pi)}),l&&c.addEventListener("resize",n.update,Pi),function(){i&&u.forEach(function(d){d.removeEventListener("scroll",n.update,Pi)}),l&&c.removeEventListener("resize",n.update,Pi)}}const i0={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:r0,data:{}};var s0={left:"right",right:"left",bottom:"top",top:"bottom"};function as(t){return t.replace(/left|right|bottom|top/g,function(e){return s0[e]})}var a0={start:"end",end:"start"};function Vd(t){return t.replace(/start|end/g,function(e){return a0[e]})}function Vc(t){var e=Xt(t),n=e.pageXOffset,o=e.pageYOffset;return{scrollLeft:n,scrollTop:o}}function zc(t){return yr(Co(t)).left+Vc(t).scrollLeft}function l0(t,e){var n=Xt(t),o=Co(t),r=n.visualViewport,i=o.clientWidth,s=o.clientHeight,l=0,c=0;if(r){i=r.width,s=r.height;var u=Uh();(u||!u&&e==="fixed")&&(l=r.offsetLeft,c=r.offsetTop)}return{width:i,height:s,x:l+zc(t),y:c}}function c0(t){var e,n=Co(t),o=Vc(t),r=(e=t.ownerDocument)==null?void 0:e.body,i=Fo(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=Fo(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),l=-o.scrollLeft+zc(t),c=-o.scrollTop;return Xn(r||n).direction==="rtl"&&(l+=Fo(n.clientWidth,r?r.clientWidth:0)-i),{width:i,height:s,x:l,y:c}}function Hc(t){var e=Xn(t),n=e.overflow,o=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+o)}function Gh(t){return["html","body","#document"].indexOf(In(t))>=0?t.ownerDocument.body:an(t)&&Hc(t)?t:Gh(wa(t))}function Kr(t,e){var n;e===void 0&&(e=[]);var o=Gh(t),r=o===((n=t.ownerDocument)==null?void 0:n.body),i=Xt(o),s=r?[i].concat(i.visualViewport||[],Hc(o)?o:[]):o,l=e.concat(s);return r?l:l.concat(Kr(wa(s)))}function Ul(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function u0(t,e){var n=yr(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 zd(t,e,n){return e===Vh?Ul(l0(t,n)):jo(e)?u0(e,n):Ul(c0(Co(t)))}function d0(t){var e=Kr(wa(t)),n=["absolute","fixed"].indexOf(Xn(t).position)>=0,o=n&&an(t)?Si(t):t;return jo(o)?e.filter(function(r){return jo(r)&&qh(r,o)&&In(r)!=="body"}):[]}function p0(t,e,n,o){var r=e==="clippingParents"?d0(t):[].concat(e),i=[].concat(r,[n]),s=i[0],l=i.reduce(function(c,u){var d=zd(t,u,o);return c.top=Fo(d.top,c.top),c.right=xs(d.right,c.right),c.bottom=xs(d.bottom,c.bottom),c.left=Fo(d.left,c.left),c},zd(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 Yh(t){var e=t.reference,n=t.element,o=t.placement,r=o?Rn(o):null,i=o?vr(o):null,s=e.x+e.width/2-n.width/2,l=e.y+e.height/2-n.height/2,c;switch(r){case zt:c={x:s,y:e.y-n.height};break;case cn:c={x:s,y:e.y+e.height};break;case un:c={x:e.x+e.width,y:l};break;case Ht:c={x:e.x-n.width,y:l};break;default:c={x:e.x,y:e.y}}var u=r?Fc(r):null;if(u!=null){var d=u==="y"?"height":"width";switch(i){case gr:c[u]=c[u]-(e[d]/2-n[d]/2);break;case ui:c[u]=c[u]+(e[d]/2-n[d]/2);break}}return c}function di(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?BE:l,u=n.rootBoundary,d=u===void 0?Vh:u,p=n.elementContext,f=p===void 0?Rr:p,h=n.altBoundary,m=h===void 0?!1:h,g=n.padding,b=g===void 0?0:g,y=Wh(typeof b!="number"?b:jh(b,Ci)),k=f===Rr?DE:Rr,E=t.rects.popper,v=t.elements[m?k:f],C=p0(jo(v)?v:v.contextElement||Co(t.elements.popper),c,d,s),_=yr(t.elements.reference),R=Yh({reference:_,element:E,placement:r}),B=Ul(Object.assign({},E,R)),N=f===Rr?B:_,M={top:C.top-N.top+y.top,bottom:N.bottom-C.bottom+y.bottom,left:C.left-N.left+y.left,right:N.right-C.right+y.right},z=t.modifiersData.offset;if(f===Rr&&z){var G=z[r];Object.keys(M).forEach(function($){var U=[un,cn].indexOf($)>=0?1:-1,q=[zt,cn].indexOf($)>=0?"y":"x";M[$]+=G[q]*U})}return M}function f0(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,u=c===void 0?zh:c,d=vr(o),p=d?l?Pd:Pd.filter(function(m){return vr(m)===d}):Ci,f=p.filter(function(m){return u.indexOf(m)>=0});f.length===0&&(f=p);var h=f.reduce(function(m,g){return m[g]=di(t,{placement:g,boundary:r,rootBoundary:i,padding:s})[Rn(g)],m},{});return Object.keys(h).sort(function(m,g){return h[m]-h[g]})}function h0(t){if(Rn(t)===Lc)return[];var e=as(t);return[Vd(t),e,Vd(e)]}function m0(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,u=n.padding,d=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=Rn(b),k=y===b,E=c||(k||!m?[as(b)]:h0(b)),v=[b].concat(E).reduce(function(ot,Re){return ot.concat(Rn(Re)===Lc?f0(e,{placement:Re,boundary:d,rootBoundary:p,padding:u,flipVariations:m,allowedAutoPlacements:g}):Re)},[]),C=e.rects.reference,_=e.rects.popper,R=new Map,B=!0,N=v[0],M=0;M<v.length;M++){var z=v[M],G=Rn(z),$=vr(z)===gr,U=[zt,cn].indexOf(G)>=0,q=U?"width":"height",ee=di(e,{placement:z,boundary:d,rootBoundary:p,altBoundary:f,padding:u}),S=U?$?un:Ht:$?cn:zt;C[q]>_[q]&&(S=as(S));var O=as(S),F=[];if(i&&F.push(ee[G]<=0),l&&F.push(ee[S]<=0,ee[O]<=0),F.every(function(ot){return ot})){N=z,B=!1;break}R.set(z,F)}if(B)for(var J=m?3:1,Q=function(Re){var X=v.find(function(be){var ke=R.get(be);if(ke)return ke.slice(0,Re).every(function(Ye){return Ye})});if(X)return N=X,"break"},ce=J;ce>0;ce--){var Ce=Q(ce);if(Ce==="break")break}e.placement!==N&&(e.modifiersData[o]._skip=!0,e.placement=N,e.reset=!0)}}const g0={name:"flip",enabled:!0,phase:"main",fn:m0,requiresIfExists:["offset"],data:{_skip:!1}};function Hd(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 Ud(t){return[zt,un,cn,Ht].some(function(e){return t[e]>=0})}function b0(t){var e=t.state,n=t.name,o=e.rects.reference,r=e.rects.popper,i=e.modifiersData.preventOverflow,s=di(e,{elementContext:"reference"}),l=di(e,{altBoundary:!0}),c=Hd(s,o),u=Hd(l,r,i),d=Ud(c),p=Ud(u);e.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:p},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":p})}const y0={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:b0};function v0(t,e,n){var o=Rn(t),r=[Ht,zt].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,[Ht,un].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=zh.reduce(function(d,p){return d[p]=v0(p,e.rects,i),d},{}),l=s[e.placement],c=l.x,u=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=u),e.modifiersData[o]=s}const w0={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:k0};function E0(t){var e=t.state,n=t.name;e.modifiersData[n]=Yh({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const _0={name:"popperOffsets",enabled:!0,phase:"read",fn:E0,data:{}};function C0(t){return t==="x"?"y":"x"}function S0(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,u=n.rootBoundary,d=n.altBoundary,p=n.padding,f=n.tether,h=f===void 0?!0:f,m=n.tetherOffset,g=m===void 0?0:m,b=di(e,{boundary:c,rootBoundary:u,padding:p,altBoundary:d}),y=Rn(e.placement),k=vr(e.placement),E=!k,v=Fc(y),C=C0(v),_=e.modifiersData.popperOffsets,R=e.rects.reference,B=e.rects.popper,N=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,M=typeof N=="number"?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),z=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,G={x:0,y:0};if(_){if(i){var $,U=v==="y"?zt:Ht,q=v==="y"?cn:un,ee=v==="y"?"height":"width",S=_[v],O=S+b[U],F=S-b[q],J=h?-B[ee]/2:0,Q=k===gr?R[ee]:B[ee],ce=k===gr?-B[ee]:-R[ee],Ce=e.elements.arrow,ot=h&&Ce?$c(Ce):{width:0,height:0},Re=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Kh(),X=Re[U],be=Re[q],ke=qr(0,R[ee],ot[ee]),Ye=E?R[ee]/2-J-ke-X-M.mainAxis:Q-ke-X-M.mainAxis,tt=E?-R[ee]/2+J+ke+be+M.mainAxis:ce+ke+be+M.mainAxis,en=e.elements.arrow&&Si(e.elements.arrow),En=en?v==="y"?en.clientTop||0:en.clientLeft||0:0,fn=($=z==null?void 0:z[v])!=null?$:0,qt=S+Ye-fn-En,hn=S+tt-fn,pe=qr(h?xs(O,qt):O,S,h?Fo(F,hn):F);_[v]=pe,G[v]=pe-S}if(l){var Pt,wt=v==="x"?zt:Ht,se=v==="x"?cn:un,Tt=_[C],$e=C==="y"?"height":"width",Oe=Tt+b[wt],Ot=Tt-b[se],nt=[zt,Ht].indexOf(y)!==-1,mn=(Pt=z==null?void 0:z[C])!=null?Pt:0,Mt=nt?Oe:Tt-R[$e]-B[$e]-mn+M.altAxis,L=nt?Tt+R[$e]+B[$e]-mn-M.altAxis:Ot,K=h&&nt?YE(Mt,Tt,L):qr(h?Mt:Oe,Tt,h?L:Ot);_[C]=K,G[C]=K-Tt}e.modifiersData[o]=G}}const x0={name:"preventOverflow",enabled:!0,phase:"main",fn:S0,requiresIfExists:["offset"]};function N0(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function T0(t){return t===Xt(t)||!an(t)?Vc(t):N0(t)}function O0(t){var e=t.getBoundingClientRect(),n=br(e.width)/t.offsetWidth||1,o=br(e.height)/t.offsetHeight||1;return n!==1||o!==1}function M0(t,e,n){n===void 0&&(n=!1);var o=an(e),r=an(e)&&O0(e),i=Co(e),s=yr(t,r,n),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(o||!o&&!n)&&((In(e)!=="body"||Hc(i))&&(l=T0(e)),an(e)?(c=yr(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):i&&(c.x=zc(i))),{x:s.left+l.scrollLeft-c.x,y:s.top+l.scrollTop-c.y,width:s.width,height:s.height}}function A0(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 R0(t){var e=A0(t);return qE.reduce(function(n,o){return n.concat(e.filter(function(r){return r.phase===o}))},[])}function B0(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function D0(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 qd={placement:"bottom",modifiers:[],strategy:"absolute"};function Kd(){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 I0(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,o=n===void 0?[]:n,r=e.defaultOptions,i=r===void 0?qd:r;return function(l,c,u){u===void 0&&(u=i);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},qd,i),modifiersData:{},elements:{reference:l,popper:c},attributes:{},styles:{}},p=[],f=!1,h={state:d,setOptions:function(y){var k=typeof y=="function"?y(d.options):y;g(),d.options=Object.assign({},i,d.options,k),d.scrollParents={reference:jo(l)?Kr(l):l.contextElement?Kr(l.contextElement):[],popper:Kr(c)};var E=R0(D0([].concat(o,d.options.modifiers)));return d.orderedModifiers=E.filter(function(v){return v.enabled}),m(),h.update()},forceUpdate:function(){if(!f){var y=d.elements,k=y.reference,E=y.popper;if(Kd(k,E)){d.rects={reference:M0(k,Si(E),d.options.strategy==="fixed"),popper:$c(E)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(M){return d.modifiersData[M.name]=Object.assign({},M.data)});for(var v=0;v<d.orderedModifiers.length;v++){if(d.reset===!0){d.reset=!1,v=-1;continue}var C=d.orderedModifiers[v],_=C.fn,R=C.options,B=R===void 0?{}:R,N=C.name;typeof _=="function"&&(d=_({state:d,options:B,name:N,instance:h})||d)}}}},update:B0(function(){return new Promise(function(b){h.forceUpdate(),b(d)})}),destroy:function(){g(),f=!0}};if(!Kd(l,c))return h;h.setOptions(u).then(function(b){!f&&u.onFirstUpdate&&u.onFirstUpdate(b)});function m(){d.orderedModifiers.forEach(function(b){var y=b.name,k=b.options,E=k===void 0?{}:k,v=b.effect;if(typeof v=="function"){var C=v({state:d,name:y,instance:h,options:E}),_=function(){};p.push(C||_)}})}function g(){p.forEach(function(b){return b()}),p=[]}return h}}var L0=[i0,_0,o0,Hh,w0,g0,x0,QE,y0],P0=I0({defaultModifiers:L0}),$0="tippy-box",Jh="tippy-content",F0="tippy-backdrop",Xh="tippy-arrow",Zh="tippy-svg-arrow",To={passive:!0,capture:!0},Qh=function(){return document.body};function V0(t,e){return{}.hasOwnProperty.call(t,e)}function tl(t,e,n){if(Array.isArray(t)){var o=t[e];return o??(Array.isArray(n)?n[e]:n)}return t}function Uc(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function em(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Wd(t,e){if(e===0)return t;var n;return function(o){clearTimeout(n),n=setTimeout(function(){t(o)},e)}}function z0(t,e){var n=Object.assign({},t);return e.forEach(function(o){delete n[o]}),n}function H0(t){return t.split(/\s+/).filter(Boolean)}function or(t){return[].concat(t)}function jd(t,e){t.indexOf(e)===-1&&t.push(e)}function U0(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function q0(t){return t.split("-")[0]}function Ns(t){return[].slice.call(t)}function Gd(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Wr(){return document.createElement("div")}function pi(t){return["Element","Fragment"].some(function(e){return Uc(t,e)})}function K0(t){return Uc(t,"NodeList")}function W0(t){return Uc(t,"MouseEvent")}function j0(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function G0(t){return pi(t)?[t]:K0(t)?Ns(t):Array.isArray(t)?t:Ns(document.querySelectorAll(t))}function nl(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function Yd(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function Y0(t){var e,n=or(t),o=n[0];return o!=null&&(e=o.ownerDocument)!=null&&e.body?o.ownerDocument:document}function J0(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,u=q0(s.placement),d=s.modifiersData.offset;if(!d)return!0;var p=u==="bottom"?d.top.y:0,f=u==="top"?d.bottom.y:0,h=u==="right"?d.left.x:0,m=u==="left"?d.right.x:0,g=i.top-o+p>c,b=o-i.bottom-f>c,y=i.left-n+h>c,k=n-i.right-m>c;return g||b||y||k})}function ol(t,e,n){var o=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){t[o](r,n)})}function Jd(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 On={isTouch:!1},Xd=0;function X0(){On.isTouch||(On.isTouch=!0,window.performance&&document.addEventListener("mousemove",tm))}function tm(){var t=performance.now();t-Xd<20&&(On.isTouch=!1,document.removeEventListener("mousemove",tm)),Xd=t}function Z0(){var t=document.activeElement;if(j0(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function Q0(){document.addEventListener("touchstart",X0,To),window.addEventListener("blur",Z0)}var e_=typeof window<"u"&&typeof document<"u",t_=e_?!!window.msCrypto:!1;function Qo(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 Zd(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function n_(t){return Zd(`
|
|
93
|
+
%ctippy.js
|
|
94
|
+
|
|
95
|
+
%c`+Zd(t)+`
|
|
96
|
+
|
|
97
|
+
%c👷 This is a development-only message. It will be removed in production.
|
|
98
|
+
`)}function nm(t){return[n_(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var fi;process.env.NODE_ENV!=="production"&&o_();function o_(){fi=new Set}function Wn(t,e){if(t&&!fi.has(e)){var n;fi.add(e),(n=console).warn.apply(n,nm(e))}}function ql(t,e){if(t&&!fi.has(e)){var n;fi.add(e),(n=console).error.apply(n,nm(e))}}function r_(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;ql(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),ql(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var om={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},i_={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Gt=Object.assign({appendTo:Qh,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},om,i_),s_=Object.keys(Gt),a_=function(e){process.env.NODE_ENV!=="production"&&im(e,[]);var n=Object.keys(e);n.forEach(function(o){Gt[o]=e[o]})};function rm(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=Gt[i])!=null?l:s}return o},{});return Object.assign({},t,n)}function l_(t,e){var n=e?Object.keys(rm(Object.assign({},Gt,{plugins:e}))):s_,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 Qd(t,e){var n=Object.assign({},e,{content:em(e.content,[t])},e.ignoreAttributes?{}:l_(t,e.plugins));return n.aria=Object.assign({},Gt.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 im(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(o){var r=z0(Gt,Object.keys(om)),i=!V0(r,o);i&&(i=e.filter(function(s){return s.name===o}).length===0),Wn(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 c_=function(){return"innerHTML"};function Kl(t,e){t[c_()]=e}function ep(t){var e=Wr();return t===!0?e.className=Xh:(e.className=Zh,pi(t)?e.appendChild(t):Kl(e,t)),e}function tp(t,e){pi(e.content)?(Kl(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Kl(t,e.content):t.textContent=e.content)}function Wl(t){var e=t.firstElementChild,n=Ns(e.children);return{box:e,content:n.find(function(o){return o.classList.contains(Jh)}),arrow:n.find(function(o){return o.classList.contains(Xh)||o.classList.contains(Zh)}),backdrop:n.find(function(o){return o.classList.contains(F0)})}}function sm(t){var e=Wr(),n=Wr();n.className=$0,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var o=Wr();o.className=Jh,o.setAttribute("data-state","hidden"),tp(o,t.props),e.appendChild(n),n.appendChild(o),r(t.props,t.props);function r(i,s){var l=Wl(e),c=l.box,u=l.content,d=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)&&tp(u,t.props),s.arrow?d?i.arrow!==s.arrow&&(c.removeChild(d),c.appendChild(ep(s.arrow))):c.appendChild(ep(s.arrow)):d&&c.removeChild(d)}return{popper:e,onUpdate:r}}sm.$$tippy=!0;var u_=1,$i=[],rl=[];function d_(t,e){var n=Qd(t,Object.assign({},Gt,rm(Gd(e)))),o,r,i,s=!1,l=!1,c=!1,u=!1,d,p,f,h=[],m=Wd(qt,n.interactiveDebounce),g,b=u_++,y=null,k=U0(n.plugins),E={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:b,reference:t,popper:Wr(),popperInstance:y,props:n,state:E,plugins:k,clearDelayTimeouts:Mt,setProps:L,setContent:K,show:fe,hide:Me,hideWithInteractivity:rt,enable:nt,disable:mn,unmount:Kt,destroy:Tr};if(!n.render)return process.env.NODE_ENV!=="production"&&ql(!0,"render() function has not been supplied."),v;var C=n.render(v),_=C.popper,R=C.onUpdate;_.setAttribute("data-tippy-root",""),_.id="tippy-"+v.id,v.popper=_,t._tippy=v,_._tippy=v;var B=k.map(function(x){return x.fn(v)}),N=t.hasAttribute("aria-expanded");return en(),J(),S(),O("onCreate",[v]),n.showOnCreate&&Oe(),_.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),_.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&U().addEventListener("mousemove",m)}),v;function M(){var x=v.props.touch;return Array.isArray(x)?x:[x,0]}function z(){return M()[0]==="hold"}function G(){var x;return!!((x=v.props.render)!=null&&x.$$tippy)}function $(){return g||t}function U(){var x=$().parentNode;return x?Y0(x):document}function q(){return Wl(_)}function ee(x){return v.state.isMounted&&!v.state.isVisible||On.isTouch||d&&d.type==="focus"?0:tl(v.props.delay,x?0:1,Gt.delay)}function S(x){x===void 0&&(x=!1),_.style.pointerEvents=v.props.interactive&&!x?"":"none",_.style.zIndex=""+v.props.zIndex}function O(x,Y,le){if(le===void 0&&(le=!0),B.forEach(function(Ee){Ee[x]&&Ee[x].apply(Ee,Y)}),le){var Be;(Be=v.props)[x].apply(Be,Y)}}function F(){var x=v.props.aria;if(x.content){var Y="aria-"+x.content,le=_.id,Be=or(v.props.triggerTarget||t);Be.forEach(function(Ee){var ut=Ee.getAttribute(Y);if(v.state.isVisible)Ee.setAttribute(Y,ut?ut+" "+le:le);else{var At=ut&&ut.replace(le,"").trim();At?Ee.setAttribute(Y,At):Ee.removeAttribute(Y)}})}}function J(){if(!(N||!v.props.aria.expanded)){var x=or(v.props.triggerTarget||t);x.forEach(function(Y){v.props.interactive?Y.setAttribute("aria-expanded",v.state.isVisible&&Y===$()?"true":"false"):Y.removeAttribute("aria-expanded")})}}function Q(){U().removeEventListener("mousemove",m),$i=$i.filter(function(x){return x!==m})}function ce(x){if(!(On.isTouch&&(c||x.type==="mousedown"))){var Y=x.composedPath&&x.composedPath()[0]||x.target;if(!(v.props.interactive&&Jd(_,Y))){if(or(v.props.triggerTarget||t).some(function(le){return Jd(le,Y)})){if(On.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else O("onClickOutside",[v,x]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),l=!0,setTimeout(function(){l=!1}),v.state.isMounted||X())}}}function Ce(){c=!0}function ot(){c=!1}function Re(){var x=U();x.addEventListener("mousedown",ce,!0),x.addEventListener("touchend",ce,To),x.addEventListener("touchstart",ot,To),x.addEventListener("touchmove",Ce,To)}function X(){var x=U();x.removeEventListener("mousedown",ce,!0),x.removeEventListener("touchend",ce,To),x.removeEventListener("touchstart",ot,To),x.removeEventListener("touchmove",Ce,To)}function be(x,Y){Ye(x,function(){!v.state.isVisible&&_.parentNode&&_.parentNode.contains(_)&&Y()})}function ke(x,Y){Ye(x,Y)}function Ye(x,Y){var le=q().box;function Be(Ee){Ee.target===le&&(ol(le,"remove",Be),Y())}if(x===0)return Y();ol(le,"remove",p),ol(le,"add",Be),p=Be}function tt(x,Y,le){le===void 0&&(le=!1);var Be=or(v.props.triggerTarget||t);Be.forEach(function(Ee){Ee.addEventListener(x,Y,le),h.push({node:Ee,eventType:x,handler:Y,options:le})})}function en(){z()&&(tt("touchstart",fn,{passive:!0}),tt("touchend",hn,{passive:!0})),H0(v.props.trigger).forEach(function(x){if(x!=="manual")switch(tt(x,fn),x){case"mouseenter":tt("mouseleave",hn);break;case"focus":tt(t_?"focusout":"blur",pe);break;case"focusin":tt("focusout",pe);break}})}function En(){h.forEach(function(x){var Y=x.node,le=x.eventType,Be=x.handler,Ee=x.options;Y.removeEventListener(le,Be,Ee)}),h=[]}function fn(x){var Y,le=!1;if(!(!v.state.isEnabled||Pt(x)||l)){var Be=((Y=d)==null?void 0:Y.type)==="focus";d=x,g=x.currentTarget,J(),!v.state.isVisible&&W0(x)&&$i.forEach(function(Ee){return Ee(x)}),x.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||s)&&v.props.hideOnClick!==!1&&v.state.isVisible?le=!0:Oe(x),x.type==="click"&&(s=!le),le&&!Be&&Ot(x)}}function qt(x){var Y=x.target,le=$().contains(Y)||_.contains(Y);if(!(x.type==="mousemove"&&le)){var Be=$e().concat(_).map(function(Ee){var ut,At=Ee._tippy,eo=(ut=At.popperInstance)==null?void 0:ut.state;return eo?{popperRect:Ee.getBoundingClientRect(),popperState:eo,props:n}:null}).filter(Boolean);J0(Be,x)&&(Q(),Ot(x))}}function hn(x){var Y=Pt(x)||v.props.trigger.indexOf("click")>=0&&s;if(!Y){if(v.props.interactive){v.hideWithInteractivity(x);return}Ot(x)}}function pe(x){v.props.trigger.indexOf("focusin")<0&&x.target!==$()||v.props.interactive&&x.relatedTarget&&_.contains(x.relatedTarget)||Ot(x)}function Pt(x){return On.isTouch?z()!==x.type.indexOf("touch")>=0:!1}function wt(){se();var x=v.props,Y=x.popperOptions,le=x.placement,Be=x.offset,Ee=x.getReferenceClientRect,ut=x.moveTransition,At=G()?Wl(_).arrow:null,eo=Ee?{getBoundingClientRect:Ee,contextElement:Ee.contextElement||$()}:t,Or={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(T){var P=T.state;if(G()){var ue=q(),We=ue.box;["placement","reference-hidden","escaped"].forEach(function(Ue){Ue==="placement"?We.setAttribute("data-placement",P.placement):P.attributes.popper["data-popper-"+Ue]?We.setAttribute("data-"+Ue,""):We.removeAttribute("data-"+Ue)}),P.attributes.popper={}}}},$t=[{name:"offset",options:{offset:Be}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!ut}},Or];G()&&At&&$t.push({name:"arrow",options:{element:At,padding:3}}),$t.push.apply($t,(Y==null?void 0:Y.modifiers)||[]),v.popperInstance=P0(eo,_,Object.assign({},Y,{placement:le,onFirstUpdate:f,modifiers:$t}))}function se(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function Tt(){var x=v.props.appendTo,Y,le=$();v.props.interactive&&x===Qh||x==="parent"?Y=le.parentNode:Y=em(x,[le]),Y.contains(_)||Y.appendChild(_),v.state.isMounted=!0,wt(),process.env.NODE_ENV!=="production"&&Wn(v.props.interactive&&x===Gt.appendTo&&le.nextElementSibling!==_,["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 $e(){return Ns(_.querySelectorAll("[data-tippy-root]"))}function Oe(x){v.clearDelayTimeouts(),x&&O("onTrigger",[v,x]),Re();var Y=ee(!0),le=M(),Be=le[0],Ee=le[1];On.isTouch&&Be==="hold"&&Ee&&(Y=Ee),Y?o=setTimeout(function(){v.show()},Y):v.show()}function Ot(x){if(v.clearDelayTimeouts(),O("onUntrigger",[v,x]),!v.state.isVisible){X();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(x.type)>=0&&s)){var Y=ee(!1);Y?r=setTimeout(function(){v.state.isVisible&&v.hide()},Y):i=requestAnimationFrame(function(){v.hide()})}}function nt(){v.state.isEnabled=!0}function mn(){v.hide(),v.state.isEnabled=!1}function Mt(){clearTimeout(o),clearTimeout(r),cancelAnimationFrame(i)}function L(x){if(process.env.NODE_ENV!=="production"&&Wn(v.state.isDestroyed,Qo("setProps")),!v.state.isDestroyed){O("onBeforeUpdate",[v,x]),En();var Y=v.props,le=Qd(t,Object.assign({},Y,Gd(x),{ignoreAttributes:!0}));v.props=le,en(),Y.interactiveDebounce!==le.interactiveDebounce&&(Q(),m=Wd(qt,le.interactiveDebounce)),Y.triggerTarget&&!le.triggerTarget?or(Y.triggerTarget).forEach(function(Be){Be.removeAttribute("aria-expanded")}):le.triggerTarget&&t.removeAttribute("aria-expanded"),J(),S(),R&&R(Y,le),v.popperInstance&&(wt(),$e().forEach(function(Be){requestAnimationFrame(Be._tippy.popperInstance.forceUpdate)})),O("onAfterUpdate",[v,x])}}function K(x){v.setProps({content:x})}function fe(){process.env.NODE_ENV!=="production"&&Wn(v.state.isDestroyed,Qo("show"));var x=v.state.isVisible,Y=v.state.isDestroyed,le=!v.state.isEnabled,Be=On.isTouch&&!v.props.touch,Ee=tl(v.props.duration,0,Gt.duration);if(!(x||Y||le||Be)&&!$().hasAttribute("disabled")&&(O("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,G()&&(_.style.visibility="visible"),S(),Re(),v.state.isMounted||(_.style.transition="none"),G()){var ut=q(),At=ut.box,eo=ut.content;nl([At,eo],0)}f=function(){var $t;if(!(!v.state.isVisible||u)){if(u=!0,_.offsetHeight,_.style.transition=v.props.moveTransition,G()&&v.props.animation){var w=q(),T=w.box,P=w.content;nl([T,P],Ee),Yd([T,P],"visible")}F(),J(),jd(rl,v),($t=v.popperInstance)==null||$t.forceUpdate(),O("onMount",[v]),v.props.animation&&G()&&ke(Ee,function(){v.state.isShown=!0,O("onShown",[v])})}},Tt()}}function Me(){process.env.NODE_ENV!=="production"&&Wn(v.state.isDestroyed,Qo("hide"));var x=!v.state.isVisible,Y=v.state.isDestroyed,le=!v.state.isEnabled,Be=tl(v.props.duration,1,Gt.duration);if(!(x||Y||le)&&(O("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,u=!1,s=!1,G()&&(_.style.visibility="hidden"),Q(),X(),S(!0),G()){var Ee=q(),ut=Ee.box,At=Ee.content;v.props.animation&&(nl([ut,At],Be),Yd([ut,At],"hidden"))}F(),J(),v.props.animation?G()&&be(Be,v.unmount):v.unmount()}}function rt(x){process.env.NODE_ENV!=="production"&&Wn(v.state.isDestroyed,Qo("hideWithInteractivity")),U().addEventListener("mousemove",m),jd($i,m),m(x)}function Kt(){process.env.NODE_ENV!=="production"&&Wn(v.state.isDestroyed,Qo("unmount")),v.state.isVisible&&v.hide(),v.state.isMounted&&(se(),$e().forEach(function(x){x._tippy.unmount()}),_.parentNode&&_.parentNode.removeChild(_),rl=rl.filter(function(x){return x!==v}),v.state.isMounted=!1,O("onHidden",[v]))}function Tr(){process.env.NODE_ENV!=="production"&&Wn(v.state.isDestroyed,Qo("destroy")),!v.state.isDestroyed&&(v.clearDelayTimeouts(),v.unmount(),En(),delete t._tippy,v.state.isDestroyed=!0,O("onDestroy",[v]))}}function dn(t,e){e===void 0&&(e={});var n=Gt.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(r_(t),im(e,n)),Q0();var o=Object.assign({},e,{plugins:n}),r=G0(t);if(process.env.NODE_ENV!=="production"){var i=pi(o.content),s=r.length>1;Wn(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,u){var d=u&&d_(u,o);return d&&c.push(d),c},[]);return pi(t)?l[0]:l}dn.defaultProps=Gt;dn.setDefaultProps=a_;dn.currentInput=On;Object.assign({},Hh,{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)}});dn.setDefaultProps({render:sm});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:u,to:d})=>{const{doc:p,selection:f}=c,{empty:h}=f,m=!p.textBetween(u,d).length&&ba(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 u=!(c!=null&&c.selection.eq(l.state.selection)),d=!(c!=null&&c.doc.eq(l.state.doc));!u&&!d||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(l,u,d,c)},this.updateDelay))},this.updateHandler=(l,c,u,d)=>{var p,f,h;const{state:m,composing:g}=l,{selection:b}=m;if(g||!c&&!u)return;this.createTooltip();const{ranges:k}=b,E=Math.min(...k.map(_=>_.$from.pos)),v=Math.max(...k.map(_=>_.$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:d,from:E,to:v}))){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(Ph(m.selection)){let _=l.nodeDOM(E);if(_){const R=_.dataset.nodeViewWrapper?_:_.querySelector("[data-node-view-wrapper]");if(R&&(_=R.firstChild),_)return _.getBoundingClientRect()}}return $h(l,E,v)})}),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=dn(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 am=t=>new Ae({key:typeof t.pluginKey=="string"?new xe(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?[am({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class f_{getTextContent(e){return Ih(e,{textSerializers:Rc(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:u,empty:d}=c,p=u.depth===1,f=u.parent.isTextblock&&!u.parent.type.spec.code&&!u.parent.textContent&&u.parent.childCount===0&&!this.getTextContent(u.parent);return!(!s.hasFocus()||!d||!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=dn(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:u,to:d}=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)||(()=>$h(e,u,d))}),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 lm=t=>new Ae({key:typeof t.pluginKey=="string"?new xe(t.pluginKey):t.pluginKey,view:e=>new f_({view:e,...t})});De.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[lm({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});const h_=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(am({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 np(t){return a.customRef((e,n)=>({get(){return e(),t},set(o){t=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class cm extends Zt{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=np(this.view.state),this.reactiveExtensionStorage=np(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 m_=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}})}}),g_=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(lm({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))}}}),Pn=a.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return a.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),qc=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))}}),b_=(t={})=>{const e=a.shallowRef();return a.onMounted(()=>{e.value=new cm(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 Kc{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 ct={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 y_ extends RE{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 Kc(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 pn(t,e){return n=>{if(!n.editor.contentComponent)return{};const o=typeof t=="function"&&"__vccOpts"in t?t.__vccOpts:t;return new y_(o,n,e)}}const v_=/^\s*>\s$/,um=ze.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",_e(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[mr({find:v_,type:this.type})]}}),k_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,w_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,E_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,__=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,C_=ln.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",_e(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[Wo({find:k_,type:this.type}),Wo({find:E_,type:this.type})]},addPasteRules(){return[ko({find:w_,type:this.type}),ko({find:__,type:this.type})]}}),S_="listItem",op="textStyle",rp=/^\s*([-+*])\s$/,x_=ze.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",_e(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(S_,this.editor.getAttributes(op)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=mr({find:rp,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=mr({find:rp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(op),editor:this.editor})),[t]}}),N_=/(^|[^`])`([^`]+)`(?!`)/,T_=/(^|[^`])`([^`]+)`(?!`)/g,O_=ln.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",_e(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[Wo({find:N_,type:this.type})]},addPasteRules(){return[ko({find:T_,type:this.type})]}}),M_=/^```([a-z]+)?[\s\n]$/,A_=/^~~~([a-z]+)?[\s\n]$/,dm=ze.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",_e(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:u})=>(u.setSelection(ae.near(o.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[zl({find:M_,type:this.type,getAttributes:t=>({language:t[1]})}),zl({find:A_,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ae({key:new xe("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(ne.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),Ts=ze.create({name:"doc",topNode:!0,content:"block+"});function R_(t={}){return new Ae({view(e){return new B_(e,t)}})}class B_{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 u=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(u){let d=u.getBoundingClientRect(),p=l?d.bottom:d.top;l&&c&&(p=(p+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),o={left:d.left,right:d.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=Sf(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 D_=De.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[R_(this.options)]}});class Ze extends ae{constructor(e){super(e,e)}map(e,n){let o=e.resolve(n.map(this.head));return Ze.valid(o)?new Ze(o):ae.near(o)}content(){return V.empty}eq(e){return e instanceof Ze&&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 Ze(e.resolve(n.pos))}getBookmark(){return new Wc(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!I_(e)||!L_(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&&Ze.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(Ze.valid(c))return c}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!oe.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(Ze.valid(l))return l}return null}}}Ze.prototype.visible=!1;Ze.findFrom=Ze.findGapCursorFrom;ae.jsonID("gapcursor",Ze);class Wc{constructor(e){this.pos=e}map(e){return new Wc(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ze.valid(n)?new Ze(n):ae.near(n)}}function I_(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 L_(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 P_(){return new Ae({props:{decorations:z_,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ze.valid(n)?new Ze(n):null},handleClick:F_,handleKeyDown:$_,handleDOMEvents:{beforeinput:V_}}})}const $_=Cc({ArrowLeft:Fi("horiz",-1),ArrowRight:Fi("horiz",1),ArrowUp:Fi("vert",-1),ArrowDown:Fi("vert",1)});function Fi(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 ne){if(!i.endOfTextblock(n)||l.depth==0)return!1;c=!1,l=o.doc.resolve(e>0?l.after():l.before())}let u=Ze.findGapCursorFrom(l,e,c);return u?(r&&r(o.tr.setSelection(new Ze(u))),!0):!1}}function F_(t,e,n){if(!t||!t.editable)return!1;let o=t.state.doc.resolve(e);if(!Ze.valid(o))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&oe.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ze(o))),!0)}function V_(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Ze))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(ne.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function z_(t){if(!(t.selection instanceof Ze))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ne.create(t.doc,[Ge.widget(t.selection.head,e,{key:"gapcursor"})])}const H_=De.create({name:"gapCursor",addProseMirrorPlugins(){return[P_()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ve(j(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),U_=ze.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",_e(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:u,dispatch:d})=>{if(d&&c&&s){const p=c.filter(f=>l.includes(f.type.name));u.ensureMarks(p)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),pm=ze.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]}`,_e(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 Os=200,ht=function(){};ht.prototype.append=function(e){return e.length?(e=ht.from(e),!this.length&&e||e.length<Os&&this.leafAppend(e)||this.length<Os&&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 q_(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 fm(e):ht.empty};var fm=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<=Os)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Os)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 fm([]);var q_=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 K_=500;class bn{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,u=[],d=[];return this.items.forEach((p,f)=>{if(!p.step){r||(r=this.remapping(o,f+1),i=r.maps.length),i--,d.push(p);return}if(r){d.push(new xn(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],u.push(new xn(m,void 0,void 0,u.length+d.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 bn(this.items.slice(0,o).append(d.reverse().concat(u)),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 d=0;d<e.steps.length;d++){let p=e.steps[d].invert(e.docs[d]),f=new xn(e.mapping.maps[d],p,n),h;(h=c&&c.merge(f))&&(f=h,d?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(s++,n=void 0),r||(c=f)}let u=s-o.depth;return u>j_&&(l=W_(l,u),s-=u),new bn(l.append(i),s)}remapping(e,n){let o=new oi;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 bn(this.items.append(e.map(n=>new xn(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 xn(m,g,b))}else o.push(new xn(m))},r);let u=[];for(let f=n;f<s;f++)u.push(new xn(i.maps[f]));let d=this.items.slice(0,r).append(u).append(o),p=new bn(d,l);return p.emptyItemCount()>K_&&(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)),u=c&&c.getMap();if(o--,u&&n.appendMap(u,o),c){let d=s.selection&&s.selection.map(n.slice(o));d&&i++;let p=new xn(u.invert(),c,d),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 bn(ht.from(r.reverse()),i)}}bn.empty=new bn(ht.empty,0);function W_(t,e){let n;return t.forEach((o,r)=>{if(o.selection&&e--==0)return n=r,!1}),t.slice(n)}class xn{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 xn(n.getMap().invert(),n,this.selection)}}}class so{constructor(e,n,o,r,i){this.done=e,this.undone=n,this.prevRanges=o,this.prevTime=r,this.prevComposition=i}}const j_=20;function G_(t,e,n,o){let r=n.getMeta(Vo),i;if(r)return r.historyState;n.getMeta(X_)&&(t=new so(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Vo))return s.getMeta(Vo).redo?new so(t.done.addTransform(n,void 0,o,ls(e)),t.undone,ip(n.mapping.maps),t.prevTime,t.prevComposition):new so(t.done,t.undone.addTransform(n,void 0,o,ls(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||!Y_(n,t.prevRanges)),u=s?il(t.prevRanges,n.mapping):ip(n.mapping.maps);return new so(t.done.addTransform(n,c?e.selection.getBookmark():void 0,o,ls(e)),bn.empty,u,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new so(t.done.rebased(n,i),t.undone.rebased(n,i),il(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new so(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),il(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Y_(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 ip(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 il(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 J_(t,e,n){let o=ls(e),r=Vo.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 so(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(Vo,{redo:n,historyState:c})}let sl=!1,sp=null;function ls(t){let e=t.plugins;if(sp!=e){sl=!1,sp=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){sl=!0;break}}return sl}const Vo=new xe("history"),X_=new xe("closeHistory");function Z_(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ae({key:Vo,state:{init(){return new so(bn.empty,bn.empty,null,0,-1)},apply(e,n,o){return G_(n,o,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let o=n.inputType,r=o=="historyUndo"?mm:o=="historyRedo"?gm:null;return r?(n.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function hm(t,e){return(n,o)=>{let r=Vo.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(o){let i=J_(r,n,t);i&&o(e?i.scrollIntoView():i)}return!0}}const mm=hm(!1,!0),gm=hm(!0,!0),Q_=De.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>mm(t,e),redo:()=>({state:t,dispatch:e})=>gm(t,e)}},addProseMirrorPlugins(){return[Z_(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()}}}),bm=ze.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",_e(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}):Ph(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:u}=s.selection,d=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?s.setSelection(ne.create(s.doc,u.pos+1)):u.nodeAfter.isBlock?s.setSelection(oe.create(s.doc,u.pos)):s.setSelection(ne.create(s.doc,u.pos));else{const p=(c=u.parent.type.contentMatch.defaultType)===null||c===void 0?void 0:c.create();p&&(s.insert(d,p),s.setSelection(ne.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ka({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),eC=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,tC=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,nC=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,oC=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,rC=ln.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",_e(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[Wo({find:eC,type:this.type}),Wo({find:nC,type:this.type})]},addPasteRules(){return[ko({find:tC,type:this.type}),ko({find:oC,type:this.type})]}}),iC=ze.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",_e(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)}}}),sC="listItem",ap="textStyle",lp=/^(\d+)\.\s$/,aC=ze.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",_e(this.options.HTMLAttributes,n),0]:["ol",_e(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(sC,this.editor.getAttributes(ap)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=mr({find:lp,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=mr({find:lp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(ap)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),ym=ze.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",_e(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),lC=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,cC=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,uC=ln.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",_e(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[Wo({find:lC,type:this.type})]},addPasteRules(){return[ko({find:cC,type:this.type})]}}),vm=ze.create({name:"text",group:"inline"}),dC=De.create({name:"starterKit",addExtensions(){var t,e,n,o,r,i,s,l,c,u,d,p,f,h,m,g,b,y;const k=[];return this.options.bold!==!1&&k.push(C_.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&k.push(um.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&k.push(x_.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&k.push(O_.configure((o=this.options)===null||o===void 0?void 0:o.code)),this.options.codeBlock!==!1&&k.push(dm.configure((r=this.options)===null||r===void 0?void 0:r.codeBlock)),this.options.document!==!1&&k.push(Ts.configure((i=this.options)===null||i===void 0?void 0:i.document)),this.options.dropcursor!==!1&&k.push(D_.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&k.push(H_.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&k.push(U_.configure((c=this.options)===null||c===void 0?void 0:c.hardBreak)),this.options.heading!==!1&&k.push(pm.configure((u=this.options)===null||u===void 0?void 0:u.heading)),this.options.history!==!1&&k.push(Q_.configure((d=this.options)===null||d===void 0?void 0:d.history)),this.options.horizontalRule!==!1&&k.push(bm.configure((p=this.options)===null||p===void 0?void 0:p.horizontalRule)),this.options.italic!==!1&&k.push(rC.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&k.push(iC.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&k.push(aC.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&k.push(ym.configure((g=this.options)===null||g===void 0?void 0:g.paragraph)),this.options.strike!==!1&&k.push(uC.configure((b=this.options)===null||b===void 0?void 0:b.strike)),this.options.text!==!1&&k.push(vm.configure((y=this.options)===null||y===void 0?void 0:y.text)),k}}),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}`)})},fC=ln.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",_e(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}}}}),re=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))}}),km={deepseek:{baseURL:"https://api.deepseek.com/v1",name:"DeepSeek"},openai:{baseURL:"https://api.openai.com/v1",name:"OpenAI"}},jc=(t,e)=>{const n=km[t];return n?n[e]:null},Gc={writing:"You are a professional writing assistant. Please answer in [LANGUAGE]."},me={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"},hC=[{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"}],Sr=[{label:"editor.paragraph",value:"paragraph",icon:"title",color:"",style:!0,group:"label.basic"},{label:"editor.heading1",value:"heading",icon:"format_h1",color:me.blue,style:!0,options:{level:1}},{label:"editor.heading2",value:"heading",icon:"format_h2",color:me.blue,style:!0,options:{level:2}},{label:"editor.heading3",value:"heading",icon:"format_h3",color:me.blue,style:!0,options:{level:3}},{label:"editor.todoList",value:"taskList",icon:"check_box",color:me.indigo,style:!0},{label:"editor.unorderedList",value:"bulletList",icon:"format_list_bulleted",color:me.indigo,style:!0},{label:"editor.orderedList",value:"orderedList",icon:"format_list_numbered",color:me.indigo,style:!0},{label:"editor.blockquote",value:"blockquote",icon:"format_quote_open",color:me.brown,style:!0},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",color:me.lightBlue,style:!0},{label:"editor.horizontal",value:"horizontalRule",icon:"horizontal_rule",color:me.blue},{label:"editor.callout",value:"callout",color:me.deepOrange,icon:"card_text",style:!1},{label:"editor.emoji",value:"emoji",icon:"emoji_emotions",color:me.blue}],hi=Sr.filter(t=>t.style),kr=[{label:"editor.aiBlock",value:"aiBlock",icon:"auto_awesome",color:me.purple,tips:"ai",group:"label.ai"},{label:"editor.callout",value:"callout",icon:"card_text",color:me.deepOrange,tips:"callout",group:"label.common"},{label:"editor.table",value:"table",icon:"window",tips:"table",color:me.cyan},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",tips:"code",color:me.blue},{label:"editor.todoList",value:"taskList",icon:"check_box",tips:"task",color:me.indigo},{label:"label.image",value:"image",icon:"image",color:me.amber,tips:"image",group:"label.media"},{label:"label.video",value:"video",icon:"videocam",tips:"video",color:me.purple},{label:"label.model",value:"modelViewer",icon:"3d_rotation",tips:"model",color:me.purple}],Ea=[...Sr,...kr],jl=[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:me.blue,tips:"Ctrl+D",group:"label.common",filter:"common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Ctrl+D",color:me.deepOrange,filter:"common"},{label:"label.replace",value:"replace",icon:"cached",tips:"Ctrl+R",color:me.blue,filter:"image,video,model"},{label:"label.color",value:"palette",icon:"palette",color:me.purple,filter:"callout",component:"OCalloutColorBoard"}],wm=[{label:"ai.improve_writing",value:"improve_writing",icon:"title",color:me.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:me.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:me.purple,options:{prompt:"Enrich the following content with Emoji: [CONTENT]"},tips:"emoji"},{label:"ai.translate",value:"translate",icon:"translate",color:me.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:me.purple,options:{prompt:"Make following content longer: [CONTENT]"},group:"label.edit",tips:"long"},{label:"ai.make_shorter",value:"make_shorter",icon:"short_text",color:me.purple,options:{prompt:"Make following content shorter: [CONTENT]"},tips:"short"},{label:"ai.change_tone",value:"change_tone",icon:"invert_colors",color:me.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:me.purple,options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"explain",group:"label.think"}],Em=[{label:"ai.summarize",value:"summarize",icon:"notes",color:me.purple,options:{prompt:"Summarize the following content: [CONTENT]"},group:"label.suggested"},{label:"ai.continuation",value:"continuation",icon:"edit_note",color:me.purple,options:{prompt:"Continue writing with the content: [CONTENT]"}}],_m=["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"],Cm=["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"],Sm=["bold","strike","text-color-dropdown","clearFormat","separator","ai","separator","list-group","link","callout","separator","align-dropdown","more"],xm=["link-open","link-edit","linkUnset"],Nm=["align-group","separator","link"],Tm=["align-group","separator","link-open","link-edit","linkUnset"],Om=["heading","separator","italic","underline","font-family","separator","code","blockquote"],Mm=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],mC=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],Am=["style-dropdown","separator","bold","italic","text-color-dropdown","separator","align-dropdown"],gC=["table-group","separator","align-group"],bC={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"]},yC=new zb({breaks:!0});function Yc(){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||jc(r,"baseURL");!r||!i||!l||(e.value=new Vb({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 u=await((s=e.value)==null?void 0:s.chat.completions.create({model:"deepseek-chat",messages:r,temperature:.7,stream:!0}));let d="";for await(const p of u){const f=((c=(l=p.choices[0])==null?void 0:l.delta)==null?void 0:c.content)||"";d+=f,i(f)}return d}catch(u){throw console.error("API Error:",u),new Error(u.message||"API request failed")}};return a.watch(()=>t,r=>{n()},{deep:!0}),a.onMounted(()=>{n()}),{md:yC,aiOption:t,createStreamingChatCompletion:o}}function Rm(){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 cp={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"}},vC={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"}},up={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:"韩语"}},wC={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:"在新標籤頁打開"}},Bm={en:cp,"en-us":cp,pl:vC,"pt-br":kC,zh:up,"zh-hans":up,"zh-hant":wC},EC="en",_C=Bm[EC],CC=t=>Bm[t]||_C;function ge(){const t=a.inject("locale",{value:"en"}),e=a.computed(()=>CC(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 xr(){const t=a.inject("darkMode",{value:!1}),e=a.computed(()=>t.value?"dark":"light");return{darkMode:t,theme:e}}function Te(){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 Qn=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}=xr(),o=a.ref(),r=a.ref(),i=a.ref();function s(){i.value=dn(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,u)=>(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(Qn,{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(re,{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"]))}}),SC=a.defineComponent({__name:"OSimpleCommandBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const e=t,{run:n}=Te(),{tr:o}=ge(),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 u;return a.openBlock(),a.createBlock(Le,{class:"o-simple-command-btn",icon:i.value.icon,tooltip:i.value.tooltip,"content-class":{"is-active":(u=t.editor)==null?void 0:u.isActive(t.name),"rotate-90":i.value.rotate},onClick:s},null,8,["icon","tooltip","content-class"])}}}),xC={class:"o-block-placeholder"},NC={class:"icon"},TC={class:"placeholder"},Jc=a.defineComponent({__name:"OBlockPlaceholder",props:{icon:{type:String,default:"image"},placeholder:{type:String,default:""}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("section",xC,[a.createElementVNode("div",NC,[a.createVNode(a.unref(re),{name:t.icon},null,8,["name"])]),a.createElementVNode("div",TC,a.toDisplayString(t.placeholder),1)]))}}),OC={class:"group o-tips"},MC={key:1,class:"item"},_a=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}=ge(),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 u(){l.value=(l.value+n.items.length-1)%n.items.length}function d(){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(),u();break;case"ArrowDown":h.preventDefault(),d();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(Qt),{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(Lt),{key:0})):a.createCommentVNode("",!0),a.createElementVNode("div",OC,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:k=>s(k,b),placement:"right-start",offset:[-10,16]},{trigger:a.withCtx(()=>[a.createVNode(a.unref(Gl),{item:g,class:a.normalizeClass(["item",{"is-active":b===l.value}]),clickable:""},null,8,["item","class"])]),default:a.withCtx(()=>[a.createVNode(a.unref(_a),{items:g.children,onSelect:k=>c(g,b,k)},null,8,["items","onSelect"])]),_:2},1536)):(a.openBlock(),a.createBlock(a.unref(Gl),{key:2,item:g,class:a.normalizeClass(["item",{"is-active":b===l.value}]),clickable:"",onClick:k=>c(g,b)},null,8,["item","class","onClick"]))],64)}),128)):(a.openBlock(),a.createElementBlock("div",MC,a.toDisplayString(a.unref(r)("label.noResults")),1))]),_:1}))}}),AC={key:0,class:"o-tips"},Gl=a.defineComponent({__name:"OBlockListItem",props:{item:{type:Object,required:!0}},emits:["select"],setup(t,{emit:e}){const{tr:n}=ge();return(o,r)=>(a.openBlock(),a.createBlock(a.unref(Ut),{class:"o-block-list-item",clickable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{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",AC,a.toDisplayString(t.item.tips),1)):a.createCommentVNode("",!0),(i=t.item.children)!=null&&i.length?(a.openBlock(),a.createBlock(a.unref(re),{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}))}}),RC={key:1,class:"group o-tips"},BC={class:"suffix o-tips"},DC={key:1,class:"item"},So=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}=ge(),i=a.ref([]),s=a.computed(()=>{var h;return(h=n.node)==null?void 0:h.type.name}),l=a.computed(()=>{const h=jl.filter(g=>{var b;return((b=g.filter)==null?void 0:b.indexOf("common"))>=0}),m=jl.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 Zc;default:return null}}function u(h){o("action",h),setTimeout(()=>{d(h)},0)}function d(h){switch(h.value){case"delete":n.deleteNode();break;case"duplicate":p();break}}function p(){var y,k,E;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"}),(k=n.editor)==null||k.commands.insertContentAt(m,g);const b=m+h+1;(E=n.editor)==null||E.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(Qt),{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(Lt),{key:0})):a.createCommentVNode("",!0),t.showGroup?(a.openBlock(),a.createElementBlock("div",RC,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(Ut),{class:"item",clickable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:g.icon,color:t.colorful?g.color:""},null,8,["name","color"])]),suffix:a.withCtx(()=>[a.createVNode(a.unref(re),{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(Ut),{key:2,class:"item",clickable:"",onClick:y=>u(g)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:g.icon,color:t.colorful?g.color:""},null,8,["name","color"])]),suffix:a.withCtx(()=>[a.createElementVNode("div",BC,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",DC,"No result"))]),_:1}))}}),Zn=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,u;l?(c=r.value)==null||c.setShow(!0):(u=r.value)==null||u.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"]))}}),IC={class:"o-block-toolbar editable-only"},LC={class:"button-group"},Xc=a.defineComponent({__name:"OBlockToolbar",props:{...ct,type:{type:String,default:"link"}},emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=ge(),s=a.ref();function l(c){var u;o("action",c),(u=s.value)==null||u.setShow(!1)}return(c,u)=>(a.openBlock(),a.createElementBlock("div",IC,[a.createElementVNode("section",LC,[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(lt),{icon:"more_horiz",tooltip:a.unref(i)("label.more")},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(So),a.mergeProps(n,{onAction:l}),null,16)]),_:1},512)])]))}}),PC={class:"o-callout-color-board"},$C={class:"fore-colors"},FC={class:"color-row"},VC={class:"color-row"},zC={class:"back-colors"},HC={class:"color-row"},UC={class:"color-row"},Zc=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",PC,[a.createElementVNode("section",$C,[l[4]||(l[4]=a.createElementVNode("div",{class:"label o-tips"},"Border color",-1)),a.createElementVNode("div",FC,[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",VC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,(c,u)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:`col-${u}`,tooltip:c.label,"content-style":{borderColor:c.value},onClick:d=>o("foreColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])]),a.createElementVNode("section",zC,[l[5]||(l[5]=a.createElementVNode("div",{class:"label o-tips"},"Background",-1)),a.createElementVNode("div",HC,[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",UC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(c,u)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:`col-${u}`,tooltip:c.label,"content-style":{backgroundColor:c.value},onClick:d=>o("backColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),qC=a.defineComponent({__name:"OCalloutColorDropdown",props:{editor:{type:Object}},emits:["select"],setup(t,{emit:e}){const n=e,{tr:o}=ge(),{run:r}=Te(),i=a.ref(null),s=a.ref(""),l=a.ref("");function c(u,d){u==="foreColor"?(s.value=d,localStorage.setItem("yiitap.text-color.fore",d)):u==="backColor"&&(l.value=d,localStorage.setItem("yiitap.text-color.back",d)),n("select",u,d)}return a.onMounted(()=>{s.value=localStorage.getItem("yiitap.text-color.fore")||"",l.value=localStorage.getItem("yiitap.text-color.back")||""}),(u,d)=>(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(lt),{icon:"palette",tooltip:a.unref(o)("editor.textColor")},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>{var p;return[a.createVNode(a.unref(Zc),{"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))}}),xi=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 u;(u=r.value)==null||u.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"]))}}),KC={class:"o-color-board"},WC={class:"cell-container"},jC={class:"label"},GC=["onClick"],Ca=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,u)=>(a.openBlock(),a.createElementBlock("section",KC,[a.createElementVNode("div",{class:"default-color",onClick:u[0]||(u[0]=d=>r({hex:t.defaultColor}))},[a.createElementVNode("div",WC,[a.createElementVNode("div",{class:"cell border",style:a.normalizeStyle({background:t.defaultColor})},[a.createVNode(a.unref(re),{name:"slash_forward"})],4)]),a.createElementVNode("div",jC,a.toDisplayString(t.defaultLabel),1)]),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(l.value,(d,p)=>(a.openBlock(),a.createElementBlock("div",{class:"color-row",key:`row-${p}`},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d,(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(re),{key:0,name:"done",style:a.normalizeStyle({color:s(f.rgb)})},null,8,["style"])):a.createCommentVNode("",!0)],6)],8,GC)]))),128))]))),128))]))}}),lt=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(Qn),{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(re),{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"]))}}),YC={key:0,class:"o-doc-toc toc"},JC={class:"mini-view"},XC={class:"toc__list"},ZC={class:"main-view o-scroll"},QC={class:"toc__title"},eS={class:"toc__list"},tS=["onClick"],nS=a.defineComponent({name:"ODocToc",__name:"ODocToc",props:{editor:{type:Zt},maxLevel:{type:Number,default:3}},emits:["docScroll"],setup(t,{expose:e,emit:n}){const o=t,r=n,{tr:i}=ge(),s=a.ref([]),l=a.ref("");function c(){var h;l.value=window.location.hash,(h=o.editor)==null||h.on("update",d),setTimeout(()=>{u(),d()},0)}function u(){const h=document.querySelector(".yiitap"),m=h==null?void 0:h.parentElement;m==null||m.addEventListener("scroll",p)}function d(){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",YC,[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",JC,[a.createElementVNode("ul",XC,[(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",ZC,[a.createElementVNode("div",QC,a.toDisplayString(a.unref(i)("label.toc")),1),a.createElementVNode("ul",eS,[(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,tS)],2))),128))])])]),_:1},512)])):a.createCommentVNode("",!0)}}),oS={class:"o-emoji-select"},rS={key:0},iS={class:"groups o-scroll"},sS={class:"items"},aS=["onClick"],lS={key:0,class:"groups-empty"},cS={class:"group-icons"},uS=["onClick"],Sa=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),u=a.computed(()=>i.value?s.value:n.items),d=a.computed(()=>{let m=!1;return u.value.map(g=>{m=m||g.emojis.length}),m});function p(){c.value=0,s.value=i.value?ei.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",oS,[t.enableSearch?(a.openBlock(),a.createElementBlock("div",rS,[a.createVNode(a.unref(Ln),{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(re),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])])):a.createCommentVNode("",!0),a.createElementVNode("section",iS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(u.value,(b,y)=>{var k;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",sS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(b.emojis,(E,v)=>(a.openBlock(),a.createElementBlock("div",{key:`item-${v}`},[a.createElementVNode("div",{class:"item",onClick:C=>f(E)},a.toDisplayString(E.emoji),9,aS)]))),128))])],512)),[[a.vShow,(k=b.emojis)==null?void 0:k.length]])}),128)),d.value?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",lS,"没有记录"))]),a.createElementVNode("section",cS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(u.value,(b,y)=>(a.openBlock(),a.createBlock(a.unref(Qn),{key:`target-${y}`,delay:300},{trigger:a.withCtx(()=>{var k;return[a.withDirectives(a.createElementVNode("div",{class:a.normalizeClass(["item",{active:c.value===y}]),onClick:E=>h(b,y)},[a.createVNode(a.unref(re),{name:a.unref(ei.emojiGroupIcons)[b.slug]},null,8,["name"])],10,uS),[[a.vShow,(k=b.emojis)==null?void 0:k.length]])]}),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(b.name),1)]),_:2},1024))),128))])]))}}),al=[{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"},pS={class:"header"},fS={class:"o-scroll"},Dm=a.defineComponent({__name:"OLanguageDropdown",props:{language:{type:String,default:"shell"}},emits:["select"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=ge(),i=a.ref(),s=a.ref(),l=a.ref(""),c=a.ref(0),u=a.ref(""),d=a.computed(()=>l.value?al.filter(y=>y.value.toLowerCase().indexOf(l.value.toLowerCase())>=0):al),p=a.computed(()=>al.find(y=>y.value===u.value));function f(y){y&&setTimeout(()=>{var k;(k=s.value)==null||k.focus(),c.value=0,window.addEventListener("keyup",b)},0)}function h(){window.removeEventListener("keyup",b)}function m(y){h(),u.value=y.value,o("select",y.value)}function g(){m(d.value[c.value])}function b(y){if(d.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>=d.value.length&&(c.value=0),c.value<0&&(c.value=d.value.length-1)}else c.value=0}return a.onMounted(()=>{u.value=n.language}),(y,k)=>(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(St),{class:"o-dropdown-btn"},{default:a.withCtx(()=>{var E;return[a.createElementVNode("span",dS,a.toDisplayString((E=p.value)==null?void 0:E.label),1),a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]}),_:1})]),default:a.withCtx(()=>[a.createElementVNode("header",pS,[a.createVNode(a.unref(Ln),{ref_key:"input",ref:s,modelValue:l.value,"onUpdate:modelValue":k[0]||(k[0]=E=>l.value=E),type:"text",placeholder:"Search",autofocus:"",clearable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])]),a.createElementVNode("section",fS,[a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d.value,(E,v)=>(a.openBlock(),a.createBlock(a.unref(Ut),{key:v,onClick:C=>m(E),class:a.normalizeClass({"is-active":E.value===u.value,"is-select":v===c.value})},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:E.icon},null,8,["name"])]),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(E.label)+" ",1)]),_:2},1032,["onClick","class"]))),128))]),_:1})])]),_:1},512))}}),hS={class:"o-media-input"},mS={class:"fields"},gS={class:"actions"},Qc=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}=ge(),i=a.ref(),s=a.ref(""),l=a.ref("");function c(){return l.value?(s.value="null",!0):(s.value="error",!1)}function u(){c()&&o("input",l.value)}return a.onMounted(()=>{l.value=n.val,setTimeout(()=>{var d;(d=i.value)==null||d.focus()},0)}),(d,p)=>(a.openBlock(),a.createElementBlock("section",hS,[a.createElementVNode("section",mS,[p[1]||(p[1]=a.createElementVNode("div",{class:"o-media-title"},"Link",-1)),a.createVNode(a.unref(Ln),{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(re),{name:"link",class:"o-tips"})]),_:1},8,["modelValue","status"])]),a.createElementVNode("footer",gS,[a.createVNode(a.unref(St),{type:"info",onClick:u},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(a.unref(r)("label.ok")),1)]),_:1})])]))}}),bS={class:"o-meta-input"},yS={class:"header"},vS={class:"title"},kS={class:"fields"},wS={class:"actions"},eu=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}=ge(),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,u)=>(a.openBlock(),a.createElementBlock("section",bS,[a.createElementVNode("section",yS,[a.createElementVNode("div",vS,a.toDisplayString(t.title),1),a.createElementVNode("div",null,[a.renderSlot(c.$slots,"header-right")])]),a.createElementVNode("section",kS,[a.createVNode(a.unref(Ln),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":u[0]||(u[0]=d=>s.value=d),type:"text",autofocus:"",clearable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:t.icon,class:"o-tips"},null,8,["name"])]),_:1},8,["modelValue"])]),a.createElementVNode("footer",wS,[a.createVNode(a.unref(St),{type:"tertiary",onClick:u[1]||(u[1]=d=>o("cancel"))},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(a.unref(r)("label.cancel")),1)]),_:1}),a.createVNode(a.unref(St),{type:"info",onClick:l},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(a.unref(r)("label.ok")),1)]),_:1})])]))}}),ES={class:"o-table-grid"},_S=["onMouseover"],Im=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(u,d){i.value=u,s.value=d,o.value===u&&o.value<10&&(o.value+=1),r.value===d&&r.value<10&&(r.value+=1)}function c(){n("select",{rows:i.value,cols:s.value,withHeaderRow:!0})}return(u,d)=>(a.openBlock(),a.createElementBlock("section",ES,[(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,_S)]))),128))]))),128)),a.createElementVNode("footer",null,a.toDisplayString(i.value)+" x "+a.toDisplayString(s.value),1)]))}}),CS={class:"o-table-cell-background o-button-group"},SS={class:"o-command-btn"},Lm=a.defineComponent({__name:"OTableCellBackground",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),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,u)=>(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(Qn),{trigger:"hover"},{trigger:a.withCtx(()=>[a.createElementVNode("div",CS,[a.createElementVNode("div",{class:"o-command-btn label",onClick:a.withModifiers(s,["stop"])},[a.createVNode(a.unref(re),{name:"crop_16_9",class:"arrow"}),a.createElementVNode("div",{class:"indicator",style:a.normalizeStyle(`background: ${i.value}`)},null,4)]),a.createElementVNode("div",SS,[a.createVNode(a.unref(re),{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(Ca),{"default-color":"","default-label":a.unref(n)("editor.noColor"),onSelect:l},null,8,["default-label"])]),_:1},512))}}),xS={class:"o-simple-color-board"},NS={class:"fore-colors"},TS={class:"color-row"},OS={class:"color-row"},MS={class:"back-colors"},AS={class:"color-row"},RS={class:"color-row"},Pm=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",xS,[a.createElementVNode("section",NS,[l[4]||(l[4]=a.createElementVNode("div",{class:"label o-tips"},"Color",-1)),a.createElementVNode("div",TS,[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",OS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,(c,u)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:`col-${u}`,icon:"format_text",color:c.value,tooltip:c.label,onClick:d=>o("foreColor",c)},null,8,["color","tooltip","onClick"]))),128))])]),a.createElementVNode("section",MS,[l[5]||(l[5]=a.createElementVNode("div",{class:"label o-tips"},"Background",-1)),a.createElementVNode("div",AS,[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",RS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(c,u)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:`col-${u}`,icon:"format_text",tooltip:c.label,"content-style":{backgroundColor:c.value},onClick:d=>o("backColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}});class BS{constructor(){Je(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=dn(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 tu=new BS,jr=[{type:"paragraph",content:[]}],$m=[{type:"listItem",content:[{type:"paragraph",content:[]}]}],Fm=[{type:"taskItem",content:[{type:"paragraph",content:[]}]}],DS={class:"o-add-node-view"},IS={key:0,class:"view-main"},LS={class:"group o-tips"},PS={class:"panel"},$S={class:"group o-tips"},FS={key:1,class:"item"},VS={key:1,class:"view-emoji"},zS=a.defineComponent({__name:"AddNodeView",props:ct,emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=ge(),{run:s}=Te(),l=a.ref("main"),c=a.ref(0);function u(f){const h=n.editor.chain();let m=null;switch(f.value){case"blockquote":m={content:jr};break;case"callout":m={content:jr,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:$m};break;case"taskList":m={content:Fm};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(()=>{d.value?h.insertContent(m).focus().run():h.insertContentAt(p.value,m).focus().run()},1)),o("action",f)}const d=a.computed(()=>n.node.content.size===0),p=a.computed(()=>d.value?c.value:c.value+n.node.nodeSize);return a.onMounted(()=>{c.value=n.getPos()}),(f,h)=>(a.openBlock(),a.createElementBlock("section",DS,[l.value==="main"?(a.openBlock(),a.createElementBlock("section",IS,[a.createElementVNode("section",null,[a.createElementVNode("div",LS,a.toDisplayString(a.unref(i)("label.basic")),1),a.createElementVNode("section",PS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(Sr),(m,g)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:g,icon:m.icon,tooltip:a.unref(i)(m.label),quaternary:"",onClick:b=>u(m)},null,8,["icon","tooltip","onClick"]))),128))])]),a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[a.unref(kr).length?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(a.unref(kr),(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(Lt),{key:0})):a.createCommentVNode("",!0),a.createElementVNode("div",$S,a.toDisplayString(a.unref(i)(m.group)),1)],64)):a.createCommentVNode("",!0),a.createVNode(a.unref(Ut),{class:"item",clickable:"",onClick:b=>u(m)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{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",FS,"No result"))]),_:1})])):l.value==="emoji"?(a.openBlock(),a.createElementBlock("section",VS)):a.createCommentVNode("",!0)]))}}),HS=a.defineComponent({__name:"AddNode",props:ct,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(St),{type:"tertiary",class:"o-node-btn"},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"add",small:""})]),_:1})],2)]),default:a.withCtx(()=>[a.createVNode(zS,a.mergeProps(e,{onAction:i}),null,16)]),_:1},512))}}),US={class:"o-drag-node-view"},qS={key:0,class:"view-main"},KS={key:0},WS={class:"panel"},jS=a.defineComponent({__name:"DragNodeView",props:ct,emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=ge(),{run:s,onCommand:l}=Te(),c=a.ref("main"),u=a.ref(["heading","codeBlock","paragraph"]),d=a.computed(()=>{var b,y;const g=(b=n.node)==null?void 0:b.content.content;if(g.length>0){const k=g[0];if(k.type.name==="image")return k.type.name}return(y=n.node)==null?void 0:y.type.name}),p=a.computed(()=>hi.find(g=>g.value===d.value));function f(g){var b;return g.value===d.value&&((b=n.editor)==null?void 0:b.isActive(d.value,g.options))}function h(g){switch(g.value){default:m(g);break}o("action",g)}function m(g){var E,v,C,_,R;const b=n.getPos();if(g.value===d.value&&u.value.indexOf(d.value)<0){const B=(E=n.editor)==null?void 0:E.isActive(d.value),N=(v=n.editor)==null?void 0:v.commands.lift(d.value);console.log("lift",d.value,B,N);return}const y=(C=n.editor)==null?void 0:C.commands,k=(_=n.editor)==null?void 0:_.chain().focus(b+1);console.log("runCommand",g),l(y,k,g.value,g.options),(R=n.editor)==null||R.commands.setNodeSelection(b)}return a.computed(()=>[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:me.blue,tips:"Ctrl+D",group:"label.common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Ctrl+D",color:me.deepOrange}]),(g,b)=>(a.openBlock(),a.createElementBlock("section",US,[c.value==="main"?(a.openBlock(),a.createElementBlock("section",qS,[p.value?(a.openBlock(),a.createElementBlock("section",KS,[b[0]||(b[0]=a.createElementVNode("div",{class:"group o-tips"},"Turn into",-1)),a.createElementVNode("section",WS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(hi),(y,k)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:k,icon:y.icon,tooltip:a.unref(i)(y.label),"content-class":{"is-active":f(y)},quaternary:"",onClick:E=>h(y)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):a.createCommentVNode("",!0),a.createVNode(a.unref(So),a.mergeProps(n,{colorful:"","show-group":"",onAction:h}),null,16)])):a.createCommentVNode("",!0)]))}}),GS=a.defineComponent({__name:"DragNode",props:ct,emits:["action"],setup(t,{emit:e}){const n=t,o=e,{run:r}=Te(),i=a.ref(null),s=a.ref(0),l=a.ref(!1),c=a.ref(["heading","codeBlock","paragraph"]),u=a.ref(!1),d=a.computed(()=>{var k,E;const y=(k=n.node)==null?void 0:k.content.content;if(y.length>0){const v=y[0];if(v.type.name==="image")return v.type.name}return(E=n.node)==null?void 0:E.type.name}),p=a.computed(()=>{var k;let y=d.value;return y==="heading"?{icon:`format_h${((k=n.node.attrs)==null?void 0:k.level)||1}`,color:me.blue}:(y==="table-wrapper"&&(y="table"),Ea.find(E=>E.value===y)||{icon:"title"})});function f(y){var k;(k=i.value)==null||k.setShow(!1),o("action",y)}function h(y){l.value=y,console.log("show",y),y&&m()}function m(){var k;let y=n.getPos();c.value.includes(d.value)||(y+=1),(k=n.editor)==null||k.commands.setNodeSelection(y),s.value=y}function g(y){u.value=!0,setTimeout(()=>{u.value=!1},10)}function b(y){u.value=!1}return(y,k)=>(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":u.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:g,onDragend:b},[a.createVNode(a.unref(St),{type:"tertiary",class:"o-node-btn"},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:p.value.icon,color:p.value.color,small:""},null,8,["name","color"]),a.createVNode(a.unref(re),{name:"drag_indicator",small:""})]),_:1})],34)]),default:a.withCtx(()=>[a.createVNode(jS,a.mergeProps(n,{onAction:f}),null,16)]),_:1},512))}}),YS=a.defineComponent({__name:"index",props:ct,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)}),u=a.computed(()=>l.value==="heading"?`type-heading-${c.value}`:`type-${l.value}`);function d(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",u.value])},[a.createVNode(HS,a.normalizeProps(a.guardReactiveProps(n)),null,16),s.value?a.createCommentVNode("",!0):(a.openBlock(),a.createBlock(GS,a.mergeProps({key:0},n,{onAction:d}),null,16))],2)],2)):a.createCommentVNode("",!0)}}}),kn=a.defineComponent({__name:"ONodeView",props:ct,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(qc),{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(YS,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"]))}}),JS={class:"o-add-node-view"},XS={key:0,class:"view-main"},ZS={class:"group o-tips"},QS={class:"panel"},ex={class:"group o-tips"},tx={key:1,class:"item"},nx=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}=ge(),{run:s}=Te(),l=a.ref("main");function c(p){const f=n.editor.chain();let h=null;switch(p.value){case"aiBlock":h={content:jr,attrs:{icon:"💡"}};break;case"blockquote":h={content:jr};break;case"callout":h={content:jr,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:$m};break;case"taskList":h={content:Fm};break;case"table":setTimeout(()=>{f.insertContentAt(d.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=d.value;h.type=h.type||p.value,setTimeout(()=>{u.value?f.insertContent(h).focus().run():f.insertContentAt(m,h).focus().run()},1)}o("action",p)}const u=a.computed(()=>{var p;return((p=n.node)==null?void 0:p.content.size)===0}),d=a.computed(()=>u.value?n.getPos():n.getPos()+n.node.nodeSize);return(p,f)=>(a.openBlock(),a.createElementBlock("section",JS,[l.value==="main"?(a.openBlock(),a.createElementBlock("section",XS,[a.createElementVNode("section",null,[a.createElementVNode("div",ZS,a.toDisplayString(a.unref(i)("label.basic")),1),a.createElementVNode("section",QS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(Sr),(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(Lt)),a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[a.unref(kr).length?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(a.unref(kr),(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(Lt),{key:0})):a.createCommentVNode("",!0),a.createElementVNode("div",ex,a.toDisplayString(a.unref(i)(h.group)),1)],64)):a.createCommentVNode("",!0),a.createVNode(a.unref(Ut),{class:"item",clickable:"",onClick:g=>c(h)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{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",tx,"No result"))]),_:1})])):a.createCommentVNode("",!0)]))}}),Vm=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,u)=>(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(St),{type:"tertiary",class:"o-node-btn",onClick:s},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"add",small:""})]),_:1})],2)]),default:a.withCtx(()=>[a.createVNode(nx,a.mergeProps(e,{onAction:l}),null,16)]),_:1},512))}}),ox={class:"o-drag-node-view"},rx={key:0,class:"view-main"},ix={key:0},sx={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}=ge(),{run:s,onCommand:l}=Te(),c=a.ref("main"),u=a.ref(["heading","codeBlock","paragraph"]),d=a.computed(()=>{var b,y;const g=(b=n.node)==null?void 0:b.content.content;if(g.length>0){const k=g[0];if(k.type.name==="image")return k.type.name}return(y=n.node)==null?void 0:y.type.name}),p=a.computed(()=>hi.find(g=>g.value===d.value));function f(g){var b;return g.value===d.value&&((b=n.editor)==null?void 0:b.isActive(d.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 E,v,C,_,R;const b=n.getPos();if(g.value===d.value&&u.value.indexOf(d.value)<0){const B=(E=n.editor)==null?void 0:E.isActive(d.value),N=(v=n.editor)==null?void 0:v.commands.lift(d.value);console.log("lift",d.value,B,N);return}const y=(C=n.editor)==null?void 0:C.commands,k=(_=n.editor)==null?void 0:_.chain().focus(b+1);console.log("runCommand",g),l(y,k,g.value,g.options),(R=n.editor)==null||R.commands.focus()}return(g,b)=>(a.openBlock(),a.createElementBlock("section",ox,[c.value==="main"?(a.openBlock(),a.createElementBlock("section",rx,[p.value?(a.openBlock(),a.createElementBlock("section",ix,[b[0]||(b[0]=a.createElementVNode("div",{class:"group o-tips"},"Turn into",-1)),a.createElementVNode("section",sx,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(hi),(y,k)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:k,icon:y.icon,tooltip:a.unref(i)(y.label),"content-class":{"is-active":f(y)},quaternary:"",onClick:E=>h(y)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):a.createCommentVNode("",!0),a.createVNode(a.unref(So),a.mergeProps(n,{colorful:"","show-group":"",onAction:h}),null,16)])):a.createCommentVNode("",!0)]))}}),zm=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}=Te(),i=a.ref(null),s=a.ref(!1),l=a.ref(["heading","codeBlock","paragraph"]),c=a.computed(()=>{var b,y,k;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 E=g[0];if(E.type.name==="image")return E.type.name}return(k=n.node)==null?void 0:k.type.name}),u=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:me.blue}:(g==="table-wrapper"&&(g="table"),Ea.find(y=>y.value===g)||{icon:"title"})});function d(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:d,onDragend:p},[a.createVNode(a.unref(St),{type:"tertiary",class:"o-node-btn"},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:u.value.icon,color:u.value.color,small:""},null,8,["name","color"]),a.createVNode(a.unref(re),{name:"drag_indicator",small:""})]),_:1})],34)]),default:a.withCtx(()=>[a.createVNode(ax,a.mergeProps(n,{onAction:f}),null,16)]),_:1},512))}}),lx={key:0,class:"spinner"},cx={key:2,class:"o-btn__label"},St=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",lx)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[t.icon?(a.openBlock(),a.createBlock(a.unref(re),{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",cx,a.toDisplayString(t.label),1)):a.createCommentVNode("",!0),a.renderSlot(o.$slots,"default")],2))}}),ux={class:"o-btn-group"},Hm=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",ux,[a.renderSlot(n.$slots,"default")]))}}),dx={class:"o-checkbox"},px={class:"o-checkbox__main"},fx={class:"o-checkbox__suffix"},nu=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",px,[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",fx,a.toDisplayString(t.label),1)]))}}),Lt=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))}}),hx={class:"o-input__prefix"},mx={class:"o-input__main"},gx=["placeholder"],bx={class:"o-input__suffix"},Ln=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(u){r("update:modelValue",u)}});function l(){var u;(u=i.value)==null||u.focus()}function c(){s.value="",l()}return e({clear:c,focus:l}),(u,d)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["o-input",`type-${t.type}`])},[a.createElementVNode("div",hx,[a.renderSlot(u.$slots,"prefix")]),a.createElementVNode("div",mx,[a.withDirectives(a.createElementVNode("input",{ref_key:"input",ref:i,"onUpdate:modelValue":d[0]||(d[0]=p=>s.value=p),placeholder:t.placeholder,onFocus:d[1]||(d[1]=p=>r("focus")),onBlur:d[2]||(d[2]=p=>r("blur"))},null,40,gx),[[a.vModelText,s.value]])]),a.createElementVNode("div",bx,[a.renderSlot(u.$slots,"suffix"),t.clearable&&s.value?(a.openBlock(),a.createBlock(re,{key:0,name:"close",class:"clear o-tips",onClick:c})):a.createCommentVNode("",!0)])],2))}}),Qt=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))}}),yx={class:"o-list-item"},vx={class:"o-list-item__prefix"},kx={class:"o-list-item__main"},wx={class:"o-list-item__suffix"},Ut=a.defineComponent({__name:"OListItem",props:{hoverable:{type:Boolean,default:!1}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("li",yx,[a.createElementVNode("div",vx,[a.renderSlot(e.$slots,"prefix")]),a.createElementVNode("div",kx,[a.renderSlot(e.$slots,"default")]),a.createElementVNode("div",wx,[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}=xr(),s=a.ref(null),l=a.ref(),c=a.ref();function u(h){var m,g,b,y;h?((g=c.value)==null||g.setProps({getReferenceClientRect:(m=o.event)!=null&&m.clientX?d:null}),(b=c.value)==null||b.show()):(y=c.value)==null||y.hide()}function d(){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=dn(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:u}),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))}}),Um=[`
|
|
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
|
+
`],Ex=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,_x=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,qm=ln.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",_e(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[Wo({find:Ex,type:this.type})]},addPasteRules(){return[ko({find:_x,type:this.type})]}}),Km=De.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ae({key:new xe("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:o}=this.editor,{anchor:r}=e,i=[];if(!n||!o)return Ne.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((c,u)=>{if(c.isText)return;if(!(r>=u&&r<=u+c.nodeSize-1))return!1;s+=1});let l=0;return t.descendants((c,u)=>{if(c.isText||!(r>=u&&r<=u+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(Ge.node(u,u+c.nodeSize,{class:this.options.className}))}),Ne.create(t,i)}}})]}}),Wm=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()}}}),jm=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()}}}),Cx=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Sx=ze.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",_e(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[ka({find:Cx,type:this.type,getAttributes:t=>{const[,,e,n,o]=t;return{src:n,alt:e,title:o}}})]}}),xx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Nx="ελ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",wr=(t,e)=>{for(const n in e)t[n]=e[n];return t},Yl="numeric",Jl="ascii",Xl="alpha",Gr="asciinumeric",Vr="alphanumeric",Zl="domain",Gm="emoji",Tx="scheme",Ox="slashscheme",ll="whitespace";function Mx(t,e){return t in e||(e[t]=[]),e[t]}function Do(t,e,n){e[Yl]&&(e[Gr]=!0,e[Vr]=!0),e[Jl]&&(e[Gr]=!0,e[Xl]=!0),e[Gr]&&(e[Vr]=!0),e[Xl]&&(e[Vr]=!0),e[Vr]&&(e[Zl]=!0),e[Gm]&&(e[Zl]=!0);for(const o in e){const r=Mx(o,n);r.indexOf(t)<0&&r.push(t)}}function Ax(t,e){const n={};for(const o in e)e[o].indexOf(t)>=0&&(n[o]=!0);return n}function Ft(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Ft.groups={};Ft.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||Ft.groups;let r;return e&&e.j?r=e:(r=new Ft(e),n&&o&&Do(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||Ft.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 Ft,wr(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new Ft,i){if(o)if(s.t&&typeof s.t=="string"){const c=wr(Ax(s.t,o),n);Do(i,c,o)}else n&&Do(i,n,o);s.t=i}return r.j[t]=s,s}};const ye=(t,e,n,o,r)=>t.ta(e,n,o,r),Xe=(t,e,n,o,r)=>t.tr(e,n,o,r),dp=(t,e,n,o,r)=>t.ts(e,n,o,r),D=(t,e,n,o,r)=>t.tt(e,n,o,r),Un="WORD",Ql="UWORD",Ym="ASCIINUMERICAL",Jm="ALPHANUMERICAL",mi="LOCALHOST",ec="TLD",tc="UTLD",cs="SCHEME",rr="SLASH_SCHEME",ou="NUM",nc="WS",ru="NL",Yr="OPENBRACE",Jr="CLOSEBRACE",Ms="OPENBRACKET",As="CLOSEBRACKET",Rs="OPENPAREN",Bs="CLOSEPAREN",Ds="OPENANGLEBRACKET",Is="CLOSEANGLEBRACKET",Ls="FULLWIDTHLEFTPAREN",Ps="FULLWIDTHRIGHTPAREN",$s="LEFTCORNERBRACKET",Fs="RIGHTCORNERBRACKET",Vs="LEFTWHITECORNERBRACKET",zs="RIGHTWHITECORNERBRACKET",Hs="FULLWIDTHLESSTHAN",Us="FULLWIDTHGREATERTHAN",qs="AMPERSAND",iu="APOSTROPHE",Ks="ASTERISK",ao="AT",Ws="BACKSLASH",js="BACKTICK",Gs="CARET",co="COLON",su="COMMA",Ys="DOLLAR",Nn="DOT",Js="EQUALS",au="EXCLAMATION",nn="HYPHEN",Xr="PERCENT",Xs="PIPE",Zs="PLUS",Qs="POUND",Zr="QUERY",lu="QUOTE",Xm="FULLWIDTHMIDDLEDOT",cu="SEMI",Tn="SLASH",Qr="TILDE",ea="UNDERSCORE",Zm="EMOJI",ta="SYM";var Qm=Object.freeze({__proto__:null,WORD:Un,UWORD:Ql,ASCIINUMERICAL:Ym,ALPHANUMERICAL:Jm,LOCALHOST:mi,TLD:ec,UTLD:tc,SCHEME:cs,SLASH_SCHEME:rr,NUM:ou,WS:nc,NL:ru,OPENBRACE:Yr,CLOSEBRACE:Jr,OPENBRACKET:Ms,CLOSEBRACKET:As,OPENPAREN:Rs,CLOSEPAREN:Bs,OPENANGLEBRACKET:Ds,CLOSEANGLEBRACKET:Is,FULLWIDTHLEFTPAREN:Ls,FULLWIDTHRIGHTPAREN:Ps,LEFTCORNERBRACKET:$s,RIGHTCORNERBRACKET:Fs,LEFTWHITECORNERBRACKET:Vs,RIGHTWHITECORNERBRACKET:zs,FULLWIDTHLESSTHAN:Hs,FULLWIDTHGREATERTHAN:Us,AMPERSAND:qs,APOSTROPHE:iu,ASTERISK:Ks,AT:ao,BACKSLASH:Ws,BACKTICK:js,CARET:Gs,COLON:co,COMMA:su,DOLLAR:Ys,DOT:Nn,EQUALS:Js,EXCLAMATION:au,HYPHEN:nn,PERCENT:Xr,PIPE:Xs,PLUS:Zs,POUND:Qs,QUERY:Zr,QUOTE:lu,FULLWIDTHMIDDLEDOT:Xm,SEMI:cu,SLASH:Tn,TILDE:Qr,UNDERSCORE:ea,EMOJI:Zm,SYM:ta});const zn=/[a-z]/,Br=new RegExp("\\p{L}","u"),cl=new RegExp("\\p{Emoji}","u"),Hn=/\d/,ul=/\s/,pp="\r",dl=`
|
|
148
|
+
`,Rx="️",Bx="",pl="";let Vi=null,zi=null;function Dx(t=[]){const e={};Ft.groups=e;const n=new Ft;Vi==null&&(Vi=fp(xx)),zi==null&&(zi=fp(Nx)),D(n,"'",iu),D(n,"{",Yr),D(n,"}",Jr),D(n,"[",Ms),D(n,"]",As),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,"&",qs),D(n,"*",Ks),D(n,"@",ao),D(n,"`",js),D(n,"^",Gs),D(n,":",co),D(n,",",su),D(n,"$",Ys),D(n,".",Nn),D(n,"=",Js),D(n,"!",au),D(n,"-",nn),D(n,"%",Xr),D(n,"|",Xs),D(n,"+",Zs),D(n,"#",Qs),D(n,"?",Zr),D(n,'"',lu),D(n,"/",Tn),D(n,";",cu),D(n,"~",Qr),D(n,"_",ea),D(n,"\\",Ws),D(n,"・",Xm);const o=Xe(n,Hn,ou,{[Yl]:!0});Xe(o,Hn,o);const r=Xe(o,zn,Ym,{[Gr]:!0}),i=Xe(o,Br,Jm,{[Vr]:!0}),s=Xe(n,zn,Un,{[Jl]:!0});Xe(s,Hn,r),Xe(s,zn,s),Xe(r,Hn,r),Xe(r,zn,r);const l=Xe(n,Br,Ql,{[Xl]:!0});Xe(l,zn),Xe(l,Hn,i),Xe(l,Br,l),Xe(i,Hn,i),Xe(i,zn),Xe(i,Br,i);const c=D(n,dl,ru,{[ll]:!0}),u=D(n,pp,nc,{[ll]:!0}),d=Xe(n,ul,nc,{[ll]:!0});D(n,pl,d),D(u,dl,c),D(u,pl,d),Xe(u,ul,d),D(d,pp),D(d,dl),Xe(d,ul,d),D(d,pl,d);const p=Xe(n,cl,Zm,{[Gm]:!0});D(p,"#"),Xe(p,cl,p),D(p,Rx,p);const f=D(p,Bx);D(f,"#"),Xe(f,cl,p);const h=[[zn,s],[Hn,r]],m=[[zn,null],[Br,l],[Hn,i]];for(let g=0;g<Vi.length;g++)oo(n,Vi[g],ec,Un,h);for(let g=0;g<zi.length;g++)oo(n,zi[g],tc,Ql,m);Do(ec,{tld:!0,ascii:!0},e),Do(tc,{utld:!0,alpha:!0},e),oo(n,"file",cs,Un,h),oo(n,"mailto",cs,Un,h),oo(n,"http",rr,Un,h),oo(n,"https",rr,Un,h),oo(n,"ftp",rr,Un,h),oo(n,"ftps",rr,Un,h),Do(cs,{scheme:!0,ascii:!0},e),Do(rr,{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],k=t[g][1]?{[Tx]:!0}:{[Ox]:!0};b.indexOf("-")>=0?k[Zl]=!0:zn.test(b)?Hn.test(b)?k[Gr]=!0:k[Jl]=!0:k[Yl]=!0,dp(n,b,b,k)}return dp(n,"localhost",mi,{ascii:!0}),n.jd=new Ft(ta),{start:n,tokens:wr({groups:e},Qm)}}function eg(t,e){const n=Ix(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,u=0,d=null,p=-1,f=-1;for(;s<o&&(c=l.go(n[s]));)l=c,l.accepts()?(p=0,f=0,d=l):p>=0&&(p+=n[s].length,f++),u+=n[s].length,i+=n[s].length,s++;i-=p,s-=f,u-=p,r.push({t:d.t,v:e.slice(i-u,i),s:i-u,e:i})}return r}function Ix(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 oo(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 Ft(o),i.jr=r.slice(),t.j[c]=i),t=i}return i=new Ft(n),i.jr=r.slice(),t.j[e[s-1]]=i,i}function fp(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 gi={defaultProtocol:"http",events:null,format:hp,formatHref:hp,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function uu(t,e=null){let n=wr({},gi);t&&(n=wr(n,t instanceof uu?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}uu.prototype={o:gi,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]:gi[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 hp(t){return t}function tg(t,e){this.t="token",this.v=t,this.tk=e}tg.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=gi.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),u=t.get("rel",n,e),d=t.getObj("attributes",n,e),p=t.getObj("events",n,e);return s.href=o,l&&(s.class=l),c&&(s.target=c),u&&(s.rel=u),d&&wr(s,d),{tagName:r,attributes:s,content:i,eventListeners:p}}};function xa(t,e){class n extends tg{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 mp=xa("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),gp=xa("text"),Lx=xa("nl"),Hi=xa("url",{isLink:!0,toHref(t=gi.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==mi&&t[1].t===co}}),tn=t=>new Ft(t);function Px({groups:t}){const e=t.domain.concat([qs,Ks,ao,Ws,js,Gs,Ys,Js,nn,ou,Xr,Xs,Zs,Qs,Tn,ta,Qr,ea]),n=[co,su,Nn,au,Xr,Zr,lu,cu,Ds,Is,Yr,Jr,As,Ms,Rs,Bs,Ls,Ps,$s,Fs,Vs,zs,Hs,Us],o=[qs,iu,Ks,Ws,js,Gs,Ys,Js,nn,Yr,Jr,Xr,Xs,Zs,Qs,Zr,Tn,ta,Qr,ea],r=tn(),i=D(r,Qr);ye(i,o,i),ye(i,t.domain,i);const s=tn(),l=tn(),c=tn();ye(r,t.domain,s),ye(r,t.scheme,l),ye(r,t.slashscheme,c),ye(s,o,i),ye(s,t.domain,s);const u=D(s,ao);D(i,ao,u),D(l,ao,u),D(c,ao,u);const d=D(i,Nn);ye(d,o,i),ye(d,t.domain,i);const p=tn();ye(u,t.domain,p),ye(p,t.domain,p);const f=D(p,Nn);ye(f,t.domain,p);const h=tn(mp);ye(f,t.tld,h),ye(f,t.utld,h),D(u,mi,h);const m=D(p,nn);D(m,nn,m),ye(m,t.domain,p),ye(h,t.domain,p),D(h,Nn,f),D(h,nn,m);const g=D(h,co);ye(g,t.numeric,mp);const b=D(s,nn),y=D(s,Nn);D(b,nn,b),ye(b,t.domain,s),ye(y,o,i),ye(y,t.domain,s);const k=tn(Hi);ye(y,t.tld,k),ye(y,t.utld,k),ye(k,t.domain,s),ye(k,o,i),D(k,Nn,y),D(k,nn,b),D(k,ao,u);const E=D(k,co),v=tn(Hi);ye(E,t.numeric,v);const C=tn(Hi),_=tn();ye(C,e,C),ye(C,n,_),ye(_,e,C),ye(_,n,_),D(k,Tn,C),D(v,Tn,C);const R=D(l,co),B=D(c,co),N=D(B,Tn),M=D(N,Tn);ye(l,t.domain,s),D(l,Nn,y),D(l,nn,b),ye(c,t.domain,s),D(c,Nn,y),D(c,nn,b),ye(R,t.domain,C),D(R,Tn,C),D(R,Zr,C),ye(M,t.domain,C),ye(M,e,C),D(M,Tn,C);const z=[[Yr,Jr],[Ms,As],[Rs,Bs],[Ds,Is],[Ls,Ps],[$s,Fs],[Vs,zs],[Hs,Us]];for(let G=0;G<z.length;G++){const[$,U]=z[G],q=D(C,$);D(_,$,q),D(q,U,C);const ee=tn(Hi);ye(q,e,ee);const S=tn();ye(q,n),ye(ee,e,ee),ye(ee,n,S),ye(S,e,ee),ye(S,n,S),D(ee,U,C),D(S,U,C)}return D(r,mi,k),D(r,ru,Lx),{start:r,tokens:Qm}}function $x(t,e,n){let o=n.length,r=0,i=[],s=[];for(;r<o;){let l=t,c=null,u=null,d=0,p=null,f=-1;for(;r<o&&!(c=l.go(n[r].t));)s.push(n[r++]);for(;r<o&&(u=c||l.go(n[r].t));)c=null,l=u,l.accepts()?(f=0,p=l):f>=0&&f++,r++,d++;if(f<0)r-=d,r<o&&(s.push(n[r]),r++);else{s.length>0&&(i.push(fl(gp,e,s)),s=[]),r-=f,d-=f;const h=p.t,m=n.slice(r-d,r);i.push(fl(h,e,m))}}return s.length>0&&i.push(fl(gp,e,s)),i}function fl(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 Fx=typeof console<"u"&&console&&console.warn||(()=>{}),Vx="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 zx(){return Ft.groups={},je.scanner=null,je.parser=null,je.tokenQueue=[],je.pluginQueue=[],je.customSchemes=[],je.initialized=!1,je}function bp(t,e=!1){if(je.initialized&&Fx(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Vx}`),!/^[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 Hx(){je.scanner=Dx(je.customSchemes);for(let t=0;t<je.tokenQueue.length;t++)je.tokenQueue[t][1]({scanner:je.scanner});je.parser=Px(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 du(t){return je.initialized||Hx(),$x(je.parser.start,t,eg(je.scanner.start,t))}du.scan=eg;function ng(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 uu(n),r=du(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 Ux(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function qx(t){return new Ae({key:new xe("autolink"),appendTransaction:(e,n,o)=>{const r=e.some(u=>u.docChanged)&&!n.doc.eq(o.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,l=jw(n.doc,[...e]);if(tE(l).forEach(({newRange:u})=>{const d=Yw(o.doc,u,h=>h.isTextblock);let p,f;if(d.length>1?(p=d[0],f=o.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):d.length&&o.doc.textBetween(u.from,u.to," "," ").endsWith(" ")&&(p=d[0],f=o.doc.textBetween(p.pos,u.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=du(m).map(y=>y.toObject(t.defaultProtocol));if(!Ux(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=>{Dc(y.from,y.to,o.doc).some(k=>k.mark.type===t.type)||s.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function Kx(t){return new Ae({key:new xe("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=Lh(e.state,t.type.name),u=o.target,d=(r=u==null?void 0:u.href)!==null&&r!==void 0?r:c.href,p=(i=u==null?void 0:u.target)!==null&&i!==void 0?i:c.target;return u&&d?(window.open(d,p),!0):!1}}})}function Wx(t){return new Ae({key:new xe("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(u=>{l+=u.textContent});const c=ng(l,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}const jx=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function No(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(jx,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const pu=ln.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"){bp(t);return}bp(t.scheme,t.optionalSlashes)})},onDestroy(){zx()},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)=>!!No(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=>!!No(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=>!!No(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",_e(this.options.HTMLAttributes,t),0]:["a",_e(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:o=>!!No(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=>!!No(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[ko({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:o}=this.options,r=ng(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!No(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(qx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!No(r,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Kx({type:this.type})),this.options.linkOnPaste&&t.push(Wx({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function Gx(t){var e;const{char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:l}=t,c=o&&!r,u=Fh(n),d=new RegExp(`\\s${u}$`),p=s?"^":"",f=r?"":u,h=c?new RegExp(`${p}${u}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\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),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!k)return null;const E=g+b.index;let v=E+b[0].length;return c&&d.test(m.slice(v-1,v+1))&&(b[0]+=" ",v+=1),E<l.pos&&v>=l.pos?{range:{from:E,to:v},query:b[0].slice(n.length),text:b[0]}:null}const Yx=new xe("suggestion");function Jx({pluginKey:t=Yx,editor:e,char:n="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:c="suggestion",command:u=()=>null,items:d=()=>[],render:p=()=>({}),allow:f=()=>!0,findSuggestionMatch:h=Gx}){let m;const g=p==null?void 0:p(),b=new Ae({key:t,view(){return{update:async(y,k)=>{var E,v,C,_,R,B,N;const M=(E=this.key)===null||E===void 0?void 0:E.getState(k),z=(v=this.key)===null||v===void 0?void 0:v.getState(y.state),G=M.active&&z.active&&M.range.from!==z.range.from,$=!M.active&&z.active,U=M.active&&!z.active,q=!$&&!U&&M.query!==z.query,ee=$||G&&q,S=q||G,O=U||G&&q;if(!ee&&!S&&!O)return;const F=O&&!ee?M:z,J=y.dom.querySelector(`[data-decoration-id="${F.decorationId}"]`);m={editor:e,range:F.range,query:F.query,text:F.text,items:[],command:Q=>u({editor:e,range:F.range,props:Q}),decorationNode:J,clientRect:J?()=>{var Q;const{decorationId:ce}=(Q=this.key)===null||Q===void 0?void 0:Q.getState(e.state),Ce=y.dom.querySelector(`[data-decoration-id="${ce}"]`);return(Ce==null?void 0:Ce.getBoundingClientRect())||null}:null},ee&&((C=g==null?void 0:g.onBeforeStart)===null||C===void 0||C.call(g,m)),S&&((_=g==null?void 0:g.onBeforeUpdate)===null||_===void 0||_.call(g,m)),(S||ee)&&(m.items=await d({editor:e,query:F.query})),O&&((R=g==null?void 0:g.onExit)===null||R===void 0||R.call(g,m)),S&&((B=g==null?void 0:g.onUpdate)===null||B===void 0||B.call(g,m)),ee&&((N=g==null?void 0:g.onStart)===null||N===void 0||N.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,k,E,v){const{isEditable:C}=e,{composing:_}=e.view,{selection:R}=y,{empty:B,from:N}=R,M={...k};if(M.composing=_,C&&(B||e.view.composing)){(N<k.range.from||N>k.range.to)&&!_&&!k.composing&&(M.active=!1);const z=h({char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:R.$from}),G=`id_${Math.floor(Math.random()*4294967295)}`;z&&f({editor:e,state:v,range:z.range,isActive:k.active})?(M.active=!0,M.decorationId=k.decorationId?k.decorationId:G,M.range=z.range,M.query=z.query,M.text=z.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(y,k){var E;const{active:v,range:C}=b.getState(y.state);return v&&((E=g==null?void 0:g.onKeyDown)===null||E===void 0?void 0:E.call(g,{view:y,event:k,range:C}))||!1},decorations(y){const{active:k,range:E,decorationId:v}=b.getState(y);return k?Ne.create(y.doc,[Ge.inline(E.from,E.to,{nodeName:l,class:c,"data-decoration-id":v})]):null}}});return b}const Xx=new xe("mention"),Zx=ze.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",_e(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:Xx,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",_e({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=_e({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:n,node:t});return typeof o=="string"?["span",_e({"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[Jx({editor:this.editor,...this.options.suggestion})]}}),Qx=/^\s*(\[([( |x])?\])\s$/,og=ze.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",_e(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",u=>u.preventDefault()),l.addEventListener("change",u=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:d}=u.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:d}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,d)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{r.setAttribute(u,d)}),r.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,s),r.append(i,c),Object.entries(e).forEach(([u,d])=>{r.setAttribute(u,d)}),{dom:r,contentDOM:c,update:u=>u.type!==this.type?!1:(r.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,!0)}}},addInputRules(){return[mr({find:Qx,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),rg=ze.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",_e(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()}}}),ig=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")}}}),eN=t=>et({find:/--$/,replace:t??"—"}),tN=t=>et({find:/\.\.\.$/,replace:t??"…"}),nN=t=>et({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),oN=t=>et({find:/"$/,replace:t??"”"}),rN=t=>et({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),iN=t=>et({find:/'$/,replace:t??"’"}),sN=t=>et({find:/<-$/,replace:t??"←"}),aN=t=>et({find:/->$/,replace:t??"→"}),lN=t=>et({find:/\(c\)$/,replace:t??"©"}),cN=t=>et({find:/\(tm\)$/,replace:t??"™"}),uN=t=>et({find:/\(sm\)$/,replace:t??"℠"}),dN=t=>et({find:/\(r\)$/,replace:t??"®"}),pN=t=>et({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),fN=t=>et({find:/\+\/-$/,replace:t??"±"}),hN=t=>et({find:/!=$/,replace:t??"≠"}),mN=t=>et({find:/<<$/,replace:t??"«"}),gN=t=>et({find:/>>$/,replace:t??"»"}),bN=t=>et({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),yN=t=>et({find:/\^2$/,replace:t??"²"}),vN=t=>et({find:/\^3$/,replace:t??"³"}),kN=t=>et({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),wN=t=>et({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),sg=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(eN(this.options.emDash)),this.options.ellipsis!==!1&&t.push(tN(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push(nN(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(oN(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(rN(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(iN(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(sN(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(aN(this.options.rightArrow)),this.options.copyright!==!1&&t.push(lN(this.options.copyright)),this.options.trademark!==!1&&t.push(cN(this.options.trademark)),this.options.servicemark!==!1&&t.push(uN(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(dN(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(pN(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(fN(this.options.plusMinus)),this.options.notEqual!==!1&&t.push(hN(this.options.notEqual)),this.options.laquo!==!1&&t.push(mN(this.options.laquo)),this.options.raquo!==!1&&t.push(gN(this.options.raquo)),this.options.multiplication!==!1&&t.push(bN(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(yN(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push(vN(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(kN(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(wN(this.options.threeQuarters)),t}}),ag=ln.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",_e(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 oc,rc;if(typeof WeakMap<"u"){let t=new WeakMap;oc=e=>t.get(e),rc=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;oc=o=>{for(let r=0;r<t.length;r+=2)if(t[r]==o)return t[r+1]},rc=(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:u}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(r,c),right:Math.max(o,l),bottom:Math.max(i,u)}}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 oc(t)||rc(t,EN(t))}};function EN(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=_N(t),n=t.childCount,o=[];let r=0,i=null;const s=[];for(let u=0,d=e*n;u<d;u++)o[u]=0;for(let u=0,d=0;u<n;u++){const p=t.child(u);d++;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:k}=g.attrs;for(let E=0;E<y;E++){if(E+u>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:y-E});break}const v=r+E*e;for(let C=0;C<b;C++){o[v+C]==0?o[v+C]=d:(i||(i=[])).push({type:"collision",row:u,pos:d,n:b-C});const _=k&&k[C];if(_){const R=(v+C)%e*2,B=s[R];B==null||B!=_&&s[R+1]==1?(s[R]=_,s[R+1]=1):B==_&&s[R+1]++}}}r+=b,d+=g.nodeSize}const f=(u+1)*e;let h=0;for(;r<f;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:u,n:h}),d++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new Qe(e,n,o,i);let c=!1;for(let u=0;!c&&u<s.length;u+=2)s[u]!=null&&s[u+1]<n&&(c=!0);return c&&CN(l,s,t),l}function _N(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 u=l.child(c);s+u.attrs.rowspan>o&&(i+=u.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 CN(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 u=0;u<c.colspan;u++){const d=(r+u)%t.width,p=e[d*2];p!=null&&(!c.colwidth||c.colwidth[u]!=p)&&((l||(l=SN(c)))[u]=p)}l&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function SN(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function xt(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 uo=new xe("selectingCells");function Nr(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 xN(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 wn(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 Na(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=Nr(e.$head)||NN(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function NN(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 ic(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function TN(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function fu(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function lg(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 Go(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 cg(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 ON(t,e,n){const o=xt(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 qn extends ae{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(d=>d!=n.pos-i);c.unshift(n.pos-i);const u=c.map(d=>{const p=o.nodeAt(d);if(!p)throw RangeError(`No cell with offset ${d} found`);const f=i+d+1;return new Mf(l.resolve(f),l.resolve(f+p.content.size))});super(u[0].$from,u[0].$to,u),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(ic(o)&&ic(r)&&fu(o,r)){const i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?qn.rowSelection(o,r):i&&this.isColSelection()?qn.colSelection(o,r):new qn(o,r)}return ne.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 u=[];for(let d=c*n.width+r.left,p=r.left;p<r.right;p++,d++){const f=n.map[d];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=Go(y,0,g)),b>0&&(y=Go(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)}u.push(m)}s.push(e.child(c).copy(A.from(u)))}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],u=e.mapping.slice(o);e.replace(u.map(l.pos),u.map(c.pos),s?V.empty:n)}const i=ae.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 qn(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 qn&&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 qn(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new qn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){return new qn(e.resolve(n),e.resolve(o))}getBookmark(){return new MN(this.$anchorCell.pos,this.$headCell.pos)}};Ve.prototype.visible=!1;ae.jsonID("cell",Ve);var MN=class ug{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ug(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&&fu(n,o)?new Ve(n,o):ae.near(o,1)}};function AN(t){if(!(t.selection instanceof Ve))return null;const e=[];return t.selection.forEachCell((n,o)=>{e.push(Ge.node(o,o+n.nodeSize,{class:"selectedCell"}))}),Ne.create(t.doc,e)}function RN({$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 BN({$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 DN(t,e,n){const o=(e||t).selection,r=(e||t).doc;let i,s;if(o instanceof oe&&(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,u=c+l.map[l.width*l.height-1];i=Ve.create(r,c+1,u)}}else o instanceof ne&&RN(o)?i=ne.create(r,o.from):o instanceof ne&&BN(o)&&(i=ne.create(r,o.$from.start(),o.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}var IN=new xe("fix-tables");function dg(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 u=l,d=Math.min(r,s+3);u<d;u++)if(t.child(u)==c){l=u+1,n+=c.nodeSize;continue e}o(c,n),l<r&&t.child(l).sameMarkup(c)?dg(t.child(l),c,n+1,o):c.nodesBetween(0,c.content.size,o,n+1),n+=c.nodeSize}}function pg(t,e){let n;const o=(r,i)=>{r.type.spec.tableRole=="table"&&(n=LN(t,r,i,n))};return e?e.doc!=t.doc&&dg(e.doc,t.doc,0,o):t.doc.descendants(o),n}function LN(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 u=r.problems[c];if(u.type=="collision"){const d=e.nodeAt(u.pos);if(!d)continue;const p=d.attrs;for(let f=0;f<p.rowspan;f++)i[u.row+f]+=u.n;o.setNodeMarkup(o.mapping.map(n+1+u.pos),null,Go(p,p.colspan-u.n,u.n))}else if(u.type=="missing")i[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+u.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+u.pos),null,{...d.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const d=o.mapping.map(n);o.delete(d,d+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,u=n+1;c<r.height;c++){const d=e.child(c),p=u+d.nodeSize,f=i[c];if(f>0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);const m=[];for(let b=0;b<f;b++){const y=xt(t.schema)[h].createAndFill();y&&m.push(y)}const g=(c==0||s==c-1)&&l==c?u+1:p-1;o.insert(o.mapping.map(g),m)}u=p}return o.setMeta(IN,{fixTables:!0})}function $n(t){const e=t.selection,n=Na(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 fg(t,{map:e,tableStart:n,table:o},r){let i=r>0?-1:0;ON(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],u=o.nodeAt(c);t.setNodeMarkup(t.mapping.map(n+c),null,cg(u.attrs,r-e.colCount(c))),s+=u.attrs.rowspan-1}else{const c=i==null?xt(o.type.schema).cell:o.nodeAt(e.map[l+i]).type,u=e.positionAt(s,r,o);t.insert(t.mapping.map(n+u),c.createAndFill())}}return t}function PN(t,e){if(!wn(t))return!1;if(e){const n=$n(t);e(fg(t.tr,n,n.left))}return!0}function $N(t,e){if(!wn(t))return!1;if(e){const n=$n(t);e(fg(t.tr,n,n.right))}return!0}function FN(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],u=n.nodeAt(c),d=u.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,Go(d,r-e.colCount(c)));else{const p=t.mapping.slice(i).map(o+c);t.delete(p,p+u.nodeSize)}s+=d.rowspan}}function VN(t,e){if(!wn(t))return!1;if(e){const n=$n(t),o=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let r=n.right-1;FN(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 zN(t,e,n){var o;const r=xt(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 hg(t,{map:e,tableStart:n,table:o},r){var i;let s=n;for(let u=0;u<r;u++)s+=o.child(u).nodeSize;const l=[];let c=r>0?-1:0;zN(e,o,r+c)&&(c=r==0||r==e.height?null:0);for(let u=0,d=e.width*r;u<e.width;u++,d++)if(r>0&&r<e.height&&e.map[d]==e.map[d-e.width]){const p=e.map[d],f=o.nodeAt(p).attrs;t.setNodeMarkup(n+p,null,{...f,rowspan:f.rowspan+1}),u+=f.colspan-1}else{const p=c==null?xt(o.type.schema).cell:(i=o.nodeAt(e.map[d+c*e.width]))==null?void 0:i.type,f=p==null?void 0:p.createAndFill();f&&l.push(f)}return t.insert(s,xt(o.type.schema).row.create(null,l)),t}function HN(t,e){if(!wn(t))return!1;if(e){const n=$n(t);e(hg(t.tr,n,n.top))}return!0}function UN(t,e){if(!wn(t))return!1;if(e){const n=$n(t);e(hg(t.tr,n,n.bottom))}return!0}function qN(t,{map:e,table:n,tableStart:o},r){let i=0;for(let u=0;u<r;u++)i+=n.child(u).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 u=0,d=r*e.width;u<e.width;u++,d++){const p=e.map[d];if(!c.has(p)){if(c.add(p),r>0&&p==e.map[d-e.width]){const f=n.nodeAt(p).attrs;t.setNodeMarkup(t.mapping.slice(l).map(p+o),null,{...f,rowspan:f.rowspan-1}),u+=f.colspan-1}else if(r<e.height&&p==e.map[d+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,u,n);t.insert(t.mapping.slice(l).map(o+g),m),u+=h.colspan-1}}}}function KN(t,e){if(!wn(t))return!1;if(e){const n=$n(t),o=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let r=n.bottom-1;qN(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 yp(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function WN({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 vp(t,e){const n=t.selection;if(!(n instanceof Ve)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=$n(t),{map:r}=o;if(WN(r,o))return!1;if(e){const i=t.tr,s={};let l=A.empty,c,u;for(let d=o.top;d<o.bottom;d++)for(let p=o.left;p<o.right;p++){const f=r.map[d*r.width+p],h=o.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,c==null)c=f,u=h;else{yp(h)||(l=l.append(h.content));const m=i.mapping.map(f+o.tableStart);i.delete(m,m+h.nodeSize)}}if(c==null||u==null)return!0;if(i.setNodeMarkup(c+o.tableStart,null,{...cg(u.attrs,u.attrs.colspan,o.right-o.left-u.attrs.colspan),rowspan:o.bottom-o.top}),l.size){const d=c+1+u.content.size,p=yp(u)?c+1:d;i.replaceWith(p+o.tableStart,d+o.tableStart,l)}i.setSelection(new Ve(i.doc.resolve(c+o.tableStart))),e(i)}return!0}function kp(t,e){const n=xt(t.schema);return jN(({node:o})=>n[o.type.spec.tableRole])(t,e)}function jN(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=xN(r.$from),!i)return!1;s=(o=Nr(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=[],u=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const d=$n(e),p=e.tr;for(let h=0;h<d.right-d.left;h++)c.push(u?{...l,colwidth:u&&u[h]?[u[h]]:null}:l);let f;for(let h=d.top;h<d.bottom;h++){let m=d.map.positionAt(h,d.left,d.table);h==d.top&&(m+=i.nodeSize);for(let g=d.left,b=0;g<d.right;g++,b++)g==d.left&&h==d.top||p.insert(f=p.mapping.map(m+d.tableStart,1),t({node:i,row:h,col:g}).createAndFill(c[b]))}p.setNodeMarkup(s,t({node:i,row:d.top,col:d.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 GN(t,e){return function(n,o){if(!wn(n))return!1;const r=Na(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 YN(t){return function(e,n){if(!wn(e))return!1;if(n){const o=xt(e.schema),r=$n(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 wp(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 bi(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?YN(t):function(n,o){if(!wn(n))return!1;if(o){const r=xt(n.schema),i=$n(n),s=n.tr,l=wp("row",i,r),c=wp("column",i,r),d=(t==="column"?l:t==="row"?c:!1)?1:0,p=t=="column"?{left:0,top:d,right:1,bottom:i.map.height}:t=="row"?{left:d,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}}bi("row",{useDeprecatedLogic:!0});bi("column",{useDeprecatedLogic:!0});var JN=bi("cell",{useDeprecatedLogic:!0});function XN(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 Ep(t){return function(e,n){if(!wn(e))return!1;const o=XN(Na(e),t);if(o==null)return!1;if(n){const r=e.doc.resolve(o);n(e.tr.setSelection(ne.between(r,TN(r))).scrollIntoView())}return!0}}function ZN(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 Ui(t,e){const n=t.selection;if(!(n instanceof Ve))return!1;if(e){const o=t.tr,r=xt(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 QN(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 u=e.child(c).content;const d=c?0:Math.max(0,n-1),p=c<e.childCount-1?0:Math.max(0,o-1);(d||p)&&(u=sc(xt(s).row,new V(u,d,p)).content),l.push(u)}else if(i=="cell"||i=="header_cell")l.push(n||o?sc(xt(s).row,new V(e,n,o)).content:e);else return null;return eT(s,l)}function eT(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 u=r;u<r+l;u++)n[u]=(n[u]||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=xt(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 sc(t,e){const n=t.createAndFill();return new fc(n).replace(0,n.content.size,e).doc}function tT({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],u=[];for(let d=i[l]||0,p=0;d<o;p++){let f=c.child(p%c.childCount);d+f.attrs.colspan>o&&(f=f.type.createChecked(Go(f.attrs,f.attrs.colspan,d+f.attrs.colspan-o),f.content)),u.push(f),d+=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(u))}n=s,t=o}if(e!=r){const i=[];for(let s=0,l=0;s<r;s++,l++){const c=[],u=n[l%e];for(let d=0;d<u.childCount;d++){let p=u.child(d);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 nT(t,e,n,o,r,i,s){const l=t.doc.type.schema,c=xt(l);let u,d;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=u||(u=c.cell.createAndFill()):g=d||(d=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?d||(d=c.header_cell.createAndFill()):u||(u=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!!(u||d)}function _p(t,e,n,o,r,i,s,l){if(s==0||s==e.height)return!1;let c=!1;for(let u=r;u<i;u++){const d=s*e.width+u,p=e.map[d];if(e.map[d-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})),u+=f.attrs.colspan-1}}return c}function Cp(t,e,n,o,r,i,s,l){if(s==0||s==e.width)return!1;let c=!1;for(let u=r;u<i;u++){const d=u*e.width+s,p=e.map[d];if(e.map[d-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,Go(f.attrs,s-h,f.attrs.colspan-(s-h))),t.insert(m+f.nodeSize,f.type.createAndFill(Go(f.attrs,0,s-h))),u+=f.attrs.rowspan-1}}return c}function Sp(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,u=c+r.width,d=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}nT(p,s,i,n,u,d,f)&&h(),_p(p,s,i,n,c,u,l,f)&&h(),_p(p,s,i,n,c,u,d,f)&&h(),Cp(p,s,i,n,l,d,c,f)&&h(),Cp(p,s,i,n,l,d,u,f)&&h();for(let m=l;m<d;m++){const g=s.positionAt(m,c,i),b=s.positionAt(m,u,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(d-1,u-1,i)))),e(p)}var oT=Cc({ArrowLeft:qi("horiz",-1),ArrowRight:qi("horiz",1),ArrowUp:qi("vert",-1),ArrowDown:qi("vert",1),"Shift-ArrowLeft":Ki("horiz",-1),"Shift-ArrowRight":Ki("horiz",1),"Shift-ArrowUp":Ki("vert",-1),"Shift-ArrowDown":Ki("vert",1),Backspace:Ui,"Mod-Backspace":Ui,Delete:Ui,"Mod-Delete":Ui});function us(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function qi(t,e){return(n,o,r)=>{if(!r)return!1;const i=n.selection;if(i instanceof Ve)return us(n,o,ae.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const s=mg(r,t,e);if(s==null)return!1;if(t=="horiz")return us(n,o,ae.near(n.doc.resolve(i.head+e),e));{const l=n.doc.resolve(s),c=lg(l,t,e);let u;return c?u=ae.near(c,1):e<0?u=ae.near(n.doc.resolve(l.before(-1)),-1):u=ae.near(n.doc.resolve(l.after(-1)),1),us(n,o,u)}}}function Ki(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=mg(r,t,e);if(c==null)return!1;s=new Ve(n.doc.resolve(c))}const l=lg(s.$headCell,t,e);return l?us(n,o,new Ve(s.$anchorCell,l)):!1}}function rT(t,e){const n=t.state.doc,o=Nr(n.resolve(e));return o?(t.dispatch(t.state.tr.setSelection(new Ve(o))),!0):!1}function iT(t,e,n){if(!wn(t.state))return!1;let o=QN(n);const r=t.state.selection;if(r instanceof Ve){o||(o={width:1,height:1,rows:[A.from(sc(xt(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=tT(o,l.right-l.left,l.bottom-l.top),Sp(t.state,t.dispatch,s,l,o),!0}else if(o){const i=Na(t.state),s=i.start(-1);return Sp(t.state,t.dispatch,s,Qe.get(i.node(-1)).findCell(i.pos-s),o),!0}else return!1}function sT(t,e){var n;if(e.ctrlKey||e.metaKey)return;const o=xp(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=Nr(t.state.selection.$anchor))!=null&&((n=hl(t,e))==null?void 0:n.pos)!=r.pos)i(r,e),e.preventDefault();else if(!o)return;function i(c,u){let d=hl(t,u);const p=uo.getState(t.state)==null;if(!d||!fu(c,d))if(p)d=c;else return;const f=new Ve(c,d);if(p||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);p&&h.setMeta(uo,c.pos),t.dispatch(h)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",l),uo.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(uo,-1))}function l(c){const u=c,d=uo.getState(t.state);let p;if(d!=null)p=t.state.doc.resolve(d);else if(xp(t,u.target)!=o&&(p=hl(t,e),!p))return s();p&&i(p,u)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",l)}function mg(t,e,n){if(!(t.state.selection instanceof ne))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 xp(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function hl(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Nr(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")),ac(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,ac(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ac(t,e,n,o,r,i){var s;let l=0,c=!0,u=e.firstChild;const d=t.firstChild;if(d){for(let p=0,f=0;p<d.childCount;p++){const{colspan:h,colwidth:m}=d.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),u)u.style.width!=y&&(u.style.width=y),u=u.nextSibling;else{const k=document.createElement("col");k.style.width=y,e.appendChild(k)}}}for(;u;){const p=u.nextSibling;(s=u.parentNode)==null||s.removeChild(u),u=p}c?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var Yt=new xe("tableColumnResizing");function lT({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:o=aT,lastColumnResizable:r=!0}={}){const i=new Ae({key:Yt,state:{init(s,l){var c,u;const d=(u=(c=i.spec)==null?void 0:c.props)==null?void 0:u.nodeViews,p=xt(l.schema).table.name;return o&&d&&(d[p]=(f,h)=>new o(f,n,h)),new cT(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=Yt.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{uT(s,l,t,r)},mouseleave:s=>{dT(s)},mousedown:(s,l)=>{pT(s,l,e,n)}},decorations:s=>{const l=Yt.getState(s);if(l&&l.activeHandle>-1)return bT(s,l.activeHandle)},nodeViews:{}}});return i}var cT=class ds{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,o=e.getMeta(Yt);if(o&&o.setHandle!=null)return new ds(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new ds(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&e.docChanged){let r=e.mapping.map(n.activeHandle,-1);return ic(e.doc.resolve(r))||(r=-1),new ds(r,n.dragging)}return n}};function uT(t,e,n,o){if(!t.editable)return;const r=Yt.getState(t.state);if(r&&!r.dragging){const i=hT(e.target);let s=-1;if(i){const{left:l,right:c}=i.getBoundingClientRect();e.clientX-l<=n?s=Np(t,e,"left",n):c-e.clientX<=n&&(s=Np(t,e,"right",n))}if(s!=r.activeHandle){if(!o&&s!==-1){const l=t.state.doc.resolve(s),c=l.node(-1),u=Qe.get(c),d=l.start(-1);if(u.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==u.width-1)return}gg(t,s)}}}function dT(t){if(!t.editable)return;const e=Yt.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&gg(t,-1)}function pT(t,e,n,o){var r;if(!t.editable)return!1;const i=(r=t.dom.ownerDocument.defaultView)!=null?r:window,s=Yt.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=t.state.doc.nodeAt(s.activeHandle),c=fT(t,s.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Yt,{setDragging:{startX:e.clientX,startWidth:c}}));function u(p){i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",d);const f=Yt.getState(t.state);f!=null&&f.dragging&&(mT(t,f.activeHandle,Tp(f.dragging,p,n)),t.dispatch(t.state.tr.setMeta(Yt,{setDragging:null})))}function d(p){if(!p.which)return u(p);const f=Yt.getState(t.state);if(f&&f.dragging){const h=Tp(f.dragging,p,n);Op(t,f.activeHandle,h,o)}}return Op(t,s.activeHandle,c,o),i.addEventListener("mouseup",u),i.addEventListener("mousemove",d),e.preventDefault(),!0}function fT(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 u=0;u<n;u++)o[u]&&(l-=o[u],c--);return l/c}function hT(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Np(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=Nr(t.state.doc.resolve(s));if(!l)return-1;if(n=="right")return l.pos;const c=Qe.get(l.node(-1)),u=l.start(-1),d=c.map.indexOf(l.pos-u);return d%c.width==0?-1:u+c.map[d-1]}function Tp(t,e,n){const o=e.clientX-t.startX;return Math.max(n,t.startWidth+o)}function gg(t,e){t.dispatch(t.state.tr.setMeta(Yt,{setHandle:e}))}function mT(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 u=0;u<i.height;u++){const d=u*i.width+l;if(u&&i.map[d]==i.map[d-i.width])continue;const p=i.map[d],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():gT(f.colspan);m[h]=n,c.setNodeMarkup(s+p,null,{...f,colwidth:m})}c.docChanged&&t.dispatch(c)}function Op(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&&ac(i,c.firstChild,c,o,l,n)}function gT(t){return Array(t).fill(0)}function bT(t,e){var n;const o=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return Ne.empty;const s=Qe.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let u=0;u<s.height;u++){const d=c+u*s.width;if((c==s.width-1||s.map[d]!=s.map[d+1])&&(u==0||s.map[d]!=s.map[d-s.width])){const p=s.map[d],f=l+p+i.nodeAt(p).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",(n=Yt.getState(t))!=null&&n.dragging&&o.push(Ge.node(l+p,l+p+i.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),o.push(Ge.widget(f,h))}}return Ne.create(t.doc,o)}function yT({allowTableNodeSelection:t=!1}={}){return new Ae({key:uo,state:{init(){return null},apply(e,n){const o=e.getMeta(uo);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:AN,handleDOMEvents:{mousedown:sT},createSelectionBetween(e){return uo.getState(e.state)!=null?e.state.selection:null},handleTripleClick:rT,handleKeyDown:oT,handlePaste:iT},appendTransaction(e,n,o){return DN(o,pg(o,n),t)}})}function lc(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Mp(t,e,n,o,r,i){var s;let l=0,c=!0,u=e.firstChild;const d=t.firstChild;if(d!==null)for(let p=0,f=0;p<d.childCount;p+=1){const{colspan:h,colwidth:m}=d.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),u){if(u.style.width!==y){const[k,E]=lc(o,b);u.style.setProperty(k,E)}u=u.nextSibling}else{const k=document.createElement("col"),[E,v]=lc(o,b);k.style.setProperty(E,v),e.appendChild(k)}}}for(;u;){const p=u.nextSibling;(s=u.parentNode)===null||s===void 0||s.removeChild(u),u=p}c?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}class vT{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")),Mp(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,Mp(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function kT(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,k]=lc(e,b);s.push(["col",{style:`${y}: ${k}`}])}}const c=i?`${r}px`:"",u=i?"":`${r}px`;return{colgroup:["colgroup",{},...s],tableWidth:c,tableMinWidth:u}}function Ap(t,e){return t.createAndFill()}function wT(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 bg(t,e,n,o,r){const i=wT(t),s=[],l=[];for(let u=0;u<n;u+=1){const d=Ap(i.cell);if(d&&l.push(d),o){const p=Ap(i.header_cell);p&&s.push(p)}}const c=[];for(let u=0;u<e;u+=1)c.push(i.row.createChecked(null,o&&u===0?s:l));return i.table.createChecked(null,c)}function ET(t){return t instanceof Ve}const Wi=({editor:t})=>{const{selection:e}=t.state;if(!ET(e))return!1;let n=0;const o=Dh(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},yg=ze.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:vT,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}=kT(t,this.options.cellMinWidth);return["table",_e(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=bg(i.schema,t,e,n);if(r){const l=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(ne.near(o.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>PN(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>$N(t,e),deleteColumn:()=>({state:t,dispatch:e})=>VN(t,e),addRowBefore:()=>({state:t,dispatch:e})=>HN(t,e),addRowAfter:()=>({state:t,dispatch:e})=>UN(t,e),deleteRow:()=>({state:t,dispatch:e})=>KN(t,e),deleteTable:()=>({state:t,dispatch:e})=>ZN(t,e),mergeCells:()=>({state:t,dispatch:e})=>vp(t,e),splitCell:()=>({state:t,dispatch:e})=>kp(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>bi("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>bi("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>JN(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>vp(t,e)?!0:kp(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:o})=>GN(t,e)(n,o),goToNextCell:()=>({state:t,dispatch:e})=>Ep(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Ep(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&pg(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:Wi,"Mod-Backspace":Wi,Delete:Wi,"Mod-Delete":Wi}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[lT({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],yT({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:ve(j(t,"tableRole",e))}}}),vg=ze.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",_e(this.options.HTMLAttributes,t),0]}}),kg=ze.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",_e(this.options.HTMLAttributes,t),0]}}),hu=ze.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",_e(this.options.HTMLAttributes,t),0]}});/**
|
|
152
|
+
* Copyright 2025 Yiitap
|
|
153
|
+
* @license MIT
|
|
154
|
+
**/const Rp=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,u=c+s.length,d=Ge.inline(c,u,{class:"color",style:`--color: ${s}`});n.push(d)})}),Ne.create(t,n)},wg=De.create({name:"colorHighlighter",addProseMirrorPlugins(){return[new Ae({key:new xe("colorHighlighter"),state:{init(t,{doc:e}){return Rp(e)},apply(t,e){return t.docChanged?Rp(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 xe("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:o}=this.editor,{anchor:r}=e,i=[];if(!n||!o)return Ne.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((c,u)=>{if(!c.isText){if(!(r>=u&&r<=u+c.nodeSize-1))return!1;s+=1}});let l=0;return t.descendants((c,u)=>{if(c.isText||!(r>=u&&r<=u+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(Ge.node(u,u+c.nodeSize,{class:this.options.className}))}),Ne.create(t,i)}}})]}});/**
|
|
158
|
+
* Copyright 2025 Yiitap
|
|
159
|
+
* @license MIT
|
|
160
|
+
**/const Eg=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 xe("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,u=this.options.showOnlyCurrent;if((l||!u)&&c){const d=[this.options.emptyNodeClass];this.editor.isEmpty&&d.push(this.options.emptyEditorClass);const p=Ge.node(s,s+i.nodeSize,{class:d.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}),Ne.create(t,r)):null}}})]}});/**
|
|
161
|
+
* Copyright 2025 Yiitap
|
|
162
|
+
* @license MIT
|
|
163
|
+
**/const Dr="selection-decoration",ji={BLUR:"blur",FOCUS:"focus"},_g=De.create({name:Dr,addProseMirrorPlugins(){return[new Ae({key:new xe(Dr),state:{init(t){return Ne.empty},apply:(t,e)=>{const{selection:n,doc:o}=t,r=t.getMeta(Dr),i=n&&n.from!==n.to;if(!i||(r==null?void 0:r.action)===ji.FOCUS)return Ne.empty;if(i&&(r==null?void 0:r.action)===ji.BLUR){const s=Ge.inline(n.from,n.to,{class:"selection-decoration-blur"});return Ne.create(o,[s])}return e}},props:{decorations(t){return this.getState(t)},handleDOMEvents:{blur:t=>{const{tr:e}=t.state,n=e.setMeta(Dr,{from:e.selection.from,to:e.selection.to,action:ji.BLUR});t.dispatch(n)},focus:t=>{const{tr:e}=t.state,n=e.setMeta(Dr,{from:e.selection.from,to:e.selection.to,action:ji.FOCUS});t.dispatch(n)}}}})]}});/**
|
|
164
|
+
* Copyright 2025 Yiitap
|
|
165
|
+
* @license MIT
|
|
166
|
+
**/function Bp(t,e,n,o,r,i){let s=0,l=!0,c=e.firstChild;const u=t.firstChild;for(let d=0,p=0;d<u.childCount;d+=1){const{colspan:f,colwidth:h}=u.child(d).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 d=c.nextSibling;c.parentNode.removeChild(c),c=d}l?(n.style.width=`${s}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${s}px`)}class _T{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")),Bp(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,Bp(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}const Cg=yg.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{},resizable:!0,handleWidth:5,cellMinWidth:25,View:_T,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||{},u=bg(n.schema,s,l,c);if(i){const d=r.selection.anchor+1;o.insertContent({type:"table-wrapper",content:[u.toJSON()]}),r.scrollIntoView().setSelection(ne.near(r.doc.resolve(d)))}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 CT({node:t,types:e}){return Array.isArray(e)&&e.includes(t.type)||t.type===e}function Gi({node:t,types:e}){return t?!CT({node:t,types:e}):!1}const Sg=De.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:["paragraph"]}},addProseMirrorPlugins(){const t=new xe(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),u=i.content.size,d=l.nodes[this.options.node];if(!(!c||!d))return s.insert(u,d.create())},state:{init:(n,o)=>{const r=o.tr.doc.lastChild,i=(r==null?void 0:r.firstChild)??null;return Gi({node:r,types:e})||Gi({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 Gi({node:r,types:e})||Gi({node:i,types:e})}}})]}});var bt=[];for(var ml=0;ml<256;++ml)bt.push((ml+256).toString(16).slice(1));function ST(t,e=0){return(bt[t[e+0]]+bt[t[e+1]]+bt[t[e+2]]+bt[t[e+3]]+"-"+bt[t[e+4]]+bt[t[e+5]]+"-"+bt[t[e+6]]+bt[t[e+7]]+"-"+bt[t[e+8]]+bt[t[e+9]]+"-"+bt[t[e+10]]+bt[t[e+11]]+bt[t[e+12]]+bt[t[e+13]]+bt[t[e+14]]+bt[t[e+15]]).toLowerCase()}var Yi,xT=new Uint8Array(16);function NT(){if(!Yi&&(Yi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Yi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Yi(xT)}var TT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Dp={randomUUID:TT};function OT(t,e,n){if(Dp.randomUUID&&!t)return Dp.randomUUID();t=t||{};var o=t.random||(t.rng||NT)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,ST(o)}/**
|
|
170
|
+
* Copyright 2025 Yiitap
|
|
171
|
+
* @license MIT
|
|
172
|
+
**/const xg=ze.create({name:"uniqueID",priority:1e4,addOptions:()=>({attributeName:"data-id",types:["heading"],enableRender:!1,enableInJSON:!1,generateId:()=>OT()}),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 xe(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 MT(t){var e;const{char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:l}=t,c=o&&!r,u=Fh(n),d=new RegExp(`\\s${u}$`),p=s?"^":"",f=r?"":u,h=c?new RegExp(`${p}${u}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\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),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!k)return null;const E=g+b.index;let v=E+b[0].length;return c&&d.test(m.slice(v-1,v+1))&&(b[0]+=" ",v+=1),E<l.pos&&v>=l.pos?{range:{from:E,to:v},query:b[0].slice(n.length),text:b[0]}:null}const AT=new xe("suggestion");function Ta({pluginKey:t=AT,editor:e,char:n="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:c="suggestion",command:u=()=>null,items:d=()=>[],render:p=()=>({}),allow:f=()=>!0,findSuggestionMatch:h=MT}){let m;const g=p==null?void 0:p(),b=new Ae({key:t,view(){return{update:async(y,k)=>{var E,v,C,_,R,B,N;const M=(E=this.key)===null||E===void 0?void 0:E.getState(k),z=(v=this.key)===null||v===void 0?void 0:v.getState(y.state),G=M.active&&z.active&&M.range.from!==z.range.from,$=!M.active&&z.active,U=M.active&&!z.active,q=!$&&!U&&M.query!==z.query,ee=$||G&&q,S=q||G,O=U||G&&q;if(!ee&&!S&&!O)return;const F=O&&!ee?M:z,J=y.dom.querySelector(`[data-decoration-id="${F.decorationId}"]`);m={editor:e,range:F.range,query:F.query,text:F.text,items:[],command:Q=>u({editor:e,range:F.range,props:Q}),decorationNode:J,clientRect:J?()=>{var Q;const{decorationId:ce}=(Q=this.key)===null||Q===void 0?void 0:Q.getState(e.state),Ce=y.dom.querySelector(`[data-decoration-id="${ce}"]`);return(Ce==null?void 0:Ce.getBoundingClientRect())||null}:null},ee&&((C=g==null?void 0:g.onBeforeStart)===null||C===void 0||C.call(g,m)),S&&((_=g==null?void 0:g.onBeforeUpdate)===null||_===void 0||_.call(g,m)),(S||ee)&&(m.items=await d({editor:e,query:F.query})),O&&((R=g==null?void 0:g.onExit)===null||R===void 0||R.call(g,m)),S&&((B=g==null?void 0:g.onUpdate)===null||B===void 0||B.call(g,m)),ee&&((N=g==null?void 0:g.onStart)===null||N===void 0||N.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,k,E,v){const{isEditable:C}=e,{composing:_}=e.view,{selection:R}=y,{empty:B,from:N}=R,M={...k};if(M.composing=_,C&&(B||e.view.composing)){(N<k.range.from||N>k.range.to)&&!_&&!k.composing&&(M.active=!1);const z=h({char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:R.$from}),G=`id_${Math.floor(Math.random()*4294967295)}`;z&&f({editor:e,state:v,range:z.range,isActive:k.active})?(M.active=!0,M.decorationId=k.decorationId?k.decorationId:G,M.range=z.range,M.query=z.query,M.text=z.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(y,k){var E;const{active:v,range:C}=b.getState(y.state);return v&&((E=g==null?void 0:g.onKeyDown)===null||E===void 0?void 0:E.call(g,{view:y,event:k,range:C}))||!1},decorations(y){const{active:k,range:E,decorationId:v}=b.getState(y);return k?Ne.create(y.doc,[Ge.inline(E.from,E.to,{nodeName:l,class:c,"data-decoration-id":v})]):null}}});return b}const RT=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[Ta({pluginKey:new xe(this.options.pluginKey),editor:this.editor,...this.options.suggestion})]}}),BT=De.create({name:"colon-command",addOptions(){return{suggestion:{char:":",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[Ta({pluginKey:new xe("colon-command"),editor:this.editor,...this.options.suggestion})]}}),DT=De.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[Ta({pluginKey:new xe("slash-command"),editor:this.editor,...this.options.suggestion})]}}),IT=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[Ta({pluginKey:new xe("slash-zh-command"),editor:this.editor,...this.options.suggestion})]}});/**
|
|
176
|
+
* Copyright 2025 Yiitap
|
|
177
|
+
* @license MIT
|
|
178
|
+
**/const LT=ze.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",_e(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=An.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,u=ne.create(r.doc,l,c);return r.setSelection(u),n.dispatch(r),!0}return!1}}}}),PT={class:"o-scroll"},$T={class:"view-main"},FT={class:"block-container"},VT={class:"block-content"},zT={key:0,class:"edit-prompt"},HT={key:1},UT={"data-tippy-role":"tooltip"},qT={class:"label"},KT={class:"block-container"},WT={class:"block-content"},jT=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,{md:n,aiOption:o,createStreamingChatCompletion:r}=Yc(),{languageName:i,tr:s}=ge(),{isFocused:l,bind:c,unbind:u,checkFocus:d}=Rm(),{theme:p}=xr(),{isEditable:f}=Te(),{getPos:h}=e,m=a.ref(null),g=a.ref(""),b=a.ref(!1),y=a.ref({}),k=a.ref(!1),E=a.ref(!1),v=a.ref(""),C=a.ref(null),_=a.ref(!1),R=a.ref(!1),B=a.computed(()=>({role:"system",content:Gc.writing.replace("[LANGUAGE]",i.value)})),N=a.ref([B.value]),M=a.computed(()=>!e.node.textContent),z=a.computed(()=>Em),G=a.computed({get(){return e.node.attrs.provider},set(X){e.updateAttributes({provider:X})}}),$=a.computed({get(){return e.node.attrs.prompt},set(X){e.updateAttributes({prompt:X})}}),U=a.computed({get(){return e.node.attrs.time},set(X){e.updateAttributes({time:X})}});function q(){g.value=$.value,M.value&&!$.value&&setTimeout(()=>{var X;(X=m.value)==null||X.focus()},0)}function ee(){setTimeout(()=>{},0)}function S(){v.value="edit",setTimeout(()=>{var X;(X=C.value)==null||X.focus()},0)}function O(){G.value=o.value.provider,$.value=g.value,U.value=Date.now(),_.value=!0,v.value&&(v.value=""),R.value?J():F()}async function F(){const X=h();let be="";N.value.push({role:"user",content:$.value}),N.value[0].role==="system"&&(N.value.shift(),N.value.unshift(B.value));try{const ke=await r(N.value,Ye=>{be+=Ye,N.value=[...N.value.slice(0,-1),{role:"assistant",content:be}];const tt=cc(n.render(be));Q(X,tt)})}catch(ke){N.value.pop(),console.error(ke),tu.error(s("ai.error"))}_.value=!1}async function J(){const X=h();let be="";try{for(const ke of Um){await new Promise(tt=>setTimeout(tt,500)),be+=ke;const Ye=cc(n.render(be));Q(X,Ye)}}catch(ke){console.error(ke)}_.value=!1}function Q(X,be){var Ye;const ke=e.node.toJSON();ke.content=be.content,(Ye=e.editor)==null||Ye.commands.updateAiBlock(X,ke),e.editor.commands.setNodeSelection(X),e.editor.view.focus(),ce()}function ce(){const be=e.node.content.lastChild;if(be&&be.attrs["data-id"]){const ke=be.attrs["data-id"],Ye=document.querySelector(`[data-id="${ke}"]`);Ye&&Ye.scrollIntoView({behavior:"smooth",block:"center"})}}function Ce(X){b.value=!1,X.value}function ot(X,be){be?g.value=s(be.label):g.value=s(X.label),k.value=!1}function Re(X){b.value=!0,y.value=X}return a.watch(()=>e.node.content,X=>{d()}),a.watch(M,X=>{X&&(E.value=!1)}),a.watch(l,X=>{X&&!M.value&&setTimeout(()=>{g.value=$.value,v.value="",E.value=X},100)}),a.onMounted(()=>{q(),c(e)}),a.onBeforeUnmount(()=>{u()}),(X,be)=>(a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:["o-ai-block-view",{"is-empty":M.value,"has-focus":a.unref(l)}],onContextmenu:a.withModifiers(Re,["prevent"])}),{default:a.withCtx(()=>[M.value?(a.openBlock(),a.createBlock(a.unref(Zn),{key:0,modelValue:k.value,"onUpdate:modelValue":be[1]||(be[1]=ke=>k.value=ke),placement:"bottom-start","tippy-class":"ai-block-popover",offset:[0,14]},{"popover-content":a.withCtx(()=>[a.createElementVNode("section",PT,[a.createElementVNode("section",$T,[a.createVNode(a.unref(_a),{items:z.value,onSelect:ot,"use-keyboard":k.value},null,8,["items","use-keyboard"])])])]),default:a.withCtx(()=>[a.createElementVNode("div",FT,[a.createElementVNode("div",VT,[a.createVNode(a.unref(Ln),{ref_key:"inputRef",ref:m,modelValue:g.value,"onUpdate:modelValue":be[0]||(be[0]=ke=>g.value=ke),placeholder:a.unref(s)("ai.tellAi"),type:"text",autofocus:"",clearable:"",onFocus:ee},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{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:_.value,onClick:O},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])])]),_:1},8,["modelValue"])):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(a.unref(Zn),{modelValue:E.value,"onUpdate:modelValue":be[4]||(be[4]=ke=>E.value=ke),placement:"top-end","tippy-class":"ai-block-update-popover",offset:[0,18]},{"popover-content":a.withCtx(()=>[v.value==="edit"?(a.openBlock(),a.createElementBlock("section",zT,[a.createVNode(a.unref(Ln),{ref_key:"updateInputRef",ref:C,modelValue:g.value,"onUpdate:modelValue":be[2]||(be[2]=ke=>g.value=ke),placeholder:a.unref(s)("ai.tellAi"),type:"text",autofocus:"",clearable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{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:_.value,onClick:O},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])):(a.openBlock(),a.createElementBlock("section",HT,[a.createVNode(a.unref(Hm),null,{default:a.withCtx(()=>[a.createElementVNode("div",UT,[a.createVNode(a.unref(St),{icon:"auto_awesome",onClick:S},{default:a.withCtx(()=>[a.createElementVNode("span",qT,a.toDisplayString(a.unref(s)("label.generatedBy"))+" "+a.toDisplayString(a.unref(jc)(G.value,"name")||"AI"),1)]),_:1})]),a.createVNode(a.unref(yn),{icon:"autorenew",tooltip:a.unref(s)("label.update"),loading:_.value,onClick:O},null,8,["tooltip","loading"])]),_:1})]))]),default:a.withCtx(()=>[a.createElementVNode("div",KT,[a.createElementVNode("div",WT,[a.createVNode(a.unref(Pn))]),a.unref(f)?(a.openBlock(),a.createBlock(a.unref(xi),{key:0,modelValue:b.value,"onUpdate:modelValue":be[3]||(be[3]=ke=>b.value=ke),event:y.value},{default:a.withCtx(()=>[a.createVNode(a.unref(So),a.mergeProps(e,{onAction:Ce}),null,16)]),_:1},8,["modelValue","event"])):a.createCommentVNode("",!0)])]),_:1},8,["modelValue"]),[[a.vShow,!M.value]])]),_:1},16,["class"]))}}),Ng=LT.extend({addNodeView(){return pn(jT)}}),GT=a.defineComponent({__name:"view",props:ct,setup(t){const e=t;return(n,o)=>(a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:"o-blockquote-view"}),{default:a.withCtx(()=>[a.createElementVNode("blockquote",null,[a.createVNode(a.unref(Pn))])]),_:1},16))}}),Tg=um.extend({draggable:!0,addNodeView(){return pn(GT)}});/**
|
|
179
|
+
* Copyright 2025 Yiitap
|
|
180
|
+
* @license MIT
|
|
181
|
+
**/const YT=ze.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",_e(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,u=ne.create(r.doc,l,c);return r.setSelection(u),n.dispatch(r),!0}return!1}}}}),JT={class:"callout-container"},XT={class:"callout-icon"},ZT={class:"callout-content"},QT=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,{theme:n}=xr(),{isEditable:o}=Te(),r=a.ref(!1),i=a.ref(!1),s=a.ref({}),l=a.ref(null),c=a.computed(()=>{const{selection:v}=e.editor.view.state,C=v.from,_=e.getPos(),R=_+e.node.nodeSize;return C>=_&&C<=R}),u=a.computed({get(){return e.node.attrs.backColor},set(v){e.updateAttributes({backColor:v})}}),d=a.computed({get(){return e.node.attrs.backColorDark},set(v){e.updateAttributes({backColorDark:v})}}),p=a.computed({get(){return e.node.attrs.borderColor},set(v){e.updateAttributes({borderColor:v})}}),f=a.computed({get(){return e.node.attrs.borderColorDark},set(v){e.updateAttributes({borderColorDark:v})}}),h=a.computed(()=>n.value==="dark"?d.value:u.value),m=a.computed(()=>n.value==="dark"?f.value:p.value);function g(v){e.updateAttributes({icon:v})}function b(v){switch(r.value=!1,v.value){case"palette":k(!0);break}}function y(v){r.value=!0,s.value=v}function k(v){i.value=v}function E(v,C){var _;switch(v){case"backColor":u.value=C;break;case"foreColor":p.value=C;break;case"icon":g(C.emoji),(_=l.value)==null||_.setShow(!1);break}}return a.watch(c,v=>{k(v)}),(v,C)=>(a.openBlock(),a.createBlock(a.unref(kn),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",JT,[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",XT,a.toDisplayString(v.node.attrs.icon),1)]),default:a.withCtx(()=>[a.createVNode(a.unref(Sa),{items:a.unref(ei.emojiGroups),onSelect:C[0]||(C[0]=_=>E("icon",_)),"enable-search":""},null,8,["items"])]),_:1},8,["disable"]),a.createElementVNode("div",ZT,[a.createVNode(a.unref(Pn))]),a.unref(o)?(a.openBlock(),a.createBlock(a.unref(xi),{key:0,modelValue:r.value,"onUpdate:modelValue":C[1]||(C[1]=_=>r.value=_),event:s.value},{default:a.withCtx(()=>[a.createVNode(a.unref(So),a.mergeProps(e,{onAction:b}),null,16)]),_:1},8,["modelValue","event"])):a.createCommentVNode("",!0)])]),_:1},16,["style"]))}}),Og=YT.extend({addNodeView(){return pn(QT)}});function e1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Mg(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)&&Mg(n)}),t}class Ip{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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function mo(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 t1="</span>",Lp=t=>!!t.scope,n1=(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 o1{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=Ag(e)}openNode(e){if(!Lp(e))return;const n=n1(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){Lp(e)&&(this.buffer+=t1)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const Pp=(t={})=>{const e={children:[]};return Object.assign(e,t),e};class mu{constructor(){this.rootNode=Pp(),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=Pp({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=>{mu._collapse(n)}))}}class r1 extends mu{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 o1(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function yi(t){return t?typeof t=="string"?t:t.source:null}function Rg(t){return Jo("(?=",t,")")}function i1(t){return Jo("(?:",t,")*")}function s1(t){return Jo("(?:",t,")?")}function Jo(...t){return t.map(n=>yi(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 gu(...t){return"("+(a1(t).capture?"":"?:")+t.map(o=>yi(o)).join("|")+")"}function Bg(t){return new RegExp(t.toString()+"|").exec("").length-1}function l1(t,e){const n=t&&t.exec(e);return n&&n.index===0}const c1=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function bu(t,{joinWith:e}){let n=0;return t.map(o=>{n+=1;const r=n;let i=yi(o),s="";for(;i.length>0;){const l=c1.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 u1=/\b\B/,Dg="[a-zA-Z]\\w*",yu="[a-zA-Z_]\\w*",Ig="\\b\\d+(\\.\\d+)?",Lg="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Pg="\\b(0b[01]+)",d1="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",p1=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=Jo(e,/.*\b/,t.binary,/\b.*/)),mo({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,o)=>{n.index!==0&&o.ignoreMatch()}},t)},vi={begin:"\\\\[\\s\\S]",relevance:0},f1={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[vi]},h1={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[vi]},m1={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/},Oa=function(t,e,n={}){const o=mo({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=gu("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:Jo(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),o},g1=Oa("//","$"),b1=Oa("/\\*","\\*/"),y1=Oa("#","$"),v1={scope:"number",begin:Ig,relevance:0},k1={scope:"number",begin:Lg,relevance:0},w1={scope:"number",begin:Pg,relevance:0},E1={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[vi,{begin:/\[/,end:/\]/,relevance:0,contains:[vi]}]},_1={scope:"title",begin:Dg,relevance:0},C1={scope:"title",begin:yu,relevance:0},S1={begin:"\\.\\s*"+yu,relevance:0},x1=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()}})};var Ji=Object.freeze({__proto__:null,APOS_STRING_MODE:f1,BACKSLASH_ESCAPE:vi,BINARY_NUMBER_MODE:w1,BINARY_NUMBER_RE:Pg,COMMENT:Oa,C_BLOCK_COMMENT_MODE:b1,C_LINE_COMMENT_MODE:g1,C_NUMBER_MODE:k1,C_NUMBER_RE:Lg,END_SAME_AS_BEGIN:x1,HASH_COMMENT_MODE:y1,IDENT_RE:Dg,MATCH_NOTHING_RE:u1,METHOD_GUARD:S1,NUMBER_MODE:v1,NUMBER_RE:Ig,PHRASAL_WORDS_MODE:m1,QUOTE_STRING_MODE:h1,REGEXP_MODE:E1,RE_STARTERS_RE:d1,SHEBANG:p1,TITLE_MODE:_1,UNDERSCORE_IDENT_RE:yu,UNDERSCORE_TITLE_MODE:C1});function N1(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function T1(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function O1(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=N1,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function M1(t,e){Array.isArray(t.illegal)&&(t.illegal=gu(...t.illegal))}function A1(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 R1(t,e){t.relevance===void 0&&(t.relevance=1)}const B1=(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=Jo(n.beforeMatch,Rg(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},D1=["of","and","for","in","not","or","if","then","parent","list","value"],I1="keyword";function $g(t,e,n=I1){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,$g(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,L1(c[0],c[1])]})}}function L1(t,e){return e?Number(e):P1(t)?0:1}function P1(t){return D1.includes(t.toLowerCase())}const $p={},zo=t=>{console.error(t)},Fp=(t,...e)=>{console.log(`WARN: ${t}`,...e)},er=(t,e)=>{$p[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),$p[`${t}/${e}`]=!0)},na=new Error;function Fg(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+=Bg(e[l-1]);t[n]=s,t[n]._emit=i,t[n]._multi=!0}function $1(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw zo("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),na;if(typeof t.beginScope!="object"||t.beginScope===null)throw zo("beginScope must be object"),na;Fg(t,t.begin,{key:"beginScope"}),t.begin=bu(t.begin,{joinWith:""})}}function F1(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw zo("skip, excludeEnd, returnEnd not compatible with endScope: {}"),na;if(typeof t.endScope!="object"||t.endScope===null)throw zo("endScope must be object"),na;Fg(t,t.end,{key:"endScope"}),t.end=bu(t.end,{joinWith:""})}}function V1(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function z1(t){V1(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),$1(t),F1(t)}function H1(t){function e(s,l){return new RegExp(yi(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+=Bg(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=e(bu(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(l);if(!c)return null;const u=c.findIndex((p,f)=>f>0&&p!==void 0),d=this.matchIndexes[u];return c.splice(0,u),Object.assign(c,d)}}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(([u,d])=>c.addRule(u,d)),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 u=c.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}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;[T1,A1,z1,B1].forEach(d=>d(s,l)),t.compilerExtensions.forEach(d=>d(s,l)),s.__beforeBegin=null,[O1,M1,R1].forEach(d=>d(s,l)),s.isCompiled=!0;let u=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),u=s.keywords.$pattern,delete s.keywords.$pattern),u=u||/\w+/,s.keywords&&(s.keywords=$g(s.keywords,t.case_insensitive)),c.keywordPatternRe=e(u,!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=yi(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(d){return U1(d==="self"?s:d)})),s.contains.forEach(function(d){i(d,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=mo(t.classNameAliases||{}),i(t)}function Vg(t){return t?t.endsWithParent||Vg(t.starts):!1}function U1(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return mo(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:Vg(t)?mo(t,{starts:t.starts?mo(t.starts):null}):Object.isFrozen(t)?mo(t):t}var q1="11.10.0";class K1 extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const gl=Ag,Vp=mo,zp=Symbol("nomatch"),W1=7,zg=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:r1};function c(S){return l.noHighlightRe.test(S)}function u(S){let O=S.className+" ";O+=S.parentNode?S.parentNode.className:"";const F=l.languageDetectRe.exec(O);if(F){const J=N(F[1]);return J||(Fp(i.replace("{}",F[1])),Fp("Falling back to no-highlight mode for this block.",S)),J?F[1]:"no-highlight"}return O.split(/\s+/).find(J=>c(J)||N(J))}function d(S,O,F){let J="",Q="";typeof O=="object"?(J=S,F=O.ignoreIllegals,Q=O.language):(er("10.7.0","highlight(lang, code, ...args) has been deprecated."),er("10.7.0",`Please use highlight(code, options) instead.
|
|
182
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),Q=S,J=O),F===void 0&&(F=!0);const ce={code:J,language:Q};q("before:highlight",ce);const Ce=ce.result?ce.result:p(ce.language,ce.code,F);return Ce.code=ce.code,q("after:highlight",Ce),Ce}function p(S,O,F,J){const Q=Object.create(null);function ce(L,K){return L.keywords[K]}function Ce(){if(!se.keywords){$e.addText(Oe);return}let L=0;se.keywordPatternRe.lastIndex=0;let K=se.keywordPatternRe.exec(Oe),fe="";for(;K;){fe+=Oe.substring(L,K.index);const Me=pe.case_insensitive?K[0].toLowerCase():K[0],rt=ce(se,Me);if(rt){const[Kt,Tr]=rt;if($e.addText(fe),fe="",Q[Me]=(Q[Me]||0)+1,Q[Me]<=W1&&(Ot+=Tr),Kt.startsWith("_"))fe+=K[0];else{const x=pe.classNameAliases[Kt]||Kt;X(K[0],x)}}else fe+=K[0];L=se.keywordPatternRe.lastIndex,K=se.keywordPatternRe.exec(Oe)}fe+=Oe.substring(L),$e.addText(fe)}function ot(){if(Oe==="")return;let L=null;if(typeof se.subLanguage=="string"){if(!e[se.subLanguage]){$e.addText(Oe);return}L=p(se.subLanguage,Oe,!0,Tt[se.subLanguage]),Tt[se.subLanguage]=L._top}else L=h(Oe,se.subLanguage.length?se.subLanguage:null);se.relevance>0&&(Ot+=L.relevance),$e.__addSublanguage(L._emitter,L.language)}function Re(){se.subLanguage!=null?ot():Ce(),Oe=""}function X(L,K){L!==""&&($e.startScope(K),$e.addText(L),$e.endScope())}function be(L,K){let fe=1;const Me=K.length-1;for(;fe<=Me;){if(!L._emit[fe]){fe++;continue}const rt=pe.classNameAliases[L[fe]]||L[fe],Kt=K[fe];rt?X(Kt,rt):(Oe=Kt,Ce(),Oe=""),fe++}}function ke(L,K){return L.scope&&typeof L.scope=="string"&&$e.openNode(pe.classNameAliases[L.scope]||L.scope),L.beginScope&&(L.beginScope._wrap?(X(Oe,pe.classNameAliases[L.beginScope._wrap]||L.beginScope._wrap),Oe=""):L.beginScope._multi&&(be(L.beginScope,K),Oe="")),se=Object.create(L,{parent:{value:se}}),se}function Ye(L,K,fe){let Me=l1(L.endRe,fe);if(Me){if(L["on:end"]){const rt=new Ip(L);L["on:end"](K,rt),rt.isMatchIgnored&&(Me=!1)}if(Me){for(;L.endsParent&&L.parent;)L=L.parent;return L}}if(L.endsWithParent)return Ye(L.parent,K,fe)}function tt(L){return se.matcher.regexIndex===0?(Oe+=L[0],1):(Mt=!0,0)}function en(L){const K=L[0],fe=L.rule,Me=new Ip(fe),rt=[fe.__beforeBegin,fe["on:begin"]];for(const Kt of rt)if(Kt&&(Kt(L,Me),Me.isMatchIgnored))return tt(K);return fe.skip?Oe+=K:(fe.excludeBegin&&(Oe+=K),Re(),!fe.returnBegin&&!fe.excludeBegin&&(Oe=K)),ke(fe,L),fe.returnBegin?0:K.length}function En(L){const K=L[0],fe=O.substring(L.index),Me=Ye(se,L,fe);if(!Me)return zp;const rt=se;se.endScope&&se.endScope._wrap?(Re(),X(K,se.endScope._wrap)):se.endScope&&se.endScope._multi?(Re(),be(se.endScope,L)):rt.skip?Oe+=K:(rt.returnEnd||rt.excludeEnd||(Oe+=K),Re(),rt.excludeEnd&&(Oe=K));do se.scope&&$e.closeNode(),!se.skip&&!se.subLanguage&&(Ot+=se.relevance),se=se.parent;while(se!==Me.parent);return Me.starts&&ke(Me.starts,L),rt.returnEnd?0:K.length}function fn(){const L=[];for(let K=se;K!==pe;K=K.parent)K.scope&&L.unshift(K.scope);L.forEach(K=>$e.openNode(K))}let qt={};function hn(L,K){const fe=K&&K[0];if(Oe+=L,fe==null)return Re(),0;if(qt.type==="begin"&&K.type==="end"&&qt.index===K.index&&fe===""){if(Oe+=O.slice(K.index,K.index+1),!r){const Me=new Error(`0 width match regex (${S})`);throw Me.languageName=S,Me.badRule=qt.rule,Me}return 1}if(qt=K,K.type==="begin")return en(K);if(K.type==="illegal"&&!F){const Me=new Error('Illegal lexeme "'+fe+'" for mode "'+(se.scope||"<unnamed>")+'"');throw Me.mode=se,Me}else if(K.type==="end"){const Me=En(K);if(Me!==zp)return Me}if(K.type==="illegal"&&fe==="")return 1;if(mn>1e5&&mn>K.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Oe+=fe,fe.length}const pe=N(S);if(!pe)throw zo(i.replace("{}",S)),new Error('Unknown language: "'+S+'"');const Pt=H1(pe);let wt="",se=J||Pt;const Tt={},$e=new l.__emitter(l);fn();let Oe="",Ot=0,nt=0,mn=0,Mt=!1;try{if(pe.__emitTokens)pe.__emitTokens(O,$e);else{for(se.matcher.considerAll();;){mn++,Mt?Mt=!1:se.matcher.considerAll(),se.matcher.lastIndex=nt;const L=se.matcher.exec(O);if(!L)break;const K=O.substring(nt,L.index),fe=hn(K,L);nt=L.index+fe}hn(O.substring(nt))}return $e.finalize(),wt=$e.toHTML(),{language:S,value:wt,relevance:Ot,illegal:!1,_emitter:$e,_top:se}}catch(L){if(L.message&&L.message.includes("Illegal"))return{language:S,value:gl(O),illegal:!0,relevance:0,_illegalBy:{message:L.message,index:nt,context:O.slice(nt-100,nt+100),mode:L.mode,resultSoFar:wt},_emitter:$e};if(r)return{language:S,value:gl(O),illegal:!1,relevance:0,errorRaised:L,_emitter:$e,_top:se};throw L}}function f(S){const O={value:gl(S),illegal:!1,relevance:0,_top:s,_emitter:new l.__emitter(l)};return O._emitter.addText(S),O}function h(S,O){O=O||l.languages||Object.keys(e);const F=f(S),J=O.filter(N).filter(z).map(Re=>p(Re,S,!1));J.unshift(F);const Q=J.sort((Re,X)=>{if(Re.relevance!==X.relevance)return X.relevance-Re.relevance;if(Re.language&&X.language){if(N(Re.language).supersetOf===X.language)return 1;if(N(X.language).supersetOf===Re.language)return-1}return 0}),[ce,Ce]=Q,ot=ce;return ot.secondBest=Ce,ot}function m(S,O,F){const J=O&&n[O]||F;S.classList.add("hljs"),S.classList.add(`language-${J}`)}function g(S){let O=null;const F=u(S);if(c(F))return;if(q("before:highlightElement",{el:S,language:F}),S.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",S);return}if(S.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(S)),l.throwUnescapedHTML))throw new K1("One of your code blocks includes unescaped HTML.",S.innerHTML);O=S;const J=O.textContent,Q=F?d(J,{language:F,ignoreIllegals:!0}):h(J);S.innerHTML=Q.value,S.dataset.highlighted="yes",m(S,F,Q.language),S.result={language:Q.language,re:Q.relevance,relevance:Q.relevance},Q.secondBest&&(S.secondBest={language:Q.secondBest.language,relevance:Q.secondBest.relevance}),q("after:highlightElement",{el:S,result:Q,text:J})}function b(S){l=Vp(l,S)}const y=()=>{v(),er("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function k(){v(),er("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let E=!1;function v(){if(document.readyState==="loading"){E=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function C(){E&&v()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",C,!1);function _(S,O){let F=null;try{F=O(t)}catch(J){if(zo("Language definition for '{}' could not be registered.".replace("{}",S)),r)zo(J);else throw J;F=s}F.name||(F.name=S),e[S]=F,F.rawDefinition=O.bind(null,t),F.aliases&&M(F.aliases,{languageName:S})}function R(S){delete e[S];for(const O of Object.keys(n))n[O]===S&&delete n[O]}function B(){return Object.keys(e)}function N(S){return S=(S||"").toLowerCase(),e[S]||e[n[S]]}function M(S,{languageName:O}){typeof S=="string"&&(S=[S]),S.forEach(F=>{n[F.toLowerCase()]=O})}function z(S){const O=N(S);return O&&!O.disableAutodetect}function G(S){S["before:highlightBlock"]&&!S["before:highlightElement"]&&(S["before:highlightElement"]=O=>{S["before:highlightBlock"](Object.assign({block:O.el},O))}),S["after:highlightBlock"]&&!S["after:highlightElement"]&&(S["after:highlightElement"]=O=>{S["after:highlightBlock"](Object.assign({block:O.el},O))})}function $(S){G(S),o.push(S)}function U(S){const O=o.indexOf(S);O!==-1&&o.splice(O,1)}function q(S,O){const F=S;o.forEach(function(J){J[F]&&J[F](O)})}function ee(S){return er("10.7.0","highlightBlock will be removed entirely in v12.0"),er("10.7.0","Please use highlightElement now."),g(S)}Object.assign(t,{highlight:d,highlightAuto:h,highlightAll:v,highlightElement:g,highlightBlock:ee,configure:b,initHighlighting:y,initHighlightingOnLoad:k,registerLanguage:_,unregisterLanguage:R,listLanguages:B,getLanguage:N,registerAliases:M,autoDetection:z,inherit:Vp,addPlugin:$,removePlugin:U}),t.debugMode=function(){r=!1},t.safeMode=function(){r=!0},t.versionString=q1,t.regex={concat:Jo,lookahead:Rg,either:gu,optional:s1,anyNumberOfTimes:i1};for(const S in Ji)typeof Ji[S]=="object"&&Mg(Ji[S]);return Object.assign(t,Ji),t},Er=zg({});Er.newInstance=()=>zg({});var j1=Er;Er.HighlightJS=Er;Er.default=Er;var G1=e1(j1);function Hg(t,e=[]){return t.map(n=>{const o=[...e,...n.properties?n.properties.className:[]];return n.children?Hg(n.children,o):{text:n.value,classes:o}}).flat()}function Hp(t){return t.value||t.children||[]}function Y1(t){return!!G1.getLanguage(t)}function Up({doc:t,name:e,lowlight:n,defaultLanguage:o}){const r=[];return Fl(t,i=>i.type.name===e).forEach(i=>{var s;let l=i.pos+1;const c=i.node.attrs.language||o,u=n.listLanguages(),d=c&&(u.includes(c)||Y1(c)||!((s=n.registered)===null||s===void 0)&&s.call(n,c))?Hp(n.highlight(c,i.node.textContent)):Hp(n.highlightAuto(i.node.textContent));Hg(d).forEach(p=>{const f=l+p.text.length;if(p.classes.length){const h=Ge.inline(l,f,{class:p.classes.join(" ")});r.push(h)}l=f})}),Ne.create(t,r)}function J1(t){return typeof t=="function"}function X1({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(r=>J1(e[r])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const o=new Ae({key:new xe("lowlight"),state:{init:(r,{doc:i})=>Up({doc:i,name:t,lowlight:e,defaultLanguage:n}),apply:(r,i,s,l)=>{const c=s.selection.$head.parent.type.name,u=l.selection.$head.parent.type.name,d=Fl(s.doc,f=>f.type.name===t),p=Fl(l.doc,f=>f.type.name===t);return r.docChanged&&([c,u].includes(t)||p.length!==d.length||r.steps.some(f=>f.from!==void 0&&f.to!==void 0&&d.some(h=>h.pos>=f.from&&h.pos+h.node.nodeSize<=f.to)))?Up({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 Z1=dm.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))||[],X1({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});function Q1(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"},u={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})"/})]},d={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(u,{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"],v={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},C={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},_=[C,p,l,n,t.C_BLOCK_COMMENT_MODE,d,u],R={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:_.concat([{begin:/\(/,end:/\)/,keywords:v,contains:_.concat(["self"]),relevance:0}]),relevance:0},B={className:"function",begin:"("+s+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:v,relevance:0},{begin:h,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:v,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(R,B,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:v,contains:["self",l]},{begin:t.IDENT_RE+"::",keywords:v},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function eO(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=Q1(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 tO(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:/\\"/},u={className:"string",begin:/'/,end:/'/},d={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._-]+)+/},k=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],E=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],v=["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"],C=["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:[...k,...E,"set","shopt",...v,...C]},contains:[h,t.SHEBANG(),m,p,i,s,y,l,c,u,d,n]}}function nO(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/}]},u={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})"/})]},d={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(u,{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,d,u],k={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},E={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,u,d,l,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C",aliases:["h"],keywords:b,disableAutodetect:!0,illegal:"</",contains:[].concat(k,E,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:u,keywords:b}}}function oO(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"},u={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})"/})]},d={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(u,{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"],v={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},C={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},_=[C,p,l,n,t.C_BLOCK_COMMENT_MODE,d,u],R={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:_.concat([{begin:/\(/,end:/\)/,keywords:v,contains:_.concat(["self"]),relevance:0}]),relevance:0},B={className:"function",begin:"("+s+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:v,relevance:0},{begin:h,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:v,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(R,B,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:v,contains:["self",l]},{begin:t.IDENT_RE+"::",keywords:v},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function rO(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},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},p=t.inherit(d,{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,d,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:[u,g,m,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},k={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},E=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",v={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,k,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,k,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:"("+E+"\\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,k],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]},v]}}const iO=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_-]*/}}),sO=["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"],aO=["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"],lO=[...sO,...aO],cO=["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(),uO=["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(),dO=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),pO=["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 fO(t){const e=t.regex,n=iO(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:":("+uO.join("|")+")"},{begin:":(:)?("+dO.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+pO.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:cO.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+lO.join("|")+")\\b"}]}}function hO(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 mO(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 gO(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 bO(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_-]+/,u=/"(\\"|[^"])*"/,d=/'[^']*'/,p=e.either(c,u,d),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 ir="[0-9](_*[0-9])*",Xi=`\\.(${ir})`,Zi="[0-9a-fA-F](_*[0-9a-fA-F])*",qp={className:"number",variants:[{begin:`(\\b(${ir})((${Xi})|\\.)?|(${Xi}))[eE][+-]?(${ir})[fFdD]?\\b`},{begin:`\\b(${ir})((${Xi})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Xi})[fFdD]?\\b`},{begin:`\\b(${ir})[fFdD]\\b`},{begin:`\\b0[xX]((${Zi})\\.?|(${Zi})?\\.(${Zi}))[pP][+-]?(${ir})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Zi})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Ug(t,e,n){return n===-1?"":t.replace(e,o=>Ug(t,e,n-1))}function yO(t){const e=t.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",o=n+Ug("(?:<"+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"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={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:[d,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:[u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,qp,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},qp,u]}}const Kp="[A-Za-z$_][0-9A-Za-z$_]*",vO=["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"],kO=["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"],wO=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],EO=[].concat(Wg,qg,Kg);function _O(t){const e=t.regex,n=(O,{after:F})=>{const J="</"+O[0].slice(1);return O.input.indexOf(J,F)!==-1},o=Kp,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(O,F)=>{const J=O[0].length+O.index,Q=O.input[J];if(Q==="<"||Q===","){F.ignoreMatch();return}Q===">"&&(n(O,{after:J})||F.ignoreMatch());let ce;const Ce=O.input.substring(J);if(ce=Ce.match(/^\s*=/)){F.ignoreMatch();return}if((ce=Ce.match(/^\s+extends\s+/))&&ce.index===0){F.ignoreMatch();return}}},l={$pattern:Kp,keyword:vO,literal:kO,built_in:EO,"variable.language":wO},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\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]},k={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]},E=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,b,{match:/\$\d+/},p];f.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const v=[].concat(k,f.contains),C=v.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(v)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:C},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]}},N={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},M={variants:[{match:[/function/,/\s+/,o,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function G(O){return e.concat("(?!",O.join("|"),")")}const $={match:e.concat(/\b/,G([...Wg,"super","import"].map(O=>`${O}\\s*\\(`)),o,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},U={begin:e.concat(/\./,e.lookahead(e.concat(o,/(?![0-9A-Za-z$_(])/))),end:o,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},q={match:[/get|set/,/\s+/,o,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},ee="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",S={match:[/const|var|let/,/\s+/,o,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(ee)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:C,CLASS_REFERENCE:B},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),N,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,b,k,{match:/\$\d+/},p,B,{scope:"attr",match:o+e.lookahead(":"),relevance:0},S,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,t.REGEXP_MODE,{className:"function",begin:ee,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:C}]}]},{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"]}]}]},M,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[_,t.inherit(t.TITLE_MODE,{begin:o,className:"title.function"})]},{match:/\.\.\./,relevance:0},U,{match:"\\$"+o,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},$,z,R,q,{match:/\$[(.]/}]}}function CO(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 sr="[0-9](_*[0-9])*",Qi=`\\.(${sr})`,es="[0-9a-fA-F](_*[0-9a-fA-F])*",SO={className:"number",variants:[{begin:`(\\b(${sr})((${Qi})|\\.)?|(${Qi}))[eE][+-]?(${sr})[fFdD]?\\b`},{begin:`\\b(${sr})((${Qi})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Qi})[fFdD]?\\b`},{begin:`\\b(${sr})[fFdD]\\b`},{begin:`\\b0[xX]((${es})\\.?|(${es})?\\.(${es}))[pP][+-]?(${sr})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${es})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function xO(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"]}]},u=SO,d=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,d,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,d],relevance:0},t.C_LINE_COMMENT_MODE,d,l,c,s,t.C_NUMBER_MODE]},d]},{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
|
+
`},u]}}const NO=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_-]*/}}),TO=["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"],OO=["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"],MO=[...TO,...OO],AO=["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(),jg=["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(),Gg=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),RO=["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(),BO=jg.concat(Gg).sort().reverse();function DO(t){const e=NO(t),n=BO,o="and or not only",r="[\\w-]+",i="("+r+"|@\\{"+r+"\\})",s=[],l=[],c=function(E){return{className:"string",begin:"~?"+E+".*?"+E}},u=function(E,v,C){return{className:E,begin:v,relevance:C}},d={$pattern:/[a-z-]+/,keyword:o,attribute:AO.join(" ")},p={begin:"\\(",end:"\\)",contains:l,keywords:d,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,u("variable","@@?"+r,10),u("variable","@\\{"+r+"\\}"),u("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("+RO.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:d,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,u("keyword","all\\b"),u("variable","@\\{"+r+"\\}"),{begin:"\\b("+MO.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,u("selector-tag",i,0),u("selector-id","#"+i),u("selector-class","\\."+i,0),u("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+jg.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Gg.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},k={begin:r+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return s.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,g,b,k,m,y,h,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function IO(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 LO(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 PO(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}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},p=t.inherit(u,{contains:[]}),f=t.inherit(d,{contains:[]});u.contains.push(f),d.contains.push(p);let h=[n,c];return[u,d,p,f].forEach(y=>{y.contains=y.contains.concat(h)}),h=h.concat(u,d),{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,u,d,{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 $O(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 FO(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]},u={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},d=[t.BACKSLASH_ESCAPE,i,c],p=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(g,b,y="\\1")=>{const k=y==="\\1"?y:e.concat(y,b);return e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,k,/(?:\\.|[^\\\/])*?/,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:d,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}]},u,{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,u]},{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 VO(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:/\}/}]},u=t.inherit(t.APOS_STRING_MODE,{illegal:null}),d=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":(U,q)=>{q.data._beginMatch=U[1]||U[2]},"on:end":(U,q)=>{q.data._beginMatch!==U[1]&&q.ignoreMatch()}},f=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),h=`[
|
|
184
|
+
]`,m={scope:"string",variants:[d,u,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"],k=["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"],v={keyword:y,literal:(U=>{const q=[];return U.forEach(ee=>{q.push(ee),ee.toLowerCase()===ee?q.push(ee.toUpperCase()):q.push(ee.toLowerCase())}),q})(b),built_in:k},C=U=>U.map(q=>q.replace(/\|\d+$/,"")),_={variants:[{match:[/new/,e.concat(h,"+"),e.concat("(?!",C(k).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"}}]},N={scope:"attr",match:e.concat(o,e.lookahead(":"),e.lookahead(/(?!::)/))},M={relevance:0,begin:/\(/,end:/\)/,keywords:v,contains:[N,s,B,t.C_BLOCK_COMMENT_MODE,m,g,_]},z={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",C(y).join("\\b|"),"|",C(k).join("\\b|"),"\\b)"),o,e.concat(h,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[M]};M.contains.push(z);const G=[N,B,t.C_BLOCK_COMMENT_MODE,m,g,_],$={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",...G]},...G,{scope:"meta",variants:[{match:r},{match:i}]}]};return{case_insensitive:!1,keywords:v,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,z,B,{match:[/const/,/\s/,o],scope:{1:"keyword",3:"variable.constant"}},_,{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:v,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 zO(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 HO(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function UO(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:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},d={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,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,c,d,u]},{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,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,d,u]},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 u.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 qO(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function KO(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 WO(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:">"},u=[t.COMMENT("#","$",{contains:[l]}),t.COMMENT("^=begin","^=end",{contains:[l],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:s},p={className:"string",contains:[t.BACKSLASH_ESCAPE,d],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,d]})]}]},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}]},_=[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,d],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,u),relevance:0}].concat(c,u);d.contains=_,g.contains=_;const M=[{begin:/^\s*=>/,starts:{end:"$",contains:_}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:s,contains:_}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(M).concat(u).concat(_)}}function jO(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"],u=["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!"],d=["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:d,keyword:l,literal:c,built_in:u},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:u,type:d}},{className:"punctuation",begin:"->"},i]}}const GO=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_-]*/}}),YO=["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"],JO=["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"],XO=[...YO,...JO],ZO=["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(),QO=["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(),eM=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),tM=["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 nM(t){const e=GO(t),n=eM,o=QO,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("+XO.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("+tM.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:ZO.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 oM(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function rM(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"],u=["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"],d=["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=d,m=[...u,...c].filter(C=>!d.includes(C)),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 k(C){return e.concat(/\b/,e.either(...C.map(_=>_.replace(/\s+/,"\\s+"))),/\b/)}const E={scope:"keyword",match:k(f),relevance:0};function v(C,{exceptions:_,when:R}={}){const B=R;return _=_||[],C.map(N=>N.match(/\|\d+$/)||_.includes(N)?N:B(N)?`${N}|0`:N)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:v(m,{when:C=>C.length<3}),literal:i,type:l,built_in:p},contains:[{scope:"type",match:k(s)},E,y,g,o,r,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,b]}}function Yg(t){return t?typeof t=="string"?t:t.source:null}function Ir(t){return Fe("(?=",t,")")}function Fe(...t){return t.map(n=>Yg(n)).join("")}function iM(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Rt(...t){return"("+(iM(t).capture?"":"?:")+t.map(o=>Yg(o)).join("|")+")"}const vu=t=>Fe(/\b/,t,/\w$/.test(t)?/\b/:/\B/),sM=["Protocol","Type"].map(vu),Wp=["init","self"].map(vu),aM=["Any","Self"],bl=["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"],jp=["false","nil","true"],lM=["assignment","associativity","higherThan","left","lowerThan","none","right"],cM=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Gp=["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"],Jg=Rt(/[/=\-+!*%<>&|^~?]/,/[\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]/),Xg=Rt(Jg,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),yl=Fe(Jg,Xg,"*"),Zg=Rt(/[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]/),oa=Rt(Zg,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Sn=Fe(Zg,oa,"*"),ts=Fe(/[A-Z]/,oa,"*"),uM=["attached","autoclosure",Fe(/convention\(/,Rt("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Fe(/objc\(/,Sn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],dM=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function pM(t){const e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),o=[t.C_LINE_COMMENT_MODE,n],r={match:[/\./,Rt(...sM,...Wp)],className:{2:"keyword"}},i={match:Fe(/\./,Rt(...bl)),relevance:0},s=bl.filter(pe=>typeof pe=="string").concat(["_|0"]),l=bl.filter(pe=>typeof pe!="string").concat(aM).map(vu),c={variants:[{className:"keyword",match:Rt(...l,...Wp)}]},u={$pattern:Rt(/\b\w+/,/#\w+/),keyword:s.concat(cM),literal:jp},d=[r,i,c],p={match:Fe(/\./,Rt(...Gp)),relevance:0},f={className:"built_in",match:Fe(/\b/,Rt(...Gp),/(?=\()/)},h=[p,f],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:yl},{match:`\\.(\\.|${Xg})+`}]},b=[m,g],y="([0-9]_*)+",k="([0-9a-fA-F]_*)+",E={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${k})(\\.(${k}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},v=(pe="")=>({className:"subst",variants:[{match:Fe(/\\/,pe,/[0\\tnr"']/)},{match:Fe(/\\/,pe,/u\{[0-9a-fA-F]{1,8}\}/)}]}),C=(pe="")=>({className:"subst",match:Fe(/\\/,pe,/[\t ]*(?:[\r\n]|\r\n)/)}),_=(pe="")=>({className:"subst",label:"interpol",begin:Fe(/\\/,pe,/\(/),end:/\)/}),R=(pe="")=>({begin:Fe(pe,/"""/),end:Fe(/"""/,pe),contains:[v(pe),C(pe),_(pe)]}),B=(pe="")=>({begin:Fe(pe,/"/),end:Fe(/"/,pe),contains:[v(pe),_(pe)]}),N={className:"string",variants:[R(),R("#"),R("##"),R("###"),B(),B("#"),B("##"),B("###")]},M=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],z={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:M},G=pe=>{const Pt=Fe(pe,/\//),wt=Fe(/\//,pe);return{begin:Pt,end:wt,contains:[...M,{scope:"comment",begin:`#(?!.*${wt})`,end:/$/}]}},$={scope:"regexp",variants:[G("###"),G("##"),G("#"),z]},U={match:Fe(/`/,Sn,/`/)},q={className:"variable",match:/\$\d+/},ee={className:"variable",match:`\\$${oa}+`},S=[U,q,ee],O={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:dM,contains:[...b,E,N]}]}},F={scope:"keyword",match:Fe(/@/,Rt(...uM),Ir(Rt(/\(/,/\s+/)))},J={scope:"meta",match:Fe(/@/,Sn)},Q=[O,F,J],ce={match:Ir(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Fe(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,oa,"+")},{className:"type",match:ts,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Fe(/\s+&\s+/,Ir(ts)),relevance:0}]},Ce={begin:/</,end:/>/,keywords:u,contains:[...o,...d,...Q,m,ce]};ce.contains.push(Ce);const ot={match:Fe(Sn,/\s*:/),keywords:"_|0",relevance:0},Re={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",ot,...o,$,...d,...h,...b,E,N,...S,...Q,ce]},X={begin:/</,end:/>/,keywords:"repeat each",contains:[...o,ce]},be={begin:Rt(Ir(Fe(Sn,/\s*:/)),Ir(Fe(Sn,/\s+/,Sn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Sn}]},ke={begin:/\(/,end:/\)/,keywords:u,contains:[be,...o,...d,...b,E,N,...Q,ce,Re],endsParent:!0,illegal:/["']/},Ye={match:[/(func|macro)/,/\s+/,Rt(U.match,Sn,yl)],className:{1:"keyword",3:"title.function"},contains:[X,ke,e],illegal:[/\[/,/%/]},tt={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[X,ke,e],illegal:/\[|%/},en={match:[/operator/,/\s+/,yl],className:{1:"keyword",3:"title"}},En={begin:[/precedencegroup/,/\s+/,ts],className:{1:"keyword",3:"title"},contains:[ce],keywords:[...lM,...jp],end:/}/},fn={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},qt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},hn={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Sn,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[X,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:ts},...d],relevance:0}]};for(const pe of N.variants){const Pt=pe.contains.find(se=>se.label==="interpol");Pt.keywords=u;const wt=[...d,...h,...b,E,N,...S];Pt.contains=[...wt,{begin:/\(/,end:/\)/,contains:["self",...wt]}]}return{name:"Swift",keywords:u,contains:[...o,Ye,tt,fn,qt,hn,en,En,{beginKeywords:"import",end:/$/,contains:[...o],relevance:0},$,...d,...h,...b,E,N,...S,...Q,ce,Re]}}const ra="[A-Za-z$_][0-9A-Za-z$_]*",Qg=["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"],eb=["true","false","null","undefined","NaN","Infinity"],tb=["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"],nb=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],ob=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],rb=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ib=[].concat(ob,tb,nb);function fM(t){const e=t.regex,n=(O,{after:F})=>{const J="</"+O[0].slice(1);return O.input.indexOf(J,F)!==-1},o=ra,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(O,F)=>{const J=O[0].length+O.index,Q=O.input[J];if(Q==="<"||Q===","){F.ignoreMatch();return}Q===">"&&(n(O,{after:J})||F.ignoreMatch());let ce;const Ce=O.input.substring(J);if(ce=Ce.match(/^\s*=/)){F.ignoreMatch();return}if((ce=Ce.match(/^\s+extends\s+/))&&ce.index===0){F.ignoreMatch();return}}},l={$pattern:ra,keyword:Qg,literal:eb,built_in:ib,"variable.language":rb},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\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]},k={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]},E=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,b,{match:/\$\d+/},p];f.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const v=[].concat(k,f.contains),C=v.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(v)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:C},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:{_:[...tb,...nb]}},N={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},M={variants:[{match:[/function/,/\s+/,o,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function G(O){return e.concat("(?!",O.join("|"),")")}const $={match:e.concat(/\b/,G([...ob,"super","import"].map(O=>`${O}\\s*\\(`)),o,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},U={begin:e.concat(/\./,e.lookahead(e.concat(o,/(?![0-9A-Za-z$_(])/))),end:o,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},q={match:[/get|set/,/\s+/,o,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},ee="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",S={match:[/const|var|let/,/\s+/,o,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(ee)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:C,CLASS_REFERENCE:B},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),N,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,b,k,{match:/\$\d+/},p,B,{scope:"attr",match:o+e.lookahead(":"),relevance:0},S,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,t.REGEXP_MODE,{className:"function",begin:ee,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:C}]}]},{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"]}]}]},M,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[_,t.inherit(t.TITLE_MODE,{begin:o,className:"title.function"})]},{match:/\.\.\./,relevance:0},U,{match:"\\$"+o,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},$,z,R,q,{match:/\$[(.]/}]}}function hM(t){const e=t.regex,n=fM(t),o=ra,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"],u={$pattern:ra,keyword:Qg.concat(c),literal:eb,built_in:ib.concat(r),"variable.language":rb},d={className:"meta",begin:"@"+o},p=(g,b,y)=>{const k=g.contains.findIndex(E=>E.label===b);if(k===-1)throw new Error("can not find mode to replace");g.contains.splice(k,1,y)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);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([d,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 mM(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),/ *#/)}]},u={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])|[%&])?/}]},d={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,u,d,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 gM(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"},u={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,u,l]}}function bM(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"}),u={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:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[u],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:u}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function yM(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 vM={arduino:eO,bash:tO,c:nO,cpp:oO,csharp:rO,css:fO,diff:hO,go:mO,graphql:gO,ini:bO,java:yO,javascript:_O,json:CO,kotlin:xO,less:DO,lua:IO,makefile:LO,markdown:PO,objectivec:$O,perl:FO,php:VO,"php-template":zO,plaintext:HO,python:UO,"python-repl":qO,r:KO,ruby:WO,rust:jO,scss:nM,shell:oM,sql:rM,swift:pM,typescript:hM,vbnet:mM,wasm:gM,xml:bM,yaml:yM};function kM(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var vl,Yp;function wM(){if(Yp)return vl;Yp=1;function t(w){return w instanceof Map?w.clear=w.delete=w.set=function(){throw new Error("map is read-only")}:w instanceof Set&&(w.add=w.clear=w.delete=function(){throw new Error("set is read-only")}),Object.freeze(w),Object.getOwnPropertyNames(w).forEach(T=>{const P=w[T],ue=typeof P;(ue==="object"||ue==="function")&&!Object.isFrozen(P)&&t(P)}),w}class e{constructor(T){T.data===void 0&&(T.data={}),this.data=T.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(w){return w.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function o(w,...T){const P=Object.create(null);for(const ue in w)P[ue]=w[ue];return T.forEach(function(ue){for(const We in ue)P[We]=ue[We]}),P}const r="</span>",i=w=>!!w.scope,s=(w,{prefix:T})=>{if(w.startsWith("language:"))return w.replace("language:","language-");if(w.includes(".")){const P=w.split(".");return[`${T}${P.shift()}`,...P.map((ue,We)=>`${ue}${"_".repeat(We+1)}`)].join(" ")}return`${T}${w}`};class l{constructor(T,P){this.buffer="",this.classPrefix=P.classPrefix,T.walk(this)}addText(T){this.buffer+=n(T)}openNode(T){if(!i(T))return;const P=s(T.scope,{prefix:this.classPrefix});this.span(P)}closeNode(T){i(T)&&(this.buffer+=r)}value(){return this.buffer}span(T){this.buffer+=`<span class="${T}">`}}const c=(w={})=>{const T={children:[]};return Object.assign(T,w),T};class u{constructor(){this.rootNode=c(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(T){this.top.children.push(T)}openNode(T){const P=c({scope:T});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(T){return this.constructor._walk(T,this.rootNode)}static _walk(T,P){return typeof P=="string"?T.addText(P):P.children&&(T.openNode(P),P.children.forEach(ue=>this._walk(T,ue)),T.closeNode(P)),T}static _collapse(T){typeof T!="string"&&T.children&&(T.children.every(P=>typeof P=="string")?T.children=[T.children.join("")]:T.children.forEach(P=>{u._collapse(P)}))}}class d extends u{constructor(T){super(),this.options=T}addText(T){T!==""&&this.add(T)}startScope(T){this.openNode(T)}endScope(){this.closeNode()}__addSublanguage(T,P){const ue=T.root;P&&(ue.scope=`language:${P}`),this.add(ue)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function p(w){return w?typeof w=="string"?w:w.source:null}function f(w){return g("(?=",w,")")}function h(w){return g("(?:",w,")*")}function m(w){return g("(?:",w,")?")}function g(...w){return w.map(P=>p(P)).join("")}function b(w){const T=w[w.length-1];return typeof T=="object"&&T.constructor===Object?(w.splice(w.length-1,1),T):{}}function y(...w){return"("+(b(w).capture?"":"?:")+w.map(ue=>p(ue)).join("|")+")"}function k(w){return new RegExp(w.toString()+"|").exec("").length-1}function E(w,T){const P=w&&w.exec(T);return P&&P.index===0}const v=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(w,{joinWith:T}){let P=0;return w.map(ue=>{P+=1;const We=P;let Ue=p(ue),Z="";for(;Ue.length>0;){const W=v.exec(Ue);if(!W){Z+=Ue;break}Z+=Ue.substring(0,W.index),Ue=Ue.substring(W.index+W[0].length),W[0][0]==="\\"&&W[1]?Z+="\\"+String(Number(W[1])+We):(Z+=W[0],W[0]==="("&&P++)}return Z}).map(ue=>`(${ue})`).join(T)}const _=/\b\B/,R="[a-zA-Z]\\w*",B="[a-zA-Z_]\\w*",N="\\b\\d+(\\.\\d+)?",M="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",z="\\b(0b[01]+)",G="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",$=(w={})=>{const T=/^#![ ]*\//;return w.binary&&(w.begin=g(T,/.*\b/,w.binary,/\b.*/)),o({scope:"meta",begin:T,end:/$/,relevance:0,"on:begin":(P,ue)=>{P.index!==0&&ue.ignoreMatch()}},w)},U={begin:"\\\\[\\s\\S]",relevance:0},q={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[U]},ee={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[U]},S={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/},O=function(w,T,P={}){const ue=o({scope:"comment",begin:w,end:T,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 We=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(/[ ]+/,"(",We,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ue},F=O("//","$"),J=O("/\\*","\\*/"),Q=O("#","$"),ce={scope:"number",begin:N,relevance:0},Ce={scope:"number",begin:M,relevance:0},ot={scope:"number",begin:z,relevance:0},Re={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[U,{begin:/\[/,end:/\]/,relevance:0,contains:[U]}]},X={scope:"title",begin:R,relevance:0},be={scope:"title",begin:B,relevance:0},ke={begin:"\\.\\s*"+B,relevance:0};var tt=Object.freeze({__proto__:null,APOS_STRING_MODE:q,BACKSLASH_ESCAPE:U,BINARY_NUMBER_MODE:ot,BINARY_NUMBER_RE:z,COMMENT:O,C_BLOCK_COMMENT_MODE:J,C_LINE_COMMENT_MODE:F,C_NUMBER_MODE:Ce,C_NUMBER_RE:M,END_SAME_AS_BEGIN:function(w){return Object.assign(w,{"on:begin":(T,P)=>{P.data._beginMatch=T[1]},"on:end":(T,P)=>{P.data._beginMatch!==T[1]&&P.ignoreMatch()}})},HASH_COMMENT_MODE:Q,IDENT_RE:R,MATCH_NOTHING_RE:_,METHOD_GUARD:ke,NUMBER_MODE:ce,NUMBER_RE:N,PHRASAL_WORDS_MODE:S,QUOTE_STRING_MODE:ee,REGEXP_MODE:Re,RE_STARTERS_RE:G,SHEBANG:$,TITLE_MODE:X,UNDERSCORE_IDENT_RE:B,UNDERSCORE_TITLE_MODE:be});function en(w,T){w.input[w.index-1]==="."&&T.ignoreMatch()}function En(w,T){w.className!==void 0&&(w.scope=w.className,delete w.className)}function fn(w,T){T&&w.beginKeywords&&(w.begin="\\b("+w.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",w.__beforeBegin=en,w.keywords=w.keywords||w.beginKeywords,delete w.beginKeywords,w.relevance===void 0&&(w.relevance=0))}function qt(w,T){Array.isArray(w.illegal)&&(w.illegal=y(...w.illegal))}function hn(w,T){if(w.match){if(w.begin||w.end)throw new Error("begin & end are not supported with match");w.begin=w.match,delete w.match}}function pe(w,T){w.relevance===void 0&&(w.relevance=1)}const Pt=(w,T)=>{if(!w.beforeMatch)return;if(w.starts)throw new Error("beforeMatch cannot be used with starts");const P=Object.assign({},w);Object.keys(w).forEach(ue=>{delete w[ue]}),w.keywords=P.keywords,w.begin=g(P.beforeMatch,f(P.begin)),w.starts={relevance:0,contains:[Object.assign(P,{endsParent:!0})]},w.relevance=0,delete P.beforeMatch},wt=["of","and","for","in","not","or","if","then","parent","list","value"],se="keyword";function Tt(w,T,P=se){const ue=Object.create(null);return typeof w=="string"?We(P,w.split(" ")):Array.isArray(w)?We(P,w):Object.keys(w).forEach(function(Ue){Object.assign(ue,Tt(w[Ue],T,Ue))}),ue;function We(Ue,Z){T&&(Z=Z.map(W=>W.toLowerCase())),Z.forEach(function(W){const de=W.split("|");ue[de[0]]=[Ue,$e(de[0],de[1])]})}}function $e(w,T){return T?Number(T):Oe(w)?0:1}function Oe(w){return wt.includes(w.toLowerCase())}const Ot={},nt=w=>{console.error(w)},mn=(w,...T)=>{console.log(`WARN: ${w}`,...T)},Mt=(w,T)=>{Ot[`${w}/${T}`]||(console.log(`Deprecated as of ${w}. ${T}`),Ot[`${w}/${T}`]=!0)},L=new Error;function K(w,T,{key:P}){let ue=0;const We=w[P],Ue={},Z={};for(let W=1;W<=T.length;W++)Z[W+ue]=We[W],Ue[W+ue]=!0,ue+=k(T[W-1]);w[P]=Z,w[P]._emit=Ue,w[P]._multi=!0}function fe(w){if(Array.isArray(w.begin)){if(w.skip||w.excludeBegin||w.returnBegin)throw nt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),L;if(typeof w.beginScope!="object"||w.beginScope===null)throw nt("beginScope must be object"),L;K(w,w.begin,{key:"beginScope"}),w.begin=C(w.begin,{joinWith:""})}}function Me(w){if(Array.isArray(w.end)){if(w.skip||w.excludeEnd||w.returnEnd)throw nt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),L;if(typeof w.endScope!="object"||w.endScope===null)throw nt("endScope must be object"),L;K(w,w.end,{key:"endScope"}),w.end=C(w.end,{joinWith:""})}}function rt(w){w.scope&&typeof w.scope=="object"&&w.scope!==null&&(w.beginScope=w.scope,delete w.scope)}function Kt(w){rt(w),typeof w.beginScope=="string"&&(w.beginScope={_wrap:w.beginScope}),typeof w.endScope=="string"&&(w.endScope={_wrap:w.endScope}),fe(w),Me(w)}function Tr(w){function T(Z,W){return new RegExp(p(Z),"m"+(w.case_insensitive?"i":"")+(w.unicodeRegex?"u":"")+(W?"g":""))}class P{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(W,de){de.position=this.position++,this.matchIndexes[this.matchAt]=de,this.regexes.push([de,W]),this.matchAt+=k(W)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const W=this.regexes.map(de=>de[1]);this.matcherRe=T(C(W,{joinWith:"|"}),!0),this.lastIndex=0}exec(W){this.matcherRe.lastIndex=this.lastIndex;const de=this.matcherRe.exec(W);if(!de)return null;const dt=de.findIndex((Mr,Aa)=>Aa>0&&Mr!==void 0),it=this.matchIndexes[dt];return de.splice(0,dt),Object.assign(de,it)}}class ue{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(W){if(this.multiRegexes[W])return this.multiRegexes[W];const de=new P;return this.rules.slice(W).forEach(([dt,it])=>de.addRule(dt,it)),de.compile(),this.multiRegexes[W]=de,de}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(W,de){this.rules.push([W,de]),de.type==="begin"&&this.count++}exec(W){const de=this.getMatcher(this.regexIndex);de.lastIndex=this.lastIndex;let dt=de.exec(W);if(this.resumingScanAtSamePosition()&&!(dt&&dt.index===this.lastIndex)){const it=this.getMatcher(0);it.lastIndex=this.lastIndex+1,dt=it.exec(W)}return dt&&(this.regexIndex+=dt.position+1,this.regexIndex===this.count&&this.considerAll()),dt}}function We(Z){const W=new ue;return Z.contains.forEach(de=>W.addRule(de.begin,{rule:de,type:"begin"})),Z.terminatorEnd&&W.addRule(Z.terminatorEnd,{type:"end"}),Z.illegal&&W.addRule(Z.illegal,{type:"illegal"}),W}function Ue(Z,W){const de=Z;if(Z.isCompiled)return de;[En,hn,Kt,Pt].forEach(it=>it(Z,W)),w.compilerExtensions.forEach(it=>it(Z,W)),Z.__beforeBegin=null,[fn,qt,pe].forEach(it=>it(Z,W)),Z.isCompiled=!0;let dt=null;return typeof Z.keywords=="object"&&Z.keywords.$pattern&&(Z.keywords=Object.assign({},Z.keywords),dt=Z.keywords.$pattern,delete Z.keywords.$pattern),dt=dt||/\w+/,Z.keywords&&(Z.keywords=Tt(Z.keywords,w.case_insensitive)),de.keywordPatternRe=T(dt,!0),W&&(Z.begin||(Z.begin=/\B|\b/),de.beginRe=T(de.begin),!Z.end&&!Z.endsWithParent&&(Z.end=/\B|\b/),Z.end&&(de.endRe=T(de.end)),de.terminatorEnd=p(de.end)||"",Z.endsWithParent&&W.terminatorEnd&&(de.terminatorEnd+=(Z.end?"|":"")+W.terminatorEnd)),Z.illegal&&(de.illegalRe=T(Z.illegal)),Z.contains||(Z.contains=[]),Z.contains=[].concat(...Z.contains.map(function(it){return Y(it==="self"?Z:it)})),Z.contains.forEach(function(it){Ue(it,de)}),Z.starts&&Ue(Z.starts,W),de.matcher=We(de),de}if(w.compilerExtensions||(w.compilerExtensions=[]),w.contains&&w.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return w.classNameAliases=o(w.classNameAliases||{}),Ue(w)}function x(w){return w?w.endsWithParent||x(w.starts):!1}function Y(w){return w.variants&&!w.cachedVariants&&(w.cachedVariants=w.variants.map(function(T){return o(w,{variants:null},T)})),w.cachedVariants?w.cachedVariants:x(w)?o(w,{starts:w.starts?o(w.starts):null}):Object.isFrozen(w)?o(w):w}var le="11.11.1";class Be extends Error{constructor(T,P){super(T),this.name="HTMLInjectionError",this.html=P}}const Ee=n,ut=o,At=Symbol("nomatch"),eo=7,Or=function(w){const T=Object.create(null),P=Object.create(null),ue=[];let We=!0;const Ue="Could not find the language '{}', did you forget to load/include a language module?",Z={disableAutodetect:!0,name:"Plain text",contains:[]};let W={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function de(I){return W.noHighlightRe.test(I)}function dt(I){let ie=I.className+" ";ie+=I.parentNode?I.parentNode.className:"";const Se=W.languageDetectRe.exec(ie);if(Se){const qe=to(Se[1]);return qe||(mn(Ue.replace("{}",Se[1])),mn("Falling back to no-highlight mode for this block.",I)),qe?Se[1]:"no-highlight"}return ie.split(/\s+/).find(qe=>de(qe)||to(qe))}function it(I,ie,Se){let qe="",at="";typeof ie=="object"?(qe=I,Se=ie.ignoreIllegals,at=ie.language):(Mt("10.7.0","highlight(lang, code, ...args) has been deprecated."),Mt("10.7.0",`Please use highlight(code, options) instead.
|
|
185
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),at=I,qe=ie),Se===void 0&&(Se=!0);const gn={code:qe,language:at};Ti("before:highlight",gn);const no=gn.result?gn.result:Mr(gn.language,gn.code,Se);return no.code=gn.code,Ti("after:highlight",no),no}function Mr(I,ie,Se,qe){const at=Object.create(null);function gn(H,te){return H.keywords[te]}function no(){if(!he.keywords){gt.addText(Ke);return}let H=0;he.keywordPatternRe.lastIndex=0;let te=he.keywordPatternRe.exec(Ke),we="";for(;te;){we+=Ke.substring(H,te.index);const Ie=Cn.case_insensitive?te[0].toLowerCase():te[0],Et=gn(he,Ie);if(Et){const[Fn,Lb]=Et;if(gt.addText(we),we="",at[Ie]=(at[Ie]||0)+1,at[Ie]<=eo&&(Ai+=Lb),Fn.startsWith("_"))we+=te[0];else{const Pb=Cn.classNameAliases[Fn]||Fn;_n(te[0],Pb)}}else we+=te[0];H=he.keywordPatternRe.lastIndex,te=he.keywordPatternRe.exec(Ke)}we+=Ke.substring(H),gt.addText(we)}function Oi(){if(Ke==="")return;let H=null;if(typeof he.subLanguage=="string"){if(!T[he.subLanguage]){gt.addText(Ke);return}H=Mr(he.subLanguage,Ke,!0,Ou[he.subLanguage]),Ou[he.subLanguage]=H._top}else H=Ra(Ke,he.subLanguage.length?he.subLanguage:null);he.relevance>0&&(Ai+=H.relevance),gt.__addSublanguage(H._emitter,H.language)}function Wt(){he.subLanguage!=null?Oi():no(),Ke=""}function _n(H,te){H!==""&&(gt.startScope(te),gt.addText(H),gt.endScope())}function Su(H,te){let we=1;const Ie=te.length-1;for(;we<=Ie;){if(!H._emit[we]){we++;continue}const Et=Cn.classNameAliases[H[we]]||H[we],Fn=te[we];Et?_n(Fn,Et):(Ke=Fn,no(),Ke=""),we++}}function xu(H,te){return H.scope&&typeof H.scope=="string"&>.openNode(Cn.classNameAliases[H.scope]||H.scope),H.beginScope&&(H.beginScope._wrap?(_n(Ke,Cn.classNameAliases[H.beginScope._wrap]||H.beginScope._wrap),Ke=""):H.beginScope._multi&&(Su(H.beginScope,te),Ke="")),he=Object.create(H,{parent:{value:he}}),he}function Nu(H,te,we){let Ie=E(H.endRe,we);if(Ie){if(H["on:end"]){const Et=new e(H);H["on:end"](te,Et),Et.isMatchIgnored&&(Ie=!1)}if(Ie){for(;H.endsParent&&H.parent;)H=H.parent;return H}}if(H.endsWithParent)return Nu(H.parent,te,we)}function Ab(H){return he.matcher.regexIndex===0?(Ke+=H[0],1):(La=!0,0)}function Rb(H){const te=H[0],we=H.rule,Ie=new e(we),Et=[we.__beforeBegin,we["on:begin"]];for(const Fn of Et)if(Fn&&(Fn(H,Ie),Ie.isMatchIgnored))return Ab(te);return we.skip?Ke+=te:(we.excludeBegin&&(Ke+=te),Wt(),!we.returnBegin&&!we.excludeBegin&&(Ke=te)),xu(we,H),we.returnBegin?0:te.length}function Bb(H){const te=H[0],we=ie.substring(H.index),Ie=Nu(he,H,we);if(!Ie)return At;const Et=he;he.endScope&&he.endScope._wrap?(Wt(),_n(te,he.endScope._wrap)):he.endScope&&he.endScope._multi?(Wt(),Su(he.endScope,H)):Et.skip?Ke+=te:(Et.returnEnd||Et.excludeEnd||(Ke+=te),Wt(),Et.excludeEnd&&(Ke=te));do he.scope&>.closeNode(),!he.skip&&!he.subLanguage&&(Ai+=he.relevance),he=he.parent;while(he!==Ie.parent);return Ie.starts&&xu(Ie.starts,H),Et.returnEnd?0:te.length}function Db(){const H=[];for(let te=he;te!==Cn;te=te.parent)te.scope&&H.unshift(te.scope);H.forEach(te=>gt.openNode(te))}let Mi={};function Tu(H,te){const we=te&&te[0];if(Ke+=H,we==null)return Wt(),0;if(Mi.type==="begin"&&te.type==="end"&&Mi.index===te.index&&we===""){if(Ke+=ie.slice(te.index,te.index+1),!We){const Ie=new Error(`0 width match regex (${I})`);throw Ie.languageName=I,Ie.badRule=Mi.rule,Ie}return 1}if(Mi=te,te.type==="begin")return Rb(te);if(te.type==="illegal"&&!Se){const Ie=new Error('Illegal lexeme "'+we+'" for mode "'+(he.scope||"<unnamed>")+'"');throw Ie.mode=he,Ie}else if(te.type==="end"){const Ie=Bb(te);if(Ie!==At)return Ie}if(te.type==="illegal"&&we==="")return Ke+=`
|
|
186
|
+
`,1;if(Ia>1e5&&Ia>te.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ke+=we,we.length}const Cn=to(I);if(!Cn)throw nt(Ue.replace("{}",I)),new Error('Unknown language: "'+I+'"');const Ib=Tr(Cn);let Da="",he=qe||Ib;const Ou={},gt=new W.__emitter(W);Db();let Ke="",Ai=0,xo=0,Ia=0,La=!1;try{if(Cn.__emitTokens)Cn.__emitTokens(ie,gt);else{for(he.matcher.considerAll();;){Ia++,La?La=!1:he.matcher.considerAll(),he.matcher.lastIndex=xo;const H=he.matcher.exec(ie);if(!H)break;const te=ie.substring(xo,H.index),we=Tu(te,H);xo=H.index+we}Tu(ie.substring(xo))}return gt.finalize(),Da=gt.toHTML(),{language:I,value:Da,relevance:Ai,illegal:!1,_emitter:gt,_top:he}}catch(H){if(H.message&&H.message.includes("Illegal"))return{language:I,value:Ee(ie),illegal:!0,relevance:0,_illegalBy:{message:H.message,index:xo,context:ie.slice(xo-100,xo+100),mode:H.mode,resultSoFar:Da},_emitter:gt};if(We)return{language:I,value:Ee(ie),illegal:!1,relevance:0,errorRaised:H,_emitter:gt,_top:he};throw H}}function Aa(I){const ie={value:Ee(I),illegal:!1,relevance:0,_top:Z,_emitter:new W.__emitter(W)};return ie._emitter.addText(I),ie}function Ra(I,ie){ie=ie||W.languages||Object.keys(T);const Se=Aa(I),qe=ie.filter(to).filter(Cu).map(Wt=>Mr(Wt,I,!1));qe.unshift(Se);const at=qe.sort((Wt,_n)=>{if(Wt.relevance!==_n.relevance)return _n.relevance-Wt.relevance;if(Wt.language&&_n.language){if(to(Wt.language).supersetOf===_n.language)return 1;if(to(_n.language).supersetOf===Wt.language)return-1}return 0}),[gn,no]=at,Oi=gn;return Oi.secondBest=no,Oi}function kb(I,ie,Se){const qe=ie&&P[ie]||Se;I.classList.add("hljs"),I.classList.add(`language-${qe}`)}function Ba(I){let ie=null;const Se=dt(I);if(de(Se))return;if(Ti("before:highlightElement",{el:I,language:Se}),I.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",I);return}if(I.children.length>0&&(W.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)),W.throwUnescapedHTML))throw new Be("One of your code blocks includes unescaped HTML.",I.innerHTML);ie=I;const qe=ie.textContent,at=Se?it(qe,{language:Se,ignoreIllegals:!0}):Ra(qe);I.innerHTML=at.value,I.dataset.highlighted="yes",kb(I,Se,at.language),I.result={language:at.language,re:at.relevance,relevance:at.relevance},at.secondBest&&(I.secondBest={language:at.secondBest.language,relevance:at.secondBest.relevance}),Ti("after:highlightElement",{el:I,result:at,text:qe})}function wb(I){W=ut(W,I)}const Eb=()=>{Ni(),Mt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function _b(){Ni(),Mt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Eu=!1;function Ni(){function I(){Ni()}if(document.readyState==="loading"){Eu||window.addEventListener("DOMContentLoaded",I,!1),Eu=!0;return}document.querySelectorAll(W.cssSelector).forEach(Ba)}function Cb(I,ie){let Se=null;try{Se=ie(w)}catch(qe){if(nt("Language definition for '{}' could not be registered.".replace("{}",I)),We)nt(qe);else throw qe;Se=Z}Se.name||(Se.name=I),T[I]=Se,Se.rawDefinition=ie.bind(null,w),Se.aliases&&_u(Se.aliases,{languageName:I})}function Sb(I){delete T[I];for(const ie of Object.keys(P))P[ie]===I&&delete P[ie]}function xb(){return Object.keys(T)}function to(I){return I=(I||"").toLowerCase(),T[I]||T[P[I]]}function _u(I,{languageName:ie}){typeof I=="string"&&(I=[I]),I.forEach(Se=>{P[Se.toLowerCase()]=ie})}function Cu(I){const ie=to(I);return ie&&!ie.disableAutodetect}function Nb(I){I["before:highlightBlock"]&&!I["before:highlightElement"]&&(I["before:highlightElement"]=ie=>{I["before:highlightBlock"](Object.assign({block:ie.el},ie))}),I["after:highlightBlock"]&&!I["after:highlightElement"]&&(I["after:highlightElement"]=ie=>{I["after:highlightBlock"](Object.assign({block:ie.el},ie))})}function Tb(I){Nb(I),ue.push(I)}function Ob(I){const ie=ue.indexOf(I);ie!==-1&&ue.splice(ie,1)}function Ti(I,ie){const Se=I;ue.forEach(function(qe){qe[Se]&&qe[Se](ie)})}function Mb(I){return Mt("10.7.0","highlightBlock will be removed entirely in v12.0"),Mt("10.7.0","Please use highlightElement now."),Ba(I)}Object.assign(w,{highlight:it,highlightAuto:Ra,highlightAll:Ni,highlightElement:Ba,highlightBlock:Mb,configure:wb,initHighlighting:Eb,initHighlightingOnLoad:_b,registerLanguage:Cb,unregisterLanguage:Sb,listLanguages:xb,getLanguage:to,registerAliases:_u,autoDetection:Cu,inherit:ut,addPlugin:Tb,removePlugin:Ob}),w.debugMode=function(){We=!1},w.safeMode=function(){We=!0},w.versionString=le,w.regex={concat:g,lookahead:f,either:y,optional:m,anyNumberOfTimes:h};for(const I in tt)typeof tt[I]=="object"&&t(tt[I]);return Object.assign(w,tt),w},$t=Or({});return $t.newInstance=()=>Or({}),vl=$t,$t.HighlightJS=$t,$t.default=$t,vl}var EM=wM();const _M=kM(EM),Jp={},CM="hljs-";function SM(t){const e=_M.newInstance();return t&&i(t),{highlight:n,highlightAuto:o,listLanguages:r,register:i,registerAlias:s,registered:l};function n(c,u,d){const p=d||Jp,f=typeof p.prefix=="string"?p.prefix:CM;if(!e.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");e.configure({__emitter:xM,classPrefix:f});const h=e.highlight(u,{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,u){const p=(u||Jp).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,u);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,u){if(typeof c=="string")e.registerLanguage(c,u);else{let d;for(d in c)Object.hasOwn(c,d)&&e.registerLanguage(d,c[d])}}function s(c,u){if(typeof c=="string")e.registerAliases(typeof u=="string"?u:[...u],{languageName:c});else{let d;for(d in c)if(Object.hasOwn(c,d)){const p=c[d];e.registerAliases(typeof p=="string"?p:[...p],{languageName:d})}}}function l(c){return!!e.getLanguage(c)}}class xM{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 NM(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 TM(t){return navigator.clipboard!==void 0?navigator.clipboard.writeText(t):new Promise((e,n)=>{const o=NM(t);o?e(!0):n(o)})}const OM={class:"code-block-toolbar"},MM={class:"wrap editable"},AM={class:"wrap"},RM={class:"language readonly"},BM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,n=a.ref("content_copy"),o=a.computed({get(){return e.node.attrs.language},set(u){e.updateAttributes({language:u})}}),r=a.computed({get(){return e.node.attrs.wrap},set(u){e.updateAttributes({wrap:u})}}),i=a.computed(()=>r.value?"text_select_move_down":"format_text_wrap");function s(u){o.value=u}function l(){const u=e.node.content.content[0].text;TM(u).then(()=>{n.value="done",setTimeout(()=>{n.value="content_copy"},2e3)})}function c(){r.value=!r.value}return(u,d)=>(a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:"o-code-block-view"}),{default:a.withCtx(()=>[a.createElementVNode("div",OM,[a.createElementVNode("div",MM,[a.createVNode(a.unref(Dm),{language:o.value,onSelect:s},null,8,["language"])]),a.createElementVNode("div",AM,[a.createElementVNode("div",RM,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(Pn),{as:"code",class:a.normalizeClass({wrap:r.value})},null,8,["class"])])]),_:1},16))}}),DM=SM(vM),sb=Z1.extend({draggable:!0,addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),wrap:{default:!0,rendered:!1}}},addNodeView(){return pn(BM)}}).configure({languageClassPrefix:"language-",defaultLanguage:"bash",lowlight:DM}),IM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,n=a.computed(()=>e.node.attrs.level);return(o,r)=>(a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:["o-heading-view",`h${n.value}`],style:`text-align: ${o.node.attrs.textAlign}`}),{default:a.withCtx(()=>[a.createVNode(a.unref(Pn))]),_:1},16,["class","style"]))}}),ab=pm.extend({draggable:!0,addNodeView(){return pn(IM)}}),LM={class:"horizontal"},PM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t;return(n,o)=>(a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:"o-horizontal-view"}),{default:a.withCtx(()=>[a.createElementVNode("div",LM,[a.createVNode(a.unref(Pn),{as:"div",class:"divider"})])]),_:1},16))}}),lb=bm.extend({draggable:!0,addNodeView(){return pn(PM)}});/**
|
|
190
|
+
* Copyright 2025 Yiitap
|
|
191
|
+
* @license MIT
|
|
192
|
+
**/const $M=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,FM=ze.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",_e(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[ka({find:$M,type:this.type,getAttributes:t=>{const[,,e,n,o]=t;return{src:n,alt:e,title:o}}})]}}),VM=FM.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",_e(this.options.HTMLAttributes,e)]}}),zM={key:1,class:"image-container"},HM={key:1},UM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,{isEditable:n}=Te(),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),u=a.computed({get(){return e.node.attrs.src},set(y){e.updateAttributes({src:y})}}),d=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(){u.value==="init"&&b(!0)}function m(y){switch(o.value=!1,y.value){case"replace":b(!0);break}}function g(y){u.value=y,b(!1)}function b(y){r.value=y}return a.onMounted(()=>{b(u.value==="init")}),(y,k)=>{var E;return a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:["o-image-view",{"with-caption":c.value.alt,"with-ratio":c.value.ratio,readonly:!((E=y.editor)!=null&&E.isEditable),init:u.value==="init"}],size:c.value.size,as:"div",onClick:h}),{default:a.withCtx(()=>[a.createVNode(a.unref(Zn),{modelValue:r.value,"onUpdate:modelValue":k[1]||(k[1]=v=>r.value=v),placement:u.value==="init"?"bottom":"top","show-arrow":""},{"popover-content":a.withCtx(()=>[a.createVNode(a.unref(Qc),{val:u.value==="init"?"":u.value,type:"image",onInput:g},null,8,["val"])]),default:a.withCtx(()=>{var v;return[u.value==="init"?(a.openBlock(),a.createBlock(a.unref(Jc),{key:0,icon:"image",placeholder:"Add an image"})):(a.openBlock(),a.createElementBlock("div",zM,[a.unref(n)?(a.openBlock(),a.createBlock(a.unref(Xc),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},[(v=y.editor)!=null&&v.isEditable&&l.value?(a.openBlock(),a.createBlock(a.unref(Ln),{key:0,ref_key:"captionInput",ref:s,class:"caption-input",modelValue:d.value,"onUpdate:modelValue":k[0]||(k[0]=C=>d.value=C),type:"text",placeholder:"Input caption",autosize:"",onBlur:f},null,8,["modelValue"])):(a.openBlock(),a.createElementBlock("span",HM,a.toDisplayString(d.value),1))])]))]}),_:1},8,["modelValue","placement"]),a.createVNode(a.unref(xi),{modelValue:o.value,"onUpdate:modelValue":k[2]||(k[2]=v=>o.value=v),event:i.value},{default:a.withCtx(()=>[a.createVNode(a.unref(So),a.mergeProps(e,{onAction:m}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class","size"])}}}),cb=VM.extend({addNodeView(){return pn(UM)}}).configure({inline:!0});function qM(t){return new Ae({key:new xe("handleClickSelectLink"),props:{handleClick:(e,n,o)=>{const{schema:r,doc:i,tr:s}=e.state,l=Cr(i.resolve(n),r.marks.link);if(!l)return!1;const c=i.resolve(l.from),u=i.resolve(l.to),d=s.setSelection(new ne(c,u));return e.dispatch(d),!0}}})}const KM=pu.extend({addProseMirrorPlugins(){var t;return[...((t=this.parent)==null?void 0:t.call(this))||[],qM({type:this.type})]}}).configure({openOnClick:!1}),WM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t;return(n,o)=>(a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:"o-paragraph-view"}),{default:a.withCtx(()=>[a.createVNode(a.unref(Pn),{as:"p",style:a.normalizeStyle(`text-align: ${n.node.attrs.textAlign}`)},null,8,["style"])]),_:1},16))}}),ub=ym.extend({draggable:!1,addNodeView(){return pn(WM,{stopEvent:()=>!1})}}),jM={class:"add"},GM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,{tr:n}=ge(),{isEditable:o,run:r}=Te(),i=a.ref(!1);function s(){i.value=!0}function l(){c("tableSelectRow",{pos:e.getPos()})}function c(u,d={}){u==="tableDeleteRow"&&(i.value=!1),setTimeout(()=>{r(e.editor,u,d)},0)}return(u,d)=>(a.openBlock(),a.createBlock(a.unref(qc),a.mergeProps({class:"o-table-cell-view",as:"td"},u.node.attrs,{style:{background:u.node.attrs.background}}),{default:a.withCtx(()=>[a.unref(o)?(a.openBlock(),a.createBlock(a.unref(Zn),{key:0,modelValue:i.value,"onUpdate:modelValue":d[2]||(d[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(lt),{icon:"select_all",placement:"left",tooltip:a.unref(n)("table.selectRow"),onClick:l},null,8,["tooltip"]),a.createVNode(a.unref(lt),{icon:"delete",placement:"left",tooltip:a.unref(n)("table.removeRow"),onClick:d[1]||(d[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",jM,[d[3]||(d[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(me).blue,tooltip:a.unref(n)("table.addRow"),placement:"left",onClick:d[0]||(d[0]=a.withModifiers(p=>c("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])):a.createCommentVNode("",!0),a.createVNode(a.unref(Pn))]),_:1},16,["style"]))}}),db=vg.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return pn(GM,{stopEvent:()=>!1})}}),YM={class:"add"},JM={class:"add"},XM=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,{tr:n}=ge(),{isEditable:o,run:r}=Te(),i=a.ref(!1),s=a.ref(!1);function l(){setTimeout(()=>{i.value=!0},0)}function c(){s.value=!0}function u(){i.value=!1,p("tableSelectColumn",{pos:e.getPos()})}function d(){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(qc),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(Zn),{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(lt),{icon:"select_all",tooltip:a.unref(n)("table.selectColumn"),onClick:u},null,8,["tooltip"]),a.createVNode(a.unref(lt),{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",YM,[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(me).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(Zn),{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(lt),{icon:"select_all",placement:"left",tooltip:a.unref(n)("table.selectRow"),onClick:d},null,8,["tooltip"]),a.createVNode(a.unref(lt),{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",JM,[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(me).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(Pn))]),_:1},16,["style"]))}}),pb=kg.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return pn(XM,{stopEvent:()=>!1})}});/**
|
|
193
|
+
* Copyright 2025 Yiitap
|
|
194
|
+
* @license MIT
|
|
195
|
+
**/const ZM=ze.create({name:"table-wrapper",group:"block",content:"table",draggable:!0,parseHTML(){return[{tag:"table-wrapper"}]},renderHTML({HTMLAttributes:t}){return["table-wrapper",_e(t),0]}}),QM=a.defineComponent({__name:"view",props:ct,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(),u=c+e.node.nodeSize;return l>=c&&l<=u});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(kn),a.mergeProps(e,{class:["o-table-wrapper-view",{"side-node-enabled":a.unref(n)}]}),{default:a.withCtx(()=>[a.createVNode(a.unref(Pn),{as:"table"})]),_:1},16,["class"]))}}),fb=ZM.extend({addNodeView(){return pn(QM,{stopEvent:()=>!1})}});/**
|
|
196
|
+
* Copyright 2025 Yiitap
|
|
197
|
+
* @license MIT
|
|
198
|
+
**/const eA=/(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,tA=ze.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",_e(this.options.HTMLAttributes,e)]]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[ka({find:eA,type:this.type,getAttributes:t=>{const[e]=t;return{src:e}}})]}}),nA={key:1,class:"video-container"},oA={key:1},rA=a.defineComponent({__name:"view",props:ct,setup(t){const e=t,{isEditable:n}=Te(),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})}}),u=a.computed({get(){return e.node.attrs.src},set(y){e.updateAttributes({src:y})}});function d(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(){u.value==="init"&&b(!0)}function m(y){o.value=!0,r.value=y}function g(y){u.value=y,b(!1)}function b(y){l.value=y}return a.onMounted(()=>{b(u.value==="init")}),(y,k)=>{var E;return a.openBlock(),a.createBlock(a.unref(kn),a.mergeProps(e,{class:["o-video-view",{readonly:!((E=y.editor)!=null&&E.isEditable),init:u.value==="init"}],as:"div",onContextmenu:a.withModifiers(m,["prevent"]),onClick:h}),{default:a.withCtx(()=>[a.createVNode(a.unref(Zn),{modelValue:l.value,"onUpdate:modelValue":k[1]||(k[1]=v=>l.value=v),placement:u.value==="init"?"bottom":"top"},{"popover-content":a.withCtx(()=>[a.createVNode(a.unref(Qc),{val:u.value==="init"?"":u.value,type:"video",onInput:g},null,8,["val"])]),default:a.withCtx(()=>{var v;return[u.value==="init"?(a.openBlock(),a.createBlock(a.unref(Jc),{key:0,icon:"videocam",placeholder:"Add a video"})):(a.openBlock(),a.createElementBlock("div",nA,[k[3]||(k[3]=a.createElementVNode("div",{class:"video-cover"},null,-1)),a.unref(n)?(a.openBlock(),a.createBlock(a.unref(Xc),a.mergeProps({key:0},e,{onAction:d}),{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},[(v=y.editor)!=null&&v.isEditable&&s.value?(a.openBlock(),a.createBlock(a.unref(Ln),{key:0,ref_key:"captionInput",ref:i,class:"caption-input",modelValue:c.value,"onUpdate:modelValue":k[0]||(k[0]=C=>c.value=C),type:"text",placeholder:"Input caption",autosize:"",onBlur:f},null,8,["modelValue"])):(a.openBlock(),a.createElementBlock("span",oA,a.toDisplayString(c.value),1))])]))]}),_:1},8,["modelValue","placement"]),a.createVNode(a.unref(xi),{modelValue:o.value,"onUpdate:modelValue":k[2]||(k[2]=v=>o.value=v),event:r.value},{default:a.withCtx(()=>[a.createVNode(a.unref(So),a.mergeProps(e,{onAction:d}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),hb=tA.extend({addNodeView(){return pn(rA)}}),iA=["BackColor","Focus","FontFamily","ForeColor","Table","TaskItem","TaskList","TextAlign","Typography","Underline","OHorizontalRule","OSelectionDecoration","OUniqueID"],sA=["BackColor","Bold","BulletList","Code","CodeBlockLowlight","Focus","FontFamily","ForeColor","HorizontalRule","Image","Italic","Link","ListItem","Mention","OrderedList","Strike","Table","TaskItem","TaskList","TextAlign","Typography","Underline"],aA=["OAiBlock","OBlockquote","OCallout","OCharCommand","OCodeBlock","OColon","OColorHighlighter","OFocus","OHeading","OHorizontalRule","OImage","OLink","OParagraph","OSelectionDecoration","OSlash","OSlashZh","OTableWrapper","OTrailingNode","OUniqueID","OVideo"],lA=[...sA,...aA],cA=[Ts,qm,Km,Wm,jm,pu,Zx,og,rg,ig,sg,ag,hu,vm,Ng,Tg,wg,Og,RT,sb,ab,lb,cb,ub,Eg,_g,Cg,db,pb,fb,Sg,xg,hb],cc=t=>Xw(t,cA),uA={key:0,class:"o-ai-menu"},dA={key:0,class:"o-scroll"},pA={class:"view-main"},fA={key:1,class:"view-output"},hA={class:"action-container"},mA={class:"actions"},gA={key:0,class:"o-scroll"},bA=["innerHTML"],yA={class:"ai-io-panel"},vA={class:"o-flex o-item-center actions"},mb=a.defineComponent({__name:"OAiMenu",props:{editor:{type:Zt,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(t,{emit:e}){const n=t,o=e,{md:r,aiOption:i,createStreamingChatCompletion:s}=Yc(),{languageName:l,tr:c}=ge(),u=a.ref(),d=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:Gc.writing.replace("[LANGUAGE]",l.value)})),k=a.ref([{role:"system",content:"You are an assistant. Please answer in [LANGUAGE]."}]),E=a.computed(()=>wm.filter($=>$.value.indexOf(p.value)>=0));function v(){const{from:$,to:U}=n.editor.state.selection;return n.editor.state.doc.textBetween($,U,"")}function C(){setTimeout(()=>{d.value=!0},0)}function _($,U){switch(U&&(d.value=!0),m.value=$.options.prompt.replaceAll("[CONTENT]",v()),$.value){case"translate":m.value=m.value.replace("[LANGUAGE]",U.value);break;case"change_tone":m.value=m.value.replace("[TONE]",U.value);break}return p.value=c($.label),N(),!0}function R(){var $;G(),($=u.value)==null||$.focus()}function B(){const $=cc(f.value);let U=0;for(const q of $.content){const ee=An.fromJSON(n.editor.schema,q);U+=ee.nodeSize}n.editor.chain().focus().deleteSelection().insertContent($.content).setTextSelection({from:n.editor.state.selection.from,to:n.editor.state.selection.from+U+1}).run(),G(),d.value=!1,setTimeout(()=>{o("confirm")},0)}function N(){h.value="output",g.value=!0,b.value?z():M()}async function M(){let $="";k.value.push({role:"user",content:m.value}),k.value[0].role==="system"&&(k.value.shift(),k.value.unshift(y.value));try{const U=await s(k.value,q=>{$+=q,k.value=[...k.value.slice(0,-1),{role:"assistant",content:$}],f.value=r.render($)})}catch(U){k.value.pop(),console.error(U),tu.error(c("ai.error"))}g.value=!1}async function z(){let $="";for(const U of Um)await new Promise(q=>setTimeout(q,500)),$+=U,f.value=r.render($);g.value=!1}function G(){h.value="main",f.value="",p.value=""}return a.onMounted(()=>{setTimeout(()=>{var $;($=u.value)==null||$.focus(),d.value=!0},300)}),($,U)=>t.editor?(a.openBlock(),a.createElementBlock("section",uA,[a.createVNode(a.unref(Zn),{modelValue:d.value,"onUpdate:modelValue":U[1]||(U[1]=q=>d.value=q),placement:"bottom-start","tippy-class":"ai-menu-popover","content-class":""},{"popover-content":a.withCtx(()=>[h.value==="main"?(a.openBlock(),a.createElementBlock("div",dA,[a.createElementVNode("section",pA,[a.createVNode(a.unref(_a),{items:E.value,onSelect:_,"use-keyboard":d.value},null,8,["items","use-keyboard"])])])):a.createCommentVNode("",!0),h.value==="output"?(a.openBlock(),a.createElementBlock("section",fA,[a.createElementVNode("div",hA,[a.createElementVNode("div",null,[a.createVNode(a.unref(re),{name:"auto_awesome",class:"o-tips"})]),a.createElementVNode("div",mA,[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",gA,[a.createElementVNode("div",{class:"tiptap output",innerHTML:f.value},null,8,bA)])):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)]),default:a.withCtx(()=>[a.createElementVNode("section",yA,[a.createVNode(a.unref(Ln),{ref_key:"inputRef",ref:u,class:"caption-input",modelValue:p.value,"onUpdate:modelValue":U[0]||(U[0]=q=>p.value=q),type:"text",placeholder:a.unref(c)("ai.askAi"),autofocus:"",onFocus:C},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"auto_awesome",class:"o-tips"})]),suffix:a.withCtx(()=>[a.createElementVNode("div",vA,[a.createVNode(a.unref(yn),{icon:"keyboard_return",tooltip:"Submit"})])]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["modelValue"])])):a.createCommentVNode("",!0)}}),kA={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(Qn),{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",kA)):(a.openBlock(),a.createBlock(a.unref(re),{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"]))}}),wA=a.defineComponent({__name:"OAiBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const{tr:e}=ge();return(n,o)=>(a.openBlock(),a.createBlock(yn,{"content-class":"o-ai-btn",icon:"auto_awesome",color:a.unref(me).purple,tooltip:a.unref(e)("ai.askAi")},null,8,["color","tooltip"]))}}),EA=a.defineComponent({__name:"OAlignDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),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(lt),{icon:"format_align_center","content-class":"o-align-dropdown dropdown",tooltip:a.unref(n)("editor.align")},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(u,d)=>{var p;return a.openBlock(),a.createBlock(a.unref(Ut),{key:d,class:a.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive({textAlign:u.value})}),onClick:f=>s(u.value)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:u.icon},null,8,["name"])]),suffix:a.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive({textAlign:u.value})?(a.openBlock(),a.createBlock(a.unref(re),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]}),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),_A={class:"o-align-group"},CA=a.defineComponent({__name:"OAlignGroup",props:{editor:{type:Zt}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),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",_A,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,(c,u)=>{var d;return a.openBlock(),a.createBlock(Le,{key:u,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(d=t.editor)==null?void 0:d.isActive({textAlign:c.value})},onClick:p=>i(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),SA={class:"o-back-color-dropdown o-button-group"},xA=a.defineComponent({__name:"OBackColorDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),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,u)=>(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(Qn),{trigger:"hover"},{trigger:a.withCtx(()=>[a.createElementVNode("div",SA,[a.createVNode(a.unref(St),{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(St),{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 d;return[a.createVNode(a.unref(Ca),{"default-color":"","default-label":a.unref(n)("editor.noColor"),"active-color":(d=t.editor)==null?void 0:d.getAttributes("highlight").color,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),NA=a.defineComponent({__name:"OEmojiBtn",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),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(lt),{icon:"emoji_emotions","content-class":"o-emoji-btn",tooltip:a.unref(n)("editor.emoji")},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Sa),{items:a.unref(ei.emojiGroups),onSelect:i,"enable-search":""},null,8,["items"])]),_:1},512))}}),TA=a.defineComponent({__name:"OFontFamilyDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),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(lt),{icon:"format_font","content-class":"o-font-family-dropdown dropdown",tooltip:a.unref(n)("editor.fontFamily")},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(u,d)=>{var p;return a.openBlock(),a.createElementBlock(a.Fragment,{key:d},[u.separator?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0})):a.createCommentVNode("",!0),a.createVNode(a.unref(Ut),{class:a.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive("textStyle",{fontFamily:u.value})}),onClick:f=>s(u.value)},{suffix:a.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive("textStyle",{fontFamily:u.value})?(a.openBlock(),a.createBlock(a.unref(re),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]}),default:a.withCtx(()=>[a.createElementVNode("span",{style:a.normalizeStyle(`font-family: ${u.value}`)},a.toDisplayString(u.label),5)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),OA={class:"o-fore-color-dropdown o-button-group"},MA=a.defineComponent({__name:"OForeColorDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(null),i=a.ref("#ff4d4f");function s(){l(i.value)}function l(c){var u;(u=r.value)==null||u.setShow(!1),i.value=c,o(e.editor,"foreColor",{color:c})}return(c,u)=>(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(Qn),null,{trigger:a.withCtx(()=>[a.createElementVNode("div",OA,[a.createVNode(a.unref(St),{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(St),{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 d;return[a.createVNode(a.unref(Ca),{"default-color":"","default-label":a.unref(n)("editor.defaultColor"),"active-color":(d=t.editor)==null?void 0:d.getAttributes("textStyle").color,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),AA=a.defineComponent({__name:"OHeadingDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),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 u,d;return c.value==="heading"?(u=e.editor)==null?void 0:u.isActive(c.value,{level:c.valueAlt}):(d=e.editor)==null?void 0:d.isActive(c.value)}function l(c){var u;(u=r.value)==null||u.setShow(!1),o(e.editor,c.value,{level:c.valueAlt})}return(c,u)=>(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(lt),{icon:"format_header_pound","content-class":"o-heading-dropdown dropdown",tooltip:a.unref(n)("editor.heading")},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(d,p)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:p},[d.separator?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0})):a.createCommentVNode("",!0),a.createVNode(a.unref(Ut),{class:a.normalizeClass({"is-active":s(d)}),onClick:f=>l(d)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:d.icon},null,8,["name"])]),suffix:a.withCtx(()=>[s(d)?(a.openBlock(),a.createBlock(a.unref(re),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),RA={class:"o-list-dropdown o-button-group"},BA=a.defineComponent({__name:"OListDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(null),i=a.ref();function s(){o(e.editor,i.value.value)}function l(u){r.value.setShow(!1),i.value=u,o(e.editor,u.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]}),(u,d)=>(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(Qn),{trigger:"hover"},{trigger:a.withCtx(()=>{var p;return[a.createElementVNode("div",RA,[a.createVNode(a.unref(St),{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(St),{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(Qt),{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(Ut),{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(re),{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(re),{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))}}),DA={class:"o-list-group"},IA=a.defineComponent({__name:"OListGroup",props:{editor:{type:Zt,required:!0}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),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",DA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,(c,u)=>{var d;return a.openBlock(),a.createBlock(Le,{key:u,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(d=t.editor)==null?void 0:d.isActive(c.value)},onClick:p=>i(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),LA=a.defineComponent({__name:"OLinkBtn",props:{editor:{type:Zt}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),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 u(){var p;(p=r.value)==null||p.setShow(!1)}function d(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(lt),{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(eu),{key:0,title:a.unref(n)("editor.hyperlink"),val:s.value,icon:"link",onCancel:u,onConfirm:d},{"header-right":a.withCtx(()=>[a.createVNode(a.unref(nu),{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"]))}}),PA=a.defineComponent({__name:"OLinkEditBtn",props:{editor:{type:Zt,required:!0}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),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 u(){var p;(p=r.value)==null||p.setShow(!1)}function d(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(lt),{icon:"edit",tooltip:a.unref(n)("link.edit")},null,8,["tooltip"])]),default:a.withCtx(()=>[i.value?(a.openBlock(),a.createBlock(a.unref(eu),{key:0,title:a.unref(n)("link.edit"),val:s.value,icon:"link",onCancel:u,onConfirm:d},{"header-right":a.withCtx(()=>[a.createVNode(a.unref(nu),{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"]))}}),$A=a.defineComponent({__name:"OLinkOpenBtn",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge();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"]))}}),FA={class:"o-command-btn"},VA={class:"o-more-bubble"},zA=a.defineComponent({__name:"OMoreBubble",props:{editor:{type:Zt,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",FA,[a.createVNode(a.unref(re),{name:"more_horiz"})])]),default:a.withCtx(()=>[a.createElementVNode("section",VA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(Om),(r,i)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:i},[r==="separator"?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0,vertical:""})):typeof r=="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(Ma)(r)),{key:1,name:r,editor:t.editor},null,8,["name","editor"])):a.createCommentVNode("",!0)],64))),128))])]),_:1},512))}}),HA=a.defineComponent({__name:"OStyleDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),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 u;return(u=e.editor)==null?void 0:u.isActive(c.value,c.options)}function l(c){r.value.setShow(!1),o(e.editor,c.value,c.options)}return(c,u)=>(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(lt),{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(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(d,p)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:p},[d.separator?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0})):a.createCommentVNode("",!0),a.createVNode(a.unref(Ut),{class:a.normalizeClass({"is-active":s(d)}),onClick:f=>l(d)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:d.icon},null,8,["name"])]),suffix:a.withCtx(()=>[s(d)?(a.openBlock(),a.createBlock(a.unref(re),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),UA=a.defineComponent({__name:"OTableBtn",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),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(lt),{icon:"window","content-class":"o-table-btn",tooltip:a.unref(n)("table.insert")},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Im),{onSelect:i})]),_:1},512))}}),qA={class:"o-table-group"},KA=a.defineComponent({__name:"OTableGroup",props:{editor:{type:Zt,required:!0}},setup(t){const{tr:e}=ge(),{run:n}=Te();return(o,r)=>{var i,s;return a.openBlock(),a.createElementBlock("section",qA,[(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(Lm),{editor:t.editor},null,8,["editor"])])}}}),WA=a.defineComponent({__name:"OTextColorDropdown",props:{editor:{type:Zt}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),r=a.ref(null),i=a.ref(""),s=a.ref("");function l(c,u){c==="foreColor"?(i.value=u,localStorage.setItem("yiitap.text-color.fore",u)):c==="backColor"&&(s.value=u,localStorage.setItem("yiitap.text-color.back",u)),r.value.setShow(!1),o(e.editor,c,{color:u})}return a.onMounted(()=>{i.value=localStorage.getItem("yiitap.text-color.fore")||"",s.value=localStorage.getItem("yiitap.text-color.back")||""}),(c,u)=>(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(lt),{icon:"format_text","content-class":"o-text-color-dropdown dropdown",tooltip:a.unref(n)("editor.textColor")},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>{var d;return[a.createVNode(a.unref(Pm),{"fore-color":i.value,"back-color":s.value,"default-label":a.unref(n)("editor.defaultColor"),"active-color":(d=t.editor)==null?void 0:d.getAttributes("textStyle").color,onSelect:l},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),jA=a.defineComponent({__name:"OTextFormatDropdown",props:{editor:{type:Zt}},setup(t){const e=t,{tr:n}=ge(),{run:o}=Te(),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(lt),{icon:"title","content-class":"o-text-format-dropdown dropdown",tooltip:a.unref(n)("editor.textFormat")},{default:a.withCtx(()=>[a.createVNode(a.unref(re),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Qt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(u,d)=>{var p;return a.openBlock(),a.createBlock(a.unref(Ut),{key:d,class:a.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive(u.value)}),onClick:f=>s(u.value)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(re),{name:u.icon},null,8,["name"])]),suffix:a.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive(u.value)?(a.openBlock(),a.createBlock(a.unref(re),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]}),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),GA={ai:wA,"align-dropdown":EA,"align-group":CA,"back-color":xA,"font-family":TA,"fore-color":MA,heading:AA,"list-dropdown":BA,"list-group":IA,link:LA,"link-edit":PA,"link-open":$A,emoji:NA,more:zA,"style-dropdown":HA,table:UA,"table-group":KA,"text-color-dropdown":WA,"text-format-dropdown":jA},Ma=t=>GA[t]||SC,YA={class:"o-main-menu"},JA={class:"left"},XA={class:"right"},gb=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=Cm),o.length>0?o:_m});return(o,r)=>(a.openBlock(),a.createElementBlock("section",YA,[a.createElementVNode("section",JA,[(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(Lt),{key:0,vertical:""})):typeof i=="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(Ma)(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",XA,[a.renderSlot(o.$slots,"right")])]))}}),ZA={key:0},QA={key:1,class:"container"},eR=a.defineComponent({__name:"OBubbleMenu",props:{editor:{type:Zt},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(t){const e=t,{tr:n}=ge(),{theme:o}=xr(),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 u(b){b==="ai"&&(i.value=!0)}function d(){s.value=!0}function p(b){const{schema:y}=e.editor,k=y.marks.link;if(!k||!b)return!1;const{$from:E,$to:v}=b;return!!Cr(E,k)}function f({editor:b,element:y,view:k,state:E,oldState:v,from:C,to:_}){var q;const{doc:R,selection:B}=E,{empty:N}=B,M=!R.textBetween(C,_).length&&ba(E.selection);if(!k.hasFocus()||N||s.value||M&&b.isActive("link")&&!b.isActive("image"))return!1;const z=["image"],G=["toc","video","model-viewer"],$=B.node,U=(q=$==null?void 0:$.type)==null?void 0:q.name;return!(b.isActive("codeBlock")||G.indexOf(U)>=0||U&&!z.includes(U))}const h=a.computed(()=>{if(e.editor){const{state:b}=e.editor,{tr:y}=b,{selection:k}=y;return p(k)}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,k;let b=e.menu;return r.value||((y=e.editor)!=null&&y.isActive("image")?b=h.value?Tm:Nm:(k=e.editor)!=null&&k.isActive("table")?b=Mm:h.value&&(b=xm)),b.length>0?b:Sm});return a.onMounted(()=>{r.value=!1}),(b,y)=>t.editor?(a.openBlock(),a.createElementBlock("section",ZA,[a.createVNode(a.unref(h_),{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(mb),{key:0,editor:t.editor,onConfirm:d},null,8,["editor"])):(a.openBlock(),a.createElementBlock("section",QA,[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(Lt),{vertical:""})],64)):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(g.value,(k,E)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:E},[k==="separator"?(a.openBlock(),a.createBlock(a.unref(Lt),{key:0,vertical:""})):typeof k=="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(Ma)(k)),{key:1,name:k,editor:t.editor,onClick:v=>u(k)},null,8,["name","editor","onClick"])):(a.openBlock(),a.createBlock(a.resolveDynamicComponent(k),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))]))]),_:1},8,["class","editor","tippy-options"])])):a.createCommentVNode("",!0)}}),tR={key:0},nR={class:"container"},oR=a.defineComponent({__name:"OFloatingMenu",props:{editor:{type:cm},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(u){const{schema:d}=e.editor,p=d.marks.link;if(!p||!u)return!1;const{$from:f,$to:h}=u;return!!Cr(f,p)}const s=a.computed(()=>{if(e.editor){const{state:u}=e.editor,{tr:d}=u,{selection:p}=d;return i(p)}else return!1}),l=a.computed(()=>!n.value&&s.value),c=a.computed(()=>{let u=e.menu;return u.length>0?u:Am});return(u,d)=>t.editor?(a.openBlock(),a.createElementBlock("section",tR,[a.createVNode(a.unref(g_),{class:a.normalizeClass(["o-floating-menu",t.menuClass]),editor:t.editor,"tippy-options":o.value},{default:a.withCtx(()=>[a.createElementVNode("section",nR,[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(Lt),{key:0,vertical:""})):typeof p=="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(Ma)(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 ku(t,e){const n=e==null?void 0:e.posAtCoords(t);if(!n)return;let o=ps(n.pos,e);if(o!==e.dom){for(;o&&o.parentNode&&o.parentNode!==e.dom;)o=o.parentNode;if(o)return o}}function ps(t,e){return e.nodeDOM(t)||e.domAtPos(t).node}function wu(t,e){const n=ku(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 rR(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 iR(t,e){const n=wu(t,e.view);return n&&n>=0?{node:e.state.doc.nodeAt(n),pos:n}:{node:null,pos:n}}const ia=new xe("sideMenu");class sR{constructor(){Je(this,"hovered",!1);Je(this,"coords",{left:0,top:0});Je(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 aR{constructor({editor:e,element:n,view:o,tippyOptions:r={},updateDelay:i=250}){Je(this,"editor");Je(this,"element");Je(this,"view");Je(this,"preventHide",!1);Je(this,"tippy");Je(this,"tippyOptions");Je(this,"updateDelay");Je(this,"updateDebounceTimer");Je(this,"mousedownHandler",()=>{this.preventHide=!0});Je(this,"onDragStart",e=>{this.hide()});Je(this,"blurHandler",({event:e})=>{var n;e!=null&&e.relatedTarget&&((n=this.element.parentNode)!=null&&n.contains(e.relatedTarget))||this.hide()});Je(this,"tippyBlurHandler",e=>{this.blurHandler({event:e})});Je(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))});Je(this,"updateHandler",(e,n,o,r)=>{var d,p;const{state:i,composing:s}=e,{coords:l}=ia.getState(i),c=ku(l,e),u=wu(l,e);!c||u<=0||(this.createTooltip(),(p=this.tippy)==null||p.setProps({getReferenceClientRect:((d=this.tippyOptions)==null?void 0:d.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=dn(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 lR=(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=wu(r,n);if(i===null)return;const s=n.state.selection,l=n.state.doc;rR(s,l),n.dispatch(n.state.tr.setSelection(oe.create(n.state.doc,i))),uR(n,i);const c=n.state.selection.content(),{dom:u,text:d}=n.serializeForClipboard(c);t.dataTransfer.clearData(),t.dataTransfer.setData("text/html",u.innerHTML),t.dataTransfer.setData("text/plain",d),t.dataTransfer.effectAllowed="move",t.dataTransfer.setDragImage(Ho,0,0),n.dragging={slice:c,move:!0}},cR=(t,e)=>{bb()};let Ho;function uR(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(ps(e,t))),c=l):(l=i(r,s(ps(e+1,t))),c=i(r,s(ps(n-1,t))));for(let p=r.childElementCount-1;p>=0;p--)(p>l||p<c)&&o.removeChild(o.children[p]);bb(),Ho=o;const d=t.dom.className.split(" ").filter(p=>p!=="ProseMirror"&&p!=="yiitap-root"&&p!=="yiitap-editor").join(" ");Ho.className+=" yiitap-dragging-preview "+d,document.body.appendChild(Ho)}function bb(){Ho!==void 0&&(document.body.removeChild(Ho),Ho=void 0)}class dR{constructor(e){Je(this,"options");Je(this,"plugin");Je(this,"sideMenuView");const n=new sR;this.options=e,this.plugin=new Ae({key:ia,props:{handleDOMEvents:{mouseover(o,r){const i={left:r.clientX,top:r.clientY},s=ku(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(ia,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 aR({view:o,...e}),this.sideMenuView)})}dragstart(e){lR(e,this.options.editor)}dragend(e){cR(e,this.options.editor)}}const pR=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:u,tippyOptions:d}=t;r.value=new dR({updateDelay:u,editor:c,element:o.value,pluginKey:l,tippyOptions:d}),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))}}}),fR={key:0,class:"o-side-menu"},hR={class:"container"},mR=a.defineComponent({__name:"OSideMenu",props:{editor:{type:Zt,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 u({editor:f,transaction:h}){let m={left:0,top:0};const g=ia.getState(e.editor.view.state);if(g){m=g.coords;const b=iR(m,f);b.node&&b.pos>0&&(o.value=b.node,r.value=b.pos)}}function d(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",u)}),(f,h)=>t.editor?(a.openBlock(),a.createElementBlock("section",fR,[a.createVNode(a.unref(pR),{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",hR,[o.value?(a.openBlock(),a.createBlock(a.unref(Vm),a.normalizeProps(a.mergeProps({key:0},s.value)),null,16)):a.createCommentVNode("",!0),o.value?(a.openBlock(),a.createBlock(a.unref(zm),a.mergeProps({key:1},s.value,{onDragstart:d,onDragend:p}),null,16)):a.createCommentVNode("",!0)])]),_:1},8,["class","editor","tippy-options"])])):a.createCommentVNode("",!0)}}),gR={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:t,tr:e}=ge(),{onCommand:n}=Te();return{locale:t,tr:e,onCommand:n}},data(){return{view:"main",selectedIndex:0}},components:{ODivider:Lt,OIcon:re,OList:Qt,OListItem:Ut},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 Sr.slice(1)}},mounted(){this.selectedIndex=0}},yb=(t,e)=>{const n=t.__vccOpts||t;for(const[o,r]of e)n[o]=r;return n},bR={key:0,class:"view-main"},yR={class:"group o-tips"},vR={class:"o-tips"},kR={key:1,class:"item"},wR={key:1,class:"view-emoji"},ER={key:2,class:"view-emoji"};function _R(t,e,n,o,r,i){const s=a.resolveComponent("o-divider"),l=a.resolveComponent("o-icon"),c=a.resolveComponent("o-list-item"),u=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",bR,[a.createVNode(u,{hoverable:"",clickable:""},{default:a.withCtx(()=>[n.items.length?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(n.items,(d,p)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:p},[d.group?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[p>0?(a.openBlock(),a.createBlock(s,{key:0})):a.createCommentVNode("",!0),a.createElementVNode("div",yR,a.toDisplayString(o.tr(d.group)),1)],64)):a.createCommentVNode("",!0),a.createVNode(c,{class:a.normalizeClass(["item",{"is-active":p===r.selectedIndex}]),clickable:"",onClick:f=>i.onClick(d)},{prefix:a.withCtx(()=>[a.createVNode(l,{name:d.icon,color:d.color},null,8,["name","color"])]),suffix:a.withCtx(()=>[a.createElementVNode("span",vR,a.toDisplayString(d.tips),1)]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(o.tr(d.label)),1)]),_:2},1032,["class","onClick"])],64))),128)):(a.openBlock(),a.createElementBlock("div",kR,"No result"))]),_:1})])):r.view==="emoji"?(a.openBlock(),a.createElementBlock("section",wR)):r.view==="ai"?(a.openBlock(),a.createElementBlock("section",ER)):a.createCommentVNode("",!0)],2)}const CR=yb(gR,[["render",_R]]),Xp={items:({query:t})=>Ea.filter(e=>e.value.toLowerCase().startsWith(t.toLowerCase())),render:()=>{let t,e;return{onStart:n=>{t=new Kc(CR,{props:n,editor:n.editor}),n.clientRect&&(e=dn("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()}}}},SR={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:t,tr:e}=ge(),{run:n}=Te();return{locale:t,tr:e,run:n}},data(){return{view:"main"}},components:{OEmojiSelect:Sa},methods:{onSelect(t){this.editor.commands.deleteRange(this.range),this.editor.commands.insertContent(t.emoji),this.editor.chain().focus()},onKeyDown({event:t}){return!1}}},xR={class:"o-colon-view"};function NR(t,e,n,o,r,i){const s=a.resolveComponent("o-emoji-select");return a.openBlock(),a.createElementBlock("section",xR,[a.createVNode(s,{items:n.items,onSelect:i.onSelect},null,8,["items","onSelect"])])}const TR=yb(SR,[["render",NR]]),OR={items:({query:t})=>ei.filterEmojiGroups(t),render:()=>{let t,e;return{onStart:n=>{t=new Kc(TR,{props:n,editor:n.editor}),n.clientRect&&(e=dn("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()}}}},MR={BackColor:qm.configure({multicolor:!0}),Focus:Km,ForeColor:jm,FontFamily:Wm,Image:Sx,Link:pu,TextAlign:ig.configure({types:["heading","paragraph"]}),TaskItem:og,TaskList:rg.configure({itemTypeName:"taskItem"}),Underline:ag,Typography:sg,OAiBlock:Ng,OColon:BT.configure({suggestion:OR}),OSlash:DT.configure({suggestion:Xp}),OSlashZh:IT.configure({suggestion:Xp}),OBlockquote:Tg,OCallout:Og,OCodeBlock:sb,OColorHighlighter:wg,OHeading:ab,OHorizontalRule:lb,OImage:cb,OLink:KM.configure({openOnClick:!1}),OParagraph:ub,OSelectionDecoration:_g,OTrailingNode:Sg,OUniqueID:xg.configure({attributeName:"data-id",enableRender:!1,types:["blockquote","codeBlock","callout","heading","image","paragraph","table-wrapper","video"]}),OVideo:hb};class AR{constructor(e){return MR[e]}}const RR=[fb,Cg.configure({resizable:!0}),hu,pb,db];yg.configure({resizable:!0});const BR=["data-theme"],vb=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}=ge(),s=a.ref(!1),l=a.ref(!0),c=a.ref("en"),u=a.ref(!1),d=a.ref();a.provide("darkMode",s),a.provide("isEditable",l),a.provide("locale",c),a.provide("sideNode",u),a.provide("aiOption",d);const p=a.computed(()=>y()),f=b_({editable:o.editable,content:o.content,autofocus:o.autofocus,extensions:p.value,onUpdate:()=>{var v,C;const k=(v=f.value)==null?void 0:v.getJSON(),E=(C=f.value)==null?void 0:C.getHTML();r("update",{json:k,html:E})},onTransaction:({editor:k,transaction:E})=>{r("transaction",{editor:k,transaction:E})}}),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 k=[];o.title?k.push(Ts.extend({content:"heading block*"})):k.push(Ts),k.push(Eg.configure({placeholder:({editor:v,node:C,pos:_})=>{if(C.type.name==="heading"){const R=C.attrs.level;return _>0?`H${R}`:i("label.untitled")}else return C.type.name==="paragraph"?i("label.typeForCommands"):""}})),k.push(fC),k.push(dC.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 E=iA.concat(o.extensions);for(const v of E)if(typeof v=="string"){if(!lA.includes(v))continue;switch(v){case"Table":k.push(...RR);break;default:try{const C=new AR(v);k.push(C)}catch(C){console.error(C.message)}break}}else k.push(v);return k}return a.watch(()=>o.darkMode,k=>{s.value=k}),a.watch(()=>o.locale,k=>{c.value=k}),a.watch(()=>o.aiOption,k=>{d.value=k},{deep:!0}),a.watch(()=>o.editable,k=>{var E;(E=f.value)==null||E.setEditable(k),l.value=k}),a.onBeforeMount(()=>{l.value=o.editable,d.value=o.aiOption,s.value=o.darkMode,c.value=o.locale,u.value=!o.showSideMenu&&o.showSideNode}),e({editor:f,darkMode:s,locale:c}),(k,E)=>{var v,C,_;return a.openBlock(),a.createElementBlock("main",{class:"yiitap yiitap-editor","data-theme":s.value?"dark":""},[t.showMainMenu?(a.openBlock(),a.createBlock(gb,a.mergeProps({key:0},h.value,{class:"desktop-only"}),{left:a.withCtx(()=>[a.renderSlot(k.$slots,"toolbar-left")]),right:a.withCtx(()=>[a.renderSlot(k.$slots,"toolbar-right")]),_:3},16)):a.createCommentVNode("",!0),(v=a.unref(f))!=null&&v.isEditable&&t.showBubbleMenu?(a.openBlock(),a.createBlock(eR,a.normalizeProps(a.mergeProps({key:1},m.value)),null,16)):a.createCommentVNode("",!0),(C=a.unref(f))!=null&&C.isEditable&&t.showFloatingMenu?(a.openBlock(),a.createBlock(oR,a.normalizeProps(a.mergeProps({key:2},g.value)),null,16)):a.createCommentVNode("",!0),(_=a.unref(f))!=null&&_.isEditable&&t.showSideMenu?(a.openBlock(),a.createBlock(mR,a.normalizeProps(a.mergeProps({key:3},b.value)),null,16)):a.createCommentVNode("",!0),a.createVNode(a.unref(m_),{class:a.normalizeClass(["editor-content",`${t.pageView}-view`]),editor:a.unref(f)},null,8,["class","editor"])],8,BR)}}}),DR={installed:!1,spellcheck:!0,install(t){this.installed=!0,t.component("YiiEditor",vb)}};exports.AddNode=Vm;exports.AiBlocks=Em;exports.AiProviders=km;exports.AskAiBlocks=wm;exports.BasicBlocks=Sr;exports.BlockMenus=jl;exports.Blocks=Ea;exports.Color=me;exports.ColorList=hC;exports.CommonBlocks=kr;exports.DefaultBubble=Sm;exports.DefaultEmbedServices=bC;exports.DefaultFloating=Am;exports.DefaultMenu=_m;exports.DragNode=zm;exports.ImageBubble=Nm;exports.ImageLinkBubble=Tm;exports.LinkBubble=xm;exports.MoreBubble=Om;exports.OAiMenu=mb;exports.OBlockList=_a;exports.OBlockListItem=Gl;exports.OBlockMenu=So;exports.OBlockPlaceholder=Jc;exports.OBlockPopover=Zn;exports.OBlockToolbar=Xc;exports.OBtn=St;exports.OBtnGroup=Hm;exports.OCalloutColorBoard=Zc;exports.OCalloutColorDropdown=qC;exports.OCheckbox=nu;exports.OColorBoard=Ca;exports.OCommandBtn=lt;exports.OCommonBtn=yn;exports.OContextMenu=xi;exports.ODivider=Lt;exports.ODocToc=nS;exports.OEmojiSelect=Sa;exports.OIcon=re;exports.OInput=Ln;exports.OLanguageDropdown=Dm;exports.OList=Qt;exports.OListItem=Ut;exports.OMainMenu=gb;exports.OMediaInput=Qc;exports.OMenubarBtn=Le;exports.OMetaInput=eu;exports.ONodeView=kn;exports.OPopover=Pe;exports.OTableCellBackground=Lm;exports.OTableGrid=Im;exports.OTextColorBoard=Pm;exports.OToast=tu;exports.OTooltip=Qn;exports.Prompts=Gc;exports.StyleBlocks=hi;exports.TableBubble=Mm;exports.TableFloating=gC;exports.TableMenu=Cm;exports.TableWrapperBubble=mC;exports.YiiEditor=vb;exports.YiiEditorPlugin=DR;exports.getProviderProp=jc;exports.useAi=Yc;exports.useI18n=ge;exports.useNodeView=Rm;exports.useTheme=xr;exports.useTiptap=Te;
|
|
199
|
+
//# sourceMappingURL=index.cjs.map
|