@i14ks/ccv 0.9.2 → 0.9.3

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 (23) hide show
  1. package/package.json +1 -1
  2. package/web/assets/{codemirror-CdWCs9Ue.js → codemirror-DdNvncEp.js} +1 -1
  3. package/web/assets/{index-l4FJdg3Q.js → index-BU5wfH5G.js} +1 -1
  4. package/web/assets/{index-C01f6NIT.js → index-Bvixqc4P.js} +1 -1
  5. package/web/assets/{index-BhV-iv4x.js → index-C4j-sk-J.js} +1 -1
  6. package/web/assets/{index-BOXDlhc1.js → index-C74Zhb9A.js} +1 -1
  7. package/web/assets/{index-DJ-p5uJH.js → index-C84jccdH.js} +1 -1
  8. package/web/assets/{index-DW6gdH0X.js → index-CTYbNkLU.js} +1 -1
  9. package/web/assets/{index-Mx2AyOuR.js → index-Ct1LA_Vh.js} +1 -1
  10. package/web/assets/{index-GdeMvy4I.js → index-CtfM5qbp.js} +1 -1
  11. package/web/assets/{index-DA01pdfH.js → index-Cw7URDCS.js} +1 -1
  12. package/web/assets/{index-Rn6Txsdk.js → index-CwfX2kTa.js} +1 -1
  13. package/web/assets/{index-C2jQFp5o.js → index-DFouuosD.js} +1 -1
  14. package/web/assets/{index-BmyAsnOo.js → index-DGDmnUZ_.js} +1 -1
  15. package/web/assets/{index-CRvrjpBk.js → index-DOhE4tPr.js} +1 -1
  16. package/web/assets/{index-K7wDRup7.js → index-DQkO9gH8.js} +1 -1
  17. package/web/assets/{index-D9VXVn86.js → index-Dn0JIAqb.js} +42 -42
  18. package/web/assets/{index-BAVMdhFr.js → index-DqKuslkp.js} +1 -1
  19. package/web/assets/{index-CZiXrzZK.js → index-Dwg8L8u6.js} +1 -1
  20. package/web/assets/{index-Bzwb3qfk.js → index-LE0hac58.js} +1 -1
  21. package/web/assets/{index-Cdz7Ltwf.js → index-n8Ws2pFS.js} +1 -1
  22. package/web/assets/{index-DhZRiwtM.js → index-rW0KajT2.js} +1 -1
  23. package/web/index.html +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i14ks/ccv",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "license": "UNLICENSED",
5
5
  "description": "GUI для Claude Code: сессии агента в каталогах проектов, дерево файлов и редактор рядом с разговором.",
6
6
  "homepage": "https://claudevisual.com",
