@i14ks/ccv 0.9.2 → 0.9.4
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/package.json +1 -1
- package/web/assets/{codemirror-CdWCs9Ue.js → codemirror-BrML4DhQ.js} +1 -1
- package/web/assets/{index-BOXDlhc1.js → index-B11vIedv.js} +1 -1
- package/web/assets/{index-DW6gdH0X.js → index-BCuOAg0C.js} +1 -1
- package/web/assets/{index-CZiXrzZK.js → index-BH51XSCv.js} +1 -1
- package/web/assets/{index-C2jQFp5o.js → index-BMlMiQH4.js} +1 -1
- package/web/assets/{index-BmyAsnOo.js → index-BMtQHCPD.js} +1 -1
- package/web/assets/{index-C01f6NIT.js → index-BZMuV7wL.js} +1 -1
- package/web/assets/{index-CRvrjpBk.js → index-BmDgU61K.js} +1 -1
- package/web/assets/{index-BhV-iv4x.js → index-BnX4KThz.js} +1 -1
- package/web/assets/{index-GdeMvy4I.js → index-CIOcaugJ.js} +1 -1
- package/web/assets/{index-Rn6Txsdk.js → index-CJJjf7QW.js} +1 -1
- package/web/assets/{index-DJ-p5uJH.js → index-Cg-P0Yp1.js} +1 -1
- package/web/assets/{index-K7wDRup7.js → index-CzJCmwIj.js} +1 -1
- package/web/assets/{index-D9VXVn86.js → index-DhmD70Mu.js} +42 -42
- package/web/assets/{index-DhZRiwtM.js → index-DueUeK4W.js} +1 -1
- package/web/assets/{index-BAVMdhFr.js → index-MEYLoAjh.js} +1 -1
- package/web/assets/{index-Bzwb3qfk.js → index-MtnHR_Fv.js} +1 -1
- package/web/assets/{index-Mx2AyOuR.js → index-TS7xklzI.js} +1 -1
- package/web/assets/{index-l4FJdg3Q.js → index-ZDWxlF_B.js} +1 -1
- package/web/assets/{index-Cdz7Ltwf.js → index-ZQEm-9IM.js} +1 -1
- package/web/assets/{index-DA01pdfH.js → index-kYR8PJFy.js} +1 -1
- package/web/index.html +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EditorSelection as h,Text as ke,findClusterBreak as T,StateField as tt,Transaction as K,Facet as Ae,Annotation as Be,combineConfig as nt,StateEffect as Se,ChangeSet as rt,ChangeDesc as ot,countColumn as ee,CharCategory as D}from"./index-BHot-lnj.js";import{E as O,o as lt}from"./index-891wE-Rj.js";import{I as Ce,g as De,c as G,e as te,m as E,h as j,j as st}from"./index-DhZRiwtM.js";import{N as Q}from"./index-D9VXVn86.js";const ct=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=ne(e.state,n.from);return r.line?it(e):r.block?ft(e):!1};function L(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let l=e(t,n);return l?(r(n.update(l)),!0):!1}}const it=L(re,0),An=L(re,1),Bn=L(re,2),ut=L(V,0),Sn=L(V,1),Cn=L(V,2),ft=L((e,t)=>V(e,t,ht(t)),0);function ne(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const v=50;function at(e,{open:t,close:n},r,l){let o=e.sliceDoc(r-v,r),s=e.sliceDoc(l,l+v),c=/\s*$/.exec(o)[0].length,i=/^\s*/.exec(s)[0].length,f=o.length-c;if(o.slice(f-t.length,f)==t&&s.slice(i,i+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:l+i,margin:i&&1}};let u,a;l-r<=2*v?u=a=e.sliceDoc(r,l):(u=e.sliceDoc(r,r+v),a=e.sliceDoc(l-v,l));let d=/^\s*/.exec(u)[0].length,B=/\s*$/.exec(a)[0].length,k=a.length-B-n.length;return u.slice(d,d+t.length)==t&&a.slice(k,k+n.length)==n?{open:{pos:r+d+t.length,margin:/\s/.test(u.charAt(d+t.length))?1:0},close:{pos:l-B-n.length,margin:/\s/.test(a.charAt(k-1))?1:0}}:null}function ht(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),l=n.to<=r.to?r:e.doc.lineAt(n.to);l.from>r.from&&l.from==n.to&&(l=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>r.from?t[o].to=l.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:l.to})}return t}function V(e,t,n=t.selection.ranges){let r=n.map(o=>ne(t,o.from).block);if(!r.every(o=>o))return null;let l=n.map((o,s)=>at(t,r[s],o.from,o.to));if(e!=2&&!l.every(o=>o))return{changes:t.changes(n.map((o,s)=>l[s]?[]:[{from:o.from,insert:r[s].open+" "},{from:o.to,insert:" "+r[s].close}]))};if(e!=1&&l.some(o=>o)){let o=[];for(let s=0,c;s<l.length;s++)if(c=l[s]){let i=r[s],{open:f,close:u}=c;o.push({from:f.pos-i.open.length,to:f.pos+f.margin},{from:u.pos-u.margin,to:u.pos+i.close.length})}return{changes:o}}return null}function re(e,t,n=t.selection.ranges){let r=[],l=-1;e:for(let{from:o,to:s}of n){let c=r.length,i=1e9,f;for(let u=o;u<=s;){let a=t.doc.lineAt(u);if(f==null&&(f=ne(t,a.from).line,!f))continue e;if(a.from>l&&(o==s||s>a.from)){l=a.from;let d=/^\s*/.exec(a.text)[0].length,B=d==a.length,k=a.text.slice(d,d+f.length)==f?d:-1;d<a.text.length&&d<i&&(i=d),r.push({line:a,comment:k,token:f,indent:d,empty:B,single:!1})}u=a.to+1}if(i<1e9)for(let u=c;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=i);r.length==c+1&&(r[c].single=!0)}if(e!=2&&r.some(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:c,token:i,indent:f,empty:u,single:a}of r)(a||!u)&&o.push({from:c.from+f,insert:i+" "});let s=t.changes(o);return{changes:s,selection:t.selection.map(s,1)}}else if(e!=1&&r.some(o=>o.comment>=0)){let o=[];for(let{line:s,comment:c,token:i}of r)if(c>=0){let f=s.from+c,u=f+i.length;s.text[u-s.from]==" "&&u++,o.push({from:f,to:u})}return{changes:o}}return null}const X=Be.define(),dt=Be.define(),mt=Ae.define(),xe=Ae.define({combine(e){return nt(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,l)=>t(r,l)||n(r,l)})}}),N=tt.define({create(){return C.empty},update(e,t){let n=t.state.facet(xe),r=t.annotation(X);if(r){let i=g.fromTransaction(t,r.selection),f=r.side,u=f==0?e.undone:e.done;return i?u=U(u,u.length,n.minDepth,i):u=Ee(u,t.startState.selection),new C(f==0?r.rest:u,f==0?u:r.rest)}let l=t.annotation(dt);if((l=="full"||l=="before")&&(e=e.isolate()),t.annotation(K.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let o=g.fromTransaction(t),s=t.annotation(K.time),c=t.annotation(K.userEvent);return o?e=e.addChanges(o,s,c,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,c,n.newGroupDelay)),(l=="full"||l=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new C(e.done.map(g.fromJSON),e.undone.map(g.fromJSON))}});function Dn(e={}){return[N,xe.of(e),O.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?Le:t.inputType=="historyRedo"?Y:null;return r?(t.preventDefault(),r(n)):!1}})]}const xn=N;function P(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let l=n.field(N,!1);if(!l)return!1;let o=l.pop(e,n,t);return o?(r(o),!0):!1}}const Le=P(0,!1),Y=P(1,!1),pt=P(0,!0),gt=P(1,!0);function Me(e){return function(t){let n=t.field(N,!1);if(!n)return 0;let r=e==0?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}const Ln=Me(0),Mn=Me(1);class g{constructor(t,n,r,l,o){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=l,this.selectionsAfter=o}setSelAfter(t){return new g(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(l=>l.toJSON())}}static fromJSON(t){return new g(t.changes&&rt.fromJSON(t.changes),[],t.mapped&&ot.fromJSON(t.mapped),t.startSelection&&h.fromJSON(t.startSelection),t.selectionsAfter.map(h.fromJSON))}static fromTransaction(t,n){let r=A;for(let l of t.startState.facet(mt)){let o=l(t);o.length&&(r=r.concat(o))}return!r.length&&t.changes.empty?null:new g(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,A)}static selection(t){return new g(void 0,A,void 0,void 0,t)}}function U(e,t,n,r){let l=t+1>n+20?t-n-1:0,o=e.slice(l,t);return o.push(r),o}function yt(e,t){let n=[],r=!1;return e.iterChangedRanges((l,o)=>n.push(l,o)),t.iterChangedRanges((l,o,s,c)=>{for(let i=0;i<n.length;){let f=n[i++],u=n[i++];c>=f&&s<=u&&(r=!0)}}),r}function kt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function be(e,t){return e.length?t.length?e.concat(t):e:t}const A=[],At=200;function Ee(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-At));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),U(e,e.length-1,1e9,n.setSelAfter(r)))}else return[g.selection([t])]}function Bt(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function $(e,t){if(!e.length)return e;let n=e.length,r=A;for(;n;){let l=St(e[n-1],t,r);if(l.changes&&!l.changes.empty||l.effects.length){let o=e.slice(0,n);return o[n-1]=l,o}else t=l.mapped,n--,r=l.selectionsAfter}return r.length?[g.selection(r)]:A}function St(e,t,n){let r=be(e.selectionsAfter.length?e.selectionsAfter.map(c=>c.map(t)):A,n);if(!e.changes)return g.selection(r);let l=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new g(l,Se.mapEffects(e.effects,t),s,e.startSelection.map(o),r)}const Ct=/^(input\.type|delete)($|\.)/;class C{constructor(t,n,r=0,l=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=l}isolate(){return this.prevTime?new C(this.done,this.undone):this}addChanges(t,n,r,l,o){let s=this.done,c=s[s.length-1];return c&&c.changes&&!c.changes.empty&&t.changes&&(!r||Ct.test(r))&&(!c.selectionsAfter.length&&n-this.prevTime<l.newGroupDelay&&l.joinToEvent(o,yt(c.changes,t.changes))||r=="input.type.compose")?s=U(s,s.length-1,l.minDepth,new g(t.changes.compose(c.changes),be(Se.mapEffects(t.effects,c.changes),c.effects),c.mapped,c.startSelection,A)):s=U(s,s.length,l.minDepth,t),new C(s,A,n,r)}addSelection(t,n,r,l){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:A;return o.length>0&&n-this.prevTime<l&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&kt(o[o.length-1],t)?this:new C(Ee(this.done,t),this.undone,n,r)}addMapping(t){return new C($(this.done,t),$(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){let l=t==0?this.done:this.undone;if(l.length==0)return null;let o=l[l.length-1],s=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):n.selection);if(r&&o.selectionsAfter.length)return n.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:X.of({side:t,rest:Bt(l),selection:s}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let c=l.length==1?A:l.slice(0,l.length-1);return o.mapped&&(c=$(c,o.mapped)),n.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:X.of({side:t,rest:c,selection:s}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}C.empty=new C(A,A);const bn=[{key:"Mod-z",run:Le,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Y,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Y,preventDefault:!0},{key:"Mod-u",run:pt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:gt,preventDefault:!0}];function I(e,t){return h.create(e.ranges.map(t),e.mainIndex)}function S(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function y({state:e,dispatch:t},n){let r=I(e.selection,n);return r.eq(e.selection,!0)?!1:(t(S(e,r)),!0)}function M(e,t){return h.cursor(t?e.to:e.from)}function J(e,t){return y(e,n=>n.empty?e.moveByChar(n,t):M(n,t))}function m(e){return e.textDirectionAt(e.state.selection.main.head)==lt.LTR}const Te=e=>J(e,!m(e)),Oe=e=>J(e,m(e)),En=e=>J(e,!0),Tn=e=>J(e,!1);function oe(e,t,n){let r=t.head,l=e.doc.lineAt(r);return r==(n?l.to:l.from)?r=n?Math.min(e.doc.length,l.to+1):Math.max(0,l.from-1):r=l.from+T(l.text,r-l.from,n),h.cursor(r,n?-1:1)}function Ie(e,t){return y(e,n=>n.empty?oe(e.state,n,t):M(n,t))}const On=e=>Ie(e,!0),In=e=>Ie(e,!1);function w(e,t){return y(e,n=>n.empty?e.moveByGroup(n,t):M(n,t))}const Dt=e=>w(e,!m(e)),xt=e=>w(e,m(e)),vn=e=>w(e,!0),Rn=e=>w(e,!1);function le(e,t,n){let r=e.state.charCategorizer(t),l=r(n),o=l!=D.Space;return s=>{let c=r(s);return c!=D.Space?o&&c==l:(o=!1,!0)}}const Fn=e=>y(e,t=>t.empty?e.moveByChar(t,!0,n=>le(e,t.head,n)):M(t,!0)),ue=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function ve(e,t,n){let r=e.state.charCategorizer(t.from),l=D.Space,o=t.from,s=0,c=!1,i=!1,f=!1,u=d=>{if(c)return!1;o+=n?d.length:-d.length;let B=r(d),k;if(B==D.Word&&d.charCodeAt(0)<128&&/[\W_]/.test(d)&&(B=-1),l==D.Space&&(l=B),l!=B)return!1;if(l==D.Word)if(d.toLowerCase()==d){if(!n&&i)return!1;f=!0}else if(f){if(n)return!1;c=!0}else{if(i&&n&&r(k=e.state.sliceDoc(o,o+1))==D.Word&&k.toLowerCase()==k)return!1;i=!0}return s++,!0},a=e.moveByChar(t,n,d=>(u(d),u));if(ue&&l==D.Word&&a.from==t.from+s*(n?1:-1)){let d=Math.min(t.head,a.head),B=Math.max(t.head,a.head),k=e.state.sliceDoc(d,B);if(k.length>1&&/[\u4E00-\uffff]/.test(k)){let R=Array.from(ue.segment(k));if(R.length>1)return n?h.cursor(t.head+R[1].index,-1):h.cursor(a.head+R[R.length-1].index,1)}}return a}function Re(e,t){return y(e,n=>n.empty?ve(e,n,t):M(n,t))}const Gn=e=>Re(e,!0),Un=e=>Re(e,!1);function Lt(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function z(e,t,n){let r=te(e).resolveInner(t.head),l=n?Q.closedBy:Q.openedBy;for(let i=t.head;;){let f=n?r.childAfter(i):r.childBefore(i);if(!f)break;Lt(e,f,l)?r=f:i=n?f.to:f.from}let o=r.type.prop(l),s,c;return o&&(s=n?E(e,r.from,1):E(e,r.to,-1))&&s.matched?c=n?s.end.to:s.end.from:c=n?r.to:r.from,h.cursor(c,n?-1:1)}const Mt=e=>y(e,t=>z(e.state,t,!m(e))),bt=e=>y(e,t=>z(e.state,t,m(e)));function Fe(e,t){return y(e,n=>{if(!n.empty)return M(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Ge=e=>Fe(e,!1),Ue=e=>Fe(e,!0);function Ve(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,l;if(t){for(let o of e.state.facet(O.scrollMargins)){let s=o(e);s!=null&&s.top&&(n=Math.max(s==null?void 0:s.top,n)),s!=null&&s.bottom&&(r=Math.max(s==null?void 0:s.bottom,r))}l=e.scrollDOM.clientHeight-n-r}else l=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,l-5)}}function Ne(e,t){let n=Ve(e),{state:r}=e,l=I(r.selection,s=>s.empty?e.moveVertically(s,t,n.height):M(s,t));if(l.eq(r.selection))return!1;let o;if(n.selfScroll){let s=e.coordsAtPos(r.selection.main.head),c=e.scrollDOM.getBoundingClientRect(),i=c.top+n.marginTop,f=c.bottom-n.marginBottom;s&&s.top>i&&s.bottom<f&&(o=O.scrollIntoView(l.main.head,{y:"start",yMargin:s.top-i}))}return e.dispatch(S(r,l),{effects:o}),!0}const fe=e=>Ne(e,!1),Z=e=>Ne(e,!0);function x(e,t,n){let r=e.lineBlockAt(t.head),l=e.moveToLineBoundary(t,n);if(l.head==t.head&&l.head!=(n?r.to:r.from)&&(l=e.moveToLineBoundary(t,n,!1)),!n&&l.head==r.from&&r.length){let o=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;o&&t.head!=r.from+o&&(l=h.cursor(r.from+o))}return l}const Et=e=>y(e,t=>x(e,t,!0)),Tt=e=>y(e,t=>x(e,t,!1)),Ot=e=>y(e,t=>x(e,t,!m(e))),It=e=>y(e,t=>x(e,t,m(e))),vt=e=>y(e,t=>h.cursor(e.lineBlockAt(t.head).from,1)),Rt=e=>y(e,t=>h.cursor(e.lineBlockAt(t.head).to,-1));function Pe(e,t,n){let r=!1,l=I(e.selection,o=>{let s=E(e,o.head,-1)||E(e,o.head,1)||o.head>0&&E(e,o.head-1,1)||o.head<e.doc.length&&E(e,o.head+1,-1);if(!s||!s.end)return o;r=!0;let c=s.start.from==o.head?s.end.to:s.end.from;return n?h.range(o.anchor,c):h.cursor(c)});return r?(t(S(e,l)),!0):!1}const Ft=({state:e,dispatch:t})=>Pe(e,t,!1),Vn=({state:e,dispatch:t})=>Pe(e,t,!0);function p(e,t,n){let r=I(e.state.selection,l=>{l.undirectional&&l.head>=l.anchor!=t&&(l=h.range(l.head,l.anchor));let o=n(l);return h.range(l.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(S(e.state,r)),!0)}function W(e,t){return p(e,t,n=>e.moveByChar(n,t))}const Je=e=>W(e,!m(e)),we=e=>W(e,m(e)),Nn=e=>W(e,!0),Pn=e=>W(e,!1),Jn=e=>p(e,!0,t=>oe(e.state,t,!0)),wn=e=>p(e,!1,t=>oe(e.state,t,!1));function H(e,t){return p(e,t,n=>e.moveByGroup(n,t))}const Gt=e=>H(e,!m(e)),Ut=e=>H(e,m(e)),zn=e=>H(e,!0),Wn=e=>H(e,!1),Hn=e=>p(e,!0,t=>e.moveByChar(t,!0,n=>le(e,t.head,n)));function ze(e,t){return p(e,t,n=>ve(e,n,t))}const qn=e=>ze(e,!0),Kn=e=>ze(e,!1),Vt=e=>{let t=!m(e);return p(e,t,n=>z(e.state,n,t))},Nt=e=>{let t=m(e);return p(e,t,n=>z(e.state,n,t))};function We(e,t){return p(e,t,n=>e.moveVertically(n,t))}const He=e=>We(e,!1),qe=e=>We(e,!0);function Ke(e,t){return p(e,t,n=>e.moveVertically(n,t,Ve(e).height))}const ae=e=>Ke(e,!1),he=e=>Ke(e,!0),Pt=e=>p(e,!0,t=>x(e,t,!0)),Jt=e=>p(e,!1,t=>x(e,t,!1)),wt=e=>{let t=!m(e);return p(e,t,n=>x(e,n,t))},zt=e=>{let t=m(e);return p(e,t,n=>x(e,n,t))},Wt=e=>p(e,!1,t=>h.cursor(e.lineBlockAt(t.head).from)),Ht=e=>p(e,!0,t=>h.cursor(e.lineBlockAt(t.head).to)),de=({state:e,dispatch:t})=>(t(S(e,{anchor:0})),!0),me=({state:e,dispatch:t})=>(t(S(e,{anchor:e.doc.length})),!0),pe=({state:e,dispatch:t})=>(t(S(e,{anchor:e.selection.main.anchor,head:0})),!0),ge=({state:e,dispatch:t})=>(t(S(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),qt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Kt=({state:e,dispatch:t})=>{let n=q(e).map(({from:r,to:l})=>h.range(r,Math.min(l+1,e.doc.length)));return t(e.update({selection:h.create(n),userEvent:"select"})),!0},$t=({state:e,dispatch:t})=>{let n=I(e.selection,r=>{let l=te(e),o=l.resolveStack(r.from,1);if(r.empty){let s=l.resolveStack(r.from,-1);s.node.from>=o.node.from&&s.node.to<=o.node.to&&(o=s)}for(let s=o;s;s=s.next){let{node:c}=s;if((c.from<r.from&&c.to>=r.to||c.to>r.to&&c.from<=r.from)&&s.next)return h.range(c.to,c.from)}return r});return n.eq(e.selection)?!1:(t(S(e,n)),!0)};function $e(e,t){let{state:n}=e,r=n.selection,l=n.selection.ranges.slice();for(let o of n.selection.ranges){let s=n.doc.lineAt(o.head);if(t?s.to<e.state.doc.length:s.from>0)for(let c=o;;){let i=e.moveVertically(c,t);if(i.head<s.from||i.head>s.to){l.some(f=>f.head==i.head)||l.push(i);break}else{if(i.head==c.head)break;c=i}}}return l.length==r.ranges.length?!1:(e.dispatch(S(n,h.create(l,l.length-1))),!0)}const jt=e=>$e(e,!1),Qt=e=>$e(e,!0),Xt=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=h.create([n.main]):n.main.empty||(r=h.create([h.cursor(n.main.head)])),r?(t(S(e,r)),!0):!1};function b(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,l=r.changeByRange(o=>{let{from:s,to:c}=o;if(s==c){let i=t(o);i<s?(n="delete.backward",i=F(e,i,!1)):i>s&&(n="delete.forward",i=F(e,i,!0)),s=Math.min(s,i),c=Math.max(c,i)}else s=F(e,s,!1),c=F(e,c,!0);return s==c?{range:o}:{changes:{from:s,to:c},range:h.cursor(s,s<o.head?-1:1)}});return l.changes.empty?!1:(e.dispatch(r.update(l,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?O.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function F(e,t,n){if(e instanceof O)for(let r of e.state.facet(O.atomicRanges).map(l=>l(e)))r.between(t,t,(l,o)=>{l<t&&o>t&&(t=n?o:l)});return t}const se=(e,t,n)=>b(e,r=>{let l=r.from,{state:o}=e,s=o.doc.lineAt(l),c,i;if(n&&!t&&l>s.from&&l<s.from+200&&!/[^ \t]/.test(c=s.text.slice(0,l-s.from))){if(c[c.length-1]==" ")return l-1;let f=ee(c,o.tabSize),u=f%j(o)||j(o);for(let a=0;a<u&&c[c.length-1-a]==" ";a++)l--;i=l}else i=T(s.text,l-s.from,t,t)+s.from,i==l&&s.number!=(t?o.doc.lines:1)?i+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(i-s.from,l-s.from))&&(i=T(s.text,i-s.from,!1,!1)+s.from);return i}),_=e=>se(e,!1,!0),$n=e=>se(e,!1,!1),je=e=>se(e,!0,!1),Qe=(e,t)=>b(e,n=>{let r=n.head,{state:l}=e,o=l.doc.lineAt(r),s=l.charCategorizer(r);for(let c=null;;){if(r==(t?o.to:o.from)){r==n.head&&o.number!=(t?l.doc.lines:1)&&(r+=t?1:-1);break}let i=T(o.text,r-o.from,t)+o.from,f=o.text.slice(Math.min(r,i)-o.from,Math.max(r,i)-o.from),u=s(f);if(c!=null&&u!=c)break;(f!=" "||r!=n.head)&&(c=u),r=i}return r}),Xe=e=>Qe(e,!1),Yt=e=>Qe(e,!0),jn=e=>b(e,t=>e.moveByChar(t,!0,n=>le(e,t.head,n)).head),Zt=e=>b(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Qn=e=>b(e,t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)}),_t=e=>b(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),en=e=>b(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Xn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=[];for(let r=0,l="",o=e.doc.iter();;){if(o.next(),o.lineBreak||o.done){let s=l.search(/\s+$/);if(s>-1&&n.push({from:r-(l.length-s),to:r}),o.done)break;l=""}else l=o.value;r+=o.value.length}return n.length?(t(e.update({changes:n,userEvent:"delete"})),!0):!1},tn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:ke.of(["",""])},range:h.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},nn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let l=r.from,o=e.doc.lineAt(l),s=l==o.from?l-1:T(o.text,l-o.from,!1)+o.from,c=l==o.to?l+1:T(o.text,l-o.from,!0)+o.from;return{changes:{from:s,to:c,insert:e.doc.slice(l,c).append(e.doc.slice(s,l))},range:h.cursor(c)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function q(e){let t=[],n=-1;for(let r of e.selection.ranges){let l=e.doc.lineAt(r.from),o=e.doc.lineAt(r.to);if(!r.empty&&r.to==o.from&&(o=e.doc.lineAt(r.to-1)),n>=l.number){let s=t[t.length-1];s.to=o.to,s.ranges.push(r)}else t.push({from:l.from,to:o.to,ranges:[r]});n=o.number+1}return t}function Ye(e,t,n){if(e.readOnly)return!1;let r=[],l=[];for(let o of q(e)){if(n?o.to==e.doc.length:o.from==0)continue;let s=e.doc.lineAt(n?o.to+1:o.from-1),c=s.length+1;if(n){r.push({from:o.to,to:s.to},{from:o.from,insert:s.text+e.lineBreak});for(let i of o.ranges)l.push(h.range(Math.min(e.doc.length,i.anchor+c),Math.min(e.doc.length,i.head+c)))}else{r.push({from:s.from,to:o.from},{from:o.to,insert:e.lineBreak+s.text});for(let i of o.ranges)l.push(h.range(i.anchor-c,i.head-c))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:h.create(l,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const rn=({state:e,dispatch:t})=>Ye(e,t,!1),on=({state:e,dispatch:t})=>Ye(e,t,!0);function Ze(e,t,n){if(e.readOnly)return!1;let r=[];for(let o of q(e))n?r.push({from:o.from,insert:e.doc.slice(o.from,o.to)+e.lineBreak}):r.push({from:o.to,insert:e.lineBreak+e.doc.slice(o.from,o.to)});let l=e.changes(r);return t(e.update({changes:l,selection:e.selection.map(l,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const ln=({state:e,dispatch:t})=>Ze(e,t,!1),sn=({state:e,dispatch:t})=>Ze(e,t,!0),cn=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(q(t).map(({from:l,to:o})=>(l>0?l--:o<t.doc.length&&o++,{from:l,to:o}))),r=I(t.selection,l=>{let o;if(e.lineWrapping){let s=e.lineBlockAt(l.head),c=e.coordsAtPos(l.head,l.assoc||1);c&&(o=s.bottom+e.documentTop-c.bottom+e.defaultLineHeight/2)}return e.moveVertically(l,!0,o)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0},Yn=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0),Zn=({state:e,dispatch:t})=>(t(e.update(e.changeByRange(n=>{let r=/^\s*/.exec(e.doc.lineAt(n.from).text)[0];return{changes:{from:n.from,to:n.to,insert:e.lineBreak+r},range:h.cursor(n.from+r.length+1)}}),{scrollIntoView:!0,userEvent:"input"})),!0);function un(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=te(e).resolveInner(t),r=n.childBefore(t),l=n.childAfter(t),o;return r&&l&&r.to<=t&&l.from>=t&&(o=r.type.prop(Q.closedBy))&&o.indexOf(l.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(l.from).from&&!/\S/.test(e.sliceDoc(r.to,l.from))?{from:r.to,to:l.from}:null}const ye=_e(!1),fn=_e(!0);function _e(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(l=>{let{from:o,to:s}=l,c=t.doc.lineAt(o),i=!e&&o==s&&un(t,o);e&&(o=s=(s<=c.to?c:t.doc.lineAt(s)).to);let f=new Ce(t,{simulateBreak:o,simulateDoubleBreak:!!i}),u=De(f,o);for(u==null&&(u=ee(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));s<c.to&&/\s/.test(c.text[s-c.from]);)s++;i?{from:o,to:s}=i:o>c.from&&o<c.from+100&&!/\S/.test(c.text.slice(0,o))&&(o=c.from);let a=["",G(t,u)];return i&&a.push(G(t,f.lineIndent(c.from,-1))),{changes:{from:o,to:s,insert:ke.of(a)},range:h.cursor(o+1+a[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function ce(e,t){let n=-1;return e.changeByRange(r=>{let l=[];for(let s=r.from;s<=r.to;){let c=e.doc.lineAt(s);c.number>n&&(r.empty||r.to>c.from)&&(t(c,l,r),n=c.number),s=c.to+1}let o=e.changes(l);return{changes:l,range:h.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}const an=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Ce(e,{overrideIndentation:o=>{let s=n[o];return s??-1}}),l=ce(e,(o,s,c)=>{let i=De(r,o.from);if(i==null)return;/\S/.test(o.text)||(i=0);let f=/^\s*/.exec(o.text)[0],u=G(e,i);(f!=u||c.from<o.from+f.length)&&(n[o.from]=i,s.push({from:o.from,to:o.from+f.length,insert:u}))});return l.changes.empty||t(e.update(l,{userEvent:"indent"})),!0},ie=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(ce(e,(n,r)=>{r.push({from:n.from,insert:e.facet(st)})}),{userEvent:"input.indent"})),!0),et=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(ce(e,(n,r)=>{let l=/^\s*/.exec(n.text)[0];if(!l)return;let o=ee(l,e.tabSize),s=0,c=G(e,Math.max(0,o-j(e)));for(;s<l.length&&s<c.length&&l.charCodeAt(s)==c.charCodeAt(s);)s++;r.push({from:n.from+s,to:n.from+l.length,insert:c.slice(s)})}),{userEvent:"delete.dedent"})),!0),hn=e=>(e.setTabFocusMode(),!0),_n=e=>(e.setTabFocusMode(2e3),!0),er=({state:e,dispatch:t})=>e.selection.ranges.some(n=>!n.empty)?ie({state:e,dispatch:t}):(t(e.update(e.replaceSelection(" "),{scrollIntoView:!0,userEvent:"input"})),!0),dn=[{key:"Ctrl-b",run:Te,shift:Je,preventDefault:!0},{key:"Ctrl-f",run:Oe,shift:we},{key:"Ctrl-p",run:Ge,shift:He},{key:"Ctrl-n",run:Ue,shift:qe},{key:"Ctrl-a",run:vt,shift:Wt},{key:"Ctrl-e",run:Rt,shift:Ht},{key:"Ctrl-d",run:je},{key:"Ctrl-h",run:_},{key:"Ctrl-k",run:Zt},{key:"Ctrl-Alt-h",run:Xe},{key:"Ctrl-o",run:tn},{key:"Ctrl-t",run:nn},{key:"Ctrl-v",run:Z}],mn=[{key:"ArrowLeft",run:Te,shift:Je,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Dt,shift:Gt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Ot,shift:wt,preventDefault:!0},{key:"ArrowRight",run:Oe,shift:we,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:xt,shift:Ut,preventDefault:!0},{mac:"Cmd-ArrowRight",run:It,shift:zt,preventDefault:!0},{key:"ArrowUp",run:Ge,shift:He,preventDefault:!0},{mac:"Cmd-ArrowUp",run:de,shift:pe},{mac:"Ctrl-ArrowUp",run:fe,shift:ae},{key:"ArrowDown",run:Ue,shift:qe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:me,shift:ge},{mac:"Ctrl-ArrowDown",run:Z,shift:he},{key:"PageUp",run:fe,shift:ae},{key:"PageDown",run:Z,shift:he},{key:"Home",run:Tt,shift:Jt,preventDefault:!0},{key:"Mod-Home",run:de,shift:pe},{key:"End",run:Et,shift:Pt,preventDefault:!0},{key:"Mod-End",run:me,shift:ge},{key:"Enter",run:ye,shift:ye},{key:"Mod-a",run:qt},{key:"Backspace",run:_,shift:_,preventDefault:!0},{key:"Delete",run:je,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Xe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Yt,preventDefault:!0},{mac:"Mod-Backspace",run:_t,preventDefault:!0},{mac:"Mod-Delete",run:en,preventDefault:!0}].concat(dn.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),tr=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Mt,shift:Vt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:bt,shift:Nt},{key:"Alt-ArrowUp",run:rn},{key:"Shift-Alt-ArrowUp",run:ln},{key:"Alt-ArrowDown",run:on},{key:"Shift-Alt-ArrowDown",run:sn},{key:"Mod-Alt-ArrowUp",run:jt},{key:"Mod-Alt-ArrowDown",run:Qt},{key:"Escape",run:Xt},{key:"Mod-Enter",run:fn},{key:"Alt-l",mac:"Ctrl-l",run:Kt},{key:"Mod-i",run:$t,preventDefault:!0},{key:"Mod-[",run:et},{key:"Mod-]",run:ie},{key:"Mod-Alt-\\",run:an},{key:"Shift-Mod-k",run:cn},{key:"Shift-Mod-\\",run:Ft},{key:"Mod-/",run:ct},{key:"Alt-A",run:ut},{key:"Ctrl-m",mac:"Shift-Alt-m",run:hn}].concat(mn),nr={key:"Tab",run:ie,shift:et};export{jt as addCursorAbove,Qt as addCursorBelow,Sn as blockComment,Cn as blockUncomment,sn as copyLineDown,ln as copyLineUp,Tn as cursorCharBackward,In as cursorCharBackwardLogical,En as cursorCharForward,On as cursorCharForwardLogical,Te as cursorCharLeft,Oe as cursorCharRight,me as cursorDocEnd,de as cursorDocStart,Rn as cursorGroupBackward,vn as cursorGroupForward,Fn as cursorGroupForwardWin,Dt as cursorGroupLeft,xt as cursorGroupRight,Tt as cursorLineBoundaryBackward,Et as cursorLineBoundaryForward,Ot as cursorLineBoundaryLeft,It as cursorLineBoundaryRight,Ue as cursorLineDown,Rt as cursorLineEnd,vt as cursorLineStart,Ge as cursorLineUp,Ft as cursorMatchingBracket,Z as cursorPageDown,fe as cursorPageUp,Un as cursorSubwordBackward,Gn as cursorSubwordForward,Mt as cursorSyntaxLeft,bt as cursorSyntaxRight,tr as defaultKeymap,_ as deleteCharBackward,$n as deleteCharBackwardStrict,je as deleteCharForward,Xe as deleteGroupBackward,Yt as deleteGroupForward,jn as deleteGroupForwardWin,cn as deleteLine,_t as deleteLineBoundaryBackward,en as deleteLineBoundaryForward,Zt as deleteToLineEnd,Qn as deleteToLineStart,Xn as deleteTrailingWhitespace,dn as emacsStyleKeymap,Dn as history,xn as historyField,bn as historyKeymap,et as indentLess,ie as indentMore,an as indentSelection,nr as indentWithTab,fn as insertBlankLine,Yn as insertNewline,ye as insertNewlineAndIndent,Zn as insertNewlineKeepIndent,er as insertTab,mt as invertedEffects,dt as isolateHistory,An as lineComment,Bn as lineUncomment,on as moveLineDown,rn as moveLineUp,Y as redo,Mn as redoDepth,gt as redoSelection,qt as selectAll,Pn as selectCharBackward,wn as selectCharBackwardLogical,Nn as selectCharForward,Jn as selectCharForwardLogical,Je as selectCharLeft,we as selectCharRight,ge as selectDocEnd,pe as selectDocStart,Wn as selectGroupBackward,zn as selectGroupForward,Hn as selectGroupForwardWin,Gt as selectGroupLeft,Ut as selectGroupRight,Kt as selectLine,Jt as selectLineBoundaryBackward,Pt as selectLineBoundaryForward,wt as selectLineBoundaryLeft,zt as selectLineBoundaryRight,qe as selectLineDown,Ht as selectLineEnd,Wt as selectLineStart,He as selectLineUp,Vn as selectMatchingBracket,he as selectPageDown,ae as selectPageUp,$t as selectParentSyntax,Kn as selectSubwordBackward,qn as selectSubwordForward,Vt as selectSyntaxLeft,Nt as selectSyntaxRight,Xt as simplifySelection,tn as splitLine,mn as standardKeymap,_n as temporarilySetTabFocusMode,ut as toggleBlockComment,ft as toggleBlockCommentByLine,ct as toggleComment,it as toggleLineComment,hn as toggleTabFocusMode,nn as transposeChars,Le as undo,Ln as undoDepth,pt as undoSelection};
|
|
1
|
+
import{EditorSelection as h,Text as ke,findClusterBreak as T,StateField as tt,Transaction as K,Facet as Ae,Annotation as Be,combineConfig as nt,StateEffect as Se,ChangeSet as rt,ChangeDesc as ot,countColumn as ee,CharCategory as D}from"./index-BHot-lnj.js";import{E as O,o as lt}from"./index-891wE-Rj.js";import{I as Ce,g as De,c as G,e as te,m as E,h as j,j as st}from"./index-DueUeK4W.js";import{N as Q}from"./index-DhmD70Mu.js";const ct=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=ne(e.state,n.from);return r.line?it(e):r.block?ft(e):!1};function L(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let l=e(t,n);return l?(r(n.update(l)),!0):!1}}const it=L(re,0),An=L(re,1),Bn=L(re,2),ut=L(V,0),Sn=L(V,1),Cn=L(V,2),ft=L((e,t)=>V(e,t,ht(t)),0);function ne(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const v=50;function at(e,{open:t,close:n},r,l){let o=e.sliceDoc(r-v,r),s=e.sliceDoc(l,l+v),c=/\s*$/.exec(o)[0].length,i=/^\s*/.exec(s)[0].length,f=o.length-c;if(o.slice(f-t.length,f)==t&&s.slice(i,i+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:l+i,margin:i&&1}};let u,a;l-r<=2*v?u=a=e.sliceDoc(r,l):(u=e.sliceDoc(r,r+v),a=e.sliceDoc(l-v,l));let d=/^\s*/.exec(u)[0].length,B=/\s*$/.exec(a)[0].length,k=a.length-B-n.length;return u.slice(d,d+t.length)==t&&a.slice(k,k+n.length)==n?{open:{pos:r+d+t.length,margin:/\s/.test(u.charAt(d+t.length))?1:0},close:{pos:l-B-n.length,margin:/\s/.test(a.charAt(k-1))?1:0}}:null}function ht(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),l=n.to<=r.to?r:e.doc.lineAt(n.to);l.from>r.from&&l.from==n.to&&(l=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>r.from?t[o].to=l.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:l.to})}return t}function V(e,t,n=t.selection.ranges){let r=n.map(o=>ne(t,o.from).block);if(!r.every(o=>o))return null;let l=n.map((o,s)=>at(t,r[s],o.from,o.to));if(e!=2&&!l.every(o=>o))return{changes:t.changes(n.map((o,s)=>l[s]?[]:[{from:o.from,insert:r[s].open+" "},{from:o.to,insert:" "+r[s].close}]))};if(e!=1&&l.some(o=>o)){let o=[];for(let s=0,c;s<l.length;s++)if(c=l[s]){let i=r[s],{open:f,close:u}=c;o.push({from:f.pos-i.open.length,to:f.pos+f.margin},{from:u.pos-u.margin,to:u.pos+i.close.length})}return{changes:o}}return null}function re(e,t,n=t.selection.ranges){let r=[],l=-1;e:for(let{from:o,to:s}of n){let c=r.length,i=1e9,f;for(let u=o;u<=s;){let a=t.doc.lineAt(u);if(f==null&&(f=ne(t,a.from).line,!f))continue e;if(a.from>l&&(o==s||s>a.from)){l=a.from;let d=/^\s*/.exec(a.text)[0].length,B=d==a.length,k=a.text.slice(d,d+f.length)==f?d:-1;d<a.text.length&&d<i&&(i=d),r.push({line:a,comment:k,token:f,indent:d,empty:B,single:!1})}u=a.to+1}if(i<1e9)for(let u=c;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=i);r.length==c+1&&(r[c].single=!0)}if(e!=2&&r.some(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:c,token:i,indent:f,empty:u,single:a}of r)(a||!u)&&o.push({from:c.from+f,insert:i+" "});let s=t.changes(o);return{changes:s,selection:t.selection.map(s,1)}}else if(e!=1&&r.some(o=>o.comment>=0)){let o=[];for(let{line:s,comment:c,token:i}of r)if(c>=0){let f=s.from+c,u=f+i.length;s.text[u-s.from]==" "&&u++,o.push({from:f,to:u})}return{changes:o}}return null}const X=Be.define(),dt=Be.define(),mt=Ae.define(),xe=Ae.define({combine(e){return nt(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,l)=>t(r,l)||n(r,l)})}}),N=tt.define({create(){return C.empty},update(e,t){let n=t.state.facet(xe),r=t.annotation(X);if(r){let i=g.fromTransaction(t,r.selection),f=r.side,u=f==0?e.undone:e.done;return i?u=U(u,u.length,n.minDepth,i):u=Ee(u,t.startState.selection),new C(f==0?r.rest:u,f==0?u:r.rest)}let l=t.annotation(dt);if((l=="full"||l=="before")&&(e=e.isolate()),t.annotation(K.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let o=g.fromTransaction(t),s=t.annotation(K.time),c=t.annotation(K.userEvent);return o?e=e.addChanges(o,s,c,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,c,n.newGroupDelay)),(l=="full"||l=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new C(e.done.map(g.fromJSON),e.undone.map(g.fromJSON))}});function Dn(e={}){return[N,xe.of(e),O.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?Le:t.inputType=="historyRedo"?Y:null;return r?(t.preventDefault(),r(n)):!1}})]}const xn=N;function P(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let l=n.field(N,!1);if(!l)return!1;let o=l.pop(e,n,t);return o?(r(o),!0):!1}}const Le=P(0,!1),Y=P(1,!1),pt=P(0,!0),gt=P(1,!0);function Me(e){return function(t){let n=t.field(N,!1);if(!n)return 0;let r=e==0?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}const Ln=Me(0),Mn=Me(1);class g{constructor(t,n,r,l,o){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=l,this.selectionsAfter=o}setSelAfter(t){return new g(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(l=>l.toJSON())}}static fromJSON(t){return new g(t.changes&&rt.fromJSON(t.changes),[],t.mapped&&ot.fromJSON(t.mapped),t.startSelection&&h.fromJSON(t.startSelection),t.selectionsAfter.map(h.fromJSON))}static fromTransaction(t,n){let r=A;for(let l of t.startState.facet(mt)){let o=l(t);o.length&&(r=r.concat(o))}return!r.length&&t.changes.empty?null:new g(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,A)}static selection(t){return new g(void 0,A,void 0,void 0,t)}}function U(e,t,n,r){let l=t+1>n+20?t-n-1:0,o=e.slice(l,t);return o.push(r),o}function yt(e,t){let n=[],r=!1;return e.iterChangedRanges((l,o)=>n.push(l,o)),t.iterChangedRanges((l,o,s,c)=>{for(let i=0;i<n.length;){let f=n[i++],u=n[i++];c>=f&&s<=u&&(r=!0)}}),r}function kt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function be(e,t){return e.length?t.length?e.concat(t):e:t}const A=[],At=200;function Ee(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-At));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),U(e,e.length-1,1e9,n.setSelAfter(r)))}else return[g.selection([t])]}function Bt(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function $(e,t){if(!e.length)return e;let n=e.length,r=A;for(;n;){let l=St(e[n-1],t,r);if(l.changes&&!l.changes.empty||l.effects.length){let o=e.slice(0,n);return o[n-1]=l,o}else t=l.mapped,n--,r=l.selectionsAfter}return r.length?[g.selection(r)]:A}function St(e,t,n){let r=be(e.selectionsAfter.length?e.selectionsAfter.map(c=>c.map(t)):A,n);if(!e.changes)return g.selection(r);let l=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new g(l,Se.mapEffects(e.effects,t),s,e.startSelection.map(o),r)}const Ct=/^(input\.type|delete)($|\.)/;class C{constructor(t,n,r=0,l=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=l}isolate(){return this.prevTime?new C(this.done,this.undone):this}addChanges(t,n,r,l,o){let s=this.done,c=s[s.length-1];return c&&c.changes&&!c.changes.empty&&t.changes&&(!r||Ct.test(r))&&(!c.selectionsAfter.length&&n-this.prevTime<l.newGroupDelay&&l.joinToEvent(o,yt(c.changes,t.changes))||r=="input.type.compose")?s=U(s,s.length-1,l.minDepth,new g(t.changes.compose(c.changes),be(Se.mapEffects(t.effects,c.changes),c.effects),c.mapped,c.startSelection,A)):s=U(s,s.length,l.minDepth,t),new C(s,A,n,r)}addSelection(t,n,r,l){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:A;return o.length>0&&n-this.prevTime<l&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&kt(o[o.length-1],t)?this:new C(Ee(this.done,t),this.undone,n,r)}addMapping(t){return new C($(this.done,t),$(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){let l=t==0?this.done:this.undone;if(l.length==0)return null;let o=l[l.length-1],s=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):n.selection);if(r&&o.selectionsAfter.length)return n.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:X.of({side:t,rest:Bt(l),selection:s}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let c=l.length==1?A:l.slice(0,l.length-1);return o.mapped&&(c=$(c,o.mapped)),n.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:X.of({side:t,rest:c,selection:s}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}C.empty=new C(A,A);const bn=[{key:"Mod-z",run:Le,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Y,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Y,preventDefault:!0},{key:"Mod-u",run:pt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:gt,preventDefault:!0}];function I(e,t){return h.create(e.ranges.map(t),e.mainIndex)}function S(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function y({state:e,dispatch:t},n){let r=I(e.selection,n);return r.eq(e.selection,!0)?!1:(t(S(e,r)),!0)}function M(e,t){return h.cursor(t?e.to:e.from)}function J(e,t){return y(e,n=>n.empty?e.moveByChar(n,t):M(n,t))}function m(e){return e.textDirectionAt(e.state.selection.main.head)==lt.LTR}const Te=e=>J(e,!m(e)),Oe=e=>J(e,m(e)),En=e=>J(e,!0),Tn=e=>J(e,!1);function oe(e,t,n){let r=t.head,l=e.doc.lineAt(r);return r==(n?l.to:l.from)?r=n?Math.min(e.doc.length,l.to+1):Math.max(0,l.from-1):r=l.from+T(l.text,r-l.from,n),h.cursor(r,n?-1:1)}function Ie(e,t){return y(e,n=>n.empty?oe(e.state,n,t):M(n,t))}const On=e=>Ie(e,!0),In=e=>Ie(e,!1);function w(e,t){return y(e,n=>n.empty?e.moveByGroup(n,t):M(n,t))}const Dt=e=>w(e,!m(e)),xt=e=>w(e,m(e)),vn=e=>w(e,!0),Rn=e=>w(e,!1);function le(e,t,n){let r=e.state.charCategorizer(t),l=r(n),o=l!=D.Space;return s=>{let c=r(s);return c!=D.Space?o&&c==l:(o=!1,!0)}}const Fn=e=>y(e,t=>t.empty?e.moveByChar(t,!0,n=>le(e,t.head,n)):M(t,!0)),ue=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function ve(e,t,n){let r=e.state.charCategorizer(t.from),l=D.Space,o=t.from,s=0,c=!1,i=!1,f=!1,u=d=>{if(c)return!1;o+=n?d.length:-d.length;let B=r(d),k;if(B==D.Word&&d.charCodeAt(0)<128&&/[\W_]/.test(d)&&(B=-1),l==D.Space&&(l=B),l!=B)return!1;if(l==D.Word)if(d.toLowerCase()==d){if(!n&&i)return!1;f=!0}else if(f){if(n)return!1;c=!0}else{if(i&&n&&r(k=e.state.sliceDoc(o,o+1))==D.Word&&k.toLowerCase()==k)return!1;i=!0}return s++,!0},a=e.moveByChar(t,n,d=>(u(d),u));if(ue&&l==D.Word&&a.from==t.from+s*(n?1:-1)){let d=Math.min(t.head,a.head),B=Math.max(t.head,a.head),k=e.state.sliceDoc(d,B);if(k.length>1&&/[\u4E00-\uffff]/.test(k)){let R=Array.from(ue.segment(k));if(R.length>1)return n?h.cursor(t.head+R[1].index,-1):h.cursor(a.head+R[R.length-1].index,1)}}return a}function Re(e,t){return y(e,n=>n.empty?ve(e,n,t):M(n,t))}const Gn=e=>Re(e,!0),Un=e=>Re(e,!1);function Lt(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function z(e,t,n){let r=te(e).resolveInner(t.head),l=n?Q.closedBy:Q.openedBy;for(let i=t.head;;){let f=n?r.childAfter(i):r.childBefore(i);if(!f)break;Lt(e,f,l)?r=f:i=n?f.to:f.from}let o=r.type.prop(l),s,c;return o&&(s=n?E(e,r.from,1):E(e,r.to,-1))&&s.matched?c=n?s.end.to:s.end.from:c=n?r.to:r.from,h.cursor(c,n?-1:1)}const Mt=e=>y(e,t=>z(e.state,t,!m(e))),bt=e=>y(e,t=>z(e.state,t,m(e)));function Fe(e,t){return y(e,n=>{if(!n.empty)return M(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Ge=e=>Fe(e,!1),Ue=e=>Fe(e,!0);function Ve(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,l;if(t){for(let o of e.state.facet(O.scrollMargins)){let s=o(e);s!=null&&s.top&&(n=Math.max(s==null?void 0:s.top,n)),s!=null&&s.bottom&&(r=Math.max(s==null?void 0:s.bottom,r))}l=e.scrollDOM.clientHeight-n-r}else l=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,l-5)}}function Ne(e,t){let n=Ve(e),{state:r}=e,l=I(r.selection,s=>s.empty?e.moveVertically(s,t,n.height):M(s,t));if(l.eq(r.selection))return!1;let o;if(n.selfScroll){let s=e.coordsAtPos(r.selection.main.head),c=e.scrollDOM.getBoundingClientRect(),i=c.top+n.marginTop,f=c.bottom-n.marginBottom;s&&s.top>i&&s.bottom<f&&(o=O.scrollIntoView(l.main.head,{y:"start",yMargin:s.top-i}))}return e.dispatch(S(r,l),{effects:o}),!0}const fe=e=>Ne(e,!1),Z=e=>Ne(e,!0);function x(e,t,n){let r=e.lineBlockAt(t.head),l=e.moveToLineBoundary(t,n);if(l.head==t.head&&l.head!=(n?r.to:r.from)&&(l=e.moveToLineBoundary(t,n,!1)),!n&&l.head==r.from&&r.length){let o=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;o&&t.head!=r.from+o&&(l=h.cursor(r.from+o))}return l}const Et=e=>y(e,t=>x(e,t,!0)),Tt=e=>y(e,t=>x(e,t,!1)),Ot=e=>y(e,t=>x(e,t,!m(e))),It=e=>y(e,t=>x(e,t,m(e))),vt=e=>y(e,t=>h.cursor(e.lineBlockAt(t.head).from,1)),Rt=e=>y(e,t=>h.cursor(e.lineBlockAt(t.head).to,-1));function Pe(e,t,n){let r=!1,l=I(e.selection,o=>{let s=E(e,o.head,-1)||E(e,o.head,1)||o.head>0&&E(e,o.head-1,1)||o.head<e.doc.length&&E(e,o.head+1,-1);if(!s||!s.end)return o;r=!0;let c=s.start.from==o.head?s.end.to:s.end.from;return n?h.range(o.anchor,c):h.cursor(c)});return r?(t(S(e,l)),!0):!1}const Ft=({state:e,dispatch:t})=>Pe(e,t,!1),Vn=({state:e,dispatch:t})=>Pe(e,t,!0);function p(e,t,n){let r=I(e.state.selection,l=>{l.undirectional&&l.head>=l.anchor!=t&&(l=h.range(l.head,l.anchor));let o=n(l);return h.range(l.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(S(e.state,r)),!0)}function W(e,t){return p(e,t,n=>e.moveByChar(n,t))}const Je=e=>W(e,!m(e)),we=e=>W(e,m(e)),Nn=e=>W(e,!0),Pn=e=>W(e,!1),Jn=e=>p(e,!0,t=>oe(e.state,t,!0)),wn=e=>p(e,!1,t=>oe(e.state,t,!1));function H(e,t){return p(e,t,n=>e.moveByGroup(n,t))}const Gt=e=>H(e,!m(e)),Ut=e=>H(e,m(e)),zn=e=>H(e,!0),Wn=e=>H(e,!1),Hn=e=>p(e,!0,t=>e.moveByChar(t,!0,n=>le(e,t.head,n)));function ze(e,t){return p(e,t,n=>ve(e,n,t))}const qn=e=>ze(e,!0),Kn=e=>ze(e,!1),Vt=e=>{let t=!m(e);return p(e,t,n=>z(e.state,n,t))},Nt=e=>{let t=m(e);return p(e,t,n=>z(e.state,n,t))};function We(e,t){return p(e,t,n=>e.moveVertically(n,t))}const He=e=>We(e,!1),qe=e=>We(e,!0);function Ke(e,t){return p(e,t,n=>e.moveVertically(n,t,Ve(e).height))}const ae=e=>Ke(e,!1),he=e=>Ke(e,!0),Pt=e=>p(e,!0,t=>x(e,t,!0)),Jt=e=>p(e,!1,t=>x(e,t,!1)),wt=e=>{let t=!m(e);return p(e,t,n=>x(e,n,t))},zt=e=>{let t=m(e);return p(e,t,n=>x(e,n,t))},Wt=e=>p(e,!1,t=>h.cursor(e.lineBlockAt(t.head).from)),Ht=e=>p(e,!0,t=>h.cursor(e.lineBlockAt(t.head).to)),de=({state:e,dispatch:t})=>(t(S(e,{anchor:0})),!0),me=({state:e,dispatch:t})=>(t(S(e,{anchor:e.doc.length})),!0),pe=({state:e,dispatch:t})=>(t(S(e,{anchor:e.selection.main.anchor,head:0})),!0),ge=({state:e,dispatch:t})=>(t(S(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),qt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Kt=({state:e,dispatch:t})=>{let n=q(e).map(({from:r,to:l})=>h.range(r,Math.min(l+1,e.doc.length)));return t(e.update({selection:h.create(n),userEvent:"select"})),!0},$t=({state:e,dispatch:t})=>{let n=I(e.selection,r=>{let l=te(e),o=l.resolveStack(r.from,1);if(r.empty){let s=l.resolveStack(r.from,-1);s.node.from>=o.node.from&&s.node.to<=o.node.to&&(o=s)}for(let s=o;s;s=s.next){let{node:c}=s;if((c.from<r.from&&c.to>=r.to||c.to>r.to&&c.from<=r.from)&&s.next)return h.range(c.to,c.from)}return r});return n.eq(e.selection)?!1:(t(S(e,n)),!0)};function $e(e,t){let{state:n}=e,r=n.selection,l=n.selection.ranges.slice();for(let o of n.selection.ranges){let s=n.doc.lineAt(o.head);if(t?s.to<e.state.doc.length:s.from>0)for(let c=o;;){let i=e.moveVertically(c,t);if(i.head<s.from||i.head>s.to){l.some(f=>f.head==i.head)||l.push(i);break}else{if(i.head==c.head)break;c=i}}}return l.length==r.ranges.length?!1:(e.dispatch(S(n,h.create(l,l.length-1))),!0)}const jt=e=>$e(e,!1),Qt=e=>$e(e,!0),Xt=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=h.create([n.main]):n.main.empty||(r=h.create([h.cursor(n.main.head)])),r?(t(S(e,r)),!0):!1};function b(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,l=r.changeByRange(o=>{let{from:s,to:c}=o;if(s==c){let i=t(o);i<s?(n="delete.backward",i=F(e,i,!1)):i>s&&(n="delete.forward",i=F(e,i,!0)),s=Math.min(s,i),c=Math.max(c,i)}else s=F(e,s,!1),c=F(e,c,!0);return s==c?{range:o}:{changes:{from:s,to:c},range:h.cursor(s,s<o.head?-1:1)}});return l.changes.empty?!1:(e.dispatch(r.update(l,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?O.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function F(e,t,n){if(e instanceof O)for(let r of e.state.facet(O.atomicRanges).map(l=>l(e)))r.between(t,t,(l,o)=>{l<t&&o>t&&(t=n?o:l)});return t}const se=(e,t,n)=>b(e,r=>{let l=r.from,{state:o}=e,s=o.doc.lineAt(l),c,i;if(n&&!t&&l>s.from&&l<s.from+200&&!/[^ \t]/.test(c=s.text.slice(0,l-s.from))){if(c[c.length-1]==" ")return l-1;let f=ee(c,o.tabSize),u=f%j(o)||j(o);for(let a=0;a<u&&c[c.length-1-a]==" ";a++)l--;i=l}else i=T(s.text,l-s.from,t,t)+s.from,i==l&&s.number!=(t?o.doc.lines:1)?i+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(i-s.from,l-s.from))&&(i=T(s.text,i-s.from,!1,!1)+s.from);return i}),_=e=>se(e,!1,!0),$n=e=>se(e,!1,!1),je=e=>se(e,!0,!1),Qe=(e,t)=>b(e,n=>{let r=n.head,{state:l}=e,o=l.doc.lineAt(r),s=l.charCategorizer(r);for(let c=null;;){if(r==(t?o.to:o.from)){r==n.head&&o.number!=(t?l.doc.lines:1)&&(r+=t?1:-1);break}let i=T(o.text,r-o.from,t)+o.from,f=o.text.slice(Math.min(r,i)-o.from,Math.max(r,i)-o.from),u=s(f);if(c!=null&&u!=c)break;(f!=" "||r!=n.head)&&(c=u),r=i}return r}),Xe=e=>Qe(e,!1),Yt=e=>Qe(e,!0),jn=e=>b(e,t=>e.moveByChar(t,!0,n=>le(e,t.head,n)).head),Zt=e=>b(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Qn=e=>b(e,t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)}),_t=e=>b(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),en=e=>b(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Xn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=[];for(let r=0,l="",o=e.doc.iter();;){if(o.next(),o.lineBreak||o.done){let s=l.search(/\s+$/);if(s>-1&&n.push({from:r-(l.length-s),to:r}),o.done)break;l=""}else l=o.value;r+=o.value.length}return n.length?(t(e.update({changes:n,userEvent:"delete"})),!0):!1},tn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:ke.of(["",""])},range:h.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},nn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let l=r.from,o=e.doc.lineAt(l),s=l==o.from?l-1:T(o.text,l-o.from,!1)+o.from,c=l==o.to?l+1:T(o.text,l-o.from,!0)+o.from;return{changes:{from:s,to:c,insert:e.doc.slice(l,c).append(e.doc.slice(s,l))},range:h.cursor(c)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function q(e){let t=[],n=-1;for(let r of e.selection.ranges){let l=e.doc.lineAt(r.from),o=e.doc.lineAt(r.to);if(!r.empty&&r.to==o.from&&(o=e.doc.lineAt(r.to-1)),n>=l.number){let s=t[t.length-1];s.to=o.to,s.ranges.push(r)}else t.push({from:l.from,to:o.to,ranges:[r]});n=o.number+1}return t}function Ye(e,t,n){if(e.readOnly)return!1;let r=[],l=[];for(let o of q(e)){if(n?o.to==e.doc.length:o.from==0)continue;let s=e.doc.lineAt(n?o.to+1:o.from-1),c=s.length+1;if(n){r.push({from:o.to,to:s.to},{from:o.from,insert:s.text+e.lineBreak});for(let i of o.ranges)l.push(h.range(Math.min(e.doc.length,i.anchor+c),Math.min(e.doc.length,i.head+c)))}else{r.push({from:s.from,to:o.from},{from:o.to,insert:e.lineBreak+s.text});for(let i of o.ranges)l.push(h.range(i.anchor-c,i.head-c))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:h.create(l,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const rn=({state:e,dispatch:t})=>Ye(e,t,!1),on=({state:e,dispatch:t})=>Ye(e,t,!0);function Ze(e,t,n){if(e.readOnly)return!1;let r=[];for(let o of q(e))n?r.push({from:o.from,insert:e.doc.slice(o.from,o.to)+e.lineBreak}):r.push({from:o.to,insert:e.lineBreak+e.doc.slice(o.from,o.to)});let l=e.changes(r);return t(e.update({changes:l,selection:e.selection.map(l,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const ln=({state:e,dispatch:t})=>Ze(e,t,!1),sn=({state:e,dispatch:t})=>Ze(e,t,!0),cn=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(q(t).map(({from:l,to:o})=>(l>0?l--:o<t.doc.length&&o++,{from:l,to:o}))),r=I(t.selection,l=>{let o;if(e.lineWrapping){let s=e.lineBlockAt(l.head),c=e.coordsAtPos(l.head,l.assoc||1);c&&(o=s.bottom+e.documentTop-c.bottom+e.defaultLineHeight/2)}return e.moveVertically(l,!0,o)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0},Yn=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0),Zn=({state:e,dispatch:t})=>(t(e.update(e.changeByRange(n=>{let r=/^\s*/.exec(e.doc.lineAt(n.from).text)[0];return{changes:{from:n.from,to:n.to,insert:e.lineBreak+r},range:h.cursor(n.from+r.length+1)}}),{scrollIntoView:!0,userEvent:"input"})),!0);function un(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=te(e).resolveInner(t),r=n.childBefore(t),l=n.childAfter(t),o;return r&&l&&r.to<=t&&l.from>=t&&(o=r.type.prop(Q.closedBy))&&o.indexOf(l.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(l.from).from&&!/\S/.test(e.sliceDoc(r.to,l.from))?{from:r.to,to:l.from}:null}const ye=_e(!1),fn=_e(!0);function _e(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(l=>{let{from:o,to:s}=l,c=t.doc.lineAt(o),i=!e&&o==s&&un(t,o);e&&(o=s=(s<=c.to?c:t.doc.lineAt(s)).to);let f=new Ce(t,{simulateBreak:o,simulateDoubleBreak:!!i}),u=De(f,o);for(u==null&&(u=ee(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));s<c.to&&/\s/.test(c.text[s-c.from]);)s++;i?{from:o,to:s}=i:o>c.from&&o<c.from+100&&!/\S/.test(c.text.slice(0,o))&&(o=c.from);let a=["",G(t,u)];return i&&a.push(G(t,f.lineIndent(c.from,-1))),{changes:{from:o,to:s,insert:ke.of(a)},range:h.cursor(o+1+a[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function ce(e,t){let n=-1;return e.changeByRange(r=>{let l=[];for(let s=r.from;s<=r.to;){let c=e.doc.lineAt(s);c.number>n&&(r.empty||r.to>c.from)&&(t(c,l,r),n=c.number),s=c.to+1}let o=e.changes(l);return{changes:l,range:h.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}const an=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Ce(e,{overrideIndentation:o=>{let s=n[o];return s??-1}}),l=ce(e,(o,s,c)=>{let i=De(r,o.from);if(i==null)return;/\S/.test(o.text)||(i=0);let f=/^\s*/.exec(o.text)[0],u=G(e,i);(f!=u||c.from<o.from+f.length)&&(n[o.from]=i,s.push({from:o.from,to:o.from+f.length,insert:u}))});return l.changes.empty||t(e.update(l,{userEvent:"indent"})),!0},ie=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(ce(e,(n,r)=>{r.push({from:n.from,insert:e.facet(st)})}),{userEvent:"input.indent"})),!0),et=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(ce(e,(n,r)=>{let l=/^\s*/.exec(n.text)[0];if(!l)return;let o=ee(l,e.tabSize),s=0,c=G(e,Math.max(0,o-j(e)));for(;s<l.length&&s<c.length&&l.charCodeAt(s)==c.charCodeAt(s);)s++;r.push({from:n.from+s,to:n.from+l.length,insert:c.slice(s)})}),{userEvent:"delete.dedent"})),!0),hn=e=>(e.setTabFocusMode(),!0),_n=e=>(e.setTabFocusMode(2e3),!0),er=({state:e,dispatch:t})=>e.selection.ranges.some(n=>!n.empty)?ie({state:e,dispatch:t}):(t(e.update(e.replaceSelection(" "),{scrollIntoView:!0,userEvent:"input"})),!0),dn=[{key:"Ctrl-b",run:Te,shift:Je,preventDefault:!0},{key:"Ctrl-f",run:Oe,shift:we},{key:"Ctrl-p",run:Ge,shift:He},{key:"Ctrl-n",run:Ue,shift:qe},{key:"Ctrl-a",run:vt,shift:Wt},{key:"Ctrl-e",run:Rt,shift:Ht},{key:"Ctrl-d",run:je},{key:"Ctrl-h",run:_},{key:"Ctrl-k",run:Zt},{key:"Ctrl-Alt-h",run:Xe},{key:"Ctrl-o",run:tn},{key:"Ctrl-t",run:nn},{key:"Ctrl-v",run:Z}],mn=[{key:"ArrowLeft",run:Te,shift:Je,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Dt,shift:Gt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Ot,shift:wt,preventDefault:!0},{key:"ArrowRight",run:Oe,shift:we,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:xt,shift:Ut,preventDefault:!0},{mac:"Cmd-ArrowRight",run:It,shift:zt,preventDefault:!0},{key:"ArrowUp",run:Ge,shift:He,preventDefault:!0},{mac:"Cmd-ArrowUp",run:de,shift:pe},{mac:"Ctrl-ArrowUp",run:fe,shift:ae},{key:"ArrowDown",run:Ue,shift:qe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:me,shift:ge},{mac:"Ctrl-ArrowDown",run:Z,shift:he},{key:"PageUp",run:fe,shift:ae},{key:"PageDown",run:Z,shift:he},{key:"Home",run:Tt,shift:Jt,preventDefault:!0},{key:"Mod-Home",run:de,shift:pe},{key:"End",run:Et,shift:Pt,preventDefault:!0},{key:"Mod-End",run:me,shift:ge},{key:"Enter",run:ye,shift:ye},{key:"Mod-a",run:qt},{key:"Backspace",run:_,shift:_,preventDefault:!0},{key:"Delete",run:je,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Xe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Yt,preventDefault:!0},{mac:"Mod-Backspace",run:_t,preventDefault:!0},{mac:"Mod-Delete",run:en,preventDefault:!0}].concat(dn.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),tr=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Mt,shift:Vt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:bt,shift:Nt},{key:"Alt-ArrowUp",run:rn},{key:"Shift-Alt-ArrowUp",run:ln},{key:"Alt-ArrowDown",run:on},{key:"Shift-Alt-ArrowDown",run:sn},{key:"Mod-Alt-ArrowUp",run:jt},{key:"Mod-Alt-ArrowDown",run:Qt},{key:"Escape",run:Xt},{key:"Mod-Enter",run:fn},{key:"Alt-l",mac:"Ctrl-l",run:Kt},{key:"Mod-i",run:$t,preventDefault:!0},{key:"Mod-[",run:et},{key:"Mod-]",run:ie},{key:"Mod-Alt-\\",run:an},{key:"Shift-Mod-k",run:cn},{key:"Shift-Mod-\\",run:Ft},{key:"Mod-/",run:ct},{key:"Alt-A",run:ut},{key:"Ctrl-m",mac:"Shift-Alt-m",run:hn}].concat(mn),nr={key:"Tab",run:ie,shift:et};export{jt as addCursorAbove,Qt as addCursorBelow,Sn as blockComment,Cn as blockUncomment,sn as copyLineDown,ln as copyLineUp,Tn as cursorCharBackward,In as cursorCharBackwardLogical,En as cursorCharForward,On as cursorCharForwardLogical,Te as cursorCharLeft,Oe as cursorCharRight,me as cursorDocEnd,de as cursorDocStart,Rn as cursorGroupBackward,vn as cursorGroupForward,Fn as cursorGroupForwardWin,Dt as cursorGroupLeft,xt as cursorGroupRight,Tt as cursorLineBoundaryBackward,Et as cursorLineBoundaryForward,Ot as cursorLineBoundaryLeft,It as cursorLineBoundaryRight,Ue as cursorLineDown,Rt as cursorLineEnd,vt as cursorLineStart,Ge as cursorLineUp,Ft as cursorMatchingBracket,Z as cursorPageDown,fe as cursorPageUp,Un as cursorSubwordBackward,Gn as cursorSubwordForward,Mt as cursorSyntaxLeft,bt as cursorSyntaxRight,tr as defaultKeymap,_ as deleteCharBackward,$n as deleteCharBackwardStrict,je as deleteCharForward,Xe as deleteGroupBackward,Yt as deleteGroupForward,jn as deleteGroupForwardWin,cn as deleteLine,_t as deleteLineBoundaryBackward,en as deleteLineBoundaryForward,Zt as deleteToLineEnd,Qn as deleteToLineStart,Xn as deleteTrailingWhitespace,dn as emacsStyleKeymap,Dn as history,xn as historyField,bn as historyKeymap,et as indentLess,ie as indentMore,an as indentSelection,nr as indentWithTab,fn as insertBlankLine,Yn as insertNewline,ye as insertNewlineAndIndent,Zn as insertNewlineKeepIndent,er as insertTab,mt as invertedEffects,dt as isolateHistory,An as lineComment,Bn as lineUncomment,on as moveLineDown,rn as moveLineUp,Y as redo,Mn as redoDepth,gt as redoSelection,qt as selectAll,Pn as selectCharBackward,wn as selectCharBackwardLogical,Nn as selectCharForward,Jn as selectCharForwardLogical,Je as selectCharLeft,we as selectCharRight,ge as selectDocEnd,pe as selectDocStart,Wn as selectGroupBackward,zn as selectGroupForward,Hn as selectGroupForwardWin,Gt as selectGroupLeft,Ut as selectGroupRight,Kt as selectLine,Jt as selectLineBoundaryBackward,Pt as selectLineBoundaryForward,wt as selectLineBoundaryLeft,zt as selectLineBoundaryRight,qe as selectLineDown,Ht as selectLineEnd,Wt as selectLineStart,He as selectLineUp,Vn as selectMatchingBracket,he as selectPageDown,ae as selectPageUp,$t as selectParentSyntax,Kn as selectSubwordBackward,qn as selectSubwordForward,Vt as selectSyntaxLeft,Nt as selectSyntaxRight,Xt as simplifySelection,tn as splitLine,mn as standardKeymap,_n as temporarilySetTabFocusMode,ut as toggleBlockComment,ft as toggleBlockCommentByLine,ct as toggleComment,it as toggleLineComment,hn as toggleTabFocusMode,nn as transposeChars,Le as undo,Ln as undoDepth,pt as undoSelection};
|
package/web/index.html
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
})();
|
|
33
33
|
</script>
|
|
34
|
-
<script type="module" crossorigin src="./assets/index-
|
|
34
|
+
<script type="module" crossorigin src="./assets/index-DhmD70Mu.js"></script>
|
|
35
35
|
<link rel="stylesheet" crossorigin href="./assets/index-D0UlXcXr.css">
|
|
36
36
|
</head>
|
|
37
37
|
<body>
|