vendor: 8,040 bytes, line 1
1import{f as fe,k as rt,B as it,j as ot,h as Q,N as v,T as at,g as Ie,J as Te,x as lt,O as D,H as ht,E as M,r as R,d as ft,o as E,z as ut,s as ct,b as dt,Q as g,w as Be,y as pt,G as mt,c as gt,e as ue,P as kt}from"./R5yEemHd.js";import{C as xt}from"./DBUztC9j.js";import{html as Lt,htmlCompletionSource as bt}from"./D7a961Ci.js";import"./CiKtckVa.js";import"./Bxhx-pQp.js";import"./E0Y8HYKP.js";class j{static create(e,n,s,r,i){let o=r+(r<<8)+e+(n<<4)|0;return new j(e,n,s,o,i,[],[])}constructor(e,n,s,r,i,o,a){this.type=e,this.value=n,this.from=s,this.hash=r,this.end=i,this.children=o,this.positions=a,this.hashProp=[[v.contextHash,r]]}addChild(e,n){e.prop(v.contextHash)!=this.hash&&(e=new E(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(n)}toTree(e,n=this.end){let s=this.children.length-1;return s>=0&&(n=Math.max(n,this.positions[s]+this.children[s].length+this.from)),new E(e.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:(r,i,o)=>new E(Q.none,r,i,o,this.hashProp)})}}var u;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})(u||(u={}));class St{constructor(e,n){this.start=e,this.content=n,this.marks=[],this.parsers=[]}}class Ct{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return O(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,n=0,s=0){for(let r=n;r<e;r++)s+=this.text.charCodeAt(r)==9?4-s%4:1;return s}findColumn(e){let n=0;for(let s=0;n<this.text.length&&s<e;n++)s+=this.text.charCodeAt(n)==9?4-s%4:1;return n}scrub(){if(!this.baseIndent)return this.text;let e="";for(let n=0;n<this.basePos;n++)e+=" ";return e+this.text.slice(this.basePos)}}function ce(t,e,n){if(n.pos==n.text.length||t!=e.block&&n.indent>=e.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let s=(t.type==u.OrderedList?oe:ie)(n,e,!1);return s>0&&(t.type!=u.BulletList||re(n,e,!1)<0)&&n.text.charCodeAt(n.pos+s-1)==t.value}const Ee={[u.Blockquote](t,e,n){return n.next!=62?!1:(n.markers.push(k(u.QuoteMark,e.lineStart+n.pos,e.lineStart+n.pos+1)),n.moveBase(n.pos+(w(n.text.charCodeAt(n.pos+1))?2:1)),t.end=e.lineStart+n.text.length,!0)},[u.ListItem](t,e,n){return n.indent<n.baseIndent+t.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+t.value),!0)},[u.OrderedList]:ce,[u.BulletList]:ce,[u.Document](){return!0}};function w(t){return t==32||t==9||t==10||t==13}function O(t,e=0){for(;e<t.length&&w(t.charCodeAt(e));)e++;return e}function de(t,e,n){for(;e>n&&w(t.charCodeAt(e-1));)e--;return e}function Me(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;if(e<t.pos+3)return-1;if(t.next==96){for(let n=e;n<t.text.length;n++)if(t.text.charCodeAt(n)==96)return-1}return e}function ve(t){return t.next!=62?-1:t.text.charCodeAt(t.pos+1)==32?2:1}function re(t,e,n){if(t.next!=42&&t.next!=45&&t.next!=95)return-1;let s=1;for(let r=t.pos+1;r<t.text.length;r++){let i=t.text.charCodeAt(r);if(i==t.next)s++;else if(!w(i))return-1}return n&&t.next==45&&Ne(t)>-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(Xe.SetextHeading)>-1||s<3?-1:1}function He(t,e){for(let n=t.stack.length-1;n>=0;n--)if(t.stack[n].type==e)return!0;return!1}function ie(t,e,n){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||w(t.text.charCodeAt(t.pos+1)))&&(!n||He(e,u.BulletList)||t.skipSpace(t.pos+2)<t.text.length)?1:-1}function oe(t,e,n){let s=t.pos,r=t.next;for(;r>=48&&r<=57;){if(s++,s==t.text.length)return-1;r=t.text.charCodeAt(s)}return s==t.pos||s>t.pos+9||r!=46&&r!=41||s<t.text.length-1&&!w(t.text.charCodeAt(s+1))||n&&!He(e,u.OrderedList)&&(t.skipSpace(s+1)==t.text.length||s>t.pos+1||t.next!=49)?-1:s+1-t.pos}function Pe(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==35;)e++;if(e<t.text.length&&t.text.charCodeAt(e)!=32)return-1;let n=e-t.pos;return n>6?-1:n}function Ne(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;let n=e;for(;e<t.text.length&&w(t.text.charCodeAt(e));)e++;return e==t.text.length?n:-1}const Y=/^[ \t]*$/,Oe=/-->/,$e=/\?>/,ee=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,Oe],[/^\s*<\?/,$e],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?: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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,Y],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,Y]];function Re(t,e,n){if(t.next!=60)return-1;let s=t.text.slice(t.pos);for(let r=0,i=ee.length-(n?1:0);r<i;r++)if(ee[r][0].test(s))return r;return-1}function pe(t,e){let n=t.countIndent(e,t.pos,t.indent),s=t.countIndent(t.skipSpace(e),e,n);return s>=n+5?n+1:s}function y(t,e,n){let s=t.length-1;s>=0&&t[s].to==e&&t[s].type==u.CodeText?t[s].to=n:t.push(k(u.CodeText,e,n))}const q={LinkReference:void 0,IndentedCode(t,e){let n=e.baseIndent+4;if(e.indent<n)return!1;let s=e.findColumn(n),r=t.lineStart+s,i=t.lineStart+e.text.length,o=[],a=[];for(y(o,r,i);t.nextLine()&&e.depth>=t.stack.length;)if(e.pos==e.text.length){y(a,t.lineStart-1,t.lineStart);for(let l of e.markers)a.push(l)}else{if(e.indent<n)break;{if(a.length){for(let h of a)h.type==u.CodeText?y(o,h.from,h.to):o.push(h);a=[]}y(o,t.lineStart-1,t.lineStart);for(let h of e.markers)o.push(h);i=t.lineStart+e.text.length;let l=t.lineStart+e.findColumn(e.baseIndent+4);l<i&&y(o,l,i)}}return a.length&&(a=a.filter(l=>l.type!=u.CodeText),a.length&&(e.markers=a.concat(e.markers))),t.addNode(t.buffer.writeElements(o,-r).finish(u.CodeBlock,i-r),r),!0},FencedCode(t,e){let n=Me(e);if(n<0)return!1;let s=t.lineStart+e.pos,r=e.next,i=n-e.pos,o=e.skipSpace(n),a=de(e.text,e.text.length,o),l=[k(u.CodeMar
1k,s,s+i)];o<a&&l.push(k(u.CodeInfo,t.lineStart+o,t.lineStart+a));for(let h=!0,f=!0,d=!1;t.nextLine()&&e.depth>=t.stack.length;h=!1){let c=e.pos;if(e.indent-e.baseIndent<4)for(;c<e.text.length&&e.text.charCodeAt(c)==r;)c++;if(c-e.pos>=i&&e.skipSpace(c)==e.text.length){for(let p of e.markers)l.push(p);f&&d&&y(l,t.lineStart-1,t.lineStart),l.push(k(u.CodeMark,t.lineStart+e.pos,t.lineStart+c)),t.nextLine();break}else{d=!0,h||(y(l,t.lineStart-1,t.lineStart),f=!1);for(let S of e.markers)l.push(S);let p=t.lineStart+e.basePos,m=t.lineStart+e.text.length;p<m&&(y(l,p,m),f=!1)}}return t.addNode(t.buffer.writeElements(l,-s).finish(u.FencedCode,t.prevLineEnd()-s),s),!0},Blockquote(t,e){let n=ve(e);return n<0?!1:(t.startContext(u.Blockquote,e.pos),t.addNode(u.QuoteMark,t.lineStart+e.pos,t.lineStart+e.pos+1),e.moveBase(e.pos+n),null)},HorizontalRule(t,e){if(re(e,t,!1)<0)return!1;let n=t.lineStart+e.pos;return t.nextLine(),t.addNode(u.HorizontalRule,n),!0},BulletList(t,e){let n=ie(e,t,!1);if(n<0)return!1;t.block.type!=u.BulletList&&t.startContext(u.BulletList,e.basePos,e.next);let s=pe(e,e.pos+1);return t.startContext(u.ListItem,e.basePos,s-e.baseIndent),t.addNode(u.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+n),e.moveBaseColumn(s),null},OrderedList(t,e){let n=oe(e,t,!1);if(n<0)return!1;t.block.type!=u.OrderedList&&t.startContext(u.OrderedList,e.basePos,e.text.charCodeAt(e.pos+n-1));let s=pe(e,e.pos+n);return t.startContext(u.ListItem,e.basePos,s-e.baseIndent),t.addNode(u.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+n),e.moveBaseColumn(s),null},ATXHeading(t,e){let n=Pe(e);if(n<0)return!1;let s=e.pos,r=t.lineStart+s,i=de(e.text,e.text.length,s),o=i;for(;o>s&&e.text.charCodeAt(o-1)==e.next;)o--;(o==i||o==s||!w(e.text.charCodeAt(o-1)))&&(o=e.text.length);let a=t.buffer.write(u.HeaderMark,0,n).writeElements(t.parser.parseInline(e.text.slice(s+n+1,o),r+n+1),-r);o<e.text.length&&a.write(u.HeaderMark,o-s,i-s);let l=a.finish(u.ATXHeading1-1+n,e.text.length-s);return t.nextLine(),t.addNode(l,r),!0},HTMLBlock(t,e){let n=Re(e,t,!1);if(n<0)return!1;let s=t.lineStart+e.pos,r=ee[n][1],i=[],o=r!=Y;for(;!r.test(e.text)&&t.nextLine();){if(e.depth<t.stack.length){o=!1;break}for(let h of e.markers)i.push(h)}o&&t.nextLine();let a=r==Oe?u.CommentBlock:r==$e?u.ProcessingInstructionBlock:u.HTMLBlock,l=t.prevLineEnd();return t.addNode(t.buffer.writeElements(i,-s).finish(a,l-s),s),!0},SetextHeading:void 0};class wt{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,n,s){if(this.stage==-1)return!1;let r=s.content+` 2`+n.scrub(),i=this.advance(r);return i>-1&&i<r.length?this.complete(e,s,i):!1}finish(e,n){return(this.stage==2||this.stage==3)&&O(n.content,this.pos)==n.content.length?this.complete(e,n,n.content.length):!1}complete(e,n,s){return e.addLeafElement(n,k(u.LinkReference,this.start,this.start+s,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(Ze(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(k(u.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(_e(e,O(e,this.pos),this.start)))return-1}else if(this.stage==2){let n=O(e,this.pos),s=0;if(n>this.pos){let r=Qe(e,n,this.start);if(r){let i=V(e,r.to-this.start);i>0&&(this.nextStage(r),s=i)}}return s||(s=V(e,this.pos)),s>0&&s<e.length?s:-1}else return V(e,this.pos)}}}function V(t,e){for(;e<t.length;e++){let n=t.charCodeAt(e);if(n==10)break;if(!w(n))return-1}return e}class yt{nextLine(e,n,s){let r=n.depth<e.stack.length?-1:Ne(n),i=n.next;if(r<0)return!1;let o=k(u.HeaderMark,e.lineStart+n.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(s,k(i==61?u.SetextHeading1:u.SetextHeading2,s.start,e.prevLineEnd(),[...e.parser.parseInline(s.content,s.start),o])),!0}finish(){return!1}}const Xe={LinkReference(t,e){return e.content.charCodeAt(0)==91?new wt(e):null},SetextHeading(){return new yt}},At=[(t,e)=>Pe(e)>=0,(t,e)=>Me(e)>=0,(t,e)=>ve(e)>=0,(t,e)=>ie(e,t,!0)>=0,(t,e)=>oe(e,t,!0)>=0,(t,e)=>re(e,t,!0)>=0,(t,e)=>
vendor: 6,046 bytes, lines 2-5
2Re(e,t,!0)>=0],It={text:"",end:0};class Tt{constructor(e,n,s,r){this.parser=e,this.input=n,this.ranges=r,this.line=new Ct,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=j.create(u.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=s.length?new Mt(s,n):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let s=0;;){let r=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;s<e.markers.length&&(!r||e.markers[s].from<r.end);){let i=e.markers[s++];this.addNode(i.type,i.from,i.to)}if(!r)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let s of this.parser.blockParsers)if(s){let r=s(this,e);if(r!=!1){if(r==!0)return null;e.forward();continue e}}break}let n=new St(this.lineStart+e.pos,e.text.slice(e.pos));for(let s of this.parser.leafBlockParsers)if(s){let r=s(this,n);r&&n.parsers.push(r)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let s of this.parser.endLeafBlock)if(s(this,e,n))break e}for(let s of n.parsers)if(s.nextLine(this,e,n))return null;n.content+=` 3`+e.scrub();for(let s of e.markers)n.marks.push(s)}return this.finishLeaf(n),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 n=this.fragments.takeNodes(this);return n?(this.absoluteLineStart+=n,this.lineStart=Ve(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 n=It;if(n.end=e,e>=this.to)n.text="";else if(n.text=this.lineChunkAt(e),n.end+=n.text.length,this.ranges.length>1){let s=this.absoluteLineStart,r=this.rangeI;for(;this.ranges[r].to<n.end;){r++;let i=this.ranges[r].from,o=this.lineChunkAt(i);n.end=i+o.length,n.text=n.text.slice(0,this.ranges[r-1].to-s)+o,s=n.end-n.text.length}}return n}readLine(){let{line:e}=this,{text:n,end:s}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=s,e.reset(n);e.depth<this.stack.length;e.depth++){let r=this.stack[e.depth],i=this.parser.skipContextMarkup[r.type];if(!i)throw new Error("Unhandled block context "+u[r.type]);let o=this.line.markers.length;if(!i(r,this,e)){this.line.markers.length>o&&(r.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let n=this.input.chunk(e),s;if(this.input.lineChunks)s=n==` 4`?"":n;else{let r=n.indexOf(` 5`);s=r<0?n:n.slice(0,r)}return e+s.length>this.to?s.slice(0,this.to-e):s}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,n,s=0){this.block=j.create(e,s,this.lineStart+n,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,n,s=0){this.startContext(this.parser.getNodeType(e),n,s)}addNode(e,n,s){typeof e=="number"&&(e=new E(this.parser.nodeSet.types[e],H,H,(s??this.prevLineEnd())-n)),this.block.addChild(e,n-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,n){this.addNode(this.buffer.writeElements(ne(n.children,e.marks),-n.from).finish(n.type,n.to-n.from),n.from)}finishContext(){let e=this.stack.pop(),n=this.stack[this.stack.length-1];n.addChild(e.toTree(this.parser.nodeSet),e.from-n.from),this.block=n}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?ze(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let s of e.parsers)if(s.finish(this,e))return;let n=ne(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(n,-e.start).finish(u.Paragraph,e.content.length),e.start)}elt(e,n,s,r){return typeof e=="string"?k(this.parser.getNodeType(e),n,s,r):new Fe(e,n)}get buffer(){return new qe(this.parser.nodeSet)}}function ze(t,e,n,s,r){let i=t[e].to,o=[],a=[],l=n.from+s;function h(f,d){for(;d?f>=i:f>i;){let c=t[e+1].from-i;s+=c,f+=c,e++,i=t[e].to}}for(let f=n.firstChild;f;f=f.nextSibling){h(f.from+s,!0);let d=f.from+s,c,p=r.get(f.tree);p?c=p:f.to+s>i?(c=ze(t,e,f,s,r),h(f.to+s,!1)):c=f.toTree(),o.push(c),a.push(d-l)}return h(n.to+s,!1),new E(n.type,o,a,n.to+s-l,n.tree?n.tree.propValues:void 0)}class Z extends ot{constructor(e,n,s,r,i,o,a,l,h){super(),this.nodeSet=e,this.blockParsers=n,this.leafBlockParsers=s,this.blockNames=r,this.endLeafBlock=i,this.skipContextMarkup=o,this.inlineParsers=a,this.inlineNames=l,this.wrappers=h,this.nodeTypes=Object.create(null);for(let f of e.types)this.nodeTypes[f.name]=f.id}createParse(e,n,s){let r=new Tt(this,e,n,s);for(let i of this.wrappers)r=i(r,e,n,s);return r}configure(e){let n=te(e);if(!n)return this;let{nodeSet:s,skipContextMarkup:r}=this,i=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inl
5ineParsers.slice(),h=this.inlineNames.slice(),f=this.endLeafBlock.slice(),d=this.wrappers;if(N(n.defineNodes)){r=Object.assign({},r);let c=s.types.slice(),p;for(let m of n.defineNodes){let{name:S,block:A,composite:L,style:b}=typeof m=="string"?{name:m}:m;if(c.some(T=>T.name==S))continue;L&&(r[c.length]=(T,P,st)=>L(P,st,T.value));let x=c.length,I=L?["Block","BlockContext"]:A?x>=u.ATXHeading1&&x<=u.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;c.push(Q.define({id:x,name:S,props:I&&[[v.group,I]]})),b&&(p||(p={}),Array.isArray(b)||b instanceof at?p[S]=b:Object.assign(p,b))}s=new Ie(c),p&&(s=s.extend(Te(p)))}if(N(n.props)&&(s=s.extend(...n.props)),N(n.remove))for(let c of n.remove){let p=this.blockNames.indexOf(c),m=this.inlineNames.indexOf(c);p>-1&&(i[p]=o[p]=void 0),m>-1&&(l[m]=void 0)}if(N(n.parseBlock))for(let c of n.parseBlock){let p=a.indexOf(c.name);if(p>-1)i[p]=c.parse,o[p]=c.leaf;else{let m=c.before?F(a,c.before):c.after?F(a,c.after)+1:a.length-1;i.splice(m,0,c.parse),o.splice(m,0,c.leaf),a.splice(m,0,c.name)}c.endLeaf&&f.push(c.endLeaf)}if(N(n.parseInline))for(let c of n.parseInline){let p=h.indexOf(c.name);if(p>-1)l[p]=c.parse;else{let m=c.before?F(h,c.before):c.after?F(h,c.after)+1:h.length-1;l.splice(m,0,c.parse),h.splice(m,0,c.name)}}return n.wrap&&(d=d.concat(n.wrap)),new Z(s,i,o,a,f,r,l,h,d)}getNodeType(e){let n=this.nodeTypes[e];if(n==null)throw new RangeError(`Unknown node type '${e}'`);return n}parseInline(e,n){let s=new ae(this,e,n);e:for(let r=n;r<s.end;){let i=s.char(r);for(let o of this.inlineParsers)if(o){let a=o(s,i,r);if(a>=0){r=a;continue e}}r++}return s.resolveMarkers(0)}}function N(t){return t!=null&&t.length>0}function te(t){if(!Array.isArray(t))return t;if(t.length==0)return null;let e=te(t[0]);if(t.length==1)return e;let n=te(t.slice(1));if(!n||!e)return e||n;let s=(o,a)=>(o||H).concat(a||H),r=e.wrap,i=n.wrap;return{props:s(e.props,n.props),defineNodes:s(e.defineNodes,n.defineNodes),parseBlock:s(e.parseBlock,n.parseBlock),parseInline:s(e.parseInline,n.parseInline),remove:s(e.remove,n.remove),wrap:r?i?(o,a,l,h)=>r(i(o,a,l,h),a,l,h):r:i}}function F(t,e){let n=t.indexOf(e);if(n<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return n}let De=[Q.none];for(let t=1,e;e=u[t];t++)De[t]=Q.define({id:t,name:e,props:t>=u.Escape?[]:[[v.group,t in Ee?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});const H=[];class qe{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,n,s,r=0){return this.content.push(e,n,s,4+r*4),this}writeElements(e,n=0){for(let s of e)s.writeTo(this,n);return this}finish(e,n){return E.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:n})}}class X{constructor(e,n,s,r=H){this.type=e,this.from=n,this.to=s,this.children=r}writeTo(e,n){let s=e.content.length;e.writeElements(this.children,n),e.content.push(this.type,this.from+n,this.to+n,e.content.length+4-s)}toTree(e){return new qe(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}}class Fe{constructor(e,n){this.tree=e,this.from=n}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return H}writeTo(e,n){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+n,this.to+n,-1)}toTree(){return this.tree}}function k(t,e,n,s){return new X(t,e,n,s)}const je={resolve:"Emphasis",mark:"EmphasisMark"},Ue={resolve:"Emphasis",mark:"EmphasisMark"},B={},U={};class C{constructor(e,n,s,r){this.type=e,this.from=n,this.to=s,this.side=r}}const me="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let z=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{z=new RegExp("[\\p{S}|\\p{P}]","u")}catch{}const G={Escape(t,e,n){if(e!=92||n==t.end-1)return-1;let s=t.char(n+1);for(let r=0;r<me.length;r++)if(me.charCodeAt(r)==s)return t.append(k(u.Escape,n,n+2));return-1},Entity(t,e,n){if(e!=38)return-1;let s=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(t.slice(n+1,n+31));return s?t.append(k(u.Entity,n,n+1+s[0].length)):-1},InlineCode(t,e,n){if(e!=96||n&&t.char(n-1)==96)return-1;let s=n+1;for(;s<t.end&&t.char(s)==96;)s++;let r=s-n,i=0;for(;s<t.end;s++)if(t.char(s)==96){if(i++,i==r&&t.char(s+1)!=96)return t.append(k(u.InlineCode,n,s+1,[k(u.CodeMar
vendor: 21,382 bytes, lines 5-6
5k,n,n+r),k(u.CodeMark,s+1-r,s+1)]))}else i=0;return-1},HTMLTag(t,e,n){if(e!=60||n==t.end-1)return-1;let s=t.slice(n+1,t.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(s);if(r)return t.append(k(u.Autolink,n,n+1+r[0].length,[k(u.LinkMark,n,n+1),k(u.URL,n+1,n+r[0].length),k(u.LinkMark,n+r[0].length,n+1+r[0].length)]));let i=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(s);if(i)return t.append(k(u.Comment,n,n+1+i[0].length));let o=/^\?[^]*?\?>/.exec(s);if(o)return t.append(k(u.ProcessingInstruction,n,n+1+o[0].length));let a=/^(?:![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(s);return a?t.append(k(u.HTMLTag,n,n+1+a[0].length)):-1},Emphasis(t,e,n){if(e!=95&&e!=42)return-1;let s=n+1;for(;t.char(s)==e;)s++;let r=t.slice(n-1,n),i=t.slice(s,s+1),o=z.test(r),a=z.test(i),l=/\s|^$/.test(r),h=/\s|^$/.test(i),f=!h&&(!a||l||o),d=!l&&(!o||h||a),c=f&&(e==42||!d||o),p=d&&(e==42||!f||a);return t.append(new C(e==95?je:Ue,n,s,(c?1:0)|(p?2:0)))},HardBreak(t,e,n){if(e==92&&t.char(n+1)==10)return t.append(k(u.HardBreak,n,n+2));if(e==32){let s=n+1;for(;t.char(s)==32;)s++;if(t.char(s)==10&&s>=n+2)return t.append(k(u.HardBreak,n,s+1))}return-1},Link(t,e,n){return e==91?t.append(new C(B,n,n+1,1)):-1},Image(t,e,n){return e==33&&t.char(n+1)==91?t.append(new C(U,n,n+2,1)):-1},LinkEnd(t,e,n){if(e!=93)return-1;for(let s=t.parts.length-1;s>=0;s--){let r=t.parts[s];if(r instanceof C&&(r.type==B||r.type==U)){if(!r.side||t.skipSpace(r.to)==n&&!/[(\[]/.test(t.slice(n+1,n+2)))return t.parts[s]=null,-1;let i=t.takeContent(s),o=t.parts[s]=Bt(t,i,r.type==B?u.Link:u.Image,r.from,n+1);if(r.type==B)for(let a=0;a<s;a++){let l=t.parts[a];l instanceof C&&l.type==B&&(l.side=0)}return o.to}}return-1}};function Bt(t,e,n,s,r){let{text:i}=t,o=t.char(r),a=r;if(e.unshift(k(u.LinkMark,s,s+(n==u.Image?2:1))),e.push(k(u.LinkMark,r-1,r)),o==40){let l=t.skipSpace(r+1),h=_e(i,l-t.offset,t.offset),f;h&&(l=t.skipSpace(h.to),l!=h.to&&(f=Qe(i,l-t.offset,t.offset),f&&(l=t.skipSpace(f.to)))),t.char(l)==41&&(e.push(k(u.LinkMark,r,r+1)),a=l+1,h&&e.push(h),f&&e.push(f),e.push(k(u.LinkMark,l,a)))}else if(o==91){let l=Ze(i,r-t.offset,t.offset,!1);l&&(e.push(l),a=l.to)}return k(n,s,a,e)}function _e(t,e,n){if(t.charCodeAt(e)==60){for(let s=e+1;s<t.length;s++){let r=t.charCodeAt(s);if(r==62)return k(u.URL,e+n,s+1+n);if(r==60||r==10)return!1}return null}else{let s=0,r=e;for(let i=!1;r<t.length;r++){let o=t.charCodeAt(r);if(w(o))break;if(i)i=!1;else if(o==40)s++;else if(o==41){if(!s)break;s--}else o==92&&(i=!0)}return r>e?k(u.URL,e+n,r+n):r==t.length?null:!1}}function Qe(t,e,n){let s=t.charCodeAt(e);if(s!=39&&s!=34&&s!=40)return!1;let r=s==40?41:s;for(let i=e+1,o=!1;i<t.length;i++){let a=t.charCodeAt(i);if(o)o=!1;else{if(a==r)return k(u.LinkTitle,e+n,i+1+n);a==92&&(o=!0)}}return null}function Ze(t,e,n,s){for(let r=!1,i=e+1,o=Math.min(t.length,i+999);i<o;i++){let a=t.charCodeAt(i);if(r)r=!1;else{if(a==93)return s?!1:k(u.LinkLabel,e+n,i+1+n);if(s&&!w(a)&&(s=!1),a==91)return!1;a==92&&(r=!0)}}return null}class ae{constructor(e,n,s){this.parser=e,this.text=n,this.offset=s,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,n){return this.text.slice(e-this.offset,n-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,n,s,r,i){return this.append(new C(e,n,s,(r?1:0)|(i?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let n=this.parts[e];if(n instanceof C&&(n.type==B||n.type==U))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let s=e;s<this.parts.length;s++){let r=this.parts[s];if(!(r instanceof C&&r.type.resolve&&r.side&2))continue;let i=r.type==je||r.type==Ue,o=r.to-r.from,a,l=s-1;for(;l>=e;l--){let m=this.parts[l];if(m instanceof C&&m.side&1&&m.type==r.type&&!(i&&(r.side&1||m.side&2)&&(m.to-m.from+o)%3==0&&((m.to-m.from)%3||o%3))){a=m;break}}if(!a)continue;let h=r.type.resolve,f=[],d=a.from,c=r.to;if(i){let m=Math.min(2,a.to-a.from,o);d=a.to-m,c=r.from+m,h=m==1?"Emphasis":"StrongEmphasis"}a.type.mark&&f.push(this.elt(a.type.mark,d,a.to));for(let m=l+1;m<s;m++)this.parts[m]instanceof X&&f.push(this.parts[m]),this.parts[m]=null;r.type.mark&&f.push(this.elt(r.type.mark,r.from,c));let p=this.elt(h,d,c,f);this.parts[l]=i&&a.from!=d?new C(a.type,a.from,d,a.side):null,(this.parts[s]=i&&r.to!=c?new C(r.type,c,r.to,r.side):null)?this.parts.splice(s,0,p):this.parts[s]=p}let n=[];for(let s=e;s<this.parts.length;s++){let r=this.parts[s];r instanceof X&&n.push(r)}return n}findOpeningDelimiter(e){for(let n=this.parts.length-1;n>=0;n--){let s=this.parts[n];if(s instanceof C&&s.type==e&&s.side&1)return n}return null}takeContent(e){let n=this.resolveMarkers(e);return this.parts.length=e,n}getDelimiterAt(e){let n=this.parts[e];return n instanceof C?n:null}skipSpace(e){return O(this.text,e-this.offset)+this.offset}elt(e,n,s,r){return typeof e=="string"?k(this.parser.getNodeType(e),n,s,r):new Fe(e,n)}}ae.linkStart=B;ae.imageStart=U;function ne(t,e){if(!e.length)return t;if(!t.length)return e;let n=t.slice(),s=0;for(let r of e){for(;s<n.length&&n[s].to<r.to;)s++;if(s<n.length&&n[s].from<r.from){let i=n[s];i instanceof X&&(n[s]=new X(i.type,i.from,i.to,ne(i.children,[r])))}else n.splice(s++,0,r)}return n}const Et=[u.CodeBlock,u.ListItem,u.OrderedList,u.BulletList];class Mt{constructor(e,n){this.fragments=e,this.input=n,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,n){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 i=this.fragment.to;for(;i>0&&this.input.read(i-1,i)!=` 6`;)i--;this.fragmentEnd=i?i-1:0}let s=this.cursor;s||(s=this.cursor=this.fragment.tree.cursor(),s.firstChild());let r=e+this.fragment.offset;for(;s.to<=r;)if(!s.parent())return!1;for(;;){if(s.from>=r)return this.fragment.from<=n;if(!s.childAfter(r))return!1}}matches(e){let n=this.cursor.tree;return n&&n.prop(v.contextHash)==e}takeNodes(e){let n=this.cursor,s=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),i=e.absoluteLineStart,o=i,a=e.block.children.length,l=o,h=a;for(;;){if(n.to-s>r){if(n.type.isAnonymous&&n.firstChild())continue;break}let f=Ve(n.from-s,e.ranges);if(n.to-s<=e.ranges[e.rangeI].to)e.addNode(n.tree,f);else{let d=new E(e.parser.nodeSet.types[u.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(d,n.tree),e.addNode(d,f)}if(n.type.is("Block")&&(Et.indexOf(n.type.id)<0?(o=n.to-s,a=e.block.children.length):(o=l,a=h),l=n.to-s,h=e.block.children.length),!n.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-i}}function Ve(t,e){let n=t;for(let s=1;s<e.length;s++){let r=e[s-1].to,i=e[s].from;r<t&&(n-=i-r)}return n}const vt=Te({"Blockquote/...":g.quote,HorizontalRule:g.contentSeparator,"ATXHeading1/... SetextHeading1/...":g.heading1,"ATXHeading2/... SetextHeading2/...":g.heading2,"ATXHeading3/...":g.heading3,"ATXHeading4/...":g.heading4,"ATXHeading5/...":g.heading5,"ATXHeading6/...":g.heading6,"Comment CommentBlock":g.comment,Escape:g.escape,Entity:g.character,"Emphasis/...":g.emphasis,"StrongEmphasis/...":g.strong,"Link/... Image/...":g.link,"OrderedList/... BulletList/...":g.list,"BlockQuote/...":g.quote,"InlineCode CodeText":g.monospace,"URL Autolink":g.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":g.processingInstruction,"CodeInfo LinkLabel":g.labelName,LinkTitle:g.string,Paragraph:g.content}),Ht=new Z(new Ie(De).extend(vt),Object.keys(q).map(t=>q[t]),Object.keys(q).map(t=>Xe[t]),Object.keys(q),At,Ee,Object.keys(G).map(t=>G[t]),Object.keys(G),[]);function Pt(t,e,n){let s=[];for(let r=t.firstChild,i=e;;r=r.nextSibling){let o=r?r.from:n;if(o>i&&s.push({from:i,to:o}),!r)break;i=r.to}return s}function Nt(t){let{codeParser:e,htmlParser:n}=t;return{wrap:ht((s,r)=>{let i=s.type.id;if(e&&(i==u.CodeBlock||i==u.FencedCode)){let o="";if(i==u.FencedCode){let l=s.node.getChild(u.CodeInfo);l&&(o=r.read(l.from,l.to))}let a=e(o);if(a)return{parser:a,overlay:l=>l.type.id==u.CodeText,bracketed:i==u.FencedCode}}else if(n&&(i==u.HTMLBlock||i==u.HTMLTag||i==u.CommentBlock))return{parser:n,overlay:Pt(s.node,s.from,s.to)};return null})}}const Ot={resolve:"Strikethrough",mark:"StrikethroughMark"},$t={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":g.strikethrough}},{name:"StrikethroughMark",style:g.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,n){if(e!=126||t.char(n+1)!=126||t.char(n+2)==126)return-1;let s=t.slice(n-1,n),r=t.slice(n+2,n+3),i=/\s|^$/.test(s),o=/\s|^$/.test(r),a=z.test(s),l=z.test(r);return t.addDelimiter(Ot,n,n+2,!o&&(!l||i||a),!i&&(!a||o||l))},after:"Emphasis"}]};function $(t,e,n=0,s,r=0){let i=0,o=!0,a=-1,l=-1,h=!1,f=()=>{s.push(t.elt("TableCell",r+a,r+l,t.parser.parseInline(e.slice(a,l),r+a)))};for(let d=n;d<e.length;d++){let c=e.charCodeAt(d);c==124&&!h?((!o||a>-1)&&i++,o=!1,s&&(a>-1&&f(),s.push(t.elt("TableDelimiter",d+r,d+r+1))),a=l=-1):(h||c!=32&&c!=9)&&(a<0&&(a=d),l=d+1),h=!h&&c==92}return a>-1&&(i++,s&&f()),i}function ge(t,e){for(let n=e;n<t.length;n++){let s=t.charCodeAt(n);if(s==124)return!0;s==92&&n++}return!1}const Ge=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class ke{constructor(){this.rows=null}nextLine(e,n,s){if(this.rows==null){this.rows=!1;let r;if((n.next==45||n.next==58||n.next==124)&&Ge.test(r=n.text.slice(n.pos))){let i=[];$(e,s.content,0,i,s.start)==$(e,r,0)&&(this.rows=[e.elt("TableHeader",s.start,s.start+s.content.length,i),e.elt("TableDelimiter",e.lineStart+n.pos,e.lineStart+n.text.length)])}}else if(this.rows){let r=[];$(e,n.text,n.pos,r,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+n.pos,e.lineStart+n.text.length,r))}return!1}finish(e,n){return this.rows?(e.addLeafElement(n,e.elt("Table",n.start,n.start+n.content.length,this.rows)),!0):!1}}const Rt={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":g.heading}},"TableRow",{name:"TableCell",style:g.content},{name:"TableDelimiter",style:g.processingInstruction}],parseBlock:[{name:"Table",leaf(t,e){return ge(e.content,0)?new ke:null},endLeaf(t,e,n){if(n.parsers.some(r=>r instanceof ke)||!ge(e.text,e.basePos))return!1;let s=t.peekLine();return Ge.test(s)&&$(t,e.text,e.basePos)==$(t,s,e.basePos)},before:"SetextHeading"}]};class Xt{nextLine(){return!1}finish(e,n){return e.addLeafElement(n,e.elt("Task",n.start,n.start+n.content.length,[e.elt("TaskMarker",n.start,n.start+3),...e.parser.parseInline(n.content.slice(3),n.start+3)])),!0}}const zt={defineNodes:[{name:"Task",block:!0,style:g.list},{name:"TaskMarker",style:g.atom}],parseBlock:[{name:"TaskList",leaf(t,e){return/^\[[ xX]\][ \t]/.test(e.content)&&t.parentType().name=="ListItem"?new Xt:null},after:"SetextHeading"}]},xe=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,Le=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,Dt=/[\w-]+\.[\w-]+($|[/:])/,be=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,Se=/\/[a-zA-Z\d@.]+/gy;function Ce(t,e,n,s){let r=0;for(let i=e;i<n;i++)t[i]==s&&r++;return r}function qt(t,e){Le.lastIndex=e;let n=Le.exec(t);if(!n||Dt.exec(n[0])[0].indexOf("_")>-1)return-1;let s=e+n[0].length;for(;;){let r=t[s-1],i;if(/[?!.,:*_~]/.test(r)||r==")"&&Ce(t,e,s,")")>Ce(t,e,s,"("))s--;else if(r==";"&&(i=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e,s))))s=e+i.index;else break}return s}function we(t,e){be.lastIndex=e;let n=be.exec(t);if(!n)return-1;let s=n[0][n[0].length-1];return s=="_"||s=="-"?-1:e+n[0].length-(s=="."?1:0)}const Ft={parseInline:[{name:"Autolink",parse(t,e,n){let s=n-t.offset;if(s&&/\w/.test(t.text[s-1]))return-1;xe.lastIndex=s;let r=xe.exec(t.text),i=-1;if(!r)return-1;if(r[1]||r[2]){if(i=qt(t.text,s+r[0].length),i>-1&&t.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(s,i));i=s+o[0].length}}else r[3]?i=we(t.text,s):(i=we(t.text,s+r[0].length),i>-1&&r[0]=="xmpp:"&&(Se.lastIndex=i,r=Se.exec(t.text),r&&(i=r.index+r[0].length)));return i<0?-1:(t.addElement(t.elt("URL",n,i+t.offset)),i+t.offset)}}]},jt=[Rt,zt,$t,Ft];function Je(t,e,n){return(s,r,i)=>{if(r!=t||s.char(i+1)==t)return-1;let o=[s.elt(n,i,i+1)];for(let a=i+1;a<s.end;a++){let l=s.char(a);if(l==t)return s.addElement(s.elt(e,i,a+1,o.concat(s.elt(n,a,a+1))));if(l==92&&o.push(s.elt("Escape",a,a+++2)),w(l))break}return-1}}const Ut={defineNodes:[{name:"Superscript",style:g.special(g.content)},{name:"SuperscriptMark",style:g.processingInstruction}],parseInline:[{name:"Superscript",parse:Je(94,"Superscript","SuperscriptMark")}]},_t={defineNodes:[{name:"Subscript",style:g.special(g.content)},{name:"SubscriptMark",style:g.processingInstruction}],parseInline:[{name:"Subscript",parse:Je(126,"Subscript","SubscriptMark")}]},Qt={defineNodes:[{name:"Emoji",style:g.character}],parseInline:[{name:"Emoji",parse(t,e,n){let s;return e!=58||!(s=/^[a-zA-Z_0-9]+:/.exec(t.slice(n+1,t.end)))?-1:t.addElement(t.elt("Emoji",n,n+1+s[0].length))}}]},Ke=ct({commentTokens:{block:{open:"<!--",close:"-->"}}}),We=new v,Ye=Ht.configure({props:[Be.add(t=>!t.is("Block")||t.is("Document")||se(t)!=null||Zt(t)?void 0:(e,n)=>({from:n.doc.lineAt(e.from).to,to:e.to})),We.add(se),pt.add({Document:()=>null}),mt.add({Document:Ke})]});function se(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function Zt(t){return t.name=="OrderedList"||t.name=="BulletList"}function Vt(t,e){let n=t;for(;;){let s=n.nextSibling,r;if(!s||(r=se(s.type))!=null&&r<=e)break;n=s}return n.to}const Gt=lt.of((t,e,n)=>{for(let s=D(t).resolveInner(n,-1);s&&!(s.from<e);s=s.parent){let r=s.type.prop(We);if(r==null)continue;let i=Vt(s,r);if(i>n)return{from:n,to:i}}return null});function le(t){return new ft(Ke,t,[],"markdown")}const Jt=le(Ye),Kt=Ye.configure([jt,_t,Ut,Qt,{props:[Be.add({Table:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}]),_=le(Kt);function Wt(t,e){return n=>{if(n&&t){let s=null;if(n=/\S*/.exec(n)[0],typeof t=="function"?s=t(n):s=ue.matchLanguageName(t,n,!0),s instanceof ue)return s.support?s.support.language.parser:kt.getSkippingParser(s.load());if(s)return s.parser}return e?e.parser:null}}class J{constructor(e,n,s,r,i,o,a){this.node=e,this.from=n,this.to=s,this.spaceBefore=r,this.spaceAfter=i,this.type=o,this.item=a}blank(e,n=!0){let s=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;s.length<e;)s+=" ";return s}else{for(let r=this.to-this.from-s.length-this.spaceAfter.length;r>0;r--)s+=" ";return s+(n?this.spaceAfter:"")}}marker(e,n){let s=this.node.name=="OrderedList"?String(+tt(this.item,e)[2]+n):"";return this.spaceBefore+s+this.type+this.spaceAfter}}function et(t,e){let n=[],s=[];for(let r=t;r;r=r.parent){if(r.name=="FencedCode")return s;(r.name=="ListItem"||r.name=="Blockquote")&&n.push(r)}for(let r=n.length-1;r>=0;r--){let i=n[r],o,a=e.lineAt(i.from),l=i.from-a.from;if(i.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l))))s.push(new J(i,l,l+o[0].length,"",o[1],">",null));else if(i.name=="ListItem"&&i.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(a.text.slice(l)))){let h=o[3],f=o[0].length;h.length>=4&&(h=h.slice(0,h.length-4),f-=4),s.push(new J(i.parent,l,l+f,o[1],h,o[2],i))}else if(i.name=="ListItem"&&i.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))){let h=o[4],f=o[0].length;h.length>4&&(h=h.slice(0,h.length-4),f-=4);let d=o[2];o[3]&&(d+=o[3].replace(/[xX]/," ")),s.push(new J(i.parent,l,l+f,o[1],h,d,i))}}return s}function tt(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function K(t,e,n,s=0){for(let r=-1,i=t;;){if(i.name=="ListItem"){let a=tt(i,e),l=+a[2];if(r>=0){if(l!=r+1)return;n.push({from:i.from+a[1].length,to:i.from+a[0].length,insert:String(r+2+s)})}r=l}let o=i.nextSibling;if(!o)break;i=o}}function he(t,e){let n=/^[ \t]*/.exec(t)[0].length;if(!n||e.facet(ut)!=" ")return t;let s=R(t,4,n),r="";for(let i=s;i>0;)i>=4?(r+=" ",i-=4):(r+=" ",i--);return r+t.slice(n)}const Yt=(t={})=>({state:e,dispatch:n})=>{let s=D(e),{doc:r}=e,i=null,o=e.changeByRange(a=>{if(!a.empty||!_.isActiveAt(e,a.from,-1)&&!_.isActiveAt(e,a.from,1))return i={range:a};let l=a.from,h=r.lineAt(l),f=et(s.resolveInner(l,-1),r);for(;f.length&&f[f.length-1].from>l-h.from;)f.pop();if(!f.length)return i={range:a};let d=f[f.length-1];if(d.to-d.spaceAfter.length>l-h.from)return i={range:a};let c=l>=d.to-d.spaceAfter.length&&!/\S/.test(h.text.slice(d.to));if(d.item&&c){let L=d.node.firstChild,b=d.node.getChild("ListItem","ListItem");if(L.to>=l||b&&b.to<l||h.from>0&&!/[^\s>]/.test(r.lineAt(h.from-1).text)||t.nonTightLists===!1){let x=f.length>1?f[f.length-2]:null,I,T="";x&&x.item?(I=h.from+x.from,T=x.marker(r,1)):I=h.from+(x?x.to:0);let P=[{from:I,to:l,insert:T}];return d.node.name=="OrderedList"&&K(d.item,r,P,-2),x&&x.node.name=="OrderedList"&&K(x.item,r,P),{range:M.cursor(I+T.length),changes:P}}else{let x=Ae(f,e,h);return{range:M.cursor(l+x.length+1),changes:{from:h.from,insert:x+e.lineBreak}}}}if(d.node.name=="Blockquote"&&c&&h.from){let L=r.lineAt(h.from-1),b=/>\s*$/.exec(L.text);if(b&&b.index==d.from){let x=e.changes([{from:L.from+b.index,to:L.to},{from:h.from+d.from,to:h.to}]);return{range:a.map(x),changes:x}}}let p=[];d.node.name=="OrderedList"&&K(d.item,r,p);let m=d.item&&d.item.from<h.from,S="";if(!m||/^[\s\d.)\-+*>]*/.exec(h.text)[0].length>=d.to)for(let L=0,b=f.length-1;L<=b;L++)S+=L==b&&!m?f[L].marker(r,1):f[L].blank(L<b?R(h.text,4,f[L+1].from)-S.length:null);let A=l;for(;A>h.from&&/\s/.test(h.text.charAt(A-h.from-1));)A--;return S=he(S,e),tn(d.node,e.doc)&&(S=Ae(f,e,h)+e.lineBreak+S),p.push({from:A,to:l,insert:e.lineBreak+S}),{range:M.cursor(A+S.length+1),changes:p}});return i?!1:(n(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},en=Yt();function ye(t){return t.name=="QuoteMark"||t.name=="ListMark"}function tn(t,e){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let n=t.firstChild,s=t.getChild("ListItem","ListItem");if(!s)return!1;let r=e.lineAt(n.to),i=e.lineAt(s.from),o=/^[\s>]*$/.test(r.text);return r.number+(o?0:1)<i.number}function Ae(t,e,n){let s="";for(let r=0,i=t.length-2;r<=i;r++)s+=t[r].blank(r<i?R(n.text,4,t[r+1].from)-s.length:null,r<i);return he(s,e)}function nn(t,e){let n=t.resolveInner(e,-1),s=e;ye(n)&&(s=n.from,n=n.parent);for(let r;r=n.childBefore(s);)if(ye(r))s=r.from;else if(r.name=="OrderedList"||r.name=="BulletList")n=r.lastChild,s=n.to;else break;return n}const sn=({state:t,dispatch:e})=>{let n=D(t),s=null,r=t.changeByRange(i=>{let o=i.from,{doc:a}=t;if(i.empty&&_.isActiveAt(t,i.from)){let l=a.lineAt(o),h=et(nn(n,o),a);if(h.length){let f=h[h.length-1],d=f.to-f.spaceAfter.length+(f.spaceAfter?1:0);if(o-l.from>d&&!/\S/.test(l.text.slice(d,o-l.from)))return{range:M.cursor(l.from+d),changes:{from:l.from+d,to:o}};if(o-l.from==d&&(!f.item||l.from<=f.item.from||!/\S/.test(l.text.slice(0,f.to)))){let c=l.from+f.from;if(f.item&&f.node.from<f.item.from&&/\S/.test(l.text.slice(f.from,f.to))){let p=f.blank(R(l.text,4,f.to)-R(l.text,4,f.from));return c==l.from&&(p=he(p,t)),{range:M.cursor(c+p.length),changes:{from:c,to:l.from+f.to,insert:p}}}if(c<o)return{range:M.cursor(c),changes:{from:c,to:o}}}}}return s={range:i}});return s?!1:(e(t.update(r,{scrollIntoView:!0,userEvent:"delete"})),!0)},rn=[{key:"Enter",run:en},{key:"Backspace",run:sn}],nt=Lt({matchClosingTags:!1});function gn(t={}){let{codeLanguages:e,defaultCodeLanguage:n,addKeymap:s=!0,base:{parser:r}=Jt,completeHTMLTags:i=!0,pasteURLAsLink:o=!0,htmlTagLanguage:a=nt}=t;if(!(r instanceof Z))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let l=t.extensions?[t.extensions]:[],h=[a.support,Gt],f;o&&h.push(hn),n instanceof fe?(h.push(n.support),f=n.language):n&&(f=n);let d=e||f?Wt(e,f):void 0;l.push(Nt({codeParser:d,htmlParser:a.language.parser})),s&&h.push(rt.high(it.of(rn)));let c=le(r.configure(l));return i&&h.push(c.data.of({autocomplete:on})),new fe(c,h)}function on(t){let{state:e,pos:n}=t,s=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(n-25,n));if(!s)return null;let r=D(e).resolveInner(n,-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:n-s[0].length,to:n,options:an(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let W=null;function an(){if(W)return W;let t=bt(new xt(dt.create({extensions:nt}),0,!0));return W=t?t.options:[]}const ln=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,hn=gt.domEventHandlers({paste:(t,e)=>{var n;let{main:s}=e.state.selection;if(s.empty)return!1;let r=(n=t.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r)||(/^www\./.test(r)&&(r="https://"+r),!_.isActiveAt(e.state,s.from,1)))return!1;let i=D(e.state),o=!1;return i.iterate({from:s.from,to:s.to,enter:a=>{(a.from>s.from||ln.test(a.name))&&(o=!0)},leave:a=>{a.to<s.to&&(o=!0)}}),o?!1:(e.dispatch({changes:[{from:s.from,insert:"["},{from:s.to,insert:`](${r})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}});
6export{Jt as commonmarkLanguage,sn as deleteMarkupBackward,en as insertNewlineContinueMarkup,Yt as insertNewlineContinueMarkupCommand,gn as markdown,rn as markdownKeymap,_ as markdownLanguage,hn as pasteURLAsLink};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.