p3x-redis-ui-material
Version:
💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity
3 lines • 66.4 kB
JavaScript
import {N,s as sa,A as A$1,p as pt$1,c as et,R as R$1,J as J$1,r as rt$1,Q}from'./chunk-CSgt_bzr.js';import {countColumn as vt$1,StateEffect as I,Facet as k$1,RangeSetBuilder as se$1,RangeSet as ie,StateField as V,EditorState as mt$1,Prec as pt$2,combineConfig as wt$1}from'./chunk-OaLmDfu9.js';import {E,F as F$1}from'./main-HNF44SV3.js';var Mn=0,ke=class{constructor(e,t){this.from=e,this.to=t;}},k=class{constructor(e={}){this.id=Mn++,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=R.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};k.closedBy=new k({deserialize:r=>r.split(" ")});k.openedBy=new k({deserialize:r=>r.split(" ")});k.group=new k({deserialize:r=>r.split(" ")});k.isolate=new k({deserialize:r=>{if(r&&r!="rtl"&&r!="ltr"&&r!="auto")throw new RangeError("Invalid value for isolate: "+r);return r||"auto"}});k.contextHash=new k({perNode:true});k.lookAhead=new k({perNode:true});k.mounted=new k({perNode:true});var se=class{constructor(e,t,n,i=false){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=i;}static get(e){return e&&e.props&&e.props[k.mounted.id]}},On=Object.create(null),R=class r{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i;}static define(e){let t=e.props&&e.props.length?Object.create(null):On,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new r(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1];}}return i}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 true;let t=this.prop(k.group);return t?t.indexOf(e)>-1:false}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return n=>{for(let i=n.prop(k.group),s=-1;s<(i?i.length:0);s++){let l=t[s<0?n.name:i[s]];if(l)return l}}}};R.none=new R("",Object.create(null),0,8);var Fe=class r{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 n of this.types){let i=null;for(let s of e){let l=s(n);if(l){i||(i=Object.assign({},n.props));let o=l[1],a=l[0];a.combine&&a.id in i&&(o=a.combine(i[a.id],o)),i[a.id]=o;}}t.push(i?new R(n.name,i,n.id,n.flags):n);}return new r(t)}},_e=new WeakMap,Ft=new WeakMap,B=(function(r){return 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",r})(B||{}),A=class r{constructor(e,t,n,i,s){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[l,o]of s)this.props[typeof l=="number"?l:l.id]=o;}}toString(){let e=se.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let i=n.toString();i&&(t&&(t+=","),t+=i);}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 xe(this.topNode,e)}cursorAt(e,t=0,n=0){let i=_e.get(this)||this.topNode,s=new xe(i);return s.moveTo(e,t),_e.set(this,s._tree),s}get topNode(){return new q(this,0,0,null)}resolve(e,t=0){let n=be(_e.get(this)||this.topNode,e,t,false);return _e.set(this,n),n}resolveInner(e,t=0){let n=be(Ft.get(this)||this.topNode,e,t,true);return Ft.set(this,n),n}resolveStack(e,t=0){return Dn(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:s=this.length}=e,l=e.mode||0,o=(l&B.IncludeAnonymous)>0;for(let a=this.cursor(l|B.IncludeAnonymous);;){let h=false;if(a.from<=s&&a.to>=i&&(!o&&a.type.isAnonymous||t(a)!==false)){if(a.firstChild())continue;h=true;}for(;h&&n&&(o||!a.type.isAnonymous)&&n(a),!a.nextSibling();){if(!a.parent())return;h=true;}}}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:ht(R.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,i)=>new r(this.type,t,n,i,this.propValues),e.makeTree||((t,n,i)=>new r(R.none,t,n,i)))}static build(e){return En(e)}};A.empty=new A(R.none,[],[],0);var rt=class r{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 r(this.buffer,this.index)}},Y=class r{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n;}get type(){return R.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],n=this.buffer[e+3],i=this.set.types[t],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,n==e)return s;let l=[];for(;e<n;)l.push(this.childString(e)),e=this.buffer[e+3];return s+"("+l.join(",")+")"}findChild(e,t,n,i,s){let{buffer:l}=this,o=-1;for(let a=e;a!=t&&!(Ut(s,i,l[a+1],l[a+2])&&(o=a,n>0));a=l[a+3]);return o}slice(e,t,n){let i=this.buffer,s=new Uint16Array(t-e),l=0;for(let o=e,a=0;o<t;){s[a++]=i[o++],s[a++]=i[o++]-n;let h=s[a++]=i[o++]-n;s[a++]=i[o++]-e,l=Math.max(l,h);}return new r(s,l,this.set)}};function Ut(r,e,t,n){switch(r){case -2:return t<e;case -1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return true}}function be(r,e,t,n){for(var i;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let l=!n&&r instanceof q&&r.index<0?null:r.parent;if(!l)return r;r=l;}let s=n?0:B.IgnoreOverlays;if(n)for(let l=r,o=l.parent;o;l=o,o=l.parent)l instanceof q&&l.index<0&&((i=o.enter(e,t,s))===null||i===void 0?void 0:i.from)!=l.from&&(r=o);for(;;){let l=r.enter(e,t,s);if(!l)return r;r=l;}}var ze=class{cursor(e=0){return new xe(this,e)}getChild(e,t=null,n=null){let i=zt(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return zt(this,e,t,n)}resolve(e,t=0){return be(this,e,t,false)}resolveInner(e,t=0){return be(this,e,t,true)}matchContext(e){return it(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(n=t,t=i.prevSibling):t=i;}return n}get node(){return this}get next(){return this.parent}},q=class r extends ze{constructor(e,t,n,i){super(),this._tree=e,this.from=t,this.index=n,this._parent=i;}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,s=0){for(let l=this;;){for(let{children:o,positions:a}=l._tree,h=t>0?o.length:-1;e!=h;e+=t){let f=o[e],d=a[e]+l.from,g;if(!(!(s&B.EnterBracketed&&f instanceof A&&(g=se.get(f))&&!g.overlay&&g.bracketed&&n>=d&&n<=d+f.length)&&!Ut(i,n,d,d+f.length))){if(f instanceof Y){if(s&B.ExcludeBuffers)continue;let y=f.findChild(0,f.buffer.length,t,n-d,i);if(y>-1)return new ye(new st(l,f,e,d),null,y)}else if(s&B.IncludeAnonymous||!f.type.isAnonymous||at(f)){let y;if(!(s&B.IgnoreMounts)&&(y=se.get(f))&&!y.overlay)return new r(y.tree,d,e,l);let x=new r(f,d,e,l);return s&B.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(t<0?f.children.length-1:0,t,n,i,s)}}}if(s&B.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?e=l.index+t:e=t<0?-1:l._parent._tree.children.length,l=l._parent,!l))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,n=0){let i;if(!(n&B.IgnoreOverlays)&&(i=se.get(this._tree))&&i.overlay){let s=e-this.from,l=n&B.EnterBracketed&&i.bracketed;for(let{from:o,to:a}of i.overlay)if((t>0||l?o<=s:o<s)&&(t<0||l?a>=s:a>s))return new r(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}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 zt(r,e,t,n){let i=r.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(let l=false;!l;)if(l=i.type.is(t),!i.nextSibling())return s}for(;;){if(n!=null&&i.type.is(n))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return n==null?s:[]}}function it(r,e,t=e.length-1){for(let n=r;t>=0;n=n.parent){if(!n)return false;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return false;t--;}}return true}var st=class{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i;}},ye=class r extends ze{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,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]];}child(e,t,n){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new r(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,n=0){if(n&B.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new r(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 r(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 r(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,s=n.buffer[this.index+3];if(s>i){let l=n.buffer[this.index+1];e.push(n.slice(i,s,l)),t.push(0);}return new A(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function Wt(r){if(!r.length)return null;let e=0,t=r[0];for(let s=1;s<r.length;s++){let l=r[s];(l.from>t.from||l.to<t.to)&&(t=l,e=s);}let n=t instanceof q&&t.index<0?null:t.parent,i=r.slice();return n?i[e]=n:i.splice(e,1),new lt(i,t)}var lt=class{constructor(e,t){this.heads=e,this.node=t;}get next(){return Wt(this.heads)}};function Dn(r,e,t){let n=r.resolveInner(e,t),i=null;for(let s=n instanceof q?n:n.context.parent;s;s=s.parent)if(s.index<0){let l=s.parent;(i||(i=[n])).push(l.resolve(e,t)),s=l;}else {let l=se.get(s.tree);if(l&&l.overlay&&l.overlay[0].from<=e&&l.overlay[l.overlay.length-1].to>=e){let o=new q(l.tree,l.overlay[0].from+s.from,-1,s);(i||(i=[n])).push(be(o,e,t,false));}}return i?Wt(i):n}var xe=class{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&~B.EnterBracketed,e instanceof q)this.yieldNode(e);else {this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.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,true):false}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],true}yield(e){return e?e instanceof q?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):false}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?false:(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,n=this.mode){return this.buffer?n&B.ExcludeBuffers?false:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&B.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&B.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)):false;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else {let i=t.buffer[this.index+3];if(i<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):false}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return false}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return false;({index:t,parent:n}=i);}else ({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let s=t+e,l=e<0?-1:n._tree.children.length;s!=l;s+=e){let o=n._tree.children[s];if(this.mode&B.IncludeAnonymous||o instanceof Y||!o.type.isAnonymous||at(o))return false}return true}move(e,t){if(t&&this.enterChild(e,0,4))return true;for(;;){if(this.sibling(e))return true;if(this.atLastNode(e)||!this.parent())return false}}next(e=true){return this.move(1,e)}prev(e=true){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,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let l=e;l;l=l._parent)if(l.index==i){if(i==this.index)return l;t=l,n=s+1;break e}i=this.stack[--s];}for(let i=n;i<this.stack.length;i++)t=new ye(this.buffer,t,this.stack[i]);return this.bufferNode=new ye(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=false;if(this.type.isAnonymous||e(this)!==false){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=true);}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=true;}}}matchContext(e){if(!this.buffer)return it(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return it(this._tree,e,i);let l=n[t.buffer[this.stack[s]]];if(!l.isAnonymous){if(e[i]&&e[i]!=l.name)return false;i--;}}return true}};function at(r){return r.children.some(e=>e instanceof Y||!e.type.isAnonymous||at(e))}function En(r){var e;let{buffer:t,nodeSet:n,maxBufferLength:i=1024,reused:s=[],minRepeatType:l=n.types.length}=r,o=Array.isArray(t)?new rt(t,t.length):t,a=n.types,h=0,f=0;function d(w,C,p,P,v,N){let{id:b,start:m,end:S,size:T}=o,O=f,X=h;if(T<0)if(o.next(),T==-1){let Q=s[b];p.push(Q),P.push(m-w);return}else if(T==-3){h=b;return}else if(T==-4){f=b;return}else throw new RangeError(`Unrecognized record size: ${T}`);let pe=a[b],Oe,re,Mt=m-w;if(S-m<=i&&(re=j(o.pos-C,v))){let Q=new Uint16Array(re.size-re.skip),U=o.pos-re.size,$=Q.length;for(;o.pos>U;)$=D(re.start,Q,$);Oe=new Y(Q,S-re.start,n),Mt=re.start-w;}else {let Q=o.pos-T;o.next();let U=[],$=[],ie=b>=l?b:-1,fe=0,De=S;for(;o.pos>Q;)ie>=0&&o.id==ie&&o.size>=0?(o.end<=De-i&&(x(U,$,m,fe,o.end,De,ie,O,X),fe=U.length,De=o.end),o.next()):N>2500?g(m,Q,U,$):d(m,Q,U,$,ie,N+1);if(ie>=0&&fe>0&&fe<U.length&&x(U,$,m,fe,m,De,ie,O,X),U.reverse(),$.reverse(),ie>-1&&fe>0){let Ot=y(pe,X);Oe=ht(pe,U,$,0,U.length,0,S-m,Ot,Ot);}else Oe=I(pe,U,$,S-m,O-S,X);}p.push(Oe),P.push(Mt);}function g(w,C,p,P){let v=[],N=0,b=-1;for(;o.pos>C;){let{id:m,start:S,end:T,size:O}=o;if(O>4)o.next();else {if(b>-1&&S<b)break;b<0&&(b=T-i),v.push(m,S,T),N++,o.next();}}if(N){let m=new Uint16Array(N*4),S=v[v.length-2];for(let T=v.length-3,O=0;T>=0;T-=3)m[O++]=v[T],m[O++]=v[T+1]-S,m[O++]=v[T+2]-S,m[O++]=O;p.push(new Y(m,v[2]-S,n)),P.push(S-w);}}function y(w,C){return (p,P,v)=>{let N=0,b=p.length-1,m,S;if(b>=0&&(m=p[b])instanceof A){if(!b&&m.type==w&&m.length==v)return m;(S=m.prop(k.lookAhead))&&(N=P[b]+m.length+S);}return I(w,p,P,v,N,C)}}function x(w,C,p,P,v,N,b,m,S){let T=[],O=[];for(;w.length>P;)T.push(w.pop()),O.push(C.pop()+p-v);w.push(I(n.types[b],T,O,N-v,m-N,S)),C.push(v-p);}function I(w,C,p,P,v,N,b){if(N){let m=[k.contextHash,N];b=b?[m].concat(b):[m];}if(v>25){let m=[k.lookAhead,v];b=b?[m].concat(b):[m];}return new A(w,C,p,P,b)}function j(w,C){let p=o.fork(),P=0,v=0,N=0,b=p.end-i,m={size:0,start:0,skip:0};e:for(let S=p.pos-w;p.pos>S;){let T=p.size;if(p.id==C&&T>=0){m.size=P,m.start=v,m.skip=N,N+=4,P+=4,p.next();continue}let O=p.pos-T;if(T<0||O<S||p.start<b)break;let X=p.id>=l?4:0,pe=p.start;for(p.next();p.pos>O;){if(p.size<0)if(p.size==-3||p.size==-4)X+=4;else break e;else p.id>=l&&(X+=4);p.next();}v=pe,P+=T,N+=X;}return (C<0||P==w)&&(m.size=P,m.start=v,m.skip=N),m.size>4?m:void 0}function D(w,C,p){let{id:P,start:v,end:N,size:b}=o;if(o.next(),b>=0&&P<l){let m=p;if(b>4){let S=o.pos-(b-4);for(;o.pos>S;)p=D(w,C,p);}C[--p]=m,C[--p]=N-w,C[--p]=v-w,C[--p]=P;}else b==-3?h=P:b==-4&&(f=P);return p}let _=[],M=[];for(;o.pos>0;)d(r.start||0,r.bufferStart||0,_,M,-1,0);let V=(e=r.length)!==null&&e!==void 0?e:_.length?M[0]+_[0].length:0;return new A(a[r.topID],_.reverse(),M.reverse(),V)}var jt=new WeakMap;function Le(r,e){if(!r.isAnonymous||e instanceof Y||e.type!=r)return 1;let t=jt.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=r||!(n instanceof A)){t=1;break}t+=Le(r,n);}jt.set(e,t);}return t}function ht(r,e,t,n,i,s,l,o,a){let h=0;for(let x=n;x<i;x++)h+=Le(r,e[x]);let f=Math.ceil(h*1.5/8),d=[],g=[];function y(x,I,j,D,_){for(let M=j;M<D;){let V=M,w=I[M],C=Le(r,x[M]);for(M++;M<D;M++){let p=Le(r,x[M]);if(C+p>=f)break;C+=p;}if(M==V+1){if(C>f){let p=x[V];y(p.children,p.positions,0,p.children.length,I[V]+_);continue}d.push(x[V]);}else {let p=I[M-1]+x[M-1].length-w;d.push(ht(r,x,I,V,M,w,p,null,a));}g.push(w+_-s);}}return y(e,t,n,i,0),(o||a)(d,g,l)}var le=class r{constructor(e,t,n,i,s=false,l=false){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(s?1:0)|(l?2:0);}get openStart(){return (this.open&1)>0}get openEnd(){return (this.open&2)>0}static addTree(e,t=[],n=false){let i=[new r(0,e.length,e,0,false,n)];for(let s of t)s.to>e.length&&i.push(s);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],s=1,l=e.length?e[0]:null;for(let o=0,a=0,h=0;;o++){let f=o<t.length?t[o]:null,d=f?f.fromA:1e9;if(d-a>=n)for(;l&&l.from<d;){let g=l;if(a>=g.from||d<=g.to||h){let y=Math.max(g.from,a)-h,x=Math.min(g.to,d)-h;g=y>=x?null:new r(y,x,g.tree,g.offset+h,o>0,!!f);}if(g&&i.push(g),l.to>d)break;l=s<e.length?e[s++]:null;}if(!f)break;a=f.toA,h=f.toA-f.toB;}return i}},we=class{startParse(e,t,n){return typeof e=="string"&&(e=new ot(e)),n=n?n.length?n.map(i=>new ke(i.from,i.to)):[new ke(0,0)]:[new ke(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let s=i.advance();if(s)return s}}},ot=class{constructor(e){this.string=e;}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return false}read(e,t){return this.string.slice(e,t)}};new k({perNode:true});var Rn=0,H=class r{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=Rn++;}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof r&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let i=new r(n,[],null,[]);if(i.set.push(i),t)for(let s of t.set)i.set.push(s);return i}static defineModifier(e){let t=new He(e);return n=>n.modified.indexOf(t)>-1?n:He.get(n.base||n,n.modified.concat(t).sort((i,s)=>i.id-s.id))}},_n=0,He=class r{constructor(e){this.name=e,this.instances=[],this.id=_n++;}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(o=>o.base==e&&Ln(t,o.modified));if(n)return n;let i=[],s=new H(e.name,i,e,t);for(let o of t)o.instances.push(s);let l=Fn(t);for(let o of e.set)if(!o.modified.length)for(let a of l)i.push(r.get(o,a));return s}};function Ln(r,e){return r.length==e.length&&r.every((t,n)=>t==e[n])}function Fn(r){let e=[[]];for(let t=0;t<r.length;t++)for(let n=0,i=e.length;n<i;n++)e.push(e[n].concat(r[t]));return e.sort((t,n)=>n.length-t.length)}function $t(r){let e=Object.create(null);for(let t in r){let n=r[t];Array.isArray(n)||(n=[n]);for(let i of t.split(" "))if(i){let s=[],l=2,o=i;for(let d=0;;){if(o=="..."&&d>0&&d+3==i.length){l=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!g)throw new RangeError("Invalid path: "+i);if(s.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),d+=g[0].length,d==i.length)break;let y=i[d++];if(d==i.length&&y=="!"){l=0;break}if(y!="/")throw new RangeError("Invalid path: "+i);o=i.slice(d);}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+i);let f=new ae(n,l,a>0?s.slice(0,a):null);e[h]=f.sort(e[h]);}}return qt.add(e)}var qt=new k({combine(r,e){let t,n,i;for(;r||e;){if(!r||e&&r.depth>=e.depth?(i=e,e=e.next):(i=r,r=r.next),t&&t.mode==i.mode&&!i.context&&!t.context)continue;let s=new ae(i.tags,i.mode,i.context);t?t.next=s:n=s,t=s;}return n}}),ae=class{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i;}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}};ae.empty=new ae([],2,null);function dt(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 l of s.tag)t[l.id]=s.class;let{scope:n,all:i=null}=e||{};return {style:s=>{let l=i;for(let o of s)for(let a of o.set){let h=t[a.id];if(h){l=l?l+" "+h:h;break}}return l},scope:n}}function zn(r,e){let t=null;for(let n of r){let i=n.style(e);i&&(t=t?t+" "+i:i);}return t}function Gt(r,e,t,n=0,i=r.length){let s=new ut(n,Array.isArray(e)?e:[e],t);s.highlightRange(r.cursor(),n,i,"",s.highlighters),s.flush(i);}var ut=class{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,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,n,i,s){let{type:l,from:o,to:a}=e;if(o>=n||a<=t)return;l.isTop&&(s=this.highlighters.filter(y=>!y.scope||y.scope(l)));let h=i,f=jn(e)||ae.empty,d=zn(s,f.tags);if(d&&(h&&(h+=" "),h+=d,f.mode==1&&(i+=(i?" ":"")+d)),this.startSpan(Math.max(t,o),h),f.opaque)return;let g=e.tree&&e.tree.prop(k.mounted);if(g&&g.overlay){let y=e.node.enter(g.overlay[0].from+o,1),x=this.highlighters.filter(j=>!j.scope||j.scope(g.tree.type)),I=e.firstChild();for(let j=0,D=o;;j++){let _=j<g.overlay.length?g.overlay[j]:null,M=_?_.from+o:a,V=Math.max(t,D),w=Math.min(n,M);if(V<w&&I)for(;e.from<w&&(this.highlightRange(e,V,w,i,s),this.startSpan(Math.min(w,e.to),h),!(e.to>=M||!e.nextSibling())););if(!_||M>n)break;D=_.to+o,D>t&&(this.highlightRange(y.cursor(),Math.max(t,_.from+o),Math.min(n,D),"",x),this.startSpan(Math.min(n,D),h));}I&&e.parent();}else if(e.firstChild()){g&&(i="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,s),this.startSpan(Math.min(n,e.to),h);}while(e.nextSibling());e.parent();}}};function jn(r){let e=r.type.prop(qt);for(;e&&e.context&&!r.matchContext(e.context);)e=e.next;return e||null}var u=H.define,je=u(),Z=u(),Ht=u(Z),Vt=u(Z),ee=u(),Ue=u(ee),ft=u(ee),K=u(),oe=u(K),G=u(),J=u(),ct=u(),ve=u(ct),We=u(),c={comment:je,lineComment:u(je),blockComment:u(je),docComment:u(je),name:Z,variableName:u(Z),typeName:Ht,tagName:u(Ht),propertyName:Vt,attributeName:u(Vt),className:u(Z),labelName:u(Z),namespace:u(Z),macroName:u(Z),literal:ee,string:Ue,docString:u(Ue),character:u(Ue),attributeValue:u(Ue),number:ft,integer:u(ft),float:u(ft),bool:u(ee),regexp:u(ee),escape:u(ee),color:u(ee),url:u(ee),keyword:G,self:u(G),null:u(G),atom:u(G),unit:u(G),modifier:u(G),operatorKeyword:u(G),controlKeyword:u(G),definitionKeyword:u(G),moduleKeyword:u(G),operator:J,derefOperator:u(J),arithmeticOperator:u(J),logicOperator:u(J),bitwiseOperator:u(J),compareOperator:u(J),updateOperator:u(J),definitionOperator:u(J),typeOperator:u(J),controlOperator:u(J),punctuation:ct,separator:u(ct),bracket:ve,angleBracket:u(ve),squareBracket:u(ve),paren:u(ve),brace:u(ve),content:K,heading:oe,heading1:u(oe),heading2:u(oe),heading3:u(oe),heading4:u(oe),heading5:u(oe),heading6:u(oe),contentSeparator:u(K),list:u(K),quote:u(K),emphasis:u(K),strong:u(K),link:u(K),monospace:u(K),strikethrough:u(K),inserted:u(),deleted:u(),changed:u(),invalid:u(),meta:We,documentMeta:u(We),annotation:u(We),processingInstruction:u(We),definition:H.defineModifier("definition"),constant:H.defineModifier("constant"),function:H.defineModifier("function"),standard:H.defineModifier("standard"),local:H.defineModifier("local"),special:H.defineModifier("special")};for(let r in c){let e=c[r];e instanceof H&&(e.name=r);}dt([{tag:c.link,class:"tok-link"},{tag:c.heading,class:"tok-heading"},{tag:c.emphasis,class:"tok-emphasis"},{tag:c.strong,class:"tok-strong"},{tag:c.keyword,class:"tok-keyword"},{tag:c.atom,class:"tok-atom"},{tag:c.bool,class:"tok-bool"},{tag:c.url,class:"tok-url"},{tag:c.labelName,class:"tok-labelName"},{tag:c.inserted,class:"tok-inserted"},{tag:c.deleted,class:"tok-deleted"},{tag:c.literal,class:"tok-literal"},{tag:c.string,class:"tok-string"},{tag:c.number,class:"tok-number"},{tag:[c.regexp,c.escape,c.special(c.string)],class:"tok-string2"},{tag:c.variableName,class:"tok-variableName"},{tag:c.local(c.variableName),class:"tok-variableName tok-local"},{tag:c.definition(c.variableName),class:"tok-variableName tok-definition"},{tag:c.special(c.variableName),class:"tok-variableName2"},{tag:c.definition(c.propertyName),class:"tok-propertyName tok-definition"},{tag:c.typeName,class:"tok-typeName"},{tag:c.namespace,class:"tok-namespace"},{tag:c.className,class:"tok-className"},{tag:c.macroName,class:"tok-macroName"},{tag:c.propertyName,class:"tok-propertyName"},{tag:c.operator,class:"tok-operator"},{tag:c.comment,class:"tok-comment"},{tag:c.meta,class:"tok-meta"},{tag:c.invalid,class:"tok-invalid"},{tag:c.punctuation,class:"tok-punctuation"}]);var pt,he=new k;function hn(r){return k$1.define({combine:r?e=>e.concat(r):void 0})}var Un=new k,F=(()=>{class r{constructor(t,n,i=[],s=""){this.data=t,this.name=s,mt$1.prototype.hasOwnProperty("tree")||Object.defineProperty(mt$1.prototype,"tree",{get(){return z(this)}}),this.parser=n,this.extension=[te.of(this),mt$1.languageData.of((l,o,a)=>{let h=Jt(l,o,a),f=h.type.prop(he);if(!f)return [];let d=l.facet(f),g=h.type.prop(Un);if(g){let y=h.resolve(o-h.from,a);for(let x of g)if(x.test(y,l)){let I=l.facet(x.facet);return x.type=="replace"?I:I.concat(d)}}return d})].concat(i);}isActiveAt(t,n,i=-1){return Jt(t,n,i).type.prop(he)==this.data}findRegions(t){let n=t.facet(te);if(n?.data==this.data)return [{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return [];let i=[],s=(l,o)=>{if(l.prop(he)==this.data){i.push({from:o,to:o+l.length});return}let a=l.prop(k.mounted);if(a){if(a.tree.prop(he)==this.data){if(a.overlay)for(let h of a.overlay)i.push({from:h.from+o,to:h.to+o});else i.push({from:o,to:o+l.length});return}else if(a.overlay){let h=i.length;if(s(a.tree,a.overlay[0].from+o),i.length>h)return}}for(let h=0;h<l.children.length;h++){let f=l.children[h];f instanceof A&&s(f,l.positions[h]+o);}};return s(z(t),0),i}get allowsNesting(){return true}}return r.setState=I.define(),r})();function Jt(r,e,t){let n=r.facet(te),i=z(r).topNode;if(!n||n.allowsNesting)for(let s=i;s;s=s.enter(e,t,B.ExcludeBuffers|B.EnterBracketed))s.type.isTop&&(i=s);return i}var Kt=class r extends F{constructor(e,t,n){super(e,t,[],n),this.parser=t;}static define(e){let t=hn(e.languageData);return new r(t,e.parser.configure({props:[he.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new r(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function z(r){let e=r.field(F.state,false);return e?e.tree:A.empty}function Wn(r,e,t=50){var n;let i=(n=r.field(F.state,false))===null||n===void 0?void 0:n.context;if(!i)return null;let s=i.viewport;i.updateViewport({from:0,to:e});let l=i.isDone(e)||i.work(t,e)?i.tree:null;return i.updateViewport(s),l}function jr(r,e=r.doc.length){var t;return ((t=r.field(F.state,false))===null||t===void 0?void 0:t.context.isDone(e))||false}function Ur(r,e=r.viewport.to,t=100){let n=Wn(r.state,e,t);return n!=z(r.state)&&r.dispatch({}),!!n}function Wr(r){var e;return ((e=r.plugin(un))===null||e===void 0?void 0:e.isWorking())||false}var kt=class{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter();}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return true}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},Se=null,Ce=class r{constructor(e,t,n=[],i,s,l,o,a){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=s,this.viewport=l,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[];}static create(e,t,n){return new r(e,t,[],A.empty,0,n,[],null)}startParse(){return this.parser.startParse(new kt(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=A.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),true):this.withContext(()=>{var n;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i;}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(le.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return true;if(e())return false}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(le.addTree(this.tree,this.fragments,true)),this.parse=null);}withContext(e){let t=Se;Se=this;try{return e()}finally{Se=t;}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Qt(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:s,viewport:l,skipped:o}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,f,d,g)=>a.push({fromA:h,toA:f,fromB:d,toB:g})),n=le.applyChanges(n,a),i=A.empty,s=0,l={from:e.mapPos(l.from,-1),to:e.mapPos(l.to,1)},this.skipped.length){o=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),d=e.mapPos(h.to,-1);f<d&&o.push({from:f,to:d});}}}return new r(this.parser,t,n,i,s,l,o,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return false;this.viewport=e;let t=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:i,to:s}=this.skipped[n];i<e.to&&s>e.from&&(this.fragments=Qt(this.fragments,i,s),this.skipped.splice(n--,1));}return this.skipped.length>=t?false:(this.reset(),true)}reset(){this.parse&&(this.takeTree(),this.parse=null);}skipUntilInView(e,t){this.skipped.push({from:e,to:t});}static getSkippingParser(e){return new class extends we{createParse(t,n,i){let s=i[0].from,l=i[i.length-1].to;return {parsedPos:s,advance(){let a=Se;if(a){for(let h of i)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e);}return this.parsedPos=l,new A(R.none,[],[],l-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Se}};function Qt(r,e,t){return le.applyChanges(r,[{fromA:e,toA:t,fromB:e,toB:t}])}var Te=class r{constructor(e){this.context=e,this.tree=e.tree;}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new r(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=Ce.create(e.facet(te).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new r(n)}};F.state=V.define({create:Te.init,update(r,e){for(let t of e.effects)if(t.is(F.setState))return t.value;return e.startState.facet(te)!=e.state.facet(te)?Te.init(e.state):r.apply(e)}});var fn=r=>{let e=setTimeout(()=>r(),500);return ()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(fn=r=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(r,{timeout:400});},100);return ()=>e<0?clearTimeout(t):cancelIdleCallback(e)});var gt=typeof navigator<"u"&&(!((pt=navigator.scheduling)===null||pt===void 0)&&pt.isInputPending)?()=>navigator.scheduling.isInputPending():null,un=N.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork();}update(e){let t=this.view.state.field(F.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t);}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(F.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=fn(this.work));}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,s=n.field(F.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let l=Date.now()+Math.min(this.chunkBudget,100,e&&!gt?Math.max(25,e.timeRemaining()-5):1e9),o=s.context.treeLen<i&&n.doc.length>i+1e3,a=s.context.work(()=>gt&>()||Date.now()>l,i+(o?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:F.setState.of(new Te(s.context))})),this.chunkBudget>0&&!(a&&!o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context);}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Q(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null);}destroy(){this.working&&this.working();}isWorking(){return !!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork();}}}),te=k$1.define({combine(r){return r.length?r[0]:null},enables:r=>[F.state,un,pt$1.contentAttributes.compute([r],e=>{let t=e.facet(r);return t&&t.name?{"data-language":t.name}:{}})]}),Xt=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t];}},Yt=class r{constructor(e,t,n,i,s,l=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=i,this.loadFunc=s,this.support=l,this.loading=null;}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:n}=e;if(!t){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(n);}return new r(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,t,n)}static matchFilename(e,t){for(let i of e)if(i.filename&&i.filename.test(t))return i;let n=/\.([^.]+)$/.exec(t);if(n){for(let i of e)if(i.extensions.indexOf(n[1])>-1)return i}return null}static matchLanguageName(e,t,n=true){t=t.toLowerCase();for(let i of e)if(i.alias.some(s=>s==t))return i;if(n)for(let i of e)for(let s of i.alias){let l=t.indexOf(s);if(l>-1&&(s.length>2||!/\w/.test(t[l-1])&&!/\w/.test(t[l+s.length])))return i}return null}},Hn=k$1.define(),cn=k$1.define({combine:r=>{if(!r.length)return " ";let e=r[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(r[0]));return e}});function qe(r){let e=r.facet(cn);return e.charCodeAt(0)==9?r.tabSize*e.length:e.length}function dn(r,e){let t="",n=r.tabSize,i=r.facet(cn)[0];if(i==" "){for(;e>=n;)t+=" ",e-=n;i=" ";}for(let s=0;s<e;s++)t+=i;return t}function pn(r,e){r instanceof mt$1&&(r=new Pe(r));for(let n of r.state.facet(Hn)){let i=n(r,e);if(i!==void 0)return i}let t=z(r.state);return t.length>=e?Vn(r,t,e):null}function Vr(r,e,t){let n=Object.create(null),i=new Pe(r,{overrideIndentation:l=>{var o;return (o=n[l])!==null&&o!==void 0?o:-1}}),s=[];for(let l=e;l<=t;){let o=r.doc.lineAt(l);l=o.to+1;let a=pn(i,o.from);if(a==null)continue;/\S/.test(o.text)||(a=0);let h=/^\s*/.exec(o.text)[0],f=dn(r,a);h!=f&&(n[o.from]=a,s.push({from:o.from,to:o.from+h.length,insert:f}));}return r.changes(s)}var Pe=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=qe(e);}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=n.from&&i<=n.to?s&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return "";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),s=this.countColumn(n,e-i),l=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return l>-1&&(s+=l-this.countColumn(n,n.search(/\S|$/))),s}countColumn(e,t=e.length){return vt$1(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let l=s(i);if(l>-1)return l}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},gn=new k;function Vn(r,e,t){let n=e.resolveStack(t),i=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(i!=n.node){let s=[];for(let l=i;l&&!(l.from<n.node.from||l.to>n.node.to||l.from==n.node.from&&l.type==n.node.type);l=l.parent)s.push(l);for(let l=s.length-1;l>=0;l--)n={node:s[l],next:n};}return mn(n,r,t)}function mn(r,e,t){for(let n=r;n;n=n.next){let i=qn(n.node);if(i)return i(bt.create(e,t,n))}return 0}function $n(r){return r.pos==r.options.simulateBreak&&r.options.simulateDoubleBreak}function qn(r){let e=r.type.prop(gn);if(e)return e;let t=r.firstChild,n;if(t&&(n=t.type.prop(k.closedBy))){let i=r.lastChild,s=i&&n.indexOf(i.name)>-1;return l=>kn(l,true,1,void 0,s&&!$n(l)?i.from:void 0)}return r.parent==null?Gn:null}function Gn(){return 0}var bt=class r extends Pe{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n;}get node(){return this.context.node}static create(e,t,n){return new r(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Jn(n,e))break;t=this.state.doc.lineAt(n.from);}return this.lineIndent(t.from)}continue(){return mn(this.context.next,this.base,this.pos)}};function Jn(r,e){for(let t=e;t;t=t.parent)if(r==t)return true;return false}function Kn(r){let e=r.node,t=e.childAfter(e.from),n=e.lastChild;if(!t)return null;let i=r.options.simulateBreak,s=r.state.doc.lineAt(t.from),l=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let o=t.to;;){let a=e.childAfter(o);if(!a||a==n)return null;if(!a.type.isSkipped){if(a.from>=l)return null;let h=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return {from:t.from,to:t.to+h}}o=a.to;}}function $r({closing:r,align:e=true,units:t=1}){return n=>kn(n,e,t,r)}function kn(r,e,t,n,i){let s=r.textAfter,l=s.match(/^\s*/)[0].length,o=n&&s.slice(l,l+n.length)==n||i==r.pos+l,a=e?Kn(r):null;return a?o?r.column(a.from):r.column(a.to):r.baseIndent+(o?0:r.unit*t)}var qr=r=>r.baseIndent;function Gr({except:r,units:e=1}={}){return t=>{let n=r&&r.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}var Qn=200;function Jr(){return mt$1.transactionFilter.of(r=>{if(!r.docChanged||!r.isUserEvent("input.type")&&!r.isUserEvent("input.complete"))return r;let e=r.startState.languageDataAt("indentOnInput",r.startState.selection.main.head);if(!e.length)return r;let t=r.newDoc,{head:n}=r.newSelection.main,i=t.lineAt(n);if(n>i.from+Qn)return r;let s=t.sliceString(i.from,n);if(!e.some(h=>h.test(s)))return r;let{state:l}=r,o=-1,a=[];for(let{head:h}of l.selection.ranges){let f=l.doc.lineAt(h);if(f.from==o)continue;o=f.from;let d=pn(l,f.from);if(d==null)continue;let g=/^\s*/.exec(f.text)[0],y=dn(l,d);g!=y&&a.push({from:f.from,to:f.from+g.length,insert:y});}return a.length?[r,{changes:a,sequential:true}]:r})}var Xn=k$1.define(),Yn=new k;function Kr(r){let e=r.firstChild,t=r.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?r.to:t.from}:null}function Zn(r,e,t){let n=z(r);if(n.length<t)return null;let i=n.resolveStack(t,1),s=null;for(let l=i;l;l=l.next){let o=l.node;if(o.to<=t||o.from>t)continue;if(s&&o.from<e)break;let a=o.type.prop(Yn);if(a&&(o.to<n.length-50||n.length==r.doc.length||!er(o))){let h=a(o,r);h&&h.from<=t&&h.from>=e&&h.to>t&&(s=h);}}return s}function er(r){let e=r.lastChild;return e&&e.to==r.to&&e.type.isError}function Ne(r,e,t){for(let n of r.facet(Xn)){let i=n(r,e,t);if(i)return i}return Zn(r,e,t)}function bn(r,e){let t=e.mapPos(r.from,1),n=e.mapPos(r.to,-1);return t>=n?void 0:{from:t,to:n}}var Me=I.define({map:bn}),de=I.define({map:bn});function Tt(r){let e=[];for(let{head:t}of r.state.selection.ranges)e.some(n=>n.from<=t&&n.to>=t)||e.push(r.lineBlockAt(t));return e}var ne=V.define({create(){return A$1.none},update(r,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,n)=>r=Zt(r,t,n)),r=r.map(e.changes);for(let t of e.effects)if(t.is(Me)&&!tr(r,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(Nt),i=n?A$1.replace({widget:new yt(n(e.state,t.value))}):en;r=r.update({add:[i.range(t.value.from,t.value.to)]});}else t.is(de)&&(r=r.update({filter:(n,i)=>t.value.from!=n||t.value.to!=i,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(r=Zt(r,e.selection.main.head)),r},provide:r=>pt$1.decorations.from(r),toJSON(r,e){let t=[];return r.between(0,e.doc.length,(n,i)=>{t.push(n,i);}),t},fromJSON(r){if(!Array.isArray(r)||r.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<r.length;){let n=r[t++],i=r[t++];if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(en.range(n,i));}return A$1.set(e,true)}});function Zt(r,e,t=e){let n=false;return r.between(e,t,(i,s)=>{i<t&&s>e&&(n=true);}),n?r.update({filterFrom:e,filterTo:t,filter:(i,s)=>i>=t||s<=e}):r}function Qr(r){return r.field(ne,false)||ie.empty}function Ie(r,e,t){var n;let i=null;return (n=r.field(ne,false))===null||n===void 0||n.between(e,t,(s,l)=>{(!i||i.from>s)&&(i={from:s,to:l});}),i}function tr(r,e,t){let n=false;return r.between(e,e,(i,s)=>{i==e&&s==t&&(n=true);}),n}function Pt(r,e){return r.field(ne,false)?e:e.concat(I.appendConfig.of(yn()))}var nr=r=>{for(let e of Tt(r)){let t=Ne(r.state,e.from,e.to);if(t)return r.dispatch({effects:Pt(r.state,[Me.of(t),Ge(r,t)])}),true}return false},rr=r=>{if(!r.state.field(ne,false))return false;let e=[];for(let t of Tt(r)){let n=Ie(r.state,t.from,t.to);n&&e.push(de.of(n),Ge(r,n,false));}return e.length&&r.dispatch({effects:e}),e.length>0};function Ge(r,e,t=true){let n=r.state.doc.lineAt(e.from).number,i=r.state.doc.lineAt(e.to).number;return pt$1.announce.of(`${r.state.phrase(t?"Folded lines":"Unfolded lines")} ${n} ${r.state.phrase("to")} ${i}.`)}var ir=r=>{let{state:e}=r,t=[];for(let n=0;n<e.doc.length;){let i=r.lineBlockAt(n),s=Ne(e,i.from,i.to);s&&t.push(Me.of(s)),n=(s?r.lineBlockAt(s.to):i).to+1;}return t.length&&r.dispatch({effects:Pt(r.state,t)}),!!t.length},sr=r=>{let e=r.state.field(ne,false);if(!e||!e.size)return false;let t=[];return e.between(0,r.state.doc.length,(n,i)=>{t.push(de.of({from:n,to:i}));}),r.dispatch({effects:t}),true};function lr(r,e){for(let t=e;;){let n=Ne(r.state,t.from,t.to);if(n&&n.to>e.from)return n;if(!t.from)return null;t=r.lineBlockAt(t.from-1);}}var Xr=r=>{let e=[];for(let t of Tt(r)){let n=Ie(r.state,t.from,t.to);if(n)e.push(de.of(n),Ge(r,n,false));else {let i=lr(r,t);i&&e.push(Me.of(i),Ge(r,i));}}return e.length>0&&r.dispatch({effects:Pt(r.state,e)}),!!e.length},Yr=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:nr},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:rr},{key:"Ctrl-Alt-[",run:ir},{key:"Ctrl-Alt-]",run:sr}],or={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},Nt=k$1.define({combine(r){return wt$1(r,or)}});function yn(r){let e=[ne,hr];return r&&e.push(Nt.of(r)),e}function xn(r,e){let{state:t}=r,n=t.facet(Nt),i=l=>{let o=r.lineBlockAt(r.posAtDOM(l.target)),a=Ie(r.state,o.from,o.to);a&&r.dispatch({effects:de.of(a)}),l.preventDefault();};if(n.placeholderDOM)return n.placeholderDOM(r,i,e);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}var en=A$1.replace({widget:new class extends rt$1{toDOM(r){return xn(r,null)}}}),yt=class extends rt$1{constructor(e){super(),this.value=e;}eq(e){return this.value==e.value}toDOM(e){return xn(e,this.value)}},ar={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>false},Ae=class extends J$1{constructor(e,t){super(),this.config=e,this.open=t;}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}};function Zr(r={}){let e=E(E({},ar),r),t=new Ae(e,true),n=new Ae(e,false),i=N.fromClass(class{constructor(l){this.from=l.viewport.from,this.markers=this.buildMarkers(l);}update(l){(l.docChanged||l.viewportChanged||l.startState.facet(te)!=l.state.facet(te)||l.startState.field(ne,false)!=l.state.field(ne,false)||z(l.startState)!=z(l.state)||e.foldingChanged(l))&&(this.markers=this.buildMarkers(l.view));}buildMarkers(l){let o=new se$1;for(let a of l.viewportLineBlocks){let h=Ie(l.state,a.from,a.to)?n:Ne(l.state,a.from,a.to)?t:null;h&&o.add(a.from,a.from,h);}return o.finish()}}),{domEventHandlers:s}=e;return [i,sa({class:"cm-foldGutter",markers(l){var o;return ((o=l.plugin(i))===null||o===void 0?void 0:o.markers)||ie.empty},initialSpacer(){return new Ae(e,false)},domEventHandlers:F$1(E({},s),{click:(l,o,a)=>{if(s.click&&s.click(l,o,a))return true;let h=Ie(l.state,o.from,o.to);if(h)return l.dispatch({effects:de.of(h)}),true;let f=Ne(l.state,o.from,o.to);return f?(l.dispatch({effects:Me.of(f)}),true):false}})}),yn()]}var hr=pt$1.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),Je=class r{constructor(e,t){this.specs=e;let n;function i(o){let a=et.newName();return (n||(n=Object.create(null)))["."+a]=o,a}let s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,l=t.scope;this.scope=l instanceof F?o=>o.prop(he)==l.data:l?o=>o==l:void 0,this.style=dt(e.map(o=>({tag:o.tag,class:o.class||i(Object.assign({},o,{tag:null}))})),{all:s}).style,this.module=n?new et(n):null,this.themeType=t.themeType;}static define(e,t){return new r(e,t||{})}},xt=k$1.define(),wn=k$1.define({combine(r){return r.length?[r[0]]:null}});function $e(r){let e=r.facet(xt);return e.length?e:r.facet(wn)}function ei(r,e){let t=[fr],n;return r instanceof Je&&(r.module&&t.push(pt$1.styleModule.of(r.module)),n=r.themeType),e?.fallback?t.push(wn.of(r)):n?t.push(xt.computeN([pt$1.darkTheme],i=>i.facet(pt$1.darkTheme)==(n=="dark")?[r]:[])):t.push(xt.of(r)),t}function ti(r,e,t){let n=$e(r),i=null;if(n){for(let s of n)if(!s.scope||t&&s.scope(t)){let l=s.style(e);l&&(i=i?i+" "+l:l);}}return i}var wt=class{constructor(e){this.markCache=Object.create(null),this.tree=z(e.state),this.decorations=this.buildDeco(e,$e(e.state)),this.decoratedTo=e.viewport.to;}update(e){let t=z(e.state),n=$e(e.state),i=n!=$e(e.startState),{viewport:s}=e.view,l=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!i&&t.type==this.tree.type&&l>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=l):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=s.to);}buildDeco(e,t){if(!t||!this.tree.length)return A$1.none;let n=new se$1;for(let{from:i,to:s}of e.visibleRanges)Gt(this.tree,t,(l,o,a)=>{n.add(l,o,this.markCache[a]||(this.markCache[a]=A$1.mark({class:a})));},i,s);return n.finish()}},fr=pt$2.high(N.fromClass(wt,{decorations:r=>r.decorations})),ni=Je.define([{tag:c.meta,color:"#404740"},{tag:c.link,textDecoration:"underline"},{tag:c.heading,textDecoration:"underline",fontWeight:"bold"},{tag:c.emphasis,fontStyle:"italic"},{tag:c.strong,fontWeight:"bold"},{tag:c.strikethrough,textDecoration:"line-through"},{tag:c.keyword,color:"#708"},{tag:[c.atom,c.bool,c.url,c.contentSeparator,c.labelName],color:"#219"},{tag:[c.literal,c.inserted],color:"#164"},{tag:[c.string,c.deleted],color:"#a11"},{tag:[c.regexp,c.escape,c.special(c.string)],color:"#e40"},{tag:c.definition(c.variableName),color:"#00f"},{tag:c.local(c.variableName),color:"#30a"},{tag:[c.typeName,c.namespace],color:"#085"},{tag:c.className,color:"#167"},{tag:[c.special(c.variableName),c.macroName],color:"#256"},{tag:c.definition(c.propertyName),color:"#00c"},{tag:c.comment,color:"#940"},{tag:c.invalid,color:"#f00"}]),ur=pt$1.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),vn=1e4,Sn="()[]{}",An=k$1.define({combine(r){return wt$1(r,{afterCursor:true,brackets:Sn,maxScanDistance:vn,renderMatch:pr})}}),cr=A$1.mark({class:"cm-matchingBracket"}),dr=A$1.mark({class:"cm-nonmatchingBracket"});function pr(r){let e=[],t=r.matched?cr:dr;return e.push(t.range(r.start.from,r.start.to)),r.end&&e.push(t.range(r.end.from,r.end.to)),e}function tn(r){let e=[],t=r.facet(An);for(let n of r.selection.ranges){if(!n.empty)continue;let i=Ve(r,n.head,-1,t)||n.head>0&&Ve(r,n.head-1,1,t)||t.afterCursor&&(Ve(r,n.head,1,t)||n.head<r.doc.length&&Ve(r,n.head+1,-1,t));i&&(e=e.concat(t.renderMatch(i,r)));}return A$1.set(e,true)}var gr=N.fromClass(class{constructor(r){this.paused=false,this.decorations=tn(r.state);}update(r){(r.docChanged||r.selectionSet||this.paused)&&(r.view.composing?(this.decorations=this.decorations.map(r.changes),this.paused=true):(this.decorations=tn(r.state),this.paused=false));}},{decorations:r=>r.decorations}),mr=[gr,ur];function ri(r={}){return [An.of(r),mr]}var kr=new k;function vt(r,e,t){let n=r.prop(e<0?k.openedBy:k.closedBy);if(n)return n;if(r.name.length==1){let i=t.indexOf(r.name);if(i>-1&&i%2==(e<0?1:0))return [t[i+e]]}return null}function St(r){let e=r.type.prop(kr);return e?e(r.node):r}function Ve(r,e,t,n={}){let i=n.maxScanDistance||vn,s=n.brackets||Sn,l=z(r),o=l.resolveInner(e,t);for(let a=o;a;a=a.parent){let h=vt(a.type,t,s);if(h&&a.from<a.to){let f=St(a);if(f&&(t>0?e>=f.from&&e<f.to:e>f.from&&e<=f.to))return br(r,e,t,a,f,h,s)}}return yr(r,e,t,l,o.type,i,s)}function br(r,e,t,n,i,s,l){let o=n.parent,a={from:i.from,to:i.to},h=0,f=o?.cursor();if(f&&(t<0?f.childBefore(n.from):f.childAfter(n.to)))do if(t<0?f.to<=n.from:f.from>=n.to){if(h==0&&s.indexOf(f.type.name)>-1&&f.from<f.to){let d=St(f);return {start:a,end:d?{from:d.from,to:d.to}:void 0,matched:true}}else if(vt(f.type,t,l))h++;else if(vt(f.type,-t,l)){if(h==0){let d=St(f);return {start:a,end:d&&d.from<d.to?{from:d.from,to:d.to}:void 0,matched:false}}h--;}}while(t<0?f.prevSibling():f.nextSibling());return {start:a,matched:false}}function yr(r,e,t,n,i,s,l){if(t<0?!e:e==r.doc.length)return null;let o=t<0?r.sliceDoc(e-1,e):r.sliceDoc(e,e+1),a=l.indexOf(o);if(a<0||a%2==0!=t>0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},f=r.doc.iterRange(e,t>0?r.doc.length:0),d=0;for(let g=0;!f.next().done&&g<=s;){let y=f.value;t<0&&(g+=y.length);let x=e+g*t;for(let I=t>0?0:y.length-1,j=t>0?y.length:-1;I!=j;I+=t){let D=l.indexOf(y[I]);if(!(D<0||n.resolveInner(x+I,1).type!=i))if(D%2==0==t>0)d++;else {if(d==1)return {start:h,end:{from:x+I,to:x+I+1},matched:D>>1==a>>1};d--;}}t>0&&(g+=y.length);}return f.done?{start:h,matched:false}:null}function nn(r,e,t,n=0,i=0){e==null&&(e=r.search(/[^\s\u00a0]/),e==-1&&(e=r.length));let s=i;for(let l=n;l<e;l++)r.charCodeAt(l)==9?s+=t-s%t:s++;return s}var Ke=class{constructor(e,t,n,i){this.string=e,this.tabSize=t,this.indentUnit=n,this.overrideIndent=i,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0;}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e instanceof RegExp?e.test(t):e(t)),n)return ++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length;}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,true}backUp(e){this.pos-=e;}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=nn(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return (e=this.overrideIndent)!==null&&e!==void 0?e:nn(this.string,null,this.tabSize)}match(e,t,n){if(typeof e=="string"){let i=l=>n?l.toLowerCase():l,s=this.string.substr(this.pos,e.length);return i(s)==i(e)?(t!==false&&(this.pos+=e.length),true):null}else {let i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&t!==false&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}};function xr(r){return {name:r.name||"",token:r.token,blankLine:r.blankLine||(()=>{}),startState:r.startState||(()=>true),copyState:r.copyState||wr,indent:r.indent||(()=>null),languageData:r.languageData||{},tokenTable:r.tokenTable||Bt,mergeTokens:r.mergeTokens!==false}}function wr(r){if(typeof r!="object")return r;let e={};for(let t in r){let n=r[t];e[t]=n instanceof Array?n.slice():n;}return e}var rn=new WeakMap,sn=class r extends F{constructor(e){let t=hn(e.languageData),n=xr(e),i,s=new class extends we{createParse(l,o,a){return new At(i,l,o,a)}};super(t,s,[],e.name),this.topNode=Cr(t,this),i=this,this.streamParser=n,this.stateAfter=new k({perNode:true}),this.tokenTable=e.tokenTable?new Qe(n.tokenTable):Ar;}static define(e){return new r(e)}getIndent(e){let t,{overrideIndentation:n}=e.options;n&&(t=rn.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let i=It(this,e.node.tree,e.node.from,e.node.from,t??e.pos),s,l;if(i?(l=i.state,s=i.pos+1):(l=this.streamParser.startState(e.unit),s=e.node.from),e.pos-s>1e4)return null;for(;s<e.pos;){let a=e.state.doc.lineAt(s),h=Math.min(e.pos,a.to);if(a.length){let f=n?n(a.from):-1,d=new Ke(a.text,e.state.tabSize,e.unit,f<0?void 0:f);for(;d.pos<h-a.from;)Tn(this.streamParser.token,d,l);}else this.streamParser.blankLine(l,e.unit);if(h==e.pos)break;s=a.to+1;}let o=e.lineAt(e.pos);return n&&t==null&&rn.set(e.state,o.from),this.streamParser.indent(l,/^\s*(.*)/.exec(o.text)[1],e)}get allowsNesting(){return false}};function It(r,e,t,n,i){let s=t>=n&&t+e.length<=i&&e.prop(r.stateAfter);if(s)return {state:r.streamParser.copyState(s),pos:t+e.length};for(let l=e.children.length-1;l>=0;l--){let o=e.children[l],a=t+e.positions[l],h=o instanceof A&&a<i&&It(r,o,a,n,i);if(h)return h}return null}function Cn(r,e,t,n,i){if(i&&t<=0&&n>=e.length)return e;!i&&t==0&&e.type==r.topNode&&(i=true);for(let s=e.children.length-1;s>=0;s--){let l=e.positions[s],o=e.children[s],a;if(l<n&&o instanceof A){if(!(a=Cn(r,o,t-l,n-l,i)))break;return i?new A(e.type,e.children.slice(0,s).concat(a),e.positions.slice(0,s+1),l+a.length):a}}return null}function vr(r,e,t,n,i){for(let s of e){let l=s.from+(s.openStart?25:0),o=s.to-(s.openEnd?25:0),a=l<=t&&o>t&&It(r,s.tree,0-s.offset,t,o),h;if(a&&a.pos<=n&&(h=Cn(r,s.tree,t+s.offset,a.pos+s.offset,false)))return {state:a.state,tree:h}}return {state:r.streamParser.startState(i?qe(i):4),tree:A.empty}}var At=class{constructor(e,t,n,i){this.lang=e,this.input=t,this.fragments=n,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let s=Ce.get(),l=i[0].from,{state:o,tree:a}=vr(e,n,l,this.to,s?.state);this.state=o,this.parsedPos=this.chunkStart=l+a.length;for(let h=0;h<a.children.length;h++)this.chunks.push(a.children[h]),this.chunkPos.push(a.positions[h]);s&&this.parsedPos<s.viewport.from-1e5&&i.some(h=>h.from<=s.viewport.from&&h.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(qe(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex();}advance(){let e=Ce.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(t,this.chunkStart+512);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos<n;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e;}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==`
`&&(t="");else {let n=t.indexOf(`
`);n>-1&&(t=t.slice(0,n));}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=n||(t=t.slice(0,s-(n-t.length)),i++,i==this.ranges.length))break;let l=this.ranges[i].from,o=this.lineAfter(l);t+=o,n=l+o.length;}return {line:t,end:n}}skipGapsTo(e,t,n){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+t;if(n>0?i>s:i>=s)break;let l=this.ranges[++this.rangeIndex].from;t+=l-i;}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++;}emitToken(e,t,n,i){let s=4;if(this.ranges.length>1){i=this.skipGapsTo(t,i,1),t+=i;let o=this.chunk.length;i=this.skipGapsTo(n,i,-1),n+=i,s+=this.chunk.length-o;}let l=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&l>=0&&this.chunk[l]==e&&this.chunk[l+2]==t?this.chunk[l+2]=n:this.chunk.push(e,t,n,s),i}parseLine(e){let{line:t,end:n}=this.nextLine(),i=0,{streamParser:s}=this.lang,l=new Ke(t,e?e.state.tabSize:4,e?qe(e.state):2);if(l.eol())s.blankLine(this.state,l.indentUnit);else for(;!l.eol();){let o=Tn(s.token,l,this.state);if(o&&(i=this.emitToken(this.lang.tokenTable.resolve(o),this.parsedPos+l.start,this.parsedPos+l.pos,i)),l.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++;}finishChunk(){let e=A.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Sr,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new A(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos;}finish(){return new A(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function Tn(r,e,t){e.start=e.pos;for(let n=0;n<10;n++){let i=r(e,t);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}var Bt=Object.create(null),Be=[R.none],Sr=new Fe(Be),ln=[],on=Object.create(null),Pn=Object.create(null);for(let[r,e]of [["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Pn[r]=Nn(Bt,e);var Qe=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Pn);}resolve(e){return e?this.table[e]||(this.table[e]=Nn(this.extra,e)):0}},Ar=new Qe(Bt);function mt(r,e){ln.indexOf(r)>-1||(ln.push(r),console.warn(e));}function Nn(r,e){let t=[];for(let o of e.split(" ")){let a=[];for(let h of o.split(".")){let f=r[h]||c[h];f?typeof f=="function"?a.length?a=a.map(f):mt(h,`Modifier ${h} used at start of tag`):a.length?mt(h,`Tag ${h} used as modifier`):a=Array.isArray(f)?f:[f]:mt(h,`Unknown highlighting tag ${h}`);}for(let h of a)t.push(h);}if(!t.length)return 0;let n=e.replace(/ /g,"_"),i=n+" "+t.map(o=>o.id),s=on[i];if(s)return s.id;let l=on[i]=R.define({id:Be.length,name:n,props:[$t({[n]:t})]});return Be.push(l),l.id}function Cr(r,e){let t=R.define({id:Be.length,name:"Document",props:[he.add(()=>r),gn.add(()=>n=>e.getIndent(n))],top:true});return Be.push(t),t}function In(r){return r.length<=4096&&/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/.test(r)}function Bn(r){for(let e=r.iter();!e.next().done;)if(In(e.value))return true;return false}function Tr(r){let e=false;return r.iterChanges((t,n,i,s,l)=>{!e&&Bn(l)&&(e=true);}),e}var Ct=k$1.define({combine:r=>r.some(e=>e)});function ii(r={}){let e=[Pr];return r.alwaysIsolate&&e.push(Ct.of(true)),e}var Pr=N.fromClass(class{constructor(r){this.always=r.state.facet(Ct)||r.textDirection!=R$1.LTR||r.state.facet(pt$1.perLineTextDirection),this.hasRTL=!this.always&&Bn(r.state.doc),this.tree=z(r.state),this.decorations=this.always||this.hasRTL?an(r,this.tree,this.always):A$1.none;}update(r){let e=r.state.facet(Ct)||r.view.textDirection!=R$1.LTR||r.state.facet(pt$1.perLineTextDirection);if(!e&&!this.hasRTL&&Tr(r.changes)&&(this.hasRTL=true),!e&&!this.hasRTL)return;let t=z(r.state);(e!=this.always||t!=this.tree||r.docChanged||r.viewportChanged)&&(this.tree=t,this.always=e,this.decorations=an(r.view,t,e));}},{provide:r=>{function e(t){var n,i;return (i=(n=t.plugin(r))===null||n===void 0?void 0:n.decorations)!==null&&i!==void 0?i:A$1.none}return [pt$1.outerDecorations.of(e),pt$2.lowest(pt$1.bidiIsolatedRanges.of(e))]}});function an(r,e,t){let n=new se$1,i=r.visibleRanges;t||(i=Nr(i,r.state.doc));for(let{from:s,to:l}of i)e.iterate({enter:o=>{let a=o.type.prop(k.isolate);a&&n.add(o.from,o.to,Ir[a]);},from:s,to:l});return n.finish()}function Nr(r,e){let t=e.iter(),n=0,i=[],s=null;for(let{from:l,to:o}of r)if(!(s&&s.to>l&&(l=s.to,l>=o)))for(n+t.value.length<l&&(t.next(l-(n+t.value.length)),n=l);;){let a=n,h=n+t.value.length;if(!t.lineBreak&&In(t.value)&&(s&&s.to>a-10?s.to=Math.min(o,h):i.push(s={from:a,to:Math.min(o,h)})),h>=o)break;n=h,t.next();}return i}var Ir={rtl:A$1.mark({class:"cm-iso",inclusive:true,attributes:{dir:"rtl"},bidiIsolate:R$1.RTL}),ltr:A$1.mark({class:"cm-iso",inclusive:true,attributes:{dir:"ltr"},bidiIsolate:R$1.LTR}),auto:A$1.mark({class:"cm-iso",inclusive:true,attributes:{dir:"auto"},bidiIsolate:null})};var chunkRTPFSJM2=/*#__PURE__*/Object.freeze({__proto__:null,DocInput:kt,HighlightStyle:Je,IndentContext:Pe,LRLanguage:Kt,Language:F,LanguageDescription:Yt,LanguageSupport:Xt,ParseContext:Ce,StreamLanguage:sn,StringStream:Ke,TreeIndentContext:bt,bidiIsolates:ii,bracketMatching:ri,bracketMatchingHandle:kr,codeFolding:yn,continuedIndent:Gr,defaultHighlightStyle:ni,defineLanguageFacet:hn,delimitedIndent:$r,ensureSyntaxTree:Wn,flatIndent:qr,foldAll:ir,foldCode:nr,foldEffect:Me,foldGutter:Zr,foldInside:Kr,foldKeymap:Yr,foldNodeProp:Yn,foldService:Xn,foldState:ne,foldable:Ne,foldedRanges:Qr,forceParsing:Ur,getIndentUnit:qe,getIndentation:pn,highlightingFor:ti,indentNodeProp:gn,indentOnInput:Jr,indentRange:Vr,indentService:Hn,indentString:dn,indentUnit:cn,language:te,languageDataProp:he,matchBrackets:Ve,sublanguageProp:Un,syntaxHighlighting:ei,syntaxParserRunning:Wr,syntaxTree:z,syntaxTreeAvailable:jr,toggleFold:Xr,unfoldAll:sr,unfoldCode:rr,unfoldEffect:de});export{$t as $,A,B,Fe as F,Gr as G,Je as J,Kt as K,Pe as P,R,Ve as V,Xt as X,Yn as Y,Kr as a,cn as b,c,dn as d,ei as e,chunkRTPFSJM2 as f,gn as g,k,pn as p,qe as q,we as w,z};