@tempots/beatui 0.87.3 → 0.87.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ar-DjMvIww5.js → ar-Dn7AkNO5.js} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +1 -1
- package/dist/{auth-divider-BIefTDoO.js → auth-divider-BZPM2Xd3.js} +101 -103
- package/dist/{auth-divider-V_Se6Qhe.cjs → auth-divider-Cj-xJxF_.cjs} +1 -1
- package/dist/better-auth/index.cjs.js +1 -1
- package/dist/better-auth/index.es.js +12 -12
- package/dist/{colors-BmLYKmoH.js → colors-CatA-RXf.js} +9 -9
- package/dist/{de-wChFYqM4.js → de-QYhBiWv7.js} +1 -1
- package/dist/deep-merge-BmxkFFi1.cjs +1 -0
- package/dist/{deep-merge-BRqRzEQs.js → deep-merge-D076XcC5.js} +152 -156
- package/dist/{duration-input-BDEb1Bb7.js → duration-input-6RN16H08.js} +5 -5
- package/dist/{duration-input-BtFL5Vjx.cjs → duration-input-CJU-yeKk.cjs} +1 -1
- package/dist/{editor-toolbar-group-CwCCGzEC.js → editor-toolbar-group-DRCbXeQP.js} +6 -3
- package/dist/{es-CmPF3IGl.js → es-Ba31pZAd.js} +1 -1
- package/dist/{fa-D696e75R.js → fa-DvLjl_Ha.js} +1 -1
- package/dist/{fr-B0jeX1Hx.js → fr-D64yBpAp.js} +1 -1
- package/dist/{he-SgAsIYJA.js → he-DHZGEQ7C.js} +1 -1
- package/dist/{hi-s9oiIihq.js → hi-CeAXVCvp.js} +1 -1
- package/dist/{index-CaWDj1Vg.cjs → index-BIGCKfNz.cjs} +10 -10
- package/dist/{index-DdqGL9Jk.js → index-BTITknMc.js} +701 -684
- package/dist/{index-qa82MK4Z.cjs → index-Bso_SkEn.cjs} +1 -1
- package/dist/{index-B0t-nt7i.js → index-DWDC-qRY.js} +4 -4
- package/dist/{index-D2_J_-XS.js → index-rHnH2IGb.js} +77 -77
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +1015 -1018
- package/dist/{index.esm-ChUrm4xR.js → index.esm-By0m3ki1.js} +3 -3
- package/dist/{input-container-DhUiLmXE.js → input-container-BTyCOubf.js} +1 -1
- package/dist/{it-Dc4IMciD.js → it-Im0KgKWL.js} +1 -1
- package/dist/{ja-D2t2g5xj.js → ja-lliCbC19.js} +1 -1
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +97 -103
- package/dist/json-schema-display/index.cjs.js +1 -1
- package/dist/json-schema-display/index.es.js +15 -15
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +349 -351
- package/dist/{ko-BRylA5JZ.js → ko-B9W4RBBs.js} +1 -1
- package/dist/lexical/index.cjs.js +5 -12
- package/dist/lexical/index.es.js +54 -84
- package/dist/{menu-Ui4lUPHM.js → menu-CV85y3Xf.js} +1 -1
- package/dist/{modal-Dkje8L_l.js → modal-CD3DwAlD.js} +5 -5
- package/dist/{modal-Coenk8Fy.cjs → modal-jJMS0ZlW.cjs} +1 -1
- package/dist/monaco/index.es.js +1 -1
- package/dist/{nl-Dh7LUWAn.js → nl-ba5SyHsw.js} +1 -1
- package/dist/notice-9lpZ-VDn.cjs +1 -0
- package/dist/{notice-BmkckDsD.js → notice-Cc26kgiB.js} +26 -28
- package/dist/{oneof-branch-detection-Vov_e3kI.cjs → oneof-branch-detection-BsGhMslW.cjs} +6 -6
- package/dist/{oneof-branch-detection-BED_n2MT.js → oneof-branch-detection-DiAtgGQH.js} +1740 -1734
- package/dist/{pl-XEG-p1Q9.js → pl-DCiJAZWC.js} +1 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/{pt-DYsDA2sZ.js → pt-Df5bAGWA.js} +1 -1
- package/dist/{ru-BTKBykp-.js → ru-Dg-c670Y.js} +1 -1
- package/dist/stack-4VUGISn6.cjs +1 -0
- package/dist/{stack-BJgsPJ9A.js → stack-Bm-UZosx.js} +145 -139
- package/dist/tailwind/preset.es.js +2 -2
- package/dist/tailwind/vite-plugin.es.js +1 -1
- package/dist/{text-input-BZmAB3_o.js → text-input-Cux5iiUC.js} +5 -5
- package/dist/{theme-BzpMLdvH.js → theme-kQZEeusG.js} +4 -4
- package/dist/{toolbar-Pdj-F80l.js → toolbar-DYmKrtic.js} +1 -1
- package/dist/{tr-Cp8ZCUic.js → tr-Dhpiq0u_.js} +1 -1
- package/dist/{translations-BGblCUBj.js → translations-BLlzvZgw.js} +30 -30
- package/dist/{translations-jUYta1_1.js → translations-COSDzhvR.js} +1 -1
- package/dist/types/auth-i18n/translations.d.ts +2 -2
- package/dist/types/beatui-i18n/translations.d.ts +2 -2
- package/dist/types/better-auth/components/authenticated.d.ts +2 -2
- package/dist/types/better-auth/components/better-auth-container.d.ts +1 -1
- package/dist/types/better-auth/i18n/translations.d.ts +2 -2
- package/dist/types/better-auth/provider.d.ts +2 -2
- package/dist/types/components/auth/auth-container.d.ts +1 -1
- package/dist/types/components/auth/auth-email-prop.d.ts +1 -1
- package/dist/types/components/beatui.d.ts +1 -1
- package/dist/types/components/button/button.d.ts +1 -1
- package/dist/types/components/content/native-pdf-preview.d.ts +1 -1
- package/dist/types/components/content/pdfjs-preview.d.ts +1 -1
- package/dist/types/components/data/icon.d.ts +1 -1
- package/dist/types/components/data/page-drop-zone.d.ts +1 -1
- package/dist/types/components/data/unstyled-drop-zone.d.ts +1 -1
- package/dist/types/components/editor-toolbar/editor-toolbar-button.d.ts +1 -1
- package/dist/types/components/editor-toolbar/editor-toolbar-group.d.ts +1 -1
- package/dist/types/components/form/control/control.d.ts +2 -2
- package/dist/types/components/form/control/ensure-control.d.ts +1 -1
- package/dist/types/components/form/control/list-control.d.ts +1 -1
- package/dist/types/components/form/controller/color-controller.d.ts +4 -4
- package/dist/types/components/form/input/appearance-selector.d.ts +2 -2
- package/dist/types/components/form/input/base64-input.d.ts +1 -1
- package/dist/types/components/form/input/base64s-input.d.ts +1 -1
- package/dist/types/components/form/input/combobox-tags-input.d.ts +1 -1
- package/dist/types/components/form/input/email-input.d.ts +1 -1
- package/dist/types/components/form/input/file-input.d.ts +1 -1
- package/dist/types/components/form/input/files-input.d.ts +1 -1
- package/dist/types/components/form/input/input-options.d.ts +1 -1
- package/dist/types/components/form/input/list-input.d.ts +1 -1
- package/dist/types/components/form/input/nullable-base64-input.d.ts +1 -1
- package/dist/types/components/form/input/nullable-plain-date-input.d.ts +12 -12
- package/dist/types/components/form/input/nullable-plain-date-time-input.d.ts +12 -12
- package/dist/types/components/form/input/nullable-plain-time-input.d.ts +12 -12
- package/dist/types/components/form/input/nullable-plain-year-month-input.d.ts +12 -12
- package/dist/types/components/form/input/password-input.d.ts +1 -1
- package/dist/types/components/form/input/plain-date-input.d.ts +12 -12
- package/dist/types/components/form/input/plain-date-time-input.d.ts +12 -12
- package/dist/types/components/form/input/plain-time-input.d.ts +12 -12
- package/dist/types/components/form/input/plain-year-month-input.d.ts +12 -12
- package/dist/types/components/form/input/select-tags-input.d.ts +3 -3
- package/dist/types/components/form/use-form.d.ts +3 -3
- package/dist/types/components/i18n/locale-direction.d.ts +1 -1
- package/dist/types/components/i18n/locale-selector.d.ts +1 -1
- package/dist/types/components/i18n/locale.d.ts +1 -1
- package/dist/types/components/i18n/make-i18nprovider.d.ts +2 -2
- package/dist/types/components/layout/app-shell.d.ts +1 -1
- package/dist/types/components/lexical/code/language-selector.d.ts +1 -1
- package/dist/types/components/lexical/floating/block-handle.d.ts +1 -1
- package/dist/types/components/lexical/floating/floating-toolbar.d.ts +1 -1
- package/dist/types/components/lexical/floating/slash-command-palette.d.ts +1 -1
- package/dist/types/components/lexical/table/table-controls.d.ts +1 -1
- package/dist/types/components/lexical/toolbar/lexical-toolbar.d.ts +1 -1
- package/dist/types/components/lexical/toolbar/toolbar-helpers.d.ts +2 -2
- package/dist/types/components/media/pdf-page-viewer.d.ts +1 -1
- package/dist/types/components/misc/notification-provider.d.ts +2 -2
- package/dist/types/components/navigation/link/button-link.d.ts +1 -1
- package/dist/types/components/navigation/link/link.d.ts +1 -1
- package/dist/types/components/navigation/link/navigation-link.d.ts +1 -1
- package/dist/types/components/navigation/pagination.d.ts +1 -1
- package/dist/types/components/navigation/sidebar/sidebar.d.ts +2 -2
- package/dist/types/components/navigation/toolbar/toolbar.d.ts +1 -1
- package/dist/types/components/prosemirror/link-control.d.ts +1 -1
- package/dist/types/components/prosemirror/prosemirror-toolbar.d.ts +1 -1
- package/dist/types/components/prosemirror/utils.d.ts +2 -2
- package/dist/types/components/theme/theme.d.ts +2 -2
- package/dist/types/i18n/translate.d.ts +1 -1
- package/dist/types/utils/delay-signal.d.ts +1 -1
- package/dist/types/utils/use-animated-toggle.d.ts +22 -22
- package/dist/{ur-DkIYJxsF.js → ur-Lr1p8f9y.js} +1 -1
- package/dist/{use-animated-toggle-89fKlXxy.js → use-animated-toggle-C7PTmnZi.js} +7 -7
- package/dist/{use-form-BSvvERhX.js → use-form-BfzX3bwL.js} +13 -13
- package/dist/{use-form-B_mCauP0.cjs → use-form-i97PToWB.cjs} +1 -1
- package/dist/{vi-DKw6PBja.js → vi-jozfaxSj.js} +1 -1
- package/dist/widget-customization-BZqPoojo.cjs +1 -0
- package/dist/{widget-customization-DFr3ycD7.js → widget-customization-fMNSVtuP.js} +29 -29
- package/dist/{zh-CaKHseXJ.js → zh-BBYKq49d.js} +1 -1
- package/package.json +35 -31
- package/dist/deep-merge-CvN7Xvd1.cjs +0 -1
- package/dist/notice-DMK7dx9a.cjs +0 -1
- package/dist/stack-DcZ_u50f.cjs +0 -1
- package/dist/widget-customization-BASfRpF7.cjs +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";const S=require("@tempots/dom"),dr=require("./toolbar-BR8In7O0.cjs"),Z=require("./editor-toolbar-group-BgWLVgMZ.cjs"),Ro=require("./text-input-w0eVcqk5.cjs"),Bo=require("./translations-gVgMyNno.cjs"),zo=require("./link-portal-_tiDFZqh.cjs"),vo=require("@tempots/ui"),Po=require("./theme-DogY9oT1.cjs");function V(t){this.content=t}V.prototype={constructor:V,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,u=r.find(t),i=r.content.slice();return u==-1?i.push(n||t,e):(i[u+1]=e,n&&(i[u]=n)),new V(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new V(n)},addToStart:function(t,e){return new V([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new V(n)},addBefore:function(t,e,n){var r=this.remove(e),u=r.content.slice(),i=r.find(t);return u.splice(i==-1?u.length:i,0,e,n),new V(u)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=V.from(t),t.size?new V(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=V.from(t),t.size?new V(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=V.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};V.from=function(t){if(t instanceof V)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new V(e)};function Oi(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let u=t.child(r),i=e.child(r);if(u==i){n+=u.nodeSize;continue}if(!u.sameMarkup(i))return n;if(u.isText&&u.text!=i.text){for(let s=0;u.text[s]==i.text[s];s++)n++;return n}if(u.content.size||i.content.size){let s=Oi(u.content,i.content,n+1);if(s!=null)return s}n+=u.nodeSize}}function Fi(t,e,n,r){for(let u=t.childCount,i=e.childCount;;){if(u==0||i==0)return u==i?null:{a:n,b:r};let s=t.child(--u),o=e.child(--i),l=s.nodeSize;if(s==o){n-=l,r-=l;continue}if(!s.sameMarkup(o))return{a:n,b:r};if(s.isText&&s.text!=o.text){let a=0,c=Math.min(s.text.length,o.text.length);for(;a<c&&s.text[s.text.length-a-1]==o.text[o.text.length-a-1];)a++,n--,r--;return{a:n,b:r}}if(s.content.size||o.content.size){let a=Fi(s.content,o.content,n-1,r-1);if(a)return a}n-=l,r-=l}}class x{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,u=0,i){for(let s=0,o=0;o<n;s++){let l=this.content[s],a=o+l.nodeSize;if(a>e&&r(l,u+o,i||null,s)!==!1&&l.content.size){let c=o+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,u+c)}o=a}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,u){let i="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let a=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?u?typeof u=="function"?u(o):u:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&a||o.isTextblock)&&r&&(s?s=!1:i+=r),i+=a},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,u=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(u[u.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)u.push(e.content[i]);return new x(u,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],u=0;if(n>e)for(let i=0,s=0;s<n;i++){let o=this.content[i],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),r.push(o),u+=o.nodeSize),s=l}return new x(r,u)}cutByIndex(e,n){return e==n?x.empty:e==0&&n==this.content.length?this:new x(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let u=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return u[e]=n,new x(u,i)}addToStart(e){return new x([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new x(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let u=this.content[n];e(u,r,n),r+=u.nodeSize}}findDiffStart(e,n=0){return Oi(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Fi(this,e,n,r)}findIndex(e){if(e==0)return Qt(0,e);if(e==this.size)return Qt(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let u=this.child(n),i=r+u.nodeSize;if(i>=e)return i==e?Qt(n+1,i):Qt(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return x.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new x(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return x.empty;let n,r=0;for(let u=0;u<e.length;u++){let i=e[u];r+=i.nodeSize,u&&i.isText&&e[u-1].sameMarkup(i)?(n||(n=e.slice(0,u)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new x(n||e,r)}static from(e){if(!e)return x.empty;if(e instanceof x)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new x([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}x.empty=new x([],0);const zn={index:0,offset:0};function Qt(t,e){return zn.index=t,zn.offset=e,zn}function cn(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!cn(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!cn(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class T{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let u=0;u<e.length;u++){let i=e[u];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,u));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,u)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&cn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let u=r.create(n.attrs);return r.checkAttrs(u.attrs),u}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return T.none;if(e instanceof T)return[e];let n=e.slice();return n.sort((r,u)=>r.type.rank-u.type.rank),n}}T.none=[];class fn extends Error{}class D{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Ii(this.content,e+this.openStart,n);return r&&new D(r,this.openStart,this.openEnd)}removeBetween(e,n){return new D(Ni(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return D.empty;let r=n.openStart||0,u=n.openEnd||0;if(typeof r!="number"||typeof u!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new D(x.fromJSON(e,n.content),r,u)}static maxOpen(e,n=!0){let r=0,u=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)u++;return new D(e,r,u)}}D.empty=new D(x.empty,0,0);function Ni(t,e,n){let{index:r,offset:u}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:o}=t.findIndex(n);if(u==e||i.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Ni(i.content,e-u-1,n-u-1)))}function Ii(t,e,n,r){let{index:u,offset:i}=t.findIndex(e),s=t.maybeChild(u);if(i==e||s.isText)return r&&!r.canReplace(u,u,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=Ii(s.content,e-i-1,n,s);return o&&t.replaceChild(u,s.copy(o))}function Lo(t,e,n){if(n.openStart>t.depth)throw new fn("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new fn("Inconsistent open depths");return Ri(t,e,n,0)}function Ri(t,e,n,r){let u=t.index(r),i=t.node(r);if(u==e.index(r)&&r<t.depth-n.openStart){let s=Ri(t,e,n,r+1);return i.copy(i.content.replaceChild(u,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,o=s.content;return Ye(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=qo(n,t);return Ye(i,zi(t,s,o,e,r))}else return Ye(i,dn(t,e,r))}function Bi(t,e){if(!e.type.compatibleContent(t.type))throw new fn("Cannot join "+e.type.name+" onto "+t.type.name)}function hr(t,e,n){let r=t.node(n);return Bi(r,e.node(n)),r}function Ze(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function wt(t,e,n,r){let u=(e||t).node(n),i=0,s=e?e.index(n):u.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Ze(t.nodeAfter,r),i++));for(let o=i;o<s;o++)Ze(u.child(o),r);e&&e.depth==n&&e.textOffset&&Ze(e.nodeBefore,r)}function Ye(t,e){return t.type.checkContent(e),t.copy(e)}function zi(t,e,n,r,u){let i=t.depth>u&&hr(t,e,u+1),s=r.depth>u&&hr(n,r,u+1),o=[];return wt(null,t,u,o),i&&s&&e.index(u)==n.index(u)?(Bi(i,s),Ze(Ye(i,zi(t,e,n,r,u+1)),o)):(i&&Ze(Ye(i,dn(t,e,u+1)),o),wt(e,n,u,o),s&&Ze(Ye(s,dn(n,r,u+1)),o)),wt(r,null,u,o),new x(o)}function dn(t,e,n){let r=[];if(wt(null,t,n,r),t.depth>n){let u=hr(t,e,n+1);Ze(Ye(u,dn(t,e,n+1)),r)}return wt(e,null,n,r),new x(r)}function qo(t,e){let n=e.depth-t.openStart,u=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)u=e.node(i).copy(x.from(u));return{start:u.resolveNoCache(t.openStart+n),end:u.resolveNoCache(u.content.size-t.openEnd-n)}}class It{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],u=e.child(n);return r?e.child(n).cut(r):u}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],u=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)u+=r.child(i).nodeSize;return u}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return T.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),u=e.maybeChild(n);if(!r){let o=r;r=u,u=o}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!u||!i[s].isInSet(u.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,u=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!u||!r[i].isInSet(u.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new vi(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],u=0,i=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(i),a=i-l;if(r.push(s,o,u+l),!a||(s=s.child(o),s.isText))break;i=a-1,u+=l+1}return new It(n,r,i)}static resolveCached(e,n){let r=su.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else su.set(e,r=new Vo);let u=r.elts[r.i]=It.resolve(e,n);return r.i=(r.i+1)%$o,u}}class Vo{constructor(){this.elts=[],this.i=0}}const $o=12,su=new WeakMap;class vi{constructor(e,n,r){this.$from=e,this.$to=n,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 Wo=Object.create(null);class xe{constructor(e,n,r,u=T.none){this.type=e,this.attrs=n,this.marks=u,this.content=r||x.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,u=0){this.content.nodesBetween(e,n,r,u,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,u){return this.content.textBetween(e,n,r,u)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&cn(this.attrs,n||e.defaultAttrs||Wo)&&T.sameSet(this.marks,r||T.none)}copy(e=null){return e==this.content?this:new xe(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new xe(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return D.empty;let u=this.resolve(e),i=this.resolve(n),s=r?0:u.sharedDepth(n),o=u.start(s),a=u.node(s).content.cut(u.pos-o,i.pos-o);return new D(a,u.depth-s,i.depth-s)}replace(e,n,r){return Lo(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:u}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(u==e||n.isText)return n;e-=u+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let u=this.content.child(n-1);return{node:u,index:n-1,offset:r-u.nodeSize}}resolve(e){return It.resolveCached(this,e)}resolveNoCache(e){return It.resolve(this,e)}rangeHasMark(e,n,r){let u=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(u=!0),!u)),u}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()+")"),Pi(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=x.empty,u=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,u,i),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=u;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,u){if(u&&!this.type.allowsMarks(u))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=T.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!T.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let u=x.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,u,r);return i.type.checkAttrs(i.attrs),i}}xe.prototype.text=void 0;class hn extends xe{constructor(e,n,r,u){if(super(e,n,null,u),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Pi(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new hn(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new hn(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Pi(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class tt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Ho(e,n);if(r.next==null)return tt.empty;let u=Li(r);r.next&&r.err("Unexpected trailing text");let i=Yo(Zo(u));return Xo(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let u=this;for(let i=n;u&&i<r;i++)u=u.matchType(e.child(i).type);return u}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let u=[this];function i(s,o){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return x.from(o.map(a=>a.createAndFill()));for(let a=0;a<s.next.length;a++){let{type:c,next:f}=s.next[a];if(!(c.isText||c.hasRequiredAttrs())&&u.indexOf(f)==-1){u.push(f);let p=i(f,o.concat(c));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let u=r.shift(),i=u.match;if(i.matchType(e)){let s=[];for(let o=u;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:o,next:l}=i.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!u.type||l.validEnd)&&(r.push({match:o.contentMatch,type:o,via:u}),n[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let u=0;u<r.next.length;u++)e.indexOf(r.next[u].next)==-1&&n(r.next[u].next)}return n(this),e.map((r,u)=>{let i=u+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
2
|
-
`)}}tt.empty=new tt(!0);class Ho{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Li(t){let e=[];do e.push(Jo(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Jo(t){let e=[];do e.push(jo(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function jo(t){let e=Go(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Uo(t,e);else break;return e}function ou(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Uo(t,e){let n=ou(t),r=n;return t.eat(",")&&(t.next!="}"?r=ou(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Ko(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let u=[];for(let i in n){let s=n[i];s.isInGroup(e)&&u.push(s)}return u.length==0&&t.err("No node type or group '"+e+"' found"),u}function Go(t){if(t.eat("(")){let e=Li(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Ko(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Zo(t){let e=[[]];return u(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,o,l){let a={term:l,to:o};return e[s].push(a),a}function u(s,o){s.forEach(l=>l.to=o)}function i(s,o){if(s.type=="choice")return s.exprs.reduce((l,a)=>l.concat(i(a,o)),[]);if(s.type=="seq")for(let l=0;;l++){let a=i(s.exprs[l],o);if(l==s.exprs.length-1)return a;u(a,o=n())}else if(s.type=="star"){let l=n();return r(o,l),u(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return u(i(s.expr,o),l),u(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(o)].concat(i(s.expr,o));if(s.type=="range"){let l=o;for(let a=0;a<s.min;a++){let c=n();u(i(s.expr,l),c),l=c}if(s.max==-1)u(i(s.expr,l),l);else for(let a=s.min;a<s.max;a++){let c=n();r(l,c),u(i(s.expr,l),c),l=c}return[r(l)]}else{if(s.type=="name")return[r(o,void 0,s.value)];throw new Error("Unknown expr type")}}}}function qi(t,e){return e-t}function lu(t,e){let n=[];return r(e),n.sort(qi);function r(u){let i=t[u];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(u);for(let s=0;s<i.length;s++){let{term:o,to:l}=i[s];!o&&n.indexOf(l)==-1&&r(l)}}}function Yo(t){let e=Object.create(null);return n(lu(t,0));function n(r){let u=[];r.forEach(s=>{t[s].forEach(({term:o,to:l})=>{if(!o)return;let a;for(let c=0;c<u.length;c++)u[c][0]==o&&(a=u[c][1]);lu(t,l).forEach(c=>{a||u.push([o,a=[]]),a.indexOf(c)==-1&&a.push(c)})})});let i=e[r.join(",")]=new tt(r.indexOf(t.length-1)>-1);for(let s=0;s<u.length;s++){let o=u[s][1].sort(qi);i.next.push({type:u[s][0],next:e[o.join(",")]||n(o)})}return i}}function Xo(t,e){for(let n=0,r=[t];n<r.length;n++){let u=r[n],i=!u.validEnd,s=[];for(let o=0;o<u.next.length;o++){let{type:l,next:a}=u.next[o];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(a)==-1&&r.push(a)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Vi(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function $i(t,e){let n=Object.create(null);for(let r in t){let u=e&&e[r];if(u===void 0){let i=t[r];if(i.hasDefault)u=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=u}return n}function Wi(t,e,n,r){for(let u in e)if(!(u in t))throw new RangeError(`Unsupported attribute ${u} for ${n} of type ${u}`);for(let u in t){let i=t[u];i.validate&&i.validate(e[u])}}function Hi(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new el(t,r,e[r]);return n}let au=class Ji{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Hi(e,r.attrs),this.defaultAttrs=Vi(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==tt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:$i(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new xe(this,this.computeAttrs(e),x.from(n),T.setFrom(r))}createChecked(e=null,n,r){return n=x.from(n),this.checkContent(n),new xe(this,this.computeAttrs(e),n,T.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=x.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let u=this.contentMatch.matchFragment(n),i=u&&u.fillBefore(x.empty,!0);return i?new xe(this,e,n.append(i),T.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.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)}`)}checkAttrs(e){Wi(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:T.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new Ji(i,n,s));let u=n.spec.topNode||"doc";if(!r[u])throw new RangeError("Schema is missing its top node type ('"+u+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Qo(t,e,n){let r=n.split("|");return u=>{let i=u===null?"null":typeof u;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class el{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Qo(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class En{constructor(e,n,r,u){this.name=e,this.rank=n,this.schema=r,this.spec=u,this.attrs=Hi(e,u.attrs),this.excluded=null;let i=Vi(this.attrs);this.instance=i?new T(this,i):null}create(e=null){return!e&&this.instance?this.instance:new T(this,$i(this.attrs,e))}static compile(e,n){let r=Object.create(null),u=0;return e.forEach((i,s)=>r[i]=new En(i,u++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Wi(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Rr{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let u in e)n[u]=e[u];n.nodes=V.from(e.nodes),n.marks=V.from(e.marks||{}),this.nodes=au.compile(this.spec.nodes,this),this.marks=En.compile(this.spec.marks,this);let r=Object.create(null);for(let u in this.nodes){if(u in this.marks)throw new RangeError(u+" can not be both a node and a mark");let i=this.nodes[u],s=i.spec.content||"",o=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=tt.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=o=="_"?null:o?cu(this,o.split(" ")):o==""||!i.inlineContent?[]:null}for(let u in this.marks){let i=this.marks[u],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:cu(this,s.split(" "))}this.nodeFromJSON=u=>xe.fromJSON(this,u),this.markFromJSON=u=>T.fromJSON(this,u),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,u){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof au){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,u)}text(e,n){let r=this.nodes.text;return new hn(r,r.defaultAttrs,e,T.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function cu(t,e){let n=[];for(let r=0;r<e.length;r++){let u=e[r],i=t.marks[u],s=i;if(i)n.push(i);else for(let o in t.marks){let l=t.marks[o];(u=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(u)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function tl(t){return t.tag!=null}function nl(t){return t.style!=null}class Rt{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(u=>{if(tl(u))this.tags.push(u);else if(nl(u)){let i=/[^=]*/.exec(u.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(u)}}),this.normalizeLists=!this.tags.some(u=>{if(!/^(ul|ol)\b/.test(u.tag)||!u.node)return!1;let i=e.nodes[u.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new du(this,n,!1);return r.addAll(e,T.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new du(this,n,!0);return r.addAll(e,T.none,n.from,n.to),D.maxOpen(r.finish())}matchTag(e,n,r){for(let u=r?this.tags.indexOf(r)+1:0;u<this.tags.length;u++){let i=this.tags[u];if(il(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,u){for(let i=u?this.styles.indexOf(u)+1:0;i<this.styles.length;i++){let s=this.styles[i],o=s.style;if(!(o.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||o.length>e.length&&(o.charCodeAt(e.length)!=61||o.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(u){let i=u.priority==null?50:u.priority,s=0;for(;s<n.length;s++){let o=n[s];if((o.priority==null?50:o.priority)<i)break}n.splice(s,0,u)}for(let u in e.marks){let i=e.marks[u].spec.parseDOM;i&&i.forEach(s=>{r(s=hu(s)),s.mark||s.ignore||s.clearMark||(s.mark=u)})}for(let u in e.nodes){let i=e.nodes[u].spec.parseDOM;i&&i.forEach(s=>{r(s=hu(s)),s.node||s.ignore||s.mark||(s.node=u)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Rt(e,Rt.schemaRules(e)))}}const ji={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},rl={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ui={ol:!0,ul:!0},Bt=1,pr=2,Tt=4;function fu(t,e,n){return e!=null?(e?Bt:0)|(e==="full"?pr:0):t&&t.whitespace=="pre"?Bt|pr:n&~Tt}class en{constructor(e,n,r,u,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=u,this.options=s,this.content=[],this.activeMarks=T.none,this.match=i||(s&Tt?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(x.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,u;return(u=r.findWrapping(e.type))?(this.match=r,u):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Bt)){let r=this.content[this.content.length-1],u;if(r&&r.isText&&(u=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==u[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-u[0].length))}}let n=x.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(x.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ji.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class du{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let u=n.topNode,i,s=fu(null,n.preserveWhitespace,0)|(r?Tt:0);u?i=new en(u.type,u.attrs,T.none,!0,n.topMatch||u.type.contentMatch,s):r?i=new en(null,null,T.none,!0,null,s):i=new en(e.schema.topNodeType,null,T.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,u=this.top,i=u.options&pr?"full":this.localPreserveWS||(u.options&Bt)>0,{schema:s}=this.parser;if(i==="full"||u.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
1
|
+
"use strict";const S=require("@tempots/dom"),dr=require("./toolbar-BR8In7O0.cjs"),Z=require("./editor-toolbar-group-BgWLVgMZ.cjs"),Ro=require("./text-input-w0eVcqk5.cjs"),Bo=require("./translations-gVgMyNno.cjs"),zo=require("./link-portal-_tiDFZqh.cjs"),vo=require("@tempots/ui"),Po=require("./theme-DogY9oT1.cjs");function q(t){this.content=t}q.prototype={constructor:q,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,u=r.find(t),i=r.content.slice();return u==-1?i.push(n||t,e):(i[u+1]=e,n&&(i[u]=n)),new q(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new q(n)},addToStart:function(t,e){return new q([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new q(n)},addBefore:function(t,e,n){var r=this.remove(e),u=r.content.slice(),i=r.find(t);return u.splice(i==-1?u.length:i,0,e,n),new q(u)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=q.from(t),t.size?new q(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=q.from(t),t.size?new q(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=q.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};q.from=function(t){if(t instanceof q)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new q(e)};function Oi(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let u=t.child(r),i=e.child(r);if(u==i){n+=u.nodeSize;continue}if(!u.sameMarkup(i))return n;if(u.isText&&u.text!=i.text){for(let s=0;u.text[s]==i.text[s];s++)n++;return n}if(u.content.size||i.content.size){let s=Oi(u.content,i.content,n+1);if(s!=null)return s}n+=u.nodeSize}}function Fi(t,e,n,r){for(let u=t.childCount,i=e.childCount;;){if(u==0||i==0)return u==i?null:{a:n,b:r};let s=t.child(--u),o=e.child(--i),l=s.nodeSize;if(s==o){n-=l,r-=l;continue}if(!s.sameMarkup(o))return{a:n,b:r};if(s.isText&&s.text!=o.text){let a=0,c=Math.min(s.text.length,o.text.length);for(;a<c&&s.text[s.text.length-a-1]==o.text[o.text.length-a-1];)a++,n--,r--;return{a:n,b:r}}if(s.content.size||o.content.size){let a=Fi(s.content,o.content,n-1,r-1);if(a)return a}n-=l,r-=l}}class x{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,u=0,i){for(let s=0,o=0;o<n;s++){let l=this.content[s],a=o+l.nodeSize;if(a>e&&r(l,u+o,i||null,s)!==!1&&l.content.size){let c=o+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,u+c)}o=a}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,u){let i="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let a=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?u?typeof u=="function"?u(o):u:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&a||o.isTextblock)&&r&&(s?s=!1:i+=r),i+=a},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,u=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(u[u.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)u.push(e.content[i]);return new x(u,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],u=0;if(n>e)for(let i=0,s=0;s<n;i++){let o=this.content[i],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),r.push(o),u+=o.nodeSize),s=l}return new x(r,u)}cutByIndex(e,n){return e==n?x.empty:e==0&&n==this.content.length?this:new x(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let u=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return u[e]=n,new x(u,i)}addToStart(e){return new x([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new x(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let u=this.content[n];e(u,r,n),r+=u.nodeSize}}findDiffStart(e,n=0){return Oi(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Fi(this,e,n,r)}findIndex(e){if(e==0)return Qt(0,e);if(e==this.size)return Qt(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let u=this.child(n),i=r+u.nodeSize;if(i>=e)return i==e?Qt(n+1,i):Qt(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return x.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new x(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return x.empty;let n,r=0;for(let u=0;u<e.length;u++){let i=e[u];r+=i.nodeSize,u&&i.isText&&e[u-1].sameMarkup(i)?(n||(n=e.slice(0,u)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new x(n||e,r)}static from(e){if(!e)return x.empty;if(e instanceof x)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new x([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}x.empty=new x([],0);const zn={index:0,offset:0};function Qt(t,e){return zn.index=t,zn.offset=e,zn}function cn(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!cn(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!cn(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class T{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let u=0;u<e.length;u++){let i=e[u];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,u));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,u)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&cn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let u=r.create(n.attrs);return r.checkAttrs(u.attrs),u}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return T.none;if(e instanceof T)return[e];let n=e.slice();return n.sort((r,u)=>r.type.rank-u.type.rank),n}}T.none=[];class fn extends Error{}class D{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Ii(this.content,e+this.openStart,n);return r&&new D(r,this.openStart,this.openEnd)}removeBetween(e,n){return new D(Ni(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return D.empty;let r=n.openStart||0,u=n.openEnd||0;if(typeof r!="number"||typeof u!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new D(x.fromJSON(e,n.content),r,u)}static maxOpen(e,n=!0){let r=0,u=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)u++;return new D(e,r,u)}}D.empty=new D(x.empty,0,0);function Ni(t,e,n){let{index:r,offset:u}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:o}=t.findIndex(n);if(u==e||i.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Ni(i.content,e-u-1,n-u-1)))}function Ii(t,e,n,r){let{index:u,offset:i}=t.findIndex(e),s=t.maybeChild(u);if(i==e||s.isText)return r&&!r.canReplace(u,u,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=Ii(s.content,e-i-1,n,s);return o&&t.replaceChild(u,s.copy(o))}function Lo(t,e,n){if(n.openStart>t.depth)throw new fn("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new fn("Inconsistent open depths");return Ri(t,e,n,0)}function Ri(t,e,n,r){let u=t.index(r),i=t.node(r);if(u==e.index(r)&&r<t.depth-n.openStart){let s=Ri(t,e,n,r+1);return i.copy(i.content.replaceChild(u,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,o=s.content;return Ye(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=qo(n,t);return Ye(i,zi(t,s,o,e,r))}else return Ye(i,dn(t,e,r))}function Bi(t,e){if(!e.type.compatibleContent(t.type))throw new fn("Cannot join "+e.type.name+" onto "+t.type.name)}function hr(t,e,n){let r=t.node(n);return Bi(r,e.node(n)),r}function Ze(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function wt(t,e,n,r){let u=(e||t).node(n),i=0,s=e?e.index(n):u.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Ze(t.nodeAfter,r),i++));for(let o=i;o<s;o++)Ze(u.child(o),r);e&&e.depth==n&&e.textOffset&&Ze(e.nodeBefore,r)}function Ye(t,e){return t.type.checkContent(e),t.copy(e)}function zi(t,e,n,r,u){let i=t.depth>u&&hr(t,e,u+1),s=r.depth>u&&hr(n,r,u+1),o=[];return wt(null,t,u,o),i&&s&&e.index(u)==n.index(u)?(Bi(i,s),Ze(Ye(i,zi(t,e,n,r,u+1)),o)):(i&&Ze(Ye(i,dn(t,e,u+1)),o),wt(e,n,u,o),s&&Ze(Ye(s,dn(n,r,u+1)),o)),wt(r,null,u,o),new x(o)}function dn(t,e,n){let r=[];if(wt(null,t,n,r),t.depth>n){let u=hr(t,e,n+1);Ze(Ye(u,dn(t,e,n+1)),r)}return wt(e,null,n,r),new x(r)}function qo(t,e){let n=e.depth-t.openStart,u=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)u=e.node(i).copy(x.from(u));return{start:u.resolveNoCache(t.openStart+n),end:u.resolveNoCache(u.content.size-t.openEnd-n)}}class It{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],u=e.child(n);return r?e.child(n).cut(r):u}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],u=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)u+=r.child(i).nodeSize;return u}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return T.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),u=e.maybeChild(n);if(!r){let o=r;r=u,u=o}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!u||!i[s].isInSet(u.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,u=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!u||!r[i].isInSet(u.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new vi(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],u=0,i=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(i),a=i-l;if(r.push(s,o,u+l),!a||(s=s.child(o),s.isText))break;i=a-1,u+=l+1}return new It(n,r,i)}static resolveCached(e,n){let r=su.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else su.set(e,r=new Vo);let u=r.elts[r.i]=It.resolve(e,n);return r.i=(r.i+1)%$o,u}}class Vo{constructor(){this.elts=[],this.i=0}}const $o=12,su=new WeakMap;class vi{constructor(e,n,r){this.$from=e,this.$to=n,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 Wo=Object.create(null);class xe{constructor(e,n,r,u=T.none){this.type=e,this.attrs=n,this.marks=u,this.content=r||x.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,u=0){this.content.nodesBetween(e,n,r,u,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,u){return this.content.textBetween(e,n,r,u)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&cn(this.attrs,n||e.defaultAttrs||Wo)&&T.sameSet(this.marks,r||T.none)}copy(e=null){return e==this.content?this:new xe(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new xe(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return D.empty;let u=this.resolve(e),i=this.resolve(n),s=r?0:u.sharedDepth(n),o=u.start(s),a=u.node(s).content.cut(u.pos-o,i.pos-o);return new D(a,u.depth-s,i.depth-s)}replace(e,n,r){return Lo(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:u}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(u==e||n.isText)return n;e-=u+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let u=this.content.child(n-1);return{node:u,index:n-1,offset:r-u.nodeSize}}resolve(e){return It.resolveCached(this,e)}resolveNoCache(e){return It.resolve(this,e)}rangeHasMark(e,n,r){let u=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(u=!0),!u)),u}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()+")"),Pi(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=x.empty,u=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,u,i),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=u;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,u){if(u&&!this.type.allowsMarks(u))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=T.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!T.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let u=x.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,u,r);return i.type.checkAttrs(i.attrs),i}}xe.prototype.text=void 0;class hn extends xe{constructor(e,n,r,u){if(super(e,n,null,u),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Pi(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new hn(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new hn(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Pi(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class tt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Ho(e,n);if(r.next==null)return tt.empty;let u=Li(r);r.next&&r.err("Unexpected trailing text");let i=Yo(Zo(u));return Xo(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let u=this;for(let i=n;u&&i<r;i++)u=u.matchType(e.child(i).type);return u}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let u=[this];function i(s,o){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return x.from(o.map(a=>a.createAndFill()));for(let a=0;a<s.next.length;a++){let{type:c,next:f}=s.next[a];if(!(c.isText||c.hasRequiredAttrs())&&u.indexOf(f)==-1){u.push(f);let p=i(f,o.concat(c));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let u=r.shift(),i=u.match;if(i.matchType(e)){let s=[];for(let o=u;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:o,next:l}=i.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!u.type||l.validEnd)&&(r.push({match:o.contentMatch,type:o,via:u}),n[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let u=0;u<r.next.length;u++)e.indexOf(r.next[u].next)==-1&&n(r.next[u].next)}return n(this),e.map((r,u)=>{let i=u+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
2
|
+
`)}}tt.empty=new tt(!0);class Ho{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Li(t){let e=[];do e.push(Jo(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Jo(t){let e=[];do e.push(jo(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function jo(t){let e=Go(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Uo(t,e);else break;return e}function ou(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Uo(t,e){let n=ou(t),r=n;return t.eat(",")&&(t.next!="}"?r=ou(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Ko(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let u=[];for(let i in n){let s=n[i];s.isInGroup(e)&&u.push(s)}return u.length==0&&t.err("No node type or group '"+e+"' found"),u}function Go(t){if(t.eat("(")){let e=Li(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Ko(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Zo(t){let e=[[]];return u(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,o,l){let a={term:l,to:o};return e[s].push(a),a}function u(s,o){s.forEach(l=>l.to=o)}function i(s,o){if(s.type=="choice")return s.exprs.reduce((l,a)=>l.concat(i(a,o)),[]);if(s.type=="seq")for(let l=0;;l++){let a=i(s.exprs[l],o);if(l==s.exprs.length-1)return a;u(a,o=n())}else if(s.type=="star"){let l=n();return r(o,l),u(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return u(i(s.expr,o),l),u(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(o)].concat(i(s.expr,o));if(s.type=="range"){let l=o;for(let a=0;a<s.min;a++){let c=n();u(i(s.expr,l),c),l=c}if(s.max==-1)u(i(s.expr,l),l);else for(let a=s.min;a<s.max;a++){let c=n();r(l,c),u(i(s.expr,l),c),l=c}return[r(l)]}else{if(s.type=="name")return[r(o,void 0,s.value)];throw new Error("Unknown expr type")}}}}function qi(t,e){return e-t}function lu(t,e){let n=[];return r(e),n.sort(qi);function r(u){let i=t[u];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(u);for(let s=0;s<i.length;s++){let{term:o,to:l}=i[s];!o&&n.indexOf(l)==-1&&r(l)}}}function Yo(t){let e=Object.create(null);return n(lu(t,0));function n(r){let u=[];r.forEach(s=>{t[s].forEach(({term:o,to:l})=>{if(!o)return;let a;for(let c=0;c<u.length;c++)u[c][0]==o&&(a=u[c][1]);lu(t,l).forEach(c=>{a||u.push([o,a=[]]),a.indexOf(c)==-1&&a.push(c)})})});let i=e[r.join(",")]=new tt(r.indexOf(t.length-1)>-1);for(let s=0;s<u.length;s++){let o=u[s][1].sort(qi);i.next.push({type:u[s][0],next:e[o.join(",")]||n(o)})}return i}}function Xo(t,e){for(let n=0,r=[t];n<r.length;n++){let u=r[n],i=!u.validEnd,s=[];for(let o=0;o<u.next.length;o++){let{type:l,next:a}=u.next[o];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(a)==-1&&r.push(a)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Vi(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function $i(t,e){let n=Object.create(null);for(let r in t){let u=e&&e[r];if(u===void 0){let i=t[r];if(i.hasDefault)u=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=u}return n}function Wi(t,e,n,r){for(let u in e)if(!(u in t))throw new RangeError(`Unsupported attribute ${u} for ${n} of type ${u}`);for(let u in t){let i=t[u];i.validate&&i.validate(e[u])}}function Hi(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new el(t,r,e[r]);return n}let au=class Ji{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Hi(e,r.attrs),this.defaultAttrs=Vi(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==tt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:$i(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new xe(this,this.computeAttrs(e),x.from(n),T.setFrom(r))}createChecked(e=null,n,r){return n=x.from(n),this.checkContent(n),new xe(this,this.computeAttrs(e),n,T.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=x.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let u=this.contentMatch.matchFragment(n),i=u&&u.fillBefore(x.empty,!0);return i?new xe(this,e,n.append(i),T.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.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)}`)}checkAttrs(e){Wi(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:T.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new Ji(i,n,s));let u=n.spec.topNode||"doc";if(!r[u])throw new RangeError("Schema is missing its top node type ('"+u+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Qo(t,e,n){let r=n.split("|");return u=>{let i=u===null?"null":typeof u;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class el{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Qo(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class En{constructor(e,n,r,u){this.name=e,this.rank=n,this.schema=r,this.spec=u,this.attrs=Hi(e,u.attrs),this.excluded=null;let i=Vi(this.attrs);this.instance=i?new T(this,i):null}create(e=null){return!e&&this.instance?this.instance:new T(this,$i(this.attrs,e))}static compile(e,n){let r=Object.create(null),u=0;return e.forEach((i,s)=>r[i]=new En(i,u++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Wi(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Rr{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let u in e)n[u]=e[u];n.nodes=q.from(e.nodes),n.marks=q.from(e.marks||{}),this.nodes=au.compile(this.spec.nodes,this),this.marks=En.compile(this.spec.marks,this);let r=Object.create(null);for(let u in this.nodes){if(u in this.marks)throw new RangeError(u+" can not be both a node and a mark");let i=this.nodes[u],s=i.spec.content||"",o=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=tt.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=o=="_"?null:o?cu(this,o.split(" ")):o==""||!i.inlineContent?[]:null}for(let u in this.marks){let i=this.marks[u],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:cu(this,s.split(" "))}this.nodeFromJSON=u=>xe.fromJSON(this,u),this.markFromJSON=u=>T.fromJSON(this,u),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,u){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof au){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,u)}text(e,n){let r=this.nodes.text;return new hn(r,r.defaultAttrs,e,T.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function cu(t,e){let n=[];for(let r=0;r<e.length;r++){let u=e[r],i=t.marks[u],s=i;if(i)n.push(i);else for(let o in t.marks){let l=t.marks[o];(u=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(u)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function tl(t){return t.tag!=null}function nl(t){return t.style!=null}class Rt{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(u=>{if(tl(u))this.tags.push(u);else if(nl(u)){let i=/[^=]*/.exec(u.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(u)}}),this.normalizeLists=!this.tags.some(u=>{if(!/^(ul|ol)\b/.test(u.tag)||!u.node)return!1;let i=e.nodes[u.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new du(this,n,!1);return r.addAll(e,T.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new du(this,n,!0);return r.addAll(e,T.none,n.from,n.to),D.maxOpen(r.finish())}matchTag(e,n,r){for(let u=r?this.tags.indexOf(r)+1:0;u<this.tags.length;u++){let i=this.tags[u];if(il(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,u){for(let i=u?this.styles.indexOf(u)+1:0;i<this.styles.length;i++){let s=this.styles[i],o=s.style;if(!(o.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||o.length>e.length&&(o.charCodeAt(e.length)!=61||o.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(u){let i=u.priority==null?50:u.priority,s=0;for(;s<n.length;s++){let o=n[s];if((o.priority==null?50:o.priority)<i)break}n.splice(s,0,u)}for(let u in e.marks){let i=e.marks[u].spec.parseDOM;i&&i.forEach(s=>{r(s=hu(s)),s.mark||s.ignore||s.clearMark||(s.mark=u)})}for(let u in e.nodes){let i=e.nodes[u].spec.parseDOM;i&&i.forEach(s=>{r(s=hu(s)),s.node||s.ignore||s.mark||(s.node=u)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Rt(e,Rt.schemaRules(e)))}}const ji={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},rl={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ui={ol:!0,ul:!0},Bt=1,pr=2,Tt=4;function fu(t,e,n){return e!=null?(e?Bt:0)|(e==="full"?pr:0):t&&t.whitespace=="pre"?Bt|pr:n&~Tt}class en{constructor(e,n,r,u,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=u,this.options=s,this.content=[],this.activeMarks=T.none,this.match=i||(s&Tt?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(x.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,u;return(u=r.findWrapping(e.type))?(this.match=r,u):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Bt)){let r=this.content[this.content.length-1],u;if(r&&r.isText&&(u=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==u[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-u[0].length))}}let n=x.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(x.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ji.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class du{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let u=n.topNode,i,s=fu(null,n.preserveWhitespace,0)|(r?Tt:0);u?i=new en(u.type,u.attrs,T.none,!0,n.topMatch||u.type.contentMatch,s):r?i=new en(null,null,T.none,!0,null,s):i=new en(e.schema.topNodeType,null,T.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,u=this.top,i=u.options&pr?"full":this.localPreserveWS||(u.options&Bt)>0,{schema:s}=this.parser;if(i==="full"||u.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let o=r.split(/\r?\n|\r/);for(let l=0;l<o.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),o[l]&&this.insertNode(s.text(o[l]),n,!/\S/.test(o[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=u.content[u.content.length-1],l=e.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let u=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),o;Ui.hasOwnProperty(s)&&this.parser.normalizeLists&&ul(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));e:if(l?l.ignore:rl.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let a,c=this.needsBlock;if(ji.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),a=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let f=l&&l.skip?n:this.readStyles(e,n);f&&this.addAll(e,f),a&&this.sync(i),this.needsBlock=c}else{let a=this.readStyles(e,n);a&&this.addElementByRule(e,l,a,l.consuming===!1?o:void 0)}this.localPreserveWS=u}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
|
-
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let u=0;u<this.parser.matchedStyles.length;u++){let i=this.parser.matchedStyles[u],s=r.getPropertyValue(i);if(s)for(let o=void 0;;){let l=this.parser.matchStyle(i,s,this,o);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(a=>!l.clearMark(a)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)o=l;else break}}return n}addElementByRule(e,n,r,u){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(e);else if(u)this.addElement(e,r,u);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(o)&&this.open--}addAll(e,n,r,u){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,o=u==null?null:e.childNodes[u];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let u,i;for(let s=this.open,o=0;s>=0;s--){let l=this.nodes[s],a=l.findWrapping(e);if(a&&(!u||u.length>a.length+o)&&(u=a,i=l,!a.length))break;if(l.solid){if(r)break;o+=2}}if(!u)return null;this.sync(i);for(let s=0;s<u.length;s++)n=this.enterInner(u[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let u=this.findPlace(e,n,r);if(u){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=T.none;for(let o of u.concat(e.marks))(i.type?i.type.allowsMarkType(o.type):pu(o.type,e.type))&&(s=o.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,u){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,u)),i}enterInner(e,n,r,u=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let o=fu(e,i,s.options);s.options&Tt&&s.content.length==0&&(o|=Tt);let l=T.none;return r=r.filter(a=>(s.type?s.type.allowsMarkType(a.type):pu(a.type,e))?(l=a.addToSet(l),!1):!0),this.nodes.push(new en(e,n,l,u,null,o)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Bt)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let u=r.length-1;u>=0;u--)e+=r[u].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let u=0;u<this.find.length;u++)this.find[u].pos==null&&e.nodeType==1&&e.contains(this.find[u].node)&&n.compareDocumentPosition(this.find[u].node)&(r?2:4)&&(this.find[u].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,u=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(u?0:1),s=(o,l)=>{for(;o>=0;o--){let a=n[o];if(a==""){if(o==n.length-1||o==0)continue;for(;l>=i;l--)if(s(o-1,l))return!0;return!1}else{let c=l>0||l==0&&u?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!c||c.name!=a&&!c.isInGroup(a))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function ul(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ui.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function il(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function hu(t){let e={};for(let n in t)e[n]=t[n];return e}function pu(t,e){let n=e.schema.nodes;for(let r in n){let u=n[r];if(!u.allowsMarkType(t))continue;let i=[],s=o=>{i.push(o);for(let l=0;l<o.edgeCount;l++){let{type:a,next:c}=o.edge(l);if(a==e||i.indexOf(c)<0&&s(c))return!0}};if(s(u.contentMatch))return!0}}class yt{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=vn(n).createDocumentFragment());let u=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let o=0,l=0;for(;o<i.length&&l<s.marks.length;){let a=s.marks[l];if(!this.marks[a.type.name]){l++;continue}if(!a.eq(i[o][0])||a.type.spec.spanning===!1)break;o++,l++}for(;o<i.length;)u=i.pop()[1];for(;l<s.marks.length;){let a=s.marks[l++],c=this.serializeMark(a,s.isInline,n);c&&(i.push([a,u]),u.appendChild(c.dom),u=c.contentDOM||c.dom)}}u.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:u}=un(vn(n),this.nodes[e.type.name](e),null,e.attrs);if(u){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,u)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let u=e.marks.length-1;u>=0;u--){let i=this.serializeMark(e.marks[u],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let u=this.marks[e.type.name];return u&&un(vn(r),u(e,n),null,e.attrs)}static renderSpec(e,n,r=null,u){return un(e,n,r,u)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new yt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=mu(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return mu(e.marks)}}function mu(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function vn(t){return t.document||window.document}const gu=new WeakMap;function sl(t){let e=gu.get(t);return e===void 0&&gu.set(t,e=ol(t)),e}function ol(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let u=0;u<r.length;u++)n(r[u]);else for(let u in r)n(r[u])}return n(t),e}function un(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let u=e[0],i;if(typeof u!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=sl(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=u.indexOf(" ");s>0&&(n=u.slice(0,s),u=u.slice(s+1));let o,l=n?t.createElementNS(n,u):t.createElement(u),a=e[1],c=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){c=2;for(let f in a)if(a[f]!=null){let p=f.indexOf(" ");p>0?l.setAttributeNS(f.slice(0,p),f.slice(p+1),a[f]):f=="style"&&l.style?l.style.cssText=a[f]:l.setAttribute(f,a[f])}}for(let f=c;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:d}=un(t,p,n,r);if(l.appendChild(h),d){if(o)throw new RangeError("Multiple content holes");o=d}}}return{dom:l,contentDOM:o}}const Ki=65535,Gi=Math.pow(2,16);function ll(t,e){return t+e*Gi}function bu(t){return t&Ki}function al(t){return(t-(t&Ki))/Gi}const Zi=1,Yi=2,sn=4,Xi=8;class mr{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Xi)>0}get deletedBefore(){return(this.delInfo&(Zi|sn))>0}get deletedAfter(){return(this.delInfo&(Yi|sn))>0}get deletedAcross(){return(this.delInfo&sn)>0}}class te{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&te.empty)return te.empty}recover(e){let n=0,r=bu(e);if(!this.inverted)for(let u=0;u<r;u++)n+=this.ranges[u*3+2]-this.ranges[u*3+1];return this.ranges[r*3]+n+al(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let u=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?u:0);if(l>e)break;let a=this.ranges[o+i],c=this.ranges[o+s],f=l+a;if(e<=f){let p=a?e==l?-1:e==f?1:n:n,h=l+u+(p<0?0:c);if(r)return h;let d=e==(n<0?l:f)?null:ll(o/3,e-l),m=e==l?Yi:e==f?Zi:sn;return(n<0?e!=l:e!=f)&&(m|=Xi),new mr(h,m,d)}u+=c-a}return r?e+u:new mr(e+u,0,null)}touches(e,n){let r=0,u=bu(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?r:0);if(l>e)break;let a=this.ranges[o+i],c=l+a;if(e<=c&&o==u*3)return!0;r+=this.ranges[o+s]-a}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let u=0,i=0;u<this.ranges.length;u+=3){let s=this.ranges[u],o=s-(this.inverted?i:0),l=s+(this.inverted?0:i),a=this.ranges[u+n],c=this.ranges[u+r];e(o,o+a,l,l+c),i+=c-a}}invert(){return new te(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?te.empty:new te(e<0?[0,-e,0]:[0,0,e])}}te.empty=new te([]);class zt{constructor(e,n,r=0,u=e?e.length:0){this.mirror=n,this.from=r,this.to=u,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new zt(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let u=e.getMirror(n);this.appendMap(e._maps[n],u!=null&&u<n?r+u:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let u=e.getMirror(n);this.appendMap(e._maps[n].invert(),u!=null&&u>n?r-u-1:void 0)}}invert(){let e=new zt;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let u=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],o=s.mapResult(e,n);if(o.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(o.recover);continue}}u|=o.delInfo,e=o.pos}return r?e:new mr(e,u,null)}}const Pn=Object.create(null);class U{getMap(){return te.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Pn[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Pn)throw new RangeError("Duplicate use of step JSON ID "+e);return Pn[e]=n,n.prototype.jsonID=e,n}}class B{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new B(e,null)}static fail(e){return new B(null,e)}static fromReplace(e,n,r,u){try{return B.ok(e.replace(n,r,u))}catch(i){if(i instanceof fn)return B.fail(i.message);throw i}}}function Br(t,e,n){let r=[];for(let u=0;u<t.childCount;u++){let i=t.child(u);i.content.size&&(i=i.copy(Br(i.content,e,i))),i.isInline&&(i=e(i,n,u)),r.push(i)}return x.fromArray(r)}class Be extends U{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),u=r.node(r.sharedDepth(this.to)),i=new D(Br(n.content,(s,o)=>!s.isAtom||!o.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),u),n.openStart,n.openEnd);return B.fromReplace(e,this.from,this.to,i)}invert(){return new me(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Be(n.pos,r.pos,this.mark)}merge(e){return e instanceof Be&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Be(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Be(n.from,n.to,e.markFromJSON(n.mark))}}U.jsonID("addMark",Be);class me extends U{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new D(Br(n.content,u=>u.mark(this.mark.removeFromSet(u.marks)),e),n.openStart,n.openEnd);return B.fromReplace(e,this.from,this.to,r)}invert(){return new Be(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new me(n.pos,r.pos,this.mark)}merge(e){return e instanceof me&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new me(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new me(n.from,n.to,e.markFromJSON(n.mark))}}U.jsonID("removeMark",me);class ze extends U{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return B.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return B.fromReplace(e,this.pos,this.pos+1,new D(x.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let u=0;u<n.marks.length;u++)if(!n.marks[u].isInSet(r))return new ze(this.pos,n.marks[u]);return new ze(this.pos,this.mark)}}return new nt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ze(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ze(n.pos,e.markFromJSON(n.mark))}}U.jsonID("addNodeMark",ze);class nt extends U{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return B.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return B.fromReplace(e,this.pos,this.pos+1,new D(x.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new ze(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new nt(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new nt(n.pos,e.markFromJSON(n.mark))}}U.jsonID("removeNodeMark",nt);class j extends U{constructor(e,n,r,u=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=u}apply(e){return this.structure&&gr(e,this.from,this.to)?B.fail("Structure replace would overwrite content"):B.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new te([this.from,this.to-this.from,this.slice.size])}invert(e){return new j(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new j(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof j)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?D.empty:new D(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new j(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?D.empty:new D(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new j(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new j(n.from,n.to,D.fromJSON(e,n.slice),!!n.structure)}}U.jsonID("replace",j);class Y extends U{constructor(e,n,r,u,i,s,o=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=u,this.slice=i,this.insert=s,this.structure=o}apply(e){if(this.structure&&(gr(e,this.from,this.gapFrom)||gr(e,this.gapTo,this.to)))return B.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return B.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?B.fromReplace(e,this.from,this.to,r):B.fail("Content does not fit in gap")}getMap(){return new te([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Y(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),u=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||u<n.pos||i>r.pos?null:new Y(n.pos,r.pos,u,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Y(n.from,n.to,n.gapFrom,n.gapTo,D.fromJSON(e,n.slice),n.insert,!!n.structure)}}U.jsonID("replaceAround",Y);function gr(t,e,n){let r=t.resolve(e),u=n-e,i=r.depth;for(;u>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,u--;if(u>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;u>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,u--}}return!1}function cl(t,e,n,r){let u=[],i=[],s,o;t.doc.nodesBetween(e,n,(l,a,c)=>{if(!l.isInline)return;let f=l.marks;if(!r.isInSet(f)&&c.type.allowsMarkType(r.type)){let p=Math.max(a,e),h=Math.min(a+l.nodeSize,n),d=r.addToSet(f);for(let m=0;m<f.length;m++)f[m].isInSet(d)||(s&&s.to==p&&s.mark.eq(f[m])?s.to=h:u.push(s=new me(p,h,f[m])));o&&o.to==p?o.to=h:i.push(o=new Be(p,h,r))}}),u.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function fl(t,e,n,r){let u=[],i=0;t.doc.nodesBetween(e,n,(s,o)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof En){let a=s.marks,c;for(;c=r.isInSet(a);)(l||(l=[])).push(c),a=c.removeFromSet(a)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let a=Math.min(o+s.nodeSize,n);for(let c=0;c<l.length;c++){let f=l[c],p;for(let h=0;h<u.length;h++){let d=u[h];d.step==i-1&&f.eq(u[h].style)&&(p=d)}p?(p.to=a,p.step=i):u.push({style:f,from:Math.max(o,e),to:a,step:i})}}}),u.forEach(s=>t.step(new me(s.from,s.to,s.style)))}function zr(t,e,n,r=n.contentMatch,u=!0){let i=t.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l<i.childCount;l++){let a=i.child(l),c=o+a.nodeSize,f=r.matchType(a.type);if(!f)s.push(new j(o,c,D.empty));else{r=f;for(let p=0;p<a.marks.length;p++)n.allowsMarkType(a.marks[p].type)||t.step(new me(o,c,a.marks[p]));if(u&&a.isText&&n.whitespace!="pre"){let p,h=/\r?\n|\r/g,d;for(;p=h.exec(a.text);)d||(d=new D(x.from(n.schema.text(" ",n.allowedMarks(a.marks))),0,0)),s.push(new j(o+p.index,o+p.index+p[0].length,d))}}o=c}if(!r.validEnd){let l=r.fillBefore(x.empty,!0);t.replace(o,o,new D(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function dl(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Jt(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,u=0,i=0;;--r){let s=t.$from.node(r),o=t.$from.index(r)+u,l=t.$to.indexAfter(r)-i;if(r<t.depth&&s.canReplace(o,l,n))return r;if(r==0||s.type.spec.isolating||!dl(s,o,l))break;o&&(u=1),l<s.childCount&&(i=1)}return null}function hl(t,e,n){let{$from:r,$to:u,depth:i}=e,s=r.before(i+1),o=u.after(i+1),l=s,a=o,c=x.empty,f=0;for(let d=i,m=!1;d>n;d--)m||r.index(d)>0?(m=!0,c=x.from(r.node(d).copy(c)),f++):l--;let p=x.empty,h=0;for(let d=i,m=!1;d>n;d--)m||u.after(d+1)<u.end(d)?(m=!0,p=x.from(u.node(d).copy(p)),h++):a++;t.step(new Y(l,a,s,o,new D(c.append(p),f,h),c.size-f,!0))}function Qi(t,e,n=null,r=t){let u=pl(t,e),i=u&&ml(r,e);return i?u.map(xu).concat({type:e,attrs:n}).concat(i.map(xu)):null}function xu(t){return{type:t,attrs:null}}function pl(t,e){let{parent:n,startIndex:r,endIndex:u}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,u,s)?i:null}function ml(t,e){let{parent:n,startIndex:r,endIndex:u}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let a=r;l&&a<u;a++)l=l.matchType(n.child(a).type);return!l||!l.validEnd?null:s}function gl(t,e,n){let r=x.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let o=n[s].type.contentMatch.matchFragment(r);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=x.from(n[s].type.create(n[s].attrs,r))}let u=e.start,i=e.end;t.step(new Y(u,i,u,i,new D(r,0,0),n.length,!0))}function bl(t,e,n,r,u){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,o)=>{let l=typeof u=="function"?u(s):u;if(s.isTextblock&&!s.hasMarkup(r,l)&&xl(t.doc,t.mapping.slice(i).map(o),r)){let a=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",d=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!d?a=!1:!h&&d&&(a=!0)}a===!1&&ts(t,s,o,i),zr(t,t.mapping.slice(i).map(o,1),r,void 0,a===null);let c=t.mapping.slice(i),f=c.map(o,1),p=c.map(o+s.nodeSize,1);return t.step(new Y(f,p,f+1,p-1,new D(x.from(r.create(l,null,s.marks)),0,0),1,!0)),a===!0&&es(t,s,o,i),!1}})}function es(t,e,n,r){e.forEach((u,i)=>{if(u.isText){let s,o=/\r?\n|\r/g;for(;s=o.exec(u.text);){let l=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function ts(t,e,n,r){e.forEach((u,i)=>{if(u.type==u.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
|
|
5
|
-
`))}})}function xl(t,e,n){let r=t.resolve(e),u=r.index();return r.parent.canReplaceWith(u,u+1,n)}function kl(t,e,n,r,u){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,u||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Y(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new D(x.from(s),0,0),1,!0))}function Ot(t,e,n=1,r){let u=t.resolve(e),i=u.depth-n,s=r&&r[r.length-1]||u.parent;if(i<0||u.parent.type.spec.isolating||!u.parent.canReplace(u.index(),u.parent.childCount)||!s.type.validContent(u.parent.content.cutByIndex(u.index(),u.parent.childCount)))return!1;for(let a=u.depth-1,c=n-2;a>i;a--,c--){let f=u.node(a),p=u.index(a);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),d=r&&r[c+1];d&&(h=h.replaceChild(0,d.type.create(d.attrs)));let m=r&&r[c]||f;if(!f.canReplace(p+1,f.childCount)||!m.type.validContent(h))return!1}let o=u.indexAfter(i),l=r&&r[0];return u.node(i).canReplaceWith(o,o,l?l.type:u.node(i+1).type)}function yl(t,e,n=1,r){let u=t.doc.resolve(e),i=x.empty,s=x.empty;for(let o=u.depth,l=u.depth-n,a=n-1;o>l;o--,a--){i=x.from(u.node(o).copy(i));let c=r&&r[a];s=x.from(c?c.type.create(c.attrs,s):u.node(o).copy(s))}t.step(new j(e,e,new D(i.append(s),n,n),!0))}function vr(t,e){let n=t.resolve(e),r=n.index();return Dl(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Cl(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let u=0;u<e.childCount;u++){let i=e.child(u),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function Dl(t,e){return!!(t&&e&&!t.isLeaf&&Cl(t,e))}function _l(t,e,n){let r=null,{linebreakReplacement:u}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(u&&s.inlineContent){let c=s.whitespace=="pre",f=!!s.contentMatch.matchType(u);c&&!f?r=!1:!c&&f&&(r=!0)}let o=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);ts(t,c.node(),c.before(),o)}s.inlineContent&&zr(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(o),a=l.map(e-n);if(t.step(new j(a,l.map(e+n,-1),D.empty,!0)),r===!0){let c=t.doc.resolve(a);es(t,c.node(),c.before(),t.steps.length)}return t}function El(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let u=r.depth-1;u>=0;u--){let i=r.index(u);if(r.node(u).canReplaceWith(i,i,n))return r.before(u+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let u=r.depth-1;u>=0;u--){let i=r.indexAfter(u);if(r.node(u).canReplaceWith(i,i,n))return r.after(u+1);if(i<r.node(u).childCount)return null}return null}function Sl(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let u=n.content;for(let i=0;i<n.openStart;i++)u=u.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let o=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(o>0?1:0),a=r.node(s),c=!1;if(i==1)c=a.canReplace(l,l,u);else{let f=a.contentMatchAt(l).findWrapping(u.firstChild.type);c=f&&a.canReplaceWith(l,l,f[0])}if(c)return o==0?r.pos:o<0?r.before(s+1):r.after(s+1)}return null}function Pr(t,e,n=e,r=D.empty){if(e==n&&!r.size)return null;let u=t.resolve(e),i=t.resolve(n);return ns(u,i,r)?new j(e,n,r):new Al(u,i,r).fit()}function ns(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Al{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=x.empty;for(let u=0;u<=e.depth;u++){let i=e.node(u);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(u))})}for(let u=e.depth;u>0;u--)this.placed=x.from(e.node(u).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let a=this.findFittable();a?this.placeNodes(a):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,u=this.close(e<0?this.$to:r.doc.resolve(e));if(!u)return null;let i=this.placed,s=r.depth,o=u.depth;for(;s&&o&&i.childCount==1;)i=i.firstChild.content,s--,o--;let l=new D(i,s,o);return e>-1?new Y(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new j(r.pos,u.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,u=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(u=0),i.type.spec.isolating&&u<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let u,i=null;r?(i=Ln(this.unplaced.content,r-1).firstChild,u=i.content):u=this.unplaced.content;let s=u.firstChild;for(let o=this.depth;o>=0;o--){let{type:l,match:a}=this.frontier[o],c,f=null;if(n==1&&(s?a.matchType(s.type)||(f=a.fillBefore(x.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:o,parent:i,inject:f};if(n==2&&s&&(c=a.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:o,parent:i,wrap:c};if(i&&a.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,u=Ln(e,n);return!u.childCount||u.firstChild.isLeaf?!1:(this.unplaced=new D(e,n+1,Math.max(r,u.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,u=Ln(e,n);if(u.childCount<=1&&n>0){let i=e.size-n<=n+u.size;this.unplaced=new D(St(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new D(St(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:u,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,o=r?r.content:s.content,l=s.openStart-e,a=0,c=[],{match:f,type:p}=this.frontier[n];if(u){for(let m=0;m<u.childCount;m++)c.push(u.child(m));f=f.matchFragment(u)}let h=o.size+e-(s.content.size-s.openEnd);for(;a<o.childCount;){let m=o.child(a),g=f.matchType(m.type);if(!g)break;a++,(a>1||l==0||m.content.size)&&(f=g,c.push(rs(m.mark(p.allowedMarks(m.marks)),a==1?l:0,a==o.childCount?h:-1)))}let d=a==o.childCount;d||(h=-1),this.placed=At(this.placed,n,x.from(c)),this.frontier[n].match=f,d&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=o;m<h;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=d?e==0?D.empty:new D(St(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new D(St(s.content,e,a),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!qn(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,u=this.$to.after(r);for(;r>1&&u==this.$to.end(--r);)++u;return u}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:u}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=qn(e,n,u,r,i);if(s){for(let o=n-1;o>=0;o--){let{match:l,type:a}=this.frontier[o],c=qn(e,o,a,l,!0);if(!c||c.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=At(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let u=e.node(r),i=u.type.contentMatch.fillBefore(u.content,!0,e.index(r));this.openFrontierNode(u.type,u.attrs,i)}return e}openFrontierNode(e,n=null,r){let u=this.frontier[this.depth];u.match=u.match.matchType(e),this.placed=At(this.placed,this.depth,x.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(x.empty,!0);n.childCount&&(this.placed=At(this.placed,this.frontier.length,n))}}function St(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(St(t.firstChild.content,e-1,n)))}function At(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(At(t.lastChild.content,e-1,n)))}function Ln(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function rs(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,rs(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(x.empty,!0)))),t.copy(r)}function qn(t,e,n,r,u){let i=t.node(e),s=u?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let o=r.fillBefore(i.content,!0,s);return o&&!Ml(n,i.content,s)?o:null}function Ml(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function wl(t){return t.spec.defining||t.spec.definingForContent}function Tl(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let u=t.doc.resolve(e),i=t.doc.resolve(n);if(ns(u,i,r))return t.step(new j(e,n,r));let s=is(u,i);s[s.length-1]==0&&s.pop();let o=-(u.depth+1);s.unshift(o);for(let p=u.depth,h=u.pos-1;p>0;p--,h--){let d=u.node(p).type.spec;if(d.defining||d.definingAsContext||d.isolating)break;s.indexOf(p)>-1?o=p:u.before(p)==h&&s.splice(1,0,-p)}let l=s.indexOf(o),a=[],c=r.openStart;for(let p=r.content,h=0;;h++){let d=p.firstChild;if(a.push(d),h==r.openStart)break;p=d.content}for(let p=c-1;p>=0;p--){let h=a[p],d=wl(h.type);if(d&&!h.sameMarkup(u.node(Math.abs(o)-1)))c=p;else if(d||!h.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let h=(p+c+1)%(r.openStart+1),d=a[h];if(d)for(let m=0;m<s.length;m++){let g=s[(m+l)%s.length],b=!0;g<0&&(b=!1,g=-g);let k=u.node(g-1),y=u.index(g-1);if(k.canReplaceWith(y,y,d.type,d.marks))return t.replace(u.before(g),b?i.after(g):n,new D(us(r.content,0,r.openStart,h),h,r.openEnd))}}let f=t.steps.length;for(let p=s.length-1;p>=0&&(t.replace(e,n,r),!(t.steps.length>f));p--){let h=s[p];h<0||(e=u.before(h),n=i.after(h))}}function us(t,e,n,r,u){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(us(i.content,e+1,n,r,i)))}if(e>r){let i=u.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(x.empty,!0))}return t}function Ol(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let u=El(t.doc,e,r.type);u!=null&&(e=n=u)}t.replaceRange(e,n,new D(x.from(r),0,0))}function Fl(t,e,n){let r=t.doc.resolve(e),u=t.doc.resolve(n),i=is(r,u);for(let s=0;s<i.length;s++){let o=i[s],l=s==i.length-1;if(l&&o==0||r.node(o).type.contentMatch.validEnd)return t.delete(r.start(o),u.end(o));if(o>0&&(l||r.node(o-1).canReplace(r.index(o-1),u.indexAfter(o-1))))return t.delete(r.before(o),u.after(o))}for(let s=1;s<=r.depth&&s<=u.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&u.end(s)-n!=u.depth-s&&r.start(s-1)==u.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),u.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function is(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let u=r;u>=0;u--){let i=t.start(u);if(i<t.pos-(t.depth-u)||e.end(u)>e.pos+(e.depth-u)||t.node(u).type.spec.isolating||e.node(u).type.spec.isolating)break;(i==e.start(u)||u==t.depth&&u==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&u&&e.start(u-1)==i-1)&&n.push(u)}return n}class ft extends U{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return B.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let u=n.type.create(r,null,n.marks);return B.fromReplace(e,this.pos,this.pos+1,new D(x.from(u),0,n.isLeaf?0:1))}getMap(){return te.empty}invert(e){return new ft(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ft(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ft(n.pos,n.attr,n.value)}}U.jsonID("attr",ft);class vt extends U{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let u in e.attrs)n[u]=e.attrs[u];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return B.ok(r)}getMap(){return te.empty}invert(e){return new vt(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new vt(n.attr,n.value)}}U.jsonID("docAttr",vt);let pt=class extends Error{};pt=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};pt.prototype=Object.create(Error.prototype);pt.prototype.constructor=pt;pt.prototype.name="TransformError";class Nl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new zt}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new pt(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=D.empty){let u=Pr(this.doc,e,n,r);return u&&this.step(u),this}replaceWith(e,n,r){return this.replace(e,n,new D(x.from(r),0,0))}delete(e,n){return this.replace(e,n,D.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Tl(this,e,n,r),this}replaceRangeWith(e,n,r){return Ol(this,e,n,r),this}deleteRange(e,n){return Fl(this,e,n),this}lift(e,n){return hl(this,e,n),this}join(e,n=1){return _l(this,e,n),this}wrap(e,n){return gl(this,e,n),this}setBlockType(e,n=e,r,u=null){return bl(this,e,n,r,u),this}setNodeMarkup(e,n,r=null,u){return kl(this,e,n,r,u),this}setNodeAttribute(e,n,r){return this.step(new ft(e,n,r)),this}setDocAttribute(e,n){return this.step(new vt(e,n)),this}addNodeMark(e,n){return this.step(new ze(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof T)n.isInSet(r.marks)&&this.step(new nt(e,n));else{let u=r.marks,i,s=[];for(;i=n.isInSet(u);)s.push(new nt(e,i)),u=i.removeFromSet(u);for(let o=s.length-1;o>=0;o--)this.step(s[o])}return this}split(e,n=1,r){return yl(this,e,n,r),this}addMark(e,n,r){return cl(this,e,n,r),this}removeMark(e,n,r){return fl(this,e,n,r),this}clearIncompatible(e,n,r){return zr(this,e,n,r),this}}const Vn=Object.create(null);class O{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Il(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=D.empty){let r=n.content.lastChild,u=null;for(let o=0;o<n.openEnd;o++)u=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:l,$to:a}=s[o],c=e.mapping.slice(i);e.replaceRange(c.map(l.pos),c.map(a.pos),o?D.empty:n),o==0&&Cu(e,i,(r?r.isInline:u&&u.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,u=this.ranges;for(let i=0;i<u.length;i++){let{$from:s,$to:o}=u[i],l=e.mapping.slice(r),a=l.map(s.pos),c=l.map(o.pos);i?e.deleteRange(a,c):(e.replaceRangeWith(a,c,n),Cu(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let u=e.parent.inlineContent?new F(e):at(e.node(0),e.parent,e.pos,e.index(),n,r);if(u)return u;for(let i=e.depth-1;i>=0;i--){let s=n<0?at(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):at(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new ne(e.node(0))}static atStart(e){return at(e,e,0,0,1)||new ne(e)}static atEnd(e){return at(e,e,e.content.size,e.childCount,-1)||new ne(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Vn[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Vn)throw new RangeError("Duplicate use of selection JSON ID "+e);return Vn[e]=n,n.prototype.jsonID=e,n}getBookmark(){return F.between(this.$anchor,this.$head).getBookmark()}}O.prototype.visible=!0;class Il{constructor(e,n){this.$from=e,this.$to=n}}let ku=!1;function yu(t){!ku&&!t.parent.inlineContent&&(ku=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class F extends O{constructor(e,n=e){yu(e),yu(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return O.near(r);let u=e.resolve(n.map(this.anchor));return new F(u.parent.inlineContent?u:r,r)}replace(e,n=D.empty){if(super.replace(e,n),n==D.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof F&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Sn(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new F(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let u=e.resolve(n);return new this(u,r==n?u:e.resolve(r))}static between(e,n,r){let u=e.pos-n.pos;if((!r||u)&&(r=u>=0?1:-1),!n.parent.inlineContent){let i=O.findFrom(n,r,!0)||O.findFrom(n,-r,!0);if(i)n=i.$head;else return O.near(n,r)}return e.parent.inlineContent||(u==0?e=n:(e=(O.findFrom(e,-r,!0)||O.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=u<0&&(e=n))),new F(e,n)}}O.jsonID("text",F);class Sn{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Sn(e.map(this.anchor),e.map(this.head))}resolve(e){return F.between(e.resolve(this.anchor),e.resolve(this.head))}}class A extends O{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:u}=n.mapResult(this.anchor),i=e.resolve(u);return r?O.near(i):new A(i)}content(){return new D(x.from(this.node),0,0)}eq(e){return e instanceof A&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Lr(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new A(e.resolve(n.anchor))}static create(e,n){return new A(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}A.prototype.visible=!1;O.jsonID("node",A);class Lr{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Sn(r,r):new Lr(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&A.isSelectable(r)?new A(n):O.near(n)}}class ne extends O{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=D.empty){if(n==D.empty){e.delete(0,e.doc.content.size);let r=O.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ne(e)}map(e){return new ne(e)}eq(e){return e instanceof ne}getBookmark(){return Rl}}O.jsonID("all",ne);const Rl={map(){return this},resolve(t){return new ne(t)}};function at(t,e,n,r,u,i=!1){if(e.inlineContent)return F.create(t,n);for(let s=r-(u>0?0:1);u>0?s<e.childCount:s>=0;s+=u){let o=e.child(s);if(o.isAtom){if(!i&&A.isSelectable(o))return A.create(t,n-(u<0?o.nodeSize:0))}else{let l=at(t,o,n+u,u<0?o.childCount:0,u,i);if(l)return l}n+=o.nodeSize*u}return null}function Cu(t,e,n){let r=t.steps.length-1;if(r<e)return;let u=t.steps[r];if(!(u instanceof j||u instanceof Y))return;let i=t.mapping.maps[r],s;i.forEach((o,l,a,c)=>{s==null&&(s=c)}),t.setSelection(O.near(t.doc.resolve(s),n))}const Du=1,tn=2,_u=4;class Bl extends Nl{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|Du)&~tn,this.storedMarks=null,this}get selectionSet(){return(this.updated&Du)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=tn,this}ensureMarks(e){return T.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&tn)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~tn,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||T.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let u=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(u.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,u.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(O.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=_u,this}get scrolledIntoView(){return(this.updated&_u)>0}}function Eu(t,e){return!e||!t?t:t.bind(e)}class Mt{constructor(e,n,r){this.name=e,this.init=Eu(n.init,r),this.apply=Eu(n.apply,r)}}const zl=[new Mt("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Mt("selection",{init(t,e){return t.selection||O.atStart(e.doc)},apply(t){return t.selection}}),new Mt("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Mt("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class $n{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=zl.slice(),n&&n.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 Mt(r.key,r.spec.state,r))})}}class Ue{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let u=this.config.plugins[r];if(u.spec.filterTransaction&&!u.spec.filterTransaction.call(u,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),u=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let o=this.config.plugins[s];if(o.spec.appendTransaction){let l=u?u[s].n:0,a=u?u[s].state:this,c=l<n.length&&o.spec.appendTransaction.call(o,l?n.slice(l):n,a,r);if(c&&r.filterTransaction(c,s)){if(c.setMeta("appendedTransaction",e),!u){u=[];for(let f=0;f<this.config.plugins.length;f++)u.push(f<s?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),i=!0}u&&(u[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Ue(this.config),r=this.config.fields;for(let u=0;u<r.length;u++){let i=r[u];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new Bl(this)}static create(e){let n=new $n(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ue(n);for(let u=0;u<n.fields.length;u++)r[n.fields[u].name]=n.fields[u].init(e,r);return r}reconfigure(e){let n=new $n(this.schema,e.plugins),r=n.fields,u=new Ue(n);for(let i=0;i<r.length;i++){let s=r[i].name;u[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,u)}return u}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.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 u=e[r],i=u.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(u,this[u.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let u=new $n(e.schema,e.plugins),i=new Ue(u);return u.fields.forEach(s=>{if(s.name=="doc")i.doc=xe.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=O.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let o in r){let l=r[o],a=l.spec.state;if(l.key==s.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(n,o)){i[s.name]=a.fromJSON.call(l,e,n[o],i);return}}i[s.name]=s.init(e,i)}}),i}}function ss(t,e,n){for(let r in t){let u=t[r];u instanceof Function?u=u.bind(e):r=="handleDOMEvents"&&(u=ss(u,e,{})),n[r]=u}return n}class qr{constructor(e){this.spec=e,this.props={},e.props&&ss(e.props,this,this.props),this.key=e.key?e.key.key:ls("plugin")}getState(e){return e[this.key]}}const Wn=Object.create(null);function ls(t){return t in Wn?t+"$"+ ++Wn[t]:(Wn[t]=0,t+"$")}class as{constructor(e="key"){this.key=ls(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const cs=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function vl(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Pl=(t,e,n)=>{let r=vl(t,n);if(!r)return!1;let u=fs(r);if(!u){let s=r.blockRange(),o=s&&Jt(s);return o==null?!1:(e&&e(t.tr.lift(s,o).scrollIntoView()),!0)}let i=u.nodeBefore;if(hs(t,u,e,-1))return!0;if(r.parent.content.size==0&&(mt(i,"end")||A.isSelectable(i)))for(let s=r.depth;;s--){let o=Pr(t.doc,r.before(s),r.after(s),D.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(mt(i,"end")?O.findFrom(l.doc.resolve(l.mapping.map(u.pos,-1)),-1):A.create(l.doc,u.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&u.depth==r.depth-1?(e&&e(t.tr.delete(u.pos-i.nodeSize,u.pos).scrollIntoView()),!0):!1};function mt(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Ll=(t,e,n)=>{let{$head:r,empty:u}=t.selection,i=r;if(!u)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=fs(r)}let s=i&&i.nodeBefore;return!s||!A.isSelectable(s)?!1:(e&&e(t.tr.setSelection(A.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function fs(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function ql(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Vl=(t,e,n)=>{let r=ql(t,n);if(!r)return!1;let u=ds(r);if(!u)return!1;let i=u.nodeAfter;if(hs(t,u,e,1))return!0;if(r.parent.content.size==0&&(mt(i,"start")||A.isSelectable(i))){let s=Pr(t.doc,r.before(),r.after(),D.empty);if(s&&s.slice.size<s.to-s.from){if(e){let o=t.tr.step(s);o.setSelection(mt(i,"start")?O.findFrom(o.doc.resolve(o.mapping.map(u.pos)),1):A.create(o.doc,o.mapping.map(u.pos))),e(o.scrollIntoView())}return!0}}return i.isAtom&&u.depth==r.depth-1?(e&&e(t.tr.delete(u.pos,u.pos+i.nodeSize).scrollIntoView()),!0):!1},$l=(t,e,n)=>{let{$head:r,empty:u}=t.selection,i=r;if(!u)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=ds(r)}let s=i&&i.nodeAfter;return!s||!A.isSelectable(s)?!1:(e&&e(t.tr.setSelection(A.create(t.doc,i.pos)).scrollIntoView()),!0)};function ds(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Wl=(t,e)=>{let{$from:n,$to:r}=t.selection,u=n.blockRange(r),i=u&&Jt(u);return i==null?!1:(e&&e(t.tr.lift(u,i).scrollIntoView()),!0)},Hl=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
6
|
-
`).scrollIntoView()),!0)};function Vr(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Jl=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let u=n.node(-1),i=n.indexAfter(-1),s=Vr(u.contentMatchAt(i));if(!s||!u.canReplaceWith(i,i,s))return!1;if(e){let o=n.after(),l=t.tr.replaceWith(o,o,s.createAndFill());l.setSelection(O.near(l.doc.resolve(o),1)),e(l.scrollIntoView())}return!0},jl=(t,e)=>{let n=t.selection,{$from:r,$to:u}=n;if(n instanceof ne||r.parent.inlineContent||u.parent.inlineContent)return!1;let i=Vr(u.parent.contentMatchAt(u.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&u.index()<u.parent.childCount?r:u).pos,o=t.tr.insert(s,i.createAndFill());o.setSelection(F.create(o.doc,s+1)),e(o.scrollIntoView())}return!0},Ul=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Ot(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),u=r&&Jt(r);return u==null?!1:(e&&e(t.tr.lift(r,u).scrollIntoView()),!0)};function Kl(t){return(e,n)=>{let{$from:r,$to:u}=e.selection;if(e.selection instanceof A&&e.selection.node.isBlock)return!r.parentOffset||!Ot(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,o,l=!1,a=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),a=r.start(h)==r.pos-(r.depth-h),o=Vr(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),i.unshift(l&&o?{type:o}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let c=e.tr;(e.selection instanceof F||e.selection instanceof ne)&&c.deleteSelection();let f=c.mapping.map(r.pos),p=Ot(c.doc,f,i.length,i);if(p||(i[0]=o?{type:o}:null,p=Ot(c.doc,f,i.length,i)),!p)return!1;if(c.split(f,i.length,i),!l&&a&&r.node(s).type!=o){let h=c.mapping.map(r.before(s)),d=c.doc.resolve(h);o&&r.node(s-1).canReplaceWith(d.index(),d.index()+1,o)&&c.setNodeMarkup(c.mapping.map(r.before(s)),o)}return n&&n(c.scrollIntoView()),!0}}const Gl=Kl(),Zl=(t,e)=>(e&&e(t.tr.setSelection(new ne(t.doc))),!0);function Yl(t,e,n){let r=e.nodeBefore,u=e.nodeAfter,i=e.index();return!r||!u||!r.type.compatibleContent(u.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(u.isTextblock||vr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function hs(t,e,n,r){let u=e.nodeBefore,i=e.nodeAfter,s,o,l=u.type.spec.isolating||i.type.spec.isolating;if(!l&&Yl(t,e,n))return!0;let a=!l&&e.parent.canReplace(e.index(),e.index()+1);if(a&&(s=(o=u.contentMatchAt(u.childCount)).findWrapping(i.type))&&o.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,d=x.empty;for(let b=s.length-1;b>=0;b--)d=x.from(s[b].create(null,d));d=x.from(u.copy(d));let m=t.tr.step(new Y(e.pos-1,h,e.pos,h,new D(d,1,0),s.length,!0)),g=m.doc.resolve(h+2*s.length);g.nodeAfter&&g.nodeAfter.type==u.type&&vr(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let c=i.type.spec.isolating||r>0&&l?null:O.findFrom(e,1),f=c&&c.$from.blockRange(c.$to),p=f&&Jt(f);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(f,p).scrollIntoView()),!0;if(a&&mt(i,"start",!0)&&mt(u,"end")){let h=u,d=[];for(;d.push(h),!h.isTextblock;)h=h.lastChild;let m=i,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let b=x.empty;for(let y=d.length-1;y>=0;y--)b=x.from(d[y].copy(b));let k=t.tr.step(new Y(e.pos-d.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new D(b,d.length,0),0,!0));n(k.scrollIntoView())}return!0}}return!1}function ps(t){return function(e,n){let r=e.selection,u=t<0?r.$from:r.$to,i=u.depth;for(;u.node(i).isInline;){if(!i)return!1;i--}return u.node(i).isTextblock?(n&&n(e.tr.setSelection(F.create(e.doc,t<0?u.start(i):u.end(i)))),!0):!1}}const Xl=ps(-1),Ql=ps(1);function ea(t,e=null){return function(n,r){let{$from:u,$to:i}=n.selection,s=u.blockRange(i),o=s&&Qi(s,t,e);return o?(r&&r(n.tr.wrap(s,o).scrollIntoView()),!0):!1}}function br(t,e=null){return function(n,r){let u=!1;for(let i=0;i<n.selection.ranges.length&&!u;i++){let{$from:{pos:s},$to:{pos:o}}=n.selection.ranges[i];n.doc.nodesBetween(s,o,(l,a)=>{if(u)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)u=!0;else{let c=n.doc.resolve(a),f=c.index();u=c.parent.canReplaceWith(f,f+1,t)}})}if(!u)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[s];i.setBlockType(o,l,t,e)}r(i.scrollIntoView())}return!0}}function ta(t,e,n,r){for(let u=0;u<e.length;u++){let{$from:i,$to:s}=e[u],o=i.depth==0?t.inlineContent&&t.type.allowsMarkType(n):!1;if(t.nodesBetween(i.pos,s.pos,(l,a)=>{if(o)return!1;o=l.inlineContent&&l.type.allowsMarkType(n)}),o)return!0}return!1}function on(t,e=null,n){return function(r,u){let{empty:i,$cursor:s,ranges:o}=r.selection;if(i&&!s||!ta(r.doc,o,t))return!1;if(u)if(s)t.isInSet(r.storedMarks||s.marks())?u(r.tr.removeStoredMark(t)):u(r.tr.addStoredMark(t.create(e)));else{let l,a=r.tr;l=!o.some(c=>r.doc.rangeHasMark(c.$from.pos,c.$to.pos,t));for(let c=0;c<o.length;c++){let{$from:f,$to:p}=o[c];if(!l)a.removeMark(f.pos,p.pos,t);else{let h=f.pos,d=p.pos,m=f.nodeAfter,g=p.nodeBefore,b=m&&m.isText?/^\s*/.exec(m.text)[0].length:0,k=g&&g.isText?/\s*$/.exec(g.text)[0].length:0;h+b<d&&(h+=b,d-=k),a.addMark(h,d,t.create(e))}}u(a.scrollIntoView())}return!0}}function $r(...t){return function(e,n,r){for(let u=0;u<t.length;u++)if(t[u](e,n,r))return!0;return!1}}let Hn=$r(cs,Pl,Ll),Su=$r(cs,Vl,$l);const Se={Enter:$r(Hl,jl,Ul,Gl),"Mod-Enter":Jl,Backspace:Hn,"Mod-Backspace":Hn,"Shift-Backspace":Hn,Delete:Su,"Mod-Delete":Su,"Mod-a":Zl},ms={"Ctrl-h":Se.Backspace,"Alt-Backspace":Se["Mod-Backspace"],"Ctrl-d":Se.Delete,"Ctrl-Alt-Backspace":Se["Mod-Delete"],"Alt-Delete":Se["Mod-Delete"],"Alt-d":Se["Mod-Delete"],"Ctrl-a":Xl,"Ctrl-e":Ql};for(let t in Se)ms[t]=Se[t];const na=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,ra=na?ms:Se;function gs(t,e){return bs(t,e)!=null}function bs(t,e){const{from:n,$from:r,to:u,empty:i}=t.selection;if(!e)return null;if(i){if(t.storedMarks){const c=t.storedMarks.find(f=>f.type.name===e.name);if(c!=null)return c}const l=r.marks().find(c=>c.type.name===e.name);if(l!=null)return l;const a=r.nodeAfter;if(a&&a.marks){const c=a.marks.find(f=>f.type.name===e.name);if(c!=null)return c}return null}let s=null;return t.doc.nodesBetween(n,u,o=>{if(s!=null)return!1;if(o.marks){const l=o.marks.find(a=>a.type.name===e.name);if(l!=null)return s=l,!1}}),s}function ln(t,e,n){return t.map(()=>{const r=e.value,u=r.state.schema.marks[n];return gs(r.state,u)})}function ua(t,e,n){const{$from:r}=t.selection;for(let i=r.depth;i>0;i--){const s=r.node(i);if(s.type.name===e.name)return n!=null?Object.keys(n).every(o=>s.attrs[o]===n[o]):!0}const u=t.doc.nodeAt(r.pos);return u&&u.type.name===e.name?n!=null?Object.keys(n).every(i=>u.attrs[i]===n[i]):!0:!1}function Dt(t,e,n,r){return t.map(()=>{const u=e.value,i=u.state.schema.nodes[n];return i?ua(u.state,i,r):!1})}function ia(t,e){const n=t.state.schema.marks.link;if(n==null)return;const{from:r,to:u}=t.state.selection,i=t.state.tr.addMark(r,u,n.create({href:e,title:null}));t.dispatch(i),t.focus()}function xs(t){const{state:e}=t,{$from:n,$to:r}=e.selection;if(!ks(e))return null;let u=n.pos,i=r.pos;const s=e.doc;for(;u>0&&s.resolve(u-1).nodeAfter?.marks?.some(a=>a.type.name==="link");)u--;for(;i<s.content.size&&s.resolve(i).nodeAfter?.marks?.some(a=>a.type.name==="link");)i++;return{start:u,end:i}}function sa(t,e){const n=t.state.schema.marks.link;if(n==null)return;const r=xs(t);if(r==null)return;const{start:u,end:i}=r,s=t.state.tr.removeMark(u,i,n).addMark(u,i,n.create({href:e,title:null}));t.dispatch(s)}function oa(t){const e=t.state.schema.marks.link;if(e==null)return;const n=xs(t);if(n==null)return;const{start:r,end:u}=n,i=t.state.tr.removeMark(r,u,e);t.dispatch(i),t.focus()}function ks(t){return gs(t,t.schema.marks.link)}function la({stateUpdate:t,view:e,isReadOnly:n,label:r,linkUrlPlaceholder:u,size:i}){const s=S.prop(null);s.on(l=>{l!=null&&sa(e.value,l)});const o=t.on(()=>{const l=bs(e.value.state,e.value.state.schema.marks.link);l!=null?s.set(l.attrs.href??""):s.set(null)});return S.Fragment(S.OnDispose(o),dr.ToolbarGroup(Z.EditorToolbarButton({display:S.signal(!0),active:ln(t,e,"link"),disabled:n,label:r,icon:"mdi:link-variant",size:i,onClick:()=>{const l=e.value.state;ks(l)?(oa(e.value),s.set(null)):(ia(e.value,""),s.set(""))}}),S.Ensure(s,l=>Ro.TextInput({value:l,autofocus:!0,onInput:s.set,placeholder:u,size:i}))),S.Ensure(s,l=>dr.ToolbarButton({disabled:l.map(a=>a.trim()===""),variant:"text",onClick:()=>{const a=s.value;a&&window.open(a,"_blank")},size:i},"go")))}function ys({view:t,stateUpdate:e,features:n,readOnly:r=S.signal(!1),size:u="sm"}){return S.Ensure(t,i=>S.Use(Bo.BeatUII18n,s=>{const o=s.$.prosemirror,l=i;return dr.Toolbar(Z.EditorToolbarGroup({display:[n.$.bold,n.$.italic,n.$.code]},Z.EditorToolbarButton({active:ln(e,l,"strong"),display:n.$.bold,onClick:()=>Jn(l.value,"strong"),disabled:r,label:o.$.bold,icon:"mdi:format-bold",size:u}),Z.EditorToolbarButton({active:ln(e,l,"em"),display:n.$.italic,onClick:()=>Jn(l.value,"em"),disabled:r,label:o.$.italic,icon:"mdi:format-italic",size:u}),Z.EditorToolbarButton({active:ln(e,l,"code"),display:n.$.code,onClick:()=>Jn(l.value,"code"),disabled:r,label:o.$.code,icon:"mdi:code-tags",size:u})),Z.EditorToolbarGroup({display:[n.$.headings]},S.Repeat(n.$.headerLevels.map(a=>Math.min(Math.max(a,1),6)),({counter:a})=>Z.EditorToolbarButton({active:Dt(e,l,"heading",{level:a}),display:n.$.headings,onClick:()=>aa(l.value,a),disabled:r,label:o.map(c=>c.heading(a)),icon:`mdi:format-header-${a}`,size:u}))),Z.EditorToolbarGroup({display:[n.$.bulletList,n.$.orderedList]},Z.EditorToolbarButton({active:Dt(e,l,"bullet_list"),display:n.$.bulletList,onClick:()=>Au(l.value,"bullet_list"),disabled:r,label:o.$.bulletList,icon:"mdi:format-list-bulleted",size:u}),Z.EditorToolbarButton({active:Dt(e,l,"ordered_list"),display:n.$.orderedList,onClick:()=>Au(l.value,"ordered_list"),disabled:r,label:o.$.orderedList,icon:"mdi:format-list-numbered",size:u})),Z.EditorToolbarGroup({display:[n.$.blockquote,n.$.codeBlock,n.$.horizontalRule]},Z.EditorToolbarButton({active:Dt(e,l,"blockquote"),display:n.$.blockquote,onClick:()=>ca(l.value),disabled:r,label:o.$.blockquote,icon:"mdi:format-quote-close",size:u}),Z.EditorToolbarButton({active:Dt(e,l,"code_block"),display:n.$.codeBlock,onClick:()=>fa(l.value),disabled:r,label:o.$.codeBlock,icon:"mdi:code-braces",size:u}),Z.EditorToolbarButton({active:S.signal(!1),display:n.$.horizontalRule,onClick:()=>da(l.value),disabled:r,label:o.$.horizontalRule,icon:"mdi:minus",size:u})),S.When(n.$.links,()=>la({stateUpdate:e,view:l,isReadOnly:r,label:o.$.link,linkUrlPlaceholder:o.$.linkUrlPlaceholder,size:u})))}))}function Jn(t,e){const n=t.state.schema.marks[e];n!=null&&(on(n)(t.state,t.dispatch),t.focus())}function aa(t,e){const n=t.state.schema.nodes.heading;n!=null&&(br(n,{level:e})(t.state,t.dispatch),t.focus())}async function Au(t,e){const{wrapInList:n,liftListItem:r}=await Promise.resolve().then(()=>require("./index-qa82MK4Z.cjs")),u=t.state.schema.nodes[e],i=t.state.schema.nodes.list_item;if(u==null||i==null)return;const{state:s}=t,{$from:o}=s.selection;let l=null;for(let a=o.depth;a>0;a--){const c=o.node(a);if(c.type.name==="bullet_list"||c.type.name==="ordered_list"){l=c.type.name;break}}l===e?r(i)(s,t.dispatch):l!=null?r(i)(t.state,t.dispatch)&&n(u)(t.state,t.dispatch):n(u)(s,t.dispatch),t.focus()}function ca(t){const e=t.state.schema.nodes.blockquote;if(e==null)return;const{state:n}=t,{$from:r}=n.selection;let u=!1;for(let i=r.depth;i>0;i--)if(r.node(i).type.name==="blockquote"){u=!0;break}u?Wl(n,t.dispatch):ea(e)(n,t.dispatch),t.focus()}function fa(t){const e=t.state.schema.nodes.code_block,n=t.state.schema.nodes.paragraph;if(e==null||n==null)return;const{state:r}=t,{$from:u}=r.selection;let i=!1;for(let s=u.depth;s>0;s--)if(u.node(s).type.name==="code_block"){i=!0;break}i?br(n)(r,t.dispatch):br(e)(r,t.dispatch),t.focus()}function da(t){const e=t.state.schema.nodes.horizontal_rule;if(e!=null){const n=t.state.tr.replaceSelectionWith(e.create());t.dispatch(n),t.focus()}}const $=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},gt=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let xr=null;const Ee=function(t,e,n){let r=xr||(xr=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},ha=function(){xr=null},rt=function(t,e,n,r){return n&&(Mu(t,e,n,r,-1)||Mu(t,e,n,r,1))},pa=/^(img|br|input|textarea|hr)$/i;function Mu(t,e,n,r,u){for(var i;;){if(t==n&&e==r)return!0;if(e==(u<0?0:se(t))){let s=t.parentNode;if(!s||s.nodeType!=1||jt(t)||pa.test(t.nodeName)||t.contentEditable=="false")return!1;e=$(t)+(u<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(u<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=u;else return!1;else t=s,e=u<0?se(t):0}else return!1}}function se(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ma(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=se(t)}else if(t.parentNode&&!jt(t))e=$(t),t=t.parentNode;else return null}}function ga(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!jt(t))e=$(t)+1,t=t.parentNode;else return null}}function ba(t,e,n){for(let r=e==0,u=e==se(t);r||u;){if(t==n)return!0;let i=$(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,u=u&&i==se(t)}}function jt(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const An=function(t){return t.focusNode&&rt(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function je(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function xa(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function ka(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(se(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(se(r.startContainer),r.startOffset)}}}const ke=typeof navigator<"u"?navigator:null,wu=typeof document<"u"?document:null,He=ke&&ke.userAgent||"",kr=/Edge\/(\d+)/.exec(He),Cs=/MSIE \d/.exec(He),yr=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(He),X=!!(Cs||yr||kr),Le=Cs?document.documentMode:yr?+yr[1]:kr?+kr[1]:0,oe=!X&&/gecko\/(\d+)/i.test(He);oe&&+(/Firefox\/(\d+)/.exec(He)||[0,0])[1];const Cr=!X&&/Chrome\/(\d+)/.exec(He),L=!!Cr,Ds=Cr?+Cr[1]:0,H=!X&&!!ke&&/Apple Computer/.test(ke.vendor),bt=H&&(/Mobile\/\w+/.test(He)||!!ke&&ke.maxTouchPoints>2),ie=bt||(ke?/Mac/.test(ke.platform):!1),_s=ke?/Win/.test(ke.platform):!1,Ae=/Android \d/.test(He),Ut=!!wu&&"webkitFontSmoothing"in wu.documentElement.style,ya=Ut?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ca(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function _e(t,e){return typeof t=="number"?t:t[e]}function Da(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Tu(t,e,n){let r=t.someProp("scrollThreshold")||0,u=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=gt(s);continue}let o=s,l=o==i.body,a=l?Ca(i):Da(o),c=0,f=0;if(e.top<a.top+_e(r,"top")?f=-(a.top-e.top+_e(u,"top")):e.bottom>a.bottom-_e(r,"bottom")&&(f=e.bottom-e.top>a.bottom-a.top?e.top+_e(u,"top")-a.top:e.bottom-a.bottom+_e(u,"bottom")),e.left<a.left+_e(r,"left")?c=-(a.left-e.left+_e(u,"left")):e.right>a.right-_e(r,"right")&&(c=e.right-a.right+_e(u,"right")),c||f)if(l)i.defaultView.scrollBy(c,f);else{let h=o.scrollLeft,d=o.scrollTop;f&&(o.scrollTop+=f),c&&(o.scrollLeft+=c);let m=o.scrollLeft-h,g=o.scrollTop-d;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let p=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:gt(s)}}function _a(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,u;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let o=t.root.elementFromPoint(i,s);if(!o||o==t.dom||!t.dom.contains(o))continue;let l=o.getBoundingClientRect();if(l.top>=n-20){r=o,u=l.top;break}}return{refDOM:r,refTop:u,stack:Es(t.dom)}}function Es(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=gt(r));return e}function Ea({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Ss(n,r==0?0:r-e)}function Ss(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:u,left:i}=t[n];r.scrollTop!=u+e&&(r.scrollTop=u+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let st=null;function Sa(t){if(t.setActive)return t.setActive();if(st)return t.focus(st);let e=Es(t);t.focus(st==null?{get preventScroll(){return st={preventScroll:!0},!0}}:void 0),st||(st=!1,Ss(e,0))}function As(t,e){let n,r=2e8,u,i=0,s=e.top,o=e.top,l,a;for(let c=t.firstChild,f=0;c;c=c.nextSibling,f++){let p;if(c.nodeType==1)p=c.getClientRects();else if(c.nodeType==3)p=Ee(c).getClientRects();else continue;for(let h=0;h<p.length;h++){let d=p[h];if(d.top<=s&&d.bottom>=o){s=Math.max(d.bottom,s),o=Math.min(d.top,o);let m=d.left>e.left?d.left-e.left:d.right<e.left?e.left-d.right:0;if(m<r){n=c,r=m,u=m&&n.nodeType==3?{left:d.right<e.left?d.right:d.left,top:e.top}:e,c.nodeType==1&&m&&(i=f+(e.left>=(d.left+d.right)/2?1:0));continue}}else d.top>e.top&&!l&&d.left<=e.left&&d.right>=e.left&&(l=c,a={left:Math.max(d.left,Math.min(d.right,e.left)),top:d.top});!n&&(e.left>=d.right&&e.top>=d.top||e.left>=d.left&&e.top>=d.bottom)&&(i=f+1)}}return!n&&l&&(n=l,u=a,r=0),n&&n.nodeType==3?Aa(n,u):!n||r&&n.nodeType==1?{node:t,offset:i}:As(n,u)}function Aa(t,e){let n=t.nodeValue.length,r=document.createRange(),u;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let s=Te(r,1);if(s.top!=s.bottom&&Wr(e,s)){u={node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),u||{node:t,offset:0}}function Wr(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Ma(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function wa(t,e,n){let{node:r,offset:u}=As(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,u,i)}function Ta(t,e,n,r){let u=-1;for(let i=e,s=!1;i!=t.dom;){let o=t.docView.nearestDesc(i,!0),l;if(!o)return null;if(o.dom.nodeType==1&&(o.node.isBlock&&o.parent||!o.contentDOM)&&((l=o.dom.getBoundingClientRect()).width||l.height)&&(o.node.isBlock&&o.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(o.dom.nodeName)&&(!s&&l.left>r.left||l.top>r.top?u=o.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(u=o.posAfter),s=!0),!o.contentDOM&&u<0&&!o.node.isText))return(o.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?o.posBefore:o.posAfter;i=o.dom.parentNode}return u>-1?u:t.docView.posFromDOM(e,n,-1)}function Ms(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let u=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=u;;){let s=t.childNodes[i];if(s.nodeType==1){let o=s.getClientRects();for(let l=0;l<o.length;l++){let a=o[l];if(Wr(e,a))return Ms(s,e,a)}}if((i=(i+1)%r)==u)break}return t}function Oa(t,e){let n=t.dom.ownerDocument,r,u=0,i=ka(n,e.left,e.top);i&&({node:r,offset:u}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),o;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let a=t.dom.getBoundingClientRect();if(!Wr(e,a)||(s=Ms(t.dom,e,a),!s))return null}if(H)for(let a=s;r&&a;a=gt(a))a.draggable&&(r=void 0);if(s=Ma(s,e),r){if(oe&&r.nodeType==1&&(u=Math.min(u,r.childNodes.length),u<r.childNodes.length)){let c=r.childNodes[u],f;c.nodeName=="IMG"&&(f=c.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&u++}let a;Ut&&u&&r.nodeType==1&&(a=r.childNodes[u-1]).nodeType==1&&a.contentEditable=="false"&&a.getBoundingClientRect().top>=e.top&&u--,r==t.dom&&u==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?o=t.state.doc.content.size:(u==0||r.nodeType!=1||r.childNodes[u-1].nodeName!="BR")&&(o=Ta(t,r,u,e))}o==null&&(o=wa(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:o,inside:l?l.posAtStart-l.border:-1}}function Ou(t){return t.top<t.bottom||t.left<t.right}function Te(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Ou(r))return r}return Array.prototype.find.call(n,Ou)||t.getBoundingClientRect()}const Fa=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ws(t,e,n){let{node:r,offset:u,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=Ut||oe;if(r.nodeType==3)if(s&&(Fa.test(r.nodeValue)||(n<0?!u:u==r.nodeValue.length))){let l=Te(Ee(r,u,u),n);if(oe&&u&&/\s/.test(r.nodeValue[u-1])&&u<r.nodeValue.length){let a=Te(Ee(r,u-1,u-1),-1);if(a.top==l.top){let c=Te(Ee(r,u,u+1),-1);if(c.top!=l.top)return _t(c,c.left<a.left)}}return l}else{let l=u,a=u,c=n<0?1:-1;return n<0&&!u?(a++,c=-1):n>=0&&u==r.nodeValue.length?(l--,c=1):n<0?l--:a++,_t(Te(Ee(r,l,a),c),c<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&u&&(n<0||u==se(r))){let l=r.childNodes[u-1];if(l.nodeType==1)return jn(l.getBoundingClientRect(),!1)}if(i==null&&u<se(r)){let l=r.childNodes[u];if(l.nodeType==1)return jn(l.getBoundingClientRect(),!0)}return jn(r.getBoundingClientRect(),n>=0)}if(i==null&&u&&(n<0||u==se(r))){let l=r.childNodes[u-1],a=l.nodeType==3?Ee(l,se(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(a)return _t(Te(a,1),!1)}if(i==null&&u<se(r)){let l=r.childNodes[u];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let a=l?l.nodeType==3?Ee(l,0,s?0:1):l.nodeType==1?l:null:null;if(a)return _t(Te(a,-1),!0)}return _t(Te(r.nodeType==3?Ee(r):r,-n),n>=0)}function _t(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function jn(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Ts(t,e,n){let r=t.state,u=t.root.activeElement;r!=e&&t.updateState(e),u!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),u!=t.dom&&u&&u.focus()}}function Na(t,e,n){let r=e.selection,u=n=="up"?r.$from:r.$to;return Ts(t,e,()=>{let{node:i}=t.docView.domFromPos(u.pos,n=="up"?-1:1);for(;;){let o=t.docView.nearestDesc(i,!0);if(!o)break;if(o.node.isBlock){i=o.contentDOM||o.dom;break}i=o.dom.parentNode}let s=ws(t,u.pos,1);for(let o=i.firstChild;o;o=o.nextSibling){let l;if(o.nodeType==1)l=o.getClientRects();else if(o.nodeType==3)l=Ee(o,0,o.nodeValue.length).getClientRects();else continue;for(let a=0;a<l.length;a++){let c=l[a];if(c.bottom>c.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}const Ia=/[\u0590-\u08ac]/;function Ra(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let u=r.parentOffset,i=!u,s=u==r.parent.content.size,o=t.domSelection();return o?!Ia.test(r.parent.textContent)||!o.modify?n=="left"||n=="backward"?i:s:Ts(t,e,()=>{let{focusNode:l,focusOffset:a,anchorNode:c,anchorOffset:f}=t.domSelectionRange(),p=o.caretBidiLevel;o.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:d,focusOffset:m}=t.domSelectionRange(),g=d&&!h.contains(d.nodeType==1?d:d.parentNode)||l==d&&a==m;try{o.collapse(c,f),l&&(l!=c||a!=f)&&o.extend&&o.extend(l,a)}catch{}return p!=null&&(o.caretBidiLevel=p),g}):r.pos==r.start()||r.pos==r.end()}let Fu=null,Nu=null,Iu=!1;function Ba(t,e,n){return Fu==e&&Nu==n?Iu:(Fu=e,Nu=n,Iu=n=="up"||n=="down"?Na(t,e,n):Ra(t,e,n))}const le=0,Ru=1,Ke=2,ye=3;class Kt{constructor(e,n,r,u){this.parent=e,this.children=n,this.dom=r,this.contentDOM=u,this.dirty=le,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let u=this.children[n];if(u==e)return r;r+=u.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let u;if(e==this.dom&&this.contentDOM)u=n>$(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))u=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){u=!1;break}if(i.previousSibling)break}if(u==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){u=!0;break}if(i.nextSibling)break}}return u??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,u=e;u;u=u.parentNode){let i=this.getDesc(u),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let u=e;u;u=u.parentNode){let i=this.getDesc(u);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let u=this.children[n],i=r+u.size;if(r==e&&i!=r){for(;!u.border&&u.children.length;)for(let s=0;s<u.children.length;s++){let o=u.children[s];if(o.size){u=o;break}}return u}if(e<i)return u.descAt(e-r-u.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,u=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],o=i+s.size;if(o>e||s instanceof Fs){u=e-i;break}i=o}if(u)return this.children[r].domFromPos(u-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Os&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?$(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?$(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let u=-1,i=-1;for(let s=r,o=0;;o++){let l=this.children[o],a=s+l.size;if(u==-1&&e<=a){let c=s+l.border;if(e>=c&&n<=a-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,c);e=s;for(let f=o;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){u=$(p.dom)+1;break}e-=p.size}u==-1&&(u=0)}if(u>-1&&(a>n||o==this.children.length-1)){n=a;for(let c=o+1;c<this.children.length;c++){let f=this.children[c];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=$(f.dom);break}n+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=a}return{node:this.contentDOM,from:e,to:n,fromOffset:u,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,u=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let h=0,d=0;h<this.children.length;h++){let m=this.children[h],g=d+m.size;if(i>d&&s<g)return m.setSelection(e-d-m.border,n-d-m.border,r,u);d=g}let o=this.domFromPos(e,e?-1:1),l=n==e?o:this.domFromPos(n,n?-1:1),a=r.root.getSelection(),c=r.domSelectionRange(),f=!1;if((oe||H)&&e==n){let{node:h,offset:d}=o;if(h.nodeType==3){if(f=!!(d&&h.nodeValue[d-1]==`
|
|
7
|
-
`),f&&d==h.nodeValue.length)for(let m=h,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(o=l={node:g.parentNode,offset:$(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=h.childNodes[d-1];f=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(oe&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(u=!0)}if(!(u||f&&H)&&rt(o.node,o.offset,c.anchorNode,c.anchorOffset)&&rt(l.node,l.offset,c.focusNode,c.focusOffset))return;let p=!1;if((a.extend||e==n)&&!(f&&oe)){a.collapse(o.node,o.offset);try{e!=n&&a.extend(l.node,l.offset),p=!0}catch{}}if(!p){if(e>n){let d=o;o=l,l=d}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(o.node,o.offset),a.removeAllRanges(),a.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,u=0;u<this.children.length;u++){let i=this.children[u],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let o=r+i.border,l=s-i.border;if(e>=o&&n<=l){this.dirty=e==r||n==s?Ke:Ru,e==o&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=ye:i.markDirty(e-o,n-o);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Ke:ye}r=s}this.dirty=Ke}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ke:Ru;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Os extends Kt{constructor(e,n,r,u){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return u;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let o=document.createElement("span");o.appendChild(s),s=o}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==le&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class za extends Kt{constructor(e,n,r,u){super(e,[],n,null),this.textDOM=r,this.text=u}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class ut extends Kt{constructor(e,n,r,u,i){super(e,[],r,u),this.mark=n,this.spec=i}static create(e,n,r,u){let i=u.nodeViews[n.type.name],s=i&&i(n,u,r);return(!s||!s.dom)&&(s=yt.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ut(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&ye||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ye&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=le){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=le}}slice(e,n,r){let u=ut.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=_r(i,n,s,r)),e>0&&(i=_r(i,0,e,r));for(let o=0;o<i.length;o++)i[o].parent=u;return u.children=i,u}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class qe extends Kt{constructor(e,n,r,u,i,s,o,l,a){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=u,this.nodeDOM=o}static create(e,n,r,u,i,s){let o=i.nodeViews[n.type.name],l,a=o&&o(n,i,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,u),c=a&&a.dom,f=a&&a.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:f}=yt.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let p=c;return c=Rs(c,r,n),a?l=new va(e,n,r,u,c,f||null,p,a,i,s+1):n.isText?new Mn(e,n,r,u,c,p,i):new qe(e,n,r,u,c,f||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>x.empty)}return e}matchesNode(e,n,r){return this.dirty==le&&e.eq(this.node)&&pn(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,u=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,o=i&&i.pos<0,l=new La(this,s&&s.node,e);$a(this.node,this.innerDeco,(a,c,f)=>{a.spec.marks?l.syncToMarks(a.spec.marks,r,e,c):a.type.side>=0&&!f&&l.syncToMarks(c==this.node.childCount?T.none:this.node.child(c).marks,r,e,c),l.placeWidget(a,e,u)},(a,c,f,p)=>{l.syncToMarks(a.marks,r,e,p);let h;l.findNodeMatch(a,c,f,p)||o&&e.state.selection.from>u&&e.state.selection.to<u+a.nodeSize&&(h=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(a,c,f,h,e)||l.updateNextNode(a,c,f,e,p,u)||l.addNode(a,c,f,e,u),u+=a.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Ke)&&(s&&this.protectLocalComposition(e,s),Ns(this.contentDOM,this.children,e),bt&&Wa(this.dom))}localCompositionInfo(e,n){let{from:r,to:u}=e.state.selection;if(!(e.state.selection instanceof F)||r<n||u>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,o=Ha(this.node.content,s,r-n,u-n);return o<0?null:{node:i,pos:o,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:u}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new za(this,i,n,u);e.input.compositionNodes.push(s),this.children=_r(this.children,r,r+u.length,e,s)}update(e,n,r,u){return this.dirty==ye||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,u),!0)}updateInner(e,n,r,u){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(u,this.posAtStart),this.dirty=le}updateOuterDeco(e){if(pn(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Is(this.dom,this.nodeDOM,Dr(this.outerDeco,this.node,n),Dr(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Bu(t,e,n,r,u){Rs(r,e,t);let i=new qe(void 0,t,e,n,r,r,r,u,0);return i.contentDOM&&i.updateChildren(u,0),i}class Mn extends qe{constructor(e,n,r,u,i,s,o){super(e,n,r,u,i,null,s,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,u){return this.dirty==ye||this.dirty!=le&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=le||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,u.trackWrites==this.nodeDOM&&(u.trackWrites=null)),this.node=e,this.dirty=le,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let u=this.node.cut(e,n),i=document.createTextNode(u.text);return new Mn(this.parent,u,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ye)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Fs extends Kt{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==le&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class va extends qe{constructor(e,n,r,u,i,s,o,l,a,c){super(e,n,r,u,i,s,o,a,c),this.spec=l}update(e,n,r,u){if(this.dirty==ye)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,u),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,u)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,u){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,u)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Ns(t,e,n){let r=t.firstChild,u=!1;for(let i=0;i<e.length;i++){let s=e[i],o=s.dom;if(o.parentNode==t){for(;o!=r;)r=zu(r),u=!0;r=r.nextSibling}else u=!0,t.insertBefore(o,r);if(s instanceof ut){let l=r?r.previousSibling:t.lastChild;Ns(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=zu(r),u=!0;u&&n.trackWrites==t&&(n.trackWrites=null)}const Ft=function(t){t&&(this.nodeName=t)};Ft.prototype=Object.create(null);const Ge=[new Ft];function Dr(t,e,n){if(t.length==0)return Ge;let r=n?Ge[0]:new Ft,u=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&u.push(r=new Ft(s.nodeName));for(let o in s){let l=s[o];l!=null&&(n&&u.length==1&&u.push(r=new Ft(e.isInline?"span":"div")),o=="class"?r.class=(r.class?r.class+" ":"")+l:o=="style"?r.style=(r.style?r.style+";":"")+l:o!="nodeName"&&(r[o]=l))}}}return u}function Is(t,e,n,r){if(n==Ge&&r==Ge)return e;let u=e;for(let i=0;i<r.length;i++){let s=r[i],o=n[i];if(i){let l;o&&o.nodeName==s.nodeName&&u!=t&&(l=u.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(u),o=Ge[0]),u=l}Pa(u,o||Ge[0],s)}return u}function Pa(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],u=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)u.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<u.length;i++)r.indexOf(u[i])==-1&&t.classList.add(u[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,u;for(;u=r.exec(e.style);)t.style.removeProperty(u[1])}n.style&&(t.style.cssText+=n.style)}}function Rs(t,e,n){return Is(t,t,Ge,Dr(e,n,t.nodeType!=1))}function pn(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function zu(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class La{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=qa(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,u){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=le,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1,a=this.top.children.length;u<this.preMatch.index&&(a=Math.min(this.index+3,a));for(let c=this.index;c<a;c++){let f=this.top.children[c];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){l=c;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let c=ut.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,u){let i=-1,s;if(u>=this.preMatch.index&&(s=this.preMatch.matches[u-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let o=this.index,l=Math.min(this.top.children.length,o+5);o<l;o++){let a=this.top.children[o];if(a.matchesNode(e,n,r)&&!this.preMatch.matched.has(a)){i=o;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,u,i){let s=this.top.children[u];return s.dirty==ye&&s.dom==s.contentDOM&&(s.dirty=Ke),s.update(e,n,r,i)?(this.destroyBetween(this.index,u),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let u=this.index;u<this.top.children.length;u++)if(this.top.children[u]==r)return u}return-1}e=n}}updateNextNode(e,n,r,u,i,s){for(let o=this.index;o<this.top.children.length;o++){let l=this.top.children[o];if(l instanceof qe){let a=this.preMatch.matched.get(l);if(a!=null&&a!=i)return!1;let c=l.dom,f,p=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=ye&&pn(n,l.outerDeco));if(!p&&l.update(e,n,r,u))return this.destroyBetween(this.index,o),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(l,e,n,r,u,s)))return this.destroyBetween(this.index,o),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Ke,f.updateChildren(u,s+1),f.dirty=le),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,u,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!pn(r,e.outerDeco)||!u.eq(e.innerDeco))return null;let o=qe.create(this.top,n,r,u,i,s);if(o.contentDOM){o.children=e.children,e.children=[];for(let l of o.children)l.parent=o}return e.destroy(),o}addNode(e,n,r,u,i){let s=qe.create(this.top,e,n,r,u,i);s.contentDOM&&s.updateChildren(u,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let u=this.index<this.top.children.length?this.top.children[this.index]:null;if(u&&u.matchesWidget(e)&&(e==u.widget||!u.widget.type.toDOM.parentNode))this.index++;else{let i=new Os(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof ut;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Mn)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((H||L)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let u=new Fs(this.top,[],r,null);n!=this.top?n.children.push(u):n.children.splice(this.index++,0,u),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function qa(t,e){let n=e,r=n.children.length,u=t.childCount,i=new Map,s=[];e:for(;u>0;){let o;for(;;)if(r){let a=n.children[r-1];if(a instanceof ut)n=a,r=a.children.length;else{o=a,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=o.node;if(l){if(l!=t.child(u-1))break;--u,i.set(o,u),s.push(o)}}return{index:u,matched:i,matches:s.reverse()}}function Va(t,e){return t.type.side-e.type.side}function $a(t,e,n,r){let u=e.locals(t),i=0;if(u.length==0){for(let a=0;a<t.childCount;a++){let c=t.child(a);r(c,u,e.forChild(i,c),a),i+=c.nodeSize}return}let s=0,o=[],l=null;for(let a=0;;){let c,f;for(;s<u.length&&u[s].to==i;){let g=u[s++];g.widget&&(c?(f||(f=[c])).push(g):c=g)}if(c)if(f){f.sort(Va);for(let g=0;g<f.length;g++)n(f[g],a,!!l)}else n(c,a,!!l);let p,h;if(l)h=-1,p=l,l=null;else if(a<t.childCount)h=a,p=t.child(a++);else break;for(let g=0;g<o.length;g++)o[g].to<=i&&o.splice(g--,1);for(;s<u.length&&u[s].from<=i&&u[s].to>i;)o.push(u[s++]);let d=i+p.nodeSize;if(p.isText){let g=d;s<u.length&&u[s].from<g&&(g=u[s].from);for(let b=0;b<o.length;b++)o[b].to<g&&(g=o[b].to);g<d&&(l=p.cut(g-i),p=p.cut(0,g-i),d=g,h=-1)}else for(;s<u.length&&u[s].to<d;)s++;let m=p.isInline&&!p.isLeaf?o.filter(g=>!g.inline):o.slice();r(p,m,e.forChild(i,p),h),i=d}}function Wa(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Ha(t,e,n,r){for(let u=0,i=0;u<t.childCount&&i<=r;){let s=t.child(u++),o=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;u<t.childCount;){let a=t.child(u++);if(i+=a.nodeSize,!a.isText)break;l+=a.text}if(i>=n){if(i>=r&&l.slice(r-e.length-o,r-o)==e)return r-e.length;let a=o<r?l.lastIndexOf(e,r-o-1):-1;if(a>=0&&a+e.length+o>=n)return o+a;if(n==r&&l.length>=r+e.length-o&&l.slice(r-o,r-o+e.length)==e)return r}}return-1}function _r(t,e,n,r,u){let i=[];for(let s=0,o=0;s<t.length;s++){let l=t[s],a=o,c=o+=l.size;a>=n||c<=e?i.push(l):(a<e&&i.push(l.slice(0,e-a,r)),u&&(i.push(u),u=void 0),c>n&&i.push(l.slice(n-a,l.size,r)))}return i}function Hr(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let u=t.docView.nearestDesc(n.focusNode),i=u&&u.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let o=r.resolve(s),l,a;if(An(n)){for(l=s;u&&!u.node;)u=u.parent;let f=u.node;if(u&&f.isAtom&&A.isSelectable(f)&&u.parent&&!(f.isInline&&ba(n.focusNode,n.focusOffset,u.dom))){let p=u.posBefore;a=new A(s==p?o:r.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=s,p=s;for(let h=0;h<n.rangeCount;h++){let d=n.getRangeAt(h);f=Math.min(f,t.docView.posFromDOM(d.startContainer,d.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(d.endContainer,d.endOffset,-1))}if(f<0)return null;[l,s]=p==t.state.selection.anchor?[p,f]:[f,p],o=r.resolve(s)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let c=r.resolve(l);if(!a){let f=e=="pointer"||t.state.selection.head<o.pos&&!i?1:-1;a=Jr(t,c,o,f)}return a}function Bs(t){return t.editable?t.hasFocus():vs(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Me(t,e=!1){let n=t.state.selection;if(zs(t,n),!!Bs(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&L){let r=t.domSelectionRange(),u=t.domObserver.currentSelection;if(r.anchorNode&&u.anchorNode&&rt(r.anchorNode,r.anchorOffset,u.anchorNode,u.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)ja(t);else{let{anchor:r,head:u}=n,i,s;vu&&!(n instanceof F)&&(n.$from.parent.inlineContent||(i=Pu(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Pu(t,n.to))),t.docView.setSelection(r,u,t,e),vu&&(i&&Lu(i),s&&Lu(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Ja(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const vu=H||L&&Ds<63;function Pu(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),u=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(H&&u&&u.contentEditable=="false")return Un(u);if((!u||u.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(u)return Un(u);if(i)return Un(i)}}function Un(t){return t.contentEditable="true",H&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Lu(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Ja(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,u=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=u)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Bs(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function ja(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,$(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&X&&Le<=11&&(n.disabled=!0,n.disabled=!1)}function zs(t,e){if(e instanceof A){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(qu(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else qu(t)}function qu(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Jr(t,e,n,r){return t.someProp("createSelectionBetween",u=>u(t,e,n))||F.between(e,n,r)}function Vu(t){return t.editable&&!t.hasFocus()?!1:vs(t)}function vs(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Ua(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return rt(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Er(t,e){let{$anchor:n,$head:r}=t.selection,u=e>0?n.max(r):n.min(r),i=u.parent.inlineContent?u.depth?t.doc.resolve(e>0?u.after():u.before()):null:u;return i&&O.findFrom(i,e)}function Oe(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function $u(t,e,n){let r=t.state.selection;if(r instanceof F)if(n.indexOf("s")>-1){let{$head:u}=r,i=u.textOffset?null:e<0?u.nodeBefore:u.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(u.pos+i.nodeSize*(e<0?-1:1));return Oe(t,new F(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let u=Er(t.state,e);return u&&u instanceof A?Oe(t,u):!1}else if(!(ie&&n.indexOf("m")>-1)){let u=r.$head,i=u.textOffset?null:e<0?u.nodeBefore:u.nodeAfter,s;if(!i||i.isText)return!1;let o=e<0?u.pos-i.nodeSize:u.pos;return i.isAtom||(s=t.docView.descAt(o))&&!s.contentDOM?A.isSelectable(i)?Oe(t,new A(e<0?t.state.doc.resolve(u.pos-i.nodeSize):u)):Ut?Oe(t,new F(t.state.doc.resolve(e<0?o:o+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof A&&r.node.isInline)return Oe(t,new F(e>0?r.$to:r.$from));{let u=Er(t.state,e);return u?Oe(t,u):!1}}}function mn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Nt(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ot(t,e){return e<0?Ka(t):Ga(t)}function Ka(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let u,i,s=!1;for(oe&&n.nodeType==1&&r<mn(n)&&Nt(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let o=n.childNodes[r-1];if(Nt(o,-1))u=n,i=--r;else if(o.nodeType==3)n=o,r=n.nodeValue.length;else break}}else{if(Ps(n))break;{let o=n.previousSibling;for(;o&&Nt(o,-1);)u=n.parentNode,i=$(o),o=o.previousSibling;if(o)n=o,r=mn(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Sr(t,n,r):u&&Sr(t,u,i)}function Ga(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let u=mn(n),i,s;for(;;)if(r<u){if(n.nodeType!=1)break;let o=n.childNodes[r];if(Nt(o,1))i=n,s=++r;else break}else{if(Ps(n))break;{let o=n.nextSibling;for(;o&&Nt(o,1);)i=o.parentNode,s=$(o)+1,o=o.nextSibling;if(o)n=o,r=0,u=mn(n);else{if(n=n.parentNode,n==t.dom)break;r=u=0}}}i&&Sr(t,i,s)}function Ps(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Za(t,e){for(;t&&e==t.childNodes.length&&!jt(t);)e=$(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Ya(t,e){for(;t&&!e&&!jt(t);)e=$(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Sr(t,e,n){if(e.nodeType!=3){let i,s;(s=Za(e,n))?(e=s,n=0):(i=Ya(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(An(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:u}=t;setTimeout(()=>{t.state==u&&Me(t)},50)}function Wu(t,e){let n=t.state.doc.resolve(e);if(!(L||_s)&&n.parent.inlineContent){let u=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>u.top&&s<u.bottom&&Math.abs(i.left-u.left)>1)return i.left<u.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>u.top&&s<u.bottom&&Math.abs(i.left-u.left)>1)return i.left>u.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Hu(t,e,n){let r=t.state.selection;if(r instanceof F&&!r.empty||n.indexOf("s")>-1||ie&&n.indexOf("m")>-1)return!1;let{$from:u,$to:i}=r;if(!u.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Er(t.state,e);if(s&&s instanceof A)return Oe(t,s)}if(!u.parent.inlineContent){let s=e<0?u:i,o=r instanceof ne?O.near(s,e):O.findFrom(s,e);return o?Oe(t,o):!1}return!1}function Ju(t,e){if(!(t.state.selection instanceof F))return!0;let{$head:n,$anchor:r,empty:u}=t.state.selection;if(!n.sameParent(r))return!0;if(!u)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function ju(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Xa(t){if(!H||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;ju(t,r,"true"),setTimeout(()=>ju(t,r,"false"),20)}return!1}function Qa(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function ec(t,e){let n=e.keyCode,r=Qa(e);if(n==8||ie&&n==72&&r=="c")return Ju(t,-1)||ot(t,-1);if(n==46&&!e.shiftKey||ie&&n==68&&r=="c")return Ju(t,1)||ot(t,1);if(n==13||n==27)return!0;if(n==37||ie&&n==66&&r=="c"){let u=n==37?Wu(t,t.state.selection.from)=="ltr"?-1:1:-1;return $u(t,u,r)||ot(t,u)}else if(n==39||ie&&n==70&&r=="c"){let u=n==39?Wu(t,t.state.selection.from)=="ltr"?1:-1:1;return $u(t,u,r)||ot(t,u)}else{if(n==38||ie&&n==80&&r=="c")return Hu(t,-1,r)||ot(t,-1);if(n==40||ie&&n==78&&r=="c")return Xa(t)||Hu(t,1,r)||ot(t,1);if(r==(ie?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function jr(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:u,openEnd:i}=e;for(;u>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){u--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=t.someProp("clipboardSerializer")||yt.fromSchema(t.state.schema),o=Hs(),l=o.createElement("div");l.appendChild(s.serializeFragment(r,{document:o}));let a=l.firstChild,c,f=0;for(;a&&a.nodeType==1&&(c=Ws[a.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let d=o.createElement(c[h]);for(;l.firstChild;)d.appendChild(l.firstChild);l.appendChild(d),f++}a=l.firstChild}a&&a.nodeType==1&&a.setAttribute("data-pm-slice",`${u} ${i}${f?` -${f}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
|
|
4
|
+
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let u=0;u<this.parser.matchedStyles.length;u++){let i=this.parser.matchedStyles[u],s=r.getPropertyValue(i);if(s)for(let o=void 0;;){let l=this.parser.matchStyle(i,s,this,o);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(a=>!l.clearMark(a)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)o=l;else break}}return n}addElementByRule(e,n,r,u){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(e);else if(u)this.addElement(e,r,u);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(o)&&this.open--}addAll(e,n,r,u){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,o=u==null?null:e.childNodes[u];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let u,i;for(let s=this.open,o=0;s>=0;s--){let l=this.nodes[s],a=l.findWrapping(e);if(a&&(!u||u.length>a.length+o)&&(u=a,i=l,!a.length))break;if(l.solid){if(r)break;o+=2}}if(!u)return null;this.sync(i);for(let s=0;s<u.length;s++)n=this.enterInner(u[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let u=this.findPlace(e,n,r);if(u){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=T.none;for(let o of u.concat(e.marks))(i.type?i.type.allowsMarkType(o.type):pu(o.type,e.type))&&(s=o.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,u){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,u)),i}enterInner(e,n,r,u=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let o=fu(e,i,s.options);s.options&Tt&&s.content.length==0&&(o|=Tt);let l=T.none;return r=r.filter(a=>(s.type?s.type.allowsMarkType(a.type):pu(a.type,e))?(l=a.addToSet(l),!1):!0),this.nodes.push(new en(e,n,l,u,null,o)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Bt)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let u=r.length-1;u>=0;u--)e+=r[u].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let u=0;u<this.find.length;u++)this.find[u].pos==null&&e.nodeType==1&&e.contains(this.find[u].node)&&n.compareDocumentPosition(this.find[u].node)&(r?2:4)&&(this.find[u].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,u=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(u?0:1),s=(o,l)=>{for(;o>=0;o--){let a=n[o];if(a==""){if(o==n.length-1||o==0)continue;for(;l>=i;l--)if(s(o-1,l))return!0;return!1}else{let c=l>0||l==0&&u?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!c||c.name!=a&&!c.isInGroup(a))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function ul(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ui.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function il(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function hu(t){let e={};for(let n in t)e[n]=t[n];return e}function pu(t,e){let n=e.schema.nodes;for(let r in n){let u=n[r];if(!u.allowsMarkType(t))continue;let i=[],s=o=>{i.push(o);for(let l=0;l<o.edgeCount;l++){let{type:a,next:c}=o.edge(l);if(a==e||i.indexOf(c)<0&&s(c))return!0}};if(s(u.contentMatch))return!0}}class yt{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=vn(n).createDocumentFragment());let u=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let o=0,l=0;for(;o<i.length&&l<s.marks.length;){let a=s.marks[l];if(!this.marks[a.type.name]){l++;continue}if(!a.eq(i[o][0])||a.type.spec.spanning===!1)break;o++,l++}for(;o<i.length;)u=i.pop()[1];for(;l<s.marks.length;){let a=s.marks[l++],c=this.serializeMark(a,s.isInline,n);c&&(i.push([a,u]),u.appendChild(c.dom),u=c.contentDOM||c.dom)}}u.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:u}=un(vn(n),this.nodes[e.type.name](e),null,e.attrs);if(u){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,u)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let u=e.marks.length-1;u>=0;u--){let i=this.serializeMark(e.marks[u],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let u=this.marks[e.type.name];return u&&un(vn(r),u(e,n),null,e.attrs)}static renderSpec(e,n,r=null,u){return un(e,n,r,u)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new yt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=mu(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return mu(e.marks)}}function mu(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function vn(t){return t.document||window.document}const gu=new WeakMap;function sl(t){let e=gu.get(t);return e===void 0&&gu.set(t,e=ol(t)),e}function ol(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let u=0;u<r.length;u++)n(r[u]);else for(let u in r)n(r[u])}return n(t),e}function un(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let u=e[0],i;if(typeof u!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=sl(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=u.indexOf(" ");s>0&&(n=u.slice(0,s),u=u.slice(s+1));let o,l=n?t.createElementNS(n,u):t.createElement(u),a=e[1],c=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){c=2;for(let f in a)if(a[f]!=null){let p=f.indexOf(" ");p>0?l.setAttributeNS(f.slice(0,p),f.slice(p+1),a[f]):f=="style"&&l.style?l.style.cssText=a[f]:l.setAttribute(f,a[f])}}for(let f=c;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:d}=un(t,p,n,r);if(l.appendChild(h),d){if(o)throw new RangeError("Multiple content holes");o=d}}}return{dom:l,contentDOM:o}}const Ki=65535,Gi=Math.pow(2,16);function ll(t,e){return t+e*Gi}function bu(t){return t&Ki}function al(t){return(t-(t&Ki))/Gi}const Zi=1,Yi=2,sn=4,Xi=8;class mr{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Xi)>0}get deletedBefore(){return(this.delInfo&(Zi|sn))>0}get deletedAfter(){return(this.delInfo&(Yi|sn))>0}get deletedAcross(){return(this.delInfo&sn)>0}}class te{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&te.empty)return te.empty}recover(e){let n=0,r=bu(e);if(!this.inverted)for(let u=0;u<r;u++)n+=this.ranges[u*3+2]-this.ranges[u*3+1];return this.ranges[r*3]+n+al(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let u=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?u:0);if(l>e)break;let a=this.ranges[o+i],c=this.ranges[o+s],f=l+a;if(e<=f){let p=a?e==l?-1:e==f?1:n:n,h=l+u+(p<0?0:c);if(r)return h;let d=e==(n<0?l:f)?null:ll(o/3,e-l),m=e==l?Yi:e==f?Zi:sn;return(n<0?e!=l:e!=f)&&(m|=Xi),new mr(h,m,d)}u+=c-a}return r?e+u:new mr(e+u,0,null)}touches(e,n){let r=0,u=bu(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?r:0);if(l>e)break;let a=this.ranges[o+i],c=l+a;if(e<=c&&o==u*3)return!0;r+=this.ranges[o+s]-a}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let u=0,i=0;u<this.ranges.length;u+=3){let s=this.ranges[u],o=s-(this.inverted?i:0),l=s+(this.inverted?0:i),a=this.ranges[u+n],c=this.ranges[u+r];e(o,o+a,l,l+c),i+=c-a}}invert(){return new te(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?te.empty:new te(e<0?[0,-e,0]:[0,0,e])}}te.empty=new te([]);class zt{constructor(e,n,r=0,u=e?e.length:0){this.mirror=n,this.from=r,this.to=u,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new zt(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let u=e.getMirror(n);this.appendMap(e._maps[n],u!=null&&u<n?r+u:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let u=e.getMirror(n);this.appendMap(e._maps[n].invert(),u!=null&&u>n?r-u-1:void 0)}}invert(){let e=new zt;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let u=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],o=s.mapResult(e,n);if(o.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(o.recover);continue}}u|=o.delInfo,e=o.pos}return r?e:new mr(e,u,null)}}const Pn=Object.create(null);class U{getMap(){return te.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Pn[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Pn)throw new RangeError("Duplicate use of step JSON ID "+e);return Pn[e]=n,n.prototype.jsonID=e,n}}class B{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new B(e,null)}static fail(e){return new B(null,e)}static fromReplace(e,n,r,u){try{return B.ok(e.replace(n,r,u))}catch(i){if(i instanceof fn)return B.fail(i.message);throw i}}}function Br(t,e,n){let r=[];for(let u=0;u<t.childCount;u++){let i=t.child(u);i.content.size&&(i=i.copy(Br(i.content,e,i))),i.isInline&&(i=e(i,n,u)),r.push(i)}return x.fromArray(r)}class Be extends U{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),u=r.node(r.sharedDepth(this.to)),i=new D(Br(n.content,(s,o)=>!s.isAtom||!o.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),u),n.openStart,n.openEnd);return B.fromReplace(e,this.from,this.to,i)}invert(){return new me(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Be(n.pos,r.pos,this.mark)}merge(e){return e instanceof Be&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Be(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Be(n.from,n.to,e.markFromJSON(n.mark))}}U.jsonID("addMark",Be);class me extends U{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new D(Br(n.content,u=>u.mark(this.mark.removeFromSet(u.marks)),e),n.openStart,n.openEnd);return B.fromReplace(e,this.from,this.to,r)}invert(){return new Be(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new me(n.pos,r.pos,this.mark)}merge(e){return e instanceof me&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new me(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new me(n.from,n.to,e.markFromJSON(n.mark))}}U.jsonID("removeMark",me);class ze extends U{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return B.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return B.fromReplace(e,this.pos,this.pos+1,new D(x.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let u=0;u<n.marks.length;u++)if(!n.marks[u].isInSet(r))return new ze(this.pos,n.marks[u]);return new ze(this.pos,this.mark)}}return new nt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ze(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ze(n.pos,e.markFromJSON(n.mark))}}U.jsonID("addNodeMark",ze);class nt extends U{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return B.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return B.fromReplace(e,this.pos,this.pos+1,new D(x.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new ze(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new nt(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new nt(n.pos,e.markFromJSON(n.mark))}}U.jsonID("removeNodeMark",nt);class J extends U{constructor(e,n,r,u=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=u}apply(e){return this.structure&&gr(e,this.from,this.to)?B.fail("Structure replace would overwrite content"):B.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new te([this.from,this.to-this.from,this.slice.size])}invert(e){return new J(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new J(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof J)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?D.empty:new D(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new J(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?D.empty:new D(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new J(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new J(n.from,n.to,D.fromJSON(e,n.slice),!!n.structure)}}U.jsonID("replace",J);class Y extends U{constructor(e,n,r,u,i,s,o=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=u,this.slice=i,this.insert=s,this.structure=o}apply(e){if(this.structure&&(gr(e,this.from,this.gapFrom)||gr(e,this.gapTo,this.to)))return B.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return B.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?B.fromReplace(e,this.from,this.to,r):B.fail("Content does not fit in gap")}getMap(){return new te([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Y(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),u=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||u<n.pos||i>r.pos?null:new Y(n.pos,r.pos,u,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Y(n.from,n.to,n.gapFrom,n.gapTo,D.fromJSON(e,n.slice),n.insert,!!n.structure)}}U.jsonID("replaceAround",Y);function gr(t,e,n){let r=t.resolve(e),u=n-e,i=r.depth;for(;u>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,u--;if(u>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;u>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,u--}}return!1}function cl(t,e,n,r){let u=[],i=[],s,o;t.doc.nodesBetween(e,n,(l,a,c)=>{if(!l.isInline)return;let f=l.marks;if(!r.isInSet(f)&&c.type.allowsMarkType(r.type)){let p=Math.max(a,e),h=Math.min(a+l.nodeSize,n),d=r.addToSet(f);for(let m=0;m<f.length;m++)f[m].isInSet(d)||(s&&s.to==p&&s.mark.eq(f[m])?s.to=h:u.push(s=new me(p,h,f[m])));o&&o.to==p?o.to=h:i.push(o=new Be(p,h,r))}}),u.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function fl(t,e,n,r){let u=[],i=0;t.doc.nodesBetween(e,n,(s,o)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof En){let a=s.marks,c;for(;c=r.isInSet(a);)(l||(l=[])).push(c),a=c.removeFromSet(a)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let a=Math.min(o+s.nodeSize,n);for(let c=0;c<l.length;c++){let f=l[c],p;for(let h=0;h<u.length;h++){let d=u[h];d.step==i-1&&f.eq(u[h].style)&&(p=d)}p?(p.to=a,p.step=i):u.push({style:f,from:Math.max(o,e),to:a,step:i})}}}),u.forEach(s=>t.step(new me(s.from,s.to,s.style)))}function zr(t,e,n,r=n.contentMatch,u=!0){let i=t.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l<i.childCount;l++){let a=i.child(l),c=o+a.nodeSize,f=r.matchType(a.type);if(!f)s.push(new J(o,c,D.empty));else{r=f;for(let p=0;p<a.marks.length;p++)n.allowsMarkType(a.marks[p].type)||t.step(new me(o,c,a.marks[p]));if(u&&a.isText&&n.whitespace!="pre"){let p,h=/\r?\n|\r/g,d;for(;p=h.exec(a.text);)d||(d=new D(x.from(n.schema.text(" ",n.allowedMarks(a.marks))),0,0)),s.push(new J(o+p.index,o+p.index+p[0].length,d))}}o=c}if(!r.validEnd){let l=r.fillBefore(x.empty,!0);t.replace(o,o,new D(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function dl(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Jt(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,u=0,i=0;;--r){let s=t.$from.node(r),o=t.$from.index(r)+u,l=t.$to.indexAfter(r)-i;if(r<t.depth&&s.canReplace(o,l,n))return r;if(r==0||s.type.spec.isolating||!dl(s,o,l))break;o&&(u=1),l<s.childCount&&(i=1)}return null}function hl(t,e,n){let{$from:r,$to:u,depth:i}=e,s=r.before(i+1),o=u.after(i+1),l=s,a=o,c=x.empty,f=0;for(let d=i,m=!1;d>n;d--)m||r.index(d)>0?(m=!0,c=x.from(r.node(d).copy(c)),f++):l--;let p=x.empty,h=0;for(let d=i,m=!1;d>n;d--)m||u.after(d+1)<u.end(d)?(m=!0,p=x.from(u.node(d).copy(p)),h++):a++;t.step(new Y(l,a,s,o,new D(c.append(p),f,h),c.size-f,!0))}function Qi(t,e,n=null,r=t){let u=pl(t,e),i=u&&ml(r,e);return i?u.map(xu).concat({type:e,attrs:n}).concat(i.map(xu)):null}function xu(t){return{type:t,attrs:null}}function pl(t,e){let{parent:n,startIndex:r,endIndex:u}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,u,s)?i:null}function ml(t,e){let{parent:n,startIndex:r,endIndex:u}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let a=r;l&&a<u;a++)l=l.matchType(n.child(a).type);return!l||!l.validEnd?null:s}function gl(t,e,n){let r=x.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let o=n[s].type.contentMatch.matchFragment(r);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=x.from(n[s].type.create(n[s].attrs,r))}let u=e.start,i=e.end;t.step(new Y(u,i,u,i,new D(r,0,0),n.length,!0))}function bl(t,e,n,r,u){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,o)=>{let l=typeof u=="function"?u(s):u;if(s.isTextblock&&!s.hasMarkup(r,l)&&xl(t.doc,t.mapping.slice(i).map(o),r)){let a=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",d=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!d?a=!1:!h&&d&&(a=!0)}a===!1&&ts(t,s,o,i),zr(t,t.mapping.slice(i).map(o,1),r,void 0,a===null);let c=t.mapping.slice(i),f=c.map(o,1),p=c.map(o+s.nodeSize,1);return t.step(new Y(f,p,f+1,p-1,new D(x.from(r.create(l,null,s.marks)),0,0),1,!0)),a===!0&&es(t,s,o,i),!1}})}function es(t,e,n,r){e.forEach((u,i)=>{if(u.isText){let s,o=/\r?\n|\r/g;for(;s=o.exec(u.text);){let l=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function ts(t,e,n,r){e.forEach((u,i)=>{if(u.type==u.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
|
|
5
|
+
`))}})}function xl(t,e,n){let r=t.resolve(e),u=r.index();return r.parent.canReplaceWith(u,u+1,n)}function kl(t,e,n,r,u){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,u||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Y(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new D(x.from(s),0,0),1,!0))}function Ot(t,e,n=1,r){let u=t.resolve(e),i=u.depth-n,s=r&&r[r.length-1]||u.parent;if(i<0||u.parent.type.spec.isolating||!u.parent.canReplace(u.index(),u.parent.childCount)||!s.type.validContent(u.parent.content.cutByIndex(u.index(),u.parent.childCount)))return!1;for(let a=u.depth-1,c=n-2;a>i;a--,c--){let f=u.node(a),p=u.index(a);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),d=r&&r[c+1];d&&(h=h.replaceChild(0,d.type.create(d.attrs)));let m=r&&r[c]||f;if(!f.canReplace(p+1,f.childCount)||!m.type.validContent(h))return!1}let o=u.indexAfter(i),l=r&&r[0];return u.node(i).canReplaceWith(o,o,l?l.type:u.node(i+1).type)}function yl(t,e,n=1,r){let u=t.doc.resolve(e),i=x.empty,s=x.empty;for(let o=u.depth,l=u.depth-n,a=n-1;o>l;o--,a--){i=x.from(u.node(o).copy(i));let c=r&&r[a];s=x.from(c?c.type.create(c.attrs,s):u.node(o).copy(s))}t.step(new J(e,e,new D(i.append(s),n,n),!0))}function vr(t,e){let n=t.resolve(e),r=n.index();return Dl(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Cl(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let u=0;u<e.childCount;u++){let i=e.child(u),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function Dl(t,e){return!!(t&&e&&!t.isLeaf&&Cl(t,e))}function _l(t,e,n){let r=null,{linebreakReplacement:u}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(u&&s.inlineContent){let c=s.whitespace=="pre",f=!!s.contentMatch.matchType(u);c&&!f?r=!1:!c&&f&&(r=!0)}let o=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);ts(t,c.node(),c.before(),o)}s.inlineContent&&zr(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(o),a=l.map(e-n);if(t.step(new J(a,l.map(e+n,-1),D.empty,!0)),r===!0){let c=t.doc.resolve(a);es(t,c.node(),c.before(),t.steps.length)}return t}function El(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let u=r.depth-1;u>=0;u--){let i=r.index(u);if(r.node(u).canReplaceWith(i,i,n))return r.before(u+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let u=r.depth-1;u>=0;u--){let i=r.indexAfter(u);if(r.node(u).canReplaceWith(i,i,n))return r.after(u+1);if(i<r.node(u).childCount)return null}return null}function Sl(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let u=n.content;for(let i=0;i<n.openStart;i++)u=u.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let o=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(o>0?1:0),a=r.node(s),c=!1;if(i==1)c=a.canReplace(l,l,u);else{let f=a.contentMatchAt(l).findWrapping(u.firstChild.type);c=f&&a.canReplaceWith(l,l,f[0])}if(c)return o==0?r.pos:o<0?r.before(s+1):r.after(s+1)}return null}function Pr(t,e,n=e,r=D.empty){if(e==n&&!r.size)return null;let u=t.resolve(e),i=t.resolve(n);return ns(u,i,r)?new J(e,n,r):new Al(u,i,r).fit()}function ns(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Al{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=x.empty;for(let u=0;u<=e.depth;u++){let i=e.node(u);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(u))})}for(let u=e.depth;u>0;u--)this.placed=x.from(e.node(u).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let a=this.findFittable();a?this.placeNodes(a):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,u=this.close(e<0?this.$to:r.doc.resolve(e));if(!u)return null;let i=this.placed,s=r.depth,o=u.depth;for(;s&&o&&i.childCount==1;)i=i.firstChild.content,s--,o--;let l=new D(i,s,o);return e>-1?new Y(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new J(r.pos,u.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,u=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(u=0),i.type.spec.isolating&&u<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let u,i=null;r?(i=Ln(this.unplaced.content,r-1).firstChild,u=i.content):u=this.unplaced.content;let s=u.firstChild;for(let o=this.depth;o>=0;o--){let{type:l,match:a}=this.frontier[o],c,f=null;if(n==1&&(s?a.matchType(s.type)||(f=a.fillBefore(x.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:o,parent:i,inject:f};if(n==2&&s&&(c=a.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:o,parent:i,wrap:c};if(i&&a.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,u=Ln(e,n);return!u.childCount||u.firstChild.isLeaf?!1:(this.unplaced=new D(e,n+1,Math.max(r,u.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,u=Ln(e,n);if(u.childCount<=1&&n>0){let i=e.size-n<=n+u.size;this.unplaced=new D(St(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new D(St(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:u,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,o=r?r.content:s.content,l=s.openStart-e,a=0,c=[],{match:f,type:p}=this.frontier[n];if(u){for(let m=0;m<u.childCount;m++)c.push(u.child(m));f=f.matchFragment(u)}let h=o.size+e-(s.content.size-s.openEnd);for(;a<o.childCount;){let m=o.child(a),g=f.matchType(m.type);if(!g)break;a++,(a>1||l==0||m.content.size)&&(f=g,c.push(rs(m.mark(p.allowedMarks(m.marks)),a==1?l:0,a==o.childCount?h:-1)))}let d=a==o.childCount;d||(h=-1),this.placed=At(this.placed,n,x.from(c)),this.frontier[n].match=f,d&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=o;m<h;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=d?e==0?D.empty:new D(St(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new D(St(s.content,e,a),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!qn(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,u=this.$to.after(r);for(;r>1&&u==this.$to.end(--r);)++u;return u}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:u}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=qn(e,n,u,r,i);if(s){for(let o=n-1;o>=0;o--){let{match:l,type:a}=this.frontier[o],c=qn(e,o,a,l,!0);if(!c||c.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=At(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let u=e.node(r),i=u.type.contentMatch.fillBefore(u.content,!0,e.index(r));this.openFrontierNode(u.type,u.attrs,i)}return e}openFrontierNode(e,n=null,r){let u=this.frontier[this.depth];u.match=u.match.matchType(e),this.placed=At(this.placed,this.depth,x.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(x.empty,!0);n.childCount&&(this.placed=At(this.placed,this.frontier.length,n))}}function St(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(St(t.firstChild.content,e-1,n)))}function At(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(At(t.lastChild.content,e-1,n)))}function Ln(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function rs(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,rs(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(x.empty,!0)))),t.copy(r)}function qn(t,e,n,r,u){let i=t.node(e),s=u?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let o=r.fillBefore(i.content,!0,s);return o&&!Ml(n,i.content,s)?o:null}function Ml(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function wl(t){return t.spec.defining||t.spec.definingForContent}function Tl(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let u=t.doc.resolve(e),i=t.doc.resolve(n);if(ns(u,i,r))return t.step(new J(e,n,r));let s=is(u,i);s[s.length-1]==0&&s.pop();let o=-(u.depth+1);s.unshift(o);for(let p=u.depth,h=u.pos-1;p>0;p--,h--){let d=u.node(p).type.spec;if(d.defining||d.definingAsContext||d.isolating)break;s.indexOf(p)>-1?o=p:u.before(p)==h&&s.splice(1,0,-p)}let l=s.indexOf(o),a=[],c=r.openStart;for(let p=r.content,h=0;;h++){let d=p.firstChild;if(a.push(d),h==r.openStart)break;p=d.content}for(let p=c-1;p>=0;p--){let h=a[p],d=wl(h.type);if(d&&!h.sameMarkup(u.node(Math.abs(o)-1)))c=p;else if(d||!h.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let h=(p+c+1)%(r.openStart+1),d=a[h];if(d)for(let m=0;m<s.length;m++){let g=s[(m+l)%s.length],b=!0;g<0&&(b=!1,g=-g);let k=u.node(g-1),y=u.index(g-1);if(k.canReplaceWith(y,y,d.type,d.marks))return t.replace(u.before(g),b?i.after(g):n,new D(us(r.content,0,r.openStart,h),h,r.openEnd))}}let f=t.steps.length;for(let p=s.length-1;p>=0&&(t.replace(e,n,r),!(t.steps.length>f));p--){let h=s[p];h<0||(e=u.before(h),n=i.after(h))}}function us(t,e,n,r,u){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(us(i.content,e+1,n,r,i)))}if(e>r){let i=u.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(x.empty,!0))}return t}function Ol(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let u=El(t.doc,e,r.type);u!=null&&(e=n=u)}t.replaceRange(e,n,new D(x.from(r),0,0))}function Fl(t,e,n){let r=t.doc.resolve(e),u=t.doc.resolve(n),i=is(r,u);for(let s=0;s<i.length;s++){let o=i[s],l=s==i.length-1;if(l&&o==0||r.node(o).type.contentMatch.validEnd)return t.delete(r.start(o),u.end(o));if(o>0&&(l||r.node(o-1).canReplace(r.index(o-1),u.indexAfter(o-1))))return t.delete(r.before(o),u.after(o))}for(let s=1;s<=r.depth&&s<=u.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&u.end(s)-n!=u.depth-s&&r.start(s-1)==u.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),u.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function is(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let u=r;u>=0;u--){let i=t.start(u);if(i<t.pos-(t.depth-u)||e.end(u)>e.pos+(e.depth-u)||t.node(u).type.spec.isolating||e.node(u).type.spec.isolating)break;(i==e.start(u)||u==t.depth&&u==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&u&&e.start(u-1)==i-1)&&n.push(u)}return n}class ft extends U{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return B.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let u=n.type.create(r,null,n.marks);return B.fromReplace(e,this.pos,this.pos+1,new D(x.from(u),0,n.isLeaf?0:1))}getMap(){return te.empty}invert(e){return new ft(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ft(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ft(n.pos,n.attr,n.value)}}U.jsonID("attr",ft);class vt extends U{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let u in e.attrs)n[u]=e.attrs[u];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return B.ok(r)}getMap(){return te.empty}invert(e){return new vt(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new vt(n.attr,n.value)}}U.jsonID("docAttr",vt);let pt=class extends Error{};pt=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};pt.prototype=Object.create(Error.prototype);pt.prototype.constructor=pt;pt.prototype.name="TransformError";class Nl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new zt}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new pt(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let u=this.mapping.maps[r];r&&(e=u.map(e,1),n=u.map(n,-1)),u.forEach((i,s,o,l)=>{e=Math.min(e,o),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=D.empty){let u=Pr(this.doc,e,n,r);return u&&this.step(u),this}replaceWith(e,n,r){return this.replace(e,n,new D(x.from(r),0,0))}delete(e,n){return this.replace(e,n,D.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Tl(this,e,n,r),this}replaceRangeWith(e,n,r){return Ol(this,e,n,r),this}deleteRange(e,n){return Fl(this,e,n),this}lift(e,n){return hl(this,e,n),this}join(e,n=1){return _l(this,e,n),this}wrap(e,n){return gl(this,e,n),this}setBlockType(e,n=e,r,u=null){return bl(this,e,n,r,u),this}setNodeMarkup(e,n,r=null,u){return kl(this,e,n,r,u),this}setNodeAttribute(e,n,r){return this.step(new ft(e,n,r)),this}setDocAttribute(e,n){return this.step(new vt(e,n)),this}addNodeMark(e,n){return this.step(new ze(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof T)n.isInSet(r.marks)&&this.step(new nt(e,n));else{let u=r.marks,i,s=[];for(;i=n.isInSet(u);)s.push(new nt(e,i)),u=i.removeFromSet(u);for(let o=s.length-1;o>=0;o--)this.step(s[o])}return this}split(e,n=1,r){return yl(this,e,n,r),this}addMark(e,n,r){return cl(this,e,n,r),this}removeMark(e,n,r){return fl(this,e,n,r),this}clearIncompatible(e,n,r){return zr(this,e,n,r),this}}const Vn=Object.create(null);class O{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Il(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=D.empty){let r=n.content.lastChild,u=null;for(let o=0;o<n.openEnd;o++)u=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:l,$to:a}=s[o],c=e.mapping.slice(i);e.replaceRange(c.map(l.pos),c.map(a.pos),o?D.empty:n),o==0&&Cu(e,i,(r?r.isInline:u&&u.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,u=this.ranges;for(let i=0;i<u.length;i++){let{$from:s,$to:o}=u[i],l=e.mapping.slice(r),a=l.map(s.pos),c=l.map(o.pos);i?e.deleteRange(a,c):(e.replaceRangeWith(a,c,n),Cu(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let u=e.parent.inlineContent?new F(e):at(e.node(0),e.parent,e.pos,e.index(),n,r);if(u)return u;for(let i=e.depth-1;i>=0;i--){let s=n<0?at(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):at(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new ne(e.node(0))}static atStart(e){return at(e,e,0,0,1)||new ne(e)}static atEnd(e){return at(e,e,e.content.size,e.childCount,-1)||new ne(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Vn[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Vn)throw new RangeError("Duplicate use of selection JSON ID "+e);return Vn[e]=n,n.prototype.jsonID=e,n}getBookmark(){return F.between(this.$anchor,this.$head).getBookmark()}}O.prototype.visible=!0;class Il{constructor(e,n){this.$from=e,this.$to=n}}let ku=!1;function yu(t){!ku&&!t.parent.inlineContent&&(ku=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class F extends O{constructor(e,n=e){yu(e),yu(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return O.near(r);let u=e.resolve(n.map(this.anchor));return new F(u.parent.inlineContent?u:r,r)}replace(e,n=D.empty){if(super.replace(e,n),n==D.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof F&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Sn(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new F(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let u=e.resolve(n);return new this(u,r==n?u:e.resolve(r))}static between(e,n,r){let u=e.pos-n.pos;if((!r||u)&&(r=u>=0?1:-1),!n.parent.inlineContent){let i=O.findFrom(n,r,!0)||O.findFrom(n,-r,!0);if(i)n=i.$head;else return O.near(n,r)}return e.parent.inlineContent||(u==0?e=n:(e=(O.findFrom(e,-r,!0)||O.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=u<0&&(e=n))),new F(e,n)}}O.jsonID("text",F);class Sn{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Sn(e.map(this.anchor),e.map(this.head))}resolve(e){return F.between(e.resolve(this.anchor),e.resolve(this.head))}}class A extends O{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:u}=n.mapResult(this.anchor),i=e.resolve(u);return r?O.near(i):new A(i)}content(){return new D(x.from(this.node),0,0)}eq(e){return e instanceof A&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Lr(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new A(e.resolve(n.anchor))}static create(e,n){return new A(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}A.prototype.visible=!1;O.jsonID("node",A);class Lr{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Sn(r,r):new Lr(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&A.isSelectable(r)?new A(n):O.near(n)}}class ne extends O{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=D.empty){if(n==D.empty){e.delete(0,e.doc.content.size);let r=O.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ne(e)}map(e){return new ne(e)}eq(e){return e instanceof ne}getBookmark(){return Rl}}O.jsonID("all",ne);const Rl={map(){return this},resolve(t){return new ne(t)}};function at(t,e,n,r,u,i=!1){if(e.inlineContent)return F.create(t,n);for(let s=r-(u>0?0:1);u>0?s<e.childCount:s>=0;s+=u){let o=e.child(s);if(o.isAtom){if(!i&&A.isSelectable(o))return A.create(t,n-(u<0?o.nodeSize:0))}else{let l=at(t,o,n+u,u<0?o.childCount:0,u,i);if(l)return l}n+=o.nodeSize*u}return null}function Cu(t,e,n){let r=t.steps.length-1;if(r<e)return;let u=t.steps[r];if(!(u instanceof J||u instanceof Y))return;let i=t.mapping.maps[r],s;i.forEach((o,l,a,c)=>{s==null&&(s=c)}),t.setSelection(O.near(t.doc.resolve(s),n))}const Du=1,tn=2,_u=4;class Bl extends Nl{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|Du)&~tn,this.storedMarks=null,this}get selectionSet(){return(this.updated&Du)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=tn,this}ensureMarks(e){return T.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&tn)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~tn,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||T.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let u=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(u.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,u.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(O.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=_u,this}get scrolledIntoView(){return(this.updated&_u)>0}}function Eu(t,e){return!e||!t?t:t.bind(e)}class Mt{constructor(e,n,r){this.name=e,this.init=Eu(n.init,r),this.apply=Eu(n.apply,r)}}const zl=[new Mt("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Mt("selection",{init(t,e){return t.selection||O.atStart(e.doc)},apply(t){return t.selection}}),new Mt("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Mt("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class $n{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=zl.slice(),n&&n.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 Mt(r.key,r.spec.state,r))})}}class Ue{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let u=this.config.plugins[r];if(u.spec.filterTransaction&&!u.spec.filterTransaction.call(u,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),u=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let o=this.config.plugins[s];if(o.spec.appendTransaction){let l=u?u[s].n:0,a=u?u[s].state:this,c=l<n.length&&o.spec.appendTransaction.call(o,l?n.slice(l):n,a,r);if(c&&r.filterTransaction(c,s)){if(c.setMeta("appendedTransaction",e),!u){u=[];for(let f=0;f<this.config.plugins.length;f++)u.push(f<s?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),i=!0}u&&(u[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Ue(this.config),r=this.config.fields;for(let u=0;u<r.length;u++){let i=r[u];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new Bl(this)}static create(e){let n=new $n(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ue(n);for(let u=0;u<n.fields.length;u++)r[n.fields[u].name]=n.fields[u].init(e,r);return r}reconfigure(e){let n=new $n(this.schema,e.plugins),r=n.fields,u=new Ue(n);for(let i=0;i<r.length;i++){let s=r[i].name;u[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,u)}return u}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.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 u=e[r],i=u.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(u,this[u.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let u=new $n(e.schema,e.plugins),i=new Ue(u);return u.fields.forEach(s=>{if(s.name=="doc")i.doc=xe.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=O.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let o in r){let l=r[o],a=l.spec.state;if(l.key==s.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(n,o)){i[s.name]=a.fromJSON.call(l,e,n[o],i);return}}i[s.name]=s.init(e,i)}}),i}}function ss(t,e,n){for(let r in t){let u=t[r];u instanceof Function?u=u.bind(e):r=="handleDOMEvents"&&(u=ss(u,e,{})),n[r]=u}return n}class qr{constructor(e){this.spec=e,this.props={},e.props&&ss(e.props,this,this.props),this.key=e.key?e.key.key:ls("plugin")}getState(e){return e[this.key]}}const Wn=Object.create(null);function ls(t){return t in Wn?t+"$"+ ++Wn[t]:(Wn[t]=0,t+"$")}class as{constructor(e="key"){this.key=ls(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const cs=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function vl(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Pl=(t,e,n)=>{let r=vl(t,n);if(!r)return!1;let u=fs(r);if(!u){let s=r.blockRange(),o=s&&Jt(s);return o==null?!1:(e&&e(t.tr.lift(s,o).scrollIntoView()),!0)}let i=u.nodeBefore;if(hs(t,u,e,-1))return!0;if(r.parent.content.size==0&&(mt(i,"end")||A.isSelectable(i)))for(let s=r.depth;;s--){let o=Pr(t.doc,r.before(s),r.after(s),D.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(mt(i,"end")?O.findFrom(l.doc.resolve(l.mapping.map(u.pos,-1)),-1):A.create(l.doc,u.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&u.depth==r.depth-1?(e&&e(t.tr.delete(u.pos-i.nodeSize,u.pos).scrollIntoView()),!0):!1};function mt(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Ll=(t,e,n)=>{let{$head:r,empty:u}=t.selection,i=r;if(!u)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=fs(r)}let s=i&&i.nodeBefore;return!s||!A.isSelectable(s)?!1:(e&&e(t.tr.setSelection(A.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function fs(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function ql(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Vl=(t,e,n)=>{let r=ql(t,n);if(!r)return!1;let u=ds(r);if(!u)return!1;let i=u.nodeAfter;if(hs(t,u,e,1))return!0;if(r.parent.content.size==0&&(mt(i,"start")||A.isSelectable(i))){let s=Pr(t.doc,r.before(),r.after(),D.empty);if(s&&s.slice.size<s.to-s.from){if(e){let o=t.tr.step(s);o.setSelection(mt(i,"start")?O.findFrom(o.doc.resolve(o.mapping.map(u.pos)),1):A.create(o.doc,o.mapping.map(u.pos))),e(o.scrollIntoView())}return!0}}return i.isAtom&&u.depth==r.depth-1?(e&&e(t.tr.delete(u.pos,u.pos+i.nodeSize).scrollIntoView()),!0):!1},$l=(t,e,n)=>{let{$head:r,empty:u}=t.selection,i=r;if(!u)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=ds(r)}let s=i&&i.nodeAfter;return!s||!A.isSelectable(s)?!1:(e&&e(t.tr.setSelection(A.create(t.doc,i.pos)).scrollIntoView()),!0)};function ds(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Wl=(t,e)=>{let{$from:n,$to:r}=t.selection,u=n.blockRange(r),i=u&&Jt(u);return i==null?!1:(e&&e(t.tr.lift(u,i).scrollIntoView()),!0)},Hl=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
6
|
+
`).scrollIntoView()),!0)};function Vr(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Jl=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let u=n.node(-1),i=n.indexAfter(-1),s=Vr(u.contentMatchAt(i));if(!s||!u.canReplaceWith(i,i,s))return!1;if(e){let o=n.after(),l=t.tr.replaceWith(o,o,s.createAndFill());l.setSelection(O.near(l.doc.resolve(o),1)),e(l.scrollIntoView())}return!0},jl=(t,e)=>{let n=t.selection,{$from:r,$to:u}=n;if(n instanceof ne||r.parent.inlineContent||u.parent.inlineContent)return!1;let i=Vr(u.parent.contentMatchAt(u.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&u.index()<u.parent.childCount?r:u).pos,o=t.tr.insert(s,i.createAndFill());o.setSelection(F.create(o.doc,s+1)),e(o.scrollIntoView())}return!0},Ul=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Ot(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),u=r&&Jt(r);return u==null?!1:(e&&e(t.tr.lift(r,u).scrollIntoView()),!0)};function Kl(t){return(e,n)=>{let{$from:r,$to:u}=e.selection;if(e.selection instanceof A&&e.selection.node.isBlock)return!r.parentOffset||!Ot(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,o,l=!1,a=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),a=r.start(h)==r.pos-(r.depth-h),o=Vr(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),i.unshift(l&&o?{type:o}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let c=e.tr;(e.selection instanceof F||e.selection instanceof ne)&&c.deleteSelection();let f=c.mapping.map(r.pos),p=Ot(c.doc,f,i.length,i);if(p||(i[0]=o?{type:o}:null,p=Ot(c.doc,f,i.length,i)),!p)return!1;if(c.split(f,i.length,i),!l&&a&&r.node(s).type!=o){let h=c.mapping.map(r.before(s)),d=c.doc.resolve(h);o&&r.node(s-1).canReplaceWith(d.index(),d.index()+1,o)&&c.setNodeMarkup(c.mapping.map(r.before(s)),o)}return n&&n(c.scrollIntoView()),!0}}const Gl=Kl(),Zl=(t,e)=>(e&&e(t.tr.setSelection(new ne(t.doc))),!0);function Yl(t,e,n){let r=e.nodeBefore,u=e.nodeAfter,i=e.index();return!r||!u||!r.type.compatibleContent(u.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(u.isTextblock||vr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function hs(t,e,n,r){let u=e.nodeBefore,i=e.nodeAfter,s,o,l=u.type.spec.isolating||i.type.spec.isolating;if(!l&&Yl(t,e,n))return!0;let a=!l&&e.parent.canReplace(e.index(),e.index()+1);if(a&&(s=(o=u.contentMatchAt(u.childCount)).findWrapping(i.type))&&o.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,d=x.empty;for(let b=s.length-1;b>=0;b--)d=x.from(s[b].create(null,d));d=x.from(u.copy(d));let m=t.tr.step(new Y(e.pos-1,h,e.pos,h,new D(d,1,0),s.length,!0)),g=m.doc.resolve(h+2*s.length);g.nodeAfter&&g.nodeAfter.type==u.type&&vr(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let c=i.type.spec.isolating||r>0&&l?null:O.findFrom(e,1),f=c&&c.$from.blockRange(c.$to),p=f&&Jt(f);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(f,p).scrollIntoView()),!0;if(a&&mt(i,"start",!0)&&mt(u,"end")){let h=u,d=[];for(;d.push(h),!h.isTextblock;)h=h.lastChild;let m=i,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let b=x.empty;for(let y=d.length-1;y>=0;y--)b=x.from(d[y].copy(b));let k=t.tr.step(new Y(e.pos-d.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new D(b,d.length,0),0,!0));n(k.scrollIntoView())}return!0}}return!1}function ps(t){return function(e,n){let r=e.selection,u=t<0?r.$from:r.$to,i=u.depth;for(;u.node(i).isInline;){if(!i)return!1;i--}return u.node(i).isTextblock?(n&&n(e.tr.setSelection(F.create(e.doc,t<0?u.start(i):u.end(i)))),!0):!1}}const Xl=ps(-1),Ql=ps(1);function ea(t,e=null){return function(n,r){let{$from:u,$to:i}=n.selection,s=u.blockRange(i),o=s&&Qi(s,t,e);return o?(r&&r(n.tr.wrap(s,o).scrollIntoView()),!0):!1}}function br(t,e=null){return function(n,r){let u=!1;for(let i=0;i<n.selection.ranges.length&&!u;i++){let{$from:{pos:s},$to:{pos:o}}=n.selection.ranges[i];n.doc.nodesBetween(s,o,(l,a)=>{if(u)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)u=!0;else{let c=n.doc.resolve(a),f=c.index();u=c.parent.canReplaceWith(f,f+1,t)}})}if(!u)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[s];i.setBlockType(o,l,t,e)}r(i.scrollIntoView())}return!0}}function ta(t,e,n,r){for(let u=0;u<e.length;u++){let{$from:i,$to:s}=e[u],o=i.depth==0?t.inlineContent&&t.type.allowsMarkType(n):!1;if(t.nodesBetween(i.pos,s.pos,(l,a)=>{if(o)return!1;o=l.inlineContent&&l.type.allowsMarkType(n)}),o)return!0}return!1}function on(t,e=null,n){return function(r,u){let{empty:i,$cursor:s,ranges:o}=r.selection;if(i&&!s||!ta(r.doc,o,t))return!1;if(u)if(s)t.isInSet(r.storedMarks||s.marks())?u(r.tr.removeStoredMark(t)):u(r.tr.addStoredMark(t.create(e)));else{let l,a=r.tr;l=!o.some(c=>r.doc.rangeHasMark(c.$from.pos,c.$to.pos,t));for(let c=0;c<o.length;c++){let{$from:f,$to:p}=o[c];if(!l)a.removeMark(f.pos,p.pos,t);else{let h=f.pos,d=p.pos,m=f.nodeAfter,g=p.nodeBefore,b=m&&m.isText?/^\s*/.exec(m.text)[0].length:0,k=g&&g.isText?/\s*$/.exec(g.text)[0].length:0;h+b<d&&(h+=b,d-=k),a.addMark(h,d,t.create(e))}}u(a.scrollIntoView())}return!0}}function $r(...t){return function(e,n,r){for(let u=0;u<t.length;u++)if(t[u](e,n,r))return!0;return!1}}let Hn=$r(cs,Pl,Ll),Su=$r(cs,Vl,$l);const Se={Enter:$r(Hl,jl,Ul,Gl),"Mod-Enter":Jl,Backspace:Hn,"Mod-Backspace":Hn,"Shift-Backspace":Hn,Delete:Su,"Mod-Delete":Su,"Mod-a":Zl},ms={"Ctrl-h":Se.Backspace,"Alt-Backspace":Se["Mod-Backspace"],"Ctrl-d":Se.Delete,"Ctrl-Alt-Backspace":Se["Mod-Delete"],"Alt-Delete":Se["Mod-Delete"],"Alt-d":Se["Mod-Delete"],"Ctrl-a":Xl,"Ctrl-e":Ql};for(let t in Se)ms[t]=Se[t];const na=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,ra=na?ms:Se;function gs(t,e){return bs(t,e)!=null}function bs(t,e){const{from:n,$from:r,to:u,empty:i}=t.selection;if(!e)return null;if(i){if(t.storedMarks){const c=t.storedMarks.find(f=>f.type.name===e.name);if(c!=null)return c}const l=r.marks().find(c=>c.type.name===e.name);if(l!=null)return l;const a=r.nodeAfter;if(a&&a.marks){const c=a.marks.find(f=>f.type.name===e.name);if(c!=null)return c}return null}let s=null;return t.doc.nodesBetween(n,u,o=>{if(s!=null)return!1;if(o.marks){const l=o.marks.find(a=>a.type.name===e.name);if(l!=null)return s=l,!1}}),s}function ln(t,e,n){return t.map(()=>{const r=e.value,u=r.state.schema.marks[n];return gs(r.state,u)})}function ua(t,e,n){const{$from:r}=t.selection;for(let i=r.depth;i>0;i--){const s=r.node(i);if(s.type.name===e.name)return n!=null?Object.keys(n).every(o=>s.attrs[o]===n[o]):!0}const u=t.doc.nodeAt(r.pos);return u&&u.type.name===e.name?n!=null?Object.keys(n).every(i=>u.attrs[i]===n[i]):!0:!1}function Dt(t,e,n,r){return t.map(()=>{const u=e.value,i=u.state.schema.nodes[n];return i?ua(u.state,i,r):!1})}function ia(t,e){const n=t.state.schema.marks.link;if(n==null)return;const{from:r,to:u}=t.state.selection,i=t.state.tr.addMark(r,u,n.create({href:e,title:null}));t.dispatch(i),t.focus()}function xs(t){const{state:e}=t,{$from:n,$to:r}=e.selection;if(!ks(e))return null;let u=n.pos,i=r.pos;const s=e.doc;for(;u>0&&s.resolve(u-1).nodeAfter?.marks?.some(a=>a.type.name==="link");)u--;for(;i<s.content.size&&s.resolve(i).nodeAfter?.marks?.some(a=>a.type.name==="link");)i++;return{start:u,end:i}}function sa(t,e){const n=t.state.schema.marks.link;if(n==null)return;const r=xs(t);if(r==null)return;const{start:u,end:i}=r,s=t.state.tr.removeMark(u,i,n).addMark(u,i,n.create({href:e,title:null}));t.dispatch(s)}function oa(t){const e=t.state.schema.marks.link;if(e==null)return;const n=xs(t);if(n==null)return;const{start:r,end:u}=n,i=t.state.tr.removeMark(r,u,e);t.dispatch(i),t.focus()}function ks(t){return gs(t,t.schema.marks.link)}function la({stateUpdate:t,view:e,isReadOnly:n,label:r,linkUrlPlaceholder:u,size:i}){const s=S.prop(null);s.on(l=>{l!=null&&sa(e.value,l)});const o=t.on(()=>{const l=bs(e.value.state,e.value.state.schema.marks.link);l!=null?s.set(l.attrs.href??""):s.set(null)});return S.Fragment(S.OnDispose(o),dr.ToolbarGroup(Z.EditorToolbarButton({display:S.signal(!0),active:ln(t,e,"link"),disabled:n,label:r,icon:"mdi:link-variant",size:i,onClick:()=>{const l=e.value.state;ks(l)?(oa(e.value),s.set(null)):(ia(e.value,""),s.set(""))}}),S.Ensure(s,l=>Ro.TextInput({value:l,autofocus:!0,onInput:s.set,placeholder:u,size:i}))),S.Ensure(s,l=>dr.ToolbarButton({disabled:l.map(a=>a.trim()===""),variant:"text",onClick:()=>{const a=s.value;a&&window.open(a,"_blank")},size:i},"go")))}function ys({view:t,stateUpdate:e,features:n,readOnly:r=S.signal(!1),size:u="sm"}){return S.Ensure(t,i=>S.Use(Bo.BeatUII18n,s=>{const o=s.$.prosemirror,l=i;return dr.Toolbar(Z.EditorToolbarGroup({display:[n.$.bold,n.$.italic,n.$.code]},Z.EditorToolbarButton({active:ln(e,l,"strong"),display:n.$.bold,onClick:()=>Jn(l.value,"strong"),disabled:r,label:o.$.bold,icon:"mdi:format-bold",size:u}),Z.EditorToolbarButton({active:ln(e,l,"em"),display:n.$.italic,onClick:()=>Jn(l.value,"em"),disabled:r,label:o.$.italic,icon:"mdi:format-italic",size:u}),Z.EditorToolbarButton({active:ln(e,l,"code"),display:n.$.code,onClick:()=>Jn(l.value,"code"),disabled:r,label:o.$.code,icon:"mdi:code-tags",size:u})),Z.EditorToolbarGroup({display:[n.$.headings]},S.Repeat(n.$.headerLevels.map(a=>Math.min(Math.max(a,1),6)),({counter:a})=>Z.EditorToolbarButton({active:Dt(e,l,"heading",{level:a}),display:n.$.headings,onClick:()=>aa(l.value,a),disabled:r,label:o.map(c=>c.heading(a)),icon:`mdi:format-header-${a}`,size:u}))),Z.EditorToolbarGroup({display:[n.$.bulletList,n.$.orderedList]},Z.EditorToolbarButton({active:Dt(e,l,"bullet_list"),display:n.$.bulletList,onClick:()=>Au(l.value,"bullet_list"),disabled:r,label:o.$.bulletList,icon:"mdi:format-list-bulleted",size:u}),Z.EditorToolbarButton({active:Dt(e,l,"ordered_list"),display:n.$.orderedList,onClick:()=>Au(l.value,"ordered_list"),disabled:r,label:o.$.orderedList,icon:"mdi:format-list-numbered",size:u})),Z.EditorToolbarGroup({display:[n.$.blockquote,n.$.codeBlock,n.$.horizontalRule]},Z.EditorToolbarButton({active:Dt(e,l,"blockquote"),display:n.$.blockquote,onClick:()=>ca(l.value),disabled:r,label:o.$.blockquote,icon:"mdi:format-quote-close",size:u}),Z.EditorToolbarButton({active:Dt(e,l,"code_block"),display:n.$.codeBlock,onClick:()=>fa(l.value),disabled:r,label:o.$.codeBlock,icon:"mdi:code-braces",size:u}),Z.EditorToolbarButton({active:S.signal(!1),display:n.$.horizontalRule,onClick:()=>da(l.value),disabled:r,label:o.$.horizontalRule,icon:"mdi:minus",size:u})),S.When(n.$.links,()=>la({stateUpdate:e,view:l,isReadOnly:r,label:o.$.link,linkUrlPlaceholder:o.$.linkUrlPlaceholder,size:u})))}))}function Jn(t,e){const n=t.state.schema.marks[e];n!=null&&(on(n)(t.state,t.dispatch),t.focus())}function aa(t,e){const n=t.state.schema.nodes.heading;n!=null&&(br(n,{level:e})(t.state,t.dispatch),t.focus())}async function Au(t,e){const{wrapInList:n,liftListItem:r}=await Promise.resolve().then(()=>require("./index-Bso_SkEn.cjs")),u=t.state.schema.nodes[e],i=t.state.schema.nodes.list_item;if(u==null||i==null)return;const{state:s}=t,{$from:o}=s.selection;let l=null;for(let a=o.depth;a>0;a--){const c=o.node(a);if(c.type.name==="bullet_list"||c.type.name==="ordered_list"){l=c.type.name;break}}l===e?r(i)(s,t.dispatch):l!=null?r(i)(t.state,t.dispatch)&&n(u)(t.state,t.dispatch):n(u)(s,t.dispatch),t.focus()}function ca(t){const e=t.state.schema.nodes.blockquote;if(e==null)return;const{state:n}=t,{$from:r}=n.selection;let u=!1;for(let i=r.depth;i>0;i--)if(r.node(i).type.name==="blockquote"){u=!0;break}u?Wl(n,t.dispatch):ea(e)(n,t.dispatch),t.focus()}function fa(t){const e=t.state.schema.nodes.code_block,n=t.state.schema.nodes.paragraph;if(e==null||n==null)return;const{state:r}=t,{$from:u}=r.selection;let i=!1;for(let s=u.depth;s>0;s--)if(u.node(s).type.name==="code_block"){i=!0;break}i?br(n)(r,t.dispatch):br(e)(r,t.dispatch),t.focus()}function da(t){const e=t.state.schema.nodes.horizontal_rule;if(e!=null){const n=t.state.tr.replaceSelectionWith(e.create());t.dispatch(n),t.focus()}}const V=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},gt=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let xr=null;const Ee=function(t,e,n){let r=xr||(xr=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},ha=function(){xr=null},rt=function(t,e,n,r){return n&&(Mu(t,e,n,r,-1)||Mu(t,e,n,r,1))},pa=/^(img|br|input|textarea|hr)$/i;function Mu(t,e,n,r,u){for(var i;;){if(t==n&&e==r)return!0;if(e==(u<0?0:se(t))){let s=t.parentNode;if(!s||s.nodeType!=1||jt(t)||pa.test(t.nodeName)||t.contentEditable=="false")return!1;e=V(t)+(u<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(u<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=u;else return!1;else t=s,e=u<0?se(t):0}else return!1}}function se(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ma(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=se(t)}else if(t.parentNode&&!jt(t))e=V(t),t=t.parentNode;else return null}}function ga(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!jt(t))e=V(t)+1,t=t.parentNode;else return null}}function ba(t,e,n){for(let r=e==0,u=e==se(t);r||u;){if(t==n)return!0;let i=V(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,u=u&&i==se(t)}}function jt(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const An=function(t){return t.focusNode&&rt(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function je(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function xa(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function ka(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(se(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(se(r.startContainer),r.startOffset)}}}const ke=typeof navigator<"u"?navigator:null,wu=typeof document<"u"?document:null,He=ke&&ke.userAgent||"",kr=/Edge\/(\d+)/.exec(He),Cs=/MSIE \d/.exec(He),yr=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(He),X=!!(Cs||yr||kr),Le=Cs?document.documentMode:yr?+yr[1]:kr?+kr[1]:0,oe=!X&&/gecko\/(\d+)/i.test(He);oe&&+(/Firefox\/(\d+)/.exec(He)||[0,0])[1];const Cr=!X&&/Chrome\/(\d+)/.exec(He),W=!!Cr,Ds=Cr?+Cr[1]:0,j=!X&&!!ke&&/Apple Computer/.test(ke.vendor),bt=j&&(/Mobile\/\w+/.test(He)||!!ke&&ke.maxTouchPoints>2),ie=bt||(ke?/Mac/.test(ke.platform):!1),_s=ke?/Win/.test(ke.platform):!1,Ae=/Android \d/.test(He),Ut=!!wu&&"webkitFontSmoothing"in wu.documentElement.style,ya=Ut?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ca(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function _e(t,e){return typeof t=="number"?t:t[e]}function Da(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Tu(t,e,n){let r=t.someProp("scrollThreshold")||0,u=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=gt(s);continue}let o=s,l=o==i.body,a=l?Ca(i):Da(o),c=0,f=0;if(e.top<a.top+_e(r,"top")?f=-(a.top-e.top+_e(u,"top")):e.bottom>a.bottom-_e(r,"bottom")&&(f=e.bottom-e.top>a.bottom-a.top?e.top+_e(u,"top")-a.top:e.bottom-a.bottom+_e(u,"bottom")),e.left<a.left+_e(r,"left")?c=-(a.left-e.left+_e(u,"left")):e.right>a.right-_e(r,"right")&&(c=e.right-a.right+_e(u,"right")),c||f)if(l)i.defaultView.scrollBy(c,f);else{let h=o.scrollLeft,d=o.scrollTop;f&&(o.scrollTop+=f),c&&(o.scrollLeft+=c);let m=o.scrollLeft-h,g=o.scrollTop-d;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let p=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:gt(s)}}function _a(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,u;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let o=t.root.elementFromPoint(i,s);if(!o||o==t.dom||!t.dom.contains(o))continue;let l=o.getBoundingClientRect();if(l.top>=n-20){r=o,u=l.top;break}}return{refDOM:r,refTop:u,stack:Es(t.dom)}}function Es(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=gt(r));return e}function Ea({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Ss(n,r==0?0:r-e)}function Ss(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:u,left:i}=t[n];r.scrollTop!=u+e&&(r.scrollTop=u+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let st=null;function Sa(t){if(t.setActive)return t.setActive();if(st)return t.focus(st);let e=Es(t);t.focus(st==null?{get preventScroll(){return st={preventScroll:!0},!0}}:void 0),st||(st=!1,Ss(e,0))}function As(t,e){let n,r=2e8,u,i=0,s=e.top,o=e.top,l,a;for(let c=t.firstChild,f=0;c;c=c.nextSibling,f++){let p;if(c.nodeType==1)p=c.getClientRects();else if(c.nodeType==3)p=Ee(c).getClientRects();else continue;for(let h=0;h<p.length;h++){let d=p[h];if(d.top<=s&&d.bottom>=o){s=Math.max(d.bottom,s),o=Math.min(d.top,o);let m=d.left>e.left?d.left-e.left:d.right<e.left?e.left-d.right:0;if(m<r){n=c,r=m,u=m&&n.nodeType==3?{left:d.right<e.left?d.right:d.left,top:e.top}:e,c.nodeType==1&&m&&(i=f+(e.left>=(d.left+d.right)/2?1:0));continue}}else d.top>e.top&&!l&&d.left<=e.left&&d.right>=e.left&&(l=c,a={left:Math.max(d.left,Math.min(d.right,e.left)),top:d.top});!n&&(e.left>=d.right&&e.top>=d.top||e.left>=d.left&&e.top>=d.bottom)&&(i=f+1)}}return!n&&l&&(n=l,u=a,r=0),n&&n.nodeType==3?Aa(n,u):!n||r&&n.nodeType==1?{node:t,offset:i}:As(n,u)}function Aa(t,e){let n=t.nodeValue.length,r=document.createRange(),u;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let s=Te(r,1);if(s.top!=s.bottom&&Wr(e,s)){u={node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),u||{node:t,offset:0}}function Wr(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Ma(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function wa(t,e,n){let{node:r,offset:u}=As(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,u,i)}function Ta(t,e,n,r){let u=-1;for(let i=e,s=!1;i!=t.dom;){let o=t.docView.nearestDesc(i,!0),l;if(!o)return null;if(o.dom.nodeType==1&&(o.node.isBlock&&o.parent||!o.contentDOM)&&((l=o.dom.getBoundingClientRect()).width||l.height)&&(o.node.isBlock&&o.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(o.dom.nodeName)&&(!s&&l.left>r.left||l.top>r.top?u=o.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(u=o.posAfter),s=!0),!o.contentDOM&&u<0&&!o.node.isText))return(o.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?o.posBefore:o.posAfter;i=o.dom.parentNode}return u>-1?u:t.docView.posFromDOM(e,n,-1)}function Ms(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let u=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=u;;){let s=t.childNodes[i];if(s.nodeType==1){let o=s.getClientRects();for(let l=0;l<o.length;l++){let a=o[l];if(Wr(e,a))return Ms(s,e,a)}}if((i=(i+1)%r)==u)break}return t}function Oa(t,e){let n=t.dom.ownerDocument,r,u=0,i=ka(n,e.left,e.top);i&&({node:r,offset:u}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),o;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let a=t.dom.getBoundingClientRect();if(!Wr(e,a)||(s=Ms(t.dom,e,a),!s))return null}if(j)for(let a=s;r&&a;a=gt(a))a.draggable&&(r=void 0);if(s=Ma(s,e),r){if(oe&&r.nodeType==1&&(u=Math.min(u,r.childNodes.length),u<r.childNodes.length)){let c=r.childNodes[u],f;c.nodeName=="IMG"&&(f=c.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&u++}let a;Ut&&u&&r.nodeType==1&&(a=r.childNodes[u-1]).nodeType==1&&a.contentEditable=="false"&&a.getBoundingClientRect().top>=e.top&&u--,r==t.dom&&u==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?o=t.state.doc.content.size:(u==0||r.nodeType!=1||r.childNodes[u-1].nodeName!="BR")&&(o=Ta(t,r,u,e))}o==null&&(o=wa(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:o,inside:l?l.posAtStart-l.border:-1}}function Ou(t){return t.top<t.bottom||t.left<t.right}function Te(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Ou(r))return r}return Array.prototype.find.call(n,Ou)||t.getBoundingClientRect()}const Fa=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ws(t,e,n){let{node:r,offset:u,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=Ut||oe;if(r.nodeType==3)if(s&&(Fa.test(r.nodeValue)||(n<0?!u:u==r.nodeValue.length))){let l=Te(Ee(r,u,u),n);if(oe&&u&&/\s/.test(r.nodeValue[u-1])&&u<r.nodeValue.length){let a=Te(Ee(r,u-1,u-1),-1);if(a.top==l.top){let c=Te(Ee(r,u,u+1),-1);if(c.top!=l.top)return _t(c,c.left<a.left)}}return l}else{let l=u,a=u,c=n<0?1:-1;return n<0&&!u?(a++,c=-1):n>=0&&u==r.nodeValue.length?(l--,c=1):n<0?l--:a++,_t(Te(Ee(r,l,a),c),c<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&u&&(n<0||u==se(r))){let l=r.childNodes[u-1];if(l.nodeType==1)return jn(l.getBoundingClientRect(),!1)}if(i==null&&u<se(r)){let l=r.childNodes[u];if(l.nodeType==1)return jn(l.getBoundingClientRect(),!0)}return jn(r.getBoundingClientRect(),n>=0)}if(i==null&&u&&(n<0||u==se(r))){let l=r.childNodes[u-1],a=l.nodeType==3?Ee(l,se(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(a)return _t(Te(a,1),!1)}if(i==null&&u<se(r)){let l=r.childNodes[u];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let a=l?l.nodeType==3?Ee(l,0,s?0:1):l.nodeType==1?l:null:null;if(a)return _t(Te(a,-1),!0)}return _t(Te(r.nodeType==3?Ee(r):r,-n),n>=0)}function _t(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function jn(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Ts(t,e,n){let r=t.state,u=t.root.activeElement;r!=e&&t.updateState(e),u!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),u!=t.dom&&u&&u.focus()}}function Na(t,e,n){let r=e.selection,u=n=="up"?r.$from:r.$to;return Ts(t,e,()=>{let{node:i}=t.docView.domFromPos(u.pos,n=="up"?-1:1);for(;;){let o=t.docView.nearestDesc(i,!0);if(!o)break;if(o.node.isBlock){i=o.contentDOM||o.dom;break}i=o.dom.parentNode}let s=ws(t,u.pos,1);for(let o=i.firstChild;o;o=o.nextSibling){let l;if(o.nodeType==1)l=o.getClientRects();else if(o.nodeType==3)l=Ee(o,0,o.nodeValue.length).getClientRects();else continue;for(let a=0;a<l.length;a++){let c=l[a];if(c.bottom>c.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}const Ia=/[\u0590-\u08ac]/;function Ra(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let u=r.parentOffset,i=!u,s=u==r.parent.content.size,o=t.domSelection();return o?!Ia.test(r.parent.textContent)||!o.modify?n=="left"||n=="backward"?i:s:Ts(t,e,()=>{let{focusNode:l,focusOffset:a,anchorNode:c,anchorOffset:f}=t.domSelectionRange(),p=o.caretBidiLevel;o.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:d,focusOffset:m}=t.domSelectionRange(),g=d&&!h.contains(d.nodeType==1?d:d.parentNode)||l==d&&a==m;try{o.collapse(c,f),l&&(l!=c||a!=f)&&o.extend&&o.extend(l,a)}catch{}return p!=null&&(o.caretBidiLevel=p),g}):r.pos==r.start()||r.pos==r.end()}let Fu=null,Nu=null,Iu=!1;function Ba(t,e,n){return Fu==e&&Nu==n?Iu:(Fu=e,Nu=n,Iu=n=="up"||n=="down"?Na(t,e,n):Ra(t,e,n))}const le=0,Ru=1,Ke=2,ye=3;class Kt{constructor(e,n,r,u){this.parent=e,this.children=n,this.dom=r,this.contentDOM=u,this.dirty=le,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let u=this.children[n];if(u==e)return r;r+=u.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let u;if(e==this.dom&&this.contentDOM)u=n>V(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))u=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){u=!1;break}if(i.previousSibling)break}if(u==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){u=!0;break}if(i.nextSibling)break}}return u??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,u=e;u;u=u.parentNode){let i=this.getDesc(u),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let u=e;u;u=u.parentNode){let i=this.getDesc(u);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let u=this.children[n],i=r+u.size;if(r==e&&i!=r){for(;!u.border&&u.children.length;)for(let s=0;s<u.children.length;s++){let o=u.children[s];if(o.size){u=o;break}}return u}if(e<i)return u.descAt(e-r-u.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,u=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],o=i+s.size;if(o>e||s instanceof Fs){u=e-i;break}i=o}if(u)return this.children[r].domFromPos(u-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Os&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?V(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?V(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let u=-1,i=-1;for(let s=r,o=0;;o++){let l=this.children[o],a=s+l.size;if(u==-1&&e<=a){let c=s+l.border;if(e>=c&&n<=a-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,c);e=s;for(let f=o;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){u=V(p.dom)+1;break}e-=p.size}u==-1&&(u=0)}if(u>-1&&(a>n||o==this.children.length-1)){n=a;for(let c=o+1;c<this.children.length;c++){let f=this.children[c];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=V(f.dom);break}n+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=a}return{node:this.contentDOM,from:e,to:n,fromOffset:u,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,u=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let h=0,d=0;h<this.children.length;h++){let m=this.children[h],g=d+m.size;if(i>d&&s<g)return m.setSelection(e-d-m.border,n-d-m.border,r,u);d=g}let o=this.domFromPos(e,e?-1:1),l=n==e?o:this.domFromPos(n,n?-1:1),a=r.root.getSelection(),c=r.domSelectionRange(),f=!1;if((oe||j)&&e==n){let{node:h,offset:d}=o;if(h.nodeType==3){if(f=!!(d&&h.nodeValue[d-1]==`
|
|
7
|
+
`),f&&d==h.nodeValue.length)for(let m=h,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(o=l={node:g.parentNode,offset:V(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=h.childNodes[d-1];f=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(oe&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(u=!0)}if(!(u||f&&j)&&rt(o.node,o.offset,c.anchorNode,c.anchorOffset)&&rt(l.node,l.offset,c.focusNode,c.focusOffset))return;let p=!1;if((a.extend||e==n)&&!(f&&oe)){a.collapse(o.node,o.offset);try{e!=n&&a.extend(l.node,l.offset),p=!0}catch{}}if(!p){if(e>n){let d=o;o=l,l=d}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(o.node,o.offset),a.removeAllRanges(),a.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,u=0;u<this.children.length;u++){let i=this.children[u],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let o=r+i.border,l=s-i.border;if(e>=o&&n<=l){this.dirty=e==r||n==s?Ke:Ru,e==o&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=ye:i.markDirty(e-o,n-o);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Ke:ye}r=s}this.dirty=Ke}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ke:Ru;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Os extends Kt{constructor(e,n,r,u){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return u;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let o=document.createElement("span");o.appendChild(s),s=o}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==le&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class za extends Kt{constructor(e,n,r,u){super(e,[],n,null),this.textDOM=r,this.text=u}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class ut extends Kt{constructor(e,n,r,u,i){super(e,[],r,u),this.mark=n,this.spec=i}static create(e,n,r,u){let i=u.nodeViews[n.type.name],s=i&&i(n,u,r);return(!s||!s.dom)&&(s=yt.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ut(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&ye||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ye&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=le){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=le}}slice(e,n,r){let u=ut.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=_r(i,n,s,r)),e>0&&(i=_r(i,0,e,r));for(let o=0;o<i.length;o++)i[o].parent=u;return u.children=i,u}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class qe extends Kt{constructor(e,n,r,u,i,s,o,l,a){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=u,this.nodeDOM=o}static create(e,n,r,u,i,s){let o=i.nodeViews[n.type.name],l,a=o&&o(n,i,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,u),c=a&&a.dom,f=a&&a.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:f}=yt.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let p=c;return c=Rs(c,r,n),a?l=new va(e,n,r,u,c,f||null,p,a,i,s+1):n.isText?new Mn(e,n,r,u,c,p,i):new qe(e,n,r,u,c,f||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>x.empty)}return e}matchesNode(e,n,r){return this.dirty==le&&e.eq(this.node)&&pn(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,u=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,o=i&&i.pos<0,l=new La(this,s&&s.node,e);$a(this.node,this.innerDeco,(a,c,f)=>{a.spec.marks?l.syncToMarks(a.spec.marks,r,e,c):a.type.side>=0&&!f&&l.syncToMarks(c==this.node.childCount?T.none:this.node.child(c).marks,r,e,c),l.placeWidget(a,e,u)},(a,c,f,p)=>{l.syncToMarks(a.marks,r,e,p);let h;l.findNodeMatch(a,c,f,p)||o&&e.state.selection.from>u&&e.state.selection.to<u+a.nodeSize&&(h=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(a,c,f,h,e)||l.updateNextNode(a,c,f,e,p,u)||l.addNode(a,c,f,e,u),u+=a.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Ke)&&(s&&this.protectLocalComposition(e,s),Ns(this.contentDOM,this.children,e),bt&&Wa(this.dom))}localCompositionInfo(e,n){let{from:r,to:u}=e.state.selection;if(!(e.state.selection instanceof F)||r<n||u>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,o=Ha(this.node.content,s,r-n,u-n);return o<0?null:{node:i,pos:o,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:u}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new za(this,i,n,u);e.input.compositionNodes.push(s),this.children=_r(this.children,r,r+u.length,e,s)}update(e,n,r,u){return this.dirty==ye||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,u),!0)}updateInner(e,n,r,u){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(u,this.posAtStart),this.dirty=le}updateOuterDeco(e){if(pn(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Is(this.dom,this.nodeDOM,Dr(this.outerDeco,this.node,n),Dr(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Bu(t,e,n,r,u){Rs(r,e,t);let i=new qe(void 0,t,e,n,r,r,r,u,0);return i.contentDOM&&i.updateChildren(u,0),i}class Mn extends qe{constructor(e,n,r,u,i,s,o){super(e,n,r,u,i,null,s,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,u){return this.dirty==ye||this.dirty!=le&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=le||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,u.trackWrites==this.nodeDOM&&(u.trackWrites=null)),this.node=e,this.dirty=le,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let u=this.node.cut(e,n),i=document.createTextNode(u.text);return new Mn(this.parent,u,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ye)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Fs extends Kt{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==le&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class va extends qe{constructor(e,n,r,u,i,s,o,l,a,c){super(e,n,r,u,i,s,o,a,c),this.spec=l}update(e,n,r,u){if(this.dirty==ye)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,u),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,u)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,u){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,u)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Ns(t,e,n){let r=t.firstChild,u=!1;for(let i=0;i<e.length;i++){let s=e[i],o=s.dom;if(o.parentNode==t){for(;o!=r;)r=zu(r),u=!0;r=r.nextSibling}else u=!0,t.insertBefore(o,r);if(s instanceof ut){let l=r?r.previousSibling:t.lastChild;Ns(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=zu(r),u=!0;u&&n.trackWrites==t&&(n.trackWrites=null)}const Ft=function(t){t&&(this.nodeName=t)};Ft.prototype=Object.create(null);const Ge=[new Ft];function Dr(t,e,n){if(t.length==0)return Ge;let r=n?Ge[0]:new Ft,u=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&u.push(r=new Ft(s.nodeName));for(let o in s){let l=s[o];l!=null&&(n&&u.length==1&&u.push(r=new Ft(e.isInline?"span":"div")),o=="class"?r.class=(r.class?r.class+" ":"")+l:o=="style"?r.style=(r.style?r.style+";":"")+l:o!="nodeName"&&(r[o]=l))}}}return u}function Is(t,e,n,r){if(n==Ge&&r==Ge)return e;let u=e;for(let i=0;i<r.length;i++){let s=r[i],o=n[i];if(i){let l;o&&o.nodeName==s.nodeName&&u!=t&&(l=u.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(u),o=Ge[0]),u=l}Pa(u,o||Ge[0],s)}return u}function Pa(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],u=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)u.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<u.length;i++)r.indexOf(u[i])==-1&&t.classList.add(u[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,u;for(;u=r.exec(e.style);)t.style.removeProperty(u[1])}n.style&&(t.style.cssText+=n.style)}}function Rs(t,e,n){return Is(t,t,Ge,Dr(e,n,t.nodeType!=1))}function pn(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function zu(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class La{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=qa(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,u){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=le,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1,a=this.top.children.length;u<this.preMatch.index&&(a=Math.min(this.index+3,a));for(let c=this.index;c<a;c++){let f=this.top.children[c];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){l=c;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let c=ut.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,u){let i=-1,s;if(u>=this.preMatch.index&&(s=this.preMatch.matches[u-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let o=this.index,l=Math.min(this.top.children.length,o+5);o<l;o++){let a=this.top.children[o];if(a.matchesNode(e,n,r)&&!this.preMatch.matched.has(a)){i=o;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,u,i){let s=this.top.children[u];return s.dirty==ye&&s.dom==s.contentDOM&&(s.dirty=Ke),s.update(e,n,r,i)?(this.destroyBetween(this.index,u),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let u=this.index;u<this.top.children.length;u++)if(this.top.children[u]==r)return u}return-1}e=n}}updateNextNode(e,n,r,u,i,s){for(let o=this.index;o<this.top.children.length;o++){let l=this.top.children[o];if(l instanceof qe){let a=this.preMatch.matched.get(l);if(a!=null&&a!=i)return!1;let c=l.dom,f,p=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=ye&&pn(n,l.outerDeco));if(!p&&l.update(e,n,r,u))return this.destroyBetween(this.index,o),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(l,e,n,r,u,s)))return this.destroyBetween(this.index,o),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Ke,f.updateChildren(u,s+1),f.dirty=le),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,u,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!pn(r,e.outerDeco)||!u.eq(e.innerDeco))return null;let o=qe.create(this.top,n,r,u,i,s);if(o.contentDOM){o.children=e.children,e.children=[];for(let l of o.children)l.parent=o}return e.destroy(),o}addNode(e,n,r,u,i){let s=qe.create(this.top,e,n,r,u,i);s.contentDOM&&s.updateChildren(u,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let u=this.index<this.top.children.length?this.top.children[this.index]:null;if(u&&u.matchesWidget(e)&&(e==u.widget||!u.widget.type.toDOM.parentNode))this.index++;else{let i=new Os(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof ut;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Mn)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((j||W)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let u=new Fs(this.top,[],r,null);n!=this.top?n.children.push(u):n.children.splice(this.index++,0,u),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function qa(t,e){let n=e,r=n.children.length,u=t.childCount,i=new Map,s=[];e:for(;u>0;){let o;for(;;)if(r){let a=n.children[r-1];if(a instanceof ut)n=a,r=a.children.length;else{o=a,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=o.node;if(l){if(l!=t.child(u-1))break;--u,i.set(o,u),s.push(o)}}return{index:u,matched:i,matches:s.reverse()}}function Va(t,e){return t.type.side-e.type.side}function $a(t,e,n,r){let u=e.locals(t),i=0;if(u.length==0){for(let a=0;a<t.childCount;a++){let c=t.child(a);r(c,u,e.forChild(i,c),a),i+=c.nodeSize}return}let s=0,o=[],l=null;for(let a=0;;){let c,f;for(;s<u.length&&u[s].to==i;){let g=u[s++];g.widget&&(c?(f||(f=[c])).push(g):c=g)}if(c)if(f){f.sort(Va);for(let g=0;g<f.length;g++)n(f[g],a,!!l)}else n(c,a,!!l);let p,h;if(l)h=-1,p=l,l=null;else if(a<t.childCount)h=a,p=t.child(a++);else break;for(let g=0;g<o.length;g++)o[g].to<=i&&o.splice(g--,1);for(;s<u.length&&u[s].from<=i&&u[s].to>i;)o.push(u[s++]);let d=i+p.nodeSize;if(p.isText){let g=d;s<u.length&&u[s].from<g&&(g=u[s].from);for(let b=0;b<o.length;b++)o[b].to<g&&(g=o[b].to);g<d&&(l=p.cut(g-i),p=p.cut(0,g-i),d=g,h=-1)}else for(;s<u.length&&u[s].to<d;)s++;let m=p.isInline&&!p.isLeaf?o.filter(g=>!g.inline):o.slice();r(p,m,e.forChild(i,p),h),i=d}}function Wa(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Ha(t,e,n,r){for(let u=0,i=0;u<t.childCount&&i<=r;){let s=t.child(u++),o=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;u<t.childCount;){let a=t.child(u++);if(i+=a.nodeSize,!a.isText)break;l+=a.text}if(i>=n){if(i>=r&&l.slice(r-e.length-o,r-o)==e)return r-e.length;let a=o<r?l.lastIndexOf(e,r-o-1):-1;if(a>=0&&a+e.length+o>=n)return o+a;if(n==r&&l.length>=r+e.length-o&&l.slice(r-o,r-o+e.length)==e)return r}}return-1}function _r(t,e,n,r,u){let i=[];for(let s=0,o=0;s<t.length;s++){let l=t[s],a=o,c=o+=l.size;a>=n||c<=e?i.push(l):(a<e&&i.push(l.slice(0,e-a,r)),u&&(i.push(u),u=void 0),c>n&&i.push(l.slice(n-a,l.size,r)))}return i}function Hr(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let u=t.docView.nearestDesc(n.focusNode),i=u&&u.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let o=r.resolve(s),l,a;if(An(n)){for(l=s;u&&!u.node;)u=u.parent;let f=u.node;if(u&&f.isAtom&&A.isSelectable(f)&&u.parent&&!(f.isInline&&ba(n.focusNode,n.focusOffset,u.dom))){let p=u.posBefore;a=new A(s==p?o:r.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=s,p=s;for(let h=0;h<n.rangeCount;h++){let d=n.getRangeAt(h);f=Math.min(f,t.docView.posFromDOM(d.startContainer,d.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(d.endContainer,d.endOffset,-1))}if(f<0)return null;[l,s]=p==t.state.selection.anchor?[p,f]:[f,p],o=r.resolve(s)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let c=r.resolve(l);if(!a){let f=e=="pointer"||t.state.selection.head<o.pos&&!i?1:-1;a=Jr(t,c,o,f)}return a}function Bs(t){return t.editable?t.hasFocus():vs(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Me(t,e=!1){let n=t.state.selection;if(zs(t,n),!!Bs(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&W){let r=t.domSelectionRange(),u=t.domObserver.currentSelection;if(r.anchorNode&&u.anchorNode&&rt(r.anchorNode,r.anchorOffset,u.anchorNode,u.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)ja(t);else{let{anchor:r,head:u}=n,i,s;vu&&!(n instanceof F)&&(n.$from.parent.inlineContent||(i=Pu(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Pu(t,n.to))),t.docView.setSelection(r,u,t,e),vu&&(i&&Lu(i),s&&Lu(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Ja(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const vu=j||W&&Ds<63;function Pu(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),u=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(j&&u&&u.contentEditable=="false")return Un(u);if((!u||u.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(u)return Un(u);if(i)return Un(i)}}function Un(t){return t.contentEditable="true",j&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Lu(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Ja(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,u=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=u)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Bs(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function ja(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,V(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&X&&Le<=11&&(n.disabled=!0,n.disabled=!1)}function zs(t,e){if(e instanceof A){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(qu(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else qu(t)}function qu(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Jr(t,e,n,r){return t.someProp("createSelectionBetween",u=>u(t,e,n))||F.between(e,n,r)}function Vu(t){return t.editable&&!t.hasFocus()?!1:vs(t)}function vs(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Ua(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return rt(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Er(t,e){let{$anchor:n,$head:r}=t.selection,u=e>0?n.max(r):n.min(r),i=u.parent.inlineContent?u.depth?t.doc.resolve(e>0?u.after():u.before()):null:u;return i&&O.findFrom(i,e)}function Oe(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function $u(t,e,n){let r=t.state.selection;if(r instanceof F)if(n.indexOf("s")>-1){let{$head:u}=r,i=u.textOffset?null:e<0?u.nodeBefore:u.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(u.pos+i.nodeSize*(e<0?-1:1));return Oe(t,new F(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let u=Er(t.state,e);return u&&u instanceof A?Oe(t,u):!1}else if(!(ie&&n.indexOf("m")>-1)){let u=r.$head,i=u.textOffset?null:e<0?u.nodeBefore:u.nodeAfter,s;if(!i||i.isText)return!1;let o=e<0?u.pos-i.nodeSize:u.pos;return i.isAtom||(s=t.docView.descAt(o))&&!s.contentDOM?A.isSelectable(i)?Oe(t,new A(e<0?t.state.doc.resolve(u.pos-i.nodeSize):u)):Ut?Oe(t,new F(t.state.doc.resolve(e<0?o:o+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof A&&r.node.isInline)return Oe(t,new F(e>0?r.$to:r.$from));{let u=Er(t.state,e);return u?Oe(t,u):!1}}}function mn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Nt(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ot(t,e){return e<0?Ka(t):Ga(t)}function Ka(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let u,i,s=!1;for(oe&&n.nodeType==1&&r<mn(n)&&Nt(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let o=n.childNodes[r-1];if(Nt(o,-1))u=n,i=--r;else if(o.nodeType==3)n=o,r=n.nodeValue.length;else break}}else{if(Ps(n))break;{let o=n.previousSibling;for(;o&&Nt(o,-1);)u=n.parentNode,i=V(o),o=o.previousSibling;if(o)n=o,r=mn(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Sr(t,n,r):u&&Sr(t,u,i)}function Ga(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let u=mn(n),i,s;for(;;)if(r<u){if(n.nodeType!=1)break;let o=n.childNodes[r];if(Nt(o,1))i=n,s=++r;else break}else{if(Ps(n))break;{let o=n.nextSibling;for(;o&&Nt(o,1);)i=o.parentNode,s=V(o)+1,o=o.nextSibling;if(o)n=o,r=0,u=mn(n);else{if(n=n.parentNode,n==t.dom)break;r=u=0}}}i&&Sr(t,i,s)}function Ps(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Za(t,e){for(;t&&e==t.childNodes.length&&!jt(t);)e=V(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Ya(t,e){for(;t&&!e&&!jt(t);)e=V(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Sr(t,e,n){if(e.nodeType!=3){let i,s;(s=Za(e,n))?(e=s,n=0):(i=Ya(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(An(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:u}=t;setTimeout(()=>{t.state==u&&Me(t)},50)}function Wu(t,e){let n=t.state.doc.resolve(e);if(!(W||_s)&&n.parent.inlineContent){let u=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>u.top&&s<u.bottom&&Math.abs(i.left-u.left)>1)return i.left<u.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>u.top&&s<u.bottom&&Math.abs(i.left-u.left)>1)return i.left>u.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Hu(t,e,n){let r=t.state.selection;if(r instanceof F&&!r.empty||n.indexOf("s")>-1||ie&&n.indexOf("m")>-1)return!1;let{$from:u,$to:i}=r;if(!u.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Er(t.state,e);if(s&&s instanceof A)return Oe(t,s)}if(!u.parent.inlineContent){let s=e<0?u:i,o=r instanceof ne?O.near(s,e):O.findFrom(s,e);return o?Oe(t,o):!1}return!1}function Ju(t,e){if(!(t.state.selection instanceof F))return!0;let{$head:n,$anchor:r,empty:u}=t.state.selection;if(!n.sameParent(r))return!0;if(!u)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function ju(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Xa(t){if(!j||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;ju(t,r,"true"),setTimeout(()=>ju(t,r,"false"),20)}return!1}function Qa(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function ec(t,e){let n=e.keyCode,r=Qa(e);if(n==8||ie&&n==72&&r=="c")return Ju(t,-1)||ot(t,-1);if(n==46&&!e.shiftKey||ie&&n==68&&r=="c")return Ju(t,1)||ot(t,1);if(n==13||n==27)return!0;if(n==37||ie&&n==66&&r=="c"){let u=n==37?Wu(t,t.state.selection.from)=="ltr"?-1:1:-1;return $u(t,u,r)||ot(t,u)}else if(n==39||ie&&n==70&&r=="c"){let u=n==39?Wu(t,t.state.selection.from)=="ltr"?1:-1:1;return $u(t,u,r)||ot(t,u)}else{if(n==38||ie&&n==80&&r=="c")return Hu(t,-1,r)||ot(t,-1);if(n==40||ie&&n==78&&r=="c")return Xa(t)||Hu(t,1,r)||ot(t,1);if(r==(ie?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function jr(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:u,openEnd:i}=e;for(;u>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){u--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=t.someProp("clipboardSerializer")||yt.fromSchema(t.state.schema),o=Hs(),l=o.createElement("div");l.appendChild(s.serializeFragment(r,{document:o}));let a=l.firstChild,c,f=0;for(;a&&a.nodeType==1&&(c=Ws[a.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let d=o.createElement(c[h]);for(;l.firstChild;)d.appendChild(l.firstChild);l.appendChild(d),f++}a=l.firstChild}a&&a.nodeType==1&&a.setAttribute("data-pm-slice",`${u} ${i}${f?` -${f}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
|
|
8
8
|
|
|
9
9
|
`);return{dom:l,text:p,slice:e}}function Ls(t,e,n,r,u){let i=u.parent.type.spec.code,s,o;if(!n&&!e)return null;let l=!!e&&(r||i||!n);if(l){if(t.someProp("transformPastedText",p=>{e=p(e,i||r,t)}),i)return o=new D(x.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
10
|
-
`))),0,0),t.someProp("transformPasted",p=>{o=p(o,t,!0)}),o;let f=t.someProp("clipboardTextParser",p=>p(e,u,r,t));if(f)o=f;else{let p=u.marks(),{schema:h}=t.state,d=yt.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(d.serializeNode(h.text(m,p)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=uc(n),Ut&&ic(s);let a=s&&s.querySelector("[data-pm-slice]"),c=a&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(a.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let f=+c[3];f>0;f--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(o||(o=(t.someProp("clipboardParser")||t.someProp("domParser")||Rt.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||c),context:u,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!tc.test(p.parentNode.nodeName)?{ignore:!0}:null}})),c)o=sc(Uu(o,+c[1],+c[2]),c[4]);else if(o=D.maxOpen(nc(o.content,u),!0),o.openStart||o.openEnd){let f=0,p=0;for(let h=o.content.firstChild;f<o.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=o.content.lastChild;p<o.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);o=Uu(o,f,p)}return t.someProp("transformPasted",f=>{o=f(o,t,l)}),o}const tc=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function nc(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let u=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(o=>{if(!s)return;let l=u.findWrapping(o.type),a;if(!l)return s=null;if(a=s.length&&i.length&&Vs(l,i,o,s[s.length-1],0))s[s.length-1]=a;else{s.length&&(s[s.length-1]=$s(s[s.length-1],i.length));let c=qs(o,l);s.push(c),u=u.matchType(c.type),i=l}}),s)return x.from(s)}return t}function qs(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,x.from(t));return t}function Vs(t,e,n,r,u){if(u<t.length&&u<e.length&&t[u]==e[u]){let i=Vs(t,e,n,r.lastChild,u+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(u==t.length-1?n.type:t[u+1]))return r.copy(r.content.append(x.from(qs(n,t,u+1))))}}function $s(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,$s(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(x.empty,!0);return t.copy(n.append(r))}function Ar(t,e,n,r,u,i){let s=e<0?t.firstChild:t.lastChild,o=s.content;return t.childCount>1&&(i=0),u<r-1&&(o=Ar(o,e,n,r,u+1,i)),u>=n&&(o=e<0?s.contentMatchAt(0).fillBefore(o,i<=u).append(o):o.append(s.contentMatchAt(s.childCount).fillBefore(x.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(o))}function Uu(t,e,n){return e<t.openStart&&(t=new D(Ar(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new D(Ar(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Ws={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Ku=null;function Hs(){return Ku||(Ku=document.implementation.createHTMLDocument("title"))}let Kn=null;function rc(t){let e=window.trustedTypes;return e?(Kn||(Kn=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Kn.createHTML(t)):t}function uc(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Hs().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),u;if((u=r&&Ws[r[1].toLowerCase()])&&(t=u.map(i=>"<"+i+">").join("")+t+u.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=rc(t),u)for(let i=0;i<u.length;i++)n=n.querySelector(u[i])||n;return n}function ic(t){let e=t.querySelectorAll(L?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function sc(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:u,openStart:i,openEnd:s}=t;for(let o=r.length-2;o>=0;o-=2){let l=n.nodes[r[o]];if(!l||l.hasRequiredAttrs())break;u=x.from(l.create(r[o+1],u)),i++,s++}return new D(u,i,s)}const K={},G={},oc={touchstart:!0,touchmove:!0};class lc{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function ac(t){for(let e in K){let n=K[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{fc(t,r)&&!Ur(t,r)&&(t.editable||!(r.type in G))&&n(t,r)},oc[e]?{passive:!0}:void 0)}H&&t.dom.addEventListener("input",()=>null),Mr(t)}function ve(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function cc(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Mr(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Ur(t,r))})}function Ur(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function fc(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function dc(t,e){!Ur(t,e)&&K[e.type]&&(t.editable||!(e.type in G))&&K[e.type](t,e)}G.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!js(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ae&&L&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),bt&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",u=>u(t,je(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||ec(t,n)?n.preventDefault():ve(t,"key")};G.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};G.keypress=(t,e)=>{let n=e;if(js(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||ie&&n.metaKey)return;if(t.someProp("handleKeyPress",u=>u(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof F)||!r.$from.sameParent(r.$to)){let u=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(u).scrollIntoView();!/[\r\n]/.test(u)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,u,i))&&t.dispatch(i()),n.preventDefault()}};function wn(t){return{left:t.clientX,top:t.clientY}}function hc(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Kr(t,e,n,r,u){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,o=>s>i.depth?o(t,n,i.nodeAfter,i.before(s),u,!0):o(t,n,i.node(s),i.before(s),u,!1)))return!0;return!1}function dt(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function pc(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&A.isSelectable(r)?(dt(t,new A(n)),!0):!1}function mc(t,e){if(e==-1)return!1;let n=t.state.selection,r,u;n instanceof A&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s);if(A.isSelectable(o)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?u=i.before(n.$from.depth):u=i.before(s);break}}return u!=null?(dt(t,A.create(t.state.doc,u)),!0):!1}function gc(t,e,n,r,u){return Kr(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(u?mc(t,n):pc(t,n))}function bc(t,e,n,r){return Kr(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",u=>u(t,e,r))}function xc(t,e,n,r){return Kr(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",u=>u(t,e,r))||kc(t,n,r)}function kc(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(dt(t,F.create(r,0,r.content.size)),!0):!1;let u=r.resolve(e);for(let i=u.depth+1;i>0;i--){let s=i>u.depth?u.nodeAfter:u.node(i),o=u.before(i);if(s.inlineContent)dt(t,F.create(r,o+1,o+1+s.content.size));else if(A.isSelectable(s))dt(t,A.create(r,o));else continue;return!0}}function Gr(t){return gn(t)}const Js=ie?"metaKey":"ctrlKey";K.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Gr(t),u=Date.now(),i="singleClick";u-t.input.lastClick.time<500&&hc(n,t.input.lastClick)&&!n[Js]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:u,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(wn(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new yc(t,s,n,!!r)):(i=="doubleClick"?bc:xc)(t,s.pos,s.inside,n)?n.preventDefault():ve(t,"pointer"))};class yc{constructor(e,n,r,u){this.view=e,this.pos=n,this.event=r,this.flushed=u,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Js],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);i=c.parent,s=c.depth?c.before():0}const o=u?null:r.target,l=o?e.docView.nearestDesc(o,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:a}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||a instanceof A&&a.from<=s&&a.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&oe&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),ve(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Me(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(wn(e))),this.updateAllowDefault(e),this.allowDefault||!n?ve(this.view,"pointer"):gc(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||H&&this.mightDrag&&!this.mightDrag.node.isAtom||L&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(dt(this.view,O.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ve(this.view,"pointer")}move(e){this.updateAllowDefault(e),ve(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}K.touchstart=t=>{t.input.lastTouch=Date.now(),Gr(t),ve(t,"pointer")};K.touchmove=t=>{t.input.lastTouch=Date.now(),ve(t,"pointer")};K.contextmenu=t=>Gr(t);function js(t,e){return t.composing?!0:H&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Cc=Ae?5e3:-1;G.compositionstart=G.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof F&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||L&&_s&&Dc(t)))t.markCursor=t.state.storedMarks||n.marks(),gn(t,!0),t.markCursor=null;else if(gn(t,!e.selection.empty),oe&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let u=r.focusNode,i=r.focusOffset;u&&u.nodeType==1&&i!=0;){let s=i<0?u.lastChild:u.childNodes[i-1];if(!s)break;if(s.nodeType==3){let o=t.domSelection();o&&o.collapse(s,s.nodeValue.length);break}else u=s,i=-1}}t.input.composing=!0}Us(t,Cc)};function Dc(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}G.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Us(t,20))};function Us(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>gn(t),e))}function Ks(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Ec());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function _c(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=ma(e.focusNode,e.focusOffset),r=ga(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let u=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!u||!u.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function Ec(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function gn(t,e=!1){if(!(Ae&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Ks(t),e||t.docView&&t.docView.dirty){let n=Hr(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Sc(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),u=document.createRange();u.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(u),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Pt=X&&Le<15||bt&&ya<604;K.copy=G.cut=(t,e)=>{let n=e,r=t.state.selection,u=n.type=="cut";if(r.empty)return;let i=Pt?null:n.clipboardData,s=r.content(),{dom:o,text:l}=jr(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",o.innerHTML),i.setData("text/plain",l)):Sc(t,o),u&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Ac(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Mc(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let u=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Lt(t,r.value,null,u,e):Lt(t,r.textContent,r.innerHTML,u,e)},50)}function Lt(t,e,n,r,u){let i=Ls(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,u,i||D.empty)))return!0;if(!i)return!1;let s=Ac(i),o=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(o.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Gs(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}G.paste=(t,e)=>{let n=e;if(t.composing&&!Ae)return;let r=Pt?null:n.clipboardData,u=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Lt(t,Gs(r),r.getData("text/html"),u,n)?n.preventDefault():Mc(t,n)};class Zs{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const wc=ie?"altKey":"ctrlKey";function Ys(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[wc]}K.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let u=t.state.selection,i=u.empty?null:t.posAtCoords(wn(n)),s;if(!(i&&i.pos>=u.from&&i.pos<=(u instanceof A?u.to-1:u.to))){if(r&&r.mightDrag)s=A.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(s=A.create(t.state.doc,f.posBefore))}}let o=(s||t.state.selection).content(),{dom:l,text:a,slice:c}=jr(t,o);(!n.dataTransfer.files.length||!L||Ds>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Pt?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Pt||n.dataTransfer.setData("text/plain",a),t.dragging=new Zs(c,Ys(t,n),s)};K.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};G.dragover=G.dragenter=(t,e)=>e.preventDefault();G.drop=(t,e)=>{try{Tc(t,e,t.dragging)}finally{t.dragging=null}};function Tc(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(wn(e));if(!r)return;let u=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",h=>{i=h(i,t,!1)}):i=Ls(t,Gs(e.dataTransfer),Pt?null:e.dataTransfer.getData("text/html"),!1,u);let s=!!(n&&Ys(t,e));if(t.someProp("handleDrop",h=>h(t,e,i||D.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let o=i?Sl(t.state.doc,u.pos,i):u.pos;o==null&&(o=u.pos);let l=t.state.tr;if(s){let{node:h}=n;h?h.replace(l):l.deleteSelection()}let a=l.mapping.map(o),c=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=l.doc;if(c?l.replaceRangeWith(a,a,i.content.firstChild):l.replaceRange(a,a,i),l.doc.eq(f))return;let p=l.doc.resolve(a);if(c&&A.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new A(p));else{let h=l.mapping.map(o);l.mapping.maps[l.mapping.maps.length-1].forEach((d,m,g,b)=>h=b),l.setSelection(Jr(t,p,l.doc.resolve(h)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}K.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Me(t)},20))};K.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};K.beforeinput=(t,e)=>{if(L&&Ae&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,je(8,"Backspace")))))return;let{$cursor:u}=t.state.selection;u&&u.pos>0&&t.dispatch(t.state.tr.delete(u.pos-1,u.pos).scrollIntoView())},50)}};for(let t in G)K[t]=G[t];function qt(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class bn{constructor(e,n){this.toDOM=e,this.spec=n||Xe,this.side=this.spec.side||0}map(e,n,r,u){let{pos:i,deleted:s}=e.mapResult(n.from+u,this.side<0?-1:1);return s?null:new fe(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof bn&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&qt(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ve{constructor(e,n){this.attrs=e,this.spec=n||Xe}map(e,n,r,u){let i=e.map(n.from+u,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+u,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new fe(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Ve&&qt(this.attrs,e.attrs)&&qt(this.spec,e.spec)}static is(e){return e.type instanceof Ve}destroy(){}}class Zr{constructor(e,n){this.attrs=e,this.spec=n||Xe}map(e,n,r,u){let i=e.mapResult(n.from+u,1);if(i.deleted)return null;let s=e.mapResult(n.to+u,-1);return s.deleted||s.pos<=i.pos?null:new fe(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:u}=e.content.findIndex(n.from),i;return u==n.from&&!(i=e.child(r)).isText&&u+i.nodeSize==n.to}eq(e){return this==e||e instanceof Zr&&qt(this.attrs,e.attrs)&&qt(this.spec,e.spec)}destroy(){}}class fe{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new fe(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new fe(e,e,new bn(n,r))}static inline(e,n,r,u){return new fe(e,n,new Ve(r,u))}static node(e,n,r,u){return new fe(e,n,new Zr(r,u))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ve}get widget(){return this.type instanceof bn}}const ct=[],Xe={};class v{constructor(e,n){this.local=e.length?e:ct,this.children=n.length?n:ct}static create(e,n){return n.length?xn(n,e,0,Xe):J}find(e,n,r){let u=[];return this.findInner(e??0,n??1e9,u,0,r),u}findInner(e,n,r,u,i){for(let s=0;s<this.local.length;s++){let o=this.local[s];o.from<=n&&o.to>=e&&(!i||i(o.spec))&&r.push(o.copy(o.from+u,o.to+u))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let o=this.children[s]+1;this.children[s+2].findInner(e-o,n-o,r,u+o,i)}}map(e,n,r){return this==J||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Xe)}mapInner(e,n,r,u,i){let s;for(let o=0;o<this.local.length;o++){let l=this.local[o].map(e,r,u);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?Oc(this.children,s||[],e,n,r,u,i):s?new v(s.sort(Qe),ct):J}add(e,n){return n.length?this==J?v.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let u,i=0;e.forEach((o,l)=>{let a=l+r,c;if(c=Qs(n,o,a)){for(u||(u=this.children.slice());i<u.length&&u[i]<l;)i+=3;u[i]==l?u[i+2]=u[i+2].addInner(o,c,a+1):u.splice(i,0,l,l+o.nodeSize,xn(c,o,a+1,Xe)),i+=3}});let s=Xs(i?eo(n):n,-r);for(let o=0;o<s.length;o++)s[o].type.valid(e,s[o])||s.splice(o--,1);return new v(s.length?this.local.concat(s).sort(Qe):this.local,u||this.children)}remove(e){return e.length==0||this==J?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,u=this.local;for(let i=0;i<r.length;i+=3){let s,o=r[i]+n,l=r[i+1]+n;for(let c=0,f;c<e.length;c++)(f=e[c])&&f.from>o&&f.to<l&&(e[c]=null,(s||(s=[])).push(f));if(!s)continue;r==this.children&&(r=this.children.slice());let a=r[i+2].removeInner(s,o+1);a!=J?r[i+2]=a:(r.splice(i,3),i-=3)}if(u.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let o=0;o<u.length;o++)u[o].eq(s,n)&&(u==this.local&&(u=this.local.slice()),u.splice(o--,1))}return r==this.children&&u==this.local?this:u.length||r.length?new v(u,r):J}forChild(e,n){if(this==J)return this;if(n.isLeaf)return v.empty;let r,u;for(let o=0;o<this.children.length;o+=3)if(this.children[o]>=e){this.children[o]==e&&(r=this.children[o+2]);break}let i=e+1,s=i+n.content.size;for(let o=0;o<this.local.length;o++){let l=this.local[o];if(l.from<s&&l.to>i&&l.type instanceof Ve){let a=Math.max(i,l.from)-i,c=Math.min(s,l.to)-i;a<c&&(u||(u=[])).push(l.copy(a,c))}}if(u){let o=new v(u.sort(Qe),ct);return r?new Ie([o,r]):o}return r||J}eq(e){if(this==e)return!0;if(!(e instanceof v)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Yr(this.localsInner(e))}localsInner(e){if(this==J)return ct;if(e.inlineContent||!this.local.some(Ve.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Ve||n.push(this.local[r]);return n}forEachSet(e){e(this)}}v.empty=new v([],[]);v.removeOverlap=Yr;const J=v.empty;class Ie{constructor(e){this.members=e}map(e,n){const r=this.members.map(u=>u.map(e,n,Xe));return Ie.from(r)}forChild(e,n){if(n.isLeaf)return v.empty;let r=[];for(let u=0;u<this.members.length;u++){let i=this.members[u].forChild(e,n);i!=J&&(i instanceof Ie?r=r.concat(i.members):r.push(i))}return Ie.from(r)}eq(e){if(!(e instanceof Ie)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let u=0;u<this.members.length;u++){let i=this.members[u].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?Yr(r?n:n.sort(Qe)):ct}static from(e){switch(e.length){case 0:return J;case 1:return e[0];default:return new Ie(e.every(n=>n instanceof v)?e:e.reduce((n,r)=>n.concat(r instanceof v?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Oc(t,e,n,r,u,i,s){let o=t.slice();for(let a=0,c=i;a<n.maps.length;a++){let f=0;n.maps[a].forEach((p,h,d,m)=>{let g=m-d-(h-p);for(let b=0;b<o.length;b+=3){let k=o[b+1];if(k<0||p>k+c-f)continue;let y=o[b]+c-f;h>=y?o[b+1]=p<=y?-2:-1:p>=c&&g&&(o[b]+=g,o[b+1]+=g)}f+=g}),c=n.maps[a].map(c,-1)}let l=!1;for(let a=0;a<o.length;a+=3)if(o[a+1]<0){if(o[a+1]==-2){l=!0,o[a+1]=-1;continue}let c=n.map(t[a]+i),f=c-u;if(f<0||f>=r.content.size){l=!0;continue}let p=n.map(t[a+1]+i,-1),h=p-u,{index:d,offset:m}=r.content.findIndex(f),g=r.maybeChild(d);if(g&&m==f&&m+g.nodeSize==h){let b=o[a+2].mapInner(n,g,c+1,t[a]+i+1,s);b!=J?(o[a]=f,o[a+1]=h,o[a+2]=b):(o[a+1]=-2,l=!0)}else l=!0}if(l){let a=Fc(o,t,e,n,u,i,s),c=xn(a,r,0,s);e=c.local;for(let f=0;f<o.length;f+=3)o[f+1]<0&&(o.splice(f,3),f-=3);for(let f=0,p=0;f<c.children.length;f+=3){let h=c.children[f];for(;p<o.length&&o[p]<h;)p+=3;o.splice(p,0,c.children[f],c.children[f+1],c.children[f+2])}}return new v(e.sort(Qe),o)}function Xs(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let u=t[r];n.push(new fe(u.from+e,u.to+e,u.type))}return n}function Fc(t,e,n,r,u,i,s){function o(l,a){for(let c=0;c<l.local.length;c++){let f=l.local[c].map(r,u,a);f?n.push(f):s.onRemove&&s.onRemove(l.local[c].spec)}for(let c=0;c<l.children.length;c+=3)o(l.children[c+2],l.children[c]+a+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&o(t[l+2],e[l]+i+1);return n}function Qs(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,u=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((u||(u=[])).push(s),t[i]=null);return u}function eo(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function xn(t,e,n,r){let u=[],i=!1;e.forEach((o,l)=>{let a=Qs(t,o,l+n);if(a){i=!0;let c=xn(a,o,n+l+1,r);c!=J&&u.push(l,l+o.nodeSize,c)}});let s=Xs(i?eo(t):t,-n).sort(Qe);for(let o=0;o<s.length;o++)s[o].type.valid(e,s[o])||(r.onRemove&&r.onRemove(s[o].spec),s.splice(o--,1));return s.length||u.length?new v(s,u):J}function Qe(t,e){return t.from-e.from||t.to-e.to}function Yr(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let u=n+1;u<e.length;u++){let i=e[u];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[u]=i.copy(i.from,r.to),Gu(e,u+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Gu(e,u,r.copy(i.from,r.to)));break}}}return e}function Gu(t,e,n){for(;e<t.length&&Qe(n,t[e])>0;)e++;t.splice(e,0,n)}function Gn(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=J&&e.push(r)}),t.cursorWrapper&&e.push(v.create(t.state.doc,[t.cursorWrapper.deco])),Ie.from(e)}const Nc={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ic=X&&Le<=11;class Rc{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Bc{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Rc,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let u=0;u<r.length;u++)this.queue.push(r[u]);X&&Le<=11&&r.some(u=>u.type=="childList"&&u.removedNodes.length||u.type=="characterData"&&u.oldValue.length>u.target.nodeValue.length)?this.flushSoon():H&&e.composing&&r.some(u=>u.type=="childList"&&u.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Ic&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Nc)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Vu(this.view)){if(this.suppressingSelectionUpdates)return Me(this.view);if(X&&Le<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&rt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=gt(i))n.add(i);for(let i=e.anchorNode;i;i=gt(i))if(n.has(i)){r=i;break}let u=r&&this.view.docView.nearestDesc(r);if(u&&u.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),u=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Vu(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,o=!1,l=[];if(e.editable)for(let c=0;c<n.length;c++){let f=this.registerMutation(n[c],l);f&&(i=i<0?f.from:Math.min(f.from,i),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(o=!0))}if(oe&&l.length){let c=l.filter(f=>f.nodeName=="BR");if(c.length==2){let[f,p]=c;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of c){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||Pc(e,f)!=h)&&p.remove()}}}else if((L||H)&&l.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of l)if(c.nodeName=="BR"&&c.parentNode){let f=c.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&c.parentNode.removeChild(c)}}let a=null;i<0&&u&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&An(r)&&(a=Hr(e))&&a.eq(O.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Me(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||u)&&(i>-1&&(e.docView.markDirty(i,s),zc(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Lc(e,l)),this.handleDOMChange(i,s,o,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Me(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let f=e.addedNodes[c];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let u=e.previousSibling,i=e.nextSibling;if(X&&Le<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:f,nextSibling:p}=e.addedNodes[c];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(u=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}let s=u&&u.parentNode==e.target?$(u)+1:0,o=r.localPosFromDOM(e.target,s,-1),l=i&&i.parentNode==e.target?$(i):e.target.childNodes.length,a=r.localPosFromDOM(e.target,l,1);return{from:o,to:a}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Zu=new WeakMap,Yu=!1;function zc(t){if(!Zu.has(t)&&(Zu.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=oe,Yu)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Yu=!0}}function Xu(t,e){let n=e.startContainer,r=e.startOffset,u=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return rt(s.node,s.offset,u,i)&&([n,r,u,i]=[u,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:u,focusOffset:i}}function vc(t,e){if(e.getComposedRanges){let u=e.getComposedRanges(t.root)[0];if(u)return Xu(t,u)}let n;function r(u){u.preventDefault(),u.stopImmediatePropagation(),n=u.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Xu(t,n):null}function Pc(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Lc(t,e){var n;let{focusNode:r,focusOffset:u}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let o=s;for(;;){let l=o.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;o=l}o.insertBefore(i,o.firstChild),r==i&&t.domSelection().collapse(i,u)}else i.parentNode.removeChild(i)}}function qc(t,e,n){let{node:r,fromOffset:u,toOffset:i,from:s,to:o}=t.docView.parseRange(e,n),l=t.domSelectionRange(),a,c=l.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(a=[{node:c,offset:l.anchorOffset}],An(l)||a.push({node:l.focusNode,offset:l.focusOffset})),L&&t.input.lastKeyCode===8)for(let g=i;g>u;g--){let b=r.childNodes[g-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){i=g;break}if(!k||k.size)break}let f=t.state.doc,p=t.someProp("domParser")||Rt.fromSchema(t.state.schema),h=f.resolve(s),d=null,m=p.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:u,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:a,ruleFromNode:Vc,context:h});if(a&&a[0].pos!=null){let g=a[0].pos,b=a[1]&&a[1].pos;b==null&&(b=g),d={anchor:g+s,head:b+s}}return{doc:m,sel:d,from:s,to:o}}function Vc(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(H&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||H&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const $c=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Wc(t,e,n,r,u){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,w=Hr(t,C);if(w&&!t.state.selection.eq(w)){if(L&&Ae&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",ee=>ee(t,je(13,"Enter"))))return;let I=t.state.tr.setSelection(w);C=="pointer"?I.setMeta("pointer",!0):C=="key"&&I.scrollIntoView(),i&&I.setMeta("composition",i),t.dispatch(I)}return}let s=t.state.doc.resolve(e),o=s.sharedDepth(n);e=s.before(o+1),n=t.state.doc.resolve(n).after(o+1);let l=t.state.selection,a=qc(t,e,n),c=t.state.doc,f=c.slice(a.from,a.to),p,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,h="end"):(p=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let d=jc(f.content,a.doc.content,a.from,p,h);if(d&&t.input.domChangeCount++,(bt&&t.input.lastIOSEnter>Date.now()-225||Ae)&&u.some(C=>C.nodeType==1&&!$c.test(C.nodeName))&&(!d||d.endA>=d.endB)&&t.someProp("handleKeyDown",C=>C(t,je(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!d)if(r&&l instanceof F&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(a.sel&&a.sel.anchor!=a.sel.head))d={start:l.from,endA:l.to,endB:l.to};else{if(a.sel){let C=Qu(t,t.state.doc,a.sel);if(C&&!C.eq(t.state.selection)){let w=t.state.tr.setSelection(C);i&&w.setMeta("composition",i),t.dispatch(w)}}return}t.state.selection.from<t.state.selection.to&&d.start==d.endB&&t.state.selection instanceof F&&(d.start>t.state.selection.from&&d.start<=t.state.selection.from+2&&t.state.selection.from>=a.from?d.start=t.state.selection.from:d.endA<t.state.selection.to&&d.endA>=t.state.selection.to-2&&t.state.selection.to<=a.to&&(d.endB+=t.state.selection.to-d.endA,d.endA=t.state.selection.to)),X&&Le<=11&&d.endB==d.start+1&&d.endA==d.start&&d.start>a.from&&a.doc.textBetween(d.start-a.from-1,d.start-a.from+1)==" "&&(d.start--,d.endA--,d.endB--);let m=a.doc.resolveNoCache(d.start-a.from),g=a.doc.resolveNoCache(d.endB-a.from),b=c.resolve(d.start),k=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=d.endA;if((bt&&t.input.lastIOSEnter>Date.now()-225&&(!k||u.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!k&&m.pos<a.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(a.doc.textBetween(m.pos,g.pos,"","")))&&t.someProp("handleKeyDown",C=>C(t,je(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>d.start&&Jc(c,d.start,d.endA,m,g)&&t.someProp("handleKeyDown",C=>C(t,je(8,"Backspace")))){Ae&&L&&t.domObserver.suppressSelectionUpdates();return}L&&d.endB==d.start&&(t.input.lastChromeDelete=Date.now()),Ae&&!k&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&a.sel&&a.sel.anchor==a.sel.head&&a.sel.head==d.endA&&(d.endB-=2,g=a.doc.resolveNoCache(d.endB-a.from),setTimeout(()=>{t.someProp("handleKeyDown",function(C){return C(t,je(13,"Enter"))})},20));let y=d.start,_=d.endA,E=C=>{let w=C||t.state.tr.replace(y,_,a.doc.slice(d.start-a.from,d.endB-a.from));if(a.sel){let I=Qu(t,w.doc,a.sel);I&&!(L&&t.composing&&I.empty&&(d.start!=d.endB||t.input.lastChromeDelete<Date.now()-100)&&(I.head==y||I.head==w.mapping.map(_)-1)||X&&I.empty&&I.head==y)&&w.setSelection(I)}return i&&w.setMeta("composition",i),w.scrollIntoView()},M;if(k)if(m.pos==g.pos){X&&Le<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Me(t),20));let C=E(t.state.tr.delete(y,_)),w=c.resolve(d.start).marksAcross(c.resolve(d.endA));w&&C.ensureMarks(w),t.dispatch(C)}else if(d.endA==d.endB&&(M=Hc(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,d.endA-b.start())))){let C=E(t.state.tr);M.type=="add"?C.addMark(y,_,M.mark):C.removeMark(y,_,M.mark),t.dispatch(C)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let C=m.parent.textBetween(m.parentOffset,g.parentOffset),w=()=>E(t.state.tr.insertText(C,y,_));t.someProp("handleTextInput",I=>I(t,y,_,C,w))||t.dispatch(w())}else t.dispatch(E());else t.dispatch(E())}function Qu(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Jr(t,e.resolve(n.anchor),e.resolve(n.head))}function Hc(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,u=n,i=r,s,o,l;for(let c=0;c<r.length;c++)u=r[c].removeFromSet(u);for(let c=0;c<n.length;c++)i=n[c].removeFromSet(i);if(u.length==1&&i.length==0)o=u[0],s="add",l=c=>c.mark(o.addToSet(c.marks));else if(u.length==0&&i.length==1)o=i[0],s="remove",l=c=>c.mark(o.removeFromSet(c.marks));else return null;let a=[];for(let c=0;c<e.childCount;c++)a.push(l(e.child(c)));if(x.from(a).eq(t))return{mark:o,type:s}}function Jc(t,e,n,r,u){if(n-e<=u.pos-r.pos||Zn(r,!0,!1)<u.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let o=i.nodeAfter;return o!=null&&n==e+o.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Zn(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Zn(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Zn(t,e,n){let r=t.depth,u=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,u++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,u++}return u}function jc(t,e,n,r,u){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:o}=t.findDiffEnd(e,n+t.size,n+e.size);if(u=="end"){let l=Math.max(0,i-Math.min(s,o));r-=s+l-i}if(s<i&&t.size<e.size){let l=r<=i&&r>=s?i-r:0;i-=l,i&&i<e.size&&ei(e.textBetween(i-1,i+1))&&(i+=l?1:-1),o=i+(o-s),s=i}else if(o<i){let l=r<=i&&r>=o?i-r:0;i-=l,i&&i<t.size&&ei(t.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-o),o=i}return{start:i,endA:s,endB:o}}function ei(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class to{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new lc,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ii),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=ri(this),ni(this),this.nodeViews=ui(this),this.docView=Bu(this.state.doc,ti(this),Gn(this),this.dom,this),this.domObserver=new Bc(this,(r,u,i,s)=>Wc(this,r,u,i,s)),this.domObserver.start(),ac(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Mr(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ii),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let u=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Ks(this),s=!0),this.state=e;let o=u.plugins!=e.plugins||this._props.plugins!=n.plugins;if(o||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=ui(this);Kc(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(o||n.handleDOMEvents!=this._props.handleDOMEvents)&&Mr(this),this.editable=ri(this),ni(this);let l=Gn(this),a=ti(this),c=u.plugins!=e.plugins&&!u.doc.eq(e.doc)?"reset":e.scrollToSelection>u.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,a,l);(f||!e.selection.eq(u.selection))&&(s=!0);let p=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&_a(this);if(s){this.domObserver.stop();let h=f&&(X||L)&&!this.composing&&!u.selection.empty&&!e.selection.empty&&Uc(u.selection,e.selection);if(f){let d=L?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=_c(this)),(i||!this.docView.update(e.doc,a,l,this))&&(this.docView.updateOuterDeco(a),this.docView.destroy(),this.docView=Bu(e.doc,a,l,this.dom,this)),d&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ua(this))?Me(this,h):(zs(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(u),!((r=this.dragging)===null||r===void 0)&&r.node&&!u.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,u),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():p&&Ea(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof A){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Tu(this,n.getBoundingClientRect(),e)}else Tu(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,u=-1;if(this.state.doc.nodeAt(r.from)==r.node)u=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(u=i)}this.dragging=new Zs(e.slice,e.move,u<0?void 0:A.create(this.state.doc,u))}someProp(e,n){let r=this._props&&this._props[e],u;if(r!=null&&(u=n?n(r):r))return u;for(let s=0;s<this.directPlugins.length;s++){let o=this.directPlugins[s].props[e];if(o!=null&&(u=n?n(o):o))return u}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let o=i[s].props[e];if(o!=null&&(u=n?n(o):o))return u}}hasFocus(){if(X){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Sa(this.dom),Me(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Oa(this,e)}coordsAtPos(e,n=1){return ws(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let u=this.docView.posFromDOM(e,n,r);if(u==null)throw new RangeError("DOM position not inside the editor");return u}endOfTextblock(e,n){return Ba(this,n||this.state,e)}pasteHTML(e,n){return Lt(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Lt(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return jr(this,e)}destroy(){this.docView&&(cc(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Gn(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ha())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return dc(this,e)}domSelectionRange(){let e=this.domSelection();return e?H&&this.root.nodeType===11&&xa(this.dom.ownerDocument)==this.dom&&vc(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}to.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function ti(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[fe.node(0,t.state.doc.content.size,e)]}function ni(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:fe.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function ri(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Uc(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function ui(t){let e=Object.create(null);function n(r){for(let u in r)Object.prototype.hasOwnProperty.call(e,u)||(e[u]=r[u])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Kc(t,e){let n=0,r=0;for(let u in t){if(t[u]!=e[u])return!0;n++}for(let u in e)r++;return n!=r}function ii(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const Gc=["p",0],Zc=["blockquote",0],Yc=["hr"],Xc=["pre",["code",0]],Qc=["br"],ef={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return Gc}},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM(){return Zc}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return Yc}},heading:{attrs:{level:{default:1,validate:"number"}},content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(t){return["h"+t.attrs.level,0]}},code_block:{content:"text*",marks:"",group:"block",code:!0,defining:!0,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM(){return Xc}},text:{group:"inline"},image:{inline:!0,attrs:{src:{validate:"string"},alt:{default:null,validate:"string|null"},title:{default:null,validate:"string|null"}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs(t){return{src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")}}}],toDOM(t){let{src:e,alt:n,title:r}=t.attrs;return["img",{src:e,alt:n,title:r}]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return Qc}}},tf=["em",0],nf=["strong",0],rf=["code",0],uf={link:{attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(t){return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM(t){let{href:e,title:n}=t.attrs;return["a",{href:e,title:n},0]}},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:t=>t.type.name=="em"}],toDOM(){return tf}},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM(){return nf}},code:{code:!0,parseDOM:[{tag:"code"}],toDOM(){return rf}}},sf=new Rr({nodes:ef,marks:uf}),si={};function of(t){let e=si[t];if(e)return e;e=si[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);e.push(r)}for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);e[r]="%"+("0"+r.toString(16).toUpperCase()).slice(-2)}return e}function xt(t,e){typeof e!="string"&&(e=xt.defaultChars);const n=of(e);return t.replace(/(%[a-f0-9]{2})+/gi,function(r){let u="";for(let i=0,s=r.length;i<s;i+=3){const o=parseInt(r.slice(i+1,i+3),16);if(o<128){u+=n[o];continue}if((o&224)===192&&i+3<s){const l=parseInt(r.slice(i+4,i+6),16);if((l&192)===128){const a=o<<6&1984|l&63;a<128?u+="��":u+=String.fromCharCode(a),i+=3;continue}}if((o&240)===224&&i+6<s){const l=parseInt(r.slice(i+4,i+6),16),a=parseInt(r.slice(i+7,i+9),16);if((l&192)===128&&(a&192)===128){const c=o<<12&61440|l<<6&4032|a&63;c<2048||c>=55296&&c<=57343?u+="���":u+=String.fromCharCode(c),i+=6;continue}}if((o&248)===240&&i+9<s){const l=parseInt(r.slice(i+4,i+6),16),a=parseInt(r.slice(i+7,i+9),16),c=parseInt(r.slice(i+10,i+12),16);if((l&192)===128&&(a&192)===128&&(c&192)===128){let f=o<<18&1835008|l<<12&258048|a<<6&4032|c&63;f<65536||f>1114111?u+="����":(f-=65536,u+=String.fromCharCode(55296+(f>>10),56320+(f&1023))),i+=9;continue}}u+="�"}return u})}xt.defaultChars=";/?:@&=+$,#";xt.componentChars="";const oi={};function lf(t){let e=oi[t];if(e)return e;e=oi[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);/^[0-9a-z]$/i.test(r)?e.push(r):e.push("%"+("0"+n.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<t.length;n++)e[t.charCodeAt(n)]=t[n];return e}function Gt(t,e,n){typeof e!="string"&&(n=e,e=Gt.defaultChars),typeof n>"u"&&(n=!0);const r=lf(e);let u="";for(let i=0,s=t.length;i<s;i++){const o=t.charCodeAt(i);if(n&&o===37&&i+2<s&&/^[0-9a-f]{2}$/i.test(t.slice(i+1,i+3))){u+=t.slice(i,i+3),i+=2;continue}if(o<128){u+=r[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&i+1<s){const l=t.charCodeAt(i+1);if(l>=56320&&l<=57343){u+=encodeURIComponent(t[i]+t[i+1]),i++;continue}}u+="%EF%BF%BD";continue}u+=encodeURIComponent(t[i])}return u}Gt.defaultChars=";/?:@&=+$,-_.!~*'()#";Gt.componentChars="-_.!~*'()";function Xr(t){let e="";return e+=t.protocol||"",e+=t.slashes?"//":"",e+=t.auth?t.auth+"@":"",t.hostname&&t.hostname.indexOf(":")!==-1?e+="["+t.hostname+"]":e+=t.hostname||"",e+=t.port?":"+t.port:"",e+=t.pathname||"",e+=t.search||"",e+=t.hash||"",e}function kn(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const af=/^([a-z0-9.+-]+:)/i,cf=/:[0-9]*$/,ff=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,df=["<",">",'"',"`"," ","\r",`
|
|
10
|
+
`))),0,0),t.someProp("transformPasted",p=>{o=p(o,t,!0)}),o;let f=t.someProp("clipboardTextParser",p=>p(e,u,r,t));if(f)o=f;else{let p=u.marks(),{schema:h}=t.state,d=yt.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(d.serializeNode(h.text(m,p)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=uc(n),Ut&&ic(s);let a=s&&s.querySelector("[data-pm-slice]"),c=a&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(a.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let f=+c[3];f>0;f--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(o||(o=(t.someProp("clipboardParser")||t.someProp("domParser")||Rt.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||c),context:u,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!tc.test(p.parentNode.nodeName)?{ignore:!0}:null}})),c)o=sc(Uu(o,+c[1],+c[2]),c[4]);else if(o=D.maxOpen(nc(o.content,u),!0),o.openStart||o.openEnd){let f=0,p=0;for(let h=o.content.firstChild;f<o.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=o.content.lastChild;p<o.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);o=Uu(o,f,p)}return t.someProp("transformPasted",f=>{o=f(o,t,l)}),o}const tc=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function nc(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let u=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(o=>{if(!s)return;let l=u.findWrapping(o.type),a;if(!l)return s=null;if(a=s.length&&i.length&&Vs(l,i,o,s[s.length-1],0))s[s.length-1]=a;else{s.length&&(s[s.length-1]=$s(s[s.length-1],i.length));let c=qs(o,l);s.push(c),u=u.matchType(c.type),i=l}}),s)return x.from(s)}return t}function qs(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,x.from(t));return t}function Vs(t,e,n,r,u){if(u<t.length&&u<e.length&&t[u]==e[u]){let i=Vs(t,e,n,r.lastChild,u+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(u==t.length-1?n.type:t[u+1]))return r.copy(r.content.append(x.from(qs(n,t,u+1))))}}function $s(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,$s(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(x.empty,!0);return t.copy(n.append(r))}function Ar(t,e,n,r,u,i){let s=e<0?t.firstChild:t.lastChild,o=s.content;return t.childCount>1&&(i=0),u<r-1&&(o=Ar(o,e,n,r,u+1,i)),u>=n&&(o=e<0?s.contentMatchAt(0).fillBefore(o,i<=u).append(o):o.append(s.contentMatchAt(s.childCount).fillBefore(x.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(o))}function Uu(t,e,n){return e<t.openStart&&(t=new D(Ar(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new D(Ar(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Ws={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Ku=null;function Hs(){return Ku||(Ku=document.implementation.createHTMLDocument("title"))}let Kn=null;function rc(t){let e=window.trustedTypes;return e?(Kn||(Kn=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Kn.createHTML(t)):t}function uc(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Hs().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),u;if((u=r&&Ws[r[1].toLowerCase()])&&(t=u.map(i=>"<"+i+">").join("")+t+u.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=rc(t),u)for(let i=0;i<u.length;i++)n=n.querySelector(u[i])||n;return n}function ic(t){let e=t.querySelectorAll(W?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function sc(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:u,openStart:i,openEnd:s}=t;for(let o=r.length-2;o>=0;o-=2){let l=n.nodes[r[o]];if(!l||l.hasRequiredAttrs())break;u=x.from(l.create(r[o+1],u)),i++,s++}return new D(u,i,s)}const K={},G={},oc={touchstart:!0,touchmove:!0};class lc{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function ac(t){for(let e in K){let n=K[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{fc(t,r)&&!Ur(t,r)&&(t.editable||!(r.type in G))&&n(t,r)},oc[e]?{passive:!0}:void 0)}j&&t.dom.addEventListener("input",()=>null),Mr(t)}function ve(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function cc(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Mr(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Ur(t,r))})}function Ur(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function fc(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function dc(t,e){!Ur(t,e)&&K[e.type]&&(t.editable||!(e.type in G))&&K[e.type](t,e)}G.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!js(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ae&&W&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),bt&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",u=>u(t,je(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||ec(t,n)?n.preventDefault():ve(t,"key")};G.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};G.keypress=(t,e)=>{let n=e;if(js(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||ie&&n.metaKey)return;if(t.someProp("handleKeyPress",u=>u(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof F)||!r.$from.sameParent(r.$to)){let u=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(u).scrollIntoView();!/[\r\n]/.test(u)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,u,i))&&t.dispatch(i()),n.preventDefault()}};function wn(t){return{left:t.clientX,top:t.clientY}}function hc(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Kr(t,e,n,r,u){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,o=>s>i.depth?o(t,n,i.nodeAfter,i.before(s),u,!0):o(t,n,i.node(s),i.before(s),u,!1)))return!0;return!1}function dt(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function pc(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&A.isSelectable(r)?(dt(t,new A(n)),!0):!1}function mc(t,e){if(e==-1)return!1;let n=t.state.selection,r,u;n instanceof A&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s);if(A.isSelectable(o)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?u=i.before(n.$from.depth):u=i.before(s);break}}return u!=null?(dt(t,A.create(t.state.doc,u)),!0):!1}function gc(t,e,n,r,u){return Kr(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(u?mc(t,n):pc(t,n))}function bc(t,e,n,r){return Kr(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",u=>u(t,e,r))}function xc(t,e,n,r){return Kr(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",u=>u(t,e,r))||kc(t,n,r)}function kc(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(dt(t,F.create(r,0,r.content.size)),!0):!1;let u=r.resolve(e);for(let i=u.depth+1;i>0;i--){let s=i>u.depth?u.nodeAfter:u.node(i),o=u.before(i);if(s.inlineContent)dt(t,F.create(r,o+1,o+1+s.content.size));else if(A.isSelectable(s))dt(t,A.create(r,o));else continue;return!0}}function Gr(t){return gn(t)}const Js=ie?"metaKey":"ctrlKey";K.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Gr(t),u=Date.now(),i="singleClick";u-t.input.lastClick.time<500&&hc(n,t.input.lastClick)&&!n[Js]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:u,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(wn(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new yc(t,s,n,!!r)):(i=="doubleClick"?bc:xc)(t,s.pos,s.inside,n)?n.preventDefault():ve(t,"pointer"))};class yc{constructor(e,n,r,u){this.view=e,this.pos=n,this.event=r,this.flushed=u,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Js],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);i=c.parent,s=c.depth?c.before():0}const o=u?null:r.target,l=o?e.docView.nearestDesc(o,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:a}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||a instanceof A&&a.from<=s&&a.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&oe&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),ve(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Me(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(wn(e))),this.updateAllowDefault(e),this.allowDefault||!n?ve(this.view,"pointer"):gc(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||j&&this.mightDrag&&!this.mightDrag.node.isAtom||W&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(dt(this.view,O.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ve(this.view,"pointer")}move(e){this.updateAllowDefault(e),ve(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}K.touchstart=t=>{t.input.lastTouch=Date.now(),Gr(t),ve(t,"pointer")};K.touchmove=t=>{t.input.lastTouch=Date.now(),ve(t,"pointer")};K.contextmenu=t=>Gr(t);function js(t,e){return t.composing?!0:j&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Cc=Ae?5e3:-1;G.compositionstart=G.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof F&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||W&&_s&&Dc(t)))t.markCursor=t.state.storedMarks||n.marks(),gn(t,!0),t.markCursor=null;else if(gn(t,!e.selection.empty),oe&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let u=r.focusNode,i=r.focusOffset;u&&u.nodeType==1&&i!=0;){let s=i<0?u.lastChild:u.childNodes[i-1];if(!s)break;if(s.nodeType==3){let o=t.domSelection();o&&o.collapse(s,s.nodeValue.length);break}else u=s,i=-1}}t.input.composing=!0}Us(t,Cc)};function Dc(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}G.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Us(t,20))};function Us(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>gn(t),e))}function Ks(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Ec());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function _c(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=ma(e.focusNode,e.focusOffset),r=ga(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let u=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!u||!u.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function Ec(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function gn(t,e=!1){if(!(Ae&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Ks(t),e||t.docView&&t.docView.dirty){let n=Hr(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Sc(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),u=document.createRange();u.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(u),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Pt=X&&Le<15||bt&&ya<604;K.copy=G.cut=(t,e)=>{let n=e,r=t.state.selection,u=n.type=="cut";if(r.empty)return;let i=Pt?null:n.clipboardData,s=r.content(),{dom:o,text:l}=jr(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",o.innerHTML),i.setData("text/plain",l)):Sc(t,o),u&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Ac(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Mc(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let u=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Lt(t,r.value,null,u,e):Lt(t,r.textContent,r.innerHTML,u,e)},50)}function Lt(t,e,n,r,u){let i=Ls(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,u,i||D.empty)))return!0;if(!i)return!1;let s=Ac(i),o=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(o.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Gs(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}G.paste=(t,e)=>{let n=e;if(t.composing&&!Ae)return;let r=Pt?null:n.clipboardData,u=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Lt(t,Gs(r),r.getData("text/html"),u,n)?n.preventDefault():Mc(t,n)};class Zs{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const wc=ie?"altKey":"ctrlKey";function Ys(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[wc]}K.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let u=t.state.selection,i=u.empty?null:t.posAtCoords(wn(n)),s;if(!(i&&i.pos>=u.from&&i.pos<=(u instanceof A?u.to-1:u.to))){if(r&&r.mightDrag)s=A.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(s=A.create(t.state.doc,f.posBefore))}}let o=(s||t.state.selection).content(),{dom:l,text:a,slice:c}=jr(t,o);(!n.dataTransfer.files.length||!W||Ds>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Pt?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Pt||n.dataTransfer.setData("text/plain",a),t.dragging=new Zs(c,Ys(t,n),s)};K.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};G.dragover=G.dragenter=(t,e)=>e.preventDefault();G.drop=(t,e)=>{try{Tc(t,e,t.dragging)}finally{t.dragging=null}};function Tc(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(wn(e));if(!r)return;let u=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",h=>{i=h(i,t,!1)}):i=Ls(t,Gs(e.dataTransfer),Pt?null:e.dataTransfer.getData("text/html"),!1,u);let s=!!(n&&Ys(t,e));if(t.someProp("handleDrop",h=>h(t,e,i||D.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let o=i?Sl(t.state.doc,u.pos,i):u.pos;o==null&&(o=u.pos);let l=t.state.tr;if(s){let{node:h}=n;h?h.replace(l):l.deleteSelection()}let a=l.mapping.map(o),c=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=l.doc;if(c?l.replaceRangeWith(a,a,i.content.firstChild):l.replaceRange(a,a,i),l.doc.eq(f))return;let p=l.doc.resolve(a);if(c&&A.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new A(p));else{let h=l.mapping.map(o);l.mapping.maps[l.mapping.maps.length-1].forEach((d,m,g,b)=>h=b),l.setSelection(Jr(t,p,l.doc.resolve(h)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}K.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Me(t)},20))};K.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};K.beforeinput=(t,e)=>{if(W&&Ae&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,je(8,"Backspace")))))return;let{$cursor:u}=t.state.selection;u&&u.pos>0&&t.dispatch(t.state.tr.delete(u.pos-1,u.pos).scrollIntoView())},50)}};for(let t in G)K[t]=G[t];function qt(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class bn{constructor(e,n){this.toDOM=e,this.spec=n||Xe,this.side=this.spec.side||0}map(e,n,r,u){let{pos:i,deleted:s}=e.mapResult(n.from+u,this.side<0?-1:1);return s?null:new fe(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof bn&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&qt(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ve{constructor(e,n){this.attrs=e,this.spec=n||Xe}map(e,n,r,u){let i=e.map(n.from+u,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+u,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new fe(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Ve&&qt(this.attrs,e.attrs)&&qt(this.spec,e.spec)}static is(e){return e.type instanceof Ve}destroy(){}}class Zr{constructor(e,n){this.attrs=e,this.spec=n||Xe}map(e,n,r,u){let i=e.mapResult(n.from+u,1);if(i.deleted)return null;let s=e.mapResult(n.to+u,-1);return s.deleted||s.pos<=i.pos?null:new fe(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:u}=e.content.findIndex(n.from),i;return u==n.from&&!(i=e.child(r)).isText&&u+i.nodeSize==n.to}eq(e){return this==e||e instanceof Zr&&qt(this.attrs,e.attrs)&&qt(this.spec,e.spec)}destroy(){}}class fe{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new fe(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new fe(e,e,new bn(n,r))}static inline(e,n,r,u){return new fe(e,n,new Ve(r,u))}static node(e,n,r,u){return new fe(e,n,new Zr(r,u))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ve}get widget(){return this.type instanceof bn}}const ct=[],Xe={};class v{constructor(e,n){this.local=e.length?e:ct,this.children=n.length?n:ct}static create(e,n){return n.length?xn(n,e,0,Xe):H}find(e,n,r){let u=[];return this.findInner(e??0,n??1e9,u,0,r),u}findInner(e,n,r,u,i){for(let s=0;s<this.local.length;s++){let o=this.local[s];o.from<=n&&o.to>=e&&(!i||i(o.spec))&&r.push(o.copy(o.from+u,o.to+u))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let o=this.children[s]+1;this.children[s+2].findInner(e-o,n-o,r,u+o,i)}}map(e,n,r){return this==H||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Xe)}mapInner(e,n,r,u,i){let s;for(let o=0;o<this.local.length;o++){let l=this.local[o].map(e,r,u);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?Oc(this.children,s||[],e,n,r,u,i):s?new v(s.sort(Qe),ct):H}add(e,n){return n.length?this==H?v.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let u,i=0;e.forEach((o,l)=>{let a=l+r,c;if(c=Qs(n,o,a)){for(u||(u=this.children.slice());i<u.length&&u[i]<l;)i+=3;u[i]==l?u[i+2]=u[i+2].addInner(o,c,a+1):u.splice(i,0,l,l+o.nodeSize,xn(c,o,a+1,Xe)),i+=3}});let s=Xs(i?eo(n):n,-r);for(let o=0;o<s.length;o++)s[o].type.valid(e,s[o])||s.splice(o--,1);return new v(s.length?this.local.concat(s).sort(Qe):this.local,u||this.children)}remove(e){return e.length==0||this==H?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,u=this.local;for(let i=0;i<r.length;i+=3){let s,o=r[i]+n,l=r[i+1]+n;for(let c=0,f;c<e.length;c++)(f=e[c])&&f.from>o&&f.to<l&&(e[c]=null,(s||(s=[])).push(f));if(!s)continue;r==this.children&&(r=this.children.slice());let a=r[i+2].removeInner(s,o+1);a!=H?r[i+2]=a:(r.splice(i,3),i-=3)}if(u.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let o=0;o<u.length;o++)u[o].eq(s,n)&&(u==this.local&&(u=this.local.slice()),u.splice(o--,1))}return r==this.children&&u==this.local?this:u.length||r.length?new v(u,r):H}forChild(e,n){if(this==H)return this;if(n.isLeaf)return v.empty;let r,u;for(let o=0;o<this.children.length;o+=3)if(this.children[o]>=e){this.children[o]==e&&(r=this.children[o+2]);break}let i=e+1,s=i+n.content.size;for(let o=0;o<this.local.length;o++){let l=this.local[o];if(l.from<s&&l.to>i&&l.type instanceof Ve){let a=Math.max(i,l.from)-i,c=Math.min(s,l.to)-i;a<c&&(u||(u=[])).push(l.copy(a,c))}}if(u){let o=new v(u.sort(Qe),ct);return r?new Ie([o,r]):o}return r||H}eq(e){if(this==e)return!0;if(!(e instanceof v)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Yr(this.localsInner(e))}localsInner(e){if(this==H)return ct;if(e.inlineContent||!this.local.some(Ve.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Ve||n.push(this.local[r]);return n}forEachSet(e){e(this)}}v.empty=new v([],[]);v.removeOverlap=Yr;const H=v.empty;class Ie{constructor(e){this.members=e}map(e,n){const r=this.members.map(u=>u.map(e,n,Xe));return Ie.from(r)}forChild(e,n){if(n.isLeaf)return v.empty;let r=[];for(let u=0;u<this.members.length;u++){let i=this.members[u].forChild(e,n);i!=H&&(i instanceof Ie?r=r.concat(i.members):r.push(i))}return Ie.from(r)}eq(e){if(!(e instanceof Ie)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let u=0;u<this.members.length;u++){let i=this.members[u].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?Yr(r?n:n.sort(Qe)):ct}static from(e){switch(e.length){case 0:return H;case 1:return e[0];default:return new Ie(e.every(n=>n instanceof v)?e:e.reduce((n,r)=>n.concat(r instanceof v?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Oc(t,e,n,r,u,i,s){let o=t.slice();for(let a=0,c=i;a<n.maps.length;a++){let f=0;n.maps[a].forEach((p,h,d,m)=>{let g=m-d-(h-p);for(let b=0;b<o.length;b+=3){let k=o[b+1];if(k<0||p>k+c-f)continue;let y=o[b]+c-f;h>=y?o[b+1]=p<=y?-2:-1:p>=c&&g&&(o[b]+=g,o[b+1]+=g)}f+=g}),c=n.maps[a].map(c,-1)}let l=!1;for(let a=0;a<o.length;a+=3)if(o[a+1]<0){if(o[a+1]==-2){l=!0,o[a+1]=-1;continue}let c=n.map(t[a]+i),f=c-u;if(f<0||f>=r.content.size){l=!0;continue}let p=n.map(t[a+1]+i,-1),h=p-u,{index:d,offset:m}=r.content.findIndex(f),g=r.maybeChild(d);if(g&&m==f&&m+g.nodeSize==h){let b=o[a+2].mapInner(n,g,c+1,t[a]+i+1,s);b!=H?(o[a]=f,o[a+1]=h,o[a+2]=b):(o[a+1]=-2,l=!0)}else l=!0}if(l){let a=Fc(o,t,e,n,u,i,s),c=xn(a,r,0,s);e=c.local;for(let f=0;f<o.length;f+=3)o[f+1]<0&&(o.splice(f,3),f-=3);for(let f=0,p=0;f<c.children.length;f+=3){let h=c.children[f];for(;p<o.length&&o[p]<h;)p+=3;o.splice(p,0,c.children[f],c.children[f+1],c.children[f+2])}}return new v(e.sort(Qe),o)}function Xs(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let u=t[r];n.push(new fe(u.from+e,u.to+e,u.type))}return n}function Fc(t,e,n,r,u,i,s){function o(l,a){for(let c=0;c<l.local.length;c++){let f=l.local[c].map(r,u,a);f?n.push(f):s.onRemove&&s.onRemove(l.local[c].spec)}for(let c=0;c<l.children.length;c+=3)o(l.children[c+2],l.children[c]+a+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&o(t[l+2],e[l]+i+1);return n}function Qs(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,u=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((u||(u=[])).push(s),t[i]=null);return u}function eo(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function xn(t,e,n,r){let u=[],i=!1;e.forEach((o,l)=>{let a=Qs(t,o,l+n);if(a){i=!0;let c=xn(a,o,n+l+1,r);c!=H&&u.push(l,l+o.nodeSize,c)}});let s=Xs(i?eo(t):t,-n).sort(Qe);for(let o=0;o<s.length;o++)s[o].type.valid(e,s[o])||(r.onRemove&&r.onRemove(s[o].spec),s.splice(o--,1));return s.length||u.length?new v(s,u):H}function Qe(t,e){return t.from-e.from||t.to-e.to}function Yr(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let u=n+1;u<e.length;u++){let i=e[u];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[u]=i.copy(i.from,r.to),Gu(e,u+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Gu(e,u,r.copy(i.from,r.to)));break}}}return e}function Gu(t,e,n){for(;e<t.length&&Qe(n,t[e])>0;)e++;t.splice(e,0,n)}function Gn(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=H&&e.push(r)}),t.cursorWrapper&&e.push(v.create(t.state.doc,[t.cursorWrapper.deco])),Ie.from(e)}const Nc={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ic=X&&Le<=11;class Rc{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Bc{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Rc,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let u=0;u<r.length;u++)this.queue.push(r[u]);X&&Le<=11&&r.some(u=>u.type=="childList"&&u.removedNodes.length||u.type=="characterData"&&u.oldValue.length>u.target.nodeValue.length)?this.flushSoon():j&&e.composing&&r.some(u=>u.type=="childList"&&u.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Ic&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Nc)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Vu(this.view)){if(this.suppressingSelectionUpdates)return Me(this.view);if(X&&Le<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&rt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=gt(i))n.add(i);for(let i=e.anchorNode;i;i=gt(i))if(n.has(i)){r=i;break}let u=r&&this.view.docView.nearestDesc(r);if(u&&u.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),u=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Vu(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,o=!1,l=[];if(e.editable)for(let c=0;c<n.length;c++){let f=this.registerMutation(n[c],l);f&&(i=i<0?f.from:Math.min(f.from,i),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(o=!0))}if(l.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of l)if(c.nodeName=="BR"&&c.parentNode){let f=c.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&c.parentNode.removeChild(c)}}else if(oe&&l.length){let c=l.filter(f=>f.nodeName=="BR");if(c.length==2){let[f,p]=c;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of c){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||Pc(e,f)!=h)&&p.remove()}}}let a=null;i<0&&u&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&An(r)&&(a=Hr(e))&&a.eq(O.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Me(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||u)&&(i>-1&&(e.docView.markDirty(i,s),zc(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Lc(e,l)),this.handleDOMChange(i,s,o,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Me(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let f=e.addedNodes[c];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let u=e.previousSibling,i=e.nextSibling;if(X&&Le<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:f,nextSibling:p}=e.addedNodes[c];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(u=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}let s=u&&u.parentNode==e.target?V(u)+1:0,o=r.localPosFromDOM(e.target,s,-1),l=i&&i.parentNode==e.target?V(i):e.target.childNodes.length,a=r.localPosFromDOM(e.target,l,1);return{from:o,to:a}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Zu=new WeakMap,Yu=!1;function zc(t){if(!Zu.has(t)&&(Zu.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=oe,Yu)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Yu=!0}}function Xu(t,e){let n=e.startContainer,r=e.startOffset,u=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return rt(s.node,s.offset,u,i)&&([n,r,u,i]=[u,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:u,focusOffset:i}}function vc(t,e){if(e.getComposedRanges){let u=e.getComposedRanges(t.root)[0];if(u)return Xu(t,u)}let n;function r(u){u.preventDefault(),u.stopImmediatePropagation(),n=u.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Xu(t,n):null}function Pc(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Lc(t,e){var n;let{focusNode:r,focusOffset:u}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let o=s;for(;;){let l=o.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;o=l}o.insertBefore(i,o.firstChild),r==i&&t.domSelection().collapse(i,u)}else i.parentNode.removeChild(i)}}function qc(t,e,n){let{node:r,fromOffset:u,toOffset:i,from:s,to:o}=t.docView.parseRange(e,n),l=t.domSelectionRange(),a,c=l.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(a=[{node:c,offset:l.anchorOffset}],An(l)||a.push({node:l.focusNode,offset:l.focusOffset})),W&&t.input.lastKeyCode===8)for(let g=i;g>u;g--){let b=r.childNodes[g-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){i=g;break}if(!k||k.size)break}let f=t.state.doc,p=t.someProp("domParser")||Rt.fromSchema(t.state.schema),h=f.resolve(s),d=null,m=p.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:u,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:a,ruleFromNode:Vc,context:h});if(a&&a[0].pos!=null){let g=a[0].pos,b=a[1]&&a[1].pos;b==null&&(b=g),d={anchor:g+s,head:b+s}}return{doc:m,sel:d,from:s,to:o}}function Vc(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(j&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||j&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const $c=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Wc(t,e,n,r,u){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,w=Hr(t,C);if(w&&!t.state.selection.eq(w)){if(W&&Ae&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",ee=>ee(t,je(13,"Enter"))))return;let I=t.state.tr.setSelection(w);C=="pointer"?I.setMeta("pointer",!0):C=="key"&&I.scrollIntoView(),i&&I.setMeta("composition",i),t.dispatch(I)}return}let s=t.state.doc.resolve(e),o=s.sharedDepth(n);e=s.before(o+1),n=t.state.doc.resolve(n).after(o+1);let l=t.state.selection,a=qc(t,e,n),c=t.state.doc,f=c.slice(a.from,a.to),p,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,h="end"):(p=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let d=jc(f.content,a.doc.content,a.from,p,h);if(d&&t.input.domChangeCount++,(bt&&t.input.lastIOSEnter>Date.now()-225||Ae)&&u.some(C=>C.nodeType==1&&!$c.test(C.nodeName))&&(!d||d.endA>=d.endB)&&t.someProp("handleKeyDown",C=>C(t,je(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!d)if(r&&l instanceof F&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(a.sel&&a.sel.anchor!=a.sel.head))d={start:l.from,endA:l.to,endB:l.to};else{if(a.sel){let C=Qu(t,t.state.doc,a.sel);if(C&&!C.eq(t.state.selection)){let w=t.state.tr.setSelection(C);i&&w.setMeta("composition",i),t.dispatch(w)}}return}t.state.selection.from<t.state.selection.to&&d.start==d.endB&&t.state.selection instanceof F&&(d.start>t.state.selection.from&&d.start<=t.state.selection.from+2&&t.state.selection.from>=a.from?d.start=t.state.selection.from:d.endA<t.state.selection.to&&d.endA>=t.state.selection.to-2&&t.state.selection.to<=a.to&&(d.endB+=t.state.selection.to-d.endA,d.endA=t.state.selection.to)),X&&Le<=11&&d.endB==d.start+1&&d.endA==d.start&&d.start>a.from&&a.doc.textBetween(d.start-a.from-1,d.start-a.from+1)==" "&&(d.start--,d.endA--,d.endB--);let m=a.doc.resolveNoCache(d.start-a.from),g=a.doc.resolveNoCache(d.endB-a.from),b=c.resolve(d.start),k=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=d.endA;if((bt&&t.input.lastIOSEnter>Date.now()-225&&(!k||u.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!k&&m.pos<a.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(a.doc.textBetween(m.pos,g.pos,"","")))&&t.someProp("handleKeyDown",C=>C(t,je(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>d.start&&Jc(c,d.start,d.endA,m,g)&&t.someProp("handleKeyDown",C=>C(t,je(8,"Backspace")))){Ae&&W&&t.domObserver.suppressSelectionUpdates();return}W&&d.endB==d.start&&(t.input.lastChromeDelete=Date.now()),Ae&&!k&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&a.sel&&a.sel.anchor==a.sel.head&&a.sel.head==d.endA&&(d.endB-=2,g=a.doc.resolveNoCache(d.endB-a.from),setTimeout(()=>{t.someProp("handleKeyDown",function(C){return C(t,je(13,"Enter"))})},20));let y=d.start,_=d.endA,E=C=>{let w=C||t.state.tr.replace(y,_,a.doc.slice(d.start-a.from,d.endB-a.from));if(a.sel){let I=Qu(t,w.doc,a.sel);I&&!(W&&t.composing&&I.empty&&(d.start!=d.endB||t.input.lastChromeDelete<Date.now()-100)&&(I.head==y||I.head==w.mapping.map(_)-1)||X&&I.empty&&I.head==y)&&w.setSelection(I)}return i&&w.setMeta("composition",i),w.scrollIntoView()},M;if(k)if(m.pos==g.pos){X&&Le<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Me(t),20));let C=E(t.state.tr.delete(y,_)),w=c.resolve(d.start).marksAcross(c.resolve(d.endA));w&&C.ensureMarks(w),t.dispatch(C)}else if(d.endA==d.endB&&(M=Hc(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,d.endA-b.start())))){let C=E(t.state.tr);M.type=="add"?C.addMark(y,_,M.mark):C.removeMark(y,_,M.mark),t.dispatch(C)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let C=m.parent.textBetween(m.parentOffset,g.parentOffset),w=()=>E(t.state.tr.insertText(C,y,_));t.someProp("handleTextInput",I=>I(t,y,_,C,w))||t.dispatch(w())}else t.dispatch(E());else t.dispatch(E())}function Qu(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Jr(t,e.resolve(n.anchor),e.resolve(n.head))}function Hc(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,u=n,i=r,s,o,l;for(let c=0;c<r.length;c++)u=r[c].removeFromSet(u);for(let c=0;c<n.length;c++)i=n[c].removeFromSet(i);if(u.length==1&&i.length==0)o=u[0],s="add",l=c=>c.mark(o.addToSet(c.marks));else if(u.length==0&&i.length==1)o=i[0],s="remove",l=c=>c.mark(o.removeFromSet(c.marks));else return null;let a=[];for(let c=0;c<e.childCount;c++)a.push(l(e.child(c)));if(x.from(a).eq(t))return{mark:o,type:s}}function Jc(t,e,n,r,u){if(n-e<=u.pos-r.pos||Zn(r,!0,!1)<u.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let o=i.nodeAfter;return o!=null&&n==e+o.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Zn(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Zn(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Zn(t,e,n){let r=t.depth,u=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,u++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,u++}return u}function jc(t,e,n,r,u){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:o}=t.findDiffEnd(e,n+t.size,n+e.size);if(u=="end"){let l=Math.max(0,i-Math.min(s,o));r-=s+l-i}if(s<i&&t.size<e.size){let l=r<=i&&r>=s?i-r:0;i-=l,i&&i<e.size&&ei(e.textBetween(i-1,i+1))&&(i+=l?1:-1),o=i+(o-s),s=i}else if(o<i){let l=r<=i&&r>=o?i-r:0;i-=l,i&&i<t.size&&ei(t.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-o),o=i}return{start:i,endA:s,endB:o}}function ei(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class to{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new lc,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ii),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=ri(this),ni(this),this.nodeViews=ui(this),this.docView=Bu(this.state.doc,ti(this),Gn(this),this.dom,this),this.domObserver=new Bc(this,(r,u,i,s)=>Wc(this,r,u,i,s)),this.domObserver.start(),ac(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Mr(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ii),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let u=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Ks(this),s=!0),this.state=e;let o=u.plugins!=e.plugins||this._props.plugins!=n.plugins;if(o||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=ui(this);Kc(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(o||n.handleDOMEvents!=this._props.handleDOMEvents)&&Mr(this),this.editable=ri(this),ni(this);let l=Gn(this),a=ti(this),c=u.plugins!=e.plugins&&!u.doc.eq(e.doc)?"reset":e.scrollToSelection>u.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,a,l);(f||!e.selection.eq(u.selection))&&(s=!0);let p=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&_a(this);if(s){this.domObserver.stop();let h=f&&(X||W)&&!this.composing&&!u.selection.empty&&!e.selection.empty&&Uc(u.selection,e.selection);if(f){let d=W?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=_c(this)),(i||!this.docView.update(e.doc,a,l,this))&&(this.docView.updateOuterDeco(a),this.docView.destroy(),this.docView=Bu(e.doc,a,l,this.dom,this)),d&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ua(this))?Me(this,h):(zs(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(u),!((r=this.dragging)===null||r===void 0)&&r.node&&!u.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,u),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():p&&Ea(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof A){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Tu(this,n.getBoundingClientRect(),e)}else Tu(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,u=-1;if(this.state.doc.nodeAt(r.from)==r.node)u=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(u=i)}this.dragging=new Zs(e.slice,e.move,u<0?void 0:A.create(this.state.doc,u))}someProp(e,n){let r=this._props&&this._props[e],u;if(r!=null&&(u=n?n(r):r))return u;for(let s=0;s<this.directPlugins.length;s++){let o=this.directPlugins[s].props[e];if(o!=null&&(u=n?n(o):o))return u}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let o=i[s].props[e];if(o!=null&&(u=n?n(o):o))return u}}hasFocus(){if(X){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Sa(this.dom),Me(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Oa(this,e)}coordsAtPos(e,n=1){return ws(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let u=this.docView.posFromDOM(e,n,r);if(u==null)throw new RangeError("DOM position not inside the editor");return u}endOfTextblock(e,n){return Ba(this,n||this.state,e)}pasteHTML(e,n){return Lt(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Lt(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return jr(this,e)}destroy(){this.docView&&(cc(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Gn(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ha())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return dc(this,e)}domSelectionRange(){let e=this.domSelection();return e?j&&this.root.nodeType===11&&xa(this.dom.ownerDocument)==this.dom&&vc(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}to.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function ti(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[fe.node(0,t.state.doc.content.size,e)]}function ni(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:fe.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function ri(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Uc(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function ui(t){let e=Object.create(null);function n(r){for(let u in r)Object.prototype.hasOwnProperty.call(e,u)||(e[u]=r[u])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Kc(t,e){let n=0,r=0;for(let u in t){if(t[u]!=e[u])return!0;n++}for(let u in e)r++;return n!=r}function ii(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const Gc=["p",0],Zc=["blockquote",0],Yc=["hr"],Xc=["pre",["code",0]],Qc=["br"],ef={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return Gc}},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM(){return Zc}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return Yc}},heading:{attrs:{level:{default:1,validate:"number"}},content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(t){return["h"+t.attrs.level,0]}},code_block:{content:"text*",marks:"",group:"block",code:!0,defining:!0,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM(){return Xc}},text:{group:"inline"},image:{inline:!0,attrs:{src:{validate:"string"},alt:{default:null,validate:"string|null"},title:{default:null,validate:"string|null"}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs(t){return{src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")}}}],toDOM(t){let{src:e,alt:n,title:r}=t.attrs;return["img",{src:e,alt:n,title:r}]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return Qc}}},tf=["em",0],nf=["strong",0],rf=["code",0],uf={link:{attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(t){return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM(t){let{href:e,title:n}=t.attrs;return["a",{href:e,title:n},0]}},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:t=>t.type.name=="em"}],toDOM(){return tf}},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM(){return nf}},code:{code:!0,parseDOM:[{tag:"code"}],toDOM(){return rf}}},sf=new Rr({nodes:ef,marks:uf}),si={};function of(t){let e=si[t];if(e)return e;e=si[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);e.push(r)}for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);e[r]="%"+("0"+r.toString(16).toUpperCase()).slice(-2)}return e}function xt(t,e){typeof e!="string"&&(e=xt.defaultChars);const n=of(e);return t.replace(/(%[a-f0-9]{2})+/gi,function(r){let u="";for(let i=0,s=r.length;i<s;i+=3){const o=parseInt(r.slice(i+1,i+3),16);if(o<128){u+=n[o];continue}if((o&224)===192&&i+3<s){const l=parseInt(r.slice(i+4,i+6),16);if((l&192)===128){const a=o<<6&1984|l&63;a<128?u+="��":u+=String.fromCharCode(a),i+=3;continue}}if((o&240)===224&&i+6<s){const l=parseInt(r.slice(i+4,i+6),16),a=parseInt(r.slice(i+7,i+9),16);if((l&192)===128&&(a&192)===128){const c=o<<12&61440|l<<6&4032|a&63;c<2048||c>=55296&&c<=57343?u+="���":u+=String.fromCharCode(c),i+=6;continue}}if((o&248)===240&&i+9<s){const l=parseInt(r.slice(i+4,i+6),16),a=parseInt(r.slice(i+7,i+9),16),c=parseInt(r.slice(i+10,i+12),16);if((l&192)===128&&(a&192)===128&&(c&192)===128){let f=o<<18&1835008|l<<12&258048|a<<6&4032|c&63;f<65536||f>1114111?u+="����":(f-=65536,u+=String.fromCharCode(55296+(f>>10),56320+(f&1023))),i+=9;continue}}u+="�"}return u})}xt.defaultChars=";/?:@&=+$,#";xt.componentChars="";const oi={};function lf(t){let e=oi[t];if(e)return e;e=oi[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);/^[0-9a-z]$/i.test(r)?e.push(r):e.push("%"+("0"+n.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<t.length;n++)e[t.charCodeAt(n)]=t[n];return e}function Gt(t,e,n){typeof e!="string"&&(n=e,e=Gt.defaultChars),typeof n>"u"&&(n=!0);const r=lf(e);let u="";for(let i=0,s=t.length;i<s;i++){const o=t.charCodeAt(i);if(n&&o===37&&i+2<s&&/^[0-9a-f]{2}$/i.test(t.slice(i+1,i+3))){u+=t.slice(i,i+3),i+=2;continue}if(o<128){u+=r[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&i+1<s){const l=t.charCodeAt(i+1);if(l>=56320&&l<=57343){u+=encodeURIComponent(t[i]+t[i+1]),i++;continue}}u+="%EF%BF%BD";continue}u+=encodeURIComponent(t[i])}return u}Gt.defaultChars=";/?:@&=+$,-_.!~*'()#";Gt.componentChars="-_.!~*'()";function Xr(t){let e="";return e+=t.protocol||"",e+=t.slashes?"//":"",e+=t.auth?t.auth+"@":"",t.hostname&&t.hostname.indexOf(":")!==-1?e+="["+t.hostname+"]":e+=t.hostname||"",e+=t.port?":"+t.port:"",e+=t.pathname||"",e+=t.search||"",e+=t.hash||"",e}function kn(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const af=/^([a-z0-9.+-]+:)/i,cf=/:[0-9]*$/,ff=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,df=["<",">",'"',"`"," ","\r",`
|
|
11
11
|
`," "],hf=["{","}","|","\\","^","`"].concat(df),pf=["'"].concat(hf),li=["%","/","?",";","#"].concat(pf),ai=["/","?","#"],mf=255,ci=/^[+a-z0-9A-Z_-]{0,63}$/,gf=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,fi={javascript:!0,"javascript:":!0},di={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Qr(t,e){if(t&&t instanceof kn)return t;const n=new kn;return n.parse(t,e),n}kn.prototype.parse=function(t,e){let n,r,u,i=t;if(i=i.trim(),!e&&t.split("#").length===1){const a=ff.exec(i);if(a)return this.pathname=a[1],a[2]&&(this.search=a[2]),this}let s=af.exec(i);if(s&&(s=s[0],n=s.toLowerCase(),this.protocol=s,i=i.substr(s.length)),(e||s||i.match(/^\/\/[^@\/]+@[^@\/]+/))&&(u=i.substr(0,2)==="//",u&&!(s&&fi[s])&&(i=i.substr(2),this.slashes=!0)),!fi[s]&&(u||s&&!di[s])){let a=-1;for(let d=0;d<ai.length;d++)r=i.indexOf(ai[d]),r!==-1&&(a===-1||r<a)&&(a=r);let c,f;a===-1?f=i.lastIndexOf("@"):f=i.lastIndexOf("@",a),f!==-1&&(c=i.slice(0,f),i=i.slice(f+1),this.auth=c),a=-1;for(let d=0;d<li.length;d++)r=i.indexOf(li[d]),r!==-1&&(a===-1||r<a)&&(a=r);a===-1&&(a=i.length),i[a-1]===":"&&a--;const p=i.slice(0,a);i=i.slice(a),this.parseHost(p),this.hostname=this.hostname||"";const h=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!h){const d=this.hostname.split(/\./);for(let m=0,g=d.length;m<g;m++){const b=d[m];if(b&&!b.match(ci)){let k="";for(let y=0,_=b.length;y<_;y++)b.charCodeAt(y)>127?k+="x":k+=b[y];if(!k.match(ci)){const y=d.slice(0,m),_=d.slice(m+1),E=b.match(gf);E&&(y.push(E[1]),_.unshift(E[2])),_.length&&(i=_.join(".")+i),this.hostname=y.join(".");break}}}}this.hostname.length>mf&&(this.hostname=""),h&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const o=i.indexOf("#");o!==-1&&(this.hash=i.substr(o),i=i.slice(0,o));const l=i.indexOf("?");return l!==-1&&(this.search=i.substr(l),i=i.slice(0,l)),i&&(this.pathname=i),di[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};kn.prototype.parseHost=function(t){let e=cf.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};const bf=Object.freeze(Object.defineProperty({__proto__:null,decode:xt,encode:Gt,format:Xr,parse:Qr},Symbol.toStringTag,{value:"Module"})),no=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,ro=/[\0-\x1F\x7F-\x9F]/,xf=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,eu=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,uo=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,io=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,kf=Object.freeze(Object.defineProperty({__proto__:null,Any:no,Cc:ro,Cf:xf,P:eu,S:uo,Z:io},Symbol.toStringTag,{value:"Module"})),yf=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),Cf=new Uint16Array("Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(t=>t.charCodeAt(0)));var Yn;const Df=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),_f=(Yn=String.fromCodePoint)!==null&&Yn!==void 0?Yn:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e};function Ef(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=Df.get(t))!==null&&e!==void 0?e:t}var P;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(P||(P={}));const Sf=32;var Pe;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(Pe||(Pe={}));function wr(t){return t>=P.ZERO&&t<=P.NINE}function Af(t){return t>=P.UPPER_A&&t<=P.UPPER_F||t>=P.LOWER_A&&t<=P.LOWER_F}function Mf(t){return t>=P.UPPER_A&&t<=P.UPPER_Z||t>=P.LOWER_A&&t<=P.LOWER_Z||wr(t)}function wf(t){return t===P.EQUALS||Mf(t)}var z;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(z||(z={}));var Re;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(Re||(Re={}));class Tf{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=z.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Re.Strict}startEntity(e){this.decodeMode=e,this.state=z.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case z.EntityStart:return e.charCodeAt(n)===P.NUM?(this.state=z.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=z.NamedEntity,this.stateNamedEntity(e,n));case z.NumericStart:return this.stateNumericStart(e,n);case z.NumericDecimal:return this.stateNumericDecimal(e,n);case z.NumericHex:return this.stateNumericHex(e,n);case z.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|Sf)===P.LOWER_X?(this.state=z.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=z.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,u){if(n!==r){const i=r-n;this.result=this.result*Math.pow(u,i)+parseInt(e.substr(n,i),u),this.consumed+=i}}stateNumericHex(e,n){const r=n;for(;n<e.length;){const u=e.charCodeAt(n);if(wr(u)||Af(u))n+=1;else return this.addToNumericResult(e,r,n,16),this.emitNumericEntity(u,3)}return this.addToNumericResult(e,r,n,16),-1}stateNumericDecimal(e,n){const r=n;for(;n<e.length;){const u=e.charCodeAt(n);if(wr(u))n+=1;else return this.addToNumericResult(e,r,n,10),this.emitNumericEntity(u,2)}return this.addToNumericResult(e,r,n,10),-1}emitNumericEntity(e,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===P.SEMI)this.consumed+=1;else if(this.decodeMode===Re.Strict)return 0;return this.emitCodePoint(Ef(this.result),this.consumed),this.errors&&(e!==P.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,n){const{decodeTree:r}=this;let u=r[this.treeIndex],i=(u&Pe.VALUE_LENGTH)>>14;for(;n<e.length;n++,this.excess++){const s=e.charCodeAt(n);if(this.treeIndex=Of(r,u,this.treeIndex+Math.max(1,i),s),this.treeIndex<0)return this.result===0||this.decodeMode===Re.Attribute&&(i===0||wf(s))?0:this.emitNotTerminatedNamedEntity();if(u=r[this.treeIndex],i=(u&Pe.VALUE_LENGTH)>>14,i!==0){if(s===P.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Re.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,u=(r[n]&Pe.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,u,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:u}=this;return this.emitCodePoint(n===1?u[e]&~Pe.VALUE_LENGTH:u[e+1],r),n===3&&this.emitCodePoint(u[e+2],r),r}end(){var e;switch(this.state){case z.NamedEntity:return this.result!==0&&(this.decodeMode!==Re.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case z.NumericDecimal:return this.emitNumericEntity(0,2);case z.NumericHex:return this.emitNumericEntity(0,3);case z.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case z.EntityStart:return 0}}}function so(t){let e="";const n=new Tf(t,r=>e+=_f(r));return function(u,i){let s=0,o=0;for(;(o=u.indexOf("&",o))>=0;){e+=u.slice(s,o),n.startEntity(i);const a=n.write(u,o+1);if(a<0){s=o+n.end();break}s=o+a,o=a===0?s+1:s}const l=e+u.slice(s);return e="",l}}function Of(t,e,n,r){const u=(e&Pe.BRANCH_LENGTH)>>7,i=e&Pe.JUMP_TABLE;if(u===0)return i!==0&&r===i?n:-1;if(i){const l=r-i;return l<0||l>=u?-1:t[n+l]-1}let s=n,o=s+u-1;for(;s<=o;){const l=s+o>>>1,a=t[l];if(a<r)s=l+1;else if(a>r)o=l-1;else return t[l+u]}return-1}const Ff=so(yf);so(Cf);function oo(t,e=Re.Legacy){return Ff(t,e)}function Nf(t){return Object.prototype.toString.call(t)}function tu(t){return Nf(t)==="[object String]"}const If=Object.prototype.hasOwnProperty;function Rf(t,e){return If.call(t,e)}function Tn(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){if(n){if(typeof n!="object")throw new TypeError(n+"must be object");Object.keys(n).forEach(function(r){t[r]=n[r]})}}),t}function lo(t,e,n){return[].concat(t.slice(0,e),n,t.slice(e+1))}function nu(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function yn(t){if(t>65535){t-=65536;const e=55296+(t>>10),n=56320+(t&1023);return String.fromCharCode(e,n)}return String.fromCharCode(t)}const ao=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,Bf=/&([a-z#][a-z0-9]{1,31});/gi,zf=new RegExp(ao.source+"|"+Bf.source,"gi"),vf=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function Pf(t,e){if(e.charCodeAt(0)===35&&vf.test(e)){const r=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return nu(r)?yn(r):t}const n=oo(t);return n!==t?n:t}function Lf(t){return t.indexOf("\\")<0?t:t.replace(ao,"$1")}function kt(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(zf,function(e,n,r){return n||Pf(e,r)})}const qf=/[&<>"]/,Vf=/[&<>"]/g,$f={"&":"&","<":"<",">":">",'"':"""};function Wf(t){return $f[t]}function $e(t){return qf.test(t)?t.replace(Vf,Wf):t}const Hf=/[.?*+^$[\]\\(){}|-]/g;function Jf(t){return t.replace(Hf,"\\$&")}function N(t){switch(t){case 9:case 32:return!0}return!1}function Vt(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function $t(t){return eu.test(t)||uo.test(t)}function Wt(t){switch(t){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function On(t){return t=t.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}const jf={mdurl:bf,ucmicro:kf},Uf=Object.freeze(Object.defineProperty({__proto__:null,arrayReplaceAt:lo,assign:Tn,escapeHtml:$e,escapeRE:Jf,fromCodePoint:yn,has:Rf,isMdAsciiPunct:Wt,isPunctChar:$t,isSpace:N,isString:tu,isValidEntityCode:nu,isWhiteSpace:Vt,lib:jf,normalizeReference:On,unescapeAll:kt,unescapeMd:Lf},Symbol.toStringTag,{value:"Module"}));function Kf(t,e,n){let r,u,i,s;const o=t.posMax,l=t.pos;for(t.pos=e+1,r=1;t.pos<o;){if(i=t.src.charCodeAt(t.pos),i===93&&(r--,r===0)){u=!0;break}if(s=t.pos,t.md.inline.skipToken(t),i===91){if(s===t.pos-1)r++;else if(n)return t.pos=l,-1}}let a=-1;return u&&(a=t.pos),t.pos=l,a}function Gf(t,e,n){let r,u=e;const i={ok:!1,pos:0,str:""};if(t.charCodeAt(u)===60){for(u++;u<n;){if(r=t.charCodeAt(u),r===10||r===60)return i;if(r===62)return i.pos=u+1,i.str=kt(t.slice(e+1,u)),i.ok=!0,i;if(r===92&&u+1<n){u+=2;continue}u++}return i}let s=0;for(;u<n&&(r=t.charCodeAt(u),!(r===32||r<32||r===127));){if(r===92&&u+1<n){if(t.charCodeAt(u+1)===32)break;u+=2;continue}if(r===40&&(s++,s>32))return i;if(r===41){if(s===0)break;s--}u++}return e===u||s!==0||(i.str=kt(t.slice(e,u)),i.pos=u,i.ok=!0),i}function Zf(t,e,n,r){let u,i=e;const s={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)s.str=r.str,s.marker=r.marker;else{if(i>=n)return s;let o=t.charCodeAt(i);if(o!==34&&o!==39&&o!==40)return s;e++,i++,o===40&&(o=41),s.marker=o}for(;i<n;){if(u=t.charCodeAt(i),u===s.marker)return s.pos=i+1,s.str+=kt(t.slice(e,i)),s.ok=!0,s;if(u===40&&s.marker===41)return s;u===92&&i+1<n&&i++,i++}return s.can_continue=!0,s.str+=kt(t.slice(e,i)),s}const Yf=Object.freeze(Object.defineProperty({__proto__:null,parseLinkDestination:Gf,parseLinkLabel:Kf,parseLinkTitle:Zf},Symbol.toStringTag,{value:"Module"})),Ce={};Ce.code_inline=function(t,e,n,r,u){const i=t[e];return"<code"+u.renderAttrs(i)+">"+$e(i.content)+"</code>"};Ce.code_block=function(t,e,n,r,u){const i=t[e];return"<pre"+u.renderAttrs(i)+"><code>"+$e(t[e].content)+`</code></pre>
|
|
12
12
|
`};Ce.fence=function(t,e,n,r,u){const i=t[e],s=i.info?kt(i.info).trim():"";let o="",l="";if(s){const c=s.split(/(\s+)/g);o=c[0],l=c.slice(2).join("")}let a;if(n.highlight?a=n.highlight(i.content,o,l)||$e(i.content):a=$e(i.content),a.indexOf("<pre")===0)return a+`
|
|
13
13
|
`;if(s){const c=i.attrIndex("class"),f=i.attrs?i.attrs.slice():[];c<0?f.push(["class",n.langPrefix+o]):(f[c]=f[c].slice(),f[c][1]+=" "+n.langPrefix+o);const p={attrs:f};return`<pre><code${u.renderAttrs(p)}>${a}</code></pre>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
`:">",i};Ct.prototype.renderInline=function(t,e,n){let r="";const u=this.rules;for(let i=0,s=t.length;i<s;i++){const o=t[i].type;typeof u[o]<"u"?r+=u[o](t,i,e,n,this):r+=this.renderToken(t,i,e)}return r};Ct.prototype.renderInlineAsText=function(t,e,n){let r="";for(let u=0,i=t.length;u<i;u++)switch(t[u].type){case"text":r+=t[u].content;break;case"image":r+=this.renderInlineAsText(t[u].children,e,n);break;case"html_inline":case"html_block":r+=t[u].content;break;case"softbreak":case"hardbreak":r+=`
|
|
23
23
|
`;break}return r};Ct.prototype.render=function(t,e,n){let r="";const u=this.rules;for(let i=0,s=t.length;i<s;i++){const o=t[i].type;o==="inline"?r+=this.renderInline(t[i].children,e,n):typeof u[o]<"u"?r+=u[o](t,i,e,n,this):r+=this.renderToken(t,i,e,n)}return r};function Q(){this.__rules__=[],this.__cache__=null}Q.prototype.__find__=function(t){for(let e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1};Q.prototype.__compile__=function(){const t=this,e=[""];t.__rules__.forEach(function(n){n.enabled&&n.alt.forEach(function(r){e.indexOf(r)<0&&e.push(r)})}),t.__cache__={},e.forEach(function(n){t.__cache__[n]=[],t.__rules__.forEach(function(r){r.enabled&&(n&&r.alt.indexOf(n)<0||t.__cache__[n].push(r.fn))})})};Q.prototype.at=function(t,e,n){const r=this.__find__(t),u=n||{};if(r===-1)throw new Error("Parser rule not found: "+t);this.__rules__[r].fn=e,this.__rules__[r].alt=u.alt||[],this.__cache__=null};Q.prototype.before=function(t,e,n,r){const u=this.__find__(t),i=r||{};if(u===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(u,0,{name:e,enabled:!0,fn:n,alt:i.alt||[]}),this.__cache__=null};Q.prototype.after=function(t,e,n,r){const u=this.__find__(t),i=r||{};if(u===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(u+1,0,{name:e,enabled:!0,fn:n,alt:i.alt||[]}),this.__cache__=null};Q.prototype.push=function(t,e,n){const r=n||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null};Q.prototype.enable=function(t,e){Array.isArray(t)||(t=[t]);const n=[];return t.forEach(function(r){const u=this.__find__(r);if(u<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[u].enabled=!0,n.push(r)},this),this.__cache__=null,n};Q.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach(function(n){n.enabled=!1}),this.enable(t,e)};Q.prototype.disable=function(t,e){Array.isArray(t)||(t=[t]);const n=[];return t.forEach(function(r){const u=this.__find__(r);if(u<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[u].enabled=!1,n.push(r)},this),this.__cache__=null,n};Q.prototype.getRules=function(t){return this.__cache__===null&&this.__compile__(),this.__cache__[t]||[]};function de(t,e,n){this.type=t,this.tag=e,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}de.prototype.attrIndex=function(e){if(!this.attrs)return-1;const n=this.attrs;for(let r=0,u=n.length;r<u;r++)if(n[r][0]===e)return r;return-1};de.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]};de.prototype.attrSet=function(e,n){const r=this.attrIndex(e),u=[e,n];r<0?this.attrPush(u):this.attrs[r]=u};de.prototype.attrGet=function(e){const n=this.attrIndex(e);let r=null;return n>=0&&(r=this.attrs[n][1]),r};de.prototype.attrJoin=function(e,n){const r=this.attrIndex(e);r<0?this.attrPush([e,n]):this.attrs[r][1]=this.attrs[r][1]+" "+n};function co(t,e,n){this.src=t,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=e}co.prototype.Token=de;const Xf=/\r\n?|\n/g,Qf=/\0/g;function e0(t){let e;e=t.src.replace(Xf,`
|
|
24
24
|
`),e=e.replace(Qf,"�"),t.src=e}function t0(t){let e;t.inlineMode?(e=new t.Token("inline","",0),e.content=t.src,e.map=[0,1],e.children=[],t.tokens.push(e)):t.md.block.parse(t.src,t.md,t.env,t.tokens)}function n0(t){const e=t.tokens;for(let n=0,r=e.length;n<r;n++){const u=e[n];u.type==="inline"&&t.md.inline.parse(u.content,t.md,t.env,u.children)}}function r0(t){return/^<a[>\s]/i.test(t)}function u0(t){return/^<\/a\s*>/i.test(t)}function i0(t){const e=t.tokens;if(t.md.options.linkify)for(let n=0,r=e.length;n<r;n++){if(e[n].type!=="inline"||!t.md.linkify.pretest(e[n].content))continue;let u=e[n].children,i=0;for(let s=u.length-1;s>=0;s--){const o=u[s];if(o.type==="link_close"){for(s--;u[s].level!==o.level&&u[s].type!=="link_open";)s--;continue}if(o.type==="html_inline"&&(r0(o.content)&&i>0&&i--,u0(o.content)&&i++),!(i>0)&&o.type==="text"&&t.md.linkify.test(o.content)){const l=o.content;let a=t.md.linkify.match(l);const c=[];let f=o.level,p=0;a.length>0&&a[0].index===0&&s>0&&u[s-1].type==="text_special"&&(a=a.slice(1));for(let h=0;h<a.length;h++){const d=a[h].url,m=t.md.normalizeLink(d);if(!t.md.validateLink(m))continue;let g=a[h].text;a[h].schema?a[h].schema==="mailto:"&&!/^mailto:/i.test(g)?g=t.md.normalizeLinkText("mailto:"+g).replace(/^mailto:/,""):g=t.md.normalizeLinkText(g):g=t.md.normalizeLinkText("http://"+g).replace(/^http:\/\//,"");const b=a[h].index;if(b>p){const E=new t.Token("text","",0);E.content=l.slice(p,b),E.level=f,c.push(E)}const k=new t.Token("link_open","a",1);k.attrs=[["href",m]],k.level=f++,k.markup="linkify",k.info="auto",c.push(k);const y=new t.Token("text","",0);y.content=g,y.level=f,c.push(y);const _=new t.Token("link_close","a",-1);_.level=--f,_.markup="linkify",_.info="auto",c.push(_),p=a[h].lastIndex}if(p<l.length){const h=new t.Token("text","",0);h.content=l.slice(p),h.level=f,c.push(h)}e[n].children=u=lo(u,s,c)}}}}const fo=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,s0=/\((c|tm|r)\)/i,o0=/\((c|tm|r)\)/ig,l0={c:"©",r:"®",tm:"™"};function a0(t,e){return l0[e.toLowerCase()]}function c0(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&(r.content=r.content.replace(o0,a0)),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function f0(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&fo.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function d0(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&(s0.test(t.tokens[e].content)&&c0(t.tokens[e].children),fo.test(t.tokens[e].content)&&f0(t.tokens[e].children))}const h0=/['"]/,hi=/['"]/g,pi="’";function nn(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function p0(t,e){let n;const r=[];for(let u=0;u<t.length;u++){const i=t[u],s=t[u].level;for(n=r.length-1;n>=0&&!(r[n].level<=s);n--);if(r.length=n+1,i.type!=="text")continue;let o=i.content,l=0,a=o.length;e:for(;l<a;){hi.lastIndex=l;const c=hi.exec(o);if(!c)break;let f=!0,p=!0;l=c.index+1;const h=c[0]==="'";let d=32;if(c.index-1>=0)d=o.charCodeAt(c.index-1);else for(n=u-1;n>=0&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n--)if(t[n].content){d=t[n].content.charCodeAt(t[n].content.length-1);break}let m=32;if(l<a)m=o.charCodeAt(l);else for(n=u+1;n<t.length&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n++)if(t[n].content){m=t[n].content.charCodeAt(0);break}const g=Wt(d)||$t(String.fromCharCode(d)),b=Wt(m)||$t(String.fromCharCode(m)),k=Vt(d),y=Vt(m);if(y?f=!1:b&&(k||g||(f=!1)),k?p=!1:g&&(y||b||(p=!1)),m===34&&c[0]==='"'&&d>=48&&d<=57&&(p=f=!1),f&&p&&(f=g,p=b),!f&&!p){h&&(i.content=nn(i.content,c.index,pi));continue}if(p)for(n=r.length-1;n>=0;n--){let _=r[n];if(r[n].level<s)break;if(_.single===h&&r[n].level===s){_=r[n];let E,M;h?(E=e.md.options.quotes[2],M=e.md.options.quotes[3]):(E=e.md.options.quotes[0],M=e.md.options.quotes[1]),i.content=nn(i.content,c.index,M),t[_.token].content=nn(t[_.token].content,_.pos,E),l+=M.length-1,_.token===u&&(l+=E.length-1),o=i.content,a=o.length,r.length=n;continue e}}f?r.push({token:u,pos:c.index,single:h,level:s}):p&&h&&(i.content=nn(i.content,c.index,pi))}}}function m0(t){if(t.md.options.typographer)for(let e=t.tokens.length-1;e>=0;e--)t.tokens[e].type!=="inline"||!h0.test(t.tokens[e].content)||p0(t.tokens[e].children,t)}function g0(t){let e,n;const r=t.tokens,u=r.length;for(let i=0;i<u;i++){if(r[i].type!=="inline")continue;const s=r[i].children,o=s.length;for(e=0;e<o;e++)s[e].type==="text_special"&&(s[e].type="text");for(e=n=0;e<o;e++)s[e].type==="text"&&e+1<o&&s[e+1].type==="text"?s[e+1].content=s[e].content+s[e+1].content:(e!==n&&(s[n]=s[e]),n++);e!==n&&(s.length=n)}}const Xn=[["normalize",e0],["block",t0],["inline",n0],["linkify",i0],["replacements",d0],["smartquotes",m0],["text_join",g0]];function ru(){this.ruler=new Q;for(let t=0;t<Xn.length;t++)this.ruler.push(Xn[t][0],Xn[t][1])}ru.prototype.process=function(t){const e=this.ruler.getRules("");for(let n=0,r=e.length;n<r;n++)e[n](t)};ru.prototype.State=co;function De(t,e,n,r){this.src=t,this.md=e,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;const u=this.src;for(let i=0,s=0,o=0,l=0,a=u.length,c=!1;s<a;s++){const f=u.charCodeAt(s);if(!c)if(N(f)){o++,f===9?l+=4-l%4:l++;continue}else c=!0;(f===10||s===a-1)&&(f!==10&&s++,this.bMarks.push(i),this.eMarks.push(s),this.tShift.push(o),this.sCount.push(l),this.bsCount.push(0),c=!1,o=0,l=0,i=s+1)}this.bMarks.push(u.length),this.eMarks.push(u.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}De.prototype.push=function(t,e,n){const r=new de(t,e,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r};De.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};De.prototype.skipEmptyLines=function(e){for(let n=this.lineMax;e<n&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e};De.prototype.skipSpaces=function(e){for(let n=this.src.length;e<n;e++){const r=this.src.charCodeAt(e);if(!N(r))break}return e};De.prototype.skipSpacesBack=function(e,n){if(e<=n)return e;for(;e>n;)if(!N(this.src.charCodeAt(--e)))return e+1;return e};De.prototype.skipChars=function(e,n){for(let r=this.src.length;e<r&&this.src.charCodeAt(e)===n;e++);return e};De.prototype.skipCharsBack=function(e,n,r){if(e<=r)return e;for(;e>r;)if(n!==this.src.charCodeAt(--e))return e+1;return e};De.prototype.getLines=function(e,n,r,u){if(e>=n)return"";const i=new Array(n-e);for(let s=0,o=e;o<n;o++,s++){let l=0;const a=this.bMarks[o];let c=a,f;for(o+1<n||u?f=this.eMarks[o]+1:f=this.eMarks[o];c<f&&l<r;){const p=this.src.charCodeAt(c);if(N(p))p===9?l+=4-(l+this.bsCount[o])%4:l++;else if(c-a<this.tShift[o])l++;else break;c++}l>r?i[s]=new Array(l-r+1).join(" ")+this.src.slice(c,f):i[s]=this.src.slice(c,f)}return i.join("")};De.prototype.Token=de;const b0=65536;function Qn(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(n,r)}function mi(t){const e=[],n=t.length;let r=0,u=t.charCodeAt(r),i=!1,s=0,o="";for(;r<n;)u===124&&(i?(o+=t.substring(s,r-1),s=r):(e.push(o+t.substring(s,r)),o="",s=r+1)),i=u===92,r++,u=t.charCodeAt(r);return e.push(o+t.substring(s)),e}function x0(t,e,n,r){if(e+2>n)return!1;let u=e+1;if(t.sCount[u]<t.blkIndent||t.sCount[u]-t.blkIndent>=4)return!1;let i=t.bMarks[u]+t.tShift[u];if(i>=t.eMarks[u])return!1;const s=t.src.charCodeAt(i++);if(s!==124&&s!==45&&s!==58||i>=t.eMarks[u])return!1;const o=t.src.charCodeAt(i++);if(o!==124&&o!==45&&o!==58&&!N(o)||s===45&&N(o))return!1;for(;i<t.eMarks[u];){const _=t.src.charCodeAt(i);if(_!==124&&_!==45&&_!==58&&!N(_))return!1;i++}let l=Qn(t,e+1),a=l.split("|");const c=[];for(let _=0;_<a.length;_++){const E=a[_].trim();if(!E){if(_===0||_===a.length-1)continue;return!1}if(!/^:?-+:?$/.test(E))return!1;E.charCodeAt(E.length-1)===58?c.push(E.charCodeAt(0)===58?"center":"right"):E.charCodeAt(0)===58?c.push("left"):c.push("")}if(l=Qn(t,e).trim(),l.indexOf("|")===-1||t.sCount[e]-t.blkIndent>=4)return!1;a=mi(l),a.length&&a[0]===""&&a.shift(),a.length&&a[a.length-1]===""&&a.pop();const f=a.length;if(f===0||f!==c.length)return!1;if(r)return!0;const p=t.parentType;t.parentType="table";const h=t.md.block.ruler.getRules("blockquote"),d=t.push("table_open","table",1),m=[e,0];d.map=m;const g=t.push("thead_open","thead",1);g.map=[e,e+1];const b=t.push("tr_open","tr",1);b.map=[e,e+1];for(let _=0;_<a.length;_++){const E=t.push("th_open","th",1);c[_]&&(E.attrs=[["style","text-align:"+c[_]]]);const M=t.push("inline","",0);M.content=a[_].trim(),M.children=[],t.push("th_close","th",-1)}t.push("tr_close","tr",-1),t.push("thead_close","thead",-1);let k,y=0;for(u=e+2;u<n&&!(t.sCount[u]<t.blkIndent);u++){let _=!1;for(let M=0,C=h.length;M<C;M++)if(h[M](t,u,n,!0)){_=!0;break}if(_||(l=Qn(t,u).trim(),!l)||t.sCount[u]-t.blkIndent>=4||(a=mi(l),a.length&&a[0]===""&&a.shift(),a.length&&a[a.length-1]===""&&a.pop(),y+=f-a.length,y>b0))break;if(u===e+2){const M=t.push("tbody_open","tbody",1);M.map=k=[e+2,0]}const E=t.push("tr_open","tr",1);E.map=[u,u+1];for(let M=0;M<f;M++){const C=t.push("td_open","td",1);c[M]&&(C.attrs=[["style","text-align:"+c[M]]]);const w=t.push("inline","",0);w.content=a[M]?a[M].trim():"",w.children=[],t.push("td_close","td",-1)}t.push("tr_close","tr",-1)}return k&&(t.push("tbody_close","tbody",-1),k[1]=u),t.push("table_close","table",-1),m[1]=u,t.parentType=p,t.line=u,!0}function k0(t,e,n){if(t.sCount[e]-t.blkIndent<4)return!1;let r=e+1,u=r;for(;r<n;){if(t.isEmpty(r)){r++;continue}if(t.sCount[r]-t.blkIndent>=4){r++,u=r;continue}break}t.line=u;const i=t.push("code_block","code",0);return i.content=t.getLines(e,u,4+t.blkIndent,!1)+`
|
|
25
|
-
`,i.map=[e,t.line],!0}function y0(t,e,n,r){let u=t.bMarks[e]+t.tShift[e],i=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||u+3>i)return!1;const s=t.src.charCodeAt(u);if(s!==126&&s!==96)return!1;let o=u;u=t.skipChars(u,s);let l=u-o;if(l<3)return!1;const a=t.src.slice(o,u),c=t.src.slice(u,i);if(s===96&&c.indexOf(String.fromCharCode(s))>=0)return!1;if(r)return!0;let f=e,p=!1;for(;f++,!(f>=n||(u=o=t.bMarks[f]+t.tShift[f],i=t.eMarks[f],u<i&&t.sCount[f]<t.blkIndent));)if(t.src.charCodeAt(u)===s&&!(t.sCount[f]-t.blkIndent>=4)&&(u=t.skipChars(u,s),!(u-o<l)&&(u=t.skipSpaces(u),!(u<i)))){p=!0;break}l=t.sCount[e],t.line=f+(p?1:0);const h=t.push("fence","code",0);return h.info=c,h.content=t.getLines(e+1,f,l,!0),h.markup=a,h.map=[e,t.line],!0}function C0(t,e,n,r){let u=t.bMarks[e]+t.tShift[e],i=t.eMarks[e];const s=t.lineMax;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(u)!==62)return!1;if(r)return!0;const o=[],l=[],a=[],c=[],f=t.md.block.ruler.getRules("blockquote"),p=t.parentType;t.parentType="blockquote";let h=!1,d;for(d=e;d<n;d++){const y=t.sCount[d]<t.blkIndent;if(u=t.bMarks[d]+t.tShift[d],i=t.eMarks[d],u>=i)break;if(t.src.charCodeAt(u++)===62&&!y){let E=t.sCount[d]+1,M,C;t.src.charCodeAt(u)===32?(u++,E++,C=!1,M=!0):t.src.charCodeAt(u)===9?(M=!0,(t.bsCount[d]+E)%4===3?(u++,E++,C=!1):C=!0):M=!1;let w=E;for(o.push(t.bMarks[d]),t.bMarks[d]=u;u<i;){const I=t.src.charCodeAt(u);if(N(I))I===9?w+=4-(w+t.bsCount[d]+(C?1:0))%4:w++;else break;u++}h=u>=i,l.push(t.bsCount[d]),t.bsCount[d]=t.sCount[d]+1+(M?1:0),a.push(t.sCount[d]),t.sCount[d]=w-E,c.push(t.tShift[d]),t.tShift[d]=u-t.bMarks[d];continue}if(h)break;let _=!1;for(let E=0,M=f.length;E<M;E++)if(f[E](t,d,n,!0)){_=!0;break}if(_){t.lineMax=d,t.blkIndent!==0&&(o.push(t.bMarks[d]),l.push(t.bsCount[d]),c.push(t.tShift[d]),a.push(t.sCount[d]),t.sCount[d]-=t.blkIndent);break}o.push(t.bMarks[d]),l.push(t.bsCount[d]),c.push(t.tShift[d]),a.push(t.sCount[d]),t.sCount[d]=-1}const m=t.blkIndent;t.blkIndent=0;const g=t.push("blockquote_open","blockquote",1);g.markup=">";const b=[e,0];g.map=b,t.md.block.tokenize(t,e,d);const k=t.push("blockquote_close","blockquote",-1);k.markup=">",t.lineMax=s,t.parentType=p,b[1]=t.line;for(let y=0;y<c.length;y++)t.bMarks[y+e]=o[y],t.tShift[y+e]=c[y],t.sCount[y+e]=a[y],t.bsCount[y+e]=l[y];return t.blkIndent=m,!0}function D0(t,e,n,r){const u=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let i=t.bMarks[e]+t.tShift[e];const s=t.src.charCodeAt(i++);if(s!==42&&s!==45&&s!==95)return!1;let o=1;for(;i<u;){const a=t.src.charCodeAt(i++);if(a!==s&&!N(a))return!1;a===s&&o++}if(o<3)return!1;if(r)return!0;t.line=e+1;const l=t.push("hr","hr",0);return l.map=[e,t.line],l.markup=Array(o+1).join(String.fromCharCode(s)),!0}function gi(t,e){const n=t.eMarks[e];let r=t.bMarks[e]+t.tShift[e];const u=t.src.charCodeAt(r++);if(u!==42&&u!==45&&u!==43)return-1;if(r<n){const i=t.src.charCodeAt(r);if(!N(i))return-1}return r}function bi(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];let u=n;if(u+1>=r)return-1;let i=t.src.charCodeAt(u++);if(i<48||i>57)return-1;for(;;){if(u>=r)return-1;if(i=t.src.charCodeAt(u++),i>=48&&i<=57){if(u-n>=10)return-1;continue}if(i===41||i===46)break;return-1}return u<r&&(i=t.src.charCodeAt(u),!N(i))?-1:u}function _0(t,e){const n=t.level+2;for(let r=e+2,u=t.tokens.length-2;r<u;r++)t.tokens[r].level===n&&t.tokens[r].type==="paragraph_open"&&(t.tokens[r+2].hidden=!0,t.tokens[r].hidden=!0,r+=2)}function E0(t,e,n,r){let u,i,s,o,l=e,a=!0;if(t.sCount[l]-t.blkIndent>=4||t.listIndent>=0&&t.sCount[l]-t.listIndent>=4&&t.sCount[l]<t.blkIndent)return!1;let c=!1;r&&t.parentType==="paragraph"&&t.sCount[l]>=t.blkIndent&&(c=!0);let f,p,h;if((h=bi(t,l))>=0){if(f=!0,s=t.bMarks[l]+t.tShift[l],p=Number(t.src.slice(s,h-1)),c&&p!==1)return!1}else if((h=gi(t,l))>=0)f=!1;else return!1;if(c&&t.skipSpaces(h)>=t.eMarks[l])return!1;if(r)return!0;const d=t.src.charCodeAt(h-1),m=t.tokens.length;f?(o=t.push("ordered_list_open","ol",1),p!==1&&(o.attrs=[["start",p]])):o=t.push("bullet_list_open","ul",1);const g=[l,0];o.map=g,o.markup=String.fromCharCode(d);let b=!1;const k=t.md.block.ruler.getRules("list"),y=t.parentType;for(t.parentType="list";l<n;){i=h,u=t.eMarks[l];const _=t.sCount[l]+h-(t.bMarks[l]+t.tShift[l]);let E=_;for(;i<u;){const we=t.src.charCodeAt(i);if(we===9)E+=4-(E+t.bsCount[l])%4;else if(we===32)E++;else break;i++}const M=i;let C;M>=u?C=1:C=E-_,C>4&&(C=1);const w=_+C;o=t.push("list_item_open","li",1),o.markup=String.fromCharCode(d);const I=[l,0];o.map=I,f&&(o.info=t.src.slice(s,h-1));const ee=t.tight,Je=t.tShift[l],In=t.sCount[l],Rn=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=w,t.tight=!0,t.tShift[l]=M-t.bMarks[l],t.sCount[l]=E,M>=u&&t.isEmpty(l+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,l,n,!0),(!t.tight||b)&&(a=!1),b=t.line-l>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=Rn,t.tShift[l]=Je,t.sCount[l]=In,t.tight=ee,o=t.push("list_item_close","li",-1),o.markup=String.fromCharCode(d),l=t.line,I[1]=l,l>=n||t.sCount[l]<t.blkIndent||t.sCount[l]-t.blkIndent>=4)break;let it=!1;for(let we=0,Bn=k.length;we<Bn;we++)if(k[we](t,l,n,!0)){it=!0;break}if(it)break;if(f){if(h=bi(t,l),h<0)break;s=t.bMarks[l]+t.tShift[l]}else if(h=gi(t,l),h<0)break;if(d!==t.src.charCodeAt(h-1))break}return f?o=t.push("ordered_list_close","ol",-1):o=t.push("bullet_list_close","ul",-1),o.markup=String.fromCharCode(d),g[1]=l,t.line=l,t.parentType=y,a&&_0(t,m),!0}function S0(t,e,n,r){let u=t.bMarks[e]+t.tShift[e],i=t.eMarks[e],s=e+1;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(u)!==91)return!1;function o(k){const y=t.lineMax;if(k>=y||t.isEmpty(k))return null;let _=!1;if(t.sCount[k]-t.blkIndent>3&&(_=!0),t.sCount[k]<0&&(_=!0),!_){const C=t.md.block.ruler.getRules("reference"),w=t.parentType;t.parentType="reference";let I=!1;for(let ee=0,Je=C.length;ee<Je;ee++)if(C[ee](t,k,y,!0)){I=!0;break}if(t.parentType=w,I)return null}const E=t.bMarks[k]+t.tShift[k],M=t.eMarks[k];return t.src.slice(E,M+1)}let l=t.src.slice(u,i+1);i=l.length;let a=-1;for(u=1;u<i;u++){const k=l.charCodeAt(u);if(k===91)return!1;if(k===93){a=u;break}else if(k===10){const y=o(s);y!==null&&(l+=y,i=l.length,s++)}else if(k===92&&(u++,u<i&&l.charCodeAt(u)===10)){const y=o(s);y!==null&&(l+=y,i=l.length,s++)}}if(a<0||l.charCodeAt(a+1)!==58)return!1;for(u=a+2;u<i;u++){const k=l.charCodeAt(u);if(k===10){const y=o(s);y!==null&&(l+=y,i=l.length,s++)}else if(!N(k))break}const c=t.md.helpers.parseLinkDestination(l,u,i);if(!c.ok)return!1;const f=t.md.normalizeLink(c.str);if(!t.md.validateLink(f))return!1;u=c.pos;const p=u,h=s,d=u;for(;u<i;u++){const k=l.charCodeAt(u);if(k===10){const y=o(s);y!==null&&(l+=y,i=l.length,s++)}else if(!N(k))break}let m=t.md.helpers.parseLinkTitle(l,u,i);for(;m.can_continue;){const k=o(s);if(k===null)break;l+=k,u=i,i=l.length,s++,m=t.md.helpers.parseLinkTitle(l,u,i,m)}let g;for(u<i&&d!==u&&m.ok?(g=m.str,u=m.pos):(g="",u=p,s=h);u<i;){const k=l.charCodeAt(u);if(!N(k))break;u++}if(u<i&&l.charCodeAt(u)!==10&&g)for(g="",u=p,s=h;u<i;){const k=l.charCodeAt(u);if(!N(k))break;u++}if(u<i&&l.charCodeAt(u)!==10)return!1;const b=On(l.slice(1,a));return b?(r||(typeof t.env.references>"u"&&(t.env.references={}),typeof t.env.references[b]>"u"&&(t.env.references[b]={title:g,href:f}),t.line=s),!0):!1}const A0=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],M0="[a-zA-Z_:][a-zA-Z0-9:._-]*",w0="[^\"'=<>`\\x00-\\x20]+",T0="'[^']*'",O0='"[^"]*"',F0="(?:"+w0+"|"+T0+"|"+O0+")",N0="(?:\\s+"+M0+"(?:\\s*=\\s*"+F0+")?)",ho="<[A-Za-z][A-Za-z0-9\\-]*"+N0+"*\\s*\\/?>",po="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",I0="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",R0="<[?][\\s\\S]*?[?]>",B0="<![A-Za-z][^>]*>",z0="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",v0=new RegExp("^(?:"+ho+"|"+po+"|"+I0+"|"+R0+"|"+B0+"|"+z0+")"),P0=new RegExp("^(?:"+ho+"|"+po+")"),lt=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+A0.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(P0.source+"\\s*$"),/^$/,!1]];function L0(t,e,n,r){let u=t.bMarks[e]+t.tShift[e],i=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(u)!==60)return!1;let s=t.src.slice(u,i),o=0;for(;o<lt.length&&!lt[o][0].test(s);o++);if(o===lt.length)return!1;if(r)return lt[o][2];let l=e+1;if(!lt[o][1].test(s)){for(;l<n&&!(t.sCount[l]<t.blkIndent);l++)if(u=t.bMarks[l]+t.tShift[l],i=t.eMarks[l],s=t.src.slice(u,i),lt[o][1].test(s)){s.length!==0&&l++;break}}t.line=l;const a=t.push("html_block","",0);return a.map=[e,l],a.content=t.getLines(e,l,t.blkIndent,!0),!0}function q0(t,e,n,r){let u=t.bMarks[e]+t.tShift[e],i=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let s=t.src.charCodeAt(u);if(s!==35||u>=i)return!1;let o=1;for(s=t.src.charCodeAt(++u);s===35&&u<i&&o<=6;)o++,s=t.src.charCodeAt(++u);if(o>6||u<i&&!N(s))return!1;if(r)return!0;i=t.skipSpacesBack(i,u);const l=t.skipCharsBack(i,35,u);l>u&&N(t.src.charCodeAt(l-1))&&(i=l),t.line=e+1;const a=t.push("heading_open","h"+String(o),1);a.markup="########".slice(0,o),a.map=[e,t.line];const c=t.push("inline","",0);c.content=t.src.slice(u,i).trim(),c.map=[e,t.line],c.children=[];const f=t.push("heading_close","h"+String(o),-1);return f.markup="########".slice(0,o),!0}function V0(t,e,n){const r=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;const u=t.parentType;t.parentType="paragraph";let i=0,s,o=e+1;for(;o<n&&!t.isEmpty(o);o++){if(t.sCount[o]-t.blkIndent>3)continue;if(t.sCount[o]>=t.blkIndent){let h=t.bMarks[o]+t.tShift[o];const d=t.eMarks[o];if(h<d&&(s=t.src.charCodeAt(h),(s===45||s===61)&&(h=t.skipChars(h,s),h=t.skipSpaces(h),h>=d))){i=s===61?1:2;break}}if(t.sCount[o]<0)continue;let p=!1;for(let h=0,d=r.length;h<d;h++)if(r[h](t,o,n,!0)){p=!0;break}if(p)break}if(!i)return!1;const l=t.getLines(e,o,t.blkIndent,!1).trim();t.line=o+1;const a=t.push("heading_open","h"+String(i),1);a.markup=String.fromCharCode(s),a.map=[e,t.line];const c=t.push("inline","",0);c.content=l,c.map=[e,t.line-1],c.children=[];const f=t.push("heading_close","h"+String(i),-1);return f.markup=String.fromCharCode(s),t.parentType=u,!0}function $0(t,e,n){const r=t.md.block.ruler.getRules("paragraph"),u=t.parentType;let i=e+1;for(t.parentType="paragraph";i<n&&!t.isEmpty(i);i++){if(t.sCount[i]-t.blkIndent>3||t.sCount[i]<0)continue;let a=!1;for(let c=0,f=r.length;c<f;c++)if(r[c](t,i,n,!0)){a=!0;break}if(a)break}const s=t.getLines(e,i,t.blkIndent,!1).trim();t.line=i;const o=t.push("paragraph_open","p",1);o.map=[e,t.line];const l=t.push("inline","",0);return l.content=s,l.map=[e,t.line],l.children=[],t.push("paragraph_close","p",-1),t.parentType=u,!0}const rn=[["table",x0,["paragraph","reference"]],["code",k0],["fence",y0,["paragraph","reference","blockquote","list"]],["blockquote",C0,["paragraph","reference","blockquote","list"]],["hr",D0,["paragraph","reference","blockquote","list"]],["list",E0,["paragraph","reference","blockquote"]],["reference",S0],["html_block",L0,["paragraph","reference","blockquote"]],["heading",q0,["paragraph","reference","blockquote"]],["lheading",V0],["paragraph",$0]];function Fn(){this.ruler=new Q;for(let t=0;t<rn.length;t++)this.ruler.push(rn[t][0],rn[t][1],{alt:(rn[t][2]||[]).slice()})}Fn.prototype.tokenize=function(t,e,n){const r=this.ruler.getRules(""),u=r.length,i=t.md.options.maxNesting;let s=e,o=!1;for(;s<n&&(t.line=s=t.skipEmptyLines(s),!(s>=n||t.sCount[s]<t.blkIndent));){if(t.level>=i){t.line=n;break}const l=t.line;let a=!1;for(let c=0;c<u;c++)if(a=r[c](t,s,n,!1),a){if(l>=t.line)throw new Error("block rule didn't increment state.line");break}if(!a)throw new Error("none of the block rules matched");t.tight=!o,t.isEmpty(t.line-1)&&(o=!0),s=t.line,s<n&&t.isEmpty(s)&&(o=!0,s++,t.line=s)}};Fn.prototype.parse=function(t,e,n,r){if(!t)return;const u=new this.State(t,e,n,r);this.tokenize(u,u.line,u.lineMax)};Fn.prototype.State=De;function Zt(t,e,n,r){this.src=t,this.env=n,this.md=e,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}Zt.prototype.pushPending=function(){const t=new de("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t};Zt.prototype.push=function(t,e,n){this.pending&&this.pushPending();const r=new de(t,e,n);let u=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],u={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(u),r};Zt.prototype.scanDelims=function(t,e){const n=this.posMax,r=this.src.charCodeAt(t),u=t>0?this.src.charCodeAt(t-1):32;let i=t;for(;i<n&&this.src.charCodeAt(i)===r;)i++;const s=i-t,o=i<n?this.src.charCodeAt(i):32,l=Wt(u)||$t(String.fromCharCode(u)),a=Wt(o)||$t(String.fromCharCode(o)),c=Vt(u),f=Vt(o),p=!f&&(!a||c||l),h=!c&&(!l||f||a);return{can_open:p&&(e||!h||l),can_close:h&&(e||!p||a),length:s}};Zt.prototype.Token=de;function W0(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function H0(t,e){let n=t.pos;for(;n<t.posMax&&!W0(t.src.charCodeAt(n));)n++;return n===t.pos?!1:(e||(t.pending+=t.src.slice(t.pos,n)),t.pos=n,!0)}const J0=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function j0(t,e){if(!t.md.options.linkify||t.linkLevel>0)return!1;const n=t.pos,r=t.posMax;if(n+3>r||t.src.charCodeAt(n)!==58||t.src.charCodeAt(n+1)!==47||t.src.charCodeAt(n+2)!==47)return!1;const u=t.pending.match(J0);if(!u)return!1;const i=u[1],s=t.md.linkify.matchAtStart(t.src.slice(n-i.length));if(!s)return!1;let o=s.url;if(o.length<=i.length)return!1;o=o.replace(/\*+$/,"");const l=t.md.normalizeLink(o);if(!t.md.validateLink(l))return!1;if(!e){t.pending=t.pending.slice(0,-i.length);const a=t.push("link_open","a",1);a.attrs=[["href",l]],a.markup="linkify",a.info="auto";const c=t.push("text","",0);c.content=t.md.normalizeLinkText(o);const f=t.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return t.pos+=o.length-i.length,!0}function U0(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==10)return!1;const r=t.pending.length-1,u=t.posMax;if(!e)if(r>=0&&t.pending.charCodeAt(r)===32)if(r>=1&&t.pending.charCodeAt(r-1)===32){let i=r-1;for(;i>=1&&t.pending.charCodeAt(i-1)===32;)i--;t.pending=t.pending.slice(0,i),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(n++;n<u&&N(t.src.charCodeAt(n));)n++;return t.pos=n,!0}const uu=[];for(let t=0;t<256;t++)uu.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){uu[t.charCodeAt(0)]=1});function K0(t,e){let n=t.pos;const r=t.posMax;if(t.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let u=t.src.charCodeAt(n);if(u===10){for(e||t.push("hardbreak","br",0),n++;n<r&&(u=t.src.charCodeAt(n),!!N(u));)n++;return t.pos=n,!0}let i=t.src[n];if(u>=55296&&u<=56319&&n+1<r){const o=t.src.charCodeAt(n+1);o>=56320&&o<=57343&&(i+=t.src[n+1],n++)}const s="\\"+i;if(!e){const o=t.push("text_special","",0);u<256&&uu[u]!==0?o.content=i:o.content=s,o.markup=s,o.info="escape"}return t.pos=n+1,!0}function G0(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==96)return!1;const u=n;n++;const i=t.posMax;for(;n<i&&t.src.charCodeAt(n)===96;)n++;const s=t.src.slice(u,n),o=s.length;if(t.backticksScanned&&(t.backticks[o]||0)<=u)return e||(t.pending+=s),t.pos+=o,!0;let l=n,a;for(;(a=t.src.indexOf("`",l))!==-1;){for(l=a+1;l<i&&t.src.charCodeAt(l)===96;)l++;const c=l-a;if(c===o){if(!e){const f=t.push("code_inline","code",0);f.markup=s,f.content=t.src.slice(n,a).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return t.pos=l,!0}t.backticks[c]=a}return t.backticksScanned=!0,e||(t.pending+=s),t.pos+=o,!0}function Z0(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==126)return!1;const u=t.scanDelims(t.pos,!0);let i=u.length;const s=String.fromCharCode(r);if(i<2)return!1;let o;i%2&&(o=t.push("text","",0),o.content=s,i--);for(let l=0;l<i;l+=2)o=t.push("text","",0),o.content=s+s,t.delimiters.push({marker:r,length:0,token:t.tokens.length-1,end:-1,open:u.can_open,close:u.can_close});return t.pos+=u.length,!0}function xi(t,e){let n;const r=[],u=e.length;for(let i=0;i<u;i++){const s=e[i];if(s.marker!==126||s.end===-1)continue;const o=e[s.end];n=t.tokens[s.token],n.type="s_open",n.tag="s",n.nesting=1,n.markup="~~",n.content="",n=t.tokens[o.token],n.type="s_close",n.tag="s",n.nesting=-1,n.markup="~~",n.content="",t.tokens[o.token-1].type==="text"&&t.tokens[o.token-1].content==="~"&&r.push(o.token-1)}for(;r.length;){const i=r.pop();let s=i+1;for(;s<t.tokens.length&&t.tokens[s].type==="s_close";)s++;s--,i!==s&&(n=t.tokens[s],t.tokens[s]=t.tokens[i],t.tokens[i]=n)}}function Y0(t){const e=t.tokens_meta,n=t.tokens_meta.length;xi(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&xi(t,e[r].delimiters)}const mo={tokenize:Z0,postProcess:Y0};function X0(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==95&&r!==42)return!1;const u=t.scanDelims(t.pos,r===42);for(let i=0;i<u.length;i++){const s=t.push("text","",0);s.content=String.fromCharCode(r),t.delimiters.push({marker:r,length:u.length,token:t.tokens.length-1,end:-1,open:u.can_open,close:u.can_close})}return t.pos+=u.length,!0}function ki(t,e){const n=e.length;for(let r=n-1;r>=0;r--){const u=e[r];if(u.marker!==95&&u.marker!==42||u.end===-1)continue;const i=e[u.end],s=r>0&&e[r-1].end===u.end+1&&e[r-1].marker===u.marker&&e[r-1].token===u.token-1&&e[u.end+1].token===i.token+1,o=String.fromCharCode(u.marker),l=t.tokens[u.token];l.type=s?"strong_open":"em_open",l.tag=s?"strong":"em",l.nesting=1,l.markup=s?o+o:o,l.content="";const a=t.tokens[i.token];a.type=s?"strong_close":"em_close",a.tag=s?"strong":"em",a.nesting=-1,a.markup=s?o+o:o,a.content="",s&&(t.tokens[e[r-1].token].content="",t.tokens[e[u.end+1].token].content="",r--)}}function Q0(t){const e=t.tokens_meta,n=t.tokens_meta.length;ki(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&ki(t,e[r].delimiters)}const go={tokenize:X0,postProcess:Q0};function ed(t,e){let n,r,u,i,s="",o="",l=t.pos,a=!0;if(t.src.charCodeAt(t.pos)!==91)return!1;const c=t.pos,f=t.posMax,p=t.pos+1,h=t.md.helpers.parseLinkLabel(t,t.pos,!0);if(h<0)return!1;let d=h+1;if(d<f&&t.src.charCodeAt(d)===40){for(a=!1,d++;d<f&&(n=t.src.charCodeAt(d),!(!N(n)&&n!==10));d++);if(d>=f)return!1;if(l=d,u=t.md.helpers.parseLinkDestination(t.src,d,t.posMax),u.ok){for(s=t.md.normalizeLink(u.str),t.md.validateLink(s)?d=u.pos:s="",l=d;d<f&&(n=t.src.charCodeAt(d),!(!N(n)&&n!==10));d++);if(u=t.md.helpers.parseLinkTitle(t.src,d,t.posMax),d<f&&l!==d&&u.ok)for(o=u.str,d=u.pos;d<f&&(n=t.src.charCodeAt(d),!(!N(n)&&n!==10));d++);}(d>=f||t.src.charCodeAt(d)!==41)&&(a=!0),d++}if(a){if(typeof t.env.references>"u")return!1;if(d<f&&t.src.charCodeAt(d)===91?(l=d+1,d=t.md.helpers.parseLinkLabel(t,d),d>=0?r=t.src.slice(l,d++):d=h+1):d=h+1,r||(r=t.src.slice(p,h)),i=t.env.references[On(r)],!i)return t.pos=c,!1;s=i.href,o=i.title}if(!e){t.pos=p,t.posMax=h;const m=t.push("link_open","a",1),g=[["href",s]];m.attrs=g,o&&g.push(["title",o]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=d,t.posMax=f,!0}function td(t,e){let n,r,u,i,s,o,l,a,c="";const f=t.pos,p=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;const h=t.pos+2,d=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(d<0)return!1;if(i=d+1,i<p&&t.src.charCodeAt(i)===40){for(i++;i<p&&(n=t.src.charCodeAt(i),!(!N(n)&&n!==10));i++);if(i>=p)return!1;for(a=i,o=t.md.helpers.parseLinkDestination(t.src,i,t.posMax),o.ok&&(c=t.md.normalizeLink(o.str),t.md.validateLink(c)?i=o.pos:c=""),a=i;i<p&&(n=t.src.charCodeAt(i),!(!N(n)&&n!==10));i++);if(o=t.md.helpers.parseLinkTitle(t.src,i,t.posMax),i<p&&a!==i&&o.ok)for(l=o.str,i=o.pos;i<p&&(n=t.src.charCodeAt(i),!(!N(n)&&n!==10));i++);else l="";if(i>=p||t.src.charCodeAt(i)!==41)return t.pos=f,!1;i++}else{if(typeof t.env.references>"u")return!1;if(i<p&&t.src.charCodeAt(i)===91?(a=i+1,i=t.md.helpers.parseLinkLabel(t,i),i>=0?u=t.src.slice(a,i++):i=d+1):i=d+1,u||(u=t.src.slice(h,d)),s=t.env.references[On(u)],!s)return t.pos=f,!1;c=s.href,l=s.title}if(!e){r=t.src.slice(h,d);const m=[];t.md.inline.parse(r,t.md,t.env,m);const g=t.push("image","img",0),b=[["src",c],["alt",""]];g.attrs=b,g.children=m,g.content=r,l&&b.push(["title",l])}return t.pos=i,t.posMax=p,!0}const nd=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,rd=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function ud(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==60)return!1;const r=t.pos,u=t.posMax;for(;;){if(++n>=u)return!1;const s=t.src.charCodeAt(n);if(s===60)return!1;if(s===62)break}const i=t.src.slice(r+1,n);if(rd.test(i)){const s=t.md.normalizeLink(i);if(!t.md.validateLink(s))return!1;if(!e){const o=t.push("link_open","a",1);o.attrs=[["href",s]],o.markup="autolink",o.info="auto";const l=t.push("text","",0);l.content=t.md.normalizeLinkText(i);const a=t.push("link_close","a",-1);a.markup="autolink",a.info="auto"}return t.pos+=i.length+2,!0}if(nd.test(i)){const s=t.md.normalizeLink("mailto:"+i);if(!t.md.validateLink(s))return!1;if(!e){const o=t.push("link_open","a",1);o.attrs=[["href",s]],o.markup="autolink",o.info="auto";const l=t.push("text","",0);l.content=t.md.normalizeLinkText(i);const a=t.push("link_close","a",-1);a.markup="autolink",a.info="auto"}return t.pos+=i.length+2,!0}return!1}function id(t){return/^<a[>\s]/i.test(t)}function sd(t){return/^<\/a\s*>/i.test(t)}function od(t){const e=t|32;return e>=97&&e<=122}function ld(t,e){if(!t.md.options.html)return!1;const n=t.posMax,r=t.pos;if(t.src.charCodeAt(r)!==60||r+2>=n)return!1;const u=t.src.charCodeAt(r+1);if(u!==33&&u!==63&&u!==47&&!od(u))return!1;const i=t.src.slice(r).match(v0);if(!i)return!1;if(!e){const s=t.push("html_inline","",0);s.content=i[0],id(s.content)&&t.linkLevel++,sd(s.content)&&t.linkLevel--}return t.pos+=i[0].length,!0}const ad=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,cd=/^&([a-z][a-z0-9]{1,31});/i;function fd(t,e){const n=t.pos,r=t.posMax;if(t.src.charCodeAt(n)!==38||n+1>=r)return!1;if(t.src.charCodeAt(n+1)===35){const i=t.src.slice(n).match(ad);if(i){if(!e){const s=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),o=t.push("text_special","",0);o.content=nu(s)?yn(s):yn(65533),o.markup=i[0],o.info="entity"}return t.pos+=i[0].length,!0}}else{const i=t.src.slice(n).match(cd);if(i){const s=oo(i[0]);if(s!==i[0]){if(!e){const o=t.push("text_special","",0);o.content=s,o.markup=i[0],o.info="entity"}return t.pos+=i[0].length,!0}}}return!1}function yi(t){const e={},n=t.length;if(!n)return;let r=0,u=-2;const i=[];for(let s=0;s<n;s++){const o=t[s];if(i.push(0),(t[r].marker!==o.marker||u!==o.token-1)&&(r=s),u=o.token,o.length=o.length||0,!o.close)continue;e.hasOwnProperty(o.marker)||(e[o.marker]=[-1,-1,-1,-1,-1,-1]);const l=e[o.marker][(o.open?3:0)+o.length%3];let a=r-i[r]-1,c=a;for(;a>l;a-=i[a]+1){const f=t[a];if(f.marker===o.marker&&f.open&&f.end<0){let p=!1;if((f.close||o.open)&&(f.length+o.length)%3===0&&(f.length%3!==0||o.length%3!==0)&&(p=!0),!p){const h=a>0&&!t[a-1].open?i[a-1]+1:0;i[s]=s-a+h,i[a]=h,o.open=!1,f.end=s,f.close=!1,c=-1,u=-2;break}}}c!==-1&&(e[o.marker][(o.open?3:0)+(o.length||0)%3]=c)}}function dd(t){const e=t.tokens_meta,n=t.tokens_meta.length;yi(t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&yi(e[r].delimiters)}function hd(t){let e,n,r=0;const u=t.tokens,i=t.tokens.length;for(e=n=0;e<i;e++)u[e].nesting<0&&r--,u[e].level=r,u[e].nesting>0&&r++,u[e].type==="text"&&e+1<i&&u[e+1].type==="text"?u[e+1].content=u[e].content+u[e+1].content:(e!==n&&(u[n]=u[e]),n++);e!==n&&(u.length=n)}const er=[["text",H0],["linkify",j0],["newline",U0],["escape",K0],["backticks",G0],["strikethrough",mo.tokenize],["emphasis",go.tokenize],["link",ed],["image",td],["autolink",ud],["html_inline",ld],["entity",fd]],tr=[["balance_pairs",dd],["strikethrough",mo.postProcess],["emphasis",go.postProcess],["fragments_join",hd]];function Yt(){this.ruler=new Q;for(let t=0;t<er.length;t++)this.ruler.push(er[t][0],er[t][1]);this.ruler2=new Q;for(let t=0;t<tr.length;t++)this.ruler2.push(tr[t][0],tr[t][1])}Yt.prototype.skipToken=function(t){const e=t.pos,n=this.ruler.getRules(""),r=n.length,u=t.md.options.maxNesting,i=t.cache;if(typeof i[e]<"u"){t.pos=i[e];return}let s=!1;if(t.level<u){for(let o=0;o<r;o++)if(t.level++,s=n[o](t,!0),t.level--,s){if(e>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;s||t.pos++,i[e]=t.pos};Yt.prototype.tokenize=function(t){const e=this.ruler.getRules(""),n=e.length,r=t.posMax,u=t.md.options.maxNesting;for(;t.pos<r;){const i=t.pos;let s=!1;if(t.level<u){for(let o=0;o<n;o++)if(s=e[o](t,!1),s){if(i>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(s){if(t.pos>=r)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};Yt.prototype.parse=function(t,e,n,r){const u=new this.State(t,e,n,r);this.tokenize(u);const i=this.ruler2.getRules(""),s=i.length;for(let o=0;o<s;o++)i[o](u)};Yt.prototype.State=Zt;function pd(t){const e={};t=t||{},e.src_Any=no.source,e.src_Cc=ro.source,e.src_Z=io.source,e.src_P=eu.source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");const n="[><|]";return e.src_pseudo_letter="(?:(?!"+n+"|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+n+"|"+e.src_ZPCc+")(?!"+(t["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]|$)|"+(t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+"|$)|;(?!"+e.src_ZCc+"|$)|\\!+(?!"+e.src_ZCc+"|[!]|$)|\\?(?!"+e.src_ZCc+"|[?]|$))+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}function Tr(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){t[r]=n[r]})}),t}function Nn(t){return Object.prototype.toString.call(t)}function md(t){return Nn(t)==="[object String]"}function gd(t){return Nn(t)==="[object Object]"}function bd(t){return Nn(t)==="[object RegExp]"}function Ci(t){return Nn(t)==="[object Function]"}function xd(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const bo={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function kd(t){return Object.keys(t||{}).reduce(function(e,n){return e||bo.hasOwnProperty(n)},!1)}const yd={"http:":{validate:function(t,e,n){const r=t.slice(e);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,n){const r=t.slice(e);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,n){const r=t.slice(e);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},Cd="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",Dd="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function _d(t){t.__index__=-1,t.__text_cache__=""}function Ed(t){return function(e,n){const r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}function Di(){return function(t,e){e.normalize(t)}}function Cn(t){const e=t.re=pd(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(Cd),n.push(e.src_xn),e.src_tlds=n.join("|");function r(o){return o.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(r(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(r(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(r(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(r(e.tpl_host_fuzzy_test),"i");const u=[];t.__compiled__={};function i(o,l){throw new Error('(LinkifyIt) Invalid schema "'+o+'": '+l)}Object.keys(t.__schemas__).forEach(function(o){const l=t.__schemas__[o];if(l===null)return;const a={validate:null,link:null};if(t.__compiled__[o]=a,gd(l)){bd(l.validate)?a.validate=Ed(l.validate):Ci(l.validate)?a.validate=l.validate:i(o,l),Ci(l.normalize)?a.normalize=l.normalize:l.normalize?i(o,l):a.normalize=Di();return}if(md(l)){u.push(o);return}i(o,l)}),u.forEach(function(o){t.__compiled__[t.__schemas__[o]]&&(t.__compiled__[o].validate=t.__compiled__[t.__schemas__[o]].validate,t.__compiled__[o].normalize=t.__compiled__[t.__schemas__[o]].normalize)}),t.__compiled__[""]={validate:null,normalize:Di()};const s=Object.keys(t.__compiled__).filter(function(o){return o.length>0&&t.__compiled__[o]}).map(xd).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+s+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+s+")","ig"),t.re.schema_at_start=RegExp("^"+t.re.schema_search.source,"i"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),_d(t)}function Sd(t,e){const n=t.__index__,r=t.__last_index__,u=t.__text_cache__.slice(n,r);this.schema=t.__schema__.toLowerCase(),this.index=n+e,this.lastIndex=r+e,this.raw=u,this.text=u,this.url=u}function Or(t,e){const n=new Sd(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function re(t,e){if(!(this instanceof re))return new re(t,e);e||kd(t)&&(e=t,t={}),this.__opts__=Tr({},bo,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Tr({},yd,t),this.__compiled__={},this.__tlds__=Dd,this.__tlds_replaced__=!1,this.re={},Cn(this)}re.prototype.add=function(e,n){return this.__schemas__[e]=n,Cn(this),this};re.prototype.set=function(e){return this.__opts__=Tr(this.__opts__,e),this};re.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let n,r,u,i,s,o,l,a,c;if(this.re.schema_test.test(e)){for(l=this.re.schema_search,l.lastIndex=0;(n=l.exec(e))!==null;)if(i=this.testSchemaAt(e,n[2],l.lastIndex),i){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(a=e.search(this.re.host_fuzzy_test),a>=0&&(this.__index__<0||a<this.__index__)&&(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(s=r.index+r[1].length,(this.__index__<0||s<this.__index__)&&(this.__schema__="",this.__index__=s,this.__last_index__=r.index+r[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(c=e.indexOf("@"),c>=0&&(u=e.match(this.re.email_fuzzy))!==null&&(s=u.index+u[1].length,o=u.index+u[0].length,(this.__index__<0||s<this.__index__||s===this.__index__&&o>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=o))),this.__index__>=0};re.prototype.pretest=function(e){return this.re.pretest.test(e)};re.prototype.testSchemaAt=function(e,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(e,r,this):0};re.prototype.match=function(e){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===e&&(n.push(Or(this,r)),r=this.__last_index__);let u=r?e.slice(r):e;for(;this.test(u);)n.push(Or(this,r)),u=u.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};re.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const n=this.re.schema_at_start.exec(e);if(!n)return null;const r=this.testSchemaAt(e,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,Or(this,0)):null};re.prototype.tlds=function(e,n){return e=Array.isArray(e)?e:[e],n?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(r,u,i){return r!==i[u-1]}).reverse(),Cn(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,Cn(this),this)};re.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};re.prototype.onCompile=function(){};const ht=2147483647,ge=36,iu=1,Ht=26,Ad=38,Md=700,xo=72,ko=128,yo="-",wd=/^xn--/,Td=/[^\0-\x7F]/,Od=/[\x2E\u3002\uFF0E\uFF61]/g,Fd={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},nr=ge-iu,be=Math.floor,rr=String.fromCharCode;function Fe(t){throw new RangeError(Fd[t])}function Nd(t,e){const n=[];let r=t.length;for(;r--;)n[r]=e(t[r]);return n}function Co(t,e){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(Od,".");const u=t.split("."),i=Nd(u,e).join(".");return r+i}function Do(t){const e=[];let n=0;const r=t.length;for(;n<r;){const u=t.charCodeAt(n++);if(u>=55296&&u<=56319&&n<r){const i=t.charCodeAt(n++);(i&64512)==56320?e.push(((u&1023)<<10)+(i&1023)+65536):(e.push(u),n--)}else e.push(u)}return e}const Id=t=>String.fromCodePoint(...t),Rd=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:ge},_i=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},_o=function(t,e,n){let r=0;for(t=n?be(t/Md):t>>1,t+=be(t/e);t>nr*Ht>>1;r+=ge)t=be(t/nr);return be(r+(nr+1)*t/(t+Ad))},Eo=function(t){const e=[],n=t.length;let r=0,u=ko,i=xo,s=t.lastIndexOf(yo);s<0&&(s=0);for(let o=0;o<s;++o)t.charCodeAt(o)>=128&&Fe("not-basic"),e.push(t.charCodeAt(o));for(let o=s>0?s+1:0;o<n;){const l=r;for(let c=1,f=ge;;f+=ge){o>=n&&Fe("invalid-input");const p=Rd(t.charCodeAt(o++));p>=ge&&Fe("invalid-input"),p>be((ht-r)/c)&&Fe("overflow"),r+=p*c;const h=f<=i?iu:f>=i+Ht?Ht:f-i;if(p<h)break;const d=ge-h;c>be(ht/d)&&Fe("overflow"),c*=d}const a=e.length+1;i=_o(r-l,a,l==0),be(r/a)>ht-u&&Fe("overflow"),u+=be(r/a),r%=a,e.splice(r++,0,u)}return String.fromCodePoint(...e)},So=function(t){const e=[];t=Do(t);const n=t.length;let r=ko,u=0,i=xo;for(const l of t)l<128&&e.push(rr(l));const s=e.length;let o=s;for(s&&e.push(yo);o<n;){let l=ht;for(const c of t)c>=r&&c<l&&(l=c);const a=o+1;l-r>be((ht-u)/a)&&Fe("overflow"),u+=(l-r)*a,r=l;for(const c of t)if(c<r&&++u>ht&&Fe("overflow"),c===r){let f=u;for(let p=ge;;p+=ge){const h=p<=i?iu:p>=i+Ht?Ht:p-i;if(f<h)break;const d=f-h,m=ge-h;e.push(rr(_i(h+d%m,0))),f=be(d/m)}e.push(rr(_i(f,0))),i=_o(u,a,o===s),u=0,++o}++u,++r}return e.join("")},Bd=function(t){return Co(t,function(e){return wd.test(e)?Eo(e.slice(4).toLowerCase()):e})},zd=function(t){return Co(t,function(e){return Td.test(e)?"xn--"+So(e):e})},Ao={version:"2.3.1",ucs2:{decode:Do,encode:Id},decode:Eo,encode:So,toASCII:zd,toUnicode:Bd},vd={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},Pd={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},Ld={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}},qd={default:vd,zero:Pd,commonmark:Ld},Vd=/^(vbscript|javascript|file|data):/,$d=/^data:image\/(gif|png|jpeg|webp);/;function Wd(t){const e=t.trim().toLowerCase();return Vd.test(e)?$d.test(e):!0}const Mo=["http:","https:","mailto:"];function Hd(t){const e=Qr(t,!0);if(e.hostname&&(!e.protocol||Mo.indexOf(e.protocol)>=0))try{e.hostname=Ao.toASCII(e.hostname)}catch{}return Gt(Xr(e))}function Jd(t){const e=Qr(t,!0);if(e.hostname&&(!e.protocol||Mo.indexOf(e.protocol)>=0))try{e.hostname=Ao.toUnicode(e.hostname)}catch{}return xt(Xr(e),xt.defaultChars+"%")}function ue(t,e){if(!(this instanceof ue))return new ue(t,e);e||tu(t)||(e=t||{},t="default"),this.inline=new Yt,this.block=new Fn,this.core=new ru,this.renderer=new Ct,this.linkify=new re,this.validateLink=Wd,this.normalizeLink=Hd,this.normalizeLinkText=Jd,this.utils=Uf,this.helpers=Tn({},Yf),this.options={},this.configure(t),e&&this.set(e)}ue.prototype.set=function(t){return Tn(this.options,t),this};ue.prototype.configure=function(t){const e=this;if(tu(t)){const n=t;if(t=qd[n],!t)throw new Error('Wrong `markdown-it` preset "'+n+'", check name')}if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(n){t.components[n].rules&&e[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&e[n].ruler2.enableOnly(t.components[n].rules2)}),this};ue.prototype.enable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(u){n=n.concat(this[u].ruler.enable(t,!0))},this),n=n.concat(this.inline.ruler2.enable(t,!0));const r=t.filter(function(u){return n.indexOf(u)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this};ue.prototype.disable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(u){n=n.concat(this[u].ruler.disable(t,!0))},this),n=n.concat(this.inline.ruler2.disable(t,!0));const r=t.filter(function(u){return n.indexOf(u)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this};ue.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};ue.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");const n=new this.core.State(t,this,e);return this.core.process(n),n.tokens};ue.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};ue.prototype.parseInline=function(t,e){const n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens};ue.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};const jd=new Rr({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM(){return["blockquote",0]}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return["div",["hr"]]}},heading:{attrs:{level:{default:1}},content:"(text | image)*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(t){return["h"+t.attrs.level,0]}},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>({params:t.getAttribute("data-params")||""})}],toDOM(t){return["pre",t.attrs.params?{"data-params":t.attrs.params}:{},["code",0]]}},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1,tight:t.hasAttribute("data-tight")}}}],toDOM(t){return["ol",{start:t.attrs.order==1?null:t.attrs.order,"data-tight":t.attrs.tight?"true":null},0]}},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:t=>({tight:t.hasAttribute("data-tight")})}],toDOM(t){return["ul",{"data-tight":t.attrs.tight?"true":null},0]}},list_item:{content:"block+",defining:!0,parseDOM:[{tag:"li"}],toDOM(){return["li",0]}},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs(t){return{src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")}}}],toDOM(t){return["img",t.attrs]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return["br"]}}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:t=>t.type.name=="em"}],toDOM(){return["em"]}},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM(){return["strong"]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(t){return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM(t){return["a",t.attrs]}},code:{code:!0,parseDOM:[{tag:"code"}],toDOM(){return["code"]}}}});function Ud(t,e){if(t.isText&&e.isText&&T.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}class Kd{constructor(e,n){this.schema=e,this.tokenHandlers=n,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:T.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let n=this.top(),r=n.content,u=r[r.length-1],i=this.schema.text(e,n.marks),s;u&&(s=Ud(u,i))?r[r.length-1]=s:r.push(i)}openMark(e){let n=this.top();n.marks=e.addToSet(n.marks)}closeMark(e){let n=this.top();n.marks=e.removeFromSet(n.marks)}parseTokens(e){for(let n=0;n<e.length;n++){let r=e[n],u=this.tokenHandlers[r.type];if(!u)throw new Error("Token type `"+r.type+"` not supported by Markdown parser");u(this,r,e,n)}}addNode(e,n,r){let u=this.top(),i=e.createAndFill(n,r,u?u.marks:[]);return i?(this.push(i),i):null}openNode(e,n){this.stack.push({type:e,attrs:n,content:[],marks:T.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}}function Et(t,e,n,r){return t.getAttrs?t.getAttrs(e,n,r):t.attrs instanceof Function?t.attrs(e):t.attrs}function ur(t,e){return t.noCloseToken||e=="code_inline"||e=="code_block"||e=="fence"}function Ei(t){return t[t.length-1]==`
|
|
25
|
+
`,i.map=[e,t.line],!0}function y0(t,e,n,r){let u=t.bMarks[e]+t.tShift[e],i=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||u+3>i)return!1;const s=t.src.charCodeAt(u);if(s!==126&&s!==96)return!1;let o=u;u=t.skipChars(u,s);let l=u-o;if(l<3)return!1;const a=t.src.slice(o,u),c=t.src.slice(u,i);if(s===96&&c.indexOf(String.fromCharCode(s))>=0)return!1;if(r)return!0;let f=e,p=!1;for(;f++,!(f>=n||(u=o=t.bMarks[f]+t.tShift[f],i=t.eMarks[f],u<i&&t.sCount[f]<t.blkIndent));)if(t.src.charCodeAt(u)===s&&!(t.sCount[f]-t.blkIndent>=4)&&(u=t.skipChars(u,s),!(u-o<l)&&(u=t.skipSpaces(u),!(u<i)))){p=!0;break}l=t.sCount[e],t.line=f+(p?1:0);const h=t.push("fence","code",0);return h.info=c,h.content=t.getLines(e+1,f,l,!0),h.markup=a,h.map=[e,t.line],!0}function C0(t,e,n,r){let u=t.bMarks[e]+t.tShift[e],i=t.eMarks[e];const s=t.lineMax;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(u)!==62)return!1;if(r)return!0;const o=[],l=[],a=[],c=[],f=t.md.block.ruler.getRules("blockquote"),p=t.parentType;t.parentType="blockquote";let h=!1,d;for(d=e;d<n;d++){const y=t.sCount[d]<t.blkIndent;if(u=t.bMarks[d]+t.tShift[d],i=t.eMarks[d],u>=i)break;if(t.src.charCodeAt(u++)===62&&!y){let E=t.sCount[d]+1,M,C;t.src.charCodeAt(u)===32?(u++,E++,C=!1,M=!0):t.src.charCodeAt(u)===9?(M=!0,(t.bsCount[d]+E)%4===3?(u++,E++,C=!1):C=!0):M=!1;let w=E;for(o.push(t.bMarks[d]),t.bMarks[d]=u;u<i;){const I=t.src.charCodeAt(u);if(N(I))I===9?w+=4-(w+t.bsCount[d]+(C?1:0))%4:w++;else break;u++}h=u>=i,l.push(t.bsCount[d]),t.bsCount[d]=t.sCount[d]+1+(M?1:0),a.push(t.sCount[d]),t.sCount[d]=w-E,c.push(t.tShift[d]),t.tShift[d]=u-t.bMarks[d];continue}if(h)break;let _=!1;for(let E=0,M=f.length;E<M;E++)if(f[E](t,d,n,!0)){_=!0;break}if(_){t.lineMax=d,t.blkIndent!==0&&(o.push(t.bMarks[d]),l.push(t.bsCount[d]),c.push(t.tShift[d]),a.push(t.sCount[d]),t.sCount[d]-=t.blkIndent);break}o.push(t.bMarks[d]),l.push(t.bsCount[d]),c.push(t.tShift[d]),a.push(t.sCount[d]),t.sCount[d]=-1}const m=t.blkIndent;t.blkIndent=0;const g=t.push("blockquote_open","blockquote",1);g.markup=">";const b=[e,0];g.map=b,t.md.block.tokenize(t,e,d);const k=t.push("blockquote_close","blockquote",-1);k.markup=">",t.lineMax=s,t.parentType=p,b[1]=t.line;for(let y=0;y<c.length;y++)t.bMarks[y+e]=o[y],t.tShift[y+e]=c[y],t.sCount[y+e]=a[y],t.bsCount[y+e]=l[y];return t.blkIndent=m,!0}function D0(t,e,n,r){const u=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let i=t.bMarks[e]+t.tShift[e];const s=t.src.charCodeAt(i++);if(s!==42&&s!==45&&s!==95)return!1;let o=1;for(;i<u;){const a=t.src.charCodeAt(i++);if(a!==s&&!N(a))return!1;a===s&&o++}if(o<3)return!1;if(r)return!0;t.line=e+1;const l=t.push("hr","hr",0);return l.map=[e,t.line],l.markup=Array(o+1).join(String.fromCharCode(s)),!0}function gi(t,e){const n=t.eMarks[e];let r=t.bMarks[e]+t.tShift[e];const u=t.src.charCodeAt(r++);if(u!==42&&u!==45&&u!==43)return-1;if(r<n){const i=t.src.charCodeAt(r);if(!N(i))return-1}return r}function bi(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];let u=n;if(u+1>=r)return-1;let i=t.src.charCodeAt(u++);if(i<48||i>57)return-1;for(;;){if(u>=r)return-1;if(i=t.src.charCodeAt(u++),i>=48&&i<=57){if(u-n>=10)return-1;continue}if(i===41||i===46)break;return-1}return u<r&&(i=t.src.charCodeAt(u),!N(i))?-1:u}function _0(t,e){const n=t.level+2;for(let r=e+2,u=t.tokens.length-2;r<u;r++)t.tokens[r].level===n&&t.tokens[r].type==="paragraph_open"&&(t.tokens[r+2].hidden=!0,t.tokens[r].hidden=!0,r+=2)}function E0(t,e,n,r){let u,i,s,o,l=e,a=!0;if(t.sCount[l]-t.blkIndent>=4||t.listIndent>=0&&t.sCount[l]-t.listIndent>=4&&t.sCount[l]<t.blkIndent)return!1;let c=!1;r&&t.parentType==="paragraph"&&t.sCount[l]>=t.blkIndent&&(c=!0);let f,p,h;if((h=bi(t,l))>=0){if(f=!0,s=t.bMarks[l]+t.tShift[l],p=Number(t.src.slice(s,h-1)),c&&p!==1)return!1}else if((h=gi(t,l))>=0)f=!1;else return!1;if(c&&t.skipSpaces(h)>=t.eMarks[l])return!1;if(r)return!0;const d=t.src.charCodeAt(h-1),m=t.tokens.length;f?(o=t.push("ordered_list_open","ol",1),p!==1&&(o.attrs=[["start",p]])):o=t.push("bullet_list_open","ul",1);const g=[l,0];o.map=g,o.markup=String.fromCharCode(d);let b=!1;const k=t.md.block.ruler.getRules("list"),y=t.parentType;for(t.parentType="list";l<n;){i=h,u=t.eMarks[l];const _=t.sCount[l]+h-(t.bMarks[l]+t.tShift[l]);let E=_;for(;i<u;){const we=t.src.charCodeAt(i);if(we===9)E+=4-(E+t.bsCount[l])%4;else if(we===32)E++;else break;i++}const M=i;let C;M>=u?C=1:C=E-_,C>4&&(C=1);const w=_+C;o=t.push("list_item_open","li",1),o.markup=String.fromCharCode(d);const I=[l,0];o.map=I,f&&(o.info=t.src.slice(s,h-1));const ee=t.tight,Je=t.tShift[l],In=t.sCount[l],Rn=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=w,t.tight=!0,t.tShift[l]=M-t.bMarks[l],t.sCount[l]=E,M>=u&&t.isEmpty(l+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,l,n,!0),(!t.tight||b)&&(a=!1),b=t.line-l>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=Rn,t.tShift[l]=Je,t.sCount[l]=In,t.tight=ee,o=t.push("list_item_close","li",-1),o.markup=String.fromCharCode(d),l=t.line,I[1]=l,l>=n||t.sCount[l]<t.blkIndent||t.sCount[l]-t.blkIndent>=4)break;let it=!1;for(let we=0,Bn=k.length;we<Bn;we++)if(k[we](t,l,n,!0)){it=!0;break}if(it)break;if(f){if(h=bi(t,l),h<0)break;s=t.bMarks[l]+t.tShift[l]}else if(h=gi(t,l),h<0)break;if(d!==t.src.charCodeAt(h-1))break}return f?o=t.push("ordered_list_close","ol",-1):o=t.push("bullet_list_close","ul",-1),o.markup=String.fromCharCode(d),g[1]=l,t.line=l,t.parentType=y,a&&_0(t,m),!0}function S0(t,e,n,r){let u=t.bMarks[e]+t.tShift[e],i=t.eMarks[e],s=e+1;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(u)!==91)return!1;function o(k){const y=t.lineMax;if(k>=y||t.isEmpty(k))return null;let _=!1;if(t.sCount[k]-t.blkIndent>3&&(_=!0),t.sCount[k]<0&&(_=!0),!_){const C=t.md.block.ruler.getRules("reference"),w=t.parentType;t.parentType="reference";let I=!1;for(let ee=0,Je=C.length;ee<Je;ee++)if(C[ee](t,k,y,!0)){I=!0;break}if(t.parentType=w,I)return null}const E=t.bMarks[k]+t.tShift[k],M=t.eMarks[k];return t.src.slice(E,M+1)}let l=t.src.slice(u,i+1);i=l.length;let a=-1;for(u=1;u<i;u++){const k=l.charCodeAt(u);if(k===91)return!1;if(k===93){a=u;break}else if(k===10){const y=o(s);y!==null&&(l+=y,i=l.length,s++)}else if(k===92&&(u++,u<i&&l.charCodeAt(u)===10)){const y=o(s);y!==null&&(l+=y,i=l.length,s++)}}if(a<0||l.charCodeAt(a+1)!==58)return!1;for(u=a+2;u<i;u++){const k=l.charCodeAt(u);if(k===10){const y=o(s);y!==null&&(l+=y,i=l.length,s++)}else if(!N(k))break}const c=t.md.helpers.parseLinkDestination(l,u,i);if(!c.ok)return!1;const f=t.md.normalizeLink(c.str);if(!t.md.validateLink(f))return!1;u=c.pos;const p=u,h=s,d=u;for(;u<i;u++){const k=l.charCodeAt(u);if(k===10){const y=o(s);y!==null&&(l+=y,i=l.length,s++)}else if(!N(k))break}let m=t.md.helpers.parseLinkTitle(l,u,i);for(;m.can_continue;){const k=o(s);if(k===null)break;l+=k,u=i,i=l.length,s++,m=t.md.helpers.parseLinkTitle(l,u,i,m)}let g;for(u<i&&d!==u&&m.ok?(g=m.str,u=m.pos):(g="",u=p,s=h);u<i;){const k=l.charCodeAt(u);if(!N(k))break;u++}if(u<i&&l.charCodeAt(u)!==10&&g)for(g="",u=p,s=h;u<i;){const k=l.charCodeAt(u);if(!N(k))break;u++}if(u<i&&l.charCodeAt(u)!==10)return!1;const b=On(l.slice(1,a));return b?(r||(typeof t.env.references>"u"&&(t.env.references={}),typeof t.env.references[b]>"u"&&(t.env.references[b]={title:g,href:f}),t.line=s),!0):!1}const A0=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],M0="[a-zA-Z_:][a-zA-Z0-9:._-]*",w0="[^\"'=<>`\\x00-\\x20]+",T0="'[^']*'",O0='"[^"]*"',F0="(?:"+w0+"|"+T0+"|"+O0+")",N0="(?:\\s+"+M0+"(?:\\s*=\\s*"+F0+")?)",ho="<[A-Za-z][A-Za-z0-9\\-]*"+N0+"*\\s*\\/?>",po="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",I0="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",R0="<[?][\\s\\S]*?[?]>",B0="<![A-Za-z][^>]*>",z0="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",v0=new RegExp("^(?:"+ho+"|"+po+"|"+I0+"|"+R0+"|"+B0+"|"+z0+")"),P0=new RegExp("^(?:"+ho+"|"+po+")"),lt=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+A0.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(P0.source+"\\s*$"),/^$/,!1]];function L0(t,e,n,r){let u=t.bMarks[e]+t.tShift[e],i=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(u)!==60)return!1;let s=t.src.slice(u,i),o=0;for(;o<lt.length&&!lt[o][0].test(s);o++);if(o===lt.length)return!1;if(r)return lt[o][2];let l=e+1;if(!lt[o][1].test(s)){for(;l<n&&!(t.sCount[l]<t.blkIndent);l++)if(u=t.bMarks[l]+t.tShift[l],i=t.eMarks[l],s=t.src.slice(u,i),lt[o][1].test(s)){s.length!==0&&l++;break}}t.line=l;const a=t.push("html_block","",0);return a.map=[e,l],a.content=t.getLines(e,l,t.blkIndent,!0),!0}function q0(t,e,n,r){let u=t.bMarks[e]+t.tShift[e],i=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let s=t.src.charCodeAt(u);if(s!==35||u>=i)return!1;let o=1;for(s=t.src.charCodeAt(++u);s===35&&u<i&&o<=6;)o++,s=t.src.charCodeAt(++u);if(o>6||u<i&&!N(s))return!1;if(r)return!0;i=t.skipSpacesBack(i,u);const l=t.skipCharsBack(i,35,u);l>u&&N(t.src.charCodeAt(l-1))&&(i=l),t.line=e+1;const a=t.push("heading_open","h"+String(o),1);a.markup="########".slice(0,o),a.map=[e,t.line];const c=t.push("inline","",0);c.content=t.src.slice(u,i).trim(),c.map=[e,t.line],c.children=[];const f=t.push("heading_close","h"+String(o),-1);return f.markup="########".slice(0,o),!0}function V0(t,e,n){const r=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;const u=t.parentType;t.parentType="paragraph";let i=0,s,o=e+1;for(;o<n&&!t.isEmpty(o);o++){if(t.sCount[o]-t.blkIndent>3)continue;if(t.sCount[o]>=t.blkIndent){let h=t.bMarks[o]+t.tShift[o];const d=t.eMarks[o];if(h<d&&(s=t.src.charCodeAt(h),(s===45||s===61)&&(h=t.skipChars(h,s),h=t.skipSpaces(h),h>=d))){i=s===61?1:2;break}}if(t.sCount[o]<0)continue;let p=!1;for(let h=0,d=r.length;h<d;h++)if(r[h](t,o,n,!0)){p=!0;break}if(p)break}if(!i)return!1;const l=t.getLines(e,o,t.blkIndent,!1).trim();t.line=o+1;const a=t.push("heading_open","h"+String(i),1);a.markup=String.fromCharCode(s),a.map=[e,t.line];const c=t.push("inline","",0);c.content=l,c.map=[e,t.line-1],c.children=[];const f=t.push("heading_close","h"+String(i),-1);return f.markup=String.fromCharCode(s),t.parentType=u,!0}function $0(t,e,n){const r=t.md.block.ruler.getRules("paragraph"),u=t.parentType;let i=e+1;for(t.parentType="paragraph";i<n&&!t.isEmpty(i);i++){if(t.sCount[i]-t.blkIndent>3||t.sCount[i]<0)continue;let a=!1;for(let c=0,f=r.length;c<f;c++)if(r[c](t,i,n,!0)){a=!0;break}if(a)break}const s=t.getLines(e,i,t.blkIndent,!1).trim();t.line=i;const o=t.push("paragraph_open","p",1);o.map=[e,t.line];const l=t.push("inline","",0);return l.content=s,l.map=[e,t.line],l.children=[],t.push("paragraph_close","p",-1),t.parentType=u,!0}const rn=[["table",x0,["paragraph","reference"]],["code",k0],["fence",y0,["paragraph","reference","blockquote","list"]],["blockquote",C0,["paragraph","reference","blockquote","list"]],["hr",D0,["paragraph","reference","blockquote","list"]],["list",E0,["paragraph","reference","blockquote"]],["reference",S0],["html_block",L0,["paragraph","reference","blockquote"]],["heading",q0,["paragraph","reference","blockquote"]],["lheading",V0],["paragraph",$0]];function Fn(){this.ruler=new Q;for(let t=0;t<rn.length;t++)this.ruler.push(rn[t][0],rn[t][1],{alt:(rn[t][2]||[]).slice()})}Fn.prototype.tokenize=function(t,e,n){const r=this.ruler.getRules(""),u=r.length,i=t.md.options.maxNesting;let s=e,o=!1;for(;s<n&&(t.line=s=t.skipEmptyLines(s),!(s>=n||t.sCount[s]<t.blkIndent));){if(t.level>=i){t.line=n;break}const l=t.line;let a=!1;for(let c=0;c<u;c++)if(a=r[c](t,s,n,!1),a){if(l>=t.line)throw new Error("block rule didn't increment state.line");break}if(!a)throw new Error("none of the block rules matched");t.tight=!o,t.isEmpty(t.line-1)&&(o=!0),s=t.line,s<n&&t.isEmpty(s)&&(o=!0,s++,t.line=s)}};Fn.prototype.parse=function(t,e,n,r){if(!t)return;const u=new this.State(t,e,n,r);this.tokenize(u,u.line,u.lineMax)};Fn.prototype.State=De;function Zt(t,e,n,r){this.src=t,this.env=n,this.md=e,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}Zt.prototype.pushPending=function(){const t=new de("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t};Zt.prototype.push=function(t,e,n){this.pending&&this.pushPending();const r=new de(t,e,n);let u=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],u={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(u),r};Zt.prototype.scanDelims=function(t,e){const n=this.posMax,r=this.src.charCodeAt(t),u=t>0?this.src.charCodeAt(t-1):32;let i=t;for(;i<n&&this.src.charCodeAt(i)===r;)i++;const s=i-t,o=i<n?this.src.charCodeAt(i):32,l=Wt(u)||$t(String.fromCharCode(u)),a=Wt(o)||$t(String.fromCharCode(o)),c=Vt(u),f=Vt(o),p=!f&&(!a||c||l),h=!c&&(!l||f||a);return{can_open:p&&(e||!h||l),can_close:h&&(e||!p||a),length:s}};Zt.prototype.Token=de;function W0(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function H0(t,e){let n=t.pos;for(;n<t.posMax&&!W0(t.src.charCodeAt(n));)n++;return n===t.pos?!1:(e||(t.pending+=t.src.slice(t.pos,n)),t.pos=n,!0)}const J0=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function j0(t,e){if(!t.md.options.linkify||t.linkLevel>0)return!1;const n=t.pos,r=t.posMax;if(n+3>r||t.src.charCodeAt(n)!==58||t.src.charCodeAt(n+1)!==47||t.src.charCodeAt(n+2)!==47)return!1;const u=t.pending.match(J0);if(!u)return!1;const i=u[1],s=t.md.linkify.matchAtStart(t.src.slice(n-i.length));if(!s)return!1;let o=s.url;if(o.length<=i.length)return!1;let l=o.length;for(;l>0&&o.charCodeAt(l-1)===42;)l--;l!==o.length&&(o=o.slice(0,l));const a=t.md.normalizeLink(o);if(!t.md.validateLink(a))return!1;if(!e){t.pending=t.pending.slice(0,-i.length);const c=t.push("link_open","a",1);c.attrs=[["href",a]],c.markup="linkify",c.info="auto";const f=t.push("text","",0);f.content=t.md.normalizeLinkText(o);const p=t.push("link_close","a",-1);p.markup="linkify",p.info="auto"}return t.pos+=o.length-i.length,!0}function U0(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==10)return!1;const r=t.pending.length-1,u=t.posMax;if(!e)if(r>=0&&t.pending.charCodeAt(r)===32)if(r>=1&&t.pending.charCodeAt(r-1)===32){let i=r-1;for(;i>=1&&t.pending.charCodeAt(i-1)===32;)i--;t.pending=t.pending.slice(0,i),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(n++;n<u&&N(t.src.charCodeAt(n));)n++;return t.pos=n,!0}const uu=[];for(let t=0;t<256;t++)uu.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){uu[t.charCodeAt(0)]=1});function K0(t,e){let n=t.pos;const r=t.posMax;if(t.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let u=t.src.charCodeAt(n);if(u===10){for(e||t.push("hardbreak","br",0),n++;n<r&&(u=t.src.charCodeAt(n),!!N(u));)n++;return t.pos=n,!0}let i=t.src[n];if(u>=55296&&u<=56319&&n+1<r){const o=t.src.charCodeAt(n+1);o>=56320&&o<=57343&&(i+=t.src[n+1],n++)}const s="\\"+i;if(!e){const o=t.push("text_special","",0);u<256&&uu[u]!==0?o.content=i:o.content=s,o.markup=s,o.info="escape"}return t.pos=n+1,!0}function G0(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==96)return!1;const u=n;n++;const i=t.posMax;for(;n<i&&t.src.charCodeAt(n)===96;)n++;const s=t.src.slice(u,n),o=s.length;if(t.backticksScanned&&(t.backticks[o]||0)<=u)return e||(t.pending+=s),t.pos+=o,!0;let l=n,a;for(;(a=t.src.indexOf("`",l))!==-1;){for(l=a+1;l<i&&t.src.charCodeAt(l)===96;)l++;const c=l-a;if(c===o){if(!e){const f=t.push("code_inline","code",0);f.markup=s,f.content=t.src.slice(n,a).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return t.pos=l,!0}t.backticks[c]=a}return t.backticksScanned=!0,e||(t.pending+=s),t.pos+=o,!0}function Z0(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==126)return!1;const u=t.scanDelims(t.pos,!0);let i=u.length;const s=String.fromCharCode(r);if(i<2)return!1;let o;i%2&&(o=t.push("text","",0),o.content=s,i--);for(let l=0;l<i;l+=2)o=t.push("text","",0),o.content=s+s,t.delimiters.push({marker:r,length:0,token:t.tokens.length-1,end:-1,open:u.can_open,close:u.can_close});return t.pos+=u.length,!0}function xi(t,e){let n;const r=[],u=e.length;for(let i=0;i<u;i++){const s=e[i];if(s.marker!==126||s.end===-1)continue;const o=e[s.end];n=t.tokens[s.token],n.type="s_open",n.tag="s",n.nesting=1,n.markup="~~",n.content="",n=t.tokens[o.token],n.type="s_close",n.tag="s",n.nesting=-1,n.markup="~~",n.content="",t.tokens[o.token-1].type==="text"&&t.tokens[o.token-1].content==="~"&&r.push(o.token-1)}for(;r.length;){const i=r.pop();let s=i+1;for(;s<t.tokens.length&&t.tokens[s].type==="s_close";)s++;s--,i!==s&&(n=t.tokens[s],t.tokens[s]=t.tokens[i],t.tokens[i]=n)}}function Y0(t){const e=t.tokens_meta,n=t.tokens_meta.length;xi(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&xi(t,e[r].delimiters)}const mo={tokenize:Z0,postProcess:Y0};function X0(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==95&&r!==42)return!1;const u=t.scanDelims(t.pos,r===42);for(let i=0;i<u.length;i++){const s=t.push("text","",0);s.content=String.fromCharCode(r),t.delimiters.push({marker:r,length:u.length,token:t.tokens.length-1,end:-1,open:u.can_open,close:u.can_close})}return t.pos+=u.length,!0}function ki(t,e){const n=e.length;for(let r=n-1;r>=0;r--){const u=e[r];if(u.marker!==95&&u.marker!==42||u.end===-1)continue;const i=e[u.end],s=r>0&&e[r-1].end===u.end+1&&e[r-1].marker===u.marker&&e[r-1].token===u.token-1&&e[u.end+1].token===i.token+1,o=String.fromCharCode(u.marker),l=t.tokens[u.token];l.type=s?"strong_open":"em_open",l.tag=s?"strong":"em",l.nesting=1,l.markup=s?o+o:o,l.content="";const a=t.tokens[i.token];a.type=s?"strong_close":"em_close",a.tag=s?"strong":"em",a.nesting=-1,a.markup=s?o+o:o,a.content="",s&&(t.tokens[e[r-1].token].content="",t.tokens[e[u.end+1].token].content="",r--)}}function Q0(t){const e=t.tokens_meta,n=t.tokens_meta.length;ki(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&ki(t,e[r].delimiters)}const go={tokenize:X0,postProcess:Q0};function ed(t,e){let n,r,u,i,s="",o="",l=t.pos,a=!0;if(t.src.charCodeAt(t.pos)!==91)return!1;const c=t.pos,f=t.posMax,p=t.pos+1,h=t.md.helpers.parseLinkLabel(t,t.pos,!0);if(h<0)return!1;let d=h+1;if(d<f&&t.src.charCodeAt(d)===40){for(a=!1,d++;d<f&&(n=t.src.charCodeAt(d),!(!N(n)&&n!==10));d++);if(d>=f)return!1;if(l=d,u=t.md.helpers.parseLinkDestination(t.src,d,t.posMax),u.ok){for(s=t.md.normalizeLink(u.str),t.md.validateLink(s)?d=u.pos:s="",l=d;d<f&&(n=t.src.charCodeAt(d),!(!N(n)&&n!==10));d++);if(u=t.md.helpers.parseLinkTitle(t.src,d,t.posMax),d<f&&l!==d&&u.ok)for(o=u.str,d=u.pos;d<f&&(n=t.src.charCodeAt(d),!(!N(n)&&n!==10));d++);}(d>=f||t.src.charCodeAt(d)!==41)&&(a=!0),d++}if(a){if(typeof t.env.references>"u")return!1;if(d<f&&t.src.charCodeAt(d)===91?(l=d+1,d=t.md.helpers.parseLinkLabel(t,d),d>=0?r=t.src.slice(l,d++):d=h+1):d=h+1,r||(r=t.src.slice(p,h)),i=t.env.references[On(r)],!i)return t.pos=c,!1;s=i.href,o=i.title}if(!e){t.pos=p,t.posMax=h;const m=t.push("link_open","a",1),g=[["href",s]];m.attrs=g,o&&g.push(["title",o]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=d,t.posMax=f,!0}function td(t,e){let n,r,u,i,s,o,l,a,c="";const f=t.pos,p=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;const h=t.pos+2,d=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(d<0)return!1;if(i=d+1,i<p&&t.src.charCodeAt(i)===40){for(i++;i<p&&(n=t.src.charCodeAt(i),!(!N(n)&&n!==10));i++);if(i>=p)return!1;for(a=i,o=t.md.helpers.parseLinkDestination(t.src,i,t.posMax),o.ok&&(c=t.md.normalizeLink(o.str),t.md.validateLink(c)?i=o.pos:c=""),a=i;i<p&&(n=t.src.charCodeAt(i),!(!N(n)&&n!==10));i++);if(o=t.md.helpers.parseLinkTitle(t.src,i,t.posMax),i<p&&a!==i&&o.ok)for(l=o.str,i=o.pos;i<p&&(n=t.src.charCodeAt(i),!(!N(n)&&n!==10));i++);else l="";if(i>=p||t.src.charCodeAt(i)!==41)return t.pos=f,!1;i++}else{if(typeof t.env.references>"u")return!1;if(i<p&&t.src.charCodeAt(i)===91?(a=i+1,i=t.md.helpers.parseLinkLabel(t,i),i>=0?u=t.src.slice(a,i++):i=d+1):i=d+1,u||(u=t.src.slice(h,d)),s=t.env.references[On(u)],!s)return t.pos=f,!1;c=s.href,l=s.title}if(!e){r=t.src.slice(h,d);const m=[];t.md.inline.parse(r,t.md,t.env,m);const g=t.push("image","img",0),b=[["src",c],["alt",""]];g.attrs=b,g.children=m,g.content=r,l&&b.push(["title",l])}return t.pos=i,t.posMax=p,!0}const nd=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,rd=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function ud(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==60)return!1;const r=t.pos,u=t.posMax;for(;;){if(++n>=u)return!1;const s=t.src.charCodeAt(n);if(s===60)return!1;if(s===62)break}const i=t.src.slice(r+1,n);if(rd.test(i)){const s=t.md.normalizeLink(i);if(!t.md.validateLink(s))return!1;if(!e){const o=t.push("link_open","a",1);o.attrs=[["href",s]],o.markup="autolink",o.info="auto";const l=t.push("text","",0);l.content=t.md.normalizeLinkText(i);const a=t.push("link_close","a",-1);a.markup="autolink",a.info="auto"}return t.pos+=i.length+2,!0}if(nd.test(i)){const s=t.md.normalizeLink("mailto:"+i);if(!t.md.validateLink(s))return!1;if(!e){const o=t.push("link_open","a",1);o.attrs=[["href",s]],o.markup="autolink",o.info="auto";const l=t.push("text","",0);l.content=t.md.normalizeLinkText(i);const a=t.push("link_close","a",-1);a.markup="autolink",a.info="auto"}return t.pos+=i.length+2,!0}return!1}function id(t){return/^<a[>\s]/i.test(t)}function sd(t){return/^<\/a\s*>/i.test(t)}function od(t){const e=t|32;return e>=97&&e<=122}function ld(t,e){if(!t.md.options.html)return!1;const n=t.posMax,r=t.pos;if(t.src.charCodeAt(r)!==60||r+2>=n)return!1;const u=t.src.charCodeAt(r+1);if(u!==33&&u!==63&&u!==47&&!od(u))return!1;const i=t.src.slice(r).match(v0);if(!i)return!1;if(!e){const s=t.push("html_inline","",0);s.content=i[0],id(s.content)&&t.linkLevel++,sd(s.content)&&t.linkLevel--}return t.pos+=i[0].length,!0}const ad=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,cd=/^&([a-z][a-z0-9]{1,31});/i;function fd(t,e){const n=t.pos,r=t.posMax;if(t.src.charCodeAt(n)!==38||n+1>=r)return!1;if(t.src.charCodeAt(n+1)===35){const i=t.src.slice(n).match(ad);if(i){if(!e){const s=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),o=t.push("text_special","",0);o.content=nu(s)?yn(s):yn(65533),o.markup=i[0],o.info="entity"}return t.pos+=i[0].length,!0}}else{const i=t.src.slice(n).match(cd);if(i){const s=oo(i[0]);if(s!==i[0]){if(!e){const o=t.push("text_special","",0);o.content=s,o.markup=i[0],o.info="entity"}return t.pos+=i[0].length,!0}}}return!1}function yi(t){const e={},n=t.length;if(!n)return;let r=0,u=-2;const i=[];for(let s=0;s<n;s++){const o=t[s];if(i.push(0),(t[r].marker!==o.marker||u!==o.token-1)&&(r=s),u=o.token,o.length=o.length||0,!o.close)continue;e.hasOwnProperty(o.marker)||(e[o.marker]=[-1,-1,-1,-1,-1,-1]);const l=e[o.marker][(o.open?3:0)+o.length%3];let a=r-i[r]-1,c=a;for(;a>l;a-=i[a]+1){const f=t[a];if(f.marker===o.marker&&f.open&&f.end<0){let p=!1;if((f.close||o.open)&&(f.length+o.length)%3===0&&(f.length%3!==0||o.length%3!==0)&&(p=!0),!p){const h=a>0&&!t[a-1].open?i[a-1]+1:0;i[s]=s-a+h,i[a]=h,o.open=!1,f.end=s,f.close=!1,c=-1,u=-2;break}}}c!==-1&&(e[o.marker][(o.open?3:0)+(o.length||0)%3]=c)}}function dd(t){const e=t.tokens_meta,n=t.tokens_meta.length;yi(t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&yi(e[r].delimiters)}function hd(t){let e,n,r=0;const u=t.tokens,i=t.tokens.length;for(e=n=0;e<i;e++)u[e].nesting<0&&r--,u[e].level=r,u[e].nesting>0&&r++,u[e].type==="text"&&e+1<i&&u[e+1].type==="text"?u[e+1].content=u[e].content+u[e+1].content:(e!==n&&(u[n]=u[e]),n++);e!==n&&(u.length=n)}const er=[["text",H0],["linkify",j0],["newline",U0],["escape",K0],["backticks",G0],["strikethrough",mo.tokenize],["emphasis",go.tokenize],["link",ed],["image",td],["autolink",ud],["html_inline",ld],["entity",fd]],tr=[["balance_pairs",dd],["strikethrough",mo.postProcess],["emphasis",go.postProcess],["fragments_join",hd]];function Yt(){this.ruler=new Q;for(let t=0;t<er.length;t++)this.ruler.push(er[t][0],er[t][1]);this.ruler2=new Q;for(let t=0;t<tr.length;t++)this.ruler2.push(tr[t][0],tr[t][1])}Yt.prototype.skipToken=function(t){const e=t.pos,n=this.ruler.getRules(""),r=n.length,u=t.md.options.maxNesting,i=t.cache;if(typeof i[e]<"u"){t.pos=i[e];return}let s=!1;if(t.level<u){for(let o=0;o<r;o++)if(t.level++,s=n[o](t,!0),t.level--,s){if(e>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;s||t.pos++,i[e]=t.pos};Yt.prototype.tokenize=function(t){const e=this.ruler.getRules(""),n=e.length,r=t.posMax,u=t.md.options.maxNesting;for(;t.pos<r;){const i=t.pos;let s=!1;if(t.level<u){for(let o=0;o<n;o++)if(s=e[o](t,!1),s){if(i>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(s){if(t.pos>=r)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};Yt.prototype.parse=function(t,e,n,r){const u=new this.State(t,e,n,r);this.tokenize(u);const i=this.ruler2.getRules(""),s=i.length;for(let o=0;o<s;o++)i[o](u)};Yt.prototype.State=Zt;function pd(t){const e={};t=t||{},e.src_Any=no.source,e.src_Cc=ro.source,e.src_Z=io.source,e.src_P=eu.source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");const n="[><|]";return e.src_pseudo_letter="(?:(?!"+n+"|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+n+"|"+e.src_ZPCc+")(?!"+(t["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]|$)|"+(t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+"|$)|;(?!"+e.src_ZCc+"|$)|\\!+(?!"+e.src_ZCc+"|[!]|$)|\\?(?!"+e.src_ZCc+"|[?]|$))+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}function Tr(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){t[r]=n[r]})}),t}function Nn(t){return Object.prototype.toString.call(t)}function md(t){return Nn(t)==="[object String]"}function gd(t){return Nn(t)==="[object Object]"}function bd(t){return Nn(t)==="[object RegExp]"}function Ci(t){return Nn(t)==="[object Function]"}function xd(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const bo={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function kd(t){return Object.keys(t||{}).reduce(function(e,n){return e||bo.hasOwnProperty(n)},!1)}const yd={"http:":{validate:function(t,e,n){const r=t.slice(e);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,n){const r=t.slice(e);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,n){const r=t.slice(e);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},Cd="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",Dd="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function _d(t){t.__index__=-1,t.__text_cache__=""}function Ed(t){return function(e,n){const r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}function Di(){return function(t,e){e.normalize(t)}}function Cn(t){const e=t.re=pd(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(Cd),n.push(e.src_xn),e.src_tlds=n.join("|");function r(o){return o.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(r(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(r(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(r(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(r(e.tpl_host_fuzzy_test),"i");const u=[];t.__compiled__={};function i(o,l){throw new Error('(LinkifyIt) Invalid schema "'+o+'": '+l)}Object.keys(t.__schemas__).forEach(function(o){const l=t.__schemas__[o];if(l===null)return;const a={validate:null,link:null};if(t.__compiled__[o]=a,gd(l)){bd(l.validate)?a.validate=Ed(l.validate):Ci(l.validate)?a.validate=l.validate:i(o,l),Ci(l.normalize)?a.normalize=l.normalize:l.normalize?i(o,l):a.normalize=Di();return}if(md(l)){u.push(o);return}i(o,l)}),u.forEach(function(o){t.__compiled__[t.__schemas__[o]]&&(t.__compiled__[o].validate=t.__compiled__[t.__schemas__[o]].validate,t.__compiled__[o].normalize=t.__compiled__[t.__schemas__[o]].normalize)}),t.__compiled__[""]={validate:null,normalize:Di()};const s=Object.keys(t.__compiled__).filter(function(o){return o.length>0&&t.__compiled__[o]}).map(xd).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+s+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+s+")","ig"),t.re.schema_at_start=RegExp("^"+t.re.schema_search.source,"i"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),_d(t)}function Sd(t,e){const n=t.__index__,r=t.__last_index__,u=t.__text_cache__.slice(n,r);this.schema=t.__schema__.toLowerCase(),this.index=n+e,this.lastIndex=r+e,this.raw=u,this.text=u,this.url=u}function Or(t,e){const n=new Sd(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function re(t,e){if(!(this instanceof re))return new re(t,e);e||kd(t)&&(e=t,t={}),this.__opts__=Tr({},bo,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Tr({},yd,t),this.__compiled__={},this.__tlds__=Dd,this.__tlds_replaced__=!1,this.re={},Cn(this)}re.prototype.add=function(e,n){return this.__schemas__[e]=n,Cn(this),this};re.prototype.set=function(e){return this.__opts__=Tr(this.__opts__,e),this};re.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let n,r,u,i,s,o,l,a,c;if(this.re.schema_test.test(e)){for(l=this.re.schema_search,l.lastIndex=0;(n=l.exec(e))!==null;)if(i=this.testSchemaAt(e,n[2],l.lastIndex),i){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(a=e.search(this.re.host_fuzzy_test),a>=0&&(this.__index__<0||a<this.__index__)&&(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(s=r.index+r[1].length,(this.__index__<0||s<this.__index__)&&(this.__schema__="",this.__index__=s,this.__last_index__=r.index+r[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(c=e.indexOf("@"),c>=0&&(u=e.match(this.re.email_fuzzy))!==null&&(s=u.index+u[1].length,o=u.index+u[0].length,(this.__index__<0||s<this.__index__||s===this.__index__&&o>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=o))),this.__index__>=0};re.prototype.pretest=function(e){return this.re.pretest.test(e)};re.prototype.testSchemaAt=function(e,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(e,r,this):0};re.prototype.match=function(e){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===e&&(n.push(Or(this,r)),r=this.__last_index__);let u=r?e.slice(r):e;for(;this.test(u);)n.push(Or(this,r)),u=u.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};re.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const n=this.re.schema_at_start.exec(e);if(!n)return null;const r=this.testSchemaAt(e,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,Or(this,0)):null};re.prototype.tlds=function(e,n){return e=Array.isArray(e)?e:[e],n?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(r,u,i){return r!==i[u-1]}).reverse(),Cn(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,Cn(this),this)};re.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};re.prototype.onCompile=function(){};const ht=2147483647,ge=36,iu=1,Ht=26,Ad=38,Md=700,xo=72,ko=128,yo="-",wd=/^xn--/,Td=/[^\0-\x7F]/,Od=/[\x2E\u3002\uFF0E\uFF61]/g,Fd={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},nr=ge-iu,be=Math.floor,rr=String.fromCharCode;function Fe(t){throw new RangeError(Fd[t])}function Nd(t,e){const n=[];let r=t.length;for(;r--;)n[r]=e(t[r]);return n}function Co(t,e){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(Od,".");const u=t.split("."),i=Nd(u,e).join(".");return r+i}function Do(t){const e=[];let n=0;const r=t.length;for(;n<r;){const u=t.charCodeAt(n++);if(u>=55296&&u<=56319&&n<r){const i=t.charCodeAt(n++);(i&64512)==56320?e.push(((u&1023)<<10)+(i&1023)+65536):(e.push(u),n--)}else e.push(u)}return e}const Id=t=>String.fromCodePoint(...t),Rd=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:ge},_i=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},_o=function(t,e,n){let r=0;for(t=n?be(t/Md):t>>1,t+=be(t/e);t>nr*Ht>>1;r+=ge)t=be(t/nr);return be(r+(nr+1)*t/(t+Ad))},Eo=function(t){const e=[],n=t.length;let r=0,u=ko,i=xo,s=t.lastIndexOf(yo);s<0&&(s=0);for(let o=0;o<s;++o)t.charCodeAt(o)>=128&&Fe("not-basic"),e.push(t.charCodeAt(o));for(let o=s>0?s+1:0;o<n;){const l=r;for(let c=1,f=ge;;f+=ge){o>=n&&Fe("invalid-input");const p=Rd(t.charCodeAt(o++));p>=ge&&Fe("invalid-input"),p>be((ht-r)/c)&&Fe("overflow"),r+=p*c;const h=f<=i?iu:f>=i+Ht?Ht:f-i;if(p<h)break;const d=ge-h;c>be(ht/d)&&Fe("overflow"),c*=d}const a=e.length+1;i=_o(r-l,a,l==0),be(r/a)>ht-u&&Fe("overflow"),u+=be(r/a),r%=a,e.splice(r++,0,u)}return String.fromCodePoint(...e)},So=function(t){const e=[];t=Do(t);const n=t.length;let r=ko,u=0,i=xo;for(const l of t)l<128&&e.push(rr(l));const s=e.length;let o=s;for(s&&e.push(yo);o<n;){let l=ht;for(const c of t)c>=r&&c<l&&(l=c);const a=o+1;l-r>be((ht-u)/a)&&Fe("overflow"),u+=(l-r)*a,r=l;for(const c of t)if(c<r&&++u>ht&&Fe("overflow"),c===r){let f=u;for(let p=ge;;p+=ge){const h=p<=i?iu:p>=i+Ht?Ht:p-i;if(f<h)break;const d=f-h,m=ge-h;e.push(rr(_i(h+d%m,0))),f=be(d/m)}e.push(rr(_i(f,0))),i=_o(u,a,o===s),u=0,++o}++u,++r}return e.join("")},Bd=function(t){return Co(t,function(e){return wd.test(e)?Eo(e.slice(4).toLowerCase()):e})},zd=function(t){return Co(t,function(e){return Td.test(e)?"xn--"+So(e):e})},Ao={version:"2.3.1",ucs2:{decode:Do,encode:Id},decode:Eo,encode:So,toASCII:zd,toUnicode:Bd},vd={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},Pd={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},Ld={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}},qd={default:vd,zero:Pd,commonmark:Ld},Vd=/^(vbscript|javascript|file|data):/,$d=/^data:image\/(gif|png|jpeg|webp);/;function Wd(t){const e=t.trim().toLowerCase();return Vd.test(e)?$d.test(e):!0}const Mo=["http:","https:","mailto:"];function Hd(t){const e=Qr(t,!0);if(e.hostname&&(!e.protocol||Mo.indexOf(e.protocol)>=0))try{e.hostname=Ao.toASCII(e.hostname)}catch{}return Gt(Xr(e))}function Jd(t){const e=Qr(t,!0);if(e.hostname&&(!e.protocol||Mo.indexOf(e.protocol)>=0))try{e.hostname=Ao.toUnicode(e.hostname)}catch{}return xt(Xr(e),xt.defaultChars+"%")}function ue(t,e){if(!(this instanceof ue))return new ue(t,e);e||tu(t)||(e=t||{},t="default"),this.inline=new Yt,this.block=new Fn,this.core=new ru,this.renderer=new Ct,this.linkify=new re,this.validateLink=Wd,this.normalizeLink=Hd,this.normalizeLinkText=Jd,this.utils=Uf,this.helpers=Tn({},Yf),this.options={},this.configure(t),e&&this.set(e)}ue.prototype.set=function(t){return Tn(this.options,t),this};ue.prototype.configure=function(t){const e=this;if(tu(t)){const n=t;if(t=qd[n],!t)throw new Error('Wrong `markdown-it` preset "'+n+'", check name')}if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(n){t.components[n].rules&&e[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&e[n].ruler2.enableOnly(t.components[n].rules2)}),this};ue.prototype.enable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(u){n=n.concat(this[u].ruler.enable(t,!0))},this),n=n.concat(this.inline.ruler2.enable(t,!0));const r=t.filter(function(u){return n.indexOf(u)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this};ue.prototype.disable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(u){n=n.concat(this[u].ruler.disable(t,!0))},this),n=n.concat(this.inline.ruler2.disable(t,!0));const r=t.filter(function(u){return n.indexOf(u)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this};ue.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};ue.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");const n=new this.core.State(t,this,e);return this.core.process(n),n.tokens};ue.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};ue.prototype.parseInline=function(t,e){const n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens};ue.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};const jd=new Rr({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM(){return["blockquote",0]}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return["div",["hr"]]}},heading:{attrs:{level:{default:1}},content:"(text | image)*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(t){return["h"+t.attrs.level,0]}},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>({params:t.getAttribute("data-params")||""})}],toDOM(t){return["pre",t.attrs.params?{"data-params":t.attrs.params}:{},["code",0]]}},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1,tight:t.hasAttribute("data-tight")}}}],toDOM(t){return["ol",{start:t.attrs.order==1?null:t.attrs.order,"data-tight":t.attrs.tight?"true":null},0]}},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:t=>({tight:t.hasAttribute("data-tight")})}],toDOM(t){return["ul",{"data-tight":t.attrs.tight?"true":null},0]}},list_item:{content:"block+",defining:!0,parseDOM:[{tag:"li"}],toDOM(){return["li",0]}},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs(t){return{src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")}}}],toDOM(t){return["img",t.attrs]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return["br"]}}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:t=>t.type.name=="em"}],toDOM(){return["em"]}},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM(){return["strong"]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(t){return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM(t){return["a",t.attrs]}},code:{code:!0,parseDOM:[{tag:"code"}],toDOM(){return["code"]}}}});function Ud(t,e){if(t.isText&&e.isText&&T.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}class Kd{constructor(e,n){this.schema=e,this.tokenHandlers=n,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:T.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let n=this.top(),r=n.content,u=r[r.length-1],i=this.schema.text(e,n.marks),s;u&&(s=Ud(u,i))?r[r.length-1]=s:r.push(i)}openMark(e){let n=this.top();n.marks=e.addToSet(n.marks)}closeMark(e){let n=this.top();n.marks=e.removeFromSet(n.marks)}parseTokens(e){for(let n=0;n<e.length;n++){let r=e[n],u=this.tokenHandlers[r.type];if(!u)throw new Error("Token type `"+r.type+"` not supported by Markdown parser");u(this,r,e,n)}}addNode(e,n,r){let u=this.top(),i=e.createAndFill(n,r,u?u.marks:[]);return i?(this.push(i),i):null}openNode(e,n){this.stack.push({type:e,attrs:n,content:[],marks:T.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}}function Et(t,e,n,r){return t.getAttrs?t.getAttrs(e,n,r):t.attrs instanceof Function?t.attrs(e):t.attrs}function ur(t,e){return t.noCloseToken||e=="code_inline"||e=="code_block"||e=="fence"}function Ei(t){return t[t.length-1]==`
|
|
26
26
|
`?t.slice(0,t.length-1):t}function ir(){}function Gd(t,e){let n=Object.create(null);for(let r in e){let u=e[r];if(u.block){let i=t.nodeType(u.block);ur(u,r)?n[r]=(s,o,l,a)=>{s.openNode(i,Et(u,o,l,a)),s.addText(Ei(o.content)),s.closeNode()}:(n[r+"_open"]=(s,o,l,a)=>s.openNode(i,Et(u,o,l,a)),n[r+"_close"]=s=>s.closeNode())}else if(u.node){let i=t.nodeType(u.node);n[r]=(s,o,l,a)=>s.addNode(i,Et(u,o,l,a))}else if(u.mark){let i=t.marks[u.mark];ur(u,r)?n[r]=(s,o,l,a)=>{s.openMark(i.create(Et(u,o,l,a))),s.addText(Ei(o.content)),s.closeMark(i)}:(n[r+"_open"]=(s,o,l,a)=>s.openMark(i.create(Et(u,o,l,a))),n[r+"_close"]=s=>s.closeMark(i))}else if(u.ignore)ur(u,r)?n[r]=ir:(n[r+"_open"]=ir,n[r+"_close"]=ir);else throw new RangeError("Unrecognized parsing spec "+JSON.stringify(u))}return n.text=(r,u)=>r.addText(u.content),n.inline=(r,u)=>r.parseTokens(u.children),n.softbreak=n.softbreak||(r=>r.addText(" ")),n}class wo{constructor(e,n,r){this.schema=e,this.tokenizer=n,this.tokens=r,this.tokenHandlers=Gd(e,r)}parse(e,n={}){let r=new Kd(this.schema,this.tokenHandlers),u;r.parseTokens(this.tokenizer.parse(e,n));do u=r.closeNode();while(r.stack.length);return u||this.schema.topNodeType.createAndFill()}}function Si(t,e){for(;++e<t.length;)if(t[e].type!="list_item_open")return t[e].hidden;return!1}const Fr=new wo(jd,ue("commonmark",{html:!1}),{blockquote:{block:"blockquote"},paragraph:{block:"paragraph"},list_item:{block:"list_item"},bullet_list:{block:"bullet_list",getAttrs:(t,e,n)=>({tight:Si(e,n)})},ordered_list:{block:"ordered_list",getAttrs:(t,e,n)=>({order:+t.attrGet("start")||1,tight:Si(e,n)})},heading:{block:"heading",getAttrs:t=>({level:+t.tag.slice(1)})},code_block:{block:"code_block",noCloseToken:!0},fence:{block:"code_block",getAttrs:t=>({params:t.info||""}),noCloseToken:!0},hr:{node:"horizontal_rule"},image:{node:"image",getAttrs:t=>({src:t.attrGet("src"),title:t.attrGet("title")||null,alt:t.children[0]&&t.children[0].content||null})},hardbreak:{node:"hard_break"},em:{mark:"em"},strong:{mark:"strong"},link:{mark:"link",getAttrs:t=>({href:t.attrGet("href"),title:t.attrGet("title")||null})},code_inline:{mark:"code",noCloseToken:!0}}),Zd={open:"",close:"",mixable:!0};class Yd{constructor(e,n,r={}){this.nodes=e,this.marks=n,this.options=r}serialize(e,n={}){n=Object.assign({},this.options,n);let r=new Qd(this.nodes,this.marks,n);return r.renderContent(e),r.out}}const sr=new Yd({blockquote(t,e){t.wrapBlock("> ",null,e,()=>t.renderContent(e))},code_block(t,e){const n=e.textContent.match(/`{3,}/gm),r=n?n.sort().slice(-1)[0]+"`":"```";t.write(r+(e.attrs.params||"")+`
|
|
27
27
|
`),t.text(e.textContent,!1),t.write(`
|
|
28
28
|
`),t.write(r),t.closeBlock(e)},heading(t,e){t.write(t.repeat("#",e.attrs.level)+" "),t.renderInline(e,!1),t.closeBlock(e)},horizontal_rule(t,e){t.write(e.attrs.markup||"---"),t.closeBlock(e)},bullet_list(t,e){t.renderList(e," ",()=>(e.attrs.bullet||"*")+" ")},ordered_list(t,e){let n=e.attrs.order||1,r=String(n+e.childCount-1).length,u=t.repeat(" ",r+2);t.renderList(e,u,i=>{let s=String(n+i);return t.repeat(" ",r-s.length)+s+". "})},list_item(t,e){t.renderContent(e)},paragraph(t,e){t.renderInline(e),t.closeBlock(e)},image(t,e){t.write("]/g,"\\$&")+(e.attrs.title?' "'+e.attrs.title.replace(/"/g,'\\"')+'"':"")+")")},hard_break(t,e,n,r){for(let u=r+1;u<n.childCount;u++)if(n.child(u).type!=e.type){t.write(`\\
|
|
@@ -31,6 +31,6 @@
|
|
|
31
31
|
`}this.closed=null}}getMark(e){let n=this.marks[e];if(!n){if(this.options.strict!==!1)throw new Error(`Mark type \`${e}\` not supported by Markdown renderer`);n=Zd}return n}wrapBlock(e,n,r,u){let i=this.delim;this.write(n??e),this.delim+=e,u(),this.delim=i,this.closeBlock(r)}atBlank(){return/(^|\n)$/.test(this.out)}ensureNewLine(){this.atBlank()||(this.out+=`
|
|
32
32
|
`)}write(e){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),e&&(this.out+=e)}closeBlock(e){this.closed=e}text(e,n=!0){let r=e.split(`
|
|
33
33
|
`);for(let u=0;u<r.length;u++)this.write(),!n&&r[u][0]=="["&&/(^|[^\\])\!$/.test(this.out)&&(this.out=this.out.slice(0,this.out.length-1)+"\\!"),this.out+=n?this.esc(r[u],this.atBlockStart):r[u],u!=r.length-1&&(this.out+=`
|
|
34
|
-
`)}render(e,n,r){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,n,r);else{if(this.options.strict!==!1)throw new Error("Token type `"+e.type.name+"` not supported by Markdown renderer");e.type.isLeaf||(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}}renderContent(e){e.forEach((n,r,u)=>this.render(n,e,u))}renderInline(e,n=!0){this.atBlockStart=n;let r=[],u="",i=(s,o,l)=>{let a=s?s.marks:[];s&&s.type.name===this.options.hardBreakNodeName&&(a=a.filter(m=>{if(l+1==e.childCount)return!1;let g=e.child(l+1);return m.isInSet(g.marks)&&(!g.isText||/\S/.test(g.text))}));let c=u;if(u="",s&&s.isText&&a.some(m=>{let g=this.getMark(m.type.name);return g&&g.expelEnclosingWhitespace&&!m.isInSet(r)})){let[m,g,b]=/^(\s*)(.*)$/m.exec(s.text);g&&(c+=g,s=b?s.withText(b):null,s||(a=r))}if(s&&s.isText&&a.some(m=>{let g=this.getMark(m.type.name);return g&&g.expelEnclosingWhitespace&&!this.isMarkAhead(e,l+1,m)})){let[m,g,b]=/^(.*?)(\s*)$/m.exec(s.text);b&&(u=b,s=g?s.withText(g):null,s||(a=r))}let f=a.length?a[a.length-1]:null,p=f&&this.getMark(f.type.name).escape===!1,h=a.length-(p?1:0);e:for(let m=0;m<h;m++){let g=a[m];if(!this.getMark(g.type.name).mixable)break;for(let b=0;b<r.length;b++){let k=r[b];if(!this.getMark(k.type.name).mixable)break;if(g.eq(k)){m>b?a=a.slice(0,b).concat(g).concat(a.slice(b,m)).concat(a.slice(m+1,h)):b>m&&(a=a.slice(0,m).concat(a.slice(m+1,b)).concat(g).concat(a.slice(b,h)));continue e}}}let d=0;for(;d<Math.min(r.length,h)&&a[d].eq(r[d]);)++d;for(;d<r.length;)this.text(this.markString(r.pop(),!1,e,l),!1);if(c&&this.text(c),s){for(;r.length<h;){let m=a[r.length];r.push(m),this.text(this.markString(m,!0,e,l),!1),this.atBlockStart=!1}p&&s.isText?this.text(this.markString(f,!0,e,l)+s.text+this.markString(f,!1,e,l+1),!1):this.render(s,e,l),this.atBlockStart=!1}s?.isText&&s.nodeSize>0&&(this.atBlockStart=!1)};e.forEach(i),i(null,0,e.childCount),this.atBlockStart=!1}renderList(e,n,r){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let u=typeof e.attrs.tight<"u"?e.attrs.tight:this.options.tightLists,i=this.inTightList;this.inTightList=u,e.forEach((s,o,l)=>{l&&u&&this.flushClose(1),this.wrapBlock(n,r(l),e,()=>this.render(s,e,l))}),this.inTightList=i}esc(e,n=!1){return e=e.replace(/[`*\\~\[\]_]/g,(r,u)=>r=="_"&&u>0&&u+1<e.length&&e[u-1].match(/\w/)&&e[u+1].match(/\w/)?r:"\\"+r),n&&(e=e.replace(/^(\+[ ]|[\-*>])/,"\\$&").replace(/^(\s*)(#{1,6})(\s|$)/,"$1\\$2$3").replace(/^(\s*\d+)\.\s/,"$1\\. ")),this.options.escapeExtraCharacters&&(e=e.replace(this.options.escapeExtraCharacters,"\\$&")),e}quote(e){let n=e.indexOf('"')==-1?'""':e.indexOf("'")==-1?"''":"()";return n[0]+e+n[1]}repeat(e,n){let r="";for(let u=0;u<n;u++)r+=e;return r}markString(e,n,r,u){let i=this.getMark(e.type.name),s=n?i.open:i.close;return typeof s=="string"?s:s(this,e,r,u)}getEnclosingWhitespace(e){return{leading:(e.match(/^(\s+)/)||[void 0])[0],trailing:(e.match(/(\s+)$/)||[void 0])[0]}}isMarkAhead(e,n,r){for(;;n++){if(n==e.childCount)return!1;let u=e.child(n);if(u.type.name!=this.options.hardBreakNodeName)return r.isInSet(u.marks);n++}}}var Dn=200,q=function(){};q.prototype.append=function(e){return e.length?(e=q.from(e),!this.length&&e||e.length<Dn&&this.leafAppend(e)||this.length<Dn&&e.leafPrepend(this)||this.appendInner(e)):this};q.prototype.prepend=function(e){return e.length?q.from(e).append(this):this};q.prototype.appendInner=function(e){return new eh(this,e)};q.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?q.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};q.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};q.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};q.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var u=[];return this.forEach(function(i,s){return u.push(e(i,s))},n,r),u};q.from=function(e){return e instanceof q?e:e&&e.length?new To(e):q.empty};var To=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(u,i){return u==0&&i==this.length?this:new e(this.values.slice(u,i))},e.prototype.getInner=function(u){return this.values[u]},e.prototype.forEachInner=function(u,i,s,o){for(var l=i;l<s;l++)if(u(this.values[l],o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(u,i,s,o){for(var l=i-1;l>=s;l--)if(u(this.values[l],o+l)===!1)return!1},e.prototype.leafAppend=function(u){if(this.length+u.length<=Dn)return new e(this.values.concat(u.flatten()))},e.prototype.leafPrepend=function(u){if(this.length+u.length<=Dn)return new e(u.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(q);q.empty=new To([]);var eh=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,u,i,s){var o=this.left.length;if(u<o&&this.left.forEachInner(r,u,Math.min(i,o),s)===!1||i>o&&this.right.forEachInner(r,Math.max(u-o,0),Math.min(this.length,i)-o,s+o)===!1)return!1},e.prototype.forEachInvertedInner=function(r,u,i,s){var o=this.left.length;if(u>o&&this.right.forEachInvertedInner(r,u-o,Math.max(i,o)-o,s+o)===!1||i<o&&this.left.forEachInvertedInner(r,Math.min(u,o),i,s)===!1)return!1},e.prototype.sliceInner=function(r,u){if(r==0&&u==this.length)return this;var i=this.left.length;return u<=i?this.left.slice(r,u):r>=i?this.right.slice(r-i,u-i):this.left.slice(r,i).append(this.right.slice(0,u-i))},e.prototype.leafAppend=function(r){var u=this.right.leafAppend(r);if(u)return new e(this.left,u)},e.prototype.leafPrepend=function(r){var u=this.left.leafPrepend(r);if(u)return new e(u,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(q);const th=500;class ce{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let u,i;n&&(u=this.remapping(r,this.items.length),i=u.maps.length);let s=e.tr,o,l,a=[],c=[];return this.items.forEach((f,p)=>{if(!f.step){u||(u=this.remapping(r,p+1),i=u.maps.length),i--,c.push(f);return}if(u){c.push(new pe(f.map));let h=f.step.map(u.slice(i)),d;h&&s.maybeStep(h).doc&&(d=s.mapping.maps[s.mapping.maps.length-1],a.push(new pe(d,void 0,void 0,a.length+c.length))),i--,d&&u.appendMap(d,i)}else s.maybeStep(f.step);if(f.selection)return o=u?f.selection.map(u.slice(i)):f.selection,l=new ce(this.items.slice(0,r).append(c.reverse().concat(a)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:o}}addTransform(e,n,r,u){let i=[],s=this.eventCount,o=this.items,l=!u&&o.length?o.get(o.length-1):null;for(let c=0;c<e.steps.length;c++){let f=e.steps[c].invert(e.docs[c]),p=new pe(e.mapping.maps[c],f,n),h;(h=l&&l.merge(p))&&(p=h,c?i.pop():o=o.slice(0,o.length-1)),i.push(p),n&&(s++,n=void 0),u||(l=p)}let a=s-r.depth;return a>rh&&(o=nh(o,a),s-=a),new ce(o.append(i),s)}remapping(e,n){let r=new zt;return this.items.forEach((u,i)=>{let s=u.mirrorOffset!=null&&i-u.mirrorOffset>=e?r.maps.length-u.mirrorOffset:void 0;r.appendMap(u.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new ce(this.items.append(e.map(n=>new pe(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],u=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,o=this.eventCount;this.items.forEach(p=>{p.selection&&o--},u);let l=n;this.items.forEach(p=>{let h=i.getMirror(--l);if(h==null)return;s=Math.min(s,h);let d=i.maps[h];if(p.step){let m=e.steps[h].invert(e.docs[h]),g=p.selection&&p.selection.map(i.slice(l+1,h));g&&o++,r.push(new pe(d,m,g))}else r.push(new pe(d))},u);let a=[];for(let p=n;p<s;p++)a.push(new pe(i.maps[p]));let c=this.items.slice(0,u).append(a).append(r),f=new ce(c,o);return f.emptyItemCount()>th&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,u=[],i=0;return this.items.forEach((s,o)=>{if(o>=e)u.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),a=l&&l.getMap();if(r--,a&&n.appendMap(a,r),l){let c=s.selection&&s.selection.map(n.slice(r));c&&i++;let f=new pe(a.invert(),l,c),p,h=u.length-1;(p=u.length&&u[h].merge(f))?u[h]=p:u.push(f)}}else s.map&&r--},this.items.length,0),new ce(q.from(u.reverse()),i)}}ce.empty=new ce(q.empty,0);function nh(t,e){let n;return t.forEach((r,u)=>{if(r.selection&&e--==0)return n=u,!1}),t.slice(n)}class pe{constructor(e,n,r,u){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=u}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new pe(n.getMap().invert(),n,this.selection)}}}class Ne{constructor(e,n,r,u,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=u,this.prevComposition=i}}const rh=20;function uh(t,e,n,r){let u=n.getMeta(et),i;if(u)return u.historyState;n.getMeta(oh)&&(t=new Ne(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(et))return s.getMeta(et).redo?new Ne(t.done.addTransform(n,void 0,r,an(e)),t.undone,Mi(n.mapping.maps),t.prevTime,t.prevComposition):new Ne(t.done,t.undone.addTransform(n,void 0,r,an(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let o=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=o&&(t.prevTime<(n.time||0)-r.newGroupDelay||!ih(n,t.prevRanges)),a=s?or(t.prevRanges,n.mapping):Mi(n.mapping.maps);return new Ne(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,an(e)),ce.empty,a,n.time,o??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Ne(t.done.rebased(n,i),t.undone.rebased(n,i),or(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ne(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),or(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function ih(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,u)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&u>=e[i]&&(n=!0)}),n}function Mi(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,u,i,s)=>e.push(i,s));return e}function or(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let u=e.map(t[r],1),i=e.map(t[r+1],-1);u<=i&&n.push(u,i)}return n}function sh(t,e,n){let r=an(e),u=et.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),o=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),u,r),l=new Ne(n?o:i.remaining,n?i.remaining:o,null,0,-1);return i.transform.setSelection(s).setMeta(et,{redo:n,historyState:l})}let lr=!1,wi=null;function an(t){let e=t.plugins;if(wi!=e){lr=!1,wi=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){lr=!0;break}}return lr}const et=new as("history"),oh=new as("closeHistory");function lh(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new qr({key:et,state:{init(){return new Ne(ce.empty,ce.empty,null,0,-1)},apply(e,n,r){return uh(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,u=r=="historyUndo"?Fo:r=="historyRedo"?Nr:null;return!u||!e.editable?!1:(n.preventDefault(),u(e.state,e.dispatch))}}}})}function Oo(t,e){return(n,r)=>{let u=et.getState(n);if(!u||(t?u.undone:u.done).eventCount==0)return!1;if(r){let i=sh(u,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const Fo=Oo(!1,!0),Nr=Oo(!0,!0);var We={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},_n={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ah=typeof navigator<"u"&&/Mac/.test(navigator.platform),ch=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var W=0;W<10;W++)We[48+W]=We[96+W]=String(W);for(var W=1;W<=24;W++)We[W+111]="F"+W;for(var W=65;W<=90;W++)We[W]=String.fromCharCode(W+32),_n[W]=String.fromCharCode(W);for(var ar in We)_n.hasOwnProperty(ar)||(_n[ar]=We[ar]);function fh(t){var e=ah&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||ch&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?_n:We)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const dh=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),hh=typeof navigator<"u"&&/Win/.test(navigator.platform);function ph(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,u,i,s;for(let o=0;o<e.length-1;o++){let l=e[o];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))u=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))dh?s=!0:u=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),u&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function mh(t){let e=Object.create(null);for(let n in t)e[ph(n)]=t[n];return e}function cr(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function fr(t){return new qr({props:{handleKeyDown:gh(t)}})}function gh(t){let e=mh(t);return function(n,r){let u=fh(r),i,s=e[cr(u,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(u.length==1&&u!=" "){if(r.shiftKey){let o=e[cr(u,r,!1)];if(o&&o(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(hh&&r.ctrlKey&&r.altKey)&&(i=We[r.keyCode])&&i!=u){let o=e[cr(i,r)];if(o&&o(n.state,n.dispatch,n))return!0}}return!1}}const bh=new wo(Fr.schema,ue("commonmark",{breaks:!0}),Fr.tokens);function xh(t){return t.split(`
|
|
34
|
+
`)}render(e,n,r){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,n,r);else{if(this.options.strict!==!1)throw new Error("Token type `"+e.type.name+"` not supported by Markdown renderer");e.type.isLeaf||(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}}renderContent(e){e.forEach((n,r,u)=>this.render(n,e,u))}renderInline(e,n=!0){this.atBlockStart=n;let r=[],u="",i=(s,o,l)=>{let a=s?s.marks:[];s&&s.type.name===this.options.hardBreakNodeName&&(a=a.filter(m=>{if(l+1==e.childCount)return!1;let g=e.child(l+1);return m.isInSet(g.marks)&&(!g.isText||/\S/.test(g.text))}));let c=u;if(u="",s&&s.isText&&a.some(m=>{let g=this.getMark(m.type.name);return g&&g.expelEnclosingWhitespace&&!m.isInSet(r)})){let[m,g,b]=/^(\s*)(.*)$/m.exec(s.text);g&&(c+=g,s=b?s.withText(b):null,s||(a=r))}if(s&&s.isText&&a.some(m=>{let g=this.getMark(m.type.name);return g&&g.expelEnclosingWhitespace&&!this.isMarkAhead(e,l+1,m)})){let[m,g,b]=/^(.*?)(\s*)$/m.exec(s.text);b&&(u=b,s=g?s.withText(g):null,s||(a=r))}let f=a.length?a[a.length-1]:null,p=f&&this.getMark(f.type.name).escape===!1,h=a.length-(p?1:0);e:for(let m=0;m<h;m++){let g=a[m];if(!this.getMark(g.type.name).mixable)break;for(let b=0;b<r.length;b++){let k=r[b];if(!this.getMark(k.type.name).mixable)break;if(g.eq(k)){m>b?a=a.slice(0,b).concat(g).concat(a.slice(b,m)).concat(a.slice(m+1,h)):b>m&&(a=a.slice(0,m).concat(a.slice(m+1,b)).concat(g).concat(a.slice(b,h)));continue e}}}let d=0;for(;d<Math.min(r.length,h)&&a[d].eq(r[d]);)++d;for(;d<r.length;)this.text(this.markString(r.pop(),!1,e,l),!1);if(c&&this.text(c),s){for(;r.length<h;){let m=a[r.length];r.push(m),this.text(this.markString(m,!0,e,l),!1),this.atBlockStart=!1}p&&s.isText?this.text(this.markString(f,!0,e,l)+s.text+this.markString(f,!1,e,l+1),!1):this.render(s,e,l),this.atBlockStart=!1}s?.isText&&s.nodeSize>0&&(this.atBlockStart=!1)};e.forEach(i),i(null,0,e.childCount),this.atBlockStart=!1}renderList(e,n,r){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let u=typeof e.attrs.tight<"u"?e.attrs.tight:this.options.tightLists,i=this.inTightList;this.inTightList=u,e.forEach((s,o,l)=>{l&&u&&this.flushClose(1),this.wrapBlock(n,r(l),e,()=>this.render(s,e,l))}),this.inTightList=i}esc(e,n=!1){return e=e.replace(/[`*\\~\[\]_]/g,(r,u)=>r=="_"&&u>0&&u+1<e.length&&e[u-1].match(/\w/)&&e[u+1].match(/\w/)?r:"\\"+r),n&&(e=e.replace(/^(\+[ ]|[\-*>])/,"\\$&").replace(/^(\s*)(#{1,6})(\s|$)/,"$1\\$2$3").replace(/^(\s*\d+)\.\s/,"$1\\. ")),this.options.escapeExtraCharacters&&(e=e.replace(this.options.escapeExtraCharacters,"\\$&")),e}quote(e){let n=e.indexOf('"')==-1?'""':e.indexOf("'")==-1?"''":"()";return n[0]+e+n[1]}repeat(e,n){let r="";for(let u=0;u<n;u++)r+=e;return r}markString(e,n,r,u){let i=this.getMark(e.type.name),s=n?i.open:i.close;return typeof s=="string"?s:s(this,e,r,u)}getEnclosingWhitespace(e){return{leading:(e.match(/^(\s+)/)||[void 0])[0],trailing:(e.match(/(\s+)$/)||[void 0])[0]}}isMarkAhead(e,n,r){for(;;n++){if(n>=e.childCount)return!1;let u=e.child(n);if(u.type.name!=this.options.hardBreakNodeName)return r.isInSet(u.marks);n++}}}var Dn=200,L=function(){};L.prototype.append=function(e){return e.length?(e=L.from(e),!this.length&&e||e.length<Dn&&this.leafAppend(e)||this.length<Dn&&e.leafPrepend(this)||this.appendInner(e)):this};L.prototype.prepend=function(e){return e.length?L.from(e).append(this):this};L.prototype.appendInner=function(e){return new eh(this,e)};L.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?L.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};L.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};L.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};L.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var u=[];return this.forEach(function(i,s){return u.push(e(i,s))},n,r),u};L.from=function(e){return e instanceof L?e:e&&e.length?new To(e):L.empty};var To=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(u,i){return u==0&&i==this.length?this:new e(this.values.slice(u,i))},e.prototype.getInner=function(u){return this.values[u]},e.prototype.forEachInner=function(u,i,s,o){for(var l=i;l<s;l++)if(u(this.values[l],o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(u,i,s,o){for(var l=i-1;l>=s;l--)if(u(this.values[l],o+l)===!1)return!1},e.prototype.leafAppend=function(u){if(this.length+u.length<=Dn)return new e(this.values.concat(u.flatten()))},e.prototype.leafPrepend=function(u){if(this.length+u.length<=Dn)return new e(u.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(L);L.empty=new To([]);var eh=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,u,i,s){var o=this.left.length;if(u<o&&this.left.forEachInner(r,u,Math.min(i,o),s)===!1||i>o&&this.right.forEachInner(r,Math.max(u-o,0),Math.min(this.length,i)-o,s+o)===!1)return!1},e.prototype.forEachInvertedInner=function(r,u,i,s){var o=this.left.length;if(u>o&&this.right.forEachInvertedInner(r,u-o,Math.max(i,o)-o,s+o)===!1||i<o&&this.left.forEachInvertedInner(r,Math.min(u,o),i,s)===!1)return!1},e.prototype.sliceInner=function(r,u){if(r==0&&u==this.length)return this;var i=this.left.length;return u<=i?this.left.slice(r,u):r>=i?this.right.slice(r-i,u-i):this.left.slice(r,i).append(this.right.slice(0,u-i))},e.prototype.leafAppend=function(r){var u=this.right.leafAppend(r);if(u)return new e(this.left,u)},e.prototype.leafPrepend=function(r){var u=this.left.leafPrepend(r);if(u)return new e(u,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(L);const th=500;class ce{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let u,i;n&&(u=this.remapping(r,this.items.length),i=u.maps.length);let s=e.tr,o,l,a=[],c=[];return this.items.forEach((f,p)=>{if(!f.step){u||(u=this.remapping(r,p+1),i=u.maps.length),i--,c.push(f);return}if(u){c.push(new pe(f.map));let h=f.step.map(u.slice(i)),d;h&&s.maybeStep(h).doc&&(d=s.mapping.maps[s.mapping.maps.length-1],a.push(new pe(d,void 0,void 0,a.length+c.length))),i--,d&&u.appendMap(d,i)}else s.maybeStep(f.step);if(f.selection)return o=u?f.selection.map(u.slice(i)):f.selection,l=new ce(this.items.slice(0,r).append(c.reverse().concat(a)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:o}}addTransform(e,n,r,u){let i=[],s=this.eventCount,o=this.items,l=!u&&o.length?o.get(o.length-1):null;for(let c=0;c<e.steps.length;c++){let f=e.steps[c].invert(e.docs[c]),p=new pe(e.mapping.maps[c],f,n),h;(h=l&&l.merge(p))&&(p=h,c?i.pop():o=o.slice(0,o.length-1)),i.push(p),n&&(s++,n=void 0),u||(l=p)}let a=s-r.depth;return a>rh&&(o=nh(o,a),s-=a),new ce(o.append(i),s)}remapping(e,n){let r=new zt;return this.items.forEach((u,i)=>{let s=u.mirrorOffset!=null&&i-u.mirrorOffset>=e?r.maps.length-u.mirrorOffset:void 0;r.appendMap(u.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new ce(this.items.append(e.map(n=>new pe(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],u=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,o=this.eventCount;this.items.forEach(p=>{p.selection&&o--},u);let l=n;this.items.forEach(p=>{let h=i.getMirror(--l);if(h==null)return;s=Math.min(s,h);let d=i.maps[h];if(p.step){let m=e.steps[h].invert(e.docs[h]),g=p.selection&&p.selection.map(i.slice(l+1,h));g&&o++,r.push(new pe(d,m,g))}else r.push(new pe(d))},u);let a=[];for(let p=n;p<s;p++)a.push(new pe(i.maps[p]));let c=this.items.slice(0,u).append(a).append(r),f=new ce(c,o);return f.emptyItemCount()>th&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,u=[],i=0;return this.items.forEach((s,o)=>{if(o>=e)u.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),a=l&&l.getMap();if(r--,a&&n.appendMap(a,r),l){let c=s.selection&&s.selection.map(n.slice(r));c&&i++;let f=new pe(a.invert(),l,c),p,h=u.length-1;(p=u.length&&u[h].merge(f))?u[h]=p:u.push(f)}}else s.map&&r--},this.items.length,0),new ce(L.from(u.reverse()),i)}}ce.empty=new ce(L.empty,0);function nh(t,e){let n;return t.forEach((r,u)=>{if(r.selection&&e--==0)return n=u,!1}),t.slice(n)}class pe{constructor(e,n,r,u){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=u}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new pe(n.getMap().invert(),n,this.selection)}}}class Ne{constructor(e,n,r,u,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=u,this.prevComposition=i}}const rh=20;function uh(t,e,n,r){let u=n.getMeta(et),i;if(u)return u.historyState;n.getMeta(oh)&&(t=new Ne(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(et))return s.getMeta(et).redo?new Ne(t.done.addTransform(n,void 0,r,an(e)),t.undone,Mi(n.mapping.maps),t.prevTime,t.prevComposition):new Ne(t.done,t.undone.addTransform(n,void 0,r,an(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let o=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=o&&(t.prevTime<(n.time||0)-r.newGroupDelay||!ih(n,t.prevRanges)),a=s?or(t.prevRanges,n.mapping):Mi(n.mapping.maps);return new Ne(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,an(e)),ce.empty,a,n.time,o??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Ne(t.done.rebased(n,i),t.undone.rebased(n,i),or(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ne(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),or(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function ih(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,u)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&u>=e[i]&&(n=!0)}),n}function Mi(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,u,i,s)=>e.push(i,s));return e}function or(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let u=e.map(t[r],1),i=e.map(t[r+1],-1);u<=i&&n.push(u,i)}return n}function sh(t,e,n){let r=an(e),u=et.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),o=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),u,r),l=new Ne(n?o:i.remaining,n?i.remaining:o,null,0,-1);return i.transform.setSelection(s).setMeta(et,{redo:n,historyState:l})}let lr=!1,wi=null;function an(t){let e=t.plugins;if(wi!=e){lr=!1,wi=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){lr=!0;break}}return lr}const et=new as("history"),oh=new as("closeHistory");function lh(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new qr({key:et,state:{init(){return new Ne(ce.empty,ce.empty,null,0,-1)},apply(e,n,r){return uh(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,u=r=="historyUndo"?Fo:r=="historyRedo"?Nr:null;return!u||!e.editable?!1:(n.preventDefault(),u(e.state,e.dispatch))}}}})}function Oo(t,e){return(n,r)=>{let u=et.getState(n);if(!u||(t?u.undone:u.done).eventCount==0)return!1;if(r){let i=sh(u,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const Fo=Oo(!1,!0),Nr=Oo(!0,!0);var We={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},_n={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ah=typeof navigator<"u"&&/Mac/.test(navigator.platform),ch=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var $=0;$<10;$++)We[48+$]=We[96+$]=String($);for(var $=1;$<=24;$++)We[$+111]="F"+$;for(var $=65;$<=90;$++)We[$]=String.fromCharCode($+32),_n[$]=String.fromCharCode($);for(var ar in We)_n.hasOwnProperty(ar)||(_n[ar]=We[ar]);function fh(t){var e=ah&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||ch&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?_n:We)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const dh=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),hh=typeof navigator<"u"&&/Win/.test(navigator.platform);function ph(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,u,i,s;for(let o=0;o<e.length-1;o++){let l=e[o];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))u=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))dh?s=!0:u=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),u&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function mh(t){let e=Object.create(null);for(let n in t)e[ph(n)]=t[n];return e}function cr(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function fr(t){return new qr({props:{handleKeyDown:gh(t)}})}function gh(t){let e=mh(t);return function(n,r){let u=fh(r),i,s=e[cr(u,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(u.length==1&&u!=" "){if(r.shiftKey){let o=e[cr(u,r,!1)];if(o&&o(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(hh&&r.ctrlKey&&r.altKey)&&(i=We[r.keyCode])&&i!=u){let o=e[cr(i,r)];if(o&&o(n.state,n.dispatch,n))return!0}}return!1}}const bh=new wo(Fr.schema,ue("commonmark",{breaks:!0}),Fr.tokens);function xh(t){return t.split(`
|
|
35
35
|
`).map((n,r,u)=>n.trim()===""&&r<u.length-1?" ":n).join(`
|
|
36
|
-
`)}function Ti(t,e){const n=e?bh:Fr;let r=t??"";return e&&(r=xh(r)),n.parse(r)}const Ir={headings:!0,bold:!0,italic:!0,code:!0,links:!0,bulletList:!0,orderedList:!0,blockquote:!0,codeBlock:!0,horizontalRule:!0,hardBreak:!0,headerLevels:3};function kh(t){return new qr({view:()=>({update:()=>{t()}}),filterTransaction:()=>(t(),!0)})}const yh=t=>{const{value:e,onChange:n,onInput:r,onBlur:u,class:i,id:s,name:o,hasError:l,disabled:a,autofocus:c=!1,readOnly:f=!1,placeholder:p,showToolbar:h=!1,features:d,preserveLineBreaks:m=!1}=t,g=S.Value.toSignal(f),b=S.Value.toSignal(a??!1),k=S.Value.toSignal(h),y=S.computedOf(d??Ir)(M=>({...Ir,...M})),_=S.prop(null),E=vo.ticker();return S.
|
|
36
|
+
`)}function Ti(t,e){const n=e?bh:Fr;let r=t??"";return e&&(r=xh(r)),n.parse(r)}const Ir={headings:!0,bold:!0,italic:!0,code:!0,links:!0,bulletList:!0,orderedList:!0,blockquote:!0,codeBlock:!0,horizontalRule:!0,hardBreak:!0,headerLevels:3};function kh(t){return new qr({view:()=>({update:()=>{t()}}),filterTransaction:()=>(t(),!0)})}const yh=t=>{const{value:e,onChange:n,onInput:r,onBlur:u,class:i,id:s,name:o,hasError:l,disabled:a,autofocus:c=!1,readOnly:f=!1,placeholder:p,showToolbar:h=!1,features:d,preserveLineBreaks:m=!1}=t,g=S.Value.toSignal(f),b=S.Value.toSignal(a??!1),k=S.Value.toSignal(h),y=S.computedOf(d??Ir)(M=>({...Ir,...M})),_=S.prop(null),E=vo.ticker();return S.Use(Po.Theme,({appearance:M})=>S.html.div(S.OnDispose(()=>_.value?.destroy()),(t.cssInjection??"none")==="none"?null:S.Task(()=>Promise.resolve().then(()=>require("./styles-url-BSUFsmMD.cjs")),({default:C})=>zo.LinkPortal({id:"beatui-prosemirror-css",href:C})),S.attr.class("bc-prosemirror-editor-container"),S.attr.class(i),S.attr.class(S.Value.map(l??!1,C=>C?"bc-input-container--error":"")),S.attr.id(s),S.attr.name(o),S.When(S.computedOf(k,_)((C,w)=>C&&w!=null),()=>ys({view:_,stateUpdate:E,features:y,readOnly:g})),S.html.div(S.attr.class("bc-prosemirror-editor"),S.WithElement(C=>{const w=[];return(()=>{try{const ee=S.Value.get(e)??"",Je=S.Value.get(g)??!1,In=S.Value.get(b)??!1,Rn=S.Value.get(y),it=Dh(Rr,sf,Rn),we=Ti(ee,m),Bn=Ch(it),No=Ue.create({doc:we,schema:it,plugins:[lh(),fr({"Mod-z":Fo,"Mod-y":Nr,"Mod-Shift-z":Nr}),fr(Bn),fr(ra),kh(E.tick)]}),ae=new to(C,{state:No,editable:()=>!Je&&!In,dispatchTransaction(R){const he=ae.state.apply(R);if(ae.updateState(he),R.docChanged&&r!=null){const Xt=sr.serialize(he.doc);r(Xt)}}});if(_.set(ae),S.Value.get(c)&&ae.focus(),p!=null&&w.push(S.Value.on(p,R=>{R!=null&&R!==""?C.setAttribute("data-placeholder",R):C.removeAttribute("data-placeholder")})),w.push(S.Value.on(g,R=>{const he=S.Value.get(b);ae.setProps({editable:()=>!R&&!he})})),w.push(S.Value.on(b,R=>{const he=S.Value.get(g);ae.setProps({editable:()=>!he&&!R})})),w.push(S.Value.on(e,R=>{const he=sr.serialize(ae.state.doc);if(R!==he){const Xt=Ti(R,m);if(Xt!=null){const Io=Ue.create({doc:Xt,schema:it,plugins:ae.state.plugins});ae.updateState(Io)}}})),n!=null){const R=()=>{const he=sr.serialize(ae.state.doc);n(he)};C.addEventListener("blur",R,!0),w.push(()=>C.removeEventListener("blur",R,!0))}if(u!=null){const R=()=>{u()};C.addEventListener("blur",R,!0),w.push(()=>C.removeEventListener("blur",R,!0))}w.push(M.on(R=>{R==="dark"?C.classList.add("bc-prosemirror-editor--dark"):C.classList.remove("bc-prosemirror-editor--dark")})),w.push(()=>ae.destroy())}catch(ee){console.error("[BeatUI] Failed to initialize ProseMirror editor:",ee);const Je=C;Je.textContent="Failed to load ProseMirror Editor. Please ensure prosemirror packages are installed."}})(),S.OnDispose(()=>{w.forEach(ee=>ee())})}))))};function Ch(t){const e={},n=t.marks.strong;n!=null&&(e["Mod-b"]=(i,s)=>on(n)(i,s));const r=t.marks.em;r!=null&&(e["Mod-i"]=(i,s)=>on(r)(i,s));const u=t.marks.code;return u!=null&&(e["Mod-`"]=(i,s)=>on(u)(i,s)),e}function Dh(t,e,n){const r={},u={},i=e.spec.nodes.get("doc"),s=e.spec.nodes.get("text");if(i==null||s==null)throw new Error("Basic schema missing required doc or text nodes");r.doc={...i,content:"block+"},r.text=s;const o=e.spec.nodes.get("paragraph");if(o!=null&&(r.paragraph={...o,content:"inline*"}),n.headings){const l=e.spec.nodes.get("heading");l!=null&&(r.heading={...l,content:"inline*"})}if(n.bulletList){const l=e.spec.nodes.get("bullet_list"),a=e.spec.nodes.get("list_item");l!=null&&(r.bullet_list={...l,content:"list_item+"}),a!=null&&(r.list_item={...a,content:"paragraph block*"})}if(n.orderedList){const l=e.spec.nodes.get("ordered_list"),a=e.spec.nodes.get("list_item");l!=null&&(r.ordered_list={...l,content:"list_item+"}),a!=null&&!r.list_item&&(r.list_item={...a,content:"paragraph block*"})}if(n.blockquote){const l=e.spec.nodes.get("blockquote");l!=null&&(r.blockquote={...l,content:"block+"})}if(n.codeBlock){const l=e.spec.nodes.get("code_block");l!=null&&(r.code_block=l)}if(n.horizontalRule){const l=e.spec.nodes.get("horizontal_rule");l!=null&&(r.horizontal_rule=l)}if(n.hardBreak){const l=e.spec.nodes.get("hard_break");l!=null&&(r.hard_break=l)}if(n.bold){const l=e.spec.marks.get("strong");l!=null&&(u.strong=l)}if(n.italic){const l=e.spec.marks.get("em");l!=null&&(u.em=l)}if(n.code){const l=e.spec.marks.get("code");l!=null&&(u.code=l)}if(n.links){const l=e.spec.marks.get("link");l!=null&&(u.link=l)}return new t({nodes:r,marks:u})}exports.DEFAULT_FEATURES=Ir;exports.Fragment=x;exports.NodeRange=vi;exports.ProseMirrorMarkdownInput=yh;exports.ProseMirrorToolbar=ys;exports.ReplaceAroundStep=Y;exports.Slice=D;exports.canJoin=vr;exports.canSplit=Ot;exports.findWrapping=Qi;exports.liftTarget=Jt;
|