skill-creator 2.4.0 → 2.5.0

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.
Files changed (58) hide show
  1. package/dist/cli.js +119 -9
  2. package/dist/cli.js.map +2 -2
  3. package/dist/daemon.js +268 -21
  4. package/dist/daemon.js.map +4 -4
  5. package/dist/package.json +1 -1
  6. package/dist/webui/_app/immutable/assets/0.DLmCZ2fP.css +2 -0
  7. package/dist/webui/_app/immutable/assets/CreatorWorkspace.CvDsme_1.css +1 -0
  8. package/dist/webui/_app/immutable/chunks/{CdjBDc_u.js → B8aGNSaH.js} +1 -1
  9. package/dist/webui/_app/immutable/chunks/{CvO5eq4f.js → BDMeqoYB.js} +1 -1
  10. package/dist/webui/_app/immutable/chunks/{BgJCuTDs.js → BTMBuftG.js} +1 -1
  11. package/dist/webui/_app/immutable/chunks/Ba9GVGQ5.js +6 -0
  12. package/dist/webui/_app/immutable/chunks/{D6s79OPW.js → BchFBl6r.js} +1 -1
  13. package/dist/webui/_app/immutable/chunks/BhCD2hsN.js +8 -0
  14. package/dist/webui/_app/immutable/chunks/{hIGXQE4_.js → Bynub5xW.js} +1 -1
  15. package/dist/webui/_app/immutable/chunks/CYhuNS_d.js +11 -0
  16. package/dist/webui/_app/immutable/chunks/{Bd1_Ly7G.js → C_mgfJl-.js} +1 -1
  17. package/dist/webui/_app/immutable/chunks/{CIxXWvxF.js → ClW_LCBS.js} +1 -1
  18. package/dist/webui/_app/immutable/chunks/{Do_MDwCJ.js → Cy5ABld-.js} +1 -1
  19. package/dist/webui/_app/immutable/chunks/CzkhJhvt.js +1 -0
  20. package/dist/webui/_app/immutable/chunks/{BTuMeN4z.js → DBNjJ5Iw.js} +1 -1
  21. package/dist/webui/_app/immutable/chunks/DC5f4JBB.js +5 -0
  22. package/dist/webui/_app/immutable/chunks/DF_TIB7n.js +1 -0
  23. package/dist/webui/_app/immutable/chunks/DH8yd93-.js +1 -0
  24. package/dist/webui/_app/immutable/chunks/DSbDiml2.js +28 -0
  25. package/dist/webui/_app/immutable/chunks/{Du6-3Tbt.js → DTzqg7c9.js} +1 -1
  26. package/dist/webui/_app/immutable/chunks/{DGJ9QIPN.js → DVv6BdWV.js} +1 -1
  27. package/dist/webui/_app/immutable/chunks/{CBFLFfGb.js → DYbgoqwH.js} +1 -1
  28. package/dist/webui/_app/immutable/chunks/DdHvRi0A.js +1 -0
  29. package/dist/webui/_app/immutable/chunks/{B0stYqX9.js → DjZ7hdjX.js} +1 -1
  30. package/dist/webui/_app/immutable/chunks/DvWG9eQi.js +1 -0
  31. package/dist/webui/_app/immutable/chunks/DzfSSVEB.js +2 -0
  32. package/dist/webui/_app/immutable/chunks/GHFnehdP.js +5 -0
  33. package/dist/webui/_app/immutable/chunks/VnziGBZO.js +2 -0
  34. package/dist/webui/_app/immutable/chunks/a0LlqeqU.js +1 -0
  35. package/dist/webui/_app/immutable/chunks/eFUKcYMv.js +1 -0
  36. package/dist/webui/_app/immutable/chunks/{DlsPNMHX.js → pd7EK5wP.js} +2 -2
  37. package/dist/webui/_app/immutable/chunks/{Dcf0klrH.js → xAjQV7BZ.js} +2 -2
  38. package/dist/webui/_app/immutable/entry/{app.SX0t6ojk.js → app.DlQ53I3_.js} +2 -2
  39. package/dist/webui/_app/immutable/entry/start.CNmXm9ox.js +1 -0
  40. package/dist/webui/_app/immutable/nodes/0.BXeEkneG.js +229 -0
  41. package/dist/webui/_app/immutable/nodes/{1.BY0DmHLP.js → 1.DzYWdh98.js} +1 -1
  42. package/dist/webui/_app/immutable/nodes/{2._osi8D6m.js → 2.Dl1DQV0d.js} +1 -1
  43. package/dist/webui/_app/version.json +1 -1
  44. package/dist/webui/index.html +23 -21
  45. package/package.json +5 -5
  46. package/dist/webui/_app/immutable/assets/0.B4ZC2KQW.css +0 -2
  47. package/dist/webui/_app/immutable/chunks/B_gnhZ39.js +0 -1
  48. package/dist/webui/_app/immutable/chunks/BcvferwH.js +0 -8
  49. package/dist/webui/_app/immutable/chunks/CD-NpLjk.js +0 -6
  50. package/dist/webui/_app/immutable/chunks/COXgCOd9.js +0 -2
  51. package/dist/webui/_app/immutable/chunks/Ccj5eiVa.js +0 -1
  52. package/dist/webui/_app/immutable/chunks/Cp0lquqA.js +0 -1
  53. package/dist/webui/_app/immutable/chunks/Crg8KRap.js +0 -5
  54. package/dist/webui/_app/immutable/chunks/D7DTLcps.js +0 -1
  55. package/dist/webui/_app/immutable/chunks/oJ4aK8PG.js +0 -1
  56. package/dist/webui/_app/immutable/chunks/vry1W47_.js +0 -7
  57. package/dist/webui/_app/immutable/entry/start.gejSBBnR.js +0 -1
  58. package/dist/webui/_app/immutable/nodes/0.BTXc1wYu.js +0 -229
