@dialpad/dialtone 9.4.0 → 9.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/css/CHANGELOG.json +1 -1
  2. package/dist/css/dialtone.css +4 -4
  3. package/dist/css/dialtone.min.css +1 -1
  4. package/dist/icons/svg/video-off.svg +1 -1
  5. package/dist/tokens/android/java/tokens-dark.kt +1 -1
  6. package/dist/tokens/android/java/tokens-light.kt +1 -1
  7. package/dist/tokens/android/res/values/colors-dark.xml +1 -1
  8. package/dist/tokens/android/res/values/colors-light.xml +1 -1
  9. package/dist/tokens/android/res/values/dimens.xml +1 -1
  10. package/dist/tokens/css/variables-dark.css +1 -1
  11. package/dist/tokens/css/variables-light.css +1 -1
  12. package/dist/tokens/ios/tokens-dark.swift +1 -1
  13. package/dist/tokens/ios/tokens-light.swift +1 -1
  14. package/dist/tokens/less/variables-dark.less +1 -1
  15. package/dist/tokens/less/variables-light.less +1 -1
  16. package/dist/vue2/dialtone-vue.cjs +1 -1
  17. package/dist/vue2/dialtone-vue.js +5 -5
  18. package/dist/vue2/{emoji-BMxSCSLg.js → emoji-k30EufQP.js} +697 -154
  19. package/dist/vue2/emoji-npEzXEju.cjs +1 -0
  20. package/dist/vue2/emoji.cjs +1 -1
  21. package/dist/vue2/emoji.js +3 -3
  22. package/dist/vue2/{emoji_picker-Qces1MZK.cjs → emoji_picker-h6ZjaaSm.cjs} +1 -1
  23. package/dist/vue2/{emoji_picker-sjGJ0HVH.js → emoji_picker-phIBLWjO.js} +1 -1
  24. package/dist/vue2/{emoji_text_wrapper-uHcCrlwz.js → emoji_text_wrapper-KU3Kyfko.js} +1 -1
  25. package/dist/vue2/{emoji_text_wrapper-Tni6PAOS.cjs → emoji_text_wrapper-KiKRUPpa.cjs} +1 -1
  26. package/dist/vue2/message_input.cjs +1 -1
  27. package/dist/vue2/message_input.js +3 -3
  28. package/dist/vue2/stack-Xl6jQs_C.cjs +2 -0
  29. package/dist/vue2/{stack-DRdhbSNl.js → stack-klSxDym-.js} +155 -695
  30. package/dist/vue2/types/components/button/button.vue.d.ts +1 -1
  31. package/dist/vue2/types/components/combobox/combobox.vue.d.ts +1 -1
  32. package/dist/vue2/types/components/icon/icon.vue.d.ts +2 -0
  33. package/dist/vue2/types/components/icon/icon.vue.d.ts.map +1 -1
  34. package/dist/vue2/types/components/modal/modal.vue.d.ts +1 -1
  35. package/dist/vue2/types/components/tooltip/tooltip.vue.d.ts +1 -1
  36. package/dist/vue2/types/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.d.ts +1 -1
  37. package/dist/vue2/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts +1 -1
  38. package/dist/vue3/dialtone-vue.cjs +1 -1
  39. package/dist/vue3/dialtone-vue.js +5 -5
  40. package/dist/vue3/emoji-0CxcYOpi.cjs +1 -0
  41. package/dist/vue3/{emoji-w7mkBLzY.js → emoji-qCvCxNzD.js} +876 -343
  42. package/dist/vue3/emoji.cjs +1 -1
  43. package/dist/vue3/emoji.js +3 -3
  44. package/dist/vue3/{emoji_picker-nLVt8cFZ.js → emoji_picker-6nxcKkgd.js} +1 -1
  45. package/dist/vue3/{emoji_picker-4xiNkfJF.cjs → emoji_picker-PNpV-epL.cjs} +1 -1
  46. package/dist/vue3/{emoji_text_wrapper-mBDw9Xy3.js → emoji_text_wrapper-GV9Xmp4q.js} +1 -1
  47. package/dist/vue3/{emoji_text_wrapper-MBYdbA6A.cjs → emoji_text_wrapper-M6frYocA.cjs} +1 -1
  48. package/dist/vue3/message_input.cjs +1 -1
  49. package/dist/vue3/message_input.js +3 -3
  50. package/dist/vue3/stack-CYxcB-QD.cjs +2 -0
  51. package/dist/vue3/{stack-FdfddyeK.js → stack-J7X4gRRv.js} +224 -764
  52. package/dist/vue3/types/components/button/button.vue.d.ts +1 -1
  53. package/dist/vue3/types/components/combobox/combobox.vue.d.ts +1 -1
  54. package/dist/vue3/types/components/icon/icon.vue.d.ts +2 -0
  55. package/dist/vue3/types/components/icon/icon.vue.d.ts.map +1 -1
  56. package/dist/vue3/types/components/modal/modal.vue.d.ts +1 -1
  57. package/dist/vue3/types/components/tooltip/tooltip.vue.d.ts +1 -1
  58. package/dist/vue3/types/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.d.ts +1 -1
  59. package/dist/vue3/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts +1 -1
  60. package/package.json +1 -1
  61. package/dist/vue2/emoji-ZkNhBVKW.cjs +0 -1
  62. package/dist/vue2/stack-153kJjKj.cjs +0 -2
  63. package/dist/vue3/emoji-AfK6oyUP.cjs +0 -1
  64. package/dist/vue3/stack-w8PNJngT.cjs +0 -2
@@ -1,4 +1,4 @@
1
- import { y, z as g, t as l, A as k } from "./emoji-BMxSCSLg.js";
1
+ import { z as y, A as g, w as l, B as k } from "./emoji-k30EufQP.js";
2
2
  import { n as _, D as w } from "./tooltip-PDBwUvGD.js";
3
3
  import "vue";