@@ -1 +1 @@
1
- import{s as r,H as a}from"./index-DhZRiwtM.js";import{E as e}from"./index-891wE-Rj.js";import{t as o}from"./index-D9VXVn86.js";import"./index-BHot-lnj.js";const m=e.theme({"&":{height:"100%",color:"var(--text)",backgroundColor:"var(--bg)",fontSize:"13px"},".cm-scroller":{fontFamily:"var(--mono)",lineHeight:"1.6"},".cm-content":{caretColor:"var(--accent)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--accent)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--cm-selection)"},".cm-gutters":{backgroundColor:"var(--bg)",color:"var(--muted)",borderRight:"1px solid var(--border-soft)"},".cm-activeLineGutter":{backgroundColor:"var(--surface-2)",color:"var(--text-2)"},".cm-activeLine":{backgroundColor:"var(--cm-active)"},".cm-selectionMatch":{backgroundColor:"var(--cm-match)"},"&.cm-focused .cm-matchingBracket":{backgroundColor:"var(--cm-match)",outline:"1px solid var(--accent-line)"},".cm-foldPlaceholder":{backgroundColor:"var(--surface-2)",border:"1px solid var(--border)",color:"var(--muted)"},".cm-panels":{backgroundColor:"var(--surface)",color:"var(--text)",border:"1px solid var(--border)"},".cm-panels input, .cm-panels button, .cm-panels select":{fontFamily:"var(--sans)",fontSize:"12px",background:"var(--surface-2)",color:"var(--text)",border:"1px solid var(--border)",borderRadius:"6px",padding:"3px 6px"},".cm-searchMatch":{backgroundColor:"var(--cm-match)"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"var(--accent-soft)"},".cm-tooltip":{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:"8px",boxShadow:"var(--shadow-md)",color:"var(--text)"},".cm-tooltip-autocomplete ul li[aria-selected]":{background:"var(--surface-2)",color:"var(--text)"}}),i=r(a.define([{tag:[o.keyword,o.modifier,o.controlKeyword,o.moduleKeyword],color:"var(--cm-key)"},{tag:[o.name,o.deleted,o.character,o.macroName],color:"var(--text)"},{tag:[o.propertyName],color:"var(--cm-prop)"},{tag:[o.function(o.variableName),o.labelName],color:"var(--cm-fn)"},{tag:[o.color,o.constant(o.name),o.standard(o.name),o.bool],color:"var(--cm-const)"},{tag:[o.definition(o.name),o.separator],color:"var(--text)"},{tag:[o.typeName,o.className,o.changed,o.annotation,o.self,o.namespace],color:"var(--cm-type)"},{tag:[o.number,o.integer,o.float],color:"var(--cm-num)"},{tag:[o.string,o.special(o.string),o.regexp],color:"var(--cm-str)"},{tag:[o.operator,o.operatorKeyword,o.escape],color:"var(--cm-op)"},{tag:[o.meta,o.comment],color:"var(--cm-comment)",fontStyle:"italic"},{tag:o.strong,fontWeight:"650"},{tag:o.emphasis,fontStyle:"italic"},{tag:o.strikethrough,textDecoration:"line-through"},{tag:o.link,color:"var(--cm-str)",textDecoration:"underline"},{tag:o.heading,fontWeight:"650",color:"var(--cm-key)"},{tag:o.invalid,color:"var(--danger)"}]));export{i as editorHighlight,m as editorTheme};
1
+ import{s as r,H as a}from"./index-rW0KajT2.js";import{E as e}from"./index-891wE-Rj.js";import{t as o}from"./index-Dn0JIAqb.js";import"./index-BHot-lnj.js";const m=e.theme({"&":{height:"100%",color:"var(--text)",backgroundColor:"var(--bg)",fontSize:"13px"},".cm-scroller":{fontFamily:"var(--mono)",lineHeight:"1.6"},".cm-content":{caretColor:"var(--accent)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--accent)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--cm-selection)"},".cm-gutters":{backgroundColor:"var(--bg)",color:"var(--muted)",borderRight:"1px solid var(--border-soft)"},".cm-activeLineGutter":{backgroundColor:"var(--surface-2)",color:"var(--text-2)"},".cm-activeLine":{backgroundColor:"var(--cm-active)"},".cm-selectionMatch":{backgroundColor:"var(--cm-match)"},"&.cm-focused .cm-matchingBracket":{backgroundColor:"var(--cm-match)",outline:"1px solid var(--accent-line)"},".cm-foldPlaceholder":{backgroundColor:"var(--surface-2)",border:"1px solid var(--border)",color:"var(--muted)"},".cm-panels":{backgroundColor:"var(--surface)",color:"var(--text)",border:"1px solid var(--border)"},".cm-panels input, .cm-panels button, .cm-panels select":{fontFamily:"var(--sans)",fontSize:"12px",background:"var(--surface-2)",color:"var(--text)",border:"1px solid var(--border)",borderRadius:"6px",padding:"3px 6px"},".cm-searchMatch":{backgroundColor:"var(--cm-match)"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"var(--accent-soft)"},".cm-tooltip":{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:"8px",boxShadow:"var(--shadow-md)",color:"var(--text)"},".cm-tooltip-autocomplete ul li[aria-selected]":{background:"var(--surface-2)",color:"var(--text)"}}),i=r(a.define([{tag:[o.keyword,o.modifier,o.controlKeyword,o.moduleKeyword],color:"var(--cm-key)"},{tag:[o.name,o.deleted,o.character,o.macroName],color:"var(--text)"},{tag:[o.propertyName],color:"var(--cm-prop)"},{tag:[o.function(o.variableName),o.labelName],color:"var(--cm-fn)"},{tag:[o.color,o.constant(o.name),o.standard(o.name),o.bool],color:"var(--cm-const)"},{tag:[o.definition(o.name),o.separator],color:"var(--text)"},{tag:[o.typeName,o.className,o.changed,o.annotation,o.self,o.namespace],color:"var(--cm-type)"},{tag:[o.number,o.integer,o.float],color:"var(--cm-num)"},{tag:[o.string,o.special(o.string),o.regexp],color:"var(--cm-str)"},{tag:[o.operator,o.operatorKeyword,o.escape],color:"var(--cm-op)"},{tag:[o.meta,o.comment],color:"var(--cm-comment)",fontStyle:"italic"},{tag:o.strong,fontWeight:"650"},{tag:o.emphasis,fontStyle:"italic"},{tag:o.strikethrough,textDecoration:"line-through"},{tag:o.link,color:"var(--cm-str)",textDecoration:"underline"},{tag:o.heading,fontWeight:"650",color:"var(--cm-key)"},{tag:o.invalid,color:"var(--danger)"}]));export{i as editorHighlight,m as editorTheme};
@@ -1,2 +1,2 @@
1
- import{g as Z,s as _e,E as M,V as me,D as x,a as ge,c as m,r as ze,b as Ne,h as Qe,W as Ve,l as Ge,d as je,e as pe,f as xe,i as Ue,j as Ye,k as Ze,m as Je,n as be}from"./index-891wE-Rj.js";import{StateEffect as W,EditorSelection as C,StateField as ye,Prec as Xe,codePointAt as et,fromCodePoint as tt,codePointSize as it,Facet as J,combineConfig as X,CharCategory as v,EditorState as ke,RangeSetBuilder as Se,findClusterBreak as ve}from"./index-BHot-lnj.js";import{f as nt,i as st,s as Ce,b as rt,a as lt,d as Me}from"./index-DhZRiwtM.js";import{history as we,defaultKeymap as Le,historyKeymap as Re}from"./index-DA01pdfH.js";import{c as ot,a as at,b as ct,d as ht}from"./index-Cdz7Ltwf.js";import"./index-D9VXVn86.js";const oe=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class I{constructor(e,t,n=0,s=e.length,r,l){this.test=l,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,s),this.bufferStart=n,this.normalize=r?o=>r(oe(o)):oe,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 et(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=tt(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=it(e);let s=this.normalize(t);if(s.length)for(let r=0,l=n,o=!0;;r++){let a=s.charCodeAt(r),c=this.match(a,l,o,this.bufferPos+this.bufferStart,r==s.length-1);if(c)return this.value=c,this;if(r==s.length-1)break;o&&r<t.length&&t.charCodeAt(r)==a?l++:o=!1}}}match(e,t,n,s,r){let l=null;for(let o=0;o<this.matches.length;){let a=this.matches[o],c=!1;this.query.charCodeAt(a.index)==e&&(a.index==this.query.length-1?l={from:a.from,to:s,precise:r&&a.precise}:(a.index++,c=!0)),c?o++:this.matches.splice(o,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?l={from:t,to:s,precise:n&&r}:this.matches.push({from:t,index:1,precise:n})),l&&this.test&&!this.test(l.from,l.to,this.buffer,this.bufferStart)&&(l=null),l}}typeof Symbol<"u"&&(I.prototype[Symbol.iterator]=function(){return this});const Ae={from:-1,to:-1,match:/.*/.exec(""),precise:!0},ee="gm"+(/x/.unicode==null?"":"u");class We{constructor(e,t,n,s=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=Ae,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new De(e,t,n,s,r);this.re=new RegExp(t,ee+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.iter=e.iter();let l=e.lineAt(s);this.curLineStart=l.from,this.matchPos=z(e,s),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,s=n+t[0].length;if(this.matchPos=z(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,t)))return this.value={from:n,to:s,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}}}const j=new WeakMap;class P{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let s=j.get(e);if(!s||s.from>=n||s.to<=t){let o=new P(t,e.sliceString(t,n));return j.set(e,o),o}if(s.from==t&&s.to==n)return s;let{text:r,from:l}=s;return l>t&&(r=e.sliceString(t,l)+r,l=t),s.to<n&&(r+=e.sliceString(s.to,n)),j.set(e,new P(l,r)),new P(t,r.slice(t-l,n-l))}}class De{constructor(e,t,n,s,r){this.text=e,this.to=r,this.done=!1,this.value=Ae,this.matchPos=z(e,s),this.re=new RegExp(t,ee+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=P.get(e,s,this.chunkEnd(s+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 n=this.flat.from+t.index,s=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,t)))return this.value={from:n,to:s,precise:!0,match:t},this.matchPos=z(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=P.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(We.prototype[Symbol.iterator]=De.prototype[Symbol.iterator]=function(){return this});function ft(i){try{return new RegExp(i,ee),!0}catch{return!1}}function z(i,e){if(e>=i.length)return e;let t=i.lineAt(e),n;for(;e<t.to&&(n=t.text.charCodeAt(e-t.from))>=56320&&n<57344;)e++;return e}const ut=i=>{let{state:e}=i,t=String(e.doc.lineAt(i.state.selection.main.head).number),{close:n,result:s}=_e(i,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return s.then(r=>{let l=r&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);if(!l){i.dispatch({effects:n});return}let o=e.doc.lineAt(e.selection.main.head),[,a,c,h,f]=l,p=h?+h.slice(1):0,u=c?+c:o.number;if(c&&f){let g=u/100;a&&(g=g*(a=="-"?-1:1)+o.number/e.doc.lines),u=Math.round(e.doc.lines*g)}else c&&a&&(u=u*(a=="-"?-1:1)+o.number);let y=e.doc.line(Math.max(1,Math.min(e.doc.lines,u))),b=C.cursor(y.from+Math.max(0,Math.min(p,y.length)));i.dispatch({effects:[n,M.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},dt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},mt=J.define({combine(i){return X(i,dt,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function gt(i){return[kt,yt]}const pt=x.mark({class:"cm-selectionMatch"}),xt=x.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ae(i,e,t,n){return(t==0||i(e.sliceDoc(t-1,t))!=v.Word)&&(n==e.doc.length||i(e.sliceDoc(n,n+1))!=v.Word)}function bt(i,e,t,n){return i(e.sliceDoc(t,t+1))==v.Word&&i(e.sliceDoc(n-1,n))==v.Word}const yt=me.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=i.state.facet(mt),{state:t}=i,n=t.selection;if(n.ranges.length>1)return x.none;let s=n.main,r,l=null;if(s.empty){if(!e.highlightWordAroundCursor)return x.none;let a=t.wordAt(s.head);if(!a)return x.none;l=t.charCategorizer(s.head),r=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a<e.minSelectionLength||a>200)return x.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),l=t.charCategorizer(s.head),!(ae(l,t,s.from,s.to)&&bt(l,t,s.from,s.to)))return x.none}else if(r=t.sliceDoc(s.from,s.to),!r)return x.none}let o=[];for(let a of i.visibleRanges){let c=new I(t.doc,r,a.from,a.to);for(;!c.next().done;){let{from:h,to:f}=c.value;if((!l||ae(l,t,h,f))&&(s.empty&&h<=s.from&&f>=s.to?o.push(xt.range(h,f)):(h>=s.to||f<=s.from)&&o.push(pt.range(h,f)),o.length>e.maxMatches))return x.none}}return x.set(o)}},{decorations:i=>i.decorations}),kt=M.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),St=({state:i,dispatch:e})=>{let{selection:t}=i,n=C.create(t.ranges.map(s=>i.wordAt(s.head)||C.cursor(s.head)),t.mainIndex);return n.eq(t)?!1:(e(i.update({selection:n})),!0)};function vt(i,e){let{main:t,ranges:n}=i.selection,s=i.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let l=!1,o=new I(i.doc,e,n[n.length-1].to);;)if(o.next(),o.done){if(l)return null;o=new I(i.doc,e,0,Math.max(0,n[n.length-1].from-1)),l=!0}else{if(l&&n.some(a=>a.from==o.value.from))continue;if(r){let a=i.wordAt(o.value.from);if(!a||a.from!=o.value.from||a.to!=o.value.to)continue}return o.value}}const Ct=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(r=>r.from===r.to))return St({state:i,dispatch:e});let n=i.sliceDoc(t[0].from,t[0].to);if(i.selection.ranges.some(r=>i.sliceDoc(r.from,r.to)!=n))return!1;let s=vt(i,n);return s?(e(i.update({selection:i.selection.addRange(C.range(s.from,s.to),!1),effects:M.scrollIntoView(s.to)})),!0):!1},E=J.define({combine(i){return X(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ot(e),scrollToMatch:e=>M.scrollIntoView(e)})}});class Fe{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||ft(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,(t,n)=>n=="n"?`
1
+ import{g as Z,s as _e,E as M,V as me,D as x,a as ge,c as m,r as ze,b as Ne,h as Qe,W as Ve,l as Ge,d as je,e as pe,f as xe,i as Ue,j as Ye,k as Ze,m as Je,n as be}from"./index-891wE-Rj.js";import{StateEffect as W,EditorSelection as C,StateField as ye,Prec as Xe,codePointAt as et,fromCodePoint as tt,codePointSize as it,Facet as J,combineConfig as X,CharCategory as v,EditorState as ke,RangeSetBuilder as Se,findClusterBreak as ve}from"./index-BHot-lnj.js";import{f as nt,i as st,s as Ce,b as rt,a as lt,d as Me}from"./index-rW0KajT2.js";import{history as we,defaultKeymap as Le,historyKeymap as Re}from"./index-Cw7URDCS.js";import{c as ot,a as at,b as ct,d as ht}from"./index-n8Ws2pFS.js";import"./index-Dn0JIAqb.js";const oe=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class I{constructor(e,t,n=0,s=e.length,r,l){this.test=l,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,s),this.bufferStart=n,this.normalize=r?o=>r(oe(o)):oe,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 et(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=tt(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=it(e);let s=this.normalize(t);if(s.length)for(let r=0,l=n,o=!0;;r++){let a=s.charCodeAt(r),c=this.match(a,l,o,this.bufferPos+this.bufferStart,r==s.length-1);if(c)return this.value=c,this;if(r==s.length-1)break;o&&r<t.length&&t.charCodeAt(r)==a?l++:o=!1}}}match(e,t,n,s,r){let l=null;for(let o=0;o<this.matches.length;){let a=this.matches[o],c=!1;this.query.charCodeAt(a.index)==e&&(a.index==this.query.length-1?l={from:a.from,to:s,precise:r&&a.precise}:(a.index++,c=!0)),c?o++:this.matches.splice(o,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?l={from:t,to:s,precise:n&&r}:this.matches.push({from:t,index:1,precise:n})),l&&this.test&&!this.test(l.from,l.to,this.buffer,this.bufferStart)&&(l=null),l}}typeof Symbol<"u"&&(I.prototype[Symbol.iterator]=function(){return this});const Ae={from:-1,to:-1,match:/.*/.exec(""),precise:!0},ee="gm"+(/x/.unicode==null?"":"u");class We{constructor(e,t,n,s=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=Ae,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new De(e,t,n,s,r);this.re=new RegExp(t,ee+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.iter=e.iter();let l=e.lineAt(s);this.curLineStart=l.from,this.matchPos=z(e,s),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,s=n+t[0].length;if(this.matchPos=z(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,t)))return this.value={from:n,to:s,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}}}const j=new WeakMap;class P{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let s=j.get(e);if(!s||s.from>=n||s.to<=t){let o=new P(t,e.sliceString(t,n));return j.set(e,o),o}if(s.from==t&&s.to==n)return s;let{text:r,from:l}=s;return l>t&&(r=e.sliceString(t,l)+r,l=t),s.to<n&&(r+=e.sliceString(s.to,n)),j.set(e,new P(l,r)),new P(t,r.slice(t-l,n-l))}}class De{constructor(e,t,n,s,r){this.text=e,this.to=r,this.done=!1,this.value=Ae,this.matchPos=z(e,s),this.re=new RegExp(t,ee+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=P.get(e,s,this.chunkEnd(s+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 n=this.flat.from+t.index,s=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,t)))return this.value={from:n,to:s,precise:!0,match:t},this.matchPos=z(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=P.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(We.prototype[Symbol.iterator]=De.prototype[Symbol.iterator]=function(){return this});function ft(i){try{return new RegExp(i,ee),!0}catch{return!1}}function z(i,e){if(e>=i.length)return e;let t=i.lineAt(e),n;for(;e<t.to&&(n=t.text.charCodeAt(e-t.from))>=56320&&n<57344;)e++;return e}const ut=i=>{let{state:e}=i,t=String(e.doc.lineAt(i.state.selection.main.head).number),{close:n,result:s}=_e(i,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return s.then(r=>{let l=r&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);if(!l){i.dispatch({effects:n});return}let o=e.doc.lineAt(e.selection.main.head),[,a,c,h,f]=l,p=h?+h.slice(1):0,u=c?+c:o.number;if(c&&f){let g=u/100;a&&(g=g*(a=="-"?-1:1)+o.number/e.doc.lines),u=Math.round(e.doc.lines*g)}else c&&a&&(u=u*(a=="-"?-1:1)+o.number);let y=e.doc.line(Math.max(1,Math.min(e.doc.lines,u))),b=C.cursor(y.from+Math.max(0,Math.min(p,y.length)));i.dispatch({effects:[n,M.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},dt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},mt=J.define({combine(i){return X(i,dt,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function gt(i){return[kt,yt]}const pt=x.mark({class:"cm-selectionMatch"}),xt=x.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ae(i,e,t,n){return(t==0||i(e.sliceDoc(t-1,t))!=v.Word)&&(n==e.doc.length||i(e.sliceDoc(n,n+1))!=v.Word)}function bt(i,e,t,n){return i(e.sliceDoc(t,t+1))==v.Word&&i(e.sliceDoc(n-1,n))==v.Word}const yt=me.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=i.state.facet(mt),{state:t}=i,n=t.selection;if(n.ranges.length>1)return x.none;let s=n.main,r,l=null;if(s.empty){if(!e.highlightWordAroundCursor)return x.none;let a=t.wordAt(s.head);if(!a)return x.none;l=t.charCategorizer(s.head),r=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a<e.minSelectionLength||a>200)return x.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),l=t.charCategorizer(s.head),!(ae(l,t,s.from,s.to)&&bt(l,t,s.from,s.to)))return x.none}else if(r=t.sliceDoc(s.from,s.to),!r)return x.none}let o=[];for(let a of i.visibleRanges){let c=new I(t.doc,r,a.from,a.to);for(;!c.next().done;){let{from:h,to:f}=c.value;if((!l||ae(l,t,h,f))&&(s.empty&&h<=s.from&&f>=s.to?o.push(xt.range(h,f)):(h>=s.to||f<=s.from)&&o.push(pt.range(h,f)),o.length>e.maxMatches))return x.none}}return x.set(o)}},{decorations:i=>i.decorations}),kt=M.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),St=({state:i,dispatch:e})=>{let{selection:t}=i,n=C.create(t.ranges.map(s=>i.wordAt(s.head)||C.cursor(s.head)),t.mainIndex);return n.eq(t)?!1:(e(i.update({selection:n})),!0)};function vt(i,e){let{main:t,ranges:n}=i.selection,s=i.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let l=!1,o=new I(i.doc,e,n[n.length-1].to);;)if(o.next(),o.done){if(l)return null;o=new I(i.doc,e,0,Math.max(0,n[n.length-1].from-1)),l=!0}else{if(l&&n.some(a=>a.from==o.value.from))continue;if(r){let a=i.wordAt(o.value.from);if(!a||a.from!=o.value.from||a.to!=o.value.to)continue}return o.value}}const Ct=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(r=>r.from===r.to))return St({state:i,dispatch:e});let n=i.sliceDoc(t[0].from,t[0].to);if(i.selection.ranges.some(r=>i.sliceDoc(r.from,r.to)!=n))return!1;let s=vt(i,n);return s?(e(i.update({selection:i.selection.addRange(C.range(s.from,s.to),!1),effects:M.scrollIntoView(s.to)})),!0):!1},E=J.define({combine(i){return X(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ot(e),scrollToMatch:e=>M.scrollIntoView(e)})}});class Fe{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||ft(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,(t,n)=>n=="n"?`
2
2
  `:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Wt(this):new Lt(this)}getCursor(e,t=0,n){let s=e.doc?e:ke.create({doc:e});return n==null&&(n=s.doc.length),this.regexp?F(this,s,t,n):D(this,s,t,n)}}class Pe{constructor(e){this.spec=e}}function Mt(i,e,t){return(n,s,r,l)=>{if(t&&!t(n,s,r,l))return!1;let o=n>=l&&s<=l+r.length?r.slice(n-l,s-l):e.doc.sliceString(n,s);return i(o,e,n,s)}}function D(i,e,t,n){let s;return i.wholeWord&&(s=wt(e.doc,e.charCategorizer(e.selection.main.head))),i.test&&(s=Mt(i.test,e,s)),new I(e.doc,i.unquoted,t,n,i.caseSensitive?void 0:r=>r.toLowerCase(),s)}function wt(i,e){return(t,n,s,r)=>((r>t||r+s.length<n)&&(r=Math.max(0,t-2),s=i.sliceString(r,Math.min(i.length,n+2))),(e(N(s,t-r))!=v.Word||e(Q(s,t-r))!=v.Word)&&(e(Q(s,n-r))!=v.Word||e(N(s,n-r))!=v.Word))}class Lt extends Pe{constructor(e){super(e)}nextMatch(e,t,n){let s=D(this.spec,e,n,e.doc.length).nextOverlapping();if(s.done){let r=Math.min(e.doc.length,t+this.spec.unquoted.length);s=D(this.spec,e,0,r).nextOverlapping()}return s.done||s.value.from==t&&s.value.to==n?null:s.value}prevMatchInRange(e,t,n){for(let s=n;;){let r=Math.max(t,s-1e4-this.spec.unquoted.length),l=D(this.spec,e,r,s),o=null;for(;!l.nextOverlapping().done;)o=l.value;if(o)return o;if(r==t)return null;s-=1e4}}prevMatch(e,t,n){let s=this.prevMatchInRange(e,0,t);return s||(s=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=t||s.to!=n)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=D(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=t)return null;s.push(n.value)}return s}highlight(e,t,n,s){let r=D(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Rt(i,e,t){return(n,s,r)=>(!t||t(n,s,r))&&i(r[0],e,n,s)}function F(i,e,t,n){let s;return i.wholeWord&&(s=At(e.charCategorizer(e.selection.main.head))),i.test&&(s=Rt(i.test,e,s)),new We(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:s},t,n)}function N(i,e){return i.slice(ve(i,e,!1),e)}function Q(i,e){return i.slice(e,ve(i,e))}function At(i){return(e,t,n)=>!n[0].length||(i(N(n.input,n.index))!=v.Word||i(Q(n.input,n.index))!=v.Word)&&(i(Q(n.input,n.index+n[0].length))!=v.Word||i(N(n.input,n.index+n[0].length))!=v.Word)}class Wt extends Pe{nextMatch(e,t,n){let s=F(this.spec,e,n,e.doc.length).next();return s.done&&(s=F(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,n){for(let s=1;;s++){let r=Math.max(t,n-s*1e4),l=F(this.spec,e,r,n),o=null;for(;!l.next().done;)o=l.value;if(o&&(r==t||o.from>r+10))return o;if(r==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 s=n.length;s>0;s--){let r=+n.slice(0,s);if(r>0&&r<e.match.length)return e.match[r]+n.slice(s)}return t})}matchAll(e,t){let n=F(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=t)return null;s.push(n.value)}return s}highlight(e,t,n,s){let r=F(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const q=W.define(),te=W.define(),L=ye.define({create(i){return new U(Y(i).create(),null)},update(i,e){for(let t of e.effects)t.is(q)?i=new U(t.value.create(),i.panel):t.is(te)&&(i=new U(i.query,t.value?ie:null));return i},provide:i=>ge.from(i,e=>e.panel)});class U{constructor(e,t){this.query=e,this.panel=t}}const Dt=x.mark({class:"cm-searchMatch"}),Ft=x.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Pt=me.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(L))}update(i){let e=i.state.field(L);(e!=i.startState.field(L)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return x.none;let{view:t}=this,n=new Se;for(let s=0,r=t.visibleRanges,l=r.length;s<l;s++){let{from:o,to:a}=r[s];for(;s<l-1&&a>r[s+1].from-500;)a=r[++s].to;i.highlight(t.state,o,a,(c,h)=>{let f=t.state.selection.ranges.some(p=>p.from==c&&p.to==h);n.add(c,h,f?Ft:Dt)})}return n.finish()}},{decorations:i=>i.decorations});function $(i){return e=>{let t=e.state.field(L,!1);return t&&t.query.spec.valid?i(e,t):qe(e)}}const V=$((i,{query:e})=>{let{to:t}=i.state.selection.main,n=e.nextMatch(i.state,t,t);if(!n)return!1;let s=C.single(n.from,n.to),r=i.state.facet(E);return i.dispatch({selection:s,effects:[ne(i,n),r.scrollToMatch(s.main,i)],userEvent:"select.search"}),Ee(i),!0}),G=$((i,{query:e})=>{let{state:t}=i,{from:n}=t.selection.main,s=e.prevMatch(t,n,n);if(!s)return!1;let r=C.single(s.from,s.to),l=i.state.facet(E);return i.dispatch({selection:r,effects:[ne(i,s),l.scrollToMatch(r.main,i)],userEvent:"select.search"}),Ee(i),!0}),It=$((i,{query:e})=>{let t=e.matchAll(i.state,1e3);return!t||!t.length?!1:(i.dispatch({selection:C.create(t.map(n=>C.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),Et=({state:i,dispatch:e})=>{let t=i.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:s}=t.main,r=[],l=0;for(let o=new I(i.doc,i.sliceDoc(n,s));!o.next().done;){if(r.length>1e3)return!1;o.value.from==n&&(l=r.length),r.push(C.range(o.value.from,o.value.to))}return e(i.update({selection:C.create(r,l),userEvent:"select.search.matches"})),!0},ce=$((i,{query:e})=>{let{state:t}=i,{from:n,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,n,n);if(!r)return!1;let l=r,o=[],a,c,h=[];l.precise?l.from==n&&l.to==s&&(c=t.toText(e.getReplacement(l)),o.push({from:l.from,to:l.to,insert:c}),l=e.nextMatch(t,l.from,l.to),h.push(M.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(n).number)+"."))):l=e.nextMatch(t,l.from,l.to);let f=i.state.changes(o);return l&&(a=C.single(l.from,l.to).map(f),h.push(ne(i,l)),h.push(t.facet(E).scrollToMatch(a.main,i))),i.dispatch({changes:f,selection:a,effects:h,userEvent:"input.replace"}),!0}),qt=$((i,{query:e})=>{if(i.state.readOnly)return!1;let t=[];for(let s of e.matchAll(i.state,1e9)){let{from:r,to:l,precise:o}=s;o&&t.push({from:r,to:l,insert:e.getReplacement(s)})}if(!t.length)return!1;let n=i.state.phrase("replaced $ matches",t.length)+".";return i.dispatch({changes:t,effects:M.announce.of(n),userEvent:"input.replace.all"}),!0});function ie(i){return i.state.facet(E).createPanel(i)}function Y(i,e){var t,n,s,r,l;let o=i.selection.main,a=o.empty||o.to>o.from+100?"":i.sliceDoc(o.from,o.to);if(e&&!a)return e;let c=i.facet(E);return new Fe({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(n=e==null?void 0:e.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:c.literal,regexp:(r=e==null?void 0:e.regexp)!==null&&r!==void 0?r:c.regexp,wholeWord:(l=e==null?void 0:e.wholeWord)!==null&&l!==void 0?l:c.wholeWord})}function Ie(i){let e=Z(i,ie);return e&&e.dom.querySelector("[main-field]")}function Ee(i){let e=Ie(i);e&&e==i.root.activeElement&&e.select()}const qe=i=>{let e=i.state.field(L,!1);if(e&&e.panel){let t=Ie(i);if(t&&t!=i.root.activeElement){let n=Y(i.state,e.query.spec);n.valid&&i.dispatch({effects:q.of(n)}),t.focus(),t.select()}}else i.dispatch({effects:[te.of(!0),e?q.of(Y(i.state,e.query.spec)):W.appendConfig.of(Bt)]});return!0},Te=i=>{let e=i.state.field(L,!1);if(!e||!e.panel)return!1;let t=Z(i,ie);return t&&t.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:te.of(!1)}),!0},Tt=[{key:"Mod-f",run:qe,scope:"editor search-panel"},{key:"F3",run:V,shift:G,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:V,shift:G,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Te,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Et},{key:"Mod-Alt-g",run:ut},{key:"Mod-d",run:Ct,preventDefault:!0}];class Ot{constructor(e){this.view=e;let t=this.query=e.state.field(L).query.spec;this.commit=this.commit.bind(this),this.searchField=m("input",{value:t.search,placeholder:k(e,"Find"),"aria-label":k(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=m("input",{value:t.replace,placeholder:k(e,"Replace"),"aria-label":k(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=m("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=m("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=m("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(s,r,l){return m("button",{class:"cm-button",name:s,onclick:r,type:"button"},l)}this.dom=m("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,n("next",()=>V(e),[k(e,"next")]),n("prev",()=>G(e),[k(e,"previous")]),n("select",()=>It(e),[k(e,"all")]),m("label",null,[this.caseField,k(e,"match case")]),m("label",null,[this.reField,k(e,"regexp")]),m("label",null,[this.wordField,k(e,"by word")]),...e.state.readOnly?[]:[m("br"),this.replaceField,n("replace",()=>ce(e),[k(e,"replace")]),n("replaceAll",()=>qt(e),[k(e,"replace all")])],m("button",{name:"close",onclick:()=>Te(e),"aria-label":k(e,"close"),type:"button"},["×"])])}commit(){let e=new Fe({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:q.of(e)}))}keydown(e){ze(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?G:V)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),ce(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(q)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(E).top}}function k(i,e){return i.state.phrase(e)}const K=30,H=/[\s\.,:;?!]/;function ne(i,{from:e,to:t}){let n=i.state.doc.lineAt(e),s=i.state.doc.lineAt(t).to,r=Math.max(n.from,e-K),l=Math.min(s,t+K),o=i.state.sliceDoc(r,l);if(r!=n.from){for(let a=0;a<K;a++)if(!H.test(o[a+1])&&H.test(o[a])){o=o.slice(a);break}}if(l!=s){for(let a=o.length-1;a>o.length-K;a--)if(!H.test(o[a-1])&&H.test(o[a])){o=o.slice(0,a);break}}return M.announce.of(`${i.state.phrase("current match")}. ${o} ${i.state.phrase("on line")} ${n.number}.`)}const $t=M.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"}}),Bt=[L,Xe.low(Pt),$t];class he{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class A{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let s=n.facet(T).markerFilter;s&&(e=s(e,n));let r=e.slice().sort((u,y)=>u.from-y.from||u.to-y.to),l=new Se,o=[],a=0,c=n.doc.iter(),h=0,f=n.doc.length;for(let u=0;;){let y=u==r.length?null:r[u];if(!y&&!o.length)break;let b,g;if(o.length)b=a,g=o.reduce((d,w)=>Math.min(d,w.to),y&&y.from>b?y.from:1e8);else{if(b=y.from,b>f)break;g=y.to,o.push(y),u++}for(;u<r.length;){let d=r[u];if(d.from==b&&(d.to>d.from||d.to==b))o.push(d),u++,g=Math.min(d.to,g);else{g=Math.min(d.from,g);break}}g=Math.min(g,f);let B=!1;if(o.some(d=>d.from==b&&(d.to==g||g==f))&&(B=b==g,!B&&g-b<10)){let d=b-(h+c.value.length);d>0&&(c.next(d),h=b);for(let w=b;;){if(w>=g){B=!0;break}if(!c.lineBreak&&h+c.value.length>w)break;w=h+c.value.length,h+=c.value.length,c.next()}}let re=Jt(o);if(B)l.add(b,b,x.widget({widget:new jt(re),diagnostics:o.slice()}));else{let d=o.reduce((w,le)=>le.markClass?w+" "+le.markClass:w,"");l.add(b,g,x.mark({class:"cm-lintRange cm-lintRange-"+re+d,diagnostics:o.slice(),inclusiveEnd:o.some(w=>w.to>g)}))}if(a=g,a==f)break;for(let d=0;d<o.length;d++)o[d].to<=a&&o.splice(d--,1)}let p=l.finish();return new A(p,t,R(p))}}function R(i,e=null,t=0){let n=null;return i.between(t,1e9,(s,r,{spec:l})=>{if(!(e&&l.diagnostics.indexOf(e)<0))if(!n)n=new he(s,r,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new he(n.from,r,n.diagnostic)}}),n}function Kt(i,e){let t=e.pos,n=e.end||t,s=i.state.facet(T).hideOn(i,t,n);if(s!=null)return s;let r=i.startState.doc.lineAt(e.pos);return!!(i.effects.some(l=>l.is(Oe))||i.changes.touchesRange(r.from,Math.max(r.to,n)))}function Ht(i,e){return i.field(S,!1)?e:e.concat(W.appendConfig.of(Xt))}const Oe=W.define(),se=W.define(),$e=W.define(),S=ye.define({create(){return new A(x.none,null,null)},update(i,e){if(e.docChanged&&i.diagnostics.size){let t=i.diagnostics.map(e.changes),n=null,s=i.panel;if(i.selected){let r=e.changes.mapPos(i.selected.from,1);n=R(t,i.selected.diagnostic,r)||R(t,null,r)}!t.size&&s&&e.state.facet(T).autoPanel&&(s=null),i=new A(t,s,n)}for(let t of e.effects)if(t.is(Oe)){let n=e.state.facet(T).autoPanel?t.value.length?O.open:null:i.panel;i=A.init(t.value,n,e.state)}else t.is(se)?i=new A(i.diagnostics,t.value?O.open:null,i.selected):t.is($e)&&(i=new A(i.diagnostics,i.panel,t.value));return i},provide:i=>[ge.from(i,e=>e.panel),M.decorations.from(i,e=>e.diagnostics)]}),_t=x.mark({class:"cm-lintRange cm-lintRange-active"});function zt(i,e,t){let{diagnostics:n}=i.state.field(S),s,r=-1,l=-1;n.between(e-(t<0?1:0),e+(t>0?1:0),(a,c,{spec:h})=>{if(e>=a&&e<=c&&(a==c||(e>a||t>0)&&(e<c||t<0)))return s=h.diagnostics,r=a,l=c,!1});let o=i.state.facet(T).tooltipFilter;return s&&o&&(s=o(s,i.state)),s?{pos:r,end:l,above:!0,create(){return{dom:Nt(i,s)}}}:null}function Nt(i,e){return m("ul",{class:"cm-tooltip-lint"},e.map(t=>Ke(i,t,!1)))}const Qt=i=>{let e=i.state.field(S,!1);(!e||!e.panel)&&i.dispatch({effects:Ht(i.state,[se.of(!0)])});let t=Z(i,O.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},fe=i=>{let e=i.state.field(S,!1);return!e||!e.panel?!1:(i.dispatch({effects:se.of(!1)}),!0)},Vt=i=>{let e=i.state.field(S,!1);if(!e)return!1;let t=i.state.selection.main,n=R(e.diagnostics,null,t.to+1);return!n&&(n=R(e.diagnostics,null,0),!n||n.from==t.from&&n.to==t.to)?!1:(i.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),Ne(i,n.from,1,{tooltip:He,until:s=>s.docChanged||s.newSelection.main.head<n.from||s.newSelection.main.head>n.to}),!0)},Gt=[{key:"Mod-Shift-m",run:Qt,preventDefault:!0},{key:"F8",run:Vt}],T=J.define({combine(i){return{sources:i.map(e=>e.source).filter(e=>e!=null),...X(i.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:ue,tooltipFilter:ue,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,s,r)=>e(n,s,r)||t(n,s,r):e:t,autoPanel:(e,t)=>e||t})}}});function ue(i,e){return i?e?(t,n)=>e(i(t,n),n):i:e}function Be(i){let e=[];if(i)e:for(let{name:t}of i){for(let n=0;n<t.length;n++){let s=t[n];if(/[a-zA-Z]/.test(s)&&!e.some(r=>r.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function Ke(i,e,t){var n;let s=t?Be(e.actions):[];return m("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},m("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(i):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((r,l)=>{let o=!1,a=u=>{if(u.preventDefault(),o)return;o=!0;let y=R(i.state.field(S).diagnostics,e);y&&r.apply(i,y.from,y.to)},{name:c}=r,h=s[l]?c.indexOf(s[l]):-1,f=h<0?c:[c.slice(0,h),m("u",c.slice(h,h+1)),c.slice(h+1)],p=r.markClass?" "+r.markClass:"";return m("button",{type:"button",class:"cm-diagnosticAction"+p,onclick:a,onmousedown:a,"aria-label":` Action: ${c}${h<0?"":` (access key "${s[l]})"`}.`},f)}),e.source&&m("div",{class:"cm-diagnosticSource"},e.source))}class jt extends Ve{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return m("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class de{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Ke(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class O{constructor(e){this.view=e,this.items=[];let t=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)fe(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],l=Be(r.actions);for(let o=0;o<l.length;o++)if(l[o].toUpperCase().charCodeAt(0)==s.keyCode){let a=R(this.view.state.field(S).diagnostics,r);a&&r.actions[o].apply(e,a.from,a.to)}}else return;s.preventDefault()}},n=s=>{for(let r=0;r<this.items.length;r++)this.items[r].dom.contains(s.target)&&this.moveSelection(r)};this.list=m("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=m("div",{class:"cm-panel-lint"},this.list,m("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>fe(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(S).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(S),n=0,s=!1,r=null,l=new Set;for(e.between(0,this.view.state.doc.length,(o,a,{spec:c})=>{for(let h of c.diagnostics){if(l.has(h))continue;l.add(h);let f=-1,p;for(let u=n;u<this.items.length;u++)if(this.items[u].diagnostic==h){f=u;break}f<0?(p=new de(this.view,h),this.items.splice(n,0,p),s=!0):(p=this.items[f],f>n&&(this.items.splice(n,f-n),s=!0)),t&&p.diagnostic==t.diagnostic?p.dom.hasAttribute("aria-selected")||(p.dom.setAttribute("aria-selected","true"),r=p):p.dom.hasAttribute("aria-selected")&&p.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new de(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:a})=>{let c=a.height/this.list.offsetHeight;o.top<a.top?this.list.scrollTop-=(a.top-o.top)/c:o.bottom>a.bottom&&(this.list.scrollTop+=(o.bottom-a.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let n=e;e=n.nextSibling,n.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=this.view.state.field(S),n=R(t.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:$e.of(n)})}static open(e){return new O(e)}}function Ut(i,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(i)}</svg>')`}function _(i){return Ut(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${i}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Yt=M.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:_("#f11")},".cm-lintRange-warning":{backgroundImage:_("orange")},".cm-lintRange-info":{backgroundImage:_("#999")},".cm-lintRange-hint":{backgroundImage:_("#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 Zt(i){return i=="error"?4:i=="warning"?3:i=="info"?2:1}function Jt(i){let e="hint",t=1;for(let n of i){let s=Zt(n.severity);s>t&&(t=s,e=n.severity)}return e}const He=Qe(zt,{hideOn:Kt}),Xt=[S,M.decorations.compute([S],i=>{let{selected:e,panel:t}=i.field(S);return!e||!t||e.from==e.to?x.none:x.set([_t.range(e.from,e.to)])}),He,Yt],li=[Ge(),je(),pe(),we(),nt(),xe(),Ue(),ke.allowMultipleSelections.of(!0),st(),Ce(Me,{fallback:!0}),rt(),ot(),at(),Ye(),Ze(),Je(),gt(),be.of([...ct,...Le,...Tt,...Re,...lt,...ht,...Gt])],oi=[pe(),we(),xe(),Ce(Me,{fallback:!0}),be.of([...Le,...Re])];export{M as EditorView,li as basicSetup,oi as minimalSetup};