@@ -0,0 +1,2 @@
1
+ import{$ as e,A as t,At as n,Ct as r,D as i,Dt as a,Et as o,Ft as s,I as c,It as l,L as u,M as d,Mt as f,Nt as p,O as m,Ot as ee,P as h,Pt as te,Q as g,S as ne,St as _,Tt as re,U as ie,X as v,Z as ae,_t as y,at as oe,bt as se,ct as ce,dt as le,et as ue,ft as de,gt as fe,h as pe,ht as me,i as he,it as ge,j as b,jt as _e,kt as ve,l as ye,lt as be,mt as xe,n as Se,nt as Ce,o as we,ot as Te,pt as Ee,r as De,rt as Oe,st as ke,tt as Ae,ut as je,v as Me,vt as Ne,w as Pe,wt as x,xt as S,yt as Fe}from"./CYhuNS_d.js";var Ie=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Ve(e.state,n.from);return r.line?Re(e):r.block?Be(e):!1};function Le(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var Re=Le(Ge,0),ze=Le(We,0),Be=Le((e,t)=>We(e,t,Ue(t)),0);function Ve(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var C=50;function He(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-C,r),o=e.sliceDoc(i,i+C),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+C),d=e.sliceDoc(i-C,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function Ue(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function We(e,t,n=t.selection.ranges){let r=n.map(e=>Ve(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>He(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function Ge(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=Ve(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var Ke=Ne.define(),qe=Ne.define(),Je=x.define(),Ye=x.define({combine(e){return p(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),Xe=ee.define({create(){return D.empty},update(e,t){let r=t.state.facet(Ye),i=t.annotation(Ke);if(i){let n=T.fromTransaction(t,i.selection),a=i.side,o=a==0?e.undone:e.done;return o=n?nt(o,o.length,r.minDepth,n):st(o,t.startState.selection),new D(a==0?i.rest:o,a==0?o:i.rest)}let a=t.annotation(qe);if((a==`full`||a==`before`)&&(e=e.isolate()),t.annotation(n.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let o=T.fromTransaction(t),s=t.annotation(n.time),c=t.annotation(n.userEvent);return o?e=e.addChanges(o,s,c,r,t):t.selection&&(e=e.addSelection(t.startState.selection,s,c,r.newGroupDelay)),(a==`full`||a==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new D(e.done.map(T.fromJSON),e.undone.map(T.fromJSON))}});function Ze(e={}){return[Xe,Ye.of(e),g.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?Qe:e.inputType==`historyRedo`?$e:null;return n?(e.preventDefault(),n(t)):!1}})]}function w(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(Xe,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var Qe=w(0,!1),$e=w(1,!1),et=w(0,!0),tt=w(1,!0),T=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&se.fromJSON(t.changes),[],t.mapped&&Fe.fromJSON(t.mapped),t.startSelection&&_.fromJSON(t.startSelection),t.selectionsAfter.map(_.fromJSON))}static fromTransaction(t,n){let r=E;for(let e of t.startState.facet(Je)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,E)}static selection(t){return new e(void 0,E,void 0,void 0,t)}};function nt(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function rt(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function it(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function at(e,t){return e.length?t.length?e.concat(t):e:t}var E=[],ot=200;function st(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-ot));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),nt(e,e.length-1,1e9,n.setSelAfter(r)))}return[T.selection([t])]}function ct(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 lt(e,t){if(!e.length)return e;let n=e.length,r=E;for(;n;){let i=ut(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[T.selection(r)]:E}function ut(e,t,n){let r=at(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):E,n);if(!e.changes)return T.selection(r);let i=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new T(i,a.mapEffects(e.effects,t),s,e.startSelection.map(o),r)}var dt=/^(input\.type|delete)($|\.)/,D=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,o){let s=this.done,c=s[s.length-1];return s=c&&c.changes&&!c.changes.empty&&t.changes&&(!r||dt.test(r))&&(!c.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(o,rt(c.changes,t.changes))||r==`input.type.compose`)?nt(s,s.length-1,i.minDepth,new T(t.changes.compose(c.changes),at(a.mapEffects(t.effects,c.changes),c.effects),c.mapped,c.startSelection,E)):nt(s,s.length,i.minDepth,t),new e(s,E,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:E;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&it(a[a.length-1],t)?this:new e(st(this.done,t),this.undone,n,r)}addMapping(t){return new e(lt(this.done,t),lt(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Ke.of({side:e,rest:ct(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?E:r.slice(0,r.length-1);return i.mapped&&(n=lt(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Ke.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};D.empty=new D(E,E);var ft=[{key:`Mod-z`,run:Qe,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:$e,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:$e,preventDefault:!0},{key:`Mod-u`,run:et,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:tt,preventDefault:!0}];function O(e,t){return _.create(e.ranges.map(t),e.mainIndex)}function k(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function A({state:e,dispatch:t},n){let r=O(e.selection,n);return!r.eq(e.selection,!0)&&(t(k(e,r)),!0)}function j(e,t){return _.cursor(t?e.to:e.from)}function pt(e,t){return A(e,n=>n.empty?e.moveByChar(n,t):j(n,t))}function M(e){return e.textDirectionAt(e.state.selection.main.head)==ae.LTR}var mt=e=>pt(e,!M(e)),ht=e=>pt(e,M(e));function gt(e,t){return A(e,n=>n.empty?e.moveByGroup(n,t):j(n,t))}var _t=e=>gt(e,!M(e)),vt=e=>gt(e,M(e));typeof Intl<`u`&&Intl.Segmenter;function yt(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 N(e,t,n){let r=u(e).resolveInner(t.head),i=n?ie.closedBy:ie.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;yt(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?h(e,r.from,1):h(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,_.cursor(s,n?-1:1)}var bt=e=>A(e,t=>N(e.state,t,!M(e))),xt=e=>A(e,t=>N(e.state,t,M(e)));function St(e,t){return A(e,n=>{if(!n.empty)return j(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var Ct=e=>St(e,!1),wt=e=>St(e,!0);function Tt(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(g.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function Et(e,t){let n=Tt(e),{state:r}=e,i=O(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):j(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=g.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(k(r,i),{effects:a}),!0}var Dt=e=>Et(e,!1),Ot=e=>Et(e,!0);function P(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=_.cursor(r.from+n))}return i}var kt=e=>A(e,t=>P(e,t,!0)),At=e=>A(e,t=>P(e,t,!1)),jt=e=>A(e,t=>P(e,t,!M(e))),Mt=e=>A(e,t=>P(e,t,M(e))),Nt=e=>A(e,t=>e.moveToLineBoundary(t,!1,!1)),Pt=e=>A(e,t=>e.moveToLineBoundary(t,!0,!1));function Ft(e,t,n){let r=!1,i=O(e.selection,t=>{let i=h(e,t.head,-1)||h(e,t.head,1)||t.head>0&&h(e,t.head-1,1)||t.head<e.doc.length&&h(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?_.range(t.anchor,a):_.cursor(a)});return r?(t(k(e,i)),!0):!1}var It=({state:e,dispatch:t})=>Ft(e,t,!1);function F(e,t,n){let r=O(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=_.range(e.head,e.anchor));let r=n(e);return _.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(k(e.state,r)),!0)}function Lt(e,t){return F(e,t,n=>e.moveByChar(n,t))}var Rt=e=>Lt(e,!M(e)),zt=e=>Lt(e,M(e));function Bt(e,t){return F(e,t,n=>e.moveByGroup(n,t))}var Vt=e=>Bt(e,!M(e)),Ht=e=>Bt(e,M(e)),Ut=e=>{let t=!M(e);return F(e,t,n=>N(e.state,n,t))},Wt=e=>{let t=M(e);return F(e,t,n=>N(e.state,n,t))};function Gt(e,t){return F(e,t,n=>e.moveVertically(n,t))}var Kt=e=>Gt(e,!1),qt=e=>Gt(e,!0);function Jt(e,t){return F(e,t,n=>e.moveVertically(n,t,Tt(e).height))}var Yt=e=>Jt(e,!1),Xt=e=>Jt(e,!0),Zt=e=>F(e,!0,t=>P(e,t,!0)),Qt=e=>F(e,!1,t=>P(e,t,!1)),$t=e=>{let t=!M(e);return F(e,t,n=>P(e,n,t))},en=e=>{let t=M(e);return F(e,t,n=>P(e,n,t))},tn=e=>F(e,!1,t=>_.cursor(e.lineBlockAt(t.head).from)),nn=e=>F(e,!0,t=>_.cursor(e.lineBlockAt(t.head).to)),rn=({state:e,dispatch:t})=>(t(k(e,{anchor:0})),!0),an=({state:e,dispatch:t})=>(t(k(e,{anchor:e.doc.length})),!0),on=({state:e,dispatch:t})=>(t(k(e,{anchor:e.selection.main.anchor,head:0})),!0),sn=({state:e,dispatch:t})=>(t(k(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),cn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),ln=({state:e,dispatch:t})=>{let n=R(e).map(({from:t,to:n})=>_.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:_.create(n),userEvent:`select`})),!0},un=({state:e,dispatch:t})=>{let n=O(e.selection,t=>{let n=u(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return _.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(k(e,n)),!0)};function dn(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(k(n,_.create(i,i.length-1))),!0)}var fn=e=>dn(e,!1),pn=e=>dn(e,!0),mn=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=_.create([n.main]):n.main.empty||(r=_.create([_.cursor(n.main.head)])),r?(t(k(e,r)),!0):!1};function I(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=L(e,o,!1)):o>i&&(n=`delete.forward`,o=L(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=L(e,i,!1),a=L(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:_.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?g.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function L(e,t,n){if(e instanceof g)for(let r of e.state.facet(g.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var hn=(e,t,n)=>I(e,r=>{let a=r.from,{state:o}=e,c=o.doc.lineAt(a),l,u;if(n&&!t&&a>c.from&&a<c.from+200&&!/[^ \t]/.test(l=c.text.slice(0,a-c.from))){if(l[l.length-1]==` `)return a-1;let e=te(l,o.tabSize)%i(o)||i(o);for(let t=0;t<e&&l[l.length-1-t]==` `;t++)a--;u=a}else u=s(c.text,a-c.from,t,t)+c.from,u==a&&c.number!=(t?o.doc.lines:1)?u+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(c.text.slice(u-c.from,a-c.from))&&(u=s(c.text,u-c.from,!1,!1)+c.from);return u}),gn=e=>hn(e,!1,!0),_n=e=>hn(e,!0,!1),vn=(e,t)=>I(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let c=s(a.text,r-a.from,t)+a.from,l=a.text.slice(Math.min(r,c)-a.from,Math.max(r,c)-a.from),u=o(l);if(e!=null&&u!=e)break;(l!=` `||r!=n.head)&&(e=u),r=c}return r}),yn=e=>vn(e,!1),bn=e=>vn(e,!0),xn=e=>I(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Sn=e=>I(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Cn=e=>I(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),wn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:ve.of([``,``])},range:_.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},Tn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:s(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:s(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:_.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function R(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function En(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of R(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(_.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(_.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:_.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var Dn=({state:e,dispatch:t})=>En(e,t,!1),On=({state:e,dispatch:t})=>En(e,t,!0);function kn(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of R(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var An=({state:e,dispatch:t})=>kn(e,t,!1),jn=({state:e,dispatch:t})=>kn(e,t,!0),Mn=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(R(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=O(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function Nn(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=u(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(ie.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var Pn=In(!1),Fn=In(!0);function In(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&Nn(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new ye(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=m(s,r);for(c??=te(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let l=[``,b(t,c)];return o&&l.push(b(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:ve.of(l)},range:_.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function Ln(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:_.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var Rn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new ye(e,{overrideIndentation:e=>n[e]??-1}),i=Ln(e,(t,i,a)=>{let o=m(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=b(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},zn=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Ln(e,(t,n)=>{n.push({from:t.from,insert:e.facet(d)})}),{userEvent:`input.indent`})),!0),Bn=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Ln(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let a=te(r,e.tabSize),o=0,s=b(e,Math.max(0,a-i(e)));for(;o<r.length&&o<s.length&&r.charCodeAt(o)==s.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+r.length,insert:s.slice(o)})}),{userEvent:`delete.dedent`})),!0),Vn=e=>(e.setTabFocusMode(),!0),Hn=[{key:`Ctrl-b`,run:mt,shift:Rt,preventDefault:!0},{key:`Ctrl-f`,run:ht,shift:zt},{key:`Ctrl-p`,run:Ct,shift:Kt},{key:`Ctrl-n`,run:wt,shift:qt},{key:`Ctrl-a`,run:Nt,shift:tn},{key:`Ctrl-e`,run:Pt,shift:nn},{key:`Ctrl-d`,run:_n},{key:`Ctrl-h`,run:gn},{key:`Ctrl-k`,run:xn},{key:`Ctrl-Alt-h`,run:yn},{key:`Ctrl-o`,run:wn},{key:`Ctrl-t`,run:Tn},{key:`Ctrl-v`,run:Ot}],Un=[{key:`ArrowLeft`,run:mt,shift:Rt,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:_t,shift:Vt,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:jt,shift:$t,preventDefault:!0},{key:`ArrowRight`,run:ht,shift:zt,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:vt,shift:Ht,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:Mt,shift:en,preventDefault:!0},{key:`ArrowUp`,run:Ct,shift:Kt,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:rn,shift:on},{mac:`Ctrl-ArrowUp`,run:Dt,shift:Yt},{key:`ArrowDown`,run:wt,shift:qt,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:an,shift:sn},{mac:`Ctrl-ArrowDown`,run:Ot,shift:Xt},{key:`PageUp`,run:Dt,shift:Yt},{key:`PageDown`,run:Ot,shift:Xt},{key:`Home`,run:At,shift:Qt,preventDefault:!0},{key:`Mod-Home`,run:rn,shift:on},{key:`End`,run:kt,shift:Zt,preventDefault:!0},{key:`Mod-End`,run:an,shift:sn},{key:`Enter`,run:Pn,shift:Pn},{key:`Mod-a`,run:cn},{key:`Backspace`,run:gn,shift:gn,preventDefault:!0},{key:`Delete`,run:_n,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:yn,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:bn,preventDefault:!0},{mac:`Mod-Backspace`,run:Sn,preventDefault:!0},{mac:`Mod-Delete`,run:Cn,preventDefault:!0}].concat(Hn.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Wn=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:bt,shift:Ut},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:xt,shift:Wt},{key:`Alt-ArrowUp`,run:Dn},{key:`Shift-Alt-ArrowUp`,run:An},{key:`Alt-ArrowDown`,run:On},{key:`Shift-Alt-ArrowDown`,run:jn},{key:`Mod-Alt-ArrowUp`,run:fn},{key:`Mod-Alt-ArrowDown`,run:pn},{key:`Escape`,run:mn},{key:`Mod-Enter`,run:Fn},{key:`Alt-l`,mac:`Ctrl-l`,run:ln},{key:`Mod-i`,run:un,preventDefault:!0},{key:`Mod-[`,run:Bn},{key:`Mod-]`,run:zn},{key:`Mod-Alt-\\`,run:Rn},{key:`Shift-Mod-k`,run:Mn},{key:`Shift-Mod-\\`,run:It},{key:`Mod-/`,run:Ie},{key:`Alt-A`,mac:`Ctrl-A`,run:ze},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Vn}].concat(Un),Gn=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,z=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(Gn(e)):Gn,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return _e(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=l(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=f(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(z.prototype[Symbol.iterator]=function(){return this});var Kn={from:-1,to:-1,match:/.*/.exec(``),precise:!0},qn=`gm`+(/x/.unicode==null?``:`u`),Jn=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=Kn,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Zn(e,t,n,r,i);this.re=new RegExp(t,qn+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=B(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=B(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},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}}},Yn=new WeakMap,Xn=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=Yn.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return Yn.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),Yn.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Zn=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Kn,this.matchPos=B(e,r),this.re=new RegExp(t,qn+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Xn.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=B(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Xn.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Jn.prototype[Symbol.iterator]=Zn.prototype[Symbol.iterator]=function(){return this});function Qn(e){try{return new RegExp(e,qn),!0}catch{return!1}}function B(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var $n=e=>{let t=oe(e,`cm-goto-line`);if(t){let e=t.dom.querySelector(`input[type=text]`);return e&&e.select(),!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:a}=me(e,{class:`cm-goto-line`,label:n.phrase(`Go to line`),input:{type:`text`,name:`line`,value:r},focus:!0,submitLabel:n.phrase(`go`)});return a.then(t=>{let r=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!r){e.dispatch({effects:i});return}let a=n.doc.lineAt(n.selection.main.head),[,o,s,c,l]=r,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/n.doc.lines),d=Math.round(n.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=n.doc.line(Math.max(1,Math.min(n.doc.lines,d))),p=_.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[i,g.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},er={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},tr=x.define({combine(e){return p(e,er,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function nr(e){let t=[cr,sr];return e&&t.push(tr.of(e)),t}var rr=v.mark({class:`cm-selectionMatch`}),ir=v.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function ar(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=S.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=S.Word)}function or(e,t,n,r){return e(t.sliceDoc(n,n+1))==S.Word&&e(t.sliceDoc(r-1,r))==S.Word}var sr=e.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(tr),{state:n}=e,r=n.selection;if(r.ranges.length>1)return v.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return v.none;let e=n.wordAt(i.head);if(!e)return v.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return v.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(ar(o,n,i.from,i.to)&&or(o,n,i.from,i.to)))return v.none}else if(a=n.sliceDoc(i.from,i.to),!a)return v.none}let s=[];for(let r of e.visibleRanges){let e=new z(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||ar(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(ir.range(r,a)):(r>=i.to||a<=i.from)&&s.push(rr.range(r,a)),s.length>t.maxMatches))return v.none}}return v.set(s)}},{decorations:e=>e.decorations}),cr=g.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),lr=({state:e,dispatch:t})=>{let{selection:n}=e,r=_.create(n.ranges.map(t=>e.wordAt(t.head)||_.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function ur(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new z(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new z(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var dr=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return lr({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=ur(e,r);return i?(t(e.update({selection:e.selection.addRange(_.range(i.from,i.to),!1),effects:g.scrollIntoView(i.to)})),!0):!1},V=x.define({combine(e){return p(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Rr(e),scrollToMatch:e=>g.scrollIntoView(e)})}}),fr=class{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||Qn(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,(e,t)=>t==`n`?`
2
+ `:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new yr(this):new gr(this)}getCursor(e,t=0,n){let i=e.doc?e:r.create({doc:e});return n??=i.doc.length,this.regexp?U(this,i,t,n):H(this,i,t,n)}},pr=class{constructor(e){this.spec=e}};function mr(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function H(e,t,n,r){let i;return e.wholeWord&&(i=hr(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=mr(e.test,t,i)),new z(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function hr(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(W(i,n-a))!=S.Word||t(G(i,n-a))!=S.Word)&&(t(G(i,r-a))!=S.Word||t(W(i,r-a))!=S.Word))}var gr=class extends pr{constructor(e){super(e)}nextMatch(e,t,n){let r=H(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=H(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=H(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=H(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=H(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function _r(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function U(e,t,n,r){let i;return e.wholeWord&&(i=vr(t.charCategorizer(t.selection.main.head))),e.test&&(i=_r(e.test,t,i)),new Jn(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function W(e,t){return e.slice(s(e,t,!1),t)}function G(e,t){return e.slice(t,s(e,t))}function vr(e){return(t,n,r)=>!r[0].length||(e(W(r.input,r.index))!=S.Word||e(G(r.input,r.index))!=S.Word)&&(e(G(r.input,r.index+r[0].length))!=S.Word||e(W(r.input,r.index+r[0].length))!=S.Word)}var yr=class extends pr{nextMatch(e,t,n){let r=U(this.spec,e,n,e.doc.length).next();return r.done&&(r=U(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=U(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=U(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=U(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},K=a.define(),br=a.define(),q=ee.define({create(e){return new xr(Mr(e).create(),null)},update(e,t){for(let n of t.effects)n.is(K)?e=new xr(n.value.create(),e.panel):n.is(br)&&(e=new xr(e.query,n.value?jr:null));return e},provide:e=>fe.from(e,e=>e.panel)}),xr=class{constructor(e,t){this.query=e,this.panel=t}},Sr=v.mark({class:`cm-searchMatch`}),Cr=v.mark({class:`cm-searchMatch cm-searchMatch-selected`}),wr=e.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(q))}update(e){let t=e.state.field(q);(t!=e.startState.field(q)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return v.none;let{view:n}=this,r=new o;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?Cr:Sr)})}return r.finish()}},{decorations:e=>e.decorations});function J(e){return t=>{let n=t.state.field(q,!1);return n&&n.query.spec.valid?e(t,n):Fr(t)}}var Tr=J((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=_.single(r.from,r.to),a=e.state.facet(V);return e.dispatch({selection:i,effects:[Vr(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Pr(e),!0}),Er=J((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=_.single(i.from,i.to),o=e.state.facet(V);return e.dispatch({selection:a,effects:[Vr(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Pr(e),!0}),Dr=J((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:_.create(n.map(e=>_.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Or=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new z(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(_.range(t.value.from,t.value.to))}return t(e.update({selection:_.create(a,o),userEvent:`select.search.matches`})),!0},kr=J((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.precise?o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(g.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let d=e.state.changes(s);return o&&(c=_.single(o.from,o.to).map(d),u.push(Vr(e,o)),u.push(n.facet(V).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),Ar=J((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:g.announce.of(r),userEvent:`input.replace.all`}),!0});function jr(e){return e.state.facet(V).createPanel(e)}function Mr(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(V);return new fr({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function Nr(e){let t=Te(e,jr);return t&&t.dom.querySelector(`[main-field]`)}function Pr(e){let t=Nr(e);t&&t==e.root.activeElement&&t.select()}var Fr=e=>{let t=e.state.field(q,!1);if(t&&t.panel){let n=Nr(e);if(n&&n!=e.root.activeElement){let r=Mr(e.state,t.query.spec);r.valid&&e.dispatch({effects:K.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[br.of(!0),t?K.of(Mr(e.state,t.query.spec)):a.appendConfig.of(Ur)]});return!0},Ir=e=>{let t=e.state.field(q,!1);if(!t||!t.panel)return!1;let n=Te(e,jr);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:br.of(!1)}),!0},Lr=[{key:`Mod-f`,run:Fr,scope:`editor search-panel`},{key:`F3`,run:Tr,shift:Er,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:Tr,shift:Er,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Ir,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Or},{key:`Mod-Alt-g`,run:$n},{key:`Mod-d`,run:dr,preventDefault:!0}],Rr=class{constructor(e){this.view=e;let t=this.query=e.state.field(q).query.spec;this.commit=this.commit.bind(this),this.searchField=y(`input`,{value:t.search,placeholder:Y(e,`Find`),"aria-label":Y(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=y(`input`,{value:t.replace,placeholder:Y(e,`Replace`),"aria-label":Y(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=y(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=y(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=y(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return y(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=y(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>Tr(e),[Y(e,`next`)]),n(`prev`,()=>Er(e),[Y(e,`previous`)]),n(`select`,()=>Dr(e),[Y(e,`all`)]),y(`label`,null,[this.caseField,Y(e,`match case`)]),y(`label`,null,[this.reField,Y(e,`regexp`)]),y(`label`,null,[this.wordField,Y(e,`by word`)]),...e.state.readOnly?[]:[y(`br`),this.replaceField,n(`replace`,()=>kr(e),[Y(e,`replace`)]),n(`replaceAll`,()=>Ar(e),[Y(e,`replace all`)])],y(`button`,{name:`close`,onclick:()=>Ir(e),"aria-label":Y(e,`close`),type:`button`},[`×`])])}commit(){let e=new fr({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){xe(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Er:Tr)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),kr(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(K)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(V).top}};function Y(e,t){return e.state.phrase(t)}var zr=30,Br=/[\s\.,:;?!]/;function Vr(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-zr),o=Math.min(i,n+zr),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<zr;e++)if(!Br.test(s[e+1])&&Br.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-zr;e--)if(!Br.test(s[e-1])&&Br.test(s[e])){s=s.slice(0,e);break}}return g.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Hr=g.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`}}),Ur=[q,re.low(wr),Hr],Wr=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},X=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet($).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),s=new o,c=[],l=0,u=r.doc.iter(),d=0,f=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!c.length)break;let n,r;if(c.length)n=l,r=c.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>f)break;r=t.to,c.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))c.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,f);let i=!1;if(c.some(e=>e.from==n&&(e.to==r||r==f))&&(i=n==r,!i&&r-n<10)){let e=n-(d+u.value.length);e>0&&(u.next(e),d=n);for(let e=n;;){if(e>=r){i=!0;break}if(!u.lineBreak&&d+u.value.length>e)break;e=d+u.value.length,d+=u.value.length,u.next()}}let o=fi(c);if(i)s.add(n,n,v.widget({widget:new ai(o),diagnostics:c.slice()}));else{let e=c.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);s.add(n,r,v.mark({class:`cm-lintRange cm-lintRange-`+o+e,diagnostics:c.slice(),inclusiveEnd:c.some(e=>e.to>r)}))}if(l=r,l==f)break;for(let e=0;e<c.length;e++)c[e].to<=l&&c.splice(e--,1)}let p=s.finish();return new e(p,n,Z(p))}};function Z(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0)){if(!r)r=new Wr(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new Wr(r.from,n,r.diagnostic)}}),r}function Gr(e,t){let n=t.pos,r=t.end||n,i=e.state.facet($).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(qr))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function Kr(e,t){return e.field(Q,!1)?t:t.concat(a.appendConfig.of(mi))}var qr=a.define(),Jr=a.define(),Yr=a.define(),Q=ee.define({create(){return new X(v.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=Z(n,e.selected.diagnostic,i)||Z(n,null,i)}!n.size&&i&&t.state.facet($).autoPanel&&(i=null),e=new X(n,i,r)}for(let n of t.effects)if(n.is(qr)){let r=t.state.facet($).autoPanel?n.value.length?si.open:null:e.panel;e=X.init(n.value,r,t.state)}else n.is(Jr)?e=new X(e.diagnostics,n.value?si.open:null,e.selected):n.is(Yr)&&(e=new X(e.diagnostics,e.panel,n.value));return e},provide:e=>[fe.from(e,e=>e.panel),g.decorations.from(e,e=>e.diagnostics)]}),Xr=v.mark({class:`cm-lintRange cm-lintRange-active`});function Zr(e,t,n){let{diagnostics:r}=e.state.field(Q),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet($).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:!0,create(){return{dom:Qr(e,i)}}}:null}function Qr(e,t){return y(`ul`,{class:`cm-tooltip-lint`},t.map(t=>ii(e,t,!1)))}var $r=e=>{let t=e.state.field(Q,!1);(!t||!t.panel)&&e.dispatch({effects:Kr(e.state,[Jr.of(!0)])});let n=Te(e,si.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},ei=e=>{let t=e.state.field(Q,!1);return!t||!t.panel?!1:(e.dispatch({effects:Jr.of(!1)}),!0)},ti=[{key:`Mod-Shift-m`,run:$r,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(Q,!1);if(!t)return!1;let n=e.state.selection.main,r=Z(t.diagnostics,null,n.to+1);return!r&&(r=Z(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),Ae(e,r.from,1,{tooltip:pi,until:e=>e.docChanged||e.newSelection.main.head<r.from||e.newSelection.main.head>r.to}),!0)}}],$=x.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...p(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:ni,tooltipFilter:ni,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function ni(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function ri(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function ii(e,t,n){let r=n?ri(t.actions):[];return y(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},y(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=Z(e.state.field(Q).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),y(`u`,s.slice(c,c+1)),s.slice(c+1)],u=n.markClass?` `+n.markClass:``;return y(`button`,{type:`button`,class:`cm-diagnosticAction`+u,onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&y(`div`,{class:`cm-diagnosticSource`},t.source))}var ai=class extends ue{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return y(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},oi=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=ii(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},si=class e{constructor(e){this.view=e,this.items=[];let t=t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)ei(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=ri(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=Z(this.view.state.field(Q).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=y(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t,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:()=>ei(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(Q).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Q),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new oi(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new oi(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!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:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Z(this.view.state.field(Q).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Yr.of(t)})}static open(t){return new e(t)}};function ci(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function li(e){return ci(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var ui=g.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:li(`#f11`)},".cm-lintRange-warning":{backgroundImage:li(`orange`)},".cm-lintRange-info":{backgroundImage:li(`#999`)},".cm-lintRange-hint":{backgroundImage:li(`#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 di(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function fi(e){let t=`hint`,n=1;for(let r of e){let e=di(r.severity);e>n&&(n=e,t=r.severity)}return t}var pi=je(Zr,{hideOn:Gr}),mi=[Q,g.decorations.compute([Q],e=>{let{selected:t,panel:n}=e.field(Q);return!t||!n||t.from==t.to?v.none:v.set([Xr.range(t.from,t.to)])}),pi,ui],hi=[de(),ce(),be(),Ze(),ne(),Oe(),ge(),r.allowMultipleSelections.of(!0),t(),c(Me,{fallback:!0}),pe(),De(),Se(),Ee(),Ce(),ke(),nr(),le.of([...he,...Wn,...Lr,...ft,...Pe,...we,...ti])],gi=[be(),Ze(),Oe(),c(Me,{fallback:!0}),le.of([...Wn,...ft])];export{g as EditorView,hi as basicSetup,gi as minimalSetup};
@@ -0,0 +1 @@
1
+ import{J as e}from"./DC5f4JBB.js";var t={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`,transform:`translateX(-100%)`};e(t);export{t};
@@ -0,0 +1 @@
1
+ import"./DjZ7hdjX.js";