1import{aF as I,aC as Mo}from"./index-BCi1utNp.js";import{E as y,F as be,g as $e,S as Se,T as Ye,C as Lo,h as Do,j as m,k as O,I as on,m as rn,n as bt,o as Te,p as sn,A as Ve,q as oe,r as ae,N as rt,u as ln,v as it,D as an,w as Y,x as Oe,V as St,y as T,P as Ct,z as R,B as kt,G,H as v,J as cn,K as M,M as pe,R as Bo,O as Eo,Q as ze,U as To,W as fn,X as st,Y as Oo,Z as wo,_ as Io,$ as Ro,a0 as Po,a1 as Wo,a2 as No,a3 as hn,a4 as Fo,a5 as un,a6 as qo,a7 as Uo,a8 as vt,a9 as Ho,aa as $o,ab as Vo,ac as zo,ad as dn,ae as Ko,t as d,af as jo}from"./index-CGeWvB4o.js";import{aG as ws,ag as Is,ah as Rs,ai as Ps,aH as Ws,aj as Ns,aI as Fs,ak as qs,aJ as Us,al as Hs,aK as $s,aL as Vs,am as zs,an as Ks,ao as js,ap as Gs,aM as Js,aq as Qs,ar as _s,as as Xs,at as Ys,au as Zs,av as el,aw as tl,ax as nl,ay as ol,az as rl,aA as il,aB as sl,aC as ll,aD as al,aE as cl,aF as fl}from"./index-CGeWvB4o.js";try{let t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="fb3fac09-5c4b-48e2-a16d-5fd6a2e15bcd",t._sentryDebugIdIdentifier="sentry-dbid-fb3fac09-5c4b-48e2-a16d-5fd6a2e15bcd")}catch{}function lt(){return lt=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)({}).hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},lt.apply(null,arguments)}function Go(t,e){if(t==null)return{};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(e.indexOf(o)!==-1)continue;n[o]=t[o]}return n}const Jo=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),o=Mt(t.state,n.from);return o.line?Qo(t):o.block?Xo(t):!1};function At(t,e){return({state:n,dispatch:o})=>{if(n.readOnly)return!1;let r=t(e,n);return r?(o(n.update(r)),!0):!1}}const Qo=At(er,0),_o=At(mn,0),Xo=At((t,e)=>mn(t,e,Zo(e)),0);function Mt(t,e){let n=t.languageDataAt("commentTokens",e);return n.length?n[0]:{}}const de=50;function Yo(t,{open:e,close:n},o,r){let i=t.sliceDoc(o-de,o),s=t.sliceDoc(r,r+de),l=/\s*$/.exec(i)[0].length,a=/^\s*/.exec(s)[0].length,f=i.length-l;if(i.slice(f-e.length,f)==e&&s.slice(a,a+n.length)==n)return{open:{pos:o-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let c,h;r-o<=2*de?c=h=t.sliceDoc(o,r):(c=t.sliceDoc(o,o+de),h=t.sliceDoc(r-de,r));let u=/^\s*/.exec(c)[0].length,p=/\s*$/.exec(h)[0].length,g=h.length-p-n.length;return c.slice(u,u+e.length)==e&&h.slice(g,g+n.length)==n?{open:{pos:o+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:r-p-n.length,margin:/\s/.test(h.charAt(g-1))?1:0}}:null}function Zo(t){let e=[];for(let n of t.selection.ranges){let o=t.doc.lineAt(n.from),r=n.to<=o.to?o:t.doc.lineAt(n.to);r.from>o.from&&r.from==n.to&&(r=n.to==o.to+1?o:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>o.from?e[i].to=r.to:e.push({from:o.from+/^\s*/.exec(o.text)[0].length,to:r.to})}return e}function mn(t,e,n=e.selection.ranges){let o=n.map(i=>Mt(e,i.from).block);if(!o.every(i=>i))return null;let r=n.map((i,s)=>Yo(e,o[s],i.from,i.to));if(t!=2&&!r.every(i=>i))return{changes:e.changes(n.map((i,s)=>r[s]?[]:[{from:i.from,insert:o[s].open+" "},{from:i.to,insert:" "+o[s].close}]))};if(t!=1&&r.some(i=>i)){let i=[];for(let s=0,l;s<r.length;s++)if(l=r[s]){let a=o[s],{open:f,close:c}=l;i.push({from:f.pos-a.open.length,to:f.pos+f.margin},{from:c.pos-c.margin,to:c.pos+a.close.length})}return{changes:i}}return null}function er(t,e,n=e.selection.ranges){let o=[],r=-1;for(let{from:i,to:s}of n){let l=o.length,a=1e9,f=Mt(e,i).line;if(f){for(let c=i;c<=s;){let h=e.doc.lineAt(c);if(h.from>r&&(i==s||s>h.from)){r=h.from;let u=/^\s*/.exec(h.text)[0].length,p=u==h.length,g=h.text.slice(u,u+f.length)==f?u:-1;u<h.text.length&&u<a&&(a=u),o.push({line:h,comment:g,token:f,indent:u,empty:p,single:!1})}c=h.to+1}if(a<1e9)for(let c=l;c<o.length;c++)o[c].indent<o[c].line.text.length&&(o[c].indent=a);o.length==l+1&&(o[l].single=!0)}}if(t!=2&&o.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:l,token:a,indent:f,empty:c,single:h}of o)(h||!c)&&i.push({from:l.from+f,insert:a+" "});let s=e.changes(i);return{changes:s,selection:e.selection.map(s,1)}}else if(t!=1&&o.some(i=>i.comment>=0)){let i=[];for(let{line:s,comment:l,token:a}of o)if(l>=0){let f=s.from+l,c=f+a.length;s.text[c-s.from]==" "&&c++,i.push({from:f,to:c})}return{changes:i}}return null}const at=Ve.define(),tr=Ve.define(),nr=be.define(),pn=be.define({combine(t){return $e(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(o,r)=>e(o,r)||n(o,r)})}}),gn=Se.define({create(){return z.empty},update(t,e){let n=e.state.facet(pn),o=e.annotation(at);if(o){let a=B.fromTransaction(e,o.selection),f=o.side,c=f==0?t.undone:t.done;return a?c=we(c,c.length,n.minDepth,a):c=Sn(c,e.startState.selection),new z(f==0?o.rest:c,f==0?c:o.rest)}let r=e.annotation(tr);if((r=="full"||r=="before")&&(t=t.isolate()),e.annotation(Ye.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=B.fromTransaction(e),s=e.annotation(Ye.time),l=e.annotation(Ye.userEvent);return i?t=t.addChanges(i,s,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,s,l,n.newGroupDelay)),(r=="full"||r=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new z(t.done.map(B.fromJSON),t.undone.map(B.fromJSON))}});function yn(t={}){return[gn,pn.of(t),y.domEventHandlers({beforeinput(e,n){let o=e.inputType=="historyUndo"?xn:e.inputType=="historyRedo"?ct:null;return o?(e.preventDefault(),o(n)):!1}})]}function Ke(t,e){return function({state:n,dispatch:o}){if(!e&&n.readOnly)return!1;let r=n.field(gn,!1);if(!r)return!1;
1let i=r.pop(t,n,e);return i?(o(i),!0):!1}}const xn=Ke(0,!1),ct=Ke(1,!1),or=Ke(0,!0),rr=Ke(1,!0);class B{constructor(e,n,o,r,i){this.changes=e,this.effects=n,this.mapped=o,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new B(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,o;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(o=this.startSelection)===null||o===void 0?void 0:o.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new B(e.changes&&Lo.fromJSON(e.changes),[],e.mapped&&Do.fromJSON(e.mapped),e.startSelection&&m.fromJSON(e.startSelection),e.selectionsAfter.map(m.fromJSON))}static fromTransaction(e,n){let o=P;for(let r of e.startState.facet(nr)){let i=r(e);i.length&&(o=o.concat(i))}return!o.length&&e.changes.empty?null:new B(e.changes.invert(e.startState.doc),o,void 0,n||e.startState.selection,P)}static selection(e){return new B(void 0,P,void 0,void 0,e)}}function we(t,e,n,o){let r=e+1>n+20?e-n-1:0,i=t.slice(r,e);return i.push(o),i}function ir(t,e){let n=[],o=!1;return t.iterChangedRanges((r,i)=>n.push(r,i)),e.iterChangedRanges((r,i,s,l)=>{for(let a=0;a<n.length;){let f=n[a++],c=n[a++];l>=f&&s<=c&&(o=!0)}}),o}function sr(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,o)=>n.empty!=e.ranges[o].empty).length===0}function bn(t,e){return t.length?e.length?t.concat(e):t:e}const P=[],lr=200;function Sn(t,e){if(t.length){let n=t[t.length-1],o=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-lr));return o.length&&o[o.length-1].eq(e)?t:(o.push(e),we(t,t.length-1,1e9,n.setSelAfter(o)))}else return[B.selection([e])]}function ar(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Ze(t,e){if(!t.length)return t;let n=t.length,o=P;for(;n;){let r=cr(t[n-1],e,o);if(r.changes&&!r.changes.empty||r.effects.length){let i=t.slice(0,n);return i[n-1]=r,i}else e=r.mapped,n--,o=r.selectionsAfter}return o.length?[B.selection(o)]:P}function cr(t,e,n){let o=bn(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):P,n);if(!t.changes)return B.selection(o);let r=t.changes.map(e),i=e.mapDesc(t.changes,!0),s=t.mapped?t.mapped.composeDesc(i):i;return new B(r,O.mapEffects(t.effects,e),s,t.startSelection.map(i),o)}const fr=/^(input\.type|delete)($|\.)/;class z{constructor(e,n,o=0,r=void 0){this.done=e,this.undone=n,this.prevTime=o,this.prevUserEvent=r}isolate(){return this.prevTime?new z(this.done,this.undone):this}addChanges(e,n,o,r,i){let s=this.done,l=s[s.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!o||fr.test(o))&&(!l.selectionsAfter.length&&n-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,ir(l.changes,e.changes))||o=="input.type.compose")?s=we(s,s.length-1,r.minDepth,new B(e.changes.compose(l.changes),bn(O.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,P)):s=we(s,s.length,r.minDepth,e),new z(s,P,n,o)}addSelection(e,n,o,r){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:P;return i.length>0&&n-this.prevTime<r&&o==this.prevUserEvent&&o&&/^select($|\.)/.test(o)&&sr(i[i.length-1],e)?this:new z(Sn(this.done,e),this.undone,n,o)}addMapping(e){return new z(Ze(this.done,e),Ze(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,o){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],s=i.selectionsAfter[0]||n.selection;if(o&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:at.of({side:e,rest:ar(r),selection:s}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let l=r.length==1?P:r.slice(0,r.length-1);return i.mapped&&(l=Ze(l,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:at.of({side:e,rest:l,selection:s}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}z.empty=new z(P,P);const Cn=[{key:"Mod-z",run:xn,preventDefault:!0}
1,{key:"Mod-y",mac:"Mod-Shift-z",run:ct,preventDefault:!0},{linux:"Ctrl-Shift-z",run:ct,preventDefault:!0},{key:"Mod-u",run:or,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:rr,preventDefault:!0}];function ce(t,e){return m.create(t.ranges.map(e),t.mainIndex)}function K(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function U({state:t,dispatch:e},n){let o=ce(t.selection,n);return o.eq(t.selection,!0)?!1:(e(K(t,o)),!0)}function je(t,e){return m.cursor(e?t.to:t.from)}function kn(t,e){return U(t,n=>n.empty?t.moveByChar(n,e):je(n,e))}function A(t){return t.textDirectionAt(t.state.selection.main.head)==an.LTR}const vn=t=>kn(t,!A(t)),An=t=>kn(t,A(t));function Mn(t,e){return U(t,n=>n.empty?t.moveByGroup(n,e):je(n,e))}const hr=t=>Mn(t,!A(t)),ur=t=>Mn(t,A(t));function dr(t,e,n){if(e.type.prop(n))return!0;let o=e.to-e.from;return o&&(o>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Ge(t,e,n){let o=ae(t).resolveInner(e.head),r=n?rt.closedBy:rt.openedBy;for(let a=e.head;;){let f=n?o.childAfter(a):o.childBefore(a);if(!f)break;dr(t,f,r)?o=f:a=n?f.to:f.from}let i=o.type.prop(r),s,l;return i&&(s=n?oe(t,o.from,1):oe(t,o.to,-1))&&s.matched?l=n?s.end.to:s.end.from:l=n?o.to:o.from,m.cursor(l,n?-1:1)}const mr=t=>U(t,e=>Ge(t.state,e,!A(t))),pr=t=>U(t,e=>Ge(t.state,e,A(t)));function Ln(t,e){return U(t,n=>{if(!n.empty)return je(n,e);let o=t.moveVertically(n,e);return o.head!=n.head?o:t.moveToLineBoundary(n,e)})}const Dn=t=>Ln(t,!1),Bn=t=>Ln(t,!0);function En(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,o=0,r;if(e){for(let i of t.state.facet(y.scrollMargins)){let s=i(t);s!=null&&s.top&&(n=Math.max(s==null?void 0:s.top,n)),s!=null&&s.bottom&&(o=Math.max(s==null?void 0:s.bottom,o))}r=t.scrollDOM.clientHeight-n-o}else r=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:o,selfScroll:e,height:Math.max(t.defaultLineHeight,r-5)}}function Tn(t,e){let n=En(t),{state:o}=t,r=ce(o.selection,s=>s.empty?t.moveVertically(s,e,n.height):je(s,e));if(r.eq(o.selection))return!1;let i;if(n.selfScroll){let s=t.coordsAtPos(o.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,f=l.bottom-n.marginBottom;s&&s.top>a&&s.bottom<f&&(i=y.scrollIntoView(r.main.head,{y:"start",yMargin:s.top-a}))}return t.dispatch(K(o,r),{effects:i}),!0}const Rt=t=>Tn(t,!1),ft=t=>Tn(t,!0);function Q(t,e,n){let o=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,n);if(r.head==e.head&&r.head!=(n?o.to:o.from)&&(r=t.moveToLineBoundary(e,n,!1)),!n&&r.head==o.from&&o.length){let i=/^\s*/.exec(t.state.sliceDoc(o.from,Math.min(o.from+100,o.to)))[0].length;i&&e.head!=o.from+i&&(r=m.cursor(o.from+i))}return r}const gr=t=>U(t,e=>Q(t,e,!0)),yr=t=>U(t,e=>Q(t,e,!1)),xr=t=>U(t,e=>Q(t,e,!A(t))),br=t=>U(t,e=>Q(t,e,A(t))),Sr=t=>U(t,e=>m.cursor(t.lineBlockAt(e.head).from,1)),Cr=t=>U(t,e=>m.cursor(t.lineBlockAt(e.head).to,-1));function kr(t,e,n){let o=!1,r=ce(t.selection,i=>{let s=oe(t,i.head,-1)||oe(t,i.head,1)||i.head>0&&oe(t,i.head-1,1)||i.head<t.doc.length&&oe(t,i.head+1,-1);if(!s||!s.end)return i;o=!0;let l=s.start.from==i.head?s.end.to:s.end.from;return m.cursor(l)});return o?(e(K(t,r)),!0):!1}const vr=({state:t,dispatch:e})=>kr(t,e);function N(t,e){let n=ce(t.state.selection,o=>{let r=e(o);return m.range(o.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(K(t.state,n)),!0)}function On(t,e){return N(t,n=>t.moveByChar(n,e))}const wn=t=>On(t,!A(t)),In=t=>On(t,A(t));function Rn(t,e){return N(t,n=>t.moveByGroup(n,e))}const Ar=t=>Rn(t,!A(t)),Mr=t=>Rn(t,A(t)),Lr=t=>N(t,e=>Ge(t.state,e,!A(t))),Dr=t=>N(t,e=>Ge(t.state,e,A(t)));function Pn(t,e){return N(t,n=>t.moveVertically(n,e))}const Wn=t=>Pn(t,!1),Nn=t=>Pn(t,!0);function Fn(t,e){return N(t,n=>t.moveVertically(n,e,En(t).height))}const Pt=t=>Fn(t,!1),Wt=t=>Fn(t,!0),Br=t=>N(t,e=>Q(t,e,!0)),Er=t=>N(t,e=>Q(t,e,!1)),Tr=t=>N(t,e=>Q(t,e,!A(t))),Or=t=>N(t,e=>Q(t,e,A(t))),wr=t=>N(t,e=>m.cursor(t.lineBlockAt(e.head).from)),Ir=t=>N(t,e=>m.cursor(t.lineBlockAt(e.head).to)),Nt=({state:t,dispatch:e})=>(e(K(t,{anchor:0})),!0),Ft=({state:t,dispatch:e})=>(e(K(t,{anchor:t.doc.length})),!0),qt=({state:t,dispatch:e})=>(e(K(t,{anchor:t.selection.main.anchor,head:0})),!0),Ut=({state:t,dispatch:e})=>(e(K(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Rr=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Pr=({state:t,dispatch:e})=>{let n=Je(t).map(({from:o,to:r})=>m.range(o,Math.min(r+1,t.doc.length)));return e(t.update({selection:m.create(n),userEvent:"select"})),!0},Wr=({state:t,dispatch:e})=>{let n=ce(t.selection,o=>{let r=ae(t),i=r.resolveStack(o.from,1);if(o.empty){let s=r.resolveStack(o.from,-1);s.node.from>=i.node.from&&s.node.to<=i.node.to&&(i=s)}for(let s=i;s;s=s.next){let{node:l}=s;if((l.from<o.from&&l.to>=o.to||l.to>o.to&&l.from<=o.from)&&s.next)return m.range(l.to,l.from)}return o}
vendor: 5,882 bytes, line 1
1);return n.eq(t.selection)?!1:(e(K(t,n)),!0)},Nr=({state:t,dispatch:e})=>{let n=t.selection,o=null;return n.ranges.length>1?o=m.create([n.main]):n.main.empty||(o=m.create([m.cursor(n.main.head)])),o?(e(K(t,o)),!0):!1};function Ce(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:o}=t,r=o.changeByRange(i=>{let{from:s,to:l}=i;if(s==l){let a=e(i);a<s?(n="delete.backward",a=Me(t,a,!1)):a>s&&(n="delete.forward",a=Me(t,a,!0)),s=Math.min(s,a),l=Math.max(l,a)}else s=Me(t,s,!1),l=Me(t,l,!0);return s==l?{range:i}:{changes:{from:s,to:l},range:m.cursor(s,s<i.head?-1:1)}});return r.changes.empty?!1:(t.dispatch(o.update(r,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?y.announce.of(o.phrase("Selection deleted")):void 0})),!0)}function Me(t,e,n){if(t instanceof y)for(let o of t.state.facet(y.atomicRanges).map(r=>r(t)))o.between(e,e,(r,i)=>{r<e&&i>e&&(e=n?i:r)});return e}const qn=(t,e,n)=>Ce(t,o=>{let r=o.from,{state:i}=t,s=i.doc.lineAt(r),l,a;if(n&&!e&&r>s.from&&r<s.from+200&&!/[^ \t]/.test(l=s.text.slice(0,r-s.from))){if(l[l.length-1]==" ")return r-1;let f=bt(l,i.tabSize),c=f%it(i)||it(i);for(let h=0;h<c&&l[l.length-1-h]==" ";h++)r--;a=r}else a=Y(s.text,r-s.from,e,e)+s.from,a==r&&s.number!=(e?i.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(s.text.slice(a-s.from,r-s.from))&&(a=Y(s.text,a-s.from,!1,!1)+s.from);return a}),ht=t=>qn(t,!1,!0),Un=t=>qn(t,!0,!1),Hn=(t,e)=>Ce(t,n=>{let o=n.head,{state:r}=t,i=r.doc.lineAt(o),s=r.charCategorizer(o);for(let l=null;;){if(o==(e?i.to:i.from)){o==n.head&&i.number!=(e?r.doc.lines:1)&&(o+=e?1:-1);break}let a=Y(i.text,o-i.from,e)+i.from,f=i.text.slice(Math.min(o,a)-i.from,Math.max(o,a)-i.from),c=s(f);if(l!=null&&c!=l)break;(f!=" "||o!=n.head)&&(l=c),o=a}return o}),$n=t=>Hn(t,!1),Fr=t=>Hn(t,!0),qr=t=>Ce(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),Ur=t=>Ce(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),Hr=t=>Ce(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),$r=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(o=>({changes:{from:o.from,to:o.to,insert:sn.of(["",""])},range:m.cursor(o.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Vr=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(o=>{if(!o.empty||o.from==0||o.from==t.doc.length)return{range:o};let r=o.from,i=t.doc.lineAt(r),s=r==i.from?r-1:Y(i.text,r-i.from,!1)+i.from,l=r==i.to?r+1:Y(i.text,r-i.from,!0)+i.from;return{changes:{from:s,to:l,insert:t.doc.slice(r,l).append(t.doc.slice(s,r))},range:m.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Je(t){let e=[],n=-1;for(let o of t.selection.ranges){let r=t.doc.lineAt(o.from),i=t.doc.lineAt(o.to);if(!o.empty&&o.to==i.from&&(i=t.doc.lineAt(o.to-1)),n>=r.number){let s=e[e.length-1];s.to=i.to,s.ranges.push(o)}else e.push({from:r.from,to:i.to,ranges:[o]});n=i.number+1}return e}function Vn(t,e,n){if(t.readOnly)return!1;let o=[],r=[];for(let i of Je(t)){if(n?i.to==t.doc.length:i.from==0)continue;let s=t.doc.lineAt(n?i.to+1:i.from-1),l=s.length+1;if(n){o.push({from:i.to,to:s.to},{from:i.from,insert:s.text+t.lineBreak});for(let a of i.ranges)r.push(m.range(Math.min(t.doc.length,a.anchor+l),Math.min(t.doc.length,a.head+l)))}else{o.push({from:s.from,to:i.from},{from:i.to,insert:t.lineBreak+s.text});for(let a of i.ranges)r.push(m.range(a.anchor-l,a.head-l))}}return o.length?(e(t.update({changes:o,scrollIntoView:!0,selection:m.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const zr=({state:t,dispatch:e})=>Vn(t,e,!1),Kr=({state:t,dispatch:e})=>Vn(t,e,!0);function zn(t,e,n){if(t.readOnly)return!1;let o=[];for(let r of Je(t))n?o.push({from:r.from,insert:t.doc.slice(r.from,r.to)+t.lineBreak}):o.push({from:r.to,insert:t.lineBreak+t.doc.slice(r.from,r.to)});return e(t.update({changes:o,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const jr=({state:t,dispatch:e})=>zn(t,e,!1),Gr=({state:t,dispatch:e})=>zn(t,e,!0),Jr=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Je(e).map(({from:r,to:i})=>(r>0?r--:i<e.doc.length&&i++,{from:r,to:i}))),o=ce(e.selection,r=>{let i;if(t.lineWrapping){let s=t.lineBlockAt(r.head),l=t.coordsAtPos(r.head,r.assoc||1);l&&(i=s.bottom+t.documentTop-l.bottom+t.defaultLineHeight/2)}return t.moveVertically(r,!0,i)}).map(n);return t.dispatch({changes:n,selection:o,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Qr(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=ae(t).resolveInner(e),o=n.childBefore(e),r=n.childAfter(e),i;return o&&r&&o.to<=e&&r.from>=e&&(i=o.type.prop(rt.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(o.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(o.to,r.from))?{from:o.to,to:r.from}:null}const Ht=Kn(!1),_r=Kn(!0);function Kn(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let o=e.changeByRange(r=>{let{from:i,to:s}=r,l=e.doc.lineAt(i),a=!t&&i==s&&Qr(e,i);t&&(i=s=(s<=l.to?l:e.doc.lineAt(s)).to);let f=new on(e,{simulateBreak:i,simulateDoubleBreak:!!a}),c=rn(f,i);for(c==null&&(c=bt(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));s<l.to&&/\s/.test(l.text[s-l.from]);)s++;a?{from:i,to:s}=a:i>l.from&&i<l.from+100&&!/\S/.test(l.text.slice(0,i))&&(i=l.from);let h=["",Te(e,c)];return a&&h.push(Te(e,f.lineIndent(l.from,-1))),{changes:{from:i,to:s,insert:sn.of(h)},range:m.cursor(i+1+h[1].length)}});return n(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0}}function Lt(t,e){let n=-1;return t.changeByRange(o=>{let r=[];for(let s=o.from;s<=o.to;){let l=t.doc.lineAt(s);l.number>n&&(o.empty||o.to>l.from)&&(e(l,r,o),n=l.number),s=l.to+1}let i=t.changes(r);return{changes:r,range:m.range(i.mapPos(o.anchor,1),i.mapPos(o.head,1))}})}const Xr=({state:t,dispatch:e})=>
1{if(t.readOnly)return!1;let n=Object.create(null),o=new on(t,{overrideIndentation:i=>{let s=n[i];return s??-1}}),r=Lt(t,(i,s,l)=>{let a=rn(o,i.from);if(a==null)return;/\S/.test(i.text)||(a=0);let f=/^\s*/.exec(i.text)[0],c=Te(t,a);(f!=c||l.from<i.from+f.length)&&(n[i.from]=a,s.push({from:i.from,to:i.from+f.length,insert:c}))});return r.changes.empty||e(t.update(r,{userEvent:"indent"})),!0},jn=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Lt(t,(n,o)=>{o.push({from:n.from,insert:t.facet(ln)})}),{userEvent:"input.indent"})),!0),Gn=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Lt(t,(n,o)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let i=bt(r,t.tabSize),s=0,l=Te(t,Math.max(0,i-it(t)));for(;s<r.length&&s<l.length&&r.charCodeAt(s)==l.charCodeAt(s);)s++;o.push({from:n.from+s,to:n.from+r.length,insert:l.slice(s)})}),{userEvent:"delete.dedent"})),!0),Yr=t=>(t.setTabFocusMode(),!0),Zr=[{key:"Ctrl-b",run:vn,shift:wn,preventDefault:!0},{key:"Ctrl-f",run:An,shift:In},{key:"Ctrl-p",run:Dn,shift:Wn},{key:"Ctrl-n",run:Bn,shift:Nn},{key:"Ctrl-a",run:Sr,shift:wr},{key:"Ctrl-e",run:Cr,shift:Ir},{key:"Ctrl-d",run:Un},{key:"Ctrl-h",run:ht},{key:"Ctrl-k",run:qr},{key:"Ctrl-Alt-h",run:$n},{key:"Ctrl-o",run:$r},{key:"Ctrl-t",run:Vr},{key:"Ctrl-v",run:ft}],ei=[{key:"ArrowLeft",run:vn,shift:wn,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:hr,shift:Ar,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:xr,shift:Tr,preventDefault:!0},{key:"ArrowRight",run:An,shift:In,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ur,shift:Mr,preventDefault:!0},{mac:"Cmd-ArrowRight",run:br,shift:Or,preventDefault:!0},{key:"ArrowUp",run:Dn,shift:Wn,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Nt,shift:qt},{mac:"Ctrl-ArrowUp",run:Rt,shift:Pt},{key:"ArrowDown",run:Bn,shift:Nn,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Ft,shift:Ut},{mac:"Ctrl-ArrowDown",run:ft,shift:Wt},{key:"PageUp",run:Rt,shift:Pt},{key:"PageDown",run:ft,shift:Wt},{key:"Home",run:yr,shift:Er,preventDefault:!0},{key:"Mod-Home",run:Nt,shift:qt},{key:"End",run:gr,shift:Br,preventDefault:!0},{key:"Mod-End",run:Ft,shift:Ut},{key:"Enter",run:Ht,shift:Ht},{key:"Mod-a",run:Rr},{key:"Backspace",run:ht,shift:ht},{key:"Delete",run:Un},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$n},{key:"Mod-Delete",mac:"Alt-Delete",run:Fr},{mac:"Mod-Backspace",run:Ur},{mac:"Mod-Delete",run:Hr}].concat(Zr.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Jn=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:mr,shift:Lr},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:pr,shift:Dr},{key:"Alt-ArrowUp",run:zr},{key:"Shift-Alt-ArrowUp",run:jr},{key:"Alt-ArrowDown",run:Kr},{key:"Shift-Alt-ArrowDown",run:Gr},{key:"Escape",run:Nr},{key:"Mod-Enter",run:_r},{key:"Alt-l",mac:"Ctrl-l",run:Pr},{key:"Mod-i",run:Wr,preventDefault:!0},{key:"Mod-[",run:Gn},{key:"Mod-]",run:jn},{key:"Mod-Alt-\\",run:Xr},{key:"Shift-Mod-k",run:Jr},{key:"Shift-Mod-\\",run:vr},{key:"Mod-/",run:Jo},{key:"Alt-A",run:_o},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Yr}].concat(ei),ti={key:"Tab",run:jn,shift:Gn},$t=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class le{constructor(e,n,o=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(o,r),this.bufferStart=o,this.normalize=i?l=>i($t(l)):$t,this.query=this.normalize(n)}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 R(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 n=kt(e),o=this.bufferStart+this.bufferPos;this.bufferPos+=G(e);let r=this.normalize(n);if(r.length)for(let i=0,s=o;;i++){let l=r.charCodeAt(i),a=this.match(l,s,this.bufferPos+this.bufferStart);if(i==r.length-1){if(a)return this.value=a,this;break}s==o&&i<n.length&&n.charCodeAt(i)==l&&s++}}}match(e,n,o){let r=null;for(let i=0;i<this.matches.length;i+=2){let s=this.matches[i],l=!1;
1this.query.charCodeAt(s)==e&&(s==this.query.length-1?r={from:this.matches[i+1],to:o}:(this.matches[i]++,l=!0)),l||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:n,to:o}:this.matches.push(1,n)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}}typeof Symbol<"u"&&(le.prototype[Symbol.iterator]=function(){return this});const Qn={from:-1,to:-1,match:/.*/.exec("")},Dt="gm"+(/x/.unicode==null?"":"u");class _n{constructor(e,n,o,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=Qn,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new Xn(e,n,o,r,i);this.re=new RegExp(n,Dt+(o!=null&&o.ignoreCase?"i":"")),this.test=o==null?void 0:o.test,this.iter=e.iter();let s=e.lineAt(r);this.curLineStart=s.from,this.matchPos=Ie(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.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 n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let o=this.curLineStart+n.index,r=o+n[0].length;if(this.matchPos=Ie(this.text,r+(o==r?1:0)),o==this.curLineStart+this.curLine.length&&this.nextLine(),(o<r||o>this.value.to)&&(!this.test||this.test(o,r,n)))return this.value={from:o,to:r,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const et=new WeakMap;class ie{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,o){let r=et.get(e);if(!r||r.from>=o||r.to<=n){let l=new ie(n,e.sliceString(n,o));return et.set(e,l),l}if(r.from==n&&r.to==o)return r;let{text:i,from:s}=r;return s>n&&(i=e.sliceString(n,s)+i,s=n),r.to<o&&(i+=e.sliceString(r.to,o)),et.set(e,new ie(s,i)),new ie(n,i.slice(n-s,o-s))}}class Xn{constructor(e,n,o,r,i){this.text=e,this.to=i,this.done=!1,this.value=Qn,this.matchPos=Ie(e,r),this.re=new RegExp(n,Dt+(o!=null&&o.ignoreCase?"i":"")),this.test=o==null?void 0:o.test,this.flat=ie.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let o=this.flat.from+n.index,r=o+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(o,r,n)))return this.value={from:o,to:r,match:n},this.matchPos=Ie(this.text,r+(o==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ie.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(_n.prototype[Symbol.iterator]=Xn.prototype[Symbol.iterator]=function(){return this});function ni(t){try{return new RegExp(t,Dt),!0}catch{return!1}}function Ie(t,e){if(e>=t.length)return e;let n=t.lineAt(e),o;for(;e<n.to&&(o=n.text.charCodeAt(e-n.from))>=56320&&o<57344;)e++;return e}function ut(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=v("input",{class:"cm-textfield",name:"line",value:e}),o=v("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:Re.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),r())},onsubmit:i=>{i.preventDefault(),r()}},v("label",t.state.phrase("Go to line"),": ",n)," ",v("button",{class:"cm-button",type:"submit"},t.state.phrase("go")));function r(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:s}=t,l=s.doc.lineAt(s.selection.main.head),[,a,f,c,h]=i,u=c?+c.slice(1):0,p=f?+f:l.number;if(f&&h){let w=p/100;a&&(w=w*(a=="-"?-1:1)+l.number/s.doc.lines),p=Math.round(s.doc.lines*w)}else f&&a&&(p=p*(a=="-"?-1:1)+l.number);let g=s.doc.line(Math.max(1,Math.min(s.doc.lines,p))),b=m.cursor(g.from+Math.max(0,Math.min(u,g.length)));t.dispatch({effects:[Re.of(!1),y.scrollIntoView(b.from,{y:"center"})],selection:b}),t.focus()}return{dom:o}}const Re=O.define(),Vt=Se.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(Re)&&(t=n.value);return t},provide:t=>cn.from(t,e=>e?ut:null)}),oi=t=>{let e=Oe(t,ut);if(!e){let n=[Re.of(!0)];t.state.field(Vt,!1)==null&&n.push(O.appendConfig.of([Vt,ri])),t.dis
vendor: 9,043 bytes, lines 1-2
1patch({effects:n}),e=Oe(t,ut)}return e&&e.dom.querySelector("input").select(),!0},ri=y.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),ii={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},si=be.define({combine(t){return $e(t,ii,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function li(t){return[ui,hi]}const ai=T.mark({class:"cm-selectionMatch"}),ci=T.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function zt(t,e,n,o){return(n==0||t(e.sliceDoc(n-1,n))!=M.Word)&&(o==e.doc.length||t(e.sliceDoc(o,o+1))!=M.Word)}function fi(t,e,n,o){return t(e.sliceDoc(n,n+1))==M.Word&&t(e.sliceDoc(o-1,o))==M.Word}const hi=St.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(si),{state:n}=t,o=n.selection;if(o.ranges.length>1)return T.none;let r=o.main,i,s=null;if(r.empty){if(!e.highlightWordAroundCursor)return T.none;let a=n.wordAt(r.head);if(!a)return T.none;s=n.charCategorizer(r.head),i=n.sliceDoc(a.from,a.to)}else{let a=r.to-r.from;if(a<e.minSelectionLength||a>200)return T.none;if(e.wholeWords){if(i=n.sliceDoc(r.from,r.to),s=n.charCategorizer(r.head),!(zt(s,n,r.from,r.to)&&fi(s,n,r.from,r.to)))return T.none}else if(i=n.sliceDoc(r.from,r.to),!i)return T.none}let l=[];for(let a of t.visibleRanges){let f=new le(n.doc,i,a.from,a.to);for(;!f.next().done;){let{from:c,to:h}=f.value;if((!s||zt(s,n,c,h))&&(r.empty&&c<=r.from&&h>=r.to?l.push(ci.range(c,h)):(c>=r.to||h<=r.from)&&l.push(ai.range(c,h)),l.length>e.maxMatches))return T.none}}return T.set(l)}},{decorations:t=>t.decorations}),ui=y.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),di=({state:t,dispatch:e})=>{let{selection:n}=t,o=m.create(n.ranges.map(r=>t.wordAt(r.head)||m.cursor(r.head)),n.mainIndex);return o.eq(n)?!1:(e(t.update({selection:o})),!0)};function mi(t,e){let{main:n,ranges:o}=t.selection,r=t.wordAt(n.head),i=r&&r.from==n.from&&r.to==n.to;for(let s=!1,l=new le(t.doc,e,o[o.length-1].to);;)if(l.next(),l.done){if(s)return null;l=new le(t.doc,e,0,Math.max(0,o[o.length-1].from-1)),s=!0}else{if(s&&o.some(a=>a.from==l.value.from))continue;if(i){let a=t.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const pi=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return di({state:t,dispatch:e});let o=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=o))return!1;let r=mi(t,o);return r?(e(t.update({selection:t.selection.addRange(m.range(r.from,r.to),!1),effects:y.scrollIntoView(r.to)})),!0):!1},fe=be.define({combine(t){return $e(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Di(e),scrollToMatch:e=>y.scrollIntoView(e)})}});class Yn{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||ni(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,o)=>o=="n"?` 2`:o=="r"?"\r":o=="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 bi(this):new yi(this)}getCursor(e,n=0,o){let r=e.doc?e:pe.create({doc:e});return o==null&&(o=r.doc.length),this.regexp?ne(this,r,n,o):te(this,r,n,o)}}class Zn{constructor(e){this.spec=e}}function te(t,e,n,o){return new le(e.doc,t.unquoted,n,o,t.caseSensitive?void 0:r=>r.toLowerCase(),t.wholeWord?gi(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function gi(t,e){return(n,o,r,i)=>((i>n||i+r.length<o)&&(i=Math.max(0,n-2),r=t.sliceString(i,Math.min(t.length,o+2))),(e(Pe(r,n-i))!=M.Word||e(We(r,n-i))!=M.Word)&&(e(We(r,o-i))!=M.Word||e(Pe(r,o-i))!=M.Word))}class yi extends Zn{constructor(e){super(e)}nextMatch(e,n,o){let r=te(this.spec,e,o,e.doc.length).nextOverlapping();if(r.done){let i=Math.min(e.doc.length,n+this.spec.unquoted.length);r=te(this.spec,e,0,i).nextOverlapping()}return r.done||r.value.from==n&&r.value.to==o?null:r.value}prevMatchInRange(e,n,o){for(let r=o;;){let i=Math.max(n,r-1e4-this.spec.unquoted.length),s=te(this.spec,e,i,r),l=null;for(;!s.nextOverlapping().done;)l=s.value;if(l)return l;if(i==n)return null;r-=1e4}}prevMatch(e,n,o){let r=this.prevMatchInRange(e,0,n);return r||(r=this.prevMatchInRange(e,Math.max(0,o-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=n||r.to!=o)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let o=te(this.spec,e,0,e.doc.length),r=[];for(;!o.next().done;){if(r.length>=n)return null;r.push(o.value)}return r}highlight(e,n,o,r){let i=te(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(o+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function ne(t,e,n,o){return new _n(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?xi(e.charCategorizer(e.selection.main.head)):void 0},n,o)}function Pe(t,e){return t.slice(Y(t,e,!1),e)}function We(t,e){return t.slice(e,Y(t,e))}function xi(t){return(e,n,o)=>!o[0].length||(t(Pe(o.input,o.index))!=M.Word||t(We(o.input,o.index))!=M.Word)&&(t(We(o.input,o.index+o[0].length))!=M.Word||t(Pe(o.input,o.index+o[0].length))!=M.Word)}class bi extends Zn{nextMatch(e,n,o){let r=ne(this.spec,e,o,e.doc.length).next();return r.done&&(r=ne(this.spec,e,0,n).next()),r.done?null:r.value}prevMatchInRange(e,n,o){for(let r=1;;r++){let i=Math.max(n,o-r*1e4),s=ne(this.spec,e,i,o),l=null;for(;!s.next().done;)l=s.value;if(l&&(i==n||l.from>i+10))return l;if(i==n)return null}}prevMatch(e,n,o){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,o,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(n,o)=>o=="$"?"$":o=="&"?e.match[0]:o!="0"&&+o<e.match.length?e.match[o]:n)}matchAll(e,n){let o=ne(this.spec,e,0,e.doc.length),r=[];for(;!o.next().done;){if(r.length>=n)return null;r.push(o.value)}return r}highlight(e,n,o,r){let i=ne(this.spec,e,Math.max(0,n-250),Math.min(o+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}const ge=O.define(),Bt=O.define(),J=Se.define({create(t){return new tt(dt(t).create(),null)},update(t,e){for(let n of e.effects)n.is(ge)?t=new tt(n.value.create(),t.panel):n.is(Bt)&&(t=new tt(t.query,n.value?Et:null));return t},provide:t=>cn.from(t,e=>e.panel)});class tt{constructor(e,n){this.query=e,this.panel=n}}const Si=T.mark({class:"cm-searchMatch"}),Ci=T.mark({class:"cm-searchMatch cm-searchMatch-selected"}),ki=St.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(J))}update(t){let e=t.state.field(J);(e!=t.startState.field(J)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return T.none;let{view:n}=this,o=new Bo;for(let r=0,i=n.visibleRanges,s=i.length;r<s;r++){let{from:l,to:a}=i[r];for(;r<s-1&&a>i[r+1].from-2*250;)a=i[++r].to;t.highlight(n.state,l,a,(f,c)=>{let h=n.state.selection.ranges.some(u=>u.from==f&&u.to==c);o.add(f,c,h?Ci:Si)})}return o.finish()}},{decorations:t=>t.decorations});function ke(t){return e=>{let n=e.state.field(J,!1);return n&&n.query.spec.valid?t(e,n):no(e)}}const Ne=ke((t,{query:e})=>{let{to:n}=t.state.selection.main,o=e.nextMatch(t.state,n,n);if(!o)return!1;let r=m.single(o.from,o.to),i=t.state.facet(fe);return t.dispatch({selection:r,effects:[Tt(t,o),i.scrollToMatch(r.main,t)],userEvent:"select.search"}),to(t),!0}),Fe=ke((t,{query:e})=>{let{state:n}=t,{from:o}=n.selection.main,r=e.prevMatch(n,o,o);if(!r)return!1;let i=m.single(r.from,r.to),s=t.state.facet(fe);return t.dispatch({selection:i,effects:[Tt(t,r),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),to(t),!0}),vi=ke((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:m.create(n.map(o=>m.range(o.from,o.to))),userEvent:"select.search.matches"}),!0)}),Ai=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:o,to:r}=n.main,i=[],s=0;for(let l=new le(t.doc,t.sliceDoc(o,r));!l.next().done;){if(i.length>1e3)return!1;l.value.from==o&&(s=i.length),i.push(m.range(l.value.from,l.value.to))}return e(t.update({selection:m.create(i,s),userEvent:"select.search.matches"})),!0},Kt=ke((t,{query:e})=>{let{state:n}=t,{from:o,to:r}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,o,o);if(!i)return!1;let s=[],l,a,f=[];if(i.from==o&&i.to==r&&(a=n.toText(e.getReplacement(i)),s.push({from:i.from,to:i.to,insert:a}),i=e.nextMatch(n,i.from,i.to),f.push(y.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(o).number)+"."))),i){let c=s.length==0||s[0].from>
2=i.to?0:i.to-i.from-a.length;l=m.single(i.from-c,i.to-c),f.push(Tt(t,i)),f.push(n.facet(fe).scrollToMatch(l.main,t))}return t.dispatch({changes:s,selection:l,effects:f,userEvent:"input.replace"}),!0}),Mi=ke((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(r=>{let{from:i,to:s}=r;return{from:i,to:s,insert:e.getReplacement(r)}});if(!n.length)return!1;let o=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:y.announce.of(o),userEvent:"input.replace.all"}),!0});function Et(t){return t.state.facet(fe).createPanel(t)}function dt(t,e){var n,o,r,i,s;let l=t.selection.main,a=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!a)return e;let f=t.facet(fe);return new Yn({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:f.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(o=e==null?void 0:e.caseSensitive)!==null&&o!==void 0?o:f.caseSensitive,literal:(r=e==null?void 0:e.literal)!==null&&r!==void 0?r:f.literal,regexp:(i=e==null?void 0:e.regexp)!==null&&i!==void 0?i:f.regexp,wholeWord:(s=e==null?void 0:e.wholeWord)!==null&&s!==void 0?s:f.wholeWord})}function eo(t){let e=Oe(t,Et);return e&&e.dom.querySelector("[main-field]")}function to(t){let e=eo(t);e&&e==t.root.activeElement&&e.select()}const no=t=>{let e=t.state.field(J,!1);if(e&&e.panel){let n=eo(t);if(n&&n!=t.root.activeElement){let o=dt(t.state,e.query.spec);o.valid&&t.dispatch({effects:ge.of(o)}),n.focus(),n.select()}}else t.dispatch({effects:[Bt.of(!0),e?ge.of(dt(t.state,e.query.spec)):O.appendConfig.of(Ei)]});return!0},oo=t=>{let e=t.state.field(J,!1);if(!e||!e.panel)return!1;let n=Oe(t,Et);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Bt.of(!1)}),!0},Li=[{key:"Mod-f",run:no,scope:"editor search-panel"},{key:"F3",run:Ne,shift:Fe,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Ne,shift:Fe,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:oo,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Ai},{key:"Mod-Alt-g",run:oi},{key:"Mod-d",run:pi,preventDefault:!0}];class Di{constructor(e){this.view=e;let n=this.query=e.state.field(J).query.spec;this.commit=this.commit.bind(this),this.searchField=v("input",{value:n.search,placeholder:E(e,"Find"),"aria-label":E(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=v("input",{value:n.replace,placeholder:E(e,"Replace"),"aria-label":E(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=v("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=v("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=v("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function o(r,i,s){return v("button",{class:"cm-button",name:r,onclick:i,type:"button"},s)}this.dom=v("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,o("next",()=>Ne(e),[E(e,"next")]),o("prev",()=>Fe(e),[E(e,"previous")]),o("select",()=>vi(e),[E(e,"all")]),v("label",null,[this.caseField,E(e,"match case")]),v("label",null,[this.reField,E(e,"regexp")]),v("label",null,[this.wordField,E(e,"by word")]),...e.state.readOnly?[]:[v("br"),this.replaceField,o("replace",()=>Kt(e),[E(e,"replace")]),o("replaceAll",()=>Mi(e),[E(e,"replace all")])],v("button",{name:"close",onclick:()=>oo(e),"aria-label":E(e,"close"),type:"button"},["Ã"])])}commit(){let e=new Yn({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:ge.of(e)}))}keydown(e){Eo(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Fe:Ne)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Kt(this.view))}update(e){for(let n of e.transactions)for(let o of n.effects)o.is(ge)&&!o.value.eq(this.query)&&this.setQuery(o.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(fe).top}}function E(t,e){return t.state.phrase(e)}const Le=30,De=/[\s\.,:;?!]/;function Tt(t,{from:e,to:n}){let o=t.state.doc.lineAt(e),r=t.state.doc.lineAt(n).to,i=Math.max(o.from,e-Le),s=Math.min(r,n+Le),l=t.state.sliceDoc(i,s);if(i!=o.from){for(let a=0;a<Le;a++)if(!De.test(l[a+1])&&De.test(l[a])){l=l.slice(a);break}}if(s!=r){for(let a=l.length-1;a>l.length-Le;a--)if(!De.test(l[a-1])&&De.test(l[a])){l=l.slice(0,a);break}}return y.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${o.number}.`)}const Bi=y.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"}}),Ei=[J,Ct.low(ki),Bi];class ro{constructor(e,n,o,r){this.state=e,this.pos=n,this.explicit=o,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=ae(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),o=Math.max(n.from,this.pos-250),r=n.text.slice(o-n.from,this.pos-n.from),i=r.search(io(e,!1));return i<0?null:{from:o+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,o){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),o&&o.onDocChange&&(this.abortOnDocChange=!0))}}function jt(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Ti(t){let e=Object.create(null),n=Object.create(null);for(let{label:r}of t){e[r[0]]=!0;for(let i=1;i<r.length;i++)n[r[i]]=!0}let o=jt(e)+jt(n)+"*$";
vendor: 25,024 bytes, line 2
2return[new RegExp("^"+o),new RegExp(o)]}function Oi(t){let e=t.map(r=>typeof r=="string"?{label:r}:r),[n,o]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:Ti(e);return r=>{let i=r.matchBefore(o);return i||r.explicit?{from:i?i.from:r.pos,options:e,validFor:n}:null}}class Gt{constructor(e,n,o,r){this.completion=e,this.source=n,this.match=o,this.score=r}}function X(t){return t.selection.main.from}function io(t,e){var n;let{source:o}=t,r=e&&o[0]!="^",i=o[o.length-1]!="$";return!r&&!i?t:new RegExp(`${r?"^":""}(?:${o})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const so=Ve.define();function wi(t,e,n,o){let{main:r}=t.selection,i=n-r.from,s=o-r.from;return Object.assign(Object.assign({},t.changeByRange(l=>{if(l!=r&&n!=o&&t.sliceDoc(l.from+i,l.from+s)!=t.sliceDoc(n,o))return{range:l};let a=t.toText(e);return{changes:{from:l.from+i,to:o==r.from?l.to:l.from+s,insert:a},range:m.cursor(l.from+i+a.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}const Jt=new WeakMap;function Ii(t){if(!Array.isArray(t))return t;let e=Jt.get(t);return e||Jt.set(t,e=Oi(t)),e}const qe=O.define(),ye=O.define();class Ri{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let o=R(e,n),r=G(o);this.chars.push(o);let i=e.slice(n,n+r),s=i.toUpperCase();this.folded.push(R(s==i?i.toLowerCase():s,0)),n+=r}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:o,any:r,precise:i,byWord:s}=this;if(n.length==1){let x=R(e,0),F=G(x),L=F==e.length?0:-100;if(x!=n[0])if(x==o[0])L+=-200;else return null;return this.ret(L,[0,F])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=n.length,f=0;if(l<0){for(let x=0,F=Math.min(e.length,200);x<F&&f<a;){let L=R(e,x);(L==n[f]||L==o[f])&&(r[f++]=x),x+=G(L)}if(f<a)return null}let c=0,h=0,u=!1,p=0,g=-1,b=-1,w=/[a-z]/.test(e),H=!0;for(let x=0,F=Math.min(e.length,200),L=0;x<F&&h<a;){let S=R(e,x);l<0&&(c<a&&S==n[c]&&(i[c++]=x),p<a&&(S==n[p]||S==o[p]?(p==0&&(g=x),b=x+1,p++):p=0));let $,V=S<255?S>=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:($=kt(S))!=$.toLowerCase()?1:$!=$.toUpperCase()?2:0;(!x||V==1&&w||L==0&&V!=0)&&(n[h]==S||o[h]==S&&(u=!0)?s[h++]=x:s.length&&(H=!1)),L=V,x+=G(S)}return h==a&&s[0]==0&&H?this.result(-100+(u?-200:0),s,e):p==a&&g==0?this.ret(-200-e.length+(b==e.length?0:-100),[0,b]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):p==a?this.ret(-900-e.length,[g,b]):h==a?this.result(-100+(u?-200:0)+-700+(H?0:-1100),s,e):n.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,n,o){let r=[],i=0;for(let s of n){let l=s+(this.astral?G(R(o,s)):1);i&&r[i-1]==s?r[i-1]=l:(r[i++]=s,r[i++]=l)}return this.ret(e-o.length,r)}}class Pi{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),o=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return o==null?null:(this.matched=[0,n.length],this.score=o+(e.length==this.pattern.length?0:-100),this)}}const k=be.define({combine(t){return $e(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Wi,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>o=>Qt(e(o),n(o)),optionClass:(e,n)=>o=>Qt(e(o),n(o)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function Qt(t,e){return t?e?t+" "+e:t:e}function Wi(t,e,n,o,r,i){let s=t.textDirection==an.RTL,l=s,a=!1,f="top",c,h,u=e.left-r.left,p=r.right-e.right,g=o.right-o.left,b=o.bottom-o.top;if(l&&u<Math.min(g,p)?l=!1:!l&&p<Math.min(g,u)&&(l=!0),g<=(l?u:p))c=Math.max(r.top,Math.min(n.top,r.bottom-b))-e.top,h=Math.min(400,l?u:p);else{a=!0,h=Math.min(400,(s?e.right:r.right-e.left)-30);let x=r.bottom-e.bottom;x>=b||x>e.top?c=n.bottom-e.top:(f="bottom",c=e.bottom-n.top)}let w=(e.bottom-e.top)/i.offsetHeight,H=(e.right-e.left)/i.offsetWidth;return{style:`${f}: ${c/w}px; max-width: ${h/H}px`,class:"cm-completionInfo-"+(a?s?"left-narrow":"right-narrow":l?"left":"right")}}function Ni(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let o=document.createElement("div");return o.classList.add("cm-completionIcon"),n.type&&o.classList.add(...n.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),o.setAttribute("aria-hidden","true"),o},position:20}),e.push({render(n,o,r,i){let s=document.createElement("span");s.className="cm-completionLabel";let l=n.displayLabel||n.label,a=0;for(let f=0;f<i.length;){let c=i[f++],h=i[f++];c>a&&s.appendChild(document.createTextNode(l.slice(a,c)));let u=s.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,h))),u.className="cm-completionMatchedText",a=h}return a<l.length&&s.appendChild(document.createTextNode(l.slice(a))),s},position:50},{render(n){if(!n.detail)return null;let o=document.createElement("span");return o.className="cm-completionDetail",o.textContent=n.detail,o},position:80}),e.sort((n,o)=>n.position-o.position).map(n=>n.render)}function nt(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let r=Math.floor(e/n);return{from:r*n,to:(r+1)*n}}let o=Math.floor((t-e)/n);return{from:t-(o+1)*n,to:t-o*n}}class Fi{constructor(e,n,o){this.view=e,this.stateField=n,this.applyCompletion=o,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let r=e.state.field(n),{options:i,selected:s}=r.open,l=e.state.facet(k);this.optionContent=Ni(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=nt(i.length,s,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:f}=e.state.field(n).open;for(let c=a.target,h;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(h=/-(\d+)$/.exec(c.id))&&+h[1]<f.length){this.applyCompletion(e,f[+h[1]]),a.preventDefault();return}}),this.dom.addEventListener("focusout",a=>{let f=e.state.field(this.stateField,!1);f&&f.tooltip&&e.state.facet(k).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:ye.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let o=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),o!=r){let{options:i,selected:s,disabled:l}=o.open;(!r.open||r.open.options!=i)&&(this.range=nt(i.length,s,e.state.facet(k).maxRenderedOptions),this.showOptions(i,o.id)),this.updateSel(),l!=((n=r.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let o of this.currentClass.split(" "))o&&this.dom.classList.remove(o);for(let o of n.split(" "))o&&this.dom.classList.add(o);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;if((n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=nt(n.options.length,n.selected,this.view.state.facet(k).maxRenderedOptions),this.showOptions(n.options,e.id)),this.updateSelectedOption(n.selected)){this.destroyInfo();let{completion:o}=n.options[n.selected],{info:r}=o;if(!r)return;let i=typeof r=="string"?document.createTextNode(r):r(o);if(!i)return;"then"in i?i.then(s=>{s&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(s,o)}).catch(s=>st(this.view.state,s,"completion info")):this.addInfoPane(i,o)}}addInfoPane(e,n){this.destroyInfo();let o=this.info=document.createElement("div");if(o.className="cm-tooltip cm-completionInfo",e.nodeType!=null)o.appendChild(e),this.infoDestroy=null;else{let{dom:r,destroy:i}=e;o.appendChild(r),this.infoDestroy=i||null}this.dom.appendChild(o),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let o=this.list.firstChild,r=this.range.from;o;o=o.nextSibling,r++)o.nodeName!="LI"||!o.id?r--:r==e?o.hasAttribute("aria-selected")||(o.setAttribute("aria-selected","true"),n=o):o.hasAttribute("aria-selected")&&o.removeAttribute("aria-selected");return n&&Ui(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),o=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let s=this.dom.ownerDocument.defaultView||window;i={left:0,top:0,right:s.innerWidth,bottom:s.innerHeight}}return r.top>Math.min(i.bottom,n.bottom)-10||r.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(k).positionInfo(this.view,n,r,o,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,o){const r=document.createElement("ul");r.id=n,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions"));let i=null;for(let s=o.from;s<o.to;s++){let{completion:l,match:a}=e[s],{section:f}=l;if(f){let u=typeof f=="string"?f:f.name;if(u!=i&&(s>o.from||o.from==0))if(i=u,typeof f!="string"&&f.header)r.appendChild(f.header(f));else{let p=r.appendChild(document.createElement("completion-section"));p.textContent=u}}const c=r.appendChild(document.createElement("li"));c.id=n+"-"+s,c.setAttribute("role","option");let h=this.optionClass(l);h&&(c.className=h);for(let u of this.optionContent){let p=u(l,this.view.state,this.view,a);p&&c.appendChild(p)}}return o.from&&r.classList.add("cm-completionListIncompleteTop"),o.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function qi(t,e){return n=>new Fi(n,t,e)}function Ui(t,e){let n=t.getBoundingClientRect(),o=e.getBoundingClientRect(),r=n.height/t.offsetHeight;o.top<n.top?t.scrollTop-=(n.top-o.top)/r:o.bottom>n.bottom&&(t.scrollTop+=(o.bottom-n.bottom)/r)}function _t(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Hi(t,e){let n=[],o=null,r=f=>{n.push(f);let{section:c}=f.completion;if(c){o||(o=[]);let h=typeof c=="string"?c:c.name;o.some(u=>u.name==h)||o.push(typeof c=="string"?{name:h}:c)}},i=e.facet(k);for(let f of t)if(f.hasResult()){let c=f.result.getMatch;if(f.result.filter===!1)for(let h of f.result.options)r(new Gt(h,f.source,c?c(h):[],1e9-n.length));else{let h=e.sliceDoc(f.from,f.to),u,p=i.filterStrict?new Pi(h):new Ri(h);for(let g of f.result.options)if(u=p.match(g.label)){let b=g.displayLabel?c?c(g,u.matched):[]:u.matched;r(new Gt(g,f.source,b,u.score+(g.boost||0)))}}}if(o){let f=Object.create(null),c=0,h=(u,p)=>{var g,b;return((g=u.rank)!==null&&g!==void 0?g:1e9)-((b=p.rank)!==null&&b!==void 0?b:1e9)||(u.name<p.name?-1:1)};for(let u of o.sort(h))c-=1e5,f[u.name]=c;for(let u of n){let{section:p}=u.completion;p&&(u.score+=f[typeof p=="string"?p:p.name])}}let s=[],l=null,a=i.compareCompletions;for(let f of n.sort((c,h)=>h.score-c.score||a(c.completion,h.completion))){let c=f.completion;!l||l.label!=c.label||l.detail!=c.detail||l.type!=null&&c.type!=null&&l.type!=c.type||l.apply!=c.apply||l.boost!=c.boost?s.push(f):_t(f.completion)>_t(l)&&(s[s.length-1]=f),l=f.completion}return s}class re{constructor(e,n,o,r,i,s){this.options=e,this.attrs=n,this.tooltip=o,this.timestamp=r,this.selected=i,this.disabled=s}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new re(this.options,Xt(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,o,r,i,s){if(r&&!s&&e.some(f=>f.isPending))return r.setDisabled();let l=Hi(e,n);if(!l.length)return r&&e.some(f=>f.isPending)?r.setDisabled():null;let a=n.facet(k).selectOnOpen?0:-1;if(r&&r.selected!=a&&r.selected!=-1){let f=r.options[r.selected].completion;for(let c=0;c<l.length;c++)if(l[c].completion==f){a=c;break}}return new re(l,Xt(o,a),{pos:e.reduce((f,c)=>c.hasResult()?Math.min(f,c.from):f,1e8),create:Gi,above:i.aboveCursor},r?r.timestamp:Date.now(),a,!1)}map(e){return new re(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 re(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Ue{constructor(e,n,o){this.active=e,this.id=n,this.open=o}static start(){return new Ue(Ki,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,o=n.facet(k),i=(o.override||n.languageDataAt("autocomplete",X(n)).map(Ii)).map(a=>(this.active.find(c=>c.source==a)||new W(a,this.active.some(c=>c.state!=0)?1:0)).update(e,o));i.length==this.active.length&&i.every((a,f)=>a==this.active[f])&&(i=this.active);let s=this.open,l=e.effects.some(a=>a.is(Ot));s&&e.docChanged&&(s=s.map(e.changes)),e.selection||i.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!$i(i,this.active)||l?s=re.build(i,n,this.id,s,o,l):s&&s.disabled&&!i.some(a=>a.isPending)&&(s=null),!s&&i.every(a=>!a.isPending)&&i.some(a=>a.hasResult())&&(i=i.map(a=>a.hasResult()?new W(a.source,0):a));for(let a of e.effects)a.is(ao)&&(s=s&&s.setSelected(a.value,this.id));return i==this.active&&s==this.open?this:new Ue(i,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Vi:zi}}function $i(t,e){if(t==e)return!0;for(let n=0,o=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;o<e.length&&!e[o].hasResult();)o++;let r=n==t.length,i=o==e.length;if(r||i)return r==i;if(t[n++].result!=e[o++].result)return!1}}const Vi={"aria-autocomplete":"list"},zi={};function Xt(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const Ki=[];function lo(t,e){if(t.isUserEvent("input.complete")){let o=t.annotation(so);if(o&&e.activateOnCompletion(o))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class W{constructor(e,n,o=!1){this.source=e,this.state=n,this.explicit=o}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let o=lo(e,n),r=this;(o&8||o&16&&this.touches(e))&&(r=new W(r.source,0)),o&4&&r.state==0&&(r=new W(this.source,1)),r=r.updateFor(e,o);for(let i of e.effects)if(i.is(qe))r=new W(r.source,1,i.value);else if(i.is(ye))r=new W(r.source,0);else if(i.is(Ot))for(let s of i.value)s.source==r.source&&(r=s);return r}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(X(e.state))}}class se extends W{constructor(e,n,o,r,i,s){super(e,3,n),this.limit=o,this.result=r,this.from=i,this.to=s}hasResult(){return!0}updateFor(e,n){var o;if(!(n&3))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),l=X(e.state);if(l>s||!r||n&2&&(X(e.startState)==this.from||l<this.limit))return new W(this.source,n&4?1:0);let a=e.changes.mapPos(this.limit);return ji(r.validFor,e.state,i,s)?new se(this.source,this.explicit,a,r,i,s):r.update&&(r=r.update(r,i,s,new ro(e.state,l,!1)))?new se(this.source,this.explicit,a,r,r.from,(o=r.to)!==null&&o!==void 0?o:X(e.state)):new W(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new se(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new W(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function ji(t,e,n,o){if(!t)return!1;let r=e.sliceDoc(n,o);return typeof t=="function"?t(r,n,o,e):io(t,!0).test(r)}const Ot=O.define({map(t,e){return t.map(n=>n.map(e))}}),ao=O.define(),D=Se.define({create(){return Ue.start()},update(t,e){return t.update(e)},provide:t=>[To.from(t,e=>e.tooltip),y.contentAttributes.from(t,e=>e.attrs)]});function wt(t,e){const n=e.completion.apply||e.completion.label;let o=t.state.field(D).active.find(r=>r.source==e.source);return o instanceof se?(typeof n=="string"?t.dispatch(Object.assign(Object.assign({},wi(t.state,n,o.from,o.to)),{annotations:so.of(e.completion)})):n(t,e.completion,o.from,o.to),!0):!1}const Gi=qi(D,wt);function Be(t,e="option"){return n=>{let o=n.state.field(D,!1);if(!o||!o.open||o.open.disabled||Date.now()-o.open.timestamp<n.state.facet(k).interactionDelay)return!1;let r=1,i;e=="page"&&(i=fn(n,o.open.tooltip))&&(r=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:s}=o.open.options,l=o.open.selected>-1?o.open.selected+r*(t?1:-1):t?0:s-1;return l<0?l=e=="page"?0:s-1:l>=s&&(l=e=="page"?s-1:0),n.dispatch({effects:ao.of(l)}),!0}}const Ji=t=>{let e=t.state.field(D,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(k).interactionDelay?!1:wt(t,e.open.options[e.open.selected])},Yt=t=>t.state.field(D,!1)?(t.dispatch({effects:qe.of(!0)}),!0):!1,Qi=t=>{let e=t.state.field(D,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:ye.of(null)}),!0)};class _i{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Xi=50,Yi=1e3,Zi=St.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(D).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(D),n=t.state.facet(k);if(!t.selectionSet&&!t.docChanged&&t.startState.field(D)==e)return;let o=t.transactions.some(i=>{let s=lo(i,n);return s&8||(i.selection||i.docChanged)&&!(s&3)});for(let i=0;i<this.running.length;i++){let s=this.running[i];if(o||s.context.abortOnDocChange&&t.docChanged||s.updates.length+t.transactions.length>Xi&&Date.now()-s.time>Yi){for(let l of s.context.abortListeners)try{l()}catch(a){st(this.view.state,a)}s.context.abortListeners=null,this.running.splice(i--,1)}else s.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(s=>s.is(qe)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(s=>s.active.source==i.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(D);for(let n of e.active)n.isPending&&!this.running.some(o=>o.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(k).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=X(e),o=new ro(e,n,t.explicit,this.view),r=new _i(t,o);this.running.push(r),Promise.resolve(t.source(o)).then(i=>{r.context.aborted||(r.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:ye.of(null)}),st(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(k).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(k),o=this.view.state.field(D);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let l=X(i.updates.length?i.updates[0].startState:this.view.state),a=Math.min(l,i.done.from+(i.active.explicit?0:1)),f=new se(i.active.source,i.active.explicit,a,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:l);for(let c of i.updates)f=f.update(c,n);if(f.hasResult()){e.push(f);continue}}let s=o.active.find(l=>l.source==i.active.source);if(s&&s.isPending)if(i.done==null){let l=new W(i.active.source,0);for(let a of i.updates)l=l.update(a,n);l.isPending||e.push(l)}else this.startQuery(s)}(e.length||o.open&&o.open.disabled)&&this.view.dispatch({effects:Ot.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(D,!1);if(e&&e.tooltip&&this.view.state.facet(k).closeOnBlur){let n=e.open&&fn(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:ye.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:qe.of(!1)}),20),this.composing=0}}}),es=typeof navigator=="object"&&/Win/.test(navigator.platform),ts=Ct.highest(y.domEventHandlers({keydown(t,e){let n=e.state.field(D,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(es&&t.altKey)||t.metaKey)return!1;let o=n.open.options[n.open.selected],r=n.active.find(s=>s.source==o.source),i=o.completion.commitCharacters||r.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&wt(e,o),!1}})),ns=y.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:'"···"',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:"'ð¥'"}},".cm-completionIcon-constant":{"&:after":{content:"'ð¶'"}},".cm-completionIcon-type":{"&:after":{content:"'ð¡'"}},".cm-completionIcon-enum":{"&:after":{content:"'âª'"}},".cm-completionIcon-property":{"&:after":{content:"'â¡'"}},".cm-completionIcon-keyword":{"&:after":{content:"'ðï¸'"}},".cm-completionIcon-namespace":{"&:after":{content:"'â¢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),xe={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},_=O.define({map(t,e){let n=e.mapPos(t,-1,Oo.TrackAfter);return n??void 0}}),It=new class extends wo{};It.startSide=1;It.endSide=-1;const co=Se.define({create(){return Io.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:o=>o>=n.from&&o<=n.to})}for(let n of e.effects)n.is(_)&&(t=t.update({add:[It.range(n.value,
vendor: 4,242 bytes, line 2
2n.value+1)]}));return t}});function os(){return[is,co]}const ot="()[]{}<>";function fo(t){for(let e=0;e<ot.length;e+=2)if(ot.charCodeAt(e)==t)return ot.charAt(e+1);return kt(t<128?t:t+1)}function ho(t,e){return t.languageDataAt("closeBrackets",e)[0]||xe}const rs=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),is=y.inputHandler.of((t,e,n,o)=>{if((rs?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let r=t.state.selection.main;if(o.length>2||o.length==2&&G(R(o,0))==1||e!=r.from||n!=r.to)return!1;let i=as(t.state,o);return i?(t.dispatch(i),!0):!1}),ss=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let o=ho(t,t.selection.main.head).brackets||xe.brackets,r=null,i=t.changeByRange(s=>{if(s.empty){let l=cs(t.doc,s.head);for(let a of o)if(a==l&&Qe(t.doc,s.head)==fo(R(a,0)))return{changes:{from:s.head-a.length,to:s.head+a.length},range:m.cursor(s.head-a.length)}}return{range:r=s}});return r||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},ls=[{key:"Backspace",run:ss}];function as(t,e){let n=ho(t,t.selection.main.head),o=n.brackets||xe.brackets;for(let r of o){let i=fo(R(r,0));if(e==r)return i==r?us(t,r,o.indexOf(r+r+r)>-1,n):fs(t,r,i,n.before||xe.before);if(e==i&&uo(t,t.selection.main.from))return hs(t,r,i)}return null}function uo(t,e){let n=!1;return t.field(co).between(0,t.doc.length,o=>{o==e&&(n=!0)}),n}function Qe(t,e){let n=t.sliceString(e,e+2);return n.slice(0,G(R(n,0)))}function cs(t,e){let n=t.sliceString(e-2,e);return G(R(n,0))==n.length?n:n.slice(1)}function fs(t,e,n,o){let r=null,i=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:n,from:s.to}],effects:_.of(s.to+e.length),range:m.range(s.anchor+e.length,s.head+e.length)};let l=Qe(t.doc,s.head);return!l||/\s/.test(l)||o.indexOf(l)>-1?{changes:{insert:e+n,from:s.head},effects:_.of(s.head+e.length),range:m.cursor(s.head+e.length)}:{range:r=s}});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function hs(t,e,n){let o=null,r=t.changeByRange(i=>i.empty&&Qe(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:m.cursor(i.head+n.length)}:o={range:i});return o?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function us(t,e,n,o){let r=o.stringPrefixes||xe.stringPrefixes,i=null,s=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:_.of(l.to+e.length),range:m.range(l.anchor+e.length,l.head+e.length)};let a=l.head,f=Qe(t.doc,a),c;if(f==e){if(Zt(t,a))return{changes:{insert:e+e,from:a},effects:_.of(a+e.length),range:m.cursor(a+e.length)};if(uo(t,a)){let u=n&&t.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:m.cursor(a+u.length)}}}else{if(n&&t.sliceDoc(a-2*e.length,a)==e+e&&(c=en(t,a-2*e.length,r))>-1&&Zt(t,c))return{changes:{insert:e+e+e+e,from:a},effects:_.of(a+e.length),range:m.cursor(a+e.length)};if(t.charCategorizer(a)(f)!=M.Word&&en(t,a,r)>-1&&!ds(t,a,e,r))return{changes:{insert:e+e,from:a},effects:_.of(a+e.length),range:m.cursor(a+e.length)}}return{range:i=l}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Zt(t,e){let n=ae(t).resolveInner(e+1);return n.parent&&n.from==e}function ds(t,e,n,o){let r=ae(t).resolveInner(e,-1),i=o.reduce((s,l)=>Math.max(s,l.length),0);for(let s=0;s<5;s++){let l=t.sliceDoc(r.from,Math.min(r.to,r.from+n.length+i)),a=l.indexOf(n);if(!a||a>-1&&o.indexOf(l.slice(0,a))>-1){let c=r.firstChild;for(;c&&c.from==r.from&&c.to-c.from>n.length+a;){if(t.sliceDoc(c.to-n.length,c.to)==n)return!1;c=c.firstChild}return!0}let f=r.to==e&&r.parent;if(!f)break;r=f}return!1}function en(t,e,n){let o=t.charCategorizer(e);if(o(t.sliceDoc(e-1,e))!=M.Word)return e;for(let r of n){let i=e-r.length;if(t.sliceDoc(i,e)==r&&o(t.sliceDoc(i-1,i))!=M.Word)return i}return-1}function ms(t={}){return[ts,D,k.of(t),Zi,ps,ns]}const mo=[{key:"Ctrl-Space",run:Yt},{mac:"Alt-`",run:Yt},{key:"Escape",run:Qi},{key:"ArrowDown",run:Be(!0)},{key:"ArrowUp",run:Be(!1)},{key:"PageDown",run:Be(!0,"page")},{key:"PageUp",run:Be(!1,"page")},{key:"Enter",run:Ji}],ps=Ct.highest(ze.computeN([k],t=>t.facet(k).defaultKeymap?[mo]:[]));var tn=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,o=[];
2e.closeBracketsKeymap!==!1&&(o=o.concat(ls)),e.defaultKeymap!==!1&&(o=o.concat(Jn)),e.searchKeymap!==!1&&(o=o.concat(Li)),e.historyKeymap!==!1&&(o=o.concat(Cn)),e.foldKeymap!==!1&&(o=o.concat(Ro)),e.completionKeymap!==!1&&(o=o.concat(mo)),e.lintKeymap!==!1&&(o=o.concat(Po));var r=[];return e.lineNumbers!==!1&&r.push(Wo()),e.highlightActiveLineGutter!==!1&&r.push(No()),e.highlightSpecialChars!==!1&&r.push(hn()),e.history!==!1&&r.push(yn()),e.foldGutter!==!1&&r.push(Fo()),e.drawSelection!==!1&&r.push(un()),e.dropCursor!==!1&&r.push(qo()),e.allowMultipleSelections!==!1&&r.push(pe.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&r.push(Uo()),e.syntaxHighlighting!==!1&&r.push(vt(dn,{fallback:!0})),e.bracketMatching!==!1&&r.push(Ho()),e.closeBrackets!==!1&&r.push(os()),e.autocompletion!==!1&&r.push(ms()),e.rectangularSelection!==!1&&r.push($o()),n!==!1&&r.push(Vo()),e.highlightActiveLine!==!1&&r.push(zo()),e.highlightSelectionMatches!==!1&&r.push(li()),e.tabSize&&typeof e.tabSize=="number"&&r.push(ln.of(" ".repeat(e.tabSize))),r.concat([ze.of(o.flat())]).filter(Boolean)},Bs=function(e){e===void 0&&(e={});var n=[];e.defaultKeymap!==!1&&(n=n.concat(Jn)),e.historyKeymap!==!1&&(n=n.concat(Cn));var o=[];return e.highlightSpecialChars!==!1&&o.push(hn()),e.history!==!1&&o.push(yn()),e.drawSelection!==!1&&o.push(un()),e.syntaxHighlighting!==!1&&o.push(vt(dn,{fallback:!0})),o.concat([ze.of(n.flat())]).filter(Boolean)};const po="#e5c07b",mt="#e06c75",go="#56b6c2",yo="#ffffff",me="#abb2bf",He="#7d8799",xo="#61afef",bo="#98c379",pt="#d19a66",So="#c678dd",Co="#21252b",gt="#2c313a",yt="#282c34",Ee="#353a42",ko="#3E4451",xt="#528bff",Es={chalky:po,coral:mt,cyan:go,invalid:yo,ivory:me,stone:He,malibu:xo,sage:bo,whiskey:pt,violet:So,darkBackground:Co,highlightBackgroun
2d:gt,background:yt,tooltipBackground:Ee,selection:ko,cursor:xt},gs=y.theme({"&":{color:me,backgroundColor:yt},".cm-content":{caretColor:xt},".cm-cursor, .cm-dropCursor":{borderLeftColor:xt},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:ko},".cm-panels":{backgroundColor:Co,color:me},".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:yt,color:He,border:"none"},".cm-activeLineGutter":{backgroundColor:gt},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Ee},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Ee,borderBottomColor:Ee},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:gt,color:me}}},{dark:!0}),ys=Ko.define([{tag:d.keyword,color:So},{tag:[d.name,d.deleted,d.character,d.propertyName,d.macroName],color:mt},{tag:[d.function(d.variableName),d.labelName],color:xo},{tag:[d.color,d.constant(d.name),d.standard(d.name)],color:pt},{tag:[d.definition(d.name),d.separator],color:me},{tag:[d.typeName,d.className,d.number,d.changed,d.annotation,d.modifier,d.self,d.namespace],color:po},{tag:[d.operator,d.operatorKeyword,d.url,d.escape,d.regexp,d.link,d.special(d.string)],color:go},{tag:[d.meta,d.comment],color:He},{tag:d.strong,fontWeight:"bold"},{tag:d.emphasis,fontStyle:"italic"},{tag:d.strikethrough,textDecoration:"line-through"},{tag:d.link,color:He,textDecoration:"underline"},{tag:d.heading,fontWeight:"bold",color:mt},{tag:[d.atom,d.bool,d.special(d.variableName)],color:pt},{tag:[d.processingInstruction,d.string,d.inserted],color:bo},{tag:d.invalid,color:yo}]),xs=[gs,vt(ys)];var bs=y.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Ss=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:o=!0,readOnly:r=!1,theme:i="light",placeholder:s="",basicSetup:l=!0}=e,a=[];switch(n&&a.unshift(ze.of([ti])),l&&(typeof l=="boolean"?a.unshift(tn()):a.unshift(tn(l))),s&&a.unshift(jo(s)),i){case"light":a.push(bs);break;case"dark":a.push(xs);break;case"none":break;default:a.push(i);break}return o===!1&&a.push(y.editable.of(!1)),r&&a.push(pe.readOnly.of(!0)),[...a]},Cs=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)}),nn=Ve.define(),ks=[];function vs(t){var{value:e,selection:n,onChange:o,onStatistics:r,onCreateEditor:i,onUpdate:s,extensions:l=ks,autoFocus:a,theme:f="light",height:c=null,minHeight:h=null,maxHeight:u=null,width:p=null,minWidth:g=null,maxWidth:b=null,placeholder:w="",editable:H=!0,readOnly:x=!1,indentWithTab:F=!0,basicSetup:L=!0,root:S,initialState:$}=t,[V,ve]=I.useState(),[C,j]=I.useState(),[Z,ee]=I.useState(),_e=y.theme({"&":{height:c,minHeight:h,maxHeight:u,width:p,minWidth:g,maxWidth:b},"& .cm-scroller":{height:"100% !important"}}),Xe=y.updateListener.of(q=>{if(q.docChanged&&typeof o=="function"&&!q.transactions.some(Ao=>Ao.annotation(nn))){var ue=q.state.doc,Ae=ue.toString();o(Ae,q)}r&&r(Cs(q))}),vo=Ss({theme:f,editable:H,readOnly:x,placeholder:w,indentWithTab:F,basicSetup:L}),he=[Xe,_e,...vo];return s&&typeof s=="function"&&he.push(y.updateListener.of(s)),he=he.concat(l),I.useEffect(()=>{if(V&&!Z){var q={doc:e,selection:n,extensions:he},ue=$?pe.fromJSON($.json,q,$.fields):pe.create(q);if(ee(ue),!C){var Ae=new y({state:ue,parent:V,root:S});j(Ae),i&&i(Ae,ue)}}return()=>{C&&(ee(void 0),j(void 0))}},[V,Z]),I.useEffect(()=>ve(t.container),[t.container]),I.useEffect(()=>()=>{C&&(C.destroy(),j(void 0))},[C]),I.useEffect(()=>{a&&C&&C.focus()},[a,C]),I.useEffect(()=>
2{C&&C.dispatch({effects:O.reconfigure.of(he)})},[f,l,c,h,u,p,g,b,w,H,x,F,L,o,s]),I.useEffect(()=>{if(e!==void 0){var q=C?C.state.doc.toString():"";C&&e!==q&&C.dispatch({changes:{from:0,to:q.length,insert:e||""},annotations:[nn.of(!0)]})}},[e,C]),{state:Z,setState:ee,view:C,setView:j,container:V,setContainer:ve}}var As=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Ms=I.forwardRef((t,e)=>{var{className:n,value:o="",selection:r,extensions:i=[],onChange:s,onStatistics:l,onCreateEditor:a,onUpdate:f,autoFocus:c,theme:h="light",height:u,minHeight:p,maxHeight:g,width:b,minWidth:w,maxWidth:H,basicSetup:x,placeholder:F,indentWithTab:L,editable:S,readOnly:$,root:V,initialState:ve}=t,C=Go(t,As),j=I.useRef(null),{state:Z,view:ee,container:_e}=vs({container:j.current,root:V,value:o,autoFocus:c,theme:h,height:u,minHeight:p,maxHeight:g,width:b,minWidth:w,maxWidth:H,basicSetup:x,placeholder:F,indentWithTab:L,editable:S,readOnly:$,selection:r,onChange:s,onStatistics:l,onCreateEditor:a,onUpdate:f,extensions:i,initialState:ve});if(I.useImperativeHandle(e,()=>({editor:j.current,state:Z,view:ee}),[j,_e,Z,ee]),typeof o!="string")throw new Error("value must be typeof string but got "+typeof o);var Xe=typeof h=="string"?"cm-theme-"+h:"cm-theme";return Mo.jsx("div",lt({ref:j,className:""+Xe+(n?" "+n:"")},C))});Ms.displayName="CodeMirror";export{Ve as Annotation,ws as AnnotationType,Is as BidiSpan,Rs as BlockInfo,Ps as BlockType,Do as ChangeDesc,Lo as ChangeSet,M as CharCategory,Ws as Compartment,T as Decoration,an as Direction,m as EditorSelection,pe as EditorState,y as EditorView,be as Facet,Ns as GutterMarker,Fs as Line,Oo as MapMode,qs as MatchDecorator,Ct as Prec,Us as Range,Io as RangeSet,Bo as RangeSetBuilder,wo as RangeValue,Hs as RectangleMarker,$s as SelectionRange,O as StateEffect,Vs as StateEffectType,Se as StateField,sn as Text,Ye as Transaction,St as ViewPlugin,zs as ViewUpdate,Ks as WidgetType,js as __test,tn as basicSetup,Gs as closeHoverTooltips,R as codePointAt,G as codePointSize,Es as color,$e as combineConfig,bt as countColumn,Vo as crosshairCursor,Ms as default,bs as defaultLightThemeOption,un as drawSelection,qo as dropCursor,Y as findClusterBreak,Js as findColumn,kt as fromCodePoint,Ss as getDefaultExtensions,Qs as getDrawSelectionConfig,Oe as getPanel,Cs as getStatistics,fn as getTooltip,_s as gutter,Xs as gutterLineClass,Ys as gutterWidgetClass,Zs as gutters,el as hasHoverTooltips,zo as highlightActiveLine,No as highlightActiveLineGutter,hn as highlightSpecialChars,tl as highlightTrailingWhitespace,nl as highlightWhitespace,ol as hoverTooltip,ze as keymap,rl as layer,il as lineNumberMarkers,sl as lineNumberWidgetMarker,Wo as lineNumbers,st as logException,Bs as minimalSetup,xs as oneDark,ys as oneDarkHighlightStyle,gs as oneDarkTheme,ll as panels,jo as placeholder,$o as rectangularSelection,al as repositionTooltips,Eo as runScopeHandlers,cl as scrollPastEnd,cn as showPanel,To as showTooltip,fl as tooltips,vs as useCodeMirror}; 3//# sourceMappingURL=index-CtqB8i4S.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.