r.bottom)&&y==r.bottom-u.bottom>u.top-r.top&&(y=!y);var O=(y?u.top-r.top:r.bottom-u.bottom)-f;if(Og&&S.topk&&(k=y?S.top-p-2-f:S.bottom+f+2)}}catch(P){x.e(P)}finally{x.f()}}"absolute"==this.position?(l.style.top=k-e.parent.top+"px",l.style.left=g-e.parent.left+"px"):(l.style.top=k+"px",l.style.left=g+"px"),h&&(h.style.left="".concat(u.left+(m?v.x:-v.x)-(g+14-7),"px")),!0!==s.overlap&&i.push({left:g,top:k,right:b,bottom:k+p}),l.classList.toggle("cm-tooltip-above",y),l.classList.toggle("cm-tooltip-below",!y),s.positioned&&s.positioned(e.space)}}}},{key:"maybeMeasure",value:function(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView))){var e,t=T(this.manager.tooltipViews);try{for(t.s();!(e=t.n()).done;){e.value.dom.style.top=zs}}catch(n){t.e(n)}finally{t.f()}}}}]),e}(),{eventHandlers:{scroll:function(){this.maybeMeasure()}}}),Us=Ya.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"".concat(7,"px"),width:"".concat(14,"px"),position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"".concat(7,"px solid transparent"),borderRight:"".concat(7,"px solid transparent")},".cm-tooltip-above &":{bottom:"-".concat(7,"px"),"&:before":{borderTop:"".concat(7,"px solid #bbb")},"&:after":{borderTop:"".concat(7,"px solid #f5f5f5"),bottom:"1px"}},".cm-tooltip-below &":{top:"-".concat(7,"px"),"&:before":{borderBottom:"".concat(7,"px solid #bbb")},"&:after":{borderBottom:"".concat(7,"px solid #f5f5f5"),top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Gs={x:0,y:0},Hs=Lt.define({enables:[Fs,Us]}),Zs=Lt.define(),Ks=function(){function e(t){var n=this;u(this,e),this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Bs(t,Zs,(function(e){return n.createHostedView(e)}))}return d(e,[{key:"createHostedView",value:function(e){var t=e.create(this.view);return t.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(t.dom),this.mounted&&t.mount&&t.mount(this.view),t}},{key:"mount",value:function(e){var t,n=T(this.manager.tooltipViews);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.mount&&r.mount(e)}}catch(i){n.e(i)}finally{n.f()}this.mounted=!0}},{key:"positioned",value:function(e){var t,n=T(this.manager.tooltipViews);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.positioned&&r.positioned(e)}}catch(i){n.e(i)}finally{n.f()}}},{key:"update",value:function(e){this.manager.update(e)}},{key:"destroy",value:function(){var e,t,n=T(this.manager.tooltipViews);try{for(n.s();!(t=n.n()).done;){var r=t.value;null===(e=r.destroy)||void 0===e||e.call(r)}}catch(i){n.e(i)}finally{n.f()}}}],[{key:"create",value:function(t){return new e(t)}}]),e}(),Js=Hs.compute([Zs],(function(e){var t=e.facet(Zs).filter((function(e){return e}));return 0===t.length?null:{pos:Math.min.apply(Math,l(t.map((function(e){return e.pos})))),end:Math.max.apply(Math,l(t.filter((function(e){return null!=e.end})).map((function(e){return e.end})))),create:Ks.create,above:t[0].above,arrow:t.some((function(e){return e.arrow}))}})),el=function(){function e(t,n,r,i,o){u(this,e),this.view=t,this.source=n,this.field=r,this.setHover=i,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}return d(e,[{key:"update",value:function(){var e=this;this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((function(){return e.startHover()}),20))}},{key:"active",get:function(){return this.view.state.field(this.field)}},{key:"checkHover",value:function(){if(this.hoverTimeout=-1,!this.active){var e=Date.now()-this.lastMove.time;er.bottom||t.xr.right+this.view.defaultCharacterWidth)){var i=this.view.bidiSpans(this.view.state.doc.lineAt(n)).find((function(e){return e.from<=n&&e.to>=n})),o=i&&i.dir==Bi.RTL?-1:1,a=this.source(this.view,n,t.x1&&void 0!==arguments[1]?arguments[1]:{},n=mn.define(),r=Yt.define({create:function(){return null},update:function(e,r){if(e&&(t.hideOnChange&&(r.docChanged||r.selection)||t.hideOn&&t.hideOn(r,e)))return null;if(e&&r.docChanged){var i=r.changes.mapPos(e.pos,-1,Ct.TrackDel);if(null==i)return null;var o=Object.assign(Object.create(null),e);o.pos=i,null!=e.end&&(o.end=r.changes.mapPos(e.end)),e=o}var a,s=T(r.effects);try{for(s.s();!(a=s.n()).done;){var l=a.value;l.is(n)&&(e=l.value),l.is(il)&&(e=null)}}catch(u){s.e(u)}finally{s.f()}return e},provide:function(e){return Zs.from(e)}});return[r,Mi.define((function(i){return new el(i,e,r,n,t.hoverTime||300)})),Js]}function rl(e,t){var n=e.plugin(Fs);if(!n)return null;var r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}var il=mn.define();var ol=Lt.define({combine:function(e){var t,n,r,i=T(e);try{for(i.s();!(r=i.n()).done;){var o=r.value;t=t||o.topContainer,n=n||o.bottomContainer}}catch(a){i.e(a)}finally{i.f()}return{topContainer:t,bottomContainer:n}}});function al(e,t){var n=e.plugin(sl),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var sl=Mi.fromClass(function(){function e(t){u(this,e),this.input=t.state.facet(cl),this.specs=this.input.filter((function(e){return e})),this.panels=this.specs.map((function(e){return e(t)}));var n=t.state.facet(ol);this.top=new ll(t,!0,n.topContainer),this.bottom=new ll(t,!1,n.bottomContainer),this.top.sync(this.panels.filter((function(e){return e.top}))),this.bottom.sync(this.panels.filter((function(e){return!e.top})));var r,i=T(this.panels);try{for(i.s();!(r=i.n()).done;){var o=r.value;o.dom.classList.add("cm-panel"),o.mount&&o.mount()}}catch(a){i.e(a)}finally{i.f()}}return d(e,[{key:"update",value:function(e){var t=e.state.facet(ol);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new ll(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new ll(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();var n=e.state.facet(cl);if(n!=this.input){var r,i=n.filter((function(e){return e})),o=[],a=[],s=[],l=[],u=T(i);try{for(u.s();!(r=u.n()).done;){var c=r.value,h=this.specs.indexOf(c),f=void 0;h<0?(f=c(e.view),l.push(f)):(f=this.panels[h]).update&&f.update(e),o.push(f),(f.top?a:s).push(f)}}catch(O){u.e(O)}finally{u.f()}this.specs=i,this.panels=o,this.top.sync(a),this.bottom.sync(s);for(var d=0,p=l;dthis.i;){var t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}]),e}(),wl=function(){function e(t,n){var r=this;u(this,e),this.view=t,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");var i=function(e){r.dom.addEventListener(e,(function(i){var o,a=i.target;if(a!=r.dom&&r.dom.contains(a)){for(;a.parentNode!=r.dom;)a=a.parentNode;var s=a.getBoundingClientRect();o=(s.top+s.bottom)/2}else o=i.clientY;var l=t.lineBlockAtHeight(o-t.documentTop);n.domEventHandlers[e](t,l,i)&&i.preventDefault()}))};for(var o in n.domEventHandlers)i(o);this.markers=Ol(n.markers(t)),n.initialSpacer&&(this.spacer=new xl(t,0,0,[n.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}return d(e,[{key:"update",value:function(e){var t=this.markers;if(this.markers=Ol(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){var n=this.config.updateSpacer(this.spacer.markers[0],e);n!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[n])}var r=e.view.viewport;return!qn.eq(this.markers,t,r.from,r.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}},{key:"destroy",value:function(){var e,t=T(this.elements);try{for(t.s();!(e=t.n()).done;){e.value.destroy()}}catch(n){t.e(n)}finally{t.f()}}}]),e}(),xl=function(){function e(t,n,r,i){u(this,e),this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,r,i)}return d(e,[{key:"update",value:function(e,t,n,r){this.height!=t&&(this.dom.style.height=(this.height=t)+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(var n=0;nr&&(r=a,n.push(Rl.range(a)))}}catch(s){i.e(s)}finally{i.f()}return qn.of(n)}));function Ml(e,t,n){return(t=h(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Dl=1024,ql=0,Wl=d((function e(t,n){u(this,e),this.from=t,this.to=n})),_l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u(this,e),this.id=ql++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return d(e,[{key:"add",value:function(e){var t=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=$l.match(e)),function(n){var r=e(n);return void 0===r?null:[t,r]}}}]),e}();_l.closedBy=new _l({deserialize:function(e){return e.split(" ")}}),_l.openedBy=new _l({deserialize:function(e){return e.split(" ")}}),_l.group=new _l({deserialize:function(e){return e.split(" ")}}),_l.contextHash=new _l({perNode:!0}),_l.lookAhead=new _l({perNode:!0}),_l.mounted=new _l({perNode:!0});var Nl=Object.create(null),$l=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;u(this,e),this.name=t,this.props=n,this.id=r,this.flags=i}return d(e,[{key:"prop",value:function(e){return this.props[e.id]}},{key:"isTop",get:function(){return(1&this.flags)>0}},{key:"isSkipped",get:function(){return(2&this.flags)>0}},{key:"isError",get:function(){return(4&this.flags)>0}},{key:"isAnonymous",get:function(){return(8&this.flags)>0}},{key:"is",value:function(e){if("string"==typeof e){if(this.name==e)return!0;var t=this.prop(_l.group);return!!t&&t.indexOf(e)>-1}return this.id==e}}],[{key:"define",value:function(t){var n=t.props&&t.props.length?Object.create(null):Nl,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),i=new e(t.name||"",n,t.id,r);if(t.props){var o,a=T(t.props);try{for(a.s();!(o=a.n()).done;){var s=o.value;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");n[s[0].id]=s[1]}}}catch(l){a.e(l)}finally{a.f()}}return i}},{key:"match",value:function(e){var t=Object.create(null);for(var n in e){var r,i=T(n.split(" "));try{for(i.s();!(r=i.n()).done;){var o=r.value;t[o]=e[n]}}catch(a){i.e(a)}finally{i.f()}}return function(e){for(var n=e.prop(_l.group),r=-1;r<(n?n.length:0);r++){var i=t[r<0?e.name:n[r]];if(i)return i}}}}]),e}();$l.none=new $l("",Object.create(null),0,8);var Vl,Ll=function(){function e(t){u(this,e),this.types=t;for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:0;return new eu(this.topNode,e)}},{key:"cursorAt",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Il.get(this)||this.topNode,r=new eu(n);return r.moveTo(e,t),Il.set(this,r._tree),r}},{key:"topNode",get:function(){return new Gl(this,0,0,null)}},{key:"resolve",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Ul(Il.get(this)||this.topNode,e,t,!1);return Il.set(this,n),n}},{key:"resolveInner",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Ul(zl.get(this)||this.topNode,e,t,!0);return zl.set(this,n),n}},{key:"iterate",value:function(e){for(var t=e.enter,n=e.leave,r=e.from,i=void 0===r?0:r,o=e.to,a=void 0===o?this.length:o,s=e.mode||0,l=(s&Vl.IncludeAnonymous)>0,u=this.cursor(s|Vl.IncludeAnonymous);;){var c=!1;if(u.from<=a&&u.to>=i&&(!l&&u.type.isAnonymous||!1!==t(u))){if(u.firstChild())continue;c=!0}for(;c&&n&&(l||!u.type.isAnonymous)&&n(u),!u.nextSibling();){if(!u.parent())return;c=!0}}}},{key:"prop",value:function(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}},{key:"propValues",get:function(){var e=[];if(this.props)for(var t in this.props)e.push([+t,this.props[t]]);return e}},{key:"balance",value:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.children.length<=8?this:iu($l.none,this.children,this.positions,0,this.children.length,0,this.length,(function(n,r,i){return new e(t.type,n,r,i,t.propValues)}),n.makeTree||function(t,n,r){return new e($l.none,t,n,r)})}}],[{key:"build",value:function(e){return function(e){var t,n=e.buffer,r=e.nodeSet,i=e.maxBufferLength,o=void 0===i?Dl:i,a=e.reused,s=void 0===a?[]:a,l=e.minRepeatType,u=void 0===l?r.types.length:l,c=Array.isArray(n)?new Xl(n,n.length):n,h=r.types,f=0,d=0;function p(e,t,n,i,a){for(var l=c.id,k=c.start,b=c.end,w=c.size,x=d;w<0;){if(c.next(),-1==w){var S=s[l];return n.push(S),void i.push(k-e)}if(-3==w)return void(f=l);if(-4==w)return void(d=l);throw new RangeError("Unrecognized record size: ".concat(w))}var T,P,C=h[l],E=k-e;if(b-k<=o&&(P=y(c.pos-t,a))){for(var Q=new Uint16Array(P.size-P.skip),R=c.pos-P.size,A=Q.length;c.pos>R;)A=O(P.start,Q,A);T=new jl(Q,b-P.start,r),E=P.start-e}else{var M=c.pos-w;c.next();for(var D=[],q=[],W=l>=u?l:-1,_=0,N=b;c.pos>M;)W>=0&&c.id==W&&c.size>=0?(c.end<=N-o&&(m(D,q,k,_,c.end,N,W,x),_=D.length,N=c.end),c.next()):p(k,M,D,q,W);if(W>=0&&_>0&&_-1&&_>0){var $=v(C);T=iu(C,D,q,0,D.length,0,b-k,$,$)}else T=g(C,D,q,b-k,x-b)}n.push(T),i.push(E)}function v(e){return function(t,n,r){var i,o,a=0,s=t.length-1;if(s>=0&&(i=t[s])instanceof Bl){if(!s&&i.type==e&&i.length==r)return i;(o=i.prop(_l.lookAhead))&&(a=n[s]+i.length+o)}return g(e,t,n,r,a)}}function m(e,t,n,i,o,a,s,l){for(var u=[],c=[];e.length>i;)u.push(e.pop()),c.push(t.pop()+n-o);e.push(g(r.types[s],u,c,a-o,l-a)),t.push(o-n)}function g(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0;if(f){var a=[_l.contextHash,f];o=o?[a].concat(o):[a]}if(i>25){var s=[_l.lookAhead,i];o=o?[s].concat(o):[s]}return new Bl(e,t,n,r,o)}function y(e,t){var n=c.fork(),r=0,i=0,a=0,s=n.end-o,l={size:0,start:0,skip:0};e:for(var h=n.pos-e;n.pos>h;){var f=n.size;if(n.id==t&&f>=0)l.size=r,l.start=i,l.skip=a,a+=4,r+=4,n.next();else{var d=n.pos-f;if(f<0||d=u?4:0,v=n.start;for(n.next();n.pos>d;){if(n.size<0){if(-3!=n.size)break e;p+=4}else n.id>=u&&(p+=4);n.next()}i=v,r+=f,a+=p}}return(t<0||r==e)&&(l.size=r,l.start=i,l.skip=a),l.size>4?l:void 0}function O(e,t,n){var r=c.id,i=c.start,o=c.end,a=c.size;if(c.next(),a>=0&&r4)for(var l=c.pos-(a-4);c.pos>l;)n=O(e,t,n);t[--n]=s,t[--n]=o-e,t[--n]=i-e,t[--n]=r}else-3==a?f=r:-4==a&&(d=r);return n}var k=[],b=[];for(;c.pos>0;)p(e.start||0,e.bufferStart||0,k,b,-1);var w=null!==(t=e.length)&&void 0!==t?t:k.length?b[0]+k[0].length:0;return new Bl(h[e.topID],k.reverse(),b.reverse(),w)}(e)}}]),e}();Bl.empty=new Bl($l.none,[],[],0);var Xl=function(){function e(t,n){u(this,e),this.buffer=t,this.index=n}return d(e,[{key:"id",get:function(){return this.buffer[this.index-4]}},{key:"start",get:function(){return this.buffer[this.index-3]}},{key:"end",get:function(){return this.buffer[this.index-2]}},{key:"size",get:function(){return this.buffer[this.index-1]}},{key:"pos",get:function(){return this.index}},{key:"next",value:function(){this.index-=4}},{key:"fork",value:function(){return new e(this.buffer,this.index)}}]),e}(),jl=function(){function e(t,n,r){u(this,e),this.buffer=t,this.length=n,this.set=r}return d(e,[{key:"type",get:function(){return $l.none}},{key:"toString",value:function(){for(var e=[],t=0;t0));s=o[s+3]);return a}},{key:"slice",value:function(t,n,r){for(var i=this.buffer,o=new Uint16Array(n-t),a=0,s=t,l=0;s=t&&nt;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function Fl(e,t){for(var n=e.childBefore(t);n;){var r=n.lastChild;if(!r||r.to!=n.to)break;r.type.isError&&r.from==r.to?(e=n,n=r.prevSibling):n=r}return e}function Ul(e,t,n,r){for(var i;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to4&&void 0!==arguments[4]?arguments[4]:0,a=this;;){for(var s=a._tree,l=s.children,u=s.positions,c=n>0?l.length:-1;t!=c;t+=n){var h=l[t],f=u[t]+a.from;if(Yl(i,r,f,f+h.length))if(h instanceof jl){if(o&Vl.ExcludeBuffers)continue;var d=h.findChild(0,h.buffer.length,n,r-f,i);if(d>-1)return new Jl(new Kl(a,h,t,f),null,d)}else if(o&Vl.IncludeAnonymous||!h.type.isAnonymous||tu(h)){var p=void 0;if(!(o&Vl.IgnoreMounts)&&h.props&&(p=h.prop(_l.mounted))&&!p.overlay)return new e(p.tree,f,t,a);var v=new e(h,f,t,a);return o&Vl.IncludeAnonymous||!v.type.isAnonymous?v:v.nextChild(n<0?h.children.length-1:0,n,r,i)}}if(o&Vl.IncludeAnonymous||!a.type.isAnonymous)return null;if(t=a.index>=0?a.index+n:n<0?-1:a._parent._tree.children.length,!(a=a._parent))return null}}},{key:"firstChild",get:function(){return this.nextChild(0,1,0,4)}},{key:"lastChild",get:function(){return this.nextChild(this._tree.children.length-1,-1,0,4)}},{key:"childAfter",value:function(e){return this.nextChild(0,1,e,2)}},{key:"childBefore",value:function(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}},{key:"enter",value:function(t,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(i&Vl.IgnoreOverlays)&&(r=this._tree.prop(_l.mounted))&&r.overlay){var o,a=t-this.from,s=T(r.overlay);try{for(s.s();!(o=s.n()).done;){var l=o.value,u=l.from,c=l.to;if((n>0?u<=a:u=a:c>a))return new e(r.tree,r.overlay[0].from+this.from,-1,this)}}catch(h){s.e(h)}finally{s.f()}}return this.nextChild(0,1,t,n,i)}},{key:"nextSignificantParent",value:function(){for(var e=this;e.type.isAnonymous&&e._parent;)e=e._parent;return e}},{key:"parent",get:function(){return this._parent?this._parent.nextSignificantParent():null}},{key:"nextSibling",get:function(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}},{key:"prevSibling",get:function(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}},{key:"cursor",value:function(){return new eu(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function(){return this._tree}},{key:"toTree",value:function(){return this._tree}},{key:"resolve",value:function(e){return Ul(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(e){return Ul(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function(e){return Fl(this,e)}},{key:"getChild",value:function(e){var t=Hl(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return t.length?t[0]:null}},{key:"getChildren",value:function(e){return Hl(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}},{key:"toString",value:function(){return this._tree.toString()}},{key:"node",get:function(){return this}},{key:"matchContext",value:function(e){return Zl(this,e)}}]),e}();function Hl(e,t,n,r){var i=e.cursor(),o=[];if(!i.firstChild())return o;if(null!=n)for(;!i.type.is(n);)if(!i.nextSibling())return o;for(;;){if(null!=r&&i.type.is(r))return o;if(i.type.is(t)&&o.push(i.node),!i.nextSibling())return null==r?o:[]}}function Zl(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length-1,r=e.parent;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var Kl=d((function e(t,n,r,i){u(this,e),this.parent=t,this.buffer=n,this.index=r,this.start=i})),Jl=function(){function e(t,n,r){u(this,e),this.context=t,this._parent=n,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}return d(e,[{key:"name",get:function(){return this.type.name}},{key:"from",get:function(){return this.context.start+this.context.buffer.buffer[this.index+1]}},{key:"to",get:function(){return this.context.start+this.context.buffer.buffer[this.index+2]}},{key:"child",value:function(t,n,r){var i=this.context.buffer,o=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return o<0?null:new e(this.context,this,o)}},{key:"firstChild",get:function(){return this.child(1,0,4)}},{key:"lastChild",get:function(){return this.child(-1,0,4)}},{key:"childAfter",value:function(e){return this.child(1,e,2)}},{key:"childBefore",value:function(e){return this.child(-1,e,-2)}},{key:"enter",value:function(t,n){if((arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)&Vl.ExcludeBuffers)return null;var r=this.context.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return i<0?null:new e(this.context,this,i)}},{key:"parent",get:function(){return this._parent||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}},{key:"nextSibling",get:function(){var t=this.context.buffer,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}},{key:"prevSibling",get:function(){var t=this.context.buffer,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}},{key:"cursor",value:function(){return new eu(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function(){return null}},{key:"toTree",value:function(){var e=[],t=[],n=this.context.buffer,r=this.index+4,i=n.buffer[this.index+3];if(i>r){var o=n.buffer[this.index+1];e.push(n.slice(r,i,o)),t.push(0)}return new Bl(this.type,e,t,this.to-this.from)}},{key:"resolve",value:function(e){return Ul(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(e){return Ul(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function(e){return Fl(this,e)}},{key:"toString",value:function(){return this.context.buffer.childString(this.index)}},{key:"getChild",value:function(e){var t=Hl(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return t.length?t[0]:null}},{key:"getChildren",value:function(e){return Hl(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}},{key:"node",get:function(){return this}},{key:"matchContext",value:function(e){return Zl(this,e)}}]),e}(),eu=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(u(this,e),this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Gl)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(var r=t._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=t,this.yieldBuf(t.index)}}return d(e,[{key:"name",get:function(){return this.type.name}},{key:"yieldNode",value:function(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}},{key:"yieldBuf",value:function(e,t){this.index=e;var n=this.buffer,r=n.start,i=n.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}},{key:"yield",value:function(e){return!!e&&(e instanceof Gl?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}},{key:"toString",value:function(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}},{key:"enterChild",value:function(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));var r=this.buffer.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}},{key:"firstChild",value:function(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function(e){return this.enterChild(1,e,2)}},{key:"childBefore",value:function(e){return this.enterChild(-1,e,-2)}},{key:"enter",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(n&Vl.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}},{key:"parent",value:function(){if(!this.buffer)return this.yieldNode(this.mode&Vl.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var e=this.mode&Vl.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}},{key:"sibling",value:function(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));var t=this.buffer.buffer,n=this.stack.length-1;if(e<0){var r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{var 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))}},{key:"nextSibling",value:function(){return this.sibling(1)}},{key:"prevSibling",value:function(){return this.sibling(-1)}},{key:"atLastNode",value:function(e){var t,n,r=this.buffer;if(r){if(e>0){if(this.index-1)for(var s=t+e,l=e<0?-1:n._tree.children.length;s!=l;s+=e){var u=n._tree.children[s];if(this.mode&Vl.IncludeAnonymous||u instanceof jl||!u.type.isAnonymous||tu(u))return!1}}return!0}},{key:"move",value:function(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}}},{key:"next",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(1,e)}},{key:"prev",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(-1,e)}},{key:"moveTo",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(var o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=i+1;break e}r=this.stack[--i]}for(var a=n;a=0;i--){if(i<0)return Zl(this.node,e,r);var o=n[t.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}]),e}();function tu(e){return e.children.some((function(e){return e instanceof jl||!e.type.isAnonymous||tu(e)}))}var nu=new WeakMap;function ru(e,t){if(!e.isAnonymous||t instanceof jl||t.type!=e)return 1;var n=nu.get(t);if(null==n){n=1;var r,i=T(t.children);try{for(i.s();!(r=i.n()).done;){var o=r.value;if(o.type!=e||!(o instanceof Bl)){n=1;break}n+=ru(e,o)}}catch(a){i.e(a)}finally{i.f()}nu.set(t,n)}return n}function iu(e,t,n,r,i,o,a,s,l){for(var u=0,c=r;c=h)break;v+=m}if(u==c+1){if(v>h){var g=n[c];t(g.children,g.positions,0,g.children.length,r[c]+s);continue}f.push(n[c])}else{var y=r[u-1]+n[u-1].length-p;f.push(iu(e,n,r,c,u,p,y,null,l))}d.push(p+s-o)}}(t,n,r,i,0),(s||l)(f,d,a)}var ou=function(){function e(){u(this,e),this.map=new WeakMap}return d(e,[{key:"setBuffer",value:function(e,t,n){var r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}},{key:"getBuffer",value:function(e,t){var n=this.map.get(e);return n&&n.get(t)}},{key:"set",value:function(e,t){e instanceof Jl?this.setBuffer(e.context.buffer,e.index,t):e instanceof Gl&&this.map.set(e.tree,t)}},{key:"get",value:function(e){return e instanceof Jl?this.getBuffer(e.context.buffer,e.index):e instanceof Gl?this.map.get(e.tree):void 0}},{key:"cursorSet",value:function(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}},{key:"cursorGet",value:function(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}]),e}(),au=function(){function e(t,n,r,i){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];u(this,e),this.from=t,this.to=n,this.tree=r,this.offset=i,this.open=(o?1:0)|(a?2:0)}return d(e,[{key:"openStart",get:function(){return(1&this.open)>0}},{key:"openEnd",get:function(){return(2&this.open)>0}}],[{key:"addTree",value:function(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=[new e(0,t.length,t,0,!1,i)],a=T(r);try{for(a.s();!(n=a.n()).done;){var s=n.value;s.to>t.length&&o.push(s)}}catch(l){a.e(l)}finally{a.f()}return o}},{key:"applyChanges",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:128;if(!n.length)return t;for(var i=[],o=1,a=t.length?t[0]:null,s=0,l=0,u=0;;s++){var c=s=r)for(;a&&a.from=f.from||h<=f.to||u){var d=Math.max(f.from,l)-u,p=Math.min(f.to,h)-u;f=d>=p?null:new e(d,p,f.tree,f.offset+u,s>0,!!c)}if(f&&i.push(f),a.to>h)break;a=o-1?t:fu.get(t.base||t,t.modified.concat(e).sort((function(e,t){return e.id-t.id})))}}}]),e}(),hu=0,fu=function(){function e(){u(this,e),this.instances=[],this.id=hu++}return d(e,null,[{key:"get",value:function(t,n){if(!n.length)return t;var r=n[0].instances.find((function(e){return e.base==t&&(r=n,i=e.modified,r.length==i.length&&r.every((function(e,t){return e==i[t]})));var r,i}));if(r)return r;var i,o=[],a=new cu(o,t,n),s=T(n);try{for(s.s();!(i=s.n()).done;){i.value.instances.push(a)}}catch(v){s.e(v)}finally{s.f()}var l,u=function(e){for(var t=[[]],n=0;n0&&c+3==a.length){l=1;break}var h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(u);if(!h)throw new RangeError("Invalid path: "+a);if(s.push("*"==h[0]?"":'"'==h[0][0]?JSON.parse(h[0]):h[0]),(c+=h[0].length)==a.length)break;var f=a[c++];if(c==a.length&&"!"==f){l=0;break}if("/"!=f)throw new RangeError("Invalid path: "+a);u=a.slice(c)}var d=s.length-1,p=s[d];if(!p)throw new RangeError("Invalid path: "+a);var v=new vu(r,l,d>0?s.slice(0,d):null);t[p]=v.sort(t[p])}}}catch(m){o.e(m)}finally{o.f()}}return pu.add(t)}var pu=new _l,vu=function(){function e(t,n,r,i){u(this,e),this.tags=t,this.mode=n,this.context=r,this.next=i}return d(e,[{key:"opaque",get:function(){return 0==this.mode}},{key:"inherit",get:function(){return 1==this.mode}},{key:"sort",value:function(e){return!e||e.depth3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e.length,o=new yu(r,Array.isArray(t)?t:[t],n);o.highlightRange(e.cursor(),r,i,"",o.highlighters),o.flush(i)}vu.empty=new vu([],2,null);var yu=function(){function e(t,n,r){u(this,e),this.at=t,this.highlighters=n,this.span=r,this.class=""}return d(e,[{key:"startSpan",value:function(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}},{key:"flush",value:function(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}},{key:"highlightRange",value:function(e,t,n,r,i){var o=e.type,a=e.from,s=e.to;if(!(a>=n||s<=t)){o.isTop&&(i=this.highlighters.filter((function(e){return!e.scope||e.scope(o)})));var l=r,u=function(e){var t=e.type.prop(pu);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||vu.empty,c=function(e,t){var n,r=null,i=T(e);try{for(i.s();!(n=i.n()).done;){var o=n.value.style(t);o&&(r=r?r+" "+o:o)}}catch(a){i.e(a)}finally{i.f()}return r}(i,u.tags);if(c&&(l&&(l+=" "),l+=c,1==u.mode&&(r+=(r?" ":"")+c)),this.startSpan(Math.max(t,a),l),!u.opaque){var h=e.tree&&e.tree.prop(_l.mounted);if(h&&h.overlay){for(var f=e.node.enter(h.overlay[0].from+a,1),d=this.highlighters.filter((function(e){return!e.scope||e.scope(h.tree.type)})),p=e.firstChild(),v=0,m=a;;v++){var g=v=y)&&e.nextSibling()););if(!g||y>n)break;(m=g.to+a)>t&&(this.highlightRange(f.cursor(),Math.max(t,g.from+a),Math.min(n,m),"",d),this.startSpan(Math.min(n,m),l))}p&&e.parent()}else if(e.firstChild()){h&&(r="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),l)}}while(e.nextSibling());e.parent()}}}}}]),e}();var Ou,ku=cu.define,bu=ku(),wu=ku(),xu=ku(wu),Su=ku(wu),Tu=ku(),Pu=ku(Tu),Cu=ku(Tu),Eu=ku(),Qu=ku(Eu),Ru=ku(),Au=ku(),Mu=ku(),Du=ku(Mu),qu=ku(),Wu={comment:bu,lineComment:ku(bu),blockComment:ku(bu),docComment:ku(bu),name:wu,variableName:ku(wu),typeName:xu,tagName:ku(xu),propertyName:Su,attributeName:ku(Su),className:ku(wu),labelName:ku(wu),namespace:ku(wu),macroName:ku(wu),literal:Tu,string:Pu,docString:ku(Pu),character:ku(Pu),attributeValue:ku(Pu),number:Cu,integer:ku(Cu),float:ku(Cu),bool:ku(Tu),regexp:ku(Tu),escape:ku(Tu),color:ku(Tu),url:ku(Tu),keyword:Ru,self:ku(Ru),null:ku(Ru),atom:ku(Ru),unit:ku(Ru),modifier:ku(Ru),operatorKeyword:ku(Ru),controlKeyword:ku(Ru),definitionKeyword:ku(Ru),moduleKeyword:ku(Ru),operator:Au,derefOperator:ku(Au),arithmeticOperator:ku(Au),logicOperator:ku(Au),bitwiseOperator:ku(Au),compareOperator:ku(Au),updateOperator:ku(Au),definitionOperator:ku(Au),typeOperator:ku(Au),controlOperator:ku(Au),punctuation:Mu,separator:ku(Mu),bracket:Du,angleBracket:ku(Du),squareBracket:ku(Du),paren:ku(Du),brace:ku(Du),content:Eu,heading:Qu,heading1:ku(Qu),heading2:ku(Qu),heading3:ku(Qu),heading4:ku(Qu),heading5:ku(Qu),heading6:ku(Qu),contentSeparator:ku(Eu),list:ku(Eu),quote:ku(Eu),emphasis:ku(Eu),strong:ku(Eu),link:ku(Eu),monospace:ku(Eu),strikethrough:ku(Eu),inserted:ku(),deleted:ku(),changed:ku(),invalid:ku(),meta:qu,documentMeta:ku(qu),annotation:ku(qu),processingInstruction:ku(qu),definition:cu.defineModifier(),constant:cu.defineModifier(),function:cu.defineModifier(),standard:cu.defineModifier(),local:cu.defineModifier(),special:cu.defineModifier()},_u=(mu([{tag:Wu.link,class:"tok-link"},{tag:Wu.heading,class:"tok-heading"},{tag:Wu.emphasis,class:"tok-emphasis"},{tag:Wu.strong,class:"tok-strong"},{tag:Wu.keyword,class:"tok-keyword"},{tag:Wu.atom,class:"tok-atom"},{tag:Wu.bool,class:"tok-bool"},{tag:Wu.url,class:"tok-url"},{tag:Wu.labelName,class:"tok-labelName"},{tag:Wu.inserted,class:"tok-inserted"},{tag:Wu.deleted,class:"tok-deleted"},{tag:Wu.literal,class:"tok-literal"},{tag:Wu.string,class:"tok-string"},{tag:Wu.number,class:"tok-number"},{tag:[Wu.regexp,Wu.escape,Wu.special(Wu.string)],class:"tok-string2"},{tag:Wu.variableName,class:"tok-variableName"},{tag:Wu.local(Wu.variableName),class:"tok-variableName tok-local"},{tag:Wu.definition(Wu.variableName),class:"tok-variableName tok-definition"},{tag:Wu.special(Wu.variableName),class:"tok-variableName2"},{tag:Wu.definition(Wu.propertyName),class:"tok-propertyName tok-definition"},{tag:Wu.typeName,class:"tok-typeName"},{tag:Wu.namespace,class:"tok-namespace"},{tag:Wu.className,class:"tok-className"},{tag:Wu.macroName,class:"tok-macroName"},{tag:Wu.propertyName,class:"tok-propertyName"},{tag:Wu.operator,class:"tok-operator"},{tag:Wu.comment,class:"tok-comment"},{tag:Wu.meta,class:"tok-meta"},{tag:Wu.invalid,class:"tok-invalid"},{tag:Wu.punctuation,class:"tok-punctuation"}]),new _l);function Nu(e){return Lt.define({combine:e?function(t){return t.concat(e)}:void 0})}var $u=new _l,Vu=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";u(this,e),this.data=t,this.name=i,En.prototype.hasOwnProperty("tree")||Object.defineProperty(En.prototype,"tree",{get:function(){return zu(this)}}),this.parser=n,this.extension=[Zu.of(this),En.languageData.of((function(e,t,n){var r=Lu(e,t,n),i=r.type.prop(_u);if(!i)return[];var o=e.facet(i),a=r.type.prop($u);if(a){var s,l=r.resolve(t-r.from,n),u=T(a);try{for(u.s();!(s=u.n()).done;){var c=s.value;if(c.test(l,e)){var h=e.facet(c.facet);return"replace"==c.type?h:h.concat(o)}}}catch(f){u.e(f)}finally{u.f()}}return o}))].concat(r)}return d(e,[{key:"isActiveAt",value:function(e,t){return Lu(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1).type.prop(_u)==this.data}},{key:"findRegions",value:function(e){var t=this,n=e.facet(Zu);if((null===n||void 0===n?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];var r=[];return function e(n,i){if(n.prop(_u)!=t.data){var o=n.prop(_l.mounted);if(o){if(o.tree.prop(_u)==t.data){if(o.overlay){var a,s=T(o.overlay);try{for(s.s();!(a=s.n()).done;){var l=a.value;r.push({from:l.from+i,to:l.to+i})}}catch(f){s.e(f)}finally{s.f()}}else r.push({from:i,to:i+n.length});return}if(o.overlay){var u=r.length;if(e(o.tree,o.overlay[0].from+i),r.length>u)return}}for(var c=0;c=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}]),e}(),Xu=null,ju=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,s=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0;u(this,e),this.parser=t,this.state=n,this.fragments=r,this.tree=i,this.treeLen=o,this.viewport=a,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}return d(e,[{key:"startParse",value:function(){return this.parser.startParse(new Bu(this.state.doc),this.fragments)}},{key:"work",value:function(e,t){var n=this;return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=Bl.empty&&this.isDone(null!==t&&void 0!==t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((function(){var r;if("number"==typeof e){var i=Date.now()+e;e=function(){return Date.now()>i}}for(n.parse||(n.parse=n.startParse()),null!=t&&(null==n.parse.stoppedAt||n.parse.stoppedAt>t)&&t=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext((function(){for(;!(t=n.parse.advance()););})),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(au.addTree(this.tree,this.fragments,!0)),this.parse=null)}},{key:"withContext",value:function(e){var t=Xu;Xu=this;try{return e()}finally{Xu=t}}},{key:"withoutTempSkipped",value:function(e){for(var t;t=this.tempSkipped.pop();)e=Yu(e,t.from,t.to);return e}},{key:"changes",value:function(t,n){var r=this.fragments,i=this.tree,o=this.treeLen,a=this.viewport,s=this.skipped;if(this.takeTree(),!t.empty){var l=[];if(t.iterChangedRanges((function(e,t,n,r){return l.push({fromA:e,toA:t,fromB:n,toB:r})})),r=au.applyChanges(r,l),i=Bl.empty,o=0,a={from:t.mapPos(a.from,-1),to:t.mapPos(a.to,1)},this.skipped.length){s=[];var u,c=T(this.skipped);try{for(c.s();!(u=c.n()).done;){var h=u.value,f=t.mapPos(h.from,1),d=t.mapPos(h.to,-1);fe.from&&(this.fragments=Yu(this.fragments,i,o),this.skipped.splice(n--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}},{key:"reset",value:function(){this.parse&&(this.takeTree(),this.parse=null)}},{key:"skipUntilInView",value:function(e,t){this.skipped.push({from:e,to:t})}},{key:"isDone",value:function(e){e=Math.min(e,this.state.doc.length);var t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}}],[{key:"create",value:function(t,n,r){return new e(t,n,[],Bl.empty,0,r,[],null)}},{key:"getSkippingParser",value:function(e){return new(function(t){v(r,t);var n=O(r);function r(){return u(this,r),n.apply(this,arguments)}return d(r,[{key:"createParse",value:function(t,n,r){var i=r[0].from,o=r[r.length-1].to,a={parsedPos:i,advance:function(){var t=Xu;if(t){var n,a=T(r);try{for(a.s();!(n=a.n()).done;){var s=n.value;t.tempSkipped.push(s)}}catch(l){a.e(l)}finally{a.f()}e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=o,new Bl($l.none,[],[],o-i)},stoppedAt:null,stopAt:function(){}};return a}}]),r}(su))}},{key:"get",value:function(){return Xu}}]),e}();function Yu(e,t,n){return au.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var Fu=function(){function e(t){u(this,e),this.context=t,this.tree=t.tree}return d(e,[{key:"apply",value:function(t){if(!t.docChanged&&this.tree==this.context.tree)return this;var n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new e(n)}}],[{key:"init",value:function(t){var n=Math.min(3e3,t.doc.length),r=ju.create(t.facet(Zu).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}}]),e}();Vu.state=Yt.define({create:Fu.init,update:function(e,t){var n,r=T(t.effects);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.is(Vu.setState))return i.value}}catch(o){r.e(o)}finally{r.f()}return t.startState.facet(Zu)!=t.state.facet(Zu)?Fu.init(t.state):e.apply(t)}});var Uu=function(e){var t=setTimeout((function(){return e()}),500);return function(){return clearTimeout(t)}};"undefined"!=typeof requestIdleCallback&&(Uu=function(e){var t=-1,n=setTimeout((function(){t=requestIdleCallback(e,{timeout:400})}),100);return function(){return t<0?clearTimeout(n):cancelIdleCallback(t)}});var Gu="undefined"!=typeof navigator&&(null===(Ou=navigator.scheduling)||void 0===Ou?void 0:Ou.isInputPending)?function(){return navigator.scheduling.isInputPending()}:null,Hu=Mi.fromClass(function(){function e(t){u(this,e),this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}return d(e,[{key:"update",value:function(e){var t=this.view.state.field(Vu.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),e.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}},{key:"scheduleWork",value:function(){if(!this.working){var e=this.view.state,t=e.field(Vu.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=Uu(this.work))}}},{key:"work",value:function(e){this.working=null;var t=Date.now();if(this.chunkEndi+1e3,l=o.context.work((function(){return Gu&&Gu()||Date.now()>a}),i+(s?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Vu.setState.of(new Fu(o.context))})),this.chunkBudget>0&&(!l||s)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}}}},{key:"checkAsyncSchedule",value:function(e){var t=this;e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((function(){return t.scheduleWork()})).catch((function(e){return Ei(t.view.state,e)})).then((function(){return t.workScheduled--})),e.scheduleOn=null)}},{key:"destroy",value:function(){this.working&&this.working()}},{key:"isWorking",value:function(){return!!(this.working||this.workScheduled>0)}}]),e}(),{eventHandlers:{focus:function(){this.scheduleWork()}}}),Zu=Lt.define({combine:function(e){return e.length?e[0]:null},enables:function(e){return[Vu.state,Hu,Ya.contentAttributes.compute([e],(function(t){var n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}}))]}}),Ku=d((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];u(this,e),this.language=t,this.support=n,this.extension=[t,n]})),Ju=Lt.define(),ec=Lt.define({combine:function(e){if(!e.length)return" ";var t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((function(e){return e!=t[0]})))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function tc(e){var t=e.facet(ec);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function nc(e,t){var n="",r=e.tabSize,i=e.facet(ec)[0];if("\t"==i){for(;t>=r;)n+="\t",t-=r;i=" "}for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:{};u(this,e),this.state=t,this.options=n,this.unit=tc(t)}return d(e,[{key:"lineAt",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.state.doc.lineAt(e),r=this.options,i=r.simulateBreak,o=r.simulateDoubleBreak;return null!=i&&i>=n.from&&i<=n.to?o&&i==e?{text:"",from:e}:(t<0?i1&&void 0!==arguments[1]?arguments[1]:1;if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";var n=this.lineAt(e,t),r=n.text,i=n.from;return r.slice(e-i,Math.min(r.length,e+100-i))}},{key:"column",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.lineAt(e,t),r=n.text,i=n.from,o=this.countColumn(r,e-i),a=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return a>-1&&(o+=a-this.countColumn(r,r.search(/\S|$/))),o}},{key:"countColumn",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length;return Yn(e,this.state.tabSize,t)}},{key:"lineIndent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.lineAt(e,t),r=n.text,i=n.from,o=this.options.overrideIndentation;if(o){var a=o(i);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}},{key:"simulatedBreak",get:function(){return this.options.simulateBreak||null}}]),e}(),oc=new _l;function ac(e){var t=e.type.prop(oc);if(t)return t;var n,r=e.firstChild;if(r&&(n=r.type.prop(_l.closedBy))){var i=e.lastChild,o=i&&n.indexOf(i.name)>-1;return function(e){return fc(e,!0,1,void 0,o&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?i.from:void 0)}}return null==e.parent?lc:null}function sc(e,t,n){for(;e;e=e.parent){var r=ac(e);if(r)return r(uc.create(n,t,e))}return null}function lc(){return 0}var uc=function(e){v(n,e);var t=O(n);function n(e,r,i){var o;return u(this,n),(o=t.call(this,e.state,e.options)).base=e,o.pos=r,o.node=i,o}return d(n,[{key:"textAfter",get:function(){return this.textAfterPos(this.pos)}},{key:"baseIndent",get:function(){return this.baseIndentFor(this.node)}},{key:"baseIndentFor",value:function(e){for(var t=this.state.doc.lineAt(e.from);;){for(var n=e.resolve(t.from);n.parent&&n.parent.from==n.from;)n=n.parent;if(cc(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}},{key:"continue",value:function(){var e=this.node.parent;return e?sc(e,this.pos,this.base):0}}],[{key:"create",value:function(e,t,r){return new n(e,t,r)}}]),n}(ic);function cc(e,t){for(var n=t;n;n=n.parent)if(e==n)return!0;return!1}function hc(e){var t=e.closing,n=e.align,r=void 0===n||n,i=e.units,o=void 0===i?1:i;return function(e){return fc(e,r,o,t)}}function fc(e,t,n,r,i){var o=e.textAfter,a=o.match(/^\s*/)[0].length,s=r&&o.slice(a,a+r.length)==r||i==e.pos+a,l=t?function(e){var t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;for(var i=e.options.simulateBreak,o=e.state.doc.lineAt(n.from),a=null==i||i<=o.from?o.to:Math.min(o.to,i),s=n.to;;){var l=t.childAfter(s);if(!l||l==r)return null;if(!l.type.isSkipped)return l.fromn)){if(i&&o.from=t&&s.to>n&&(i=s)}}return i}(e,t,n)}function gc(e,t){var n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}var yc=mn.define({map:gc}),Oc=mn.define({map:gc});function kc(e){var t,n=[],r=T(e.state.selection.ranges);try{var i=function(){var r=t.value.head;if(n.some((function(e){return e.from<=r&&e.to>=r})))return"continue";n.push(e.lineBlockAt(r))};for(r.s();!(t=r.n()).done;)i()}catch(o){r.e(o)}finally{r.f()}return n}var bc=Yt.define({create:function(){return ai.none},update:function(e,t){e=e.map(t.changes);var n,r=T(t.effects);try{var i=function(){var t=n.value;t.is(yc)&&!function(e,t,n){var r=!1;return e.between(t,t,(function(e,i){e==t&&i==n&&(r=!0)})),r}(e,t.value.from,t.value.to)?e=e.update({add:[Qc.range(t.value.from,t.value.to)]}):t.is(Oc)&&(e=e.update({filter:function(e,n){return t.value.from!=e||t.value.to!=n},filterFrom:t.value.from,filterTo:t.value.to}))};for(r.s();!(n=r.n()).done;)i()}catch(s){r.e(s)}finally{r.f()}if(t.selection){var o=!1,a=t.selection.main.head;e.between(a,a,(function(e,t){ea&&(o=!0)})),o&&(e=e.update({filterFrom:a,filterTo:a,filter:function(e,t){return t<=a||e>=a}}))}return e},provide:function(e){return Ya.decorations.from(e)},toJSON:function(e,t){var n=[];return e.between(0,t.doc.length,(function(e,t){n.push(e,t)})),n},fromJSON:function(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");for(var t=[],n=0;ne)&&(i={from:e,to:t})})),i}function xc(e,t){return e.field(bc,!1)?t:t.concat(mn.appendConfig.of(Ec()))}function Sc(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return Ya.announce.of("".concat(e.state.phrase(n?"Folded lines":"Unfolded lines")," ").concat(r," ").concat(e.state.phrase("to")," ").concat(i,"."))}var Tc=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:function(e){var t,n=T(kc(e));try{for(n.s();!(t=n.n()).done;){var r=t.value,i=mc(e.state,r.from,r.to);if(i)return e.dispatch({effects:xc(e.state,[yc.of(i),Sc(e,i)])}),!0}}catch(o){n.e(o)}finally{n.f()}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:function(e){if(!e.state.field(bc,!1))return!1;var t,n=[],r=T(kc(e));try{for(r.s();!(t=r.n()).done;){var i=t.value,o=wc(e.state,i.from,i.to);o&&n.push(Oc.of(o),Sc(e,o,!1))}}catch(a){r.e(a)}finally{r.f()}return n.length&&e.dispatch({effects:n}),n.length>0}},{key:"Ctrl-Alt-[",run:function(e){for(var t=e.state,n=[],r=0;r0&&Jc(t.state,a.head-1,1,i)||i.afterCursor&&(Jc(t.state,a.head,1,i)||a.head