@siteboon/claude-code-ui 1.13.6 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{r as Dp,a as ve}from"./vendor-react-DVSKlM5e.js";var ws={exports:{}},Wi={};/**
1
+ import{r as Dp,a as ve}from"./vendor-react-DcyRfQm3.js";var ws={exports:{}},Wi={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@ import{r as Dp,a as ve}from"./vendor-react-DVSKlM5e.js";var ws={exports:{}},Wi={
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Ta;function jp(){if(Ta)return Wi;Ta=1;var n=Dp(),e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,r=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(l,a,h){var c,f={},O=null,u=null;h!==void 0&&(O=""+h),a.key!==void 0&&(O=""+a.key),a.ref!==void 0&&(u=a.ref);for(c in a)i.call(a,c)&&!s.hasOwnProperty(c)&&(f[c]=a[c]);if(l&&l.defaultProps)for(c in a=l.defaultProps,a)f[c]===void 0&&(f[c]=a[c]);return{$$typeof:e,type:l,key:O,ref:u,props:f,_owner:r.current}}return Wi.Fragment=t,Wi.jsx=o,Wi.jsxs=o,Wi}var Ca;function Bp(){return Ca||(Ca=1,ws.exports=jp()),ws.exports}var Gp=Bp();function So(){return So=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},So.apply(null,arguments)}function Ip(n,e){if(n==null)return{};var t={};for(var i in n)if({}.hasOwnProperty.call(n,i)){if(e.indexOf(i)!==-1)continue;t[i]=n[i]}return t}let yo=[],$f=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?$f:yo).push(t=t+n[e])})();function Up(n){if(n<768)return!1;for(let e=0,t=yo.length;;){let i=e+t>>1;if(n<yo[i])t=i;else if(n>=$f[i])e=i+1;else return!0;if(e==t)return!1}}function Xa(n){return n>=127462&&n<=127487}const Ra=8205;function Np(n,e,t=!0,i=!0){return(t?wf:Fp)(n,e,i)}function wf(n,e,t){if(e==n.length)return e;e&&vf(n.charCodeAt(e))&&Tf(n.charCodeAt(e-1))&&e--;let i=vs(n,e);for(e+=qa(i);e<n.length;){let r=vs(n,e);if(i==Ra||r==Ra||t&&Up(r))e+=qa(r),i=r;else if(Xa(r)){let s=0,o=e-2;for(;o>=0&&Xa(vs(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Fp(n,e,t){for(;e>0;){let i=wf(n,e-2,t);if(i<e)return i;e--}return 0}function vs(n,e){let t=n.charCodeAt(e);if(!Tf(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return vf(i)?(t-55296<<10)+(i-56320)+65536:t}function vf(n){return n>=56320&&n<57344}function Tf(n){return n>=55296&&n<56320}function qa(n){return n<65536?1:2}class B{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=wi(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),st.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=wi(this,e,t);let i=[];return this.decompose(e,t,i,0),st.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new rn(this),s=new rn(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new rn(this,e)}iterRange(e,t=this.length){return new Cf(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Xf(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?B.empty:e.length<=32?new re(e):st.from(re.split(e,[]))}}class re extends B{constructor(e,t=Hp(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?i:l)>=e)return new Kp(r,l,i,o);r=l+1,i++}}decompose(e,t,i,r){let s=e<=0&&t>=this.length?this:new re(Za(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=i.pop(),l=Qr(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new re(l,o.length+s.length));else{let a=l.length>>1;i.push(new re(l.slice(0,a)),new re(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof re))return super.replace(e,t,i);[e,t]=wi(this,e,t);let r=Qr(this.text,Qr(i.text,Za(this.text,0,e)),t),s=this.length+i.length-(t-e);return r.length<=32?new re(r,s):st.from(re.split(r,[]),s)}sliceString(e,t=this.length,i=`
9
+ */var Ta;function jp(){if(Ta)return Wi;Ta=1;var n=Dp(),e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,r=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(l,a,h){var c,f={},O=null,u=null;h!==void 0&&(O=""+h),a.key!==void 0&&(O=""+a.key),a.ref!==void 0&&(u=a.ref);for(c in a)i.call(a,c)&&!s.hasOwnProperty(c)&&(f[c]=a[c]);if(l&&l.defaultProps)for(c in a=l.defaultProps,a)f[c]===void 0&&(f[c]=a[c]);return{$$typeof:e,type:l,key:O,ref:u,props:f,_owner:r.current}}return Wi.Fragment=t,Wi.jsx=o,Wi.jsxs=o,Wi}var Ca;function Bp(){return Ca||(Ca=1,ws.exports=jp()),ws.exports}var Gp=Bp();function Ip(n,e){if(n==null)return{};var t={};for(var i in n)if({}.hasOwnProperty.call(n,i)){if(e.indexOf(i)!==-1)continue;t[i]=n[i]}return t}function So(){return So=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},So.apply(null,arguments)}let yo=[],$f=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?$f:yo).push(t=t+n[e])})();function Up(n){if(n<768)return!1;for(let e=0,t=yo.length;;){let i=e+t>>1;if(n<yo[i])t=i;else if(n>=$f[i])e=i+1;else return!0;if(e==t)return!1}}function Xa(n){return n>=127462&&n<=127487}const Ra=8205;function Np(n,e,t=!0,i=!0){return(t?wf:Fp)(n,e,i)}function wf(n,e,t){if(e==n.length)return e;e&&vf(n.charCodeAt(e))&&Tf(n.charCodeAt(e-1))&&e--;let i=vs(n,e);for(e+=qa(i);e<n.length;){let r=vs(n,e);if(i==Ra||r==Ra||t&&Up(r))e+=qa(r),i=r;else if(Xa(r)){let s=0,o=e-2;for(;o>=0&&Xa(vs(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Fp(n,e,t){for(;e>0;){let i=wf(n,e-2,t);if(i<e)return i;e--}return 0}function vs(n,e){let t=n.charCodeAt(e);if(!Tf(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return vf(i)?(t-55296<<10)+(i-56320)+65536:t}function vf(n){return n>=56320&&n<57344}function Tf(n){return n>=55296&&n<56320}function qa(n){return n<65536?1:2}class B{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=wi(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),st.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=wi(this,e,t);let i=[];return this.decompose(e,t,i,0),st.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new rn(this),s=new rn(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new rn(this,e)}iterRange(e,t=this.length){return new Cf(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Xf(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?B.empty:e.length<=32?new re(e):st.from(re.split(e,[]))}}class re extends B{constructor(e,t=Hp(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?i:l)>=e)return new Kp(r,l,i,o);r=l+1,i++}}decompose(e,t,i,r){let s=e<=0&&t>=this.length?this:new re(Za(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=i.pop(),l=Qr(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new re(l,o.length+s.length));else{let a=l.length>>1;i.push(new re(l.slice(0,a)),new re(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof re))return super.replace(e,t,i);[e,t]=wi(this,e,t);let r=Qr(this.text,Qr(i.text,Za(this.text,0,e)),t),s=this.length+i.length-(t-e);return r.length<=32?new re(r,s):st.from(re.split(r,[]),s)}sliceString(e,t=this.length,i=`
10
10
  `){[e,t]=wi(this,e,t);let r="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=i),e<a&&t>s&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let s of e)i.push(s),r+=s.length+1,i.length==32&&(t.push(new re(i,r)),i=[],r=-1);return r>-1&&t.push(new re(i,r)),t}}class st extends B{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,r);r=l+1,i=a+1}}decompose(e,t,i,r){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=wi(this,e,t),i.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[r]=a,new st(c,this.length-(t-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
11
11
  `){[e,t]=wi(this,e,t);let r="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=i),e<a&&t>o&&(r+=l.sliceString(e-o,t-o,i)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof st))return 0;let i=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return i;let a=this.children[r],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let u of e)i+=u.lines;if(i<32){let u=[];for(let d of e)d.flatten(u);return new re(u,t)}let r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function f(u){let d;if(u.lines>s&&u instanceof st)for(let m of u.children)f(m);else u.lines>o&&(a>o||!a)?(O(),l.push(u)):u instanceof re&&a&&(d=c[c.length-1])instanceof re&&u.lines+d.lines<=32?(a+=u.lines,h+=u.length+1,c[c.length-1]=new re(d.text.concat(u.text),d.length+1+u.length)):(a+u.lines>r&&O(),a+=u.lines,h+=u.length+1,c.push(u))}function O(){a!=0&&(l.push(c.length==1?c[0]:st.from(c,h)),h=-1,a=c.length=0)}for(let u of e)f(u);return O(),l.length==1?l[0]:new st(l,t)}}B.empty=new re([""],0);function Hp(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Qr(n,e,t=0,i=1e9){for(let r=0,s=0,o=!0;s<n.length&&r<=i;s++){let l=n[s],a=r+l.length;a>=t&&(a>i&&(l=l.slice(0,i-r)),r<t&&(l=l.slice(t-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function Za(n,e,t){return Qr(n,[""],e,t)}class rn{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof re?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof re?r.text.length:r.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
12
12
  `,this;e--}else if(r instanceof re){let a=r.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof re?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Cf{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new rn(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Xf{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(B.prototype[Symbol.iterator]=function(){return this.iter()},rn.prototype[Symbol.iterator]=Cf.prototype[Symbol.iterator]=Xf.prototype[Symbol.iterator]=function(){return this});let Kp=class{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}};function wi(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Se(n,e,t=!0,i=!0){return Np(n,e,t,i)}function Jp(n){return n>=56320&&n<57344}function em(n){return n>=55296&&n<56320}function Re(n,e){let t=n.charCodeAt(e);if(!em(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Jp(i)?(t-55296<<10)+(i-56320)+65536:t}function vl(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function ot(n){return n<65536?1:2}const bo=/\r\n?|\n/;var Qe=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(Qe||(Qe={}));class ft{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,r,s),r+=s):r+=o,i+=s}}iterChangedRanges(e,t=!1){xo(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new ft(e)}composeDesc(e){return this.empty?e:e.empty?this:Rf(this,e)}mapDesc(e,t=!1){return e.empty?this:ko(this,e,t)}mapPos(e,t=-1,i=Qe.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=r+l;if(a<0){if(h>e)return s+(e-r);s+=l}else{if(i!=Qe.Simple&&h>=e&&(i==Qe.TrackDel&&r<e&&h>e||i==Qe.TrackBefore&&r<e||i==Qe.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let s=this.sections[i++],o=this.sections[i++],l=r+s;if(o>=0&&r<=t&&l>=e)return r<e&&l>t?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ft(e)}static create(e){return new ft(e)}}class ce extends ft{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return xo(this,(t,i,r,s,o)=>e=e.replace(r,r+(i-t),o),!1),e}mapDesc(e,t=!1){return ko(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,s=0;r<t.length;r+=2){let o=t[r],l=t[r+1];if(l>=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;i.length<a;)i.push(B.empty);i.push(o?e.slice(s,s+o):B.empty)}s+=o}return new ce(t,i)}compose(e){return this.empty?e:e.empty?this:Rf(this,e,!0)}map(e,t=!1){return e.empty?this:ko(this,e,t,!0)}iterChanges(e,t=!1){xo(this,e,t)}get desc(){return ft.create(this.sections)}filter(e){let t=[],i=[],r=[],s=new On(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let c=Math.min(s.len,a-l);ke(r,c,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;ke(t,c,f),f>0&&At(i,t,s.text),s.forward(c),l+=c}let h=e[o++];for(;l<h;){if(s.done)break e;let c=Math.min(s.len,h-l);ke(t,c,-1),ke(r,c,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(c),l+=c}}return{changes:new ce(t,i),filtered:ft.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],r=this.sections[t+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let r=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!r.length)return;o<t&&ke(r,t-o,-1);let f=new ce(r,s);l=l?l.compose(f.map(l)):f,r=[],s=[],o=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof ce){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:f,to:O=f,insert:u}=c;if(f>O||f<0||O>t)throw new RangeError(`Invalid change range ${f} to ${O} (in doc of length ${t})`);let d=u?typeof u=="string"?B.of(u.split(i||bo)):u:B.empty,m=d.length;if(f==O&&m==0)return;f<o&&a(),f>o&&ke(r,f-o,-1),ke(r,O-f,m),At(s,r,d),o=O}}return h(e),a(!l),l}static empty(e){return new ce(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let r=0;r<e.length;r++){let s=e[r];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<r;)i.push(B.empty);i[r]=B.of(s.slice(1)),t.push(s[0],i[r].length)}}}return new ce(t,i)}static createSet(e,t){return new ce(e,t)}}function ke(n,e,t,i=!1){if(e==0&&t<=0)return;let r=n.length-2;r>=0&&t<=0&&t==n[r+1]?n[r]+=e:r>=0&&e==0&&n[r]==0?n[r+1]+=t:i?(n[r]+=e,n[r+1]+=t):n.push(e,t)}function At(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(B.empty);n.push(t)}}function xo(n,e,t){let i=n.inserted;for(let r=0,s=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)r+=l,s+=l;else{let h=r,c=s,f=B.empty;for(;h+=l,c+=a,a&&i&&(f=f.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(r,h,s,c,f),r=h,s=c}}}function ko(n,e,t,i=!1){let r=[],s=i?[]:null,o=new On(n),l=new On(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ke(r,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(ke(r,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(ke(r,0,o.ins),s&&At(s,r,o.text),a=o.i),o.forward(c),h-=c}l.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;ke(r,h,a<o.i?o.ins:0),s&&a<o.i&&At(s,r,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return s?ce.createSet(r,s):ft.create(r);throw new Error("Mismatched change set lengths")}}}function Rf(n,e,t=!1){let i=[],r=t?[]:null,s=new On(n),o=new On(e);for(let l=!1;;){if(s.done&&o.done)return r?ce.createSet(i,r):ft.create(i);if(s.ins==0)ke(i,s.len,0,l),s.next();else if(o.len==0&&!o.done)ke(i,0,o.ins,l),r&&At(r,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),h=i.length;if(s.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;ke(i,a,c,l),r&&c&&At(r,i,o.text)}else o.ins==-1?(ke(i,s.off?0:s.len,a,l),r&&At(r,i,s.textBit(a))):(ke(i,s.off?0:s.len,o.off?0:o.ins,l),r&&!o.off&&At(r,i,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),s.forward2(a),o.forward(a)}}}}class On{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?B.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?B.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class ei{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new ei(i,r,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return y.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return y.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return y.range(e.anchor,e.head)}static create(e,t,i){return new ei(e,t,i)}}class y{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:y.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new y([this.main],0)}addRange(e,t=!0){return y.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,y.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new y(e.ranges.map(t=>ei.fromJSON(t)),e.main)}static single(e,t=e){return new y([y.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let s=e[r];if(s.empty?s.from<=i:s.from<i)return y.normalized(e.slice(),t);i=s.to}return new y(e,t)}static cursor(e,t=0,i,r){return ei.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(r??16777215)<<6)}static range(e,t,i,r){let s=(i??16777215)<<6|(r==null?7:Math.min(6,r));return t<e?ei.create(t,e,48|s):ei.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let i=e[t];e.sort((r,s)=>r.from-s.from),t=e.indexOf(i);for(let r=1;r<e.length;r++){let s=e[r],o=e[r-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);r<=t&&t--,e.splice(--r,2,s.anchor>s.head?y.range(a,l):y.range(l,a))}}return new y(e,t)}}function qf(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Tl=0;class X{constructor(e,t,i,r,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=r,this.id=Tl++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new X(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Cl),!!e.static,e.enables)}of(e){return new Sr([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Sr(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Sr(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Cl(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Sr{constructor(e,t,i,r){this.dependencies=e,this.facet=t,this.type=i,this.value=r,this.id=Tl++}dynamicSlot(e){var t;let i=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,O){if(a&&O.docChanged||h&&(O.docChanged||O.selection)||Po(f,c)){let u=i(f);if(l?!Aa(u,f.values[o],r):!r(u,f.values[o]))return f.values[o]=u,1}return 0},reconfigure:(f,O)=>{let u,d=O.config.address[s];if(d!=null){let m=_r(O,d);if(this.dependencies.every(g=>g instanceof X?O.facet(g)===f.facet(g):g instanceof de?O.field(g,!1)==f.field(g,!1):!0)||(l?Aa(u=i(f),m,r):r(u=i(f),m)))return f.values[o]=m,0}else u=i(f);return f.values[o]=u,1}}}}function Aa(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function Po(n,e){let t=!1;for(let i of e)sn(n,i)&1&&(t=!0);return t}function tm(n,e,t){let i=t.map(a=>n[a.id]),r=t.map(a=>a.type),s=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let f=_r(a,i[c]);if(r[c]==2)for(let O of f)h.push(O);else h.push(f)}return e.combine(h)}return{create(a){for(let h of i)sn(a,h);return a.values[o]=l(a),1},update(a,h){if(!Po(a,s))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=Po(a,i),f=h.config.facets[e.id],O=h.facet(e);if(f&&!c&&Cl(t,f))return a.values[o]=O,0;let u=l(a);return e.compare(u,O)?(a.values[o]=O,0):(a.values[o]=u,1)}}}const Gn=X.define({static:!0});class de{constructor(e,t,i,r,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=r,this.spec=s,this.provides=void 0}static define(e){let t=new de(Tl++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Gn).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,r)=>{let s=i.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,r)=>{let s=i.facet(Gn),o=r.facet(Gn),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):r.config.address[this.id]!=null?(i.values[t]=r.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,Gn.of({field:this,create:e})]}get extension(){return this}}const Kt={lowest:4,low:3,default:2,high:1,highest:0};function Di(n){return e=>new Zf(e,n)}const Xt={highest:Di(Kt.highest),high:Di(Kt.high),default:Di(Kt.default),low:Di(Kt.low),lowest:Di(Kt.lowest)};class Zf{constructor(e,t){this.inner=e,this.prec=t}}class Os{of(e){return new $o(this,e)}reconfigure(e){return Os.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class $o{constructor(e,t){this.compartment=e,this.inner=t}}class Er{constructor(e,t,i,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let r=[],s=Object.create(null),o=new Map;for(let O of im(e,t,o))O instanceof de?r.push(O):(s[O.facet.id]||(s[O.facet.id]=[])).push(O);let l=Object.create(null),a=[],h=[];for(let O of r)l[O.id]=h.length<<1,h.push(u=>O.slot(u));let c=i?.config.facets;for(let O in s){let u=s[O],d=u[0].facet,m=c&&c[O]||[];if(u.every(g=>g.type==0))if(l[d.id]=a.length<<1|1,Cl(m,u))a.push(i.facet(d));else{let g=d.combine(u.map(Q=>Q.value));a.push(i&&d.compare(g,i.facet(d))?i.facet(d):g)}else{for(let g of u)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(Q=>g.dynamicSlot(Q)));l[d.id]=h.length<<1,h.push(g=>tm(g,d,u))}}let f=h.map(O=>O(l));return new Er(e,o,f,l,a,s)}}function im(n,e,t){let i=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof $o&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof $o){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof Zf)s(o.inner,o.prec);else if(o instanceof de)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Sr)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,Kt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(n,Kt.default),i.reduce((o,l)=>o.concat(l))}function sn(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let r=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|r}function _r(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Af=X.define(),wo=X.define({combine:n=>n.some(e=>e),static:!0}),Mf=X.define({combine:n=>n.length?n[0]:void 0,static:!0}),Ef=X.define(),_f=X.define(),Vf=X.define(),zf=X.define({combine:n=>n.length?n[0]:!1});class dt{constructor(e,t){this.type=e,this.value=t}static define(){return new nm}}class nm{of(e){return new dt(this,e)}}class rm{constructor(e){this.map=e}of(e){return new _(this,e)}}class _{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new _(this.type,t)}is(e){return this.type==e}static define(e={}){return new rm(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let r of e){let s=r.map(t);s&&i.push(s)}return i}}_.reconfigure=_.define();_.appendConfig=_.define();class ae{constructor(e,t,i,r,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&qf(i,t.newLength),s.some(l=>l.type==ae.time)||(this.annotations=s.concat(ae.time.of(Date.now())))}static create(e,t,i,r,s,o){return new ae(e,t,i,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ae.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ae.time=dt.define();ae.userEvent=dt.define();ae.addToHistory=dt.define();ae.remote=dt.define();function sm(n,e){let t=[];for(let i=0,r=0;;){let s,o;if(i<n.length&&(r==e.length||e[r]>=n[i]))s=n[i++],o=n[i++];else if(r<e.length)s=e[r++],o=e[r++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Yf(n,e,t){var i;let r,s,o;return t?(r=e.changes,s=ce.empty(e.changes.length),o=n.changes.compose(e.changes)):(r=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(s):(i=n.selection)===null||i===void 0?void 0:i.map(r),effects:_.mapEffects(n.effects,r).concat(_.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function vo(n,e,t){let i=e.selection,r=Si(e.annotations);return e.userEvent&&(r=r.concat(ae.userEvent.of(e.userEvent))),{changes:e.changes instanceof ce?e.changes:ce.of(e.changes||[],t,n.facet(Mf)),selection:i&&(i instanceof y?i:y.single(i.anchor,i.head)),effects:Si(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Lf(n,e,t){let i=vo(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;i=Yf(i,vo(n,e[s],o?i.changes.newLength:n.doc.length),o)}let r=ae.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return lm(t?om(r):r)}function om(n){let e=n.startState,t=!0;for(let r of e.facet(Ef)){let s=r(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:sm(t,s))}if(t!==!0){let r,s;if(t===!1)s=n.changes.invertedDesc,r=ce.empty(e.doc.length);else{let o=n.changes.filter(t);r=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=ae.create(e,r,n.selection&&n.selection.map(s),_.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let i=e.facet(_f);for(let r=i.length-1;r>=0;r--){let s=i[r](n);s instanceof ae?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof ae?n=s[0]:n=Lf(e,Si(s),!1)}return n}function lm(n){let e=n.startState,t=e.facet(Vf),i=n;for(let r=t.length-1;r>=0;r--){let s=t[r](n);s&&Object.keys(s).length&&(i=Yf(i,vo(e,s,n.changes.newLength),!0))}return i==n?n:ae.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const am=[];function Si(n){return n==null?am:Array.isArray(n)?n:[n]}var ie=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(ie||(ie={}));const hm=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let To;try{To=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function cm(n){if(To)return To.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||hm.test(t)))return!0}return!1}function fm(n){return e=>{if(!/\S/.test(e))return ie.Space;if(cm(e))return ie.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return ie.Word;return ie.Other}}class W{constructor(e,t,i,r,s,o){this.config=e,this.doc=t,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)sn(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return sn(this,i),_r(this,i)}update(...e){return Lf(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:r}=t;for(let l of e.effects)l.is(Os.reconfigure)?(t&&(r=new Map,t.compartments.forEach((a,h)=>r.set(h,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is(_.reconfigure)?(t=null,i=l.value):l.is(_.appendConfig)&&(t=null,i=Si(i).concat(l.value));let s;t?s=e.startState.values.slice():(t=Er.resolve(i,r,this),s=new W(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(wo)?e.newSelection:e.newSelection.asSingle();new W(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:y.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),r=this.changes(i.changes),s=[i.range],o=Si(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),c=h.map(r);for(let O=0;O<l;O++)s[O]=s[O].map(c);let f=r.mapDesc(h,!0);s.push(a.range.map(f)),r=r.compose(c),o=_.mapEffects(o,c).concat(_.mapEffects(Si(a.effects),f))}return{changes:r,selection:y.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ce?e:ce.of(e,this.doc.length,this.facet(W.lineSeparator))}toText(e){return B.of(e.split(this.facet(W.lineSeparator)||bo))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(sn(this,t),_r(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof de&&this.config.address[r.id]!=null&&(t[i]=r.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let o=i[s],l=e[s];r.push(o.init(a=>o.spec.fromJSON(l,a)))}}return W.create({doc:e.doc,selection:y.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=Er.resolve(e.extensions||[],new Map),i=e.doc instanceof B?e.doc:B.of((e.doc||"").split(t.staticFacet(W.lineSeparator)||bo)),r=e.selection?e.selection instanceof y?e.selection:y.single(e.selection.anchor,e.selection.head):y.single(0);return qf(r,i.length),t.staticFacet(wo)||(r=r.asSingle()),new W(t,i,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(W.tabSize)}get lineBreak(){return this.facet(W.lineSeparator)||`
@@ -36,4 +36,4 @@ import{r as Dp,a as ve}from"./vendor-react-DVSKlM5e.js";var ws={exports:{}},Wi={
36
36
  `+e.scrub();for(let i of e.markers)t.marks.push(i)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=Ap(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=a$;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let i=this.absoluteLineStart,r=this.rangeI;for(;this.ranges[r].to<t.end;){r++;let s=this.ranges[r].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[r-1].to-i)+o,i=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:i}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=i,e.reset(t);e.depth<this.stack.length;e.depth++){let r=this.stack[e.depth],s=this.parser.skipContextMarkup[r.type];if(!s)throw new Error("Unhandled block context "+$[r.type]);if(!s(r,this,e))break;e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),i;if(this.input.lineChunks)i=t==`
37
37
  `?"":t;else{let r=t.indexOf(`
38
38
  `);i=r<0?t:t.slice(0,r)}return e+i.length>this.to?i.slice(0,this.to-e):i}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,i=0){this.block=fs.create(e,i,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,i=0){this.startContext(this.parser.getNodeType(e),t,i)}addNode(e,t,i){typeof e=="number"&&(e=new I(this.parser.nodeSet.types[e],Ei,Ei,(i??this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(Pl(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?$p(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let i of e.parsers)if(i.finish(this,e))return;let t=Pl(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish($.Paragraph,e.content.length),e.start)}elt(e,t,i,r){return typeof e=="string"?j(this.parser.getNodeType(e),t,i,r):new Tp(e,t)}get buffer(){return new vp(this.parser.nodeSet)}}function $p(n,e,t,i,r){let s=n[e].to,o=[],l=[],a=t.from+i;function h(c,f){for(;f?c>=s:c>s;){let O=n[e+1].from-s;i+=O,c+=O,e++,s=n[e].to}}for(let c=t.firstChild;c;c=c.nextSibling){h(c.from+i,!0);let f=c.from+i,O,u=r.get(c.tree);u?O=u:c.to+i>s?(O=$p(n,e,c,i,r),h(c.to+i,!1)):O=c.toTree(),o.push(O),l.push(f-a)}return h(t.to+i,!1),new I(t.type,o,l,t.to+i-a,t.tree?t.tree.propValues:void 0)}class $s extends Il{constructor(e,t,i,r,s,o,l,a,h){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=i,this.blockNames=r,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=l,this.inlineNames=a,this.wrappers=h,this.nodeTypes=Object.create(null);for(let c of e.types)this.nodeTypes[c.name]=c.id}createParse(e,t,i){let r=new h$(this,e,t,i);for(let s of this.wrappers)r=s(r,e,t,i);return r}configure(e){let t=xl(e);if(!t)return this;let{nodeSet:i,skipContextMarkup:r}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),l=this.blockNames.slice(),a=this.inlineParsers.slice(),h=this.inlineNames.slice(),c=this.endLeafBlock.slice(),f=this.wrappers;if(Hi(t.defineNodes)){r=Object.assign({},r);let O=i.types.slice(),u;for(let d of t.defineNodes){let{name:m,block:g,composite:Q,style:S}=typeof d=="string"?{name:d}:d;if(O.some(b=>b.name==m))continue;Q&&(r[O.length]=(b,P,w)=>Q(P,w,b.value));let x=O.length,k=Q?["Block","BlockContext"]:g?x>=$.ATXHeading1&&x<=$.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;O.push(fe.define({id:x,name:m,props:k&&[[M.group,k]]})),S&&(u||(u={}),Array.isArray(S)||S instanceof Ye?u[m]=S:Object.assign(u,S))}i=new zn(O),u&&(i=i.extend(Gt(u)))}if(Hi(t.props)&&(i=i.extend(...t.props)),Hi(t.remove))for(let O of t.remove){let u=this.blockNames.indexOf(O),d=this.inlineNames.indexOf(O);u>-1&&(s[u]=o[u]=void 0),d>-1&&(a[d]=void 0)}if(Hi(t.parseBlock))for(let O of t.parseBlock){let u=l.indexOf(O.name);if(u>-1)s[u]=O.parse,o[u]=O.leaf;else{let d=O.before?gr(l,O.before):O.after?gr(l,O.after)+1:l.length-1;s.splice(d,0,O.parse),o.splice(d,0,O.leaf),l.splice(d,0,O.name)}O.endLeaf&&c.push(O.endLeaf)}if(Hi(t.parseInline))for(let O of t.parseInline){let u=h.indexOf(O.name);if(u>-1)a[u]=O.parse;else{let d=O.before?gr(h,O.before):O.after?gr(h,O.after)+1:h.length-1;a.splice(d,0,O.parse),h.splice(d,0,O.name)}}return t.wrap&&(f=f.concat(t.wrap)),new $s(i,s,o,l,c,r,a,h,f)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let i=new f$(this,e,t);e:for(let r=t;r<i.end;){let s=i.char(r);for(let o of this.inlineParsers)if(o){let l=o(i,s,r);if(l>=0){r=l;continue e}}r++}return i.resolveMarkers(0)}}function Hi(n){return n!=null&&n.length>0}function xl(n){if(!Array.isArray(n))return n;if(n.length==0)return null;let e=xl(n[0]);if(n.length==1)return e;let t=xl(n.slice(1));if(!t||!e)return e||t;let i=(o,l)=>(o||Ei).concat(l||Ei),r=e.wrap,s=t.wrap;return{props:i(e.props,t.props),defineNodes:i(e.defineNodes,t.defineNodes),parseBlock:i(e.parseBlock,t.parseBlock),parseInline:i(e.parseInline,t.parseInline),remove:i(e.remove,t.remove),wrap:r?s?(o,l,a,h)=>r(s(o,l,a,h),l,a,h):r:s}}function gr(n,e){let t=n.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}let wp=[fe.none];for(let n=1,e;e=$[n];n++)wp[n]=fe.define({id:n,name:e,props:n>=$.Escape?[]:[[M.group,n in pp?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});const Ei=[];class vp{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,i,r=0){return this.content.push(e,t,i,4+r*4),this}writeElements(e,t=0){for(let i of e)i.writeTo(this,t);return this}finish(e,t){return I.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:t})}}class Zn{constructor(e,t,i,r=Ei){this.type=e,this.from=t,this.to=i,this.children=r}writeTo(e,t){let i=e.content.length;e.writeElements(this.children,t),e.content.push(this.type,this.from+t,this.to+t,e.content.length+4-i)}toTree(e){return new vp(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}}class Tp{constructor(e,t){this.tree=e,this.from=t}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return Ei}writeTo(e,t){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+t,this.to+t,-1)}toTree(){return this.tree}}function j(n,e,t,i){return new Zn(n,e,t,i)}const Cp={resolve:"Emphasis",mark:"EmphasisMark"},Xp={resolve:"Emphasis",mark:"EmphasisMark"},pi={},kl={};class Le{constructor(e,t,i,r){this.type=e,this.from=t,this.to=i,this.side=r}}const df="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let An=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{An=new RegExp("[\\p{S}|\\p{P}]","u")}catch{}const po={Escape(n,e,t){if(e!=92||t==n.end-1)return-1;let i=n.char(t+1);for(let r=0;r<df.length;r++)if(df.charCodeAt(r)==i)return n.append(j($.Escape,t,t+2));return-1},Entity(n,e,t){if(e!=38)return-1;let i=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(n.slice(t+1,t+31));return i?n.append(j($.Entity,t,t+1+i[0].length)):-1},InlineCode(n,e,t){if(e!=96||t&&n.char(t-1)==96)return-1;let i=t+1;for(;i<n.end&&n.char(i)==96;)i++;let r=i-t,s=0;for(;i<n.end;i++)if(n.char(i)==96){if(s++,s==r&&n.char(i+1)!=96)return n.append(j($.InlineCode,t,i+1,[j($.CodeMark,t,t+r),j($.CodeMark,i+1-r,i+1)]))}else s=0;return-1},HTMLTag(n,e,t){if(e!=60||t==n.end-1)return-1;let i=n.slice(t+1,n.end),r=/^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(i);if(r)return n.append(j($.Autolink,t,t+1+r[0].length,[j($.LinkMark,t,t+1),j($.URL,t+1,t+r[0].length),j($.LinkMark,t+r[0].length,t+1+r[0].length)]));let s=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(i);if(s)return n.append(j($.Comment,t,t+1+s[0].length));let o=/^\?[^]*?\?>/.exec(i);if(o)return n.append(j($.ProcessingInstruction,t,t+1+o[0].length));let l=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(i);return l?n.append(j($.HTMLTag,t,t+1+l[0].length)):-1},Emphasis(n,e,t){if(e!=95&&e!=42)return-1;let i=t+1;for(;n.char(i)==e;)i++;let r=n.slice(t-1,t),s=n.slice(i,i+1),o=An.test(r),l=An.test(s),a=/\s|^$/.test(r),h=/\s|^$/.test(s),c=!h&&(!l||a||o),f=!a&&(!o||h||l),O=c&&(e==42||!f||o),u=f&&(e==42||!c||l);return n.append(new Le(e==95?Cp:Xp,t,i,(O?1:0)|(u?2:0)))},HardBreak(n,e,t){if(e==92&&n.char(t+1)==10)return n.append(j($.HardBreak,t,t+2));if(e==32){let i=t+1;for(;n.char(i)==32;)i++;if(n.char(i)==10&&i>=t+2)return n.append(j($.HardBreak,t,i+1))}return-1},Link(n,e,t){return e==91?n.append(new Le(pi,t,t+1,1)):-1},Image(n,e,t){return e==33&&n.char(t+1)==91?n.append(new Le(kl,t,t+2,1)):-1},LinkEnd(n,e,t){if(e!=93)return-1;for(let i=n.parts.length-1;i>=0;i--){let r=n.parts[i];if(r instanceof Le&&(r.type==pi||r.type==kl)){if(!r.side||n.skipSpace(r.to)==t&&!/[(\[]/.test(n.slice(t+1,t+2)))return n.parts[i]=null,-1;let s=n.takeContent(i),o=n.parts[i]=c$(n,s,r.type==pi?$.Link:$.Image,r.from,t+1);if(r.type==pi)for(let l=0;l<i;l++){let a=n.parts[l];a instanceof Le&&a.type==pi&&(a.side=0)}return o.to}}return-1}};function c$(n,e,t,i,r){let{text:s}=n,o=n.char(r),l=r;if(e.unshift(j($.LinkMark,i,i+(t==$.Image?2:1))),e.push(j($.LinkMark,r-1,r)),o==40){let a=n.skipSpace(r+1),h=Rp(s,a-n.offset,n.offset),c;h&&(a=n.skipSpace(h.to),a!=h.to&&(c=qp(s,a-n.offset,n.offset),c&&(a=n.skipSpace(c.to)))),n.char(a)==41&&(e.push(j($.LinkMark,r,r+1)),l=a+1,h&&e.push(h),c&&e.push(c),e.push(j($.LinkMark,a,l)))}else if(o==91){let a=Zp(s,r-n.offset,n.offset,!1);a&&(e.push(a),l=a.to)}return j(t,i,l,e)}function Rp(n,e,t){if(n.charCodeAt(e)==60){for(let r=e+1;r<n.length;r++){let s=n.charCodeAt(r);if(s==62)return j($.URL,e+t,r+1+t);if(s==60||s==10)return!1}return null}else{let r=0,s=e;for(let o=!1;s<n.length;s++){let l=n.charCodeAt(s);if(Ne(l))break;if(o)o=!1;else if(l==40)r++;else if(l==41){if(!r)break;r--}else l==92&&(o=!0)}return s>e?j($.URL,e+t,s+t):s==n.length?null:!1}}function qp(n,e,t){let i=n.charCodeAt(e);if(i!=39&&i!=34&&i!=40)return!1;let r=i==40?41:i;for(let s=e+1,o=!1;s<n.length;s++){let l=n.charCodeAt(s);if(o)o=!1;else{if(l==r)return j($.LinkTitle,e+t,s+1+t);l==92&&(o=!0)}}return null}function Zp(n,e,t,i){for(let r=!1,s=e+1,o=Math.min(n.length,s+999);s<o;s++){let l=n.charCodeAt(s);if(r)r=!1;else{if(l==93)return i?!1:j($.LinkLabel,e+t,s+1+t);if(i&&!Ne(l)&&(i=!1),l==91)return!1;l==92&&(r=!0)}}return null}class f${constructor(e,t,i){this.parser=e,this.text=t,this.offset=i,this.parts=[]}char(e){return e>=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,t){return this.text.slice(e-this.offset,t-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,t,i,r,s){return this.append(new Le(e,t,i,(r?1:0)|(s?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let t=this.parts[e];if(t instanceof Le&&(t.type==pi||t.type==kl))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let i=e;i<this.parts.length;i++){let r=this.parts[i];if(!(r instanceof Le&&r.type.resolve&&r.side&2))continue;let s=r.type==Cp||r.type==Xp,o=r.to-r.from,l,a=i-1;for(;a>=e;a--){let m=this.parts[a];if(m instanceof Le&&m.side&1&&m.type==r.type&&!(s&&(r.side&1||m.side&2)&&(m.to-m.from+o)%3==0&&((m.to-m.from)%3||o%3))){l=m;break}}if(!l)continue;let h=r.type.resolve,c=[],f=l.from,O=r.to;if(s){let m=Math.min(2,l.to-l.from,o);f=l.to-m,O=r.from+m,h=m==1?"Emphasis":"StrongEmphasis"}l.type.mark&&c.push(this.elt(l.type.mark,f,l.to));for(let m=a+1;m<i;m++)this.parts[m]instanceof Zn&&c.push(this.parts[m]),this.parts[m]=null;r.type.mark&&c.push(this.elt(r.type.mark,r.from,O));let u=this.elt(h,f,O,c);this.parts[a]=s&&l.from!=f?new Le(l.type,l.from,f,l.side):null,(this.parts[i]=s&&r.to!=O?new Le(r.type,O,r.to,r.side):null)?this.parts.splice(i,0,u):this.parts[i]=u}let t=[];for(let i=e;i<this.parts.length;i++){let r=this.parts[i];r instanceof Zn&&t.push(r)}return t}findOpeningDelimiter(e){for(let t=this.parts.length-1;t>=0;t--){let i=this.parts[t];if(i instanceof Le&&i.type==e)return t}return null}takeContent(e){let t=this.resolveMarkers(e);return this.parts.length=e,t}skipSpace(e){return cn(this.text,e-this.offset)+this.offset}elt(e,t,i,r){return typeof e=="string"?j(this.parser.getNodeType(e),t,i,r):new Tp(e,t)}}function Pl(n,e){if(!e.length)return n;if(!n.length)return e;let t=n.slice(),i=0;for(let r of e){for(;i<t.length&&t[i].to<r.to;)i++;if(i<t.length&&t[i].from<r.from){let s=t[i];s instanceof Zn&&(t[i]=new Zn(s.type,s.from,s.to,Pl(s.children,[r])))}else t.splice(i++,0,r)}return t}const O$=[$.CodeBlock,$.ListItem,$.OrderedList,$.BulletList];class u${constructor(e,t){this.fragments=e,this.input=t,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,e.length&&(this.fragment=e[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(e,t){for(;this.fragment&&this.fragment.to<=e;)this.nextFragment();if(!this.fragment||this.fragment.from>(e?e-1:0))return!1;if(this.fragmentEnd<0){let s=this.fragment.to;for(;s>0&&this.input.read(s-1,s)!=`
39
- `;)s--;this.fragmentEnd=s?s-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let r=e+this.fragment.offset;for(;i.to<=r;)if(!i.parent())return!1;for(;;){if(i.from>=r)return this.fragment.from<=t;if(!i.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(M.contextHash)==e}takeNodes(e){let t=this.cursor,i=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,l=e.block.children.length,a=o,h=l;for(;;){if(t.to-i>r){if(t.type.isAnonymous&&t.firstChild())continue;break}let c=Ap(t.from-i,e.ranges);if(t.to-i<=e.ranges[e.rangeI].to)e.addNode(t.tree,c);else{let f=new I(e.parser.nodeSet.types[$.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(f,t.tree),e.addNode(f,c)}if(t.type.is("Block")&&(O$.indexOf(t.type.id)<0?(o=t.to-i,l=e.block.children.length):(o=a,l=h,a=t.to-i,h=e.block.children.length)),!t.nextSibling())break}for(;e.block.children.length>l;)e.block.children.pop(),e.block.positions.pop();return o-s}}function Ap(n,e){let t=n;for(let i=1;i<e.length;i++){let r=e[i-1].to,s=e[i].from;r<n&&(t-=s-r)}return t}const d$=Gt({"Blockquote/...":p.quote,HorizontalRule:p.contentSeparator,"ATXHeading1/... SetextHeading1/...":p.heading1,"ATXHeading2/... SetextHeading2/...":p.heading2,"ATXHeading3/...":p.heading3,"ATXHeading4/...":p.heading4,"ATXHeading5/...":p.heading5,"ATXHeading6/...":p.heading6,"Comment CommentBlock":p.comment,Escape:p.escape,Entity:p.character,"Emphasis/...":p.emphasis,"StrongEmphasis/...":p.strong,"Link/... Image/...":p.link,"OrderedList/... BulletList/...":p.list,"BlockQuote/...":p.quote,"InlineCode CodeText":p.monospace,"URL Autolink":p.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":p.processingInstruction,"CodeInfo LinkLabel":p.labelName,LinkTitle:p.string,Paragraph:p.content}),p$=new $s(new zn(wp).extend(d$),Object.keys(mr).map(n=>mr[n]),Object.keys(mr).map(n=>Pp[n]),Object.keys(mr),l$,pp,Object.keys(po).map(n=>po[n]),Object.keys(po),[]);function m$(n,e,t){let i=[];for(let r=n.firstChild,s=e;;r=r.nextSibling){let o=r?r.from:t;if(o>s&&i.push({from:s,to:o}),!r)break;s=r.to}return i}function g$(n){let{codeParser:e,htmlParser:t}=n;return{wrap:tu((r,s)=>{let o=r.type.id;if(e&&(o==$.CodeBlock||o==$.FencedCode)){let l="";if(o==$.FencedCode){let h=r.node.getChild($.CodeInfo);h&&(l=s.read(h.from,h.to))}let a=e(l);if(a)return{parser:a,overlay:h=>h.type.id==$.CodeText}}else if(t&&(o==$.HTMLBlock||o==$.HTMLTag||o==$.CommentBlock))return{parser:t,overlay:m$(r.node,r.from,r.to)};return null})}}const Q$={resolve:"Strikethrough",mark:"StrikethroughMark"},S$={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":p.strikethrough}},{name:"StrikethroughMark",style:p.processingInstruction}],parseInline:[{name:"Strikethrough",parse(n,e,t){if(e!=126||n.char(t+1)!=126||n.char(t+2)==126)return-1;let i=n.slice(t-1,t),r=n.slice(t+2,t+3),s=/\s|^$/.test(i),o=/\s|^$/.test(r),l=An.test(i),a=An.test(r);return n.addDelimiter(Q$,t,t+2,!o&&(!a||s||l),!s&&(!l||o||a))},after:"Emphasis"}]};function fn(n,e,t=0,i,r=0){let s=0,o=!0,l=-1,a=-1,h=!1,c=()=>{i.push(n.elt("TableCell",r+l,r+a,n.parser.parseInline(e.slice(l,a),r+l)))};for(let f=t;f<e.length;f++){let O=e.charCodeAt(f);O==124&&!h?((!o||l>-1)&&s++,o=!1,i&&(l>-1&&c(),i.push(n.elt("TableDelimiter",f+r,f+r+1))),l=a=-1):(h||O!=32&&O!=9)&&(l<0&&(l=f),a=f+1),h=!h&&O==92}return l>-1&&(s++,i&&c()),s}function pf(n,e){for(let t=e;t<n.length;t++){let i=n.charCodeAt(t);if(i==124)return!0;i==92&&t++}return!1}const Mp=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class mf{constructor(){this.rows=null}nextLine(e,t,i){if(this.rows==null){this.rows=!1;let r;if((t.next==45||t.next==58||t.next==124)&&Mp.test(r=t.text.slice(t.pos))){let s=[];fn(e,i.content,0,s,i.start)==fn(e,r,t.pos)&&(this.rows=[e.elt("TableHeader",i.start,i.start+i.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let r=[];fn(e,t.text,t.pos,r,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,r))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}}const y$={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":p.heading}},"TableRow",{name:"TableCell",style:p.content},{name:"TableDelimiter",style:p.processingInstruction}],parseBlock:[{name:"Table",leaf(n,e){return pf(e.content,0)?new mf:null},endLeaf(n,e,t){if(t.parsers.some(r=>r instanceof mf)||!pf(e.text,e.basePos))return!1;let i=n.peekLine();return Mp.test(i)&&fn(n,e.text,e.basePos)==fn(n,i,e.basePos)},before:"SetextHeading"}]};class b${nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}}const x$={defineNodes:[{name:"Task",block:!0,style:p.list},{name:"TaskMarker",style:p.atom}],parseBlock:[{name:"TaskList",leaf(n,e){return/^\[[ xX]\][ \t]/.test(e.content)&&n.parentType().name=="ListItem"?new b$:null},after:"SetextHeading"}]},gf=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,Qf=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,k$=/[\w-]+\.[\w-]+($|\/)/,Sf=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,yf=/\/[a-zA-Z\d@.]+/gy;function bf(n,e,t,i){let r=0;for(let s=e;s<t;s++)n[s]==i&&r++;return r}function P$(n,e){Qf.lastIndex=e;let t=Qf.exec(n);if(!t||k$.exec(t[0])[0].indexOf("_")>-1)return-1;let i=e+t[0].length;for(;;){let r=n[i-1],s;if(/[?!.,:*_~]/.test(r)||r==")"&&bf(n,e,i,")")>bf(n,e,i,"("))i--;else if(r==";"&&(s=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(n.slice(e,i))))i=e+s.index;else break}return i}function xf(n,e){Sf.lastIndex=e;let t=Sf.exec(n);if(!t)return-1;let i=t[0][t[0].length-1];return i=="_"||i=="-"?-1:e+t[0].length-(i=="."?1:0)}const $$={parseInline:[{name:"Autolink",parse(n,e,t){let i=t-n.offset;if(i&&/\w/.test(n.text[i-1]))return-1;gf.lastIndex=i;let r=gf.exec(n.text),s=-1;if(!r)return-1;if(r[1]||r[2]){if(s=P$(n.text,i+r[0].length),s>-1&&n.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(n.text.slice(i,s));s=i+o[0].length}}else r[3]?s=xf(n.text,i):(s=xf(n.text,i+r[0].length),s>-1&&r[0]=="xmpp:"&&(yf.lastIndex=s,r=yf.exec(n.text),r&&(s=r.index+r[0].length)));return s<0?-1:(n.addElement(n.elt("URL",t,s+n.offset)),s+n.offset)}}]},w$=[y$,x$,S$,$$];function Ep(n,e,t){return(i,r,s)=>{if(r!=n||i.char(s+1)==n)return-1;let o=[i.elt(t,s,s+1)];for(let l=s+1;l<i.end;l++){let a=i.char(l);if(a==n)return i.addElement(i.elt(e,s,l+1,o.concat(i.elt(t,l,l+1))));if(a==92&&o.push(i.elt("Escape",l,l+++2)),Ne(a))break}return-1}}const v$={defineNodes:[{name:"Superscript",style:p.special(p.content)},{name:"SuperscriptMark",style:p.processingInstruction}],parseInline:[{name:"Superscript",parse:Ep(94,"Superscript","SuperscriptMark")}]},T$={defineNodes:[{name:"Subscript",style:p.special(p.content)},{name:"SubscriptMark",style:p.processingInstruction}],parseInline:[{name:"Subscript",parse:Ep(126,"Subscript","SubscriptMark")}]},C$={defineNodes:[{name:"Emoji",style:p.character}],parseInline:[{name:"Emoji",parse(n,e,t){let i;return e!=58||!(i=/^[a-zA-Z_0-9]+:/.exec(n.slice(t+1,n.end)))?-1:n.addElement(n.elt("Emoji",t,t+1+i[0].length))}}]},_p=Ul({commentTokens:{block:{open:"<!--",close:"-->"}}}),Vp=new M,zp=p$.configure({props:[It.add(n=>!n.is("Block")||n.is("Document")||$l(n)!=null||X$(n)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),Vp.add($l),ci.add({Document:()=>null}),ti.add({Document:_p})]});function $l(n){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(n.name);return e?+e[1]:void 0}function X$(n){return n.name=="OrderedList"||n.name=="BulletList"}function R$(n,e){let t=n;for(;;){let i=t.nextSibling,r;if(!i||(r=$l(i.type))!=null&&r<=e)break;t=i}return t.to}const q$=lu.of((n,e,t)=>{for(let i=J(n).resolveInner(t,-1);i&&!(i.from<e);i=i.parent){let r=i.type.prop(Vp);if(r==null)continue;let s=R$(i,r);if(s>t)return{from:t,to:s}}return null});function $a(n){return new De(_p,n,[q$],"markdown")}const Z$=$a(zp),A$=zp.configure([w$,T$,v$,C$,{props:[It.add({Table:(n,e)=>({from:e.doc.lineAt(n.from).to,to:n.to})})]}]),wl=$a(A$);function M$(n,e){return t=>{if(t&&n){let i=null;if(t=/\S*/.exec(t)[0],typeof n=="function"?i=n(t):i=Ir.matchLanguageName(n,t,!0),i instanceof Ir)return i.support?i.support.language.parser:xn.getSkippingParser(i.load());if(i)return i.parser}return e?e.parser:null}}class mo{constructor(e,t,i,r,s,o,l){this.node=e,this.from=t,this.to=i,this.spaceBefore=r,this.spaceAfter=s,this.type=o,this.item=l}blank(e,t=!0){let i=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;i.length<e;)i+=" ";return i}else{for(let r=this.to-this.from-i.length-this.spaceAfter.length;r>0;r--)i+=" ";return i+(t?this.spaceAfter:"")}}marker(e,t){let i=this.node.name=="OrderedList"?String(+Lp(this.item,e)[2]+t):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function Yp(n,e){let t=[],i=[];for(let r=n;r;r=r.parent){if(r.name=="FencedCode")return i;(r.name=="ListItem"||r.name=="Blockquote")&&t.push(r)}for(let r=t.length-1;r>=0;r--){let s=t[r],o,l=e.lineAt(s.from),a=s.from-l.from;if(s.name=="Blockquote"&&(o=/^ *>( ?)/.exec(l.text.slice(a))))i.push(new mo(s,a,a+o[0].length,"",o[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(l.text.slice(a)))){let h=o[3],c=o[0].length;h.length>=4&&(h=h.slice(0,h.length-4),c-=4),i.push(new mo(s.parent,a,a+c,o[1],h,o[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(a)))){let h=o[4],c=o[0].length;h.length>4&&(h=h.slice(0,h.length-4),c-=4);let f=o[2];o[3]&&(f+=o[3].replace(/[xX]/," ")),i.push(new mo(s.parent,a,a+c,o[1],h,f,s))}}return i}function Lp(n,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(n.from,n.from+10))}function go(n,e,t,i=0){for(let r=-1,s=n;;){if(s.name=="ListItem"){let l=Lp(s,e),a=+l[2];if(r>=0){if(a!=r+1)return;t.push({from:s.from+l[1].length,to:s.from+l[0].length,insert:String(r+2+i)})}r=a}let o=s.nextSibling;if(!o)break;s=o}}function wa(n,e){let t=/^[ \t]*/.exec(n)[0].length;if(!t||e.facet(Vi)!=" ")return n;let i=Fe(n,4,t),r="";for(let s=i;s>0;)s>=4?(r+=" ",s-=4):(r+=" ",s--);return r+n.slice(t)}const E$=({state:n,dispatch:e})=>{let t=J(n),{doc:i}=n,r=null,s=n.changeByRange(o=>{if(!o.empty||!wl.isActiveAt(n,o.from,-1)&&!wl.isActiveAt(n,o.from,1))return r={range:o};let l=o.from,a=i.lineAt(l),h=Yp(t.resolveInner(l,-1),i);for(;h.length&&h[h.length-1].from>l-a.from;)h.pop();if(!h.length)return r={range:o};let c=h[h.length-1];if(c.to-c.spaceAfter.length>l-a.from)return r={range:o};let f=l>=c.to-c.spaceAfter.length&&!/\S/.test(a.text.slice(c.to));if(c.item&&f){let g=c.node.firstChild,Q=c.node.getChild("ListItem","ListItem");if(g.to>=l||Q&&Q.to<l||a.from>0&&!/[^\s>]/.test(i.lineAt(a.from-1).text)){let S=h.length>1?h[h.length-2]:null,x,k="";S&&S.item?(x=a.from+S.from,k=S.marker(i,1)):x=a.from+(S?S.to:0);let b=[{from:x,to:l,insert:k}];return c.node.name=="OrderedList"&&go(c.item,i,b,-2),S&&S.node.name=="OrderedList"&&go(S.item,i,b),{range:y.cursor(x+k.length),changes:b}}else{let S=Pf(h,n,a);return{range:y.cursor(l+S.length+1),changes:{from:a.from,insert:S+n.lineBreak}}}}if(c.node.name=="Blockquote"&&f&&a.from){let g=i.lineAt(a.from-1),Q=/>\s*$/.exec(g.text);if(Q&&Q.index==c.from){let S=n.changes([{from:g.from+Q.index,to:g.to},{from:a.from+c.from,to:a.to}]);return{range:o.map(S),changes:S}}}let O=[];c.node.name=="OrderedList"&&go(c.item,i,O);let u=c.item&&c.item.from<a.from,d="";if(!u||/^[\s\d.)\-+*>]*/.exec(a.text)[0].length>=c.to)for(let g=0,Q=h.length-1;g<=Q;g++)d+=g==Q&&!u?h[g].marker(i,1):h[g].blank(g<Q?Fe(a.text,4,h[g+1].from)-d.length:null);let m=l;for(;m>a.from&&/\s/.test(a.text.charAt(m-a.from-1));)m--;return d=wa(d,n),_$(c.node,n.doc)&&(d=Pf(h,n,a)+n.lineBreak+d),O.push({from:m,to:l,insert:n.lineBreak+d}),{range:y.cursor(m+d.length+1),changes:O}});return r?!1:(e(n.update(s,{scrollIntoView:!0,userEvent:"input"})),!0)};function kf(n){return n.name=="QuoteMark"||n.name=="ListMark"}function _$(n,e){if(n.name!="OrderedList"&&n.name!="BulletList")return!1;let t=n.firstChild,i=n.getChild("ListItem","ListItem");if(!i)return!1;let r=e.lineAt(t.to),s=e.lineAt(i.from),o=/^[\s>]*$/.test(r.text);return r.number+(o?0:1)<s.number}function Pf(n,e,t){let i="";for(let r=0,s=n.length-2;r<=s;r++)i+=n[r].blank(r<s?Fe(t.text,4,n[r+1].from)-i.length:null,r<s);return wa(i,e)}function V$(n,e){let t=n.resolveInner(e,-1),i=e;kf(t)&&(i=t.from,t=t.parent);for(let r;r=t.childBefore(i);)if(kf(r))i=r.from;else if(r.name=="OrderedList"||r.name=="BulletList")t=r.lastChild,i=t.to;else break;return t}const z$=({state:n,dispatch:e})=>{let t=J(n),i=null,r=n.changeByRange(s=>{let o=s.from,{doc:l}=n;if(s.empty&&wl.isActiveAt(n,s.from)){let a=l.lineAt(o),h=Yp(V$(t,o),l);if(h.length){let c=h[h.length-1],f=c.to-c.spaceAfter.length+(c.spaceAfter?1:0);if(o-a.from>f&&!/\S/.test(a.text.slice(f,o-a.from)))return{range:y.cursor(a.from+f),changes:{from:a.from+f,to:o}};if(o-a.from==f&&(!c.item||a.from<=c.item.from||!/\S/.test(a.text.slice(0,c.to)))){let O=a.from+c.from;if(c.item&&c.node.from<c.item.from&&/\S/.test(a.text.slice(c.from,c.to))){let u=c.blank(Fe(a.text,4,c.to)-Fe(a.text,4,c.from));return O==a.from&&(u=wa(u,n)),{range:y.cursor(O+u.length),changes:{from:O,to:a.from+c.to,insert:u}}}if(O<o)return{range:y.cursor(O),changes:{from:O,to:o}}}}}return i={range:s}});return i?!1:(e(n.update(r,{scrollIntoView:!0,userEvent:"delete"})),!0)},Y$=[{key:"Enter",run:E$},{key:"Backspace",run:z$}],Wp=KP({matchClosingTags:!1});function tw(n={}){let{codeLanguages:e,defaultCodeLanguage:t,addKeymap:i=!0,base:{parser:r}=Z$,completeHTMLTags:s=!0,htmlTagLanguage:o=Wp}=n;if(!(r instanceof $s))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let l=n.extensions?[n.extensions]:[],a=[o.support],h;t instanceof ai?(a.push(t.support),h=t.language):t&&(h=t);let c=e||h?M$(e,h):void 0;l.push(g$({codeParser:c,htmlParser:o.language.parser})),i&&a.push(Xt.high(_i.of(Y$)));let f=$a(r.configure(l));return s&&a.push(f.data.of({autocomplete:L$})),new ai(f,a)}function L$(n){let{state:e,pos:t}=n,i=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(t-25,t));if(!i)return null;let r=J(e).resolveInner(t,-1);for(;r&&!r.type.isTop;){if(r.name=="CodeBlock"||r.name=="FencedCode"||r.name=="ProcessingInstructionBlock"||r.name=="CommentBlock"||r.name=="Link"||r.name=="Image")return null;r=r.parent}return{from:t-i[0].length,to:t,options:W$(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let Qo=null;function W$(){if(Qo)return Qo;let n=NP(new sa(W.create({extensions:Wp}),0,!0));return Qo=n?n.options:[]}export{ce as C,Z as D,T as E,X as F,Ct as G,Xt as P,D as R,de as S,B as T,se as V,mt as W,_ as a,vt as b,N$ as c,pt as d,N as e,U$ as f,V0 as g,uQ as h,Qs as i,Gp as j,wt as k,Dt as l,F$ as m,H$ as n,Sn as o,mb as p,ob as q,tw as r,Sd as s,ew as t,Yn as u,jP as v,KP as w,J$ as x,lx as y};
39
+ `;)s--;this.fragmentEnd=s?s-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let r=e+this.fragment.offset;for(;i.to<=r;)if(!i.parent())return!1;for(;;){if(i.from>=r)return this.fragment.from<=t;if(!i.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(M.contextHash)==e}takeNodes(e){let t=this.cursor,i=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,l=e.block.children.length,a=o,h=l;for(;;){if(t.to-i>r){if(t.type.isAnonymous&&t.firstChild())continue;break}let c=Ap(t.from-i,e.ranges);if(t.to-i<=e.ranges[e.rangeI].to)e.addNode(t.tree,c);else{let f=new I(e.parser.nodeSet.types[$.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(f,t.tree),e.addNode(f,c)}if(t.type.is("Block")&&(O$.indexOf(t.type.id)<0?(o=t.to-i,l=e.block.children.length):(o=a,l=h,a=t.to-i,h=e.block.children.length)),!t.nextSibling())break}for(;e.block.children.length>l;)e.block.children.pop(),e.block.positions.pop();return o-s}}function Ap(n,e){let t=n;for(let i=1;i<e.length;i++){let r=e[i-1].to,s=e[i].from;r<n&&(t-=s-r)}return t}const d$=Gt({"Blockquote/...":p.quote,HorizontalRule:p.contentSeparator,"ATXHeading1/... SetextHeading1/...":p.heading1,"ATXHeading2/... SetextHeading2/...":p.heading2,"ATXHeading3/...":p.heading3,"ATXHeading4/...":p.heading4,"ATXHeading5/...":p.heading5,"ATXHeading6/...":p.heading6,"Comment CommentBlock":p.comment,Escape:p.escape,Entity:p.character,"Emphasis/...":p.emphasis,"StrongEmphasis/...":p.strong,"Link/... Image/...":p.link,"OrderedList/... BulletList/...":p.list,"BlockQuote/...":p.quote,"InlineCode CodeText":p.monospace,"URL Autolink":p.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":p.processingInstruction,"CodeInfo LinkLabel":p.labelName,LinkTitle:p.string,Paragraph:p.content}),p$=new $s(new zn(wp).extend(d$),Object.keys(mr).map(n=>mr[n]),Object.keys(mr).map(n=>Pp[n]),Object.keys(mr),l$,pp,Object.keys(po).map(n=>po[n]),Object.keys(po),[]);function m$(n,e,t){let i=[];for(let r=n.firstChild,s=e;;r=r.nextSibling){let o=r?r.from:t;if(o>s&&i.push({from:s,to:o}),!r)break;s=r.to}return i}function g$(n){let{codeParser:e,htmlParser:t}=n;return{wrap:tu((r,s)=>{let o=r.type.id;if(e&&(o==$.CodeBlock||o==$.FencedCode)){let l="";if(o==$.FencedCode){let h=r.node.getChild($.CodeInfo);h&&(l=s.read(h.from,h.to))}let a=e(l);if(a)return{parser:a,overlay:h=>h.type.id==$.CodeText}}else if(t&&(o==$.HTMLBlock||o==$.HTMLTag||o==$.CommentBlock))return{parser:t,overlay:m$(r.node,r.from,r.to)};return null})}}const Q$={resolve:"Strikethrough",mark:"StrikethroughMark"},S$={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":p.strikethrough}},{name:"StrikethroughMark",style:p.processingInstruction}],parseInline:[{name:"Strikethrough",parse(n,e,t){if(e!=126||n.char(t+1)!=126||n.char(t+2)==126)return-1;let i=n.slice(t-1,t),r=n.slice(t+2,t+3),s=/\s|^$/.test(i),o=/\s|^$/.test(r),l=An.test(i),a=An.test(r);return n.addDelimiter(Q$,t,t+2,!o&&(!a||s||l),!s&&(!l||o||a))},after:"Emphasis"}]};function fn(n,e,t=0,i,r=0){let s=0,o=!0,l=-1,a=-1,h=!1,c=()=>{i.push(n.elt("TableCell",r+l,r+a,n.parser.parseInline(e.slice(l,a),r+l)))};for(let f=t;f<e.length;f++){let O=e.charCodeAt(f);O==124&&!h?((!o||l>-1)&&s++,o=!1,i&&(l>-1&&c(),i.push(n.elt("TableDelimiter",f+r,f+r+1))),l=a=-1):(h||O!=32&&O!=9)&&(l<0&&(l=f),a=f+1),h=!h&&O==92}return l>-1&&(s++,i&&c()),s}function pf(n,e){for(let t=e;t<n.length;t++){let i=n.charCodeAt(t);if(i==124)return!0;i==92&&t++}return!1}const Mp=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class mf{constructor(){this.rows=null}nextLine(e,t,i){if(this.rows==null){this.rows=!1;let r;if((t.next==45||t.next==58||t.next==124)&&Mp.test(r=t.text.slice(t.pos))){let s=[];fn(e,i.content,0,s,i.start)==fn(e,r,t.pos)&&(this.rows=[e.elt("TableHeader",i.start,i.start+i.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let r=[];fn(e,t.text,t.pos,r,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,r))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}}const y$={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":p.heading}},"TableRow",{name:"TableCell",style:p.content},{name:"TableDelimiter",style:p.processingInstruction}],parseBlock:[{name:"Table",leaf(n,e){return pf(e.content,0)?new mf:null},endLeaf(n,e,t){if(t.parsers.some(r=>r instanceof mf)||!pf(e.text,e.basePos))return!1;let i=n.peekLine();return Mp.test(i)&&fn(n,e.text,e.basePos)==fn(n,i,e.basePos)},before:"SetextHeading"}]};class b${nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}}const x$={defineNodes:[{name:"Task",block:!0,style:p.list},{name:"TaskMarker",style:p.atom}],parseBlock:[{name:"TaskList",leaf(n,e){return/^\[[ xX]\][ \t]/.test(e.content)&&n.parentType().name=="ListItem"?new b$:null},after:"SetextHeading"}]},gf=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,Qf=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,k$=/[\w-]+\.[\w-]+($|\/)/,Sf=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,yf=/\/[a-zA-Z\d@.]+/gy;function bf(n,e,t,i){let r=0;for(let s=e;s<t;s++)n[s]==i&&r++;return r}function P$(n,e){Qf.lastIndex=e;let t=Qf.exec(n);if(!t||k$.exec(t[0])[0].indexOf("_")>-1)return-1;let i=e+t[0].length;for(;;){let r=n[i-1],s;if(/[?!.,:*_~]/.test(r)||r==")"&&bf(n,e,i,")")>bf(n,e,i,"("))i--;else if(r==";"&&(s=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(n.slice(e,i))))i=e+s.index;else break}return i}function xf(n,e){Sf.lastIndex=e;let t=Sf.exec(n);if(!t)return-1;let i=t[0][t[0].length-1];return i=="_"||i=="-"?-1:e+t[0].length-(i=="."?1:0)}const $$={parseInline:[{name:"Autolink",parse(n,e,t){let i=t-n.offset;if(i&&/\w/.test(n.text[i-1]))return-1;gf.lastIndex=i;let r=gf.exec(n.text),s=-1;if(!r)return-1;if(r[1]||r[2]){if(s=P$(n.text,i+r[0].length),s>-1&&n.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(n.text.slice(i,s));s=i+o[0].length}}else r[3]?s=xf(n.text,i):(s=xf(n.text,i+r[0].length),s>-1&&r[0]=="xmpp:"&&(yf.lastIndex=s,r=yf.exec(n.text),r&&(s=r.index+r[0].length)));return s<0?-1:(n.addElement(n.elt("URL",t,s+n.offset)),s+n.offset)}}]},w$=[y$,x$,S$,$$];function Ep(n,e,t){return(i,r,s)=>{if(r!=n||i.char(s+1)==n)return-1;let o=[i.elt(t,s,s+1)];for(let l=s+1;l<i.end;l++){let a=i.char(l);if(a==n)return i.addElement(i.elt(e,s,l+1,o.concat(i.elt(t,l,l+1))));if(a==92&&o.push(i.elt("Escape",l,l+++2)),Ne(a))break}return-1}}const v$={defineNodes:[{name:"Superscript",style:p.special(p.content)},{name:"SuperscriptMark",style:p.processingInstruction}],parseInline:[{name:"Superscript",parse:Ep(94,"Superscript","SuperscriptMark")}]},T$={defineNodes:[{name:"Subscript",style:p.special(p.content)},{name:"SubscriptMark",style:p.processingInstruction}],parseInline:[{name:"Subscript",parse:Ep(126,"Subscript","SubscriptMark")}]},C$={defineNodes:[{name:"Emoji",style:p.character}],parseInline:[{name:"Emoji",parse(n,e,t){let i;return e!=58||!(i=/^[a-zA-Z_0-9]+:/.exec(n.slice(t+1,n.end)))?-1:n.addElement(n.elt("Emoji",t,t+1+i[0].length))}}]},_p=Ul({commentTokens:{block:{open:"<!--",close:"-->"}}}),Vp=new M,zp=p$.configure({props:[It.add(n=>!n.is("Block")||n.is("Document")||$l(n)!=null||X$(n)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),Vp.add($l),ci.add({Document:()=>null}),ti.add({Document:_p})]});function $l(n){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(n.name);return e?+e[1]:void 0}function X$(n){return n.name=="OrderedList"||n.name=="BulletList"}function R$(n,e){let t=n;for(;;){let i=t.nextSibling,r;if(!i||(r=$l(i.type))!=null&&r<=e)break;t=i}return t.to}const q$=lu.of((n,e,t)=>{for(let i=J(n).resolveInner(t,-1);i&&!(i.from<e);i=i.parent){let r=i.type.prop(Vp);if(r==null)continue;let s=R$(i,r);if(s>t)return{from:t,to:s}}return null});function $a(n){return new De(_p,n,[q$],"markdown")}const Z$=$a(zp),A$=zp.configure([w$,T$,v$,C$,{props:[It.add({Table:(n,e)=>({from:e.doc.lineAt(n.from).to,to:n.to})})]}]),wl=$a(A$);function M$(n,e){return t=>{if(t&&n){let i=null;if(t=/\S*/.exec(t)[0],typeof n=="function"?i=n(t):i=Ir.matchLanguageName(n,t,!0),i instanceof Ir)return i.support?i.support.language.parser:xn.getSkippingParser(i.load());if(i)return i.parser}return e?e.parser:null}}class mo{constructor(e,t,i,r,s,o,l){this.node=e,this.from=t,this.to=i,this.spaceBefore=r,this.spaceAfter=s,this.type=o,this.item=l}blank(e,t=!0){let i=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;i.length<e;)i+=" ";return i}else{for(let r=this.to-this.from-i.length-this.spaceAfter.length;r>0;r--)i+=" ";return i+(t?this.spaceAfter:"")}}marker(e,t){let i=this.node.name=="OrderedList"?String(+Lp(this.item,e)[2]+t):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function Yp(n,e){let t=[],i=[];for(let r=n;r;r=r.parent){if(r.name=="FencedCode")return i;(r.name=="ListItem"||r.name=="Blockquote")&&t.push(r)}for(let r=t.length-1;r>=0;r--){let s=t[r],o,l=e.lineAt(s.from),a=s.from-l.from;if(s.name=="Blockquote"&&(o=/^ *>( ?)/.exec(l.text.slice(a))))i.push(new mo(s,a,a+o[0].length,"",o[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(l.text.slice(a)))){let h=o[3],c=o[0].length;h.length>=4&&(h=h.slice(0,h.length-4),c-=4),i.push(new mo(s.parent,a,a+c,o[1],h,o[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(a)))){let h=o[4],c=o[0].length;h.length>4&&(h=h.slice(0,h.length-4),c-=4);let f=o[2];o[3]&&(f+=o[3].replace(/[xX]/," ")),i.push(new mo(s.parent,a,a+c,o[1],h,f,s))}}return i}function Lp(n,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(n.from,n.from+10))}function go(n,e,t,i=0){for(let r=-1,s=n;;){if(s.name=="ListItem"){let l=Lp(s,e),a=+l[2];if(r>=0){if(a!=r+1)return;t.push({from:s.from+l[1].length,to:s.from+l[0].length,insert:String(r+2+i)})}r=a}let o=s.nextSibling;if(!o)break;s=o}}function wa(n,e){let t=/^[ \t]*/.exec(n)[0].length;if(!t||e.facet(Vi)!=" ")return n;let i=Fe(n,4,t),r="";for(let s=i;s>0;)s>=4?(r+=" ",s-=4):(r+=" ",s--);return r+n.slice(t)}const E$=({state:n,dispatch:e})=>{let t=J(n),{doc:i}=n,r=null,s=n.changeByRange(o=>{if(!o.empty||!wl.isActiveAt(n,o.from,-1)&&!wl.isActiveAt(n,o.from,1))return r={range:o};let l=o.from,a=i.lineAt(l),h=Yp(t.resolveInner(l,-1),i);for(;h.length&&h[h.length-1].from>l-a.from;)h.pop();if(!h.length)return r={range:o};let c=h[h.length-1];if(c.to-c.spaceAfter.length>l-a.from)return r={range:o};let f=l>=c.to-c.spaceAfter.length&&!/\S/.test(a.text.slice(c.to));if(c.item&&f){let g=c.node.firstChild,Q=c.node.getChild("ListItem","ListItem");if(g.to>=l||Q&&Q.to<l||a.from>0&&!/[^\s>]/.test(i.lineAt(a.from-1).text)){let S=h.length>1?h[h.length-2]:null,x,k="";S&&S.item?(x=a.from+S.from,k=S.marker(i,1)):x=a.from+(S?S.to:0);let b=[{from:x,to:l,insert:k}];return c.node.name=="OrderedList"&&go(c.item,i,b,-2),S&&S.node.name=="OrderedList"&&go(S.item,i,b),{range:y.cursor(x+k.length),changes:b}}else{let S=Pf(h,n,a);return{range:y.cursor(l+S.length+1),changes:{from:a.from,insert:S+n.lineBreak}}}}if(c.node.name=="Blockquote"&&f&&a.from){let g=i.lineAt(a.from-1),Q=/>\s*$/.exec(g.text);if(Q&&Q.index==c.from){let S=n.changes([{from:g.from+Q.index,to:g.to},{from:a.from+c.from,to:a.to}]);return{range:o.map(S),changes:S}}}let O=[];c.node.name=="OrderedList"&&go(c.item,i,O);let u=c.item&&c.item.from<a.from,d="";if(!u||/^[\s\d.)\-+*>]*/.exec(a.text)[0].length>=c.to)for(let g=0,Q=h.length-1;g<=Q;g++)d+=g==Q&&!u?h[g].marker(i,1):h[g].blank(g<Q?Fe(a.text,4,h[g+1].from)-d.length:null);let m=l;for(;m>a.from&&/\s/.test(a.text.charAt(m-a.from-1));)m--;return d=wa(d,n),_$(c.node,n.doc)&&(d=Pf(h,n,a)+n.lineBreak+d),O.push({from:m,to:l,insert:n.lineBreak+d}),{range:y.cursor(m+d.length+1),changes:O}});return r?!1:(e(n.update(s,{scrollIntoView:!0,userEvent:"input"})),!0)};function kf(n){return n.name=="QuoteMark"||n.name=="ListMark"}function _$(n,e){if(n.name!="OrderedList"&&n.name!="BulletList")return!1;let t=n.firstChild,i=n.getChild("ListItem","ListItem");if(!i)return!1;let r=e.lineAt(t.to),s=e.lineAt(i.from),o=/^[\s>]*$/.test(r.text);return r.number+(o?0:1)<s.number}function Pf(n,e,t){let i="";for(let r=0,s=n.length-2;r<=s;r++)i+=n[r].blank(r<s?Fe(t.text,4,n[r+1].from)-i.length:null,r<s);return wa(i,e)}function V$(n,e){let t=n.resolveInner(e,-1),i=e;kf(t)&&(i=t.from,t=t.parent);for(let r;r=t.childBefore(i);)if(kf(r))i=r.from;else if(r.name=="OrderedList"||r.name=="BulletList")t=r.lastChild,i=t.to;else break;return t}const z$=({state:n,dispatch:e})=>{let t=J(n),i=null,r=n.changeByRange(s=>{let o=s.from,{doc:l}=n;if(s.empty&&wl.isActiveAt(n,s.from)){let a=l.lineAt(o),h=Yp(V$(t,o),l);if(h.length){let c=h[h.length-1],f=c.to-c.spaceAfter.length+(c.spaceAfter?1:0);if(o-a.from>f&&!/\S/.test(a.text.slice(f,o-a.from)))return{range:y.cursor(a.from+f),changes:{from:a.from+f,to:o}};if(o-a.from==f&&(!c.item||a.from<=c.item.from||!/\S/.test(a.text.slice(0,c.to)))){let O=a.from+c.from;if(c.item&&c.node.from<c.item.from&&/\S/.test(a.text.slice(c.from,c.to))){let u=c.blank(Fe(a.text,4,c.to)-Fe(a.text,4,c.from));return O==a.from&&(u=wa(u,n)),{range:y.cursor(O+u.length),changes:{from:O,to:a.from+c.to,insert:u}}}if(O<o)return{range:y.cursor(O),changes:{from:O,to:o}}}}}return i={range:s}});return i?!1:(e(n.update(r,{scrollIntoView:!0,userEvent:"delete"})),!0)},Y$=[{key:"Enter",run:E$},{key:"Backspace",run:z$}],Wp=KP({matchClosingTags:!1});function tw(n={}){let{codeLanguages:e,defaultCodeLanguage:t,addKeymap:i=!0,base:{parser:r}=Z$,completeHTMLTags:s=!0,htmlTagLanguage:o=Wp}=n;if(!(r instanceof $s))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let l=n.extensions?[n.extensions]:[],a=[o.support],h;t instanceof ai?(a.push(t.support),h=t.language):t&&(h=t);let c=e||h?M$(e,h):void 0;l.push(g$({codeParser:c,htmlParser:o.language.parser})),i&&a.push(Xt.high(_i.of(Y$)));let f=$a(r.configure(l));return s&&a.push(f.data.of({autocomplete:L$})),new ai(f,a)}function L$(n){let{state:e,pos:t}=n,i=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(t-25,t));if(!i)return null;let r=J(e).resolveInner(t,-1);for(;r&&!r.type.isTop;){if(r.name=="CodeBlock"||r.name=="FencedCode"||r.name=="ProcessingInstructionBlock"||r.name=="CommentBlock"||r.name=="Link"||r.name=="Image")return null;r=r.parent}return{from:t-i[0].length,to:t,options:W$(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let Qo=null;function W$(){if(Qo)return Qo;let n=NP(new sa(W.create({extensions:Wp}),0,!0));return Qo=n?n.options:[]}export{ce as C,Z as D,T as E,X as F,Ct as G,Xt as P,D as R,de as S,B as T,se as V,mt as W,Ip as _,So as a,_ as b,vt as c,N$ as d,pt as e,N as f,V0 as g,uQ as h,U$ as i,Gp as j,Qs as k,Dt as l,wt as m,F$ as n,H$ as o,Sn as p,mb as q,ob as r,Sd as s,tw as t,Yn as u,ew as v,jP as w,KP as x,J$ as y,lx as z};