@trpc-playground/html
Version:
html for trpc-playground
1 lines • 4.4 MB
JavaScript
var hte=Object.defineProperty;var vte=(n,t,i)=>t in n?hte(n,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[t]=i;var Ud=(n,t,i)=>(vte(n,typeof t!="symbol"?t+"":t,i),i);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))o(l);new MutationObserver(l=>{for(const d of l)if(d.type==="childList")for(const g of d.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&o(g)}).observe(document,{childList:!0,subtree:!0});function i(l){const d={};return l.integrity&&(d.integrity=l.integrity),l.referrerpolicy&&(d.referrerPolicy=l.referrerpolicy),l.crossorigin==="use-credentials"?d.credentials="include":l.crossorigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function o(l){if(l.ep)return;l.ep=!0;const d=i(l);fetch(l.href,d)}})();var UD,Vo,mB,eD,AM,hB,pC={},vB=[],yte=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function ov(n,t){for(var i in t)n[i]=t[i];return n}function yB(n){var t=n.parentNode;t&&t.removeChild(n)}function mc(n,t,i){var o,l,d,g={};for(d in t)d=="key"?o=t[d]:d=="ref"?l=t[d]:g[d]=t[d];if(arguments.length>2&&(g.children=arguments.length>3?UD.call(arguments,2):i),typeof n=="function"&&n.defaultProps!=null)for(d in n.defaultProps)g[d]===void 0&&(g[d]=n.defaultProps[d]);return rD(n,g,o,l,null)}function rD(n,t,i,o,l){var d={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:l??++mB};return l==null&&Vo.vnode!=null&&Vo.vnode(d),d}function bB(){return{current:null}}function vh(n){return n.children}function Dm(n,t){this.props=n,this.context=t}function gD(n,t){if(t==null)return n.__?gD(n.__,n.__.__k.indexOf(n)+1):null;for(var i;t<n.__k.length;t++)if((i=n.__k[t])!=null&&i.__e!=null)return i.__e;return typeof n.type=="function"?gD(n):null}function DB(n){var t,i;if((n=n.__)!=null&&n.__c!=null){for(n.__e=n.__c.base=null,t=0;t<n.__k.length;t++)if((i=n.__k[t])!=null&&i.__e!=null){n.__e=n.__c.base=i.__e;break}return DB(n)}}function S6(n){(!n.__d&&(n.__d=!0)&&eD.push(n)&&!gC.__r++||AM!==Vo.debounceRendering)&&((AM=Vo.debounceRendering)||setTimeout)(gC)}function gC(){for(var n;gC.__r=eD.length;)n=eD.sort(function(t,i){return t.__v.__b-i.__v.__b}),eD=[],n.some(function(t){var i,o,l,d,g,b;t.__d&&(g=(d=(i=t).__v).__e,(b=i.__P)&&(o=[],(l=ov({},d)).__v=d.__v+1,u4(b,d,l,i.__n,b.ownerSVGElement!==void 0,d.__h!=null?[g]:null,o,g??gD(d),d.__h),CB(o,d),d.__e!=g&&DB(d)))})}function SB(n,t,i,o,l,d,g,b,h,e){var c,S,D,s,y,W,$,I=o&&o.__k||vB,v=I.length;for(i.__k=[],c=0;c<t.length;c++)if((s=i.__k[c]=(s=t[c])==null||typeof s=="boolean"?null:typeof s=="string"||typeof s=="number"||typeof s=="bigint"?rD(null,s,null,null,s):Array.isArray(s)?rD(vh,{children:s},null,null,null):s.__b>0?rD(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s)!=null){if(s.__=i,s.__b=i.__b+1,(D=I[c])===null||D&&s.key==D.key&&s.type===D.type)I[c]=void 0;else for(S=0;S<v;S++){if((D=I[S])&&s.key==D.key&&s.type===D.type){I[S]=void 0;break}D=null}u4(n,s,D=D||pC,l,d,g,b,h,e),y=s.__e,(S=s.ref)&&D.ref!=S&&($||($=[]),D.ref&&$.push(D.ref,null,s),$.push(S,s.__c||y,s)),y!=null?(W==null&&(W=y),typeof s.type=="function"&&s.__k===D.__k?s.__d=h=xB(s,h,n):h=TB(n,s,D,I,y,h),typeof i.type=="function"&&(i.__d=h)):h&&D.__e==h&&h.parentNode!=n&&(h=gD(D))}for(i.__e=W,c=v;c--;)I[c]!=null&&OB(I[c],I[c]);if($)for(c=0;c<$.length;c++)EB($[c],$[++c],$[++c])}function xB(n,t,i){for(var o,l=n.__k,d=0;l&&d<l.length;d++)(o=l[d])&&(o.__=n,t=typeof o.type=="function"?xB(o,t,i):TB(i,o,o,l,o.__e,t));return t}function sv(n,t){return t=t||[],n==null||typeof n=="boolean"||(Array.isArray(n)?n.some(function(i){sv(i,t)}):t.push(n)),t}function TB(n,t,i,o,l,d){var g,b,h;if(t.__d!==void 0)g=t.__d,t.__d=void 0;else if(i==null||l!=d||l.parentNode==null)e:if(d==null||d.parentNode!==n)n.appendChild(l),g=null;else{for(b=d,h=0;(b=b.nextSibling)&&h<o.length;h+=1)if(b==l)break e;n.insertBefore(l,d),g=d}return g!==void 0?g:l.nextSibling}function bte(n,t,i,o,l){var d;for(d in i)d==="children"||d==="key"||d in t||mC(n,d,null,i[d],o);for(d in t)l&&typeof t[d]!="function"||d==="children"||d==="key"||d==="value"||d==="checked"||i[d]===t[d]||mC(n,d,t[d],i[d],o)}function wM(n,t,i){t[0]==="-"?n.setProperty(t,i):n[t]=i==null?"":typeof i!="number"||yte.test(t)?i:i+"px"}function mC(n,t,i,o,l){var d;e:if(t==="style")if(typeof i=="string")n.style.cssText=i;else{if(typeof o=="string"&&(n.style.cssText=o=""),o)for(t in o)i&&t in i||wM(n.style,t,"");if(i)for(t in i)o&&i[t]===o[t]||wM(n.style,t,i[t])}else if(t[0]==="o"&&t[1]==="n")d=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in n?t.toLowerCase().slice(2):t.slice(2),n.l||(n.l={}),n.l[t+d]=i,i?o||n.addEventListener(t,d?NM:PM,d):n.removeEventListener(t,d?NM:PM,d);else if(t!=="dangerouslySetInnerHTML"){if(l)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t in n)try{n[t]=i??"";break e}catch{}typeof i=="function"||(i==null||i===!1&&t.indexOf("-")==-1?n.removeAttribute(t):n.setAttribute(t,i))}}function PM(n){this.l[n.type+!1](Vo.event?Vo.event(n):n)}function NM(n){this.l[n.type+!0](Vo.event?Vo.event(n):n)}function u4(n,t,i,o,l,d,g,b,h){var e,c,S,D,s,y,W,$,I,v,O,ce,te,X,pe,w=t.type;if(t.constructor!==void 0)return null;i.__h!=null&&(h=i.__h,b=t.__e=i.__e,t.__h=null,d=[b]),(e=Vo.__b)&&e(t);try{e:if(typeof w=="function"){if($=t.props,I=(e=w.contextType)&&o[e.__c],v=e?I?I.props.value:e.__:o,i.__c?W=(c=t.__c=i.__c).__=c.__E:("prototype"in w&&w.prototype.render?t.__c=c=new w($,v):(t.__c=c=new Dm($,v),c.constructor=w,c.render=Ste),I&&I.sub(c),c.props=$,c.state||(c.state={}),c.context=v,c.__n=o,S=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),w.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=ov({},c.__s)),ov(c.__s,w.getDerivedStateFromProps($,c.__s))),D=c.props,s=c.state,S)w.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(w.getDerivedStateFromProps==null&&$!==D&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps($,v),!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate($,c.__s,v)===!1||t.__v===i.__v){for(c.props=$,c.state=c.__s,t.__v!==i.__v&&(c.__d=!1),c.__v=t,t.__e=i.__e,t.__k=i.__k,t.__k.forEach(function(le){le&&(le.__=t)}),O=0;O<c._sb.length;O++)c.__h.push(c._sb[O]);c._sb=[],c.__h.length&&g.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate($,c.__s,v),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(D,s,y)})}if(c.context=v,c.props=$,c.__v=t,c.__P=n,ce=Vo.__r,te=0,"prototype"in w&&w.prototype.render){for(c.state=c.__s,c.__d=!1,ce&&ce(t),e=c.render(c.props,c.state,c.context),X=0;X<c._sb.length;X++)c.__h.push(c._sb[X]);c._sb=[]}else do c.__d=!1,ce&&ce(t),e=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++te<25);c.state=c.__s,c.getChildContext!=null&&(o=ov(ov({},o),c.getChildContext())),S||c.getSnapshotBeforeUpdate==null||(y=c.getSnapshotBeforeUpdate(D,s)),pe=e!=null&&e.type===vh&&e.key==null?e.props.children:e,SB(n,Array.isArray(pe)?pe:[pe],t,i,o,l,d,g,b,h),c.base=t.__e,t.__h=null,c.__h.length&&g.push(c),W&&(c.__E=c.__=null),c.__e=!1}else d==null&&t.__v===i.__v?(t.__k=i.__k,t.__e=i.__e):t.__e=Dte(i.__e,t,i,o,l,d,g,h);(e=Vo.diffed)&&e(t)}catch(le){t.__v=null,(h||d!=null)&&(t.__e=b,t.__h=!!h,d[d.indexOf(b)]=null),Vo.__e(le,t,i)}}function CB(n,t){Vo.__c&&Vo.__c(t,n),n.some(function(i){try{n=i.__h,i.__h=[],n.some(function(o){o.call(i)})}catch(o){Vo.__e(o,i.__v)}})}function Dte(n,t,i,o,l,d,g,b){var h,e,c,S=i.props,D=t.props,s=t.type,y=0;if(s==="svg"&&(l=!0),d!=null){for(;y<d.length;y++)if((h=d[y])&&"setAttribute"in h==!!s&&(s?h.localName===s:h.nodeType===3)){n=h,d[y]=null;break}}if(n==null){if(s===null)return document.createTextNode(D);n=l?document.createElementNS("http://www.w3.org/2000/svg",s):document.createElement(s,D.is&&D),d=null,b=!1}if(s===null)S===D||b&&n.data===D||(n.data=D);else{if(d=d&&UD.call(n.childNodes),e=(S=i.props||pC).dangerouslySetInnerHTML,c=D.dangerouslySetInnerHTML,!b){if(d!=null)for(S={},y=0;y<n.attributes.length;y++)S[n.attributes[y].name]=n.attributes[y].value;(c||e)&&(c&&(e&&c.__html==e.__html||c.__html===n.innerHTML)||(n.innerHTML=c&&c.__html||""))}if(bte(n,D,S,l,b),c)t.__k=[];else if(y=t.props.children,SB(n,Array.isArray(y)?y:[y],t,i,o,l&&s!=="foreignObject",d,g,d?d[0]:i.__k&&gD(i,0),b),d!=null)for(y=d.length;y--;)d[y]!=null&&yB(d[y]);b||("value"in D&&(y=D.value)!==void 0&&(y!==n.value||s==="progress"&&!y||s==="option"&&y!==S.value)&&mC(n,"value",y,S.value,!1),"checked"in D&&(y=D.checked)!==void 0&&y!==n.checked&&mC(n,"checked",y,S.checked,!1))}return n}function EB(n,t,i){try{typeof n=="function"?n(t):n.current=t}catch(o){Vo.__e(o,i)}}function OB(n,t,i){var o,l;if(Vo.unmount&&Vo.unmount(n),(o=n.ref)&&(o.current&&o.current!==n.__e||EB(o,null,t)),(o=n.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(d){Vo.__e(d,t)}o.base=o.__P=null,n.__c=void 0}if(o=n.__k)for(l=0;l<o.length;l++)o[l]&&OB(o[l],t,i||typeof n.type!="function");i||n.__e==null||yB(n.__e),n.__=n.__e=n.__d=void 0}function Ste(n,t,i){return this.constructor(n,i)}function J0(n,t,i){var o,l,d;Vo.__&&Vo.__(n,t),l=(o=typeof i=="function")?null:i&&i.__k||t.__k,d=[],u4(t,n=(!o&&i||t).__k=mc(vh,null,[n]),l||pC,pC,t.ownerSVGElement!==void 0,!o&&i?[i]:l?null:t.firstChild?UD.call(t.childNodes):null,d,!o&&i?i:l?l.__e:t.firstChild,o),CB(d,n)}function kB(n,t){J0(n,t,kB)}function xte(n,t,i){var o,l,d,g=ov({},n.props);for(d in t)d=="key"?o=t[d]:d=="ref"?l=t[d]:g[d]=t[d];return arguments.length>2&&(g.children=arguments.length>3?UD.call(arguments,2):i),rD(n.type,g,o||n.key,l||n.ref,null)}function Mp(n,t){var i={__c:t="__cC"+hB++,__:n,Consumer:function(o,l){return o.children(l)},Provider:function(o){var l,d;return this.getChildContext||(l=[],(d={})[t]=this,this.getChildContext=function(){return d},this.shouldComponentUpdate=function(g){this.props.value!==g.value&&l.some(S6)},this.sub=function(g){l.push(g);var b=g.componentWillUnmount;g.componentWillUnmount=function(){l.splice(l.indexOf(g),1),b&&b.call(g)}}),o.children}};return i.Provider.__=i.Consumer.contextType=i}UD=vB.slice,Vo={__e:function(n,t,i,o){for(var l,d,g;t=t.__;)if((l=t.__c)&&!l.__)try{if((d=l.constructor)&&d.getDerivedStateFromError!=null&&(l.setState(d.getDerivedStateFromError(n)),g=l.__d),l.componentDidCatch!=null&&(l.componentDidCatch(n,o||{}),g=l.__d),g)return l.__E=l}catch(b){n=b}throw n}},mB=0,Dm.prototype.setState=function(n,t){var i;i=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ov({},this.state),typeof n=="function"&&(n=n(ov({},i),this.props)),n&&ov(i,n),n!=null&&this.__v&&(t&&this._sb.push(t),S6(this))},Dm.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),S6(this))},Dm.prototype.render=vh,eD=[],gC.__r=0,hB=0;const AB=1024;let Tte=0,Cw=class{constructor(t,i){this.from=t,this.to=i}};class ic{constructor(t={}){this.id=Tte++,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 typeof t!="function"&&(t=ip.match(t)),i=>{let o=t(i);return o===void 0?null:[this,o]}}}ic.closedBy=new ic({deserialize:n=>n.split(" ")});ic.openedBy=new ic({deserialize:n=>n.split(" ")});ic.group=new ic({deserialize:n=>n.split(" ")});ic.contextHash=new ic({perNode:!0});ic.lookAhead=new ic({perNode:!0});ic.mounted=new ic({perNode:!0});const Cte=Object.create(null);class ip{constructor(t,i,o,l=0){this.name=t,this.props=i,this.id=o,this.flags=l}static define(t){let i=t.props&&t.props.length?Object.create(null):Cte,o=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),l=new ip(t.name||"",i,t.id,o);if(t.props){for(let d of t.props)if(Array.isArray(d)||(d=d(l)),d){if(d[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[d[0].id]=d[1]}}return l}prop(t){return this.props[t.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(t){if(typeof t=="string"){if(this.name==t)return!0;let i=this.prop(ic.group);return i?i.indexOf(t)>-1:!1}return this.id==t}static match(t){let i=Object.create(null);for(let o in t)for(let l of o.split(" "))i[l]=t[o];return o=>{for(let l=o.prop(ic.group),d=-1;d<(l?l.length:0);d++){let g=i[d<0?o.name:l[d]];if(g)return g}}}}ip.none=new ip("",Object.create(null),0,8);class l4{constructor(t){this.types=t;for(let i=0;i<t.length;i++)if(t[i].id!=i)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let i=[];for(let o of this.types){let l=null;for(let d of t){let g=d(o);g&&(l||(l=Object.assign({},o.props)),l[g[0].id]=g[1])}i.push(l?new ip(o.name,l,o.id,o.flags):o)}return new l4(i)}}const uT=new WeakMap,IM=new WeakMap;var jf;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays"})(jf||(jf={}));class Hl{constructor(t,i,o,l,d){if(this.type=t,this.children=i,this.positions=o,this.length=l,this.props=null,d&&d.length){this.props=Object.create(null);for(let[g,b]of d)this.props[typeof g=="number"?g:g.id]=b}}toString(){let t=this.prop(ic.mounted);if(t&&!t.overlay)return t.tree.toString();let i="";for(let o of this.children){let l=o.toString();l&&(i&&(i+=","),i+=l)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(i.length?"("+i+")":""):i}cursor(t=0){return new yC(this.topNode,t)}cursorAt(t,i=0,o=0){let l=uT.get(this)||this.topNode,d=new yC(l);return d.moveTo(t,i),uT.set(this,d._tree),d}get topNode(){return new Sm(this,0,0,null)}resolve(t,i=0){let o=W0(uT.get(this)||this.topNode,t,i,!1);return uT.set(this,o),o}resolveInner(t,i=0){let o=W0(IM.get(this)||this.topNode,t,i,!0);return IM.set(this,o),o}iterate(t){let{enter:i,leave:o,from:l=0,to:d=this.length}=t;for(let g=this.cursor((t.mode||0)|jf.IncludeAnonymous);;){let b=!1;if(g.from<=d&&g.to>=l&&(g.type.isAnonymous||i(g)!==!1)){if(g.firstChild())continue;b=!0}for(;b&&o&&!g.type.isAnonymous&&o(g),!g.nextSibling();){if(!g.parent())return;b=!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 i in this.props)t.push([+i,this.props[i]]);return t}balance(t={}){return this.children.length<=8?this:_4(ip.none,this.children,this.positions,0,this.children.length,0,this.length,(i,o,l)=>new Hl(this.type,i,o,l,this.propValues),t.makeTree||((i,o,l)=>new Hl(ip.none,i,o,l)))}static build(t){return Ote(t)}}Hl.empty=new Hl(ip.none,[],[],0);class f4{constructor(t,i){this.buffer=t,this.index=i}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 f4(this.buffer,this.index)}}class Ey{constructor(t,i,o){this.buffer=t,this.length=i,this.set=o}get type(){return ip.none}toString(){let t=[];for(let i=0;i<this.buffer.length;)t.push(this.childString(i)),i=this.buffer[i+3];return t.join(",")}childString(t){let i=this.buffer[t],o=this.buffer[t+3],l=this.set.types[i],d=l.name;if(/\W/.test(d)&&!l.isError&&(d=JSON.stringify(d)),t+=4,o==t)return d;let g=[];for(;t<o;)g.push(this.childString(t)),t=this.buffer[t+3];return d+"("+g.join(",")+")"}findChild(t,i,o,l,d){let{buffer:g}=this,b=-1;for(let h=t;h!=i&&!(wB(d,l,g[h+1],g[h+2])&&(b=h,o>0));h=g[h+3]);return b}slice(t,i,o){let l=this.buffer,d=new Uint16Array(i-t),g=0;for(let b=t,h=0;b<i;){d[h++]=l[b++],d[h++]=l[b++]-o;let e=d[h++]=l[b++]-o;d[h++]=l[b++]-t,g=Math.max(g,e)}return new Ey(d,g,this.set)}}function wB(n,t,i,o){switch(n){case-2:return i<t;case-1:return o>=t&&i<t;case 0:return i<t&&o>t;case 1:return i<=t&&o>t;case 2:return o>t;case 4:return!0}}function PB(n,t){let i=n.childBefore(t);for(;i;){let o=i.lastChild;if(!o||o.to!=i.to)break;o.type.isError&&o.from==o.to?(n=i,i=o.prevSibling):i=o}return n}function W0(n,t,i,o){for(var l;n.from==n.to||(i<1?n.from>=t:n.from>t)||(i>-1?n.to<=t:n.to<t);){let g=!o&&n instanceof Sm&&n.index<0?null:n.parent;if(!g)return n;n=g}let d=o?0:jf.IgnoreOverlays;if(o)for(let g=n,b=g.parent;b;g=b,b=g.parent)g instanceof Sm&&g.index<0&&((l=b.enter(t,i,d))===null||l===void 0?void 0:l.from)!=g.from&&(n=b);for(;;){let g=n.enter(t,i,d);if(!g)return n;n=g}}class Sm{constructor(t,i,o,l){this._tree=t,this.from=i,this.index=o,this._parent=l}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,i,o,l,d=0){for(let g=this;;){for(let{children:b,positions:h}=g._tree,e=i>0?b.length:-1;t!=e;t+=i){let c=b[t],S=h[t]+g.from;if(wB(l,o,S,S+c.length)){if(c instanceof Ey){if(d&jf.ExcludeBuffers)continue;let D=c.findChild(0,c.buffer.length,i,o-S,l);if(D>-1)return new lh(new Ete(g,c,t,S),null,D)}else if(d&jf.IncludeAnonymous||!c.type.isAnonymous||d4(c)){let D;if(!(d&jf.IgnoreMounts)&&c.props&&(D=c.prop(ic.mounted))&&!D.overlay)return new Sm(D.tree,S,t,g);let s=new Sm(c,S,t,g);return d&jf.IncludeAnonymous||!s.type.isAnonymous?s:s.nextChild(i<0?c.children.length-1:0,i,o,l)}}}if(d&jf.IncludeAnonymous||!g.type.isAnonymous||(g.index>=0?t=g.index+i:t=i<0?-1:g._parent._tree.children.length,g=g._parent,!g))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,i,o=0){let l;if(!(o&jf.IgnoreOverlays)&&(l=this._tree.prop(ic.mounted))&&l.overlay){let d=t-this.from;for(let{from:g,to:b}of l.overlay)if((i>0?g<=d:g<d)&&(i<0?b>=d:b>d))return new Sm(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,i,o)}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}cursor(t=0){return new yC(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,i=0){return W0(this,t,i,!1)}resolveInner(t,i=0){return W0(this,t,i,!0)}enterUnfinishedNodesBefore(t){return PB(this,t)}getChild(t,i=null,o=null){let l=hC(this,t,i,o);return l.length?l[0]:null}getChildren(t,i=null,o=null){return hC(this,t,i,o)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return vC(this,t)}}function hC(n,t,i,o){let l=n.cursor(),d=[];if(!l.firstChild())return d;if(i!=null){for(;!l.type.is(i);)if(!l.nextSibling())return d}for(;;){if(o!=null&&l.type.is(o))return d;if(l.type.is(t)&&d.push(l.node),!l.nextSibling())return o==null?d:[]}}function vC(n,t,i=t.length-1){for(let o=n.parent;i>=0;o=o.parent){if(!o)return!1;if(!o.type.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}class Ete{constructor(t,i,o,l){this.parent=t,this.buffer=i,this.index=o,this.start=l}}class lh{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,i,o){this.context=t,this._parent=i,this.index=o,this.type=t.buffer.set.types[t.buffer.buffer[o]]}child(t,i,o){let{buffer:l}=this.context,d=l.findChild(this.index+4,l.buffer[this.index+3],t,i-this.context.start,o);return d<0?null:new lh(this.context,this,d)}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,i,o=0){if(o&jf.ExcludeBuffers)return null;let{buffer:l}=this.context,d=l.findChild(this.index+4,l.buffer[this.index+3],i>0?1:-1,t-this.context.start,i);return d<0?null:new lh(this.context,this,d)}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,i=t.buffer[this.index+3];return i<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new lh(this.context,this._parent,i):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,i=this._parent?this._parent.index+4:0;return this.index==i?this.externalSibling(-1):new lh(this.context,this._parent,t.findChild(i,this.index,-1,0,4))}cursor(t=0){return new yC(this,t)}get tree(){return null}toTree(){let t=[],i=[],{buffer:o}=this.context,l=this.index+4,d=o.buffer[this.index+3];if(d>l){let g=o.buffer[this.index+1];t.push(o.slice(l,d,g)),i.push(0)}return new Hl(this.type,t,i,this.to-this.from)}resolve(t,i=0){return W0(this,t,i,!1)}resolveInner(t,i=0){return W0(this,t,i,!0)}enterUnfinishedNodesBefore(t){return PB(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,i=null,o=null){let l=hC(this,t,i,o);return l.length?l[0]:null}getChildren(t,i=null,o=null){return hC(this,t,i,o)}get node(){return this}matchContext(t){return vC(this,t)}}class yC{get name(){return this.type.name}constructor(t,i=0){if(this.mode=i,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Sm)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let o=t._parent;o;o=o._parent)this.stack.unshift(o.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):!1}yieldBuf(t,i){this.index=t;let{start:o,buffer:l}=this.buffer;return this.type=i||l.set.types[l.buffer[t]],this.from=o+l.buffer[t+1],this.to=o+l.buffer[t+2],!0}yield(t){return t?t instanceof Sm?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,i,o){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,i,o,this.mode));let{buffer:l}=this.buffer,d=l.findChild(this.index+4,l.buffer[this.index+3],t,i-this.buffer.start,o);return d<0?!1:(this.stack.push(this.index),this.yieldBuf(d))}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,i,o=this.mode){return this.buffer?o&jf.ExcludeBuffers?!1:this.enterChild(1,t,i):this.yield(this._tree.enter(t,i,o))}parent(){if(!this.buffer)return this.yieldNode(this.mode&jf.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&jf.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)):!1;let{buffer:i}=this.buffer,o=this.stack.length-1;if(t<0){let l=o<0?0:this.stack[o]+4;if(this.index!=l)return this.yieldBuf(i.findChild(l,this.index,-1,0,4))}else{let l=i.buffer[this.index+3];if(l<(o<0?i.buffer.length:i.buffer[this.stack[o]+3]))return this.yieldBuf(l)}return o<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let i,o,{buffer:l}=this;if(l){if(t>0){if(this.index<l.buffer.buffer.length)return!1}else for(let d=0;d<this.index;d++)if(l.buffer.buffer[d+3]<this.index)return!1;({index:i,parent:o}=l)}else({index:i,_parent:o}=this._tree);for(;o;{index:i,_parent:o}=o)if(i>-1)for(let d=i+t,g=t<0?-1:o._tree.children.length;d!=g;d+=t){let b=o._tree.children[d];if(this.mode&jf.IncludeAnonymous||b instanceof Ey||!b.type.isAnonymous||d4(b))return!1}return!0}move(t,i){if(i&&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,i=0){for(;(this.from==this.to||(i<1?this.from>=t:this.from>t)||(i>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,i););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,i=null,o=0;if(t&&t.context==this.buffer){e:for(let l=this.index,d=this.stack.length;d>=0;){for(let g=t;g;g=g._parent)if(g.index==l){if(l==this.index)return g;i=g,o=d+1;break e}l=this.stack[--d]}}for(let l=o;l<this.stack.length;l++)i=new lh(this.buffer,i,this.stack[l]);return this.bufferNode=new lh(this.buffer,i,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,i){for(let o=0;;){let l=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){o++;continue}this.type.isAnonymous||(l=!0)}for(;l&&i&&i(this),l=this.type.isAnonymous,!this.nextSibling();){if(!o)return;this.parent(),o--,l=!0}}}matchContext(t){if(!this.buffer)return vC(this.node,t);let{buffer:i}=this.buffer,{types:o}=i.set;for(let l=t.length-1,d=this.stack.length-1;l>=0;d--){if(d<0)return vC(this.node,t,l);let g=o[i.buffer[this.stack[d]]];if(!g.isAnonymous){if(t[l]&&t[l]!=g.name)return!1;l--}}return!0}}function d4(n){return n.children.some(t=>t instanceof Ey||!t.type.isAnonymous||d4(t))}function Ote(n){var t;let{buffer:i,nodeSet:o,maxBufferLength:l=AB,reused:d=[],minRepeatType:g=o.types.length}=n,b=Array.isArray(i)?new f4(i,i.length):i,h=o.types,e=0,c=0;function S(ce,te,X,pe,w){let{id:le,start:B,end:C,size:E}=b,F=c;for(;E<0;)if(b.next(),E==-1){let se=d[le];X.push(se),pe.push(B-ce);return}else if(E==-3){e=le;return}else if(E==-4){c=le;return}else throw new RangeError(`Unrecognized record size: ${E}`);let P=h[le],U,ge,Ne=B-ce;if(C-B<=l&&(ge=W(b.pos-te,w))){let se=new Uint16Array(ge.size-ge.skip),me=b.pos-ge.size,Z=se.length;for(;b.pos>me;)Z=$(ge.start,se,Z);U=new Ey(se,C-ge.start,o),Ne=ge.start-ce}else{let se=b.pos-E;b.next();let me=[],Z=[],ne=le>=g?le:-1,M=0,K=C;for(;b.pos>se;)ne>=0&&b.id==ne&&b.size>=0?(b.end<=K-l&&(s(me,Z,B,M,b.end,K,ne,F),M=me.length,K=b.end),b.next()):S(B,se,me,Z,ne);if(ne>=0&&M>0&&M<me.length&&s(me,Z,B,M,B,K,ne,F),me.reverse(),Z.reverse(),ne>-1&&M>0){let J=D(P);U=_4(P,me,Z,0,me.length,0,C-B,J,J)}else U=y(P,me,Z,C-B,F-C)}X.push(U),pe.push(Ne)}function D(ce){return(te,X,pe)=>{let w=0,le=te.length-1,B,C;if(le>=0&&(B=te[le])instanceof Hl){if(!le&&B.type==ce&&B.length==pe)return B;(C=B.prop(ic.lookAhead))&&(w=X[le]+B.length+C)}return y(ce,te,X,pe,w)}}function s(ce,te,X,pe,w,le,B,C){let E=[],F=[];for(;ce.length>pe;)E.push(ce.pop()),F.push(te.pop()+X-w);ce.push(y(o.types[B],E,F,le-w,C-le)),te.push(w-X)}function y(ce,te,X,pe,w=0,le){if(e){let B=[ic.contextHash,e];le=le?[B].concat(le):[B]}if(w>25){let B=[ic.lookAhead,w];le=le?[B].concat(le):[B]}return new Hl(ce,te,X,pe,le)}function W(ce,te){let X=b.fork(),pe=0,w=0,le=0,B=X.end-l,C={size:0,start:0,skip:0};e:for(let E=X.pos-ce;X.pos>E;){let F=X.size;if(X.id==te&&F>=0){C.size=pe,C.start=w,C.skip=le,le+=4,pe+=4,X.next();continue}let P=X.pos-F;if(F<0||P<E||X.start<B)break;let U=X.id>=g?4:0,ge=X.start;for(X.next();X.pos>P;){if(X.size<0)if(X.size==-3)U+=4;else break e;else X.id>=g&&(U+=4);X.next()}w=ge,pe+=F,le+=U}return(te<0||pe==ce)&&(C.size=pe,C.start=w,C.skip=le),C.size>4?C:void 0}function $(ce,te,X){let{id:pe,start:w,end:le,size:B}=b;if(b.next(),B>=0&&pe<g){let C=X;if(B>4){let E=b.pos-(B-4);for(;b.pos>E;)X=$(ce,te,X)}te[--X]=C,te[--X]=le-ce,te[--X]=w-ce,te[--X]=pe}else B==-3?e=pe:B==-4&&(c=pe);return X}let I=[],v=[];for(;b.pos>0;)S(n.start||0,n.bufferStart||0,I,v,-1);let O=(t=n.length)!==null&&t!==void 0?t:I.length?v[0]+I[0].length:0;return new Hl(h[n.topID],I.reverse(),v.reverse(),O)}const MM=new WeakMap;function $T(n,t){if(!n.isAnonymous||t instanceof Ey||t.type!=n)return 1;let i=MM.get(t);if(i==null){i=1;for(let o of t.children){if(o.type!=n||!(o instanceof Hl)){i=1;break}i+=$T(n,o)}MM.set(t,i)}return i}function _4(n,t,i,o,l,d,g,b,h){let e=0;for(let y=o;y<l;y++)e+=$T(n,t[y]);let c=Math.ceil(e*1.5/8),S=[],D=[];function s(y,W,$,I,v){for(let O=$;O<I;){let ce=O,te=W[O],X=$T(n,y[O]);for(O++;O<I;O++){let pe=$T(n,y[O]);if(X+pe>=c)break;X+=pe}if(O==ce+1){if(X>c){let pe=y[ce];s(pe.children,pe.positions,0,pe.children.length,W[ce]+v);continue}S.push(y[ce])}else{let pe=W[O-1]+y[O-1].length-te;S.push(_4(n,y,W,ce,O,te,pe,null,h))}D.push(te+v-d)}}return s(t,i,o,l,0),(b||h)(S,D,g)}class kte{constructor(){this.map=new WeakMap}setBuffer(t,i,o){let l=this.map.get(t);l||this.map.set(t,l=new Map),l.set(i,o)}getBuffer(t,i){let o=this.map.get(t);return o&&o.get(i)}set(t,i){t instanceof lh?this.setBuffer(t.context.buffer,t.index,i):t instanceof Sm&&this.map.set(t.tree,i)}get(t){return t instanceof lh?this.getBuffer(t.context.buffer,t.index):t instanceof Sm?this.map.get(t.tree):void 0}cursorSet(t,i){t.buffer?this.setBuffer(t.buffer.buffer,t.index,i):this.map.set(t.tree,i)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class hy{constructor(t,i,o,l,d=!1,g=!1){this.from=t,this.to=i,this.tree=o,this.offset=l,this.open=(d?1:0)|(g?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,i=[],o=!1){let l=[new hy(0,t.length,t,0,!1,o)];for(let d of i)d.to>t.length&&l.push(d);return l}static applyChanges(t,i,o=128){if(!i.length)return t;let l=[],d=1,g=t.length?t[0]:null;for(let b=0,h=0,e=0;;b++){let c=b<i.length?i[b]:null,S=c?c.fromA:1e9;if(S-h>=o)for(;g&&g.from<S;){let D=g;if(h>=D.from||S<=D.to||e){let s=Math.max(D.from,h)-e,y=Math.min(D.to,S)-e;D=s>=y?null:new hy(s,y,D.tree,D.offset+e,b>0,!!c)}if(D&&l.push(D),g.to>S)break;g=d<t.length?t[d++]:null}if(!c)break;h=c.toA,e=c.toA-c.toB}return l}}class NB{startParse(t,i,o){return typeof t=="string"&&(t=new Ate(t)),o=o?o.length?o.map(l=>new Cw(l.from,l.to)):[new Cw(0,0)]:[new Cw(0,t.length)],this.createParse(t,i||[],o)}parse(t,i,o){let l=this.startParse(t,i,o);for(;;){let d=l.advance();if(d)return d}}}class Ate{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,i){return this.string.slice(t,i)}}new ic({perNode:!0});let x6=class{constructor(t,i,o,l,d,g,b,h,e,c=0,S){this.p=t,this.stack=i,this.state=o,this.reducePos=l,this.pos=d,this.score=g,this.buffer=b,this.bufferBase=h,this.curContext=e,this.lookAhead=c,this.parent=S}toString(){return`[${this.stack.filter((t,i)=>i%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,i,o=0){let l=t.parser.context;return new x6(t,[],i,o,o,0,[],0,l?new FM(l,l.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,i){this.stack.push(this.state,i,this.bufferBase+this.buffer.length),this.state=t}reduce(t){let i=t>>19,o=t&65535,{parser:l}=this.p,d=l.dynamicPrecedence(o);if(d&&(this.score+=d),i==0){this.pushState(l.getGoto(this.state,o,!0),this.reducePos),o<l.minRepeatTerm&&this.storeNode(o,this.reducePos,this.reducePos,4,!0),this.reduceContext(o,this.reducePos);return}let g=this.stack.length-(i-1)*3-(t&262144?6:0),b=this.stack[g-2],h=this.stack[g-1],e=this.bufferBase+this.buffer.length-h;if(o<l.minRepeatTerm||t&131072){let c=l.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(o,b,c,e+4,!0)}if(t&262144)this.state=this.stack[g];else{let c=this.stack[g-3];this.state=l.getGoto(c,o,!0)}for(;this.stack.length>g;)this.stack.pop();this.reduceContext(o,b)}storeNode(t,i,o,l=4,d=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let g=this,b=this.buffer.length;if(b==0&&g.parent&&(b=g.bufferBase-g.parent.bufferBase,g=g.parent),b>0&&g.buffer[b-4]==0&&g.buffer[b-1]>-1){if(i==o)return;if(g.buffer[b-2]>=i){g.buffer[b-2]=o;return}}}if(!d||this.pos==o)this.buffer.push(t,i,o,l);else{let g=this.buffer.length;if(g>0&&this.buffer[g-4]!=0)for(;g>0&&this.buffer[g-2]>o;)this.buffer[g]=this.buffer[g-4],this.buffer[g+1]=this.buffer[g-3],this.buffer[g+2]=this.buffer[g-2],this.buffer[g+3]=this.buffer[g-1],g-=4,l>4&&(l-=4);this.buffer[g]=t,this.buffer[g+1]=i,this.buffer[g+2]=o,this.buffer[g+3]=l}}shift(t,i,o){let l=this.pos;if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=o,this.shiftContext(i,l),i<=this.p.parser.maxNode&&this.buffer.push(i,l,o,4);else{let d=t,{parser:g}=this.p;(o>this.pos||i<=g.maxNode)&&(this.pos=o,g.stateFlag(d,1)||(this.reducePos=o)),this.pushState(d,l),this.shiftContext(i,l),i<=g.maxNode&&this.buffer.push(i,l,o,4)}}apply(t,i,o){t&65536?this.reduce(t):this.shift(t,i,o)}useNode(t,i){let o=this.p.reused.length-1;(o<0||this.p.reused[o]!=t)&&(this.p.reused.push(t),o++);let l=this.pos;this.reducePos=this.pos=l+t.length,this.pushState(i,l),this.buffer.push(o,l,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,i=t.buffer.length;for(;i>0&&t.buffer[i-2]>t.reducePos;)i-=4;let o=t.buffer.slice(i),l=t.bufferBase+i;for(;t&&l==t.bufferBase;)t=t.parent;return new x6(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,o,l,this.curContext,this.lookAhead,t)}recoverByDelete(t,i){let o=t<=this.p.parser.maxNode;o&&this.storeNode(t,this.pos,i,4),this.storeNode(0,this.pos,i,o?8:4),this.pos=this.reducePos=i,this.score-=190}canShift(t){for(let i=new wte(this);;){let o=this.p.parser.stateSlot(i.state,4)||this.p.parser.hasAction(i.state,t);if(o==0)return!1;if(!(o&65536))return!0;i.reduce(o)}}recoverByInsert(t){if(this.stack.length>=300)return[];let i=this.p.parser.nextStates(this.state);if(i.length>4<<1||this.stack.length>=120){let l=[];for(let d=0,g;d<i.length;d+=2)(g=i[d+1])!=this.state&&this.p.parser.hasAction(g,t)&&l.push(i[d],g);if(this.stack.length<120)for(let d=0;l.length<4<<1&&d<i.length;d+=2){let g=i[d+1];l.some((b,h)=>h&1&&b==g)||l.push(i[d],g)}i=l}let o=[];for(let l=0;l<i.length&&o.length<4;l+=2){let d=i[l+1];if(d==this.state)continue;let g=this.split();g.pushState(d,this.pos),g.storeNode(0,g.pos,g.pos,4,!0),g.shiftContext(i[l],this.pos),g.score-=200,o.push(g)}return o}forceReduce(){let t=this.p.parser.stateSlot(this.state,5);if(!(t&65536))return!1;let{parser:i}=this.p;if(!i.validAction(this.state,t)){let o=t>>19,l=t&65535,d=this.stack.length-o*3;if(d<0||i.getGoto(this.stack[d],l,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!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(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){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 i=0;i<this.stack.length;i+=3)if(this.stack[i]!=t.stack[i])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,i){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(i)))}reduceContext(t,i){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(i)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.reducePos,this.reducePos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.reducePos,this.reducePos,-4)}updateContext(t){if(t!=this.curContext.context){let i=new FM(this.curContext.tracker,t);i.hash!=this.curContext.hash&&this.emitContext(),this.curContext=i}}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 FM{constructor(t,i){this.tracker=t,this.context=i,this.hash=t.strict?t.hash(i):0}}var LM;(function(n){n[n.Insert=200]="Insert",n[n.Delete=190]="Delete",n[n.Reduce=100]="Reduce",n[n.MaxNext=4]="MaxNext",n[n.MaxInsertStackDepth=300]="MaxInsertStackDepth",n[n.DampenInsertStackDepth=120]="DampenInsertStackDepth"})(LM||(LM={}));class wte{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let i=t&65535,o=t>>19;o==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(o-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],i,!0);this.state=l}}class bC{constructor(t,i,o){this.stack=t,this.pos=i,this.index=o,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,i=t.bufferBase+t.buffer.length){return new bC(t,i,i-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(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,this.index==0&&this.maybeNext()}fork(){return new bC(this.stack,this.pos,this.index)}}class GT{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const RM=new GT;class Pte{constructor(t,i){this.input=t,this.ranges=i,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=RM,this.rangeIndex=0,this.pos=this.chunkPos=i[0].from,this.range=i[0],this.end=i[i.length-1].to,this.readNext()}resolveOffset(t,i){let o=this.range,l=this.rangeIndex,d=this.pos+t;for(;d<o.from;){if(!l)return null;let g=this.ranges[--l];d-=o.from-g.to,o=g}for(;i<0?d>o.to:d>=o.to;){if(l==this.ranges.length-1)return null;let g=this.ranges[++l];d+=g.from-o.to,o=g}return d}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let i of this.ranges)if(i.to>t)return Math.max(t,i.from);return this.end}peek(t){let i=this.chunkOff+t,o,l;if(i>=0&&i<this.chunk.length)o=this.pos+t,l=this.chunk.charCodeAt(i);else{let d=this.resolveOffset(t,1);if(d==null)return-1;if(o=d,o>=this.chunk2Pos&&o<this.chunk2Pos+this.chunk2.length)l=this.chunk2.charCodeAt(o-this.chunk2Pos);else{let g=this.rangeIndex,b=this.range;for(;b.to<=o;)b=this.ranges[++g];this.chunk2=this.input.chunk(this.chunk2Pos=o),o+this.chunk2.length>b.to&&(this.chunk2=this.chunk2.slice(0,b.to-o)),l=this.chunk2.charCodeAt(0)}}return o>=this.token.lookAhead&&(this.token.lookAhead=o+1),l}acceptToken(t,i=0){let o=i?this.resolveOffset(i,-1):this.pos;if(o==null||o<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=o}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:i}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=i,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),i=this.pos+t.length;this.chunk=i>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,i){if(i?(this.token=i,i.start=t,i.lookAhead=t+1,i.value=i.extended=-1):this.token=RM,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,i){if(t>=this.chunkPos&&i<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,i-this.chunkPos);if(t>=this.chunk2Pos&&i<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,i-this.chunk2Pos);if(t>=this.range.from&&i<=this.range.to)return this.input.read(t,i);let o="";for(let l of this.ranges){if(l.from>=i)break;l.to>t&&(o+=this.input.read(Math.max(l.from,t),Math.min(l.to,i)))}return o}}class HT{constructor(t,i){this.data=t,this.id=i}token(t,i){Nte(this.data,t,i,this.id)}}HT.prototype.contextual=HT.prototype.fallback=HT.prototype.extend=!1;class hE{constructor(t,i={}){this.token=t,this.contextual=!!i.contextual,this.fallback=!!i.fallback,this.extend=!!i.extend}}function Nte(n,t,i,o){let l=0,d=1<<o,{parser:g}=i.p,{dialect:b}=g;e:for(;d&n[l];){let h=n[l+1];for(let D=l+3;D<h;D+=2)if((n[D+1]&d)>0){let s=n[D];if(b.allows(s)&&(t.token.value==-1||t.token.value==s||g.overrides(s,t.token.value))){t.acceptToken(s);break}}let e=t.next,c=0,S=n[l+2];if(t.next<0&&S>c&&n[h+S*3-3]==65535&&n[h+S*3-3]==65535){l=n[h+S*3-1];continue e}for(;c<S;){let D=c+S>>1,s=h+D+(D<<1),y=n[s],W=n[s+1]||65536;if(e<y)S=D;else if(e>=W)c=D+1;else{l=n[s+2],t.advance();continue e}}break}}function lT(n,t=Uint16Array){if(typeof n!="string")return n;let i=null;for(let o=0,l=0;o<n.length;){let d=0;for(;;){let g=n.charCodeAt(o++),b=!1;if(g==126){d=65535;break}g>=92&&g--,g>=34&&g--;let h=g-32;if(h>=46&&(h-=46,b=!0),d+=h,b)break;d*=46}i?i[l++]=d:i=new t(d)}return i}const vm=typeof process<"u"&&process.env&&/\bparse\b/.test({}.LOG);let Ew=null;var BM;(function(n){n[n.Margin=25]="Margin"})(BM||(BM={}));function jM(n,t,i){let o=n.cursor(jf.IncludeAnonymous);for(o.moveTo(t);;)if(!(i<0?o.childBefore(t):o.childAfter(t)))for(;;){if((i<0?o.to<t:o.from>t)&&!o.type.isError)return i<0?Math.max(0,Math.min(o.to-1,t-25)):Math.min(n.length,Math.max(o.from+1,t+25));if(i<0?o.prevSibling():o.nextSibling())break;if(!o.parent())return i<0?0:n.length}}class Ite{constructor(t,i){this.fragments=t,this.nodeSet=i,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?jM(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?jM(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 i=this.trees.length-1;if(i<0)return this.nextFragment(),null;let o=this.trees[i],l=this.index[i];if(l==o.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let d=o.children[l],g=this.start[i]+o.positions[l];if(g>t)return this.nextStart=g,null;if(d instanceof Hl){if(g==t){if(g<this.safeFrom)return null;let b=g+d.length;if(b<=this.safeTo){let h=d.prop(ic.lookAhead);if(!h||b+h<this.fragment.to)return d}}this.index[i]++,g+d.length>=Math.max(this.safeFrom,t)&&(this.trees.push(d),this.start.push(g),this.index.push(0))}else this.index[i]++,this.nextStart=g+d.length}}}class Mte{constructor(t,i){this.stream=i,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(o=>new GT)}getActions(t){let i=0,o=null,{parser:l}=t.p,{tokenizers:d}=l,g=l.stateSlot(t.state,3),b=t.curContext?t.curContext.hash:0,h=0;for(let e=0;e<d.length;e++){if(!(1<<e&g))continue;let c=d[e],S=this.tokens[e];if(!(o&&!c.fallback)&&((c.contextual||S.start!=t.pos||S.mask!=g||S.context!=b)&&(this.updateCachedToken(S,c,t),S.mask=g,S.context=b),S.lookAhead>S.end+25&&(h=Math.max(S.lookAhead,h)),S.value!=0)){let D=i;if(S.extended>-1&&(i=this.addActions(t,S.extended,S.end,i)),i=this.addActions(t,S.value,S.end,i),!c.extend&&(o=S,i>D))break}}for(;this.actions.length>i;)this.actions.pop();return h&&t.setLookAhead(h),!o&&t.pos==this.stream.end&&(o=new GT,o.value=t.p.parser.eofTerm,o.start=o.end=t.pos,i=this.addActions(t,o.value,o.end,i)),this.mainToken=o,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let i=new GT,{pos:o,p:l}=t;return i.start=o,i.end=Math.min(o+1,l.stream.end),i.value=o==l.stream.end?l.parser.eofTerm:0,i}updateCachedToken(t,i,o){let l=this.stream.clipPos(o.pos);if(i.token(this.stream.reset(l,t),o),t.value>-1){let{parser:d}=o.p;for(let g=0;g<d.specialized.length;g++)if(d.specialized[g]==t.value){let b=d.specializers[g](this.stream.read(t.start,t.end),o);if(b>=0&&o.p.parser.dialect.allows(b>>1)){b&1?t.extended=b>>1:t.value=b>>1;break}}}else t.value=0,t.end=this.stream.clipPos(l+1)}putAction(t,i,o,l){for(let d=0;d<l;d+=3)if(this.actions[d]==t)return l;return this.actions[l++]=t,this.actions[l++]=i,this.actions[l++]=o,l}addActions(t,i,o,l){let{state:d}=t,{parser:g}=t.p,{data:b}=g;for(let h=0;h<2;h++)for(let e=g.stateSlot(d,h?2:1);;e+=3){if(b[e]==65535)if(b[e+1]==1)e=iv(b,e+2);else{l==0&&b[e+1]==2&&(l=this.putAction(iv(b,e+2),i,o,l));break}b[e]==i&&(l=this.putAction(iv(b,e+1),i,o,l))}return l}}var JM;(function(n){n[n.Distance=5]="Distance",n[n.MaxRemainingPerStep=3]="MaxRemainingPerStep",n[n.MinBufferLengthPrune=500]="MinBufferLengthPrune",n[n.ForceReduceLimit=10]="ForceReduceLimit",n[n.CutDepth=15e3]="CutDepth",n[n.CutTo=9e3]="CutTo"})(JM||(JM={}));class Fte{constructor(t,i,o,l){this.parser=t,this.input=i,this.ranges=l,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.stream=new Pte(i,l),this.tokens=new Mte(t,this.stream),this.topTerm=t.top[1];let{from:d}=l[0];this.stacks=[x6.start(this,t.top[0],d)],this.fragments=o.length&&this.stream.end-d>t.bufferLength*4?new Ite(o,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,i=this.minStackPos,o=this.stacks=[],l,d;for(let g=0;g<t.length;g++){let b=t[g];for(;;){if(this.tokens.mainToken=null,b.pos>i)o.push(b);else{if(this.advanceStack(b,o,t))continue;{l||(l=[],d=[]),l.push(b);let h=this.tokens.getMainToken(b);d.push(h.value,h.end)}}break}}if(!o.length){let g=l&&Bte(l);if(g)return this.stackToTree(g);if(this.parser.strict)throw vm&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&l){let g=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,d,o);if(g)return this.stackToTree(g.forceAll())}if(this.recovering){let g=this.recovering==1?1:this.recovering*3;if(o.length>g)for(o.sort((b,h)=>h.score-b.score);o.length>g;)o.pop();o.some(b=>b.reducePos>i)&&this.recovering--}else if(o.length>1){e:for(let g=0;g<o.length-1;g++){let b=o[g];for(let h=g+1;h<o.length;h++){let e=o[h];if(b.sameState(e)||b.buffer.length>500&&e.buffer.length>500)if((b.score-e.score||b.buffer.length-e.buffer.length)>0)o.splice(h--,1);else{o.splice(g--,1);continue e}}}}this.minStackPos=o[0].pos;for(let g=1;g<o.length;g++)o[g].pos<this.minStackPos&&(this.minStackPos=o[g].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,i,o){let l=t.pos,{parser:d}=this,g=vm?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,c=e?t.curContext.hash:0;for(let S=this.fragments.nodeAt(l);S;){let D=this.parser.nodeSet.types[S.type.id]==S.type?d.getGoto(t.state,S.type.id):-1;if(D>-1&&S.length&&(!e||(S.prop(ic.contextHash)||0)==c))return t.useNode(S,D),vm&&console.log(g+this.stackID(t)+` (via reuse of ${d.getName(S.type.id)})`),!0;if(!(S instanceof Hl)||S.children.length==0||S.positions[0]>0)break;let s=S.children[0];if(s instanceof Hl&&S.positions[0]==0)S=s;else break}}let b=d.stateSlot(t.state,4);if(b>0)return t.reduce(b),vm&&console.log(g+this.stackID(t)+` (via always-reduce ${d.getName(b&65535)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let h=this.tokens.getActions(t);for(let e=0;e<h.length;){let c=h[e++],S=h[e++],D=h[e++],s=e==h.length||!o,y=s?t:t.split();if(y.apply(c,S,D),vm&&console.log(g+this.stackID(y)+` (via ${c&65536?`reduce of ${d.getName(c&65535)}`:"shift"} for ${d.getName(S)} @ ${l}${y==t?"":", split"})`),s)return!0;y.pos>l?i.push(y):o.push(y)}return!1}advanceFully(t,i){let o=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>o)return WM(t,i),!0}}runRecovery(t,i,o){let l=null,d=!1;for(let g=0;g<t.length;g++){let b=t[g],h=i[g<<1],e=i[(g<<1)+1],c=vm?this.stackID(b)+" -> ":"";if(b.deadEnd&&(d||(d=!0,b.restart(),vm&&console.log(c+this.stackID(b)+" (restarted)"),this.advanceFully(b,o))))continue;let S=b.split(),D=c;for(let s=0;S.forceReduce()&&s<10&&(vm&&console.log(D+this.stackID(S)+" (via force-reduce)"),!this.advanceFully(S,o));s++)vm&&(D=this.stackID(S)+" -> ");for(let s of b.recoverByInsert(h))vm&&console.log(c+this.stackID(s)+" (via recover-insert)"),this.advanceFully(s,o);this.stream.end>b.pos?(e==b.pos&&(e++,h=0),b.recoverByDelete(h,e),vm&&console.log(c+this.stackID(b)+` (via recover-delete ${this.parser.getName(h)})`),WM(b,o)):(!l||l.score<b.score)&&(l=b)}return l}stackToTree(t){return t.close(),Hl.build({buffer:bC.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBuff