@karmaniverous/jeeves-server 3.4.2 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.tsbuildinfo +1 -1
- package/CHANGELOG.md +47 -1
- package/README.md +18 -17
- package/client/package.json +20 -19
- package/client/src/components/SearchModal.tsx +11 -1
- package/client/src/components/layout/Header.tsx +3 -3
- package/client/src/lib/api.ts +10 -5
- package/dist/client/assets/CodeEditor-Brh86AGF.js +1 -0
- package/dist/client/assets/CodeViewer-Cegj3cEn.js +1 -0
- package/dist/client/assets/dist-2YqVIvgv.js +2 -0
- package/dist/client/assets/dist-5vamY028.js +1 -0
- package/dist/client/assets/dist-6_auAGci.js +1 -0
- package/dist/client/assets/dist-B0kq1DQG.js +1 -0
- package/dist/client/assets/dist-B2SZD_eN.js +1 -0
- package/dist/client/assets/dist-B2t4dYA2.js +1 -0
- package/dist/client/assets/dist-B5gFYAn7.js +1 -0
- package/dist/client/assets/dist-BPy6CnYN.js +1 -0
- package/dist/client/assets/dist-CL6VCrQn.js +9 -0
- package/dist/client/assets/dist-CWsHar9N.js +1 -0
- package/dist/client/assets/dist-CnFc5Ssx.js +1 -0
- package/dist/client/assets/dist-DSgLBuTS.js +1 -0
- package/dist/client/assets/dist-DUcac0X_.js +7 -0
- package/dist/client/assets/dist-DcTcc-BG.js +6 -0
- package/dist/client/assets/dist-DvfTyWk_.js +1 -0
- package/dist/client/assets/dist-Dz1Ulpqa.js +1 -0
- package/dist/client/assets/dist-Kr-mUYW1.js +5 -0
- package/dist/client/assets/dist-OX4k3MMG.js +2 -0
- package/dist/client/assets/dist-qiU0qoeK.js +1 -0
- package/dist/client/assets/dist-ui4J6fvl.js +23 -0
- package/dist/client/assets/index-Dk_myGs4.css +2 -0
- package/dist/client/assets/index-DrBXupPz.js +62 -0
- package/dist/client/assets/theme-CPpIxvB0.js +2 -0
- package/dist/client/index.html +3 -2
- package/dist/src/cli/commands/config.test.js +6 -41
- package/dist/src/cli/index.js +9 -15
- package/dist/src/cli/start-server.js +16 -0
- package/dist/src/config/index.js +48 -37
- package/dist/src/config/loadConfig.test.js +27 -25
- package/dist/src/config/migration.js +60 -0
- package/dist/src/config/schema.js +4 -3
- package/dist/src/descriptor.js +51 -0
- package/dist/src/routes/api/diagramExport.js +101 -0
- package/dist/src/routes/api/diagramExport.test.js +134 -0
- package/dist/src/routes/api/events.js +13 -0
- package/dist/src/routes/api/export.js +6 -82
- package/dist/src/routes/api/index.js +4 -0
- package/dist/src/routes/api/search.js +9 -50
- package/dist/src/routes/api/sharing.js +40 -23
- package/dist/src/routes/api/sharing.test.js +52 -0
- package/dist/src/routes/auth.js +1 -1
- package/dist/src/routes/config.js +8 -2
- package/dist/src/routes/keys.js +4 -4
- package/dist/src/routes/path/index.js +1 -1
- package/dist/src/routes/status.js +15 -16
- package/dist/src/routes/status.test.js +13 -8
- package/dist/src/server.js +21 -16
- package/dist/src/services/markdown.js +2 -1
- package/dist/src/services/markdown.test.js +22 -0
- package/dist/src/util/packageVersion.js +7 -16
- package/dist/src/util/packageVersion.test.js +7 -0
- package/guides/api-integration.md +4 -0
- package/guides/deployment.md +11 -10
- package/guides/event-gateway.md +4 -0
- package/guides/exports.md +4 -0
- package/guides/index.md +1 -1
- package/guides/setup.md +17 -16
- package/guides/sharing.md +4 -0
- package/package.json +3 -3
- package/scripts/download-plantuml.js +0 -1
- package/src/cli/commands/config.test.ts +6 -46
- package/src/cli/index.ts +9 -16
- package/src/cli/start-server.ts +21 -0
- package/src/config/index.ts +56 -43
- package/src/config/loadConfig.test.ts +27 -29
- package/src/config/migration.ts +76 -0
- package/src/config/schema.ts +5 -4
- package/src/descriptor.ts +60 -0
- package/src/routes/api/diagramExport.test.ts +200 -0
- package/src/routes/api/diagramExport.ts +170 -0
- package/src/routes/api/events.ts +22 -0
- package/src/routes/api/export.ts +6 -131
- package/src/routes/api/index.ts +4 -0
- package/src/routes/api/search.ts +9 -63
- package/src/routes/api/sharing.test.ts +66 -0
- package/src/routes/api/sharing.ts +47 -23
- package/src/routes/auth.ts +1 -1
- package/src/routes/config.ts +15 -2
- package/src/routes/keys.ts +4 -4
- package/src/routes/path/index.ts +1 -1
- package/src/routes/status.test.ts +14 -8
- package/src/routes/status.ts +56 -62
- package/src/server.ts +29 -17
- package/src/services/markdown.test.ts +26 -0
- package/src/services/markdown.ts +2 -1
- package/src/util/packageVersion.test.ts +9 -0
- package/src/util/packageVersion.ts +11 -18
- package/src/util/platform.ts +1 -1
- package/dist/client/assets/CodeEditor-DQZZL5Rq.js +0 -1
- package/dist/client/assets/CodeViewer-ofJVD1Vn.js +0 -1
- package/dist/client/assets/index--MBieNJA.js +0 -1
- package/dist/client/assets/index-BENeXQI_.js +0 -1
- package/dist/client/assets/index-BbBpoOxz.js +0 -1
- package/dist/client/assets/index-BdV9g5AM.js +0 -6
- package/dist/client/assets/index-BjAilRri.js +0 -2
- package/dist/client/assets/index-BqbhWo2I.js +0 -3
- package/dist/client/assets/index-CVbycZ0H.js +0 -1
- package/dist/client/assets/index-Cs5oz2oJ.js +0 -5
- package/dist/client/assets/index-D-RC7ZS6.css +0 -1
- package/dist/client/assets/index-D8KZVveX.js +0 -1
- package/dist/client/assets/index-DC4HMHxY.js +0 -13
- package/dist/client/assets/index-DcY2RXqX.js +0 -1
- package/dist/client/assets/index-Duy-tZYV.js +0 -1
- package/dist/client/assets/index-Dw7rDFmE.js +0 -7
- package/dist/client/assets/index-FlCUvrjv.js +0 -2
- package/dist/client/assets/index-K6OVmfhg.js +0 -1
- package/dist/client/assets/index-MLwyFRN0.js +0 -1
- package/dist/client/assets/index-OpqBpSjn.js +0 -1
- package/dist/client/assets/index-SsHei0HE.js +0 -1
- package/dist/client/assets/index-jSGuHSeS.js +0 -62
- package/dist/client/assets/index-uQa2yckk.js +0 -1
- package/dist/client/assets/index-udkXoIER.js +0 -1
- package/dist/src/cli/commands/config.js +0 -105
- package/dist/src/cli/commands/service.js +0 -93
- package/dist/src/cli/commands/start.js +0 -24
- package/src/cli/commands/config.ts +0 -117
- package/src/cli/commands/service.ts +0 -129
- package/src/cli/commands/start.ts +0 -27
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{E as A,D as an,g as De,s as hn,V as nt,a as k,b as rt,c as y,r as un,h as fn,W as dn,l as mn,d as gn,e as ot,f as it,i as pn,j as yn,k as xn,m as kn,n as lt}from"./index-Dw7rDFmE.js";import{StateField as Be,Transaction as pe,Facet as j,combineConfig as ue,EditorSelection as f,StateEffect as T,ChangeSet as Sn,ChangeDesc as An,Annotation as st,countColumn as we,Text as ct,findClusterBreak as q,Prec as Cn,codePointAt as bn,fromCodePoint as Mn,codePointSize as vn,CharCategory as L,EditorState as at,RangeSetBuilder as ht}from"./index-Cs5oz2oJ.js";import{I as ut,g as ft,i as oe,s as Re,m as $,N as Se,a as Ae,b as Ln,f as Dn,c as Bn,d as dt,e as wn,h as Rn,j as mt}from"./index-CVbycZ0H.js";import{c as En,a as In,b as Tn,d as Pn}from"./index-OpqBpSjn.js";const On=t=>{let{state:e}=t,r=e.doc.lineAt(e.selection.main.from),n=Ie(t.state,r.from);return n.line?Fn(t):n.block?qn(t):!1};function Ee(t,e){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let o=t(e,r);return o?(n(r.update(o)),!0):!1}}const Fn=Ee($n,0),Wn=Ee(gt,0),qn=Ee((t,e)=>gt(t,e,Vn(e)),0);function Ie(t,e){let r=t.languageDataAt("commentTokens",e,1);return r.length?r[0]:{}}const J=50;function Nn(t,{open:e,close:r},n,o){let i=t.sliceDoc(n-J,n),l=t.sliceDoc(o,o+J),s=/\s*$/.exec(i)[0].length,c=/^\s*/.exec(l)[0].length,a=i.length-s;if(i.slice(a-e.length,a)==e&&l.slice(c,c+r.length)==r)return{open:{pos:n-s,margin:s&&1},close:{pos:o+c,margin:c&&1}};let h,u;o-n<=2*J?h=u=t.sliceDoc(n,o):(h=t.sliceDoc(n,n+J),u=t.sliceDoc(o-J,o));let d=/^\s*/.exec(h)[0].length,m=/\s*$/.exec(u)[0].length,g=u.length-m-r.length;return h.slice(d,d+e.length)==e&&u.slice(g,g+r.length)==r?{open:{pos:n+d+e.length,margin:/\s/.test(h.charAt(d+e.length))?1:0},close:{pos:o-m-r.length,margin:/\s/.test(u.charAt(g-1))?1:0}}:null}function Vn(t){let e=[];for(let r of t.selection.ranges){let n=t.doc.lineAt(r.from),o=r.to<=n.to?n:t.doc.lineAt(r.to);o.from>n.from&&o.from==r.to&&(o=r.to==n.to+1?n:t.doc.lineAt(r.to-1));let i=e.length-1;i>=0&&e[i].to>n.from?e[i].to=o.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:o.to})}return e}function gt(t,e,r=e.selection.ranges){let n=r.map(i=>Ie(e,i.from).block);if(!n.every(i=>i))return null;let o=r.map((i,l)=>Nn(e,n[l],i.from,i.to));if(t!=2&&!o.every(i=>i))return{changes:e.changes(r.map((i,l)=>o[l]?[]:[{from:i.from,insert:n[l].open+" "},{from:i.to,insert:" "+n[l].close}]))};if(t!=1&&o.some(i=>i)){let i=[];for(let l=0,s;l<o.length;l++)if(s=o[l]){let c=n[l],{open:a,close:h}=s;i.push({from:a.pos-c.open.length,to:a.pos+a.margin},{from:h.pos-h.margin,to:h.pos+c.close.length})}return{changes:i}}return null}function $n(t,e,r=e.selection.ranges){let n=[],o=-1;e:for(let{from:i,to:l}of r){let s=n.length,c=1e9,a;for(let h=i;h<=l;){let u=e.doc.lineAt(h);if(a==null&&(a=Ie(e,u.from).line,!a))continue e;if(u.from>o&&(i==l||l>u.from)){o=u.from;let d=/^\s*/.exec(u.text)[0].length,m=d==u.length,g=u.text.slice(d,d+a.length)==a?d:-1;d<u.text.length&&d<c&&(c=d),n.push({line:u,comment:g,token:a,indent:d,empty:m,single:!1})}h=u.to+1}if(c<1e9)for(let h=s;h<n.length;h++)n[h].indent<n[h].line.text.length&&(n[h].indent=c);n.length==s+1&&(n[s].single=!0)}if(t!=2&&n.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:s,token:c,indent:a,empty:h,single:u}of n)(u||!h)&&i.push({from:s.from+a,insert:c+" "});let l=e.changes(i);return{changes:l,selection:e.selection.map(l,1)}}else if(t!=1&&n.some(i=>i.comment>=0)){let i=[];for(let{line:l,comment:s,token:c}of n)if(s>=0){let a=l.from+s,h=a+c.length;l.text[h-l.from]==" "&&h++,i.push({from:a,to:h})}return{changes:i}}return null}const Ce=st.define(),Un=st.define(),zn=j.define(),pt=j.define({combine(t){return ue(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,r)=>r},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,r)=>(n,o)=>e(n,o)||r(n,o)})}}),yt=Be.define({create(){return I.empty},update(t,e){let r=e.state.facet(pt),n=e.annotation(Ce);if(n){let c=b.fromTransaction(e,n.selection),a=n.side,h=a==0?t.undone:t.done;return c?h=ie(h,h.length,r.minDepth,c):h=At(h,e.startState.selection),new I(a==0?n.rest:h,a==0?h:n.rest)}let o=e.annotation(Un);if((o=="full"||o=="before")&&(t=t.isolate()),e.annotation(pe.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=b.fromTransaction(e),l=e.annotation(pe.time),s=e.annotation(pe.userEvent);return i?t=t.addChanges(i,l,s,r,e):e.selection&&(t=t.addSelection(e.startState.selection,l,s,r.newGroupDelay)),(o=="full"||o=="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 I(t.done.map(b.fromJSON),t.undone.map(b.fromJSON))}});function xt(t={}){return[yt,pt.of(t),A.domEventHandlers({beforeinput(e,r){let n=e.inputType=="historyUndo"?kt:e.inputType=="historyRedo"?be:null;return n?(e.preventDefault(),n(r)):!1}})]}function fe(t,e){return function({state:r,dispatch:n}){if(!e&&r.readOnly)return!1;let o=r.field(yt,!1);if(!o)return!1;let i=o.pop(t,r,e);return i?(n(i),!0):!1}}const kt=fe(0,!1),be=fe(1,!1),Gn=fe(0,!0),Hn=fe(1,!0);class b{constructor(e,r,n,o,i){this.changes=e,this.effects=r,this.mapped=n,this.startSelection=o,this.selectionsAfter=i}setSelAfter(e){return new b(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,r,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(o=>o.toJSON())}}static fromJSON(e){return new b(e.changes&&Sn.fromJSON(e.changes),[],e.mapped&&An.fromJSON(e.mapped),e.startSelection&&f.fromJSON(e.startSelection),e.selectionsAfter.map(f.fromJSON))}static fromTransaction(e,r){let n=D;for(let o of e.startState.facet(zn)){let i=o(e);i.length&&(n=n.concat(i))}return!n.length&&e.changes.empty?null:new b(e.changes.invert(e.startState.doc),n,void 0,r||e.startState.selection,D)}static selection(e){return new b(void 0,D,void 0,void 0,e)}}function ie(t,e,r,n){let o=e+1>r+20?e-r-1:0,i=t.slice(o,e);return i.push(n),i}function Jn(t,e){let r=[],n=!1;return t.iterChangedRanges((o,i)=>r.push(o,i)),e.iterChangedRanges((o,i,l,s)=>{for(let c=0;c<r.length;){let a=r[c++],h=r[c++];s>=a&&l<=h&&(n=!0)}}),n}function Kn(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((r,n)=>r.empty!=e.ranges[n].empty).length===0}function St(t,e){return t.length?e.length?t.concat(e):t:e}const D=[],_n=200;function At(t,e){if(t.length){let r=t[t.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-_n));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),ie(t,t.length-1,1e9,r.setSelAfter(n)))}else return[b.selection([e])]}function Qn(t){let e=t[t.length-1],r=t.slice();return r[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),r}function ye(t,e){if(!t.length)return t;let r=t.length,n=D;for(;r;){let o=jn(t[r-1],e,n);if(o.changes&&!o.changes.empty||o.effects.length){let i=t.slice(0,r);return i[r-1]=o,i}else e=o.mapped,r--,n=o.selectionsAfter}return n.length?[b.selection(n)]:D}function jn(t,e,r){let n=St(t.selectionsAfter.length?t.selectionsAfter.map(s=>s.map(e)):D,r);if(!t.changes)return b.selection(n);let o=t.changes.map(e),i=e.mapDesc(t.changes,!0),l=t.mapped?t.mapped.composeDesc(i):i;return new b(o,T.mapEffects(t.effects,e),l,t.startSelection.map(i),n)}const Yn=/^(input\.type|delete)($|\.)/;class I{constructor(e,r,n=0,o=void 0){this.done=e,this.undone=r,this.prevTime=n,this.prevUserEvent=o}isolate(){return this.prevTime?new I(this.done,this.undone):this}addChanges(e,r,n,o,i){let l=this.done,s=l[l.length-1];return s&&s.changes&&!s.changes.empty&&e.changes&&(!n||Yn.test(n))&&(!s.selectionsAfter.length&&r-this.prevTime<o.newGroupDelay&&o.joinToEvent(i,Jn(s.changes,e.changes))||n=="input.type.compose")?l=ie(l,l.length-1,o.minDepth,new b(e.changes.compose(s.changes),St(T.mapEffects(e.effects,s.changes),s.effects),s.mapped,s.startSelection,D)):l=ie(l,l.length,o.minDepth,e),new I(l,D,r,n)}addSelection(e,r,n,o){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:D;return i.length>0&&r-this.prevTime<o&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&Kn(i[i.length-1],e)?this:new I(At(this.done,e),this.undone,r,n)}addMapping(e){return new I(ye(this.done,e),ye(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,r,n){let o=e==0?this.done:this.undone;if(o.length==0)return null;let i=o[o.length-1],l=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):r.selection);if(n&&i.selectionsAfter.length)return r.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Ce.of({side:e,rest:Qn(o),selection:l}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let s=o.length==1?D:o.slice(0,o.length-1);return i.mapped&&(s=ye(s,i.mapped)),r.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Ce.of({side:e,rest:s,selection:l}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}I.empty=new I(D,D);const Ct=[{key:"Mod-z",run:kt,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:be,preventDefault:!0},{linux:"Ctrl-Shift-z",run:be,preventDefault:!0},{key:"Mod-u",run:Gn,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Hn,preventDefault:!0}];function G(t,e){return f.create(t.ranges.map(e),t.mainIndex)}function w(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function R({state:t,dispatch:e},r){let n=G(t.selection,r);return n.eq(t.selection,!0)?!1:(e(w(t,n)),!0)}function de(t,e){return f.cursor(e?t.to:t.from)}function bt(t,e){return R(t,r=>r.empty?t.moveByChar(r,e):de(r,e))}function C(t){return t.textDirectionAt(t.state.selection.main.head)==an.LTR}const Mt=t=>bt(t,!C(t)),vt=t=>bt(t,C(t));function Lt(t,e){return R(t,r=>r.empty?t.moveByGroup(r,e):de(r,e))}const Zn=t=>Lt(t,!C(t)),Xn=t=>Lt(t,C(t));function er(t,e,r){if(e.type.prop(r))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function me(t,e,r){let n=Re(t).resolveInner(e.head),o=r?Se.closedBy:Se.openedBy;for(let c=e.head;;){let a=r?n.childAfter(c):n.childBefore(c);if(!a)break;er(t,a,o)?n=a:c=r?a.to:a.from}let i=n.type.prop(o),l,s;return i&&(l=r?$(t,n.from,1):$(t,n.to,-1))&&l.matched?s=r?l.end.to:l.end.from:s=r?n.to:n.from,f.cursor(s,r?-1:1)}const tr=t=>R(t,e=>me(t.state,e,!C(t))),nr=t=>R(t,e=>me(t.state,e,C(t)));function Dt(t,e){return R(t,r=>{if(!r.empty)return de(r,e);let n=t.moveVertically(r,e);return n.head!=r.head?n:t.moveToLineBoundary(r,e)})}const Bt=t=>Dt(t,!1),wt=t=>Dt(t,!0);function Rt(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,r=0,n=0,o;if(e){for(let i of t.state.facet(A.scrollMargins)){let l=i(t);l?.top&&(r=Math.max(l?.top,r)),l?.bottom&&(n=Math.max(l?.bottom,n))}o=t.scrollDOM.clientHeight-r-n}else o=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:n,selfScroll:e,height:Math.max(t.defaultLineHeight,o-5)}}function Et(t,e){let r=Rt(t),{state:n}=t,o=G(n.selection,l=>l.empty?t.moveVertically(l,e,r.height):de(l,e));if(o.eq(n.selection))return!1;let i;if(r.selfScroll){let l=t.coordsAtPos(n.selection.main.head),s=t.scrollDOM.getBoundingClientRect(),c=s.top+r.marginTop,a=s.bottom-r.marginBottom;l&&l.top>c&&l.bottom<a&&(i=A.scrollIntoView(o.main.head,{y:"start",yMargin:l.top-c}))}return t.dispatch(w(n,o),{effects:i}),!0}const $e=t=>Et(t,!1),Me=t=>Et(t,!0);function F(t,e,r){let n=t.lineBlockAt(e.head),o=t.moveToLineBoundary(e,r);if(o.head==e.head&&o.head!=(r?n.to:n.from)&&(o=t.moveToLineBoundary(e,r,!1)),!r&&o.head==n.from&&n.length){let i=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;i&&e.head!=n.from+i&&(o=f.cursor(n.from+i))}return o}const rr=t=>R(t,e=>F(t,e,!0)),or=t=>R(t,e=>F(t,e,!1)),ir=t=>R(t,e=>F(t,e,!C(t))),lr=t=>R(t,e=>F(t,e,C(t))),sr=t=>R(t,e=>f.cursor(t.lineBlockAt(e.head).from,1)),cr=t=>R(t,e=>f.cursor(t.lineBlockAt(e.head).to,-1));function ar(t,e,r){let n=!1,o=G(t.selection,i=>{let l=$(t,i.head,-1)||$(t,i.head,1)||i.head>0&&$(t,i.head-1,1)||i.head<t.doc.length&&$(t,i.head+1,-1);if(!l||!l.end)return i;n=!0;let s=l.start.from==i.head?l.end.to:l.end.from;return f.cursor(s)});return n?(e(w(t,o)),!0):!1}const hr=({state:t,dispatch:e})=>ar(t,e);function B(t,e){let r=G(t.state.selection,n=>{let o=e(n);return f.range(n.anchor,o.head,o.goalColumn,o.bidiLevel||void 0)});return r.eq(t.state.selection)?!1:(t.dispatch(w(t.state,r)),!0)}function It(t,e){return B(t,r=>t.moveByChar(r,e))}const Tt=t=>It(t,!C(t)),Pt=t=>It(t,C(t));function Ot(t,e){return B(t,r=>t.moveByGroup(r,e))}const ur=t=>Ot(t,!C(t)),fr=t=>Ot(t,C(t)),dr=t=>B(t,e=>me(t.state,e,!C(t))),mr=t=>B(t,e=>me(t.state,e,C(t)));function Ft(t,e){return B(t,r=>t.moveVertically(r,e))}const Wt=t=>Ft(t,!1),qt=t=>Ft(t,!0);function Nt(t,e){return B(t,r=>t.moveVertically(r,e,Rt(t).height))}const Ue=t=>Nt(t,!1),ze=t=>Nt(t,!0),gr=t=>B(t,e=>F(t,e,!0)),pr=t=>B(t,e=>F(t,e,!1)),yr=t=>B(t,e=>F(t,e,!C(t))),xr=t=>B(t,e=>F(t,e,C(t))),kr=t=>B(t,e=>f.cursor(t.lineBlockAt(e.head).from)),Sr=t=>B(t,e=>f.cursor(t.lineBlockAt(e.head).to)),Ge=({state:t,dispatch:e})=>(e(w(t,{anchor:0})),!0),He=({state:t,dispatch:e})=>(e(w(t,{anchor:t.doc.length})),!0),Je=({state:t,dispatch:e})=>(e(w(t,{anchor:t.selection.main.anchor,head:0})),!0),Ke=({state:t,dispatch:e})=>(e(w(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Ar=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Cr=({state:t,dispatch:e})=>{let r=ge(t).map(({from:n,to:o})=>f.range(n,Math.min(o+1,t.doc.length)));return e(t.update({selection:f.create(r),userEvent:"select"})),!0},br=({state:t,dispatch:e})=>{let r=G(t.selection,n=>{let o=Re(t),i=o.resolveStack(n.from,1);if(n.empty){let l=o.resolveStack(n.from,-1);l.node.from>=i.node.from&&l.node.to<=i.node.to&&(i=l)}for(let l=i;l;l=l.next){let{node:s}=l;if((s.from<n.from&&s.to>=n.to||s.to>n.to&&s.from<=n.from)&&l.next)return f.range(s.to,s.from)}return n});return r.eq(t.selection)?!1:(e(w(t,r)),!0)};function Vt(t,e){let{state:r}=t,n=r.selection,o=r.selection.ranges.slice();for(let i of r.selection.ranges){let l=r.doc.lineAt(i.head);if(e?l.to<t.state.doc.length:l.from>0)for(let s=i;;){let c=t.moveVertically(s,e);if(c.head<l.from||c.head>l.to){o.some(a=>a.head==c.head)||o.push(c);break}else{if(c.head==s.head)break;s=c}}}return o.length==n.ranges.length?!1:(t.dispatch(w(r,f.create(o,o.length-1))),!0)}const Mr=t=>Vt(t,!1),vr=t=>Vt(t,!0),Lr=({state:t,dispatch:e})=>{let r=t.selection,n=null;return r.ranges.length>1?n=f.create([r.main]):r.main.empty||(n=f.create([f.cursor(r.main.head)])),n?(e(w(t,n)),!0):!1};function Y(t,e){if(t.state.readOnly)return!1;let r="delete.selection",{state:n}=t,o=n.changeByRange(i=>{let{from:l,to:s}=i;if(l==s){let c=e(i);c<l?(r="delete.backward",c=ee(t,c,!1)):c>l&&(r="delete.forward",c=ee(t,c,!0)),l=Math.min(l,c),s=Math.max(s,c)}else l=ee(t,l,!1),s=ee(t,s,!0);return l==s?{range:i}:{changes:{from:l,to:s},range:f.cursor(l,l<i.head?-1:1)}});return o.changes.empty?!1:(t.dispatch(n.update(o,{scrollIntoView:!0,userEvent:r,effects:r=="delete.selection"?A.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function ee(t,e,r){if(t instanceof A)for(let n of t.state.facet(A.atomicRanges).map(o=>o(t)))n.between(e,e,(o,i)=>{o<e&&i>e&&(e=r?i:o)});return e}const $t=(t,e,r)=>Y(t,n=>{let o=n.from,{state:i}=t,l=i.doc.lineAt(o),s,c;if(r&&!e&&o>l.from&&o<l.from+200&&!/[^ \t]/.test(s=l.text.slice(0,o-l.from))){if(s[s.length-1]==" ")return o-1;let a=we(s,i.tabSize),h=a%Ae(i)||Ae(i);for(let u=0;u<h&&s[s.length-1-u]==" ";u++)o--;c=o}else c=q(l.text,o-l.from,e,e)+l.from,c==o&&l.number!=(e?i.doc.lines:1)?c+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(l.text.slice(c-l.from,o-l.from))&&(c=q(l.text,c-l.from,!1,!1)+l.from);return c}),ve=t=>$t(t,!1,!0),Ut=t=>$t(t,!0,!1),zt=(t,e)=>Y(t,r=>{let n=r.head,{state:o}=t,i=o.doc.lineAt(n),l=o.charCategorizer(n);for(let s=null;;){if(n==(e?i.to:i.from)){n==r.head&&i.number!=(e?o.doc.lines:1)&&(n+=e?1:-1);break}let c=q(i.text,n-i.from,e)+i.from,a=i.text.slice(Math.min(n,c)-i.from,Math.max(n,c)-i.from),h=l(a);if(s!=null&&h!=s)break;(a!=" "||n!=r.head)&&(s=h),n=c}return n}),Gt=t=>zt(t,!1),Dr=t=>zt(t,!0),Br=t=>Y(t,e=>{let r=t.lineBlockAt(e.head).to;return e.head<r?r:Math.min(t.state.doc.length,e.head+1)}),wr=t=>Y(t,e=>{let r=t.moveToLineBoundary(e,!1).head;return e.head>r?r:Math.max(0,e.head-1)}),Rr=t=>Y(t,e=>{let r=t.moveToLineBoundary(e,!0).head;return e.head<r?r:Math.min(t.state.doc.length,e.head+1)}),Er=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:ct.of(["",""])},range:f.cursor(n.from)}));return e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},Ir=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{if(!n.empty||n.from==0||n.from==t.doc.length)return{range:n};let o=n.from,i=t.doc.lineAt(o),l=o==i.from?o-1:q(i.text,o-i.from,!1)+i.from,s=o==i.to?o+1:q(i.text,o-i.from,!0)+i.from;return{changes:{from:l,to:s,insert:t.doc.slice(o,s).append(t.doc.slice(l,o))},range:f.cursor(s)}});return r.changes.empty?!1:(e(t.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function ge(t){let e=[],r=-1;for(let n of t.selection.ranges){let o=t.doc.lineAt(n.from),i=t.doc.lineAt(n.to);if(!n.empty&&n.to==i.from&&(i=t.doc.lineAt(n.to-1)),r>=o.number){let l=e[e.length-1];l.to=i.to,l.ranges.push(n)}else e.push({from:o.from,to:i.to,ranges:[n]});r=i.number+1}return e}function Ht(t,e,r){if(t.readOnly)return!1;let n=[],o=[];for(let i of ge(t)){if(r?i.to==t.doc.length:i.from==0)continue;let l=t.doc.lineAt(r?i.to+1:i.from-1),s=l.length+1;if(r){n.push({from:i.to,to:l.to},{from:i.from,insert:l.text+t.lineBreak});for(let c of i.ranges)o.push(f.range(Math.min(t.doc.length,c.anchor+s),Math.min(t.doc.length,c.head+s)))}else{n.push({from:l.from,to:i.from},{from:i.to,insert:t.lineBreak+l.text});for(let c of i.ranges)o.push(f.range(c.anchor-s,c.head-s))}}return n.length?(e(t.update({changes:n,scrollIntoView:!0,selection:f.create(o,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Tr=({state:t,dispatch:e})=>Ht(t,e,!1),Pr=({state:t,dispatch:e})=>Ht(t,e,!0);function Jt(t,e,r){if(t.readOnly)return!1;let n=[];for(let i of ge(t))r?n.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):n.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});let o=t.changes(n);return e(t.update({changes:o,selection:t.selection.map(o,r?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Or=({state:t,dispatch:e})=>Jt(t,e,!1),Fr=({state:t,dispatch:e})=>Jt(t,e,!0),Wr=t=>{if(t.state.readOnly)return!1;let{state:e}=t,r=e.changes(ge(e).map(({from:o,to:i})=>(o>0?o--:i<e.doc.length&&i++,{from:o,to:i}))),n=G(e.selection,o=>{let i;if(t.lineWrapping){let l=t.lineBlockAt(o.head),s=t.coordsAtPos(o.head,o.assoc||1);s&&(i=l.bottom+t.documentTop-s.bottom+t.defaultLineHeight/2)}return t.moveVertically(o,!0,i)}).map(r);return t.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function qr(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let r=Re(t).resolveInner(e),n=r.childBefore(e),o=r.childAfter(e),i;return n&&o&&n.to<=e&&o.from>=e&&(i=n.type.prop(Se.closedBy))&&i.indexOf(o.name)>-1&&t.doc.lineAt(n.to).from==t.doc.lineAt(o.from).from&&!/\S/.test(t.sliceDoc(n.to,o.from))?{from:n.to,to:o.from}:null}const _e=Kt(!1),Nr=Kt(!0);function Kt(t){return({state:e,dispatch:r})=>{if(e.readOnly)return!1;let n=e.changeByRange(o=>{let{from:i,to:l}=o,s=e.doc.lineAt(i),c=!t&&i==l&&qr(e,i);t&&(i=l=(l<=s.to?s:e.doc.lineAt(l)).to);let a=new ut(e,{simulateBreak:i,simulateDoubleBreak:!!c}),h=ft(a,i);for(h==null&&(h=we(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));l<s.to&&/\s/.test(s.text[l-s.from]);)l++;c?{from:i,to:l}=c:i>s.from&&i<s.from+100&&!/\S/.test(s.text.slice(0,i))&&(i=s.from);let u=["",oe(e,h)];return c&&u.push(oe(e,a.lineIndent(s.from,-1))),{changes:{from:i,to:l,insert:ct.of(u)},range:f.cursor(i+1+u[1].length)}});return r(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Te(t,e){let r=-1;return t.changeByRange(n=>{let o=[];for(let l=n.from;l<=n.to;){let s=t.doc.lineAt(l);s.number>r&&(n.empty||n.to>s.from)&&(e(s,o,n),r=s.number),l=s.to+1}let i=t.changes(o);return{changes:o,range:f.range(i.mapPos(n.anchor,1),i.mapPos(n.head,1))}})}const Vr=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=Object.create(null),n=new ut(t,{overrideIndentation:i=>{let l=r[i];return l??-1}}),o=Te(t,(i,l,s)=>{let c=ft(n,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let a=/^\s*/.exec(i.text)[0],h=oe(t,c);(a!=h||s.from<i.from+a.length)&&(r[i.from]=c,l.push({from:i.from,to:i.from+a.length,insert:h}))});return o.changes.empty||e(t.update(o,{userEvent:"indent"})),!0},$r=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Te(t,(r,n)=>{n.push({from:r.from,insert:t.facet(Ln)})}),{userEvent:"input.indent"})),!0),Ur=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Te(t,(r,n)=>{let o=/^\s*/.exec(r.text)[0];if(!o)return;let i=we(o,t.tabSize),l=0,s=oe(t,Math.max(0,i-Ae(t)));for(;l<o.length&&l<s.length&&o.charCodeAt(l)==s.charCodeAt(l);)l++;n.push({from:r.from+l,to:r.from+o.length,insert:s.slice(l)})}),{userEvent:"delete.dedent"})),!0),zr=t=>(t.setTabFocusMode(),!0),Gr=[{key:"Ctrl-b",run:Mt,shift:Tt,preventDefault:!0},{key:"Ctrl-f",run:vt,shift:Pt},{key:"Ctrl-p",run:Bt,shift:Wt},{key:"Ctrl-n",run:wt,shift:qt},{key:"Ctrl-a",run:sr,shift:kr},{key:"Ctrl-e",run:cr,shift:Sr},{key:"Ctrl-d",run:Ut},{key:"Ctrl-h",run:ve},{key:"Ctrl-k",run:Br},{key:"Ctrl-Alt-h",run:Gt},{key:"Ctrl-o",run:Er},{key:"Ctrl-t",run:Ir},{key:"Ctrl-v",run:Me}],Hr=[{key:"ArrowLeft",run:Mt,shift:Tt,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Zn,shift:ur,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:ir,shift:yr,preventDefault:!0},{key:"ArrowRight",run:vt,shift:Pt,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Xn,shift:fr,preventDefault:!0},{mac:"Cmd-ArrowRight",run:lr,shift:xr,preventDefault:!0},{key:"ArrowUp",run:Bt,shift:Wt,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Ge,shift:Je},{mac:"Ctrl-ArrowUp",run:$e,shift:Ue},{key:"ArrowDown",run:wt,shift:qt,preventDefault:!0},{mac:"Cmd-ArrowDown",run:He,shift:Ke},{mac:"Ctrl-ArrowDown",run:Me,shift:ze},{key:"PageUp",run:$e,shift:Ue},{key:"PageDown",run:Me,shift:ze},{key:"Home",run:or,shift:pr,preventDefault:!0},{key:"Mod-Home",run:Ge,shift:Je},{key:"End",run:rr,shift:gr,preventDefault:!0},{key:"Mod-End",run:He,shift:Ke},{key:"Enter",run:_e,shift:_e},{key:"Mod-a",run:Ar},{key:"Backspace",run:ve,shift:ve,preventDefault:!0},{key:"Delete",run:Ut,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Gt,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Dr,preventDefault:!0},{mac:"Mod-Backspace",run:wr,preventDefault:!0},{mac:"Mod-Delete",run:Rr,preventDefault:!0}].concat(Gr.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),_t=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:tr,shift:dr},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:nr,shift:mr},{key:"Alt-ArrowUp",run:Tr},{key:"Shift-Alt-ArrowUp",run:Or},{key:"Alt-ArrowDown",run:Pr},{key:"Shift-Alt-ArrowDown",run:Fr},{key:"Mod-Alt-ArrowUp",run:Mr},{key:"Mod-Alt-ArrowDown",run:vr},{key:"Escape",run:Lr},{key:"Mod-Enter",run:Nr},{key:"Alt-l",mac:"Ctrl-l",run:Cr},{key:"Mod-i",run:br,preventDefault:!0},{key:"Mod-[",run:Ur},{key:"Mod-]",run:$r},{key:"Mod-Alt-\\",run:Vr},{key:"Shift-Mod-k",run:Wr},{key:"Shift-Mod-\\",run:hr},{key:"Mod-/",run:On},{key:"Alt-A",run:Wn},{key:"Ctrl-m",mac:"Shift-Alt-m",run:zr}].concat(Hr),Qe=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class z{constructor(e,r,n=0,o=e.length,i,l){this.test=l,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,o),this.bufferStart=n,this.normalize=i?s=>i(Qe(s)):Qe,this.query=this.normalize(r)}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 bn(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 r=Mn(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=vn(e);let o=this.normalize(r);if(o.length)for(let i=0,l=n;;i++){let s=o.charCodeAt(i),c=this.match(s,l,this.bufferPos+this.bufferStart);if(i==o.length-1){if(c)return this.value=c,this;break}l==n&&i<r.length&&r.charCodeAt(i)==s&&l++}}}match(e,r,n){let o=null;for(let i=0;i<this.matches.length;i+=2){let l=this.matches[i],s=!1;this.query.charCodeAt(l)==e&&(l==this.query.length-1?o={from:this.matches[i+1],to:n}:(this.matches[i]++,s=!0)),s||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:r,to:n}:this.matches.push(1,r)),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(z.prototype[Symbol.iterator]=function(){return this});const Qt={from:-1,to:-1,match:/.*/.exec("")},Pe="gm"+(/x/.unicode==null?"":"u");class jt{constructor(e,r,n,o=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=Qt,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new Yt(e,r,n,o,i);this.re=new RegExp(r,Pe+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let l=e.lineAt(o);this.curLineStart=l.from,this.matchPos=le(e,o),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 r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,o=n+r[0].length;if(this.matchPos=le(this.text,o+(n==o?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<o||n>this.value.to)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,match:r},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 xe=new WeakMap;class U{constructor(e,r){this.from=e,this.text=r}get to(){return this.from+this.text.length}static get(e,r,n){let o=xe.get(e);if(!o||o.from>=n||o.to<=r){let s=new U(r,e.sliceString(r,n));return xe.set(e,s),s}if(o.from==r&&o.to==n)return o;let{text:i,from:l}=o;return l>r&&(i=e.sliceString(r,l)+i,l=r),o.to<n&&(i+=e.sliceString(o.to,n)),xe.set(e,new U(l,i)),new U(r,i.slice(r-l,n-l))}}class Yt{constructor(e,r,n,o,i){this.text=e,this.to=i,this.done=!1,this.value=Qt,this.matchPos=le(e,o),this.re=new RegExp(r,Pe+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=U.get(e,o,this.chunkEnd(o+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,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==e&&(this.re.lastIndex=e+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,o=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,match:r},this.matchPos=le(this.text,o+(n==o?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=U.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(jt.prototype[Symbol.iterator]=Yt.prototype[Symbol.iterator]=function(){return this});function Jr(t){try{return new RegExp(t,Pe),!0}catch{return!1}}function le(t,e){if(e>=t.length)return e;let r=t.lineAt(e),n;for(;e<r.to&&(n=r.text.charCodeAt(e-r.from))>=56320&&n<57344;)e++;return e}const Kr=t=>{let{state:e}=t,r=String(e.doc.lineAt(t.state.selection.main.head).number),{close:n,result:o}=hn(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:e.phrase("go")});return o.then(i=>{let l=i&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.elements.line.value);if(!l){t.dispatch({effects:n});return}let s=e.doc.lineAt(e.selection.main.head),[,c,a,h,u]=l,d=h?+h.slice(1):0,m=a?+a:s.number;if(a&&u){let x=m/100;c&&(x=x*(c=="-"?-1:1)+s.number/e.doc.lines),m=Math.round(e.doc.lines*x)}else a&&c&&(m=m*(c=="-"?-1:1)+s.number);let g=e.doc.line(Math.max(1,Math.min(e.doc.lines,m))),S=f.cursor(g.from+Math.max(0,Math.min(d,g.length)));t.dispatch({effects:[n,A.scrollIntoView(S.from,{y:"center"})],selection:S})}),!0},_r={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Qr=j.define({combine(t){return ue(t,_r,{highlightWordAroundCursor:(e,r)=>e||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function jr(t){return[to,eo]}const Yr=k.mark({class:"cm-selectionMatch"}),Zr=k.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function je(t,e,r,n){return(r==0||t(e.sliceDoc(r-1,r))!=L.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=L.Word)}function Xr(t,e,r,n){return t(e.sliceDoc(r,r+1))==L.Word&&t(e.sliceDoc(n-1,n))==L.Word}const eo=nt.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(Qr),{state:r}=t,n=r.selection;if(n.ranges.length>1)return k.none;let o=n.main,i,l=null;if(o.empty){if(!e.highlightWordAroundCursor)return k.none;let c=r.wordAt(o.head);if(!c)return k.none;l=r.charCategorizer(o.head),i=r.sliceDoc(c.from,c.to)}else{let c=o.to-o.from;if(c<e.minSelectionLength||c>200)return k.none;if(e.wholeWords){if(i=r.sliceDoc(o.from,o.to),l=r.charCategorizer(o.head),!(je(l,r,o.from,o.to)&&Xr(l,r,o.from,o.to)))return k.none}else if(i=r.sliceDoc(o.from,o.to),!i)return k.none}let s=[];for(let c of t.visibleRanges){let a=new z(r.doc,i,c.from,c.to);for(;!a.next().done;){let{from:h,to:u}=a.value;if((!l||je(l,r,h,u))&&(o.empty&&h<=o.from&&u>=o.to?s.push(Zr.range(h,u)):(h>=o.to||u<=o.from)&&s.push(Yr.range(h,u)),s.length>e.maxMatches))return k.none}}return k.set(s)}},{decorations:t=>t.decorations}),to=A.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),no=({state:t,dispatch:e})=>{let{selection:r}=t,n=f.create(r.ranges.map(o=>t.wordAt(o.head)||f.cursor(o.head)),r.mainIndex);return n.eq(r)?!1:(e(t.update({selection:n})),!0)};function ro(t,e){let{main:r,ranges:n}=t.selection,o=t.wordAt(r.head),i=o&&o.from==r.from&&o.to==r.to;for(let l=!1,s=new z(t.doc,e,n[n.length-1].to);;)if(s.next(),s.done){if(l)return null;s=new z(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),l=!0}else{if(l&&n.some(c=>c.from==s.value.from))continue;if(i){let c=t.wordAt(s.value.from);if(!c||c.from!=s.value.from||c.to!=s.value.to)continue}return s.value}}const oo=({state:t,dispatch:e})=>{let{ranges:r}=t.selection;if(r.some(i=>i.from===i.to))return no({state:t,dispatch:e});let n=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=n))return!1;let o=ro(t,n);return o?(e(t.update({selection:t.selection.addRange(f.range(o.from,o.to),!1),effects:A.scrollIntoView(o.to)})),!0):!1},H=j.define({combine(t){return ue(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new ko(e),scrollToMatch:e=>A.scrollIntoView(e)})}});class Zt{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||Jr(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
|
|
2
|
-
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new ho(this):new so(this)}getCursor(e,r=0,n){let o=e.doc?e:at.create({doc:e});return n==null&&(n=o.doc.length),this.regexp?V(this,o,r,n):N(this,o,r,n)}}class Xt{constructor(e){this.spec=e}}function io(t,e,r){return(n,o,i,l)=>{if(r&&!r(n,o,i,l))return!1;let s=n>=l&&o<=l+i.length?i.slice(n-l,o-l):e.doc.sliceString(n,o);return t(s,e,n,o)}}function N(t,e,r,n){let o;return t.wholeWord&&(o=lo(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(o=io(t.test,e,o)),new z(e.doc,t.unquoted,r,n,t.caseSensitive?void 0:i=>i.toLowerCase(),o)}function lo(t,e){return(r,n,o,i)=>((i>r||i+o.length<n)&&(i=Math.max(0,r-2),o=t.sliceString(i,Math.min(t.length,n+2))),(e(se(o,r-i))!=L.Word||e(ce(o,r-i))!=L.Word)&&(e(ce(o,n-i))!=L.Word||e(se(o,n-i))!=L.Word))}class so extends Xt{constructor(e){super(e)}nextMatch(e,r,n){let o=N(this.spec,e,n,e.doc.length).nextOverlapping();if(o.done){let i=Math.min(e.doc.length,r+this.spec.unquoted.length);o=N(this.spec,e,0,i).nextOverlapping()}return o.done||o.value.from==r&&o.value.to==n?null:o.value}prevMatchInRange(e,r,n){for(let o=n;;){let i=Math.max(r,o-1e4-this.spec.unquoted.length),l=N(this.spec,e,i,o),s=null;for(;!l.nextOverlapping().done;)s=l.value;if(s)return s;if(i==r)return null;o-=1e4}}prevMatch(e,r,n){let o=this.prevMatchInRange(e,0,r);return o||(o=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),o&&(o.from!=r||o.to!=n)?o:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,r){let n=N(this.spec,e,0,e.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(e,r,n,o){let i=N(this.spec,e,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}}function co(t,e,r){return(n,o,i)=>(!r||r(n,o,i))&&t(i[0],e,n,o)}function V(t,e,r,n){let o;return t.wholeWord&&(o=ao(e.charCategorizer(e.selection.main.head))),t.test&&(o=co(t.test,e,o)),new jt(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:o},r,n)}function se(t,e){return t.slice(q(t,e,!1),e)}function ce(t,e){return t.slice(e,q(t,e))}function ao(t){return(e,r,n)=>!n[0].length||(t(se(n.input,n.index))!=L.Word||t(ce(n.input,n.index))!=L.Word)&&(t(ce(n.input,n.index+n[0].length))!=L.Word||t(se(n.input,n.index+n[0].length))!=L.Word)}class ho extends Xt{nextMatch(e,r,n){let o=V(this.spec,e,n,e.doc.length).next();return o.done&&(o=V(this.spec,e,0,r).next()),o.done?null:o.value}prevMatchInRange(e,r,n){for(let o=1;;o++){let i=Math.max(r,n-o*1e4),l=V(this.spec,e,i,n),s=null;for(;!l.next().done;)s=l.value;if(s&&(i==r||s.from>i+10))return s;if(i==r)return null}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let o=n.length;o>0;o--){let i=+n.slice(0,o);if(i>0&&i<e.match.length)return e.match[i]+n.slice(o)}return r})}matchAll(e,r){let n=V(this.spec,e,0,e.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(e,r,n,o){let i=V(this.spec,e,Math.max(0,r-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}}const K=T.define(),Oe=T.define(),P=Be.define({create(t){return new ke(Le(t).create(),null)},update(t,e){for(let r of e.effects)r.is(K)?t=new ke(r.value.create(),t.panel):r.is(Oe)&&(t=new ke(t.query,r.value?Fe:null));return t},provide:t=>rt.from(t,e=>e.panel)});class ke{constructor(e,r){this.query=e,this.panel=r}}const uo=k.mark({class:"cm-searchMatch"}),fo=k.mark({class:"cm-searchMatch cm-searchMatch-selected"}),mo=nt.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(P))}update(t){let e=t.state.field(P);(e!=t.startState.field(P)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return k.none;let{view:r}=this,n=new ht;for(let o=0,i=r.visibleRanges,l=i.length;o<l;o++){let{from:s,to:c}=i[o];for(;o<l-1&&c>i[o+1].from-500;)c=i[++o].to;t.highlight(r.state,s,c,(a,h)=>{let u=r.state.selection.ranges.some(d=>d.from==a&&d.to==h);n.add(a,h,u?fo:uo)})}return n.finish()}},{decorations:t=>t.decorations});function Z(t){return e=>{let r=e.state.field(P,!1);return r&&r.query.spec.valid?t(e,r):nn(e)}}const ae=Z((t,{query:e})=>{let{to:r}=t.state.selection.main,n=e.nextMatch(t.state,r,r);if(!n)return!1;let o=f.single(n.from,n.to),i=t.state.facet(H);return t.dispatch({selection:o,effects:[We(t,n),i.scrollToMatch(o.main,t)],userEvent:"select.search"}),tn(t),!0}),he=Z((t,{query:e})=>{let{state:r}=t,{from:n}=r.selection.main,o=e.prevMatch(r,n,n);if(!o)return!1;let i=f.single(o.from,o.to),l=t.state.facet(H);return t.dispatch({selection:i,effects:[We(t,o),l.scrollToMatch(i.main,t)],userEvent:"select.search"}),tn(t),!0}),go=Z((t,{query:e})=>{let r=e.matchAll(t.state,1e3);return!r||!r.length?!1:(t.dispatch({selection:f.create(r.map(n=>f.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),po=({state:t,dispatch:e})=>{let r=t.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:o}=r.main,i=[],l=0;for(let s=new z(t.doc,t.sliceDoc(n,o));!s.next().done;){if(i.length>1e3)return!1;s.value.from==n&&(l=i.length),i.push(f.range(s.value.from,s.value.to))}return e(t.update({selection:f.create(i,l),userEvent:"select.search.matches"})),!0},Ye=Z((t,{query:e})=>{let{state:r}=t,{from:n,to:o}=r.selection.main;if(r.readOnly)return!1;let i=e.nextMatch(r,n,n);if(!i)return!1;let l=i,s=[],c,a,h=[];l.from==n&&l.to==o&&(a=r.toText(e.getReplacement(l)),s.push({from:l.from,to:l.to,insert:a}),l=e.nextMatch(r,l.from,l.to),h.push(A.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+".")));let u=t.state.changes(s);return l&&(c=f.single(l.from,l.to).map(u),h.push(We(t,l)),h.push(r.facet(H).scrollToMatch(c.main,t))),t.dispatch({changes:u,selection:c,effects:h,userEvent:"input.replace"}),!0}),yo=Z((t,{query:e})=>{if(t.state.readOnly)return!1;let r=e.matchAll(t.state,1e9).map(o=>{let{from:i,to:l}=o;return{from:i,to:l,insert:e.getReplacement(o)}});if(!r.length)return!1;let n=t.state.phrase("replaced $ matches",r.length)+".";return t.dispatch({changes:r,effects:A.announce.of(n),userEvent:"input.replace.all"}),!0});function Fe(t){return t.state.facet(H).createPanel(t)}function Le(t,e){var r,n,o,i,l;let s=t.selection.main,c=s.empty||s.to>s.from+100?"":t.sliceDoc(s.from,s.to);if(e&&!c)return e;let a=t.facet(H);return new Zt({search:((r=e?.literal)!==null&&r!==void 0?r:a.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:a.caseSensitive,literal:(o=e?.literal)!==null&&o!==void 0?o:a.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:a.regexp,wholeWord:(l=e?.wholeWord)!==null&&l!==void 0?l:a.wholeWord})}function en(t){let e=De(t,Fe);return e&&e.dom.querySelector("[main-field]")}function tn(t){let e=en(t);e&&e==t.root.activeElement&&e.select()}const nn=t=>{let e=t.state.field(P,!1);if(e&&e.panel){let r=en(t);if(r&&r!=t.root.activeElement){let n=Le(t.state,e.query.spec);n.valid&&t.dispatch({effects:K.of(n)}),r.focus(),r.select()}}else t.dispatch({effects:[Oe.of(!0),e?K.of(Le(t.state,e.query.spec)):T.appendConfig.of(Ao)]});return!0},rn=t=>{let e=t.state.field(P,!1);if(!e||!e.panel)return!1;let r=De(t,Fe);return r&&r.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Oe.of(!1)}),!0},xo=[{key:"Mod-f",run:nn,scope:"editor search-panel"},{key:"F3",run:ae,shift:he,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ae,shift:he,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:rn,scope:"editor search-panel"},{key:"Mod-Shift-l",run:po},{key:"Mod-Alt-g",run:Kr},{key:"Mod-d",run:oo,preventDefault:!0}];class ko{constructor(e){this.view=e;let r=this.query=e.state.field(P).query.spec;this.commit=this.commit.bind(this),this.searchField=y("input",{value:r.search,placeholder:M(e,"Find"),"aria-label":M(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=y("input",{value:r.replace,placeholder:M(e,"Replace"),"aria-label":M(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=y("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=y("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=y("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(o,i,l){return y("button",{class:"cm-button",name:o,onclick:i,type:"button"},l)}this.dom=y("div",{onkeydown:o=>this.keydown(o),class:"cm-search"},[this.searchField,n("next",()=>ae(e),[M(e,"next")]),n("prev",()=>he(e),[M(e,"previous")]),n("select",()=>go(e),[M(e,"all")]),y("label",null,[this.caseField,M(e,"match case")]),y("label",null,[this.reField,M(e,"regexp")]),y("label",null,[this.wordField,M(e,"by word")]),...e.state.readOnly?[]:[y("br"),this.replaceField,n("replace",()=>Ye(e),[M(e,"replace")]),n("replaceAll",()=>yo(e),[M(e,"replace all")])],y("button",{name:"close",onclick:()=>rn(e),"aria-label":M(e,"close"),type:"button"},["×"])])}commit(){let e=new Zt({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:K.of(e)}))}keydown(e){un(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?he:ae)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Ye(this.view))}update(e){for(let r of e.transactions)for(let n of r.effects)n.is(K)&&!n.value.eq(this.query)&&this.setQuery(n.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(H).top}}function M(t,e){return t.state.phrase(e)}const te=30,ne=/[\s\.,:;?!]/;function We(t,{from:e,to:r}){let n=t.state.doc.lineAt(e),o=t.state.doc.lineAt(r).to,i=Math.max(n.from,e-te),l=Math.min(o,r+te),s=t.state.sliceDoc(i,l);if(i!=n.from){for(let c=0;c<te;c++)if(!ne.test(s[c+1])&&ne.test(s[c])){s=s.slice(c);break}}if(l!=o){for(let c=s.length-1;c>s.length-te;c--)if(!ne.test(s[c-1])&&ne.test(s[c])){s=s.slice(0,c);break}}return A.announce.of(`${t.state.phrase("current match")}. ${s} ${t.state.phrase("on line")} ${n.number}.`)}const So=A.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"}}),Ao=[P,Cn.low(mo),So];class Ze{constructor(e,r,n){this.from=e,this.to=r,this.diagnostic=n}}class W{constructor(e,r,n){this.diagnostics=e,this.panel=r,this.selected=n}static init(e,r,n){let o=n.facet(_).markerFilter;o&&(e=o(e,n));let i=e.slice().sort((m,g)=>m.from-g.from||m.to-g.to),l=new ht,s=[],c=0,a=n.doc.iter(),h=0,u=n.doc.length;for(let m=0;;){let g=m==i.length?null:i[m];if(!g&&!s.length)break;let S,x;if(s.length)S=c,x=s.reduce((p,E)=>Math.min(p,E.to),g&&g.from>S?g.from:1e8);else{if(S=g.from,S>u)break;x=g.to,s.push(g),m++}for(;m<i.length;){let p=i[m];if(p.from==S&&(p.to>p.from||p.to==S))s.push(p),m++,x=Math.min(p.to,x);else{x=Math.min(p.from,x);break}}x=Math.min(x,u);let X=!1;if(s.some(p=>p.from==S&&(p.to==x||x==u))&&(X=S==x,!X&&x-S<10)){let p=S-(h+a.value.length);p>0&&(a.next(p),h=S);for(let E=S;;){if(E>=x){X=!0;break}if(!a.lineBreak&&h+a.value.length>E)break;E=h+a.value.length,h+=a.value.length,a.next()}}let Ne=Po(s);if(X)l.add(S,S,k.widget({widget:new Ro(Ne),diagnostics:s.slice()}));else{let p=s.reduce((E,Ve)=>Ve.markClass?E+" "+Ve.markClass:E,"");l.add(S,x,k.mark({class:"cm-lintRange cm-lintRange-"+Ne+p,diagnostics:s.slice(),inclusiveEnd:s.some(E=>E.to>x)}))}if(c=x,c==u)break;for(let p=0;p<s.length;p++)s[p].to<=c&&s.splice(p--,1)}let d=l.finish();return new W(d,r,O(d))}}function O(t,e=null,r=0){let n=null;return t.between(r,1e9,(o,i,{spec:l})=>{if(!(e&&l.diagnostics.indexOf(e)<0))if(!n)n=new Ze(o,i,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new Ze(n.from,i,n.diagnostic)}}),n}function Co(t,e){let r=e.pos,n=e.end||r,o=t.state.facet(_).hideOn(t,r,n);if(o!=null)return o;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(l=>l.is(on))||t.changes.touchesRange(i.from,Math.max(i.to,n)))}function bo(t,e){return t.field(v,!1)?e:e.concat(T.appendConfig.of(Oo))}const on=T.define(),qe=T.define(),ln=T.define(),v=Be.define({create(){return new W(k.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let r=t.diagnostics.map(e.changes),n=null,o=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);n=O(r,t.selected.diagnostic,i)||O(r,null,i)}!r.size&&o&&e.state.facet(_).autoPanel&&(o=null),t=new W(r,o,n)}for(let r of e.effects)if(r.is(on)){let n=e.state.facet(_).autoPanel?r.value.length?Q.open:null:t.panel;t=W.init(r.value,n,e.state)}else r.is(qe)?t=new W(t.diagnostics,r.value?Q.open:null,t.selected):r.is(ln)&&(t=new W(t.diagnostics,t.panel,r.value));return t},provide:t=>[rt.from(t,e=>e.panel),A.decorations.from(t,e=>e.diagnostics)]}),Mo=k.mark({class:"cm-lintRange cm-lintRange-active"});function vo(t,e,r){let{diagnostics:n}=t.state.field(v),o,i=-1,l=-1;n.between(e-(r<0?1:0),e+(r>0?1:0),(c,a,{spec:h})=>{if(e>=c&&e<=a&&(c==a||(e>c||r>0)&&(e<a||r<0)))return o=h.diagnostics,i=c,l=a,!1});let s=t.state.facet(_).tooltipFilter;return o&&s&&(o=s(o,t.state)),o?{pos:i,end:l,above:t.state.doc.lineAt(i).to<l,create(){return{dom:Lo(t,o)}}}:null}function Lo(t,e){return y("ul",{class:"cm-tooltip-lint"},e.map(r=>cn(t,r,!1)))}const Do=t=>{let e=t.state.field(v,!1);(!e||!e.panel)&&t.dispatch({effects:bo(t.state,[qe.of(!0)])});let r=De(t,Q.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0},Xe=t=>{let e=t.state.field(v,!1);return!e||!e.panel?!1:(t.dispatch({effects:qe.of(!1)}),!0)},Bo=t=>{let e=t.state.field(v,!1);if(!e)return!1;let r=t.state.selection.main,n=O(e.diagnostics,null,r.to+1);return!n&&(n=O(e.diagnostics,null,0),!n||n.from==r.from&&n.to==r.to)?!1:(t.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},wo=[{key:"Mod-Shift-m",run:Do,preventDefault:!0},{key:"F8",run:Bo}],_=j.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...ue(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:et,tooltipFilter:et,needsRefresh:(e,r)=>e?r?n=>e(n)||r(n):e:r,hideOn:(e,r)=>e?r?(n,o,i)=>e(n,o,i)||r(n,o,i):e:r,autoPanel:(e,r)=>e||r})}}});function et(t,e){return t?e?(r,n)=>e(t(r,n),n):t:e}function sn(t){let e=[];if(t)e:for(let{name:r}of t){for(let n=0;n<r.length;n++){let o=r[n];if(/[a-zA-Z]/.test(o)&&!e.some(i=>i.toLowerCase()==o.toLowerCase())){e.push(o);continue e}}e.push("")}return e}function cn(t,e,r){var n;let o=r?sn(e.actions):[];return y("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},y("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((i,l)=>{let s=!1,c=m=>{if(m.preventDefault(),s)return;s=!0;let g=O(t.state.field(v).diagnostics,e);g&&i.apply(t,g.from,g.to)},{name:a}=i,h=o[l]?a.indexOf(o[l]):-1,u=h<0?a:[a.slice(0,h),y("u",a.slice(h,h+1)),a.slice(h+1)],d=i.markClass?" "+i.markClass:"";return y("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:c,onmousedown:c,"aria-label":` Action: ${a}${h<0?"":` (access key "${o[l]})"`}.`},u)}),e.source&&y("div",{class:"cm-diagnosticSource"},e.source))}class Ro extends dn{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return y("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class tt{constructor(e,r){this.diagnostic=r,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=cn(e,r,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Q{constructor(e){this.view=e,this.items=[];let r=o=>{if(!(o.ctrlKey||o.altKey||o.metaKey)){if(o.keyCode==27)Xe(this.view),this.view.focus();else if(o.keyCode==38||o.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(o.keyCode==40||o.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(o.keyCode==36)this.moveSelection(0);else if(o.keyCode==35)this.moveSelection(this.items.length-1);else if(o.keyCode==13)this.view.focus();else if(o.keyCode>=65&&o.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],l=sn(i.actions);for(let s=0;s<l.length;s++)if(l[s].toUpperCase().charCodeAt(0)==o.keyCode){let c=O(this.view.state.field(v).diagnostics,i);c&&i.actions[s].apply(e,c.from,c.to)}}else return;o.preventDefault()}},n=o=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(o.target)&&this.moveSelection(i)};this.list=y("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:r,onclick:n}),this.dom=y("div",{class:"cm-panel-lint"},this.list,y("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Xe(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(v).selected;if(!e)return-1;for(let r=0;r<this.items.length;r++)if(this.items[r].diagnostic==e.diagnostic)return r;return-1}update(){let{diagnostics:e,selected:r}=this.view.state.field(v),n=0,o=!1,i=null,l=new Set;for(e.between(0,this.view.state.doc.length,(s,c,{spec:a})=>{for(let h of a.diagnostics){if(l.has(h))continue;l.add(h);let u=-1,d;for(let m=n;m<this.items.length;m++)if(this.items[m].diagnostic==h){u=m;break}u<0?(d=new tt(this.view,h),this.items.splice(n,0,d),o=!0):(d=this.items[u],u>n&&(this.items.splice(n,u-n),o=!0)),r&&d.diagnostic==r.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),i=d):d.dom.hasAttribute("aria-selected")&&d.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)o=!0,this.items.pop();this.items.length==0&&(this.items.push(new tt(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),o=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:s,panel:c})=>{let a=c.height/this.list.offsetHeight;s.top<c.top?this.list.scrollTop-=(c.top-s.top)/a:s.bottom>c.bottom&&(this.list.scrollTop+=(s.bottom-c.bottom)/a)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}sync(){let e=this.list.firstChild;function r(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)r();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)r()}moveSelection(e){if(this.selectedIndex<0)return;let r=this.view.state.field(v),n=O(r.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:ln.of(n)})}static open(e){return new Q(e)}}function Eo(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function re(t){return Eo(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Io=A.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:re("#d11")},".cm-lintRange-warning":{backgroundImage:re("orange")},".cm-lintRange-info":{backgroundImage:re("#999")},".cm-lintRange-hint":{backgroundImage:re("#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}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function To(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function Po(t){let e="hint",r=1;for(let n of t){let o=To(n.severity);o>r&&(r=o,e=n.severity)}return e}const Oo=[v,A.decorations.compute([v],t=>{let{selected:e,panel:r}=t.field(v);return!e||!r||e.from==e.to?k.none:k.set([Mo.range(e.from,e.to)])}),fn(vo,{hideOn:Co}),Io],Vo=[mn(),gn(),ot(),xt(),Dn(),it(),pn(),at.allowMultipleSelections.of(!0),Bn(),dt(mt,{fallback:!0}),wn(),En(),In(),yn(),xn(),kn(),jr(),lt.of([...Tn,..._t,...xo,...Ct,...Rn,...Pn,...wo])],$o=[ot(),xt(),it(),dt(mt,{fallback:!0}),lt.of([..._t,...Ct])];export{A as EditorView,Vo as basicSetup,$o as minimalSetup};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as L,u as $,r as E,M as j,N as y,v as S,F as G}from"./index-CVbycZ0H.js";var N={};class v{constructor(t,e,s,i,h,r,n,o,a,u=0,f){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=a,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new v(t,[],e,s,s,0,[],0,i?new R(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),n=h.dynamicPrecedence(i);if(n&&(this.score+=n),s==0){this.pushState(h.getGoto(this.state,i,!0),this.reducePos),i<h.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0),this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(s-1)*3-(t&262144?6:0),a=o?this.stack[o-2]:this.p.ranges[0].from,u=this.reducePos-a;u>=2e3&&!(!((e=this.p.parser.nodeSet.types[i])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=u));let f=o?this.stack[o-1]:0,p=this.bufferBase+this.buffer.length-f;if(i<h.minRepeatTerm||t&131072){let c=h.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,c,p+4,!0)}if(t&262144)this.state=this.stack[o];else{let c=this.stack[o-3];this.state=h.getGoto(c,i,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this,n=this.buffer.length;if(n==0&&r.parent&&(n=r.bufferBase-r.parent.bufferBase,r=r.parent),n>0&&r.buffer[n-4]==0&&r.buffer[n-1]>-1){if(e==s)return;if(r.buffer[n-2]>=e){r.buffer[n-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i;let n=r.stateFlag(h,1);!n&&(i>s||e<=r.maxNode)&&(this.reducePos=i),this.pushState(h,n?s:Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode&&this.buffer.push(e,s,i,4)}else this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4)}apply(t,e,s,i){t&65536?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new v(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new U(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;h<e.length;h+=2)(r=e[h+1])!=this.state&&this.p.parser.hasAction(r,t)&&i.push(e[h],r);if(this.stack.length<120)for(let h=0;i.length<8&&h<e.length;h+=2){let r=e[h+1];i.some((n,o)=>o&1&&n==r)||i.push(e[h],r)}e=i}let s=[];for(let i=0;i<e.length&&s.length<4;i+=2){let h=e[i+1];if(h==this.state)continue;let r=this.split();r.pushState(h,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[i],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(!e.includes(i))return e.push(i),t.allActions(i,r=>{if(!(r&393216))if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,a=this.stack.length-n*3;if(a>=0&&t.getGoto(this.stack[a],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new R(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){return t<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=t,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class R{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class U{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class A{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new A(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new A(this.stack,this.pos,this.index)}}function x(l,t=Uint16Array){if(typeof l!="string")return l;let e=null;for(let s=0,i=0;s<l.length;){let h=0;for(;;){let r=l.charCodeAt(s++),n=!1;if(r==126){h=65535;break}r>=92&&r--,r>=34&&r--;let o=r-32;if(o>=46&&(o-=46,n=!0),h+=o,n)break;h*=46}e?e[i++]=h:e=new t(h)}return e}class P{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const z=new P;class H{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=z,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;for(;h<s.from;){if(!i)return null;let r=this.ranges[--i];h-=s.from-r.to,s=r}for(;e<0?h>s.to:h>=s.to;){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e<this.chunk.length)s=this.pos+t,i=this.chunk.charCodeAt(e);else{let h=this.resolveOffset(t,1);if(h==null)return-1;if(s=h,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let r=this.rangeIndex,n=this.range;for(;n.to<=s;)n=this.ranges[++r];this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>n.to&&(this.chunk2=this.chunk2.slice(0,n.to-s)),i=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=z,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class m{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;O(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}m.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class W{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?x(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(O(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(h||i++,r==null)break;t.reset(r,t.token)}i&&(t.reset(s,t.token),t.acceptToken(this.elseToken,i))}}W.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class Z{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function O(l,t,e,s,i,h){let r=0,n=1<<s,{dialect:o}=e.p.parser;t:for(;(n&l[r])!=0;){let a=l[r+1];for(let c=r+3;c<a;c+=2)if((l[c+1]&n)>0){let d=l[c];if(o.allows(d)&&(t.token.value==-1||t.token.value==d||q(d,t.token.value,i,h))){t.acceptToken(d);break}}let u=t.next,f=0,p=l[r+2];if(t.next<0&&p>f&&l[a+p*3-3]==65535){r=l[a+p*3-1];continue t}for(;f<p;){let c=f+p>>1,d=a+c+(c<<1),b=l[d],M=l[d+1]||65536;if(u<b)p=c;else if(u>=M)f=c+1;else{r=l[d+2],t.advance();continue t}}break}}function I(l,t,e){for(let s=t,i;(i=l[s])!=65535;s++)if(i==e)return s-t;return-1}function q(l,t,e,s){let i=I(e,s,t);return i<0||I(e,s,l)<i}const g=typeof process<"u"&&N&&/\bparse\b/.test(N.LOG);let T=null;function D(l,t,e){let s=l.cursor(G.IncludeAnonymous);for(s.moveTo(t);;)if(!(e<0?s.childBefore(t):s.childAfter(t)))for(;;){if((e<0?s.to<t:s.from>t)&&!s.type.isError)return e<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(l.length,Math.max(s.from+1,t+25));if(e<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return e<0?0:l.length}}class J{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?D(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?D(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],i=this.index[e];if(i==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let h=s.children[i],r=this.start[e]+s.positions[i];if(r>t)return this.nextStart=r,null;if(h instanceof S){if(r==t){if(r<this.safeFrom)return null;let n=r+h.length;if(n<=this.safeTo){let o=h.prop(y.lookAhead);if(!o||n+o<this.fragment.to)return h}}this.index[e]++,r+h.length>=Math.max(this.safeFrom,t)&&(this.trees.push(h),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+h.length}}}class K{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(s=>new P)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let a=0;a<h.length;a++){if((1<<a&r)==0)continue;let u=h[a],f=this.tokens[a];if(!(s&&!u.fallback)&&((u.contextual||f.start!=t.pos||f.mask!=r||f.context!=n)&&(this.updateCachedToken(f,u,t),f.mask=r,f.context=n),f.lookAhead>f.end+25&&(o=Math.max(f.lookAhead,o)),f.value!=0)){let p=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!u.extend&&(s=f,e>p))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),!s&&t.pos==this.stream.end&&(s=new P,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new P,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r<h.specialized.length;r++)if(h.specialized[r]==t.value){let n=h.specializers[r](this.stream.read(t.start,t.end),s);if(n>=0&&s.p.parser.dialect.allows(n>>1)){(n&1)==0?t.value=n>>1:t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;h<i;h+=3)if(this.actions[h]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:h}=t,{parser:r}=t.p,{data:n}=r;for(let o=0;o<2;o++)for(let a=r.stateSlot(h,o?2:1);;a+=3){if(n[a]==65535)if(n[a+1]==1)a=k(n,a+2);else{i==0&&n[a+1]==2&&(i=this.putAction(k(n,a+2),e,s,i));break}n[a]==e&&(i=this.putAction(k(n,a+1),e,s,i))}return i}}class Q{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new H(e,i),this.tokens=new K(t,this.stream),this.topTerm=t.top[1];let{from:h}=i[0];this.stacks=[v.start(this,t.top[0],h)],this.fragments=s.length&&this.stream.end-h>t.bufferLength*4?new J(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<t.length;r++){let n=t[r];for(;;){if(this.tokens.mainToken=null,n.pos>e)s.push(n);else{if(this.advanceStack(n,s,t))continue;{i||(i=[],h=[]),i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}}break}}if(!s.length){let r=i&&X(i);if(r)return g&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw g&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r)return g&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r)for(s.sort((n,o)=>o.score-n.score);s.length>r;)s.pop();s.some(n=>n.reducePos>e)&&this.recovering--}else if(s.length>1){t:for(let r=0;r<s.length-1;r++){let n=s[r];for(let o=r+1;o<s.length;o++){let a=s[o];if(n.sameState(a)||n.buffer.length>500&&a.buffer.length>500)if((n.score-a.score||n.buffer.length-a.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}s.length>12&&(s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12))}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)s[r].pos<this.minStackPos&&(this.minStackPos=s[r].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,s){let i=t.pos,{parser:h}=this,r=g?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let a=t.curContext&&t.curContext.tracker.strict,u=a?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let p=this.parser.nodeSet.types[f.type.id]==f.type?h.getGoto(t.state,f.type.id):-1;if(p>-1&&f.length&&(!a||(f.prop(y.contextHash)||0)==u))return t.useNode(f,p),g&&console.log(r+this.stackID(t)+` (via reuse of ${h.getName(f.type.id)})`),!0;if(!(f instanceof S)||f.children.length==0||f.positions[0]>0)break;let c=f.children[0];if(c instanceof S&&f.positions[0]==0)f=c;else break}}let n=h.stateSlot(t.state,4);if(n>0)return t.reduce(n),g&&console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let a=0;a<o.length;){let u=o[a++],f=o[a++],p=o[a++],c=a==o.length||!s,d=c?t:t.split(),b=this.tokens.mainToken;if(d.apply(u,f,b?b.start:d.pos,p),g&&console.log(r+this.stackID(d)+` (via ${(u&65536)==0?"shift":`reduce of ${h.getName(u&65535)}`} for ${h.getName(f)} @ ${i}${d==t?"":", split"})`),c)return!0;d.pos>i?e.push(d):s.push(d)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return B(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r<<1],a=e[(r<<1)+1],u=g?this.stackID(n)+" -> ":"";if(n.deadEnd&&(h||(h=!0,n.restart(),g&&console.log(u+this.stackID(n)+" (restarted)"),this.advanceFully(n,s))))continue;let f=n.split(),p=u;for(let c=0;c<10&&f.forceReduce()&&(g&&console.log(p+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,s));c++)g&&(p=this.stackID(f)+" -> ");for(let c of n.recoverByInsert(o))g&&console.log(u+this.stackID(c)+" (via recover-insert)"),this.advanceFully(c,s);this.stream.end>n.pos?(a==n.pos&&(a++,o=0),n.recoverByDelete(o,a),g&&console.log(u+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`),B(n,s)):(!i||i.score<f.score)&&(i=f)}return i}stackToTree(t){return t.close(),S.build({buffer:A.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(T||(T=new WeakMap)).get(t);return e||T.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function B(l,t){for(let e=0;e<t.length;e++){let s=t[e];if(s.pos==l.pos&&s.sameState(l)){t[e].score<l.score&&(t[e]=l);return}}t.push(l)}class V{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||this.disabled[t]==0}}const C=l=>l;class _{constructor(t){this.start=t.start,this.shift=t.shift||C,this.reduce=t.reduce||C,this.reuse=t.reuse||C,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class w extends L{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let s=Object.keys(t.topRules).map(n=>t.topRules[n][1]),i=[];for(let n=0;n<e.length;n++)i.push([]);function h(n,o,a){i[n].push([o,o.deserialize(String(a))])}if(t.nodeProps)for(let n of t.nodeProps){let o=n[0];typeof o=="string"&&(o=y[o]);for(let a=1;a<n.length;){let u=n[a++];if(u>=0)h(u,o,n[a++]);else{let f=n[a+-u];for(let p=-u;p>0;p--)h(n[a++],o,f);a++}}}this.nodeSet=new $(e.map((n,o)=>E.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=j;let r=x(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;n<this.specializerSpecs.length;n++)this.specialized[n]=this.specializerSpecs[n].term;this.specializers=this.specializerSpecs.map(F),this.states=x(t.states,Uint32Array),this.data=x(t.stateData),this.goto=x(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(n=>typeof n=="number"?new m(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new Q(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let a=h+(r>>1);h<a;h++)if(i[h]==t)return o;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let h=this.stateSlot(t,i?2:1),r;;h+=3){if((r=s[h])==65535)if(s[h+1]==1)r=s[h=k(s,h+2)];else{if(s[h+1]==2)return k(s,h+2);break}if(r==e||r==0)return k(s,h+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,s=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=k(this.data,h+2);else break;i=e(k(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=k(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];e.some((h,r)=>r&1&&h==i)||e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(w.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(s=>{let i=t.tokenizers.find(h=>h.from==s);return i?i.to:s})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find(n=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=F(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);r>=0&&(s[r]=!0)}let i=null;for(let h=0;h<e.length;h++)if(!s[h])for(let r=this.dialects[e[h]],n;(n=this.data[r++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new V(t,s,i)}static deserialize(t){return new w(t)}}function k(l,t){return l[t]|l[t+1]<<16}function X(l){let t=null;for(let e of l){let s=e.p.stoppedAt;(e.pos==e.p.stream.end||s!=null&&e.pos>s)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.score<e.score)&&(t=e)}return t}function F(l){if(l.external){let t=l.extend?1:0;return(e,s)=>l.external(e,s)<<1|t}return l.get}export{_ as C,Z as E,w as L,W as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as k}from"./index-Dw7rDFmE.js";import{d as h,H as C,t as o}from"./index-CVbycZ0H.js";import"./index-Cs5oz2oJ.js";const d="#e5c07b",t="#e06c75",m="#56b6c2",s="#ffffff",r="#abb2bf",a="#7d8799",g="#61afef",b="#98c379",c="#d19a66",p="#c678dd",f="#21252b",l="#2c313a",n="#282c34",e="#353a42",u="#3E4451",i="#528bff",w={chalky:d,coral:t,cyan:m,invalid:s,ivory:r,stone:a,malibu:g,sage:b,whiskey:c,violet:p,darkBackground:f,highlightBackground:l,background:n,tooltipBackground:e,selection:u,cursor:i},y=k.theme({"&":{color:r,backgroundColor:n},".cm-content":{caretColor:i},".cm-cursor, .cm-dropCursor":{borderLeftColor:i},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:u},".cm-panels":{backgroundColor:f,color:r},".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:n,color:a,border:"none"},".cm-activeLineGutter":{backgroundColor:l},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:e},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:e,borderBottomColor:e},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:l,color:r}}},{dark:!0}),B=C.define([{tag:o.keyword,color:p},{tag:[o.name,o.deleted,o.character,o.propertyName,o.macroName],color:t},{tag:[o.function(o.variableName),o.labelName],color:g},{tag:[o.color,o.constant(o.name),o.standard(o.name)],color:c},{tag:[o.definition(o.name),o.separator],color:r},{tag:[o.typeName,o.className,o.number,o.changed,o.annotation,o.modifier,o.self,o.namespace],color:d},{tag:[o.operator,o.operatorKeyword,o.url,o.escape,o.regexp,o.link,o.special(o.string)],color:m},{tag:[o.meta,o.comment],color:a},{tag:o.strong,fontWeight:"bold"},{tag:o.emphasis,fontStyle:"italic"},{tag:o.strikethrough,textDecoration:"line-through"},{tag:o.link,color:a,textDecoration:"underline"},{tag:o.heading,fontWeight:"bold",color:t},{tag:[o.atom,o.bool,o.special(o.variableName)],color:c},{tag:[o.processingInstruction,o.string,o.inserted],color:b},{tag:o.invalid,color:s}]),D=[y,h(B)];export{w as color,D as oneDark,B as oneDarkHighlightStyle,y as oneDarkTheme};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{codePointAt as v,EditorSelection as C,codePointSize as T,StateField as _,RangeSet as Pe,Prec as ee,Facet as be,combineConfig as Le,fromCodePoint as xe,StateEffect as O,MapMode as G,RangeValue as Me,Annotation as ke,Transaction as Be,Text as Fe,CharCategory as J}from"./index-Cs5oz2oJ.js";import{E as L,o as $e,V as We,p as Z,q as Ce,n as we,D as Ne,a as H,W as Ue}from"./index-Dw7rDFmE.js";import{s as q,b as je}from"./index-CVbycZ0H.js";class ve{constructor(e,t,n,s){this.state=e,this.pos=t,this.explicit=n,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=q(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)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),s=t.text.slice(n-t.from,this.pos-t.from),o=s.search(Se(e,!1));return o<0?null:{from:n+o,to:this.pos,text:s.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function ce(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Ve(i){let e=Object.create(null),t=Object.create(null);for(let{label:s}of i){e[s[0]]=!0;for(let o=1;o<s.length;o++)t[s[o]]=!0}let n=ce(e)+ce(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function He(i){let e=i.map(s=>typeof s=="string"?{label:s}:s),[t,n]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:Ve(e);return s=>{let o=s.matchBefore(n);return o||s.explicit?{from:o?o.from:s.pos,options:e,validFor:t}:null}}function Nt(i,e){return t=>{for(let n=q(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(i.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}class fe{constructor(e,t,n,s){this.completion=e,this.source=t,this.match=n,this.score=s}}function A(i){return i.selection.main.from}function Se(i,e){var t;let{source:n}=i,s=e&&n[0]!="^",o=n[n.length-1]!="$";return!s&&!o?i:new RegExp(`${s?"^":""}(?:${n})${o?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}const te=ke.define();function qe(i,e,t,n){let{main:s}=i.selection,o=t-s.from,l=n-s.from;return{...i.changeByRange(a=>{if(a!=s&&t!=n&&i.sliceDoc(a.from+o,a.from+l)!=i.sliceDoc(t,n))return{range:a};let r=i.toText(e);return{changes:{from:a.from+o,to:n==s.from?a.to:a.from+l,insert:r},range:C.cursor(a.from+o+r.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const he=new WeakMap;function ze(i){if(!Array.isArray(i))return i;let e=he.get(i);return e||he.set(i,e=He(i)),e}const j=O.define(),B=O.define();class Ke{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<e.length;){let n=v(e,t),s=T(n);this.chars.push(n);let o=e.slice(t,t+s),l=o.toUpperCase();this.folded.push(v(l==o?o.toLowerCase():l,0)),t+=s}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:s,precise:o,byWord:l}=this;if(t.length==1){let d=v(e,0),D=T(d),S=D==e.length?0:-100;if(d!=t[0])if(d==n[0])S+=-200;else return null;return this.ret(S,[0,D])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let r=t.length,h=0;if(a<0){for(let d=0,D=Math.min(e.length,200);d<D&&h<r;){let S=v(e,d);(S==t[h]||S==n[h])&&(s[h++]=d),d+=T(S)}if(h<r)return null}let c=0,f=0,p=!1,u=0,m=-1,y=-1,k=/[a-z]/.test(e),I=!0;for(let d=0,D=Math.min(e.length,200),S=0;d<D&&f<r;){let b=v(e,d);a<0&&(c<r&&b==t[c]&&(o[c++]=d),u<r&&(b==t[u]||b==n[u]?(u==0&&(m=d),y=d+1,u++):u=0));let N,K=b<255?b>=48&&b<=57||b>=97&&b<=122?2:b>=65&&b<=90?1:0:(N=xe(b))!=N.toLowerCase()?1:N!=N.toUpperCase()?2:0;(!d||K==1&&k||S==0&&K!=0)&&(t[f]==b||n[f]==b&&(p=!0)?l[f++]=d:l.length&&(I=!1)),S=K,d+=T(b)}return f==r&&l[0]==0&&I?this.result(-100+(p?-200:0),l,e):u==r&&m==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):u==r?this.ret(-900-e.length,[m,y]):f==r?this.result(-100+(p?-200:0)+-700+(I?0:-1100),l,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,n){let s=[],o=0;for(let l of t){let a=l+(this.astral?T(v(n,l)):1);o&&s[o-1]==l?s[o-1]=a:(s[o++]=l,s[o++]=a)}return this.ret(e-n.length,s)}}class Qe{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 t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const g=be.define({combine(i){return Le(i,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Ye,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||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=>pe(e(n),t(n)),optionClass:(e,t)=>n=>pe(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function pe(i,e){return i?e?i+" "+e:i:e}function Ye(i,e,t,n,s,o){let l=i.textDirection==Ne.RTL,a=l,r=!1,h="top",c,f,p=e.left-s.left,u=s.right-e.right,m=n.right-n.left,y=n.bottom-n.top;if(a&&p<Math.min(m,u)?a=!1:!a&&u<Math.min(m,p)&&(a=!0),m<=(a?p:u))c=Math.max(s.top,Math.min(t.top,s.bottom-y))-e.top,f=Math.min(400,a?p:u);else{r=!0,f=Math.min(400,(l?e.right:s.right-e.left)-30);let d=s.bottom-e.bottom;d>=y||d>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let k=(e.bottom-e.top)/o.offsetHeight,I=(e.right-e.left)/o.offsetWidth;return{style:`${h}: ${c/k}px; max-width: ${f/I}px`,class:"cm-completionInfo-"+(r?l?"left-narrow":"right-narrow":a?"left":"right")}}const ie=O.define();function Xe(i){let e=i.addToOptions.slice();return i.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,s,o){let l=document.createElement("span");l.className="cm-completionLabel";let a=t.displayLabel||t.label,r=0;for(let h=0;h<o.length;){let c=o[h++],f=o[h++];c>r&&l.appendChild(document.createTextNode(a.slice(r,c)));let p=l.appendChild(document.createElement("span"));p.appendChild(document.createTextNode(a.slice(c,f))),p.className="cm-completionMatchedText",r=f}return r<a.length&&l.appendChild(document.createTextNode(a.slice(r))),l},position:50},{render(t){if(!t.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=t.detail,n},position:80}),e.sort((t,n)=>t.position-n.position).map(t=>t.render)}function Q(i,e,t){if(i<=t)return{from:0,to:i};if(e<0&&(e=0),e<=i>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let n=Math.floor((i-e)/t);return{from:i-(n+1)*t,to:i-n*t}}class Ge{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:r=>this.placeInfo(r),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:o,selected:l}=s.open,a=e.state.facet(g);this.optionContent=Xe(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=Q(o.length,l,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",r=>{let{options:h}=e.state.field(t).open;for(let c=r.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]<h.length){this.applyCompletion(e,h[+f[1]]),r.preventDefault();return}if(r.target==this.list){let c=this.list.classList.contains("cm-completionListIncompleteTop")&&r.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&r.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:ie.of(c)}),r.preventDefault())}}),this.dom.addEventListener("focusout",r=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(g).closeOnBlur&&r.relatedTarget!=e.contentDOM&&e.dispatch({effects:B.of(null)})}),this.showOptions(o,s.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),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=s){let{options:o,selected:l,disabled:a}=n.open;(!s.open||s.open.options!=o)&&(this.range=Q(o.length,l,e.state.facet(g).maxRenderedOptions),this.showOptions(o,n.id)),this.updateSel(),a!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);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;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Q(t.options.length,t.selected,this.view.state.facet(g).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:o}=s;if(!o)return;let l=typeof o=="string"?document.createTextNode(o):o(s);if(!l)return;"then"in l?l.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>Z(this.view.state,a,"completion info")):(this.addInfoPane(l,s),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:o}=e;n.appendChild(s),this.infoDestroy=o||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,s=this.range.from;n;n=n.nextSibling,s++)n.nodeName!="LI"||!n.id?s--:s==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return t&&Ze(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),o=this.space;if(!o){let l=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight}}return s.top>Math.min(o.bottom,t.bottom)-10||s.bottom<Math.max(o.top,t.top)+10?null:this.view.state.facet(g).positionInfo(this.view,t,s,n,o,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,t,n){const s=document.createElement("ul");s.id=t,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",l=>{l.target==s&&l.preventDefault()});let o=null;for(let l=n.from;l<n.to;l++){let{completion:a,match:r}=e[l],{section:h}=a;if(h){let p=typeof h=="string"?h:h.name;if(p!=o&&(l>n.from||n.from==0))if(o=p,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let u=s.appendChild(document.createElement("completion-section"));u.textContent=p}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+l,c.setAttribute("role","option");let f=this.optionClass(a);f&&(c.className=f);for(let p of this.optionContent){let u=p(a,this.view.state,this.view,r);u&&c.appendChild(u)}}return n.from&&s.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function Je(i,e){return t=>new Ge(t,i,e)}function Ze(i,e){let t=i.getBoundingClientRect(),n=e.getBoundingClientRect(),s=t.height/i.offsetHeight;n.top<t.top?i.scrollTop-=(t.top-n.top)/s:n.bottom>t.bottom&&(i.scrollTop+=(n.bottom-t.bottom)/s)}function ue(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function _e(i,e){let t=[],n=null,s=null,o=c=>{t.push(c);let{section:f}=c.completion;if(f){n||(n=[]);let p=typeof f=="string"?f:f.name;n.some(u=>u.name==p)||n.push(typeof f=="string"?{name:p}:f)}},l=e.facet(g);for(let c of i)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let p of c.result.options)o(new fe(p,c.source,f?f(p):[],1e9-t.length));else{let p=e.sliceDoc(c.from,c.to),u,m=l.filterStrict?new Qe(p):new Ke(p);for(let y of c.result.options)if(u=m.match(y.label)){let k=y.displayLabel?f?f(y,u.matched):[]:u.matched,I=u.score+(y.boost||0);if(o(new fe(y,c.source,k,I)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:d}=y.section;s||(s=Object.create(null)),s[d]=Math.max(I,s[d]||-1e9)}}}}if(n){let c=Object.create(null),f=0,p=(u,m)=>(u.rank==="dynamic"&&m.rank==="dynamic"?s[m.name]-s[u.name]:0)||(typeof u.rank=="number"?u.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(u.name<m.name?-1:1);for(let u of n.sort(p))f-=1e5,c[u.name]=f;for(let u of t){let{section:m}=u.completion;m&&(u.score+=c[typeof m=="string"?m:m.name])}}let a=[],r=null,h=l.compareCompletions;for(let c of t.sort((f,p)=>p.score-f.score||h(f.completion,p.completion))){let f=c.completion;!r||r.label!=f.label||r.detail!=f.detail||r.type!=null&&f.type!=null&&r.type!=f.type||r.apply!=f.apply||r.boost!=f.boost?a.push(c):ue(c.completion)>ue(r)&&(a[a.length-1]=c),r=c.completion}return a}class R{constructor(e,t,n,s,o,l){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=s,this.selected=o,this.disabled=l}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new R(this.options,de(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,s,o,l){if(s&&!l&&e.some(h=>h.isPending))return s.setDisabled();let a=_e(e,t);if(!a.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let r=t.facet(g).selectOnOpen?0:-1;if(s&&s.selected!=r&&s.selected!=-1){let h=s.options[s.selected].completion;for(let c=0;c<a.length;c++)if(a[c].completion==h){r=c;break}}return new R(a,de(n,r),{pos:e.reduce((h,c)=>c.hasResult()?Math.min(h,c.from):h,1e8),create:ot,above:o.aboveCursor},s?s.timestamp:Date.now(),r,!1)}map(e){return new R(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new R(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class V{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new V(nt,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(g),o=(n.override||t.languageDataAt("autocomplete",A(t)).map(ze)).map(r=>(this.active.find(c=>c.source==r)||new w(r,this.active.some(c=>c.state!=0)?1:0)).update(e,n));o.length==this.active.length&&o.every((r,h)=>r==this.active[h])&&(o=this.active);let l=this.open,a=e.effects.some(r=>r.is(ne));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||o.some(r=>r.hasResult()&&e.changes.touchesRange(r.from,r.to))||!et(o,this.active)||a?l=R.build(o,t,this.id,l,n,a):l&&l.disabled&&!o.some(r=>r.isPending)&&(l=null),!l&&o.every(r=>!r.isPending)&&o.some(r=>r.hasResult())&&(o=o.map(r=>r.hasResult()?new w(r.source,0):r));for(let r of e.effects)r.is(ie)&&(l=l&&l.setSelected(r.value,this.id));return o==this.active&&l==this.open?this:new V(o,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?tt:it}}function et(i,e){if(i==e)return!0;for(let t=0,n=0;;){for(;t<i.length&&!i[t].hasResult();)t++;for(;n<e.length&&!e[n].hasResult();)n++;let s=t==i.length,o=n==e.length;if(s||o)return s==o;if(i[t++].result!=e[n++].result)return!1}}const tt={"aria-autocomplete":"list"},it={};function de(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}const nt=[];function Ie(i,e){if(i.isUserEvent("input.complete")){let n=i.annotation(te);if(n&&e.activateOnCompletion(n))return 12}let t=i.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:i.isUserEvent("delete.backward")?2:i.selection?8:i.docChanged?16:0}class w{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let n=Ie(e,t),s=this;(n&8||n&16&&this.touches(e))&&(s=new w(s.source,0)),n&4&&s.state==0&&(s=new w(this.source,1)),s=s.updateFor(e,n);for(let o of e.effects)if(o.is(j))s=new w(s.source,1,o.value);else if(o.is(B))s=new w(s.source,0);else if(o.is(ne))for(let l of o.value)l.source==s.source&&(s=l);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(A(e.state))}}class P extends w{constructor(e,t,n,s,o,l){super(e,3,t),this.limit=n,this.result=s,this.from=o,this.to=l}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let o=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),a=A(e.state);if(a>l||!s||t&2&&(A(e.startState)==this.from||a<this.limit))return new w(this.source,t&4?1:0);let r=e.changes.mapPos(this.limit);return st(s.validFor,e.state,o,l)?new P(this.source,this.explicit,r,s,o,l):s.update&&(s=s.update(s,o,l,new ve(e.state,a,!1)))?new P(this.source,this.explicit,r,s,s.from,(n=s.to)!==null&&n!==void 0?n:A(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 P(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 st(i,e,t,n){if(!i)return!1;let s=e.sliceDoc(t,n);return typeof i=="function"?i(s,t,n,e):Se(i,!0).test(s)}const ne=O.define({map(i,e){return i.map(t=>t.map(e))}}),x=_.define({create(){return V.start()},update(i,e){return i.update(e)},provide:i=>[$e.from(i,e=>e.tooltip),L.contentAttributes.from(i,e=>e.attrs)]});function se(i,e){const t=e.completion.apply||e.completion.label;let n=i.state.field(x).active.find(s=>s.source==e.source);return n instanceof P?(typeof t=="string"?i.dispatch({...qe(i.state,t,n.from,n.to),annotations:te.of(e.completion)}):t(i,e.completion,n.from,n.to),!0):!1}const ot=Je(x,se);function U(i,e="option"){return t=>{let n=t.state.field(x,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(g).interactionDelay)return!1;let s=1,o;e=="page"&&(o=Ce(t,n.open.tooltip))&&(s=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:l}=n.open.options,a=n.open.selected>-1?n.open.selected+s*(i?1:-1):i?0:l-1;return a<0?a=e=="page"?0:l-1:a>=l&&(a=e=="page"?l-1:0),t.dispatch({effects:ie.of(a)}),!0}}const lt=i=>{let e=i.state.field(x,!1);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<i.state.facet(g).interactionDelay?!1:se(i,e.open.options[e.open.selected])},Y=i=>i.state.field(x,!1)?(i.dispatch({effects:j.of(!0)}),!0):!1,rt=i=>{let e=i.state.field(x,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:B.of(null)}),!0)};class at{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const ct=50,ft=1e3,ht=We.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of i.state.field(x).active)e.isPending&&this.startQuery(e)}update(i){let e=i.state.field(x),t=i.state.facet(g);if(!i.selectionSet&&!i.docChanged&&i.startState.field(x)==e)return;let n=i.transactions.some(o=>{let l=Ie(o,t);return l&8||(o.selection||o.docChanged)&&!(l&3)});for(let o=0;o<this.running.length;o++){let l=this.running[o];if(n||l.context.abortOnDocChange&&i.docChanged||l.updates.length+i.transactions.length>ct&&Date.now()-l.time>ft){for(let a of l.context.abortListeners)try{a()}catch(r){Z(this.view.state,r)}l.context.abortListeners=null,this.running.splice(o--,1)}else l.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(o=>o.effects.some(l=>l.is(j)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.isPending&&!this.running.some(l=>l.active.source==o.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let o of i.transactions)o.isUserEvent("input.type")?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,e=i.field(x);for(let t of e.active)t.isPending&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(g).updateSyncTime))}startQuery(i){let{state:e}=this.view,t=A(e),n=new ve(e,t,i.explicit,this.view),s=new at(i,n);this.running.push(s),Promise.resolve(i.source(n)).then(o=>{s.context.aborted||(s.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:B.of(null)}),Z(this.view.state,o)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(g).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(g),n=this.view.state.field(x);for(let s=0;s<this.running.length;s++){let o=this.running[s];if(o.done===void 0)continue;if(this.running.splice(s--,1),o.done){let a=A(o.updates.length?o.updates[0].startState:this.view.state),r=Math.min(a,o.done.from+(o.active.explicit?0:1)),h=new P(o.active.source,o.active.explicit,r,o.done,o.done.from,(i=o.done.to)!==null&&i!==void 0?i:a);for(let c of o.updates)h=h.update(c,t);if(h.hasResult()){e.push(h);continue}}let l=n.active.find(a=>a.source==o.active.source);if(l&&l.isPending)if(o.done==null){let a=new w(o.active.source,0);for(let r of o.updates)a=a.update(r,t);a.isPending||e.push(a)}else this.startQuery(l)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:ne.of(e)})}},{eventHandlers:{blur(i){let e=this.view.state.field(x,!1);if(e&&e.tooltip&&this.view.state.facet(g).closeOnBlur){let t=e.open&&Ce(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:B.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:j.of(!1)}),20),this.composing=0}}}),pt=typeof navigator=="object"&&/Win/.test(navigator.platform),ut=ee.highest(L.domEventHandlers({keydown(i,e){let t=e.state.field(x,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(pt&&i.altKey)||i.metaKey)return!1;let n=t.open.options[t.open.selected],s=t.active.find(l=>l.source==n.source),o=n.completion.commitCharacters||s.result.commitCharacters;return o&&o.indexOf(i.key)>-1&&se(e,n),!1}})),Te=L.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"}}});class dt{constructor(e,t,n,s){this.field=e,this.line=t,this.from=n,this.to=s}}class oe{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,G.TrackDel),n=e.mapPos(this.to,1,G.TrackDel);return t==null||n==null?null:new oe(this.field,t,n)}}class le{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],s=[t],o=e.doc.lineAt(t),l=/^\s*/.exec(o.text)[0];for(let r of this.lines){if(n.length){let h=l,c=/^\t*/.exec(r)[0].length;for(let f=0;f<c;f++)h+=e.facet(je);s.push(t+h.length-c),r=h+r.slice(c)}n.push(r),t+=r.length+1}let a=this.fieldPositions.map(r=>new oe(r.field,s[r.line]+r.from,s[r.line]+r.to));return{text:n,ranges:a}}static parse(e){let t=[],n=[],s=[],o;for(let l of e.split(/\r\n?|\n/)){for(;o=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l);){let a=o[1]?+o[1]:null,r=o[2]||o[3]||"",h=-1,c=r.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f<t.length;f++)(a!=null?t[f].seq==a:c&&t[f].name==c)&&(h=f);if(h<0){let f=0;for(;f<t.length&&(a==null||t[f].seq!=null&&t[f].seq<a);)f++;t.splice(f,0,{seq:a,name:c}),h=f;for(let p of s)p.field>=h&&p.field++}for(let f of s)if(f.line==n.length&&f.from>o.index){let p=o[2]?3+(o[1]||"").length:2;f.from-=p,f.to-=p}s.push(new dt(h,n.length,o.index,o.index+c.length)),l=l.slice(0,o.index)+r+l.slice(o.index+o[0].length)}l=l.replace(/\\([{}])/g,(a,r,h)=>{for(let c of s)c.line==n.length&&c.from>h&&(c.from--,c.to--);return r}),n.push(l)}return new le(n,s)}}let mt=H.widget({widget:new class extends Ue{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),gt=H.mark({class:"cm-snippetField"});class M{constructor(e,t){this.ranges=e,this.active=t,this.deco=H.set(e.map(n=>(n.from==n.to?mt:gt).range(n.from,n.to)),!0)}map(e){let t=[];for(let n of this.ranges){let s=n.map(e);if(!s)return null;t.push(s)}return new M(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(n=>n.field==this.active&&n.from<=t.from&&n.to>=t.to))}}const W=O.define({map(i,e){return i&&i.map(e)}}),yt=O.define(),F=_.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(W))return t.value;if(t.is(yt)&&i)return new M(i.ranges,t.value)}return i&&e.docChanged&&(i=i.map(e.changes)),i&&e.selection&&!i.selectionInsideField(e.selection)&&(i=null),i},provide:i=>L.decorations.from(i,e=>e?e.deco:H.none)});function re(i,e){return C.create(i.filter(t=>t.field==e).map(t=>C.range(t.from,t.to)))}function bt(i){let e=le.parse(i);return(t,n,s,o)=>{let{text:l,ranges:a}=e.instantiate(t.state,s),{main:r}=t.state.selection,h={changes:{from:s,to:o==r.from?r.to:o,insert:Fe.of(l)},scrollIntoView:!0,annotations:n?[te.of(n),Be.userEvent.of("input.complete")]:void 0};if(a.length&&(h.selection=re(a,0)),a.some(c=>c.field>0)){let c=new M(a,0),f=h.effects=[W.of(c)];t.state.field(F,!1)===void 0&&f.push(O.appendConfig.of([F,St,It,Te]))}t.dispatch(t.state.update(h))}}function Oe(i){return({state:e,dispatch:t})=>{let n=e.field(F,!1);if(!n||i<0&&n.active==0)return!1;let s=n.active+i,o=i>0&&!n.ranges.some(l=>l.field==s+i);return t(e.update({selection:re(n.ranges,s),effects:W.of(o?null:new M(n.ranges,s)),scrollIntoView:!0})),!0}}const xt=({state:i,dispatch:e})=>i.field(F,!1)?(e(i.update({effects:W.of(null)})),!0):!1,Ct=Oe(1),wt=Oe(-1),vt=[{key:"Tab",run:Ct,shift:wt},{key:"Escape",run:xt}],me=be.define({combine(i){return i.length?i[0]:vt}}),St=ee.highest(we.compute([me],i=>i.facet(me)));function Ut(i,e){return{...e,apply:bt(i)}}const It=L.domEventHandlers({mousedown(i,e){let t=e.state.field(F,!1),n;if(!t||(n=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let s=t.ranges.find(o=>o.from<=n&&o.to>=n);return!s||s.field==t.active?!1:(e.dispatch({selection:re(t.ranges,s.field),effects:W.of(t.ranges.some(o=>o.field>s.field)?new M(t.ranges,s.field):null),scrollIntoView:!0}),!0)}}),$={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},E=O.define({map(i,e){let t=e.mapPos(i,-1,G.TrackAfter);return t??void 0}}),ae=new class extends Me{};ae.startSide=1;ae.endSide=-1;const Ee=_.define({create(){return Pe.empty},update(i,e){if(i=i.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);i=i.update({filter:n=>n>=t.from&&n<=t.to})}for(let t of e.effects)t.is(E)&&(i=i.update({add:[ae.range(t.value,t.value+1)]}));return i}});function jt(){return[Ot,Ee]}const X="()[]{}<>«»»«[]{}";function Ae(i){for(let e=0;e<X.length;e+=2)if(X.charCodeAt(e)==i)return X.charAt(e+1);return xe(i<128?i:i+1)}function De(i,e){return i.languageDataAt("closeBrackets",e)[0]||$}const Tt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Ot=L.inputHandler.of((i,e,t,n)=>{if((Tt?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let s=i.state.selection.main;if(n.length>2||n.length==2&&T(v(n,0))==1||e!=s.from||t!=s.to)return!1;let o=At(i.state,n);return o?(i.dispatch(o),!0):!1}),Et=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let n=De(i,i.selection.main.head).brackets||$.brackets,s=null,o=i.changeByRange(l=>{if(l.empty){let a=Dt(i.doc,l.head);for(let r of n)if(r==a&&z(i.doc,l.head)==Ae(v(r,0)))return{changes:{from:l.head-r.length,to:l.head+r.length},range:C.cursor(l.head-r.length)}}return{range:s=l}});return s||e(i.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Vt=[{key:"Backspace",run:Et}];function At(i,e){let t=De(i,i.selection.main.head),n=t.brackets||$.brackets;for(let s of n){let o=Ae(v(s,0));if(e==s)return o==s?Lt(i,s,n.indexOf(s+s+s)>-1,t):Rt(i,s,o,t.before||$.before);if(e==o&&Re(i,i.selection.main.from))return Pt(i,s,o)}return null}function Re(i,e){let t=!1;return i.field(Ee).between(0,i.doc.length,n=>{n==e&&(t=!0)}),t}function z(i,e){let t=i.sliceString(e,e+2);return t.slice(0,T(v(t,0)))}function Dt(i,e){let t=i.sliceString(e-2,e);return T(v(t,0))==t.length?t:t.slice(1)}function Rt(i,e,t,n){let s=null,o=i.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:t,from:l.to}],effects:E.of(l.to+e.length),range:C.range(l.anchor+e.length,l.head+e.length)};let a=z(i.doc,l.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:e+t,from:l.head},effects:E.of(l.head+e.length),range:C.cursor(l.head+e.length)}:{range:s=l}});return s?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Pt(i,e,t){let n=null,s=i.changeByRange(o=>o.empty&&z(i.doc,o.head)==t?{changes:{from:o.head,to:o.head+t.length,insert:t},range:C.cursor(o.head+t.length)}:n={range:o});return n?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Lt(i,e,t,n){let s=n.stringPrefixes||$.stringPrefixes,o=null,l=i.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:E.of(a.to+e.length),range:C.range(a.anchor+e.length,a.head+e.length)};let r=a.head,h=z(i.doc,r),c;if(h==e){if(ge(i,r))return{changes:{insert:e+e,from:r},effects:E.of(r+e.length),range:C.cursor(r+e.length)};if(Re(i,r)){let p=t&&i.sliceDoc(r,r+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:r,to:r+p.length,insert:p},range:C.cursor(r+p.length)}}}else{if(t&&i.sliceDoc(r-2*e.length,r)==e+e&&(c=ye(i,r-2*e.length,s))>-1&&ge(i,c))return{changes:{insert:e+e+e+e,from:r},effects:E.of(r+e.length),range:C.cursor(r+e.length)};if(i.charCategorizer(r)(h)!=J.Word&&ye(i,r,s)>-1&&!Mt(i,r,e,s))return{changes:{insert:e+e,from:r},effects:E.of(r+e.length),range:C.cursor(r+e.length)}}return{range:o=a}});return o?null:i.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function ge(i,e){let t=q(i).resolveInner(e+1);return t.parent&&t.from==e}function Mt(i,e,t,n){let s=q(i).resolveInner(e,-1),o=n.reduce((l,a)=>Math.max(l,a.length),0);for(let l=0;l<5;l++){let a=i.sliceDoc(s.from,Math.min(s.to,s.from+t.length+o)),r=a.indexOf(t);if(!r||r>-1&&n.indexOf(a.slice(0,r))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+r;){if(i.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function ye(i,e,t){let n=i.charCategorizer(e);if(n(i.sliceDoc(e-1,e))!=J.Word)return e;for(let s of t){let o=e-s.length;if(i.sliceDoc(o,e)==s&&n(i.sliceDoc(o-1,o))!=J.Word)return o}return-1}function Ht(i={}){return[ut,x,g.of(i),ht,Bt,Te]}const kt=[{key:"Ctrl-Space",run:Y},{mac:"Alt-`",run:Y},{mac:"Alt-i",run:Y},{key:"Escape",run:rt},{key:"ArrowDown",run:U(!0)},{key:"ArrowUp",run:U(!1)},{key:"PageDown",run:U(!0,"page")},{key:"PageUp",run:U(!1,"page")},{key:"Enter",run:lt}],Bt=ee.highest(we.computeN([g],i=>i.facet(g).defaultKeymap?[kt]:[]));export{ve as C,Ht as a,Vt as b,jt as c,kt as d,He as e,Nt as i,Ut as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{L as r}from"./index-K6OVmfhg.js";import{k as a,t as O,L as P,l as o,n as Q,o as e,p as s,q as t}from"./index-CVbycZ0H.js";import"./index-Cs5oz2oJ.js";import"./index-Dw7rDFmE.js";const n=a({String:O.string,Number:O.number,"True False":O.bool,PropertyName:O.propertyName,Null:O.null,", :":O.separator,"[ ]":O.squareBracket,"{ }":O.brace}),i=r.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[n],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),c=o.define({name:"json",parser:i.configure({props:[Q.add({Object:e({except:/^\s*\}/}),Array:e({except:/^\s*\]/})}),s.add({"Object Array":t})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function d(){return new P(c)}export{d as json,c as jsonLanguage};
|