"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[66806],{94658:function(e,t,n){n.d(t,{Gz:function(){return m}});var r=n(79353),i=n(13199),s=n(26829),o=n(66692),l=e=>{var{theme:t,settings:n={},styles:r=[]}=e,i={".cm-gutters":{}},l={};n.background&&(l.backgroundColor=n.background),n.backgroundImage&&(l.backgroundImage=n.backgroundImage),n.foreground&&(l.color=n.foreground),(n.background||n.foreground)&&(i["&"]=l),n.fontFamily&&(i["&.cm-editor .cm-scroller"]={fontFamily:n.fontFamily}),n.gutterBackground&&(i[".cm-gutters"].backgroundColor=n.gutterBackground),n.gutterForeground&&(i[".cm-gutters"].color=n.gutterForeground),n.gutterBorder&&(i[".cm-gutters"].borderRightColor=n.gutterBorder),n.caret&&(i[".cm-content"]={caretColor:n.caret},i[".cm-cursor, .cm-dropCursor"]={borderLeftColor:n.caret});var a={};n.gutterActiveForeground&&(a.color=n.gutterActiveForeground),n.lineHighlight&&(i[".cm-activeLine"]={backgroundColor:n.lineHighlight},a.backgroundColor=n.lineHighlight),i[".cm-activeLineGutter"]=a,n.selection&&(i["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:n.selection+" !important"}),n.selectionMatch&&(i["& .cm-selectionMatch"]={backgroundColor:n.selectionMatch});var h=s.tk.theme(i,{dark:"dark"===t}),c=o.Qf.define(r);return[h,(0,o.nF)(c)]},a="#000c18",h="#6688cc",c="#225588",u="#2277ff",f="#9966b8",d="#9966b8",p={background:a,foreground:h,caret:"#ddbb88",selection:"#770811",selectionMatch:"#770811",gutterBackground:a,gutterForeground:h,lineHighlight:"#0055ff30"},m=e=>{var{theme:t="dark",settings:n={},styles:s=[]}=e||{};return l({theme:t,settings:(0,r.Z)({},p,n),styles:[{tag:i.pJ.keyword,color:c},{tag:[i.pJ.name,i.pJ.deleted,i.pJ.character,i.pJ.macroName],color:u},{tag:[i.pJ.propertyName],color:f},{tag:[i.pJ.processingInstruction,i.pJ.string,i.pJ.inserted,i.pJ.special(i.pJ.string)],color:"#22aa44"},{tag:[i.pJ.function(i.pJ.variableName),i.pJ.labelName],color:f},{tag:[i.pJ.color,i.pJ.constant(i.pJ.name),i.pJ.standard(i.pJ.name)],color:"#f280d0"},{tag:[i.pJ.definition(i.pJ.name),i.pJ.separator],color:u},{tag:[i.pJ.className],color:"#ddbb88"},{tag:[i.pJ.number,i.pJ.changed,i.pJ.annotation,i.pJ.modifier,i.pJ.self,i.pJ.namespace],color:"#f280d0"},{tag:[i.pJ.typeName],color:d,fontStyle:d},{tag:[i.pJ.operator,i.pJ.operatorKeyword],color:c},{tag:[i.pJ.url,i.pJ.escape,i.pJ.regexp,i.pJ.link],color:"#22aa44"},{tag:[i.pJ.meta,i.pJ.comment],color:"#384887"},{tag:i.pJ.tagName,color:"#225588"},{tag:i.pJ.strong,fontWeight:"bold"},{tag:i.pJ.emphasis,fontStyle:"italic"},{tag:i.pJ.link,textDecoration:"underline"},{tag:i.pJ.heading,fontWeight:"bold",color:"#6688cc"},{tag:[i.pJ.atom,i.pJ.bool,i.pJ.special(i.pJ.variableName)],color:u},{tag:i.pJ.invalid,color:"#A22D44"},{tag:i.pJ.strikethrough,textDecoration:"line-through"},...s]})};m()},24167:function(e,t,n){let r,i;function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(n.readOnly)return!1;let i=e(t,n);return!!i&&(r(n.update(i)),!0)}}let y=g(function(e,t,n=t.selection.ranges){let r=[],i=-1;for(let{from:e,to:s}of n){let n=r.length,o=1e9,l=b(t,e).line;if(l){for(let n=e;n<=s;){let a=t.doc.lineAt(n);if(a.from>i&&(e==s||s>a.from)){i=a.from;let e=/^\s*/.exec(a.text)[0].length,t=e==a.length,n=a.text.slice(e,e+l.length)==l?e:-1;ee.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:s,single:o}of r)(o||!s)&&e.push({from:t.from+i,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,s=r+i.length;" "==t.text[s-t.from]&&s++,e.push({from:r,to:s})}return{changes:e}}return null},0),v=g(k,0),x=g((e,t)=>k(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to),s=t.length-1;s>=0&&t[s].to>r.from?t[s].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}(t)),0);function b(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}function k(e,t,n=t.selection.ranges){let r=n.map(e=>b(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>(function(e,{open:t,close:n},r,i){let s,o,l=e.sliceDoc(r-50,r),a=e.sliceDoc(i,i+50),h=/\s*$/.exec(l)[0].length,c=/^\s*/.exec(a)[0].length,u=l.length-h;if(l.slice(u-t.length,u)==t&&a.slice(c,c+n.length)==n)return{open:{pos:r-h,margin:h&&1},close:{pos:i+c,margin:c&&1}};i-r<=100?s=o=e.sliceDoc(r,i):(s=e.sliceDoc(r,r+50),o=e.sliceDoc(i-50,i));let f=/^\s*/.exec(s)[0].length,d=/\s*$/.exec(o)[0].length,p=o.length-d-n.length;return s.slice(f,f+t.length)==t&&o.slice(p,p+n.length)==n?{open:{pos:r+f+t.length,margin:/\s/.test(s.charAt(f+t.length))?1:0},close:{pos:i-d-n.length,margin:/\s/.test(o.charAt(p-1))?1:0}}:null})(t,r[n],e.from,e.to));if(2!=e&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}]))};if(1!=e&&i.some(e=>e)){let e=[];for(let t=0,n;t(0,u.BO)(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),M=u.QQ.define({create:()=>j.empty,update(e,t){let n=t.state.facet(A),r=t.annotation(w);if(r){let i=P.fromTransaction(t,r.selection),s=r.side,o=0==s?e.undone:e.done;return o=i?E(o,o.length,n.minDepth,i):L(o,t.startState.selection),new j(0==s?r.rest:o,0==s?o:r.rest)}let i=t.annotation(S);if(("full"==i||"before"==i)&&(e=e.isolate()),!1===t.annotation(u.YW.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let s=P.fromTransaction(t),o=t.annotation(u.YW.time),l=t.annotation(u.YW.userEvent);return s?e=e.addChanges(s,o,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,l,n.newGroupDelay)),("full"==i||"after"==i)&&(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new j(e.done.map(P.fromJSON),e.undone.map(P.fromJSON))});function O(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(M,!1);if(!i)return!1;let s=i.pop(e,n,t);return!!s&&(r(s),!0)}}let I=O(0,!1),T=O(1,!1),N=O(0,!0),D=O(1,!0);class P{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new P(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new P(e.changes&&u.as.fromJSON(e.changes),[],e.mapped&&u.n0.fromJSON(e.mapped),e.startSelection&&u.jT.fromJSON(e.startSelection),e.selectionsAfter.map(u.jT.fromJSON))}static fromTransaction(e,t){let n=R;for(let t of e.startState.facet(C)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new P(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,R)}static selection(e){return new P(void 0,R,void 0,void 0,e)}}function E(e,t,n,r){let i=e.slice(t+1>n+20?t-n-1:0,t);return i.push(r),i}function B(e,t){return e.length?t.length?e.concat(t):e:t}let R=[];function L(e,t){if(!e.length)return[P.selection([t])];{let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),E(e,e.length-1,1e9,n.setSelAfter(r)))}}function _(e,t){if(!e.length)return e;let n=e.length,r=R;for(;n;){let i=function(e,t,n){let r=B(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):R,n);if(!e.changes)return P.selection(r);let i=e.changes.map(t),s=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(s):s;return new P(i,u.Py.mapEffects(e.effects,t),o,e.startSelection.map(s),r)}(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[P.selection(r)]:R}let J=/^(input\.type|delete)($|\.)/;class j{constructor(e,t,n=0,r){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new j(this.done,this.undone):this}addChanges(e,t,n,r,i){var s,o;let l,a,h=this.done,c=h[h.length-1];return new j(h=c&&c.changes&&!c.changes.empty&&e.changes&&(!n||J.test(n))&&(!c.selectionsAfter.length&&t-this.prevTimel.push(e,t)),o.iterChangedRanges((e,t,n,r)=>{for(let e=0;e=t&&n<=i&&(a=!0)}}),a))||"input.type.compose"==n)?E(h,h.length-1,r.minDepth,new P(e.changes.compose(c.changes),B(e.effects,c.effects),c.mapped,c.startSelection,R)):E(h,h.length,r.minDepth,e),R,t,n)}addSelection(e,t,n,r){var i;let s=this.done.length?this.done[this.done.length-1].selectionsAfter:R;return s.length>0&&t-this.prevTimet.empty!=e.ranges[n].empty).length?this:new j(L(this.done,e),this.undone,t,n)}addMapping(e){return new j(_(this.done,e),_(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let i=r[r.length-1],s=i.selectionsAfter[0]||t.selection;if(n&&i.selectionsAfter.length){let n,o;return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:w.of({side:e,rest:(n=r[r.length-1],(o=r.slice())[r.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),o),selection:s}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0})}if(!i.changes)return null;{let n=1==r.length?R:r.slice(0,r.length-1);return i.mapped&&(n=_(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:w.of({side:e,rest:n,selection:s}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}}}j.empty=new j(R,R);let W=[{key:"Mod-z",run:I,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:T,preventDefault:!0},{linux:"Ctrl-Shift-z",run:T,preventDefault:!0},{key:"Mod-u",run:N,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:D,preventDefault:!0}];function q(e,t){return u.jT.create(e.ranges.map(t),e.mainIndex)}function F(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function z({state:e,dispatch:t},n){let r=q(e.selection,n);return!r.eq(e.selection,!0)&&(t(F(e,r)),!0)}function $(e,t){return u.jT.cursor(t?e.to:e.from)}function U(e,t){return z(e,n=>n.empty?e.moveByChar(n,t):$(n,t))}function V(e){return e.textDirectionAt(e.state.selection.main.head)==d.Nm.LTR}let H=e=>U(e,!V(e)),Q=e=>U(e,V(e));function K(e,t){return z(e,n=>n.empty?e.moveByGroup(n,t):$(n,t))}function G(e,t,n){let r,i,s=(0,p.qz)(e).resolveInner(t.head),o=n?m.md.closedBy:m.md.openedBy;for(let r=t.head;;){let t=n?s.childAfter(r):s.childBefore(r);if(!t)break;!function(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}(e,t,o)?r=n?t.to:t.from:s=t}return i=s.type.prop(o)&&(r=n?(0,p.Um)(e,s.from,1):(0,p.Um)(e,s.to,-1))&&r.matched?n?r.end.to:r.end.from:n?s.to:s.from,u.jT.cursor(i,n?-1:1)}function Z(e,t){return z(e,n=>{if(!n.empty)return $(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}"undefined"!=typeof Intl&&Intl.Segmenter;let Y=e=>Z(e,!1),X=e=>Z(e,!0);function ee(e){let t=e.scrollDOM.clientHeightn.empty?e.moveVertically(n,t,r.height):$(n,t));if(s.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),l=o.top+r.marginTop,a=o.bottom-r.marginBottom;t&&t.top>l&&t.bottomet(e,!1),er=e=>et(e,!0);function ei(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=u.jT.cursor(r.from+n))}return i}function es(e,t){let n=q(e.state.selection,e=>{let n=t(e);return u.jT.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(e.state.selection)&&(e.dispatch(F(e.state,n)),!0)}function eo(e,t){return es(e,n=>e.moveByChar(n,t))}let el=e=>eo(e,!V(e)),ea=e=>eo(e,V(e));function eh(e,t){return es(e,n=>e.moveByGroup(n,t))}function ec(e,t){return es(e,n=>e.moveVertically(n,t))}let eu=e=>ec(e,!1),ef=e=>ec(e,!0);function ed(e,t){return es(e,n=>e.moveVertically(n,t,ee(e).height))}let ep=e=>ed(e,!1),em=e=>ed(e,!0),eg=({state:e,dispatch:t})=>(t(F(e,{anchor:0})),!0),ey=({state:e,dispatch:t})=>(t(F(e,{anchor:e.doc.length})),!0),ev=({state:e,dispatch:t})=>(t(F(e,{anchor:e.selection.main.anchor,head:0})),!0),ex=({state:e,dispatch:t})=>(t(F(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function eb(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:s}=r;if(i==s){let o=t(r);oi&&(n="delete.forward",o=ek(e,o,!0)),i=Math.min(i,o),s=Math.max(s,o)}else i=ek(e,i,!1),s=ek(e,s,!0);return i==s?{range:r}:{changes:{from:i,to:s},range:u.jT.cursor(i,it(e)))r.between(t,t,(e,r)=>{et&&(t=n?r:e)});return t}let ew=(e,t)=>eb(e,n=>{let r=n.from,{state:i}=e,s=i.doc.lineAt(r),o,l;if(!t&&r>s.from&&rew(e,!1),eC=e=>ew(e,!0),eA=(e,t)=>eb(e,n=>{let r=n.head,{state:i}=e,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?s.to:s.from)){r==n.head&&s.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let l=(0,u.cp)(s.text,r-s.from,t)+s.from,a=s.text.slice(Math.min(r,l)-s.from,Math.max(r,l)-s.from),h=o(a);if(null!=e&&h!=e)break;(" "!=a||r!=n.head)&&(e=h),r=l}return r}),eM=e=>eA(e,!1);function eO(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),s=e.doc.lineAt(r.to);if(r.empty||r.to!=s.from||(s=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=s.to,e.ranges.push(r)}else t.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return t}function eI(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of eO(e)){if(n?t.to==e.doc.length:0==t.from)continue;let s=e.doc.lineAt(n?t.to+1:t.from-1),o=s.length+1;if(n)for(let n of(r.push({from:t.to,to:s.to},{from:t.from,insert:s.text+e.lineBreak}),t.ranges))i.push(u.jT.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)));else for(let n of(r.push({from:s.from,to:t.from},{from:t.to,insert:e.lineBreak+s.text}),t.ranges))i.push(u.jT.range(n.anchor-o,n.head-o))}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:u.jT.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function eT(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of eO(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}let eN=eP(!1),eD=eP(!0);function eP(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,s=t.doc.lineAt(r),o=!e&&r==i&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=(0,p.qz)(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),s;return r&&i&&r.to<=t&&i.from>=t&&(s=r.type.prop(m.md.closedBy))&&s.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}(t,r);e&&(r=i=(i<=s.to?s:t.doc.lineAt(i)).to);let l=new p.Gn(t,{simulateBreak:r,simulateDoubleBreak:!!o}),a=(0,p.K0)(l,r);for(null==a&&(a=(0,u.IS)(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));is.from&&r{let i=[];for(let s=r.from;s<=r.to;){let o=e.doc.lineAt(s);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),s=o.to+1}let s=e.changes(i);return{changes:i,range:u.jT.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}let eB=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(eE(e,(t,n)=>{n.push({from:t.from,insert:e.facet(p.c)})}),{userEvent:"input.indent"})),!0),eR=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(eE(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=(0,u.IS)(r,e.tabSize),s=0,o=(0,p.SS)(e,Math.max(0,i-(0,p.y1)(e)));for(;sz(e,t=>u.jT.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>es(e,t=>u.jT.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>z(e,t=>u.jT.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>es(e,t=>u.jT.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:eC},{key:"Ctrl-h",run:eS},{key:"Ctrl-k",run:e=>eb(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:u.xv.of(["",""])},range:u.jT.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:(0,u.cp)(r.text,n-r.from,!1)+r.from,s=n==r.to?n+1:(0,u.cp)(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:s,insert:e.doc.slice(n,s).append(e.doc.slice(i,n))},range:u.jT.cursor(s)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:er}],e_=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>z(e,t=>G(e.state,t,!V(e))),shift:e=>es(e,t=>G(e.state,t,!V(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>z(e,t=>G(e.state,t,V(e))),shift:e=>es(e,t=>G(e.state,t,V(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>eI(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>eT(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>eI(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>eT(e,t,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=u.jT.create([n.main]):n.main.empty||(r=u.jT.create([u.jT.cursor(n.main.head)])),!!r&&(t(F(e,r)),!0)}},{key:"Mod-Enter",run:eD},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=eO(e).map(({from:t,to:n})=>u.jT.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:u.jT.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=q(e.selection,t=>{var n;let r=(0,p.qz)(e).resolveStack(t.from,1);for(let e=r;e;e=e.next){let{node:r}=e;if((r.from=t.to||r.to>t.to&&r.from<=t.from)&&(null===(n=r.parent)||void 0===n?void 0:n.parent))return u.jT.range(r.to,r.from)}return t});return t(F(e,n)),!0},preventDefault:!0},{key:"Mod-[",run:eR},{key:"Mod-]",run:eB},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new p.Gn(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),i=eE(e,(t,i,s)=>{let o=(0,p.K0)(r,t.from);if(null==o)return;/\S/.test(t.text)||(o=0);let l=/^\s*/.exec(t.text)[0],a=(0,p.SS)(e,o);(l!=a||s.from{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(eO(t).map(({from:e,to:n})=>(e>0?e--:ne.moveVertically(t,!0)).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>{let n,r;return n=!1,r=q(e.selection,t=>{let r=(0,p.Um)(e,t.head,-1)||(0,p.Um)(e,t.head,1)||t.head>0&&(0,p.Um)(e,t.head-1,1)||t.head{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=b(e.state,n.from);return r.line?y(e):!!r.block&&x(e)}},{key:"Alt-A",run:v}].concat([{key:"ArrowLeft",run:H,shift:el,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>K(e,!V(e)),shift:e=>eh(e,!V(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>z(e,t=>ei(e,t,!V(e))),shift:e=>es(e,t=>ei(e,t,!V(e))),preventDefault:!0},{key:"ArrowRight",run:Q,shift:ea,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>K(e,V(e)),shift:e=>eh(e,V(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>z(e,t=>ei(e,t,V(e))),shift:e=>es(e,t=>ei(e,t,V(e))),preventDefault:!0},{key:"ArrowUp",run:Y,shift:eu,preventDefault:!0},{mac:"Cmd-ArrowUp",run:eg,shift:ev},{mac:"Ctrl-ArrowUp",run:en,shift:ep},{key:"ArrowDown",run:X,shift:ef,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ey,shift:ex},{mac:"Ctrl-ArrowDown",run:er,shift:em},{key:"PageUp",run:en,shift:ep},{key:"PageDown",run:er,shift:em},{key:"Home",run:e=>z(e,t=>ei(e,t,!1)),shift:e=>es(e,t=>ei(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:eg,shift:ev},{key:"End",run:e=>z(e,t=>ei(e,t,!0)),shift:e=>es(e,t=>ei(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:ey,shift:ex},{key:"Enter",run:eN},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:eS,shift:eS},{key:"Delete",run:eC},{key:"Mod-Backspace",mac:"Alt-Backspace",run:eM},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>eA(e,!0)},{mac:"Mod-Backspace",run:e=>eb(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)})},{mac:"Mod-Delete",run:e=>eb(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head({mac:e.key,run:e.run,shift:e.shift})))),eJ={key:"Tab",run:eB,shift:eR};function ej(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];"string"==typeof i?e.setAttribute(r,i):null!=i&&(e[r]=i)}t++}for(;te.normalize("NFKD"):e=>e;class eq{constructor(e,t,n=0,r=e.length,i,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(eW(e)):eW,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return -1;this.bufferPos=0,this.buffer=this.iter.value}return(0,u.gm)(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=(0,u.bg)(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=(0,u.nZ)(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let s=r.charCodeAt(e),o=this.match(s,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&ethis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=eQ(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=n||r.to<=t){let r=new eV(t,e.sliceString(t,n));return eU.set(e,r),r}if(r.from==t&&r.to==n)return r;let{text:i,from:s}=r;return s>t&&(i=e.sliceString(t,s)+i,s=t),r.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=eQ(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=eV.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function eQ(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t=56320&&r<57344;)t++;return t}function eK(e){let t=ej("input",{class:"cm-textfield",name:"line",value:String(e.state.doc.lineAt(e.state.selection.main.head).number)});function n(){let n=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!n)return;let{state:r}=e,i=r.doc.lineAt(r.selection.main.head),[,s,o,l,a]=n,h=l?+l.slice(1):0,c=o?+o:i.number;if(o&&a){let e=c/100;s&&(e=e*("-"==s?-1:1)+i.number/r.doc.lines),c=Math.round(r.doc.lines*e)}else o&&s&&(c=c*("-"==s?-1:1)+i.number);let d=r.doc.line(Math.max(1,Math.min(r.doc.lines,c))),p=u.jT.cursor(d.from+Math.max(0,Math.min(h,d.length)));e.dispatch({effects:[eG.of(!1),f.tk.scrollIntoView(p.from,{y:"center"})],selection:p}),e.focus()}return{dom:ej("form",{class:"cm-gotoLine",onkeydown:t=>{27==t.keyCode?(t.preventDefault(),e.dispatch({effects:eG.of(!1)}),e.focus()):13==t.keyCode&&(t.preventDefault(),n())},onsubmit:e=>{e.preventDefault(),n()}},ej("label",e.state.phrase("Go to line"),": ",t)," ",ej("button",{class:"cm-button",type:"submit"},e.state.phrase("go")))}}"undefined"!=typeof Symbol&&(e$.prototype[Symbol.iterator]=eH.prototype[Symbol.iterator]=function(){return this});let eG=u.Py.define(),eZ=u.QQ.define({create:()=>!0,update(e,t){for(let n of t.effects)n.is(eG)&&(e=n.value);return e},provide:e=>f.mH.from(e,e=>e?eK:null)}),eY=f.tk.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),eX={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},e0=u.r$.define({combine:e=>(0,u.BO)(e,eX,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}),e1=f.p.mark({class:"cm-selectionMatch"}),e2=f.p.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function e4(e,t,n,r){return(0==n||e(t.sliceDoc(n-1,n))!=u.D0.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=u.D0.Word)}let e3=f.lg.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(e0),{state:n}=e,r=n.selection;if(r.ranges.length>1)return f.p.none;let i=r.main,s,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return f.p.none;let e=n.wordAt(i.head);if(!e)return f.p.none;o=n.charCategorizer(i.head),s=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e200)return f.p.none;if(t.wholeWords){var l,a,h;if(s=n.sliceDoc(i.from,i.to),!(e4(o=n.charCategorizer(i.head),n,i.from,i.to)&&(l=o,a=i.from,h=i.to,l(n.sliceDoc(a,a+1))==u.D0.Word&&l(n.sliceDoc(h-1,h))==u.D0.Word)))return f.p.none}else if(!(s=n.sliceDoc(i.from,i.to)))return f.p.none}let c=[];for(let r of e.visibleRanges){let e=new eq(n.doc,s,r.from,r.to);for(;!e.next().done;){let{from:r,to:s}=e.value;if((!o||e4(o,n,r,s))&&(i.empty&&r<=i.from&&s>=i.to?c.push(e2.range(r,s)):(r>=i.to||s<=i.from)&&c.push(e1.range(r,s)),c.length>t.maxMatches))return f.p.none}}return f.p.set(c)}},{decorations:e=>e.decorations}),e5=f.tk.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),e9=({state:e,dispatch:t})=>{let{selection:n}=e,r=u.jT.create(n.ranges.map(t=>e.wordAt(t.head)||u.jT.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)},e6=u.r$.define({combine:e=>(0,u.BO)(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new tM(e),scrollToMatch:e=>f.tk.scrollIntoView(e)})});class e8{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,ez),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new ts(this):new tt(this)}getCursor(e,t=0,n){let r=e.doc?e:u.yy.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?tn(this,r,t,n):te(this,r,t,n)}}class e7{constructor(e){this.spec=e}}function te(e,t,n,r){var i,s;return new eq(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),e.wholeWord?(i=t.doc,s=t.charCategorizer(t.selection.main.head),(e,t,n,r)=>((r>e||r+n.length=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=te(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function tn(e,t,n,r){var i;return new e$(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?(i=t.charCategorizer(t.selection.main.head),(e,t,n)=>!n[0].length||(i(tr(n.input,n.index))!=u.D0.Word||i(ti(n.input,n.index))!=u.D0.Word)&&(i(ti(n.input,n.index+n[0].length))!=u.D0.Word||i(tr(n.input,n.index+n[0].length))!=u.D0.Word)):void 0},n,r)}function tr(e,t){return e.slice((0,u.cp)(e,t,!1),t)}function ti(e,t){return e.slice(t,(0,u.cp)(e,t))}class ts extends e7{nextMatch(e,t,n){let r=tn(this.spec,e,n,e.doc.length).next();return r.done&&(r=tn(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-1e4*r),s=tn(this.spec,e,i,n),o=null;for(;!s.next().done;)o=s.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(t,n)=>"$"==n?"$":"&"==n?e.match[0]:"0"!=n&&+n=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=tn(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}let to=u.Py.define(),tl=u.Py.define(),ta=u.QQ.define({create:e=>new th(tb(e).create(),null),update(e,t){for(let n of t.effects)n.is(to)?e=new th(n.value.create(),e.panel):n.is(tl)&&(e=new th(e.query,n.value?tx:null));return e},provide:e=>f.mH.from(e,e=>e.panel)});class th{constructor(e,t){this.query=e,this.panel=t}}let tc=f.p.mark({class:"cm-searchMatch"}),tu=f.p.mark({class:"cm-searchMatch cm-searchMatch-selected"}),tf=f.lg.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(ta))}update(e){let t=e.state.field(ta);(t!=e.startState.field(ta)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return f.p.none;let{view:n}=this,r=new u.f_;for(let t=0,i=n.visibleRanges,s=i.length;ti[t+1].from-500;)l=i[++t].to;e.highlight(n.state,o,l,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?tu:tc)})}return r.finish()}},{decorations:e=>e.decorations});function td(e){return t=>{let n=t.state.field(ta,!1);return n&&n.query.spec.valid?e(t,n):tS(t)}}let tp=td((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=u.jT.single(r.from,r.to),s=e.state.facet(e6);return e.dispatch({selection:i,effects:[tT(e,r),s.scrollToMatch(i.main,e)],userEvent:"select.search"}),tw(e),!0}),tm=td((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let s=u.jT.single(i.from,i.to),o=e.state.facet(e6);return e.dispatch({selection:s,effects:[tT(e,i),o.scrollToMatch(s.main,e)],userEvent:"select.search"}),tw(e),!0}),tg=td((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!!n&&!!n.length&&(e.dispatch({selection:u.jT.create(n.map(e=>u.jT.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),ty=td((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let s=t.nextMatch(n,r,r);if(!s)return!1;let o=[],l,a,h=[];if(s.from==r&&s.to==i&&(a=n.toText(t.getReplacement(s)),o.push({from:s.from,to:s.to,insert:a}),s=t.nextMatch(n,s.from,s.to),h.push(f.tk.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))),s){let t=0==o.length||o[0].from>=s.to?0:s.to-s.from-a.length;l=u.jT.single(s.from-t,s.to-t),h.push(tT(e,s)),h.push(n.facet(e6).scrollToMatch(l.main,e))}return e.dispatch({changes:o,selection:l,effects:h,userEvent:"input.replace"}),!0}),tv=td((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:f.tk.announce.of(r),userEvent:"input.replace.all"}),!0});function tx(e){return e.state.facet(e6).createPanel(e)}function tb(e,t){var n,r,i,s,o;let l=e.selection.main,a=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!a)return t;let h=e.facet(e6);return new e8({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(r=null==t?void 0:t.caseSensitive)&&void 0!==r?r:h.caseSensitive,literal:null!==(i=null==t?void 0:t.literal)&&void 0!==i?i:h.literal,regexp:null!==(s=null==t?void 0:t.regexp)&&void 0!==s?s:h.regexp,wholeWord:null!==(o=null==t?void 0:t.wholeWord)&&void 0!==o?o:h.wholeWord})}function tk(e){let t=(0,f.Sd)(e,tx);return t&&t.dom.querySelector("[main-field]")}function tw(e){let t=tk(e);t&&t==e.root.activeElement&&t.select()}let tS=e=>{let t=e.state.field(ta,!1);if(t&&t.panel){let n=tk(e);if(n&&n!=e.root.activeElement){let r=tb(e.state,t.query.spec);r.valid&&e.dispatch({effects:to.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[tl.of(!0),t?to.of(tb(e.state,t.query.spec)):u.Py.appendConfig.of(tD)]});return!0},tC=e=>{let t=e.state.field(ta,!1);if(!t||!t.panel)return!1;let n=(0,f.Sd)(e,tx);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:tl.of(!1)}),!0},tA=[{key:"Mod-f",run:tS,scope:"editor search-panel"},{key:"F3",run:tp,shift:tm,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:tp,shift:tm,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:tC,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,s=[],o=0;for(let t=new eq(e.doc,e.sliceDoc(r,i));!t.next().done;){if(s.length>1e3)return!1;t.value.from==r&&(o=s.length),s.push(u.jT.range(t.value.from,t.value.to))}return t(e.update({selection:u.jT.create(s,o),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let t=(0,f.Sd)(e,eK);if(!t){let n=[eG.of(!0)];null==e.state.field(eZ,!1)&&n.push(u.Py.appendConfig.of([eZ,eY])),e.dispatch({effects:n}),t=(0,f.Sd)(e,eK)}return t&&t.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return e9({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=function(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),s=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new eq(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new eq(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(s){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}(e,r);return!!i&&(t(e.update({selection:e.selection.addRange(u.jT.range(i.from,i.to),!1),effects:f.tk.scrollIntoView(i.to)})),!0)},preventDefault:!0}];class tM{constructor(e){this.view=e;let t=this.query=e.state.field(ta).query.spec;function n(e,t,n){return ej("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=ej("input",{value:t.search,placeholder:tO(e,"Find"),"aria-label":tO(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ej("input",{value:t.replace,placeholder:tO(e,"Replace"),"aria-label":tO(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ej("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=ej("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=ej("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=ej("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",()=>tp(e),[tO(e,"next")]),n("prev",()=>tm(e),[tO(e,"previous")]),n("select",()=>tg(e),[tO(e,"all")]),ej("label",null,[this.caseField,tO(e,"match case")]),ej("label",null,[this.reField,tO(e,"regexp")]),ej("label",null,[this.wordField,tO(e,"by word")]),...e.state.readOnly?[]:[ej("br"),this.replaceField,n("replace",()=>ty(e),[tO(e,"replace")]),n("replaceAll",()=>tv(e),[tO(e,"replace all")])],ej("button",{name:"close",onclick:()=>tC(e),"aria-label":tO(e,"close"),type:"button"},["\xd7"])])}commit(){let e=new e8({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:to.of(e)}))}keydown(e){(0,f.$1)(this.view,e,"search-panel")?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?tm:tp)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),ty(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(to)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(e6).top}}function tO(e,t){return e.state.phrase(t)}let tI=/[\s\.,:;?!]/;function tT(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,s=Math.max(r.from,t-30),o=Math.min(i,n+30),l=e.state.sliceDoc(s,o);if(s!=r.from){for(let e=0;e<30;e++)if(!tI.test(l[e+1])&&tI.test(l[e])){l=l.slice(e);break}}if(o!=i){for(let e=l.length-1;e>l.length-30;e--)if(!tI.test(l[e-1])&&tI.test(l[e])){l=l.slice(0,e);break}}return f.tk.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${r.number}.`)}let tN=f.tk.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),tD=[ta,u.Wl.low(tf),tN];class tP{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=(0,p.qz)(this.state).resolveInner(this.pos,-1);for(;t&&0>e.indexOf(t.name);)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(tL(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function tE(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}class tB{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}}function tR(e){return e.selection.main.from}function tL(e,t){var n;let{source:r}=e,i=t&&"^"!=r[0],s="$"!=r[r.length-1];return i||s?RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}let t_=u.q6.define(),tJ=new WeakMap;function tj(e){if(!Array.isArray(e))return e;let t=tJ.get(e);return t||tJ.set(e,t=function(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}(e)),t}let tW=u.Py.define(),tq=u.Py.define();class tF{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&a<=57||a>=97&&a<=122?2:a>=65&&a<=90?1:0:(x=(0,u.bg)(a))!=x.toLowerCase()?1:x!=x.toUpperCase()?2:0;(!r||1==b&&g||0==v&&0!=b)&&(t[c]==a||n[c]==a&&(f=!0)?s[c++]=r:s.length&&(y=!1)),v=b,r+=(0,u.nZ)(a)}return c==l&&0==s[0]&&y?this.result(-100+(f?-200:0),s,e):d==l&&0==p?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):d==l?this.ret(-900-e.length,[p,m]):c==l?this.result(-100+(f?-200:0)+-700+(y?0:-1100),s,e):2==t.length?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?(0,u.nZ)((0,u.gm)(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}}class tz{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length(0,u.BO)(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:tV,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>tU(e(n),t(n)),optionClass:(e,t)=>n=>tU(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function tU(e,t){return e?t?e+" "+t:e:t}function tV(e,t,n,r,i,s){let o=e.textDirection==f.Nm.RTL,l=o,a=!1,h="top",c,u,d=t.left-i.left,p=i.right-t.right,m=r.right-r.left,g=r.bottom-r.top;if(l&&d=g||e>t.top?c=n.bottom-t.top:(h="bottom",c=t.bottom-n.top)}let y=(t.bottom-t.top)/s.offsetHeight,v=(t.right-t.left)/s.offsetWidth;return{style:`${h}: ${c/y}px; max-width: ${u/v}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function tH(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.floor((e-t)/n);return{from:e-(r+1)*n,to:e-r*n}}class tQ{constructor(e,t,n){let r;this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:s,selected:o}=i.open,l=e.state.facet(t$);this.optionContent=(r=l.addToOptions.slice(),l.icons&&r.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>"cm-completionIcon-"+e)),t.setAttribute("aria-hidden","true"),t},position:20}),r.push({render(e,t,n,r){let i=document.createElement("span");i.className="cm-completionLabel";let s=e.displayLabel||e.label,o=0;for(let e=0;eo&&i.appendChild(document.createTextNode(s.slice(o,t)));let l=i.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(s.slice(t,n))),l.className="cm-completionMatchedText",o=n}return oe.position-t.position).map(e=>e.render)),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=tH(s.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if("LI"==t.nodeName&&(i=/-(\d+)$/.exec(t.id))&&+i[1]{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(t$).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:tq.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=r){let{options:i,selected:s,disabled:o}=n.open;r.open&&r.open.options==i||(this.range=tH(i.length,s,e.state.facet(t$).maxRenderedOptions),this.showOptions(i,n.id)),this.updateSel(),o!=(null===(t=r.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=tH(t.options.length,t.selected,this.view.state.facet(t$).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:n}=t.options[t.selected],{info:r}=n;if(!r)return;let i="string"==typeof r?document.createTextNode(r):r(n);if(!i)return;"then"in i?i.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,n)}).catch(e=>(0,f.OO)(this.view.state,e,"completion info")):this.addInfoPane(i,n)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){var t,n;let r,i,s,o=null;for(let t=this.list.firstChild,n=this.range.from;t;t=t.nextSibling,n++)"LI"==t.nodeName&&t.id?n==e?t.hasAttribute("aria-selected")||(t.setAttribute("aria-selected","true"),o=t):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected"):n--;return o&&(t=this.list,n=o,r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),s=r.height/t.offsetHeight,i.topr.bottom&&(t.scrollTop+=(i.bottom-r.bottom)/s)),o}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.defaultView||window;i={left:0,top:0,right:e.innerWidth,bottom:e.innerHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottomn.from||0==n.from)&&(i=e,"string"!=typeof a&&a.header?r.appendChild(a.header(a)):r.appendChild(document.createElement("completion-section")).textContent=e)}let h=r.appendChild(document.createElement("li"));h.id=t+"-"+s,h.setAttribute("role","option");let c=this.optionClass(o);for(let e of(c&&(h.className=c),this.optionContent)){let t=e(o,this.view.state,this.view,l);t&&h.appendChild(t)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.to=this.options.length?this:new tG(this.options,t0(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,r,i,s){if(r&&!s&&e.some(e=>1==e.state))return r.setDisabled();let o=function(e,t){let n=[],r=null,i=e=>{n.push(e);let{section:t}=e.completion;if(t){r||(r=[]);let e="string"==typeof t?t:t.name;r.some(t=>t.name==e)||r.push("string"==typeof t?{name:e}:t)}},s=t.facet(t$);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(!1===r.result.filter)for(let t of r.result.options)i(new tB(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),o,l=s.filterStrict?new tz(n):new tF(n);for(let t of r.result.options)if(o=l.match(t.label)){let n=t.displayLabel?e?e(t,o.matched):[]:o.matched;i(new tB(t,r.source,n,o.score+(t.boost||0)))}}}if(r){let e=Object.create(null),t=0;for(let n of r.sort((e,t)=>{var n,r;return(null!==(n=e.rank)&&void 0!==n?n:1e9)-(null!==(r=t.rank)&&void 0!==r?r:1e9)||(e.namet.score-e.score||a(e.completion,t.completion))){let t=e.completion;l&&l.label==t.label&&l.detail==t.detail&&(null==l.type||null==t.type||l.type==t.type)&&l.apply==t.apply&&l.boost==t.boost?tK(e.completion)>tK(l)&&(o[o.length-1]=e):o.push(e),l=e.completion}return o}(e,t);if(!o.length)return r&&e.some(e=>1==e.state)?r.setDisabled():null;let l=t.facet(t$).selectOnOpen?0:-1;if(r&&r.selected!=l&&-1!=r.selected){let e=r.options[r.selected].completion;for(let t=0;tt.hasResult()?Math.min(e,t.from):e,1e8),create:t7,above:i.aboveCursor},r?r.timestamp:Date.now(),l,!1)}map(e){return new tG(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new tG(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class tZ{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new tZ(t1,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(t$),r=(n.override||t.languageDataAt("autocomplete",tR(t)).map(tj)).map(t=>(this.active.find(e=>e.source==t)||new t4(t,this.active.some(e=>0!=e.state)?1:0)).update(e,n));r.length==this.active.length&&r.every((e,t)=>e==this.active[t])&&(r=this.active);let i=this.open,s=e.effects.some(e=>e.is(t5));for(let o of(i&&e.docChanged&&(i=i.map(e.changes)),e.selection||r.some(t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to))||!function(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n1==e.state)&&(i=null),!i&&r.every(e=>1!=e.state)&&r.some(e=>e.hasResult())&&(r=r.map(e=>e.hasResult()?new t4(e.source,0):e)),e.effects))o.is(t9)&&(i=i&&i.setSelected(o.value,this.id));return r==this.active&&i==this.open?this:new tZ(r,this.id,i)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?tY:tX}}let tY={"aria-autocomplete":"list"},tX={};function t0(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}let t1=[];function t2(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(t_);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class t4{constructor(e,t,n=-1){this.source=e,this.state=t,this.explicitPos=n}hasResult(){return!1}update(e,t){let n=t2(e,t),r=this;for(let t of((8&n||16&n&&this.touches(e))&&(r=new t4(r.source,0)),4&n&&0==r.state&&(r=new t4(this.source,1)),r=r.updateFor(e,n),e.effects))if(t.is(tW))r=new t4(r.source,1,t.value?tR(e.state):-1);else if(t.is(tq))r=new t4(r.source,0);else if(t.is(t5))for(let e of t.value)e.source==r.source&&(r=e);return r}updateFor(e,t){return this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new t4(this.source,this.state,e.mapPos(this.explicitPos))}touches(e){return e.changes.touchesRange(tR(e.state))}}class t3 extends t4{constructor(e,t,n,r,i){super(e,2,t),this.result=n,this.from=r,this.to=i}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let i=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1),o=tR(e.state);if((this.explicitPos<0?o<=i:os||!r||2&t&&tR(e.startState)==this.from)return new t4(this.source,4&t?1:0);let l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return!function(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return"function"==typeof e?e(i,n,r,t):tL(e,!0).test(i)}(r.validFor,e.state,i,s)?r.update&&(r=r.update(r,i,s,new tP(e.state,o,l>=0)))?new t3(this.source,l,r,r.from,null!==(n=r.to)&&void 0!==n?n:tR(e.state)):new t4(this.source,1,l):new t3(this.source,l,r,i,s)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new t3(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new t4(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}let t5=u.Py.define({map:(e,t)=>e.map(e=>e.map(t))}),t9=u.Py.define(),t6=u.QQ.define({create:()=>tZ.start(),update:(e,t)=>e.update(t),provide:e=>[f.hJ.from(e,e=>e.tooltip),f.tk.contentAttributes.from(e,e=>e.attrs)]});function t8(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(t6).active.find(e=>e.source==t.source);return r instanceof t3&&("string"==typeof n?e.dispatch(Object.assign(Object.assign({},function(e,t,n,r){let{main:i}=e.selection,s=n-i.from,o=r-i.from;return Object.assign(Object.assign({},e.changeByRange(l=>{if(l!=i&&n!=r&&e.sliceDoc(l.from+s,l.from+o)!=e.sliceDoc(n,r))return{range:l};let a=e.toText(t);return{changes:{from:l.from+s,to:r==i.from?l.to:l.from+o,insert:a},range:u.jT.cursor(l.from+s+a.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}(e.state,n,r.from,r.to)),{annotations:t_.of(t.completion)})):n(e,t.completion,r.from,r.to),!0)}let t7=e=>new tQ(e,t6,t8);function ne(e,t="option"){return n=>{let r=n.state.field(t6,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+i*(e?1:-1):e?0:o-1;return l<0?l="page"==t?0:o-1:l>=o&&(l="page"==t?o-1:0),n.dispatch({effects:t9.of(l)}),!0}}let nt=e=>!!e.state.field(t6,!1)&&(e.dispatch({effects:tW.of(!0)}),!0);class nn{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}let nr=f.lg.fromClass(class{constructor(e){for(let t of(this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0,e.state.field(t6).active))1==t.state&&this.startQuery(t)}update(e){let t=e.state.field(t6),n=e.state.facet(t$);if(!e.selectionSet&&!e.docChanged&&e.startState.field(t6)==t)return;let r=e.transactions.some(e=>{let t=t2(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let t=0;t50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){(0,f.OO)(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(tW)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>1==e.state&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(t6);for(let e of t.active)1!=e.state||this.running.some(t=>t.active.source==e.source)||this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(t$).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=tR(t),r=new tP(t,n,e.explicitPos==n,this.view),i=new nn(e,r);this.running.push(i),Promise.resolve(e.source(r)).then(e=>{i.context.aborted||(i.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:tq.of(null)}),(0,f.OO)(this.view.state,e)})}scheduleAccept(){this.running.every(e=>void 0!==e.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(t$).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(t$),r=this.view.state.field(t6);for(let i=0;ie.source==s.active.source);if(o&&1==o.state){if(null==s.done){let e=new t4(s.active.source,0);for(let t of s.updates)e=e.update(t,n);1!=e.state&&t.push(e)}else this.startQuery(o)}}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:t5.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(t6,!1);if(t&&t.tooltip&&this.view.state.facet(t$).closeOnBlur){let n=t.open&&(0,f.gB)(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:tq.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:tW.of(!1)}),20),this.composing=0}}}),ni="object"==typeof navigator&&/Win/.test(navigator.platform),ns=u.Wl.highest(f.tk.domEventHandlers({keydown(e,t){let n=t.state.field(t6,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(ni&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&t8(t,r),!1}})),no=f.tk.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xb7\xb7\xb7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'\uD835\uDC65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\uD835\uDC36'"}},".cm-completionIcon-type":{"&:after":{content:"'\uD835\uDC61'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\uD83D\uDD11︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),nl=f.p.widget({widget:new class extends f.l9{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),na=f.p.mark({class:"cm-snippetField"});class nh{constructor(e,t){this.ranges=e,this.active=t,this.deco=f.p.set(e.map(e=>(e.from==e.to?nl:na).range(e.from,e.to)))}map(e){let t=[];for(let n of this.ranges){let r=n.map(e);if(!r)return null;t.push(r)}return new nh(t,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}}let nc=u.Py.define({map:(e,t)=>e&&e.map(t)}),nu=u.Py.define(),nf=u.QQ.define({create:()=>null,update(e,t){for(let n of t.effects){if(n.is(nc))return n.value;if(n.is(nu)&&e)return new nh(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>f.tk.decorations.from(e,e=>e?e.deco:f.p.none)});function nd(e){return({state:t,dispatch:n})=>{var r;let i=t.field(nf,!1);if(!i||e<0&&0==i.active)return!1;let s=i.active+e,o=e>0&&!i.ranges.some(t=>t.field==s+e);return n(t.update({selection:(r=i.ranges,u.jT.create(r.filter(e=>e.field==s).map(e=>u.jT.range(e.from,e.to)))),effects:nc.of(o?null:new nh(i.ranges,s)),scrollIntoView:!0})),!0}}({state:e,dispatch:t})=>!!e.field(nf,!1)&&(t(e.update({effects:nc.of(null)})),!0);let np={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},nm=u.Py.define({map(e,t){let n=t.mapPos(e,-1,u.gc.TrackAfter);return null==n?void 0:n}}),ng=new class extends u.uU{};ng.startSide=1,ng.endSide=-1;let ny=u.QQ.define({create:()=>u.Xs.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(nm)&&(e=e.update({add:[ng.range(n.value,n.value+1)]}));return e}}),nv="()[]{}<>";function nx(e){for(let t=0;t{if((nk?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||2==r.length&&1==(0,u.nZ)((0,u.gm)(r,0))||t!=i.from||n!=i.to)return!1;let s=function(e,t){let n=nb(e,e.selection.main.head),r=n.brackets||np.brackets;for(let i of r){let s=nx((0,u.gm)(i,0));if(t==i)return s==i?function(e,t,n,r){let i=r.stringPrefixes||np.stringPrefixes,s=null,o=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:nm.of(r.to+t.length),range:u.jT.range(r.anchor+t.length,r.head+t.length)};let o=r.head,l=nA(e.doc,o),a;if(l==t){if(nM(e,o))return{changes:{insert:t+t,from:o},effects:nm.of(o+t.length),range:u.jT.cursor(o+t.length)};if(nC(e,o)){let r=n&&e.sliceDoc(o,o+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:o,to:o+r.length,insert:r},range:u.jT.cursor(o+r.length)}}}else if(n&&e.sliceDoc(o-2*t.length,o)==t+t&&(a=nO(e,o-2*t.length,i))>-1&&nM(e,a))return{changes:{insert:t+t+t+t,from:o},effects:nm.of(o+t.length),range:u.jT.cursor(o+t.length)};else if(e.charCategorizer(o)(l)!=u.D0.Word&&nO(e,o,i)>-1&&!function(e,t,n,r){let i=(0,p.qz)(e).resolveInner(t,-1),s=r.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),l=o.indexOf(n);if(!l||l>-1&&r.indexOf(o.slice(0,l))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+l;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let a=i.to==t&&i.parent;if(!a)break;i=a}return!1}(e,o,t,i))return{changes:{insert:t+t,from:o},effects:nm.of(o+t.length),range:u.jT.cursor(o+t.length)};return{range:s=r}});return s?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}(e,i,r.indexOf(i+i+i)>-1,n):function(e,t,n,r){let i=null,s=e.changeByRange(s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:n,from:s.to}],effects:nm.of(s.to+t.length),range:u.jT.range(s.anchor+t.length,s.head+t.length)};let o=nA(e.doc,s.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:s.head},effects:nm.of(s.head+t.length),range:u.jT.cursor(s.head+t.length)}:{range:i=s}});return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}(e,i,s,n.before||np.before);if(t==s&&nC(e,e.selection.main.from))return function(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&nA(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:u.jT.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}(e,0,s)}return null}(e.state,r);return!!s&&(e.dispatch(s),!0)}),nS=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=nb(e,e.selection.main.head).brackets||np.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){var i,s;let r;let o=(i=e.doc,s=t.head,r=i.sliceString(s-2,s),(0,u.nZ)((0,u.gm)(r,0))==r.length?r:r.slice(1));for(let r of n)if(r==o&&nA(e.doc,t.head)==nx((0,u.gm)(r,0)))return{changes:{from:t.head-r.length,to:t.head+r.length},range:u.jT.cursor(t.head-r.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function nC(e,t){let n=!1;return e.field(ny).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function nA(e,t){let n=e.sliceString(t,t+2);return n.slice(0,(0,u.nZ)((0,u.gm)(n,0)))}function nM(e,t){let n=(0,p.qz)(e).resolveInner(t+1);return n.parent&&n.from==t}function nO(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=u.D0.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=u.D0.Word)return n}return -1}let nI=[{key:"Ctrl-Space",run:nt},{mac:"Alt-`",run:nt},{key:"Escape",run:e=>{let t=e.state.field(t6,!1);return!!(t&&t.active.some(e=>0!=e.state))&&(e.dispatch({effects:tq.of(null)}),!0)}},{key:"ArrowDown",run:ne(!0)},{key:"ArrowUp",run:ne(!1)},{key:"PageDown",run:ne(!0,"page")},{key:"PageUp",run:ne(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(t6,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.facet(t$).defaultKeymap?[nI]:[]));class nN{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class nD{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=e,i=n.facet(nq).markerFilter;i&&(r=i(r,n));let s=f.p.set(r.map(e=>e.from==e.to||e.from==e.to-1&&n.doc.lineAt(e.from).to==e.from?f.p.widget({widget:new n$(e),diagnostic:e}).range(e.from):f.p.mark({attributes:{class:"cm-lintRange cm-lintRange-"+e.severity+(e.markClass?" "+e.markClass:"")},diagnostic:e}).range(e.from,e.to)),!0);return new nD(s,t,nP(s))}}function nP(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!t||i.diagnostic==t)return r=new nN(e,n,i.diagnostic),!1}),r}function nE(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(nq).hideOn(e,n,r);if(null!=i)return i;let s=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(nB))||e.changes.touchesRange(s.from,Math.max(s.to,r)))}let nB=u.Py.define(),nR=u.Py.define(),nL=u.Py.define(),n_=u.QQ.define({create:()=>new nD(f.p.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=nP(n,e.selected.diagnostic,i)||nP(n,null,i)}!n.size&&i&&t.state.facet(nq).autoPanel&&(i=null),e=new nD(n,i,r)}for(let n of t.effects)if(n.is(nB)){let r=t.state.facet(nq).autoPanel?n.value.length?nV.open:null:e.panel;e=nD.init(n.value,r,t.state)}else n.is(nR)?e=new nD(e.diagnostics,n.value?nV.open:null,e.selected):n.is(nL)&&(e=new nD(e.diagnostics,e.panel,n.value));return e},provide:e=>[f.mH.from(e,e=>e.panel),f.tk.decorations.from(e,e=>e.diagnostics)]}),nJ=f.p.mark({class:"cm-lintRange cm-lintRange-active"}),nj=e=>{let t=e.state.field(n_,!1);return!!t&&!!t.panel&&(e.dispatch({effects:nR.of(!1)}),!0)},nW=[{key:"Mod-Shift-m",run:e=>{var t,n;let r=e.state.field(n_,!1);r&&r.panel||e.dispatch({effects:(t=e.state,n=[nR.of(!0)],t.field(n_,!1)?n:n.concat(u.Py.appendConfig.of(nG)))});let i=(0,f.Sd)(e,nV.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(n_,!1);if(!t)return!1;let n=e.state.selection.main,r=t.diagnostics.iter(n.to+1);return(!!r.value||!!(r=t.diagnostics.iter(0)).value&&(r.from!=n.from||r.to!=n.to))&&(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],nq=u.r$.define({combine:e=>Object.assign({sources:e.map(e=>e.source).filter(e=>null!=e)},(0,u.BO)(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t}))});function nF(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;ee.toLowerCase()==r.toLowerCase())){t.push(r);continue e}}t.push("")}return t}function nz(e,t,n){var r;let i=n?nF(t.actions):[];return ej("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},ej("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(r=t.actions)||void 0===r?void 0:r.map((n,r)=>{let s=!1,o=r=>{if(r.preventDefault(),s)return;s=!0;let i=nP(e.state.field(n_).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:l}=n,a=i[r]?l.indexOf(i[r]):-1,h=a<0?l:[l.slice(0,a),ej("u",l.slice(a,a+1)),l.slice(a+1)];return ej("button",{type:"button",class:"cm-diagnosticAction",onclick:o,onmousedown:o,"aria-label":` Action: ${l}${a<0?"":` (access key "${i[r]})"`}.`},h)}),t.source&&ej("div",{class:"cm-diagnosticSource"},t.source))}class n$ extends f.l9{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return ej("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class nU{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=nz(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class nV{constructor(e){this.view=e,this.items=[],this.list=ej("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)nj(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65)||!(t.keyCode<=90)||!(this.selectedIndex>=0))return;let{diagnostic:n}=this.items[this.selectedIndex],r=nF(n.actions);for(let i=0;i{for(let t=0;tnj(this.view)},"\xd7")),this.update()}get selectedIndex(){let e=this.view.state.field(n_).selected;if(!e)return -1;for(let t=0;t{let l=-1,a;for(let e=n;en&&(this.items.splice(n,l-n),r=!0)),t&&a.diagnostic==t.diagnostic?a.dom.hasAttribute("aria-selected")||(a.dom.setAttribute("aria-selected","true"),i=a):a.dom.hasAttribute("aria-selected")&&a.dom.removeAttribute("aria-selected"),n++});n({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.topt.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=nP(this.view.state.field(n_).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:nL.of(t)})}static open(e){return new nV(e)}}function nH(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(e)}')`}(``,'width="6" height="3"')}let nQ=f.tk.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:nH("#d11")},".cm-lintRange-warning":{backgroundImage:nH("orange")},".cm-lintRange-info":{backgroundImage:nH("#999")},".cm-lintRange-hint":{backgroundImage:nH("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});f.SJ;let nK=u.Py.define(),nG=[n_,f.tk.decorations.compute([n_],e=>{let{selected:t,panel:n}=e.field(n_);return t&&n&&t.from!=t.to?f.p.set([nJ.range(t.from,t.to)]):f.p.none}),(0,f.bF)(function(e,t,n){let{diagnostics:r}=e.state.field(n_),i=[],s=2e8,o=0;r.between(t-(n<0?1:0),t+(n>0?1:0),(e,r,{spec:l})=>{t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t{var t;return{dom:(t=e,ej("ul",{class:"cm-tooltip-lint"},i.map(e=>nz(t,e,!1))))}}}:null},{hideOn:nE}),nQ];var nZ=function(e){void 0===e&&(e={});var{crosshairCursor:t=!1}=e,n=[];!1!==e.closeBracketsKeymap&&(n=n.concat(nS)),!1!==e.defaultKeymap&&(n=n.concat(e_)),!1!==e.searchKeymap&&(n=n.concat(tA)),!1!==e.historyKeymap&&(n=n.concat(W)),!1!==e.foldKeymap&&(n=n.concat(p.e7)),!1!==e.completionKeymap&&(n=n.concat(nI)),!1!==e.lintKeymap&&(n=n.concat(nW));var r=[];if(!1!==e.lineNumbers&&r.push((0,f.Eu)()),!1!==e.highlightActiveLineGutter&&r.push((0,f.HQ)()),!1!==e.highlightSpecialChars&&r.push((0,f.AE)()),!1!==e.history&&r.push(function(e={}){return[M,A.of(e),d.tk.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?I:"historyRedo"==e.inputType?T:null;return!!n&&(e.preventDefault(),n(t))}})]}()),!1!==e.foldGutter&&r.push((0,p.mi)()),!1!==e.drawSelection&&r.push((0,f.Uw)()),!1!==e.dropCursor&&r.push((0,f.qr)()),!1!==e.allowMultipleSelections&&r.push(u.yy.allowMultipleSelections.of(!0)),!1!==e.indentOnInput&&r.push((0,p.nY)()),!1!==e.syntaxHighlighting&&r.push((0,p.nF)(p.R_,{fallback:!0})),!1!==e.bracketMatching&&r.push((0,p.n$)()),!1!==e.closeBrackets&&r.push([nw,ny]),!1!==e.autocompletion&&r.push(function(e={}){return[ns,t6,t$.of(e),nr,nT,no]}()),!1!==e.rectangularSelection&&r.push((0,f.Zs)()),!1!==t&&r.push((0,f.S2)()),!1!==e.highlightActiveLine&&r.push((0,f.ZO)()),!1!==e.highlightSelectionMatches)r.push([e5,e3]);return e.tabSize&&"number"==typeof e.tabSize&&r.push(p.c.of(" ".repeat(e.tabSize))),r.concat([f.$f.of(n.flat())]).filter(Boolean)};let nY=0;class nX{constructor(e,t){this.from=e,this.to=t}}class n0{constructor(e={}){this.id=nY++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=n4.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}n0.closedBy=new n0({deserialize:e=>e.split(" ")}),n0.openedBy=new n0({deserialize:e=>e.split(" ")}),n0.group=new n0({deserialize:e=>e.split(" ")}),n0.isolate=new n0({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw RangeError("Invalid value for isolate: "+e);return e||"auto"}}),n0.contextHash=new n0({perNode:!0}),n0.lookAhead=new n0({perNode:!0}),n0.mounted=new n0({perNode:!0});class n1{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[n0.mounted.id]}}let n2=Object.create(null);class n4{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):n2,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),r=new n4(e.name||"",t,e.id,n);if(e.props){for(let n of e.props)if(Array.isArray(n)||(n=n(r)),n){if(n[0].perNode)throw RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(n0.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return e=>{for(let n=e.prop(n0.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}}n4.none=new n4("",Object.create(null),0,8);class n3{constructor(e){this.types=e;for(let t=0;t=t){let o=new rr(s.tree,s.overlay[0].from+e.from,-1,e);(i||(i=[r])).push(rt(o,t,n,!1))}}return i?ra(i):r}(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,s=e.mode||0,o=(s&a.IncludeAnonymous)>0;for(let e=this.cursor(s|a.IncludeAnonymous);;){let s=!1;if(e.from<=i&&e.to>=r&&(!o&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;s=!0}for(;s&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;s=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:rp(n4.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,n)=>new n6(this.type,e,t,n,this.propValues),e.makeTree||((e,t,n)=>new n6(n4.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=1024,reused:s=[],minRepeatType:o=r.types.length}=e,l=Array.isArray(n)?new n8(n,n.length):n,a=r.types,h=0,c=0;function u(e,t,n,i,s,o,l,a,h){let c=[],u=[];for(;e.length>i;)c.push(e.pop()),u.push(t.pop()+n-s);e.push(f(r.types[l],c,u,o-s,a-o,h)),t.push(s-n)}function f(e,t,n,r,i,s,o){if(s){let e=[n0.contextHash,s];o=o?[e].concat(o):[e]}if(i>25){let e=[n0.lookAhead,i];o=o?[e].concat(o):[e]}return new n6(e,t,n,r,o)}let d=[],p=[];for(;l.pos>0;)!function e(t,n,d,p,m,g){let{id:y,start:v,end:x,size:b}=l,k=c,w=h;for(;b<0;){if(l.next(),-1==b){let e=s[y];d.push(e),p.push(v-t);return}if(-3==b){h=y;return}if(-4==b){c=y;return}throw RangeError(`Unrecognized record size: ${b}`)}let S=a[y],C,A,M=v-t;if(x-v<=i&&(A=function(e,t){let n=l.fork(),r=0,s=0,a=0,h=n.end-i,c={size:0,start:0,skip:0};t:for(let i=n.pos-e;n.pos>i;){let e=n.size;if(n.id==t&&e>=0){c.size=r,c.start=s,c.skip=a,a+=4,r+=4,n.next();continue}let l=n.pos-e;if(e<0||l=o?4:0,f=n.start;for(n.next();n.pos>l;){if(n.size<0){if(-3==n.size)u+=4;else break t}else n.id>=o&&(u+=4);n.next()}s=f,r+=e,a+=u}return(t<0||r==e)&&(c.size=r,c.start=s,c.skip=a),c.size>4?c:void 0}(l.pos-n,m))){let e=new Uint16Array(A.size-A.skip),n=l.pos-A.size,i=e.length;for(;l.pos>n;)i=function e(t,n,r){let{id:i,start:s,end:a,size:u}=l;if(l.next(),u>=0&&i4){let i=l.pos-(u-4);for(;l.pos>i;)r=e(t,n,r)}n[--r]=o,n[--r]=a-t,n[--r]=s-t,n[--r]=i}else -3==u?h=i:-4==u&&(c=i);return r}(A.start,e,i);C=new n7(e,x-A.start,r),M=A.start-t}else{let t=l.pos-b;l.next();let n=[],s=[],a=y>=o?y:-1,h=0,c=x;for(;l.pos>t;)a>=0&&l.id==a&&l.size>=0?(l.end<=c-i&&(u(n,s,v,h,l.end,c,a,k,w),h=n.length,c=l.end),l.next()):g>2500?function(e,t,n,s){let o=[],a=0,h=-1;for(;l.pos>t;){let{id:e,start:t,end:n,size:r}=l;if(r>4)l.next();else if(h>-1&&t=0;e-=3)t[n++]=o[e],t[n++]=o[e+1]-i,t[n++]=o[e+2]-i,t[n++]=n;n.push(new n7(t,o[2]-i,r)),s.push(i-e)}}(v,t,n,s):e(v,t,n,s,a,g+1);if(a>=0&&h>0&&h-1&&h>0){let e=function(e,t){return(n,r,i)=>{let s=0,o=n.length-1,l,a;if(o>=0&&(l=n[o])instanceof n6){if(!o&&l.type==e&&l.length==i)return l;(a=l.prop(n0.lookAhead))&&(s=r[o]+l.length+a)}return f(e,n,r,i,s,t)}}(S,w);C=rp(S,n,s,0,n.length,0,x-v,e,e)}else C=f(S,n,s,x-v,k-x,w)}d.push(C),p.push(M)}(e.start||0,e.bufferStart||0,d,p,-1,0);let m=null!==(t=e.length)&&void 0!==t?t:d.length?p[0]+d[0].length:0;return new n6(a[e.topID],d.reverse(),p.reverse(),m)}(e)}}n6.empty=new n6(n4.none,[],[],0);class n8{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 n8(this.buffer,this.index)}}class n7{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return n4.none}toString(){let e=[];for(let t=0;t0)));l=s[l+3]);return o}slice(e,t,n){let r=this.buffer,i=new Uint16Array(t-e),s=0;for(let o=e,l=0;o=t&&nt;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function rt(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.to0?o.length:-1;e!=h;e+=t){let h=o[e],c=l[e]+s.from;if(re(r,n,c,c+h.length)){if(h instanceof n7){if(i&a.ExcludeBuffers)continue;let o=h.findChild(0,h.buffer.length,t,n-c,r);if(o>-1)return new rl(new ro(s,h,e,c),null,o)}else if(i&a.IncludeAnonymous||!h.type.isAnonymous||ru(h)){let o;if(!(i&a.IgnoreMounts)&&(o=n1.get(h))&&!o.overlay)return new rr(o.tree,c,e,s);let l=new rr(h,c,e,s);return i&a.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(t<0?h.children.length-1:0,t,n,r)}}}if(i&a.IncludeAnonymous||!s.type.isAnonymous||(e=s.index>=0?s.index+t:t<0?-1:s._parent._tree.children.length,!(s=s._parent)))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)}enter(e,t,n=0){let r;if(!(n&a.IgnoreOverlays)&&(r=n1.get(this._tree))&&r.overlay){let n=e-this.from;for(let{from:e,to:i}of r.overlay)if((t>0?e<=n:e=n:i>n))return new rr(r.tree,r.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 ri(e,t,n,r){let i=e.cursor(),s=[];if(!i.firstChild())return s;if(null!=n){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return s}for(;;){if(null!=r&&i.type.is(r))return s;if(i.type.is(t)&&s.push(i.node),!i.nextSibling())return null==r?s:[]}}function rs(e,t,n=t.length-1){for(let r=e;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}class ro{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class rl extends rn{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:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return i<0?null:new rl(this.context,this,i)}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)}enter(e,t,n=0){if(n&a.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new rl(this.context,this,i)}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 rl(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 rl(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let s=n.buffer[this.index+1];e.push(n.slice(r,i,s)),t.push(0)}return new n6(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ra(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;rn.from||i.to0){if(this.index-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&a.IncludeAnonymous||e instanceof n7||!e.type.isAnonymous||ru(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let s=e;s;s=s._parent)if(s.index==r){if(r==this.index)return s;t=s,n=i+1;break t}r=this.stack[--i]}for(let e=n;e=0;i--){if(i<0)return rs(this._tree,e,r);let s=n[t.buffer[this.stack[i]]];if(!s.isAnonymous){if(e[r]&&e[r]!=s.name)return!1;r--}}return!0}}function ru(e){return e.children.some(e=>e instanceof n7||!e.type.isAnonymous||ru(e))}let rf=new WeakMap;function rd(e,t){if(!e.isAnonymous||t instanceof n7||t.type!=e)return 1;let n=rf.get(t);if(null==n){for(let r of(n=1,t.children)){if(r.type!=e||!(r instanceof n6)){n=1;break}n+=rd(e,r)}rf.set(t,n)}return n}function rp(e,t,n,r,i,s,o,l,a){let h=0;for(let n=r;n=c)break;p+=t}if(h==i+1){if(p>c){let e=n[i];t(e.children,e.positions,0,e.children.length,r[i]+l);continue}u.push(n[i])}else{let t=r[h-1]+n[h-1].length-d;u.push(rp(e,n,r,i,h,d,t,null,a))}f.push(d+l-s)}}(t,n,r,i,0),(l||a)(u,f,o)}class rm{constructor(e,t,n,r,i=!1,s=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(i?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let r=[new rm(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&r.push(n);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],i=1,s=e.length?e[0]:null;for(let o=0,l=0,a=0;;o++){let h=o=n)for(;s&&s.from=t.from||c<=t.to||a){let e=Math.max(t.from,l)-a,n=Math.min(t.to,c)-a;t=e>=n?null:new rm(e,n,t.tree,t.offset+a,o>0,!!h)}if(t&&r.push(t),s.to>c)break;s=inew nX(e.from,e.to)):[new nX(0,0)]:[new nX(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}}class ry{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new n0({perNode:!0});let rv=0;class rx{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=rv++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){if(e instanceof rx&&(t=e),null==t?void 0:t.base)throw Error("Can not derive from a modified tag");let n=new rx("string"==typeof e?e:"?",[],null,[]);if(n.set.push(n),t)for(let e of t.set)n.set.push(e);return n}static defineModifier(e){let t=new rk(e);return e=>e.modified.indexOf(t)>-1?e:rk.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}}let rb=0;class rk{constructor(e){this.name=e,this.instances=[],this.id=rb++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(n=>{var r;return n.base==e&&(r=n.modified,t.length==r.length&&t.every((e,t)=>e==r[t]))});if(n)return n;let r=[],i=new rx(e.name,r,e,t);for(let e of t)e.instances.push(i);let s=function(e){let t=[[]];for(let n=0;nt.length-e.length)}(t);for(let t of e.set)if(!t.modified.length)for(let e of s)r.push(rk.get(t,e));return i}}let rw=new n0;class rS{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+" "+r:r;break}}return t},scope:r}}rS.empty=new rS([],2,null);class rA{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,r,i){let{type:s,from:o,to:l}=e;if(o>=n||l<=t)return;s.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(s)));let a=r,h=function(e){let t=e.type.prop(rw);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||rS.empty,c=function(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+" "+e:e)}return n}(i,h.tags);if(c&&(a&&(a+=" "),a+=c,1==h.mode&&(r+=(r?" ":"")+c)),this.startSpan(Math.max(t,o),a),h.opaque)return;let u=e.tree&&e.tree.prop(n0.mounted);if(u&&u.overlay){let s=e.node.enter(u.overlay[0].from+o,1),h=this.highlighters.filter(e=>!e.scope||e.scope(u.tree.type)),c=e.firstChild();for(let f=0,d=o;;f++){let p=f=m)&&e.nextSibling()););if(!p||m>n)break;(d=p.to+o)>t&&(this.highlightRange(s.cursor(),Math.max(t,p.from+o),Math.min(n,d),"",h),this.startSpan(Math.min(n,d),a))}c&&e.parent()}else if(e.firstChild()){u&&(r="");do{if(e.to<=t)continue;if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),a)}while(e.nextSibling());e.parent()}}}let rM=rx.define,rO=rM(),rI=rM(),rT=rM(rI),rN=rM(rI),rD=rM(),rP=rM(rD),rE=rM(rD),rB=rM(),rR=rM(rB),rL=rM(),r_=rM(),rJ=rM(),rj=rM(rJ),rW=rM(),rq={comment:rO,lineComment:rM(rO),blockComment:rM(rO),docComment:rM(rO),name:rI,variableName:rM(rI),typeName:rT,tagName:rM(rT),propertyName:rN,attributeName:rM(rN),className:rM(rI),labelName:rM(rI),namespace:rM(rI),macroName:rM(rI),literal:rD,string:rP,docString:rM(rP),character:rM(rP),attributeValue:rM(rP),number:rE,integer:rM(rE),float:rM(rE),bool:rM(rD),regexp:rM(rD),escape:rM(rD),color:rM(rD),url:rM(rD),keyword:rL,self:rM(rL),null:rM(rL),atom:rM(rL),unit:rM(rL),modifier:rM(rL),operatorKeyword:rM(rL),controlKeyword:rM(rL),definitionKeyword:rM(rL),moduleKeyword:rM(rL),operator:r_,derefOperator:rM(r_),arithmeticOperator:rM(r_),logicOperator:rM(r_),bitwiseOperator:rM(r_),compareOperator:rM(r_),updateOperator:rM(r_),definitionOperator:rM(r_),typeOperator:rM(r_),controlOperator:rM(r_),punctuation:rJ,separator:rM(rJ),bracket:rj,angleBracket:rM(rj),squareBracket:rM(rj),paren:rM(rj),brace:rM(rj),content:rB,heading:rR,heading1:rM(rR),heading2:rM(rR),heading3:rM(rR),heading4:rM(rR),heading5:rM(rR),heading6:rM(rR),contentSeparator:rM(rB),list:rM(rB),quote:rM(rB),emphasis:rM(rB),strong:rM(rB),link:rM(rB),monospace:rM(rB),strikethrough:rM(rB),inserted:rM(),deleted:rM(),changed:rM(),invalid:rM(),meta:rW,documentMeta:rM(rW),annotation:rM(rW),processingInstruction:rM(rW),definition:rx.defineModifier("definition"),constant:rx.defineModifier("constant"),function:rx.defineModifier("function"),standard:rx.defineModifier("standard"),local:rx.defineModifier("local"),special:rx.defineModifier("special")};for(let e in rq){let t=rq[e];t instanceof rx&&(t.name=e)}rC([{tag:rq.link,class:"tok-link"},{tag:rq.heading,class:"tok-heading"},{tag:rq.emphasis,class:"tok-emphasis"},{tag:rq.strong,class:"tok-strong"},{tag:rq.keyword,class:"tok-keyword"},{tag:rq.atom,class:"tok-atom"},{tag:rq.bool,class:"tok-bool"},{tag:rq.url,class:"tok-url"},{tag:rq.labelName,class:"tok-labelName"},{tag:rq.inserted,class:"tok-inserted"},{tag:rq.deleted,class:"tok-deleted"},{tag:rq.literal,class:"tok-literal"},{tag:rq.string,class:"tok-string"},{tag:rq.number,class:"tok-number"},{tag:[rq.regexp,rq.escape,rq.special(rq.string)],class:"tok-string2"},{tag:rq.variableName,class:"tok-variableName"},{tag:rq.local(rq.variableName),class:"tok-variableName tok-local"},{tag:rq.definition(rq.variableName),class:"tok-variableName tok-definition"},{tag:rq.special(rq.variableName),class:"tok-variableName2"},{tag:rq.definition(rq.propertyName),class:"tok-propertyName tok-definition"},{tag:rq.typeName,class:"tok-typeName"},{tag:rq.namespace,class:"tok-namespace"},{tag:rq.className,class:"tok-className"},{tag:rq.macroName,class:"tok-macroName"},{tag:rq.propertyName,class:"tok-propertyName"},{tag:rq.operator,class:"tok-operator"},{tag:rq.comment,class:"tok-comment"},{tag:rq.meta,class:"tok-meta"},{tag:rq.invalid,class:"tok-invalid"},{tag:rq.punctuation,class:"tok-punctuation"}]);var rF=n(53791);let rz=new n0,r$=new n0;class rU{constructor(e,t,n=[],r=""){this.data=e,this.name=r,u.yy.prototype.hasOwnProperty("tree")||Object.defineProperty(u.yy.prototype,"tree",{get(){return rH(this)}}),this.parser=t,this.extension=[r2.of(this),u.yy.languageData.of((e,t,n)=>{let r=rV(e,t,n),i=r.type.prop(rz);if(!i)return[];let s=e.facet(i),o=r.type.prop(r$);if(o){let i=r.resolve(t-r.from,n);for(let t of o)if(t.test(i,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(s)}}return s})].concat(n)}isActiveAt(e,t,n=-1){return rV(e,t,n).type.prop(rz)==this.data}findRegions(e){let t=e.facet(r2);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(rz)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(n0.mounted);if(i){if(i.tree.prop(rz)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let rK=null;class rG{constructor(e,t,n=[],r,i,s,o,l){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=s,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new rG(e,t,[],n6.empty,0,n,[],null)}startParse(){return this.parser.startParse(new rQ(this.state.doc),this.fragments)}work(e,t){return(null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=n6.empty&&this.isDone(null!=t?t:this.state.doc.length))?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t=this.treeLen&&((null==this.parse.stoppedAt||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(rm.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=rK;rK=this;try{return e()}finally{rK=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=rZ(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:r,treeLen:i,viewport:s,skipped:o}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges((e,n,r,i)=>t.push({fromA:e,toA:n,fromB:r,toB:i})),n=rm.applyChanges(n,t),r=n6.empty,i=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length)for(let t of(o=[],this.skipped)){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);ne.from&&(this.fragments=rZ(this.fragments,n,r),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}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 rg{createParse(t,n,r){let i=r[0].from,s=r[r.length-1].to;return{parsedPos:i,advance(){let t=rK;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=s,new n6(n4.none,[],[],s-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return rK}}function rZ(e,t,n){return rm.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class rY{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 rY(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=rG.create(e.facet(r2).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new rY(n)}}rU.state=u.QQ.define({create:rY.init,update(e,t){for(let e of t.effects)if(e.is(rU.setState))return e.value;return t.startState.facet(r2)!=t.state.facet(r2)?rY.init(t.state):e.apply(t)}});let rX=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(rX=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});let r0="undefined"!=typeof navigator&&(null===(h=navigator.scheduling)||void 0===h?void 0:h.isInputPending)?()=>navigator.scheduling.isInputPending():null,r1=f.lg.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(rU.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(rU.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=rX(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndr+1e3,l=i.context.work(()=>r0&&r0()||Date.now()>s,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:rU.setState.of(new rY(i.context))})),this.chunkBudget>0&&!(l&&!o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>(0,f.OO)(this.view.state,e)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),r2=u.r$.define({combine:e=>e.length?e[0]:null,enables:e=>[rU.state,r1,f.tk.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});function r4(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}let r3=u.Py.define({map:r4}),r5=u.Py.define({map:r4}),r9=u.QQ.define({create:()=>f.p.none,update(e,t){for(let n of(e=e.map(t.changes),t.effects))if(n.is(r3)&&!function(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(r8),i=r?f.p.replace({widget:new it(r(t.state,n.value))}):ie;e=e.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(r5)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));if(t.selection){let n=!1,{head:r}=t.selection.main;e.between(r,r,(e,t)=>{er&&(n=!0)}),n&&(e=e.update({filterFrom:r,filterTo:r,filter:(e,t)=>t<=r||e>=r}))}return e},provide:e=>f.tk.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n(0,u.BO)(e,r6)});function r7(e,t){let{state:n}=e,r=n.facet(r8),i=t=>{var n,r,i,s;let o,l=e.lineBlockAt(e.posAtDOM(t.target)),a=(n=e.state,r=l.from,i=l.to,o=null,null===(s=n.field(r9,!1))||void 0===s||s.between(r,i,(e,t)=>{(!o||o.from>e)&&(o={from:e,to:t})}),o);a&&e.dispatch({effects:r5.of(a)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}let ie=f.p.replace({widget:new class extends f.l9{toDOM(e){return r7(e,null)}}});class it extends f.l9{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return r7(e,this.value)}}class ir{constructor(e,t){let n;function r(e){let t=rF.V.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;let i="string"==typeof t.all?t.all:t.all?r(t.all):void 0,s=t.scope;this.scope=s instanceof rU?e=>e.prop(rz)==s.data:s?e=>e==s:void 0,this.style=rC(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new rF.V(n):null,this.themeType=t.themeType}static define(e,t){return new ir(e,t||{})}}let ii=u.r$.define(),is=u.r$.define({combine:e=>e.length?[e[0]]:null});function io(e){let t=e.facet(ii);return t.length?t:e.facet(is)}class il{constructor(e){this.markCache=Object.create(null),this.tree=rH(e.state),this.decorations=this.buildDeco(e,io(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=rH(e.state),n=io(e.state),r=n!=io(e.startState),{viewport:i}=e.view,s=e.changes.mapPos(this.decoratedTo,1);t.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=s):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return f.p.none;let n=new u.f_;for(let{from:r,to:i}of e.visibleRanges)!function(e,t,n,r=0,i=e.length){let s=new rA(r,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),r,i,"",s.highlighters),s.flush(i)}(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=f.p.mark({class:r})))},r,i);return n.finish()}}let ia=u.Wl.high(f.lg.fromClass(il,{decorations:e=>e.decorations}));rq.meta,rq.link,rq.heading,rq.emphasis,rq.strong,rq.strikethrough,rq.keyword,rq.atom,rq.bool,rq.url,rq.contentSeparator,rq.labelName,rq.literal,rq.inserted,rq.string,rq.deleted,rq.regexp,rq.escape,rq.string,rq.variableName,rq.variableName,rq.typeName,rq.namespace,rq.className,rq.variableName,rq.macroName,rq.propertyName,rq.comment,rq.invalid;let ih=Object.create(null),ic=[n4.none],iu=[],id=Object.create(null),ip=Object.create(null);for(let[e,t]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"]])ip[e]=function(e,t){let n=[];for(let r of t.split(" ")){let t=[];for(let n of r.split(".")){let r=e[n]||rq[n];r?"function"==typeof r?t.length?t=t.map(r):im(n,`Modifier ${n} used at start of tag`):t.length?im(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:im(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),i=r+" "+n.map(e=>e.id),s=id[i];if(s)return s.id;let o=id[i]=n4.define({id:ic.length,name:r,props:[function(e){let t=Object.create(null);for(let n in e){let r=e[n];for(let e of(Array.isArray(r)||(r=[r]),n.split(" ")))if(e){let n=[],i=2,s=e;for(let t=0;;){if("..."==s&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!r)throw RangeError("Invalid path: "+e);if(n.push("*"==r[0]?"":'"'==r[0][0]?JSON.parse(r[0]):r[0]),(t+=r[0].length)==e.length)break;let o=e[t++];if(t==e.length&&"!"==o){i=0;break}if("/"!=o)throw RangeError("Invalid path: "+e);s=e.slice(t)}let o=n.length-1,l=n[o];if(!l)throw RangeError("Invalid path: "+e);let a=new rS(r,i,o>0?n.slice(0,o):null);t[l]=a.sort(t[l])}}return rw.add(t)}({[r]:n})]});return ic.push(o),o.id}(ih,t);function im(e,t){iu.indexOf(e)>-1||(iu.push(e),console.warn(t))}f.Nm.RTL,f.Nm.LTR;let ig="#e06c75",iy="#abb2bf",iv="#7d8799",ix="#d19a66",ib="#2c313a",ik="#282c34",iw="#353a42",iS="#528bff",iC=[f.tk.theme({"&":{color:iy,backgroundColor:ik},".cm-content":{caretColor:iS},".cm-cursor, .cm-dropCursor":{borderLeftColor:iS},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:iy},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:ik,color:iv,border:"none"},".cm-activeLineGutter":{backgroundColor:ib},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:iw},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:iw,borderBottomColor:iw},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:ib,color:iy}}},{dark:!0}),(l=ir.define([{tag:rq.keyword,color:"#c678dd"},{tag:[rq.name,rq.deleted,rq.character,rq.propertyName,rq.macroName],color:ig},{tag:[rq.function(rq.variableName),rq.labelName],color:"#61afef"},{tag:[rq.color,rq.constant(rq.name),rq.standard(rq.name)],color:ix},{tag:[rq.definition(rq.name),rq.separator],color:iy},{tag:[rq.typeName,rq.className,rq.number,rq.changed,rq.annotation,rq.modifier,rq.self,rq.namespace],color:"#e5c07b"},{tag:[rq.operator,rq.operatorKeyword,rq.url,rq.escape,rq.regexp,rq.link,rq.special(rq.string)],color:"#56b6c2"},{tag:[rq.meta,rq.comment],color:iv},{tag:rq.strong,fontWeight:"bold"},{tag:rq.emphasis,fontStyle:"italic"},{tag:rq.strikethrough,textDecoration:"line-through"},{tag:rq.link,color:iv,textDecoration:"underline"},{tag:rq.heading,fontWeight:"bold",color:ig},{tag:[rq.atom,rq.bool,rq.special(rq.variableName)],color:ix},{tag:[rq.processingInstruction,rq.string,rq.inserted],color:"#98c379"},{tag:rq.invalid,color:"#ffffff"}]),r=[ia],l instanceof ir&&(l.module&&r.push(f.tk.styleModule.of(l.module)),i=l.themeType),i?r.push(ii.computeN([f.tk.darkTheme],e=>e.facet(f.tk.darkTheme)==("dark"==i)?[l]:[])):r.push(ii.of(l)),r)];var iA=f.tk.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),iM=function(e){void 0===e&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:r=!1,theme:i="light",placeholder:s="",basicSetup:o=!0}=e,l=[];switch(t&&l.unshift(f.$f.of([eJ])),o&&("boolean"==typeof o?l.unshift(nZ()):l.unshift(nZ(o))),s&&l.unshift((0,f.W$)(s)),i){case"light":l.push(iA);break;case"dark":l.push(iC);break;case"none":break;default:l.push(i)}return!1===n&&l.push(f.tk.editable.of(!1)),r&&l.push(u.yy.readOnly.of(!0)),[...l]},iO=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)}),iI=u.q6.define(),iT=[],iN=n(9550),iD=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],iP=(0,c.forwardRef)((e,t)=>{var{className:n,value:r="",selection:i,extensions:o=[],onChange:l,onStatistics:a,onCreateEditor:h,onUpdate:d,autoFocus:p,theme:m="light",height:g,minHeight:y,maxHeight:v,width:x,minWidth:b,maxWidth:k,basicSetup:w,placeholder:S,indentWithTab:C,editable:A,readOnly:M,root:O,initialState:I}=e,T=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}(e,iD),N=(0,c.useRef)(null),{state:D,view:P,container:E}=function(e){var{value:t,selection:n,onChange:r,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:l=iT,autoFocus:a,theme:h="light",height:d=null,minHeight:p=null,maxHeight:m=null,width:g=null,minWidth:y=null,maxWidth:v=null,placeholder:x="",editable:b=!0,readOnly:k=!1,indentWithTab:w=!0,basicSetup:S=!0,root:C,initialState:A}=e,[M,O]=(0,c.useState)(),[I,T]=(0,c.useState)(),[N,D]=(0,c.useState)(),P=f.tk.theme({"&":{height:d,minHeight:p,maxHeight:m,width:g,minWidth:y,maxWidth:v},"& .cm-scroller":{height:"100% !important"}}),E=[f.tk.updateListener.of(e=>{e.docChanged&&"function"==typeof r&&!e.transactions.some(e=>e.annotation(iI))&&r(e.state.doc.toString(),e),i&&i(iO(e))}),P,...iM({theme:h,editable:b,readOnly:k,placeholder:x,indentWithTab:w,basicSetup:S})];return o&&"function"==typeof o&&E.push(f.tk.updateListener.of(o)),E=E.concat(l),(0,c.useEffect)(()=>{if(M&&!N){var e={doc:t,selection:n,extensions:E},r=A?u.yy.fromJSON(A.json,e,A.fields):u.yy.create(e);if(D(r),!I){var i=new f.tk({state:r,parent:M,root:C});T(i),s&&s(i,r)}}return()=>{I&&(D(void 0),T(void 0))}},[M,N]),(0,c.useEffect)(()=>O(e.container),[e.container]),(0,c.useEffect)(()=>()=>{I&&(I.destroy(),T(void 0))},[I]),(0,c.useEffect)(()=>{a&&I&&I.focus()},[a,I]),(0,c.useEffect)(()=>{I&&I.dispatch({effects:u.Py.reconfigure.of(E)})},[h,l,d,p,m,g,y,v,x,b,k,w,S,r,o]),(0,c.useEffect)(()=>{if(void 0!==t){var e=I?I.state.doc.toString():"";I&&t!==e&&I.dispatch({changes:{from:0,to:e.length,insert:t||""},annotations:[iI.of(!0)]})}},[t,I]),{state:N,setState:D,view:I,setView:T,container:M,setContainer:O}}({container:N.current,root:O,value:r,autoFocus:p,theme:m,height:g,minHeight:y,maxHeight:v,width:x,minWidth:b,maxWidth:k,basicSetup:w,placeholder:S,indentWithTab:C,editable:A,readOnly:M,selection:i,onChange:l,onStatistics:a,onCreateEditor:h,onUpdate:d,extensions:o,initialState:I});if((0,c.useImperativeHandle)(t,()=>({editor:N.current,state:D,view:P}),[N,E,D,P]),"string"!=typeof r)throw Error("value must be typeof string but got "+typeof r);var B="string"==typeof m?"cm-theme-"+m:"cm-theme";return(0,iN.jsx)("div",s({ref:N,className:""+B+(n?" "+n:"")},T))});iP.displayName="CodeMirror";var iE=iP},66692:function(e,t,n){n.d(t,{Dv:function(){return q},Gn:function(){return N},K0:function(){return T},Qf:function(){return ea},R_:function(){return em},SS:function(){return I},Um:function(){return eO},c:function(){return M},e7:function(){return Z},mi:function(){return eo},n$:function(){return eS},nF:function(){return ef},nY:function(){return J},qp:function(){return d},qz:function(){return p},ri:function(){return C},tC:function(){return _},uj:function(){return D},vw:function(){return R},x0:function(){return W},y1:function(){return O}});var r,i=n(80240),s=n(3031),o=n(36709),l=n(13199),a=n(53791);let h=new i.md,c=new i.md;class u{constructor(e,t,n=[],r=""){this.data=e,this.name=r,s.yy.prototype.hasOwnProperty("tree")||Object.defineProperty(s.yy.prototype,"tree",{get(){return p(this)}}),this.parser=t,this.extension=[S.of(this),s.yy.languageData.of((e,t,n)=>{let r=f(e,t,n),i=r.type.prop(h);if(!i)return[];let s=e.facet(i),o=r.type.prop(c);if(o){let i=r.resolve(t-r.from,n);for(let t of o)if(t.test(i,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(s)}}return s})].concat(n)}isActiveAt(e,t,n=-1){return f(e,t,n).type.prop(h)==this.data}findRegions(e){let t=e.facet(S);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(h)==this.data){n.push({from:t,to:t+e.length});return}let s=e.prop(i.md.mounted);if(s){if(s.tree.prop(h)==this.data){if(s.overlay)for(let e of s.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(s.overlay){let e=n.length;if(r(s.tree,s.overlay[0].from+t),n.length>e)return}}for(let n=0;ne.concat(t):void 0}));return new d(n,e.parser.configure({props:[h.add(e=>e.isTop?n:void 0)]}),e.name)}configure(e,t){return new d(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function p(e){let t=e.field(u.state,!1);return t?t.tree:i.mp.empty}class m{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!0}read(e,t){let n=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let g=null;class y{constructor(e,t,n=[],r,i,s,o,l){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=s,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new y(e,t,[],i.mp.empty,0,n,[],null)}startParse(){return this.parser.startParse(new m(this.state.doc),this.fragments)}work(e,t){return(null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=i.mp.empty&&this.isDone(null!=t?t:this.state.doc.length))?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t=this.treeLen&&((null==this.parse.stoppedAt||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(i.i9.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=g;g=this;try{return e()}finally{g=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=v(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:r,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges((e,n,r,i)=>t.push({fromA:e,toA:n,fromB:r,toB:i})),n=i.i9.applyChanges(n,t),r=i.mp.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length)for(let t of(l=[],this.skipped)){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);ne.from&&(this.fragments=v(this.fragments,n,r),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}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 i._b{createParse(t,n,r){let s=r[0].from,o=r[r.length-1].to;return{parsedPos:s,advance(){let t=g;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=o,new i.mp(i.Jq.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return g}}function v(e,t,n){return i.i9.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class x{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 x(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=y.create(e.facet(S).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new x(n)}}u.state=s.QQ.define({create:x.init,update(e,t){for(let e of t.effects)if(e.is(u.setState))return e.value;return t.startState.facet(S)!=t.state.facet(S)?x.init(t.state):e.apply(t)}});let b=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(b=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});let k="undefined"!=typeof navigator&&(null===(r=navigator.scheduling)||void 0===r?void 0:r.isInputPending)?()=>navigator.scheduling.isInputPending():null,w=o.lg.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(u.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(u.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=b(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndr+1e3,l=i.context.work(()=>k&&k()||Date.now()>s,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:u.setState.of(new x(i.context))})),this.chunkBudget>0&&!(l&&!o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>(0,o.OO)(this.view.state,e)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),S=s.r$.define({combine:e=>e.length?e[0]:null,enables:e=>[u.state,w,o.tk.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class C{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}let A=s.r$.define(),M=s.r$.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function O(e){let t=e.facet(M);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function I(e,t){let n="",r=e.tabSize,i=e.facet(M)[0];if(" "==i){for(;t>=r;)n+=" ",t-=r;i=" "}for(let e=0;e=t?function(e,t,n){let r=t.resolveStack(n),i=r.node.enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t!=r.node;t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return P(r,e,n)}(e,n,t):null}class N{constructor(e,t={}){this.state=e,this.options=t,this.unit=O(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return null!=r&&r>=n.from&&r<=n.to?i&&r==e?{text:"",from:e}:(t<0?r-1&&(i+=s-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return(0,s.IS)(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}let D=new i.md;function P(e,t,n){for(let r=e;r;r=r.next){let e=function(e){let t=e.type.prop(D);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(i.md.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>L(e,!0,1,void 0,n&&!(e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak)?t.from:void 0)}return null==e.parent?E:null}(r.node);if(e)return e(B.create(t,n,r))}return 0}function E(){return 0}class B extends N{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 B(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(function(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return P(this.context.next,this.base,this.pos)}}function R({closing:e,align:t=!0,units:n=1}){return r=>L(r,t,n,e)}function L(e,t,n,r,i){let s=e.textAfter,o=s.match(/^\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||i==e.pos+o,a=t?function(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,s=e.state.doc.lineAt(n.from),o=null==i||i<=s.from?s.to:Math.min(s.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped)return i.from{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}function J(){return s.yy.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+200)return e;let s=n.sliceString(i.from,r);if(!t.some(e=>e.test(s)))return e;let{state:o}=e,l=-1,a=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==l)continue;l=t.from;let n=T(o,t.from);if(null==n)continue;let r=/^\s*/.exec(t.text)[0],i=I(o,n);r!=i&&a.push({from:t.from,to:t.from+r.length,insert:i})}return a.length?[e,{changes:a,sequential:!0}]:e})}let j=s.r$.define(),W=new i.md;function q(e){let t=e.firstChild,n=e.lastChild;return t&&t.ton)continue;if(s&&i.from=t&&r.to>n&&(s=r)}}return s}(e,t,n)}function z(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}let $=s.Py.define({map:z}),U=s.Py.define({map:z});function V(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}let H=s.QQ.define({create:()=>o.p.none,update(e,t){for(let n of(e=e.map(t.changes),t.effects))if(n.is($)&&!function(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(X),i=r?o.p.replace({widget:new er(r(t.state,n.value))}):en;e=e.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(U)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));if(t.selection){let n=!1,{head:r}=t.selection.main;e.between(r,r,(e,t)=>{er&&(n=!0)}),n&&(e=e.update({filterFrom:r,filterTo:r,filter:(e,t)=>t<=r||e>=r}))}return e},provide:e=>o.tk.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n{(!i||i.from>e)&&(i={from:e,to:t})}),i}function K(e,t){return e.field(H,!1)?t:t.concat(s.Py.appendConfig.of(ee()))}function G(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return o.tk.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}let Z=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of V(e)){let n=F(e.state,t.from,t.to);if(n)return e.dispatch({effects:K(e.state,[$.of(n),G(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(H,!1))return!1;let t=[];for(let n of V(e)){let r=Q(e.state,n.from,n.to);r&&t.push(U.of(r),G(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let r=0;r{let t=e.state.field(H,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(U.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],Y={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},X=s.r$.define({combine:e=>(0,s.BO)(e,Y)});function ee(e){let t=[H,el];return e&&t.push(X.of(e)),t}function et(e,t){let{state:n}=e,r=n.facet(X),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=Q(e.state,n.from,n.to);r&&e.dispatch({effects:U.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}let en=o.p.replace({widget:new class extends o.l9{toDOM(e){return et(e,null)}}});class er extends o.l9{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return et(e,this.value)}}let ei={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class es extends o.SJ{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 eo(e={}){let t=Object.assign(Object.assign({},ei),e),n=new es(t,!0),r=new es(t,!1),i=o.lg.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(S)!=e.state.facet(S)||e.startState.field(H,!1)!=e.state.field(H,!1)||p(e.startState)!=p(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new s.f_;for(let i of e.viewportLineBlocks){let s=Q(e.state,i.from,i.to)?r:F(e.state,i.from,i.to)?n:null;s&&t.add(i.from,i.from,s)}return t.finish()}}),{domEventHandlers:l}=t;return[i,(0,o.v5)({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.markers)||s.Xs.empty},initialSpacer:()=>new es(t,!1),domEventHandlers:Object.assign(Object.assign({},l),{click:(e,t,n)=>{if(l.click&&l.click(e,t,n))return!0;let r=Q(e.state,t.from,t.to);if(r)return e.dispatch({effects:U.of(r)}),!0;let i=F(e.state,t.from,t.to);return!!i&&(e.dispatch({effects:$.of(i)}),!0)}})}),ee()]}let el=o.tk.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"}});class ea{constructor(e,t){let n;function r(e){let t=a.V.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;let i="string"==typeof t.all?t.all:t.all?r(t.all):void 0,s=t.scope;this.scope=s instanceof u?e=>e.prop(h)==s.data:s?e=>e==s:void 0,this.style=(0,l.QR)(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new a.V(n):null,this.themeType=t.themeType}static define(e,t){return new ea(e,t||{})}}let eh=s.r$.define(),ec=s.r$.define({combine:e=>e.length?[e[0]]:null});function eu(e){let t=e.facet(eh);return t.length?t:e.facet(ec)}function ef(e,t){let n=[ep],r;return e instanceof ea&&(e.module&&n.push(o.tk.styleModule.of(e.module)),r=e.themeType),(null==t?void 0:t.fallback)?n.push(ec.of(e)):r?n.push(eh.computeN([o.tk.darkTheme],t=>t.facet(o.tk.darkTheme)==("dark"==r)?[e]:[])):n.push(eh.of(e)),n}class ed{constructor(e){this.markCache=Object.create(null),this.tree=p(e.state),this.decorations=this.buildDeco(e,eu(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=p(e.state),n=eu(e.state),r=n!=eu(e.startState),{viewport:i}=e.view,s=e.changes.mapPos(this.decoratedTo,1);t.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=s):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return o.p.none;let n=new s.f_;for(let{from:r,to:i}of e.visibleRanges)(0,l.bW)(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=o.p.mark({class:r})))},r,i);return n.finish()}}let ep=s.Wl.high(o.lg.fromClass(ed,{decorations:e=>e.decorations})),em=ea.define([{tag:l.pJ.meta,color:"#404740"},{tag:l.pJ.link,textDecoration:"underline"},{tag:l.pJ.heading,textDecoration:"underline",fontWeight:"bold"},{tag:l.pJ.emphasis,fontStyle:"italic"},{tag:l.pJ.strong,fontWeight:"bold"},{tag:l.pJ.strikethrough,textDecoration:"line-through"},{tag:l.pJ.keyword,color:"#708"},{tag:[l.pJ.atom,l.pJ.bool,l.pJ.url,l.pJ.contentSeparator,l.pJ.labelName],color:"#219"},{tag:[l.pJ.literal,l.pJ.inserted],color:"#164"},{tag:[l.pJ.string,l.pJ.deleted],color:"#a11"},{tag:[l.pJ.regexp,l.pJ.escape,l.pJ.special(l.pJ.string)],color:"#e40"},{tag:l.pJ.definition(l.pJ.variableName),color:"#00f"},{tag:l.pJ.local(l.pJ.variableName),color:"#30a"},{tag:[l.pJ.typeName,l.pJ.namespace],color:"#085"},{tag:l.pJ.className,color:"#167"},{tag:[l.pJ.special(l.pJ.variableName),l.pJ.macroName],color:"#256"},{tag:l.pJ.definition(l.pJ.propertyName),color:"#00c"},{tag:l.pJ.comment,color:"#940"},{tag:l.pJ.invalid,color:"#f00"}]),eg=o.tk.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),ey="()[]{}",ev=s.r$.define({combine:e=>(0,s.BO)(e,{afterCursor:!0,brackets:ey,maxScanDistance:1e4,renderMatch:ek})}),ex=o.p.mark({class:"cm-matchingBracket"}),eb=o.p.mark({class:"cm-nonmatchingBracket"});function ek(e){let t=[],n=e.matched?ex:eb;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}let ew=[s.QQ.define({create:()=>o.p.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],r=t.state.facet(ev);for(let e of t.state.selection.ranges){if(!e.empty)continue;let i=eO(t.state,e.head,-1,r)||e.head>0&&eO(t.state,e.head-1,1,r)||r.afterCursor&&(eO(t.state,e.head,1,r)||e.heado.tk.decorations.from(e)}),eg];function eS(e={}){return[ev.of(e),ew]}let eC=new i.md;function eA(e,t,n){let r=e.prop(t<0?i.md.openedBy:i.md.closedBy);if(r)return r;if(1==e.name.length){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function eM(e){let t=e.type.prop(eC);return t?t(e.node):e}function eO(e,t,n,r={}){let i=r.maxScanDistance||1e4,s=r.brackets||ey,o=p(e),l=o.resolveInner(t,n);for(let e=l;e;e=e.parent){let r=eA(e.type,n,s);if(r&&e.from0?t>=i.from&&ti.from&&t<=i.to))return function(e,t,n,r,i,s,o){let l=r.parent,a={from:i.from,to:i.to},h=0,c=null==l?void 0:l.cursor();if(c&&(n<0?c.childBefore(r.from):c.childAfter(r.to)))do if(n<0?c.to<=r.from:c.from>=r.to){if(0==h&&s.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:n<0?t-1:t,to:n>0?t+1:t},c=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!c.next().done&&e<=s;){let s=c.value;n<0&&(e+=s.length);let l=t+e*n;for(let e=n>0?0:s.length-1,t=n>0?s.length:-1;e!=t;e+=n){let t=o.indexOf(s[e]);if(!(t<0)&&r.resolveInner(l+e,1).type==i){if(t%2==0==n>0)u++;else{if(1==u)return{start:h,end:{from:l+e,to:l+e+1},matched:t>>1==a>>1};u--}}}n>0&&(e+=s.length)}return c.done?{start:h,matched:!1}:null}(e,t,n,o,l.type,i,s)}let eI=Object.create(null),eT=[i.Jq.none],eN=[],eD=Object.create(null),eP=Object.create(null);for(let[e,t]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"]])eP[e]=function(e,t){let n=[];for(let r of t.split(" ")){let t=[];for(let n of r.split(".")){let r=e[n]||l.pJ[n];r?"function"==typeof r?t.length?t=t.map(r):eE(n,`Modifier ${n} used at start of tag`):t.length?eE(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:eE(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),s=r+" "+n.map(e=>e.id),o=eD[s];if(o)return o.id;let a=eD[s]=i.Jq.define({id:eT.length,name:r,props:[(0,l.Gv)({[r]:n})]});return eT.push(a),a.id}(eI,t);function eE(e,t){eN.indexOf(e)>-1||(eN.push(e),console.warn(t))}o.Nm.RTL,o.Nm.LTR},3031:function(e,t,n){let r;n.d(t,{BO:function(){return ex},D0:function(){return eg},Gz:function(){return e_},IS:function(){return eL},Py:function(){return ec},QQ:function(){return $},Wl:function(){return H},Xs:function(){return eC},YW:function(){return eu},as:function(){return O},bg:function(){return b},cp:function(){return m},f_:function(){return eA},gc:function(){return A},gm:function(){return x},jT:function(){return R},n0:function(){return M},nZ:function(){return k},q6:function(){return el},r$:function(){return J},uU:function(){return eb},xv:function(){return i},yy:function(){return ev}});class i{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=f(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),o.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=f(this,e,t);let n=[];return this.decompose(e,t,n,0),o.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new a(this),i=new a(e);for(let e=t,s=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(s+=r.value.length,r.done||s>=n)return!0}}iter(e=1){return new a(this,e)}iterRange(e,t=this.length){return new h(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new c(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new s(e):o.from(s.split(e,[])):i.empty}}class s extends i{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let s=this.text[i],o=r+s.length;if((t?n:o)>=e)return new u(r,o,n,s);r=o+1,n++}}decompose(e,t,n,r){let i=e<=0&&t>=this.length?this:new s(l(this.text,[""],e,t),Math.min(t,this.length)-Math.max(0,e));if(1&r){let e=n.pop(),t=l(i.text,e.text.slice(),0,i.length);if(t.length<=32)n.push(new s(t,e.length+i.length));else{let e=t.length>>1;n.push(new s(t.slice(0,e)),new s(t.slice(e)))}}else n.push(i)}replace(e,t,n){if(!(n instanceof s))return super.replace(e,t,n);[e,t]=f(this,e,t);let r=l(this.text,l(n.text,l(this.text,[""],0,e)),t),i=this.length+n.length-(t-e);return r.length<=32?new s(r,i):o.from(s.split(r,[]),i)}sliceString(e,t=this.length,n="\n"){[e,t]=f(this,e,t);let r="";for(let i=0,s=0;i<=t&&se&&s&&(r+=n),ei&&(r+=o.slice(Math.max(0,e-i),t-i)),i=l+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let i of e)n.push(i),r+=i.length+1,32==n.length&&(t.push(new s(n,r)),n=[],r=-1);return r>-1&&t.push(new s(n,r)),t}}class o extends i{constructor(e,t){for(let n of(super(),this.children=e,this.length=t,this.lines=0,e))this.lines+=n.lines}lineInner(e,t,n,r){for(let i=0;;i++){let s=this.children[i],o=r+s.length,l=n+s.lines-1;if((t?l:o)>=e)return s.lineInner(e,t,n,r);r=o+1,n=l+1}}decompose(e,t,n,r){for(let i=0,s=0;s<=t&&i=s){let i=r&((s<=e?1:0)|(l>=t?2:0));s>=e&&l<=t&&!i?n.push(o):o.decompose(e-s,t-s,n,i)}s=l+1}}replace(e,t,n){if([e,t]=f(this,e,t),n.lines=i&&t<=l){let a=s.replace(e-i,t-i,n),h=this.lines-s.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let i=this.children.slice();return i[r]=a,new o(i,this.length-(t-e)+n.length)}return super.replace(i,l,a)}i=l+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=f(this,e,t);let r="";for(let i=0,s=0;ie&&i&&(r+=n),es&&(r+=o.sliceString(e-s,t-s,n)),s=l+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof o))return 0;let n=0,[r,i,s,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,i+=t){if(r==s||i==l)return n;let o=this.children[r],a=e.children[i];if(o!=a)return n+o.scanIdentical(a,t);n+=o.length+1}}static from(e,t=e.reduce((e,t)=>e+t.length+1,-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new s(n,t)}let r=Math.max(32,n>>5),i=r<<1,l=r>>1,a=[],h=0,c=-1,u=[];function f(){0!=h&&(a.push(1==u.length?u[0]:o.from(u,c)),c=-1,h=u.length=0)}for(let t of e)!function e(t){let n;if(t.lines>i&&t instanceof o)for(let n of t.children)e(n);else t.lines>l&&(h>l||!h)?(f(),a.push(t)):t instanceof s&&h&&(n=u[u.length-1])instanceof s&&t.lines+n.lines<=32?(h+=t.lines,c+=t.length+1,u[u.length-1]=new s(n.text.concat(t.text),n.length+1+t.length)):(h+t.lines>r&&f(),h+=t.lines,c+=t.length+1,u.push(t))}(t);return f(),1==a.length?a[0]:new o(a,t)}}function l(e,t,n=0,r=1e9){for(let i=0,s=0,o=!0;s=n&&(a>r&&(l=l.slice(0,r-i)),i0?1:(e instanceof s?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],o=i>>1,l=r instanceof s?r.text.length:r.children.length;if(o==(t>0?l:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&i)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(r instanceof s){let i=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=0==e?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[o+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof s?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class h{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new a(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class c{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(i.prototype[Symbol.iterator]=function(){return this.iter()},a.prototype[Symbol.iterator]=h.prototype[Symbol.iterator]=c.prototype[Symbol.iterator]=function(){return this});class u{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}}function f(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}let d="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=1;e=127462&&e<=127487}function m(e,t,n=!0,r=!0){return(n?g:function(e,t,n){for(;t>0;){let r=g(e,t-2,n);if(re)return d[t-1]<=e;return!1}(i))t+=k(i),r=i;else if(p(i)){let n=0,r=t-2;for(;r>=0&&p(x(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function y(e){return e>=56320&&e<57344}function v(e){return e>=55296&&e<56320}function x(e,t){let n=e.charCodeAt(t);if(!v(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return y(r)?(n-55296<<10)+(r-56320)+65536:n}function b(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(((e-=65536)>>10)+55296,(1023&e)+56320)}function k(e){return e<65536?1:2}let w=/\r\n?|\n/;var S,C,A=((S=A||(A={}))[S.Simple=0]="Simple",S[S.TrackDel=1]="TrackDel",S[S.TrackBefore=2]="TrackBefore",S[S.TrackAfter=3]="TrackAfter",S);class M{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return i+(e-r);i+=o}else{if(n!=A.Simple&&a>=e&&(n==A.TrackDel&&re||n==A.TrackBefore&&re))return null;if(a>e||a==e&&t<0&&!o)return e==r||t<0?i:i+l;i+=l}r=a}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n=0&&r<=t&&o>=e)return!(rt)||"cover";r=o}return!1}toString(){let e="";for(let t=0;t=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(e=>"number"!=typeof e))throw RangeError("Invalid JSON representation of ChangeDesc");return new M(e)}static create(e){return new M(e)}}class O extends M{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError("Applying change set to a document with the wrong length");return N(this,(t,n,r,i,s)=>e=e.replace(r,r+(n-t),s),!1),e}mapDesc(e,t=!1){return D(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,s=0;r=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;n.length0&&T(n,t,i.text),i.forward(e),o+=e}let a=e[s++];for(;o>1].toJSON()))}return e}static of(e,t,n){let r=[],s=[],o=0,l=null;function a(e=!1){if(!e&&!r.length)return;ol||e<0||l>t)throw RangeError(`Invalid change range ${e} to ${l} (in doc of length ${t})`);let u=c?"string"==typeof c?i.of(c.split(n||w)):c:i.empty,f=u.length;if(e==l&&0==f)return;eo&&I(r,e-o,-1),I(r,l-e,f),T(s,r,u),o=l}}(e),a(!l),l}static empty(e){return new O(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;rt&&"string"!=typeof e))throw RangeError("Invalid JSON representation of ChangeSet");else if(1==s.length)t.push(s[0],0);else{for(;n.length=0&&n<=0&&n==e[i+1]?e[i]+=t:0==t&&0==e[i]?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function T(e,t,n){if(0==n.length)return;let r=t.length-2>>1;if(r>1])),!n&&l!=e.sections.length&&!(e.sections[l+1]<0);)a=e.sections[l++],h=e.sections[l++];t(s,c,o,u,f),s=c,o=u}}}function D(e,t,n,r=!1){let i=[],s=r?[]:null,o=new E(e),l=new E(t);for(let e=-1;;)if(-1==o.ins&&-1==l.ins){let e=Math.min(o.len,l.len);I(i,e,-1),o.forward(e),l.forward(e)}else if(l.ins>=0&&(o.ins<0||e==o.i||0==o.off&&(l.len=0&&e=0){let t=0,n=o.len;for(;n;)if(-1==l.ins){let e=Math.min(n,l.len);t+=e,n-=e,l.forward(e)}else if(0==l.ins&&l.lent||o.ins>=0&&o.len>t)&&(e||r.length>n),s.forward2(t),o.forward(t)}}else I(r,0,o.ins,e),i&&T(i,r,o.text),o.next()}}class E{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?i.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?i.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class B{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new B(n,r,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return R.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return R.range(this.anchor,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw RangeError("Invalid JSON representation for SelectionRange");return R.range(e.anchor,e.head)}static create(e,t,n){return new B(e,t,n)}}class R{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:R.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw RangeError("Invalid JSON representation for EditorSelection");return new R(e.ranges.map(e=>B.fromJSON(e)),e.main)}static single(e,t=e){return new R([R.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw RangeError("A selection needs at least one range");for(let n=0,r=0;re?8:0)|i)}static normalized(e,t=0){let n=e[t];e.sort((e,t)=>e.from-t.from),t=e.indexOf(n);for(let n=1;nr.head?R.range(o,s):R.range(s,o))}}return new R(e,t)}}function L(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError("Selection points outside of document")}let _=0;class J{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=_++,this.default=e([]),this.extensions="function"==typeof i?i(this):i}get reader(){return this}static define(e={}){return new J(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:j),!!e.static,e.enables)}of(e){return new W([],this,0,e)}compute(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new W(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new W(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],n=>t(n.field(e)))}}function j(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}class W{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=_++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,i=this.id,s=e[i]>>1,o=2==this.type,l=!1,a=!1,h=[];for(let n of this.dependencies)"doc"==n?l=!0:"selection"==n?a=!0:((null!==(t=e[n.id])&&void 0!==t?t:1)&1)==0&&h.push(e[n.id]);return{create:e=>(e.values[s]=n(e),1),update(e,t){if(l&&t.docChanged||a&&(t.docChanged||t.selection)||F(e,h)){let t=n(e);if(o?!q(t,e.values[s],r):!r(t,e.values[s]))return e.values[s]=t,1}return 0},reconfigure:(e,t)=>{let l,a=t.config.address[i];if(null!=a){let i=X(t,a);if(this.dependencies.every(n=>n instanceof J?t.facet(n)===e.facet(n):!(n instanceof $)||t.field(n,!1)==e.field(n,!1))||(o?q(l=n(e),i,r):r(l=n(e),i)))return e.values[s]=i,0}else l=n(e);return e.values[s]=l,1}}}}function q(e,t,n){if(e.length!=t.length)return!1;for(let r=0;re===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(z).find(e=>e.field==this);return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}init(e){return[this,z.of({field:this,create:e})]}get extension(){return this}}let U={lowest:4,low:3,default:2,high:1,highest:0};function V(e){return t=>new Q(t,e)}let H={highest:V(U.highest),high:V(U.high),default:V(U.default),low:V(U.low),lowest:V(U.lowest)};class Q{constructor(e,t){this.inner=e,this.prec=t}}class K{of(e){return new G(this,e)}reconfigure(e){return K.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class G{constructor(e,t){this.compartment=e,this.inner=t}}class Z{constructor(e,t,n,r,i,s){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=s,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,n){let r,i,s=[],o=Object.create(null),l=new Map;for(let n of(r=[[],[],[],[],[]],i=new Map,!function e(n,s){let o=i.get(n);if(null!=o){if(o<=s)return;let e=r[o].indexOf(n);e>-1&&r[o].splice(e,1),n instanceof G&&l.delete(n.compartment)}if(i.set(n,s),Array.isArray(n))for(let t of n)e(t,s);else if(n instanceof G){if(l.has(n.compartment))throw RangeError("Duplicate use of compartment in extensions");let r=t.get(n.compartment)||n.inner;l.set(n.compartment,r),e(r,s)}else if(n instanceof Q)e(n.inner,n.prec);else if(n instanceof $)r[s].push(n),n.provides&&e(n.provides,s);else if(n instanceof W)r[s].push(n),n.facet.extensions&&e(n.facet.extensions,U.default);else{let t=n.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${n}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(t,s)}}(e,U.default),r.reduce((e,t)=>e.concat(t))))n instanceof $?s.push(n):(o[n.facet.id]||(o[n.facet.id]=[])).push(n);let a=Object.create(null),h=[],c=[];for(let e of s)a[e.id]=c.length<<1,c.push(t=>e.slot(t));let u=null==n?void 0:n.config.facets;for(let e in o){let t=o[e],r=t[0].facet,i=u&&u[e]||[];if(t.every(e=>0==e.type)){if(a[r.id]=h.length<<1|1,j(i,t))h.push(n.facet(r));else{let e=r.combine(t.map(e=>e.value));h.push(n&&r.compare(e,n.facet(r))?n.facet(r):e)}}else{for(let e of t)0==e.type?(a[e.id]=h.length<<1|1,h.push(e.value)):(a[e.id]=c.length<<1,c.push(t=>e.dynamicSlot(t)));a[r.id]=c.length<<1,c.push(e=>(function(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),s=r.filter(e=>!(1&e)),o=e[t.id]>>1;function l(e){let n=[];for(let t=0;te(a)),a,h,o)}}function Y(e,t){if(1&t)return 2;let n=t>>1,r=e.status[n];if(4==r)throw Error("Cyclic dependency between fields and/or facets");if(2&r)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function X(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}let ee=J.define(),et=J.define({combine:e=>e.some(e=>e),static:!0}),en=J.define({combine:e=>e.length?e[0]:void 0,static:!0}),er=J.define(),ei=J.define(),es=J.define(),eo=J.define({combine:e=>!!e.length&&e[0]});class el{constructor(e,t){this.type=e,this.value=t}static define(){return new ea}}class ea{of(e){return new el(this,e)}}class eh{constructor(e){this.map=e}of(e){return new ec(this,e)}}class ec{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new ec(this.type,t)}is(e){return this.type==e}static define(e={}){return new eh(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}}ec.reconfigure=ec.define(),ec.appendConfig=ec.define();class eu{constructor(e,t,n,r,i,s){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=i,this.scrollIntoView=s,this._doc=null,this._state=null,n&&L(n,t.newLength),i.some(e=>e.type==eu.time)||(this.annotations=i.concat(eu.time.of(Date.now())))}static create(e,t,n,r,i,s){return new eu(e,t,n,r,i,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(eu.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function ef(e,t,n){var r;let i,s,o;return n?(i=t.changes,s=O.empty(t.changes.length),o=e.changes.compose(t.changes)):(i=t.changes.map(e.changes),s=e.changes.mapDesc(t.changes,!0),o=e.changes.compose(i)),{changes:o,selection:t.selection?t.selection.map(s):null===(r=e.selection)||void 0===r?void 0:r.map(i),effects:ec.mapEffects(e.effects,i).concat(ec.mapEffects(t.effects,s)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function ed(e,t,n){let r=t.selection,i=em(t.annotations);return t.userEvent&&(i=i.concat(eu.userEvent.of(t.userEvent))),{changes:t.changes instanceof O?t.changes:O.of(t.changes||[],n,e.facet(en)),selection:r&&(r instanceof R?r:R.single(r.anchor,r.head)),effects:em(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}eu.time=el.define(),eu.userEvent=el.define(),eu.addToHistory=el.define(),eu.remote=el.define();let ep=[];function em(e){return null==e?ep:Array.isArray(e)?e:[e]}var eg=((C=eg||(eg={}))[C.Word=0]="Word",C[C.Space=1]="Space",C[C.Other=2]="Other",C);let ey=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{r=RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}class ev{constructor(e,t,n,r,i,s){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,s&&(s._state=this);for(let e=0;e=0;i--){let s=n[i](e);s&&Object.keys(s).length&&(r=ef(r,ed(t,s,e.changes.newLength),!0))}return r==e?e:eu.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}(r?function(t){let n=t.startState,r=!0;for(let e of n.facet(er)){let n=e(t);if(!1===n){r=!1;break}Array.isArray(n)&&(r=!0===r?n:function(e,t){let n=[];for(let r=0,i=0;;){let s,o;if(r=e[r]))s=e[r++],o=e[r++];else{if(!(i=0;r--){let s=i[r](t);t=s instanceof eu?s:Array.isArray(s)&&1==s.length&&s[0]instanceof eu?s[0]:e(n,em(s),!1)}return t}(s):s)}(this,e,!0)}applyTransaction(e){let t,n=this.config,{base:r,compartments:i}=n;for(let t of e.effects)t.is(K.reconfigure)?(n&&(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),n=null),i.set(t.value.compartment,t.value.extension)):t.is(ec.reconfigure)?(n=null,r=t.value):t.is(ec.appendConfig)&&(n=null,r=em(r).concat(t.value));t=n?e.startState.values.slice():new ev(n=Z.resolve(r,i,this),this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values;let s=e.startState.facet(et)?e.newSelection:e.newSelection.asSingle();new ev(n,e.newDoc,s,t,(t,n)=>n.update(t,e),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:R.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],s=em(n.effects);for(let n=1;ni.spec.fromJSON(s,e)))}}return ev.create({doc:e.doc,selection:R.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=Z.resolve(e.extensions||[],new Map),n=e.doc instanceof i?e.doc:i.of((e.doc||"").split(t.staticFacet(ev.lineSeparator)||w)),r=e.selection?e.selection instanceof R?e.selection:R.single(e.selection.anchor,e.selection.head):R.single(0);return L(r,n.length),t.staticFacet(et)||(r=r.asSingle()),new ev(t,n,r,t.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(ev.tabSize)}get lineBreak(){return this.facet(ev.lineSeparator)||"\n"}get readOnly(){return this.facet(eo)}phrase(e,...t){for(let t of this.facet(ev.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(e,n)=>{if("$"==n)return"$";let r=+(n||1);return!r||r>t.length?e:t[r-1]})),e}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(ee))for(let s of i(this,t,n))Object.prototype.hasOwnProperty.call(s,e)&&r.push(s[e]);return r}charCategorizer(e){var t;return t=this.languageDataAt("wordChars",e).join(""),e=>{if(!/\S/.test(e))return eg.Space;if(function(e){if(r)return r.test(e);for(let t=0;t"\x80"&&(n.toUpperCase()!=n.toLowerCase()||ey.test(n)))return!0}return!1}(e))return eg.Word;for(let n=0;n-1)return eg.Word;return eg.Other}}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),s=e-n,o=e-n;for(;s>0;){let e=m(t,s,!1);if(i(t.slice(e,s))!=eg.Word)break;s=e}for(;oe.length?e[0]:4}),ev.lineSeparator=en,ev.readOnly=eo,ev.phrases=J.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),ev.languageData=ee,ev.changeFilter=er,ev.transactionFilter=ei,ev.transactionExtender=es,K.reconfigure=ec.define();class eb{eq(e){return this==e}range(e,t=e){return ek.create(e,t,this)}}eb.prototype.startSide=eb.prototype.endSide=0,eb.prototype.point=!1,eb.prototype.mapMode=A.TrackDel;class ek{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new ek(e,t,n)}}function ew(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class eS{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let s=r,o=i.length;;){if(s==o)return s;let r=s+o>>1,l=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==s)return l>=0?s:o;l>=0?o=r:s=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),s=this.findIndex(n,1e9,!1,i);i(f=t.mapPos(c,a.endSide))||u==f&&a.startSide>0&&a.endSide<=0)continue;0>(f-u||a.endSide-a.startSide)||(s<0&&(s=u),a.point&&(o=Math.max(o,f-u)),n.push(a),r.push(u-s),i.push(f-s))}return{mapped:n.length?new eS(r,i,n,o):null,pos:s}}}class eC{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new eC(e,t,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:r=0,filterTo:i=this.length}=e,s=e.filter;if(0==t.length&&!s)return this;if(n&&(t=t.slice().sort(ew)),this.isEmpty)return t.length?eC.of(t):this;let o=new eO(this,null,-1).goto(0),l=0,a=[],h=new eA;for(;o.value||l=0){let e=t[l++];h.addInner(e.from,e.to,e.value)||a.push(e)}else 1==o.rangeIndex&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||io.to||i=i&&e<=i+s.length&&!1===s.between(i,e-i,t-i,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return eI.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return eI.from(e).goto(t)}static compare(e,t,n,r,i=-1){let s=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),o=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),l=eM(s,o,n),a=new eN(s,l,i),h=new eN(o,l,i);n.iterGaps((e,t,n)=>eD(a,e,h,t,n,r)),n.empty&&0==n.length&&eD(a,0,h,0,0,r)}static eq(e,t,n=0,r){null==r&&(r=999999999);let i=e.filter(e=>!e.isEmpty&&0>t.indexOf(e)),s=t.filter(t=>!t.isEmpty&&0>e.indexOf(t));if(i.length!=s.length)return!1;if(!i.length)return!0;let o=eM(i,s),l=new eN(i,o,0).goto(n),a=new eN(s,o,0).goto(n);for(;;){if(l.to!=a.to||!eP(l.active,a.active)||l.point&&(!a.point||!l.point.eq(a.point)))return!1;if(l.to>r)return!0;l.next(),a.next()}}static spans(e,t,n,r,i=-1){let s=new eN(e,null,i).goto(t),o=t,l=s.openStart;for(;;){let e=Math.min(s.to,n);if(s.point){let n=s.activeForPoint(s.to),i=s.pointFromo&&(r.span(o,e,s.active,l),l=s.openEnd(e));if(s.to>n)return l+(s.point&&s.to>n?1:0);o=s.to,s.next()}}static of(e,t=!1){let n=new eA;for(let r of e instanceof ek?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(ew);t=r}return e}(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return eC.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=eC.empty;r=r.nextLayer)t=new eC(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}eC.empty=new eC([],[],null,-1),eC.empty.nextLayer=eC.empty;class eA{finishChunk(e){this.chunks.push(new eS(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new eA)).add(e,t,n)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&0>(e-this.lastFrom||n.startSide-this.last.startSide))throw Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if(0>(e-this.lastTo||t.value[0].startSide-this.last.endSide))return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(eC.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=eC.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function eM(e,t,n){let r=new Map;for(let t of e)for(let e=0;e(this.to-e||this.endSide-t)&&this.gotoInner(e,t,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=n&&r.push(new eO(s,t,n,i));return 1==r.length?r[0]:new eI(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)eT(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)eT(this.heap,e);0>(this.to-e||this.value.endSide-t)&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),eT(this.heap,0)}}}function eT(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let i=e[r];if(r+1=0&&(i=e[r+1],r++),0>n.compare(i))break;e[r]=n,e[t]=i,t=r}}class eN{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=eI.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&0>(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t);)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){eE(this.active,e),eE(this.activeTo,e),eE(this.activeRank,e),this.minActive=eR(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t0;)t++;eB(this.active,t,n),eB(this.activeTo,t,r),eB(this.activeRank,t,i),e&&eB(e,t,this.cursor.from),this.minActive=eR(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&0>(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&eE(n,r)}else if(this.cursor.value){if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(t&&this.cursor.to==this.to&&this.cursor.from=0&&n[t]=0&&!(this.activeRank[n]e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function eD(e,t,n,r,i,s){e.goto(t),n.goto(r);let o=r+i,l=r,a=r-t;for(;;){let t=e.to+a-n.to||e.endSide-n.endSide,r=t<0?e.to+a:n.to,i=Math.min(r,o);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&eP(e.activeForPoint(e.to),n.activeForPoint(n.to))||s.comparePoint(l,i,e.point,n.point):i>l&&!eP(e.active,n.active)&&s.compareRange(l,i,e.active,n.active),r>o)break;l=r,t<=0&&e.next(),t>=0&&n.next()}}function eP(e,t){if(e.length!=t.length)return!1;for(let n=0;n=t;n--)e[n+1]=e[n];e[t]=n}function eR(e,t){let n=-1,r=1e9;for(let i=0;i(t[i]-r||e[i].endSide-e[n].endSide)&&(n=i,r=t[i]);return n}function eL(e,t,n=e.length){let r=0;for(let i=0;i=t)return r;if(r==e.length)break;i+=9==e.charCodeAt(r)?n-i%n:1,r=m(e,r)}return!0===r?-1:e.length}},80240:function(e,t,n){var r,i;n.d(t,{Jq:function(){return u},L3:function(){return s},Lj:function(){return f},_b:function(){return R},hr:function(){return E},i9:function(){return B},md:function(){return a},mp:function(){return m},vj:function(){return r}});let s=1024,o=0;class l{constructor(e,t){this.from=e,this.to=t}}class a{constructor(e={}){this.id=o++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=u.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}a.closedBy=new a({deserialize:e=>e.split(" ")}),a.openedBy=new a({deserialize:e=>e.split(" ")}),a.group=new a({deserialize:e=>e.split(" ")}),a.isolate=new a({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw RangeError("Invalid value for isolate: "+e);return e||"auto"}}),a.contextHash=new a({perNode:!0}),a.lookAhead=new a({perNode:!0}),a.mounted=new a({perNode:!0});class h{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[a.mounted.id]}}let c=Object.create(null);class u{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):c,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),r=new u(e.name||"",t,e.id,n);if(e.props){for(let n of e.props)if(Array.isArray(n)||(n=n(r)),n){if(n[0].perNode)throw RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(a.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return e=>{for(let n=e.prop(a.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}}u.none=new u("",Object.create(null),0,8);class f{constructor(e){this.types=e;for(let t=0;t=t){let o=new k(s.tree,s.overlay[0].from+e.from,-1,e);(i||(i=[r])).push(x(o,t,n,!1))}}return i?M(i):r}(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:s=this.length}=e,o=e.mode||0,l=(o&r.IncludeAnonymous)>0;for(let e=this.cursor(o|r.IncludeAnonymous);;){let r=!1;if(e.from<=s&&e.to>=i&&(!l&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;r=!0}for(;r&&n&&(l||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;r=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:P(u.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,n)=>new m(this.type,e,t,n,this.propValues),e.makeTree||((e,t,n)=>new m(u.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=s,reused:o=[],minRepeatType:l=r.types.length}=e,h=Array.isArray(n)?new g(n,n.length):n,c=r.types,u=0,f=0;function d(e,t,n,i,s,o,l,a){let h=[],c=[];for(;e.length>i;)h.push(e.pop()),c.push(t.pop()+n-s);e.push(p(r.types[l],h,c,o-s,a-o)),t.push(s-n)}function p(e,t,n,r,i=0,s){if(u){let e=[a.contextHash,u];s=s?[e].concat(s):[e]}if(i>25){let e=[a.lookAhead,i];s=s?[e].concat(s):[e]}return new m(e,t,n,r,s)}let v=[],x=[];for(;h.pos>0;)!function e(t,n,s,g,v,x){let{id:b,start:k,end:w,size:S}=h,C=f;for(;S<0;){if(h.next(),-1==S){let e=o[b];s.push(e),g.push(k-t);return}if(-3==S){u=b;return}if(-4==S){f=b;return}throw RangeError(`Unrecognized record size: ${S}`)}let A=c[b],M,O,I=k-t;if(w-k<=i&&(O=function(e,t){let n=h.fork(),r=0,s=0,o=0,a=n.end-i,c={size:0,start:0,skip:0};t:for(let i=n.pos-e;n.pos>i;){let e=n.size;if(n.id==t&&e>=0){c.size=r,c.start=s,c.skip=o,o+=4,r+=4,n.next();continue}let h=n.pos-e;if(e<0||h=l?4:0,f=n.start;for(n.next();n.pos>h;){if(n.size<0){if(-3==n.size)u+=4;else break t}else n.id>=l&&(u+=4);n.next()}s=f,r+=e,o+=u}return(t<0||r==e)&&(c.size=r,c.start=s,c.skip=o),c.size>4?c:void 0}(h.pos-n,v))){let e=new Uint16Array(O.size-O.skip),n=h.pos-O.size,i=e.length;for(;h.pos>n;)i=function e(t,n,r){let{id:i,start:s,end:o,size:a}=h;if(h.next(),a>=0&&i4){let i=h.pos-(a-4);for(;h.pos>i;)r=e(t,n,r)}n[--r]=l,n[--r]=o-t,n[--r]=s-t,n[--r]=i}else -3==a?u=i:-4==a&&(f=i);return r}(O.start,e,i);M=new y(e,w-O.start,r),I=O.start-t}else{let t=h.pos-S;h.next();let n=[],s=[],o=b>=l?b:-1,c=0,u=w;for(;h.pos>t;)o>=0&&h.id==o&&h.size>=0?(h.end<=u-i&&(d(n,s,k,c,h.end,u,o,C),c=n.length,u=h.end),h.next()):x>2500?function(e,t,n,s){let o=[],l=0,a=-1;for(;h.pos>t;){let{id:e,start:t,end:n,size:r}=h;if(r>4)h.next();else if(a>-1&&t=0;e-=3)t[n++]=o[e],t[n++]=o[e+1]-i,t[n++]=o[e+2]-i,t[n++]=n;n.push(new y(t,o[2]-i,r)),s.push(i-e)}}(k,t,n,s):e(k,t,n,s,o,x+1);if(o>=0&&c>0&&c-1&&c>0){let e=function(e){return(t,n,r)=>{let i=0,s=t.length-1,o,l;if(s>=0&&(o=t[s])instanceof m){if(!s&&o.type==e&&o.length==r)return o;(l=o.prop(a.lookAhead))&&(i=n[s]+o.length+l)}return p(e,t,n,r,i)}}(A);M=P(A,n,s,0,n.length,0,w-k,e,e)}else M=p(A,n,s,w-k,C-w)}s.push(M),g.push(I)}(e.start||0,e.bufferStart||0,v,x,-1,0);let b=null!==(t=e.length)&&void 0!==t?t:v.length?x[0]+v[0].length:0;return new m(c[e.topID],v.reverse(),x.reverse(),b)}(e)}}m.empty=new m(u.none,[],[],0);class g{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 g(this.buffer,this.index)}}class y{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return u.none}toString(){let e=[];for(let t=0;t0)));l=s[l+3]);return o}slice(e,t,n){let r=this.buffer,i=new Uint16Array(t-e),s=0;for(let o=e,l=0;o=t&&nt;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function x(e,t,n,i){for(var s;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0?l.length:-1;e!=c;e+=t){let c=l[e],u=a[e]+o.from;if(v(i,n,u,u+c.length)){if(c instanceof y){if(s&r.ExcludeBuffers)continue;let l=c.findChild(0,c.buffer.length,t,n-u,i);if(l>-1)return new A(new C(o,c,e,u),null,l)}else if(s&r.IncludeAnonymous||!c.type.isAnonymous||T(c)){let l;if(!(s&r.IgnoreMounts)&&(l=h.get(c))&&!l.overlay)return new k(l.tree,u,e,o);let a=new k(c,u,e,o);return s&r.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?c.children.length-1:0,t,n,i)}}}if(s&r.IncludeAnonymous||!o.type.isAnonymous||(e=o.index>=0?o.index+t:t<0?-1:o._parent._tree.children.length,!(o=o._parent)))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)}enter(e,t,n=0){let i;if(!(n&r.IgnoreOverlays)&&(i=h.get(this._tree))&&i.overlay){let n=e-this.from;for(let{from:e,to:r}of i.overlay)if((t>0?e<=n:e=n:r>n))return new k(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 w(e,t,n,r){let i=e.cursor(),s=[];if(!i.firstChild())return s;if(null!=n){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return s}for(;;){if(null!=r&&i.type.is(r))return s;if(i.type.is(t)&&s.push(i.node),!i.nextSibling())return null==r?s:[]}}function S(e,t,n=t.length-1){for(let 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}class C{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class A extends b{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(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:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return i<0?null:new A(this.context,this,i)}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)}enter(e,t,n=0){if(n&r.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 A(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 A(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 A(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let s=n.buffer[this.index+1];e.push(n.slice(r,i,s)),t.push(0)}return new m(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function M(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;rn.from||i.to0){if(this.index-1)for(let i=t+e,s=e<0?-1:n._tree.children.length;i!=s;i+=e){let e=n._tree.children[i];if(this.mode&r.IncludeAnonymous||e instanceof y||!e.type.isAnonymous||T(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let s=e;s;s=s._parent)if(s.index==r){if(r==this.index)return s;t=s,n=i+1;break t}r=this.stack[--i]}for(let e=n;e=0;i--){if(i<0)return S(this.node,e,r);let s=n[t.buffer[this.stack[i]]];if(!s.isAnonymous){if(e[r]&&e[r]!=s.name)return!1;r--}}return!0}}function T(e){return e.children.some(e=>e instanceof y||!e.type.isAnonymous||T(e))}let N=new WeakMap;function D(e,t){if(!e.isAnonymous||t instanceof y||t.type!=e)return 1;let n=N.get(t);if(null==n){for(let r of(n=1,t.children)){if(r.type!=e||!(r instanceof m)){n=1;break}n+=D(e,r)}N.set(t,n)}return n}function P(e,t,n,r,i,s,o,l,a){let h=0;for(let n=r;n=c)break;p+=t}if(h==i+1){if(p>c){let e=n[i];t(e.children,e.positions,0,e.children.length,r[i]+l);continue}u.push(n[i])}else{let t=r[h-1]+n[h-1].length-d;u.push(P(e,n,r,i,h,d,t,null,a))}f.push(d+l-s)}}(t,n,r,i,0),(l||a)(u,f,o)}class E{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof A?this.setBuffer(e.context.buffer,e.index,t):e instanceof k&&this.map.set(e.tree,t)}get(e){return e instanceof A?this.getBuffer(e.context.buffer,e.index):e instanceof k?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class B{constructor(e,t,n,r,i=!1,s=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(i?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let r=[new B(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&r.push(n);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],i=1,s=e.length?e[0]:null;for(let o=0,l=0,a=0;;o++){let h=o=n)for(;s&&s.from=t.from||c<=t.to||a){let e=Math.max(t.from,l)-a,n=Math.min(t.to,c)-a;t=e>=n?null:new B(e,n,t.tree,t.offset+a,o>0,!!h)}if(t&&r.push(t),s.to>c)break;s=inew l(e.from,e.to)):[new l(0,0)]:[new l(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}}class L{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new a({perNode:!0})},13199:function(e,t,n){n.d(t,{Gv:function(){return a},QR:function(){return u},bW:function(){return f},pJ:function(){return T}});var r=n(80240);let i=0;class s{constructor(e,t,n){this.set=e,this.base=t,this.modified=n,this.id=i++}static define(e){if(null==e?void 0:e.base)throw Error("Can not derive from a modified tag");let t=new s([],null,[]);if(t.set.push(t),e)for(let n of e.set)t.set.push(n);return t}static defineModifier(){let e=new l;return t=>t.modified.indexOf(e)>-1?t:l.get(t.base||t,t.modified.concat(e).sort((e,t)=>e.id-t.id))}}let o=0;class l{constructor(){this.instances=[],this.id=o++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(n=>{var r;return n.base==e&&(r=n.modified,t.length==r.length&&t.every((e,t)=>e==r[t]))});if(n)return n;let r=[],i=new s(r,e,t);for(let e of t)e.instances.push(i);let o=function(e){let t=[[]];for(let n=0;nt.length-e.length)}(t);for(let t of e.set)if(!t.modified.length)for(let e of o)r.push(l.get(t,e));return i}}function a(e){let t=Object.create(null);for(let n in e){let r=e[n];for(let e of(Array.isArray(r)||(r=[r]),n.split(" ")))if(e){let n=[],i=2,s=e;for(let t=0;;){if("..."==s&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!r)throw RangeError("Invalid path: "+e);if(n.push("*"==r[0]?"":'"'==r[0][0]?JSON.parse(r[0]):r[0]),(t+=r[0].length)==e.length)break;let o=e[t++];if(t==e.length&&"!"==o){i=0;break}if("/"!=o)throw RangeError("Invalid path: "+e);s=e.slice(t)}let o=n.length-1,l=n[o];if(!l)throw RangeError("Invalid path: "+e);let a=new c(r,i,o>0?n.slice(0,o):null);t[l]=a.sort(t[l])}}return h.add(t)}let h=new r.md;class c{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+" "+r:r;break}}return t},scope:r}}function f(e,t,n,r=0,i=e.length){let s=new d(r,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),r,i,"",s.highlighters),s.flush(i)}c.empty=new c([],2,null);class d{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:o,from:l,to:a}=e;if(l>=n||a<=t)return;o.isTop&&(s=this.highlighters.filter(e=>!e.scope||e.scope(o)));let u=i,f=function(e){let t=e.type.prop(h);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||c.empty,d=function(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+" "+e:e)}return n}(s,f.tags);if(d&&(u&&(u+=" "),u+=d,1==f.mode&&(i+=(i?" ":"")+d)),this.startSpan(Math.max(t,l),u),f.opaque)return;let p=e.tree&&e.tree.prop(r.md.mounted);if(p&&p.overlay){let r=e.node.enter(p.overlay[0].from+l,1),o=this.highlighters.filter(e=>!e.scope||e.scope(p.tree.type)),h=e.firstChild();for(let c=0,f=l;;c++){let d=c=m)&&e.nextSibling()););if(!d||m>n)break;(f=d.to+l)>t&&(this.highlightRange(r.cursor(),Math.max(t,d.from+l),Math.min(n,f),"",o),this.startSpan(Math.min(n,f),u))}h&&e.parent()}else if(e.firstChild()){p&&(i="");do{if(e.to<=t)continue;if(e.from>=n)break;this.highlightRange(e,t,n,i,s),this.startSpan(Math.min(n,e.to),u)}while(e.nextSibling());e.parent()}}}let p=s.define,m=p(),g=p(),y=p(g),v=p(g),x=p(),b=p(x),k=p(x),w=p(),S=p(w),C=p(),A=p(),M=p(),O=p(M),I=p(),T={comment:m,lineComment:p(m),blockComment:p(m),docComment:p(m),name:g,variableName:p(g),typeName:y,tagName:p(y),propertyName:v,attributeName:p(v),className:p(g),labelName:p(g),namespace:p(g),macroName:p(g),literal:x,string:b,docString:p(b),character:p(b),attributeValue:p(b),number:k,integer:p(k),float:p(k),bool:p(x),regexp:p(x),escape:p(x),color:p(x),url:p(x),keyword:C,self:p(C),null:p(C),atom:p(C),unit:p(C),modifier:p(C),operatorKeyword:p(C),controlKeyword:p(C),definitionKeyword:p(C),moduleKeyword:p(C),operator:A,derefOperator:p(A),arithmeticOperator:p(A),logicOperator:p(A),bitwiseOperator:p(A),compareOperator:p(A),updateOperator:p(A),definitionOperator:p(A),typeOperator:p(A),controlOperator:p(A),punctuation:M,separator:p(M),bracket:O,angleBracket:p(O),squareBracket:p(O),paren:p(O),brace:p(O),content:w,heading:S,heading1:p(S),heading2:p(S),heading3:p(S),heading4:p(S),heading5:p(S),heading6:p(S),contentSeparator:p(w),list:p(w),quote:p(w),emphasis:p(w),strong:p(w),link:p(w),monospace:p(w),strikethrough:p(w),inserted:p(),deleted:p(),changed:p(),invalid:p(),meta:I,documentMeta:p(I),annotation:p(I),processingInstruction:p(I),definition:s.defineModifier(),constant:s.defineModifier(),function:s.defineModifier(),standard:s.defineModifier(),local:s.defineModifier(),special:s.defineModifier()};u([{tag:T.link,class:"tok-link"},{tag:T.heading,class:"tok-heading"},{tag:T.emphasis,class:"tok-emphasis"},{tag:T.strong,class:"tok-strong"},{tag:T.keyword,class:"tok-keyword"},{tag:T.atom,class:"tok-atom"},{tag:T.bool,class:"tok-bool"},{tag:T.url,class:"tok-url"},{tag:T.labelName,class:"tok-labelName"},{tag:T.inserted,class:"tok-inserted"},{tag:T.deleted,class:"tok-deleted"},{tag:T.literal,class:"tok-literal"},{tag:T.string,class:"tok-string"},{tag:T.number,class:"tok-number"},{tag:[T.regexp,T.escape,T.special(T.string)],class:"tok-string2"},{tag:T.variableName,class:"tok-variableName"},{tag:T.local(T.variableName),class:"tok-variableName tok-local"},{tag:T.definition(T.variableName),class:"tok-variableName tok-definition"},{tag:T.special(T.variableName),class:"tok-variableName2"},{tag:T.definition(T.propertyName),class:"tok-propertyName tok-definition"},{tag:T.typeName,class:"tok-typeName"},{tag:T.namespace,class:"tok-namespace"},{tag:T.className,class:"tok-className"},{tag:T.macroName,class:"tok-macroName"},{tag:T.propertyName,class:"tok-propertyName"},{tag:T.operator,class:"tok-operator"},{tag:T.comment,class:"tok-comment"},{tag:T.meta,class:"tok-meta"},{tag:T.invalid,class:"tok-invalid"},{tag:T.punctuation,class:"tok-punctuation"}])},53791:function(e,t,n){n.d(t,{V:function(){return o}});let r="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),i="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class o{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}for(let t in e)!function e(t,i,s,o){let l=[],a=/^@(\w+)\b/.exec(t[0]),h=a&&"keyframes"==a[1];if(a&&null==i)return s.push(t[0]+";");for(let n in i){let o=i[n];if(/&/.test(n))e(n.split(/,\s*/).map(e=>t.map(t=>e.replace(/&/,t))).reduce((e,t)=>e.concat(t)),o,s);else if(o&&"object"==typeof o){if(!a)throw RangeError("The value of a property ("+n+") should be a primitive value.");e(r(n),o,l,h)}else null!=o&&l.push(n.replace(/_.*/,"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+o+";")}(l.length||h)&&s.push((!n||a||o?t:t.map(n)).join(", ")+" {"+l.join(" ")+"}")}(r(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=s[r]||1;return s[r]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let r=e[i],s=n&&n.nonce;r?s&&r.setNonce(s):r=new a(e,s),r.mount(Array.isArray(t)?t:[t],e)}}let l=new Map;class a{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=l.get(n);if(t)return e[i]=t;this.sheet=new r.CSSStyleSheet,l.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[i]=this}mount(e,t){let n=this.sheet,r=0,i=0;for(let t=0;t-1&&(this.modules.splice(o,1),i--,o=-1),-1==o){if(this.modules.splice(i++,0,s),n)for(let e=0;et.adoptedStyleSheets.indexOf(this.sheet)&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e="";for(let t=0;t",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},s="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),o="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),l=0;l<10;l++)r[48+l]=r[96+l]=String(l);for(var l=1;l<=24;l++)r[l+111]="F"+l;for(var l=65;l<=90;l++)r[l]=String.fromCharCode(l+32),i[l]=String.fromCharCode(l);for(var a in r)i.hasOwnProperty(a)||(i[a]=r[a]);function h(e){var t=!(s&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||o&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?i:r)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}}}]);