4
4
  const b = {
@@ -1,4 +1,4 @@
1
- import { D as o, I as i, p as a, r as l } from "./emoji-BMxSCSLg.js";
1
+ import { D as o, I as i, p as a, r as l } from "./emoji-k30EufQP.js";
2
2
  import { n as c } from "./tooltip-PDBwUvGD.js";
3
3
  const p = {
4
4
  name: "DtEmojiTextWrapper",
@@ -1 +1 @@
1
- "use strict";const n=require("./emoji-ZkNhBVKW.cjs"),o=require("./tooltip-RmgCyjmY.cjs"),l={name:"DtEmojiTextWrapper",components:{DtEmoji:n.DtEmoji},inheritAttrs:!1,props:{elementType:{type:String,default:"div"},size:{type:String,default:"500",validator:e=>Object.keys(n.ICON_SIZE_MODIFIERS).includes(e)}},data(){return{loadingEmojiJson:!0}},async created(){this.loadingEmojiJson=!1},methods:{replaceDtEmojis(e,t){const s=new RegExp(`(${e.join("|")})`,"g");return t.split(s).map(i=>e.includes(i)?this.$createElement(n.DtEmoji,{attrs:{class:"d-d-inline-block"},props:{code:i,size:this.size,...this.$attrs}}):i)},searchVNodes(e){if(!e.tag&&e.text)return this.searchCodes(e.text);const t=e.children?e.children.map(s=>this.searchVNodes(s)):[];return this.$createElement(e.tag,e.data,t)},replaceVueComponentVNodeContent(e){},searchCodes(e){const t=n.findShortCodes(e),s=n.findEmojis(e),r=[...t,...s];return r.length===0?e:this.replaceDtEmojis(r,e)}},render(e){const t=this.$slots.default||[];return e(this.elementType,this.loadingEmojiJson?t:t.map(s=>this.searchVNodes(s)))}},a=null,c=null;var p=o.normalizeComponent(l,a,c,!1,null,null,null,null);const d=p.exports;exports.DtEmojiTextWrapper=d;
1
+ "use strict";const n=require("./emoji-npEzXEju.cjs"),o=require("./tooltip-RmgCyjmY.cjs"),l={name:"DtEmojiTextWrapper",components:{DtEmoji:n.DtEmoji},inheritAttrs:!1,props:{elementType:{type:String,default:"div"},size:{type:String,default:"500",validator:e=>Object.keys(n.ICON_SIZE_MODIFIERS).includes(e)}},data(){return{loadingEmojiJson:!0}},async created(){this.loadingEmojiJson=!1},methods:{replaceDtEmojis(e,t){const s=new RegExp(`(${e.join("|")})`,"g");return t.split(s).map(i=>e.includes(i)?this.$createElement(n.DtEmoji,{attrs:{class:"d-d-inline-block"},props:{code:i,size:this.size,...this.$attrs}}):i)},searchVNodes(e){if(!e.tag&&e.text)return this.searchCodes(e.text);const t=e.children?e.children.map(s=>this.searchVNodes(s)):[];return this.$createElement(e.tag,e.data,t)},replaceVueComponentVNodeContent(e){},searchCodes(e){const t=n.findShortCodes(e),s=n.findEmojis(e),r=[...t,...s];return r.length===0?e:this.replaceDtEmojis(r,e)}},render(e){const t=this.$slots.default||[];return e(this.elementType,this.loadingEmojiJson?t:t.map(s=>this.searchVNodes(s)))}},a=null,c=null;var p=o.normalizeComponent(l,a,c,!1,null,null,null,null);const d=p.exports;exports.DtEmojiTextWrapper=d;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ve=require("vue"),Ce=require("./emoji-ZkNhBVKW.cjs"),te=require("./tooltip-RmgCyjmY.cjs"),Xi=require("./emoji_picker-Qces1MZK.cjs"),it=require("./stack-153kJjKj.cjs");function L(n){this.content=n}L.prototype={constructor:L,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new L(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new L(t)},addToStart:function(n,e){return new L([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new L(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new L(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=L.from(n),n.size?new L(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=L.from(n),n.size?new L(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=L.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};L.from=function(n){if(n instanceof L)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new L(e)};function Zi(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Zi(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Qi(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Qi(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class b{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(s+=l.text.slice(Math.max(e,a)-a,t-a),o=!r):l.isLeaf?(i?s+=typeof i=="function"?i(l):i:l.type.spec.leafText&&(s+=l.type.spec.leafText(l)),o=!r):!o&&l.isBlock&&(s+=r,o=!0)},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new b(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new b(r,i)}cutByIndex(e,t){return e==t?b.empty:e==0&&t==this.content.length?this:new b(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new b(i,s)}addToStart(e){return new b([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new b(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Zi(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Qi(this,e,t,r)}findIndex(e,t=-1){if(e==0)return Bt(0,e);if(e==this.size)return Bt(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||t>0?Bt(r+1,o):Bt(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return b.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new b(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return b.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new b(t||e,r)}static from(e){if(!e)return b.empty;if(e instanceof b)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new b([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}b.empty=new b([],0);const Fn={index:0,offset:0};function Bt(n,e){return Fn.index=n,Fn.offset=e,Fn}function jt(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!jt(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!jt(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let D=class ir{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&jt(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ir.none;if(e instanceof ir)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};D.none=[];class Vt extends Error{}class k{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=ts(this.content,e+this.openStart,t);return r&&new k(r,this.openStart,this.openEnd)}removeBetween(e,t){return new k(es(this.content,e+this.openStart,t+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,t){if(!t)return k.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new k(b.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new k(e,r,i)}}k.empty=new k(b.empty,0,0);function es(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(es(s.content,e-i-1,t-i-1)))}function ts(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=ts(o.content,e-s-1,t);return l&&n.replaceChild(i,o.copy(l))}function Ao(n,e,t){if(t.openStart>n.depth)throw new Vt("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Vt("Inconsistent open depths");return ns(n,e,t,0)}function ns(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=ns(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return Le(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Io(t,n);return Le(s,is(n,o,l,e,r))}else return Le(s,qt(n,e,r))}function rs(n,e){if(!e.type.compatibleContent(n.type))throw new Vt("Cannot join "+e.type.name+" onto "+n.type.name)}function sr(n,e,t){let r=n.node(t);return rs(r,e.node(t)),r}function ze(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function yt(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(ze(n.nodeAfter,r),s++));for(let l=s;l<o;l++)ze(i.child(l),r);e&&e.depth==t&&e.textOffset&&ze(e.nodeBefore,r)}function Le(n,e){return n.type.checkContent(e),n.copy(e)}function is(n,e,t,r,i){let s=n.depth>i&&sr(n,e,i+1),o=r.depth>i&&sr(t,r,i+1),l=[];return yt(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(rs(s,o),ze(Le(s,is(n,e,t,r,i+1)),l)):(s&&ze(Le(s,qt(n,e,i+1)),l),yt(e,t,i,l),o&&ze(Le(o,qt(t,r,i+1)),l)),yt(r,null,i,l),new b(l)}function qt(n,e,t){let r=[];if(yt(null,n,t,r),n.depth>t){let i=sr(n,e,t+1);ze(Le(i,qt(n,e,t+1)),r)}return yt(e,null,t,r),new b(r)}function Io(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(b.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Ot{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return D.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Wt(this,e,r);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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new Ot(t,r,s)}static resolveCached(e,t){for(let i=0;i<zn.length;i++){let s=zn[i];if(s.pos==t&&s.doc==e)return s}let r=zn[Ln]=Ot.resolve(e,t);return Ln=(Ln+1)%Ro,r}}let zn=[],Ln=0,Ro=12;class Wt{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}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 Bo=Object.create(null);let $e=class or{constructor(e,t,r,i=D.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||b.empty}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,t,r,i=0){this.content.nodesBetween(e,t,r,i,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,t,r,i){return this.content.textBetween(e,t,r,i)}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,t,r){return this.type==e&&jt(this.attrs,t||e.defaultAttrs||Bo)&&D.sameSet(this.marks,r||D.none)}copy(e=null){return e==this.content?this:new or(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new or(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return k.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new k(c,i.depth-o,s.depth-o)}replace(e,t,r){return Ao(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Ot.resolveCached(this,e)}resolveNoCache(e){return Ot.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),ss(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=b.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.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);let e=D.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!D.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=b.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};$e.prototype.text=void 0;class Ht extends $e{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ss(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ht(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ht(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ss(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class qe{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Fo(e,t);if(r.next==null)return qe.empty;let i=ls(r);r.next&&r.err("Unexpected trailing text");let s=qo(Vo(i));return Wo(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function s(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return b.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,l.concat(u));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[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 t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ve=require("vue"),Ce=require("./emoji-npEzXEju.cjs"),te=require("./tooltip-RmgCyjmY.cjs"),Xi=require("./emoji_picker-h6ZjaaSm.cjs"),it=require("./stack-Xl6jQs_C.cjs");function L(n){this.content=n}L.prototype={constructor:L,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new L(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new L(t)},addToStart:function(n,e){return new L([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new L(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new L(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=L.from(n),n.size?new L(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=L.from(n),n.size?new L(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=L.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};L.from=function(n){if(n instanceof L)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new L(e)};function Zi(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Zi(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Qi(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Qi(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class b{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(s+=l.text.slice(Math.max(e,a)-a,t-a),o=!r):l.isLeaf?(i?s+=typeof i=="function"?i(l):i:l.type.spec.leafText&&(s+=l.type.spec.leafText(l)),o=!r):!o&&l.isBlock&&(s+=r,o=!0)},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new b(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new b(r,i)}cutByIndex(e,t){return e==t?b.empty:e==0&&t==this.content.length?this:new b(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new b(i,s)}addToStart(e){return new b([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new b(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Zi(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Qi(this,e,t,r)}findIndex(e,t=-1){if(e==0)return Bt(0,e);if(e==this.size)return Bt(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||t>0?Bt(r+1,o):Bt(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return b.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new b(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return b.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new b(t||e,r)}static from(e){if(!e)return b.empty;if(e instanceof b)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new b([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}b.empty=new b([],0);const Fn={index:0,offset:0};function Bt(n,e){return Fn.index=n,Fn.offset=e,Fn}function jt(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!jt(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!jt(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let D=class ir{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&jt(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ir.none;if(e instanceof ir)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};D.none=[];class Vt extends Error{}class k{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=ts(this.content,e+this.openStart,t);return r&&new k(r,this.openStart,this.openEnd)}removeBetween(e,t){return new k(es(this.content,e+this.openStart,t+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,t){if(!t)return k.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new k(b.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new k(e,r,i)}}k.empty=new k(b.empty,0,0);function es(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(es(s.content,e-i-1,t-i-1)))}function ts(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=ts(o.content,e-s-1,t);return l&&n.replaceChild(i,o.copy(l))}function Ao(n,e,t){if(t.openStart>n.depth)throw new Vt("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Vt("Inconsistent open depths");return ns(n,e,t,0)}function ns(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=ns(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return Le(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Io(t,n);return Le(s,is(n,o,l,e,r))}else return Le(s,qt(n,e,r))}function rs(n,e){if(!e.type.compatibleContent(n.type))throw new Vt("Cannot join "+e.type.name+" onto "+n.type.name)}function sr(n,e,t){let r=n.node(t);return rs(r,e.node(t)),r}function ze(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function yt(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(ze(n.nodeAfter,r),s++));for(let l=s;l<o;l++)ze(i.child(l),r);e&&e.depth==t&&e.textOffset&&ze(e.nodeBefore,r)}function Le(n,e){return n.type.checkContent(e),n.copy(e)}function is(n,e,t,r,i){let s=n.depth>i&&sr(n,e,i+1),o=r.depth>i&&sr(t,r,i+1),l=[];return yt(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(rs(s,o),ze(Le(s,is(n,e,t,r,i+1)),l)):(s&&ze(Le(s,qt(n,e,i+1)),l),yt(e,t,i,l),o&&ze(Le(o,qt(t,r,i+1)),l)),yt(r,null,i,l),new b(l)}function qt(n,e,t){let r=[];if(yt(null,n,t,r),n.depth>t){let i=sr(n,e,t+1);ze(Le(i,qt(n,e,t+1)),r)}return yt(e,null,t,r),new b(r)}function Io(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(b.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Ot{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return D.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Wt(this,e,r);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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new Ot(t,r,s)}static resolveCached(e,t){for(let i=0;i<zn.length;i++){let s=zn[i];if(s.pos==t&&s.doc==e)return s}let r=zn[Ln]=Ot.resolve(e,t);return Ln=(Ln+1)%Ro,r}}let zn=[],Ln=0,Ro=12;class Wt{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}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 Bo=Object.create(null);let $e=class or{constructor(e,t,r,i=D.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||b.empty}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,t,r,i=0){this.content.nodesBetween(e,t,r,i,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,t,r,i){return this.content.textBetween(e,t,r,i)}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,t,r){return this.type==e&&jt(this.attrs,t||e.defaultAttrs||Bo)&&D.sameSet(this.marks,r||D.none)}copy(e=null){return e==this.content?this:new or(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new or(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return k.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new k(c,i.depth-o,s.depth-o)}replace(e,t,r){return Ao(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Ot.resolveCached(this,e)}resolveNoCache(e){return Ot.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),ss(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=b.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.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);let e=D.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!D.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=b.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};$e.prototype.text=void 0;class Ht extends $e{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ss(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ht(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ht(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ss(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class qe{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Fo(e,t);if(r.next==null)return qe.empty;let i=ls(r);r.next&&r.err("Unexpected trailing text");let s=qo(Vo(i));return Wo(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function s(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return b.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,l.concat(u));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[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 t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
2
2
  `)}}qe.empty=new qe(!0);class Fo{constructor(e,t){this.string=e,this.nodeTypes=t,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 ls(n){let e=[];do e.push(zo(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function zo(n){let e=[];do e.push(Lo(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Lo(n){let e=jo(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=$o(n,e);else break;return e}function Vr(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function $o(n,e){let t=Vr(n),r=t;return n.eat(",")&&(n.next!="}"?r=Vr(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function _o(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function jo(n){if(n.eat("(")){let e=ls(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=_o(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Vo(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();i(s(o.expr,a),u),a=u}if(o.max==-1)i(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),i(s(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function as(n,e){return e-n}function qr(n,e){let t=[];return r(e),t.sort(as);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&r(a)}}}function qo(n){let e=Object.create(null);return t(qr(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<i.length;u++)i[u][0]==l&&(c=i[u][1]);qr(n,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new qe(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(as);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}function Wo(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function cs(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function us(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function ds(n){let e=Object.create(null);if(n)for(let t in n)e[t]=new Ho(n[t]);return e}let Wr=class fs{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ds(r.attrs),this.defaultAttrs=cs(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==qe.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}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:us(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new $e(this,this.computeAttrs(e),b.from(t),D.setFrom(r))}createChecked(e=null,t,r){return t=b.from(t),this.checkContent(t),new $e(this,this.computeAttrs(e),t,D.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=b.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(b.empty,!0);return s?new $e(this,e,t.append(s),D.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).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)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:D.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new fs(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class Ho{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class tn{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=ds(i.attrs),this.excluded=null;let s=cs(this.attrs);this.instance=s?new D(this,s):null}create(e=null){return!e&&this.instance?this.instance:new D(this,us(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new tn(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class Jo{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=L.from(e.nodes),t.marks=L.from(e.marks||{}),this.nodes=Wr.compile(this.spec.nodes,this),this.marks=tn.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;s.contentMatch=r[o]||(r[o]=qe.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.markSet=l=="_"?null:l?Hr(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Hr(this,o.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,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Wr){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(t,r,i)}text(e,t){let r=this.nodes.text;return new Ht(r,r.defaultAttrs,e,D.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return $e.fromJSON(this,e)}markFromJSON(e){return D.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Hr(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],o=s;if(s)t.push(s);else for(let l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}class st{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(r=>{r.tag?this.tags.push(r):r.style&&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,t={}){let r=new Kr(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Kr(this,t,!0);return r.addAll(e,t.from,t.to),k.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Go(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Ur(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Ur(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new st(e,st.schemaRules(e)))}}const hs={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},Ko={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ps={ol:!0,ul:!0},Jt=1,Kt=2,bt=4;function Jr(n,e,t){return e!=null?(e?Jt:0)|(e==="full"?Kt:0):n&&n.whitespace=="pre"?Jt|Kt:t&~bt}class Ft{constructor(e,t,r,i,s,o,l){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=i,this.solid=s,this.options=l,this.content=[],this.activeMarks=D.none,this.stashMarks=[],this.match=o||(l&bt?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(b.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Jt)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=b.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(b.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;t<r.length;t++){let i=r[t];(this.type?this.type.allowsMarkType(i.type):Xo(i.type,e))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!hs.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Kr{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let i=t.topNode,s,o=Jr(null,t.preserveWhitespace,0)|(r?bt:0);i?s=new Ft(i.type,i.attrs,D.none,D.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new Ft(null,null,D.none,D.none,!0,null,o):s=new Ft(e.schema.topNodeType,null,D.none,D.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,t){let r=e.getAttribute("style");if(!r)return t();let i=this.readStyles(Yo(r));if(!i)return;let[s,o]=i,l=this.top;for(let a=0;a<o.length;a++)this.removePendingMark(o[a],l);for(let a=0;a<s.length;a++)this.addPendingMark(s[a]);t();for(let a=0;a<s.length;a++)this.removePendingMark(s[a],l);for(let a=0;a<o.length;a++)this.addPendingMark(o[a])}addTextNode(e){let t=e.nodeValue,r=this.top;if(r.options&Kt||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(r.options&Jt)r.options&Kt?t=t.replace(/\r\n?/g,`
3
3
  `):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],s=e.previousSibling;(!i||s&&s.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let r=e.nodeName.toLowerCase(),i;ps.hasOwnProperty(r)&&this.parser.normalizeLists&&Uo(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,t));if(s?s.ignore:Ko.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let o,l=this.top,a=this.needsBlock;if(hs.hasOwnProperty(r))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),o=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}s&&s.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),o&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,s,s.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=D.none,r=D.none;for(let i=0;i<e.length;i+=2)for(let s=void 0;;){let o=this.parser.matchStyle(e[i],e[i+1],this,s);if(!o)break;if(o.ignore)return null;if(o.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(l=>{o.clearMark(l)&&(r=l.addToSet(r))}):t=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(t),o.consuming===!1)s=o;else break}return[t,r]}addElementByRule(e,t,r){let i,s,o;t.node?(s=this.parser.schema.nodes[t.node],s.isLeaf?this.insertNode(s.create(t.attrs))||this.leafFallback(e):i=this.enter(s,t.attrs||null,t.preserveWhitespace)):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}i&&this.sync(l)&&this.open--,o&&this.removePendingMark(o,l)}addAll(e,t,r){let i=t||0;for(let s=t?e.childNodes[t]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,r=s,!o.length)||s.solid)break}if(!t)return!1;this.sync(r);for(let i=0;i<t.length;i++)this.enterInner(t[i],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let r=t.activeMarks;for(let i=0;i<e.marks.length;i++)(!t.type||t.type.allowsMarkType(e.marks[i].type))&&(r=e.marks[i].addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r){let i=this.findPlace(e.create(t));return i&&this.enterInner(e,t,!0,r),i}enterInner(e,t=null,r=!1,i){this.closeExtra();let s=this.top;s.applyPending(e),s.match=s.match&&s.match.matchType(e);let o=Jr(e,i,s.options);s.options&bt&&s.content.length==0&&(o|=bt),this.nodes.push(new Ft(e,t,s.activeMarks,s.pendingMarks,r,null,o)),this.open++}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=Zo(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==t)break}}}function Uo(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ps.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Go(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Yo(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function Ur(n){let e={};for(let t in n)e[t]=n[t];return e}function Xo(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}function Zo(n,e){for(let t=0;t<e.length;t++)if(n.eq(e[t]))return e[t]}class ae{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=$n(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=ae.renderSpec($n(t),this.nodes[e.type.name](e));if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&ae.renderSpec($n(r),i(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],s=i.indexOf(" ");s>0&&(r=i.slice(0,s),i=i.slice(s+1));let o,l=r?e.createElementNS(r,i):e.createElement(i),a=t[1],c=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){c=2;for(let u in a)if(a[u]!=null){let d=u.indexOf(" ");d>0?l.setAttributeNS(u.slice(0,d),u.slice(d+1),a[u]):l.setAttribute(u,a[u])}}for(let u=c;u<t.length;u++){let d=t[u];if(d===0){if(u<t.length-1||u>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:h}=ae.renderSpec(e,d,r);if(l.appendChild(f),h){if(o)throw new RangeError("Multiple content holes");o=h}}}return{dom:l,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ae(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Gr(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Gr(e.marks)}}function Gr(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function $n(n){return n.document||window.document}const ms=65535,gs=Math.pow(2,16);function Qo(n,e){return n+e*gs}function Yr(n){return n&ms}function el(n){return(n-(n&ms))/gs}const ys=1,bs=2,$t=4,ks=8;class lr{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&ks)>0}get deletedBefore(){return(this.delInfo&(ys|$t))>0}get deletedAfter(){return(this.delInfo&(bs|$t))>0}get deletedAcross(){return(this.delInfo&$t)>0}}class X{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&X.empty)return X.empty}recover(e){let t=0,r=Yr(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+el(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+s],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+i+(f<0?0:u);if(r)return h;let p=e==(t<0?a:d)?null:Qo(l/3,e-a),m=e==a?bs:e==d?ys:$t;return(t<0?e!=a:e!=d)&&(m|=ks),new lr(h,m,p)}i+=u-c}return r?e+i:new lr(e+i,0,null)}touches(e,t){let r=0,i=Yr(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),c=this.ranges[i+t],u=this.ranges[i+r];e(l,l+c,a,a+u),s+=u-c}}invert(){return new X(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?X.empty:new X(e<0?[0,-e,0]:[0,0,e])}}X.empty=new X([]);class kt{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new kt(this.maps,this.mirror,e,t)}copy(){return new kt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new kt;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this.maps[s],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this.maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new lr(e,i,null)}}const _n=Object.create(null);class q{getMap(){return X.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=_n[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in _n)throw new RangeError("Duplicate use of step JSON ID "+e);return _n[e]=t,t.prototype.jsonID=e,t}}class R{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new R(e,null)}static fail(e){return new R(null,e)}static fromReplace(e,t,r,i){try{return R.ok(e.replace(t,r,i))}catch(s){if(s instanceof Vt)return R.fail(s.message);throw s}}}function Mr(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(Mr(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return b.fromArray(r)}class xe extends q{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new k(Mr(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return R.fromReplace(e,this.from,this.to,s)}invert(){return new ce(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new xe(t.pos,r.pos,this.mark)}merge(e){return e instanceof xe&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xe(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new xe(t.from,t.to,e.markFromJSON(t.mark))}}q.jsonID("addMark",xe);class ce extends q{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new k(Mr(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return R.fromReplace(e,this.from,this.to,r)}invert(){return new xe(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ce(t.pos,r.pos,this.mark)}merge(e){return e instanceof ce&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ce(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ce(t.from,t.to,e.markFromJSON(t.mark))}}q.jsonID("removeMark",ce);class Oe extends q{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return R.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return R.fromReplace(e,this.pos,this.pos+1,new k(b.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Oe(this.pos,t.marks[i]);return new Oe(this.pos,this.mark)}}return new ot(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Oe(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Oe(t.pos,e.markFromJSON(t.mark))}}q.jsonID("addNodeMark",Oe);class ot extends q{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return R.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return R.fromReplace(e,this.pos,this.pos+1,new k(b.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Oe(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ot(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ot(t.pos,e.markFromJSON(t.mark))}}q.jsonID("removeNodeMark",ot);class $ extends q{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&ar(e,this.from,this.to)?R.fail("Structure replace would overwrite content"):R.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new X([this.from,this.to-this.from,this.slice.size])}invert(e){return new $(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new $(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof $)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?k.empty:new k(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new $(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?k.empty:new k(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new $(e.from,this.to,t,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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new $(t.from,t.to,k.fromJSON(e,t.slice),!!t.structure)}}q.jsonID("replace",$);class F extends q{constructor(e,t,r,i,s,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(ar(e,this.from,this.gapFrom)||ar(e,this.gapTo,this.to)))return R.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return R.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?R.fromReplace(e,this.from,this.to,r):R.fail("Content does not fit in gap")}getMap(){return new X([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new F(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=e.map(this.gapFrom,-1),s=e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new F(t.pos,r.pos,i,s,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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new F(t.from,t.to,t.gapFrom,t.gapTo,k.fromJSON(e,t.slice),t.insert,!!t.structure)}}q.jsonID("replaceAround",F);function ar(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function tl(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[m])?o.to=h:i.push(o=new ce(f,h,d[m])));l&&l.to==f?l.to=h:s.push(l=new xe(f,h,r))}}),i.forEach(a=>n.step(a)),s.forEach(a=>n.step(a))}function nl(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof tn){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<i.length;h++){let p=i[h];p.step==s-1&&d.eq(i[h].style)&&(f=p)}f?(f.to=c,f.step=s):i.push({style:d,from:Math.max(l,e),to:c,step:s})}}}),i.forEach(o=>n.step(new ce(o.from,o.to,o.style)))}function rl(n,e,t,r=t.contentMatch){let i=n.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l<i.childCount;l++){let a=i.child(l),c=o+a.nodeSize,u=r.matchType(a.type);if(!u)s.push(new $(o,c,k.empty));else{r=u;for(let d=0;d<a.marks.length;d++)t.allowsMarkType(a.marks[d].type)||n.step(new ce(o,c,a.marks[d]));if(a.isText&&!t.spec.code){let d,f=/\r?\n|\r/g,h;for(;d=f.exec(a.text);)h||(h=new k(b.from(t.schema.text(" ",t.allowedMarks(a.marks))),0,0)),s.push(new $(o+d.index,o+d.index+d[0].length,h))}}o=c}if(!r.validEnd){let l=r.fillBefore(b.empty,!0);n.replace(o,o,new k(l,0,0))}for(let l=s.length-1;l>=0;l--)n.step(s[l])}function il(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function ut(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(s,o,t))return r;if(r==0||i.type.spec.isolating||!il(i,s,o))break}return null}function sl(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),a=o,c=l,u=b.empty,d=0;for(let p=s,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,u=b.from(r.node(p).copy(u)),d++):a--;let f=b.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,f=b.from(i.node(p).copy(f)),h++):c++;n.step(new F(a,c,o,l,new k(u.append(f),d,h),u.size-d,!0))}function Ss(n,e,t=null,r=n){let i=ol(n,e),s=i&&ll(r,e);return s?i.map(Xr).concat({type:e,attrs:t}).concat(s.map(Xr)):null}function Xr(n){return{type:n,attrs:null}}function ol(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function ll(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function al(n,e,t){let r=b.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=b.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new F(i,s,i,s,new k(r,0,0),t.length,!0))}function cl(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{if(o.isTextblock&&!o.hasMarkup(r,i)&&ul(n.doc,n.mapping.slice(s).map(l),r)){n.clearIncompatible(n.mapping.slice(s).map(l,1),r);let a=n.mapping.slice(s),c=a.map(l,1),u=a.map(l+o.nodeSize,1);return n.step(new F(c,u,c+1,u-1,new k(b.from(r.create(i,null,o.marks)),0,0),1,!0)),!1}})}function ul(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function dl(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new F(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new k(b.from(o),0,0),1,!0))}function tt(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let d=i.node(c),f=i.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function fl(n,e,t=1,r){let i=n.doc.resolve(e),s=b.empty,o=b.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=b.from(i.node(l).copy(s));let u=r&&r[c];o=b.from(u?u.type.create(u.attrs,o):i.node(l).copy(o))}n.step(new $(e,e,new k(s.append(o),t,t),!0))}function Je(n,e){let t=n.resolve(e),r=t.index();return xs(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function xs(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function Os(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&xs(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function hl(n,e,t){let r=new $(e-t,e+t,k.empty,!0);n.step(r)}function pl(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function ml(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(a,a,i);else{let d=c.contentMatchAt(a).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function Cr(n,e,t=e,r=k.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Ms(i,s,r)?new $(e,t,r):new gl(i,s,r).fit()}function Ms(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class gl{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=b.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=b.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new k(s,o,l);return e>-1?new F(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new $(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=jn(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(t==1&&(o?c.matchType(o.type)||(d=c.fillBefore(b.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:d};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=jn(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new k(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=jn(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new k(pt(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new k(pt(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)u.push(i.child(m));d=d.matchFragment(i)}let h=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let m=l.child(c),g=d.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(d=g,u.push(Cs(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=mt(this.placed,t,b.from(u)),this.frontier[t].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<h;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?k.empty:new k(pt(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new k(pt(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Vn(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=Vn(e,t,i,r,s);if(o){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Vn(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=mt(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=mt(this.placed,this.depth,b.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(b.empty,!0);t.childCount&&(this.placed=mt(this.placed,this.frontier.length,t))}}function pt(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(pt(n.firstChild.content,e-1,t)))}function mt(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(mt(n.lastChild.content,e-1,t)))}function jn(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Cs(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Cs(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(b.empty,!0)))),n.copy(r)}function Vn(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!yl(t,s.content,o)?l:null}function yl(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function bl(n){return n.spec.defining||n.spec.definingForContent}function kl(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(Ms(i,s,r))return n.step(new $(e,t,r));let o=vs(i,n.doc.resolve(t));o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?l=f:i.before(f)==h&&o.splice(1,0,-f)}let a=o.indexOf(l),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=bl(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m<o.length;m++){let g=o[(m+a)%o.length],y=!0;g<0&&(y=!1,g=-g);let x=i.node(g-1),w=i.index(g-1);if(x.canReplaceWith(w,w,p.type,p.marks))return n.replace(i.before(g),y?s.after(g):t,new k(ws(r.content,0,r.openStart,h),h,r.openEnd))}}let d=n.steps.length;for(let f=o.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>d));f--){let h=o[f];h<0||(e=i.before(h),t=s.after(h))}}function ws(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(ws(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(b.empty,!0))}return n}function Sl(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=pl(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new k(b.from(r),0,0))}function xl(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=vs(r,i);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o)return n.delete(r.before(o),t);n.delete(e,t)}function vs(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class nt extends q{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return R.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return R.fromReplace(e,this.pos,this.pos+1,new k(b.from(i),0,t.isLeaf?0:1))}getMap(){return X.empty}invert(e){return new nt(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new nt(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new nt(t.pos,t.attr,t.value)}}q.jsonID("attr",nt);class Mt extends q{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return R.ok(r)}getMap(){return X.empty}invert(e){return new Mt(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Mt(t.attr,t.value)}}q.jsonID("docAttr",Mt);let lt=class extends Error{};lt=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};lt.prototype=Object.create(Error.prototype);lt.prototype.constructor=lt;lt.prototype.name="TransformError";class Ts{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new kt}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new lt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=k.empty){let i=Cr(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new k(b.from(r),0,0))}delete(e,t){return this.replace(e,t,k.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return kl(this,e,t,r),this}replaceRangeWith(e,t,r){return Sl(this,e,t,r),this}deleteRange(e,t){return xl(this,e,t),this}lift(e,t){return sl(this,e,t),this}join(e,t=1){return hl(this,e,t),this}wrap(e,t){return al(this,e,t),this}setBlockType(e,t=e,r,i=null){return cl(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return dl(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new nt(e,t,r)),this}setDocAttribute(e,t){return this.step(new Mt(e,t)),this}addNodeMark(e,t){return this.step(new Oe(e,t)),this}removeNodeMark(e,t){if(!(t instanceof D)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new ot(e,t)),this}split(e,t=1,r){return fl(this,e,t,r),this}addMark(e,t,r){return tl(this,e,t,r),this}removeMark(e,t,r){return nl(this,e,t,r),this}clearIncompatible(e,t,r){return rl(this,e,t,r),this}}const qn=Object.create(null);class v{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Ol(e.min(t),e.max(t))]}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 t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=k.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],u=e.mapping.slice(s);e.replaceRange(u.map(a.pos),u.map(c.pos),l?k.empty:t),l==0&&ei(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],a=e.mapping.slice(r),c=a.map(o.pos),u=a.map(l.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),ei(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new T(e):Xe(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?Xe(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):Xe(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new ie(e.node(0))}static atStart(e){return Xe(e,e,0,0,1)||new ie(e)}static atEnd(e){return Xe(e,e,e.content.size,e.childCount,-1)||new ie(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=qn[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in qn)throw new RangeError("Duplicate use of selection JSON ID "+e);return qn[e]=t,t.prototype.jsonID=e,t}getBookmark(){return T.between(this.$anchor,this.$head).getBookmark()}}v.prototype.visible=!0;class Ol{constructor(e,t){this.$from=e,this.$to=t}}let Zr=!1;function Qr(n){!Zr&&!n.parent.inlineContent&&(Zr=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class T extends v{constructor(e,t=e){Qr(e),Qr(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return v.near(r);let i=e.resolve(t.map(this.anchor));return new T(i.parent.inlineContent?i:r,r)}replace(e,t=k.empty){if(super.replace(e,t),t==k.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof T&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new nn(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new T(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=v.findFrom(t,r,!0)||v.findFrom(t,-r,!0);if(s)t=s.$head;else return v.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(v.findFrom(e,-r,!0)||v.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new T(e,t)}}v.jsonID("text",T);class nn{constructor(e,t){this.anchor=e,this.head=t}map(e){return new nn(e.map(this.anchor),e.map(this.head))}resolve(e){return T.between(e.resolve(this.anchor),e.resolve(this.head))}}class O extends v{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return r?v.near(s):new O(s)}content(){return new k(b.from(this.node),0,0)}eq(e){return e instanceof O&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new wr(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new O(e.resolve(t.anchor))}static create(e,t){return new O(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}O.prototype.visible=!1;v.jsonID("node",O);class wr{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new nn(r,r):new wr(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&O.isSelectable(r)?new O(t):v.near(t)}}class ie extends v{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=k.empty){if(t==k.empty){e.delete(0,e.doc.content.size);let r=v.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new ie(e)}map(e){return new ie(e)}eq(e){return e instanceof ie}getBookmark(){return Ml}}v.jsonID("all",ie);const Ml={map(){return this},resolve(n){return new ie(n)}};function Xe(n,e,t,r,i,s=!1){if(e.inlineContent)return T.create(n,t);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&O.isSelectable(l))return O.create(n,t-(i<0?l.nodeSize:0))}else{let a=Xe(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function ei(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof $||i instanceof F))return;let s=n.mapping.maps[r],o;s.forEach((l,a,c,u)=>{o==null&&(o=u)}),n.setSelection(v.near(n.doc.resolve(o),t))}const ti=1,zt=2,ni=4;class Cl extends Ts{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|ti)&~zt,this.storedMarks=null,this}get selectionSet(){return(this.updated&ti)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=zt,this}ensureMarks(e){return D.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&zt)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~zt,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||D.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(v.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,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|=ni,this}get scrolledIntoView(){return(this.updated&ni)>0}}function ri(n,e){return!e||!n?n:n.bind(e)}class gt{constructor(e,t,r){this.name=e,this.init=ri(t.init,r),this.apply=ri(t.apply,r)}}const wl=[new gt("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new gt("selection",{init(n,e){return n.selection||v.atStart(e.doc)},apply(n){return n.selection}}),new gt("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new gt("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Wn{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=wl.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new gt(r.key,r.spec.state,r))})}}class Qe{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,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=i?i[o].n:0,c=i?i[o].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),s=!0}i&&(i[o]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Qe(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new Cl(this)}static create(e){let t=new Wn(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Qe(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new Wn(this.schema,e.plugins),r=t.fields,i=new Qe(t);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Wn(e.schema,e.plugins),s=new Qe(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=$e.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=v.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function Ns(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Ns(i,e,{})),t[r]=i}return t}class ne{constructor(e){this.spec=e,this.props={},e.props&&Ns(e.props,this,this.props),this.key=e.key?e.key.key:Es("plugin")}getState(e){return e[this.key]}}const Hn=Object.create(null);function Es(n){return n in Hn?n+"$"+ ++Hn[n]:(Hn[n]=0,n+"$")}class oe{constructor(e="key"){this.key=Es(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const W=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Ct=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let ii=null;const ge=function(n,e,t){let r=ii||(ii=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},We=function(n,e,t,r){return t&&(si(n,e,t,r,-1)||si(n,e,t,r,1))},vl=/^(img|br|input|textarea|hr)$/i;function si(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:le(n))){let s=n.parentNode;if(!s||s.nodeType!=1||vr(n)||vl.test(n.nodeName)||n.contentEditable=="false")return!1;e=W(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?le(n):0}else return!1}}function le(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Tl(n,e,t){for(let r=e==0,i=e==le(n);r||i;){if(n==t)return!0;let s=W(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==le(n)}}function vr(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const rn=function(n){return n.focusNode&&We(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Ie(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Nl(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function El(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:r.startOffset}}}const ue=typeof navigator<"u"?navigator:null,oi=typeof document<"u"?document:null,Ee=ue&&ue.userAgent||"",cr=/Edge\/(\d+)/.exec(Ee),Ps=/MSIE \d/.exec(Ee),ur=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ee),Y=!!(Ps||ur||cr),we=Ps?document.documentMode:ur?+ur[1]:cr?+cr[1]:0,se=!Y&&/gecko\/(\d+)/i.test(Ee);se&&+(/Firefox\/(\d+)/.exec(Ee)||[0,0])[1];const dr=!Y&&/Chrome\/(\d+)/.exec(Ee),V=!!dr,Pl=dr?+dr[1]:0,H=!Y&&!!ue&&/Apple Computer/.test(ue.vendor),at=H&&(/Mobile\/\w+/.test(Ee)||!!ue&&ue.maxTouchPoints>2),Q=at||(ue?/Mac/.test(ue.platform):!1),Dl=ue?/Win/.test(ue.platform):!1,re=/Android \d/.test(Ee),Pt=!!oi&&"webkitFontSmoothing"in oi.documentElement.style,Al=Pt?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Il(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function pe(n,e){return typeof n=="number"?n:n[e]}function Rl(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function li(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;o=Ct(o)){if(o.nodeType!=1)continue;let l=o,a=l==s.body,c=a?Il(s):Rl(l),u=0,d=0;if(e.top<c.top+pe(r,"top")?d=-(c.top-e.top+pe(i,"top")):e.bottom>c.bottom-pe(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+pe(i,"top")-c.top:e.bottom-c.bottom+pe(i,"bottom")),e.left<c.left+pe(r,"left")?u=-(c.left-e.left+pe(i,"left")):e.right>c.right-pe(r,"right")&&(u=e.right-c.right+pe(i,"right")),u||d)if(a)s.defaultView.scrollBy(u,d);else{let f=l.scrollLeft,h=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let p=l.scrollLeft-f,m=l.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function Bl(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=n.root.elementFromPoint(s,o);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:Ds(n.dom)}}function Ds(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Ct(r));return e}function Fl({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;As(t,r==0?0:r-e)}function As(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:s}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Ge=null;function zl(n){if(n.setActive)return n.setActive();if(Ge)return n.focus(Ge);let e=Ds(n);n.focus(Ge==null?{get preventScroll(){return Ge={preventScroll:!0},!0}}:void 0),Ge||(Ge=!1,As(e,0))}function Is(n,e){let t,r=2e8,i,s=0,o=e.top,l=e.top,a,c;for(let u=n.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=ge(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){t=u,r=m,i=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?Ll(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Is(t,i)}function Ll(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let s=be(r,1);if(s.top!=s.bottom&&Tr(e,s))return{node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function Tr(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function $l(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function _l(n,e,t){let{node:r,offset:i}=Is(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function jl(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent&&!o||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&!o&&(o=!0,a.left>r.left||a.top>r.top?i=l.posBefore:(a.right<r.left||a.bottom<r.top)&&(i=l.posAfter)),!l.contentDOM&&i<0&&!l.node.isText)return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}s=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function Rs(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=n.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Tr(e,c))return Rs(o,e,c)}}if((s=(s+1)%r)==i)break}return n}function Vl(n,e){let t=n.dom.ownerDocument,r,i=0,s=El(t,e.left,e.top);s&&({node:r,offset:i}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!Tr(e,c)||(o=Rs(n.dom,e,c),!o))return null}if(H)for(let c=o;r&&c;c=Ct(c))c.draggable&&(r=void 0);if(o=$l(o,e),r){if(se&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;Pt&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=jl(n,r,i,e))}l==null&&(l=_l(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function ai(n){return n.top<n.bottom||n.left<n.right}function be(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(ai(r))return r}return Array.prototype.find.call(t,ai)||n.getBoundingClientRect()}const ql=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Bs(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=Pt||se;if(r.nodeType==3)if(o&&(ql.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=be(ge(r,i,i),t);if(se&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=be(ge(r,i-1,i-1),-1);if(c.top==a.top){let u=be(ge(r,i,i+1),-1);if(u.top!=a.top)return ht(u,u.left<c.left)}}return a}else{let a=i,c=i,u=t<0?1:-1;return t<0&&!i?(c++,u=-1):t>=0&&i==r.nodeValue.length?(a--,u=1):t<0?a--:c++,ht(be(ge(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==le(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Jn(a.getBoundingClientRect(),!1)}if(s==null&&i<le(r)){let a=r.childNodes[i];if(a.nodeType==1)return Jn(a.getBoundingClientRect(),!0)}return Jn(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==le(r))){let a=r.childNodes[i-1],c=a.nodeType==3?ge(a,le(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return ht(be(c,1),!1)}if(s==null&&i<le(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?ge(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return ht(be(c,-1),!0)}return ht(be(r.nodeType==3?ge(r):r,-t),t>=0)}function ht(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Jn(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Fs(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function Wl(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return Fs(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=Bs(n,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=ge(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const Hl=/[\u0590-\u08ac]/;function Jl(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=n.domSelection();return!Hl.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:Fs(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=n.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),g})}let ci=null,ui=null,di=!1;function Kl(n,e,t){return ci==e&&ui==t?di:(ci=e,ui=t,di=t=="up"||t=="down"?Wl(n,e,t):Jl(n,e,t))}const ee=0,fi=1,Re=2,de=3;class Dt{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=ee,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].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 t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.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,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>W(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.size;if(l>e||o instanceof Ls){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof zs&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?W(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?W(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,l=0;;l++){let a=this.children[l],c=o+a.size;if(i==-1&&e<=c){let u=o+a.border;if(e>=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=o;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=W(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=W(d.dom);break}t+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let f=0,h=0;f<this.children.length;f++){let p=this.children[f],m=h+p.size;if(s>h&&o<m)return p.setSelection(e-h-p.border,t-h-p.border,r,i);h=m}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.getSelection(),u=!1;if((se||H)&&e==t){let{node:f,offset:h}=l;if(f.nodeType==3){if(u=!!(h&&f.nodeValue[h-1]==`
@@ -1,8 +1,8 @@
1
1
  import kt, { markRaw as Ki } from "vue";
2
- import { D as Ui, m as Io, o as Gi, x as Ro, t as Bo, A as Fo } from "./emoji-BMxSCSLg.js";
2
+ import { D as Ui, m as Io, o as Gi, y as Ro, w as Bo, B as Fo } from "./emoji-k30EufQP.js";
3
3
  import { n as qe, t as Yi, f as zo, l as Lo, D as $o } from "./tooltip-PDBwUvGD.js";
4
- import { e as _o, D as jo } from "./emoji_picker-sjGJ0HVH.js";
5
- import { D as Vo, a as Xi, b as qo, c as Wo, d as Ho } from "./stack-DRdhbSNl.js";
4
+ import { e as _o, D as jo } from "./emoji_picker-phIBLWjO.js";
5
+ import { D as Vo, a as Xi, b as qo, c as Wo, d as Ho } from "./stack-klSxDym-.js";
6
6
  function L(n) {
7
7
  this.content = n;
8
8
  }
@@ -0,0 +1,2 @@
1
+ "use strict";const o=require("./tooltip-RmgCyjmY.cjs"),i=require("./emoji-npEzXEju.cjs"),h=require("vue"),l={BUSY:"busy",AWAY:"away",OFFLINE:"offline",ACTIVE:"active"},A=[l.BUSY,l.AWAY,l.OFFLINE,l.ACTIVE],z={name:"DtPresence",props:{presence:{type:String,default:l.ACTIVE,validator:t=>A.includes(t)},srText:{type:String,default:null}}};var K=function(){var e=this,n=e._self._c;return n("div",{staticClass:"d-presence",attrs:{"data-qa":"dt-presence",role:"status","aria-live":e.$attrs.ariaLive||"off"}},[e.srText?n("span",{staticClass:"sr-only",attrs:{"data-qa":"dt-presence-sr-text"}},[e._v(e._s(e.srText)+" ")]):e._e(),n("div",{staticClass:"d-presence__inner",class:{"d-presence__inner--active":e.presence==="active","d-presence__inner--away":e.presence==="away","d-presence__inner--busy":e.presence==="busy","d-presence__inner--offline":e.presence==="offline"}})])},j=[],G=o.normalizeComponent(z,K,j,!1,null,null,null,null);const T=G.exports,u={xs:"d-avatar--xs",sm:"d-avatar--sm",md:"d-avatar--md",lg:"d-avatar--lg",xl:"d-avatar--xl"},P={default:"",icon:"d-avatar__icon",initials:"d-avatar__initials"},D={md:"d-avatar__presence--md",lg:"d-avatar__presence--lg"},y={NONE:"",BUSY:"busy",AWAY:"away",OFFLINE:"offline",ACTIVE:"active"},w={xs:"100",sm:"200",md:"300",lg:"500",xl:"600"},R=["100","200","300","400","500","600","700","800","900","1000","1100","1200","1300","1400","1500","1600","1700","1800"],v=t=>t>1;function U(){return[void 0,...i.iconNames]}const W=t=>{if(typeof t!="string"||!t.trim())return"";const e=t.trim().split(/\s+/g);return e.length===1?e.join("").substring(0,2):e.filter((n,s)=>s===0||s===e.length-1).map(n=>n.slice(0,1).toUpperCase()).join("")},Y=U(),Z={name:"DtAvatar",components:{DtPresence:T,DtIcon:i.DtIcon},inheritAttrs:!1,props:{id:{type:String,default(){return o.getUniqueString()}},seed:{type:String,default:void 0},color:{type:String,default:void 0},size:{type:String,default:"md",validator:t=>Object.keys(u).includes(t)},avatarClass:{type:[String,Array,Object],default:""},canvasClass:{type:[String,Array,Object],default:""},iconClass:{type:[String,Array,Object],default:""},presence:{type:String,default:y.NONE,validator:t=>Object.values(y).includes(t)},presenceProps:{type:Object,default:()=>({})},group:{type:Number,default:void 0,validator:t=>v(t)},overlayIcon:{type:String,default:""},overlayText:{type:String,default:""},overlayClass:{type:[String,Array,Object],default:""},imageSrc:{type:String,default:""},imageAlt:{type:String,default:""},iconName:{type:String,default:void 0,validator:t=>Y.includes(t)},iconSize:{type:String,default:"",validator:t=>!t||Object.keys(i.ICON_SIZE_MODIFIERS).includes(t)},fullName:{type:String,default:""},clickable:{type:Boolean,default:!1}},emits:["click"],data(){return{AVATAR_SIZE_MODIFIERS:u,AVATAR_KIND_MODIFIERS:P,AVATAR_PRESENCE_SIZE_MODIFIERS:D,AVATAR_ICON_SIZES:w,imageLoadedSuccessfully:null,formattedInitials:"",initializing:!1}},computed:{isNotIconType(){return!this.iconName},avatarClasses(){return["d-avatar",u[this.validatedSize],this.avatarClass,{"d-avatar--group":this.showGroup,[`d-avatar--color-${this.getColor()}`]:this.isNotIconType,"d-avatar--clickable":this.clickable}]},overlayClasses(){return["d-avatar__overlay",this.overlayClass]},showGroup(){return v(this.group)},formattedGroup(){return this.group>99?"99+":this.group},validatedSize(){return this.group?"xs":this.size},showImage(){return this.imageLoadedSuccessfully!==!1&&this.imageSrc},buttonAriaLabel(){if(this.clickable)return this.fullName||this.imageAlt||this.$attrs["aria-label"]}},watch:{fullName:{immediate:!0,handler(){this.formatInitials()}},size:{immediate:!0,handler(){this.formatInitials()}},group:{immediate:!0,handler(){this.formatInitials()}},imageSrc(t){this.imageLoadedSuccessfully=null,t&&(this.validateProps(),this.setImageListeners())}},mounted(){this.validateProps(),this.setImageListeners()},methods:{async setImageListeners(){await this.$nextTick();const t=this.$refs.avatarImage;t&&(t.addEventListener("load",()=>this._loadedImageEventHandler(t),{once:!0}),t.addEventListener("error",()=>this._erroredImageEventHandler(t),{once:!0}))},formatInitials(){const t=W(this.fullName);this.validatedSize==="xs"?this.formattedInitials="":this.validatedSize==="sm"?this.formattedInitials=t[0]:this.formattedInitials=t},getColor(){return this.color??o.getRandomElement(R,this.seed)},_loadedImageEventHandler(t){this.imageLoadedSuccessfully=!0,t.classList.remove("d-d-none")},_erroredImageEventHandler(t){this.imageLoadedSuccessfully=!1,t.classList.add("d-d-none")},validateProps(){if(this.imageSrc&&!(this.fullName||this.imageAlt))throw new Error("full-name or image-alt must be set if image-src is provided")},handleClick(t){this.clickable&&this.$emit("click",t)}}};var X=function(){var e=this,n=e._self._c;return n(e.clickable?"button":"div",{tag:"component",class:e.avatarClasses,attrs:{id:e.id,"data-qa":"dt-avatar","aria-label":e.buttonAriaLabel},on:{click:e.handleClick}},[n("div",{ref:"canvas",class:[e.canvasClass,"d-avatar__canvas",{"d-avatar--image-loaded":e.imageLoadedSuccessfully}]},[e.showImage?n("img",{ref:"avatarImage",staticClass:"d-avatar__image",attrs:{"data-qa":"dt-avatar-image",src:e.imageSrc,alt:e.imageAlt||e.fullName}}):e.iconName?n("dt-icon",{class:[e.iconClass,e.AVATAR_KIND_MODIFIERS.icon],attrs:{name:e.iconName,size:e.iconSize||e.AVATAR_ICON_SIZES[e.size],"data-qa":"dt-avatar-icon"}}):n("span",{class:[e.AVATAR_KIND_MODIFIERS.initials]},[e._v(" "+e._s(e.formattedInitials)+" ")])],1),e.overlayIcon||e.overlayText?n("div",{class:e.overlayClasses},[e.overlayIcon?n("dt-icon",{staticClass:"d-avatar__overlay-icon",attrs:{name:e.overlayIcon}}):e.overlayText?n("p",{staticClass:"d-avatar__overlay-text"},[e._v(" "+e._s(e.overlayText)+" ")]):e._e()],1):e._e(),e.showGroup?n("span",{staticClass:"d-avatar__count",attrs:{"data-qa":"dt-avatar-count"}},[e._v(e._s(e.formattedGroup))]):e._e(),e.presence&&!e.showGroup?n("dt-presence",e._b({class:["d-avatar__presence",e.AVATAR_PRESENCE_SIZE_MODIFIERS[e.size]],attrs:{presence:e.presence,"data-qa":"dt-presence"}},"dt-presence",e.presenceProps,!1)):e._e()],1)},J=[],Q=o.normalizeComponent(Z,X,J,!1,null,null,null,null);const ee=Q.exports,te={name:"DtLink",props:{kind:{type:String,default:"",validator(t){return i.LINK_VARIANTS.includes(t)}}},emits:["click","focusin","focusout"],data(){return{LINK_KIND_MODIFIERS:i.LINK_KIND_MODIFIERS}}};var ne=function(){var e=this,n=e._self._c;return n("a",e._g({class:["d-link",e.LINK_KIND_MODIFIERS[e.kind]],attrs:{"data-qa":"dt-link",href:"href"in e.$attrs?e.$attrs.href:"javascript:void(0)"}},e.$listeners),[e._t("default")],2)},se=[],oe=o.normalizeComponent(te,ne,se,!1,null,null,null,null);const ie=oe.exports,L={props:{visuallyHiddenClose:{type:Boolean,default:!1},visuallyHiddenCloseLabel:{type:String,default:null}},watch:{$props:{immediate:!0,deep:!0,handler(){this.validateVisuallyHiddenCloseProps()}}},computed:{showVisuallyHiddenClose(){return this.visuallyHiddenClose&&this.visuallyHiddenCloseLabel!=null}},methods:{validateVisuallyHiddenCloseProps(){this.visuallyHiddenClose&&!this.visuallyHiddenCloseLabel&&console.error(`If visuallyHiddenClose prop is true, the component includes
2
+ a visually hidden close button and you must set the visuallyHiddenCloseLabel prop.`)}}},ae={name:"SrOnlyCloseButton",components:{DtIcon:i.DtIcon,DtButton:i.DtButton},props:{visuallyHiddenCloseLabel:{type:String,default:null}},emits:["close"],methods:{close(){this.$emit("close")}}};var re=function(){var e=this,n=e._self._c;return n("dt-button",{staticClass:"d-vi-visible-sr",attrs:{id:"sr-only-close-button","data-qa":"dt-sr-only-close-button","aria-label":e.visuallyHiddenCloseLabel},on:{click:e.close,keydown:function(s){return!s.type.indexOf("key")&&e._k(s.keyCode,"space",32,s.key,[" ","Spacebar"])?null:(s.preventDefault(),s.stopPropagation(),e.close.apply(null,arguments))}}},[n("dt-icon",{attrs:{name:"close"}})],1)},le=[],de=o.normalizeComponent(ae,re,le,!1,null,null,null,null);const $=de.exports,k=':not(:disabled):not([aria-disabled="true"]):not([role="presentation"])',ce=`${k}:not([tabindex="-1"])`,ue="button,[href],input,select,textarea,details,[tabindex]",N={methods:{async getFirstFocusableElement(t){await this.$nextTick();const e=this._getFocusableElements(t,!0);return this._getFirstFocusElement(e)},async focusFirstElement(t=this.$el){const e=await this.getFirstFocusableElement(t);e==null||e.focus({preventScroll:!0})},async focusElementById(t){var n;await this.$nextTick();const e=(n=this.$el)==null?void 0:n.querySelector(t);if(e){e.focus();return}console.warn('Could not find the element specified in dt-modal prop "initialFocusElement". Defaulting to focusing the first element.'),await this.focusFirstElement()},_getFirstFocusElement(t){if(!t.length)return;let e=t[0];return e.matches('[type="radio"]:not(:checked)')&&(e=t.find(n=>n.checked&&n.name===e.name)||e),e},_getFocusableElements(t=this.$el,e=!1){return t?[...t.querySelectorAll(ue)].filter(s=>{const a=window.getComputedStyle(s);return a.getPropertyValue("display")!=="none"&&a.getPropertyValue("visibility")!=="hidden"&&s.matches(e?k:ce)}):[]},focusTrappedTabPress(t,e){if(!(t.key==="Tab"))return;const s=this._getFocusableElements(e);if(!s.length){t.preventDefault();return}const a=this._getFirstFocusElement(s),b=s[s.length-1];t.shiftKey?document.activeElement===a&&(b.focus(),t.preventDefault()):document.activeElement===b&&(a.focus(),t.preventDefault())}}},p={DEFAULT:"default",CUSTOM:"custom"},d={ARROW_KEYS:"arrow-keys",TAB:"tab",NONE:"none"},pe={name:"DtItemLayout",props:{as:{type:String,default:"div"}}};var fe=function(){var e=this,n=e._self._c;return n(e.as,{tag:"component",staticClass:"dt-item-layout"},[e.$slots.left?n("section",{staticClass:"dt-item-layout--left",attrs:{"data-qa":"dt-item-layout-left-wrapper"}},[e._t("left")],2):e._e(),n("section",{staticClass:"dt-item-layout--content",attrs:{"data-qa":"dt-item-layout-content-wrapper"}},[e.$slots.default?n("div",{staticClass:"dt-item-layout--title",attrs:{"data-qa":"dt-item-layout-title-wrapper"}},[e._t("default")],2):e._e(),e.$slots.subtitle?n("div",{class:["dt-item-layout--subtitle",{"dt-item-layout--subtitle--with-title":e.$slots.default}],attrs:{"data-qa":"dt-item-layout-subtitle-wrapper"}},[e._t("subtitle")],2):e._e(),e.$slots.bottom?n("div",{staticClass:"dt-item-layout--bottom",attrs:{"data-qa":"dt-item-layout-bottom-wrapper"}},[e._t("bottom")],2):e._e()]),e.$slots.right?n("section",{staticClass:"dt-item-layout--right",attrs:{"data-qa":"dt-item-layout-right-wrapper"}},[e._t("right")],2):e._e(),e.$slots.selected?n("section",{staticClass:"dt-item-layout--selected",attrs:{"data-qa":"dt-item-layout-selected-wrapper"}},[e._t("selected")],2):e._e()])},he=[],me=o.normalizeComponent(pe,fe,he,!1,null,"411cb81e",null,null);const g=me.exports,_e={name:"DtListItem",components:{DtItemLayout:g,DtIcon:i.DtIcon},inject:{highlightId:{default:null}},props:{id:{type:String,default(){return o.utils.getUniqueString()}},role:{type:String,default:"listitem"},elementType:{type:String,default:"li"},type:{type:String,default:p.DEFAULT,validator:t=>Object.values(p).includes(t)},navigationType:{type:String,default:d.NONE,validator:t=>Object.values(d).includes(t)},selected:{type:Boolean,default:!1}},emits:["click","keydown","mousemove","mouseleave"],data(){return{injected:!1,mouseHighlighted:!1}},computed:{listItemType(){switch(this.type){case p.DEFAULT:return g;default:return null}},listItemListeners(){return{...this.$listeners,keydown:t=>{["enter","space"].includes(t.code.toLowerCase())&&this.onClick(t),this.$emit("keydown",t)},mousemove:t=>{this.onMouseHover(t),this.$emit("mousemove",t)},mouseleave:t=>{this.onMouseLeave(t),this.$emit("mouseleave",t)}}},isHighlighted(){return this.isHoverable?this.highlightId&&this.highlightId()?this.id===this.highlightId():this.mouseHighlighted:!1},isFocusable(){return this.navigationType===d.TAB},isHoverable(){return this.navigationType!==d.NONE}},methods:{onClick(t){this.$emit("click",t)},onMouseHover(){this.mouseHighlighted=!0},onMouseLeave(){this.mouseHighlighted=!1}}};var ye=function(){var e=this,n=e._self._c;return n(e.elementType,e._g({tag:"component",class:["dt-list-item",{"dt-list-item--focusable":e.isFocusable,"dt-list-item--highlighted":e.isHighlighted,"dt-list-item--static":!e.isHoverable}],attrs:{id:e.id,tabindex:e.isFocusable?0:-1,role:e.role,"aria-selected":e.isHighlighted}},e.listItemListeners),[e.listItemType?n(e.listItemType,{tag:"component",scopedSlots:e._u([e._l(e.$slots,function(s,a){return{key:a,fn:function(){return[e._t(a)]},proxy:!0}}),e.selected?{key:"selected",fn:function(){return[n("dt-icon",{staticClass:"dt-list-item--selected-icon",attrs:{name:"check",size:"400"}})]},proxy:!0}:null],null,!0)}):e._t("default")],2)},ve=[],ge=o.normalizeComponent(_e,ye,ve,!1,null,null,null,null);const Se=ge.exports,r={default:"column",column:"column",row:"row","row-reverse":"row-reverse","column-reverse":"column-reverse"},E=["sm","md","lg","xl"],m=["0","100","200","300","400","500","600"],S={none:void 0,small:"d-p4",medium:"d-p8",large:"d-p16"},x={none:void 0,small:"d-pl4",medium:"d-pl8",large:"d-pl16"},F=["dialog","menu","listbox","tree","grid"],V=["","anchor"],B=["none","dialog","first"],H=["parent","body"],q=[...o.TIPPY_STICKY_VALUES],Ee=[...o.BASE_TIPPY_DIRECTIONS];let Ie="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",be=(t=21)=>{let e="",n=t;for(;n--;)e+=Ie[Math.random()*64|0];return e};function f(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?f=function(e){return typeof e}:f=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(t)}var M={selector:"vue-portal-target-".concat(be())},Ce=function(e){return M.selector=e},_=typeof window<"u"&&(typeof document>"u"?"undefined":f(document))!==void 0,Oe=h.extend({abstract:!0,name:"PortalOutlet",props:["nodes","tag"],data:function(e){return{updatedNodes:e.nodes}},render:function(e){var n=this.updatedNodes&&this.updatedNodes();return n?n.length===1&&!n[0].text?n:e(this.tag||"DIV",n):e()},destroyed:function(){var e=this.$el;e&&e.parentNode.removeChild(e)}}),I=h.extend({name:"VueSimplePortal",props:{disabled:{type:Boolean},prepend:{type:Boolean},selector:{type:String,default:function(){return"#".concat(M.selector)}},tag:{type:String,default:"DIV"}},render:function(e){if(this.disabled){var n=this.$scopedSlots&&this.$scopedSlots.default();return n?n.length<2&&!n[0].text?n:e(this.tag,n):e()}return e()},created:function(){this.getTargetEl()||this.insertTargetEl()},updated:function(){var e=this;this.$nextTick(function(){!e.disabled&&e.slotFn!==e.$scopedSlots.default&&(e.container.updatedNodes=e.$scopedSlots.default),e.slotFn=e.$scopedSlots.default})},beforeDestroy:function(){this.unmount()},watch:{disabled:{immediate:!0,handler:function(e){e?this.unmount():this.$nextTick(this.mount)}}},methods:{getTargetEl:function(){if(_)return document.querySelector(this.selector)},insertTargetEl:function(){if(_){var e=document.querySelector("body"),n=document.createElement(this.tag);n.id=this.selector.substring(1),e.appendChild(n)}},mount:function(){if(_){var e=this.getTargetEl(),n=document.createElement("DIV");this.prepend&&e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n),this.container=new Oe({el:n,parent:this,propsData:{tag:this.tag,nodes:this.$scopedSlots.default}})}},unmount:function(){this.container&&(this.container.$destroy(),delete this.container)}}});function Ae(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};t.component(e.name||"portal",I),e.defaultSelector&&Ce(e.defaultSelector)}typeof window<"u"&&window.Vue&&window.Vue===h&&h.use(Ae);const Te={name:"PopoverHeaderFooter",components:{DtButton:i.DtButton,DtIcon:i.DtIcon},props:{type:{type:String,validator:function(t){return["header","footer"].includes(t)}},contentClass:{type:[String,Array,Object],default:""},showCloseButton:{type:Boolean,default:!1},closeButtonProps:{type:Object,default:()=>{}}},emits:["close"],methods:{focusCloseButton(){var e;const t=(e=this.$refs["popover__close-button"])==null?void 0:e.$el;t==null||t.focus()}}};var Pe=function(){var e=this,n=e._self._c;return n("div",{class:{"d-popover__header":e.type==="header","d-popover__footer":e.type==="footer"},attrs:{"data-qa":"dt-popover-header-footer"}},[e.$slots.content?n("div",{class:[{"d-popover__header__content":e.type==="header","d-popover__footer__content":e.type==="footer"},e.contentClass],attrs:{"data-qa":"dt-popover-header-footer-content"}},[e._t("content")],2):e._e(),e.showCloseButton?n("dt-button",e._b({ref:"popover__close-button",class:{"d-popover__header__close-button":e.type==="header","d-popover__footer__close-button":e.type==="footer"},attrs:{"data-qa":"dt-popover-close",importance:"outlined",kind:"muted",circle:""},on:{click:function(s){return e.$emit("close")}},scopedSlots:e._u([{key:"icon",fn:function(){return[n("dt-icon",{attrs:{name:"close",size:"300"}})]},proxy:!0}],null,!1,2538694920)},"dt-button",e.closeButtonProps,!1)):e._e()],1)},De=[],we=o.normalizeComponent(Te,Pe,De,!1,null,null,null,null);const Re=we.exports,Le={name:"DtPopover",components:{SrOnlyCloseButton:$,DtLazyShow:o.DtLazyShow,PopoverHeaderFooter:Re,Portal:I},mixins:[N,L],props:{open:{type:Boolean,default:null},openOnContext:{type:Boolean,default:!1},elementType:{type:String,default:"div"},transition:{type:String,default:"fade"},role:{type:String,default:"dialog",validator:t=>F.includes(t)},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null},closeButtonProps:{type:Object,default:()=>({})},padding:{type:String,default:"large",validator:t=>Object.keys(S).some(e=>e===t)},contentClass:{type:[String,Array,Object],default:""},contentWidth:{type:String,default:"",validator:t=>V.includes(t)},contentTabindex:{type:Number||null,default:-1},externalAnchor:{type:String,default:""},id:{type:String,default(){return o.getUniqueString()}},offset:{type:Array,default:()=>[0,4]},hideOnClick:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},fallbackPlacements:{type:Array,default:()=>["auto"]},placement:{type:String,default:"bottom-end"},tether:{type:Boolean,default:!0},sticky:{type:[Boolean,String],default:!1,validator:t=>q.includes(t)},maxHeight:{type:String,default:""},maxWidth:{type:String,default:""},showCloseButton:{type:Boolean,default:!1},headerClass:{type:[String,Array,Object],default:""},footerClass:{type:[String,Array,Object],default:""},dialogClass:{type:[String,Array,Object],default:""},initialFocusElement:{type:[String,HTMLElement],default:"first",validator:t=>B.includes(t)||t instanceof HTMLElement||t.startsWith("#")},openWithArrowKeys:{type:Boolean,default:!1},appendTo:{type:[HTMLElement,String],default:"body",validator:t=>H.includes(t)||t instanceof HTMLElement}},emits:["opened","update:open"],data(){return{POPOVER_PADDING_CLASSES:S,POPOVER_HEADER_FOOTER_PADDING_CLASSES:x,intersectionObserver:null,isOutsideViewport:!1,isOpen:!1,anchorEl:null,popoverContentEl:null}},computed:{popoverListeners(){return{...this.$listeners,keydown:t=>{this.onKeydown(t),this.$emit("keydown",t)},"after-leave":t=>{this.onLeaveTransitionComplete()},"after-enter":t=>{this.onEnterTransitionComplete()}}},calculatedMaxHeight(){return this.isOutsideViewport&&this.modal?"calc(100vh - var(--dt-space-300))":this.maxHeight},labelledBy(){return this.ariaLabelledby||!this.ariaLabel&&o.getUniqueString("DtPopover__anchor")}},watch:{$props:{immediate:!0,deep:!0,handler(){this.validateProps()}},modal(t){var e;(e=this.tip)==null||e.setProps({zIndex:t?650:this.calculateAnchorZindex()})},offset(t){var e;(e=this.tip)==null||e.setProps({offset:t})},sticky(t){var e;(e=this.tip)==null||e.setProps({sticky:t})},fallbackPlacements(){var t;(t=this.tip)==null||t.setProps({popperOptions:this.popperOptions()})},tether(){var t;(t=this.tip)==null||t.setProps({popperOptions:this.popperOptions()})},placement(t){var e;(e=this.tip)==null||e.setProps({placement:t})},open:{handler:function(t){t!==null&&(this.isOpen=t)},immediate:!0},isOpen(t,e){t?(this.initTippyInstance(),this.tip.show()):!t&&e!==t&&(this.removeEventListeners(),this.tip.hide())}},mounted(){const t=this.externalAnchor?this.$refs.anchor.getRootNode().querySelector(`#${this.externalAnchor}`):null;this.anchorEl=t??this.$refs.anchor.children[0],this.popoverContentEl=this.$refs.content.$el,this.isOpen&&(this.initTippyInstance(),this.tip.show()),this.intersectionObserver=new IntersectionObserver(this.hasIntersectedViewport),this.intersectionObserver.observe(this.popoverContentEl)},beforeDestroy(){var t;(t=this.tip)==null||t.destroy(),this.intersectionObserver.disconnect(),this.removeReferences(),this.removeEventListeners()},methods:{hasIntersectedViewport(t){var s;const e=(s=t==null?void 0:t[0])==null?void 0:s.target;if(!e)return;const n=o.isOutOfViewPort(e);this.isOutsideViewport=n.bottom||n.top},popperOptions(){return o.getPopperOptions({fallbackPlacements:this.fallbackPlacements,tether:this.tether,hasHideModifierEnabled:!0})},validateProps(){this.modal&&this.initialFocusElement==="none"&&console.error('If the popover is modal you must set the initialFocusElement prop. Possible values: "dialog", "first", HTMLElement')},calculateAnchorZindex(){var t;return this.$el.getRootNode().querySelector('.d-modal[aria-hidden="false"], .d-modal--transparent[aria-hidden="false"]')||(t=this.anchorEl)!=null&&t.closest(".d-zi-drawer")?650:300},defaultToggleOpen(t){var e,n;this.openOnContext||(this.open??((e=this.anchorEl)!=null&&e.contains(t.target)&&!((n=this.anchorEl)!=null&&n.disabled)&&this.toggleOpen()))},async onContext(t){this.openOnContext&&(t.preventDefault(),this.isOpen=!0,await this.$nextTick(),this.tip.setProps({placement:"right-start",getReferenceClientRect:()=>({width:0,height:0,top:t.clientY,bottom:t.clientY,left:t.clientX,right:t.clientX})}))},toggleOpen(){this.isOpen=!this.isOpen},onArrowKeyPress(t){var e;this.open===null&&this.openWithArrowKeys&&(e=this.anchorEl)!=null&&e.contains(t.target)&&(this.isOpen||(this.isOpen=!0))},addEventListeners(){window.addEventListener("dt-popover-close",this.closePopover),this.contentWidth==="anchor"&&window.addEventListener("resize",this.onResize)},removeEventListeners(){window.removeEventListener("dt-popover-close",this.closePopover),this.contentWidth==="anchor"&&window.removeEventListener("resize",this.onResize)},closePopover(){this.isOpen=!1},preventScrolling(){var t;if(this.modal){const e=(t=this.anchorEl)==null?void 0:t.closest("body, .tippy-box");e.tagName.toLowerCase()==="body"?(e.classList.add("d-of-hidden"),this.tip.setProps({offset:this.offset})):e.classList.add("d-zi-popover")}},enableScrolling(){var e,n;const t=(e=this.anchorEl)==null?void 0:e.closest("body, .tippy-box");t&&(((n=t.tagName)==null?void 0:n.toLowerCase())==="body"?(t.classList.remove("d-of-hidden"),this.tip.setProps({offset:this.offset})):t.classList.remove("d-zi-popover"))},removeReferences(){this.anchorEl=null,this.popoverContentEl=null,this.tip=null},async onShow(){this.contentWidth==="anchor"&&await this.setPopoverContentAnchorWidth(),this.contentWidth===null&&(this.popoverContentEl.style.width="auto"),this.addEventListeners()},async onLeaveTransitionComplete(){var t;this.modal&&(await this.focusFirstElement(this.$refs.anchor),await this.$nextTick(),this.enableScrolling()),(t=this.tip)==null||t.unmount(),this.$emit("opened",!1),this.open!==null&&this.$emit("update:open",!1)},async onEnterTransitionComplete(){this.focusInitialElement(),await this.$nextTick(),this.preventScrolling(),this.$emit("opened",!0,this.$refs.popover__content),this.open!==null&&this.$emit("update:open",!0)},focusInitialElement(){this.initialFocusElement==="dialog"&&this.$refs.content.$el.focus(),this.initialFocusElement.startsWith("#")&&this.focusInitialElementById(),this.initialFocusElement==="first"&&this.focusFirstElementIfNeeded(this.$refs.popover__content),this.initialFocusElement instanceof HTMLElement&&this.initialFocusElement.focus()},focusInitialElementById(){var e,n,s;const t=(n=(e=this.$refs.content)==null?void 0:e.$el)==null?void 0:n.querySelector(this.initialFocusElement);t?t.focus():console.warn('Could not find the element specified in dt-popover prop "initialFocusElement". Defaulting to focusing the dialog.'),t?t.focus():(s=this.$refs.content)==null||s.$el.focus()},onResize(){this.closePopover()},onClickOutside(){if(!this.hideOnClick)return;this.popoverContentEl.querySelector(".d-popover__anchor--opened")||this.closePopover()},onKeydown(t){t.key==="Tab"&&this.modal&&this.focusTrappedTabPress(t,this.popoverContentEl),t.key==="Escape"&&this.closePopover()},async setPopoverContentAnchorWidth(){var t;await this.$nextTick(),this.popoverContentEl.style.width=`${(t=this.anchorEl)==null?void 0:t.clientWidth}px`},focusFirstElementIfNeeded(t){var n,s;this._getFocusableElements(t,!0).length!==0?this.focusFirstElement(t):this.showCloseButton?(n=this.$refs.popover__header)==null||n.focusCloseButton():(s=this.$refs.content)==null||s.$el.focus()},initTippyInstance(){var t,e;this.tip=o.createTippy(this.anchorEl,{popperOptions:this.popperOptions(),contentElement:this.popoverContentEl,placement:this.placement,offset:this.offset,sticky:this.sticky,appendTo:this.appendTo==="body"?(e=(t=this.anchorEl)==null?void 0:t.getRootNode())==null?void 0:e.querySelector("body"):this.appendTo,interactive:!0,trigger:"manual",hideOnClick:!1,zIndex:this.modal?650:this.calculateAnchorZindex(),onClickOutside:this.onClickOutside,onShow:this.onShow})}}};var $e=function(){var e=this,n=e._self._c;return n("div",[e.modal&&e.isOpen?n("portal",[n("div",{staticClass:"d-modal--transparent",attrs:{"aria-hidden":e.modal&&e.isOpen?"false":"true"},on:{click:function(s){s.preventDefault(),s.stopPropagation()}}})]):e._e(),n(e.elementType,e._g({ref:"popover",tag:"component",class:["d-popover",{"d-popover__anchor--opened":e.isOpen}],attrs:{"data-qa":"dt-popover-container"}},e.$listeners),[n("div",{ref:"anchor",attrs:{id:!e.ariaLabelledby&&e.labelledBy,"data-qa":"dt-popover-anchor",tabindex:e.openOnContext?0:void 0},on:{"!click":function(s){return e.defaultToggleOpen.apply(null,arguments)},contextmenu:e.onContext,keydown:[function(s){return!s.type.indexOf("key")&&e._k(s.keyCode,"up",38,s.key,["Up","ArrowUp"])?null:(s.preventDefault(),e.onArrowKeyPress.apply(null,arguments))},function(s){return!s.type.indexOf("key")&&e._k(s.keyCode,"down",40,s.key,["Down","ArrowDown"])?null:(s.preventDefault(),e.onArrowKeyPress.apply(null,arguments))}],"!keydown":function(s){return!s.type.indexOf("key")&&e._k(s.keyCode,"escape",void 0,s.key,void 0)?null:e.closePopover.apply(null,arguments)}}},[e._t("anchor",null,{attrs:{"aria-expanded":e.isOpen.toString(),"aria-controls":e.id,"aria-haspopup":e.role}})],2),n("dt-lazy-show",e._g({ref:"content",class:["d-popover__dialog",{"d-popover__dialog--modal":e.modal},e.dialogClass],style:{"max-height":e.calculatedMaxHeight,"max-width":e.maxWidth},attrs:{id:e.id,role:e.role,"data-qa":"dt-popover","aria-hidden":`${!e.isOpen}`,"aria-labelledby":e.labelledBy,"aria-label":e.ariaLabel,"aria-modal":`${!e.modal}`,transition:e.transition,show:e.isOpen,tabindex:e.contentTabindex,appear:""}},e.popoverListeners),[e.$slots.headerContent||e.showCloseButton?n("popover-header-footer",{ref:"popover__header",class:e.POPOVER_HEADER_FOOTER_PADDING_CLASSES[e.padding],attrs:{"content-class":e.headerClass,type:"header","show-close-button":e.showCloseButton,"close-button-props":e.closeButtonProps},on:{close:e.closePopover},scopedSlots:e._u([{key:"content",fn:function(){return[e._t("headerContent",null,{close:e.closePopover})]},proxy:!0}],null,!0)}):e._e(),n("div",{ref:"popover__content",class:["d-popover__content",e.POPOVER_PADDING_CLASSES[e.padding],e.contentClass],attrs:{"data-qa":"dt-popover-content"}},[e._t("content",null,{close:e.closePopover})],2),e.$slots.footerContent?n("popover-header-footer",{ref:"popover__footer",class:e.POPOVER_HEADER_FOOTER_PADDING_CLASSES[e.padding],attrs:{type:"footer","content-class":e.footerClass},scopedSlots:e._u([{key:"content",fn:function(){return[e._t("footerContent",null,{close:e.closePopover})]},proxy:!0}],null,!0)}):e._e(),e.showVisuallyHiddenClose?n("sr-only-close-button",{attrs:{"visually-hidden-close-label":e.visuallyHiddenCloseLabel},on:{close:e.closePopover}}):e._e()],1)],1)],1)},ke=[],Ne=o.normalizeComponent(Le,$e,ke,!1,null,null,null,null);const xe=Ne.exports;function C(t){return t===r.default}function O(t){if(c(t)==="string")return C(t)?null:r[t];if(c(t)==="object"){const{default:e}=t;return C(e)?null:r[e]}else return null}function c(t){return typeof t}function Fe(t){return O(t)?`d-stack--${r[O(t)]}`:null}function Ve(t){return c(t)==="object"?[...E.map(e=>t[e]?`d-stack--${e}--${t[e]}`:null)]:null}function Be(t){return m.includes(t)?`d-stack--gap-${t}`:null}function He(t){if(c(t)==="string")return Object.keys(r).includes(t);if(c(t)==="object"){const{default:e}=t;return Object.keys(r).includes(e)}else return null}function qe(t){return m.includes(t)}const Me={name:"DtStack",props:{direction:{type:[String,Object],default:"column",validator:t=>He(t)},as:{type:String,default:"div"},gap:{type:String,default:"0",validator:t=>qe(t)}},data(){return{DT_STACK_DIRECTION:r,DT_STACK_GAP:m,DT_STACK_RESPONSIVE_BREAKPOINTS:E}},computed:{stackGap(){return Be(this.gap)},defaultDirection(){return Fe(this.direction)},stackResponsive(){return Ve(this.direction)}}};var ze=function(){var e=this,n=e._self._c;return n(e.as,{tag:"component",class:["d-stack",e.defaultDirection,e.stackResponsive,e.stackGap]},[e._t("default")],2)},Ke=[],je=o.normalizeComponent(Me,ze,Ke,!1,null,null,null,null);const Ge=je.exports;exports.AVATAR_COLORS=R;exports.AVATAR_GROUP_VALIDATOR=v;exports.AVATAR_ICON_SIZES=w;exports.AVATAR_KIND_MODIFIERS=P;exports.AVATAR_PRESENCE_SIZE_MODIFIERS=D;exports.AVATAR_PRESENCE_STATES=y;exports.AVATAR_SIZE_MODIFIERS=u;exports.DT_STACK_DIRECTION=r;exports.DT_STACK_GAP=m;exports.DT_STACK_RESPONSIVE_BREAKPOINTS=E;exports.DtAvatar=ee;exports.DtItemLayout=g;exports.DtLink=ie;exports.DtListItem=Se;exports.DtPopover=xe;exports.DtPresence=T;exports.DtStack=Ge;exports.LIST_ITEM_NAVIGATION_TYPES=d;exports.LIST_ITEM_TYPES=p;exports.Modal=N;exports.POPOVER_APPEND_TO_VALUES=H;exports.POPOVER_CONTENT_WIDTHS=V;exports.POPOVER_DIRECTIONS=Ee;exports.POPOVER_HEADER_FOOTER_PADDING_CLASSES=x;exports.POPOVER_INITIAL_FOCUS_STRINGS=B;exports.POPOVER_PADDING_CLASSES=S;exports.POPOVER_ROLES=F;exports.POPOVER_STICKY_VALUES=q;exports.PRESENCE_STATES=l;exports.PRESENCE_STATES_LIST=A;exports.Portal=I;exports.SrOnlyCloseButton=$;exports.SrOnlyCloseButtonMixin=L;