nomoreide 0.1.39 → 0.1.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{r as It,j as Rf}from"./index-D84ED51b.js";const sh=1024;let Af=0,Te=class{constructor(e,t){this.from=e,this.to=t}};class R{constructor(e={}){this.id=Af++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=re.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}R.closedBy=new R({deserialize:r=>r.split(" ")});R.openedBy=new R({deserialize:r=>r.split(" ")});R.group=new R({deserialize:r=>r.split(" ")});R.isolate=new R({deserialize:r=>{if(r&&r!="rtl"&&r!="ltr"&&r!="auto")throw new RangeError("Invalid value for isolate: "+r);return r||"auto"}});R.contextHash=new R({perNode:!0});R.lookAhead=new R({perNode:!0});R.mounted=new R({perNode:!0});class Ht{constructor(e,t,i,n=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=n}static get(e){return e&&e.props&&e.props[R.mounted.id]}}const Mf=Object.create(null);class re{constructor(e,t,i,n=0){this.name=e,this.props=t,this.id=i,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):Mf,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new re(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(n)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(R.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let n of i.split(" "))t[n]=e[i];return i=>{for(let n=i.prop(R.group),s=-1;s<(n?n.length:0);s++){let o=t[s<0?i.name:n[s]];if(o)return o}}}}re.none=new re("",Object.create(null),0,8);class ir{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let n=null;for(let s of e){let o=s(i);if(o){n||(n=Object.assign({},i.props));let l=o[1],a=o[0];a.combine&&a.id in n&&(l=a.combine(n[a.id],l)),n[a.id]=l}}t.push(n?new re(i.name,n,i.id,i.flags):i)}return new ir(t)}}const Or=new WeakMap,Ko=new WeakMap;var E;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays",r[r.EnterBracketed=16]="EnterBracketed"})(E||(E={}));class W{constructor(e,t,i,n,s){if(this.type=e,this.children=t,this.positions=i,this.length=n,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=Ht.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let n=i.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new _r(this.topNode,e)}cursorAt(e,t=0,i=0){let n=Or.get(this)||this.topNode,s=new _r(n);return s.moveTo(e,t),Or.set(this,s._tree),s}get topNode(){return new ce(this,0,0,null)}resolve(e,t=0){let i=Wi(Or.get(this)||this.topNode,e,t,!1);return Or.set(this,i),i}resolveInner(e,t=0){let i=Wi(Ko.get(this)||this.topNode,e,t,!0);return Ko.set(this,i),i}resolveStack(e,t=0){return Lf(this,e,t)}iterate(e){let{enter:t,leave:i,from:n=0,to:s=this.length}=e,o=e.mode||0,l=(o&E.IncludeAnonymous)>0;for(let a=this.cursor(o|E.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=n&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:co(re.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,n)=>new W(this.type,t,i,n,this.propValues),e.makeTree||((t,i,n)=>new W(re.none,t,i,n)))}static build(e){return Yf(e)}}W.empty=new W(re.none,[],[],0);class ao{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ao(this.buffer,this.index)}}class Qt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return re.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],n=this.set.types[t],s=n.name;if(/\W/.test(s)&&!n.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,i,n,s){let{buffer:o}=this,l=-1;for(let a=e;a!=t&&!(oh(s,n,o[a+1],o[a+2])&&(l=a,i>0));a=o[a+3]);return l}slice(e,t,i){let n=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){s[a++]=n[l++],s[a++]=n[l++]-i;let h=s[a++]=n[l++]-i;s[a++]=n[l++]-e,o=Math.max(o,h)}return new Qt(s,o,this.set)}}function oh(r,e,t,i){switch(r){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Wi(r,e,t,i){for(var n;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let o=!i&&r instanceof ce&&r.index<0?null:r.parent;if(!o)return r;r=o}let s=i?0:E.IgnoreOverlays;if(i)for(let o=r,l=o.parent;l;o=l,l=o.parent)o instanceof ce&&o.index<0&&((n=l.enter(e,t,s))===null||n===void 0?void 0:n.from)!=o.from&&(r=l);for(;;){let o=r.enter(e,t,s);if(!o)return r;r=o}}class lh{cursor(e=0){return new _r(this,e)}getChild(e,t=null,i=null){let n=Jo(this,e,t,i);return n.length?n[0]:null}getChildren(e,t=null,i=null){return Jo(this,e,t,i)}resolve(e,t=0){return Wi(this,e,t,!1)}resolveInner(e,t=0){return Wi(this,e,t,!0)}matchContext(e){return os(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let n=t.lastChild;if(!n||n.to!=t.to)break;n.type.isError&&n.from==n.to?(i=t,t=n.prevSibling):t=n}return i}get node(){return this}get next(){return this.parent}}class ce extends lh{constructor(e,t,i,n){super(),this._tree=e,this.from=t,this.index=i,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,n,s=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,h=t>0?l.length:-1;e!=h;e+=t){let c=l[e],O=a[e]+o.from,f;if(!(!(s&E.EnterBracketed&&c instanceof W&&(f=Ht.get(c))&&!f.overlay&&f.bracketed&&i>=O&&i<=O+c.length)&&!oh(n,i,O,O+c.length))){if(c instanceof Qt){if(s&E.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-O,n);if(u>-1)return new Ne(new jf(o,c,e,O),null,u)}else if(s&E.IncludeAnonymous||!c.type.isAnonymous||ho(c)){let u;if(!(s&E.IgnoreMounts)&&(u=Ht.get(c))&&!u.overlay)return new ce(u.tree,O,e,o);let d=new ce(c,O,e,o);return s&E.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,i,n,s)}}}if(s&E.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let n;if(!(i&E.IgnoreOverlays)&&(n=Ht.get(this._tree))&&n.overlay){let s=e-this.from,o=i&E.EnterBracketed&&n.bracketed;for(let{from:l,to:a}of n.overlay)if((t>0||o?l<=s:l<s)&&(t<0||o?a>=s:a>s))return new ce(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Jo(r,e,t,i){let n=r.cursor(),s=[];if(!n.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=n.type.is(t),!n.nextSibling())return s}for(;;){if(i!=null&&n.type.is(i))return s;if(n.type.is(e)&&s.push(n.node),!n.nextSibling())return i==null?s:[]}}function os(r,e,t=e.length-1){for(let i=r;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class jf{constructor(e,t,i,n){this.parent=e,this.buffer=t,this.index=i,this.start=n}}class Ne extends 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(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new Ne(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&E.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new Ne(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Ne(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Ne(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,n=this.index+4,s=i.buffer[this.index+3];if(s>n){let o=i.buffer[this.index+1];e.push(i.slice(n,s,o)),t.push(0)}return new W(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ah(r){if(!r.length)return null;let e=0,t=r[0];for(let s=1;s<r.length;s++){let o=r[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let i=t instanceof ce&&t.index<0?null:t.parent,n=r.slice();return i?n[e]=i:n.splice(e,1),new zf(n,t)}class zf{constructor(e,t){this.heads=e,this.node=t}get next(){return ah(this.heads)}}function Lf(r,e,t){let i=r.resolveInner(e,t),n=null;for(let s=i instanceof ce?i:i.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(n||(n=[i])).push(o.resolve(e,t)),s=o}else{let o=Ht.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new ce(o.tree,o.overlay[0].from+s.from,-1,s);(n||(n=[i])).push(Wi(l,e,t,!1))}}return n?ah(n):i}class _r{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~E.EnterBracketed,e instanceof ce)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=i+n.buffer[e+1],this.to=i+n.buffer[e+2],!0}yield(e){return e?e instanceof ce?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&E.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&E.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&E.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let n=i<0?0:this.stack[i]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(n)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(n.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:i}=n)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let s=t+e,o=e<0?-1:i._tree.children.length;s!=o;s+=e){let l=i._tree.children[s];if(this.mode&E.IncludeAnonymous||l instanceof Qt||!l.type.isAnonymous||ho(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let n=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==n){if(n==this.index)return o;t=o,i=s+1;break e}n=this.stack[--s]}for(let n=i;n<this.stack.length;n++)t=new Ne(this.buffer,t,this.stack[n]);return this.bufferNode=new Ne(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let n=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&t&&t(this),n=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,n=!0}}}matchContext(e){if(!this.buffer)return os(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let n=e.length-1,s=this.stack.length-1;n>=0;s--){if(s<0)return os(this._tree,e,n);let o=i[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[n]&&e[n]!=o.name)return!1;n--}}return!0}}function ho(r){return r.children.some(e=>e instanceof Qt||!e.type.isAnonymous||ho(e))}function Yf(r){var e;let{buffer:t,nodeSet:i,maxBufferLength:n=sh,reused:s=[],minRepeatType:o=i.types.length}=r,l=Array.isArray(t)?new ao(t,t.length):t,a=i.types,h=0,c=0;function O(x,w,$,Y,j,D){let{id:M,start:C,end:q,size:_}=l,G=c,fe=h;if(_<0)if(l.next(),_==-1){let tt=s[M];$.push(tt),Y.push(C-x);return}else if(_==-3){h=M;return}else if(_==-4){c=M;return}else throw new RangeError(`Unrecognized record size: ${_}`);let ke=a[M],_e,ne,we=C-x;if(q-C<=n&&(ne=m(l.pos-w,j))){let tt=new Uint16Array(ne.size-ne.skip),ve=l.pos-ne.size,We=tt.length;for(;l.pos>ve;)We=Q(ne.start,tt,We);_e=new Qt(tt,q-ne.start,i),we=ne.start-x}else{let tt=l.pos-_;l.next();let ve=[],We=[],vt=M>=o?M:-1,Dt=0,cr=q;for(;l.pos>tt;)vt>=0&&l.id==vt&&l.size>=0?(l.end<=cr-n&&(d(ve,We,C,Dt,l.end,cr,vt,G,fe),Dt=ve.length,cr=l.end),l.next()):D>2500?f(C,tt,ve,We):O(C,tt,ve,We,vt,D+1);if(vt>=0&&Dt>0&&Dt<ve.length&&d(ve,We,C,Dt,C,cr,vt,G,fe),ve.reverse(),We.reverse(),vt>-1&&Dt>0){let Ho=u(ke,fe);_e=co(ke,ve,We,0,ve.length,0,q-C,Ho,Ho)}else _e=g(ke,ve,We,q-C,G-q,fe)}$.push(_e),Y.push(we)}function f(x,w,$,Y){let j=[],D=0,M=-1;for(;l.pos>w;){let{id:C,start:q,end:_,size:G}=l;if(G>4)l.next();else{if(M>-1&&q<M)break;M<0&&(M=_-n),j.push(C,q,_),D++,l.next()}}if(D){let C=new Uint16Array(D*4),q=j[j.length-2];for(let _=j.length-3,G=0;_>=0;_-=3)C[G++]=j[_],C[G++]=j[_+1]-q,C[G++]=j[_+2]-q,C[G++]=G;$.push(new Qt(C,j[2]-q,i)),Y.push(q-x)}}function u(x,w){return($,Y,j)=>{let D=0,M=$.length-1,C,q;if(M>=0&&(C=$[M])instanceof W){if(!M&&C.type==x&&C.length==j)return C;(q=C.prop(R.lookAhead))&&(D=Y[M]+C.length+q)}return g(x,$,Y,j,D,w)}}function d(x,w,$,Y,j,D,M,C,q){let _=[],G=[];for(;x.length>Y;)_.push(x.pop()),G.push(w.pop()+$-j);x.push(g(i.types[M],_,G,D-j,C-D,q)),w.push(j-$)}function g(x,w,$,Y,j,D,M){if(D){let C=[R.contextHash,D];M=M?[C].concat(M):[C]}if(j>25){let C=[R.lookAhead,j];M=M?[C].concat(M):[C]}return new W(x,w,$,Y,M)}function m(x,w){let $=l.fork(),Y=0,j=0,D=0,M=$.end-n,C={size:0,start:0,skip:0};e:for(let q=$.pos-x;$.pos>q;){let _=$.size;if($.id==w&&_>=0){C.size=Y,C.start=j,C.skip=D,D+=4,Y+=4,$.next();continue}let G=$.pos-_;if(_<0||G<q||$.start<M)break;let fe=$.id>=o?4:0,ke=$.start;for($.next();$.pos>G;){if($.size<0)if($.size==-3||$.size==-4)fe+=4;else break e;else $.id>=o&&(fe+=4);$.next()}j=ke,Y+=_,D+=fe}return(w<0||Y==x)&&(C.size=Y,C.start=j,C.skip=D),C.size>4?C:void 0}function Q(x,w,$){let{id:Y,start:j,end:D,size:M}=l;if(l.next(),M>=0&&Y<o){let C=$;if(M>4){let q=l.pos-(M-4);for(;l.pos>q;)$=Q(x,w,$)}w[--$]=C,w[--$]=D-x,w[--$]=j-x,w[--$]=Y}else M==-3?h=Y:M==-4&&(c=Y);return $}let S=[],y=[];for(;l.pos>0;)O(r.start||0,r.bufferStart||0,S,y,-1,0);let A=(e=r.length)!==null&&e!==void 0?e:S.length?y[0]+S[0].length:0;return new W(a[r.topID],S.reverse(),y.reverse(),A)}const el=new WeakMap;function Xr(r,e){if(!r.isAnonymous||e instanceof Qt||e.type!=r)return 1;let t=el.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=r||!(i instanceof W)){t=1;break}t+=Xr(r,i)}el.set(e,t)}return t}function co(r,e,t,i,n,s,o,l,a){let h=0;for(let d=i;d<n;d++)h+=Xr(r,e[d]);let c=Math.ceil(h*1.5/8),O=[],f=[];function u(d,g,m,Q,S){for(let y=m;y<Q;){let A=y,x=g[y],w=Xr(r,d[y]);for(y++;y<Q;y++){let $=Xr(r,d[y]);if(w+$>=c)break;w+=$}if(y==A+1){if(w>c){let $=d[A];u($.children,$.positions,0,$.children.length,g[A]+S);continue}O.push(d[A])}else{let $=g[y-1]+d[y-1].length-x;O.push(co(r,d,g,A,y,x,$,null,a))}f.push(x+S-s)}}return u(e,t,i,n,0),(l||a)(O,f,o)}class hh{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof Ne?this.setBuffer(e.context.buffer,e.index,t):e instanceof ce&&this.map.set(e.tree,t)}get(e){return e instanceof Ne?this.getBuffer(e.context.buffer,e.index):e instanceof ce?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class ot{constructor(e,t,i,n,s=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=n,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let n=[new ot(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&n.push(s);return n}static applyChanges(e,t,i=128){if(!t.length)return e;let n=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l<t.length?t[l]:null,O=c?c.fromA:1e9;if(O-a>=i)for(;o&&o.from<O;){let f=o;if(a>=f.from||O<=f.to||h){let u=Math.max(f.from,a)-h,d=Math.min(f.to,O)-h;f=u>=d?null:new ot(u,d,f.tree,f.offset+h,l>0,!!c)}if(f&&n.push(f),o.to>O)break;o=s<e.length?e[s++]:null}if(!c)break;a=c.toA,h=c.toA-c.toB}return n}}class Oo{startParse(e,t,i){return typeof e=="string"&&(e=new _f(e)),i=i?i.length?i.map(n=>new Te(n.from,n.to)):[new Te(0,0)]:[new Te(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let n=this.startParse(e,t,i);for(;;){let s=n.advance();if(s)return s}}}class _f{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function ch(r){return(e,t,i,n)=>new Vf(e,r,t,i,n)}class tl{constructor(e,t,i,n,s,o){this.parser=e,this.parse=t,this.overlay=i,this.bracketed=n,this.target=s,this.from=o}}function il(r){if(!r.length||r.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(r))}class Wf{constructor(e,t,i,n,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=i,this.index=n,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const ls=new R({perNode:!0});class Vf{constructor(e,t,i,n,s){this.nest=t,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new W(i.type,i.children,i.positions,i.length,i.propValues.concat([[ls,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[R.mounted.id]=new Ht(t,e.overlay,e.parser,e.bracketed),e.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new Bf(this.fragments),t=null,i=null,n=new _r(new ce(this.baseTree,this.ranges[0].from,0,null),E.IncludeAnonymous|E.IgnoreMounts);e:for(let s,o;;){let l=!0,a;if(this.stoppedAt!=null&&n.from>=this.stoppedAt)l=!1;else if(e.hasNode(n)){if(t){let h=t.mounts.find(c=>c.frag.from<=n.from&&c.frag.to>=n.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let O=c.from+h.pos,f=c.to+h.pos;O>=n.from&&f<=n.to&&!t.ranges.some(u=>u.from<f&&u.to>O)&&t.ranges.push({from:O,to:f})}}l=!1}else if(i&&(o=Ef(i.ranges,n.from,n.to)))l=o!=2;else if(!n.type.isAnonymous&&(s=this.nest(n,this.input))&&(n.from<n.to||!s.overlay)){n.tree||(qf(n),t&&t.depth++,i&&i.depth++);let h=e.findMounts(n.from,s.parser);if(typeof s.overlay=="function")t=new Wf(s.parser,s.overlay,h,this.inner.length,n.from,!!s.bracketed,n.tree,t);else{let c=sl(this.ranges,s.overlay||(n.from<n.to?[new Te(n.from,n.to)]:[]));c.length&&il(c),(c.length||!s.overlay)&&this.inner.push(new tl(s.parser,c.length?s.parser.startParse(this.input,ol(h,c),c):s.parser.startParse(""),s.overlay?s.overlay.map(O=>new Te(O.from-n.from,O.to-n.from)):null,!!s.bracketed,n.tree,c.length?c[0].from:n.from)),s.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):l=!1}}else if(t&&(a=t.predicate(n))&&(a===!0&&(a=new Te(n.from,n.to)),a.from<a.to)){let h=t.ranges.length-1;h>=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&n.firstChild())t&&t.depth++,i&&i.depth++;else for(;!n.nextSibling();){if(!n.parent())break e;if(t&&!--t.depth){let h=sl(this.ranges,t.ranges);h.length&&(il(h),this.inner.splice(t.index,0,new tl(t.parser,t.parser.startParse(this.input,ol(t.mounts,h),h),t.ranges.map(c=>new Te(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function Ef(r,e,t){for(let i of r){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function rl(r,e,t,i,n,s){if(e<t){let o=r.buffer[e+1];i.push(r.slice(e,t,o)),n.push(o-s)}}function qf(r){let{node:e}=r,t=[],i=e.context.buffer;do t.push(r.index),r.parent();while(!r.tree);let n=r.tree,s=n.children.indexOf(i),o=n.children[s],l=o.buffer,a=[s];function h(c,O,f,u,d,g){let m=t[g],Q=[],S=[];rl(o,c,m,Q,S,u);let y=l[m+1],A=l[m+2];a.push(Q.length);let x=g?h(m+4,l[m+3],o.set.types[l[m]],y,A-y,g-1):e.toTree();return Q.push(x),S.push(y-u),rl(o,l[m+3],O,Q,S,u),new W(f,Q,S,d)}n.children[s]=h(0,l.length,re.none,0,o.length,t.length-1);for(let c of a){let O=r.tree.children[c],f=r.tree.positions[c];r.yield(new ce(O,f+r.from,c,r._tree))}}class nl{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(E.IncludeAnonymous|E.IgnoreMounts)}moveTo(e){let{cursor:t}=this,i=e-this.offset;for(;!this.done&&t.from<i;)if(!(t.to>=e&&t.enter(i,1,E.IgnoreOverlays|E.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof W)t=t.children[0];else break}return!1}}let Bf=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(t=i.tree.prop(ls))!==null&&t!==void 0?t:i.to,this.inner=new nl(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(ls))!==null&&e!==void 0?e:t.to,this.inner=new nl(t.tree,-t.offset)}}findMounts(e,t){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(i=s.tree)===null||i===void 0?void 0:i.prop(R.mounted);if(o&&o.parser==t)for(let l=this.fragI;l<this.fragments.length;l++){let a=this.fragments[l];if(a.from>=s.to)break;a.tree==this.curFrag.tree&&n.push({frag:a,pos:s.from-a.offset,mount:o})}}}return n}};function sl(r,e){let t=null,i=e;for(let n=1,s=0;n<r.length;n++){let o=r[n-1].to,l=r[n].from;for(;s<i.length;s++){let a=i[s];if(a.from>=l)break;a.to<=o||(t||(i=t=e.slice()),a.from<o?(t[s]=new Te(a.from,o),a.to>l&&t.splice(s+1,0,new Te(l,a.to))):a.to>l?t[s--]=new Te(l,a.to):t.splice(s--,1))}}return i}function Df(r,e,t,i){let n=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=n==r.length?1e9:o?r[n].to:r[n].from,O=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),u=Math.min(c,O,i);f<u&&h.push(new Te(f,u))}if(a=Math.min(c,O),a==1e9)break;c==a&&(o?(o=!1,n++):o=!0),O==a&&(l?(l=!1,s++):l=!0)}return h}function ol(r,e){let t=[];for(let{pos:i,mount:n,frag:s}of r){let o=i+(n.overlay?n.overlay[0].from:0),l=o+n.tree.length,a=Math.max(s.from,o),h=Math.min(s.to,l);if(n.overlay){let c=n.overlay.map(f=>new Te(f.from+i,f.to+i)),O=Df(e,c,a,h);for(let f=0,u=a;;f++){let d=f==O.length,g=d?h:O[f].from;if(g>u&&t.push(new ot(u,g,n.tree,-o,s.from>=u||s.openStart,s.to<=g||s.openEnd)),d)break;u=O[f].to}}else t.push(new ot(a,h,n.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}var ll={};class Wr{constructor(e,t,i,n,s,o,l,a,h,c=0,O){this.p=e,this.stack=t,this.state=i,this.reducePos=n,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=O}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let n=e.parser.context;return new Wr(e,[],t,i,i,0,[],0,n?new al(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,n=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),l=s.dynamicPrecedence(n);if(l&&(this.score+=l),i==0){n<s.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n<s.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(n,this.reducePos);return}let a=this.stack.length-(i-1)*3-(e&262144?6:0),h=a?this.stack[a-2]:this.p.ranges[0].from;n<s.minRepeatTerm&&h==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-h;c>=2e3&&!(!((t=this.p.parser.nodeSet.types[n])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=c));let O=a?this.stack[a-1]:0,f=this.bufferBase+this.buffer.length-O;if(n<s.minRepeatTerm||e&131072){let u=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,h,u,f+4,!0)}if(e&262144)this.state=this.stack[a];else{let u=this.stack[a-3];this.state=s.getGoto(u,n,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(n,h)}storeNode(e,t,i,n=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this.buffer.length;if(o>0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==i)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(e,t,i,n);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>i;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=n}}shift(e,t,i,n){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;this.pos=n;let l=o.stateFlag(s,1);!l&&(n>i||t<=o.maxNode)&&(this.reducePos=n),this.pushState(s,l?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,n,4)}else this.pos=n,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,n,4)}apply(e,t,i,n){e&65536?this.reduce(e):this.shift(e,t,i,n)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),n=e.bufferBase+t;for(;e&&n==e.bufferBase;)e=e.parent;return new Wr(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new If(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&n.push(t[s],o);if(this.stack.length<120)for(let s=0;n.length<8&&s<t.length;s+=2){let o=t[s+1];n.some((l,a)=>a&1&&l==o)||n.push(t[s],o)}t=n}let i=[];for(let n=0;n<t.length&&i.length<4;n+=2){let s=t[n+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[n],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let i=t>>19,n=t&65535,s=this.stack.length-i*3;if(s<0||e.getGoto(this.stack[s],n,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(n,s)=>{if(!t.includes(n))return t.push(n),e.allActions(n,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=i(o,s+1);if(l!=null)return l}})};return i(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(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new al(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class al{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class If{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=n}}class Vr{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Vr(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.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 Vr(this.stack,this.pos,this.index)}}function Ti(r,e=Uint16Array){if(typeof r!="string")return r;let t=null;for(let i=0,n=0;i<r.length;){let s=0;for(;;){let o=r.charCodeAt(i++),l=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[n++]=s:t=new e(s)}return t}class Zr{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const hl=new Zr;class Gf{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=hl,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,n=this.rangeIndex,s=this.pos+e;for(;s<i.from;){if(!n)return null;let o=this.ranges[--n];s-=i.from-o.to,i=o}for(;t<0?s>i.to:s>=i.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];s+=o.from-i.to,i=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,n;if(t>=0&&t<this.chunk.length)i=this.pos+e,n=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(i=s,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let o=this.rangeIndex,l=this.range;for(;l.to<=i;)l=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),n=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),n}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,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(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,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(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=hl,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let n of this.ranges){if(n.from>=t)break;n.to>e&&(i+=this.input.read(Math.max(n.from,e),Math.min(n.to,t)))}return i}}class Kt{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;Oh(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}Kt.prototype.contextual=Kt.prototype.fallback=Kt.prototype.extend=!1;class Er{constructor(e,t,i){this.precTable=t,this.elseToken=i,this.data=typeof e=="string"?Ti(e):e}token(e,t){let i=e.pos,n=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Oh(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||n++,o==null)break;e.reset(o,e.token)}n&&(e.reset(i,e.token),e.acceptToken(this.elseToken,n))}}Er.prototype.contextual=Kt.prototype.fallback=Kt.prototype.extend=!1;class le{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Oh(r,e,t,i,n,s){let o=0,l=1<<i,{dialect:a}=t.p.parser;e:for(;(l&r[o])!=0;){let h=r[o+1];for(let u=o+3;u<h;u+=2)if((r[u+1]&l)>0){let d=r[u];if(a.allows(d)&&(e.token.value==-1||e.token.value==d||Nf(d,e.token.value,n,s))){e.acceptToken(d);break}}let c=e.next,O=0,f=r[o+2];if(e.next<0&&f>O&&r[h+f*3-3]==65535){o=r[h+f*3-1];continue e}for(;O<f;){let u=O+f>>1,d=h+u+(u<<1),g=r[d],m=r[d+1]||65536;if(c<g)f=u;else if(c>=m)O=u+1;else{o=r[d+2],e.advance();continue e}}break}}function cl(r,e,t){for(let i=e,n;(n=r[i])!=65535;i++)if(n==t)return i-e;return-1}function Nf(r,e,t,i){let n=cl(t,i,e);return n<0||cl(t,i,r)<n}const ye=typeof process<"u"&&ll&&/\bparse\b/.test(ll.LOG);let wn=null;function Ol(r,e,t){let i=r.cursor(E.IncludeAnonymous);for(i.moveTo(e);;)if(!(t<0?i.childBefore(e):i.childAfter(e)))for(;;){if((t<0?i.to<e:i.from>e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(r.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:r.length}}let Uf=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Ol(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Ol(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let i=this.trees[t],n=this.index[t];if(n==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=i.children[n],o=this.start[t]+i.positions[n];if(o>e)return this.nextStart=o,null;if(s instanceof W){if(o==e){if(o<this.safeFrom)return null;let l=o+s.length;if(l<=this.safeTo){let a=s.prop(R.lookAhead);if(!a||l+a<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}};class Ff{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Zr)}getActions(e){let t=0,i=null,{parser:n}=e.p,{tokenizers:s}=n,o=n.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;h<s.length;h++){if((1<<h&o)==0)continue;let c=s[h],O=this.tokens[h];if(!(i&&!c.fallback)&&((c.contextual||O.start!=e.pos||O.mask!=o||O.context!=l)&&(this.updateCachedToken(O,c,e),O.mask=o,O.context=l),O.lookAhead>O.end+25&&(a=Math.max(O.lookAhead,a)),O.value!=0)){let f=t;if(O.extended>-1&&(t=this.addActions(e,O.extended,O.end,t)),t=this.addActions(e,O.value,O.end,t),!c.extend&&(i=O,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!i&&e.pos==this.stream.end&&(i=new Zr,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Zr,{pos:i,p:n}=e;return t.start=i,t.end=Math.min(i+1,n.stream.end),t.value=i==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,i){let n=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(n,e),i),e.value>-1){let{parser:s}=i.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let l=s.specializers[o](this.stream.read(e.start,e.end),i);if(l>=0&&i.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,t,i,n){for(let s=0;s<n;s+=3)if(this.actions[s]==e)return n;return this.actions[n++]=e,this.actions[n++]=t,this.actions[n++]=i,n}addActions(e,t,i,n){let{state:s}=e,{parser:o}=e.p,{data:l}=o;for(let a=0;a<2;a++)for(let h=o.stateSlot(s,a?2:1);;h+=3){if(l[h]==65535)if(l[h+1]==1)h=rt(l,h+2);else{n==0&&l[h+1]==2&&(n=this.putAction(rt(l,h+2),t,i,n));break}l[h]==t&&(n=this.putAction(rt(l,h+1),t,i,n))}return n}}class Hf{constructor(e,t,i,n){this.parser=e,this.input=t,this.ranges=n,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 Gf(t,n),this.tokens=new Ff(e,this.stream),this.topTerm=e.top[1];let{from:s}=n[0];this.stacks=[Wr.start(this,e.top[0],s)],this.fragments=i.length&&this.stream.end-s>e.bufferLength*4?new Uf(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],n,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let l=e[o];for(;;){if(this.tokens.mainToken=null,l.pos>t)i.push(l);else{if(this.advanceStack(l,i,e))continue;{n||(n=[],s=[]),n.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!i.length){let o=n&&Jf(n);if(o)return ye&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ye&&n&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,s,i);if(o)return ye&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,a)=>a.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o<i.length-1;o++){let l=i[o];for(let a=o+1;a<i.length;a++){let h=i[a];if(l.sameState(h)||l.buffer.length>500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)i.splice(a--,1);else{i.splice(o--,1);continue e}}}i.length>12&&(i.sort((o,l)=>l.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o<i.length;o++)i[o].pos<this.minStackPos&&(this.minStackPos=i[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,i){let n=e.pos,{parser:s}=this,o=ye?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let O=this.fragments.nodeAt(n);O;){let f=this.parser.nodeSet.types[O.type.id]==O.type?s.getGoto(e.state,O.type.id):-1;if(f>-1&&O.length&&(!h||(O.prop(R.contextHash)||0)==c))return e.useNode(O,f),ye&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(O.type.id)})`),!0;if(!(O instanceof W)||O.children.length==0||O.positions[0]>0)break;let u=O.children[0];if(u instanceof W&&O.positions[0]==0)O=u;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),ye&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;h<a.length;){let c=a[h++],O=a[h++],f=a[h++],u=h==a.length||!i,d=u?e:e.split(),g=this.tokens.mainToken;if(d.apply(c,O,g?g.start:d.pos,f),ye&&console.log(o+this.stackID(d)+` (via ${(c&65536)==0?"shift":`reduce of ${s.getName(c&65535)}`} for ${s.getName(O)} @ ${n}${d==e?"":", split"})`),u)return!0;d.pos>n?t.push(d):i.push(d)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return fl(e,t),!0}}runRecovery(e,t,i){let n=null,s=!1;for(let o=0;o<e.length;o++){let l=e[o],a=t[o<<1],h=t[(o<<1)+1],c=ye?this.stackID(l)+" -> ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),ye&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let O=l.split(),f=c;for(let u=0;u<10&&O.forceReduce()&&(ye&&console.log(f+this.stackID(O)+" (via force-reduce)"),!this.advanceFully(O,i));u++)ye&&(f=this.stackID(O)+" -> ");for(let u of l.recoverByInsert(a))ye&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,i);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),ye&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),fl(l,i)):(!n||n.score<O.score)&&(n=O)}return n}stackToTree(e){return e.close(),W.build({buffer:Vr.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(wn||(wn=new WeakMap)).get(e);return t||wn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function fl(r,e){for(let t=0;t<e.length;t++){let i=e[t];if(i.pos==r.pos&&i.sameState(r)){e[t].score<r.score&&(e[t]=r);return}}e.push(r)}class Kf{constructor(e,t,i){this.source=e,this.flags=t,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}const vn=r=>r;class fo{constructor(e){this.start=e.start,this.shift=e.shift||vn,this.reduce=e.reduce||vn,this.reuse=e.reuse||vn,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class St extends Oo{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;l<e.repeatNodeCount;l++)t.push("");let i=Object.keys(e.topRules).map(l=>e.topRules[l][1]),n=[];for(let l=0;l<t.length;l++)n.push([]);function s(l,a,h){n[l].push([a,a.deserialize(String(h))])}if(e.nodeProps)for(let l of e.nodeProps){let a=l[0];typeof a=="string"&&(a=R[a]);for(let h=1;h<l.length;){let c=l[h++];if(c>=0)s(c,a,l[h++]);else{let O=l[h+-c];for(let f=-c;f>0;f--)s(l[h++],a,O);h++}}}this.nodeSet=new ir(t.map((l,a)=>re.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:n[a],top:i.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=sh;let o=Ti(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(ul),this.states=Ti(e.states,Uint32Array),this.data=Ti(e.stateData),this.goto=Ti(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(l=>typeof l=="number"?new Kt(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let n=new Hf(this,e,t,i);for(let s of this.wrappers)n=s(n,e,t,i);return n}getGoto(e,t,i=!1){let n=this.goto;if(t>=n[0])return-1;for(let s=n[t+1];;){let o=n[s++],l=o&1,a=n[s++];if(l&&i)return a;for(let h=s+(o>>1);s<h;s++)if(n[s]==e)return a;if(l)return-1}}hasAction(e,t){let i=this.data;for(let n=0;n<2;n++)for(let s=this.stateSlot(e,n?2:1),o;;s+=3){if((o=i[s])==65535)if(i[s+1]==1)o=i[s=rt(i,s+2)];else{if(i[s+1]==2)return rt(i,s+2);break}if(o==t||o==0)return rt(i,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),n=i?t(i):void 0;for(let s=this.stateSlot(e,1);n==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=rt(this.data,s+2);else break;n=t(rt(this.data,s+1))}return n}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=rt(this.data,i+2);else break;if((this.data[i+2]&1)==0){let n=this.data[i+1];t.some((s,o)=>o&1&&s==n)||t.push(this.data[i],n)}}return t}configure(e){let t=Object.assign(Object.create(St.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let n=e.tokenizers.find(s=>s.from==i);return n?n.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,n)=>{let s=e.specializers.find(l=>l.from==i.external);if(!s)return i;let o=Object.assign(Object.assign({},i),{external:s.to});return t.specializers[n]=ul(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(i[o]=!0)}let n=null;for(let s=0;s<t.length;s++)if(!i[s])for(let o=this.dialects[t[s]],l;(l=this.data[o++])!=65535;)(n||(n=new Uint8Array(this.maxTerm+1)))[l]=1;return new Kf(e,i,n)}static deserialize(e){return new St(e)}}function rt(r,e){return r[e]|r[e+1]<<16}function Jf(r){let e=null;for(let t of r){let i=t.p.stoppedAt;(t.pos==t.p.stream.end||i!=null&&t.pos>i)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function ul(r){if(r.external){let e=r.extend?1:0;return(t,i)=>r.external(t,i)<<1|e}return r.get}let eu=0,De=class as{constructor(e,t,i,n){this.name=e,this.set=t,this.base=i,this.modified=n,this.id=eu++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof as&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let n=new as(i,[],null,[]);if(n.set.push(n),t)for(let s of t.set)n.set.push(s);return n}static defineModifier(e){let t=new qr(e);return i=>i.modified.indexOf(t)>-1?i:qr.get(i.base||i,i.modified.concat(t).sort((n,s)=>n.id-s.id))}},tu=0;class qr{constructor(e){this.name=e,this.instances=[],this.id=tu++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&iu(t,l.modified));if(i)return i;let n=[],s=new De(e.name,n,e,t);for(let l of t)l.instances.push(s);let o=ru(t);for(let l of e.set)if(!l.modified.length)for(let a of o)n.push(qr.get(l,a));return s}}function iu(r,e){return r.length==e.length&&r.every((t,i)=>t==e[i])}function ru(r){let e=[[]];for(let t=0;t<r.length;t++)for(let i=0,n=e.length;i<n;i++)e.push(e[i].concat(r[t]));return e.sort((t,i)=>i.length-t.length)}function $t(r){let e=Object.create(null);for(let t in r){let i=r[t];Array.isArray(i)||(i=[i]);for(let n of t.split(" "))if(n){let s=[],o=2,l=n;for(let O=0;;){if(l=="..."&&O>0&&O+3==n.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+n);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),O+=f[0].length,O==n.length)break;let u=n[O++];if(O==n.length&&u=="!"){o=0;break}if(u!="/")throw new RangeError("Invalid path: "+n);l=n.slice(O)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+n);let c=new Vi(i,o,a>0?s.slice(0,a):null);e[h]=c.sort(e[h])}}return fh.add(e)}const fh=new R({combine(r,e){let t,i,n;for(;r||e;){if(!r||e&&r.depth>=e.depth?(n=e,e=e.next):(n=r,r=r.next),t&&t.mode==n.mode&&!n.context&&!t.context)continue;let s=new Vi(n.tags,n.mode,n.context);t?t.next=s:i=s,t=s}return i}});class Vi{constructor(e,t,i,n){this.tags=e,this.mode=t,this.context=i,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Vi.empty=new Vi([],2,null);function uh(r,e){let t=Object.create(null);for(let s of r)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:i,all:n=null}=e||{};return{style:s=>{let o=n;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function nu(r,e){let t=null;for(let i of r){let n=i.style(e);n&&(t=t?t+" "+n:n)}return t}function su(r,e,t,i=0,n=r.length){let s=new ou(i,Array.isArray(e)?e:[e],t);s.highlightRange(r.cursor(),i,n,"",s.highlighters),s.flush(n)}class ou{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,n,s){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(s=this.highlighters.filter(u=>!u.scope||u.scope(o)));let h=n,c=lu(e)||Vi.empty,O=nu(s,c.tags);if(O&&(h&&(h+=" "),h+=O,c.mode==1&&(n+=(n?" ":"")+O)),this.startSpan(Math.max(t,l),h),c.opaque)return;let f=e.tree&&e.tree.prop(R.mounted);if(f&&f.overlay){let u=e.node.enter(f.overlay[0].from+l,1),d=this.highlighters.filter(m=>!m.scope||m.scope(f.tree.type)),g=e.firstChild();for(let m=0,Q=l;;m++){let S=m<f.overlay.length?f.overlay[m]:null,y=S?S.from+l:a,A=Math.max(t,Q),x=Math.min(i,y);if(A<x&&g)for(;e.from<x&&(this.highlightRange(e,A,x,n,s),this.startSpan(Math.min(x,e.to),h),!(e.to>=y||!e.nextSibling())););if(!S||y>i)break;Q=S.to+l,Q>t&&(this.highlightRange(u.cursor(),Math.max(t,S.from+l),Math.min(i,Q),"",d),this.startSpan(Math.min(i,Q),h))}g&&e.parent()}else if(e.firstChild()){f&&(n="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,n,s),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function lu(r){let e=r.type.prop(fh);for(;e&&e.context&&!r.matchContext(e.context);)e=e.next;return e||null}const P=De.define,fr=P(),dt=P(),dl=P(dt),pl=P(dt),pt=P(),ur=P(pt),Tn=P(pt),Be=P(),Tt=P(Be),Ve=P(),Ee=P(),hs=P(),bi=P(hs),dr=P(),p={comment:fr,lineComment:P(fr),blockComment:P(fr),docComment:P(fr),name:dt,variableName:P(dt),typeName:dl,tagName:P(dl),propertyName:pl,attributeName:P(pl),className:P(dt),labelName:P(dt),namespace:P(dt),macroName:P(dt),literal:pt,string:ur,docString:P(ur),character:P(ur),attributeValue:P(ur),number:Tn,integer:P(Tn),float:P(Tn),bool:P(pt),regexp:P(pt),escape:P(pt),color:P(pt),url:P(pt),keyword:Ve,self:P(Ve),null:P(Ve),atom:P(Ve),unit:P(Ve),modifier:P(Ve),operatorKeyword:P(Ve),controlKeyword:P(Ve),definitionKeyword:P(Ve),moduleKeyword:P(Ve),operator:Ee,derefOperator:P(Ee),arithmeticOperator:P(Ee),logicOperator:P(Ee),bitwiseOperator:P(Ee),compareOperator:P(Ee),updateOperator:P(Ee),definitionOperator:P(Ee),typeOperator:P(Ee),controlOperator:P(Ee),punctuation:hs,separator:P(hs),bracket:bi,angleBracket:P(bi),squareBracket:P(bi),paren:P(bi),brace:P(bi),content:Be,heading:Tt,heading1:P(Tt),heading2:P(Tt),heading3:P(Tt),heading4:P(Tt),heading5:P(Tt),heading6:P(Tt),contentSeparator:P(Be),list:P(Be),quote:P(Be),emphasis:P(Be),strong:P(Be),link:P(Be),monospace:P(Be),strikethrough:P(Be),inserted:P(),deleted:P(),changed:P(),invalid:P(),meta:dr,documentMeta:P(dr),annotation:P(dr),processingInstruction:P(dr),definition:De.defineModifier("definition"),constant:De.defineModifier("constant"),function:De.defineModifier("function"),standard:De.defineModifier("standard"),local:De.defineModifier("local"),special:De.defineModifier("special")};for(let r in p){let e=p[r];e instanceof De&&(e.name=r)}uh([{tag:p.link,class:"tok-link"},{tag:p.heading,class:"tok-heading"},{tag:p.emphasis,class:"tok-emphasis"},{tag:p.strong,class:"tok-strong"},{tag:p.keyword,class:"tok-keyword"},{tag:p.atom,class:"tok-atom"},{tag:p.bool,class:"tok-bool"},{tag:p.url,class:"tok-url"},{tag:p.labelName,class:"tok-labelName"},{tag:p.inserted,class:"tok-inserted"},{tag:p.deleted,class:"tok-deleted"},{tag:p.literal,class:"tok-literal"},{tag:p.string,class:"tok-string"},{tag:p.number,class:"tok-number"},{tag:[p.regexp,p.escape,p.special(p.string)],class:"tok-string2"},{tag:p.variableName,class:"tok-variableName"},{tag:p.local(p.variableName),class:"tok-variableName tok-local"},{tag:p.definition(p.variableName),class:"tok-variableName tok-definition"},{tag:p.special(p.variableName),class:"tok-variableName2"},{tag:p.definition(p.propertyName),class:"tok-propertyName tok-definition"},{tag:p.typeName,class:"tok-typeName"},{tag:p.namespace,class:"tok-namespace"},{tag:p.className,class:"tok-className"},{tag:p.macroName,class:"tok-macroName"},{tag:p.propertyName,class:"tok-propertyName"},{tag:p.operator,class:"tok-operator"},{tag:p.comment,class:"tok-comment"},{tag:p.meta,class:"tok-meta"},{tag:p.invalid,class:"tok-invalid"},{tag:p.punctuation,class:"tok-punctuation"}]);const au=135,gl=1,hu=136,cu=137,dh=2,Ou=138,fu=3,uu=4,ph=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],du=58,pu=40,gh=95,gu=91,Cr=45,mu=46,Qu=35,Su=37,bu=38,ku=92,yu=10,xu=42;function Ei(r){return r>=65&&r<=90||r>=97&&r<=122||r>=161}function uo(r){return r>=48&&r<=57}function ml(r){return uo(r)||r>=97&&r<=102||r>=65&&r<=70}const mh=(r,e,t)=>(i,n)=>{for(let s=!1,o=0,l=0;;l++){let{next:a}=i;if(Ei(a)||a==Cr||a==gh||s&&uo(a))!s&&(a!=Cr||l>0)&&(s=!0),o===l&&a==Cr&&o++,i.advance();else if(a==ku&&i.peek(1)!=yu){if(i.advance(),ml(i.next)){do i.advance();while(ml(i.next));i.next==32&&i.advance()}else i.next>-1&&i.advance();s=!0}else{s&&i.acceptToken(o==2&&n.canShift(dh)?e:a==pu?t:r);break}}},Pu=new le(mh(hu,dh,cu),{contextual:!0}),$u=new le(mh(Ou,fu,uu),{contextual:!0}),wu=new le(r=>{if(ph.includes(r.peek(-1))){let{next:e}=r;(Ei(e)||e==gh||e==Qu||e==mu||e==xu||e==gu||e==du&&Ei(r.peek(1))||e==Cr||e==bu)&&r.acceptToken(au)}}),vu=new le(r=>{if(!ph.includes(r.peek(-1))){let{next:e}=r;if(e==Su&&(r.advance(),r.acceptToken(gl)),Ei(e)){do r.advance();while(Ei(r.next)||uo(r.next));r.acceptToken(gl)}}}),Tu=$t({"AtKeyword import charset namespace keyframes media supports font-feature-values":p.definitionKeyword,"from to selector scope MatchFlag":p.keyword,NamespaceName:p.namespace,KeyframeName:p.labelName,KeyframeRangeName:p.operatorKeyword,TagName:p.tagName,ClassName:p.className,PseudoClassName:p.constant(p.className),IdName:p.labelName,"FeatureName PropertyName":p.propertyName,AttributeName:p.attributeName,NumberLiteral:p.number,KeywordQuery:p.keyword,UnaryQueryOp:p.operatorKeyword,"CallTag ValueName FontName":p.atom,VariableName:p.variableName,Callee:p.operatorKeyword,Unit:p.unit,"UniversalSelector NestingSelector":p.definitionOperator,"MatchOp CompareOp":p.compareOperator,"ChildOp SiblingOp, LogicOp":p.logicOperator,BinOp:p.arithmeticOperator,Important:p.modifier,Comment:p.blockComment,ColorLiteral:p.color,"ParenthesizedContent StringLiteral":p.string,":":p.punctuation,"PseudoOp #":p.derefOperator,"; , |":p.separator,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace}),Xu={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:90,url:132,"url-prefix":132,domain:132,regexp:132},Zu={__proto__:null,or:104,and:104,not:112,only:112,layer:186},Cu={__proto__:null,selector:118,layer:182},Ru={__proto__:null,"@import":178,"@media":190,"@charset":194,"@namespace":198,"@keyframes":204,"@supports":216,"@scope":220,"@font-feature-values":226},Au={__proto__:null,to:223},Mu=St.deserialize({version:14,states:"IpQYQdOOO#}QdOOP$UO`OOO%OQaO'#CfOOQP'#Ce'#CeO%VQdO'#CgO%[Q`O'#CgO%aQaO'#FdO&XQdO'#CkO&xQaO'#CcO'SQdO'#CnO'_QdO'#DtO'dQdO'#DvO'oQdO'#D}O'oQdO'#EQOOQP'#Fd'#FdO)OQhO'#EsOOQS'#Fc'#FcOOQS'#Ev'#EvQYQdOOO)VQdO'#EWO*cQhO'#E^O)VQdO'#E`O*jQdO'#EbO*uQdO'#EeO)zQhO'#EkO*}QdO'#EmO+YQdO'#EpO+_QaO'#CfO+fQ`O'#ETO+kQ`O'#FnO+vQdO'#FnQOQ`OOP,QO&jO'#CaPOOO)CAR)CAROOQP'#Ci'#CiOOQP,59R,59RO%VQdO,59ROOQP'#Cm'#CmOOQP,59V,59VO&XQdO,59VO,]QdO,59YO'_QdO,5:`O'dQdO,5:bO'oQdO,5:iO'oQdO,5:kO'oQdO,5:lO'oQdO'#E}O,hQ`O,58}O,pQdO'#ESOOQS,58},58}OOQP'#Cq'#CqOOQO'#Dr'#DrOOQP,59Y,59YO,wQ`O,59YO,|Q`O,59YOOQP'#Du'#DuOOQP,5:`,5:`O-RQpO'#DwO-^QdO'#DxO-cQ`O'#DxO-hQpO,5:bO.RQaO,5:iO.iQaO,5:lOOQW'#D^'#D^O/eQhO'#DgO/xQhO,5;_O)zQhO'#DeO0VQ`O'#DkO0[QhO'#DnOOQW'#Fj'#FjOOQS,5;_,5;_O0aQ`O'#Dh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[#pQ!qdQ!zf[$V!m!n!o$Y$[$^Q$y#Yd%Y#p%Z%_&a&f&k'U'^'k'sQ%^#uQ%n$aS&U$y&WQ&[%UQ&}&VR'b&p]$X!m!n!o$Y$[$^Q!d`U!xe!q$eQ#QiQ#x!cS#{!d$OQ$Q!eQ%b#|Q%c#}Q%g$RS%r$g%tQ%w$jR'Z&iQ#z!cQ&h%`R'j'YR%i$RR%X#oQpPR#n!RQ!yeQ$d!qR%q$e",nodeNames:"⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NamespacedTagSelector NamespaceName TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , PseudoQuery CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName NamespacedAttribute NamespaceName AttributeName MatchOp MatchFlag ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to FontFeatureStatement font-feature-values FontName AtRule Styles",maxTerm:159,nodeProps:[["isolate",-2,5,39,""],["openedBy",23,"(",31,"[",34,"{"],["closedBy",24,")",32,"]",35,"}"]],propSources:[Tu],skippedNodes:[0,5,117],repeatNodeCount:17,tokenData:"K`~R!bOX%ZX^&R^p%Zpq&Rqr)ers)vst+jtu2Xuv%Zvw3Rwx3dxy5Ryz5dz{5i{|6S|}:u}!O;W!O!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8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<r.length;e++)(e%2?Qh:cs).push(t=t+r[e])})();function ju(r){if(r<768)return!1;for(let e=0,t=cs.length;;){let i=e+t>>1;if(r<cs[i])t=i;else if(r>=Qh[i])e=i+1;else return!0;if(e==t)return!1}}function Ql(r){return r>=127462&&r<=127487}const Sl=8205;function zu(r,e,t=!0,i=!0){return(t?Sh:Lu)(r,e,i)}function Sh(r,e,t){if(e==r.length)return e;e&&bh(r.charCodeAt(e))&&kh(r.charCodeAt(e-1))&&e--;let i=Xn(r,e);for(e+=bl(i);e<r.length;){let n=Xn(r,e);if(i==Sl||n==Sl||t&&ju(n))e+=bl(n),i=n;else if(Ql(n)){let s=0,o=e-2;for(;o>=0&&Ql(Xn(r,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Lu(r,e,t){for(;e>0;){let i=Sh(r,e-2,t);if(i<e)return i;e--}return 0}function Xn(r,e){let t=r.charCodeAt(e);if(!kh(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return bh(i)?(t-55296<<10)+(i-56320)+65536:t}function bh(r){return r>=56320&&r<57344}function kh(r){return r>=55296&&r<56320}function bl(r){return r<65536?1:2}class L{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=ni(this,e,t);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(t,this.length,n,1),Ie.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ni(this,e,t);let i=[];return this.decompose(e,t,i,0),Ie.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new Ri(this),s=new Ri(e);for(let o=t,l=t;;){if(n.next(o),s.next(o),o=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(l+=n.value.length,n.done||l>=i)return!0}}iter(e=1){return new Ri(this,e)}iterRange(e,t=this.length){return new yh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new xh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?L.empty:e.length<=32?new ee(e):Ie.from(ee.split(e,[]))}}class ee extends L{constructor(e,t=Yu(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let s=0;;s++){let o=this.text[s],l=n+o.length;if((t?i:l)>=e)return new _u(n,l,i,o);n=l+1,i++}}decompose(e,t,i,n){let s=e<=0&&t>=this.length?this:new ee(kl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let o=i.pop(),l=Rr(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new ee(l,o.length+s.length));else{let a=l.length>>1;i.push(new ee(l.slice(0,a)),new ee(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof ee))return super.replace(e,t,i);[e,t]=ni(this,e,t);let n=Rr(this.text,Rr(i.text,kl(this.text,0,e)),t),s=this.length+i.length-(t-e);return n.length<=32?new ee(n,s):Ie.from(ee.split(n,[]),s)}sliceString(e,t=this.length,i=`
1
+ import{r as It,j as Rf}from"./index-CFGCUh46.js";const sh=1024;let Af=0,Te=class{constructor(e,t){this.from=e,this.to=t}};class R{constructor(e={}){this.id=Af++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=re.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}R.closedBy=new R({deserialize:r=>r.split(" ")});R.openedBy=new R({deserialize:r=>r.split(" ")});R.group=new R({deserialize:r=>r.split(" ")});R.isolate=new R({deserialize:r=>{if(r&&r!="rtl"&&r!="ltr"&&r!="auto")throw new RangeError("Invalid value for isolate: "+r);return r||"auto"}});R.contextHash=new R({perNode:!0});R.lookAhead=new R({perNode:!0});R.mounted=new R({perNode:!0});class Ht{constructor(e,t,i,n=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=n}static get(e){return e&&e.props&&e.props[R.mounted.id]}}const Mf=Object.create(null);class re{constructor(e,t,i,n=0){this.name=e,this.props=t,this.id=i,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):Mf,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new re(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(n)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(R.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let n of i.split(" "))t[n]=e[i];return i=>{for(let n=i.prop(R.group),s=-1;s<(n?n.length:0);s++){let o=t[s<0?i.name:n[s]];if(o)return o}}}}re.none=new re("",Object.create(null),0,8);class ir{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let n=null;for(let s of e){let o=s(i);if(o){n||(n=Object.assign({},i.props));let l=o[1],a=o[0];a.combine&&a.id in n&&(l=a.combine(n[a.id],l)),n[a.id]=l}}t.push(n?new re(i.name,n,i.id,i.flags):i)}return new ir(t)}}const Or=new WeakMap,Ko=new WeakMap;var E;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays",r[r.EnterBracketed=16]="EnterBracketed"})(E||(E={}));class W{constructor(e,t,i,n,s){if(this.type=e,this.children=t,this.positions=i,this.length=n,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=Ht.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let n=i.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new _r(this.topNode,e)}cursorAt(e,t=0,i=0){let n=Or.get(this)||this.topNode,s=new _r(n);return s.moveTo(e,t),Or.set(this,s._tree),s}get topNode(){return new ce(this,0,0,null)}resolve(e,t=0){let i=Wi(Or.get(this)||this.topNode,e,t,!1);return Or.set(this,i),i}resolveInner(e,t=0){let i=Wi(Ko.get(this)||this.topNode,e,t,!0);return Ko.set(this,i),i}resolveStack(e,t=0){return Lf(this,e,t)}iterate(e){let{enter:t,leave:i,from:n=0,to:s=this.length}=e,o=e.mode||0,l=(o&E.IncludeAnonymous)>0;for(let a=this.cursor(o|E.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=n&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:co(re.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,n)=>new W(this.type,t,i,n,this.propValues),e.makeTree||((t,i,n)=>new W(re.none,t,i,n)))}static build(e){return Yf(e)}}W.empty=new W(re.none,[],[],0);class ao{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ao(this.buffer,this.index)}}class Qt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return re.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],n=this.set.types[t],s=n.name;if(/\W/.test(s)&&!n.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,i,n,s){let{buffer:o}=this,l=-1;for(let a=e;a!=t&&!(oh(s,n,o[a+1],o[a+2])&&(l=a,i>0));a=o[a+3]);return l}slice(e,t,i){let n=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){s[a++]=n[l++],s[a++]=n[l++]-i;let h=s[a++]=n[l++]-i;s[a++]=n[l++]-e,o=Math.max(o,h)}return new Qt(s,o,this.set)}}function oh(r,e,t,i){switch(r){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Wi(r,e,t,i){for(var n;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let o=!i&&r instanceof ce&&r.index<0?null:r.parent;if(!o)return r;r=o}let s=i?0:E.IgnoreOverlays;if(i)for(let o=r,l=o.parent;l;o=l,l=o.parent)o instanceof ce&&o.index<0&&((n=l.enter(e,t,s))===null||n===void 0?void 0:n.from)!=o.from&&(r=l);for(;;){let o=r.enter(e,t,s);if(!o)return r;r=o}}class lh{cursor(e=0){return new _r(this,e)}getChild(e,t=null,i=null){let n=Jo(this,e,t,i);return n.length?n[0]:null}getChildren(e,t=null,i=null){return Jo(this,e,t,i)}resolve(e,t=0){return Wi(this,e,t,!1)}resolveInner(e,t=0){return Wi(this,e,t,!0)}matchContext(e){return os(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let n=t.lastChild;if(!n||n.to!=t.to)break;n.type.isError&&n.from==n.to?(i=t,t=n.prevSibling):t=n}return i}get node(){return this}get next(){return this.parent}}class ce extends lh{constructor(e,t,i,n){super(),this._tree=e,this.from=t,this.index=i,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,n,s=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,h=t>0?l.length:-1;e!=h;e+=t){let c=l[e],O=a[e]+o.from,f;if(!(!(s&E.EnterBracketed&&c instanceof W&&(f=Ht.get(c))&&!f.overlay&&f.bracketed&&i>=O&&i<=O+c.length)&&!oh(n,i,O,O+c.length))){if(c instanceof Qt){if(s&E.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-O,n);if(u>-1)return new Ne(new jf(o,c,e,O),null,u)}else if(s&E.IncludeAnonymous||!c.type.isAnonymous||ho(c)){let u;if(!(s&E.IgnoreMounts)&&(u=Ht.get(c))&&!u.overlay)return new ce(u.tree,O,e,o);let d=new ce(c,O,e,o);return s&E.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,i,n,s)}}}if(s&E.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let n;if(!(i&E.IgnoreOverlays)&&(n=Ht.get(this._tree))&&n.overlay){let s=e-this.from,o=i&E.EnterBracketed&&n.bracketed;for(let{from:l,to:a}of n.overlay)if((t>0||o?l<=s:l<s)&&(t<0||o?a>=s:a>s))return new ce(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Jo(r,e,t,i){let n=r.cursor(),s=[];if(!n.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=n.type.is(t),!n.nextSibling())return s}for(;;){if(i!=null&&n.type.is(i))return s;if(n.type.is(e)&&s.push(n.node),!n.nextSibling())return i==null?s:[]}}function os(r,e,t=e.length-1){for(let i=r;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class jf{constructor(e,t,i,n){this.parent=e,this.buffer=t,this.index=i,this.start=n}}class Ne extends 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(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new Ne(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&E.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new Ne(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Ne(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Ne(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,n=this.index+4,s=i.buffer[this.index+3];if(s>n){let o=i.buffer[this.index+1];e.push(i.slice(n,s,o)),t.push(0)}return new W(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ah(r){if(!r.length)return null;let e=0,t=r[0];for(let s=1;s<r.length;s++){let o=r[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let i=t instanceof ce&&t.index<0?null:t.parent,n=r.slice();return i?n[e]=i:n.splice(e,1),new zf(n,t)}class zf{constructor(e,t){this.heads=e,this.node=t}get next(){return ah(this.heads)}}function Lf(r,e,t){let i=r.resolveInner(e,t),n=null;for(let s=i instanceof ce?i:i.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(n||(n=[i])).push(o.resolve(e,t)),s=o}else{let o=Ht.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new ce(o.tree,o.overlay[0].from+s.from,-1,s);(n||(n=[i])).push(Wi(l,e,t,!1))}}return n?ah(n):i}class _r{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~E.EnterBracketed,e instanceof ce)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=i+n.buffer[e+1],this.to=i+n.buffer[e+2],!0}yield(e){return e?e instanceof ce?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&E.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&E.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&E.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let n=i<0?0:this.stack[i]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(n)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(n.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:i}=n)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let s=t+e,o=e<0?-1:i._tree.children.length;s!=o;s+=e){let l=i._tree.children[s];if(this.mode&E.IncludeAnonymous||l instanceof Qt||!l.type.isAnonymous||ho(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let n=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==n){if(n==this.index)return o;t=o,i=s+1;break e}n=this.stack[--s]}for(let n=i;n<this.stack.length;n++)t=new Ne(this.buffer,t,this.stack[n]);return this.bufferNode=new Ne(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let n=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&t&&t(this),n=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,n=!0}}}matchContext(e){if(!this.buffer)return os(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let n=e.length-1,s=this.stack.length-1;n>=0;s--){if(s<0)return os(this._tree,e,n);let o=i[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[n]&&e[n]!=o.name)return!1;n--}}return!0}}function ho(r){return r.children.some(e=>e instanceof Qt||!e.type.isAnonymous||ho(e))}function Yf(r){var e;let{buffer:t,nodeSet:i,maxBufferLength:n=sh,reused:s=[],minRepeatType:o=i.types.length}=r,l=Array.isArray(t)?new ao(t,t.length):t,a=i.types,h=0,c=0;function O(x,w,$,Y,j,D){let{id:M,start:C,end:q,size:_}=l,G=c,fe=h;if(_<0)if(l.next(),_==-1){let tt=s[M];$.push(tt),Y.push(C-x);return}else if(_==-3){h=M;return}else if(_==-4){c=M;return}else throw new RangeError(`Unrecognized record size: ${_}`);let ke=a[M],_e,ne,we=C-x;if(q-C<=n&&(ne=m(l.pos-w,j))){let tt=new Uint16Array(ne.size-ne.skip),ve=l.pos-ne.size,We=tt.length;for(;l.pos>ve;)We=Q(ne.start,tt,We);_e=new Qt(tt,q-ne.start,i),we=ne.start-x}else{let tt=l.pos-_;l.next();let ve=[],We=[],vt=M>=o?M:-1,Dt=0,cr=q;for(;l.pos>tt;)vt>=0&&l.id==vt&&l.size>=0?(l.end<=cr-n&&(d(ve,We,C,Dt,l.end,cr,vt,G,fe),Dt=ve.length,cr=l.end),l.next()):D>2500?f(C,tt,ve,We):O(C,tt,ve,We,vt,D+1);if(vt>=0&&Dt>0&&Dt<ve.length&&d(ve,We,C,Dt,C,cr,vt,G,fe),ve.reverse(),We.reverse(),vt>-1&&Dt>0){let Ho=u(ke,fe);_e=co(ke,ve,We,0,ve.length,0,q-C,Ho,Ho)}else _e=g(ke,ve,We,q-C,G-q,fe)}$.push(_e),Y.push(we)}function f(x,w,$,Y){let j=[],D=0,M=-1;for(;l.pos>w;){let{id:C,start:q,end:_,size:G}=l;if(G>4)l.next();else{if(M>-1&&q<M)break;M<0&&(M=_-n),j.push(C,q,_),D++,l.next()}}if(D){let C=new Uint16Array(D*4),q=j[j.length-2];for(let _=j.length-3,G=0;_>=0;_-=3)C[G++]=j[_],C[G++]=j[_+1]-q,C[G++]=j[_+2]-q,C[G++]=G;$.push(new Qt(C,j[2]-q,i)),Y.push(q-x)}}function u(x,w){return($,Y,j)=>{let D=0,M=$.length-1,C,q;if(M>=0&&(C=$[M])instanceof W){if(!M&&C.type==x&&C.length==j)return C;(q=C.prop(R.lookAhead))&&(D=Y[M]+C.length+q)}return g(x,$,Y,j,D,w)}}function d(x,w,$,Y,j,D,M,C,q){let _=[],G=[];for(;x.length>Y;)_.push(x.pop()),G.push(w.pop()+$-j);x.push(g(i.types[M],_,G,D-j,C-D,q)),w.push(j-$)}function g(x,w,$,Y,j,D,M){if(D){let C=[R.contextHash,D];M=M?[C].concat(M):[C]}if(j>25){let C=[R.lookAhead,j];M=M?[C].concat(M):[C]}return new W(x,w,$,Y,M)}function m(x,w){let $=l.fork(),Y=0,j=0,D=0,M=$.end-n,C={size:0,start:0,skip:0};e:for(let q=$.pos-x;$.pos>q;){let _=$.size;if($.id==w&&_>=0){C.size=Y,C.start=j,C.skip=D,D+=4,Y+=4,$.next();continue}let G=$.pos-_;if(_<0||G<q||$.start<M)break;let fe=$.id>=o?4:0,ke=$.start;for($.next();$.pos>G;){if($.size<0)if($.size==-3||$.size==-4)fe+=4;else break e;else $.id>=o&&(fe+=4);$.next()}j=ke,Y+=_,D+=fe}return(w<0||Y==x)&&(C.size=Y,C.start=j,C.skip=D),C.size>4?C:void 0}function Q(x,w,$){let{id:Y,start:j,end:D,size:M}=l;if(l.next(),M>=0&&Y<o){let C=$;if(M>4){let q=l.pos-(M-4);for(;l.pos>q;)$=Q(x,w,$)}w[--$]=C,w[--$]=D-x,w[--$]=j-x,w[--$]=Y}else M==-3?h=Y:M==-4&&(c=Y);return $}let S=[],y=[];for(;l.pos>0;)O(r.start||0,r.bufferStart||0,S,y,-1,0);let A=(e=r.length)!==null&&e!==void 0?e:S.length?y[0]+S[0].length:0;return new W(a[r.topID],S.reverse(),y.reverse(),A)}const el=new WeakMap;function Xr(r,e){if(!r.isAnonymous||e instanceof Qt||e.type!=r)return 1;let t=el.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=r||!(i instanceof W)){t=1;break}t+=Xr(r,i)}el.set(e,t)}return t}function co(r,e,t,i,n,s,o,l,a){let h=0;for(let d=i;d<n;d++)h+=Xr(r,e[d]);let c=Math.ceil(h*1.5/8),O=[],f=[];function u(d,g,m,Q,S){for(let y=m;y<Q;){let A=y,x=g[y],w=Xr(r,d[y]);for(y++;y<Q;y++){let $=Xr(r,d[y]);if(w+$>=c)break;w+=$}if(y==A+1){if(w>c){let $=d[A];u($.children,$.positions,0,$.children.length,g[A]+S);continue}O.push(d[A])}else{let $=g[y-1]+d[y-1].length-x;O.push(co(r,d,g,A,y,x,$,null,a))}f.push(x+S-s)}}return u(e,t,i,n,0),(l||a)(O,f,o)}class hh{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof Ne?this.setBuffer(e.context.buffer,e.index,t):e instanceof ce&&this.map.set(e.tree,t)}get(e){return e instanceof Ne?this.getBuffer(e.context.buffer,e.index):e instanceof ce?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class ot{constructor(e,t,i,n,s=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=n,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let n=[new ot(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&n.push(s);return n}static applyChanges(e,t,i=128){if(!t.length)return e;let n=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l<t.length?t[l]:null,O=c?c.fromA:1e9;if(O-a>=i)for(;o&&o.from<O;){let f=o;if(a>=f.from||O<=f.to||h){let u=Math.max(f.from,a)-h,d=Math.min(f.to,O)-h;f=u>=d?null:new ot(u,d,f.tree,f.offset+h,l>0,!!c)}if(f&&n.push(f),o.to>O)break;o=s<e.length?e[s++]:null}if(!c)break;a=c.toA,h=c.toA-c.toB}return n}}class Oo{startParse(e,t,i){return typeof e=="string"&&(e=new _f(e)),i=i?i.length?i.map(n=>new Te(n.from,n.to)):[new Te(0,0)]:[new Te(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let n=this.startParse(e,t,i);for(;;){let s=n.advance();if(s)return s}}}class _f{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function ch(r){return(e,t,i,n)=>new Vf(e,r,t,i,n)}class tl{constructor(e,t,i,n,s,o){this.parser=e,this.parse=t,this.overlay=i,this.bracketed=n,this.target=s,this.from=o}}function il(r){if(!r.length||r.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(r))}class Wf{constructor(e,t,i,n,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=i,this.index=n,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const ls=new R({perNode:!0});class Vf{constructor(e,t,i,n,s){this.nest=t,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new W(i.type,i.children,i.positions,i.length,i.propValues.concat([[ls,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[R.mounted.id]=new Ht(t,e.overlay,e.parser,e.bracketed),e.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new Bf(this.fragments),t=null,i=null,n=new _r(new ce(this.baseTree,this.ranges[0].from,0,null),E.IncludeAnonymous|E.IgnoreMounts);e:for(let s,o;;){let l=!0,a;if(this.stoppedAt!=null&&n.from>=this.stoppedAt)l=!1;else if(e.hasNode(n)){if(t){let h=t.mounts.find(c=>c.frag.from<=n.from&&c.frag.to>=n.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let O=c.from+h.pos,f=c.to+h.pos;O>=n.from&&f<=n.to&&!t.ranges.some(u=>u.from<f&&u.to>O)&&t.ranges.push({from:O,to:f})}}l=!1}else if(i&&(o=Ef(i.ranges,n.from,n.to)))l=o!=2;else if(!n.type.isAnonymous&&(s=this.nest(n,this.input))&&(n.from<n.to||!s.overlay)){n.tree||(qf(n),t&&t.depth++,i&&i.depth++);let h=e.findMounts(n.from,s.parser);if(typeof s.overlay=="function")t=new Wf(s.parser,s.overlay,h,this.inner.length,n.from,!!s.bracketed,n.tree,t);else{let c=sl(this.ranges,s.overlay||(n.from<n.to?[new Te(n.from,n.to)]:[]));c.length&&il(c),(c.length||!s.overlay)&&this.inner.push(new tl(s.parser,c.length?s.parser.startParse(this.input,ol(h,c),c):s.parser.startParse(""),s.overlay?s.overlay.map(O=>new Te(O.from-n.from,O.to-n.from)):null,!!s.bracketed,n.tree,c.length?c[0].from:n.from)),s.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):l=!1}}else if(t&&(a=t.predicate(n))&&(a===!0&&(a=new Te(n.from,n.to)),a.from<a.to)){let h=t.ranges.length-1;h>=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&n.firstChild())t&&t.depth++,i&&i.depth++;else for(;!n.nextSibling();){if(!n.parent())break e;if(t&&!--t.depth){let h=sl(this.ranges,t.ranges);h.length&&(il(h),this.inner.splice(t.index,0,new tl(t.parser,t.parser.startParse(this.input,ol(t.mounts,h),h),t.ranges.map(c=>new Te(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function Ef(r,e,t){for(let i of r){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function rl(r,e,t,i,n,s){if(e<t){let o=r.buffer[e+1];i.push(r.slice(e,t,o)),n.push(o-s)}}function qf(r){let{node:e}=r,t=[],i=e.context.buffer;do t.push(r.index),r.parent();while(!r.tree);let n=r.tree,s=n.children.indexOf(i),o=n.children[s],l=o.buffer,a=[s];function h(c,O,f,u,d,g){let m=t[g],Q=[],S=[];rl(o,c,m,Q,S,u);let y=l[m+1],A=l[m+2];a.push(Q.length);let x=g?h(m+4,l[m+3],o.set.types[l[m]],y,A-y,g-1):e.toTree();return Q.push(x),S.push(y-u),rl(o,l[m+3],O,Q,S,u),new W(f,Q,S,d)}n.children[s]=h(0,l.length,re.none,0,o.length,t.length-1);for(let c of a){let O=r.tree.children[c],f=r.tree.positions[c];r.yield(new ce(O,f+r.from,c,r._tree))}}class nl{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(E.IncludeAnonymous|E.IgnoreMounts)}moveTo(e){let{cursor:t}=this,i=e-this.offset;for(;!this.done&&t.from<i;)if(!(t.to>=e&&t.enter(i,1,E.IgnoreOverlays|E.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof W)t=t.children[0];else break}return!1}}let Bf=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(t=i.tree.prop(ls))!==null&&t!==void 0?t:i.to,this.inner=new nl(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(ls))!==null&&e!==void 0?e:t.to,this.inner=new nl(t.tree,-t.offset)}}findMounts(e,t){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(i=s.tree)===null||i===void 0?void 0:i.prop(R.mounted);if(o&&o.parser==t)for(let l=this.fragI;l<this.fragments.length;l++){let a=this.fragments[l];if(a.from>=s.to)break;a.tree==this.curFrag.tree&&n.push({frag:a,pos:s.from-a.offset,mount:o})}}}return n}};function sl(r,e){let t=null,i=e;for(let n=1,s=0;n<r.length;n++){let o=r[n-1].to,l=r[n].from;for(;s<i.length;s++){let a=i[s];if(a.from>=l)break;a.to<=o||(t||(i=t=e.slice()),a.from<o?(t[s]=new Te(a.from,o),a.to>l&&t.splice(s+1,0,new Te(l,a.to))):a.to>l?t[s--]=new Te(l,a.to):t.splice(s--,1))}}return i}function Df(r,e,t,i){let n=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=n==r.length?1e9:o?r[n].to:r[n].from,O=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),u=Math.min(c,O,i);f<u&&h.push(new Te(f,u))}if(a=Math.min(c,O),a==1e9)break;c==a&&(o?(o=!1,n++):o=!0),O==a&&(l?(l=!1,s++):l=!0)}return h}function ol(r,e){let t=[];for(let{pos:i,mount:n,frag:s}of r){let o=i+(n.overlay?n.overlay[0].from:0),l=o+n.tree.length,a=Math.max(s.from,o),h=Math.min(s.to,l);if(n.overlay){let c=n.overlay.map(f=>new Te(f.from+i,f.to+i)),O=Df(e,c,a,h);for(let f=0,u=a;;f++){let d=f==O.length,g=d?h:O[f].from;if(g>u&&t.push(new ot(u,g,n.tree,-o,s.from>=u||s.openStart,s.to<=g||s.openEnd)),d)break;u=O[f].to}}else t.push(new ot(a,h,n.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}var ll={};class Wr{constructor(e,t,i,n,s,o,l,a,h,c=0,O){this.p=e,this.stack=t,this.state=i,this.reducePos=n,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=O}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let n=e.parser.context;return new Wr(e,[],t,i,i,0,[],0,n?new al(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,n=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),l=s.dynamicPrecedence(n);if(l&&(this.score+=l),i==0){n<s.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n<s.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(n,this.reducePos);return}let a=this.stack.length-(i-1)*3-(e&262144?6:0),h=a?this.stack[a-2]:this.p.ranges[0].from;n<s.minRepeatTerm&&h==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-h;c>=2e3&&!(!((t=this.p.parser.nodeSet.types[n])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=c));let O=a?this.stack[a-1]:0,f=this.bufferBase+this.buffer.length-O;if(n<s.minRepeatTerm||e&131072){let u=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,h,u,f+4,!0)}if(e&262144)this.state=this.stack[a];else{let u=this.stack[a-3];this.state=s.getGoto(u,n,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(n,h)}storeNode(e,t,i,n=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this.buffer.length;if(o>0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==i)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(e,t,i,n);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>i;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=n}}shift(e,t,i,n){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;this.pos=n;let l=o.stateFlag(s,1);!l&&(n>i||t<=o.maxNode)&&(this.reducePos=n),this.pushState(s,l?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,n,4)}else this.pos=n,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,n,4)}apply(e,t,i,n){e&65536?this.reduce(e):this.shift(e,t,i,n)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),n=e.bufferBase+t;for(;e&&n==e.bufferBase;)e=e.parent;return new Wr(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new If(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&n.push(t[s],o);if(this.stack.length<120)for(let s=0;n.length<8&&s<t.length;s+=2){let o=t[s+1];n.some((l,a)=>a&1&&l==o)||n.push(t[s],o)}t=n}let i=[];for(let n=0;n<t.length&&i.length<4;n+=2){let s=t[n+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[n],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let i=t>>19,n=t&65535,s=this.stack.length-i*3;if(s<0||e.getGoto(this.stack[s],n,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(n,s)=>{if(!t.includes(n))return t.push(n),e.allActions(n,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=i(o,s+1);if(l!=null)return l}})};return i(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(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new al(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class al{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class If{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=n}}class Vr{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Vr(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.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 Vr(this.stack,this.pos,this.index)}}function Ti(r,e=Uint16Array){if(typeof r!="string")return r;let t=null;for(let i=0,n=0;i<r.length;){let s=0;for(;;){let o=r.charCodeAt(i++),l=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[n++]=s:t=new e(s)}return t}class Zr{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const hl=new Zr;class Gf{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=hl,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,n=this.rangeIndex,s=this.pos+e;for(;s<i.from;){if(!n)return null;let o=this.ranges[--n];s-=i.from-o.to,i=o}for(;t<0?s>i.to:s>=i.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];s+=o.from-i.to,i=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,n;if(t>=0&&t<this.chunk.length)i=this.pos+e,n=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(i=s,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let o=this.rangeIndex,l=this.range;for(;l.to<=i;)l=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),n=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),n}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,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(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,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(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=hl,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let n of this.ranges){if(n.from>=t)break;n.to>e&&(i+=this.input.read(Math.max(n.from,e),Math.min(n.to,t)))}return i}}class Kt{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;Oh(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}Kt.prototype.contextual=Kt.prototype.fallback=Kt.prototype.extend=!1;class Er{constructor(e,t,i){this.precTable=t,this.elseToken=i,this.data=typeof e=="string"?Ti(e):e}token(e,t){let i=e.pos,n=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Oh(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||n++,o==null)break;e.reset(o,e.token)}n&&(e.reset(i,e.token),e.acceptToken(this.elseToken,n))}}Er.prototype.contextual=Kt.prototype.fallback=Kt.prototype.extend=!1;class le{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Oh(r,e,t,i,n,s){let o=0,l=1<<i,{dialect:a}=t.p.parser;e:for(;(l&r[o])!=0;){let h=r[o+1];for(let u=o+3;u<h;u+=2)if((r[u+1]&l)>0){let d=r[u];if(a.allows(d)&&(e.token.value==-1||e.token.value==d||Nf(d,e.token.value,n,s))){e.acceptToken(d);break}}let c=e.next,O=0,f=r[o+2];if(e.next<0&&f>O&&r[h+f*3-3]==65535){o=r[h+f*3-1];continue e}for(;O<f;){let u=O+f>>1,d=h+u+(u<<1),g=r[d],m=r[d+1]||65536;if(c<g)f=u;else if(c>=m)O=u+1;else{o=r[d+2],e.advance();continue e}}break}}function cl(r,e,t){for(let i=e,n;(n=r[i])!=65535;i++)if(n==t)return i-e;return-1}function Nf(r,e,t,i){let n=cl(t,i,e);return n<0||cl(t,i,r)<n}const ye=typeof process<"u"&&ll&&/\bparse\b/.test(ll.LOG);let wn=null;function Ol(r,e,t){let i=r.cursor(E.IncludeAnonymous);for(i.moveTo(e);;)if(!(t<0?i.childBefore(e):i.childAfter(e)))for(;;){if((t<0?i.to<e:i.from>e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(r.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:r.length}}let Uf=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Ol(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Ol(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let i=this.trees[t],n=this.index[t];if(n==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=i.children[n],o=this.start[t]+i.positions[n];if(o>e)return this.nextStart=o,null;if(s instanceof W){if(o==e){if(o<this.safeFrom)return null;let l=o+s.length;if(l<=this.safeTo){let a=s.prop(R.lookAhead);if(!a||l+a<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}};class Ff{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Zr)}getActions(e){let t=0,i=null,{parser:n}=e.p,{tokenizers:s}=n,o=n.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;h<s.length;h++){if((1<<h&o)==0)continue;let c=s[h],O=this.tokens[h];if(!(i&&!c.fallback)&&((c.contextual||O.start!=e.pos||O.mask!=o||O.context!=l)&&(this.updateCachedToken(O,c,e),O.mask=o,O.context=l),O.lookAhead>O.end+25&&(a=Math.max(O.lookAhead,a)),O.value!=0)){let f=t;if(O.extended>-1&&(t=this.addActions(e,O.extended,O.end,t)),t=this.addActions(e,O.value,O.end,t),!c.extend&&(i=O,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!i&&e.pos==this.stream.end&&(i=new Zr,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Zr,{pos:i,p:n}=e;return t.start=i,t.end=Math.min(i+1,n.stream.end),t.value=i==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,i){let n=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(n,e),i),e.value>-1){let{parser:s}=i.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let l=s.specializers[o](this.stream.read(e.start,e.end),i);if(l>=0&&i.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,t,i,n){for(let s=0;s<n;s+=3)if(this.actions[s]==e)return n;return this.actions[n++]=e,this.actions[n++]=t,this.actions[n++]=i,n}addActions(e,t,i,n){let{state:s}=e,{parser:o}=e.p,{data:l}=o;for(let a=0;a<2;a++)for(let h=o.stateSlot(s,a?2:1);;h+=3){if(l[h]==65535)if(l[h+1]==1)h=rt(l,h+2);else{n==0&&l[h+1]==2&&(n=this.putAction(rt(l,h+2),t,i,n));break}l[h]==t&&(n=this.putAction(rt(l,h+1),t,i,n))}return n}}class Hf{constructor(e,t,i,n){this.parser=e,this.input=t,this.ranges=n,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 Gf(t,n),this.tokens=new Ff(e,this.stream),this.topTerm=e.top[1];let{from:s}=n[0];this.stacks=[Wr.start(this,e.top[0],s)],this.fragments=i.length&&this.stream.end-s>e.bufferLength*4?new Uf(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],n,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let l=e[o];for(;;){if(this.tokens.mainToken=null,l.pos>t)i.push(l);else{if(this.advanceStack(l,i,e))continue;{n||(n=[],s=[]),n.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!i.length){let o=n&&Jf(n);if(o)return ye&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ye&&n&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,s,i);if(o)return ye&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,a)=>a.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o<i.length-1;o++){let l=i[o];for(let a=o+1;a<i.length;a++){let h=i[a];if(l.sameState(h)||l.buffer.length>500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)i.splice(a--,1);else{i.splice(o--,1);continue e}}}i.length>12&&(i.sort((o,l)=>l.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o<i.length;o++)i[o].pos<this.minStackPos&&(this.minStackPos=i[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,i){let n=e.pos,{parser:s}=this,o=ye?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let O=this.fragments.nodeAt(n);O;){let f=this.parser.nodeSet.types[O.type.id]==O.type?s.getGoto(e.state,O.type.id):-1;if(f>-1&&O.length&&(!h||(O.prop(R.contextHash)||0)==c))return e.useNode(O,f),ye&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(O.type.id)})`),!0;if(!(O instanceof W)||O.children.length==0||O.positions[0]>0)break;let u=O.children[0];if(u instanceof W&&O.positions[0]==0)O=u;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),ye&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;h<a.length;){let c=a[h++],O=a[h++],f=a[h++],u=h==a.length||!i,d=u?e:e.split(),g=this.tokens.mainToken;if(d.apply(c,O,g?g.start:d.pos,f),ye&&console.log(o+this.stackID(d)+` (via ${(c&65536)==0?"shift":`reduce of ${s.getName(c&65535)}`} for ${s.getName(O)} @ ${n}${d==e?"":", split"})`),u)return!0;d.pos>n?t.push(d):i.push(d)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return fl(e,t),!0}}runRecovery(e,t,i){let n=null,s=!1;for(let o=0;o<e.length;o++){let l=e[o],a=t[o<<1],h=t[(o<<1)+1],c=ye?this.stackID(l)+" -> ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),ye&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let O=l.split(),f=c;for(let u=0;u<10&&O.forceReduce()&&(ye&&console.log(f+this.stackID(O)+" (via force-reduce)"),!this.advanceFully(O,i));u++)ye&&(f=this.stackID(O)+" -> ");for(let u of l.recoverByInsert(a))ye&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,i);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),ye&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),fl(l,i)):(!n||n.score<O.score)&&(n=O)}return n}stackToTree(e){return e.close(),W.build({buffer:Vr.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(wn||(wn=new WeakMap)).get(e);return t||wn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function fl(r,e){for(let t=0;t<e.length;t++){let i=e[t];if(i.pos==r.pos&&i.sameState(r)){e[t].score<r.score&&(e[t]=r);return}}e.push(r)}class Kf{constructor(e,t,i){this.source=e,this.flags=t,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}const vn=r=>r;class fo{constructor(e){this.start=e.start,this.shift=e.shift||vn,this.reduce=e.reduce||vn,this.reuse=e.reuse||vn,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class St extends Oo{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;l<e.repeatNodeCount;l++)t.push("");let i=Object.keys(e.topRules).map(l=>e.topRules[l][1]),n=[];for(let l=0;l<t.length;l++)n.push([]);function s(l,a,h){n[l].push([a,a.deserialize(String(h))])}if(e.nodeProps)for(let l of e.nodeProps){let a=l[0];typeof a=="string"&&(a=R[a]);for(let h=1;h<l.length;){let c=l[h++];if(c>=0)s(c,a,l[h++]);else{let O=l[h+-c];for(let f=-c;f>0;f--)s(l[h++],a,O);h++}}}this.nodeSet=new ir(t.map((l,a)=>re.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:n[a],top:i.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=sh;let o=Ti(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(ul),this.states=Ti(e.states,Uint32Array),this.data=Ti(e.stateData),this.goto=Ti(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(l=>typeof l=="number"?new Kt(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let n=new Hf(this,e,t,i);for(let s of this.wrappers)n=s(n,e,t,i);return n}getGoto(e,t,i=!1){let n=this.goto;if(t>=n[0])return-1;for(let s=n[t+1];;){let o=n[s++],l=o&1,a=n[s++];if(l&&i)return a;for(let h=s+(o>>1);s<h;s++)if(n[s]==e)return a;if(l)return-1}}hasAction(e,t){let i=this.data;for(let n=0;n<2;n++)for(let s=this.stateSlot(e,n?2:1),o;;s+=3){if((o=i[s])==65535)if(i[s+1]==1)o=i[s=rt(i,s+2)];else{if(i[s+1]==2)return rt(i,s+2);break}if(o==t||o==0)return rt(i,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),n=i?t(i):void 0;for(let s=this.stateSlot(e,1);n==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=rt(this.data,s+2);else break;n=t(rt(this.data,s+1))}return n}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=rt(this.data,i+2);else break;if((this.data[i+2]&1)==0){let n=this.data[i+1];t.some((s,o)=>o&1&&s==n)||t.push(this.data[i],n)}}return t}configure(e){let t=Object.assign(Object.create(St.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let n=e.tokenizers.find(s=>s.from==i);return n?n.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,n)=>{let s=e.specializers.find(l=>l.from==i.external);if(!s)return i;let o=Object.assign(Object.assign({},i),{external:s.to});return t.specializers[n]=ul(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(i[o]=!0)}let n=null;for(let s=0;s<t.length;s++)if(!i[s])for(let o=this.dialects[t[s]],l;(l=this.data[o++])!=65535;)(n||(n=new Uint8Array(this.maxTerm+1)))[l]=1;return new Kf(e,i,n)}static deserialize(e){return new St(e)}}function rt(r,e){return r[e]|r[e+1]<<16}function Jf(r){let e=null;for(let t of r){let i=t.p.stoppedAt;(t.pos==t.p.stream.end||i!=null&&t.pos>i)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function ul(r){if(r.external){let e=r.extend?1:0;return(t,i)=>r.external(t,i)<<1|e}return r.get}let eu=0,De=class as{constructor(e,t,i,n){this.name=e,this.set=t,this.base=i,this.modified=n,this.id=eu++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof as&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let n=new as(i,[],null,[]);if(n.set.push(n),t)for(let s of t.set)n.set.push(s);return n}static defineModifier(e){let t=new qr(e);return i=>i.modified.indexOf(t)>-1?i:qr.get(i.base||i,i.modified.concat(t).sort((n,s)=>n.id-s.id))}},tu=0;class qr{constructor(e){this.name=e,this.instances=[],this.id=tu++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&iu(t,l.modified));if(i)return i;let n=[],s=new De(e.name,n,e,t);for(let l of t)l.instances.push(s);let o=ru(t);for(let l of e.set)if(!l.modified.length)for(let a of o)n.push(qr.get(l,a));return s}}function iu(r,e){return r.length==e.length&&r.every((t,i)=>t==e[i])}function ru(r){let e=[[]];for(let t=0;t<r.length;t++)for(let i=0,n=e.length;i<n;i++)e.push(e[i].concat(r[t]));return e.sort((t,i)=>i.length-t.length)}function $t(r){let e=Object.create(null);for(let t in r){let i=r[t];Array.isArray(i)||(i=[i]);for(let n of t.split(" "))if(n){let s=[],o=2,l=n;for(let O=0;;){if(l=="..."&&O>0&&O+3==n.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+n);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),O+=f[0].length,O==n.length)break;let u=n[O++];if(O==n.length&&u=="!"){o=0;break}if(u!="/")throw new RangeError("Invalid path: "+n);l=n.slice(O)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+n);let c=new Vi(i,o,a>0?s.slice(0,a):null);e[h]=c.sort(e[h])}}return fh.add(e)}const fh=new R({combine(r,e){let t,i,n;for(;r||e;){if(!r||e&&r.depth>=e.depth?(n=e,e=e.next):(n=r,r=r.next),t&&t.mode==n.mode&&!n.context&&!t.context)continue;let s=new Vi(n.tags,n.mode,n.context);t?t.next=s:i=s,t=s}return i}});class Vi{constructor(e,t,i,n){this.tags=e,this.mode=t,this.context=i,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Vi.empty=new Vi([],2,null);function uh(r,e){let t=Object.create(null);for(let s of r)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:i,all:n=null}=e||{};return{style:s=>{let o=n;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function nu(r,e){let t=null;for(let i of r){let n=i.style(e);n&&(t=t?t+" "+n:n)}return t}function su(r,e,t,i=0,n=r.length){let s=new ou(i,Array.isArray(e)?e:[e],t);s.highlightRange(r.cursor(),i,n,"",s.highlighters),s.flush(n)}class ou{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,n,s){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(s=this.highlighters.filter(u=>!u.scope||u.scope(o)));let h=n,c=lu(e)||Vi.empty,O=nu(s,c.tags);if(O&&(h&&(h+=" "),h+=O,c.mode==1&&(n+=(n?" ":"")+O)),this.startSpan(Math.max(t,l),h),c.opaque)return;let f=e.tree&&e.tree.prop(R.mounted);if(f&&f.overlay){let u=e.node.enter(f.overlay[0].from+l,1),d=this.highlighters.filter(m=>!m.scope||m.scope(f.tree.type)),g=e.firstChild();for(let m=0,Q=l;;m++){let S=m<f.overlay.length?f.overlay[m]:null,y=S?S.from+l:a,A=Math.max(t,Q),x=Math.min(i,y);if(A<x&&g)for(;e.from<x&&(this.highlightRange(e,A,x,n,s),this.startSpan(Math.min(x,e.to),h),!(e.to>=y||!e.nextSibling())););if(!S||y>i)break;Q=S.to+l,Q>t&&(this.highlightRange(u.cursor(),Math.max(t,S.from+l),Math.min(i,Q),"",d),this.startSpan(Math.min(i,Q),h))}g&&e.parent()}else if(e.firstChild()){f&&(n="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,n,s),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function lu(r){let e=r.type.prop(fh);for(;e&&e.context&&!r.matchContext(e.context);)e=e.next;return e||null}const P=De.define,fr=P(),dt=P(),dl=P(dt),pl=P(dt),pt=P(),ur=P(pt),Tn=P(pt),Be=P(),Tt=P(Be),Ve=P(),Ee=P(),hs=P(),bi=P(hs),dr=P(),p={comment:fr,lineComment:P(fr),blockComment:P(fr),docComment:P(fr),name:dt,variableName:P(dt),typeName:dl,tagName:P(dl),propertyName:pl,attributeName:P(pl),className:P(dt),labelName:P(dt),namespace:P(dt),macroName:P(dt),literal:pt,string:ur,docString:P(ur),character:P(ur),attributeValue:P(ur),number:Tn,integer:P(Tn),float:P(Tn),bool:P(pt),regexp:P(pt),escape:P(pt),color:P(pt),url:P(pt),keyword:Ve,self:P(Ve),null:P(Ve),atom:P(Ve),unit:P(Ve),modifier:P(Ve),operatorKeyword:P(Ve),controlKeyword:P(Ve),definitionKeyword:P(Ve),moduleKeyword:P(Ve),operator:Ee,derefOperator:P(Ee),arithmeticOperator:P(Ee),logicOperator:P(Ee),bitwiseOperator:P(Ee),compareOperator:P(Ee),updateOperator:P(Ee),definitionOperator:P(Ee),typeOperator:P(Ee),controlOperator:P(Ee),punctuation:hs,separator:P(hs),bracket:bi,angleBracket:P(bi),squareBracket:P(bi),paren:P(bi),brace:P(bi),content:Be,heading:Tt,heading1:P(Tt),heading2:P(Tt),heading3:P(Tt),heading4:P(Tt),heading5:P(Tt),heading6:P(Tt),contentSeparator:P(Be),list:P(Be),quote:P(Be),emphasis:P(Be),strong:P(Be),link:P(Be),monospace:P(Be),strikethrough:P(Be),inserted:P(),deleted:P(),changed:P(),invalid:P(),meta:dr,documentMeta:P(dr),annotation:P(dr),processingInstruction:P(dr),definition:De.defineModifier("definition"),constant:De.defineModifier("constant"),function:De.defineModifier("function"),standard:De.defineModifier("standard"),local:De.defineModifier("local"),special:De.defineModifier("special")};for(let r in p){let e=p[r];e instanceof De&&(e.name=r)}uh([{tag:p.link,class:"tok-link"},{tag:p.heading,class:"tok-heading"},{tag:p.emphasis,class:"tok-emphasis"},{tag:p.strong,class:"tok-strong"},{tag:p.keyword,class:"tok-keyword"},{tag:p.atom,class:"tok-atom"},{tag:p.bool,class:"tok-bool"},{tag:p.url,class:"tok-url"},{tag:p.labelName,class:"tok-labelName"},{tag:p.inserted,class:"tok-inserted"},{tag:p.deleted,class:"tok-deleted"},{tag:p.literal,class:"tok-literal"},{tag:p.string,class:"tok-string"},{tag:p.number,class:"tok-number"},{tag:[p.regexp,p.escape,p.special(p.string)],class:"tok-string2"},{tag:p.variableName,class:"tok-variableName"},{tag:p.local(p.variableName),class:"tok-variableName tok-local"},{tag:p.definition(p.variableName),class:"tok-variableName tok-definition"},{tag:p.special(p.variableName),class:"tok-variableName2"},{tag:p.definition(p.propertyName),class:"tok-propertyName tok-definition"},{tag:p.typeName,class:"tok-typeName"},{tag:p.namespace,class:"tok-namespace"},{tag:p.className,class:"tok-className"},{tag:p.macroName,class:"tok-macroName"},{tag:p.propertyName,class:"tok-propertyName"},{tag:p.operator,class:"tok-operator"},{tag:p.comment,class:"tok-comment"},{tag:p.meta,class:"tok-meta"},{tag:p.invalid,class:"tok-invalid"},{tag:p.punctuation,class:"tok-punctuation"}]);const au=135,gl=1,hu=136,cu=137,dh=2,Ou=138,fu=3,uu=4,ph=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],du=58,pu=40,gh=95,gu=91,Cr=45,mu=46,Qu=35,Su=37,bu=38,ku=92,yu=10,xu=42;function Ei(r){return r>=65&&r<=90||r>=97&&r<=122||r>=161}function uo(r){return r>=48&&r<=57}function ml(r){return uo(r)||r>=97&&r<=102||r>=65&&r<=70}const mh=(r,e,t)=>(i,n)=>{for(let s=!1,o=0,l=0;;l++){let{next:a}=i;if(Ei(a)||a==Cr||a==gh||s&&uo(a))!s&&(a!=Cr||l>0)&&(s=!0),o===l&&a==Cr&&o++,i.advance();else if(a==ku&&i.peek(1)!=yu){if(i.advance(),ml(i.next)){do i.advance();while(ml(i.next));i.next==32&&i.advance()}else i.next>-1&&i.advance();s=!0}else{s&&i.acceptToken(o==2&&n.canShift(dh)?e:a==pu?t:r);break}}},Pu=new le(mh(hu,dh,cu),{contextual:!0}),$u=new le(mh(Ou,fu,uu),{contextual:!0}),wu=new le(r=>{if(ph.includes(r.peek(-1))){let{next:e}=r;(Ei(e)||e==gh||e==Qu||e==mu||e==xu||e==gu||e==du&&Ei(r.peek(1))||e==Cr||e==bu)&&r.acceptToken(au)}}),vu=new le(r=>{if(!ph.includes(r.peek(-1))){let{next:e}=r;if(e==Su&&(r.advance(),r.acceptToken(gl)),Ei(e)){do r.advance();while(Ei(r.next)||uo(r.next));r.acceptToken(gl)}}}),Tu=$t({"AtKeyword import charset namespace keyframes media supports font-feature-values":p.definitionKeyword,"from to selector scope MatchFlag":p.keyword,NamespaceName:p.namespace,KeyframeName:p.labelName,KeyframeRangeName:p.operatorKeyword,TagName:p.tagName,ClassName:p.className,PseudoClassName:p.constant(p.className),IdName:p.labelName,"FeatureName PropertyName":p.propertyName,AttributeName:p.attributeName,NumberLiteral:p.number,KeywordQuery:p.keyword,UnaryQueryOp:p.operatorKeyword,"CallTag ValueName FontName":p.atom,VariableName:p.variableName,Callee:p.operatorKeyword,Unit:p.unit,"UniversalSelector NestingSelector":p.definitionOperator,"MatchOp CompareOp":p.compareOperator,"ChildOp SiblingOp, LogicOp":p.logicOperator,BinOp:p.arithmeticOperator,Important:p.modifier,Comment:p.blockComment,ColorLiteral:p.color,"ParenthesizedContent StringLiteral":p.string,":":p.punctuation,"PseudoOp #":p.derefOperator,"; , |":p.separator,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace}),Xu={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:90,url:132,"url-prefix":132,domain:132,regexp:132},Zu={__proto__:null,or:104,and:104,not:112,only:112,layer:186},Cu={__proto__:null,selector:118,layer:182},Ru={__proto__:null,"@import":178,"@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Z&iQ#z!cQ&h%`R'j'YR%i$RR%X#oQpPR#n!RQ!yeQ$d!qR%q$e",nodeNames:"⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NamespacedTagSelector NamespaceName TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , PseudoQuery CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName NamespacedAttribute NamespaceName AttributeName MatchOp MatchFlag ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to FontFeatureStatement font-feature-values FontName AtRule Styles",maxTerm:159,nodeProps:[["isolate",-2,5,39,""],["openedBy",23,"(",31,"[",34,"{"],["closedBy",24,")",32,"]",35,"}"]],propSources:[Tu],skippedNodes:[0,5,117],repeatNodeCount:17,tokenData:"K`~R!bOX%ZX^&R^p%Zpq&Rqr)ers)vst+jtu2Xuv%Zvw3Rwx3dxy5Ryz5dz{5i{|6S|}:u}!O;W!O!P;u!P!Q<^!Q![=V![!]>Q!]!^>|!^!_?_!_!`@Z!`!a@n!a!b%Z!b!cAo!c!k%Z!k!lC|!l!u%Z!u!vC|!v!}%Z!}#OD_#O#P%Z#P#QDp#Q#R2X#R#]%Z#]#^ER#^#g%Z#g#hC|#h#o%Z#o#pIf#p#qIw#q#rJ`#r#sJq#s#y%Z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t=cs.length;;){let i=e+t>>1;if(r<cs[i])t=i;else if(r>=Qh[i])e=i+1;else return!0;if(e==t)return!1}}function Ql(r){return r>=127462&&r<=127487}const Sl=8205;function zu(r,e,t=!0,i=!0){return(t?Sh:Lu)(r,e,i)}function Sh(r,e,t){if(e==r.length)return e;e&&bh(r.charCodeAt(e))&&kh(r.charCodeAt(e-1))&&e--;let i=Xn(r,e);for(e+=bl(i);e<r.length;){let n=Xn(r,e);if(i==Sl||n==Sl||t&&ju(n))e+=bl(n),i=n;else if(Ql(n)){let s=0,o=e-2;for(;o>=0&&Ql(Xn(r,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Lu(r,e,t){for(;e>0;){let i=Sh(r,e-2,t);if(i<e)return i;e--}return 0}function Xn(r,e){let t=r.charCodeAt(e);if(!kh(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return bh(i)?(t-55296<<10)+(i-56320)+65536:t}function bh(r){return r>=56320&&r<57344}function kh(r){return r>=55296&&r<56320}function bl(r){return r<65536?1:2}class L{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=ni(this,e,t);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(t,this.length,n,1),Ie.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ni(this,e,t);let i=[];return this.decompose(e,t,i,0),Ie.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new Ri(this),s=new Ri(e);for(let o=t,l=t;;){if(n.next(o),s.next(o),o=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(l+=n.value.length,n.done||l>=i)return!0}}iter(e=1){return new Ri(this,e)}iterRange(e,t=this.length){return new yh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new xh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?L.empty:e.length<=32?new ee(e):Ie.from(ee.split(e,[]))}}class ee extends L{constructor(e,t=Yu(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let s=0;;s++){let o=this.text[s],l=n+o.length;if((t?i:l)>=e)return new _u(n,l,i,o);n=l+1,i++}}decompose(e,t,i,n){let s=e<=0&&t>=this.length?this:new ee(kl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let o=i.pop(),l=Rr(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new ee(l,o.length+s.length));else{let a=l.length>>1;i.push(new ee(l.slice(0,a)),new ee(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof ee))return super.replace(e,t,i);[e,t]=ni(this,e,t);let n=Rr(this.text,Rr(i.text,kl(this.text,0,e)),t),s=this.length+i.length-(t-e);return n.length<=32?new ee(n,s):Ie.from(ee.split(n,[]),s)}sliceString(e,t=this.length,i=`
2
2
  `){[e,t]=ni(this,e,t);let n="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(n+=i),e<a&&t>s&&(n+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],n=-1;for(let s of e)i.push(s),n+=s.length+1,i.length==32&&(t.push(new ee(i,n)),i=[],n=-1);return n>-1&&t.push(new ee(i,n)),t}}class Ie extends L{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,n){for(let s=0;;s++){let o=this.children[s],l=n+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,n);n=l+1,i=a+1}}decompose(e,t,i,n){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let h=n&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=ni(this,e,t),i.lines<this.lines)for(let n=0,s=0;n<this.children.length;n++){let o=this.children[n],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[n]=a,new Ie(c,this.length-(t-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
3
3
  `){[e,t]=ni(this,e,t);let n="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(n+=i),e<a&&t>o&&(n+=l.sliceString(e-o,t-o,i)),o=a+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ie))return 0;let i=0,[n,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,s+=t){if(n==o||s==l)return i;let a=this.children[n],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let u of e)i+=u.lines;if(i<32){let u=[];for(let d of e)d.flatten(u);return new ee(u,t)}let n=Math.max(32,i>>5),s=n<<1,o=n>>1,l=[],a=0,h=-1,c=[];function O(u){let d;if(u.lines>s&&u instanceof Ie)for(let g of u.children)O(g);else u.lines>o&&(a>o||!a)?(f(),l.push(u)):u instanceof ee&&a&&(d=c[c.length-1])instanceof ee&&u.lines+d.lines<=32?(a+=u.lines,h+=u.length+1,c[c.length-1]=new ee(d.text.concat(u.text),d.length+1+u.length)):(a+u.lines>n&&f(),a+=u.lines,h+=u.length+1,c.push(u))}function f(){a!=0&&(l.push(c.length==1?c[0]:Ie.from(c,h)),h=-1,a=c.length=0)}for(let u of e)O(u);return f(),l.length==1?l[0]:new Ie(l,t)}}L.empty=new ee([""],0);function Yu(r){let e=-1;for(let t of r)e+=t.length+1;return e}function Rr(r,e,t=0,i=1e9){for(let n=0,s=0,o=!0;s<r.length&&n<=i;s++){let l=r[s],a=n+l.length;a>=t&&(a>i&&(l=l.slice(0,i-n)),n<t&&(l=l.slice(t-n)),o?(e[e.length-1]+=l,o=!1):e.push(l)),n=a+1}return e}function kl(r,e,t){return Rr(r,[""],e,t)}class Ri{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof ee?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],s=this.offsets[i],o=s>>1,l=n instanceof ee?n.text.length:n.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
4
4
  `,this;e--}else if(n instanceof ee){let a=n.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=n.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof ee?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class yh{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ri(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=i?n:t<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class xh{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(L.prototype[Symbol.iterator]=function(){return this.iter()},Ri.prototype[Symbol.iterator]=yh.prototype[Symbol.iterator]=xh.prototype[Symbol.iterator]=function(){return this});let _u=class{constructor(e,t,i,n){this.from=e,this.to=t,this.number=i,this.text=n}get length(){return this.to-this.from}};function ni(r,e,t){return e=Math.max(0,Math.min(r.length,e)),[e,Math.max(e,Math.min(r.length,t))]}function he(r,e,t=!0,i=!0){return zu(r,e,t,i)}function Wu(r){return r>=56320&&r<57344}function Vu(r){return r>=55296&&r<56320}function Ph(r,e){let t=r.charCodeAt(e);if(!Vu(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return Wu(i)?(t-55296<<10)+(i-56320)+65536:t}function Eu(r){return r<65536?1:2}const Os=/\r\n?|\n/;var de=(function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r})(de||(de={}));class Ke{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,n=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,n,s),n+=s):n+=o,i+=s}}iterChangedRanges(e,t=!1){fs(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];n<0?e.push(i,n):e.push(n,i)}return new Ke(e)}composeDesc(e){return this.empty?e:e.empty?this:$h(this,e)}mapDesc(e,t=!1){return e.empty?this:us(this,e,t)}mapPos(e,t=-1,i=de.Simple){let n=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=n+l;if(a<0){if(h>e)return s+(e-n);s+=l}else{if(i!=de.Simple&&h>=e&&(i==de.TrackDel&&n<e&&h>e||i==de.TrackBefore&&n<e||i==de.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==n||t<0?s:s+a;s+=a}n=h}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return s}touchesRange(e,t=e){for(let i=0,n=0;i<this.sections.length&&n<=t;){let s=this.sections[i++],o=this.sections[i++],l=n+s;if(o>=0&&n<=t&&l>=e)return n<e&&l>t?"cover":!0;n=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+i+(n>=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ke(e)}static create(e){return new Ke(e)}}class ie extends Ke{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return fs(this,(t,i,n,s,o)=>e=e.replace(n,n+(i-t),o),!1),e}mapDesc(e,t=!1){return us(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let n=0,s=0;n<t.length;n+=2){let o=t[n],l=t[n+1];if(l>=0){t[n]=l,t[n+1]=o;let a=n>>1;for(;i.length<a;)i.push(L.empty);i.push(o?e.slice(s,s+o):L.empty)}s+=o}return new ie(t,i)}compose(e){return this.empty?e:e.empty?this:$h(this,e,!0)}map(e,t=!1){return e.empty?this:us(this,e,t,!0)}iterChanges(e,t=!1){fs(this,e,t)}get desc(){return Ke.create(this.sections)}filter(e){let t=[],i=[],n=[],s=new qi(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let c=Math.min(s.len,a-l);ae(n,c,-1);let O=s.ins==-1?-1:s.off==0?s.ins:0;ae(t,c,O),O>0&&mt(i,t,s.text),s.forward(c),l+=c}let h=e[o++];for(;l<h;){if(s.done)break e;let c=Math.min(s.len,h-l);ae(t,c,-1),ae(n,c,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(c),l+=c}}return{changes:new ie(t,i),filtered:Ke.create(n)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],n=this.sections[t+1];n<0?e.push(i):n==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let n=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!n.length)return;o<t&&ae(n,t-o,-1);let O=new ie(n,s);l=l?l.compose(O.map(l)):O,n=[],s=[],o=0}function h(c){if(Array.isArray(c))for(let O of c)h(O);else if(c instanceof ie){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:O,to:f=O,insert:u}=c;if(O>f||O<0||f>t)throw new RangeError(`Invalid change range ${O} to ${f} (in doc of length ${t})`);let d=u?typeof u=="string"?L.of(u.split(i||Os)):u:L.empty,g=d.length;if(O==f&&g==0)return;O<o&&a(),O>o&&ae(n,O-o,-1),ae(n,f-O,g),mt(s,n,d),o=f}}return h(e),a(!l),l}static empty(e){return new ie(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let n=0;n<e.length;n++){let s=e[n];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<n;)i.push(L.empty);i[n]=L.of(s.slice(1)),t.push(s[0],i[n].length)}}}return new ie(t,i)}static createSet(e,t){return new ie(e,t)}}function ae(r,e,t,i=!1){if(e==0&&t<=0)return;let n=r.length-2;n>=0&&t<=0&&t==r[n+1]?r[n]+=e:n>=0&&e==0&&r[n]==0?r[n+1]+=t:i?(r[n]+=e,r[n+1]+=t):r.push(e,t)}function mt(r,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<r.length)r[r.length-1]=r[r.length-1].append(t);else{for(;r.length<i;)r.push(L.empty);r.push(t)}}function fs(r,e,t){let i=r.inserted;for(let n=0,s=0,o=0;o<r.sections.length;){let l=r.sections[o++],a=r.sections[o++];if(a<0)n+=l,s+=l;else{let h=n,c=s,O=L.empty;for(;h+=l,c+=a,a&&i&&(O=O.append(i[o-2>>1])),!(t||o==r.sections.length||r.sections[o+1]<0);)l=r.sections[o++],a=r.sections[o++];e(n,h,s,c,O),n=h,s=c}}}function us(r,e,t,i=!1){let n=[],s=i?[]:null,o=new qi(r),l=new qi(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ae(n,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(ae(n,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(ae(n,0,o.ins),s&&mt(s,n,o.text),a=o.i),o.forward(c),h-=c}l.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let O=Math.min(c,l.len);h+=O,c-=O,l.forward(O)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;ae(n,h,a<o.i?o.ins:0),s&&a<o.i&&mt(s,n,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return s?ie.createSet(n,s):Ke.create(n);throw new Error("Mismatched change set lengths")}}}function $h(r,e,t=!1){let i=[],n=t?[]:null,s=new qi(r),o=new qi(e);for(let l=!1;;){if(s.done&&o.done)return n?ie.createSet(i,n):Ke.create(i);if(s.ins==0)ae(i,s.len,0,l),s.next();else if(o.len==0&&!o.done)ae(i,0,o.ins,l),n&&mt(n,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),h=i.length;if(s.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;ae(i,a,c,l),n&&c&&mt(n,i,o.text)}else o.ins==-1?(ae(i,s.off?0:s.len,a,l),n&&mt(n,i,s.textBit(a))):(ae(i,s.off?0:s.len,o.off?0:o.ins,l),n&&!o.off&&mt(n,i,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),s.forward2(a),o.forward(a)}}}}class qi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?L.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?L.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class At{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,n;return this.empty?i=n=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new At(i,n,this.flags)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t,void 0,void 0,i);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,n,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,i){return new At(e,t,i)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new b([this.main],0)}addRange(e,t=!0){return b.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,b.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>At.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;n<e.length;n++){let s=e[n];if(s.empty?s.from<=i:s.from<i)return b.normalized(e.slice(),t);i=s.to}return new b(e,t)}static cursor(e,t=0,i,n){return At.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(n??16777215)<<6)}static range(e,t,i,n,s){let o=(i??16777215)<<6|(n==null?7:Math.min(6,n));return!s&&e!=t&&(s=t<e?1:-1),t<e?At.create(t,e,48|o):At.create(e,t,(s?s<0?8:16:0)|o)}static normalized(e,t=0){let i=e[t];e.sort((n,s)=>n.from-s.from),t=e.indexOf(i);for(let n=1;n<e.length;n++){let s=e[n],o=e[n-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);n<=t&&t--,e.splice(--n,2,s.anchor>s.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function wh(r,e){for(let t of r.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let po=0;class X{constructor(e,t,i,n,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=n,this.id=po++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new X(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:go),!!e.static,e.enables)}of(e){return new Ar([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ar(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ar(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function go(r,e){return r==e||r.length==e.length&&r.every((t,i)=>t===e[i])}class Ar{constructor(e,t,i,n){this.dependencies=e,this.facet=t,this.type=i,this.value=n,this.id=po++}dynamicSlot(e){var t;let i=this.value,n=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let O of this.dependencies)O=="doc"?a=!0:O=="selection"?h=!0:(((t=e[O.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[O.id]);return{create(O){return O.values[o]=i(O),1},update(O,f){if(a&&f.docChanged||h&&(f.docChanged||f.selection)||ds(O,c)){let u=i(O);if(l?!yl(u,O.values[o],n):!n(u,O.values[o]))return O.values[o]=u,1}return 0},reconfigure:(O,f)=>{let u,d=f.config.address[s];if(d!=null){let g=Dr(f,d);if(this.dependencies.every(m=>m instanceof X?f.facet(m)===O.facet(m):m instanceof Ot?f.field(m,!1)==O.field(m,!1):!0)||(l?yl(u=i(O),g,n):n(u=i(O),g)))return O.values[o]=g,0}else u=i(O);return O.values[o]=u,1}}}}function yl(r,e,t){if(r.length!=e.length)return!1;for(let i=0;i<r.length;i++)if(!t(r[i],e[i]))return!1;return!0}function ds(r,e){let t=!1;for(let i of e)Ai(r,i)&1&&(t=!0);return t}function qu(r,e,t){let i=t.map(a=>r[a.id]),n=t.map(a=>a.type),s=i.filter(a=>!(a&1)),o=r[e.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let O=Dr(a,i[c]);if(n[c]==2)for(let f of O)h.push(f);else h.push(O)}return e.combine(h)}return{create(a){for(let h of i)Ai(a,h);return a.values[o]=l(a),1},update(a,h){if(!ds(a,s))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=ds(a,i),O=h.config.facets[e.id],f=h.facet(e);if(O&&!c&&go(t,O))return a.values[o]=f,0;let u=l(a);return e.compare(u,f)?(a.values[o]=f,0):(a.values[o]=u,1)}}}const pr=X.define({static:!0});class Ot{constructor(e,t,i,n,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=n,this.spec=s,this.provides=void 0}static define(e){let t=new Ot(po++,e.create,e.update,e.compare||((i,n)=>i===n),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(pr).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,n)=>{let s=i.values[t],o=this.updateF(s,n);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,n)=>{let s=i.facet(pr),o=n.facet(pr),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):n.config.address[this.id]!=null?(i.values[t]=n.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,pr.of({field:this,create:e})]}get extension(){return this}}const Zt={lowest:4,low:3,default:2,high:1,highest:0};function ki(r){return e=>new vh(e,r)}const mi={highest:ki(Zt.highest),high:ki(Zt.high),default:ki(Zt.default),low:ki(Zt.low),lowest:ki(Zt.lowest)};class vh{constructor(e,t){this.inner=e,this.prec=t}}class fn{of(e){return new ps(this,e)}reconfigure(e){return fn.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ps{constructor(e,t){this.compartment=e,this.inner=t}}class Br{constructor(e,t,i,n,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=n,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let n=[],s=Object.create(null),o=new Map;for(let f of Bu(e,t,o))f instanceof Ot?n.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let l=Object.create(null),a=[],h=[];for(let f of n)l[f.id]=h.length<<1,h.push(u=>f.slot(u));let c=i?.config.facets;for(let f in s){let u=s[f],d=u[0].facet,g=c&&c[f]||[];if(u.every(m=>m.type==0))if(l[d.id]=a.length<<1|1,go(g,u))a.push(i.facet(d));else{let m=d.combine(u.map(Q=>Q.value));a.push(i&&d.compare(m,i.facet(d))?i.facet(d):m)}else{for(let m of u)m.type==0?(l[m.id]=a.length<<1|1,a.push(m.value)):(l[m.id]=h.length<<1,h.push(Q=>m.dynamicSlot(Q)));l[d.id]=h.length<<1,h.push(m=>qu(m,d,u))}}let O=h.map(f=>f(l));return new Br(e,o,O,l,a,s)}}function Bu(r,e,t){let i=[[],[],[],[],[]],n=new Map;function s(o,l){let a=n.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof ps&&t.delete(o.compartment)}if(n.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof ps){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof vh)s(o.inner,o.prec);else if(o instanceof Ot)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Ar)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,Zt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(r,Zt.default),i.reduce((o,l)=>o.concat(l))}function Ai(r,e){if(e&1)return 2;let t=e>>1,i=r.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;r.status[t]=4;let n=r.computeSlot(r,r.config.dynamicSlots[t]);return r.status[t]=2|n}function Dr(r,e){return e&1?r.config.staticValues[e>>1]:r.values[e>>1]}const Th=X.define(),gs=X.define({combine:r=>r.some(e=>e),static:!0}),Xh=X.define({combine:r=>r.length?r[0]:void 0,static:!0}),Zh=X.define(),Ch=X.define(),Rh=X.define(),Ah=X.define({combine:r=>r.length?r[0]:!1});class ft{constructor(e,t){this.type=e,this.value=t}static define(){return new Du}}class Du{of(e){return new ft(this,e)}}class Iu{constructor(e){this.map=e}of(e){return new F(this,e)}}class F{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new F(this.type,t)}is(e){return this.type==e}static define(e={}){return new Iu(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let n of e){let s=n.map(t);s&&i.push(s)}return i}}F.reconfigure=F.define();F.appendConfig=F.define();class te{constructor(e,t,i,n,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=n,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&wh(i,t.newLength),s.some(l=>l.type==te.time)||(this.annotations=s.concat(te.time.of(Date.now())))}static create(e,t,i,n,s,o){return new te(e,t,i,n,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(te.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}te.time=ft.define();te.userEvent=ft.define();te.addToHistory=ft.define();te.remote=ft.define();function Gu(r,e){let t=[];for(let i=0,n=0;;){let s,o;if(i<r.length&&(n==e.length||e[n]>=r[i]))s=r[i++],o=r[i++];else if(n<e.length)s=e[n++],o=e[n++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Mh(r,e,t){var i;let n,s,o;return t?(n=e.changes,s=ie.empty(e.changes.length),o=r.changes.compose(e.changes)):(n=e.changes.map(r.changes),s=r.changes.mapDesc(e.changes,!0),o=r.changes.compose(n)),{changes:o,selection:e.selection?e.selection.map(s):(i=r.selection)===null||i===void 0?void 0:i.map(n),effects:F.mapEffects(r.effects,n).concat(F.mapEffects(e.effects,s)),annotations:r.annotations.length?r.annotations.concat(e.annotations):e.annotations,scrollIntoView:r.scrollIntoView||e.scrollIntoView}}function ms(r,e,t){let i=e.selection,n=Jt(e.annotations);return e.userEvent&&(n=n.concat(te.userEvent.of(e.userEvent))),{changes:e.changes instanceof ie?e.changes:ie.of(e.changes||[],t,r.facet(Xh)),selection:i&&(i instanceof b?i:b.single(i.anchor,i.head)),effects:Jt(e.effects),annotations:n,scrollIntoView:!!e.scrollIntoView}}function jh(r,e,t){let i=ms(r,e.length?e[0]:{},r.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;i=Mh(i,ms(r,e[s],o?i.changes.newLength:r.doc.length),o)}let n=te.create(r,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Uu(t?Nu(n):n)}function Nu(r){let e=r.startState,t=!0;for(let n of e.facet(Zh)){let s=n(r);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:Gu(t,s))}if(t!==!0){let n,s;if(t===!1)s=r.changes.invertedDesc,n=ie.empty(e.doc.length);else{let o=r.changes.filter(t);n=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}r=te.create(e,n,r.selection&&r.selection.map(s),F.mapEffects(r.effects,s),r.annotations,r.scrollIntoView)}let i=e.facet(Ch);for(let n=i.length-1;n>=0;n--){let s=i[n](r);s instanceof te?r=s:Array.isArray(s)&&s.length==1&&s[0]instanceof te?r=s[0]:r=jh(e,Jt(s),!1)}return r}function Uu(r){let e=r.startState,t=e.facet(Rh),i=r;for(let n=t.length-1;n>=0;n--){let s=t[n](r);s&&Object.keys(s).length&&(i=Mh(i,ms(e,s,r.changes.newLength),!0))}return i==r?r:te.create(e,r.changes,r.selection,i.effects,i.annotations,i.scrollIntoView)}const Fu=[];function Jt(r){return r==null?Fu:Array.isArray(r)?r:[r]}var st=(function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r})(st||(st={}));const Hu=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Qs;try{Qs=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Ku(r){if(Qs)return Qs.test(r);for(let e=0;e<r.length;e++){let t=r[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Hu.test(t)))return!0}return!1}function Ju(r){return e=>{if(!/\S/.test(e))return st.Space;if(Ku(e))return st.Word;for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>-1)return st.Word;return st.Other}}class V{constructor(e,t,i,n,s,o){this.config=e,this.doc=t,this.selection=i,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Ai(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Ai(this,i),Dr(this,i)}update(...e){return jh(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:n}=t;for(let l of e.effects)l.is(fn.reconfigure)?(t&&(n=new Map,t.compartments.forEach((a,h)=>n.set(h,a)),t=null),n.set(l.value.compartment,l.value.extension)):l.is(F.reconfigure)?(t=null,i=l.value):l.is(F.appendConfig)&&(t=null,i=Jt(i).concat(l.value));let s;t?s=e.startState.values.slice():(t=Br.resolve(i,n,this),s=new V(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(gs)?e.newSelection:e.newSelection.asSingle();new V(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),n=this.changes(i.changes),s=[i.range],o=Jt(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),c=h.map(n);for(let f=0;f<l;f++)s[f]=s[f].map(c);let O=n.mapDesc(h,!0);s.push(a.range.map(O)),n=n.compose(c),o=F.mapEffects(o,c).concat(F.mapEffects(Jt(a.effects),O))}return{changes:n,selection:b.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ie?e:ie.of(e,this.doc.length,this.facet(V.lineSeparator))}toText(e){return L.of(e.split(this.facet(V.lineSeparator)||Os))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Ai(this,t),Dr(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let n=e[i];n instanceof Ot&&this.config.address[n.id]!=null&&(t[i]=n.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let n=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let o=i[s],l=e[s];n.push(o.init(a=>o.spec.fromJSON(l,a)))}}return V.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?n.concat([t.extensions]):n})}static create(e={}){let t=Br.resolve(e.extensions||[],new Map),i=e.doc instanceof L?e.doc:L.of((e.doc||"").split(t.staticFacet(V.lineSeparator)||Os)),n=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return wh(n,i.length),t.staticFacet(gs)||(n=n.asSingle()),new V(t,i,n,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(V.tabSize)}get lineBreak(){return this.facet(V.lineSeparator)||`
@@ -131,9 +131,9 @@ Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error
131
131
  `+e.slice(a,l),a=l+1),c=h;return m+=`
132
132
  `,e.length-a>t&&c>a?m+=e.slice(a,c)+`
133
133
  `+e.slice(c+1):m+=e.slice(a),m.slice(1)}function rF(e){for(var t="",i=0,n,a=0;a<e.length;i>=65536?a+=2:a++)i=Sc(e,a),n=Ii[i],!n&&Vc(i)?(t+=e[a],i>=65536&&(t+=e[a+1])):t+=n||XH(i);return t}function aF(e,t,i){var n="",a=e.tag,l,c,h;for(l=0,c=i.length;l<c;l+=1)h=i[l],e.replacer&&(h=e.replacer.call(i,String(l),h)),(Zn(e,t,h,!1,!1)||typeof h>"u"&&Zn(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=a,e.dump="["+n+"]"}function C2(e,t,i,n){var a="",l=e.tag,c,h,m;for(c=0,h=i.length;c<h;c+=1)m=i[c],e.replacer&&(m=e.replacer.call(i,String(c),m)),(Zn(e,t+1,m,!0,!0,!1,!0)||typeof m>"u"&&Zn(e,t+1,null,!0,!0,!1,!0))&&((!n||a!=="")&&(a+=D0(e,t)),e.dump&&Fc===e.dump.charCodeAt(0)?a+="-":a+="- ",a+=e.dump);e.tag=l,e.dump=a||"[]"}function oF(e,t,i){var n="",a=e.tag,l=Object.keys(i),c,h,m,f,g;for(c=0,h=l.length;c<h;c+=1)g="",n!==""&&(g+=", "),e.condenseFlow&&(g+='"'),m=l[c],f=i[m],e.replacer&&(f=e.replacer.call(i,m,f)),Zn(e,t,m,!1,!1)&&(e.dump.length>1024&&(g+="? "),g+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Zn(e,t,f,!1,!1)&&(g+=e.dump,n+=g));e.tag=a,e.dump="{"+n+"}"}function lF(e,t,i,n){var a="",l=e.tag,c=Object.keys(i),h,m,f,g,b,v;if(e.sortKeys===!0)c.sort();else if(typeof e.sortKeys=="function")c.sort(e.sortKeys);else if(e.sortKeys)throw new Fi("sortKeys must be a boolean or a function");for(h=0,m=c.length;h<m;h+=1)v="",(!n||a!=="")&&(v+=D0(e,t)),f=c[h],g=i[f],e.replacer&&(g=e.replacer.call(i,f,g)),Zn(e,t+1,f,!0,!0,!0)&&(b=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,b&&(e.dump&&Fc===e.dump.charCodeAt(0)?v+="?":v+="? "),v+=e.dump,b&&(v+=D0(e,t)),Zn(e,t+1,g,!0,b)&&(e.dump&&Fc===e.dump.charCodeAt(0)?v+=":":v+=": ",v+=e.dump,a+=v));e.tag=l,e.dump=a||"{}"}function k2(e,t,i){var n,a,l,c,h,m;for(a=i?e.explicitTypes:e.implicitTypes,l=0,c=a.length;l<c;l+=1)if(h=a[l],(h.instanceOf||h.predicate)&&(!h.instanceOf||typeof t=="object"&&t instanceof h.instanceOf)&&(!h.predicate||h.predicate(t))){if(i?h.multi&&h.representName?e.tag=h.representName(t):e.tag=h.tag:e.tag="?",h.represent){if(m=e.styleMap[h.tag]||h.defaultStyle,J3.call(h.represent)==="[object Function]")n=h.represent(t,m);else if(eN.call(h.represent,m))n=h.represent[m](t,m);else throw new Fi("!<"+h.tag+'> tag resolver accepts not "'+m+'" style');e.dump=n}return!0}return!1}function Zn(e,t,i,n,a,l,c){e.tag=null,e.dump=i,k2(e,i,!1)||k2(e,i,!0);var h=J3.call(e.dump),m=n,f;n&&(n=e.flowLevel<0||e.flowLevel>t);var g=h==="[object Object]"||h==="[object Array]",b,v;if(g&&(b=e.duplicates.indexOf(i),v=b!==-1),(e.tag!==null&&e.tag!=="?"||v||e.indent!==2&&t>0)&&(a=!1),v&&e.usedDuplicates[b])e.dump="*ref_"+b;else{if(g&&v&&!e.usedDuplicates[b]&&(e.usedDuplicates[b]=!0),h==="[object Object]")n&&Object.keys(e.dump).length!==0?(lF(e,t,e.dump,a),v&&(e.dump="&ref_"+b+e.dump)):(oF(e,t,e.dump),v&&(e.dump="&ref_"+b+" "+e.dump));else if(h==="[object Array]")n&&e.dump.length!==0?(e.noArrayIndent&&!c&&t>0?C2(e,t-1,e.dump,a):C2(e,t,e.dump,a),v&&(e.dump="&ref_"+b+e.dump)):(aF(e,t,e.dump),v&&(e.dump="&ref_"+b+" "+e.dump));else if(h==="[object String]")e.tag!=="?"&&sF(e,e.dump,t,l,m);else{if(h==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Fi("unacceptable kind of an object to dump "+h)}e.tag!==null&&e.tag!=="?"&&(f=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?f="!"+f:f.slice(0,18)==="tag:yaml.org,2002:"?f="!!"+f.slice(18):f="!<"+f+">",e.dump=f+" "+e.dump)}return!0}function cF(e,t){var i=[],n=[],a,l;for(j0(e,i,n),a=0,l=n.length;a<l;a+=1)t.duplicates.push(i[n[a]]);t.usedDuplicates=new Array(l)}function j0(e,t,i){var n,a,l;if(e!==null&&typeof e=="object")if(a=t.indexOf(e),a!==-1)i.indexOf(a)===-1&&i.push(a);else if(t.push(e),Array.isArray(e))for(a=0,l=e.length;a<l;a+=1)j0(e[a],t,i);else for(n=Object.keys(e),a=0,l=n.length;a<l;a+=1)j0(e[n[a]],t,i)}function uF(e,t){t=t||{};var i=new QH(t);i.noRefs||cF(e,i);var n=e;return i.replacer&&(n=i.replacer.call({"":n},"",n)),Zn(i,0,n,!0,!0)?i.dump+`
134
- `:""}var dF=uF,hF={dump:dF};function q_(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var fF=Mi,mF=E3,pF=T3,gF=O3,_F=j3,bF=H_,vF=Q3.load,xF=Q3.loadAll,yF=hF.dump,SF=Fi,wF={binary:P3,float:D3,map:N3,null:A3,pairs:H3,set:F3,timestamp:z3,bool:M3,int:R3,merge:I3,omap:U3,seq:k3,str:C3},EF=q_("safeLoad","load"),CF=q_("safeLoadAll","loadAll"),kF=q_("safeDump","dump"),NF={Type:fF,Schema:mF,FAILSAFE_SCHEMA:pF,JSON_SCHEMA:gF,CORE_SCHEMA:_F,DEFAULT_SCHEMA:bF,load:vF,loadAll:xF,dump:yF,YAMLException:SF,types:wF,safeLoad:EF,safeLoadAll:CF,safeDump:kF};function uN(e){return e!==null&&typeof e=="object"}function dN(e){return typeof e=="string"?"text-rose-700":typeof e=="number"?"text-emerald-700":typeof e=="boolean"?"text-blue-700":e==null?"text-zinc-400 italic":"text-zinc-800"}function hN(e){return e==null?"null":typeof e=="string"?e===""?'""':e:String(e)}function fN({label:e,value:t,depth:i,defaultOpen:n}){const[a,l]=E.useState(n),c={paddingLeft:`${i*1.1}rem`};if(!uN(t))return u.jsxs("div",{className:"flex items-baseline gap-2 py-[1px]",style:c,children:[u.jsxs("span",{className:"text-zinc-500",children:[e,":"]}),u.jsx("span",{className:fe("whitespace-pre-wrap break-words",dN(t)),children:hN(t)})]});const h=Array.isArray(t)?t.map((f,g)=>[String(g),f]):Object.entries(t),m=Array.isArray(t)?`[${h.length}]`:`{${h.length}}`;return u.jsxs("div",{children:[u.jsxs("button",{type:"button",onClick:()=>l(f=>!f),className:"flex w-full items-center gap-1 py-[1px] text-left hover:bg-zinc-100",style:c,children:[a?u.jsx(Qs,{className:"size-3.5 shrink-0 text-zinc-400"}):u.jsx(Yr,{className:"size-3.5 shrink-0 text-zinc-400"}),u.jsx("span",{className:"font-medium text-zinc-700",children:e}),u.jsx("span",{className:"text-zinc-400",children:m})]}),a?h.map(([f,g])=>u.jsx(fN,{label:f,value:g,depth:i+1,defaultOpen:i<1},f)):null]})}function TF({content:e}){const t=E.useMemo(()=>{try{const n=NF.loadAll(e);return{value:n.length<=1?n[0]:n,error:null}}catch(n){return{value:null,error:n instanceof Error?n.message:String(n)}}},[e]);if(t.error)return u.jsx("div",{className:"p-4",children:u.jsxs(dt,{variant:"destructive",children:["Could not parse YAML: ",t.error]})});if(!uN(t.value))return u.jsx("div",{className:"p-4 font-mono text-[12px]",children:u.jsx("span",{className:dN(t.value),children:hN(t.value)})});const i=Array.isArray(t.value)?t.value.map((n,a)=>[String(a),n]):Object.entries(t.value);return u.jsx("div",{className:"min-w-max px-4 py-3 font-mono text-[12px] leading-[1.6]",children:i.map(([n,a])=>u.jsx(fN,{label:n,value:a,depth:0,defaultOpen:!0},n))})}const AF=E.lazy(()=>OI(()=>import("./code-editor-BJd-TJLv.js"),[]).then(e=>({default:e.CodeEditor})));function MF(e){const t=e.split("/").pop()?.toLowerCase().split(".").pop()??"";return t==="md"||t==="mdx"||t==="markdown"?"markdown":t==="yml"||t==="yaml"?"yaml":null}function RF(e){const t=e.split("/").pop()?.toLowerCase()??"",i=t.includes(".")?t.split(".").pop()??"":"",n={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",h:"c",cpp:"cpp",cc:"cpp",hpp:"cpp",cs:"csharp",sh:"bash",bash:"bash",zsh:"bash",json:"json",yaml:"yaml",yml:"yaml",toml:"ini",ini:"ini",md:"markdown",mdx:"markdown",css:"css",scss:"scss",less:"less",html:"xml",xml:"xml",sql:"sql",dockerfile:"dockerfile"};return n[i]?n[i]:t==="dockerfile"?"dockerfile":null}function DF(e,t){const i=e.endsWith(`
134
+ `:""}var dF=uF,hF={dump:dF};function q_(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var fF=Mi,mF=E3,pF=T3,gF=O3,_F=j3,bF=H_,vF=Q3.load,xF=Q3.loadAll,yF=hF.dump,SF=Fi,wF={binary:P3,float:D3,map:N3,null:A3,pairs:H3,set:F3,timestamp:z3,bool:M3,int:R3,merge:I3,omap:U3,seq:k3,str:C3},EF=q_("safeLoad","load"),CF=q_("safeLoadAll","loadAll"),kF=q_("safeDump","dump"),NF={Type:fF,Schema:mF,FAILSAFE_SCHEMA:pF,JSON_SCHEMA:gF,CORE_SCHEMA:_F,DEFAULT_SCHEMA:bF,load:vF,loadAll:xF,dump:yF,YAMLException:SF,types:wF,safeLoad:EF,safeLoadAll:CF,safeDump:kF};function uN(e){return e!==null&&typeof e=="object"}function dN(e){return typeof e=="string"?"text-rose-700":typeof e=="number"?"text-emerald-700":typeof e=="boolean"?"text-blue-700":e==null?"text-zinc-400 italic":"text-zinc-800"}function hN(e){return e==null?"null":typeof e=="string"?e===""?'""':e:String(e)}function fN({label:e,value:t,depth:i,defaultOpen:n}){const[a,l]=E.useState(n),c={paddingLeft:`${i*1.1}rem`};if(!uN(t))return u.jsxs("div",{className:"flex items-baseline gap-2 py-[1px]",style:c,children:[u.jsxs("span",{className:"text-zinc-500",children:[e,":"]}),u.jsx("span",{className:fe("whitespace-pre-wrap break-words",dN(t)),children:hN(t)})]});const h=Array.isArray(t)?t.map((f,g)=>[String(g),f]):Object.entries(t),m=Array.isArray(t)?`[${h.length}]`:`{${h.length}}`;return u.jsxs("div",{children:[u.jsxs("button",{type:"button",onClick:()=>l(f=>!f),className:"flex w-full items-center gap-1 py-[1px] text-left hover:bg-zinc-100",style:c,children:[a?u.jsx(Qs,{className:"size-3.5 shrink-0 text-zinc-400"}):u.jsx(Yr,{className:"size-3.5 shrink-0 text-zinc-400"}),u.jsx("span",{className:"font-medium text-zinc-700",children:e}),u.jsx("span",{className:"text-zinc-400",children:m})]}),a?h.map(([f,g])=>u.jsx(fN,{label:f,value:g,depth:i+1,defaultOpen:i<1},f)):null]})}function TF({content:e}){const t=E.useMemo(()=>{try{const n=NF.loadAll(e);return{value:n.length<=1?n[0]:n,error:null}}catch(n){return{value:null,error:n instanceof Error?n.message:String(n)}}},[e]);if(t.error)return u.jsx("div",{className:"p-4",children:u.jsxs(dt,{variant:"destructive",children:["Could not parse YAML: ",t.error]})});if(!uN(t.value))return u.jsx("div",{className:"p-4 font-mono text-[12px]",children:u.jsx("span",{className:dN(t.value),children:hN(t.value)})});const i=Array.isArray(t.value)?t.value.map((n,a)=>[String(a),n]):Object.entries(t.value);return u.jsx("div",{className:"min-w-max px-4 py-3 font-mono text-[12px] leading-[1.6]",children:i.map(([n,a])=>u.jsx(fN,{label:n,value:a,depth:0,defaultOpen:!0},n))})}const AF=E.lazy(()=>OI(()=>import("./code-editor-CIQMI6TY.js"),[]).then(e=>({default:e.CodeEditor})));function MF(e){const t=e.split("/").pop()?.toLowerCase().split(".").pop()??"";return t==="md"||t==="mdx"||t==="markdown"?"markdown":t==="yml"||t==="yaml"?"yaml":null}function RF(e){const t=e.split("/").pop()?.toLowerCase()??"",i=t.includes(".")?t.split(".").pop()??"":"",n={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",h:"c",cpp:"cpp",cc:"cpp",hpp:"cpp",cs:"csharp",sh:"bash",bash:"bash",zsh:"bash",json:"json",yaml:"yaml",yml:"yaml",toml:"ini",ini:"ini",md:"markdown",mdx:"markdown",css:"css",scss:"scss",less:"less",html:"xml",xml:"xml",sql:"sql",dockerfile:"dockerfile"};return n[i]?n[i]:t==="dockerfile"?"dockerfile":null}function DF(e,t){const i=e.endsWith(`
135
135
  `)?e.slice(0,-1):e;return!t||!k0.getLanguage(t)?i.split(`
136
136
  `).map(N2):i.split(`
137
137
  `).map(n=>{if(!n)return"";try{return k0.highlight(n,{language:t,ignoreIllegals:!0}).value}catch{return N2(n)}})}function N2(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function OF({content:e,path:t}){const i=E.useMemo(()=>RF(t),[t]),n=E.useMemo(()=>DF(e,i),[e,i]),a=`${Math.max(2,String(n.length).length)}ch`;return u.jsx("div",{className:"min-w-max font-mono text-[12px] leading-[1.5]",children:n.map((l,c)=>u.jsxs("div",{className:"flex",children:[u.jsx("span",{className:"shrink-0 select-none border-r border-zinc-200 bg-zinc-100 px-2 text-right text-zinc-400",style:{minWidth:`calc(${a} + 1rem)`},children:c+1}),u.jsx("span",{className:"hljs whitespace-pre px-3 text-zinc-800",dangerouslySetInnerHTML:{__html:l||" "}})]},c))})}function jF({path:e,isModified:t,onViewDiff:i,onFileSaved:n}){const[a,l]=E.useState(null),[c,h]=E.useState(""),[m,f]=E.useState(!1),[g,b]=E.useState(null),[v,x]=E.useState(!1),[y,w]=E.useState(!1),{success:C,error:N}=qi(),T=E.useMemo(()=>MF(e),[e]),[D,A]=E.useState("preview"),L=!!(a&&!a.binary&&!a.truncated),G=a?c!==a.content:!1;E.useEffect(()=>{A(T?"preview":"source"),f(!1)},[T]),E.useEffect(()=>{if(!e){l(null);return}let H=!0;return x(!0),b(null),f(!1),gM(e).then(I=>{H&&(l(I),h(I.content),x(!1))}).catch(I=>{H&&(b(I instanceof Error?I.message:String(I)),x(!1))}),()=>{H=!1}},[e]);async function j(){if(!(!e||!a||!G||y)){w(!0);try{await _M(e,c);const H={...a,content:c,size:new TextEncoder().encode(c).length};l(H),f(!1),C(`Saved ${e}.`),n?.(e)}catch(H){N(H instanceof Error?H.message:String(H))}finally{w(!1)}}}function R(){h(a?.content??""),f(!1)}return e?u.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[u.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:e}),u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[u.jsx("span",{children:"Read-only view of tracked file."}),a?.truncated?u.jsx("span",{className:"text-amber-700",children:"Truncated — file exceeds 1MB."}):null,a?.binary?u.jsx("span",{className:"text-amber-700",children:"Binary file."}):null]})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[T&&!a?.binary?u.jsxs("div",{className:"flex items-center rounded-md border border-border p-0.5",children:[u.jsxs("button",{type:"button",onClick:()=>A("preview"),"aria-pressed":D==="preview",className:fe("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",D==="preview"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[u.jsx(I0,{className:"size-3.5"}),"Preview"]}),u.jsxs("button",{type:"button",onClick:()=>A("source"),"aria-pressed":D==="source",className:fe("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",D==="source"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[u.jsx(U2,{className:"size-3.5"}),"Source"]})]}):null,t?u.jsx(de,{onClick:i,size:"sm",type:"button",variant:"outline",children:"View diff"}):null,m?u.jsxs(u.Fragment,{children:[u.jsxs(de,{disabled:!G||y,onClick:()=>{j()},size:"sm",type:"button",children:[u.jsx(P0,{}),"Apply"]}),u.jsxs(de,{disabled:y,onClick:R,size:"sm",type:"button",variant:"outline",children:[u.jsx(Js,{}),"Cancel"]})]}):L?u.jsxs(de,{onClick:()=>{A("source"),f(!0)},size:"sm",type:"button",variant:"outline",children:[u.jsx(Mc,{}),"Edit"]}):null]})]}),u.jsx("div",{className:"min-h-0 flex-1 overflow-auto bg-zinc-50",children:g?u.jsx("div",{className:"p-4",children:u.jsx(dt,{variant:"destructive",children:g})}):v?u.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading…"}):a?.binary?u.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Cannot display binary content."}):a?m?u.jsx(E.Suspense,{fallback:u.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading editor…"}),children:u.jsx(AF,{path:e,value:c,onChange:h})}):T&&D==="preview"?T==="markdown"?u.jsx(oU,{content:a.content}):u.jsx(TF,{content:a.content}):u.jsx(OF,{content:a.content,path:e}):null})]}):u.jsx("div",{className:"p-4",children:u.jsx(dt,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a file to view its contents."})})}function LF({activeHunkIndex:e,filePaths:t,hunkCount:i,pendingNextFilePath:n,selectedFile:a}){if(i>0&&e<i-1)return{kind:"hunk",activeHunkIndex:e+1};const l=t.indexOf(a),c=t[l+1];return c?n===c?{kind:"file",filePath:c}:{kind:"confirm-next-file",filePath:c}:{kind:"none"}}function T2(e){const t={name:"",fullPath:"",children:new Map};for(const i of e){const n=i.name.split("/");let a=t;n.forEach((l,c)=>{let h=a.children.get(l);h||(h={name:l,fullPath:n.slice(0,c+1).join("/"),children:new Map},a.children.set(l,h)),a=h}),a.branch=i}return t}function A2({label:e,tree:t,onSelect:i,defaultOpen:n,forceOpen:a}){const[l,c]=E.useState(n??!1),h=a||l,m=t.children.size===0;return u.jsxs("div",{className:"mb-1",children:[u.jsxs("button",{type:"button",onClick:()=>c(f=>!f),className:"flex w-full items-center gap-1 px-2 py-0.5 text-left text-[11px] font-semibold uppercase tracking-wide text-muted-foreground hover:text-foreground",children:[h?u.jsx(Qs,{size:12}):u.jsx(Yr,{size:12}),e,m?null:u.jsxs("span",{className:"ml-1 text-[10px] font-normal",children:["(",t.children.size,")"]})]}),h&&!m?u.jsx("ul",{children:Array.from(t.children.values()).map(f=>u.jsx(mN,{node:f,depth:1,onSelect:i,forceOpen:a},f.fullPath))}):null]})}function mN({node:e,depth:t,onSelect:i,forceOpen:n}){const[a,l]=E.useState(!0),c=n||a,h=e.children.size>0,m=e.branch,f={paddingLeft:`${t*10}px`};return!h&&m?u.jsx("li",{children:u.jsxs("button",{type:"button",onClick:()=>i(m),style:f,title:m.name,className:`flex w-full items-center gap-1.5 py-0.5 pr-2 text-left text-[12px] hover:bg-muted/60 ${m.current?"font-semibold text-emerald-700":""}`,children:[u.jsx(Ac,{size:11,className:"shrink-0 opacity-70"}),u.jsx("span",{className:"truncate",children:e.name}),m.current?u.jsx("span",{className:"text-[10px]",children:"●"}):null]})}):u.jsxs("li",{children:[u.jsxs("button",{type:"button",onClick:()=>{m?i(m):l(g=>!g)},style:f,className:"flex w-full items-center gap-1 py-0.5 pr-2 text-left text-[12px] hover:bg-muted/60",children:[h?c?u.jsx(Qs,{size:11}):u.jsx(Yr,{size:11}):u.jsx("span",{className:"inline-block w-[11px]"}),u.jsx("span",{className:"truncate",children:e.name})]}),c&&h?u.jsx("ul",{children:Array.from(e.children.values()).map(g=>u.jsx(mN,{node:g,depth:t+1,onSelect:i,forceOpen:n},g.fullPath))}):null]})}function BF({selectedCommit:e,selectedFile:t,diff:i,diffLoading:n,diffError:a}){return u.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col bg-card border-b border-border",children:[u.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:u.jsxs("div",{className:"min-w-0",children:[u.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:t??(e?e.subject:"Commit")}),e?u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[u.jsx("span",{className:"font-mono",children:e.hash.slice(0,12)}),u.jsxs("span",{children:[e.author," <",e.email,">"]}),u.jsx("span",{children:new Date(e.timestamp*1e3).toLocaleString()})]}):null]})}),u.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:a?u.jsx("div",{className:"p-4",children:u.jsx(dt,{variant:"destructive",children:a})}):e?n?u.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading diff…"}):i?u.jsx(u3,{activeHunkIndex:0,diff:i}):u.jsx("div",{className:"p-4",children:u.jsx(dt,{variant:"muted",className:"border-dashed p-6 text-center",children:e.parents.length>1?"Merge commit with no conflict resolution — no diff against the first parent.":"No textual changes in this commit."})}):u.jsx("div",{className:"p-4",children:u.jsx(dt,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a commit to inspect its diff."})})})]})}function zF({files:e,filesError:t,selectedHash:i,selectedFile:n,onSelect:a}){return u.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[u.jsx("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:u.jsxs("h2",{className:"text-[13px] font-semibold tracking-tight",children:["Files",e.length?u.jsx("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:e.length}):null]})}),u.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:t?u.jsx("div",{className:"p-3",children:u.jsx(dt,{variant:"destructive",children:t})}):i?e.length===0?u.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No file changes."}):u.jsx("ul",{className:"divide-y divide-border",children:e.map(l=>u.jsx("li",{children:u.jsxs("button",{onClick:()=>a(l.path),type:"button",title:l.path,className:`flex w-full items-center gap-2 px-2 py-1 text-left text-[12px] transition-colors hover:bg-muted/60 ${n===l.path?"bg-muted":""}`,children:[u.jsx("span",{className:IF(l.index),children:l.index.trim()||"·"}),u.jsx("span",{className:"truncate font-mono",children:l.path})]})},l.path))}):u.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Select a commit to see its files."})})]})}function IF(e){const t="inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-[10px] font-bold";switch(e.trim().toUpperCase()){case"A":return`${t} bg-emerald-100 text-emerald-800`;case"D":return`${t} bg-red-100 text-red-800`;case"M":return`${t} bg-amber-100 text-amber-800`;case"R":return`${t} bg-blue-100 text-blue-800`;case"C":return`${t} bg-indigo-100 text-indigo-800`;default:return`${t} bg-slate-100 text-slate-700`}}const M2=["#3b82f6","#10b981","#f59e0b","#ec4899","#8b5cf6","#14b8a6","#ef4444","#84cc16"];function hc(e){return M2[e%M2.length]}function PF({lane:e,laneCount:t,edges:i,throughLanes:n,isMerge:a,height:l=28,laneWidth:c=14}){const m=Math.max(e+1,t,1)*c,f=l/2,g=fc(e,c),b=a?4:3.5;return u.jsxs("svg",{width:m,height:l,viewBox:`0 0 ${m} ${l}`,style:{flex:"0 0 auto",display:"block"},children:[n.map(v=>u.jsx("line",{x1:fc(v,c),y1:0,x2:fc(v,c),y2:l,stroke:hc(v),strokeWidth:1.5},`t-${v}`)),u.jsx("line",{x1:g,y1:0,x2:g,y2:f,stroke:hc(e),strokeWidth:1.5}),i.map((v,x)=>{const y=fc(v.fromLane,c),w=fc(v.toLane,c);if(y===w)return u.jsx("line",{x1:y,y1:f,x2:w,y2:l,stroke:hc(v.toLane),strokeWidth:1.5},`e-${x}`);const C=f+(l-f)/2;return u.jsx("path",{d:`M ${y} ${f} C ${y} ${C}, ${w} ${C}, ${w} ${l}`,fill:"none",stroke:hc(v.toLane),strokeWidth:1.5},`e-${x}`)}),u.jsx("circle",{cx:g,cy:f,r:b,fill:hc(e),stroke:"var(--background, #fff)",strokeWidth:1.5})]})}function fc(e,t){return e*t+t/2}const R2=28;function UF({commits:e,loading:t,error:i,selectedHash:n,maxLanes:a,rowRefs:l,onSelect:c,onLoadMore:h}){return u.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[u.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[u.jsxs("h2",{className:"text-[13px] font-semibold tracking-tight",children:["Commit tree",e.length?u.jsxs("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:[e.length," commits"]}):null]}),u.jsx(de,{disabled:t,onClick:h,size:"sm",type:"button",variant:"outline",children:"Load more"})]}),u.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:i?u.jsx("div",{className:"p-3",children:u.jsx(dt,{variant:"destructive",children:i})}):t&&e.length===0?u.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Loading commits…"}):e.length===0?u.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No commits."}):u.jsx("ul",{className:"divide-y divide-border",children:e.map(m=>u.jsx("li",{ref:f=>{f?l.current.set(m.hash,f):l.current.delete(m.hash)},children:u.jsxs("button",{onClick:()=>c(m.hash),type:"button",className:`flex w-full items-center gap-2 px-2 py-0.5 text-left transition-colors hover:bg-muted/60 ${n===m.hash?"bg-muted":""}`,style:{minHeight:R2},title:`${m.hash}
138
138
  ${m.author} <${m.email}>
139
- ${m.subject}`,children:[u.jsx(PF,{lane:m.lane,laneCount:Math.max(m.laneCount,a),edges:m.edges,throughLanes:m.throughLanes,isMerge:m.parents.length>1,height:R2}),u.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:m.hash.slice(0,7)}),u.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[m.refs.map(f=>u.jsx("span",{className:FF(f.kind),children:f.name},`${f.kind}-${f.name}`)),u.jsx("span",{className:"truncate text-[12px]",children:m.subject})]}),u.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:m.author}),u.jsx("span",{className:"shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground/70",title:new Date(m.timestamp*1e3).toLocaleString(),children:HF(m.timestamp)})]})},m.hash))})})]})}function HF(e){if(!e)return"";const t=Math.max(0,Math.floor(Date.now()/1e3-e));if(t<60)return`${t}s`;const i=Math.floor(t/60);if(i<60)return`${i}m`;const n=Math.floor(i/60);if(n<24)return`${n}h`;const a=Math.floor(n/24);if(a<30)return`${a}d`;const l=Math.floor(a/30);return l<12?`${l}mo`:`${Math.floor(l/12)}y`}function FF(e){const t="rounded px-1.5 py-px text-[10px] font-medium";switch(e){case"head":return`${t} bg-emerald-100 text-emerald-800`;case"branch":return`${t} bg-blue-100 text-blue-800`;case"remote":return`${t} bg-slate-100 text-slate-700`;case"tag":return`${t} bg-amber-100 text-amber-800`}}const D2=200;function $F(){const[e,t]=E.useState([]),[i,n]=E.useState(D2),[a,l]=E.useState(!0),[c,h]=E.useState(null),[m,f]=E.useState(null),[g,b]=E.useState([]),[v,x]=E.useState(null),[y,w]=E.useState(null),[C,N]=E.useState(""),[T,D]=E.useState(!1),[A,L]=E.useState(null);E.useEffect(()=>{let R=!0;return l(!0),h(null),dM(i).then(H=>{R&&(t(H),H.length>0&&!H.some(I=>I.hash===m)&&f(H[0].hash))}).catch(H=>{R&&h(H instanceof Error?H.message:String(H))}).finally(()=>{R&&l(!1)}),()=>{R=!1}},[i]),E.useEffect(()=>{if(!m){b([]),w(null);return}let R=!0;return x(null),fM(m).then(H=>{R&&(b(H),w(H[0]?.path??null))}).catch(H=>{R&&x(H instanceof Error?H.message:String(H))}),()=>{R=!1}},[m]),E.useEffect(()=>{if(!m){N("");return}let R=!0;return L(null),D(!0),hM(m,y??void 0).then(H=>{R&&N(H)}).catch(H=>{R&&L(H instanceof Error?H.message:String(H))}).finally(()=>{R&&D(!1)}),()=>{R=!1}},[m,y]);const G=E.useMemo(()=>e.reduce((R,H)=>Math.max(R,H.laneCount),1),[e]),j=e.find(R=>R.hash===m)??null;return{commits:e,loading:a,error:c,selectedHash:m,setSelectedHash:f,files:g,filesError:v,selectedFile:y,setSelectedFile:w,diff:C,diffLoading:T,diffError:A,maxLanes:G,selectedCommit:j,loadMore:()=>n(R=>R+D2)}}function VF({branches:e=[]}){const{commits:t,loading:i,error:n,selectedHash:a,setSelectedHash:l,files:c,filesError:h,selectedFile:m,setSelectedFile:f,diff:g,diffLoading:b,diffError:v,maxLanes:x,selectedCommit:y,loadMore:w}=$F(),[C,N]=E.useState(""),T=E.useMemo(()=>{const R=C.trim().toLowerCase();return R?e.filter(H=>H.name.toLowerCase().includes(R)):e},[e,C]),D=E.useMemo(()=>T2(T.filter(R=>!R.remote)),[T]),A=E.useMemo(()=>T2(T.filter(R=>R.remote)),[T]),L=C.trim().length>0,G=E.useRef(new Map);function j(R){const H=R.remote?"remote":"branch",I=t.find(J=>J.refs.some(P=>P.kind===H&&P.name===R.name));if(!I)return;l(I.hash);const W=G.current.get(I.hash);W&&W.scrollIntoView({block:"center",behavior:"smooth"})}return u.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 grid-cols-[220px_minmax(0,1fr)]",children:[u.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[u.jsxs("div",{className:"flex shrink-0 flex-col gap-1 border-b border-border px-3 py-1.5",children:[u.jsx("h2",{className:"text-[13px] font-semibold tracking-tight",children:"Branches"}),u.jsx("input",{type:"search",value:C,onChange:R=>N(R.target.value),placeholder:"Search branches…",className:"w-full rounded border border-border bg-background px-2 py-1 text-[11px] outline-none focus:border-foreground"})]}),u.jsxs("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:[u.jsx(A2,{label:"Local",tree:D,onSelect:j,defaultOpen:!0,forceOpen:L}),u.jsx(A2,{label:"Remote",tree:A,onSelect:j,forceOpen:L})]})]}),u.jsxs("div",{className:"grid min-h-0 min-w-0 grid-rows-[minmax(0,3fr)_minmax(0,2fr)]",children:[u.jsx(BF,{selectedCommit:y,selectedFile:m,diff:g,diffLoading:b,diffError:v}),u.jsxs("div",{className:"grid min-h-0 min-w-0 grid-cols-[minmax(0,1fr)_280px]",children:[u.jsx(UF,{commits:t,loading:i,error:n,selectedHash:a,maxLanes:x,rowRefs:G,onSelect:l,onLoadMore:w}),u.jsx(zF,{files:c,filesError:h,selectedHash:a,selectedFile:m,onSelect:f})]})]})]})}const L0=300,qF=600,KF=new Set(["md","mdx","markdown","txt","rst","adoc","json","jsonc","json5","yaml","yml","toml","xml","ini","cfg","conf","env","properties","csv","tsv","lock","svg","map","snap","png","jpg","jpeg","gif","ico","webp"]);function GF(e){const t=e.toLowerCase();if(t.endsWith(".d.ts")||t.endsWith(".min.js")||t.endsWith(".min.css"))return!1;const i=t.lastIndexOf(".");return i<0?!0:!KF.has(t.slice(i+1))}function WF(e){return e>=qF?"danger":e>=L0?"warn":"ok"}const YF={ok:"bg-emerald-500/60",warn:"bg-amber-500/70",danger:"bg-destructive/70"},XF={ok:"text-muted-foreground",warn:"text-amber-600 dark:text-amber-400",danger:"text-destructive"};function ZF({onOpenFile:e}){const[t,i]=E.useState([]),[n,a]=E.useState(!0),[l,c]=E.useState(null),[h,m]=E.useState(!0);function f(){a(!0),c(null),pM().then(i).catch(y=>c(y instanceof Error?y.message:String(y))).finally(()=>a(!1))}E.useEffect(()=>{f()},[]);const g=E.useMemo(()=>h?t.filter(y=>GF(y.path)):t,[t,h]),b=t.length-g.length,v=g[0]?.lines??1,x=g.filter(y=>y.lines>=L0).length;return u.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[u.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[u.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[u.jsx(V2,{className:"size-4"}),u.jsx("span",{className:"font-semibold text-foreground",children:"Largest files"}),!n&&!l?u.jsxs("span",{children:[g.length," files · ",x," over ",L0," lines",h&&b>0?` · ${b} data/docs hidden`:""]}):null]}),u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsxs(de,{size:"sm",variant:h?"default":"outline",className:"h-7",onClick:()=>m(y=>!y),title:"Hide docs, data, config and generated files",type:"button",children:[u.jsx(U2,{}),"Code only"]}),u.jsxs(de,{size:"sm",variant:"outline",className:"h-7",onClick:f,disabled:n,type:"button",children:[n?u.jsx(as,{className:"animate-spin"}):u.jsx(Eh,{}),"Refresh"]})]})]}),l?u.jsx(dt,{variant:"destructive",className:"m-3",children:l}):n&&t.length===0?u.jsxs("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:[u.jsx(as,{className:"mr-2 size-4 animate-spin"}),"Scanning tracked files…"]}):g.length===0?u.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:t.length===0?"No tracked text files found.":"No code files — toggle off “Code only” to see data & docs."}):u.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border/60 overflow-auto",children:g.map((y,w)=>{const C=WF(y.lines);return u.jsx("li",{children:u.jsxs("button",{type:"button",onClick:()=>e(y.path),className:"group flex w-full items-center gap-3 px-3 py-1.5 text-left transition-colors hover:bg-muted/50",children:[u.jsx("span",{className:"w-6 shrink-0 text-right font-mono text-[10px] text-muted-foreground",children:w+1}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsx("span",{className:"truncate font-mono text-[11px]",children:y.path}),u.jsxs("span",{className:fe("shrink-0 font-mono text-[11px] tabular-nums",XF[C]),children:[y.truncated?"≥":"",y.lines.toLocaleString()," lines"]})]}),u.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded-full bg-muted",children:u.jsx("div",{className:fe("h-full rounded-full",YF[C]),style:{width:`${Math.max(2,y.lines/v*100)}%`}})})]})]})},y.path)})})]})}function QF({data:e}){const[t,i]=E.useState("changes"),[n,a]=E.useState("changes"),[l,c]=E.useState(e.git.status?.files[0]?.path??""),[h,m]=E.useState(""),[f,g]=E.useState([]),[b,v]=E.useState(null),[x,y]=E.useState(""),[w,C]=E.useState(null),[N,T]=E.useState(0),[D,A]=E.useState(null),[L,G]=E.useState(()=>new Set),j=e.git.status?.files??[],R=E.useMemo(()=>{const ie=new Set(j.map(me=>me.path)),le=[...L].filter(me=>!ie.has(me)).sort().map(me=>({path:me,index:" ",workingTree:"M"}));return[...j,...le]},[j,L]),H=E.useMemo(()=>R.map(ie=>ie.path),[R]),I=E.useMemo(()=>vI(x),[x]);E.useEffect(()=>{const ie=R[0]?.path??"";c(le=>le&&R.some(me=>me.path===le)?le:ie)},[R]),E.useEffect(()=>{if(t!=="all"||f.length>0)return;let ie=!0;return v(null),mM().then(le=>{ie&&g(le)}).catch(le=>{ie&&v(le instanceof Error?le.message:String(le))}),()=>{ie=!1}},[t,f.length]),E.useEffect(()=>{if(!l){y("");return}let ie=!0;return C(null),bM(l).then(le=>{ie&&(y(le),T(0),A(null))}).catch(le=>{ie&&C(le instanceof Error?le.message:String(le))}),()=>{ie=!1}},[l]);function W(ie){T(0),A(null),c(ie)}function J(){const ie=LF({activeHunkIndex:N,filePaths:H,hunkCount:I.hunks,pendingNextFilePath:D,selectedFile:l});ie.kind==="hunk"?(A(null),T(ie.activeHunkIndex)):ie.kind==="confirm-next-file"?A(ie.filePath):ie.kind==="file"?W(ie.filePath):A(null)}function P(){if(A(null),N>0){T(me=>me-1);return}const ie=R.findIndex(me=>me.path===l),le=R[ie-1];le&&W(le.path)}const te=R.findIndex(ie=>ie.path===l),K=!!(I.hunks&&N<I.hunks-1||R[te+1]),M=!!(N>0||R[te-1]),$=D?`End of file. Click Next again to open ${D}.`:null,F=ie=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${ie?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,V=ie=>`flex-1 px-2 py-0.5 text-[11px] font-medium transition-colors ${ie?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,Y=E.useMemo(()=>{const ie=new Set(R.map(le=>le.path));for(const le of L)ie.add(le);return ie},[R,L]);if(!e.git.selectedRepository)return u.jsx(JF,{});function O(){h&&(i("changes"),a("changes"),W(h))}function ee(ie){G(le=>new Set(le).add(ie)),m(ie),i("changes"),a("changes"),W(ie)}function ue(ie){m(ie),i("all")}return u.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[u.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[u.jsx("button",{type:"button",className:F(t==="changes"),onClick:()=>i("changes"),children:"Changes"}),u.jsx("button",{type:"button","aria-label":"Open all tracked files",className:F(t==="all"),onClick:()=>i("all"),children:"All files"}),u.jsx("button",{type:"button",className:F(t==="graph"),onClick:()=>i("graph"),children:"Tree"}),u.jsx("button",{type:"button",className:F(t==="largest"),onClick:()=>i("largest"),children:"Largest files"})]}),u.jsx("div",{className:"min-h-0 flex-1",children:t==="graph"?u.jsx(VF,{branches:e.git.branches??[]}):t==="largest"?u.jsx(ZF,{onOpenFile:ue}):t==="all"?u.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[u.jsx("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:b?u.jsx(dt,{variant:"destructive",className:"m-3",children:b}):u.jsx(vw,{branch:e.git.status?.branch||void 0,onSelectFile:m,paths:f,root:e.git.cwd,selectedFile:h,status:R})}),u.jsx(jF,{isModified:Y.has(h),onFileSaved:ee,onViewDiff:O,path:h})]}):u.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[u.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:[u.jsxs("div",{className:"flex shrink-0 gap-0.5 border-b border-border bg-card/95 p-1",children:[u.jsx("button",{"aria-label":"Show changed files as a list",className:V(n==="changes"),onClick:()=>a("changes"),type:"button",children:"Changes"}),u.jsx("button",{"aria-label":"Show changed files as a tree",className:V(n==="tree"),onClick:()=>a("tree"),type:"button",children:"Tree"})]}),n==="changes"?u.jsx(wI,{branch:e.git.status?.branch||void 0,error:e.git.error,files:R,selectedFile:l,onSelectFile:W,root:e.git.cwd}):u.jsx(vw,{branch:e.git.status?.branch||void 0,defaultExpandAll:!0,emptyMessage:e.git.error??"No changed files.",onSelectFile:W,paths:H,root:e.git.cwd,selectedFile:l,status:R,title:"Changes"})]}),u.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[u.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:l||"Diff"}),u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[u.jsx("span",{children:"Long rows wrap inside the editor pane."}),I.additions||I.deletions?u.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[u.jsxs("span",{className:"text-emerald-700",children:["+",I.additions]}),u.jsxs("span",{className:"text-red-700",children:["-",I.deletions]})]}):null]})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[$?u.jsx("span",{className:"max-w-72 truncate rounded border border-amber-200 bg-amber-50 px-2 py-1 text-[11px] text-amber-900",children:$}):null,u.jsxs(de,{disabled:!l||!M,onClick:P,size:"sm",type:"button",variant:"outline",children:[u.jsx(zT,{}),"Previous"]}),u.jsxs(de,{disabled:!l||!K,onClick:J,size:"sm",type:"button",variant:"outline",children:[u.jsx(LT,{}),"Next"]})]})]}),u.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:w?u.jsx("div",{className:"p-4",children:u.jsx(dt,{variant:"destructive",children:w})}):l?u.jsx(u3,{activeHunkIndex:N,diff:x||"No unstaged diff for this file."}):u.jsx("div",{className:"p-4",children:u.jsx(dt,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a changed file to inspect its diff."})})})]})]})})]})}function JF(){return u.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:u.jsxs("div",{className:"max-w-sm",children:[u.jsx(xA,{className:"mx-auto size-8 text-muted-foreground/50"}),u.jsx("p",{className:"mt-3 text-sm font-medium",children:"No Git project registered"}),u.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Add a folder that is a Git worktree to review changes, browse files, and inspect history. Use the project picker in the header to add one."})]})})}function e$({initialPath:e,onSelect:t,selectedPath:i}){const[n,a]=E.useState(e),[l,c]=E.useState(null),[h,m]=E.useState(null),[f,g]=E.useState(!1),b=t$(l);return E.useEffect(()=>{a(e)},[e]),E.useEffect(()=>{let v=!0;return g(!0),m(null),sE(n).then(x=>{v&&(c(x),t(x.path))}).catch(x=>{v&&m(x instanceof Error?x.message:String(x))}).finally(()=>{v&&g(!1)}),()=>{v=!1}},[n,t]),u.jsxs("div",{className:"rounded-md border border-border bg-background",children:[u.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[b?u.jsx(de,{"aria-label":"Open parent folder",onClick:()=>l&&a(l.parent),size:"icon",type:"button",variant:"ghost",children:u.jsx(Qs,{className:"rotate-90"})}):null,u.jsx("div",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:l?.path??n}),f?u.jsx(as,{className:"size-4 animate-spin text-muted-foreground"}):null]}),u.jsxs("div",{className:"max-h-56 overflow-auto p-1",children:[h?u.jsx(dt,{variant:"destructive",className:"m-1",children:h}):null,!h&&l?.entries.length===0?u.jsx(dt,{variant:"muted",className:"m-1 text-center",children:"No folders here."}):null,l?.entries.map(v=>u.jsxs(de,{className:fe("h-8 w-full justify-start rounded-sm px-2 text-left",i===v.path&&"bg-muted"),onClick:()=>a(v.path),title:v.path,type:"button",variant:"ghost",children:[u.jsx(Ha,{className:"text-accent"}),u.jsx("span",{className:"truncate",children:v.name})]},v.path))]})]})}function t$(e){return!!(e&&e.parent!==e.path)}function O2(e){return e.split(/[\\/]/).filter(Boolean).pop()??"project"}function i$({data:e,onRefresh:t}){const[i,n]=E.useState(!1),[a,l]=E.useState(e.git.cwd),[c,h]=E.useState(null),[m,f]=E.useState(!1),[g,b]=E.useState(e.git.cwd),v=E.useRef(null),x=e.git.selectedRepository,y=x?.name??(e.git.cwd?O2(e.git.cwd):"Add Git project"),{error:w,success:C}=qi(),N=n$({gitCwd:e.git.cwd});E.useEffect(()=>{l(e.git.cwd),b(e.git.cwd)},[e.git.cwd]),E.useEffect(()=>{if(!i)return;function j(R){v.current&&R.target instanceof Node&&!v.current.contains(R.target)&&n(!1)}return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[i]);async function T(j){try{await rs("/api/git/select",{name:j}),n(!1),await t(),C(`Switched to ${j}.`)}catch(R){w(R instanceof Error?R.message:String(R))}}async function D(j){const R=j.trim();if(!s$(R)){const H="Please add an absolute path. Paths beginning with ~ are not expanded here.";return h(H),w(H),!1}try{const H=O2(R);return await rs("/api/git/repositories",{name:H,path:R}),h(null),await t(),C(`Added Git project ${H}.`),!0}catch(H){const I=H instanceof Error?H.message:String(H);return h(I),w(I),!1}}async function A(j){try{await vM(j),await t(),C(`Removed Git project ${j}.`)}catch(R){w(R instanceof Error?R.message:String(R))}}async function L(j){j.preventDefault(),await D(a)&&n(!1)}function G(){h(null),b(N.selectedPath),f(!0)}return u.jsxs("div",{className:"relative z-50 flex items-center gap-2",ref:v,children:[u.jsxs(de,{className:"max-w-[220px] justify-start gap-2 rounded-md border-border bg-card",onClick:()=>n(j=>!j),size:"sm",type:"button",variant:"outline",children:[u.jsx(Ha,{className:"text-muted-foreground"}),u.jsx("span",{className:"truncate",children:y}),u.jsx(Qs,{className:fe("ml-auto transition-transform",i&&"rotate-180")})]}),u.jsx(de,{"aria-label":"Add Git project",onClick:G,size:"sm",type:"button",variant:"outline",children:u.jsx(zs,{})}),i?u.jsxs("div",{className:"absolute right-0 top-10 z-50 w-[min(380px,calc(100vw-2rem))] overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[u.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[u.jsx(oA,{className:"size-3.5 text-muted-foreground"}),u.jsx("div",{className:"text-xs font-semibold",children:"Git Projects"}),u.jsx(Ke,{className:"ml-auto h-5 px-1.5 text-[10px]",variant:"outline",children:e.config.gitRepositories.length})]}),u.jsx("div",{className:"max-h-72 overflow-auto",children:e.config.gitRepositories.length?u.jsx("div",{className:"divide-y divide-border",children:e.config.gitRepositories.map(j=>{const R=j.name===x?.name;return u.jsxs("div",{className:fe("group grid w-full grid-cols-[1fr_auto_auto] items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-muted",R&&"bg-muted/70"),children:[u.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{T(j.name)},type:"button",children:[u.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:j.name}),u.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:j.path})]}),R?u.jsx(Qo,{className:"size-3.5"}):u.jsx("span",{className:"size-3.5"}),u.jsx(de,{"aria-label":`Remove ${j.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{A(j.name)},size:"icon",title:`Remove ${j.name}`,type:"button",variant:"ghost",children:u.jsx(qc,{className:"size-3.5 text-destructive"})})]},j.name)})}):u.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No saved Git projects yet."})}),u.jsxs("div",{className:"border-t border-border bg-muted/20 p-2",children:[u.jsxs("form",{className:"flex gap-1.5",onSubmit:L,children:[u.jsx(ot,{"aria-label":"Paste absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:j=>{l(j.target.value),h(null)},placeholder:"/absolute/path",value:a}),u.jsxs(de,{className:"h-7 px-2 text-[11px]",size:"sm",type:"submit",children:[u.jsx(zs,{className:"size-3"}),"Add"]}),u.jsx(de,{"aria-label":"Browse and add Git project",className:"h-7 px-2",onClick:G,size:"sm",type:"button",variant:"outline",children:u.jsx(wA,{className:"size-3"})})]}),c?u.jsx("div",{className:"mt-1.5 truncate text-[10px] text-destructive",children:c}):null]})]}):null,m?u.jsx(r$,{confirmLabel:N.confirmLabel,errorMessage:c,initialPath:N.initialPath,selectedPath:g,title:"Add Git Project",onCancel:()=>f(!1),onSelect:b,onUse:async()=>{await D(g)&&(f(!1),n(!1))}}):null]})}function s$(e){return e.startsWith("/")}function n$({gitCwd:e}){return{confirmLabel:"Add Git project",initialPath:e,selectedPath:e}}function r$({confirmLabel:e="Use this folder",errorMessage:t,initialPath:i,onCancel:n,onSelect:a,onUse:l,selectedPath:c,title:h="Choose Git Project Folder"}){return __.createPortal(u.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",children:u.jsxs("div",{className:"w-full max-w-2xl rounded-xl border border-border bg-card p-4 shadow-xl",children:[u.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[u.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg border border-border bg-background",children:u.jsx(Ha,{className:"size-4"})}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("div",{className:"text-sm font-semibold",children:h}),u.jsx("div",{className:"truncate font-mono text-xs text-muted-foreground",children:c})]}),u.jsx(de,{"aria-label":"Close folder picker",onClick:n,size:"icon",variant:"ghost",children:u.jsx(Js,{})})]}),u.jsx(e$,{initialPath:i,onSelect:a,selectedPath:c}),t?u.jsx("div",{className:"mt-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:t}):null,u.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[u.jsx(de,{onClick:n,type:"button",variant:"outline",children:"Cancel"}),u.jsx(de,{onClick:()=>{l()},type:"button",children:e})]})]})}),document.body)}function a$({branches:e,currentBranch:t,disabled:i,onRefresh:n}){const[a,l]=E.useState(!1),[c,h]=E.useState(""),[m,f]=E.useState(null),[g,b]=E.useState(null),[v,x]=E.useState(null),y=e.filter(A=>!A.remote),w=e.filter(A=>A.remote);async function C(A,L){f(A),x(null),b(null);try{await L(),await n()}catch(G){x(G instanceof Error?G.message:String(G))}finally{f(null)}}async function N(A){await C(`switch:${A}`,async()=>{await rs("/api/git/branches/switch",{name:A}),l(!1)})}async function T(){await C("fetch",async()=>{await rs("/api/git/fetch",{}),b("Fetched latest branch refs.")})}async function D(A){A.preventDefault();const L=c.trim();if(!L){x("Branch name is required.");return}await C("create",async()=>{await rs("/api/git/branches",{name:L}),h(""),l(!1)})}return u.jsxs("div",{className:"fixed bottom-12 right-4 z-50 flex items-end",children:[a?u.jsxs("div",{"aria-label":"Switch Git branch",className:"mb-11 w-[min(460px,calc(100vw-2rem))] rounded-lg border border-border bg-card shadow-xl",role:"dialog",children:[u.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border p-3",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx(Ac,{className:"size-4 text-muted-foreground"}),u.jsx("span",{className:"truncate text-sm font-semibold",children:t||"Branches"})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.jsx(de,{"aria-label":"Fetch branches",disabled:i||m!==null,onClick:()=>{T()},size:"icon",title:"Fetch branches",type:"button",variant:"ghost",children:u.jsx(Eh,{className:fe(m==="fetch"&&"animate-spin")})}),u.jsx(de,{"aria-label":"Close branch dialog",onClick:()=>l(!1),size:"icon",type:"button",variant:"ghost",children:u.jsx(Js,{})})]})]}),u.jsx("div",{className:"max-h-72 overflow-auto",children:e.length?u.jsxs(u.Fragment,{children:[u.jsx(j2,{branches:y,busy:m!==null,disabled:i,label:"Local",onSwitch:N}),u.jsx(j2,{branches:w,busy:m!==null,disabled:i,label:"Remote",onSwitch:N})]}):u.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No branches found."})}),u.jsxs("div",{className:"border-t border-border p-3",children:[u.jsxs("form",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",onSubmit:D,children:[u.jsx(ot,{"aria-label":"New branch name",disabled:i||m!==null,onChange:A=>{h(A.target.value),x(null),b(null)},placeholder:"feature/new-work",value:c}),u.jsxs(de,{disabled:i||m!==null,type:"submit",children:[u.jsx(MA,{}),"Create"]})]}),v||g?u.jsx(dt,{className:"mt-3 px-3 py-2 text-xs",variant:v?"destructive":"muted",children:v??g}):null]})]}):null,u.jsxs(de,{className:"h-8 max-w-[260px] gap-2 rounded-md shadow-lg",disabled:i,onClick:()=>l(A=>!A),size:"sm",title:"Switch Git branch",type:"button",variant:"default",children:[u.jsx(Ac,{className:"size-4"}),u.jsx("span",{className:"truncate font-mono text-xs",children:t||"No branch"}),u.jsx(Qs,{className:fe("size-4 transition-transform",a&&"rotate-180")})]})]})}function j2({branches:e,busy:t,disabled:i,label:n,onSwitch:a}){return u.jsxs("section",{children:[u.jsx("div",{className:"border-b border-border bg-muted/60 px-3 py-1.5 text-[11px] font-semibold uppercase text-muted-foreground",children:n}),e.length?e.map(l=>u.jsxs("button",{className:fe("grid w-full grid-cols-[1fr_auto] items-center gap-2 border-b border-border px-3 py-2 text-left text-sm last:border-b-0 hover:bg-muted",l.current&&"bg-muted/70"),disabled:i||t||l.current,onClick:()=>{a(l.name)},type:"button",children:[u.jsxs("span",{className:"min-w-0",children:[u.jsx("span",{className:"block truncate font-medium",children:l.name}),l.upstream?u.jsxs("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:["tracks ",l.upstream]}):null]}),u.jsx(Ke,{variant:l.current?"success":l.remote?"outline":"secondary",children:l.current?"current":l.remote?"remote":"local"})]},`${l.remote?"remote":"local"}:${l.name}`)):u.jsxs("div",{className:"border-b border-border px-3 py-3 text-sm text-muted-foreground",children:["No ",n.toLowerCase()," branches."]})]})}const pN="nomoreide-theme";function o$(){if(typeof window>"u")return"light";const e=window.localStorage.getItem(pN);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function l$(e){const t=document.documentElement;t.classList.toggle("dark",e==="dark"),t.style.colorScheme=e}function c$(){const[e,t]=E.useState(()=>o$()),i=E.useRef(null);E.useEffect(()=>{l$(e),window.localStorage.setItem(pN,e)},[e]);const n=E.useCallback(()=>{const a=e==="dark"?"light":"dark",l=i.current,c=document;if(!l||!c.startViewTransition||window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(a);return}const h=l.getBoundingClientRect(),m=h.left+h.width/2,f=h.top+h.height/2,g=Math.hypot(Math.max(m,window.innerWidth-m),Math.max(f,window.innerHeight-f));c.startViewTransition(()=>{t(a)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${m}px ${f}px)`,`circle(${g}px at ${m}px ${f}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},[e]);return u.jsx("button",{ref:i,onClick:n,title:e==="dark"?"Switch to light mode":"Switch to dark mode","aria-label":"Toggle theme",className:fe(yE({variant:"outline",size:"sm"}),"px-2"),children:e==="dark"?u.jsx(D4,{}):u.jsx(KA,{})})}function u$(e=!1){return fe("group/sidebar hidden h-full shrink-0 overflow-x-hidden overflow-y-auto border-r border-border bg-card/85 py-5 backdrop-blur transition-[width,padding] duration-200 md:flex md:flex-col",e?"w-64 px-4":"w-16 px-2 hover:w-64 hover:px-4")}function d$(e,t=!1){return fe("relative grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center justify-start gap-0 overflow-hidden rounded-md px-0 text-[15px] font-medium transition-[background-color,color,width] duration-150",t?"w-full":"w-12 group-hover/sidebar:w-full",e?"bg-primary text-primary-foreground hover:bg-primary/90":"hover:bg-muted")}function h$(e=!1,t=!1){return fe("min-w-0 overflow-hidden text-left text-current transition duration-150 whitespace-pre",e?"translate-x-1 opacity-100":"opacity-0 group-hover/sidebar:translate-x-1 group-hover/sidebar:opacity-100",t?"pr-10":"pr-3")}function f$(e=!1){return fe("flex size-12 items-center justify-center text-current transition-transform duration-150 [&_svg]:size-5",e?"translate-x-0":"-translate-x-px group-hover/sidebar:translate-x-0")}function m$({docked:e,onToggleDock:t}){return u.jsxs("div",{className:fe("mt-auto flex h-10 min-w-0 items-center overflow-hidden border-t border-border/60 text-[11px] text-muted-foreground transition-[height,opacity,width] duration-150",e?"w-full justify-start opacity-100":"w-12 justify-center group-hover/sidebar:w-full group-hover/sidebar:justify-start group-hover/sidebar:opacity-100"),children:[u.jsxs("span",{className:fe("flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-pre transition-[opacity,width] duration-150",e?"flex-1 opacity-100":"w-0 flex-none opacity-0 group-hover/sidebar:w-auto group-hover/sidebar:flex-1 group-hover/sidebar:opacity-100"),children:[u.jsx("span",{children:"Made with"}),u.jsx(DA,{"aria-label":"love",className:"size-3 shrink-0 fill-red-500 text-red-500"}),u.jsx("span",{children:"by Robert Wang"}),u.jsx("a",{"aria-label":"Robert Wang on LinkedIn",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-[#0A66C2]",href:"https://www.linkedin.com/in/robert-wang-cs/",rel:"noopener noreferrer",target:"_blank",title:"LinkedIn",children:u.jsx("svg",{"aria-hidden":!0,className:"size-3 fill-current",role:"img",viewBox:"0 0 24 24",children:u.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.063 2.063 0 1 1 0-4.126 2.063 2.063 0 0 1 0 4.126zM7.119 20.452H3.554V9h3.565v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.225 0z"})})})]}),u.jsx("button",{"aria-label":e?"Undock sidebar":"Dock sidebar","aria-pressed":e,className:fe("flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-4",e?"ml-auto bg-muted text-foreground":"group-hover/sidebar:ml-auto"),onClick:t,title:e?"Undock sidebar":"Dock sidebar",type:"button",children:e?u.jsx(e4,{}):u.jsx(i4,{})})]})}function p$({className:e}){return u.jsxs("div",{className:fe("min-w-0",e),children:[u.jsxs("div",{className:"flex items-baseline gap-1.5",children:[u.jsx("div",{className:"text-sm font-semibold",children:"NoMoreIDE"}),u.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:["v","0.1.39"]})]}),u.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:"127.0.0.1 console"})]})}function g$(){const[e,t]=E.useState(()=>window.location.pathname.startsWith("/agent")?"agent":window.location.pathname.startsWith("/errors")?"errors":window.location.pathname.startsWith("/database")?"database":window.location.pathname.startsWith("/terminal")?"terminal":window.location.pathname.startsWith("/git")?"git":"services"),[i,n]=E.useState(null),[a,l]=E.useState(null),[c,h]=E.useState(!0),{error:m,success:f}=qi(),[g,b]=E.useState(()=>window.localStorage.getItem("nomoreide:sidebar-docked")==="true"),v=E.useCallback(async(y={})=>{y.silent||h(!0),l(null);try{n(await SM()),y.notify&&f("Dashboard refreshed.")}catch(w){const C=w instanceof Error?w.message:String(w);l(C),m(C)}finally{h(!1)}},[m,f]);E.useEffect(()=>{v()},[v]),E.useEffect(()=>{function y(){document.visibilityState==="visible"&&v({silent:!0})}const w=window.setInterval(y,5e3);return window.addEventListener("focus",y),document.addEventListener("visibilitychange",y),()=>{window.clearInterval(w),window.removeEventListener("focus",y),document.removeEventListener("visibilitychange",y)}},[e,v]),E.useEffect(()=>{const y=e==="git"?"/git":e==="agent"?"/agent":e==="errors"?"/errors":e==="database"?"/database":e==="terminal"?"/terminal":"/";window.location.pathname!==y&&window.history.pushState(null,"",y)},[e]),E.useEffect(()=>{window.localStorage.setItem("nomoreide:sidebar-docked",String(g))},[g]);const x=E.useMemo(()=>i?Object.values(i.runtime.services).filter(y=>y.state==="running").length:0,[i]);return u.jsxs("div",{className:"h-screen overflow-hidden pb-9",children:[u.jsxs("div",{className:"mx-auto flex h-full max-w-[1500px]",children:[u.jsxs("aside",{className:u$(g),children:[u.jsxs("div",{className:fe("grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden transition-[width] duration-150",g?"w-full":"w-12 group-hover/sidebar:w-full"),children:[u.jsx("div",{className:"flex size-12 items-center justify-center",children:u.jsx("div",{className:"flex size-9 items-center justify-center overflow-hidden rounded-md bg-primary text-primary-foreground",children:u.jsxs("svg",{"aria-label":"NoMoreIDE",className:"size-6",fill:"none",role:"img",viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M5 17C5 13.69 7.69 11 11 11H25L31 17H53C56.31 17 59 19.69 59 23V53C59 56.31 56.31 59 53 59H11C7.69 59 5 56.31 5 53V17Z",fill:"currentColor"}),u.jsx("path",{d:"M22 31L30 39L22 47",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"4.5"}),u.jsx("path",{d:"M36 47H48",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeWidth:"4.5"})]})})}),u.jsx(p$,{className:fe("min-w-0 translate-x-1 overflow-hidden transition-opacity duration-200",g?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100")})]}),u.jsxs("nav",{className:"mt-5 grid flex-1 content-start gap-1",children:[u.jsx(zo,{active:e==="services",badge:x,docked:g,icon:u.jsx(S4,{}),label:"Services",onClick:()=>t("services")}),u.jsx(zo,{active:e==="git",docked:g,icon:u.jsx(Ac,{}),label:"Git Review",onClick:()=>t("git")}),u.jsx(zo,{active:e==="errors",docked:g,icon:u.jsx(pg,{}),label:"Error Inbox",onClick:()=>t("errors")}),u.jsx(zo,{active:e==="database",docked:g,icon:u.jsx(za,{}),label:"Database",onClick:()=>t("database")}),u.jsx(zo,{active:e==="terminal",docked:g,icon:u.jsx(A4,{}),label:"Terminal",onClick:()=>t("terminal")}),u.jsx(zo,{active:e==="agent",docked:g,icon:u.jsx(Tc,{}),label:"Agent",onClick:()=>t("agent")})]}),u.jsx(m$,{docked:g,onToggleDock:()=>b(y=>!y)})]}),u.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col px-0 py-0",children:[u.jsxs("header",{className:fe("relative z-40 flex shrink-0 flex-wrap items-center justify-between gap-3 border border-border bg-card/90 px-4 py-3 backdrop-blur","border-x-0 border-t-0 border-b"),children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(n4,{className:"size-4 text-muted-foreground md:hidden"}),u.jsxs("div",{children:[u.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:e==="git"?"Git Review":e==="agent"?"Agent":e==="errors"?"Error Inbox":e==="database"?"Database":e==="terminal"?"Terminal":"Services"}),u.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:i?.git.selectedRepository?.name??i?.git.cwd??"Local workspace"})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[a?u.jsx(Ke,{variant:"danger",children:a}):null,i&&e==="git"?u.jsx(i$,{data:i,onRefresh:v}):null,u.jsxs(de,{onClick:()=>{v({notify:!0})},size:"sm",title:"Refresh dashboard",variant:"outline",children:[u.jsx(Eh,{className:fe(c&&"animate-spin")}),"Refresh"]}),u.jsx(c$,{})]})]}),c&&!i?u.jsx(dt,{variant:"muted",children:"Loading NoMoreIDE state..."}):null,u.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[i&&e==="services"?u.jsx(mI,{data:i,onRefresh:v}):null,i&&e==="git"?u.jsx(QF,{data:i}):null,e==="agent"?u.jsx(X7,{}):null,e==="errors"?u.jsx(jj,{}):null,e==="database"?u.jsx(Aj,{}):null,e==="terminal"?u.jsx(_I,{}):null]})]})]}),i&&e==="git"?u.jsx(a$,{branches:i.git.branches,currentBranch:i.git.status?.branch||void 0,disabled:!i.git.status,onRefresh:v}):null,u.jsx(fj,{onOpenAgentPage:e==="agent"?void 0:()=>t("agent")})]})}function zo({active:e,badge:t,docked:i,icon:n,label:a,onClick:l}){const c=t!==void 0&&t>0;return u.jsxs(de,{"aria-label":a,title:a,className:d$(e,i),variant:"ghost",onClick:l,type:"button",children:[u.jsx("span",{className:f$(i),children:n}),u.jsx("span",{className:h$(i,c),children:a}),t!==void 0&&t>0?u.jsx(Ke,{appearance:t>0?"solid":"outline",className:fe("min-w-6 justify-center px-1.5 font-mono shadow-none",e?"border-primary-foreground/40 bg-primary-foreground/15 text-primary-foreground":t>0?"":"border-border bg-background text-muted-foreground","absolute right-1.5 top-1.5 h-4 min-w-4 rounded-full px-1 text-[10px] leading-none shadow-none group-hover/sidebar:right-2 group-hover/sidebar:top-1/2 group-hover/sidebar:-translate-y-1/2 group-hover/sidebar:text-xs",i&&"right-2 top-1/2 -translate-y-1/2 text-xs"),size:"small",variant:t>0?"success":"outline",children:t}):null]})}B2.createRoot(document.getElementById("root")).render(u.jsx(E.StrictMode,{children:u.jsx(g$,{})}));export{u as j,E as r};
139
+ ${m.subject}`,children:[u.jsx(PF,{lane:m.lane,laneCount:Math.max(m.laneCount,a),edges:m.edges,throughLanes:m.throughLanes,isMerge:m.parents.length>1,height:R2}),u.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:m.hash.slice(0,7)}),u.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[m.refs.map(f=>u.jsx("span",{className:FF(f.kind),children:f.name},`${f.kind}-${f.name}`)),u.jsx("span",{className:"truncate text-[12px]",children:m.subject})]}),u.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:m.author}),u.jsx("span",{className:"shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground/70",title:new Date(m.timestamp*1e3).toLocaleString(),children:HF(m.timestamp)})]})},m.hash))})})]})}function HF(e){if(!e)return"";const t=Math.max(0,Math.floor(Date.now()/1e3-e));if(t<60)return`${t}s`;const i=Math.floor(t/60);if(i<60)return`${i}m`;const n=Math.floor(i/60);if(n<24)return`${n}h`;const a=Math.floor(n/24);if(a<30)return`${a}d`;const l=Math.floor(a/30);return l<12?`${l}mo`:`${Math.floor(l/12)}y`}function FF(e){const t="rounded px-1.5 py-px text-[10px] font-medium";switch(e){case"head":return`${t} bg-emerald-100 text-emerald-800`;case"branch":return`${t} bg-blue-100 text-blue-800`;case"remote":return`${t} bg-slate-100 text-slate-700`;case"tag":return`${t} bg-amber-100 text-amber-800`}}const D2=200;function $F(){const[e,t]=E.useState([]),[i,n]=E.useState(D2),[a,l]=E.useState(!0),[c,h]=E.useState(null),[m,f]=E.useState(null),[g,b]=E.useState([]),[v,x]=E.useState(null),[y,w]=E.useState(null),[C,N]=E.useState(""),[T,D]=E.useState(!1),[A,L]=E.useState(null);E.useEffect(()=>{let R=!0;return l(!0),h(null),dM(i).then(H=>{R&&(t(H),H.length>0&&!H.some(I=>I.hash===m)&&f(H[0].hash))}).catch(H=>{R&&h(H instanceof Error?H.message:String(H))}).finally(()=>{R&&l(!1)}),()=>{R=!1}},[i]),E.useEffect(()=>{if(!m){b([]),w(null);return}let R=!0;return x(null),fM(m).then(H=>{R&&(b(H),w(H[0]?.path??null))}).catch(H=>{R&&x(H instanceof Error?H.message:String(H))}),()=>{R=!1}},[m]),E.useEffect(()=>{if(!m){N("");return}let R=!0;return L(null),D(!0),hM(m,y??void 0).then(H=>{R&&N(H)}).catch(H=>{R&&L(H instanceof Error?H.message:String(H))}).finally(()=>{R&&D(!1)}),()=>{R=!1}},[m,y]);const G=E.useMemo(()=>e.reduce((R,H)=>Math.max(R,H.laneCount),1),[e]),j=e.find(R=>R.hash===m)??null;return{commits:e,loading:a,error:c,selectedHash:m,setSelectedHash:f,files:g,filesError:v,selectedFile:y,setSelectedFile:w,diff:C,diffLoading:T,diffError:A,maxLanes:G,selectedCommit:j,loadMore:()=>n(R=>R+D2)}}function VF({branches:e=[]}){const{commits:t,loading:i,error:n,selectedHash:a,setSelectedHash:l,files:c,filesError:h,selectedFile:m,setSelectedFile:f,diff:g,diffLoading:b,diffError:v,maxLanes:x,selectedCommit:y,loadMore:w}=$F(),[C,N]=E.useState(""),T=E.useMemo(()=>{const R=C.trim().toLowerCase();return R?e.filter(H=>H.name.toLowerCase().includes(R)):e},[e,C]),D=E.useMemo(()=>T2(T.filter(R=>!R.remote)),[T]),A=E.useMemo(()=>T2(T.filter(R=>R.remote)),[T]),L=C.trim().length>0,G=E.useRef(new Map);function j(R){const H=R.remote?"remote":"branch",I=t.find(J=>J.refs.some(P=>P.kind===H&&P.name===R.name));if(!I)return;l(I.hash);const W=G.current.get(I.hash);W&&W.scrollIntoView({block:"center",behavior:"smooth"})}return u.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 grid-cols-[220px_minmax(0,1fr)]",children:[u.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[u.jsxs("div",{className:"flex shrink-0 flex-col gap-1 border-b border-border px-3 py-1.5",children:[u.jsx("h2",{className:"text-[13px] font-semibold tracking-tight",children:"Branches"}),u.jsx("input",{type:"search",value:C,onChange:R=>N(R.target.value),placeholder:"Search branches…",className:"w-full rounded border border-border bg-background px-2 py-1 text-[11px] outline-none focus:border-foreground"})]}),u.jsxs("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:[u.jsx(A2,{label:"Local",tree:D,onSelect:j,defaultOpen:!0,forceOpen:L}),u.jsx(A2,{label:"Remote",tree:A,onSelect:j,forceOpen:L})]})]}),u.jsxs("div",{className:"grid min-h-0 min-w-0 grid-rows-[minmax(0,3fr)_minmax(0,2fr)]",children:[u.jsx(BF,{selectedCommit:y,selectedFile:m,diff:g,diffLoading:b,diffError:v}),u.jsxs("div",{className:"grid min-h-0 min-w-0 grid-cols-[minmax(0,1fr)_280px]",children:[u.jsx(UF,{commits:t,loading:i,error:n,selectedHash:a,maxLanes:x,rowRefs:G,onSelect:l,onLoadMore:w}),u.jsx(zF,{files:c,filesError:h,selectedHash:a,selectedFile:m,onSelect:f})]})]})]})}const L0=300,qF=600,KF=new Set(["md","mdx","markdown","txt","rst","adoc","json","jsonc","json5","yaml","yml","toml","xml","ini","cfg","conf","env","properties","csv","tsv","lock","svg","map","snap","png","jpg","jpeg","gif","ico","webp"]);function GF(e){const t=e.toLowerCase();if(t.endsWith(".d.ts")||t.endsWith(".min.js")||t.endsWith(".min.css"))return!1;const i=t.lastIndexOf(".");return i<0?!0:!KF.has(t.slice(i+1))}function WF(e){return e>=qF?"danger":e>=L0?"warn":"ok"}const YF={ok:"bg-emerald-500/60",warn:"bg-amber-500/70",danger:"bg-destructive/70"},XF={ok:"text-muted-foreground",warn:"text-amber-600 dark:text-amber-400",danger:"text-destructive"};function ZF({onOpenFile:e}){const[t,i]=E.useState([]),[n,a]=E.useState(!0),[l,c]=E.useState(null),[h,m]=E.useState(!0);function f(){a(!0),c(null),pM().then(i).catch(y=>c(y instanceof Error?y.message:String(y))).finally(()=>a(!1))}E.useEffect(()=>{f()},[]);const g=E.useMemo(()=>h?t.filter(y=>GF(y.path)):t,[t,h]),b=t.length-g.length,v=g[0]?.lines??1,x=g.filter(y=>y.lines>=L0).length;return u.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[u.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[u.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[u.jsx(V2,{className:"size-4"}),u.jsx("span",{className:"font-semibold text-foreground",children:"Largest files"}),!n&&!l?u.jsxs("span",{children:[g.length," files · ",x," over ",L0," lines",h&&b>0?` · ${b} data/docs hidden`:""]}):null]}),u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsxs(de,{size:"sm",variant:h?"default":"outline",className:"h-7",onClick:()=>m(y=>!y),title:"Hide docs, data, config and generated files",type:"button",children:[u.jsx(U2,{}),"Code only"]}),u.jsxs(de,{size:"sm",variant:"outline",className:"h-7",onClick:f,disabled:n,type:"button",children:[n?u.jsx(as,{className:"animate-spin"}):u.jsx(Eh,{}),"Refresh"]})]})]}),l?u.jsx(dt,{variant:"destructive",className:"m-3",children:l}):n&&t.length===0?u.jsxs("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:[u.jsx(as,{className:"mr-2 size-4 animate-spin"}),"Scanning tracked files…"]}):g.length===0?u.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:t.length===0?"No tracked text files found.":"No code files — toggle off “Code only” to see data & docs."}):u.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border/60 overflow-auto",children:g.map((y,w)=>{const C=WF(y.lines);return u.jsx("li",{children:u.jsxs("button",{type:"button",onClick:()=>e(y.path),className:"group flex w-full items-center gap-3 px-3 py-1.5 text-left transition-colors hover:bg-muted/50",children:[u.jsx("span",{className:"w-6 shrink-0 text-right font-mono text-[10px] text-muted-foreground",children:w+1}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsx("span",{className:"truncate font-mono text-[11px]",children:y.path}),u.jsxs("span",{className:fe("shrink-0 font-mono text-[11px] tabular-nums",XF[C]),children:[y.truncated?"≥":"",y.lines.toLocaleString()," lines"]})]}),u.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded-full bg-muted",children:u.jsx("div",{className:fe("h-full rounded-full",YF[C]),style:{width:`${Math.max(2,y.lines/v*100)}%`}})})]})]})},y.path)})})]})}function QF({data:e}){const[t,i]=E.useState("changes"),[n,a]=E.useState("changes"),[l,c]=E.useState(e.git.status?.files[0]?.path??""),[h,m]=E.useState(""),[f,g]=E.useState([]),[b,v]=E.useState(null),[x,y]=E.useState(""),[w,C]=E.useState(null),[N,T]=E.useState(0),[D,A]=E.useState(null),[L,G]=E.useState(()=>new Set),j=e.git.status?.files??[],R=E.useMemo(()=>{const ie=new Set(j.map(me=>me.path)),le=[...L].filter(me=>!ie.has(me)).sort().map(me=>({path:me,index:" ",workingTree:"M"}));return[...j,...le]},[j,L]),H=E.useMemo(()=>R.map(ie=>ie.path),[R]),I=E.useMemo(()=>vI(x),[x]);E.useEffect(()=>{const ie=R[0]?.path??"";c(le=>le&&R.some(me=>me.path===le)?le:ie)},[R]),E.useEffect(()=>{if(t!=="all"||f.length>0)return;let ie=!0;return v(null),mM().then(le=>{ie&&g(le)}).catch(le=>{ie&&v(le instanceof Error?le.message:String(le))}),()=>{ie=!1}},[t,f.length]),E.useEffect(()=>{if(!l){y("");return}let ie=!0;return C(null),bM(l).then(le=>{ie&&(y(le),T(0),A(null))}).catch(le=>{ie&&C(le instanceof Error?le.message:String(le))}),()=>{ie=!1}},[l]);function W(ie){T(0),A(null),c(ie)}function J(){const ie=LF({activeHunkIndex:N,filePaths:H,hunkCount:I.hunks,pendingNextFilePath:D,selectedFile:l});ie.kind==="hunk"?(A(null),T(ie.activeHunkIndex)):ie.kind==="confirm-next-file"?A(ie.filePath):ie.kind==="file"?W(ie.filePath):A(null)}function P(){if(A(null),N>0){T(me=>me-1);return}const ie=R.findIndex(me=>me.path===l),le=R[ie-1];le&&W(le.path)}const te=R.findIndex(ie=>ie.path===l),K=!!(I.hunks&&N<I.hunks-1||R[te+1]),M=!!(N>0||R[te-1]),$=D?`End of file. Click Next again to open ${D}.`:null,F=ie=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${ie?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,V=ie=>`flex-1 px-2 py-0.5 text-[11px] font-medium transition-colors ${ie?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,Y=E.useMemo(()=>{const ie=new Set(R.map(le=>le.path));for(const le of L)ie.add(le);return ie},[R,L]);if(!e.git.selectedRepository)return u.jsx(JF,{});function O(){h&&(i("changes"),a("changes"),W(h))}function ee(ie){G(le=>new Set(le).add(ie)),m(ie),i("changes"),a("changes"),W(ie)}function ue(ie){m(ie),i("all")}return u.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[u.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[u.jsx("button",{type:"button",className:F(t==="changes"),onClick:()=>i("changes"),children:"Changes"}),u.jsx("button",{type:"button","aria-label":"Open all tracked files",className:F(t==="all"),onClick:()=>i("all"),children:"All files"}),u.jsx("button",{type:"button",className:F(t==="graph"),onClick:()=>i("graph"),children:"Tree"}),u.jsx("button",{type:"button",className:F(t==="largest"),onClick:()=>i("largest"),children:"Largest files"})]}),u.jsx("div",{className:"min-h-0 flex-1",children:t==="graph"?u.jsx(VF,{branches:e.git.branches??[]}):t==="largest"?u.jsx(ZF,{onOpenFile:ue}):t==="all"?u.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[u.jsx("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:b?u.jsx(dt,{variant:"destructive",className:"m-3",children:b}):u.jsx(vw,{branch:e.git.status?.branch||void 0,onSelectFile:m,paths:f,root:e.git.cwd,selectedFile:h,status:R})}),u.jsx(jF,{isModified:Y.has(h),onFileSaved:ee,onViewDiff:O,path:h})]}):u.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[u.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:[u.jsxs("div",{className:"flex shrink-0 gap-0.5 border-b border-border bg-card/95 p-1",children:[u.jsx("button",{"aria-label":"Show changed files as a list",className:V(n==="changes"),onClick:()=>a("changes"),type:"button",children:"Changes"}),u.jsx("button",{"aria-label":"Show changed files as a tree",className:V(n==="tree"),onClick:()=>a("tree"),type:"button",children:"Tree"})]}),n==="changes"?u.jsx(wI,{branch:e.git.status?.branch||void 0,error:e.git.error,files:R,selectedFile:l,onSelectFile:W,root:e.git.cwd}):u.jsx(vw,{branch:e.git.status?.branch||void 0,defaultExpandAll:!0,emptyMessage:e.git.error??"No changed files.",onSelectFile:W,paths:H,root:e.git.cwd,selectedFile:l,status:R,title:"Changes"})]}),u.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[u.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:l||"Diff"}),u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[u.jsx("span",{children:"Long rows wrap inside the editor pane."}),I.additions||I.deletions?u.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[u.jsxs("span",{className:"text-emerald-700",children:["+",I.additions]}),u.jsxs("span",{className:"text-red-700",children:["-",I.deletions]})]}):null]})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[$?u.jsx("span",{className:"max-w-72 truncate rounded border border-amber-200 bg-amber-50 px-2 py-1 text-[11px] text-amber-900",children:$}):null,u.jsxs(de,{disabled:!l||!M,onClick:P,size:"sm",type:"button",variant:"outline",children:[u.jsx(zT,{}),"Previous"]}),u.jsxs(de,{disabled:!l||!K,onClick:J,size:"sm",type:"button",variant:"outline",children:[u.jsx(LT,{}),"Next"]})]})]}),u.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:w?u.jsx("div",{className:"p-4",children:u.jsx(dt,{variant:"destructive",children:w})}):l?u.jsx(u3,{activeHunkIndex:N,diff:x||"No unstaged diff for this file."}):u.jsx("div",{className:"p-4",children:u.jsx(dt,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a changed file to inspect its diff."})})})]})]})})]})}function JF(){return u.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:u.jsxs("div",{className:"max-w-sm",children:[u.jsx(xA,{className:"mx-auto size-8 text-muted-foreground/50"}),u.jsx("p",{className:"mt-3 text-sm font-medium",children:"No Git project registered"}),u.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Add a folder that is a Git worktree to review changes, browse files, and inspect history. Use the project picker in the header to add one."})]})})}function e$({initialPath:e,onSelect:t,selectedPath:i}){const[n,a]=E.useState(e),[l,c]=E.useState(null),[h,m]=E.useState(null),[f,g]=E.useState(!1),b=t$(l);return E.useEffect(()=>{a(e)},[e]),E.useEffect(()=>{let v=!0;return g(!0),m(null),sE(n).then(x=>{v&&(c(x),t(x.path))}).catch(x=>{v&&m(x instanceof Error?x.message:String(x))}).finally(()=>{v&&g(!1)}),()=>{v=!1}},[n,t]),u.jsxs("div",{className:"rounded-md border border-border bg-background",children:[u.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[b?u.jsx(de,{"aria-label":"Open parent folder",onClick:()=>l&&a(l.parent),size:"icon",type:"button",variant:"ghost",children:u.jsx(Qs,{className:"rotate-90"})}):null,u.jsx("div",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:l?.path??n}),f?u.jsx(as,{className:"size-4 animate-spin text-muted-foreground"}):null]}),u.jsxs("div",{className:"max-h-56 overflow-auto p-1",children:[h?u.jsx(dt,{variant:"destructive",className:"m-1",children:h}):null,!h&&l?.entries.length===0?u.jsx(dt,{variant:"muted",className:"m-1 text-center",children:"No folders here."}):null,l?.entries.map(v=>u.jsxs(de,{className:fe("h-8 w-full justify-start rounded-sm px-2 text-left",i===v.path&&"bg-muted"),onClick:()=>a(v.path),title:v.path,type:"button",variant:"ghost",children:[u.jsx(Ha,{className:"text-accent"}),u.jsx("span",{className:"truncate",children:v.name})]},v.path))]})]})}function t$(e){return!!(e&&e.parent!==e.path)}function O2(e){return e.split(/[\\/]/).filter(Boolean).pop()??"project"}function i$({data:e,onRefresh:t}){const[i,n]=E.useState(!1),[a,l]=E.useState(e.git.cwd),[c,h]=E.useState(null),[m,f]=E.useState(!1),[g,b]=E.useState(e.git.cwd),v=E.useRef(null),x=e.git.selectedRepository,y=x?.name??(e.git.cwd?O2(e.git.cwd):"Add Git project"),{error:w,success:C}=qi(),N=n$({gitCwd:e.git.cwd});E.useEffect(()=>{l(e.git.cwd),b(e.git.cwd)},[e.git.cwd]),E.useEffect(()=>{if(!i)return;function j(R){v.current&&R.target instanceof Node&&!v.current.contains(R.target)&&n(!1)}return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[i]);async function T(j){try{await rs("/api/git/select",{name:j}),n(!1),await t(),C(`Switched to ${j}.`)}catch(R){w(R instanceof Error?R.message:String(R))}}async function D(j){const R=j.trim();if(!s$(R)){const H="Please add an absolute path. Paths beginning with ~ are not expanded here.";return h(H),w(H),!1}try{const H=O2(R);return await rs("/api/git/repositories",{name:H,path:R}),h(null),await t(),C(`Added Git project ${H}.`),!0}catch(H){const I=H instanceof Error?H.message:String(H);return h(I),w(I),!1}}async function A(j){try{await vM(j),await t(),C(`Removed Git project ${j}.`)}catch(R){w(R instanceof Error?R.message:String(R))}}async function L(j){j.preventDefault(),await D(a)&&n(!1)}function G(){h(null),b(N.selectedPath),f(!0)}return u.jsxs("div",{className:"relative z-50 flex items-center gap-2",ref:v,children:[u.jsxs(de,{className:"max-w-[220px] justify-start gap-2 rounded-md border-border bg-card",onClick:()=>n(j=>!j),size:"sm",type:"button",variant:"outline",children:[u.jsx(Ha,{className:"text-muted-foreground"}),u.jsx("span",{className:"truncate",children:y}),u.jsx(Qs,{className:fe("ml-auto transition-transform",i&&"rotate-180")})]}),u.jsx(de,{"aria-label":"Add Git project",onClick:G,size:"sm",type:"button",variant:"outline",children:u.jsx(zs,{})}),i?u.jsxs("div",{className:"absolute right-0 top-10 z-50 w-[min(380px,calc(100vw-2rem))] overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[u.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[u.jsx(oA,{className:"size-3.5 text-muted-foreground"}),u.jsx("div",{className:"text-xs font-semibold",children:"Git Projects"}),u.jsx(Ke,{className:"ml-auto h-5 px-1.5 text-[10px]",variant:"outline",children:e.config.gitRepositories.length})]}),u.jsx("div",{className:"max-h-72 overflow-auto",children:e.config.gitRepositories.length?u.jsx("div",{className:"divide-y divide-border",children:e.config.gitRepositories.map(j=>{const R=j.name===x?.name;return u.jsxs("div",{className:fe("group grid w-full grid-cols-[1fr_auto_auto] items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-muted",R&&"bg-muted/70"),children:[u.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{T(j.name)},type:"button",children:[u.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:j.name}),u.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:j.path})]}),R?u.jsx(Qo,{className:"size-3.5"}):u.jsx("span",{className:"size-3.5"}),u.jsx(de,{"aria-label":`Remove ${j.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{A(j.name)},size:"icon",title:`Remove ${j.name}`,type:"button",variant:"ghost",children:u.jsx(qc,{className:"size-3.5 text-destructive"})})]},j.name)})}):u.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No saved Git projects yet."})}),u.jsxs("div",{className:"border-t border-border bg-muted/20 p-2",children:[u.jsxs("form",{className:"flex gap-1.5",onSubmit:L,children:[u.jsx(ot,{"aria-label":"Paste absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:j=>{l(j.target.value),h(null)},placeholder:"/absolute/path",value:a}),u.jsxs(de,{className:"h-7 px-2 text-[11px]",size:"sm",type:"submit",children:[u.jsx(zs,{className:"size-3"}),"Add"]}),u.jsx(de,{"aria-label":"Browse and add Git project",className:"h-7 px-2",onClick:G,size:"sm",type:"button",variant:"outline",children:u.jsx(wA,{className:"size-3"})})]}),c?u.jsx("div",{className:"mt-1.5 truncate text-[10px] text-destructive",children:c}):null]})]}):null,m?u.jsx(r$,{confirmLabel:N.confirmLabel,errorMessage:c,initialPath:N.initialPath,selectedPath:g,title:"Add Git Project",onCancel:()=>f(!1),onSelect:b,onUse:async()=>{await D(g)&&(f(!1),n(!1))}}):null]})}function s$(e){return e.startsWith("/")}function n$({gitCwd:e}){return{confirmLabel:"Add Git project",initialPath:e,selectedPath:e}}function r$({confirmLabel:e="Use this folder",errorMessage:t,initialPath:i,onCancel:n,onSelect:a,onUse:l,selectedPath:c,title:h="Choose Git Project Folder"}){return __.createPortal(u.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",children:u.jsxs("div",{className:"w-full max-w-2xl rounded-xl border border-border bg-card p-4 shadow-xl",children:[u.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[u.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg border border-border bg-background",children:u.jsx(Ha,{className:"size-4"})}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("div",{className:"text-sm font-semibold",children:h}),u.jsx("div",{className:"truncate font-mono text-xs text-muted-foreground",children:c})]}),u.jsx(de,{"aria-label":"Close folder picker",onClick:n,size:"icon",variant:"ghost",children:u.jsx(Js,{})})]}),u.jsx(e$,{initialPath:i,onSelect:a,selectedPath:c}),t?u.jsx("div",{className:"mt-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:t}):null,u.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[u.jsx(de,{onClick:n,type:"button",variant:"outline",children:"Cancel"}),u.jsx(de,{onClick:()=>{l()},type:"button",children:e})]})]})}),document.body)}function a$({branches:e,currentBranch:t,disabled:i,onRefresh:n}){const[a,l]=E.useState(!1),[c,h]=E.useState(""),[m,f]=E.useState(null),[g,b]=E.useState(null),[v,x]=E.useState(null),y=e.filter(A=>!A.remote),w=e.filter(A=>A.remote);async function C(A,L){f(A),x(null),b(null);try{await L(),await n()}catch(G){x(G instanceof Error?G.message:String(G))}finally{f(null)}}async function N(A){await C(`switch:${A}`,async()=>{await rs("/api/git/branches/switch",{name:A}),l(!1)})}async function T(){await C("fetch",async()=>{await rs("/api/git/fetch",{}),b("Fetched latest branch refs.")})}async function D(A){A.preventDefault();const L=c.trim();if(!L){x("Branch name is required.");return}await C("create",async()=>{await rs("/api/git/branches",{name:L}),h(""),l(!1)})}return u.jsxs("div",{className:"fixed bottom-12 right-4 z-50 flex items-end",children:[a?u.jsxs("div",{"aria-label":"Switch Git branch",className:"mb-11 w-[min(460px,calc(100vw-2rem))] rounded-lg border border-border bg-card shadow-xl",role:"dialog",children:[u.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border p-3",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx(Ac,{className:"size-4 text-muted-foreground"}),u.jsx("span",{className:"truncate text-sm font-semibold",children:t||"Branches"})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.jsx(de,{"aria-label":"Fetch branches",disabled:i||m!==null,onClick:()=>{T()},size:"icon",title:"Fetch branches",type:"button",variant:"ghost",children:u.jsx(Eh,{className:fe(m==="fetch"&&"animate-spin")})}),u.jsx(de,{"aria-label":"Close branch dialog",onClick:()=>l(!1),size:"icon",type:"button",variant:"ghost",children:u.jsx(Js,{})})]})]}),u.jsx("div",{className:"max-h-72 overflow-auto",children:e.length?u.jsxs(u.Fragment,{children:[u.jsx(j2,{branches:y,busy:m!==null,disabled:i,label:"Local",onSwitch:N}),u.jsx(j2,{branches:w,busy:m!==null,disabled:i,label:"Remote",onSwitch:N})]}):u.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No branches found."})}),u.jsxs("div",{className:"border-t border-border p-3",children:[u.jsxs("form",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",onSubmit:D,children:[u.jsx(ot,{"aria-label":"New branch name",disabled:i||m!==null,onChange:A=>{h(A.target.value),x(null),b(null)},placeholder:"feature/new-work",value:c}),u.jsxs(de,{disabled:i||m!==null,type:"submit",children:[u.jsx(MA,{}),"Create"]})]}),v||g?u.jsx(dt,{className:"mt-3 px-3 py-2 text-xs",variant:v?"destructive":"muted",children:v??g}):null]})]}):null,u.jsxs(de,{className:"h-8 max-w-[260px] gap-2 rounded-md shadow-lg",disabled:i,onClick:()=>l(A=>!A),size:"sm",title:"Switch Git branch",type:"button",variant:"default",children:[u.jsx(Ac,{className:"size-4"}),u.jsx("span",{className:"truncate font-mono text-xs",children:t||"No branch"}),u.jsx(Qs,{className:fe("size-4 transition-transform",a&&"rotate-180")})]})]})}function j2({branches:e,busy:t,disabled:i,label:n,onSwitch:a}){return u.jsxs("section",{children:[u.jsx("div",{className:"border-b border-border bg-muted/60 px-3 py-1.5 text-[11px] font-semibold uppercase text-muted-foreground",children:n}),e.length?e.map(l=>u.jsxs("button",{className:fe("grid w-full grid-cols-[1fr_auto] items-center gap-2 border-b border-border px-3 py-2 text-left text-sm last:border-b-0 hover:bg-muted",l.current&&"bg-muted/70"),disabled:i||t||l.current,onClick:()=>{a(l.name)},type:"button",children:[u.jsxs("span",{className:"min-w-0",children:[u.jsx("span",{className:"block truncate font-medium",children:l.name}),l.upstream?u.jsxs("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:["tracks ",l.upstream]}):null]}),u.jsx(Ke,{variant:l.current?"success":l.remote?"outline":"secondary",children:l.current?"current":l.remote?"remote":"local"})]},`${l.remote?"remote":"local"}:${l.name}`)):u.jsxs("div",{className:"border-b border-border px-3 py-3 text-sm text-muted-foreground",children:["No ",n.toLowerCase()," branches."]})]})}const pN="nomoreide-theme";function o$(){if(typeof window>"u")return"light";const e=window.localStorage.getItem(pN);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function l$(e){const t=document.documentElement;t.classList.toggle("dark",e==="dark"),t.style.colorScheme=e}function c$(){const[e,t]=E.useState(()=>o$()),i=E.useRef(null);E.useEffect(()=>{l$(e),window.localStorage.setItem(pN,e)},[e]);const n=E.useCallback(()=>{const a=e==="dark"?"light":"dark",l=i.current,c=document;if(!l||!c.startViewTransition||window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(a);return}const h=l.getBoundingClientRect(),m=h.left+h.width/2,f=h.top+h.height/2,g=Math.hypot(Math.max(m,window.innerWidth-m),Math.max(f,window.innerHeight-f));c.startViewTransition(()=>{t(a)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${m}px ${f}px)`,`circle(${g}px at ${m}px ${f}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},[e]);return u.jsx("button",{ref:i,onClick:n,title:e==="dark"?"Switch to light mode":"Switch to dark mode","aria-label":"Toggle theme",className:fe(yE({variant:"outline",size:"sm"}),"px-2"),children:e==="dark"?u.jsx(D4,{}):u.jsx(KA,{})})}function u$(e=!1){return fe("group/sidebar hidden h-full shrink-0 overflow-x-hidden overflow-y-auto border-r border-border bg-card/85 py-5 backdrop-blur transition-[width,padding] duration-200 md:flex md:flex-col",e?"w-64 px-4":"w-16 px-2 hover:w-64 hover:px-4")}function d$(e,t=!1){return fe("relative grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center justify-start gap-0 overflow-hidden rounded-md px-0 text-[15px] font-medium transition-[background-color,color,width] duration-150",t?"w-full":"w-12 group-hover/sidebar:w-full",e?"bg-primary text-primary-foreground hover:bg-primary/90":"hover:bg-muted")}function h$(e=!1,t=!1){return fe("min-w-0 overflow-hidden text-left text-current transition duration-150 whitespace-pre",e?"translate-x-1 opacity-100":"opacity-0 group-hover/sidebar:translate-x-1 group-hover/sidebar:opacity-100",t?"pr-10":"pr-3")}function f$(e=!1){return fe("flex size-12 items-center justify-center text-current transition-transform duration-150 [&_svg]:size-5",e?"translate-x-0":"-translate-x-px group-hover/sidebar:translate-x-0")}function m$({docked:e,onToggleDock:t}){return u.jsxs("div",{className:fe("mt-auto flex h-10 min-w-0 items-center overflow-hidden border-t border-border/60 text-[11px] text-muted-foreground transition-[height,opacity,width] duration-150",e?"w-full justify-start opacity-100":"w-12 justify-center group-hover/sidebar:w-full group-hover/sidebar:justify-start group-hover/sidebar:opacity-100"),children:[u.jsxs("span",{className:fe("flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-pre transition-[opacity,width] duration-150",e?"flex-1 opacity-100":"w-0 flex-none opacity-0 group-hover/sidebar:w-auto group-hover/sidebar:flex-1 group-hover/sidebar:opacity-100"),children:[u.jsx("span",{children:"Made with"}),u.jsx(DA,{"aria-label":"love",className:"size-3 shrink-0 fill-red-500 text-red-500"}),u.jsx("span",{children:"by Robert Wang"}),u.jsx("a",{"aria-label":"Robert Wang on LinkedIn",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-[#0A66C2]",href:"https://www.linkedin.com/in/robert-wang-cs/",rel:"noopener noreferrer",target:"_blank",title:"LinkedIn",children:u.jsx("svg",{"aria-hidden":!0,className:"size-3 fill-current",role:"img",viewBox:"0 0 24 24",children:u.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.063 2.063 0 1 1 0-4.126 2.063 2.063 0 0 1 0 4.126zM7.119 20.452H3.554V9h3.565v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.225 0z"})})})]}),u.jsx("button",{"aria-label":e?"Undock sidebar":"Dock sidebar","aria-pressed":e,className:fe("flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-4",e?"ml-auto bg-muted text-foreground":"group-hover/sidebar:ml-auto"),onClick:t,title:e?"Undock sidebar":"Dock sidebar",type:"button",children:e?u.jsx(e4,{}):u.jsx(i4,{})})]})}function p$({className:e}){return u.jsxs("div",{className:fe("min-w-0",e),children:[u.jsxs("div",{className:"flex items-baseline gap-1.5",children:[u.jsx("div",{className:"text-sm font-semibold",children:"NoMoreIDE"}),u.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:["v","0.1.40"]})]}),u.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:"127.0.0.1 console"})]})}function g$(){const[e,t]=E.useState(()=>window.location.pathname.startsWith("/agent")?"agent":window.location.pathname.startsWith("/errors")?"errors":window.location.pathname.startsWith("/database")?"database":window.location.pathname.startsWith("/terminal")?"terminal":window.location.pathname.startsWith("/git")?"git":"services"),[i,n]=E.useState(null),[a,l]=E.useState(null),[c,h]=E.useState(!0),{error:m,success:f}=qi(),[g,b]=E.useState(()=>window.localStorage.getItem("nomoreide:sidebar-docked")==="true"),v=E.useCallback(async(y={})=>{y.silent||h(!0),l(null);try{n(await SM()),y.notify&&f("Dashboard refreshed.")}catch(w){const C=w instanceof Error?w.message:String(w);l(C),m(C)}finally{h(!1)}},[m,f]);E.useEffect(()=>{v()},[v]),E.useEffect(()=>{function y(){document.visibilityState==="visible"&&v({silent:!0})}const w=window.setInterval(y,5e3);return window.addEventListener("focus",y),document.addEventListener("visibilitychange",y),()=>{window.clearInterval(w),window.removeEventListener("focus",y),document.removeEventListener("visibilitychange",y)}},[e,v]),E.useEffect(()=>{const y=e==="git"?"/git":e==="agent"?"/agent":e==="errors"?"/errors":e==="database"?"/database":e==="terminal"?"/terminal":"/";window.location.pathname!==y&&window.history.pushState(null,"",y)},[e]),E.useEffect(()=>{window.localStorage.setItem("nomoreide:sidebar-docked",String(g))},[g]);const x=E.useMemo(()=>i?Object.values(i.runtime.services).filter(y=>y.state==="running").length:0,[i]);return u.jsxs("div",{className:"h-screen overflow-hidden pb-9",children:[u.jsxs("div",{className:"mx-auto flex h-full max-w-[1500px]",children:[u.jsxs("aside",{className:u$(g),children:[u.jsxs("div",{className:fe("grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden transition-[width] duration-150",g?"w-full":"w-12 group-hover/sidebar:w-full"),children:[u.jsx("div",{className:"flex size-12 items-center justify-center",children:u.jsx("div",{className:"flex size-9 items-center justify-center overflow-hidden rounded-md bg-primary text-primary-foreground",children:u.jsxs("svg",{"aria-label":"NoMoreIDE",className:"size-6",fill:"none",role:"img",viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M5 17C5 13.69 7.69 11 11 11H25L31 17H53C56.31 17 59 19.69 59 23V53C59 56.31 56.31 59 53 59H11C7.69 59 5 56.31 5 53V17Z",fill:"currentColor"}),u.jsx("path",{d:"M22 31L30 39L22 47",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"4.5"}),u.jsx("path",{d:"M36 47H48",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeWidth:"4.5"})]})})}),u.jsx(p$,{className:fe("min-w-0 translate-x-1 overflow-hidden transition-opacity duration-200",g?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100")})]}),u.jsxs("nav",{className:"mt-5 grid flex-1 content-start gap-1",children:[u.jsx(zo,{active:e==="services",badge:x,docked:g,icon:u.jsx(S4,{}),label:"Services",onClick:()=>t("services")}),u.jsx(zo,{active:e==="git",docked:g,icon:u.jsx(Ac,{}),label:"Git Review",onClick:()=>t("git")}),u.jsx(zo,{active:e==="errors",docked:g,icon:u.jsx(pg,{}),label:"Error Inbox",onClick:()=>t("errors")}),u.jsx(zo,{active:e==="database",docked:g,icon:u.jsx(za,{}),label:"Database",onClick:()=>t("database")}),u.jsx(zo,{active:e==="terminal",docked:g,icon:u.jsx(A4,{}),label:"Terminal",onClick:()=>t("terminal")}),u.jsx(zo,{active:e==="agent",docked:g,icon:u.jsx(Tc,{}),label:"Agent",onClick:()=>t("agent")})]}),u.jsx(m$,{docked:g,onToggleDock:()=>b(y=>!y)})]}),u.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col px-0 py-0",children:[u.jsxs("header",{className:fe("relative z-40 flex shrink-0 flex-wrap items-center justify-between gap-3 border border-border bg-card/90 px-4 py-3 backdrop-blur","border-x-0 border-t-0 border-b"),children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(n4,{className:"size-4 text-muted-foreground md:hidden"}),u.jsxs("div",{children:[u.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:e==="git"?"Git Review":e==="agent"?"Agent":e==="errors"?"Error Inbox":e==="database"?"Database":e==="terminal"?"Terminal":"Services"}),u.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:i?.git.selectedRepository?.name??i?.git.cwd??"Local workspace"})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[a?u.jsx(Ke,{variant:"danger",children:a}):null,i&&e==="git"?u.jsx(i$,{data:i,onRefresh:v}):null,u.jsxs(de,{onClick:()=>{v({notify:!0})},size:"sm",title:"Refresh dashboard",variant:"outline",children:[u.jsx(Eh,{className:fe(c&&"animate-spin")}),"Refresh"]}),u.jsx(c$,{})]})]}),c&&!i?u.jsx(dt,{variant:"muted",children:"Loading NoMoreIDE state..."}):null,u.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[i&&e==="services"?u.jsx(mI,{data:i,onRefresh:v}):null,i&&e==="git"?u.jsx(QF,{data:i}):null,e==="agent"?u.jsx(X7,{}):null,e==="errors"?u.jsx(jj,{}):null,e==="database"?u.jsx(Aj,{}):null,e==="terminal"?u.jsx(_I,{}):null]})]})]}),i&&e==="git"?u.jsx(a$,{branches:i.git.branches,currentBranch:i.git.status?.branch||void 0,disabled:!i.git.status,onRefresh:v}):null,u.jsx(fj,{onOpenAgentPage:e==="agent"?void 0:()=>t("agent")})]})}function zo({active:e,badge:t,docked:i,icon:n,label:a,onClick:l}){const c=t!==void 0&&t>0;return u.jsxs(de,{"aria-label":a,title:a,className:d$(e,i),variant:"ghost",onClick:l,type:"button",children:[u.jsx("span",{className:f$(i),children:n}),u.jsx("span",{className:h$(i,c),children:a}),t!==void 0&&t>0?u.jsx(Ke,{appearance:t>0?"solid":"outline",className:fe("min-w-6 justify-center px-1.5 font-mono shadow-none",e?"border-primary-foreground/40 bg-primary-foreground/15 text-primary-foreground":t>0?"":"border-border bg-background text-muted-foreground","absolute right-1.5 top-1.5 h-4 min-w-4 rounded-full px-1 text-[10px] leading-none shadow-none group-hover/sidebar:right-2 group-hover/sidebar:top-1/2 group-hover/sidebar:-translate-y-1/2 group-hover/sidebar:text-xs",i&&"right-2 top-1/2 -translate-y-1/2 text-xs"),size:"small",variant:t>0?"success":"outline",children:t}):null]})}B2.createRoot(document.getElementById("root")).render(u.jsx(E.StrictMode,{children:u.jsx(g$,{})}));export{u as j,E as r};
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/assets/nomoreide-favicon-Ds7Tgj9p.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>NoMoreIDE</title>
8
- <script type="module" crossorigin src="/assets/index-D84ED51b.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-CFGCUh46.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-D8bZZCIa.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nomoreide",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
4
4
  "description": "An AI-native terminal workbench for services, Git review, logs, and MCP workflows.",
5
5
  "repository": {
6
6
  "type": "git",