const Oe=1024;let ke=0;class M{constructor(e,t){this.from=e,this.to=t}}class A{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")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=j.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}A.closedBy=new A({deserialize:l=>l.split(" ")});A.openedBy=new A({deserialize:l=>l.split(" ")});A.group=new A({deserialize:l=>l.split(" ")});A.isolate=new A({deserialize:l=>{if(l&&l!="rtl"&&l!="ltr"&&l!="auto")throw new RangeError("Invalid value for isolate: "+l);return l||"auto"}});A.contextHash=new A({perNode:!0});A.lookAhead=new A({perNode:!0});A.mounted=new A({perNode:!0});class ${constructor(e,t,r,n=!1){this.tree=e,this.overlay=t,this.parser=r,this.bracketed=n}static get(e){return e&&e.props&&e.props[A.mounted.id]}}const Ce=Object.create(null);class j{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 j(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(A.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(A.group),i=-1;i<(n?n.length:0);i++){let s=t[i<0?r.name:n[i]];if(s)return s}}}}j.none=new j("",Object.create(null),0,8);class ye{constructor(e){this.types=e;for(let t=0;t0;for(let h=this.cursor(s|w.IncludeAnonymous);;){let o=!1;if(h.from<=i&&h.to>=n&&(!f&&h.type.isAnonymous||t(h)!==!1)){if(h.firstChild())continue;o=!0}for(;o&&r&&(f||!h.type.isAnonymous)&&r(h),!h.nextSibling();){if(!h.parent())return;o=!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:le(j.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(j.none,t,r,n)))}static build(e){return Be(e)}}z.empty=new z(j.none,[],[],0);class ie{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 ie(this.buffer,this.index)}}class H{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return j.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 K(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?h.length:-1;e!=u;e+=t){let p=h[e],c=o[e]+f.from;if(!(!(i&w.EnterBracketed&&p instanceof z&&((s=$.get(p))===null||s===void 0?void 0:s.overlay)===null&&(c>=r||c+p.length<=r))&&!xe(n,r,c,c+p.length))){if(p instanceof H){if(i&w.ExcludeBuffers)continue;let m=p.findChild(0,p.buffer.length,t,r-c,n);if(m>-1)return new D(new Ae(f,p,e,c),null,m)}else if(i&w.IncludeAnonymous||!p.type.isAnonymous||se(p)){let m;if(!(i&w.IgnoreMounts)&&(m=$.get(p))&&!m.overlay)return new I(m.tree,c,e,f);let x=new I(p,c,e,f);return i&w.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(t<0?p.children.length-1:0,t,r,n,i)}}}if(i&w.IncludeAnonymous||!f.type.isAnonymous||(f.index>=0?e=f.index+t:e=t<0?-1:f._parent._tree.children.length,f=f._parent,!f))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)}prop(e){return this._tree.prop(e)}enter(e,t,r=0){let n;if(!(r&w.IgnoreOverlays)&&(n=$.get(this._tree))&&n.overlay){let i=e-this.from,s=r&w.EnterBracketed&&n.bracketed;for(let{from:f,to:h}of n.overlay)if((t>0||s?f<=i:f=i:h>i))return new I(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 ue(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 re(l,e,t=e.length-1){for(let r=l;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 we{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)}prop(e){return this.type.prop(e)}enter(e,t,r=0){if(r&w.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 ve(l){if(!l.length)return null;let e=0,t=l[0];for(let i=1;it.from||s.to=e){let f=new I(s.tree,s.overlay[0].from+i.from,-1,i);(n||(n=[r])).push(K(f,e,t,!1))}}return n?ve(n):r}class te{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~w.EnterBracketed,e instanceof I)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 I?(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&w.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&w.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&w.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&w.IncludeAnonymous||f instanceof H||!f.type.isAnonymous||se(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 re(this._tree,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 se(l){return l.children.some(e=>e instanceof H||!e.type.isAnonymous||se(e))}function Be(l){var e;let{buffer:t,nodeSet:r,maxBufferLength:n=1024,reused:i=[],minRepeatType:s=r.types.length}=l,f=Array.isArray(t)?new ie(t,t.length):t,h=r.types,o=0,u=0;function p(b,k,a,S,y,_){let{id:g,start:d,end:v,size:C}=f,N=u,U=o;if(C<0)if(f.next(),C==-1){let W=i[g];a.push(W),S.push(d-b);return}else if(C==-3){o=g;return}else if(C==-4){u=g;return}else throw new RangeError(`Unrecognized record size: ${C}`);let q=h[g],X,J,fe=d-b;if(v-d<=n&&(J=O(f.pos-k,y))){let W=new Uint16Array(J.size-J.skip),T=f.pos-J.size,R=W.length;for(;f.pos>T;)R=F(J.start,W,R);X=new H(W,v-J.start,r),fe=J.start-b}else{let W=f.pos-C;f.next();let T=[],R=[],V=g>=s?g:-1,G=0,Y=v;for(;f.pos>W;)V>=0&&f.id==V&&f.size>=0?(f.end<=Y-n&&(x(T,R,d,G,f.end,Y,V,N,U),G=T.length,Y=f.end),f.next()):_>2500?c(d,W,T,R):p(d,W,T,R,V,_+1);if(V>=0&&G>0&&G-1&&G>0){let he=m(q,U);X=le(q,T,R,0,T.length,0,v-d,he,he)}else X=P(q,T,R,v-d,N-v,U)}a.push(X),S.push(fe)}function c(b,k,a,S){let y=[],_=0,g=-1;for(;f.pos>k;){let{id:d,start:v,end:C,size:N}=f;if(N>4)f.next();else{if(g>-1&&v=0;C-=3)d[N++]=y[C],d[N++]=y[C+1]-v,d[N++]=y[C+2]-v,d[N++]=N;a.push(new H(d,y[2]-v,r)),S.push(v-b)}}function m(b,k){return(a,S,y)=>{let _=0,g=a.length-1,d,v;if(g>=0&&(d=a[g])instanceof z){if(!g&&d.type==b&&d.length==y)return d;(v=d.prop(A.lookAhead))&&(_=S[g]+d.length+v)}return P(b,a,S,y,_,k)}}function x(b,k,a,S,y,_,g,d,v){let C=[],N=[];for(;b.length>S;)C.push(b.pop()),N.push(k.pop()+a-y);b.push(P(r.types[g],C,N,_-y,d-_,v)),k.push(y-a)}function P(b,k,a,S,y,_,g){if(_){let d=[A.contextHash,_];g=g?[d].concat(g):[d]}if(y>25){let d=[A.lookAhead,y];g=g?[d].concat(g):[d]}return new z(b,k,a,S,g)}function O(b,k){let a=f.fork(),S=0,y=0,_=0,g=a.end-n,d={size:0,start:0,skip:0};e:for(let v=a.pos-b;a.pos>v;){let C=a.size;if(a.id==k&&C>=0){d.size=S,d.start=y,d.skip=_,_+=4,S+=4,a.next();continue}let N=a.pos-C;if(C<0||N=s?4:0,q=a.start;for(a.next();a.pos>N;){if(a.size<0)if(a.size==-3||a.size==-4)U+=4;else break e;else a.id>=s&&(U+=4);a.next()}y=q,S+=C,_+=U}return(k<0||S==b)&&(d.size=S,d.start=y,d.skip=_),d.size>4?d:void 0}function F(b,k,a){let{id:S,start:y,end:_,size:g}=f;if(f.next(),g>=0&&S4){let v=f.pos-(g-4);for(;f.pos>v;)a=F(b,k,a)}k[--a]=d,k[--a]=_-b,k[--a]=y-b,k[--a]=S}else g==-3?o=S:g==-4&&(u=S);return a}let E=[],B=[];for(;f.pos>0;)p(l.start||0,l.bufferStart||0,E,B,-1,0);let L=(e=l.length)!==null&&e!==void 0?e:E.length?B[0]+E[0].length:0;return new z(h[l.topID],E.reverse(),B.reverse(),L)}const ae=new WeakMap;function ee(l,e){if(!l.isAnonymous||e instanceof H||e.type!=l)return 1;let t=ae.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)}ae.set(e,t)}return t}function le(l,e,t,r,n,i,s,f,h){let o=0;for(let x=r;x=u)break;k+=a}if(B==L+1){if(k>u){let a=x[L];m(a.children,a.positions,0,a.children.length,P[L]+E);continue}p.push(x[L])}else{let a=P[B-1]+x[B-1].length-b;p.push(le(l,x,P,L,B,b,a,null,h))}c.push(b+E-i)}}return m(e,t,r,n,0),(f||h)(p,c,s)}class Fe{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 I&&this.map.set(e.tree,t)}get(e){return e instanceof D?this.getBuffer(e.context.buffer,e.index):e instanceof I?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 Q{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 Q(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,o=0;;f++){let u=f=r)for(;s&&s.from=c.from||p<=c.to||o){let m=Math.max(c.from,h)-o,x=Math.min(c.to,p)-o;c=m>=x?null:new Q(m,x,c.tree,c.offset+o,f>0,!!u)}if(c&&n.push(c),s.to>p)break;s=inew M(n.from,n.to)):[new M(0,0)]:[new M(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 Ne{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 Re(l){return(e,t,r,n)=>new Ie(e,l,t,r,n)}class pe{constructor(e,t,r,n,i,s){this.parser=e,this.parse=t,this.overlay=r,this.bracketed=n,this.target=i,this.from=s}}function de(l){if(!l.length||l.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(l))}class Pe{constructor(e,t,r,n,i,s,f,h){this.parser=e,this.predicate=t,this.mounts=r,this.index=n,this.start=i,this.bracketed=s,this.target=f,this.prev=h,this.depth=0,this.ranges=[]}}const ne=new A({perNode:!0});class Ie{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([[ne,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[A.mounted.id]=new $(t,e.overlay,e.parser,e.bracketed),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 o=t.mounts.find(u=>u.frag.from<=n.from&&u.frag.to>=n.to&&u.mount.overlay);if(o)for(let u of o.mount.overlay){let p=u.from+o.pos,c=u.to+o.pos;p>=n.from&&c<=n.to&&!t.ranges.some(m=>m.fromp)&&t.ranges.push({from:p,to:c})}}f=!1}else if(r&&(s=ze(r.ranges,n.from,n.to)))f=s!=2;else if(!n.type.isAnonymous&&(i=this.nest(n,this.input))&&(n.fromnew M(p.from-n.from,p.to-n.from)):null,!!i.bracketed,n.tree,u.length?u[0].from:n.from)),i.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):f=!1}}else if(t&&(h=t.predicate(n))&&(h===!0&&(h=new M(n.from,n.to)),h.from=0&&t.ranges[o].to==h.from?t.ranges[o]={from:t.ranges[o].from,to:h.to}:t.ranges.push(h)}if(f&&n.firstChild())t&&t.depth++,r&&r.depth++;else for(;!n.nextSibling();){if(!n.parent())break e;if(t&&!--t.depth){let o=me(this.ranges,t.ranges);o.length&&(de(o),this.inner.splice(t.index,0,new pe(t.parser,t.parser.startParse(this.input,be(t.mounts,o),o),t.ranges.map(u=>new M(u.from-t.start,u.to-t.start)),t.bracketed,t.target,o[0].from))),t=t.prev}r&&!--r.depth&&(r=r.prev)}}}}function ze(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 ce(l,e,t,r,n,i){if(e=e&&t.enter(r,1,w.IgnoreOverlays|w.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 Te{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(ne))!==null&&t!==void 0?t:r.to,this.inner=new ge(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(ne))!==null&&e!==void 0?e:t.to,this.inner=new ge(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(A.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 me(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 M(f,h.to))):h.to>f?t[i--]=new M(f,h.to):t.splice(i--,1))}}return r}function Me(l,e,t,r){let n=0,i=0,s=!1,f=!1,h=-1e9,o=[];for(;;){let u=n==l.length?1e9:s?l[n].to:l[n].from,p=i==e.length?1e9:f?e[i].to:e[i].from;if(s!=f){let c=Math.max(h,t),m=Math.min(u,p,r);cnew M(c.from+r,c.to+r)),p=Me(e,u,h,o);for(let c=0,m=h;;c++){let x=c==p.length,P=x?o:p[c].from;if(P>m&&t.push(new Q(m,P,n.tree,-s,i.from>=m||i.openStart,i.to<=P||i.openEnd)),x)break;m=p[c].to}}else t.push(new Q(h,o,n.tree,-s,i.from>=s||i.openStart,i.to<=f||i.openEnd))}return t}export{Oe as D,w as I,A as N,je as P,z as T,Fe as a,j as b,ye as c,Q as d,Re as p};