Files
server/opt/grafana/plugins/grafana-metricsdrilldown-app/782.js
cutemeli 0bfc6c8425 Initial
2025-12-22 10:32:59 +00:00

2 lines
43 KiB
JavaScript

"use strict";(self.webpackChunkgrafana_metricsdrilldown_app=self.webpackChunkgrafana_metricsdrilldown_app||[]).push([[782],{782:(t,e,s)=>{s.d(e,{U1:()=>A});var i=s(7203);class r{constructor(t,e,s,i,r,n,h,o,l,a=0,u){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=r,this.score=n,this.buffer=h,this.bufferBase=o,this.curContext=l,this.lookAhead=a,this.parent=u}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new r(t,[],e,s,s,0,[],0,i?new n(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=65535&t,{parser:r}=this.p,n=this.reducePos<this.pos-25;n&&this.setLookAhead(this.pos);let h=r.dynamicPrecedence(i);if(h&&(this.score+=h),0==s)return this.pushState(r.getGoto(this.state,i,!0),this.reducePos),i<r.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,n?8:4,!0),void this.reduceContext(i,this.reducePos);let o=this.stack.length-3*(s-1)-(262144&t?6:0),l=o?this.stack[o-2]:this.p.ranges[0].from,a=this.reducePos-l;a>=2e3&&!(null===(e=this.p.parser.nodeSet.types[i])||void 0===e?void 0:e.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=a):this.p.lastBigReductionSize<a&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=a));let u=o?this.stack[o-1]:0,f=this.bufferBase+this.buffer.length-u;if(i<r.minRepeatTerm||131072&t){let t=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,l,t,f+4,!0)}if(262144&t)this.state=this.stack[o];else{let t=this.stack[o-3];this.state=r.getGoto(t,i,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(i,l)}storeNode(t,e,s,i=4,r=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let t=this,i=this.buffer.length;if(0==i&&t.parent&&(i=t.bufferBase-t.parent.bufferBase,t=t.parent),i>0&&0==t.buffer[i-4]&&t.buffer[i-1]>-1){if(e==s)return;if(t.buffer[i-2]>=e)return void(t.buffer[i-2]=s)}}if(r&&this.pos!=s){let r=this.buffer.length;if(r>0&&0!=this.buffer[r-4]){let t=!1;for(let e=r;e>0&&this.buffer[e-2]>s;e-=4)if(this.buffer[e-1]>=0){t=!0;break}if(t)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}else this.buffer.push(t,e,s,i)}shift(t,e,s,i){if(131072&t)this.pushState(65535&t,this.pos);else if(262144&t)this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4);else{let r=t,{parser:n}=this.p;(i>this.pos||e<=n.maxNode)&&(this.pos=i,n.stateFlag(r,1)||(this.reducePos=i)),this.pushState(r,s),this.shiftContext(e,s),e<=n.maxNode&&this.buffer.push(e,s,i,4)}}apply(t,e,s,i){65536&t?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new r(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new h(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==s)return!1;if(!(65536&s))return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let s=[];for(let i,r=0;r<e.length;r+=2)(i=e[r+1])!=this.state&&this.p.parser.hasAction(i,t)&&s.push(e[r],i);if(this.stack.length<120)for(let t=0;s.length<8&&t<e.length;t+=2){let i=e[t+1];s.some((t,e)=>1&e&&t==i)||s.push(e[t],i)}e=s}let s=[];for(let t=0;t<e.length&&s.length<4;t+=2){let i=e[t+1];if(i==this.state)continue;let r=this.split();r.pushState(i,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[t],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if(!(65536&e))return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=65535&e,r=this.stack.length-3*s;if(r<0||t.getGoto(this.stack[r],i,!1)<0){let t=this.findForcedReduction();if(null==t)return!1;e=t}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,r)=>{if(!e.includes(i))return e.push(i),t.allActions(i,e=>{if(393216&e);else if(65536&e){let s=(e>>19)-r;if(s>1){let i=65535&e,r=this.stack.length-3*s;if(r>=0&&t.getGoto(this.stack[r],i,!1)>=0)return s<<19|65536|i}}else{let t=s(e,r+1);if(null!=t)return t}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||-3!=this.buffer[t])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||-4!=this.buffer[t])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new n(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){t>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class n{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class h{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,s=t>>19;0==s?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(s-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class o{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new o(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}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]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new o(this.stack,this.pos,this.index)}}function l(t,e=Uint16Array){if("string"!=typeof t)return t;let s=null;for(let i=0,r=0;i<t.length;){let n=0;for(;;){let e=t.charCodeAt(i++),s=!1;if(126==e){n=65535;break}e>=92&&e--,e>=34&&e--;let r=e-32;if(r>=46&&(r-=46,s=!0),n+=r,s)break;n*=46}s?s[r++]=n:s=new e(n)}return s}class a{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const u=new a;class f{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=u,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,r=this.pos+t;for(;r<s.from;){if(!i)return null;let t=this.ranges[--i];r-=s.from-t.to,s=t}for(;e<0?r>s.to:r>=s.to;){if(i==this.ranges.length-1)return null;let t=this.ranges[++i];r+=t.from-s.to,s=t}return r}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e,s,i=this.chunkOff+t;if(i>=0&&i<this.chunk.length)e=this.pos+t,s=this.chunk.charCodeAt(i);else{let i=this.resolveOffset(t,1);if(null==i)return-1;if(e=i,e>=this.chunk2Pos&&e<this.chunk2Pos+this.chunk2.length)s=this.chunk2.charCodeAt(e-this.chunk2Pos);else{let t=this.rangeIndex,i=this.range;for(;i.to<=e;)i=this.ranges[++t];this.chunk2=this.input.chunk(this.chunk2Pos=e),e+this.chunk2.length>i.to&&(this.chunk2=this.chunk2.slice(0,i.to-e)),s=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),s}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(null==s||s<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=u,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class c{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;p(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}c.prototype.contextual=c.prototype.fallback=c.prototype.extend=!1;c.prototype.fallback=c.prototype.extend=!1;function p(t,e,s,i,r,n){let h=0,o=1<<i,{dialect:l}=s.p.parser;t:for(;0!=(o&t[h]);){let s=t[h+1];for(let i=h+3;i<s;i+=2)if((t[i+1]&o)>0){let s=t[i];if(l.allows(s)&&(-1==e.token.value||e.token.value==s||g(s,e.token.value,r,n))){e.acceptToken(s);break}}let i=e.next,a=0,u=t[h+2];if(!(e.next<0&&u>a&&65535==t[s+3*u-3])){for(;a<u;){let r=a+u>>1,n=s+r+(r<<1),o=t[n],l=t[n+1]||65536;if(i<o)u=r;else{if(!(i>=l)){h=t[n+2],e.advance();continue t}a=r+1}}break}h=t[s+3*u-1]}}function d(t,e,s){for(let i,r=e;65535!=(i=t[r]);r++)if(i==s)return r-e;return-1}function g(t,e,s,i){let r=d(s,i,e);return r<0||d(s,i,t)<r}const k="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let x=null;function m(t,e,s){let r=t.cursor(i.Qj.IncludeAnonymous);for(r.moveTo(e);;)if(!(s<0?r.childBefore(e):r.childAfter(e)))for(;;){if((s<0?r.to<e:r.from>e)&&!r.type.isError)return s<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(s<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return s<0?0:t.length}}class b{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?m(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?m(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],r=this.index[e];if(r==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let n=s.children[r],h=this.start[e]+s.positions[r];if(h>t)return this.nextStart=h,null;if(n instanceof i.PH){if(h==t){if(h<this.safeFrom)return null;let t=h+n.length;if(t<=this.safeTo){let e=n.prop(i.uY.lookAhead);if(!e||t+e<this.fragment.to)return n}}this.index[e]++,h+n.length>=Math.max(this.safeFrom,t)&&(this.trees.push(n),this.start.push(h),this.index.push(0))}else this.index[e]++,this.nextStart=h+n.length}}}class y{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(t=>new a)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:r}=i,n=i.stateSlot(t.state,3),h=t.curContext?t.curContext.hash:0,o=0;for(let i=0;i<r.length;i++){if(!(1<<i&n))continue;let l=r[i],a=this.tokens[i];if((!s||l.fallback)&&((l.contextual||a.start!=t.pos||a.mask!=n||a.context!=h)&&(this.updateCachedToken(a,l,t),a.mask=n,a.context=h),a.lookAhead>a.end+25&&(o=Math.max(a.lookAhead,o)),0!=a.value)){let i=e;if(a.extended>-1&&(e=this.addActions(t,a.extended,a.end,e)),e=this.addActions(t,a.value,a.end,e),!l.extend&&(s=a,e>i))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),s||t.pos!=this.stream.end||(s=new a,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new a,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:e}=s.p;for(let i=0;i<e.specialized.length;i++)if(e.specialized[i]==t.value){let r=e.specializers[i](this.stream.read(t.start,t.end),s);if(r>=0&&s.p.parser.dialect.allows(r>>1)){1&r?t.extended=r>>1:t.value=r>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let e=0;e<i;e+=3)if(this.actions[e]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:r}=t,{parser:n}=t.p,{data:h}=n;for(let t=0;t<2;t++)for(let o=n.stateSlot(r,t?2:1);;o+=3){if(65535==h[o]){if(1!=h[o+1]){0==i&&2==h[o+1]&&(i=this.putAction(C(h,o+2),e,s,i));break}o=C(h,o+2)}h[o]==e&&(i=this.putAction(C(h,o+1),e,s,i))}return i}}class S{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new f(e,i),this.tokens=new y(t,this.stream),this.topTerm=t.top[1];let{from:n}=i[0];this.stacks=[r.start(this,t.top[0],n)],this.fragments=s.length&&this.stream.end-n>4*t.bufferLength?new b(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,s=this.stacks,i=this.minStackPos,r=this.stacks=[];if(this.bigReductionCount>300&&1==s.length){let[t]=s;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let n=0;n<s.length;n++){let h=s[n];for(;;){if(this.tokens.mainToken=null,h.pos>i)r.push(h);else{if(this.advanceStack(h,r,s))continue;{t||(t=[],e=[]),t.push(h);let s=this.tokens.getMainToken(h);e.push(s.value,s.end)}}break}}if(!r.length){let e=t&&function(t){let e=null;for(let s of t){let t=s.p.stoppedAt;(s.pos==s.p.stream.end||null!=t&&s.pos>t)&&s.p.parser.stateFlag(s.state,2)&&(!e||e.score<s.score)&&(e=s)}return e}(t);if(e)return this.stackToTree(e);if(this.parser.strict)throw new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&t){let s=null!=this.stoppedAt&&t[0].pos>this.stoppedAt?t[0]:this.runRecovery(t,e,r);if(s)return this.stackToTree(s.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(r.length>t)for(r.sort((t,e)=>e.score-t.score);r.length>t;)r.pop();r.some(t=>t.reducePos>i)&&this.recovering--}else if(r.length>1){t:for(let t=0;t<r.length-1;t++){let e=r[t];for(let s=t+1;s<r.length;s++){let i=r[s];if(e.sameState(i)||e.buffer.length>500&&i.buffer.length>500){if(!((e.score-i.score||e.buffer.length-i.buffer.length)>0)){r.splice(t--,1);continue t}r.splice(s--,1)}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let t=1;t<r.length;t++)r[t].pos<this.minStackPos&&(this.minStackPos=r[t].pos);return null}stopAt(t){if(null!=this.stoppedAt&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,s){let r=t.pos,{parser:n}=this;k&&this.stackID(t);if(null!=this.stoppedAt&&r>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,s=e?t.curContext.hash:0;for(let h=this.fragments.nodeAt(r);h;){let r=this.parser.nodeSet.types[h.type.id]==h.type?n.getGoto(t.state,h.type.id):-1;if(r>-1&&h.length&&(!e||(h.prop(i.uY.contextHash)||0)==s))return t.useNode(h,r),!0;if(!(h instanceof i.PH)||0==h.children.length||h.positions[0]>0)break;let o=h.children[0];if(!(o instanceof i.PH&&0==h.positions[0]))break;h=o}}let h=n.stateSlot(t.state,4);if(h>0)return t.reduce(h),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let i=0;i<o.length;){let n=o[i++],h=o[i++],l=o[i++],a=i==o.length||!s,u=a?t:t.split(),f=this.tokens.mainToken;if(u.apply(n,h,f?f.start:u.pos,l),a)return!0;u.pos>r?e.push(u):s.push(u)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return v(t,e),!0}}runRecovery(t,e,s){let i=null,r=!1;for(let n=0;n<t.length;n++){let h=t[n],o=e[n<<1],l=e[1+(n<<1)],a=k?this.stackID(h)+" -> ":"";if(h.deadEnd){if(r)continue;if(r=!0,h.restart(),this.advanceFully(h,s))continue}let u=h.split(),f=a;for(let t=0;u.forceReduce()&&t<10;t++){if(this.advanceFully(u,s))break;k&&(f=this.stackID(u)+" -> ")}for(let t of h.recoverByInsert(o))this.advanceFully(t,s);this.stream.end>h.pos?(l==h.pos&&(l++,o=0),h.recoverByDelete(o,l),v(h,s)):(!i||i.score<h.score)&&(i=h)}return i}stackToTree(t){return t.close(),i.PH.build({buffer:o.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(x||(x=new WeakMap)).get(t);return e||x.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function v(t,e){for(let s=0;s<e.length;s++){let i=e[s];if(i.pos==t.pos&&i.sameState(t))return void(e[s].score<t.score&&(e[s]=t))}e.push(t)}class w{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||0==this.disabled[t]}}class A extends i.iX{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let s=0;s<t.repeatNodeCount;s++)e.push("");let s=Object.keys(t.topRules).map(e=>t.topRules[e][1]),r=[];for(let t=0;t<e.length;t++)r.push([]);function n(t,e,s){r[t].push([e,e.deserialize(String(s))])}if(t.nodeProps)for(let e of t.nodeProps){let t=e[0];"string"==typeof t&&(t=i.uY[t]);for(let s=1;s<e.length;){let i=e[s++];if(i>=0)n(i,t,e[s++]);else{let r=e[s+-i];for(let h=-i;h>0;h--)n(e[s++],t,r);s++}}}this.nodeSet=new i.fI(e.map((e,n)=>i.Z6.define({name:n>=this.minRepeatTerm?void 0:e,id:n,props:r[n],top:s.indexOf(n)>-1,error:0==n,skipped:t.skippedNodes&&t.skippedNodes.indexOf(n)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=i.cF;let h=l(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t<this.specializerSpecs.length;t++)this.specialized[t]=this.specializerSpecs[t].term;this.specializers=this.specializerSpecs.map(P),this.states=l(t.states,Uint32Array),this.data=l(t.stateData),this.goto=l(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(t=>"number"==typeof t?new c(h,t):t),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new S(this,t,e,s);for(let r of this.wrappers)i=r(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let r=i[e+1];;){let e=i[r++],n=1&e,h=i[r++];if(n&&s)return h;for(let s=r+(e>>1);r<s;r++)if(i[r]==t)return h;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let r,n=this.stateSlot(t,i?2:1);;n+=3){if(65535==(r=s[n])){if(1!=s[n+1]){if(2==s[n+1])return C(s,n+2);break}r=s[n=C(s,n+2)]}if(r==e||0==r)return C(s,n+1)}return 0}stateSlot(t,e){return this.states[6*t+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,t=>t==e||null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let s=this.stateSlot(t,1);null==i;s+=3){if(65535==this.data[s]){if(1!=this.data[s+1])break;s=C(this.data,s+2)}i=e(C(this.data,s+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(65535==this.data[s]){if(1!=this.data[s+1])break;s=C(this.data,s+2)}if(!(1&this.data[s+2])){let t=this.data[s+1];e.some((e,s)=>1&s&&e==t)||e.push(this.data[s],t)}}return e}configure(t){let e=Object.assign(Object.create(A.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(e=>{let s=t.tokenizers.find(t=>t.from==e);return s?s.to:e})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let r=t.specializers.find(t=>t.from==s.external);if(!r)return s;let n=Object.assign(Object.assign({},s),{external:r.to});return e.specializers[i]=P(n),n})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let i of t.split(" ")){let t=e.indexOf(i);t>=0&&(s[t]=!0)}let i=null;for(let t=0;t<e.length;t++)if(!s[t])for(let s,r=this.dialects[e[t]];65535!=(s=this.data[r++]);)(i||(i=new Uint8Array(this.maxTerm+1)))[s]=1;return new w(t,s,i)}static deserialize(t){return new A(t)}}function C(t,e){return t[e]|t[e+1]<<16}function P(t){if(t.external){let e=t.extend?1:0;return(s,i)=>t.external(s,i)<<1|e}return t.get}},7203:(t,e,s)=>{s.d(e,{PH:()=>d,Qj:()=>p,Z6:()=>a,cF:()=>i,fI:()=>u,iX:()=>R,uY:()=>h});const i=1024;let r=0;class n{constructor(t,e){this.from=t,this.to=e}}class h{constructor(t={}){this.id=r++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=a.match(t)),e=>{let s=t(e);return void 0===s?null:[this,s]}}}h.closedBy=new h({deserialize:t=>t.split(" ")}),h.openedBy=new h({deserialize:t=>t.split(" ")}),h.group=new h({deserialize:t=>t.split(" ")}),h.isolate=new h({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),h.contextHash=new h({perNode:!0}),h.lookAhead=new h({perNode:!0}),h.mounted=new h({perNode:!0});class o{constructor(t,e,s){this.tree=t,this.overlay=e,this.parser=s}static get(t){return t&&t.props&&t.props[h.mounted.id]}}const l=Object.create(null);class a{constructor(t,e,s,i=0){this.name=t,this.props=e,this.id=s,this.flags=i}static define(t){let e=t.props&&t.props.length?Object.create(null):l,s=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),i=new a(t.name||"",e,t.id,s);if(t.props)for(let s of t.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[s[0].id]=s[1]}return i}prop(t){return this.props[t.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(t){if("string"==typeof t){if(this.name==t)return!0;let e=this.prop(h.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let s in t)for(let i of s.split(" "))e[i]=t[s];return t=>{for(let s=t.prop(h.group),i=-1;i<(s?s.length:0);i++){let r=e[i<0?t.name:s[i]];if(r)return r}}}}a.none=new a("",Object.create(null),0,8);class u{constructor(t){this.types=t;for(let e=0;e<t.length;e++)if(t[e].id!=e)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let e=[];for(let s of this.types){let i=null;for(let e of t){let t=e(s);t&&(i||(i=Object.assign({},s.props)),i[t[0].id]=t[1])}e.push(i?new a(s.name,i,s.id,s.flags):s)}return new u(e)}}const f=new WeakMap,c=new WeakMap;var p;!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(p||(p={}));class d{constructor(t,e,s,i,r){if(this.type=t,this.children=e,this.positions=s,this.length=i,this.props=null,r&&r.length){this.props=Object.create(null);for(let[t,e]of r)this.props["number"==typeof t?t:t.id]=e}}toString(){let t=o.get(this);if(t&&!t.overlay)return t.tree.toString();let e="";for(let t of this.children){let s=t.toString();s&&(e&&(e+=","),e+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e}cursor(t=0){return new N(this.topNode,t)}cursorAt(t,e=0,s=0){let i=f.get(this)||this.topNode,r=new N(i);return r.moveTo(t,e),f.set(this,r._tree),r}get topNode(){return new y(this,0,0,null)}resolve(t,e=0){let s=m(f.get(this)||this.topNode,t,e,!1);return f.set(this,s),s}resolveInner(t,e=0){let s=m(c.get(this)||this.topNode,t,e,!0);return c.set(this,s),s}resolveStack(t,e=0){return function(t,e,s){let i=t.resolveInner(e,s),r=null;for(let t=i instanceof y?i:i.context.parent;t;t=t.parent)if(t.index<0){let n=t.parent;(r||(r=[i])).push(n.resolve(e,s)),t=n}else{let n=o.get(t.tree);if(n&&n.overlay&&n.overlay[0].from<=e&&n.overlay[n.overlay.length-1].to>=e){let h=new y(n.tree,n.overlay[0].from+t.from,-1,t);(r||(r=[i])).push(m(h,e,s,!1))}}return r?C(r):i}(this,t,e)}iterate(t){let{enter:e,leave:s,from:i=0,to:r=this.length}=t,n=t.mode||0,h=(n&p.IncludeAnonymous)>0;for(let t=this.cursor(n|p.IncludeAnonymous);;){let n=!1;if(t.from<=r&&t.to>=i&&(!h&&t.type.isAnonymous||!1!==e(t))){if(t.firstChild())continue;n=!0}for(;n&&s&&(h||!t.type.isAnonymous)&&s(t),!t.nextSibling();){if(!t.parent())return;n=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:B(a.none,this.children,this.positions,0,this.children.length,0,this.length,(t,e,s)=>new d(this.type,t,e,s,this.propValues),t.makeTree||((t,e,s)=>new d(a.none,t,e,s)))}static build(t){return function(t){var e;let{buffer:s,nodeSet:r,maxBufferLength:n=i,reused:o=[],minRepeatType:l=r.types.length}=t,a=Array.isArray(s)?new g(s,s.length):s,u=r.types,f=0,c=0;function p(t,e,s,i,h,d){let{id:g,start:w,end:A,size:C}=a,P=c,N=f;for(;C<0;){if(a.next(),-1==C){let e=o[g];return s.push(e),void i.push(w-t)}if(-3==C)return void(f=g);if(-4==C)return void(c=g);throw new RangeError(`Unrecognized record size: ${C}`)}let _,z,T=u[g],R=w-t;if(A-w<=n&&(z=S(a.pos-e,h))){let e=new Uint16Array(z.size-z.skip),s=a.pos-z.size,i=e.length;for(;a.pos>s;)i=v(z.start,e,i);_=new k(e,A-z.start,r),R=z.start-t}else{let t=a.pos-C;a.next();let e=[],s=[],i=g>=l?g:-1,r=0,h=A;for(;a.pos>t;)i>=0&&a.id==i&&a.size>=0?(a.end<=h-n&&(b(e,s,w,r,a.end,h,i,P,N),r=e.length,h=a.end),a.next()):d>2500?x(w,t,e,s):p(w,t,e,s,i,d+1);if(i>=0&&r>0&&r<e.length&&b(e,s,w,r,w,h,i,P,N),e.reverse(),s.reverse(),i>-1&&r>0){let t=m(T,N);_=B(T,e,s,0,e.length,0,A-w,t,t)}else _=y(T,e,s,A-w,P-A,N)}s.push(_),i.push(R)}function x(t,e,s,i){let h=[],o=0,l=-1;for(;a.pos>e;){let{id:t,start:e,end:s,size:i}=a;if(i>4)a.next();else{if(l>-1&&e<l)break;l<0&&(l=s-n),h.push(t,e,s),o++,a.next()}}if(o){let e=new Uint16Array(4*o),n=h[h.length-2];for(let t=h.length-3,s=0;t>=0;t-=3)e[s++]=h[t],e[s++]=h[t+1]-n,e[s++]=h[t+2]-n,e[s++]=s;s.push(new k(e,h[2]-n,r)),i.push(n-t)}}function m(t,e){return(s,i,r)=>{let n,o,l=0,a=s.length-1;if(a>=0&&(n=s[a])instanceof d){if(!a&&n.type==t&&n.length==r)return n;(o=n.prop(h.lookAhead))&&(l=i[a]+n.length+o)}return y(t,s,i,r,l,e)}}function b(t,e,s,i,n,h,o,l,a){let u=[],f=[];for(;t.length>i;)u.push(t.pop()),f.push(e.pop()+s-n);t.push(y(r.types[o],u,f,h-n,l-h,a)),e.push(n-s)}function y(t,e,s,i,r,n,o){if(n){let t=[h.contextHash,n];o=o?[t].concat(o):[t]}if(r>25){let t=[h.lookAhead,r];o=o?[t].concat(o):[t]}return new d(t,e,s,i,o)}function S(t,e){let s=a.fork(),i=0,r=0,h=0,o=s.end-n,u={size:0,start:0,skip:0};t:for(let n=s.pos-t;s.pos>n;){let t=s.size;if(s.id==e&&t>=0){u.size=i,u.start=r,u.skip=h,h+=4,i+=4,s.next();continue}let a=s.pos-t;if(t<0||a<n||s.start<o)break;let f=s.id>=l?4:0,c=s.start;for(s.next();s.pos>a;){if(s.size<0){if(-3!=s.size)break t;f+=4}else s.id>=l&&(f+=4);s.next()}r=c,i+=t,h+=f}return(e<0||i==t)&&(u.size=i,u.start=r,u.skip=h),u.size>4?u:void 0}function v(t,e,s){let{id:i,start:r,end:n,size:h}=a;if(a.next(),h>=0&&i<l){let o=s;if(h>4){let i=a.pos-(h-4);for(;a.pos>i;)s=v(t,e,s)}e[--s]=o,e[--s]=n-t,e[--s]=r-t,e[--s]=i}else-3==h?f=i:-4==h&&(c=i);return s}let w=[],A=[];for(;a.pos>0;)p(t.start||0,t.bufferStart||0,w,A,-1,0);let C=null!==(e=t.length)&&void 0!==e?e:w.length?A[0]+w[0].length:0;return new d(u[t.topID],w.reverse(),A.reverse(),C)}(t)}}d.empty=new d(a.none,[],[],0);class g{constructor(t,e){this.buffer=t,this.index=e}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 g(this.buffer,this.index)}}class k{constructor(t,e,s){this.buffer=t,this.length=e,this.set=s}get type(){return a.none}toString(){let t=[];for(let e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}childString(t){let e=this.buffer[t],s=this.buffer[t+3],i=this.set.types[e],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),s==(t+=4))return r;let n=[];for(;t<s;)n.push(this.childString(t)),t=this.buffer[t+3];return r+"("+n.join(",")+")"}findChild(t,e,s,i,r){let{buffer:n}=this,h=-1;for(let o=t;o!=e&&!(x(r,i,n[o+1],n[o+2])&&(h=o,s>0));o=n[o+3]);return h}slice(t,e,s){let i=this.buffer,r=new Uint16Array(e-t),n=0;for(let h=t,o=0;h<e;){r[o++]=i[h++],r[o++]=i[h++]-s;let e=r[o++]=i[h++]-s;r[o++]=i[h++]-t,n=Math.max(n,e)}return new k(r,n,this.set)}}function x(t,e,s,i){switch(t){case-2:return s<e;case-1:return i>=e&&s<e;case 0:return s<e&&i>e;case 1:return s<=e&&i>e;case 2:return i>e;case 4:return!0}}function m(t,e,s,i){for(var r;t.from==t.to||(s<1?t.from>=e:t.from>e)||(s>-1?t.to<=e:t.to<e);){let e=!i&&t instanceof y&&t.index<0?null:t.parent;if(!e)return t;t=e}let n=i?0:p.IgnoreOverlays;if(i)for(let i=t,h=i.parent;h;i=h,h=i.parent)i instanceof y&&i.index<0&&(null===(r=h.enter(e,s,n))||void 0===r?void 0:r.from)!=i.from&&(t=h);for(;;){let i=t.enter(e,s,n);if(!i)return t;t=i}}class b{cursor(t=0){return new N(this,t)}getChild(t,e=null,s=null){let i=S(this,t,e,s);return i.length?i[0]:null}getChildren(t,e=null,s=null){return S(this,t,e,s)}resolve(t,e=0){return m(this,t,e,!1)}resolveInner(t,e=0){return m(this,t,e,!0)}matchContext(t){return v(this.parent,t)}enterUnfinishedNodesBefore(t){let e=this.childBefore(t),s=this;for(;e;){let t=e.lastChild;if(!t||t.to!=e.to)break;t.type.isError&&t.from==t.to?(s=e,e=t.prevSibling):e=t}return s}get node(){return this}get next(){return this.parent}}class y extends b{constructor(t,e,s,i){super(),this._tree=t,this.from=e,this.index=s,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,e,s,i,r=0){for(let n=this;;){for(let{children:h,positions:l}=n._tree,a=e>0?h.length:-1;t!=a;t+=e){let a=h[t],u=l[t]+n.from;if(x(i,s,u,u+a.length))if(a instanceof k){if(r&p.ExcludeBuffers)continue;let h=a.findChild(0,a.buffer.length,e,s-u,i);if(h>-1)return new A(new w(n,a,t,u),null,h)}else if(r&p.IncludeAnonymous||!a.type.isAnonymous||_(a)){let h;if(!(r&p.IgnoreMounts)&&(h=o.get(a))&&!h.overlay)return new y(h.tree,u,t,n);let l=new y(a,u,t,n);return r&p.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(e<0?a.children.length-1:0,e,s,i)}}if(r&p.IncludeAnonymous||!n.type.isAnonymous)return null;if(t=n.index>=0?n.index+e:e<0?-1:n._parent._tree.children.length,n=n._parent,!n)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(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,s=0){let i;if(!(s&p.IgnoreOverlays)&&(i=o.get(this._tree))&&i.overlay){let s=t-this.from;for(let{from:t,to:r}of i.overlay)if((e>0?t<=s:t<s)&&(e<0?r>=s:r>s))return new y(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,s)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}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 S(t,e,s,i){let r=t.cursor(),n=[];if(!r.firstChild())return n;if(null!=s)for(let t=!1;!t;)if(t=r.type.is(s),!r.nextSibling())return n;for(;;){if(null!=i&&r.type.is(i))return n;if(r.type.is(e)&&n.push(r.node),!r.nextSibling())return null==i?n:[]}}function v(t,e,s=e.length-1){for(let i=t;s>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[s]&&e[s]!=i.name)return!1;s--}}return!0}class w{constructor(t,e,s,i){this.parent=t,this.buffer=e,this.index=s,this.start=i}}class A 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(t,e,s){super(),this.context=t,this._parent=e,this.index=s,this.type=t.buffer.set.types[t.buffer.buffer[s]]}child(t,e,s){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.context.start,s);return r<0?null:new A(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,s=0){if(s&p.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new A(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new A(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new A(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:s}=this.context,i=this.index+4,r=s.buffer[this.index+3];if(r>i){let n=s.buffer[this.index+1];t.push(s.slice(i,r,n)),e.push(0)}return new d(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function C(t){if(!t.length)return null;let e=0,s=t[0];for(let i=1;i<t.length;i++){let r=t[i];(r.from>s.from||r.to<s.to)&&(s=r,e=i)}let i=s instanceof y&&s.index<0?null:s.parent,r=t.slice();return i?r[e]=i:r.splice(e,1),new P(r,s)}class P{constructor(t,e){this.heads=t,this.node=e}get next(){return C(this.heads)}}class N{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof y)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:s,buffer:i}=this.buffer;return this.type=e||i.set.types[i.buffer[t]],this.from=s+i.buffer[t+1],this.to=s+i.buffer[t+2],!0}yield(t){return!!t&&(t instanceof y?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,s){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,s,this.mode));let{buffer:i}=this.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.buffer.start,s);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,s=this.mode){return this.buffer?!(s&p.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,s))}parent(){if(!this.buffer)return this.yieldNode(this.mode&p.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&p.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,s=this.stack.length-1;if(t<0){let t=s<0?0:this.stack[s]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(s<0?e.buffer.length:e.buffer[this.stack[s]+3]))return this.yieldBuf(t)}return s<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,s,{buffer:i}=this;if(i){if(t>0){if(this.index<i.buffer.buffer.length)return!1}else for(let t=0;t<this.index;t++)if(i.buffer.buffer[t+3]<this.index)return!1;({index:e,parent:s}=i)}else({index:e,_parent:s}=this._tree);for(;s;({index:e,_parent:s}=s))if(e>-1)for(let i=e+t,r=t<0?-1:s._tree.children.length;i!=r;i+=t){let t=s._tree.children[i];if(this.mode&p.IncludeAnonymous||t instanceof k||!t.type.isAnonymous||_(t))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,e=null,s=0;if(t&&t.context==this.buffer)t:for(let i=this.index,r=this.stack.length;r>=0;){for(let n=t;n;n=n._parent)if(n.index==i){if(i==this.index)return n;e=n,s=r+1;break t}i=this.stack[--r]}for(let t=s;t<this.stack.length;t++)e=new A(this.buffer,e,this.stack[t]);return this.bufferNode=new A(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,e){for(let s=0;;){let i=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){s++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&e&&e(this),i=this.type.isAnonymous,!s)return;if(this.nextSibling())break;this.parent(),s--,i=!0}}}matchContext(t){if(!this.buffer)return v(this.node.parent,t);let{buffer:e}=this.buffer,{types:s}=e.set;for(let i=t.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return v(this._tree,t,i);let n=s[e.buffer[this.stack[r]]];if(!n.isAnonymous){if(t[i]&&t[i]!=n.name)return!1;i--}}return!0}}function _(t){return t.children.some(t=>t instanceof k||!t.type.isAnonymous||_(t))}const z=new WeakMap;function T(t,e){if(!t.isAnonymous||e instanceof k||e.type!=t)return 1;let s=z.get(e);if(null==s){s=1;for(let i of e.children){if(i.type!=t||!(i instanceof d)){s=1;break}s+=T(t,i)}z.set(e,s)}return s}function B(t,e,s,i,r,n,h,o,l){let a=0;for(let s=i;s<r;s++)a+=T(t,e[s]);let u=Math.ceil(1.5*a/8),f=[],c=[];return function e(s,i,r,h,o){for(let a=r;a<h;){let r=a,p=i[a],d=T(t,s[a]);for(a++;a<h;a++){let e=T(t,s[a]);if(d+e>=u)break;d+=e}if(a==r+1){if(d>u){let t=s[r];e(t.children,t.positions,0,t.children.length,i[r]+o);continue}f.push(s[r])}else{let e=i[a-1]+s[a-1].length-p;f.push(B(t,s,i,r,a,p,e,null,l))}c.push(p+o-n)}}(e,s,i,r,0),(o||l)(f,c,h)}class R{startParse(t,e,s){return"string"==typeof t&&(t=new I(t)),s=s?s.length?s.map(t=>new n(t.from,t.to)):[new n(0,0)]:[new n(0,t.length)],this.createParse(t,e||[],s)}parse(t,e,s){let i=this.startParse(t,e,s);for(;;){let t=i.advance();if(t)return t}}}class I{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new h({perNode:!0})}}]);
//# sourceMappingURL=782.js.map?_cache=35041ce5d612c8c83ccf