/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
const e=1024;let t=0;class r{constructor(e,t){this.from=e,this.to=t}}class n{constructor(e={}){this.id=t++,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"function"!=typeof e&&(e=h.match(e)),t=>{let r=e(t);return void 0===r?null:[this,r]}}}n.closedBy=new n({deserialize:e=>e.split(" ")}),n.openedBy=new n({deserialize:e=>e.split(" ")}),n.group=new n({deserialize:e=>e.split(" ")}),n.isolate=new n({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),n.contextHash=new n({perNode:!0}),n.lookAhead=new n({perNode:!0}),n.mounted=new n({perNode:!0});class i{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[n.mounted.id]}}const s=/* @__PURE__ */Object.create(null);class h{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?/* @__PURE__ */Object.create(null):s,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),n=new h(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(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(n.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=/* @__PURE__ */Object.create(null);for(let r in e)for(let n of r.split(" "))t[n]=e[r];return e=>{for(let r=e.prop(n.group),i=-1;i<(r?r.length:0);i++){let n=t[i<0?e.name:r[i]];if(n)return n}}}}h.none=new h("",
/* @__PURE__ */Object.create(null),0,8);class o{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let n=null;for(let t of e){let e=t(r);if(e){n||(n=Object.assign({},r.props));let t=e[1],i=e[0];i.combine&&i.id in n&&(t=i.combine(n[i.id],t)),n[i.id]=t}}t.push(n?new h(r.name,n,r.id,r.flags):r)}return new o(t)}}const l=/* @__PURE__ */new WeakMap,f=/* @__PURE__ */new WeakMap;var u,a;(a=u||(u={}))[a.ExcludeBuffers=1]="ExcludeBuffers",a[a.IncludeAnonymous=2]="IncludeAnonymous",a[a.IgnoreMounts=4]="IgnoreMounts",a[a.IgnoreOverlays=8]="IgnoreOverlays",a[a.EnterBracketed=16]="EnterBracketed";class d{constructor(e,t,r,n,i){if(this.type=e,this.children=t,this.positions=r,this.length=n,this.props=null,i&&i.length){this.props=/* @__PURE__ */Object.create(null);for(let[e,t]of i)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=i.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let e=r.toString();e&&(t&&(t+=","),t+=e)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new A(this.topNode,e)}cursorAt(e,t=0,r=0){let n=l.get(this)||this.topNode,i=new A(n);return i.moveTo(e,t),l.set(this,i._tree),i}get topNode(){return new y(this,0,0,null)}resolve(e,t=0){let r=x(l.get(this)||this.topNode,e,t,!1);return l.set(this,r),r}resolveInner(e,t=0){let r=x(f.get(this)||this.topNode,e,t,!0);return f.set(this,r),r}resolveStack(e,t=0){return function(e,t,r){let n=e.resolveInner(t,r),s=null;for(let h=n instanceof y?n:n.context.parent;h;h=h.parent)if(h.index<0){let e=h.parent;(s||(s=[n])).push(e.resolve(t,r)),h=e}else{let e=i.get(h.tree);if(e&&e.overlay&&e.overlay[0].from<=t&&e.overlay[e.overlay.length-1].to>=t){let i=new y(e.tree,e.overlay[0].from+h.from,-1,h);(s||(s=[n])).push(x(i,t,r,!1))}}return s?k(s):n}(this,e,t)}iterate(e){let{enter:t,leave:r,from:n=0,to:i=this.length}=e,s=e.mode||0,h=(s&u.IncludeAnonymous)>0;for(let o=this.cursor(s|u.IncludeAnonymous);;){let e=!1;if(o.from<=i&&o.to>=n&&(!h&&o.type.isAnonymous||!1!==t(o))){if(o.firstChild())continue;e=!0}for(;e&&r&&(h||!o.type.isAnonymous)&&r(o),!o.nextSibling();){if(!o.parent())return;e=!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:z(h.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,r)=>new d(this.type,e,t,r,this.propValues),e.makeTree||((e,t,r)=>new d(h.none,e,t,r)))}static build(t){return function(t){var r;let{buffer:i,nodeSet:s,maxBufferLength:h=e,reused:o=[],minRepeatType:l=s.types.length}=t,f=Array.isArray(i)?new p(i,i.length):i,u=s.types,a=0,g=0;function x(e,t,r,n,i,d){let{id:p,start:k,end:C,size:A}=f,S=g,B=a;if(A<0){if(f.next(),-1==A){let t=o[p];return r.push(t),void n.push(k-e)}if(-3==A)return void(a=p);if(-4==A)return void(g=p);throw new RangeError(`Unrecognized record size: ${A}`)}let N,I,E=u[p],O=k-e;if(C-k<=h&&(I=_(f.pos-t,i))){let t=new Uint16Array(I.size-I.skip),r=f.pos-I.size,n=t.length;for(;f.pos>r;)n=v(I.start,t,n);N=new c(t,C-I.start,s),O=I.start-e}else{let e=f.pos-A;f.next();let t=[],r=[],n=p>=l?p:-1,i=0,s=C;for(;f.pos>e;)n>=0&&f.id==n&&f.size>=0?(f.end<=s-h&&(m(t,r,k,i,f.end,s,n,S,B),i=t.length,s=f.end),f.next()):d>2500?b(k,e,t,r):x(k,e,t,r,n,d+1);if(n>=0&&i>0&&i<t.length&&m(t,r,k,i,k,s,n,S,B),t.reverse(),r.reverse(),n>-1&&i>0){let e=y(E,B);N=z(E,t,r,0,t.length,0,C-k,e,e)}else N=w(E,t,r,C-k,S-C,B)}r.push(N),n.push(O)}function b(e,t,r,n){let i=[],o=0,l=-1;for(;f.pos>t;){let{id:e,start:t,end:r,size:n}=f;if(n>4)f.next();else{if(l>-1&&t<l)break;l<0&&(l=r-h),i.push(e,t,r),o++,f.next()}}if(o){let t=new Uint16Array(4*o),h=i[i.length-2];for(let e=i.length-3,r=0;e>=0;e-=3)t[r++]=i[e],t[r++]=i[e+1]-h,t[r++]=i[e+2]-h,t[r++]=r;r.push(new c(t,i[2]-h,s)),n.push(h-e)}}function y(e,t){return(r,i,s)=>{let h,o,l=0,f=r.length-1;if(f>=0&&(h=r[f])instanceof d){if(!f&&h.type==e&&h.length==s)return h;(o=h.prop(n.lookAhead))&&(l=i[f]+h.length+o)}return w(e,r,i,s,l,t)}}function m(e,t,r,n,i,h,o,l,f){let u=[],a=[];for(;e.length>n;)u.push(e.pop()),a.push(t.pop()+r-i);e.push(w(s.types[o],u,a,h-i,l-h,f)),t.push(i-r)}function w(e,t,r,i,s,h,o){if(h){let e=[n.contextHash,h];o=o?[e].concat(o):[e]}if(s>25){let e=[n.lookAhead,s];o=o?[e].concat(o):[e]}return new d(e,t,r,i,o)}function _(e,t){let r=f.fork(),n=0,i=0,s=0,o=r.end-h,u={size:0,start:0,skip:0};e:for(let h=r.pos-e;r.pos>h;){let e=r.size;if(r.id==t&&e>=0){u.size=n,u.start=i,u.skip=s,s+=4,n+=4,r.next();continue}let f=r.pos-e;if(e<0||f<h||r.start<o)break;let a=r.id>=l?4:0,d=r.start;for(r.next();r.pos>f;){if(r.size<0){if(-3!=r.size&&-4!=r.size)break e;a+=4}else r.id>=l&&(a+=4);r.next()}i=d,n+=e,s+=a}return(t<0||n==e)&&(u.size=n,u.start=i,u.skip=s),u.size>4?u:void 0}function v(e,t,r){let{id:n,start:i,end:s,size:h}=f;if(f.next(),h>=0&&n<l){let o=r;if(h>4){let n=f.pos-(h-4);for(;f.pos>n;)r=v(e,t,r)}t[--r]=o,t[--r]=s-e,t[--r]=i-e,t[--r]=n}else-3==h?a=n:-4==h&&(g=n);return r}let k=[],C=[];for(;f.pos>0;)x(t.start||0,t.bufferStart||0,k,C,-1,0);let A=null!==(r=t.length)&&void 0!==r?r:k.length?C[0]+k[0].length:0;return new d(u[t.topID],k.reverse(),C.reverse(),A)}(t)}}d.empty=new d(h.none,[],[],0);class p{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 p(this.buffer,this.index)}}class c{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return h.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],n=this.set.types[t],i=n.name;if(/\W/.test(i)&&!n.isError&&(i=JSON.stringify(i)),r==(e+=4))return i;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return i+"("+s.join(",")+")"}findChild(e,t,r,n,i){let{buffer:s}=this,h=-1;for(let o=e;o!=t&&!(g(i,n,s[o+1],s[o+2])&&(h=o,r>0));o=s[o+3]);return h}slice(e,t,r){let n=this.buffer,i=new Uint16Array(t-e),s=0;for(let h=e,o=0;h<t;){i[o++]=n[h++],i[o++]=n[h++]-r;let t=i[o++]=n[h++]-r;i[o++]=n[h++]-e,s=Math.max(s,t)}return new c(i,s,this.set)}}function g(e,t,r,n){switch(e){case-2:return r<t;case-1:return n>=t&&r<t;case 0:return r<t&&n>t;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function x(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to<t);){let t=!n&&e instanceof y&&e.index<0?null:e.parent;if(!t)return e;e=t}let s=n?0:u.IgnoreOverlays;if(n)for(let h=e,o=h.parent;o;h=o,o=h.parent)h instanceof y&&h.index<0&&(null===(i=o.enter(t,r,s))||void 0===i?void 0:i.from)!=h.from&&(e=o);for(;;){let n=e.enter(t,r,s);if(!n)return e;e=n}}class b{cursor(e=0){return new A(this,e)}getChild(e,t=null,r=null){let n=m(this,e,t,r);return n.length?n[0]:null}getChildren(e,t=null,r=null){return m(this,e,t,r)}resolve(e,t=0){return x(this,e,t,!1)}resolveInner(e,t=0){return x(this,e,t,!0)}matchContext(e){return w(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(r=t,t=e.prevSibling):t=e}return r}get node(){return this}get next(){return this.parent}}class y extends b{constructor(e,t,r,n){super(),this._tree=e,this.from=t,this.index=r,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,n,s=0){for(let h=this;;){for(let{children:o,positions:l}=h._tree,f=t>0?o.length:-1;e!=f;e+=t){let f,a=o[e],p=l[e]+h.from;if(s&u.EnterBracketed&&a instanceof d&&(f=i.get(a))&&!f.overlay&&f.bracketed&&r>=p&&r<=p+a.length||g(n,r,p,p+a.length))if(a instanceof c){if(s&u.ExcludeBuffers)continue;let i=a.findChild(0,a.buffer.length,t,r-p,n);if(i>-1)return new v(new _(h,a,e,p),null,i)}else if(s&u.IncludeAnonymous||!a.type.isAnonymous||S(a)){let o;if(!(s&u.IgnoreMounts)&&(o=i.get(a))&&!o.overlay)return new y(o.tree,p,e,h);let l=new y(a,p,e,h);return s&u.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(t<0?a.children.length-1:0,t,r,n,s)}}if(s&u.IncludeAnonymous||!h.type.isAnonymous)return null;if(e=h.index>=0?h.index+t:t<0?-1:h._parent._tree.children.length,h=h._parent,!h)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&u.IgnoreOverlays)&&(n=i.get(this._tree))&&n.overlay){let i=e-this.from,s=r&u.EnterBracketed&&n.bracketed;for(let{from:e,to:r}of n.overlay)if((t>0||s?e<=i:e<i)&&(t<0||s?r>=i:r>i))return new y(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 m(e,t,r,n){let i=e.cursor(),s=[];if(!i.firstChild())return s;if(null!=r)for(let h=!1;!h;)if(h=i.type.is(r),!i.nextSibling())return s;for(;;){if(null!=n&&i.type.is(n))return s;if(i.type.is(t)&&s.push(i.node),!i.nextSibling())return null==n?s:[]}}function w(e,t,r=t.length-1){for(let n=e;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}class _{constructor(e,t,r,n){this.parent=e,this.buffer=t,this.index=r,this.start=n}}class v extends b{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 v(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&u.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 v(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 v(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 v(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 d(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function k(e){if(!e.length)return null;let t=0,r=e[0];for(let s=1;s<e.length;s++){let n=e[s];(n.from>r.from||n.to<r.to)&&(r=n,t=s)}let n=r instanceof y&&r.index<0?null:r.parent,i=e.slice();return n?i[t]=n:i.splice(t,1),new C(i,r)}class C{constructor(e,t){this.heads=e,this.node=t}get next(){return k(this.heads)}}class A{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&~u.EnterBracketed,e instanceof y)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.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)}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 y?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}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)&&(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&u.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&u.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&u.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));let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let e=r<0?0:this.stack[r]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(e)}return r<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}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<n.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(n.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:r}=n)}else({index:t,_parent:r}=this._tree);for(;r;({index:t,_parent:r}=r))if(t>-1)for(let n=t+e,i=e<0?-1:r._tree.children.length;n!=i;n+=e){let e=r._tree.children[n];if(this.mode&u.IncludeAnonymous||e instanceof c||!e.type.isAnonymous||S(e))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<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let n=this.index,i=this.stack.length;i>=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<this.stack.length;n++)t=new v(this.buffer,t,this.stack[n]);return this.bufferNode=new v(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let n=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){r++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&t&&t(this),n=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,n=!0}}}matchContext(e){if(!this.buffer)return w(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let n=e.length-1,i=this.stack.length-1;n>=0;i--){if(i<0)return w(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 S(e){return e.children.some(e=>e instanceof c||!e.type.isAnonymous||S(e))}const B=/* @__PURE__ */new WeakMap;function N(e,t){if(!e.isAnonymous||t instanceof c||t.type!=e)return 1;let r=B.get(t);if(null==r){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof d)){r=1;break}r+=N(e,n)}B.set(t,r)}return r}function z(e,t,r,n,i,s,h,o,l){let f=0;for(let p=n;p<i;p++)f+=N(e,t[p]);let u=Math.ceil(1.5*f/8),a=[],d=[];return function t(r,n,i,h,o){for(let f=i;f<h;){let i=f,p=n[f],c=N(e,r[f]);for(f++;f<h;f++){let t=N(e,r[f]);if(c+t>=u)break;c+=t}if(f==i+1){if(c>u){let e=r[i];t(e.children,e.positions,0,e.children.length,n[i]+o);continue}a.push(r[i])}else{let t=n[f-1]+r[f-1].length-p;a.push(z(e,r,n,i,f,p,t,null,l))}d.push(p+o-s)}}(t,r,n,i,0),(o||l)(a,d,h)}class I{constructor(){this.map=/* @__PURE__ */new WeakMap}setBuffer(e,t,r){let n=this.map.get(e);n||this.map.set(e,n=/* @__PURE__ */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 v?this.setBuffer(e.context.buffer,e.index,t):e instanceof y&&this.map.set(e.tree,t)}get(e){return e instanceof v?this.getBuffer(e.context.buffer,e.index):e instanceof y?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 E{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(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],r=!1){let n=[new E(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 h=0,o=0,l=0;;h++){let f=h<t.length?t[h]:null,u=f?f.fromA:1e9;if(u-o>=r)for(;s&&s.from<u;){let t=s;if(o>=t.from||u<=t.to||l){let e=Math.max(t.from,o)-l,r=Math.min(t.to,u)-l;t=e>=r?null:new E(e,r,t.tree,t.offset+l,h>0,!!f)}if(t&&n.push(t),s.to>u)break;s=i<e.length?e[i++]:null}if(!f)break;o=f.toA,l=f.toA-f.toB}return n}}class O{startParse(e,t,n){return"string"==typeof e&&(e=new M(e)),n=n?n.length?n.map(e=>new r(e.from,e.to)):[new r(0,0)]:[new r(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,r){let n=this.startParse(e,t,r);for(;;){let e=n.advance();if(e)return e}}}class M{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)}}new n({perNode:!0});export{e as DefaultBufferLength,u as IterMode,i as MountedTree,n as NodeProp,o as NodeSet,h as NodeType,I as NodeWeakMap,O as Parser,d as Tree,c as TreeBuffer,A as TreeCursor,E as TreeFragment};