const ve=1024;let ke=0;class T{constructor(e,t){this.from=e,this.to=t}}class v{constructor(e={}){this.id=ke++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=O.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}v.closedBy=new v({deserialize:l=>l.split(" ")}),v.openedBy=new v({deserialize:l=>l.split(" ")}),v.group=new v({deserialize:l=>l.split(" ")}),v.isolate=new v({deserialize:l=>{if(l&&l!="rtl"&&l!="ltr"&&l!="auto")throw new RangeError("Invalid value for isolate: "+l);return l||"auto"}}),v.contextHash=new v({perNode:!0}),v.lookAhead=new v({perNode:!0}),v.mounted=new v({perNode:!0});class q{constructor(e,t,r){this.tree=e,this.overlay=t,this.parser=r}static get(e){return e&&e.props&&e.props[v.mounted.id]}}const Ce=Object.create(null);class O{constructor(e,t,r,n=0){this.name=e,this.props=t,this.id=r,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):Ce,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new O(e.name||"",t,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(n)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[i[0].id]=i[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(v.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let n of r.split(" "))t[n]=e[r];return r=>{for(let n=r.prop(v.group),i=-1;i<(n?n.length:0);i++){let s=t[i<0?r.name:n[i]];if(s)return s}}}}O.none=new O("",Object.create(null),0,8);class se{constructor(e){this.types=e;for(let t=0;t0;for(let h=this.cursor(s|C.IncludeAnonymous);;){let a=!1;if(h.from<=i&&h.to>=n&&(!f&&h.type.isAnonymous||t(h)!==!1)){if(h.firstChild())continue;a=!0}for(;a&&r&&(f||!h.type.isAnonymous)&&r(h),!h.nextSibling();){if(!h.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:ne(O.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,n)=>new z(this.type,t,r,n,this.propValues),e.makeTree||((t,r,n)=>new z(O.none,t,r,n)))}static build(e){return Ie(e)}}z.empty=new z(O.none,[],[],0);class le{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new le(this.buffer,this.index)}}class U{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return O.none}toString(){let e=[];for(let t=0;t0));h=s[h+3]);return f}slice(e,t,r){let n=this.buffer,i=new Uint16Array(t-e),s=0;for(let f=e,h=0;f=e&&te;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function Q(l,e,t,r){for(var n;l.from==l.to||(t<1?l.from>=e:l.from>e)||(t>-1?l.to<=e:l.to0?f.length:-1;e!=a;e+=t){let o=f[e],d=h[e]+s.from;if(ue(n,r,d,d+o.length)){if(o instanceof U){if(i&C.ExcludeBuffers)continue;let p=o.findChild(0,o.buffer.length,t,r-d,n);if(p>-1)return new D(new Ae(s,o,e,d),null,p)}else if(i&C.IncludeAnonymous||!o.type.isAnonymous||re(o)){let p;if(!(i&C.IgnoreMounts)&&(p=q.get(o))&&!p.overlay)return new P(p.tree,d,e,s);let y=new P(o,d,e,s);return i&C.IncludeAnonymous||!y.type.isAnonymous?y:y.nextChild(t<0?o.children.length-1:0,t,r,n)}}}if(i&C.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+t:e=t<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,r=0){let n;if(!(r&C.IgnoreOverlays)&&(n=q.get(this._tree))&&n.overlay){let i=e-this.from;for(let{from:s,to:f}of n.overlay)if((t>0?s<=i:s=i:f>i))return new P(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function pe(l,e,t,r){let n=l.cursor(),i=[];if(!n.firstChild())return i;if(t!=null){for(let s=!1;!s;)if(s=n.type.is(t),!n.nextSibling())return i}for(;;){if(r!=null&&n.type.is(r))return i;if(n.type.is(e)&&i.push(n.node),!n.nextSibling())return r==null?i:[]}}function te(l,e,t=e.length-1){for(let r=l.parent;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}class Ae{constructor(e,t,r,n){this.parent=e,this.buffer=t,this.index=r,this.start=n}}class D extends ae{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,r);return i<0?null:new D(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,r=0){if(r&C.ExcludeBuffers)return null;let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new D(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new D(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new D(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,n=this.index+4,i=r.buffer[this.index+3];if(i>n){let s=r.buffer[this.index+1];e.push(r.slice(n,i,s)),t.push(0)}return new z(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function de(l){if(!l.length)return null;let e=0,t=l[0];for(let i=1;it.from||s.to=e){let f=new P(s.tree,s.overlay[0].from+i.from,-1,i);(n||(n=[r])).push(Q(f,e,t,!1))}}return n?de(n):r}class X{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof P)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:r,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=r+n.buffer[e+1],this.to=r+n.buffer[e+2],!0}yield(e){return e?e instanceof P?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:n}=this.buffer,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?r&C.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&C.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&C.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let n=r<0?0:this.stack[r]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(n)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:n}=this;if(n){if(e>0){if(this.index-1)for(let i=t+e,s=e<0?-1:r._tree.children.length;i!=s;i+=e){let f=r._tree.children[i];if(this.mode&C.IncludeAnonymous||f instanceof U||!f.type.isAnonymous||re(f))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let s=e;s;s=s._parent)if(s.index==n){if(n==this.index)return s;t=s,r=i+1;break e}n=this.stack[--i]}for(let n=r;n=0;i--){if(i<0)return te(this.node,e,n);let s=r[t.buffer[this.stack[i]]];if(!s.isAnonymous){if(e[n]&&e[n]!=s.name)return!1;n--}}return!0}}function re(l){return l.children.some(e=>e instanceof U||!e.type.isAnonymous||re(e))}function Ie(l){var e;let{buffer:t,nodeSet:r,maxBufferLength:n=1024,reused:i=[],minRepeatType:s=r.types.length}=l,f=Array.isArray(t)?new le(t,t.length):t,h=r.types,a=0,o=0;function d(x,w,u,A,b,m){let{id:c,start:g,end:S,size:k}=f,B=o;for(;k<0;)if(f.next(),k==-1){let W=i[c];u.push(W),A.push(g-x);return}else if(k==-3){a=c;return}else if(k==-4){o=c;return}else throw new RangeError(`Unrecognized record size: ${k}`);let H=h[c],G,J,fe=g-x;if(S-g<=n&&(J=F(f.pos-w,b))){let W=new Uint16Array(J.size-J.skip),M=f.pos-J.size,R=W.length;for(;f.pos>M;)R=j(J.start,W,R);G=new U(W,S-J.start,r),fe=J.start-x}else{let W=f.pos-k;f.next();let M=[],R=[],V=c>=s?c:-1,$=0,Y=S;for(;f.pos>W;)V>=0&&f.id==V&&f.size>=0?(f.end<=Y-n&&(_(M,R,g,$,f.end,Y,V,B),$=M.length,Y=f.end),f.next()):m>2500?p(g,W,M,R):d(g,W,M,R,V,m+1);if(V>=0&&$>0&&$-1&&$>0){let he=y(H);G=ne(H,M,R,0,M.length,0,S-g,he,he)}else G=N(H,M,R,S-g,B-S)}u.push(G),A.push(fe)}function p(x,w,u,A){let b=[],m=0,c=-1;for(;f.pos>w;){let{id:g,start:S,end:k,size:B}=f;if(B>4)f.next();else{if(c>-1&&S=0;k-=3)g[B++]=b[k],g[B++]=b[k+1]-S,g[B++]=b[k+2]-S,g[B++]=B;u.push(new U(g,b[2]-S,r)),A.push(S-x)}}function y(x){return(w,u,A)=>{let b=0,m=w.length-1,c,g;if(m>=0&&(c=w[m])instanceof z){if(!m&&c.type==x&&c.length==A)return c;(g=c.prop(v.lookAhead))&&(b=u[m]+c.length+g)}return N(x,w,u,A,b)}}function _(x,w,u,A,b,m,c,g){let S=[],k=[];for(;x.length>A;)S.push(x.pop()),k.push(w.pop()+u-b);x.push(N(r.types[c],S,k,m-b,g-m)),w.push(b-u)}function N(x,w,u,A,b=0,m){if(a){let c=[v.contextHash,a];m=m?[c].concat(m):[c]}if(b>25){let c=[v.lookAhead,b];m=m?[c].concat(m):[c]}return new z(x,w,u,A,m)}function F(x,w){let u=f.fork(),A=0,b=0,m=0,c=u.end-n,g={size:0,start:0,skip:0};e:for(let S=u.pos-x;u.pos>S;){let k=u.size;if(u.id==w&&k>=0){g.size=A,g.start=b,g.skip=m,m+=4,A+=4,u.next();continue}let B=u.pos-k;if(k<0||B=s?4:0,G=u.start;for(u.next();u.pos>B;){if(u.size<0)if(u.size==-3)H+=4;else break e;else u.id>=s&&(H+=4);u.next()}b=G,A+=k,m+=H}return(w<0||A==x)&&(g.size=A,g.start=b,g.skip=m),g.size>4?g:void 0}function j(x,w,u){let{id:A,start:b,end:m,size:c}=f;if(f.next(),c>=0&&A4){let S=f.pos-(c-4);for(;f.pos>S;)u=j(x,w,u)}w[--u]=g,w[--u]=m-x,w[--u]=b-x,w[--u]=A}else c==-3?a=A:c==-4&&(o=A);return u}let E=[],I=[];for(;f.pos>0;)d(l.start||0,l.bufferStart||0,E,I,-1,0);let L=(e=l.length)!==null&&e!==void 0?e:E.length?I[0]+E[0].length:0;return new z(h[l.topID],E.reverse(),I.reverse(),L)}const ce=new WeakMap;function ee(l,e){if(!l.isAnonymous||e instanceof U||e.type!=l)return 1;let t=ce.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=l||!(r instanceof z)){t=1;break}t+=ee(l,r)}ce.set(e,t)}return t}function ne(l,e,t,r,n,i,s,f,h){let a=0;for(let _=r;_=o)break;w+=u}if(I==L+1){if(w>o){let u=_[L];y(u.children,u.positions,0,u.children.length,N[L]+E);continue}d.push(_[L])}else{let u=N[I-1]+_[I-1].length-x;d.push(ne(l,_,N,L,I,x,u,null,h))}p.push(x+E-i)}}return y(e,t,r,n,0),(f||h)(d,p,s)}class Ne{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof D?this.setBuffer(e.context.buffer,e.index,t):e instanceof P&&this.map.set(e.tree,t)}get(e){return e instanceof D?this.getBuffer(e.context.buffer,e.index):e instanceof P?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class K{constructor(e,t,r,n,i=!1,s=!1){this.from=e,this.to=t,this.tree=r,this.offset=n,this.open=(i?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],r=!1){let n=[new K(0,e.length,e,0,!1,r)];for(let i of t)i.to>e.length&&n.push(i);return n}static applyChanges(e,t,r=128){if(!t.length)return e;let n=[],i=1,s=e.length?e[0]:null;for(let f=0,h=0,a=0;;f++){let o=f=r)for(;s&&s.from=p.from||d<=p.to||a){let y=Math.max(p.from,h)-a,_=Math.min(p.to,d)-a;p=y>=_?null:new K(y,_,p.tree,p.offset+a,f>0,!!o)}if(p&&n.push(p),s.to>d)break;s=inew T(n.from,n.to)):[new T(0,0)]:[new T(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let n=this.startParse(e,t,r);for(;;){let i=n.advance();if(i)return i}}}class Be{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function ze(l){return(e,t,r,n)=>new Me(e,l,t,r,n)}class ge{constructor(e,t,r,n,i){this.parser=e,this.parse=t,this.overlay=r,this.target=n,this.from=i}}function me(l){if(!l.length||l.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(l))}class Ee{constructor(e,t,r,n,i,s,f){this.parser=e,this.predicate=t,this.mounts=r,this.index=n,this.start=i,this.target=s,this.prev=f,this.depth=0,this.ranges=[]}}const ie=new v({perNode:!0});class Me{constructor(e,t,r,n,i){this.nest=t,this.input=r,this.fragments=n,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new z(r.type,r.children,r.positions,r.length,r.propValues.concat([[ie,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[v.mounted.id]=new q(t,e.overlay,e.parser),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)f=!1;else if(e.hasNode(n)){if(t){let a=t.mounts.find(o=>o.frag.from<=n.from&&o.frag.to>=n.to&&o.mount.overlay);if(a)for(let o of a.mount.overlay){let d=o.from+a.pos,p=o.to+a.pos;d>=n.from&&p<=n.to&&!t.ranges.some(y=>y.fromd)&&t.ranges.push({from:d,to:p})}}f=!1}else if(r&&(s=Te(r.ranges,n.from,n.to)))f=s!=2;else if(!n.type.isAnonymous&&(i=this.nest(n,this.input))&&(n.fromnew T(d.from-n.from,d.to-n.from)):null,n.tree,o.length?o[0].from:n.from)),i.overlay?o.length&&(r={ranges:o,depth:0,prev:r}):f=!1}}else t&&(h=t.predicate(n))&&(h===!0&&(h=new T(n.from,n.to)),h.fromnew T(o.from-t.start,o.to-t.start)),t.target,a[0].from))),t=t.prev}r&&!--r.depth&&(r=r.prev)}}}}function Te(l,e,t){for(let r of l){if(r.from>=t)break;if(r.to>e)return r.from<=e&&r.to>=t?2:1}return 0}function xe(l,e,t,r,n,i){if(e=e&&t.enter(r,1,C.IgnoreOverlays|C.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof z)t=t.children[0];else break}return!1}}class Fe{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(t=r.tree.prop(ie))!==null&&t!==void 0?t:r.to,this.inner=new ye(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(ie))!==null&&e!==void 0?e:t.to,this.inner=new ye(t.tree,-t.offset)}}findMounts(e,t){var r;let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let i=this.inner.cursor.node;i;i=i.parent){let s=(r=i.tree)===null||r===void 0?void 0:r.prop(v.mounted);if(s&&s.parser==t)for(let f=this.fragI;f=i.to)break;h.tree==this.curFrag.tree&&n.push({frag:h,pos:i.from-h.offset,mount:s})}}}return n}}function be(l,e){let t=null,r=e;for(let n=1,i=0;n=f)break;h.to<=s||(t||(r=t=e.slice()),h.fromf&&t.splice(i+1,0,new T(f,h.to))):h.to>f?t[i--]=new T(f,h.to):t.splice(i--,1))}}return r}function je(l,e,t,r){let n=0,i=0,s=!1,f=!1,h=-1e9,a=[];for(;;){let o=n==l.length?1e9:s?l[n].to:l[n].from,d=i==e.length?1e9:f?e[i].to:e[i].from;if(s!=f){let p=Math.max(h,t),y=Math.min(o,d,r);pnew T(p.from+r,p.to+r)),d=je(e,o,h,a);for(let p=0,y=h;;p++){let _=p==d.length,N=_?a:d[p].from;if(N>y&&t.push(new K(y,N,n.tree,-s,i.from>=y||i.openStart,i.to<=N||i.openEnd)),_)break;y=d[p].to}}else t.push(new K(h,a,n.tree,-s,i.from>=s||i.openStart,i.to<=f||i.openEnd))}return t}export{ve as DefaultBufferLength,C as IterMode,q as MountedTree,v as NodeProp,se as NodeSet,O as NodeType,Ne as NodeWeakMap,Pe as Parser,z as Tree,U as TreeBuffer,X as TreeCursor,K as TreeFragment,ze as parseMixed};