mirror of
https://github.com/QIDITECH/QIDI_PLUS4.git
synced 2026-01-31 07:58:43 +03:00
73 lines
911 KiB
JavaScript
73 lines
911 KiB
JavaScript
|
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cssMode-BCN7etFc.js","./setupMonaco-CF2GrFdn.js","./index-4UonB8GV.js","./index-Bn-VKKTO.css","./setupMonaco-qJs8Ougx.css","./jsonMode-Buquy9zE.js"])))=>i.map(i=>d[i]);
|
||
|
|
import{l as W,A as Je,C as x,I as ue,D as Xr,a as xe,g as vm,b as z,M,E as Gt,c as b,r as ne,d as At,e as g,f as vC,h as ce,R as Y,i as ie,j as G,k as I,S as V,m as ze,n as It,o as D,K as Ie,p as A,q as Z,t as we,O as gi,s as N,u as ke,v as S,P as O,w as uc,x as Yr,y as yi,z as bm,B as so,U as de,F as jc,G as Te,H as Go,J as H,L as ki,N as bC,Q as je,T as Kc,V as CC,W as Cm,X as j,$ as U,Y as se,Z as Q,_ as he,a0 as ft,a1 as hr,a2 as pi,a3 as et,a4 as F,a5 as R,a6 as al,a7 as SC,a8 as wC,a9 as Re,aa as yC,ab as Sm,ac as fs,ad as Ce,ae as id,af as tt,ag as ge,ah as IC,ai as mt,aj as xC,ak as ro,al as ms,am as ao,an as LC,ao as Hu,ap as wm,aq as Vu,ar as Me,as as Zo,at as DC,au as Qr,av as _s,aw as kC,ax as Bu,ay as NC,az as pp,aA as me,aB as Ii,aC as Xe,aD as X,aE as Ji,aF as RC,aG as ri,aH as st,aI as Ee,aJ as Ot,aK as Uu,aL as k,aM as $,aN as ym,aO as MC,aP as zu,aQ as nd,aR as $u,aS as ju,aT as Pn,aU as PC,aV as Oe,aW as Ku,aX as EC,aY as To,aZ as Oi,a_ as Fi,a$ as Xo,b0 as ur,b1 as Jr,b2 as Im,b3 as gc,b4 as qu,b5 as ea,b6 as od,b7 as TC,b8 as xm,b9 as yl,ba as re,bb as Yo,bc as gr,bd as sd,be as Gu,bf as ee,bg as lo,bh as ta,bi as AC,bj as Zu,bk as OC,bl as FC,bm as qc,bn as Ft,bo as Lm,bp as Qo,bq as _e,br as WC,bs as q,bt as Jo,bu as ia,bv as Dm,bw as _t,bx as na,by as HC,bz as En,bA as T,bB as fp,bC as Ne,bD as ll,bE as km,bF as Wt,bG as Kt,bH as le,bI as co,bJ as Ue,bK as ot,bL as Xu,bM as es,bN as ts,bO as is,bP as Le,bQ as pr,bR as Gc,bS as Yu,bT as Nm,bU as Rm,bV as Qu,bW as VC,bX as Tn,bY as BC,bZ as Ao,b_ as mp,b$ as oa,c0 as rd,c1 as Mm,c2 as Oo,c3 as UC,c4 as kt,c5 as zC,c6 as fi,c7 as mi,c8 as sa,c9 as fr,ca as Pm,cb as ad,cc as Rt,cd as $C,ce as jC,cf as KC,cg as vs,ch as ld,ci as ai,cj as Ju,ck as qC,cl as eg,cm as GC,cn as _p,co as ZC,cp as XC,cq as qi,cr as Zc,cs as Ni,ct as Vn,cu as Bn,cv as YC,cw as si,cx as Pt,cy as ut,cz as QC,cA as li,cB as di,cC as Ke,cD as vp,cE as ra,cF as Zt,cG as mr,cH as Em,cI as JC,cJ as eS,cK as tg,cL as ig,cM as tS,cN as _r,cO as iS,cP as nS,cQ as bp,cR as Tm,cS as Cp,cT as oS,cU as sS,cV as _i,cW as rS,cX as Am,cY as Om,cZ as Fm,c_ as ng,c$ as Wm,d0 as aS,d1 as Hm,d2 as Vm,d3 as lS,d4 as dS,d5 as og,d6 as cS,d7 as hS,d8 as pe,d9 as uS,da as sg,db as gS,dc as Fo,dd as Sp,de as pS,df as fS,dg as mS,dh as _S,di as vS,dj as bS,dk as CS,dl as SS,dm as wp,dn as Xc,dp as wS,dq as yS,dr as yp,ds as Yc,dt as IS,du as rg,dv as Bm,dw as xS,dx as Um,dy as LS,dz as zm,dA as $m,dB as jm,dC as Qc,dD as DS,dE as kS,dF as NS,dG as RS,dH as Il,dI as Km,dJ as dd,dK as MS,dL as PS,dM as ES,dN as TS,dO as AS,dP as Un,dQ as qm,dR as OS,dS as Ip,dT as xp,dU as FS,dV as Wo,dW as Gm,dX as WS,dY as Zm,dZ as Xm,d_ as Ym,d$ as Qm,e0 as HS,e1 as yt,e2 as Lp,e3 as xa,e4 as VS,e5 as aa,e6 as Us,e7 as Jm,e8 as Dp,e9 as vr,ea as bs,eb as e_,ec as xl,ed as BS,ee as t_,ef as US,eg as i_,eh as zS,ei as $S,ej as n_,ek as rn,el as cd,em as Ll,en as jS,eo as o_,ep as ci,eq as $o,er as KS,es as qS,et as s_,eu as r_,ev as GS,ew as a_,ex as br,ey as l_,ez as d_,eA as ZS,eB as XS,eC as YS,eD as Ps,eE as kp,eF as QS,eG as JS,eH as ew,eI as tw,eJ as c_,eK as Dl,eL as Ae,eM as iw,eN as kl,eO as nt,eP as nw,eQ as ko,eR as ow,eS as h_,eT as u_,eU as sw,eV as er,eW as rw,eX as aw,eY as lw,eZ as dw,e_ as Np,e$ as Rp,f0 as Mp,f1 as ho,f2 as g_,f3 as cw,f4 as Jc,f5 as dl,f6 as hw,f7 as Pp,f8 as uw,f9 as gw,fa as pw,fb as ag,fc as fw,fd as p_,fe as mw,ff as Nl,fg as f_,fh as _w,fi as vw,fj as bw,fk as Cw,fl as Sw,fm as ww,fn as yw,fo as Iw,fp as m_,fq as xw,fr as Rl,fs as zs,ft as La,fu as $s,fv as Da,fw as js,fx as Gi,fy as ka,fz as Ep,fA as __,fB as Tp,fC as Lw,fD as pc,fE as Ap,fF as Dw,fG as kw,fH as Nw,fI as Rw,fJ as Mw,fK as v_,fL as cl,fM as Pw,fN as hd,fO as Op,fP as Ew,fQ as Nn,fR as Tw,fS as b_,fT as qe,fU as Fp,fV as Na,fW as Ra,fX as lg,fY as Aw,fZ as Ow,f_ as Fw,f$ as Ww,g0 as Hw,g1 as Vw,g2 as Bw,g3 as Wp,g4 as Uw,g5 as zw,g6 as $w,g7 as ns,g8 as tr,g9 as C_,ga as jw,gb as dg,gc as hl,gd as Ma,ge as fc,gf as Kw,gg as cg,gh as qw,gi as hg,gj as Gw,gk as Zw,gl as Ks,gm as Xw,gn as ud,go as eh,gp as Hp,gq as e
|
||
|
|
`),split:a=>a.split(`\r
|
||
|
|
`),parse:a=>Cd.split(a).filter(e=>!e.startsWith("#"))});class te{constructor(e){this.value=e}equals(e){return this.value===e.value}contains(e){return this.equals(e)||this.value===""||e.value.startsWith(this.value+te.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new te((this.value?[this.value,...e]:e).join(te.sep))}}te.sep=".";te.None=new te("@@none@@");te.Empty=new te("");const $p={EDITORS:"CodeEditors",FILES:"CodeFiles"};class Gy{}const Zy={DragAndDropContribution:"workbench.contributions.dragAndDrop"};so.add(Zy.DragAndDropContribution,new Gy);class Cr{constructor(){}static getInstance(){return Cr.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}}Cr.INSTANCE=new Cr;function V_(a){const e=new F_;for(const t of a.items){const i=t.type;if(t.kind==="string"){const n=new Promise(o=>t.getAsString(o));e.append(i,mg(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,Xy(n))}}return e}function Xy(a){const e=a.path?de.parse(a.path):void 0;return qy(a.name,e,async()=>new Uint8Array(await a.arrayBuffer()))}const Yy=Object.freeze([$p.EDITORS,$p.FILES,jc.RESOURCES,jc.INTERNAL_URI_LIST]);function B_(a,e=!1){const t=V_(a),i=t.get(jc.INTERNAL_URI_LIST);if(i)t.replace(Te.uriList,i);else if(e||!t.has(Te.uriList)){const n=[];for(const o of a.items){const s=o.getAsFile();if(s){const r=s.path;try{r?n.push(de.file(r).toString()):n.push(de.parse(s.name,!0).toString())}catch{}}}n.length&&t.replace(Te.uriList,mg(Cd.create(n)))}for(const n of Yy)t.delete(n);return t}var _g=function(a,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,e,t,i);else for(var r=a.length-1;r>=0;r--)(s=a[r])&&(o=(n<3?s(o):n>3?s(e,t,o):s(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Sr=function(a,e){return function(t,i){e(t,i,a)}};class vg{async provideDocumentPasteEdits(e,t,i,n,o){const s=await this.getEdit(i,o);if(s)return{dispose(){},edits:[{insertText:s.insertText,title:s.title,kind:s.kind,handledMimeType:s.handledMimeType,yieldTo:s.yieldTo}]}}async provideDocumentDropEdits(e,t,i,n){const o=await this.getEdit(i,n);return o?[{insertText:o.insertText,title:o.title,kind:o.kind,handledMimeType:o.handledMimeType,yieldTo:o.yieldTo}]:void 0}}class Pi extends vg{constructor(){super(...arguments),this.kind=Pi.kind,this.dropMimeTypes=[Te.text],this.pasteMimeTypes=[Te.text]}async getEdit(e,t){const i=e.get(Te.text);if(!i||e.has(Te.uriList))return;const n=await i.asString();return{handledMimeType:Te.text,title:g("text.label","Insert Plain Text"),insertText:n,kind:this.kind}}}Pi.id="text";Pi.kind=new te("text.plain");class U_ extends vg{constructor(){super(...arguments),this.kind=new te("uri.absolute"),this.dropMimeTypes=[Te.uriList],this.pasteMimeTypes=[Te.uriList]}async getEdit(e,t){const i=await z_(e);if(!i.length||t.isCancellationRequested)return;let n=0;const o=i.map(({uri:r,originalText:l})=>r.scheme===je.file?r.fsPath:(n++,l)).join(" ");let s;return n>0?s=i.length>1?g("defaultDropProvider.uriList.uris","Insert Uris"):g("defaultDropProvider.uriList.uri","Insert Uri"):s=i.length>1?g("defaultDropProvider.uriList.paths","Insert Paths"):g("defaultDropProvider.uriList.path","Insert Path"),{handledMimeType:Te.uriList,insertText:o,title:s,kind:this.kind}}}let Pl=class extends vg{constructor(e){super(),this._workspaceContextService=e,this.kind=new te("uri.relative"),this.dropMimeTypes=[Te.uriList],this.pasteMimeTypes=[Te.uriList]}async getEdit(e,t){const i=await z_(e);if(!i.length||t.isCancellationRequested)return;const n=ki(i.map(({uri:o})=>{const s=this._workspaceContextService.getWorkspaceFolder(o);return s?bC(s.uri,o):void 0}));if(n.length)return{handledMimeType:Te.uriList,insertText:n.join(" "),title:i.length>1?g("defaultDropProvider.uriList.relativePaths","Insert Relative Paths"):g("defaultDropProvider.uriList.relativePath","Insert Relative Path"),kind:this.kind}}};Pl=_g([Sr(0,Go)],Pl);class Qy{constructor(){this.kind=new te("html"),this.pasteMimeTypes=
|
||
|
|
`):a}function Zp(a){return a.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${a.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof a.code=="string"&&typeof a.errno=="number"&&typeof a.syscall=="string"?g("nodeExceptionMessage","A system error occurred ({0})",a.message):a.message||g("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}function Tl(a=null,e=!1){if(!a)return g("error.defaultMessage","An unknown error occurred. Please consult the log for more details.");if(Array.isArray(a)){const t=ki(a),i=Tl(t[0],e);return t.length>1?g("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(Sm(a))return a;if(a.detail){const t=a.detail;if(t.error)return vc(t.error,e);if(t.exception)return vc(t.exception,e)}return a.stack?vc(a,e):a.message?a.message:g("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}var q_=function(a,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,e,t,i);else for(var r=a.length-1;r>=0;r--)(s=a[r])&&(o=(n<3?s(o):n>3?s(e,t,o):s(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},jo=function(a,e){return function(t,i){e(t,i,a)}},ah;let Al=ah=class extends N{constructor(e,t,i,n,o,s,r,l,d,c){super(),this.typeId=e,this.editor=t,this.showCommand=n,this.range=o,this.edits=s,this.onSelectNewEdit=r,this._contextMenuService=l,this._keybindingService=c,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=i.bindTo(d),this.visibleContext.set(!0),this._register(ge(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(ge(()=>this.editor.removeContentWidget(this))),this._register(this.editor.onDidChangeCursorPosition(h=>{o.containsPosition(h.position)||this.dispose()})),this._register(Re.runAndSubscribe(c.onDidUpdateKeybindings,()=>{this._updateButtonTitle()}))}_updateButtonTitle(){var e;const t=(e=this._keybindingService.lookupKeybinding(this.showCommand.id))===null||e===void 0?void 0:e.getLabel();this.button.element.title=this.showCommand.label+(t?` (${t})`:"")}create(){this.domNode=U(".post-edit-widget"),this.button=this._register(new IC(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Q(this.domNode,he.CLICK,()=>this.showSelector()))}getId(){return ah.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=mt(this.button.element);return{x:e.left+e.width,y:e.top+e.height}},getActions:()=>this.edits.allEdits.map((e,t)=>xC({id:"",label:e.title,checked:t===this.edits.activeEditIndex,run:()=>{if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}}))})}};Al.baseId="editor.widget.postEditWidget";Al=ah=q_([jo(7,fs),jo(8,ie),jo(9,Ce)],Al);let Ol=class extends N{constructor(e,t,i,n,o,s,r){super(),this._id=e,this._editor=t,this._visibleContext=i,this._showCommand=n,this._instantiationService=o,this._bulkEditService=s,this._notificationService=r,this._currentWidget=this._register(new ft),this._register(Re.any(t.onDidChangeModel,t.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(e,t,i,n,o){const s=this._editor.getModel();if(!s||!e.length)return;const r=t.allEdits.at(t.activeEditIndex);if(!r)return;const l=async _=>{const v=this._editor.getModel();v&&(await v.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:_,allEdits:t.allEdits},i,n,o))},d=(_,v)=>{ro(_)||(this._notificationService.error(v),i&&this.show(e[0],t,l))};let c;try{c=await n(r,o)}catch(_){return d(_,g("resolveError",`Error resolving edit '{0}':
|
||
|
|
{1}`,r.title,Tl(_)))}if(o.isCancellationRequested)return;const h=j_(s.uri,e,c),u=e[0],p=s.deltaDecorations([],[{range:u,options:{description:"paste-line-suffix",stickiness:0}}]);this._editor.focus();let f,m;try{f=await this._bulkEditService.apply(h,{editor:this._editor,token:o}),m=s.getDecorationRange(p[0])}catch(_){return d(_,g("applyError",`Error applying edit '{0}':
|
||
|
|
{1}`,r.title,Tl(_)))}finally{s.deltaDecorations(p,[])}o.isCancellationRequested||i&&f.isApplied&&t.allEdits.length>1&&this.show(m??u,t,l)}show(e,t,i){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(Al,this._id,this._editor,this._visibleContext,this._showCommand,e,t,i))}clear(){this._currentWidget.clear()}tryShowSelector(){var e;(e=this._currentWidget.value)===null||e===void 0||e.showSelector()}};Ol=q_([jo(4,j),jo(5,id),jo(6,tt)],Ol);var o0=function(a,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,e,t,i);else for(var r=a.length-1;r>=0;r--)(s=a[r])&&(o=(n<3?s(o):n>3?s(e,t,o):s(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},vo=function(a,e){return function(t,i){e(t,i,a)}},Ln;const G_="editor.changePasteType",Cg=new Y("pasteWidgetVisible",!1,g("pasteWidgetVisible","Whether the paste widget is showing")),bc="application/vnd.code.copyMetadata";let hi=Ln=class extends N{static get(e){return e.getContribution(Ln.ID)}constructor(e,t,i,n,o,s,r){super(),this._bulkEditService=i,this._clipboardService=n,this._languageFeaturesService=o,this._quickInputService=s,this._progressService=r,this._editor=e;const l=e.getContainerDomNode();this._register(Q(l,"copy",d=>this.handleCopy(d))),this._register(Q(l,"cut",d=>this.handleCopy(d))),this._register(Q(l,"paste",d=>this.handlePaste(d),!0)),this._pasteProgressManager=this._register(new El("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(Ol,"pasteIntoEditor",e,Cg,{id:G_,label:g("postPasteWidgetTitle","Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(e){this._editor.focus();try{this._pasteAsActionContext={preferred:e},Hu().execCommand("paste")}finally{this._pasteAsActionContext=void 0}}clearWidgets(){this._postPasteWidgetManager.clear()}isPasteAsEnabled(){return this._editor.getOption(85).enabled&&!this._editor.getOption(91)}async finishedPaste(){await this._currentPasteOperation}handleCopy(e){var t,i;if(!this._editor.hasTextFocus()||(wm&&this._clipboardService.writeResources([]),!e.clipboardData||!this.isPasteAsEnabled()))return;const n=this._editor.getModel(),o=this._editor.getSelections();if(!n||!(o!=null&&o.length))return;const s=this._editor.getOption(37);let r=o;const l=o.length===1&&o[0].isEmpty();if(l){if(!s)return;r=[new S(r[0].startLineNumber,1,r[0].startLineNumber,1+n.getLineLength(r[0].startLineNumber))]}const d=(t=this._editor._getViewModel())===null||t===void 0?void 0:t.getPlainTextToCopy(o,s,Vu),h={multicursorText:Array.isArray(d)?d:null,pasteOnNewLine:l,mode:null},u=this._languageFeaturesService.documentPasteEditProvider.ordered(n).filter(v=>!!v.prepareDocumentPaste);if(!u.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:h});return}const p=V_(e.clipboardData),f=u.flatMap(v=>{var C;return(C=v.copyMimeTypes)!==null&&C!==void 0?C:[]}),m=bd();this.setCopyMetadata(e.clipboardData,{id:m,providerCopyMimeTypes:f,defaultPastePayload:h});const _=Me(async v=>{const C=ki(await Promise.all(u.map(async y=>{try{return await y.prepareDocumentPaste(n,r,p,v)}catch(w){console.error(w);return}})));C.reverse();for(const y of C)for(const[w,L]of y)p.replace(w,L);return p});(i=Ln._currentCopyOperation)===null||i===void 0||i.dataTransferPromise.cancel(),Ln._currentCopyOperation={handle:m,dataTransferPromise:_}}async handlePaste(e){var t,i,n,o;if(!e.clipboardData||!this._editor.hasTextFocus())return;(t=Ge.get(this._editor))===null||t===void 0||t.closeMessage(),(i=this._currentPasteOperation)===null||i===void 0||i.cancel(),this._currentPasteOperation=void 0;const s=this._editor.getModel(),r=this._editor.getSelections();if(!(r!=null&&r.length)||!s||!this.isPasteAsEnabled()&&!this._pasteAsActionContext)return;const l=this.fetchCopyMetadata(e),d=B_(e.clipboardData);d.delete(bc);const c=[...e.clipboardData.types,...(n=l==null?void 0:l.providerCopyMimeTypes)!==null&&n!==void 0?n:[],Te.uriList],h=this._languageFeat
|
||
|
|
`),this._selectionId=t.trackSelection(i);return}i.startLineNumber<i.endLineNumber&&i.endColumn===1&&(this._moveEndPositionDown=!0,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const n=Si._gatherPreflightData(this._type,this._insertSpace,e,i.startLineNumber,i.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);return n.supported?this._executeLineComments(e,t,n,i):this._executeBlockComment(e,t,i)}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),new V(i.selectionStartLineNumber,i.selectionStartColumn+this._deltaColumn,i.positionLineNumber,i.positionColumn+this._deltaColumn)}static _createRemoveLineCommentsOperations(e,t){const i=[];for(let n=0,o=e.length;n<o;n++){const s=e[n];s.ignore||i.push(pe.delete(new S(t+n,s.commentStrOffset+1,t+n,s.commentStrOffset+s.commentStrLength+1)))}return i}_createAddLineCommentsOperations(e,t){const i=[],n=this._insertSpace?" ":"";for(let o=0,s=e.length;o<s;o++){const r=e[o];r.ignore||i.push(pe.insert(new O(t+o,r.commentStrOffset+1),r.commentStr+n))}return i}static nextVisibleColumn(e,t,i,n){return i?e+(t-e%t):e+n}static _normalizeInsertionPoint(e,t,i,n){let o=1073741824,s,r;for(let l=0,d=t.length;l<d;l++){if(t[l].ignore)continue;const c=e.getLineContent(i+l);let h=0;for(let u=0,p=t[l].commentStrOffset;h<o&&u<p;u++)h=Si.nextVisibleColumn(h,n,c.charCodeAt(u)===9,1);h<o&&(o=h)}o=Math.floor(o/n)*n;for(let l=0,d=t.length;l<d;l++){if(t[l].ignore)continue;const c=e.getLineContent(i+l);let h=0;for(s=0,r=t[l].commentStrOffset;h<o&&s<r;s++)h=Si.nextVisibleColumn(h,n,c.charCodeAt(s)===9,1);h>o?t[l].commentStrOffset=s-1:t[l].commentStrOffset=s}}}class Eg extends D{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(_e);if(!t.hasModel())return;const n=t.getModel(),o=[],s=n.getOptions(),r=t.getOption(23),l=t.getSelections().map((c,h)=>({selection:c,index:h,ignoreFirstLine:!1}));l.sort((c,h)=>S.compareRangesUsingStarts(c.selection,h.selection));let d=l[0];for(let c=1;c<l.length;c++){const h=l[c];d.selection.endLineNumber===h.selection.startLineNumber&&(d.index<h.index?h.ignoreFirstLine=!0:(d.ignoreFirstLine=!0,d=h))}for(const c of l)o.push(new Si(i,c.selection,s.indentSize,this._type,r.insertSpace,r.ignoreEmptyLines,c.ignoreFirstLine));t.pushUndoStop(),t.executeCommands(this.id,o),t.pushUndoStop()}}class wx extends Eg{constructor(){super(0,{id:"editor.action.commentLine",label:g("comment.line","Toggle Line Comment"),alias:"Toggle Line Comment",precondition:b.writable,kbOpts:{kbExpr:b.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:M.MenubarEditMenu,group:"5_insert",title:g({key:"miToggleLineComment",comment:["&& denotes a mnemonic"]},"&&Toggle Line Comment"),order:1}})}}class yx extends Eg{constructor(){super(1,{id:"editor.action.addCommentLine",label:g("comment.line.add","Add Line Comment"),alias:"Add Line Comment",precondition:b.writable,kbOpts:{kbExpr:b.editorTextFocus,primary:Ie(2089,2081),weight:100}})}}class Ix extends Eg{constructor(){super(2,{id:"editor.action.removeCommentLine",label:g("comment.line.remove","Remove Line Comment"),alias:"Remove Line Comment",precondition:b.writable,kbOpts:{kbExpr:b.editorTextFocus,primary:Ie(2089,2099),weight:100}})}}class xx extends D{constructor(){super({id:"editor.action.blockComment",label:g("comment.block","Toggle Block Comment"),alias:"Toggle Block Comment",precondition:b.writable,kbOpts:{kbExpr:b.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:M.MenubarEditMenu,group:"5_insert",title:g({key:"miToggleBlockComment",comment:["&& denotes a mnemonic"]},"Toggle &&Block Comment"),order:2}})}run(e,t){const i=e.get(_e);if(!t.hasModel())return;const n=t.getOption(23),o=[],s=t.getSelections();for(const r of s)o.push(new Xi(r,n.insertSpace,i));t.pushUndoStop(),t.executeCommands(this.id,o),t.pushUndoStop()}}I(wx);I(yx);I(Ix);I(xx);var Lx=function(a,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Refle
|
||
|
|
`,i+1);break;case 116:t.emitUnchanged(i-1),t.emitStatic(" ",i+1);break;case 117:case 85:case 108:case 76:t.emitUnchanged(i-1),t.emitStatic("",i+1),e.push(String.fromCharCode(s));break}continue}if(o===36){if(i++,i>=n)break;const s=a.charCodeAt(i);if(s===36){t.emitUnchanged(i-1),t.emitStatic("$",i+1);continue}if(s===48||s===38){t.emitUnchanged(i-1),t.emitMatchIndex(0,i+1,e),e.length=0;continue}if(49<=s&&s<=57){let r=s-48;if(i+1<n){const l=a.charCodeAt(i+1);if(48<=l&&l<=57){i++,r=r*10+(l-48),t.emitUnchanged(i-2),t.emitMatchIndex(r,i+1,e),e.length=0;continue}}t.emitUnchanged(i-1),t.emitMatchIndex(r,i+1,e),e.length=0;continue}}}return t.finalize()}const Wi=new Y("findWidgetVisible",!1);Wi.toNegated();const Pd=new Y("findInputFocussed",!1),Ag=new Y("replaceInputFocussed",!1),Ba={primary:545,mac:{primary:2593}},Ua={primary:565,mac:{primary:2613}},za={primary:560,mac:{primary:2608}},$a={primary:554,mac:{primary:2602}},ja={primary:558,mac:{primary:2606}},oe={StartFindAction:"actions.find",StartFindWithSelection:"actions.findWithSelection",StartFindWithArgs:"editor.actions.findWithArgs",NextMatchFindAction:"editor.action.nextMatchFindAction",PreviousMatchFindAction:"editor.action.previousMatchFindAction",GoToMatchFindAction:"editor.action.goToMatchFindAction",NextSelectionMatchFindAction:"editor.action.nextSelectionMatchFindAction",PreviousSelectionMatchFindAction:"editor.action.previousSelectionMatchFindAction",StartFindReplaceAction:"editor.action.startFindReplaceAction",CloseFindWidgetCommand:"closeFindWidget",ToggleCaseSensitiveCommand:"toggleFindCaseSensitive",ToggleWholeWordCommand:"toggleFindWholeWord",ToggleRegexCommand:"toggleFindRegex",ToggleSearchScopeCommand:"toggleFindInSelection",TogglePreserveCaseCommand:"togglePreserveCase",ReplaceOneAction:"editor.action.replaceOne",ReplaceAllAction:"editor.action.replaceAll",SelectAllMatchesAction:"editor.action.selectAllMatches"},Yi=19999,Fx=240;class or{constructor(e,t){this._toDispose=new R,this._editor=e,this._state=t,this._isDisposed=!1,this._startSearchingTimer=new Jr,this._decorations=new We(e),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new ke(()=>this.research(!1),100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition(i=>{(i.reason===3||i.reason===5||i.reason===6)&&this._decorations.setStartPosition(this._editor.getPosition())})),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent(i=>{this._ignoreModelContentChanged||(i.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())})),this._toDispose.add(this._state.onFindReplaceStateChange(i=>this._onStateChanged(i))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,Ke(this._startSearchingTimer),this._toDispose.dispose()}_onStateChanged(e){this._isDisposed||this._editor.hasModel()&&(e.searchString||e.isReplaceRevealed||e.isRegex||e.wholeWord||e.matchCase||e.searchScope)&&(this._editor.getModel().isTooLargeForSyncing()?(this._startSearchingTimer.cancel(),this._startSearchingTimer.setIfNotSet(()=>{e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor)},Fx)):e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor))}static _getSearchRange(e,t){return t||e.getFullModelRange()}research(e,t){let i=null;typeof t<"u"?t!==null&&(Array.isArray(t)?i=t:i=[t]):i=this._decorations.getFindScopes(),i!==null&&(i=i.map(r=>{if(r.startLineNumber!==r.endLineNumber){let l=r.endLineNumber;return r.endColumn===1&&(l=l-1),new S(r.startLineNumber,1,l,this._editor.getModel().getLineMaxColumn(l))}return r}));const n=this._findMatches(i,!1,Yi);this._decorations.set(n,i);const o=this._editor.getSelection();let s=this._decorations.getCurrentMatchesPosition(o);if(s===0&&n.length>0){const r=Um(n.map(l=>l.range),l=>S.compareRangesUsingStarts(l,o)>=0);s=r>0?r-1+1:s}this._state.changeMatchInfo(s,this._decorations.getCount(),void 0),e&&this._editor.get
|
||
|
|
`),e.preventDefault();return}if(e.equals(2)){this._isReplaceVisible?this._replaceInput.focus():this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return xf(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return Lf(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(If|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{Vu&&_s&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info(g("ctrlEnter.keybindingChanged","Ctrl+Enter now inserts line break instead of replacing all. You can modify the keybinding for editor.action.replaceAll to override this behavior.")),this._ctrlEnterReplaceAllWarningPrompted=!0,this._storageService.store(yf,!0,0,0)),this._replaceInput.inputBox.insertAtCursor(`
|
||
|
|
`),e.preventDefault();return}if(e.equals(2)){this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(1026)){this._findInput.focus(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return xf(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return Lf(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"))}getVerticalSashLeft(e){return 0}_keybindingLabelFor(e){const t=this._keybindingService.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}_buildDomNode(){this._findInput=this._register(new Ah(null,this._contextViewProvider,{width:dL,label:Zx,placeholder:Xx,appendCaseSensitiveLabel:this._keybindingLabelFor(oe.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(oe.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(oe.ToggleRegexCommand),validation:c=>{if(c.length===0||!this._findInput.getRegex())return null;try{return new RegExp(c,"gu"),null}catch(h){return{content:h.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>bf(this._keybindingService),inputBoxStyles:Ip,toggleStyles:xp},this._contextKeyService)),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onKeyDown(c=>this._onFindInputKeyDown(c))),this._register(this._findInput.inputBox.onDidChange(()=>{this._ignoreChangeEvent||this._state.change({searchString:this._findInput.getValue()},!0)})),this._register(this._findInput.onDidOptionChange(()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this._findInput.onCaseSensitiveKeyDown(c=>{c.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),c.preventDefault())})),this._register(this._findInput.onRegexKeyDown(c=>{c.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),c.preventDefault())})),this._register(this._findInput.inputBox.onDidHeightChange(c=>{this._tryUpdateHeight()&&this._showViewZone()})),FS&&this._register(this._findInput.onMouseDown(c=>this._onFindInputMouseDown(c))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();const i=this._register(Qc());this._prevBtn=this._register(new yo({label:Yx+this._keybindingLabelFor(oe.PreviousMatchFindAction),icon:Kx,hoverDelegate:i,onTrigger:()=>{Wo(this._codeEditor.getAction(oe.PreviousMatchFindAction)).run().then(void 0,re)}},this._hoverService)),this._nextBtn=this._register(new yo({label:Qx+this._keybindingLabelFor(oe.NextMatchFindAction),icon:qx,hoverDelegate:i,onTrigger:()=>{Wo(this._codeEditor.getAction(oe.NextMatchFindAction)).run().then(void 0,re)}},this._hoverService));const n=document.createElement("div");n.className="find-part",n.appendChild(this._findInput.domNode);const o=document.createElement("div");o.className="find-actions",n.appendChild(o),o.appendChild(this._matchesCount),o.appendChild(this._prevBtn.domNode),o.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new Km({icon:zx,title:Jx+this._keybindingLabelFor(oe.ToggleSearchScopeCommand),isChecked:!1,hoverDelegate:i,inputActiveOptionBackground:Pn(To),inputActiveOptionBorder:Pn($m),inputActiveOptionForeground:Pn(jm)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let c=this._codeEditor.getSelections();c=c.map(h=>(h.endColumn===1&&h.endLineNumber>h.startLineNumber&&(h=h.setEndPosition(h.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(h.endLineNumber-1))),h.isEmpty()?null:h)).filter(h=>!!h),c.length&&this._state.change({searchScope:c},!0)}}else this._state.change({searchScope:null},!0)})),o.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=th
|
||
|
|
* 'levels': Number of levels to unfold. If not set, defaults to 1.
|
||
|
|
* 'direction': If 'up', unfold given number of levels up otherwise unfolds down.
|
||
|
|
* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the unfold action to. If not set, the active selection(s) will be used.
|
||
|
|
`,constraint:cb,schema:{type:"object",properties:{levels:{type:"number",default:1},direction:{type:"string",enum:["up","down"],default:"down"},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(e,t,i,n){const o=n&&n.levels||1,s=this.getLineNumbers(n,i);n&&n.direction==="up"?sb(t,!1,o,s):Is(t,!1,o,s)}}class jL extends Be{constructor(){super({id:"editor.unfoldRecursively",label:g("unFoldRecursivelyAction.label","Unfold Recursively"),alias:"Unfold Recursively",precondition:Fe,kbOpts:{kbExpr:b.editorTextFocus,primary:Ie(2089,2142),weight:100}})}invoke(e,t,i,n){Is(t,!1,Number.MAX_VALUE,this.getSelectedLines(i))}}class KL extends Be{constructor(){super({id:"editor.fold",label:g("foldAction.label","Fold"),alias:"Fold",precondition:Fe,kbOpts:{kbExpr:b.editorTextFocus,primary:3164,mac:{primary:2652},weight:100},metadata:{description:"Fold the content in the editor",args:[{name:"Fold editor argument",description:`Property-value pairs that can be passed through this argument:
|
||
|
|
* 'levels': Number of levels to fold.
|
||
|
|
* 'direction': If 'up', folds given number of levels up otherwise folds down.
|
||
|
|
* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the fold action to. If not set, the active selection(s) will be used.
|
||
|
|
If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.
|
||
|
|
`,constraint:cb,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(e,t,i,n){const o=this.getLineNumbers(n,i),s=n&&n.levels,r=n&&n.direction;typeof s!="number"&&typeof r!="string"?xL(t,!0,o):r==="up"?sb(t,!0,s||1,o):Is(t,!0,s||1,o)}}class qL extends Be{constructor(){super({id:"editor.toggleFold",label:g("toggleFoldAction.label","Toggle Fold"),alias:"Toggle Fold",precondition:Fe,kbOpts:{kbExpr:b.editorTextFocus,primary:Ie(2089,2090),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);ob(t,1,n)}}class GL extends Be{constructor(){super({id:"editor.foldRecursively",label:g("foldRecursivelyAction.label","Fold Recursively"),alias:"Fold Recursively",precondition:Fe,kbOpts:{kbExpr:b.editorTextFocus,primary:Ie(2089,2140),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);Is(t,!0,Number.MAX_VALUE,n)}}class ZL extends Be{constructor(){super({id:"editor.foldAllBlockComments",label:g("foldAllBlockComments.label","Fold All Block Comments"),alias:"Fold All Block Comments",precondition:Fe,kbOpts:{kbExpr:b.editorTextFocus,primary:Ie(2089,2138),weight:100}})}invoke(e,t,i,n,o){if(t.regions.hasTypes())Hg(t,aa.Comment.value,!0);else{const s=i.getModel();if(!s)return;const r=o.getLanguageConfiguration(s.getLanguageId()).comments;if(r&&r.blockCommentStartToken){const l=new RegExp("^\\s*"+gr(r.blockCommentStartToken));Wg(t,l,!0)}}}}class XL extends Be{constructor(){super({id:"editor.foldAllMarkerRegions",label:g("foldAllMarkerRegions.label","Fold All Regions"),alias:"Fold All Regions",precondition:Fe,kbOpts:{kbExpr:b.editorTextFocus,primary:Ie(2089,2077),weight:100}})}invoke(e,t,i,n,o){if(t.regions.hasTypes())Hg(t,aa.Region.value,!0);else{const s=i.getModel();if(!s)return;const r=o.getLanguageConfiguration(s.getLanguageId()).foldingRules;if(r&&r.markers&&r.markers.start){const l=new RegExp(r.markers.start);Wg(t,l,!0)}}}}class YL extends Be{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:g("unfoldAllMarkerRegions.label","Unfold All Regions"),alias:"Unfold All Regions",precondition:Fe,kbOpts:{kbExpr:b.editorTextFocus,primary:Ie(2089,2078),weight:100}})}invoke(e,t,i,n,o){if(t.regions.hasTypes())Hg(t,aa.Region.value,!1);else{const s=i.getModel();if(!s)return;const r=o.getLanguageConfiguration(s.getLanguageId()).foldingRules;if(r&&r.markers&&r.markers.start){const l=new RegExp(r.markers.start);Wg(t,l,!1)}}}}class QL extends Be{constructor(){super({id:"editor.foldAllExcept",label:g("foldAllExcept.label","Fold All Except Selected"),alias:"Fold All Except Selected",precondition:Fe,kbOpts:{kbExpr:b.editorTextFocus,primary:Ie(2089,2136),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);rb(t,!0,n)}}class JL extends Be{constructor(){super({id:"editor.unfoldAllExcept",label:g("unfoldAllExcept.label","Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:Fe,kbOpts:{kbExpr:b.editorTextFocus,primary:Ie(2089,2134),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);rb(t,!1,n)}}class eD extends Be{constructor(){super({id:"editor.foldAll",label:g("foldAllAction.label","Fold All"),alias:"Fold All",precondition:Fe,kbOpts:{kbExpr:b.editorTextFocus,primary:Ie(2089,2069),weight:100}})}invoke(e,t,i){Is(t,!0)}}class tD extends Be{constructor(){super({id:"editor.unfoldAll",label:g("unfoldAllAction.label","Unfold All"),alias:"Unfold All",precondition:Fe,kbOpts:{kbExpr:b.editorTextFocus,primary:Ie(2089,2088),weight:100}})}invoke(e,t,i){Is(t,!1)}}class Xn extends Be{getFoldingLevel(){return parseInt(this.id.substr(Xn.ID_PREFIX.length))}invoke(e,t,i){LL(t,this.getFoldingLevel(),!0,this.getSelectedLines(i))}}Xn.ID_PREFIX="editor.foldLevel";Xn.ID=a=>Xn.ID_PREFIX+a;class iD extends Be{constructor(){super({id:"editor.gotoParentFold",label:g("gotoParentFold.label","Go to Parent Fold"),alias:"Go to Parent Fold",precondition:Fe,kbOpts:{kbExpr:b.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const o=DL(n[0],t);o!==null&&i.setSelection({startLi
|
||
|
|
`)))]).applyToString(i).substring(this.parts[0].column-1)}isEmpty(){return this.parts.every(e=>e.lines.length===0)}get lineCount(){return 1+this.parts.reduce((e,t)=>e+t.lines.length-1,0)}}class Kl{constructor(e,t,i){this.column=e,this.text=t,this.preview=i,this.lines=cd(this.text)}equals(e){return this.column===e.column&&this.lines.length===e.lines.length&&this.lines.every((t,i)=>t===e.lines[i])}}class Uh{constructor(e,t,i,n=0){this.lineNumber=e,this.columnRange=t,this.text=i,this.additionalReservedLineCount=n,this.parts=[new Kl(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=cd(this.text)}renderForScreenReader(e){return this.newLines.join(`
|
||
|
|
`)}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every(e=>e.lines.length===0)}equals(e){return this.lineNumber===e.lineNumber&&this.columnRange.equals(e.columnRange)&&this.newLines.length===e.newLines.length&&this.newLines.every((t,i)=>t===e.newLines[i])&&this.additionalReservedLineCount===e.additionalReservedLineCount}}function Rf(a,e){return ri(a,e,gb)}function gb(a,e){return a===e?!0:!a||!e?!1:a instanceof Pr&&e instanceof Pr||a instanceof Uh&&e instanceof Uh?a.equals(e):!1}const gD=[];function pD(){return gD}class pb{constructor(e,t){if(this.startColumn=e,this.endColumnExclusive=t,e>t)throw new Ll(`startColumn ${e} cannot be after endColumnExclusive ${t}`)}toRange(e){return new S(e,this.startColumn,e,this.endColumnExclusive)}equals(e){return this.startColumn===e.startColumn&&this.endColumnExclusive===e.endColumnExclusive}}function fb(a,e){const t=new R,i=a.createDecorationsCollection();return t.add(jS({debugName:()=>`Apply decorations from ${e.debugName}`},n=>{const o=e.read(n);i.set(o)})),t.add({dispose:()=>{i.clear()}}),t}function fD(a,e){return new O(a.lineNumber+e.lineNumber-1,e.lineNumber===1?a.column+e.column-1:e.column)}function Mf(a,e){return new O(a.lineNumber-e.lineNumber+1,a.lineNumber-e.lineNumber===0?a.column-e.column+1:a.column)}var mD=function(a,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,e,t,i);else for(var r=a.length-1;r>=0;r--)(s=a[r])&&(o=(n<3?s(o):n>3?s(e,t,o):s(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},_D=function(a,e){return function(t,i){e(t,i,a)}};const Pf="ghost-text";let zh=class extends N{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=ci(this,!1),this.currentTextModel=Ue(this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=ot(this,n=>{if(this.isDisposed.read(n))return;const o=this.currentTextModel.read(n);if(o!==this.model.targetTextModel.read(n))return;const s=this.model.ghostText.read(n);if(!s)return;const r=s instanceof Uh?s.columnRange:void 0,l=[],d=[];function c(m,_){if(d.length>0){const v=d[d.length-1];_&&v.decorations.push(new br(v.content.length+1,v.content.length+1+m[0].length,_,0)),v.content+=m[0],m=m.slice(1)}for(const v of m)d.push({content:v,decorations:_?[new br(1,v.length+1,_,0)]:[]})}const h=o.getLineContent(s.lineNumber);let u,p=0;for(const m of s.parts){let _=m.lines;u===void 0?(l.push({column:m.column,text:_[0],preview:m.preview}),_=_.slice(1)):c([h.substring(p,m.column-1)],void 0),_.length>0&&(c(_,Pf),u===void 0&&m.column<=h.length&&(u=m.column)),p=m.column-1}u!==void 0&&c([h.substring(p)],void 0);const f=u!==void 0?new pb(u,h.length+1):void 0;return{replacedRange:r,inlineTexts:l,additionalLines:d,hiddenRange:f,lineNumber:s.lineNumber,additionalReservedLineCount:this.model.minReservedLineCount.read(n),targetTextModel:o}}),this.decorations=ot(this,n=>{const o=this.uiState.read(n);if(!o)return[];const s=[];o.replacedRange&&s.push({range:o.replacedRange.toRange(o.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace",description:"GhostTextReplacement"}}),o.hiddenRange&&s.push({range:o.hiddenRange.toRange(o.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(const r of o.inlineTexts)s.push({range:S.fromPositions(new O(o.lineNumber,r.column)),options:{description:Pf,after:{content:r.text,inlineClassName:r.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:Fo.Left},showIfCollapsed:!0}});return s}),this.additionalLinesWidget=this._register(new mb(this.editor,this.languageService.languageIdCodec,ot(n=>{const o=this.uiState.read(n);return o?{lineNumber:o.lineNumber,additionalLines:o.additionalLines,minReservedLineCount:o.additionalReservedLineCount,targetTextModel:o.targetTextModel}:void 0}))),this._register(ge(()=>{this.isDisposed.set(!0,void 0)})),this._register(fb(this.editor,this.decorations))}ownsViewZone(e){return this.additionalLinesWidget.viewZoneId===e}
|
||
|
|
`),n=e.replace(/\r\n|\r/g,`
|
||
|
|
`)}withRange(e){return new ql(this.filterText,this.command,e,this.insertText,this.snippetInfo,this.additionalTextEdits,this.sourceInlineCompletion,this.source)}hash(){return JSON.stringify({insertText:this.insertText,range:this.range.toString()})}}function ID(a,e){const t=e.getWordAtPosition(a),i=e.getLineMaxColumn(a.lineNumber);return t?new S(a.lineNumber,t.startColumn,a.lineNumber,i):S.fromPositions(a,a.with(void 0,i))}function Tf(a,e,t,i){const o=t.getLineContent(e.lineNumber).substring(0,e.column-1)+a,s=t.tokenization.tokenizeLineWithEdit(e,o.length-(e.column-1),a),r=s==null?void 0:s.sliceAndInflate(e.column-1,o.length,0);return r?bD(r,i):a}function Wn(a,e,t){const i=t?a.range.intersectRanges(t):a.range;if(!i)return a;const n=e.getValueInRange(i,1),o=ra(n,a.text),s=Dl.ofText(n.substring(0,o)).addToPosition(a.range.getStartPosition()),r=a.text.substring(o),l=S.fromPositions(s,a.range.getEndPosition());return new rn(l,r)}function _b(a,e){return a.text.startsWith(e.text)&&xD(a.range,e.range)}function Af(a,e,t,i,n=0){let o=Wn(a,e);if(o.range.endLineNumber!==o.range.startLineNumber)return;const s=e.getLineContent(o.range.startLineNumber),r=Ae(s).length;if(o.range.startColumn-1<=r){const f=Ae(o.text).length,m=s.substring(o.range.startColumn-1,r),[_,v]=[o.range.getStartPosition(),o.range.getEndPosition()],C=_.column+m.length<=v.column?_.delta(0,m.length):v,y=S.fromPositions(C,v),w=o.text.startsWith(m)?o.text.substring(m.length):o.text.substring(f);o=new rn(y,w)}const d=e.getValueInRange(o.range),c=LD(d,o.text);if(!c)return;const h=o.range.startLineNumber,u=new Array;if(t==="prefix"){const f=c.filter(m=>m.originalLength===0);if(f.length>1||f.length===1&&f[0].originalStart!==d.length)return}const p=o.text.length-n;for(const f of c){const m=o.range.startColumn+f.originalStart+f.originalLength;if(t==="subwordSmart"&&i&&i.lineNumber===o.range.startLineNumber&&m<i.column||f.originalLength>0)return;if(f.modifiedLength===0)continue;const _=f.modifiedStart+f.modifiedLength,v=Math.max(f.modifiedStart,Math.min(_,p)),C=o.text.substring(f.modifiedStart,v),y=o.text.substring(v,Math.max(f.modifiedStart,_));C.length>0&&u.push(new Kl(m,C,!1)),y.length>0&&u.push(new Kl(m,y,!0))}return new Pr(h,u)}function xD(a,e){return e.getStartPosition().equals(a.getStartPosition())&&e.getEndPosition().isBeforeOrEqual(a.getEndPosition())}let Jt;function LD(a,e){if((Jt==null?void 0:Jt.originalValue)===a&&(Jt==null?void 0:Jt.newValue)===e)return Jt==null?void 0:Jt.changes;{let t=Ff(a,e,!0);if(t){const i=Of(t);if(i>0){const n=Ff(a,e,!1);n&&Of(n)<i&&(t=n)}}return Jt={originalValue:a,newValue:e,changes:t},t}}function Of(a){let e=0;for(const t of a)e+=t.originalLength;return e}function Ff(a,e,t){if(a.length>5e3||e.length>5e3)return;function i(d){let c=0;for(let h=0,u=d.length;h<u;h++){const p=d.charCodeAt(h);p>c&&(c=p)}return c}const n=Math.max(i(a),i(e));function o(d){if(d<0)throw new Error("unexpected");return n+d+1}function s(d){let c=0,h=0;const u=new Int32Array(d.length);for(let p=0,f=d.length;p<f;p++)if(t&&d[p]==="("){const m=h*100+c;u[p]=o(2*m),c++}else if(t&&d[p]===")"){c=Math.max(c-1,0);const m=h*100+c;u[p]=o(2*m+1),c===0&&h++}else u[p]=d.charCodeAt(p);return u}const r=s(a),l=s(e);return new iw({getElements:()=>r},{getElements:()=>l}).ComputeDiff(!1).changes}var DD=function(a,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,e,t,i);else for(var r=a.length-1;r>=0;r--)(s=a[r])&&(o=(n<3?s(o):n>3?s(e,t,o):s(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Wf=function(a,e){return function(t,i){e(t,i,a)}};let $h=class extends N{constructor(e,t,i,n,o){super(),this.textModel=e,this.versionId=t,this._debounceValue=i,this.languageFeaturesService=n,this.languageConfigurationService=o,this._updateOperation=this._register(new ft),this.inlineCompletions=kl("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=kl("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent(()=>{this._updateOperat
|
||
|
|
Invalid subtraction between ${i.toString()} and ${o.toString()}`)),[];const d=KD(t.text,l);return n.map(c=>{const h=fD(Mf(c,o),s),u=a.getValueInRange(S.fromPositions(c,h)),p=ra(r,u),f=S.fromPositions(c,c.delta(0,p));return new rn(f,d)})}function KD(a,e){let t="";const i=gw(a);for(let n=e.lineNumber-1;n<i.length;n++)t+=i[n].substring(n===e.lineNumber-1?e.column-1:0);return t}function Zf(a){const e=pw.createSortPermutation(a,(o,s)=>S.compareRangesUsingStarts(o.range,s.range)),i=new n_(e.apply(a)).getNewRanges();return e.inverse().apply(i).map(o=>o.getEndPosition())}var qD=function(a,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,e,t,i);else for(var r=a.length-1;r>=0;r--)(s=a[r])&&(o=(n<3?s(o):n>3?s(e,t,o):s(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Xf=function(a,e){return function(t,i){e(t,i,a)}},Gs;class Kg{constructor(e){this.name=e}select(e,t,i){if(i.length===0)return 0;const n=i[0].score[0];for(let o=0;o<i.length;o++){const{score:s,completion:r}=i[o];if(s[0]!==n)break;if(r.preselect)return o}return 0}}class vb extends Kg{constructor(){super("first")}memorize(e,t,i){}toJSON(){}fromJSON(){}}class GD extends Kg{constructor(){super("recentlyUsed"),this._cache=new ta(300,.66),this._seq=0}memorize(e,t,i){const n=`${e.getLanguageId()}/${i.textLabel}`;this._cache.set(n,{touch:this._seq++,type:i.completion.kind,insertText:i.completion.insertText})}select(e,t,i){if(i.length===0)return 0;const n=e.getLineContent(t.lineNumber).substr(t.column-10,t.column-1);if(/\s$/.test(n))return super.select(e,t,i);const o=i[0].score[0];let s=-1,r=-1,l=-1;for(let d=0;d<i.length&&i[d].score[0]===o;d++){const c=`${e.getLanguageId()}/${i[d].textLabel}`,h=this._cache.peek(c);if(h&&h.touch>l&&h.type===i[d].completion.kind&&h.insertText===i[d].completion.insertText&&(l=h.touch,r=d),i[d].completion.preselect&&s===-1)return s=d}return r!==-1?r:s!==-1?s:0}toJSON(){return this._cache.toJSON()}fromJSON(e){this._cache.clear();const t=0;for(const[i,n]of e)n.touch=t,n.type=typeof n.type=="number"?n.type:ag.fromString(n.type),this._cache.set(i,n);this._seq=this._cache.size}}class ZD extends Kg{constructor(){super("recentlyUsedByPrefix"),this._trie=fw.forStrings(),this._seq=0}memorize(e,t,i){const{word:n}=e.getWordUntilPosition(t),o=`${e.getLanguageId()}/${n}`;this._trie.set(o,{type:i.completion.kind,insertText:i.completion.insertText,touch:this._seq++})}select(e,t,i){const{word:n}=e.getWordUntilPosition(t);if(!n)return super.select(e,t,i);const o=`${e.getLanguageId()}/${n}`;let s=this._trie.get(o);if(s||(s=this._trie.findSubstr(o)),s)for(let r=0;r<i.length;r++){const{kind:l,insertText:d}=i[r].completion;if(l===s.type&&d===s.insertText)return r}return super.select(e,t,i)}toJSON(){const e=[];return this._trie.forEach((t,i)=>e.push([i,t])),e.sort((t,i)=>-(t[1].touch-i[1].touch)).forEach((t,i)=>t[1].touch=i),e.slice(0,200)}fromJSON(e){if(this._trie.clear(),e.length>0){this._seq=e[0][1].touch+1;for(const[t,i]of e)i.type=typeof i.type=="number"?i.type:ag.fromString(i.type),this._trie.set(t,i)}}}let Tr=Gs=class{constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new R,this._persistSoon=new ke(()=>this._saveState(),500),this._disposables.add(e.onWillSaveState(i=>{i.reason===Zu.SHUTDOWN&&this._saveState()}))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(e,t,i){this._withStrategy(e,t).memorize(e,t,i),this._persistSoon.schedule()}select(e,t,i){return this._withStrategy(e,t).select(e,t,i)}_withStrategy(e,t){var i;const n=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:e.getLanguageIdAtPosition(t.lineNumber,t.column),resource:e.uri});if(((i=this._strategy)===null||i===void 0?void 0:i.name)!==n){this._saveState();const o=Gs._strategyCtors.get(n)||vb;this._strategy=new o;try{const r=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,l=this._storageService.get(`${Gs._storagePrefix}/${n}`,r);l&&this._strategy.fromJSON(JSON.par
|
||
|
|
`,r+=`prefix: ${(i=e.word)!==null&&i!==void 0?i:"(no prefix)"}
|
||
|
|
`,r+=`word: ${e.completion.filterText?e.completion.filterText+" (filterText)":e.textLabel}
|
||
|
|
`,r+=`distance: ${e.distance} (localityBonus-setting)
|
||
|
|
`,r+=`index: ${e.idx}, based on ${e.completion.sortText&&`sortText: "${e.completion.sortText}"`||"label"}
|
||
|
|
`,r+=`commit_chars: ${(n=e.completion.commitCharacters)===null||n===void 0?void 0:n.join("")}
|
||
|
|
`,s=new ze().appendCodeblock("empty",r),o=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!qg(e)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),o){const r=o.length>1e5?`${o.substr(0,1e5)}…`:o;this._type.textContent=r,this._type.title=r,Pt(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(r))}else si(this._type),this._type.title="",ut(this._type),this.domNode.classList.add("no-type");if(si(this._docs),typeof s=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=s;else if(s){this._docs.classList.add("markdown-docs"),si(this._docs);const r=this._markdownRenderer.render(s);this._docs.appendChild(r.element),this._renderDisposeable.add(r),this._renderDisposeable.add(this._markdownRenderer.onDidRenderAsync(()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}))}this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=r=>{r.preventDefault(),r.stopPropagation()},this._close.onclick=r=>{r.preventDefault(),r.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get isEmpty(){return this.domNode.classList.contains("no-docs")}get size(){return this._size}layout(e,t){const i=new le(e,t);le.equals(i,this._size)||(this._size=i,xw(this.domNode,e,t)),this._scrollbar.scanDomNode()}scrollDown(e=8){this._body.scrollTop+=e}scrollUp(e=8){this._body.scrollTop-=e}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}set borderWidth(e){this._borderWidth=e}get borderWidth(){return this._borderWidth}};Zh=rk([ak(1,j)],Zh);class lk{constructor(e,t){this.widget=e,this._editor=t,this.allowEditorOverflow=!0,this._disposables=new R,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new Ng,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(e.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let i,n,o=0,s=0;this._disposables.add(this._resizable.onDidWillResize(()=>{i=this._topLeft,n=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(r=>{if(i&&n){this.widget.layout(r.dimension.width,r.dimension.height);let l=!1;r.west&&(s=n.width-r.dimension.width,l=!0),r.north&&(o=n.height-r.dimension.height,l=!0),l&&this._applyTopLeft({top:i.top+o,left:i.left+s})}r.done&&(i=void 0,n=void 0,o=0,s=0,this._userSize=r.dimension)})),this._disposables.add(this.widget.onDidChangeContents(()=>{var r;this._anchorBox&&this._placeAtAnchor(this._anchorBox,(r=this._userSize)!==null&&r!==void 0?r:this.widget.size,this._preferAlignAtTop)}))}dispose(){this._resizable.dispose(),this._disposables.dispose(),this.hide()}getId(){return"suggest.details"}getDomNode(){return this._resizable.domNode}getPosition(){return this._topLeft?{preference:this._topLeft}:null}show(){this._added||(this._editor.addOverlayWidget(this),this._added=!0)}hide(e=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),e&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(e,t){var i;const n=e.getBoundingClientRect();this._anchorBox=n,this._preferAlignAtTop=t,this._placeAtAnchor(this._anchorBox,(i=this._userSize)!==null&&i!==void 0?i:this.widget.size,t)}_placeAtAnchor(e,t,i){var n;const o=oa(this.getDomNode().ownerDocument.body),s=this.widget.getLayoutInfo(),r=new le(220,2*s.lineHeight),l=e.top,d=function(){const P=o.width-(e.left+e.width+s.borderWidth+s.horizontalPadding),E=-s.borderWidth+e.left+e.width,K=new le(P,o.height-e.top-s.borderHeight-s.verticalPadding),J=K.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:l,left:E,fit:P-t.width,maxSizeTop:K,maxSizeBottom:J,minSize:r.with(Math.min(P,r.
|
||
|
|
.monaco-editor .ghost-text-decoration,
|
||
|
|
.monaco-editor .ghost-text-decoration-preview,
|
||
|
|
.monaco-editor .ghost-text {
|
||
|
|
font-family: ${_};
|
||
|
|
}`)}));const u=m=>{var _;return m.isUndoing?ct.Undo:m.isRedoing?ct.Redo:!((_=this.model.get())===null||_===void 0)&&_.isAcceptingPartially?ct.AcceptWord:ct.Other};this._register(e.onDidChangeModelContent(m=>nt(_=>this.updateObservables(_,u(m))))),this._register(e.onDidChangeCursorPosition(m=>nt(_=>{var v;this.updateObservables(_,ct.Other),(m.reason===3||m.source==="api")&&((v=this.model.get())===null||v===void 0||v.stop(_))}))),this._register(e.onDidType(()=>nt(m=>{var _;this.updateObservables(m,ct.Other),this._enabled.get()&&((_=this.model.get())===null||_===void 0||_.trigger(m))}))),this._register(this._commandService.onDidExecuteCommand(m=>{new Set([cl.Tab.id,cl.DeleteLeft.id,cl.DeleteRight.id,wv,"acceptSelectedSuggestion"]).has(m.commandId)&&e.hasTextFocus()&&this._enabled.get()&&nt(v=>{var C;(C=this.model.get())===null||C===void 0||C.trigger(v)})})),this._register(this.editor.onDidBlurEditorWidget(()=>{this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(62).keepOnBlur||dn.dropDownVisible||nt(m=>{var _;(_=this.model.get())===null||_===void 0||_.stop(m)})})),this._register(Le(m=>{var _;const v=(_=this.model.read(m))===null||_===void 0?void 0:_.state.read(m);v!=null&&v.suggestItem?v.primaryGhostText.lineCount>=2&&this._suggestWidgetAdaptor.forceRenderingAbove():this._suggestWidgetAdaptor.stopForceRenderingAbove()})),this._register(ge(()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}));const p=this._register(new R);let f;this._register(Pw({handleChange:(m,_)=>(m.didChange(this._playAccessibilitySignal)&&(f=void 0),!0)},async(m,_)=>{this._playAccessibilitySignal.read(m);const v=this.model.read(m),C=v==null?void 0:v.state.read(m);if(!v||!C||!C.inlineCompletion){f=void 0;return}if(C.inlineCompletion.semanticId!==f){p.clear(),f=C.inlineCompletion.semanticId;const y=v.textModel.getLineContent(C.primaryGhostText.lineNumber);await hd(50,Op(p)),await Ew(this._suggestWidgetAdaptor.selectedItem,Us,()=>!1,Op(p)),await this._accessibilitySignalService.playSignal(t_.inlineSuggestion),this.editor.getOption(8)&&this.provideScreenReaderUpdate(C.primaryGhostText.renderForScreenReader(y))}})),this._register(new _h(this.editor,this.model,this._instantiationService)),this._register(this._configurationService.onDidChangeConfiguration(m=>{m.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})}playAccessibilitySignal(e){this._playAccessibilitySignal.trigger(e)}provideScreenReaderUpdate(e){const t=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),i=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let n;!t&&i&&this.editor.getOption(149)&&(n=g("showAccessibleViewHint","Inspect this in the accessible view ({0})",i.getAriaLabel())),n?It(e+", "+n):It(e)}updateObservables(e,t){var i,n,o;const s=this.editor.getModel();this._textModelVersionId.set((i=s==null?void 0:s.getVersionId())!==null&&i!==void 0?i:-1,e,t),this._positions.set((o=(n=this.editor.getSelections())===null||n===void 0?void 0:n.map(r=>r.getPosition()))!==null&&o!==void 0?o:[new O(1,1)],e)}shouldShowHoverAt(e){var t;const i=(t=this.model.get())===null||t===void 0?void 0:t.primaryGhostText.get();return i?i.parts.some(n=>e.containsPosition(new O(i.lineNumber,n.column))):!1}shouldShowHoverAtViewZone(e){var t,i;return(i=(t=this._ghostTextWidgets.get()[0])===null||t===void 0?void 0:t.ownsViewZone(e))!==null&&i!==void 0?i:!1}};bt.ID="editor.contrib.inlineCompletionsController";bt=Qh=yk([Ci(1,j),Ci(2,ie),Ci(3,ue),Ci(4,Ee),Ci(5,Ft),Ci(6,H),Ci(7,e_),Ci(8,Ce),Ci(9,rd)],bt);function Ik(a,e){const t=ci("result",[]),i=[];return e.add(Le(n=>{const o=a.read(n);nt(s=>{if(o.length!==i.length){i.length=o.length;for(let r=0;r<i.length;r++)i[r]||(i[r
|
||
|
|
`);o===""&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?t.addEditOperation(new S(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber+1,1),i.endLineNumber===e.getLineCount()?"":`
|
||
|
|
`):this._isCopyingDown?t.addEditOperation(new S(i.startLineNumber,1,i.startLineNumber,1),o+`
|
||
|
|
`):t.addEditOperation(new S(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),`
|
||
|
|
`+o),this._selectionId=t.trackSelection(i),this._selectionDirection=this._selection.getDirection()}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);if(this._startLineNumberDelta!==0||this._endLineNumberDelta!==0){let n=i.startLineNumber,o=i.startColumn,s=i.endLineNumber,r=i.endColumn;this._startLineNumberDelta!==0&&(n=n+this._startLineNumberDelta,o=1),this._endLineNumberDelta!==0&&(s=s+this._endLineNumberDelta,r=1),i=V.createWithDirection(n,o,s,r,this._selectionDirection)}return i}}var yN=function(a,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,e,t,i);else for(var r=a.length-1;r>=0;r--)(s=a[r])&&(o=(n<3?s(o):n>3?s(e,t,o):s(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},IN=function(a,e){return function(t,i){e(t,i,a)}};let au=class{constructor(e,t,i,n){this._languageConfigurationService=n,this._selection=e,this._isMovingDown=t,this._autoIndent=i,this._selectionId=null,this._moveEndLineSelectionShrink=!1}getEditOperations(e,t){const i=()=>e.getLanguageId(),n=(h,u)=>e.getLanguageIdAtPosition(h,u),o=e.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===o){this._selectionId=t.trackSelection(this._selection);return}if(!this._isMovingDown&&this._selection.startLineNumber===1){this._selectionId=t.trackSelection(this._selection);return}this._moveEndPositionDown=!1;let s=this._selection;s.startLineNumber<s.endLineNumber&&s.endColumn===1&&(this._moveEndPositionDown=!0,s=s.setEndPosition(s.endLineNumber-1,e.getLineMaxColumn(s.endLineNumber-1)));const{tabSize:r,indentSize:l,insertSpaces:d}=e.getOptions(),c=this.buildIndentConverter(r,l,d);if(s.startLineNumber===s.endLineNumber&&e.getLineMaxColumn(s.startLineNumber)===1){const h=s.startLineNumber,u=this._isMovingDown?h+1:h-1;e.getLineMaxColumn(u)===1?t.addEditOperation(new S(1,1,1,1),null):(t.addEditOperation(new S(h,1,h,1),e.getLineContent(u)),t.addEditOperation(new S(u,1,u,e.getLineMaxColumn(u)),null)),s=new V(u,1,u,1)}else{let h,u;if(this._isMovingDown){h=s.endLineNumber+1,u=e.getLineContent(h),t.addEditOperation(new S(h-1,e.getLineMaxColumn(h-1),h,e.getLineMaxColumn(h)),null);let p=u;if(this.shouldAutoIndent(e,s)){const f=this.matchEnterRule(e,c,r,h,s.startLineNumber-1);if(f!==null){const _=Ae(e.getLineContent(h)),v=f+it(_,r);p=ar(v,r,d)+this.trimStart(u)}else{const _={tokenization:{getLineTokens:C=>C===s.startLineNumber?e.tokenization.getLineTokens(h):e.tokenization.getLineTokens(C),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:C=>C===s.startLineNumber?e.getLineContent(h):e.getLineContent(C)},v=tr(this._autoIndent,_,e.getLanguageIdAtPosition(h,1),s.startLineNumber,c,this._languageConfigurationService);if(v!==null){const C=Ae(e.getLineContent(h)),y=it(v,r),w=it(C,r);y!==w&&(p=ar(y,r,d)+this.trimStart(u))}}t.addEditOperation(new S(s.startLineNumber,1,s.startLineNumber,1),p+`
|
||
|
|
`);const m=this.matchEnterRuleMovingDown(e,c,r,s.startLineNumber,h,p);if(m!==null)m!==0&&this.getIndentEditsOfMovingBlock(e,t,s,r,d,m);else{const _={tokenization:{getLineTokens:C=>C===s.startLineNumber?e.tokenization.getLineTokens(h):C>=s.startLineNumber+1&&C<=s.endLineNumber+1?e.tokenization.getLineTokens(C-1):e.tokenization.getLineTokens(C),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:C=>C===s.startLineNumber?p:C>=s.startLineNumber+1&&C<=s.endLineNumber+1?e.getLineContent(C-1):e.getLineContent(C)},v=tr(this._autoIndent,_,e.getLanguageIdAtPosition(h,1),s.startLineNumber+1,c,this._languageConfigurationService);if(v!==null){const C=Ae(e.getLineContent(s.startLineNumber)),y=it(v,r),w=it(C,r);if(y!==w){const L=y-w;this.getIndentEditsOfMovingBlock(e,t,s,r,d,L)}}}}else t.addEditOperation(new S(s.startLineNumber,1,s.startLineNumber,1),p+`
|
||
|
|
`)}else if(h=s.startLineNumber-1,u=e.getLineContent(h),t.addEditOperation(new S(h,1,h+1,1),null),t.addEditOperation(new S(s.endLineNumber,e.getLineMaxColumn(s.endLineNumber),s.endLineNumber,e.getLineMaxColumn(s.endLineNumber)),`
|
||
|
|
`+u),this.shouldAutoIndent(e,s)){const p={tokenization:{getLineTokens:m=>m===h?e.tokenization.getLineTokens(s.startLineNumber):e.tokenization.getLineTokens(m),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:m=>m===h?e.getLineContent(s.startLineNumber):e.getLineContent(m)},f=this.matchEnterRule(e,c,r,s.startLineNumber,s.startLineNumber-2);if(f!==null)f!==0&&this.getIndentEditsOfMovingBlock(e,t,s,r,d,f);else{const m=tr(this._autoIndent,p,e.getLanguageIdAtPosition(s.startLineNumber,1),h,c,this._languageConfigurationService);if(m!==null){const _=Ae(e.getLineContent(s.startLineNumber)),v=it(m,r),C=it(_,r);if(v!==C){const y=v-C;this.getIndentEditsOfMovingBlock(e,t,s,r,d,y)}}}}}this._selectionId=t.trackSelection(s)}buildIndentConverter(e,t,i){return{shiftIndent:n=>ns.shiftIndent(n,n.length+1,e,t,i),unshiftIndent:n=>ns.unshiftIndent(n,n.length+1,e,t,i)}}parseEnterResult(e,t,i,n,o){if(o){let s=o.indentation;o.indentAction===Ma.None||o.indentAction===Ma.Indent?s=o.indentation+o.appendText:o.indentAction===Ma.IndentOutdent?s=o.indentation:o.indentAction===Ma.Outdent&&(s=t.unshiftIndent(o.indentation)+o.appendText);const r=e.getLineContent(n);if(this.trimStart(r).indexOf(this.trimStart(s))>=0){const l=Ae(e.getLineContent(n));let d=Ae(s);const c=C_(e,n,this._languageConfigurationService);c!==null&&c&2&&(d=t.unshiftIndent(d));const h=it(d,i),u=it(l,i);return h-u}}return null}matchEnterRuleMovingDown(e,t,i,n,o,s){if(hl(s)>=0){const r=e.getLineMaxColumn(o),l=fc(this._autoIndent,e,new S(o,r,o,r),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,l)}else{let r=n-1;for(;r>=1;){const c=e.getLineContent(r);if(hl(c)>=0)break;r--}if(r<1||n>e.getLineCount())return null;const l=e.getLineMaxColumn(r),d=fc(this._autoIndent,e,new S(r,l,r,l),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,d)}}matchEnterRule(e,t,i,n,o,s){let r=o;for(;r>=1;){let c;if(r===o&&s!==void 0?c=s:c=e.getLineContent(r),hl(c)>=0)break;r--}if(r<1||n>e.getLineCount())return null;const l=e.getLineMaxColumn(r),d=fc(this._autoIndent,e,new S(r,l,r,l),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,d)}trimStart(e){return e.replace(/^\s+/,"")}shouldAutoIndent(e,t){if(this._autoIndent<4||!e.tokenization.isCheapToTokenize(t.startLineNumber))return!1;const i=e.getLanguageIdAtPosition(t.startLineNumber,1),n=e.getLanguageIdAtPosition(t.endLineNumber,1);return!(i!==n||this._languageConfigurationService.getLanguageConfiguration(i).indentRulesSupport===null)}getIndentEditsOfMovingBlock(e,t,i,n,o,s){for(let r=i.startLineNumber;r<=i.endLineNumber;r++){const l=e.getLineContent(r),d=Ae(l),h=it(d,n)+s,u=ar(h,n,o);u!==d&&(t.addEditOperation(new S(r,1,r,d.length+1),u),r===i.endLineNumber&&i.endColumn<=d.length+1&&u===""&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&i.startLineNumber<i.endLineNumber&&(i=i.setEndPosition(i.endLineNumber,2)),i}};au=yN([IN(3,_e)],au);class on{static getCollator(){return on._COLLATOR||(on._COLLATOR=new Intl.Collator),on._COLLATOR}constructor(e,t){this.selection=e,this.descending=t,this.selectionId=null}getEditOperations(e,t){const i=xN(e,this.selection,this.descending);i&&t.addEditOperation(i.range,i.text),this.selectionId=t.trackSelection(this.selection)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}static canRun(e,t,i){if(e===null)return!1;const n=Db(e,t,i);if(!n)return!1;for(let o=0,s=n.before.length;o<s;o++)if(n.before[o]!==n.after[o])return!0;return!1}}on._COLLATOR=null;function Db(a,e,t){const i=e.startLineNumber;let n=e.endLineNumber;if(e.endColumn===1&&n--,i>=n)return null;const o=[];for(let r=i;r<=n;r++)o.push(a.getLineContent(r));let s=o.slice(0);return s.sort(on.getCollator().compare),t===!0&&(s=s.reverse()),{startLineNumber:i,endLineNumber:n,before:o,after:s}}function xN(a,e,t){const i=Db(a,e,t);return i?pe.replace(new S(i.startLineNumber,1,i.endLineNumber,a.getLineMaxColumn(i.endL
|
||
|
|
`)):null}class kb extends D{constructor(e,t){super(t),this.down=e}run(e,t){if(!t.hasModel())return;const i=t.getSelections().map((s,r)=>({selection:s,index:r,ignore:!1}));i.sort((s,r)=>S.compareRangesUsingStarts(s.selection,r.selection));let n=i[0];for(let s=1;s<i.length;s++){const r=i[s];n.selection.endLineNumber===r.selection.startLineNumber&&(n.index<r.index?r.ignore=!0:(n.ignore=!0,n=r))}const o=[];for(const s of i)o.push(new Lb(s.selection,this.down,s.ignore));t.pushUndoStop(),t.executeCommands(this.id,o),t.pushUndoStop()}}class LN extends kb{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:g("lines.copyUp","Copy Line Up"),alias:"Copy Line Up",precondition:b.writable,kbOpts:{kbExpr:b.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:M.MenubarSelectionMenu,group:"2_line",title:g({key:"miCopyLinesUp",comment:["&& denotes a mnemonic"]},"&&Copy Line Up"),order:1}})}}class DN extends kb{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:g("lines.copyDown","Copy Line Down"),alias:"Copy Line Down",precondition:b.writable,kbOpts:{kbExpr:b.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:M.MenubarSelectionMenu,group:"2_line",title:g({key:"miCopyLinesDown",comment:["&& denotes a mnemonic"]},"Co&&py Line Down"),order:2}})}}class kN extends D{constructor(){super({id:"editor.action.duplicateSelection",label:g("duplicateSelection","Duplicate Selection"),alias:"Duplicate Selection",precondition:b.writable,menuOpts:{menuId:M.MenubarSelectionMenu,group:"2_line",title:g({key:"miDuplicateSelection",comment:["&& denotes a mnemonic"]},"&&Duplicate Selection"),order:5}})}run(e,t,i){if(!t.hasModel())return;const n=[],o=t.getSelections(),s=t.getModel();for(const r of o)if(r.isEmpty())n.push(new Lb(r,!0));else{const l=new V(r.endLineNumber,r.endColumn,r.endLineNumber,r.endColumn);n.push(new Kw(l,s.getValueInRange(r)))}t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class Nb extends D{constructor(e,t){super(t),this.down=e}run(e,t){const i=e.get(_e),n=[],o=t.getSelections()||[],s=t.getOption(12);for(const r of o)n.push(new au(r,this.down,s,i));t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class NN extends Nb{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:g("lines.moveUp","Move Line Up"),alias:"Move Line Up",precondition:b.writable,kbOpts:{kbExpr:b.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:M.MenubarSelectionMenu,group:"2_line",title:g({key:"miMoveLinesUp",comment:["&& denotes a mnemonic"]},"Mo&&ve Line Up"),order:3}})}}class RN extends Nb{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:g("lines.moveDown","Move Line Down"),alias:"Move Line Down",precondition:b.writable,kbOpts:{kbExpr:b.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:M.MenubarSelectionMenu,group:"2_line",title:g({key:"miMoveLinesDown",comment:["&& denotes a mnemonic"]},"Move &&Line Down"),order:4}})}}class Rb extends D{constructor(e,t){super(t),this.descending=e}run(e,t){if(!t.hasModel())return;const i=t.getModel();let n=t.getSelections();n.length===1&&n[0].isEmpty()&&(n=[new V(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))]);for(const s of n)if(!on.canRun(t.getModel(),s,this.descending))return;const o=[];for(let s=0,r=n.length;s<r;s++)o[s]=new on(n[s],this.descending);t.pushUndoStop(),t.executeCommands(this.id,o),t.pushUndoStop()}}class MN extends Rb{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:g("lines.sortAscending","Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:b.writable})}}class PN extends Rb{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:g("lines.sortDescending","Sort Lines Descending"),alias:"Sort Lines Descending",precondition:b.writable})}}class EN extends D{constructor(){super({id:"editor.action.removeDuplicateLines",label:g("lines.deleteDuplicates","Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:b.writable})}run(e,t){if(!t.hasModel())return
|
||
|
|
`))),o.push(f),s+=d.endLineNumber-d.startLineNumber+1-h.length}t.pushUndoStop(),t.executeEdits(this.id,n,r?o:void 0),t.pushUndoStop()}}class ec extends D{constructor(){super({id:ec.ID,label:g("lines.trimTrailingWhitespace","Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:b.writable,kbOpts:{kbExpr:b.editorTextFocus,primary:Ie(2089,2102),weight:100}})}run(e,t,i){let n=[];i.reason==="auto-save"&&(n=(t.getSelections()||[]).map(c=>new O(c.positionLineNumber,c.positionColumn)));const o=t.getSelection();if(o===null)return;const s=e.get(ue),r=t.getModel(),l=s.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:r==null?void 0:r.getLanguageId(),resource:r==null?void 0:r.uri}),d=new SN(o,n,l);t.pushUndoStop(),t.executeCommands(this.id,[d]),t.pushUndoStop()}}ec.ID="editor.action.trimTrailingWhitespace";class TN extends D{constructor(){super({id:"editor.action.deleteLines",label:g("lines.delete","Delete Line"),alias:"Delete Line",precondition:b.writable,kbOpts:{kbExpr:b.textInputFocus,primary:3113,weight:100}})}run(e,t){if(!t.hasModel())return;const i=this._getLinesToRemove(t),n=t.getModel();if(n.getLineCount()===1&&n.getLineMaxColumn(1)===1)return;let o=0;const s=[],r=[];for(let l=0,d=i.length;l<d;l++){const c=i[l];let h=c.startLineNumber,u=c.endLineNumber,p=1,f=n.getLineMaxColumn(u);u<n.getLineCount()?(u+=1,f=1):h>1&&(h-=1,p=n.getLineMaxColumn(h)),s.push(pe.replace(new V(h,p,u,f),"")),r.push(new V(h-o,c.positionColumn,h-o,c.positionColumn)),o+=c.endLineNumber-c.startLineNumber+1}t.pushUndoStop(),t.executeEdits(this.id,s,r),t.pushUndoStop()}_getLinesToRemove(e){const t=e.getSelections().map(o=>{let s=o.endLineNumber;return o.startLineNumber<o.endLineNumber&&o.endColumn===1&&(s-=1),{startLineNumber:o.startLineNumber,selectionStartColumn:o.selectionStartColumn,endLineNumber:s,positionColumn:o.positionColumn}});t.sort((o,s)=>o.startLineNumber===s.startLineNumber?o.endLineNumber-s.endLineNumber:o.startLineNumber-s.startLineNumber);const i=[];let n=t[0];for(let o=1;o<t.length;o++)n.endLineNumber+1>=t[o].startLineNumber?n.endLineNumber=t[o].endLineNumber:(i.push(n),n=t[o]);return i.push(n),i}}class AN extends D{constructor(){super({id:"editor.action.indentLines",label:g("lines.indent","Indent Line"),alias:"Indent Line",precondition:b.writable,kbOpts:{kbExpr:b.editorTextFocus,primary:2142,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,cg.indent(i.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}}class ON extends D{constructor(){super({id:"editor.action.outdentLines",label:g("lines.outdent","Outdent Line"),alias:"Outdent Line",precondition:b.writable,kbOpts:{kbExpr:b.editorTextFocus,primary:2140,weight:100}})}run(e,t){cl.Outdent.runEditorCommand(e,t,null)}}class FN extends D{constructor(){super({id:"editor.action.insertLineBefore",label:g("lines.insertBefore","Insert Line Above"),alias:"Insert Line Above",precondition:b.writable,kbOpts:{kbExpr:b.editorTextFocus,primary:3075,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,cg.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}}class WN extends D{constructor(){super({id:"editor.action.insertLineAfter",label:g("lines.insertAfter","Insert Line Below"),alias:"Insert Line Below",precondition:b.writable,kbOpts:{kbExpr:b.editorTextFocus,primary:2051,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,cg.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}}class Mb extends D{run(e,t){if(!t.hasModel())return;const i=t.getSelection(),n=this._getRangesToDelete(t),o=[];for(let l=0,d=n.length-1;l<d;l++){const c=n[l],h=n[l+1];S.intersectRanges(c,h)===null?o.push(c):n[l+1]=S.plusRange(c,h)}o.push(n[n.length-1]);const s=this._getEndCursorState(i,o),r=o.map(l=>pe.replace(l,""));t.pushUndoStop(),t.executeEdits(this.id,r,s),t.pushUndoStop()}}class HN extends Mb{constructor(){super({id:"deleteAllLeft",label:g("lines.deleteAllLeft","Delete All Left"),alias:"Delete All Left",precondi
|
||
|
|
`);return new Vr(e,t,n,d,o,s,c)}constructor(e,t,i,n,o,s,r){this._editor=e,this.findController=t,this.isDisconnectedFromFindController=i,this.searchText=n,this.wholeWord=o,this.matchCase=s,this.currentMatch=r}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new ol(t.concat(e),e,0)}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new ol(t.slice(0,t.length-1).concat(e),e,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const n=this.currentMatch;return this.currentMatch=null,n}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findNextMatch(this.searchText,t.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(131):null,!1);return i?new V(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new ol(t.concat(e),e,0)}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new ol(t.slice(0,t.length-1).concat(e),e,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const n=this.currentMatch;return this.currentMatch=null,n}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findPreviousMatch(this.searchText,t.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(131):null,!1);return i?new V(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}selectAll(e){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();const t=this._editor.getModel();return e?t.findMatches(this.searchText,e,!1,this.matchCase,this.wholeWord?this._editor.getOption(131):null,!1,1073741824):t.findMatches(this.searchText,!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(131):null,!1,1073741824)}}class eo extends N{static get(e){return e.getContribution(eo.ID)}constructor(e){super(),this._sessionDispose=this._register(new R),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=Vr.create(this._editor,e);if(!t)return;this._session=t;const i={searchString:this._session.searchText};this._session.isDisconnectedFromFindController&&(i.wholeWordOverride=1,i.matchCaseOverride=1,i.isRegexOverride=2),e.getState().change(i,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection(n=>{this._ignoreSelectionChange||this._endSession()})),this._sessionDispose.add(this._editor.onDidBlurEditorText(()=>{this._endSession()})),this._sessionDispose.add(e.getState().onFindReplaceStateChange(n=>{(n.matchCase||n.wholeWord)&&this._endSession()}))}}_endSession(){if(this._sessionDispose.clear(),this._session&&this._session.isDisconnectedFromFindController){const e={wholeWordOverride:0,matchCaseOverride:0,isRegexOverride:0};this._session.findController.getState().change(e,!1)}this._session=null}_setSelections(e){this._ignoreSelectionChange=!0,this._editor.setSelections(e),this._ignoreSelectionChange=!1}_expandEmptyToWord(e,t){if(!t.isEmpty())return t;const i=this._editor.getConfiguredWordAtPosition(t.getStartPosition());return i?new V(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):t}_applySessionResult(e){e&&(this._setSelections(e.selections),e.revealRange&&this._editor.revealRangeInCenterIfOutsideViewport(e.revealRange,e.revealScrollType))}getSession(e){return this._session}addSelectionToNextFindMatch(e){if(this._editor.hasModel()){if(!this._session){const t=this._editor.getSelections();if(t.length>1){const n=e
|
||
|
|
.monaco-editor .inline-edit-decoration,
|
||
|
|
.monaco-editor .inline-edit-decoration-preview,
|
||
|
|
.monaco-editor .inline-edit {
|
||
|
|
font-family: ${p};
|
||
|
|
}`)})),this._register(new uu(this.editor,this._currentEdit,this.instantiationService))}checkCursorPosition(e){var t;if(!this._currentEdit){this._isCursorAtInlineEditContext.set(!1);return}const i=(t=this._currentEdit.get())===null||t===void 0?void 0:t.edit;if(!i){this._isCursorAtInlineEditContext.set(!1);return}this._isCursorAtInlineEditContext.set(S.containsPosition(i.range,e))}validateInlineEdit(e,t){var i,n;if(t.text.includes(`
|
||
|
|
`)&&t.range.startLineNumber!==t.range.endLineNumber&&t.range.startColumn!==t.range.endColumn){if(t.range.startColumn!==1)return!1;const s=t.range.endLineNumber,r=t.range.endColumn,l=(n=(i=e.getModel())===null||i===void 0?void 0:i.getLineLength(s))!==null&&n!==void 0?n:0;if(r!==l+1)return!1}return!0}async fetchInlineEdit(e,t){this._currentRequestCts&&this._currentRequestCts.dispose(!0);const i=e.getModel();if(!i)return;const n=i.getVersionId(),o=this.languageFeaturesService.inlineEditProvider.all(i);if(o.length===0)return;const s=o[0];this._currentRequestCts=new Oe;const r=this._currentRequestCts.token,l=t?Hp.Automatic:Hp.Invoke;if(t&&await TR(50,r),r.isCancellationRequested||i.isDisposed()||i.getVersionId()!==n)return;const c=await s.provideInlineEdit(i,{triggerKind:l},r);if(c&&!(r.isCancellationRequested||i.isDisposed()||i.getVersionId()!==n)&&this.validateInlineEdit(e,c))return c}async getInlineEdit(e,t){var i;this._isCursorAtInlineEditContext.set(!1),await this.clear();const n=await this.fetchInlineEdit(e,t);if(!n)return;const o=n.range.endLineNumber,s=n.range.endColumn,r=n.text.endsWith(`
|
||
|
|
`)&&!(n.range.startLineNumber===n.range.endLineNumber&&n.range.startColumn===n.range.endColumn)?n.text.slice(0,-1):n.text,l=new Pr(o,[new Kl(s,r,!1)]),d=this.instantiationService.createInstance(hu,this.editor,{ghostText:Nn(l),minReservedLineCount:Nn(0),targetTextModel:Nn((i=this.editor.getModel())!==null&&i!==void 0?i:void 0),range:Nn(n.range),backgroundColoring:this._backgroundColoring});this._currentEdit.set(new ER(d,n),void 0)}async trigger(){await this.getInlineEdit(this.editor,!1)}async jumpBack(){this._jumpBackPosition&&(this.editor.setPosition(this._jumpBackPosition),this.editor.revealPositionInCenterIfOutsideViewport(this._jumpBackPosition))}async accept(){var e;this._isAccepting.set(!0,void 0);const t=(e=this._currentEdit.get())===null||e===void 0?void 0:e.edit;if(!t)return;let i=t.text;t.text.startsWith(`
|
||
|
|
`)&&(i=t.text.substring(1)),this.editor.pushUndoStop(),this.editor.executeEdits("acceptCurrent",[pe.replace(S.lift(t.range),i)]),t.accepted&&await this._commandService.executeCommand(t.accepted.id,...t.accepted.arguments||[]).then(void 0,me),this.freeEdit(t),nt(n=>{this._currentEdit.set(void 0,n),this._isAccepting.set(!1,n)})}jumpToCurrent(){var e,t;this._jumpBackPosition=(e=this.editor.getSelection())===null||e===void 0?void 0:e.getStartPosition();const i=(t=this._currentEdit.get())===null||t===void 0?void 0:t.edit;if(!i)return;const n=O.lift({lineNumber:i.range.startLineNumber,column:i.range.startColumn});this.editor.setPosition(n),this.editor.revealPositionInCenterIfOutsideViewport(n)}async clear(e=!0){var t;const i=(t=this._currentEdit.get())===null||t===void 0?void 0:t.edit;i&&(i!=null&&i.rejected)&&e&&await this._commandService.executeCommand(i.rejected.id,...i.rejected.arguments||[]).then(void 0,me),i&&this.freeEdit(i),this._currentEdit.set(void 0,void 0)}freeEdit(e){const t=this.editor.getModel();if(!t)return;const i=this.languageFeaturesService.inlineEditProvider.all(t);i.length!==0&&i[0].freeInlineEdit(e)}shouldShowHoverAt(e){const t=this._currentEdit.get();if(!t)return!1;const i=t.edit,n=t.widget.model;if(S.containsPosition(i.range,e.getStartPosition())||S.containsPosition(i.range,e.getEndPosition()))return!0;const s=n.ghostText.get();return s?s.parts.some(r=>e.containsPosition(new O(s.lineNumber,r.column))):!1}shouldShowHoverAtViewZone(e){var t,i;return(i=(t=this._currentEdit.get())===null||t===void 0?void 0:t.widget.ownsViewZone(e))!==null&&i!==void 0?i:!1}};ye.ID="editor.contrib.inlineEditController";ye.inlineEditVisibleKey="inlineEditVisible";ye.inlineEditVisibleContext=new Y(Mn.inlineEditVisibleKey,!1);ye.cursorAtInlineEditKey="cursorAtInlineEdit";ye.cursorAtInlineEditContext=new Y(Mn.cursorAtInlineEditKey,!1);ye=Mn=PR([Vs(1,j),Vs(2,ie),Vs(3,H),Vs(4,Ee),Vs(5,ue)],ye);function TR(a,e){return new Promise(t=>{let i;const n=setTimeout(()=>{i&&i.dispose(),t()},a);e&&(i=e.onCancellationRequested(()=>{clearTimeout(n),i&&i.dispose(),t()}))})}class AR extends D{constructor(){super({id:xR,label:"Accept Inline Edit",alias:"Accept Inline Edit",precondition:x.and(b.writable,ye.inlineEditVisibleContext),kbOpts:[{weight:101,primary:2,kbExpr:x.and(b.writable,ye.inlineEditVisibleContext,ye.cursorAtInlineEditContext)}],menuOpts:[{menuId:M.InlineEditToolbar,title:"Accept",group:"primary",order:1}]})}async run(e,t){const i=ye.get(t);await(i==null?void 0:i.accept())}}class OR extends D{constructor(){const e=x.and(b.writable,x.not(ye.inlineEditVisibleKey));super({id:"editor.action.inlineEdit.trigger",label:"Trigger Inline Edit",alias:"Trigger Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e}})}async run(e,t){const i=ye.get(t);i==null||i.trigger()}}class FR extends D{constructor(){const e=x.and(b.writable,ye.inlineEditVisibleContext,x.not(ye.cursorAtInlineEditKey));super({id:DR,label:"Jump to Inline Edit",alias:"Jump to Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e},menuOpts:[{menuId:M.InlineEditToolbar,title:"Jump To Edit",group:"primary",order:3,when:e}]})}async run(e,t){const i=ye.get(t);i==null||i.jumpToCurrent()}}class WR extends D{constructor(){const e=x.and(b.writable,ye.cursorAtInlineEditContext);super({id:kR,label:"Jump Back from Inline Edit",alias:"Jump Back from Inline Edit",precondition:e,kbOpts:{weight:110,primary:2646,kbExpr:e},menuOpts:[{menuId:M.InlineEditToolbar,title:"Jump Back",group:"primary",order:3,when:e}]})}async run(e,t){const i=ye.get(t);i==null||i.jumpBack()}}class HR extends D{constructor(){const e=x.and(b.writable,ye.inlineEditVisibleContext);super({id:LR,label:"Reject Inline Edit",alias:"Reject Inline Edit",precondition:e,kbOpts:{weight:100,primary:9,kbExpr:e},menuOpts:[{menuId:M.InlineEditToolbar,title:"Reject",group:"secondary",order:2}]})}async run(e,t){const i=ye.get(t);await(i==null?void 0:i.clear())}}var VR=function(a,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect
|
||
|
|
`):void 0}:{range:S.fromPositions(this.position),text:"",rejectReason:t.length>0?t.join(`
|
||
|
|
`):void 0}}async provideRenameEdits(e,t){return this._provideRenameEdits(e,this._providerRenameIdx,[],t)}async _provideRenameEdits(e,t,i,n){const o=this._providers[t];if(!o)return{edits:[],rejectReason:i.join(`
|
||
|
|
`)};const s=await o.provideRenameEdits(this.model,this.position,e,n);if(s){if(s.rejectReason)return this._provideRenameEdits(e,t+1,i.concat(s.rejectReason),n)}else return this._provideRenameEdits(e,t+1,i.concat(g("no result","No result.")),n);return s}}async function YR(a,e,t,i){const n=new Jg(e,t,a),o=await n.resolveRenameLocation(X.None);return o!=null&&o.rejectReason?{edits:[],rejectReason:o.rejectReason}:n.provideRenameEdits(i,X.None)}let Ti=vu=class{static get(e){return e.getContribution(vu.ID)}constructor(e,t,i,n,o,s,r,l,d){this.editor=e,this._instaService=t,this._notificationService=i,this._bulkEditService=n,this._progressService=o,this._logService=s,this._configService=r,this._languageFeaturesService=l,this._telemetryService=d,this._disposableStore=new R,this._cts=new Oe,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(_u,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){var e,t;const i=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new Oe,!this.editor.hasModel()){i("editor has no model");return}const n=this.editor.getPosition(),o=new Jg(this.editor.getModel(),n,this._languageFeaturesService.renameProvider);if(!o.hasProvider()){i("skeleton has no provider");return}const s=new Zo(this.editor,5,void 0,this._cts.token);let r;try{i("resolving rename location");const _=o.resolveRenameLocation(s.token);this._progressService.showWhile(_,250),r=await _,i("resolved rename location")}catch(_){_ instanceof Ju?i("resolve rename location cancelled",JSON.stringify(_,null," ")):(i("resolve rename location failed",_ instanceof Error?_:JSON.stringify(_,null," ")),(typeof _=="string"||al(_))&&((e=Ge.get(this.editor))===null||e===void 0||e.showMessage(_||g("resolveRenameLocationFailed","An unknown error occurred while resolving rename location"),n)));return}finally{s.dispose()}if(!r){i("returning early - no loc");return}if(r.rejectReason){i(`returning early - rejected with reason: ${r.rejectReason}`,r.rejectReason),(t=Ge.get(this.editor))===null||t===void 0||t.showMessage(r.rejectReason,n);return}if(s.token.isCancellationRequested){i("returning early - cts1 cancelled");return}const l=new Zo(this.editor,5,r.range,this._cts.token),d=this.editor.getModel(),c=this._languageFeaturesService.newSymbolNamesProvider.all(d),h=await Promise.all(c.map(async _=>{var v;return[_,(v=await _.supportsAutomaticNewSymbolNamesTriggerKind)!==null&&v!==void 0?v:!1]})),u=(_,v)=>{let C=h.slice();return _===th.Automatic&&(C=C.filter(([y,w])=>w)),C.map(([y])=>y.provideNewSymbolNames(d,r.range,_,v))};i("creating rename input field and awaiting its result");const p=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),f=await this._renameWidget.getInput(r.range,r.text,p,c.length>0?u:void 0,l);if(i("received response from rename input field"),c.length>0&&this._reportTelemetry(c.length,d.getLanguageId(),f),typeof f=="boolean"){i(`returning early - rename input field response - ${f}`),f&&this.editor.focus(),l.dispose();return}this.editor.focus(),i("requesting rename edits");const m=Qr(o.provideRenameEdits(f.newName,l.token),l.token).then(async _=>{if(!_){i("returning early - no rename edits result");return}if(!this.editor.hasModel()){i("returning early - no model after rename edits are provided");return}if(_.rejectReason){i(`returning early - rejected with reason: ${_.rejectReason}`),this._notificationService.info(_.rejectReason);return}this.editor.setSelection(S.fromPositions(this.editor.getSelection().getPosition())),i("applying edits"),this._bulkEditService.apply(_,{editor:this.editor,showPreview:f.wantsPreview,label:g("label","Renaming '{0}' to '{1}'",r==null?void 0:r.text,f.newName),code:"undoredo.rename",quotableLabel:g("quotableLabel","Renaming {0} to {1}",r==null?void 0:r.text,f.newName),respectAutoSaveConfig:!0}).then(v=>{i("edits applied"),v.ariaSummary&&It(g("aria","Successfully renamed '{0}' to '{1}'. Summary:
|
||
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
|
* Version: 0.50.0(c321d0fbecb50ab8a5365fa1965476b0ae63fc87)
|
||
|
|
* Released under the MIT license
|
||
|
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
||
|
|
*-----------------------------------------------------------------------------*/var WP=Object.defineProperty,HP=Object.getOwnPropertyDescriptor,VP=Object.getOwnPropertyNames,BP=Object.prototype.hasOwnProperty,UP=(a,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of VP(e))!BP.call(a,n)&&n!==t&&WP(a,n,{get:()=>e[n],enumerable:!(i=HP(e,n))||i.enumerable});return a},zP=(a,e,t)=>(UP(a,e,"default"),t),Rs={};zP(Rs,fg);var dp=class{constructor(e,t,i){this._onDidChange=new Rs.Emitter,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this.options}get options(){return this._options}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setDiagnosticsOptions(e){this.setOptions(e)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},cp={validate:!0,lint:{compatibleVendorPrefixes:"ignore",vendorPrefix:"warning",duplicateProperties:"warning",emptyRules:"warning",importStatement:"ignore",boxModel:"ignore",universalSelector:"ignore",zeroUnits:"ignore",fontFaceProperties:"warning",hexColorLength:"error",argumentsInColorFunction:"error",unknownProperties:"warning",ieHack:"ignore",unknownVendorSpecificProperties:"ignore",propertyIgnoredDueToDisplay:"warning",important:"ignore",float:"ignore",idSelector:"ignore"},data:{useDefaultDataProvider:!0},format:{newlineBetweenSelectors:!0,newlineBetweenRules:!0,spaceAroundSelectorSeparator:!1,braceStyle:"collapse",maxPreserveNewLines:void 0,preserveNewLines:!0}},hp={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0,documentFormattingEdits:!0,documentRangeFormattingEdits:!0},lC=new dp("css",cp,hp),dC=new dp("scss",cp,hp),cC=new dp("less",cp,hp);Rs.languages.css={cssDefaults:lC,lessDefaults:cC,scssDefaults:dC};function up(){return _d(()=>import("./cssMode-BCN7etFc.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}Rs.languages.onLanguage("less",()=>{up().then(a=>a.setupMode(cC))});Rs.languages.onLanguage("scss",()=>{up().then(a=>a.setupMode(dC))});Rs.languages.onLanguage("css",()=>{up().then(a=>a.setupMode(lC))});/*!-----------------------------------------------------------------------------
|
||
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
|
* Version: 0.50.0(c321d0fbecb50ab8a5365fa1965476b0ae63fc87)
|
||
|
|
* Released under the MIT license
|
||
|
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
||
|
|
*-----------------------------------------------------------------------------*/var $P=Object.defineProperty,jP=Object.getOwnPropertyDescriptor,KP=Object.getOwnPropertyNames,qP=Object.prototype.hasOwnProperty,GP=(a,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of KP(e))!qP.call(a,n)&&n!==t&&$P(a,n,{get:()=>e[n],enumerable:!(i=jP(e,n))||i.enumerable});return a},ZP=(a,e,t)=>(GP(a,e,"default"),t),Sa={};ZP(Sa,fg);var XP=class{constructor(a,e,t){this._onDidChange=new Sa.Emitter,this._languageId=a,this.setDiagnosticsOptions(e),this.setModeConfiguration(t)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(a){this._diagnosticsOptions=a||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(a){this._modeConfiguration=a||Object.create(null),this._onDidChange.fire(this)}},YP={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},QP={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},hC=new XP("json",YP,QP),JP=()=>uC().then(a=>a.getWorker());Sa.languages.json={jsonDefaults:hC,getWorker:JP};function uC(){return _d(()=>import("./jsonMode-Buquy9zE.js"),__vite__mapDeps([5,1,2,3,4]),import.meta.url)}Sa.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});Sa.languages.onLanguage("json",()=>{uC().then(a=>a.setupMode(hC))});/*!-----------------------------------------------------------------------------
|
||
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
|
* Version: 0.50.0(c321d0fbecb50ab8a5365fa1965476b0ae63fc87)
|
||
|
|
* Released under the MIT license
|
||
|
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
||
|
|
*-----------------------------------------------------------------------------*/var eE=Object.defineProperty,tE=Object.getOwnPropertyDescriptor,iE=Object.getOwnPropertyNames,nE=Object.prototype.hasOwnProperty,oE=(a,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of iE(e))!nE.call(a,n)&&n!==t&&eE(a,n,{get:()=>e[n],enumerable:!(i=tE(e,n))||i.enumerable});return a},sE=(a,e,t)=>(oE(a,e,"default"),t),Js={};sE(Js,fg);var gC={},$c={},rE=class pC{static getOrCreate(e){return $c[e]||($c[e]=new pC(e)),$c[e]}constructor(e){this._languageId=e,this._loadingTriggered=!1,this._lazyLoadPromise=new Promise((t,i)=>{this._lazyLoadPromiseResolve=t,this._lazyLoadPromiseReject=i})}load(){return this._loadingTriggered||(this._loadingTriggered=!0,gC[this._languageId].loader().then(e=>this._lazyLoadPromiseResolve(e),e=>this._lazyLoadPromiseReject(e))),this._lazyLoadPromise}};function fC(a){const e=a.id;gC[e]=a,Js.languages.register(a);const t=rE.getOrCreate(e);Js.languages.registerTokensProviderFactory(e,{create:async()=>(await t.load()).language}),Js.languages.onLanguageEncountered(e,async()=>{const i=await t.load();Js.languages.setLanguageConfiguration(e,i.conf)})}fC({id:"css",extensions:[".css"],aliases:["CSS","css"],mimetypes:["text/css"],loader:()=>_d(()=>import("./css-BfLuTCmN.js"),[],import.meta.url)});fC({id:"markdown",extensions:[".md",".markdown",".mdown",".mkdn",".mkd",".mdwn",".mdtxt",".mdtext"],aliases:["Markdown","markdown"],loader:()=>_d(()=>import("./markdown-BXYnMxBe.js"),[],import.meta.url)});
|