@chillicream/nitro-embedded 32.0.0-insider.8 → 32.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/context-providers.eb0f9c1e.d_1sxt2-.js +6737 -0
- package/assets/{editor.worker.fa746e77.T3jfs7I_.js → editor.worker.eb0f9c1e.CPSH5_7o.js} +1 -1
- package/assets/graphql-engine-scheduler.eb0f9c1e.BwYTNJtE.js +363 -0
- package/assets/graphql-indexer-scheduler.eb0f9c1e.CZ7x4nfh.js +270 -0
- package/assets/graphql.worker.eb0f9c1e.DozJBJdY.js +317 -0
- package/assets/index.eb0f9c1e.BltwUsAV.js +39 -0
- package/assets/{json.worker.fa746e77.CxIAIyle.js → json.worker.eb0f9c1e.GAJVQ_Ac.js} +1 -1
- package/assets/{jsonMode.fa746e77.DT27TKkD.js → jsonMode.eb0f9c1e.C3ukgfVD.js} +1 -1
- package/assets/main.eb0f9c1e.D9a6EbRi.js +603 -0
- package/assets/{monaco.fa746e77.DSc437aS.css → monaco.eb0f9c1e.BxVJuD1y.css} +1 -1
- package/assets/{monaco.fa746e77.BD9eCg41.js → monaco.eb0f9c1e.CiFWjB0j.js} +6 -6
- package/assets/{monaco.fa746e77.Bgr_ZGqO.css → monaco.eb0f9c1e.DAGxi9tN.css} +1 -1
- package/assets/session-scheduler.eb0f9c1e.Dj_pvu9w.js +270 -0
- package/assets/{yaml.fa746e77.CUpalURV.js → yaml.eb0f9c1e.DNvATgZi.js} +1 -1
- package/assets/{yaml.worker.fa746e77.CY43AHj0.js → yaml.worker.eb0f9c1e.CQeMr55x.js} +1 -1
- package/favicon.ico +0 -0
- package/favicon.svg +4 -4
- package/index.html +5 -5
- package/package.json +1 -1
- package/service-worker.js +1 -1
- package/assets/context-providers.fa746e77.lY_QdRdj.js +0 -4070
- package/assets/graphql-engine-scheduler.fa746e77.BTQJ_285.js +0 -436
- package/assets/graphql-indexer-scheduler.fa746e77.BGflz_GU.js +0 -345
- package/assets/graphql.worker.fa746e77.BwLF1ib4.js +0 -328
- package/assets/index.fa746e77.Vga-pS89.js +0 -32
- package/assets/main.fa746e77.BTVlfkMG.js +0 -5615
- package/assets/session-scheduler.fa746e77.C9Tq9F_9.js +0 -345
- /package/assets/{FiraCode-Medium.fa746e77.-YTCSZkP.woff2 → FiraCode-Medium.eb0f9c1e.-YTCSZkP.woff2} +0 -0
- /package/assets/{codicon.fa746e77.Hscy-R9e.ttf → codicon.eb0f9c1e.Hscy-R9e.ttf} +0 -0
- /package/assets/{context-providers.fa746e77.3HkX5s82.css → context-providers.eb0f9c1e.3HkX5s82.css} +0 -0
- /package/assets/{main.fa746e77.BdMtxJz7.css → main.eb0f9c1e.BdMtxJz7.css} +0 -0
- /package/assets/{monaco.fa746e77.C81nzcW9.js → monaco.eb0f9c1e.D0z7AHed.js} +0 -0
- /package/assets/{monaco.fa746e77.Berr_lG6.js → monaco.eb0f9c1e.DFXJF4sG.js} +0 -0
- /package/assets/{monaco.fa746e77.wPd_MMVI.js → monaco.eb0f9c1e.De8cDpD3.js} +0 -0
- /package/assets/{monaco.fa746e77.vcoSoN6S.js → monaco.eb0f9c1e.DkQhus17.js} +0 -0
- /package/assets/{monaco.fa746e77.Br8woclc.js → monaco.eb0f9c1e.wTso0TWV.js} +0 -0
|
@@ -638,18 +638,18 @@ ${e.toString()}`}}class Dw{constructor(e=new xv,t=!1,i,n=gre){var s;this._servic
|
|
|
638
638
|
`:`\r
|
|
639
639
|
`),await this._clipboardService.writeText(w)})),i.getOption(90)||v.push(new cs("diff.inline.revertChange",p("diff.inline.revertChange.label","Revert this change"),void 0,!0,async()=>{this._editor.revert(this._diff)})),v},autoSelectFirstItem:!0})};this._register(vi(this._diffActions,"mousedown",f=>{if(!f.leftButton)return;const{top:m,height:_}=ji(this._diffActions),v=Math.floor(c/3);f.preventDefault(),g(f.posx,m+_+v)})),this._register(i.onMouseMove(f=>{(f.target.type===8||f.target.type===5)&&f.target.detail.viewZoneId===this._getViewZoneId()?(h=this._updateLightBulbPosition(this._marginDomNode,f.event.browserEvent.y,c),this.visibility=!0):this.visibility=!1})),this._register(i.onMouseDown(f=>{f.event.leftButton&&(f.target.type===8||f.target.type===5)&&f.target.detail.viewZoneId===this._getViewZoneId()&&(f.event.preventDefault(),h=this._updateLightBulbPosition(this._marginDomNode,f.event.browserEvent.y,c),g(f.event.posx,f.event.posy+c))}))}_updateLightBulbPosition(e,t,i){const{top:n}=ji(e),s=t-n,r=Math.floor(s/i),a=r*i;if(this._diffActions.style.top=`${a}px`,this._viewLineCounts){let l=0;for(let d=0;d<this._viewLineCounts.length;d++)if(l+=this._viewLineCounts[d],r<l)return d}return r}}const IF=vd("diffEditorWidget",{createHTML:o=>o});function Dae(o,e,t,i){Tn(i,e.fontInfo);const n=t.length>0,s=new Op(1e4);let r=0,a=0;const l=[];for(let u=0;u<o.lineTokens.length;u++){const g=u+1,f=o.lineTokens[u],m=o.lineBreakData[u],_=Ws.filter(t,g,1,Number.MAX_SAFE_INTEGER);if(m){let v=0;for(const b of m.breakOffsets){const C=f.sliceAndInflate(v,b,0);r=Math.max(r,EF(a,C,Ws.extractWrapped(_,v,b),n,o.mightContainNonBasicASCII,o.mightContainRTL,e,s)),a++,v=b}l.push(m.breakOffsets.length)}else l.push(1),r=Math.max(r,EF(a,f,_,n,o.mightContainNonBasicASCII,o.mightContainRTL,e,s)),a++}r+=e.scrollBeyondLastColumn;const d=s.build(),c=IF?IF.createHTML(d):d;i.innerHTML=c;const h=r*e.typicalHalfwidthCharacterWidth;return{heightInLines:a,minWidthInPx:h,viewLineCounts:l}}class kae{constructor(e,t,i,n){this.lineTokens=e,this.lineBreakData=t,this.mightContainNonBasicASCII=i,this.mightContainRTL=n}}class dR{static fromEditor(e){var t;const i=e.getOptions(),n=i.get(50),s=i.get(143);return new dR(((t=e.getModel())===null||t===void 0?void 0:t.getOptions().tabSize)||0,n,i.get(33),n.typicalHalfwidthCharacterWidth,i.get(103),i.get(66),s.decorationsWidth,i.get(116),i.get(98),i.get(93),i.get(51))}constructor(e,t,i,n,s,r,a,l,d,c,h){this.tabSize=e,this.fontInfo=t,this.disableMonospaceOptimizations=i,this.typicalHalfwidthCharacterWidth=n,this.scrollBeyondLastColumn=s,this.lineHeight=r,this.lineDecorationsWidth=a,this.stopRenderingLineAfter=l,this.renderWhitespace=d,this.renderControlCharacters=c,this.fontLigatures=h}}function EF(o,e,t,i,n,s,r,a){a.appendString('<div class="view-line'),i||a.appendString(" char-delete"),a.appendString('" style="top:'),a.appendString(String(o*r.lineHeight)),a.appendString('px;width:1000000px;">');const l=e.getLineContent(),d=Lo.isBasicASCII(l,n),c=Lo.containsRTL(l,d,s),h=mv(new rh(r.fontInfo.isMonospace&&!r.disableMonospaceOptimizations,r.fontInfo.canUseHalfwidthRightwardsArrow,l,!1,d,c,0,e,t,r.tabSize,0,r.fontInfo.spaceWidth,r.fontInfo.middotWidth,r.fontInfo.wsmiddotWidth,r.stopRenderingLineAfter,r.renderWhitespace,r.renderControlCharacters,r.fontLigatures!==uo.OFF,null),a);return a.appendString("</div>"),h.characterMapping.getHorizontalOffset(h.characterMapping.length)}var Iae=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},NF=function(o,e){return function(t,i){e(t,i,o)}};let UE=class extends K{constructor(e,t,i,n,s,r,a,l,d,c){super(),this._targetWindow=e,this._editors=t,this._diffModel=i,this._options=n,this._diffEditorWidget=s,this._canIgnoreViewZoneUpdateEvent=r,this._origViewZonesToIgnore=a,this._modViewZonesToIgnore=l,this._clipboardService=d,this._contextMenuService=c,this._originalTopPadding=Ct(this,0),this._originalScrollOffset=Ct(this,0),this._originalScrollOffsetAnimated=_F(this._targetWindow,this._originalScrollOffset,this._store),this._modifiedTopPadding=Ct(this,0),this._modifiedScrollOffset=Ct(this,0),this._modifiedScrollOffsetAnimated=_F(this._targetWindow,this._modifiedScrollOffset,this._store);const h=Ct("invalidateAlignmentsState",0),u=this._register(new Rt(()=>{h.set(h.get()+1,void 0)},0));this._register(this._editors.original.onDidChangeViewZones(C=>{this._canIgnoreViewZoneUpdateEvent()||u.schedule()})),this._register(this._editors.modified.onDidChangeViewZones(C=>{this._canIgnoreViewZoneUpdateEvent()||u.schedule()})),this._register(this._editors.original.onDidChangeConfiguration(C=>{(C.hasChanged(144)||C.hasChanged(66))&&u.schedule()})),this._register(this._editors.modified.onDidChangeConfiguration(C=>{(C.hasChanged(144)||C.hasChanged(66))&&u.schedule()}));const g=this._diffModel.map(C=>C?pi(C.model.original.onDidChangeTokens,()=>C.model.original.tokenization.backgroundTokenizationState===2):void 0).map((C,w)=>C?.read(w)),f=Xe(C=>{const w=this._diffModel.read(C),y=w?.diff.read(C);if(!w||!y)return null;h.read(C);const D=this._options.renderSideBySide.read(C);return TF(this._editors.original,this._editors.modified,y.mappings,this._origViewZonesToIgnore,this._modViewZonesToIgnore,D)}),m=Xe(C=>{var w;const y=(w=this._diffModel.read(C))===null||w===void 0?void 0:w.movedTextToCompare.read(C);if(!y)return null;h.read(C);const I=y.changes.map(D=>new QB(D));return TF(this._editors.original,this._editors.modified,I,this._origViewZonesToIgnore,this._modViewZonesToIgnore,!0)});function _(){const C=document.createElement("div");return C.className="diagonal-fill",C}const v=this._register(new se);this.viewZones=Kp(this,(C,w)=>{var y,I,D,T,P,H,Y,B;v.clear();const U=f.read(C)||[],G=[],ne=[],_e=this._modifiedTopPadding.read(C);_e>0&&ne.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:_e,showInHiddenAreas:!0,suppressMouseDown:!0});const Le=this._originalTopPadding.read(C);Le>0&&G.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:Le,showInHiddenAreas:!0,suppressMouseDown:!0});const De=this._options.renderSideBySide.read(C),ye=De||(y=this._editors.modified._getViewModel())===null||y===void 0?void 0:y.createLineBreaksComputer();if(ye){for(const _t of U)if(_t.diff)for(let Pi=_t.originalRange.startLineNumber;Pi<_t.originalRange.endLineNumberExclusive;Pi++)ye?.addRequest(this._editors.original.getModel().getLineContent(Pi),null,null)}const Fe=(I=ye?.finalize())!==null&&I!==void 0?I:[];let He=0;const Ne=this._editors.modified.getOption(66),ve=(D=this._diffModel.read(C))===null||D===void 0?void 0:D.movedTextToCompare.read(C),kt=(P=(T=this._editors.original.getModel())===null||T===void 0?void 0:T.mightContainNonBasicASCII())!==null&&P!==void 0?P:!1,Vt=(Y=(H=this._editors.original.getModel())===null||H===void 0?void 0:H.mightContainRTL())!==null&&Y!==void 0?Y:!1,ki=dR.fromEditor(this._editors.modified);for(const _t of U)if(_t.diff&&!De){if(!_t.originalRange.isEmpty){g.read(C);const Is=document.createElement("div");Is.classList.add("view-lines","line-delete","monaco-mouse-cursor-text");const Yi=new kae(_t.originalRange.mapToLineArray(Hi=>this._editors.original.getModel().tokenization.getLineTokens(Hi)),_t.originalRange.mapToLineArray(Hi=>Fe[He++]),kt,Vt),Ve=[];for(const Hi of _t.diff.innerChanges||[])Ve.push(new n_(Hi.originalRange.delta(-(_t.diff.original.startLineNumber-1)),BE.className,0));const yn=Dae(Yi,ki,Ve,Is),Js=document.createElement("div");if(Js.className="inline-deleted-margin-view-zone",Tn(Js,ki.fontInfo),this._options.renderIndicators.read(C))for(let Hi=0;Hi<yn.heightInLines;Hi++){const Ln=document.createElement("div");Ln.className=`delete-sign ${Re.asClassName(GB)}`,Ln.setAttribute("style",`position:absolute;top:${Hi*Ne}px;width:${ki.lineDecorationsWidth}px;height:${Ne}px;right:0;`),Js.appendChild(Ln)}let Io;v.add(new xae(()=>Zd(Io),Js,this._editors.modified,_t.diff,this._diffEditorWidget,yn.viewLineCounts,this._editors.original.getModel(),this._contextMenuService,this._clipboardService));for(let Hi=0;Hi<yn.viewLineCounts.length;Hi++){const Ln=yn.viewLineCounts[Hi];Ln>1&&G.push({afterLineNumber:_t.originalRange.startLineNumber+Hi,domNode:_(),heightInPx:(Ln-1)*Ne,showInHiddenAreas:!0,suppressMouseDown:!0})}ne.push({afterLineNumber:_t.modifiedRange.startLineNumber-1,domNode:Is,heightInPx:yn.heightInLines*Ne,minWidthInPx:yn.minWidthInPx,marginDomNode:Js,setZoneId(Hi){Io=Hi},showInHiddenAreas:!0,suppressMouseDown:!0})}const Pi=document.createElement("div");Pi.className="gutter-delete",G.push({afterLineNumber:_t.originalRange.endLineNumberExclusive-1,domNode:_(),heightInPx:_t.modifiedHeightInPx,marginDomNode:Pi,showInHiddenAreas:!0,suppressMouseDown:!0})}else{const Pi=_t.modifiedHeightInPx-_t.originalHeightInPx;if(Pi>0){if(ve?.lineRangeMapping.original.delta(-1).deltaLength(2).contains(_t.originalRange.endLineNumberExclusive-1))continue;G.push({afterLineNumber:_t.originalRange.endLineNumberExclusive-1,domNode:_(),heightInPx:Pi,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let Is=function(){const Ve=document.createElement("div");return Ve.className="arrow-revert-change "+Re.asClassName(he.arrowRight),w.add(Q(Ve,"mousedown",yn=>yn.stopPropagation())),w.add(Q(Ve,"click",yn=>{yn.stopPropagation(),s.revert(_t.diff)})),pe("div",{},Ve)};if(ve?.lineRangeMapping.modified.delta(-1).deltaLength(2).contains(_t.modifiedRange.endLineNumberExclusive-1))continue;let Yi;_t.diff&&_t.diff.modified.isEmpty&&this._options.shouldRenderRevertArrows.read(C)&&(Yi=Is()),ne.push({afterLineNumber:_t.modifiedRange.endLineNumberExclusive-1,domNode:_(),heightInPx:-Pi,marginDomNode:Yi,showInHiddenAreas:!0,suppressMouseDown:!0})}}for(const _t of(B=m.read(C))!==null&&B!==void 0?B:[]){if(!ve?.lineRangeMapping.original.intersect(_t.originalRange)||!ve?.lineRangeMapping.modified.intersect(_t.modifiedRange))continue;const Pi=_t.modifiedHeightInPx-_t.originalHeightInPx;Pi>0?G.push({afterLineNumber:_t.originalRange.endLineNumberExclusive-1,domNode:_(),heightInPx:Pi,showInHiddenAreas:!0,suppressMouseDown:!0}):ne.push({afterLineNumber:_t.modifiedRange.endLineNumberExclusive-1,domNode:_(),heightInPx:-Pi,showInHiddenAreas:!0,suppressMouseDown:!0})}return{orig:G,mod:ne}});let b=!1;this._register(this._editors.original.onDidScrollChange(C=>{C.scrollLeftChanged&&!b&&(b=!0,this._editors.modified.setScrollLeft(C.scrollLeft),b=!1)})),this._register(this._editors.modified.onDidScrollChange(C=>{C.scrollLeftChanged&&!b&&(b=!0,this._editors.original.setScrollLeft(C.scrollLeft),b=!1)})),this._originalScrollTop=pi(this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=pi(this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._register(xt(C=>{const w=this._originalScrollTop.read(C)-(this._originalScrollOffsetAnimated.get()-this._modifiedScrollOffsetAnimated.read(C))-(this._originalTopPadding.get()-this._modifiedTopPadding.read(C));w!==this._editors.modified.getScrollTop()&&this._editors.modified.setScrollTop(w,1)})),this._register(xt(C=>{const w=this._modifiedScrollTop.read(C)-(this._modifiedScrollOffsetAnimated.get()-this._originalScrollOffsetAnimated.read(C))-(this._modifiedTopPadding.get()-this._originalTopPadding.read(C));w!==this._editors.original.getScrollTop()&&this._editors.original.setScrollTop(w,1)})),this._register(xt(C=>{var w;const y=(w=this._diffModel.read(C))===null||w===void 0?void 0:w.movedTextToCompare.read(C);let I=0;if(y){const D=this._editors.original.getTopForLineNumber(y.lineRangeMapping.original.startLineNumber,!0)-this._originalTopPadding.get();I=this._editors.modified.getTopForLineNumber(y.lineRangeMapping.modified.startLineNumber,!0)-this._modifiedTopPadding.get()-D}I>0?(this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(I,void 0)):I<0?(this._modifiedTopPadding.set(-I,void 0),this._originalTopPadding.set(0,void 0)):setTimeout(()=>{this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(0,void 0)},400),this._editors.modified.hasTextFocus()?this._originalScrollOffset.set(this._modifiedScrollOffset.get()-I,void 0,!0):this._modifiedScrollOffset.set(this._originalScrollOffset.get()+I,void 0,!0)}))}};UE=Iae([NF(8,Sd),NF(9,Yo)],UE);function TF(o,e,t,i,n,s){const r=new ud(MF(o,i)),a=new ud(MF(e,n)),l=o.getOption(66),d=e.getOption(66),c=[];let h=0,u=0;function g(f,m){for(;;){let _=r.peek(),v=a.peek();if(_&&_.lineNumber>=f&&(_=void 0),v&&v.lineNumber>=m&&(v=void 0),!_&&!v)break;const b=_?_.lineNumber-h:Number.MAX_VALUE,C=v?v.lineNumber-u:Number.MAX_VALUE;b<C?(r.dequeue(),v={lineNumber:_.lineNumber-h+u,heightInPx:0}):b>C?(a.dequeue(),_={lineNumber:v.lineNumber-u+h,heightInPx:0}):(r.dequeue(),a.dequeue()),c.push({originalRange:lt.ofLength(_.lineNumber,1),modifiedRange:lt.ofLength(v.lineNumber,1),originalHeightInPx:l+_.heightInPx,modifiedHeightInPx:d+v.heightInPx,diff:void 0})}}for(const f of t){let C=function(w,y){var I,D,T,P;if(w<b||y<v)return;if(_)_=!1;else if(w===b||y===v)return;const H=new lt(b,w),Y=new lt(v,y);if(H.isEmpty&&Y.isEmpty)return;const B=(D=(I=r.takeWhile(G=>G.lineNumber<w))===null||I===void 0?void 0:I.reduce((G,ne)=>G+ne.heightInPx,0))!==null&&D!==void 0?D:0,U=(P=(T=a.takeWhile(G=>G.lineNumber<y))===null||T===void 0?void 0:T.reduce((G,ne)=>G+ne.heightInPx,0))!==null&&P!==void 0?P:0;c.push({originalRange:H,modifiedRange:Y,originalHeightInPx:H.length*l+B,modifiedHeightInPx:Y.length*d+U,diff:f.lineRangeMapping}),b=w,v=y};const m=f.lineRangeMapping;g(m.original.startLineNumber,m.modified.startLineNumber);let _=!0,v=m.modified.startLineNumber,b=m.original.startLineNumber;if(s)for(const w of m.innerChanges||[])w.originalRange.startColumn>1&&w.modifiedRange.startColumn>1&&C(w.originalRange.startLineNumber,w.modifiedRange.startLineNumber),w.originalRange.endColumn<o.getModel().getLineMaxColumn(w.originalRange.endLineNumber)&&C(w.originalRange.endLineNumber,w.modifiedRange.endLineNumber);C(m.original.endLineNumberExclusive,m.modified.endLineNumberExclusive),h=m.original.endLineNumberExclusive,u=m.modified.endLineNumberExclusive}return g(Number.MAX_VALUE,Number.MAX_VALUE),c}function MF(o,e){const t=[],i=[],n=o.getOption(144).wrappingColumn!==-1,s=o._getViewModel().coordinatesConverter,r=o.getOption(66);if(n)for(let l=1;l<=o.getModel().getLineCount();l++){const d=s.getModelLineViewLineCount(l);d>1&&i.push({lineNumber:l,heightInPx:r*(d-1)})}for(const l of o.getWhitespaces()){if(e.has(l.id))continue;const d=l.afterLineNumber===0?0:s.convertViewPositionToModelPosition(new V(l.afterLineNumber,1)).lineNumber;t.push({lineNumber:d,heightInPx:l.height})}return qre(t,i,l=>l.lineNumber,(l,d)=>({lineNumber:l.lineNumber,heightInPx:l.heightInPx+d.heightInPx}))}var Eae=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Nae=function(o,e){return function(t,i){e(t,i,o)}},nr;let Au=nr=class extends K{constructor(e,t,i,n,s,r,a){super(),this._editors=e,this._rootElement=t,this._diffModel=i,this._rootWidth=n,this._rootHeight=s,this._modifiedEditorLayoutInfo=r,this._themeService=a,this.width=nr.ENTIRE_DIFF_OVERVIEW_WIDTH;const l=pi(this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme()),d=Xe(u=>{const g=l.read(u),f=g.getColor(BG)||(g.getColor(OG)||tI).transparent(2),m=g.getColor(WG)||(g.getColor(FG)||iI).transparent(2);return{insertColor:f,removeColor:m}}),c=Lt(document.createElement("div"));c.setClassName("diffViewport"),c.setPosition("absolute");const h=Jt("div.diffOverview",{style:{position:"absolute",top:"0px",width:nr.ENTIRE_DIFF_OVERVIEW_WIDTH+"px"}}).root;this._register($b(h,c.domNode)),this._register(vi(h,ge.POINTER_DOWN,u=>{this._editors.modified.delegateVerticalScrollbarPointerDown(u)})),this._register(Q(h,ge.MOUSE_WHEEL,u=>{this._editors.modified.delegateScrollFromMouseWheelEvent(u)},{passive:!1})),this._register($b(this._rootElement,h)),this._register(yd((u,g)=>{const f=this._diffModel.read(u),m=this._editors.original.createOverviewRuler("original diffOverviewRuler");m&&(g.add(m),g.add($b(h,m.getDomNode())));const _=this._editors.modified.createOverviewRuler("modified diffOverviewRuler");if(_&&(g.add(_),g.add($b(h,_.getDomNode()))),!m||!_)return;const v=fo("viewZoneChanged",this._editors.original.onDidChangeViewZones),b=fo("viewZoneChanged",this._editors.modified.onDidChangeViewZones),C=fo("hiddenRangesChanged",this._editors.original.onDidChangeHiddenAreas),w=fo("hiddenRangesChanged",this._editors.modified.onDidChangeHiddenAreas);g.add(xt(y=>{var I;v.read(y),b.read(y),C.read(y),w.read(y);const D=d.read(y),T=(I=f?.diff.read(y))===null||I===void 0?void 0:I.mappings;function P(B,U,G){const ne=G._getViewModel();return ne?B.filter(_e=>_e.length>0).map(_e=>{const Le=ne.coordinatesConverter.convertModelPositionToViewPosition(new V(_e.startLineNumber,1)),De=ne.coordinatesConverter.convertModelPositionToViewPosition(new V(_e.endLineNumberExclusive,1)),ye=De.lineNumber-Le.lineNumber;return new G8(Le.lineNumber,De.lineNumber,ye,U.toString())}):[]}const H=P((T||[]).map(B=>B.lineRangeMapping.original),D.removeColor,this._editors.original),Y=P((T||[]).map(B=>B.lineRangeMapping.modified),D.insertColor,this._editors.modified);m?.setZones(H),_?.setZones(Y)})),g.add(xt(y=>{const I=this._rootHeight.read(y),D=this._rootWidth.read(y),T=this._modifiedEditorLayoutInfo.read(y);if(T){const P=nr.ENTIRE_DIFF_OVERVIEW_WIDTH-2*nr.ONE_OVERVIEW_WIDTH;m.setLayout({top:0,height:I,right:P+nr.ONE_OVERVIEW_WIDTH,width:nr.ONE_OVERVIEW_WIDTH}),_.setLayout({top:0,height:I,right:0,width:nr.ONE_OVERVIEW_WIDTH});const H=this._editors.modifiedScrollTop.read(y),Y=this._editors.modifiedScrollHeight.read(y),B=this._editors.modified.getOption(102),U=new sp(B.verticalHasArrows?B.arrowSize:0,B.verticalScrollbarSize,0,T.height,Y,H);c.setTop(U.getSliderPosition()),c.setHeight(U.getSliderSize())}else c.setTop(0),c.setHeight(0);h.style.height=I+"px",h.style.left=D-nr.ENTIRE_DIFF_OVERVIEW_WIDTH+"px",c.setWidth(nr.ENTIRE_DIFF_OVERVIEW_WIDTH)}))}))}};Au.ONE_OVERVIEW_WIDTH=15;Au.ENTIRE_DIFF_OVERVIEW_WIDTH=nr.ONE_OVERVIEW_WIDTH*2;Au=nr=Eae([Nae(6,tn)],Au);R("diffEditor.move.border",{dark:"#8b8b8b9c",light:"#8b8b8b9c",hcDark:"#8b8b8b9c",hcLight:"#8b8b8b9c"},p("diffEditor.move.border","The border color for text that got moved in the diff editor."));R("diffEditor.moveActive.border",{dark:"#FFA500",light:"#FFA500",hcDark:"#FFA500",hcLight:"#FFA500"},p("diffEditor.moveActive.border","The active border color for text that got moved in the diff editor."));R("diffEditor.unchangedRegionShadow",{dark:"#000000",light:"#737373BF",hcDark:"#000000",hcLight:"#737373BF"},p("diffEditor.unchangedRegionShadow","The color of the shadow around unchanged region widgets."));class Ey extends K{constructor(){super(...arguments),this._id=++Ey.idCounter,this._onDidDispose=this._register(new W),this.onDidDispose=this._onDidDispose.event}getId(){return this.getEditorType()+":v2:"+this._id}getVisibleColumnFromPosition(e){return this._targetEditor.getVisibleColumnFromPosition(e)}getPosition(){return this._targetEditor.getPosition()}setPosition(e,t="api"){this._targetEditor.setPosition(e,t)}revealLine(e,t=0){this._targetEditor.revealLine(e,t)}revealLineInCenter(e,t=0){this._targetEditor.revealLineInCenter(e,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealLineInCenterIfOutsideViewport(e,t)}revealLineNearTop(e,t=0){this._targetEditor.revealLineNearTop(e,t)}revealPosition(e,t=0){this._targetEditor.revealPosition(e,t)}revealPositionInCenter(e,t=0){this._targetEditor.revealPositionInCenter(e,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealPositionInCenterIfOutsideViewport(e,t)}revealPositionNearTop(e,t=0){this._targetEditor.revealPositionNearTop(e,t)}getSelection(){return this._targetEditor.getSelection()}getSelections(){return this._targetEditor.getSelections()}setSelection(e,t="api"){this._targetEditor.setSelection(e,t)}setSelections(e,t="api"){this._targetEditor.setSelections(e,t)}revealLines(e,t,i=0){this._targetEditor.revealLines(e,t,i)}revealLinesInCenter(e,t,i=0){this._targetEditor.revealLinesInCenter(e,t,i)}revealLinesInCenterIfOutsideViewport(e,t,i=0){this._targetEditor.revealLinesInCenterIfOutsideViewport(e,t,i)}revealLinesNearTop(e,t,i=0){this._targetEditor.revealLinesNearTop(e,t,i)}revealRange(e,t=0,i=!1,n=!0){this._targetEditor.revealRange(e,t,i,n)}revealRangeInCenter(e,t=0){this._targetEditor.revealRangeInCenter(e,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealRangeInCenterIfOutsideViewport(e,t)}revealRangeNearTop(e,t=0){this._targetEditor.revealRangeNearTop(e,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._targetEditor.revealRangeNearTopIfOutsideViewport(e,t)}revealRangeAtTop(e,t=0){this._targetEditor.revealRangeAtTop(e,t)}getSupportedActions(){return this._targetEditor.getSupportedActions()}focus(){this._targetEditor.focus()}trigger(e,t,i){this._targetEditor.trigger(e,t,i)}createDecorationsCollection(e){return this._targetEditor.createDecorationsCollection(e)}changeDecorations(e){return this._targetEditor.changeDecorations(e)}}Ey.idCounter=0;var Tae=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},RF=function(o,e){return function(t,i){e(t,i,o)}};let $E=class extends K{get onDidContentSizeChange(){return this._onDidContentSizeChange.event}constructor(e,t,i,n,s,r,a){super(),this.originalEditorElement=e,this.modifiedEditorElement=t,this._options=i,this._createInnerEditor=s,this._instantiationService=r,this._keybindingService=a,this._onDidContentSizeChange=this._register(new W),this.original=this._register(this._createLeftHandSideEditor(i.editorOptions.get(),n.originalEditor||{})),this.modified=this._register(this._createRightHandSideEditor(i.editorOptions.get(),n.modifiedEditor||{})),this.modifiedModel=pi(this.modified.onDidChangeModel,()=>this.modified.getModel()),this.modifiedScrollTop=pi(this.modified.onDidScrollChange,()=>this.modified.getScrollTop()),this.modifiedScrollHeight=pi(this.modified.onDidScrollChange,()=>this.modified.getScrollHeight()),this.modifiedSelections=pi(this.modified.onDidChangeCursorSelection,()=>{var l;return(l=this.modified.getSelections())!==null&&l!==void 0?l:[]}),this.modifiedCursor=pi(this.modified.onDidChangeCursorPosition,()=>{var l;return(l=this.modified.getPosition())!==null&&l!==void 0?l:new V(1,1)}),this._register(Fv({createEmptyChangeSummary:()=>({}),handleChange:(l,d)=>(l.didChange(i.editorOptions)&&Object.assign(d,l.change.changedOptions),!0)},(l,d)=>{i.editorOptions.read(l),this._options.renderSideBySide.read(l),this.modified.updateOptions(this._adjustOptionsForRightHandSide(l,d)),this.original.updateOptions(this._adjustOptionsForLeftHandSide(l,d))}))}_createLeftHandSideEditor(e,t){const i=this._adjustOptionsForLeftHandSide(void 0,e),n=this._constructInnerEditor(this._instantiationService,this.originalEditorElement,i,t);return n.setContextValue("isInDiffLeftEditor",!0),n}_createRightHandSideEditor(e,t){const i=this._adjustOptionsForRightHandSide(void 0,e),n=this._constructInnerEditor(this._instantiationService,this.modifiedEditorElement,i,t);return n.setContextValue("isInDiffRightEditor",!0),n}_constructInnerEditor(e,t,i,n){const s=this._createInnerEditor(e,t,i,n);return this._register(s.onDidContentSizeChange(r=>{const a=this.original.getContentWidth()+this.modified.getContentWidth()+Au.ENTIRE_DIFF_OVERVIEW_WIDTH,l=Math.max(this.modified.getContentHeight(),this.original.getContentHeight());this._onDidContentSizeChange.fire({contentHeight:l,contentWidth:a,contentHeightChanged:r.contentHeightChanged,contentWidthChanged:r.contentWidthChanged})})),s}_adjustOptionsForLeftHandSide(e,t){const i=this._adjustOptionsForSubEditor(t);return this._options.renderSideBySide.get()?(i.unicodeHighlight=this._options.editorOptions.get().unicodeHighlight||{},i.wordWrapOverride1=this._options.diffWordWrap.get()):(i.wordWrapOverride1="off",i.wordWrapOverride2="off",i.stickyScroll={enabled:!1},i.unicodeHighlight={nonBasicASCII:!1,ambiguousCharacters:!1,invisibleCharacters:!1}),i.glyphMargin=this._options.renderSideBySide.get(),t.originalAriaLabel&&(i.ariaLabel=t.originalAriaLabel),i.ariaLabel=this._updateAriaLabel(i.ariaLabel),i.readOnly=!this._options.originalEditable.get(),i.dropIntoEditor={enabled:!i.readOnly},i.extraEditorClassName="original-in-monaco-diff-editor",i}_adjustOptionsForRightHandSide(e,t){const i=this._adjustOptionsForSubEditor(t);return t.modifiedAriaLabel&&(i.ariaLabel=t.modifiedAriaLabel),i.ariaLabel=this._updateAriaLabel(i.ariaLabel),i.wordWrapOverride1=this._options.diffWordWrap.get(),i.revealHorizontalRightPadding=sa.revealHorizontalRightPadding.defaultValue+Au.ENTIRE_DIFF_OVERVIEW_WIDTH,i.scrollbar.verticalHasArrows=!1,i.extraEditorClassName="modified-in-monaco-diff-editor",i}_adjustOptionsForSubEditor(e){const t={...e,dimension:{height:0,width:0}};return t.inDiffEditor=!0,t.automaticLayout=!1,t.scrollbar={...t.scrollbar||{}},t.folding=!1,t.codeLens=this._options.diffCodeLens.get(),t.fixedOverflowWidgets=!0,t.minimap={...t.minimap||{}},t.minimap.enabled=!1,this._options.hideUnchangedRegions.get()?t.stickyScroll={enabled:!1}:t.stickyScroll=this._options.editorOptions.get().stickyScroll,t}_updateAriaLabel(e){var t;e||(e="");const i=p("diff-aria-navigation-tip"," use {0} to open the accessibility help.",(t=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp"))===null||t===void 0?void 0:t.getAriaLabel());return this._options.accessibilityVerbose.get()?e+i:e?e.replaceAll(i,""):""}};$E=Tae([RF(5,Oe),RF(6,Pt)],$E);class Mae{get editorOptions(){return this._options}constructor(e){this._diffEditorWidth=Ct(this,0),this.couldShowInlineViewBecauseOfSize=Xe(this,i=>this._options.read(i).renderSideBySide&&this._diffEditorWidth.read(i)<=this._options.read(i).renderSideBySideInlineBreakpoint),this.renderOverviewRuler=Xe(this,i=>this._options.read(i).renderOverviewRuler),this.renderSideBySide=Xe(this,i=>this._options.read(i).renderSideBySide&&!(this._options.read(i).useInlineViewWhenSpaceIsLimited&&this.couldShowInlineViewBecauseOfSize.read(i))),this.readOnly=Xe(this,i=>this._options.read(i).readOnly),this.shouldRenderRevertArrows=Xe(this,i=>!(!this._options.read(i).renderMarginRevertIcon||!this.renderSideBySide.read(i)||this.readOnly.read(i))),this.renderIndicators=Xe(this,i=>this._options.read(i).renderIndicators),this.enableSplitViewResizing=Xe(this,i=>this._options.read(i).enableSplitViewResizing),this.splitViewDefaultRatio=Xe(this,i=>this._options.read(i).splitViewDefaultRatio),this.ignoreTrimWhitespace=Xe(this,i=>this._options.read(i).ignoreTrimWhitespace),this.maxComputationTimeMs=Xe(this,i=>this._options.read(i).maxComputationTime),this.showMoves=Xe(this,i=>this._options.read(i).experimental.showMoves&&this.renderSideBySide.read(i)),this.isInEmbeddedEditor=Xe(this,i=>this._options.read(i).isInEmbeddedEditor),this.diffWordWrap=Xe(this,i=>this._options.read(i).diffWordWrap),this.originalEditable=Xe(this,i=>this._options.read(i).originalEditable),this.diffCodeLens=Xe(this,i=>this._options.read(i).diffCodeLens),this.accessibilityVerbose=Xe(this,i=>this._options.read(i).accessibilityVerbose),this.diffAlgorithm=Xe(this,i=>this._options.read(i).diffAlgorithm),this.showEmptyDecorations=Xe(this,i=>this._options.read(i).experimental.showEmptyDecorations),this.onlyShowAccessibleDiffViewer=Xe(this,i=>this._options.read(i).onlyShowAccessibleDiffViewer),this.hideUnchangedRegions=Xe(this,i=>this._options.read(i).hideUnchangedRegions.enabled),this.hideUnchangedRegionsRevealLineCount=Xe(this,i=>this._options.read(i).hideUnchangedRegions.revealLineCount),this.hideUnchangedRegionsContextLineCount=Xe(this,i=>this._options.read(i).hideUnchangedRegions.contextLineCount),this.hideUnchangedRegionsMinimumLineCount=Xe(this,i=>this._options.read(i).hideUnchangedRegions.minimumLineCount);const t={...e,...AF(e,jn)};this._options=Ct(this,t)}updateOptions(e){const t=AF(e,this._options.get()),i={...this._options.get(),...e,...t};this._options.set(i,void 0,{changedOptions:e})}setWidth(e){this._diffEditorWidth.set(e,void 0)}}function AF(o,e){var t,i,n,s,r,a,l,d;return{enableSplitViewResizing:Ie(o.enableSplitViewResizing,e.enableSplitViewResizing),splitViewDefaultRatio:IH(o.splitViewDefaultRatio,.5,.1,.9),renderSideBySide:Ie(o.renderSideBySide,e.renderSideBySide),renderMarginRevertIcon:Ie(o.renderMarginRevertIcon,e.renderMarginRevertIcon),maxComputationTime:Nh(o.maxComputationTime,e.maxComputationTime,0,1073741824),maxFileSize:Nh(o.maxFileSize,e.maxFileSize,0,1073741824),ignoreTrimWhitespace:Ie(o.ignoreTrimWhitespace,e.ignoreTrimWhitespace),renderIndicators:Ie(o.renderIndicators,e.renderIndicators),originalEditable:Ie(o.originalEditable,e.originalEditable),diffCodeLens:Ie(o.diffCodeLens,e.diffCodeLens),renderOverviewRuler:Ie(o.renderOverviewRuler,e.renderOverviewRuler),diffWordWrap:yi(o.diffWordWrap,e.diffWordWrap,["off","on","inherit"]),diffAlgorithm:yi(o.diffAlgorithm,e.diffAlgorithm,["legacy","advanced"],{smart:"legacy",experimental:"advanced"}),accessibilityVerbose:Ie(o.accessibilityVerbose,e.accessibilityVerbose),experimental:{showMoves:Ie((t=o.experimental)===null||t===void 0?void 0:t.showMoves,e.experimental.showMoves),showEmptyDecorations:Ie((i=o.experimental)===null||i===void 0?void 0:i.showEmptyDecorations,e.experimental.showEmptyDecorations)},hideUnchangedRegions:{enabled:Ie((s=(n=o.hideUnchangedRegions)===null||n===void 0?void 0:n.enabled)!==null&&s!==void 0?s:(r=o.experimental)===null||r===void 0?void 0:r.collapseUnchangedRegions,e.hideUnchangedRegions.enabled),contextLineCount:Nh((a=o.hideUnchangedRegions)===null||a===void 0?void 0:a.contextLineCount,e.hideUnchangedRegions.contextLineCount,0,1073741824),minimumLineCount:Nh((l=o.hideUnchangedRegions)===null||l===void 0?void 0:l.minimumLineCount,e.hideUnchangedRegions.minimumLineCount,0,1073741824),revealLineCount:Nh((d=o.hideUnchangedRegions)===null||d===void 0?void 0:d.revealLineCount,e.hideUnchangedRegions.revealLineCount,0,1073741824)},isInEmbeddedEditor:Ie(o.isInEmbeddedEditor,e.isInEmbeddedEditor),onlyShowAccessibleDiffViewer:Ie(o.onlyShowAccessibleDiffViewer,e.onlyShowAccessibleDiffViewer),renderSideBySideInlineBreakpoint:Nh(o.renderSideBySideInlineBreakpoint,e.renderSideBySideInlineBreakpoint,0,1073741824),useInlineViewWhenSpaceIsLimited:Ie(o.useInlineViewWhenSpaceIsLimited,e.useInlineViewWhenSpaceIsLimited)}}var Rae=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},wm=function(o,e){return function(t,i){e(t,i,o)}};let zc=class extends Ey{get onDidContentSizeChange(){return this._editors.onDidContentSizeChange}constructor(e,t,i,n,s,r,a,l){var d;super(),this._domElement=e,this._parentContextKeyService=n,this._parentInstantiationService=s,this._audioCueService=a,this._editorProgressService=l,this.elements=Jt("div.monaco-diff-editor.side-by-side",{style:{position:"relative",height:"100%"}},[Jt("div.noModificationsOverlay@overlay",{style:{position:"absolute",height:"100%",visibility:"hidden"}},[pe("span",{},"No Changes")]),Jt("div.editor.original@original",{style:{position:"absolute",height:"100%"}}),Jt("div.editor.modified@modified",{style:{position:"absolute",height:"100%"}}),Jt("div.accessibleDiffViewer@accessibleDiffViewer",{style:{position:"absolute",height:"100%"}})]),this._diffModel=Ct(this,void 0),this._shouldDisposeDiffModel=!1,this.onDidChangeModel=fe.fromObservableLight(this._diffModel),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._domElement)),this._instantiationService=this._parentInstantiationService.createChild(new xv([We,this._contextKeyService])),this._boundarySashes=Ct(this,void 0),this._accessibleDiffViewerShouldBeVisible=Ct(this,!1),this._accessibleDiffViewerVisible=Xe(this,w=>this._options.onlyShowAccessibleDiffViewer.read(w)?!0:this._accessibleDiffViewerShouldBeVisible.read(w)),this._movedBlocksLinesPart=Ct(this,void 0),this._layoutInfo=Xe(this,w=>{var y,I,D,T,P;const H=this._rootSizeObserver.width.read(w),Y=this._rootSizeObserver.height.read(w),B=(y=this._sash.read(w))===null||y===void 0?void 0:y.sashLeft.read(w),U=B??Math.max(5,this._editors.original.getLayoutInfo().decorationsLeft),G=H-U-((D=(I=this._overviewRulerPart.read(w))===null||I===void 0?void 0:I.width)!==null&&D!==void 0?D:0),ne=(P=(T=this._movedBlocksLinesPart.read(w))===null||T===void 0?void 0:T.width.read(w))!==null&&P!==void 0?P:0,_e=U-ne;return this.elements.original.style.width=_e+"px",this.elements.original.style.left="0px",this.elements.modified.style.width=G+"px",this.elements.modified.style.left=U+"px",this._editors.original.layout({width:_e,height:Y},!0),this._editors.modified.layout({width:G,height:Y},!0),{modifiedEditor:this._editors.modified.getLayoutInfo(),originalEditor:this._editors.original.getLayoutInfo()}}),this._diffValue=this._diffModel.map((w,y)=>w?.diff.read(y)),this.onDidUpdateDiff=fe.fromObservableLight(this._diffValue),r.willCreateDiffEditor(),this._contextKeyService.createKey("isInDiffEditor",!0),this._domElement.appendChild(this.elements.root),this._register(Ae(()=>this._domElement.removeChild(this.elements.root))),this._rootSizeObserver=this._register(new jB(this.elements.root,t.dimension)),this._rootSizeObserver.setAutomaticLayout((d=t.automaticLayout)!==null&&d!==void 0?d:!1),this._options=new Mae(t),this._register(xt(w=>{this._options.setWidth(this._rootSizeObserver.width.read(w))})),this._contextKeyService.createKey(M.isEmbeddedDiffEditor.key,!1),this._register(Kb(M.isEmbeddedDiffEditor,this._contextKeyService,w=>this._options.isInEmbeddedEditor.read(w))),this._register(Kb(M.comparingMovedCode,this._contextKeyService,w=>{var y;return!!(!((y=this._diffModel.read(w))===null||y===void 0)&&y.movedTextToCompare.read(w))})),this._register(Kb(M.diffEditorRenderSideBySideInlineBreakpointReached,this._contextKeyService,w=>this._options.couldShowInlineViewBecauseOfSize.read(w))),this._register(Kb(M.hasChanges,this._contextKeyService,w=>{var y,I,D;return((D=(I=(y=this._diffModel.read(w))===null||y===void 0?void 0:y.diff.read(w))===null||I===void 0?void 0:I.mappings.length)!==null&&D!==void 0?D:0)>0})),this._editors=this._register(this._instantiationService.createInstance($E,this.elements.original,this.elements.modified,this._options,i,(w,y,I,D)=>this._createInnerEditor(w,y,I,D))),this._overviewRulerPart=Bd(this,w=>this._options.renderOverviewRuler.read(w)?this._instantiationService.createInstance(Ea(Au,w),this._editors,this.elements.root,this._diffModel,this._rootSizeObserver.width,this._rootSizeObserver.height,this._layoutInfo.map(y=>y.modifiedEditor)):void 0).recomputeInitiallyAndOnChange(this._store),this._sash=Bd(this,w=>{const y=this._options.renderSideBySide.read(w);return this.elements.root.classList.toggle("side-by-side",y),y?new pae(this._options,this.elements.root,{height:this._rootSizeObserver.height,width:this._rootSizeObserver.width.map((I,D)=>{var T,P;return I-((P=(T=this._overviewRulerPart.read(D))===null||T===void 0?void 0:T.width)!==null&&P!==void 0?P:0)})},this._boundarySashes):void 0}).recomputeInitiallyAndOnChange(this._store);const c=Bd(this,w=>this._instantiationService.createInstance(Ea(WE,w),this._editors,this._diffModel,this._options)).recomputeInitiallyAndOnChange(this._store);Bd(this,w=>this._instantiationService.createInstance(Ea(gae,w),this._editors,this._diffModel,this._options,this)).recomputeInitiallyAndOnChange(this._store);const h=new Set,u=new Set;let g=!1;const f=Bd(this,w=>this._instantiationService.createInstance(Ea(UE,w),Ue(this._domElement),this._editors,this._diffModel,this._options,this,()=>g||c.get().isUpdatingHiddenAreas,h,u)).recomputeInitiallyAndOnChange(this._store),m=Xe(this,w=>{const y=f.read(w).viewZones.read(w).orig,I=c.read(w).viewZones.read(w).origViewZones;return y.concat(I)}),_=Xe(this,w=>{const y=f.read(w).viewZones.read(w).mod,I=c.read(w).viewZones.read(w).modViewZones;return y.concat(I)});this._register(Mw(this._editors.original,m,w=>{g=w},h));let v;this._register(Mw(this._editors.modified,_,w=>{g=w,g?v=na.capture(this._editors.modified):(v?.restore(this._editors.modified),v=void 0)},u)),this._accessibleDiffViewer=Bd(this,w=>this._instantiationService.createInstance(Ea(oc,w),this.elements.accessibleDiffViewer,this._accessibleDiffViewerVisible,(y,I)=>this._accessibleDiffViewerShouldBeVisible.set(y,I),this._options.onlyShowAccessibleDiffViewer.map(y=>!y),this._rootSizeObserver.width,this._rootSizeObserver.height,this._diffModel.map((y,I)=>{var D;return(D=y?.diff.read(I))===null||D===void 0?void 0:D.mappings.map(T=>T.lineRangeMapping)}),this._editors)).recomputeInitiallyAndOnChange(this._store);const b=this._accessibleDiffViewerVisible.map(w=>w?"hidden":"visible");this._register(wc(this.elements.modified,{visibility:b})),this._register(wc(this.elements.original,{visibility:b})),this._createDiffEditorContributions(),r.addDiffEditor(this),this._register(Bv(this._layoutInfo)),Bd(this,w=>new(Ea(Sc,w))(this.elements.root,this._diffModel,this._layoutInfo.map(y=>y.originalEditor),this._layoutInfo.map(y=>y.modifiedEditor),this._editors)).recomputeInitiallyAndOnChange(this._store,w=>{this._movedBlocksLinesPart.set(w,void 0)}),this._register(wc(this.elements.overlay,{width:this._layoutInfo.map((w,y)=>w.originalEditor.width+(this._options.renderSideBySide.read(y)?0:w.modifiedEditor.width)),visibility:Xe(w=>{var y,I;return this._options.hideUnchangedRegions.read(w)&&((I=(y=this._diffModel.read(w))===null||y===void 0?void 0:y.diff.read(w))===null||I===void 0?void 0:I.mappings.length)===0?"visible":"hidden"})})),this._register(fe.runAndSubscribe(this._editors.modified.onDidChangeCursorPosition,w=>{var y,I;if(w?.reason===3){const D=(I=(y=this._diffModel.get())===null||y===void 0?void 0:y.diff.get())===null||I===void 0?void 0:I.mappings.find(T=>T.lineRangeMapping.modified.contains(w.position.lineNumber));D?.lineRangeMapping.modified.isEmpty?this._audioCueService.playAudioCue(tt.diffLineDeleted,{source:"diffEditor.cursorPositionChanged"}):D?.lineRangeMapping.original.isEmpty?this._audioCueService.playAudioCue(tt.diffLineInserted,{source:"diffEditor.cursorPositionChanged"}):D&&this._audioCueService.playAudioCue(tt.diffLineModified,{source:"diffEditor.cursorPositionChanged"})}}));const C=this._diffModel.map(this,(w,y)=>{if(w)return w.diff.read(y)===void 0&&!w.isDiffUpToDate.read(y)});this._register(yd((w,y)=>{if(C.read(w)===!0){const I=this._editorProgressService.show(!0,1e3);y.add(Ae(()=>I.done()))}})),this._register(Ae(()=>{var w;this._shouldDisposeDiffModel&&((w=this._diffModel.get())===null||w===void 0||w.dispose())}))}_createInnerEditor(e,t,i,n){return e.createInstance(rp,t,i,n)}_createDiffEditorContributions(){const e=Cf.getDiffEditorContributions();for(const t of e)try{this._register(this._instantiationService.createInstance(t.ctor,this))}catch(i){Ge(i)}}get _targetEditor(){return this._editors.modified}getEditorType(){return pv.IDiffEditor}layout(e){this._rootSizeObserver.observe(e)}hasTextFocus(){return this._editors.original.hasTextFocus()||this._editors.modified.hasTextFocus()}saveViewState(){var e;const t=this._editors.original.saveViewState(),i=this._editors.modified.saveViewState();return{original:t,modified:i,modelState:(e=this._diffModel.get())===null||e===void 0?void 0:e.serializeState()}}restoreViewState(e){var t;if(e&&e.original&&e.modified){const i=e;this._editors.original.restoreViewState(i.original),this._editors.modified.restoreViewState(i.modified),i.modelState&&((t=this._diffModel.get())===null||t===void 0||t.restoreSerializedState(i.modelState))}}handleInitialized(){this._editors.original.handleInitialized(),this._editors.modified.handleInitialized()}createViewModel(e){return this._instantiationService.createInstance(zE,e,this._options)}getModel(){var e,t;return(t=(e=this._diffModel.get())===null||e===void 0?void 0:e.model)!==null&&t!==void 0?t:null}setModel(e,t){!e&&this._diffModel.get()&&this._accessibleDiffViewer.get().close();const i=e?"model"in e?{model:e,shouldDispose:!1}:{model:this.createViewModel(e),shouldDispose:!0}:void 0;this._diffModel.get()!==i?.model&&A0(t,n=>{var s;pi.batchEventsGlobally(n,()=>{this._editors.original.setModel(i?i.model.model.original:null),this._editors.modified.setModel(i?i.model.model.modified:null)});const r=this._diffModel.get(),a=this._shouldDisposeDiffModel;this._shouldDisposeDiffModel=(s=i?.shouldDispose)!==null&&s!==void 0?s:!1,this._diffModel.set(i?.model,n),a&&r?.dispose()})}updateOptions(e){this._options.updateOptions(e)}getContainerDomNode(){return this._domElement}getOriginalEditor(){return this._editors.original}getModifiedEditor(){return this._editors.modified}getLineChanges(){var e;const t=(e=this._diffModel.get())===null||e===void 0?void 0:e.diff.get();return t?Aae(t):null}revert(e){var t;if(e.innerChanges){this.revertRangeMappings(e.innerChanges);return}const i=(t=this._diffModel.get())===null||t===void 0?void 0:t.model;i&&this._editors.modified.executeEdits("diffEditor",[{range:e.modified.toExclusiveRange(),text:i.original.getValueInRange(e.original.toExclusiveRange())}])}revertRangeMappings(e){const t=this._diffModel.get();if(!t||!t.isDiffUpToDate.get())return;const i=e.map(n=>({range:n.modifiedRange,text:t.model.original.getValueInRange(n.originalRange)}));this._editors.modified.executeEdits("diffEditor",i)}_goTo(e){this._editors.modified.setPosition(new V(e.lineRangeMapping.modified.startLineNumber,1)),this._editors.modified.revealRangeInCenter(e.lineRangeMapping.modified.toExclusiveRange())}goToDiff(e){var t,i,n,s;const r=(i=(t=this._diffModel.get())===null||t===void 0?void 0:t.diff.get())===null||i===void 0?void 0:i.mappings;if(!r||r.length===0)return;const a=this._editors.modified.getPosition().lineNumber;let l;e==="next"?l=(n=r.find(d=>d.lineRangeMapping.modified.startLineNumber>a))!==null&&n!==void 0?n:r[0]:l=(s=E1(r,d=>d.lineRangeMapping.modified.startLineNumber<a))!==null&&s!==void 0?s:r[r.length-1],this._goTo(l),l.lineRangeMapping.modified.isEmpty?this._audioCueService.playAudioCue(tt.diffLineDeleted,{source:"diffEditor.goToDiff"}):l.lineRangeMapping.original.isEmpty?this._audioCueService.playAudioCue(tt.diffLineInserted,{source:"diffEditor.goToDiff"}):l&&this._audioCueService.playAudioCue(tt.diffLineModified,{source:"diffEditor.goToDiff"})}revealFirstDiff(){const e=this._diffModel.get();e&&this.waitForDiff().then(()=>{var t;const i=(t=e.diff.get())===null||t===void 0?void 0:t.mappings;!i||i.length===0||this._goTo(i[0])})}accessibleDiffViewerNext(){this._accessibleDiffViewer.get().next()}accessibleDiffViewerPrev(){this._accessibleDiffViewer.get().prev()}async waitForDiff(){const e=this._diffModel.get();e&&await e.waitForDiff()}mapToOtherSide(){var e,t;const i=this._editors.modified.hasWidgetFocus(),n=i?this._editors.modified:this._editors.original,s=i?this._editors.original:this._editors.modified;let r;const a=n.getSelection();if(a){const l=(t=(e=this._diffModel.get())===null||e===void 0?void 0:e.diff.get())===null||t===void 0?void 0:t.mappings.map(d=>i?d.lineRangeMapping.flip():d.lineRangeMapping);if(l){const d=vF(a.getStartPosition(),l),c=vF(a.getEndPosition(),l);r=k.plusRange(d,c)}}return{destination:s,destinationSelection:r}}switchSide(){const{destination:e,destinationSelection:t}=this.mapToOtherSide();e.focus(),t&&e.setSelection(t)}exitCompareMove(){const e=this._diffModel.get();e&&e.movedTextToCompare.set(void 0,void 0)}collapseAllUnchangedRegions(){var e;const t=(e=this._diffModel.get())===null||e===void 0?void 0:e.unchangedRegions.get();t&&ti(i=>{for(const n of t)n.collapseAll(i)})}showAllUnchangedRegions(){var e;const t=(e=this._diffModel.get())===null||e===void 0?void 0:e.unchangedRegions.get();t&&ti(i=>{for(const n of t)n.showAll(i)})}};zc=Rae([wm(3,We),wm(4,Oe),wm(5,Dt),wm(6,Pv),wm(7,lh)],zc);function Aae(o){return o.mappings.map(e=>{const t=e.lineRangeMapping;let i,n,s,r,a=t.innerChanges;return t.original.isEmpty?(i=t.original.startLineNumber-1,n=0,a=void 0):(i=t.original.startLineNumber,n=t.original.endLineNumberExclusive-1),t.modified.isEmpty?(s=t.modified.startLineNumber-1,r=0,a=void 0):(s=t.modified.startLineNumber,r=t.modified.endLineNumberExclusive-1),{originalStartLineNumber:i,originalEndLineNumber:n,modifiedStartLineNumber:s,modifiedEndLineNumber:r,charChanges:a?.map(l=>({originalStartLineNumber:l.originalRange.startLineNumber,originalStartColumn:l.originalRange.startColumn,originalEndLineNumber:l.originalRange.endLineNumber,originalEndColumn:l.originalRange.endColumn,modifiedStartLineNumber:l.modifiedRange.startLineNumber,modifiedStartColumn:l.modifiedRange.startColumn,modifiedEndLineNumber:l.modifiedRange.endLineNumber,modifiedEndColumn:l.modifiedRange.endColumn}))}})}var cR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Qt=function(o,e){return function(t,i){e(t,i,o)}};let Pae=0,PF=!1;function Oae(o){if(!o){if(PF)return;PF=!0}Aq(o||hi.document.body)}let Pw=class extends rp{constructor(e,t,i,n,s,r,a,l,d,c,h,u){const g={...t};g.ariaLabel=g.ariaLabel||nw.editorViewAccessibleLabel,g.ariaLabel=g.ariaLabel+";"+nw.accessibilityHelpMessage,super(e,g,{},i,n,s,r,l,d,c,h,u),a instanceof pp?this._standaloneKeybindingService=a:this._standaloneKeybindingService=null,Oae(g.ariaContainerElement)}addCommand(e,t,i){if(!this._standaloneKeybindingService)return console.warn("Cannot add command because the editor is configured with an unrecognized KeybindingService"),null;const n="DYNAMIC_"+ ++Pae,s=te.deserialize(i);return this._standaloneKeybindingService.addDynamicKeybinding(n,e,t,s),n}createContextKey(e,t){return this._contextKeyService.createKey(e,t)}addAction(e){if(typeof e.id!="string"||typeof e.label!="string"||typeof e.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");if(!this._standaloneKeybindingService)return console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),K.None;const t=e.id,i=e.label,n=te.and(te.equals("editorId",this.getId()),te.deserialize(e.precondition)),s=e.keybindings,r=te.and(n,te.deserialize(e.keybindingContext)),a=e.contextMenuGroupId||null,l=e.contextMenuOrder||0,d=(g,...f)=>Promise.resolve(e.run(this,...f)),c=new se,h=this.getId()+":"+t;if(c.add(gt.registerCommand(h,d)),a){const g={command:{id:h,title:i},when:n,group:a,order:l};c.add(vn.appendMenuItem(N.EditorContext,g))}if(Array.isArray(s))for(const g of s)c.add(this._standaloneKeybindingService.addDynamicKeybinding(h,g,d,r));const u=new Z8(h,i,i,void 0,n,(...g)=>Promise.resolve(e.run(this,...g)),this._contextKeyService);return this._actions.set(t,u),c.add(Ae(()=>{this._actions.delete(t)})),c}_triggerCommand(e,t){if(this._codeEditorService instanceof Y1)try{this._codeEditorService.setActiveCodeEditor(this),super._triggerCommand(e,t)}finally{this._codeEditorService.setActiveCodeEditor(null)}else super._triggerCommand(e,t)}};Pw=cR([Qt(2,Oe),Qt(3,Dt),Qt(4,ui),Qt(5,We),Qt(6,Pt),Qt(7,tn),Qt(8,Vi),Qt(9,Sl),Qt(10,Wt),Qt(11,Se)],Pw);let KE=class extends Pw{constructor(e,t,i,n,s,r,a,l,d,c,h,u,g,f,m){const _={...t};kw(c,_,!1);const v=l.registerEditorContainer(e);typeof _.theme=="string"&&l.setTheme(_.theme),typeof _.autoDetectHighContrast<"u"&&l.setAutoDetectHighContrast(!!_.autoDetectHighContrast);const b=_.model;delete _.model,super(e,_,i,n,s,r,a,l,d,h,f,m),this._configurationService=c,this._standaloneThemeService=l,this._register(v);let C;if(typeof b>"u"){const w=g.getLanguageIdByMimeType(_.language)||_.language||So;C=JB(u,g,_.value||"",w,void 0),this._ownsModel=!0}else C=b,this._ownsModel=!1;if(this._attachModel(C),C){const w={oldModelUrl:null,newModelUrl:C.uri};this._onDidChangeModel.fire(w)}}dispose(){super.dispose()}updateOptions(e){kw(this._configurationService,e,!1),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_postDetachModelCleanup(e){super._postDetachModelCleanup(e),e&&this._ownsModel&&(e.dispose(),this._ownsModel=!1)}};KE=cR([Qt(2,Oe),Qt(3,Dt),Qt(4,ui),Qt(5,We),Qt(6,Pt),Qt(7,xr),Qt(8,Vi),Qt(9,ft),Qt(10,Sl),Qt(11,ii),Qt(12,ni),Qt(13,Wt),Qt(14,Se)],KE);let jE=class extends zc{constructor(e,t,i,n,s,r,a,l,d,c,h,u){const g={...t};kw(l,g,!0);const f=r.registerEditorContainer(e);typeof g.theme=="string"&&r.setTheme(g.theme),typeof g.autoDetectHighContrast<"u"&&r.setAutoDetectHighContrast(!!g.autoDetectHighContrast),super(e,g,{},n,i,s,u,c),this._configurationService=l,this._standaloneThemeService=r,this._register(f)}dispose(){super.dispose()}updateOptions(e){kw(this._configurationService,e,!0),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_createInnerEditor(e,t,i){return e.createInstance(Pw,t,i)}getOriginalEditor(){return super.getOriginalEditor()}getModifiedEditor(){return super.getModifiedEditor()}addCommand(e,t,i){return this.getModifiedEditor().addCommand(e,t,i)}createContextKey(e,t){return this.getModifiedEditor().createContextKey(e,t)}addAction(e){return this.getModifiedEditor().addAction(e)}};jE=cR([Qt(2,Oe),Qt(3,We),Qt(4,Dt),Qt(5,xr),Qt(6,Vi),Qt(7,ft),Qt(8,Yo),Qt(9,lh),Qt(10,Sd),Qt(11,Pv)],jE);function JB(o,e,t,i,n){if(t=t||"",!i){const s=t.indexOf(`
|
|
640
640
|
`);let r=t;return s!==-1&&(r=t.substring(0,s)),OF(o,t,e.createByFilepathOrFirstLine(n||null,r),n)}return OF(o,t,e.createById(i),n)}function OF(o,e,t,i){return o.createModel(e,t,i)}class Fae extends K{constructor(e,t,i={orientation:0}){super(),this.submenuActionViewItems=[],this.hasSecondaryActions=!1,this._onDidChangeDropdownVisibility=this._register(new kz),this.onDidChangeDropdownVisibility=this._onDidChangeDropdownVisibility.event,this.disposables=this._register(new se),this.options=i,this.lookupKeybindings=typeof this.options.getKeyBinding=="function",this.toggleMenuAction=this._register(new O0(()=>{var n;return(n=this.toggleMenuActionViewItem)===null||n===void 0?void 0:n.show()},i.toggleMenuTitle)),this.element=document.createElement("div"),this.element.className="monaco-toolbar",e.appendChild(this.element),this.actionBar=this._register(new Go(this.element,{orientation:i.orientation,ariaLabel:i.ariaLabel,actionRunner:i.actionRunner,allowContextMenu:i.allowContextMenu,highlightToggledItems:i.highlightToggledItems,actionViewItemProvider:(n,s)=>{var r;if(n.id===O0.ID)return this.toggleMenuActionViewItem=new aw(n,n.menuActions,t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:Re.asClassNameArray((r=i.moreIcon)!==null&&r!==void 0?r:he.toolBarMore),anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,isMenu:!0}),this.toggleMenuActionViewItem.setActionContext(this.actionBar.context),this.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility)),this.toggleMenuActionViewItem;if(i.actionViewItemProvider){const a=i.actionViewItemProvider(n,s);if(a)return a}if(n instanceof Gf){const a=new aw(n,n.actions,t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:n.class,anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry});return a.setActionContext(this.actionBar.context),this.submenuActionViewItems.push(a),this.disposables.add(this._onDidChangeDropdownVisibility.add(a.onDidChangeVisibility)),a}}}))}set actionRunner(e){this.actionBar.actionRunner=e}get actionRunner(){return this.actionBar.actionRunner}getElement(){return this.element}getItemAction(e){return this.actionBar.getAction(e)}setActions(e,t){this.clear();const i=e?e.slice(0):[];this.hasSecondaryActions=!!(t&&t.length>0),this.hasSecondaryActions&&t&&(this.toggleMenuAction.menuActions=t.slice(0),i.push(this.toggleMenuAction)),i.forEach(n=>{this.actionBar.push(n,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(n)})})}getKeybindingLabel(e){var t,i,n;const s=this.lookupKeybindings?(i=(t=this.options).getKeyBinding)===null||i===void 0?void 0:i.call(t,e):void 0;return(n=s?.getLabel())!==null&&n!==void 0?n:void 0}clear(){this.submenuActionViewItems=[],this.disposables.clear(),this.actionBar.clear()}dispose(){this.clear(),this.disposables.dispose(),super.dispose()}}class O0 extends cs{constructor(e,t){t=t||p("moreActions","More Actions..."),super(O0.ID,t,void 0,!0),this._menuActions=[],this.toggleDropdownMenu=e}async run(){this.toggleDropdownMenu()}get menuActions(){return this._menuActions}set menuActions(e){this._menuActions=e}}O0.ID="toolbar.toggle.more";var e6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Wa=function(o,e){return function(t,i){e(t,i,o)}};let Ow=class extends Fae{constructor(e,t,i,n,s,r,a){super(e,s,{getKeyBinding:d=>{var c;return(c=r.lookupKeybinding(d.id))!==null&&c!==void 0?c:void 0},...t,allowContextMenu:!0,skipTelemetry:typeof t?.telemetrySource=="string"}),this._options=t,this._menuService=i,this._contextKeyService=n,this._contextMenuService=s,this._sessionDisposables=this._store.add(new se);const l=t?.telemetrySource;l&&this._store.add(this.actionBar.onDidRun(d=>a.publicLog2("workbenchActionExecuted",{id:d.action.id,from:l})))}setActions(e,t=[],i){var n,s,r;this._sessionDisposables.clear();const a=e.slice(),l=t.slice(),d=[];let c=0;const h=[];let u=!1;if(((n=this._options)===null||n===void 0?void 0:n.hiddenItemStrategy)!==-1)for(let g=0;g<a.length;g++){const f=a[g];!(f instanceof _r)&&!(f instanceof $_)||f.hideActions&&(d.push(f.hideActions.toggle),f.hideActions.toggle.checked&&c++,f.hideActions.isHidden&&(u=!0,a[g]=void 0,((s=this._options)===null||s===void 0?void 0:s.hiddenItemStrategy)!==0&&(h[g]=f)))}if(((r=this._options)===null||r===void 0?void 0:r.overflowBehavior)!==void 0){const g=Qne(new Set(this._options.overflowBehavior.exempted),rt.map(a,_=>_?.id)),f=this._options.overflowBehavior.maxItems-g.size;let m=0;for(let _=0;_<a.length;_++){const v=a[_];v&&(m++,!g.has(v.id)&&m>=f&&(a[_]=void 0,h[_]=v))}}gA(a),gA(h),super.setActions(a,dn.join(h,l)),d.length>0&&this._sessionDisposables.add(Q(this.getElement(),"contextmenu",g=>{var f,m,_,v,b;const C=new lr(Ue(this.getElement()),g),w=this.getItemAction(C.target);if(!w)return;C.preventDefault(),C.stopPropagation();let y=!1;if(c===1&&((f=this._options)===null||f===void 0?void 0:f.hiddenItemStrategy)===0){y=!0;for(let T=0;T<d.length;T++)if(d[T].checked){d[T]=bf({id:w.id,label:w.label,checked:!0,enabled:!1,run(){}});break}}let I;if(!y&&(w instanceof _r||w instanceof $_)){if(!w.hideActions)return;I=w.hideActions.hide}else I=bf({id:"label",label:p("hide","Hide"),enabled:!1,run(){}});const D=dn.join([I],d);!((m=this._options)===null||m===void 0)&&m.resetMenu&&!i&&(i=[this._options.resetMenu]),u&&i&&(D.push(new dn),D.push(bf({id:"resetThisMenu",label:p("resetThisMenu","Reset Menu"),run:()=>this._menuService.resetHiddenStates(i)}))),this._contextMenuService.showContextMenu({getAnchor:()=>C,getActions:()=>D,menuId:(_=this._options)===null||_===void 0?void 0:_.contextMenu,menuActionOptions:{renderShortTitle:!0,...(v=this._options)===null||v===void 0?void 0:v.menuOptions},skipTelemetry:typeof((b=this._options)===null||b===void 0?void 0:b.telemetrySource)=="string",contextKeyService:this._contextKeyService})}))}};Ow=e6([Wa(2,ra),Wa(3,We),Wa(4,Yo),Wa(5,Pt),Wa(6,Gs)],Ow);let qE=class extends Ow{constructor(e,t,i,n,s,r,a,l){super(e,{resetMenu:t,...i},n,s,r,a,l),this._onDidChangeMenuItems=this._store.add(new W);const d=this._store.add(n.createMenu(t,s,{emitEventsForSubmenuChanges:!0})),c=()=>{var h,u,g;const f=[],m=[];NM(d,i?.menuOptions,{primary:f,secondary:m},(h=i?.toolbarOptions)===null||h===void 0?void 0:h.primaryGroup,(u=i?.toolbarOptions)===null||u===void 0?void 0:u.shouldInlineSubmenu,(g=i?.toolbarOptions)===null||g===void 0?void 0:g.useSeparatorsInPrimaryActions),e.classList.toggle("has-no-actions",f.length===0&&m.length===0),super.setActions(f,m)};this._store.add(d.onDidChange(()=>{c(),this._onDidChangeMenuItems.fire(this)})),c()}setActions(){throw new ei("This toolbar is populated from a menu.")}};qE=e6([Wa(3,ra),Wa(4,We),Wa(5,Yo),Wa(6,Pt),Wa(7,Gs)],qE);class Bae extends Su{constructor(e){super(),this._getContext=e}runAction(e,t){return super.runAction(e,this._getContext())}}var Wae=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Vae=function(o,e){return function(t,i){e(t,i,o)}};class Hae{constructor(e){this.viewModel=e}getId(){return this.viewModel}}let Fw=class extends K{constructor(e,t,i,n){super(),this._container=e,this._overflowWidgetsDomNode=t,this._workbenchUIElementFactory=i,this._instantiationService=n,this._viewModel=Ct(this,void 0),this._collapsed=Xe(this,r=>{var a;return(a=this._viewModel.read(r))===null||a===void 0?void 0:a.collapsed.read(r)}),this._contentHeight=Ct(this,500),this.height=Xe(this,r=>(this._collapsed.read(r)?0:this._contentHeight.read(r))+this._outerEditorHeight),this._modifiedContentWidth=Ct(this,0),this._modifiedWidth=Ct(this,0),this._originalContentWidth=Ct(this,0),this._originalWidth=Ct(this,0),this.maxScroll=Xe(this,r=>{const a=this._modifiedContentWidth.read(r)-this._modifiedWidth.read(r),l=this._originalContentWidth.read(r)-this._originalWidth.read(r);return a>l?{maxScroll:a,width:this._modifiedWidth.read(r)}:{maxScroll:l,width:this._originalWidth.read(r)}}),this._elements=Jt("div.multiDiffEntry",[Jt("div.content",{style:{display:"flex",flexDirection:"column",flex:"1",overflow:"hidden"}},[Jt("div.header@header",[Jt("div.collapse-button@collapseButton"),Jt("div.title.show-file-icons@title",[]),Jt("div.actions@actions")]),Jt("div.editorParent",{style:{flex:"1",display:"flex",flexDirection:"column"}},[Jt("div.editorContainer@editor",{style:{flex:"1"}})])])]),this.editor=this._register(this._instantiationService.createInstance(zc,this._elements.editor,{overflowWidgetsDomNode:this._overflowWidgetsDomNode},{})),this.isModifedFocused=FF(this.editor.getModifiedEditor()),this.isOriginalFocused=FF(this.editor.getOriginalEditor()),this.isFocused=Xe(this,r=>this.isModifedFocused.read(r)||this.isOriginalFocused.read(r)),this._resourceLabel=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.title)):void 0,this._dataStore=new se,this._headerHeight=this._elements.header.clientHeight;const s=new yw(this._elements.collapseButton,{});this._register(xt(r=>{s.element.className="",s.icon=this._collapsed.read(r)?he.chevronRight:he.chevronDown})),this._register(s.onDidClick(()=>{var r;(r=this._viewModel.get())===null||r===void 0||r.collapsed.set(!this._collapsed.get(),void 0)})),this._register(xt(r=>{this._elements.editor.style.display=this._collapsed.read(r)?"none":"block"})),this.editor.getModifiedEditor().onDidLayoutChange(r=>{const a=this.editor.getModifiedEditor().getLayoutInfo().contentWidth;this._modifiedWidth.set(a,void 0)}),this.editor.getOriginalEditor().onDidLayoutChange(r=>{const a=this.editor.getOriginalEditor().getLayoutInfo().contentWidth;this._originalWidth.set(a,void 0)}),this._register(this.editor.onDidContentSizeChange(r=>{GC(a=>{this._contentHeight.set(r.contentHeight,a),this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(),a),this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(),a)})})),this._register(xt(r=>{const a=this.isFocused.read(r);this._elements.root.classList.toggle("focused",a)})),this._container.appendChild(this._elements.root),this._outerEditorHeight=38,this._register(this._instantiationService.createInstance(qE,this._elements.actions,N.MultiDiffEditorFileToolbar,{actionRunner:this._register(new Bae(()=>{var r,a;return(a=(r=this._viewModel.get())===null||r===void 0?void 0:r.diffEditorViewModel)===null||a===void 0?void 0:a.model.modified.uri})),menuOptions:{shouldForwardArgs:!0}}))}setScrollLeft(e){this._modifiedContentWidth.get()-this._modifiedWidth.get()>this._originalContentWidth.get()-this._originalWidth.get()?this.editor.getModifiedEditor().setScrollLeft(e):this.editor.getOriginalEditor().setScrollLeft(e)}setData(e){function t(n){return{...n,scrollBeyondLastLine:!1,hideUnchangedRegions:{enabled:!0},scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},renderOverviewRuler:!1,fixedOverflowWidgets:!0}}const i=e.viewModel.entry.value;i.onOptionsDidChange&&this._dataStore.add(i.onOptionsDidChange(()=>{var n;this.editor.updateOptions(t((n=i.options)!==null&&n!==void 0?n:{}))})),GC(n=>{var s,r;(s=this._resourceLabel)===null||s===void 0||s.setUri(e.viewModel.diffEditorViewModel.model.modified.uri),this._dataStore.clear(),this._viewModel.set(e.viewModel,n),this.editor.setModel(e.viewModel.diffEditorViewModel,n),this.editor.updateOptions(t((r=i.options)!==null&&r!==void 0?r:{}))})}render(e,t,i,n){this._elements.root.style.visibility="visible",this._elements.root.style.top=`${e.start}px`,this._elements.root.style.height=`${e.length}px`,this._elements.root.style.width=`${t}px`,this._elements.root.style.position="absolute";const s=Math.max(0,Math.min(e.length-this._headerHeight,n.start-e.start));this._elements.header.style.transform=`translateY(${s}px)`,GC(r=>{this.editor.layout({width:t,height:e.length-this._outerEditorHeight})}),this.editor.getOriginalEditor().setScrollTop(i),this._elements.header.classList.toggle("shadow",s>0||i>0)}hide(){this._elements.root.style.top="-100000px",this._elements.root.style.visibility="hidden"}};Fw=Wae([Vae(3,Oe)],Fw);function FF(o){return pi(e=>{const t=new se;return t.add(o.onDidFocusEditorWidget(()=>e(!0))),t.add(o.onDidBlurEditorWidget(()=>e(!1))),t},()=>o.hasWidgetFocus())}class zae{constructor(e){this._create=e,this._unused=new Set,this._used=new Set,this._itemData=new Map}getUnusedObj(e){var t;let i;if(this._unused.size===0)i=this._create(e),this._itemData.set(i,e);else{const n=[...this._unused.values()];i=(t=n.find(s=>this._itemData.get(s).getId()===e.getId()))!==null&&t!==void 0?t:n[0],this._unused.delete(i),this._itemData.set(i,e),i.setData(e)}return this._used.add(i),{object:i,dispose:()=>{this._used.delete(i),this._unused.size>5?i.dispose():this._unused.add(i)}}}dispose(){for(const e of this._used)e.dispose();for(const e of this._unused)e.dispose();this._used.clear(),this._unused.clear()}}var Uae=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},BF=function(o,e){return function(t,i){e(t,i,o)}};let GE=class extends K{constructor(e,t,i,n,s,r){super(),this._element=e,this._dimension=t,this._viewModel=i,this._workbenchUIElementFactory=n,this._parentContextKeyService=s,this._parentInstantiationService=r,this._elements=Jt("div",{style:{overflowY:"hidden"}},[Jt("div@content",{style:{overflow:"hidden"}}),Jt("div.monaco-editor@overflowWidgetsDomNode",{})]),this._sizeObserver=this._register(new jB(this._element,void 0)),this._objectPool=this._register(new zae(l=>{const d=this._instantiationService.createInstance(Fw,this._elements.content,this._elements.overflowWidgetsDomNode,this._workbenchUIElementFactory);return d.setData(l),d})),this._scrollable=this._register(new Wp({forceIntegerValues:!1,scheduleAtNextAnimationFrame:l=>Ks(Ue(this._element),l),smoothScrollDuration:100})),this._scrollableElement=this._register(new KS(this._elements.root,{vertical:1,horizontal:1,className:"monaco-component",useShadows:!1},this._scrollable)),this.scrollTop=pi(this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollTop),this.scrollLeft=pi(this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollLeft),this._viewItems=Kp(this,(l,d)=>{const c=this._viewModel.read(l);return c?c.items.read(l).map(u=>d.add(new $ae(u,this._objectPool,this.scrollLeft))):[]}),this._totalHeight=this._viewItems.map(this,(l,d)=>l.reduce((c,h)=>c+h.contentHeight.read(d),0)),this.activeDiffItem=Xe(this,l=>this._viewItems.read(l).find(d=>{var c;return(c=d.template.read(l))===null||c===void 0?void 0:c.isFocused.read(l)})),this.lastActiveDiffItem=Kre((l,d)=>{var c;return(c=this.activeDiffItem.read(l))!==null&&c!==void 0?c:d}),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._element)),this._instantiationService=this._parentInstantiationService.createChild(new xv([We,this._contextKeyService])),this._contextKeyService.createKey(M.inMultiDiffEditor.key,!0);const a=this._parentContextKeyService.createKey(M.multiDiffEditorAllCollapsed.key,!1);this._register(xt(l=>{const d=this._viewModel.read(l);if(d){const c=d.items.read(l).every(h=>h.collapsed.read(l));a.set(c)}})),this._register(xt(l=>{const d=this.lastActiveDiffItem.read(l);ti(c=>{var h;(h=this._viewModel.read(l))===null||h===void 0||h.activeDiffItem.set(d?.viewModel,c)})})),this._register(xt(l=>{const d=this._dimension.read(l);this._sizeObserver.observe(d)})),this._elements.content.style.position="relative",this._register(xt(l=>{const d=this._sizeObserver.height.read(l);this._elements.root.style.height=`${d}px`;const c=this._totalHeight.read(l);this._elements.content.style.height=`${c}px`;const h=this._sizeObserver.width.read(l);let u=h;const g=this._viewItems.read(l),f=L2(g,m=>m.maxScroll.read(l).maxScroll);if(f){const m=f.maxScroll.read(l);u=h+m.maxScroll}this._scrollableElement.setScrollDimensions({width:h,height:d,scrollHeight:c,scrollWidth:u})})),e.replaceChildren(this._scrollableElement.getDomNode()),this._register(Ae(()=>{e.replaceChildren()})),this._register(this._register(xt(l=>{GC(d=>{this.render(l)})})))}render(e){const t=this.scrollTop.read(e);let i=0,n=0,s=0;const r=this._sizeObserver.height.read(e),a=et.ofStartAndLength(t,r),l=this._sizeObserver.width.read(e);for(const d of this._viewItems.read(e)){const c=d.contentHeight.read(e),h=Math.min(c,r),u=et.ofStartAndLength(n,h),g=et.ofStartAndLength(s,c);if(g.isBefore(a))i-=c-h,d.hide();else if(g.isAfter(a))d.hide();else{const f=Math.max(0,Math.min(a.start-g.start,c-h));i-=f;const m=et.ofStartAndLength(t+i,r);d.render(u,f,l,m)}n+=h,s+=c}this._elements.content.style.transform=`translateY(${-(t+i)}px)`}};GE=Uae([BF(4,We),BF(5,Oe)],GE);class $ae extends K{constructor(e,t,i){super(),this.viewModel=e,this._objectPool=t,this._scrollLeft=i,this._lastTemplateData=Ct(this,{contentHeight:500,maxScroll:{maxScroll:0,width:0}}),this._templateRef=this._register(Iw(this,void 0)),this.contentHeight=Xe(this,n=>{var s,r,a;return(a=(r=(s=this._templateRef.read(n))===null||s===void 0?void 0:s.object.height)===null||r===void 0?void 0:r.read(n))!==null&&a!==void 0?a:this._lastTemplateData.read(n).contentHeight}),this.maxScroll=Xe(this,n=>{var s,r;return(r=(s=this._templateRef.read(n))===null||s===void 0?void 0:s.object.maxScroll.read(n))!==null&&r!==void 0?r:this._lastTemplateData.read(n).maxScroll}),this.template=Xe(this,n=>{var s;return(s=this._templateRef.read(n))===null||s===void 0?void 0:s.object}),this._isHidden=Ct(this,!1),this._register(xt(n=>{var s;const r=this._scrollLeft.read(n);(s=this._templateRef.read(n))===null||s===void 0||s.object.setScrollLeft(r)})),this._register(xt(n=>{const s=this._templateRef.read(n);!s||!this._isHidden.read(n)||s.object.isFocused.read(n)||ti(l=>{this._lastTemplateData.set({contentHeight:s.object.height.get(),maxScroll:{maxScroll:0,width:0}},l),s.object.hide(),this._templateRef.set(void 0,l)})}))}dispose(){this.hide(),super.dispose()}toString(){return`VirtualViewItem(${this.viewModel.entry.value.title})`}hide(){this._isHidden.set(!0,void 0)}render(e,t,i,n){this._isHidden.set(!1,void 0);let s=this._templateRef.get();s||(s=this._objectPool.getUnusedObj(new Hae(this.viewModel)),this._templateRef.set(s,void 0)),s.object.render(e,i,t,n)}}R("multiDiffEditor.headerBackground",{dark:"#808080",light:"#b4b4b4",hcDark:"#808080",hcLight:"#b4b4b4"},p("multiDiffEditor.headerBackground","The background color of the diff editor's header"));var Kae=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jae=function(o,e){return function(t,i){e(t,i,o)}};let ZE=class extends K{constructor(e,t,i){super(),this._element=e,this._workbenchUIElementFactory=t,this._instantiationService=i,this._dimension=Ct(this,void 0),this._viewModel=Ct(this,void 0),this._widgetImpl=Kp(this,(n,s)=>(Ea(Fw,n),s.add(this._instantiationService.createInstance(Ea(GE,n),this._element,this._dimension,this._viewModel,this._workbenchUIElementFactory)))),this._register(Bv(this._widgetImpl))}};ZE=Kae([jae(2,Oe)],ZE);function qae(o,e,t){return Pe.initialize(t||{}).createInstance(KE,o,e)}function Gae(o){return Pe.get(Dt).onCodeEditorAdd(t=>{o(t)})}function Zae(o){return Pe.get(Dt).onDiffEditorAdd(t=>{o(t)})}function Yae(){return Pe.get(Dt).listCodeEditors()}function Xae(){return Pe.get(Dt).listDiffEditors()}function Qae(o,e,t){return Pe.initialize(t||{}).createInstance(jE,o,e)}function Jae(o,e){const t=Pe.initialize(e||{});return new ZE(o,{},t)}function ele(o){if(typeof o.id!="string"||typeof o.run!="function")throw new Error("Invalid command descriptor, `id` and `run` are required properties!");return gt.registerCommand(o.id,o.run)}function tle(o){if(typeof o.id!="string"||typeof o.label!="string"||typeof o.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");const e=te.deserialize(o.precondition),t=(n,...s)=>cn.runEditorCommand(n,s,e,(r,a,l)=>Promise.resolve(o.run(a,...l))),i=new se;if(i.add(gt.registerCommand(o.id,t)),o.contextMenuGroupId){const n={command:{id:o.id,title:o.label},when:e,group:o.contextMenuGroupId,order:o.contextMenuOrder||0};i.add(vn.appendMenuItem(N.EditorContext,n))}if(Array.isArray(o.keybindings)){const n=Pe.get(Pt);if(!(n instanceof pp))console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService");else{const s=te.and(e,te.deserialize(o.keybindingContext));i.add(n.addDynamicKeybindings(o.keybindings.map(r=>({keybinding:r,command:o.id,when:s}))))}}return i}function ile(o){return t6([o])}function t6(o){const e=Pe.get(Pt);return e instanceof pp?e.addDynamicKeybindings(o.map(t=>({keybinding:t.keybinding,command:t.command,commandArgs:t.commandArgs,when:te.deserialize(t.when)}))):(console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),K.None)}function nle(o,e,t){const i=Pe.get(ni),n=i.getLanguageIdByMimeType(e)||e;return JB(Pe.get(ii),i,o,n,t)}function sle(o,e){const t=Pe.get(ni),i=t.getLanguageIdByMimeType(e)||e||So;o.setLanguage(t.createById(i))}function ole(o,e,t){o&&Pe.get(yl).changeOne(e,o.uri,t)}function rle(o){Pe.get(yl).changeAll(o,[])}function ale(o){return Pe.get(yl).read(o)}function lle(o){return Pe.get(yl).onMarkerChanged(o)}function dle(o){return Pe.get(ii).getModel(o)}function cle(){return Pe.get(ii).getModels()}function hle(o){return Pe.get(ii).onModelAdded(o)}function ule(o){return Pe.get(ii).onModelRemoved(o)}function gle(o){return Pe.get(ii).onModelLanguageChanged(t=>{o({model:t.model,oldLanguage:t.oldLanguageId})})}function fle(o){return lq(Pe.get(ii),Pe.get(Wt),o)}function ple(o,e){const t=Pe.get(ni),i=Pe.get(xr);return M2.colorizeElement(i,t,o,e).then(()=>{i.registerEditorContainer(o)})}function mle(o,e,t){const i=Pe.get(ni);return Pe.get(xr).registerEditorContainer(hi.document.body),M2.colorize(i,o,e,t)}function _le(o,e,t=4){return Pe.get(xr).registerEditorContainer(hi.document.body),M2.colorizeModelLine(o,e,t)}function vle(o){const e=Ti.get(o);return e||{getInitialState:()=>X_,tokenize:(t,i,n)=>n8(o,n)}}function ble(o,e){Ti.getOrCreate(e);const t=vle(e),i=ll(o),n=[];let s=t.getInitialState();for(let r=0,a=i.length;r<a;r++){const l=i[r],d=t.tokenize(l,!0,s);n[r]=d.tokens,s=d.endState}return n}function Cle(o,e){Pe.get(xr).defineTheme(o,e)}function wle(o){Pe.get(xr).setTheme(o)}function Sle(){Ek.clearAllFontInfos()}function yle(o,e){return gt.registerCommand({id:o,handler:e})}function Lle(o){return Pe.get(Qs).registerOpener({async open(t){return typeof t=="string"&&(t=Me.parse(t)),o.open(t)}})}function xle(o){return Pe.get(Dt).registerCodeEditorOpenHandler(async(t,i,n)=>{var s;if(!i)return null;const r=(s=t.options)===null||s===void 0?void 0:s.selection;let a;return r&&typeof r.endLineNumber=="number"&&typeof r.endColumn=="number"?a=r:r&&(a={lineNumber:r.startLineNumber,column:r.startColumn}),await o.openCodeEditor(i,t.resource,a)?i:null})}function Dle(){return{create:qae,getEditors:Yae,getDiffEditors:Xae,onDidCreateEditor:Gae,onDidCreateDiffEditor:Zae,createDiffEditor:Qae,addCommand:ele,addEditorAction:tle,addKeybindingRule:ile,addKeybindingRules:t6,createModel:nle,setModelLanguage:sle,setModelMarkers:ole,getModelMarkers:ale,removeAllMarkers:rle,onDidChangeMarkers:lle,getModels:cle,getModel:dle,onDidCreateModel:hle,onWillDisposeModel:ule,onDidChangeModelLanguage:gle,createWebWorker:fle,colorizeElement:ple,colorize:mle,colorizeModelLine:_le,tokenize:ble,defineTheme:Cle,setTheme:wle,remeasureFonts:Sle,registerCommand:yle,registerLinkOpener:Lle,registerEditorOpener:xle,AccessibilitySupport:VD,ContentWidgetPositionPreference:jD,CursorChangeReason:qD,DefaultEndOfLine:GD,EditorAutoIndentStrategy:YD,EditorOption:XD,EndOfLinePreference:QD,EndOfLineSequence:JD,MinimapPosition:lk,MouseTargetType:dk,OverlayWidgetPositionPreference:ck,OverviewRulerLane:hk,GlyphMarginLane:ek,RenderLineNumbersType:gk,RenderMinimap:fk,ScrollbarVisibility:mk,ScrollType:pk,TextEditorCursorBlinkingStyle:Sk,TextEditorCursorStyle:yk,TrackedRangeStickiness:Lk,WrappingIndent:xk,InjectedTextCursorStops:ik,PositionAffinity:uk,ShowAiIconMode:vk,ConfigurationChangedEvent:N3,BareFontInfo:au,FontInfo:Ik,TextModelResolvedOptions:EC,FindMatch:q_,ApplyUpdateResult:Jm,EditorZoom:Ro,createMultiFileDiffEditor:Jae,EditorType:pv,EditorOptions:sa}}function kle(o,e){if(!e||!Array.isArray(e))return!1;for(const t of e)if(!o(t))return!1;return!0}function jb(o,e){return typeof o=="boolean"?o:e}function WF(o,e){return typeof o=="string"?o:e}function Ile(o){const e={};for(const t of o)e[t]=!0;return e}function VF(o,e=!1){e&&(o=o.map(function(i){return i.toLowerCase()}));const t=Ile(o);return e?function(i){return t[i.toLowerCase()]!==void 0&&t.hasOwnProperty(i.toLowerCase())}:function(i){return t[i]!==void 0&&t.hasOwnProperty(i)}}function YE(o,e){e=e.replace(/@@/g,"");let t=0,i;do i=!1,e=e.replace(/@(\w+)/g,function(s,r){i=!0;let a="";if(typeof o[r]=="string")a=o[r];else if(o[r]&&o[r]instanceof RegExp)a=o[r].source;else throw o[r]===void 0?qt(o,"language definition does not contain attribute '"+r+"', used at: "+e):qt(o,"attribute reference '"+r+"' must be a string, used at: "+e);return Pg(a)?"":"(?:"+a+")"}),t++;while(i&&t<5);e=e.replace(/\x01/g,"@");const n=(o.ignoreCase?"i":"")+(o.unicode?"u":"");return new RegExp(e,n)}function Ele(o,e,t,i){if(i<0)return o;if(i<e.length)return e[i];if(i>=100){i=i-100;const n=t.split(".");if(n.unshift(t),i<n.length)return n[i]}return null}function Nle(o,e,t,i){let n=-1,s=t,r=t.match(/^\$(([sS]?)(\d\d?)|#)(.*)$/);r&&(r[3]&&(n=parseInt(r[3]),r[2]&&(n=n+100)),s=r[4]);let a="~",l=s;!s||s.length===0?(a="!=",l=""):/^\w*$/.test(l)?a="==":(r=s.match(/^(@|!@|~|!~|==|!=)(.*)$/),r&&(a=r[1],l=r[2]));let d;if((a==="~"||a==="!~")&&/^(\w|\|)*$/.test(l)){const c=VF(l.split("|"),o.ignoreCase);d=function(h){return a==="~"?c(h):!c(h)}}else if(a==="@"||a==="!@"){const c=o[l];if(!c)throw qt(o,"the @ match target '"+l+"' is not defined, in rule: "+e);if(!kle(function(u){return typeof u=="string"},c))throw qt(o,"the @ match target '"+l+"' must be an array of strings, in rule: "+e);const h=VF(c,o.ignoreCase);d=function(u){return a==="@"?h(u):!h(u)}}else if(a==="~"||a==="!~")if(l.indexOf("$")<0){const c=YE(o,"^"+l+"$");d=function(h){return a==="~"?c.test(h):!c.test(h)}}else d=function(c,h,u,g){return YE(o,"^"+zd(o,l,h,u,g)+"$").test(c)};else if(l.indexOf("$")<0){const c=pc(o,l);d=function(h){return a==="=="?h===c:h!==c}}else{const c=pc(o,l);d=function(h,u,g,f,m){const _=zd(o,c,u,g,f);return a==="=="?h===_:h!==_}}return n===-1?{name:t,value:i,test:function(c,h,u,g){return d(c,c,h,u,g)}}:{name:t,value:i,test:function(c,h,u,g){const f=Ele(c,h,u,n);return d(f||"",c,h,u,g)}}}function XE(o,e,t){if(t){if(typeof t=="string")return t;if(t.token||t.token===""){if(typeof t.token!="string")throw qt(o,"a 'token' attribute must be of type string, in rule: "+e);{const i={token:t.token};if(t.token.indexOf("$")>=0&&(i.tokenSubst=!0),typeof t.bracket=="string")if(t.bracket==="@open")i.bracket=1;else if(t.bracket==="@close")i.bracket=-1;else throw qt(o,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+e);if(t.next){if(typeof t.next!="string")throw qt(o,"the next state must be a string value in rule: "+e);{let n=t.next;if(!/^(@pop|@push|@popall)$/.test(n)&&(n[0]==="@"&&(n=n.substr(1)),n.indexOf("$")<0&&!kq(o,zd(o,n,"",[],""))))throw qt(o,"the next state '"+t.next+"' is not defined in rule: "+e);i.next=n}}return typeof t.goBack=="number"&&(i.goBack=t.goBack),typeof t.switchTo=="string"&&(i.switchTo=t.switchTo),typeof t.log=="string"&&(i.log=t.log),typeof t.nextEmbedded=="string"&&(i.nextEmbedded=t.nextEmbedded,o.usesEmbedded=!0),i}}else if(Array.isArray(t)){const i=[];for(let n=0,s=t.length;n<s;n++)i[n]=XE(o,e,t[n]);return{group:i}}else if(t.cases){const i=[];for(const s in t.cases)if(t.cases.hasOwnProperty(s)){const r=XE(o,e,t.cases[s]);s==="@default"||s==="@"||s===""?i.push({test:void 0,value:r,name:s}):s==="@eos"?i.push({test:function(a,l,d,c){return c},value:r,name:s}):i.push(Nle(o,e,s,r))}const n=o.defaultToken;return{test:function(s,r,a,l){for(const d of i)if(!d.test||d.test(s,r,a,l))return d.value;return n}}}else throw qt(o,"an action must be a string, an object with a 'token' or 'cases' attribute, or an array of actions; in rule: "+e)}else return{token:""}}class Tle{constructor(e){this.regex=new RegExp(""),this.action={token:""},this.matchOnlyAtLineStart=!1,this.name="",this.name=e}setRegex(e,t){let i;if(typeof t=="string")i=t;else if(t instanceof RegExp)i=t.source;else throw qt(e,"rules must start with a match string or regular expression: "+this.name);this.matchOnlyAtLineStart=i.length>0&&i[0]==="^",this.name=this.name+": "+i,this.regex=YE(e,"^(?:"+(this.matchOnlyAtLineStart?i.substr(1):i)+")")}setAction(e,t){this.action=XE(e,this.name,t)}}function i6(o,e){if(!e||typeof e!="object")throw new Error("Monarch: expecting a language definition object");const t={};t.languageId=o,t.includeLF=jb(e.includeLF,!1),t.noThrow=!1,t.maxStack=100,t.start=typeof e.start=="string"?e.start:null,t.ignoreCase=jb(e.ignoreCase,!1),t.unicode=jb(e.unicode,!1),t.tokenPostfix=WF(e.tokenPostfix,"."+t.languageId),t.defaultToken=WF(e.defaultToken,"source"),t.usesEmbedded=!1;const i=e;i.languageId=o,i.includeLF=t.includeLF,i.ignoreCase=t.ignoreCase,i.unicode=t.unicode,i.noThrow=t.noThrow,i.usesEmbedded=t.usesEmbedded,i.stateNames=e.tokenizer,i.defaultToken=t.defaultToken;function n(r,a,l){for(const d of l){let c=d.include;if(c){if(typeof c!="string")throw qt(t,"an 'include' attribute must be a string at: "+r);if(c[0]==="@"&&(c=c.substr(1)),!e.tokenizer[c])throw qt(t,"include target '"+c+"' is not defined at: "+r);n(r+"."+c,a,e.tokenizer[c])}else{const h=new Tle(r);if(Array.isArray(d)&&d.length>=1&&d.length<=3)if(h.setRegex(i,d[0]),d.length>=3)if(typeof d[1]=="string")h.setAction(i,{token:d[1],next:d[2]});else if(typeof d[1]=="object"){const u=d[1];u.next=d[2],h.setAction(i,u)}else throw qt(t,"a next state as the last element of a rule can only be given if the action is either an object or a string, at: "+r);else h.setAction(i,d[1]);else{if(!d.regex)throw qt(t,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+r);d.name&&typeof d.name=="string"&&(h.name=d.name),d.matchOnlyAtStart&&(h.matchOnlyAtLineStart=jb(d.matchOnlyAtLineStart,!1)),h.setRegex(i,d.regex),h.setAction(i,d.action)}a.push(h)}}}if(!e.tokenizer||typeof e.tokenizer!="object")throw qt(t,"a language definition must define the 'tokenizer' attribute as an object");t.tokenizer=[];for(const r in e.tokenizer)if(e.tokenizer.hasOwnProperty(r)){t.start||(t.start=r);const a=e.tokenizer[r];t.tokenizer[r]=new Array,n("tokenizer."+r,t.tokenizer[r],a)}if(t.usesEmbedded=i.usesEmbedded,e.brackets){if(!Array.isArray(e.brackets))throw qt(t,"the 'brackets' attribute must be defined as an array")}else e.brackets=[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}];const s=[];for(const r of e.brackets){let a=r;if(a&&Array.isArray(a)&&a.length===3&&(a={token:a[2],open:a[0],close:a[1]}),a.open===a.close)throw qt(t,"open and close brackets in a 'brackets' attribute must be different: "+a.open+`
|
|
641
|
-
hint: use the 'bracket' attribute if matching on equal brackets is required.`);if(typeof a.open=="string"&&typeof a.token=="string"&&typeof a.close=="string")s.push({token:a.token+t.tokenPostfix,open:pc(t,a.open),close:pc(t,a.close)});else throw qt(t,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return t.brackets=s,t.noThrow=!0,t}function Mle(o){Yf.registerLanguage(o)}function Rle(){let o=[];return o=o.concat(Yf.getLanguages()),o}function Ale(o){return Pe.get(ni).languageIdCodec.encodeLanguageId(o)}function Ple(o,e){return Pe.withServices(()=>{const i=Pe.get(ni).onDidRequestRichLanguageFeatures(n=>{n===o&&(i.dispose(),e())});return i})}function Ole(o,e){return Pe.withServices(()=>{const i=Pe.get(ni).onDidRequestBasicLanguageFeatures(n=>{n===o&&(i.dispose(),e())});return i})}function Fle(o,e){if(!Pe.get(ni).isRegisteredLanguageId(o))throw new Error(`Cannot set configuration for unknown language ${o}`);return Pe.get(Wt).register(o,e,100)}class Ble{constructor(e,t){this._languageId=e,this._actual=t}dispose(){}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,i){if(typeof this._actual.tokenize=="function")return F0.adaptTokenize(this._languageId,this._actual,e,i);throw new Error("Not supported!")}tokenizeEncoded(e,t,i){const n=this._actual.tokenizeEncoded(e,i);return new gS(n.tokens,n.endState)}}class F0{constructor(e,t,i,n){this._languageId=e,this._actual=t,this._languageService=i,this._standaloneThemeService=n}dispose(){}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t){const i=[];let n=0;for(let s=0,r=e.length;s<r;s++){const a=e[s];let l=a.startIndex;s===0?l=0:l<n&&(l=n),i[s]=new F_(l,a.scopes,t),n=l}return i}static adaptTokenize(e,t,i,n){const s=t.tokenize(i,n),r=F0._toClassicTokens(s.tokens,e);let a;return s.endState.equals(n)?a=n:a=s.endState,new XT(r,a)}tokenize(e,t,i){return F0.adaptTokenize(this._languageId,this._actual,e,i)}_toBinaryTokens(e,t){const i=e.encodeLanguageId(this._languageId),n=this._standaloneThemeService.getColorTheme().tokenTheme,s=[];let r=0,a=0;for(let d=0,c=t.length;d<c;d++){const h=t[d],u=n.match(i,h.scopes)|1024;if(r>0&&s[r-1]===u)continue;let g=h.startIndex;d===0?g=0:g<a&&(g=a),s[r++]=g,s[r++]=u,a=g}const l=new Uint32Array(r);for(let d=0;d<r;d++)l[d]=s[d];return l}tokenizeEncoded(e,t,i){const n=this._actual.tokenize(e,i),s=this._toBinaryTokens(this._languageService.languageIdCodec,n.tokens);let r;return n.endState.equals(i)?r=i:r=n.endState,new gS(s,r)}}function Wle(o){return typeof o.getInitialState=="function"}function Vle(o){return"tokenizeEncoded"in o}function n6(o){return o&&typeof o.then=="function"}function Hle(o){const e=Pe.get(xr);if(o){const t=[null];for(let i=1,n=o.length;i<n;i++)t[i]=q.fromHex(o[i]);e.setColorMapOverride(t)}else e.setColorMapOverride(null)}function s6(o,e){return Vle(e)?new Ble(o,e):new F0(o,e,Pe.get(ni),Pe.get(xr))}function hR(o,e){const t=new Qz(async()=>{const i=await Promise.resolve(e.create());return i?Wle(i)?s6(o,i):new e0(Pe.get(ni),Pe.get(xr),o,i6(o,i),Pe.get(ft)):null});return Ti.registerFactory(o,t)}function zle(o,e){if(!Pe.get(ni).isRegisteredLanguageId(o))throw new Error(`Cannot set tokens provider for unknown language ${o}`);return n6(e)?hR(o,{create:()=>e}):Ti.register(o,s6(o,e))}function Ule(o,e){const t=i=>new e0(Pe.get(ni),Pe.get(xr),o,i6(o,i),Pe.get(ft));return n6(e)?hR(o,{create:()=>e}):Ti.register(o,t(e))}function $le(o,e){return Pe.get(Se).referenceProvider.register(o,e)}function Kle(o,e){return Pe.get(Se).renameProvider.register(o,e)}function jle(o,e){return Pe.get(Se).signatureHelpProvider.register(o,e)}function qle(o,e){return Pe.get(Se).hoverProvider.register(o,{provideHover:(i,n,s)=>{const r=i.getWordAtPosition(n);return Promise.resolve(e.provideHover(i,n,s)).then(a=>{if(a)return!a.range&&r&&(a.range=new k(n.lineNumber,r.startColumn,n.lineNumber,r.endColumn)),a.range||(a.range=new k(n.lineNumber,n.column,n.lineNumber,n.column)),a})}})}function Gle(o,e){return Pe.get(Se).documentSymbolProvider.register(o,e)}function Zle(o,e){return Pe.get(Se).documentHighlightProvider.register(o,e)}function Yle(o,e){return Pe.get(Se).linkedEditingRangeProvider.register(o,e)}function Xle(o,e){return Pe.get(Se).definitionProvider.register(o,e)}function Qle(o,e){return Pe.get(Se).implementationProvider.register(o,e)}function Jle(o,e){return Pe.get(Se).typeDefinitionProvider.register(o,e)}function ede(o,e){return Pe.get(Se).codeLensProvider.register(o,e)}function tde(o,e,t){return Pe.get(Se).codeActionProvider.register(o,{providedCodeActionKinds:t?.providedCodeActionKinds,documentation:t?.documentation,provideCodeActions:(n,s,r,a)=>{const d=Pe.get(yl).read({resource:n.uri}).filter(c=>k.areIntersectingOrTouching(c,s));return e.provideCodeActions(n,s,{markers:d,only:r.only,trigger:r.trigger},a)},resolveCodeAction:e.resolveCodeAction})}function ide(o,e){return Pe.get(Se).documentFormattingEditProvider.register(o,e)}function nde(o,e){return Pe.get(Se).documentRangeFormattingEditProvider.register(o,e)}function sde(o,e){return Pe.get(Se).onTypeFormattingEditProvider.register(o,e)}function ode(o,e){return Pe.get(Se).linkProvider.register(o,e)}function rde(o,e){return Pe.get(Se).completionProvider.register(o,e)}function ade(o,e){return Pe.get(Se).colorProvider.register(o,e)}function lde(o,e){return Pe.get(Se).foldingRangeProvider.register(o,e)}function dde(o,e){return Pe.get(Se).declarationProvider.register(o,e)}function cde(o,e){return Pe.get(Se).selectionRangeProvider.register(o,e)}function hde(o,e){return Pe.get(Se).documentSemanticTokensProvider.register(o,e)}function ude(o,e){return Pe.get(Se).documentRangeSemanticTokensProvider.register(o,e)}function gde(o,e){return Pe.get(Se).inlineCompletionsProvider.register(o,e)}function fde(o,e){return Pe.get(Se).inlayHintsProvider.register(o,e)}function pde(){return{register:Mle,getLanguages:Rle,onLanguage:Ple,onLanguageEncountered:Ole,getEncodedLanguageId:Ale,setLanguageConfiguration:Fle,setColorMap:Hle,registerTokensProviderFactory:hR,setTokensProvider:zle,setMonarchTokensProvider:Ule,registerReferenceProvider:$le,registerRenameProvider:Kle,registerCompletionItemProvider:rde,registerSignatureHelpProvider:jle,registerHoverProvider:qle,registerDocumentSymbolProvider:Gle,registerDocumentHighlightProvider:Zle,registerLinkedEditingRangeProvider:Yle,registerDefinitionProvider:Xle,registerImplementationProvider:Qle,registerTypeDefinitionProvider:Jle,registerCodeLensProvider:ede,registerCodeActionProvider:tde,registerDocumentFormattingEditProvider:ide,registerDocumentRangeFormattingEditProvider:nde,registerOnTypeFormattingEditProvider:sde,registerLinkProvider:ode,registerColorProvider:ade,registerFoldingRangeProvider:lde,registerDeclarationProvider:dde,registerSelectionRangeProvider:cde,registerDocumentSemanticTokensProvider:hde,registerDocumentRangeSemanticTokensProvider:ude,registerInlineCompletionsProvider:gde,registerInlayHintsProvider:fde,DocumentHighlightKind:ZD,CompletionItemKind:UD,CompletionItemTag:$D,CompletionItemInsertTextRule:zD,SymbolKind:Ck,SymbolTag:wk,IndentAction:tk,CompletionTriggerKind:KD,SignatureHelpTriggerKind:bk,InlayHintKind:nk,InlineCompletionTriggerKind:sk,CodeActionTriggerType:HD,FoldingRangeKind:as,SelectedSuggestionInfo:K3}}const uR=ot("IEditorCancelService"),o6=new be("cancellableOperation",!1,p("cancellableOperation","Whether the editor runs a cancellable operation, e.g. like 'Peek References'"));ct(uR,class{constructor(){this._tokens=new WeakMap}add(o,e){let t=this._tokens.get(o);t||(t=o.invokeWithinContext(n=>{const s=o6.bindTo(n.get(We)),r=new rs;return{key:s,tokens:r}}),this._tokens.set(o,t));let i;return t.key.set(!0),i=t.tokens.push(e),()=>{i&&(i(),t.key.set(!t.tokens.isEmpty()),i=void 0)}}cancel(o){const e=this._tokens.get(o);if(!e)return;const t=e.tokens.pop();t&&(t.cancel(),e.key.set(!e.tokens.isEmpty()))}},1);class mde extends Wi{constructor(e,t){super(t),this.editor=e,this._unregister=e.invokeWithinContext(i=>i.get(uR).add(e,this))}dispose(){this._unregister(),super.dispose()}}ue(new class extends cn{constructor(){super({id:"editor.cancelOperation",kbOpts:{weight:100,primary:9},precondition:o6})}runEditorCommand(o,e){o.get(uR).cancel(e)}});let r6=class QE{constructor(e,t){if(this.flags=t,(this.flags&1)!==0){const i=e.getModel();this.modelVersionId=i?jf("{0}#{1}",i.uri.toString(),i.getVersionId()):null}else this.modelVersionId=null;(this.flags&4)!==0?this.position=e.getPosition():this.position=null,(this.flags&2)!==0?this.selection=e.getSelection():this.selection=null,(this.flags&8)!==0?(this.scrollLeft=e.getScrollLeft(),this.scrollTop=e.getScrollTop()):(this.scrollLeft=-1,this.scrollTop=-1)}_equals(e){if(!(e instanceof QE))return!1;const t=e;return!(this.modelVersionId!==t.modelVersionId||this.scrollLeft!==t.scrollLeft||this.scrollTop!==t.scrollTop||!this.position&&t.position||this.position&&!t.position||this.position&&t.position&&!this.position.equals(t.position)||!this.selection&&t.selection||this.selection&&!t.selection||this.selection&&t.selection&&!this.selection.equalsRange(t.selection))}validate(e){return this._equals(new QE(e,this.flags))}};class Uc extends mde{constructor(e,t,i,n){super(e,n),this._listener=new se,t&4&&this._listener.add(e.onDidChangeCursorPosition(s=>{(!i||!k.containsPosition(i,s.position))&&this.cancel()})),t&2&&this._listener.add(e.onDidChangeCursorSelection(s=>{(!i||!k.containsRange(i,s.selection))&&this.cancel()})),t&8&&this._listener.add(e.onDidScrollChange(s=>this.cancel())),t&1&&(this._listener.add(e.onDidChangeModel(s=>this.cancel())),this._listener.add(e.onDidChangeModelContent(s=>this.cancel())))}dispose(){this._listener.dispose(),super.dispose()}}class gR extends Wi{constructor(e,t){super(t),this._listener=e.onDidChangeContent(()=>this.cancel())}dispose(){this._listener.dispose(),super.dispose()}}function $c(o){return o&&typeof o.getEditorType=="function"?o.getEditorType()===pv.ICodeEditor:!1}function _de(o){return o&&typeof o.getEditorType=="function"?o.getEditorType()===pv.IDiffEditor:!1}class vp{static _handleEolEdits(e,t){let i;const n=[];for(const s of t)typeof s.eol=="number"&&(i=s.eol),s.range&&typeof s.text=="string"&&n.push(s);return typeof i=="number"&&e.hasModel()&&e.getModel().pushEOL(i),n}static _isFullModelReplaceEdit(e,t){if(!e.hasModel())return!1;const i=e.getModel(),n=i.validateRange(t.range);return i.getFullModelRange().equalsRange(n)}static execute(e,t,i){i&&e.pushUndoStop();const n=na.capture(e),s=vp._handleEolEdits(e,t);s.length===1&&vp._isFullModelReplaceEdit(e,s[0])?e.executeEdits("formatEditsCommand",s.map(r=>oi.replace(k.lift(r.range),r.text))):e.executeEdits("formatEditsCommand",s.map(r=>oi.replaceMove(k.lift(r.range),r.text))),i&&e.pushUndoStop(),n.restoreRelativeVerticalPositionOfCursor(e)}}class HF{constructor(e){this.value=e,this._lower=e.toLowerCase()}static toKey(e){return typeof e=="string"?e.toLowerCase():e._lower}}class vde{constructor(e){if(this._set=new Set,e)for(const t of e)this.add(t)}add(e){this._set.add(HF.toKey(e))}has(e){return this._set.has(HF.toKey(e))}}function a6(o,e,t){const i=[],n=new vde,s=o.ordered(t);for(const a of s)i.push(a),a.extensionId&&n.add(a.extensionId);const r=e.ordered(t);for(const a of r){if(a.extensionId){if(n.has(a.extensionId))continue;n.add(a.extensionId)}i.push({displayName:a.displayName,extensionId:a.extensionId,provideDocumentFormattingEdits(l,d,c){return a.provideDocumentRangeFormattingEdits(l,l.getFullModelRange(),d,c)}})}return i}class Pu{static setFormatterSelector(e){return{dispose:Pu._selectors.unshift(e)}}static async select(e,t,i){if(e.length===0)return;const n=rt.first(Pu._selectors);if(n)return await n(e,t,i)}}Pu._selectors=new rs;async function l6(o,e,t,i,n,s,r){const a=o.get(Oe),{documentRangeFormattingEditProvider:l}=o.get(Se),d=$c(e)?e.getModel():e,c=l.ordered(d),h=await Pu.select(c,d,i);h&&(n.report(h),await a.invokeFunction(bde,h,e,t,s,r))}async function bde(o,e,t,i,n,s){var r,a;const l=o.get(Lr),d=o.get(Zs),c=o.get(WS);let h,u;$c(t)?(h=t.getModel(),u=new Uc(t,5,void 0,n)):(h=t,u=new gR(t,n));const g=[];let f=0;for(const C of BT(i).sort(k.compareRangesUsingStarts))f>0&&k.areIntersectingOrTouching(g[f-1],C)?g[f-1]=k.fromPositions(g[f-1].getStartPosition(),C.getEndPosition()):f=g.push(C);const m=async C=>{var w,y;d.trace("[format][provideDocumentRangeFormattingEdits] (request)",(w=e.extensionId)===null||w===void 0?void 0:w.value,C);const I=await e.provideDocumentRangeFormattingEdits(h,C,h.getFormattingOptions(),u.token)||[];return d.trace("[format][provideDocumentRangeFormattingEdits] (response)",(y=e.extensionId)===null||y===void 0?void 0:y.value,I),I},_=(C,w)=>{if(!C.length||!w.length)return!1;const y=C.reduce((I,D)=>k.plusRange(I,D.range),C[0].range);if(!w.some(I=>k.intersectRanges(y,I.range)))return!1;for(const I of C)for(const D of w)if(k.intersectRanges(I.range,D.range))return!0;return!1},v=[],b=[];try{if(typeof e.provideDocumentRangesFormattingEdits=="function"){d.trace("[format][provideDocumentRangeFormattingEdits] (request)",(r=e.extensionId)===null||r===void 0?void 0:r.value,g);const C=await e.provideDocumentRangesFormattingEdits(h,g,h.getFormattingOptions(),u.token)||[];d.trace("[format][provideDocumentRangeFormattingEdits] (response)",(a=e.extensionId)===null||a===void 0?void 0:a.value,C),b.push(C)}else{for(const C of g){if(u.token.isCancellationRequested)return!0;b.push(await m(C))}for(let C=0;C<g.length;++C)for(let w=C+1;w<g.length;++w){if(u.token.isCancellationRequested)return!0;if(_(b[C],b[w])){const y=k.plusRange(g[C],g[w]),I=await m(y);g.splice(w,1),g.splice(C,1),g.push(y),b.splice(w,1),b.splice(C,1),b.push(I),C=0,w=0}}}for(const C of b){if(u.token.isCancellationRequested)return!0;const w=await l.computeMoreMinimalEdits(h.uri,C);w&&v.push(...w)}}finally{u.dispose()}if(v.length===0)return!1;if($c(t))vp.execute(t,v,!0),t.revealPositionInCenterIfOutsideViewport(t.getPosition(),1);else{const[{range:C}]=v,w=new xe(C.startLineNumber,C.startColumn,C.endLineNumber,C.endColumn);h.pushEditOperations([w],v.map(y=>({text:y.text,range:k.lift(y.range),forceMoveMarkers:!0})),y=>{for(const{range:I}of y)if(k.areIntersectingOrTouching(I,w))return[new xe(I.startLineNumber,I.startColumn,I.endLineNumber,I.endColumn)];return null})}return c.notify("format",s),!0}async function Cde(o,e,t,i,n,s){const r=o.get(Oe),a=o.get(Se),l=$c(e)?e.getModel():e,d=a6(a.documentFormattingEditProvider,a.documentRangeFormattingEditProvider,l),c=await Pu.select(d,l,t);c&&(i.report(c),await r.invokeFunction(wde,c,e,t,n,s))}async function wde(o,e,t,i,n,s){const r=o.get(Lr),a=o.get(WS);let l,d;$c(t)?(l=t.getModel(),d=new Uc(t,5,void 0,n)):(l=t,d=new gR(t,n));let c;try{const h=await e.provideDocumentFormattingEdits(l,l.getFormattingOptions(),d.token);if(c=await r.computeMoreMinimalEdits(l.uri,h),d.token.isCancellationRequested)return!0}finally{d.dispose()}if(!c||c.length===0)return!1;if($c(t))vp.execute(t,c,i!==2),i!==2&&t.revealPositionInCenterIfOutsideViewport(t.getPosition(),1);else{const[{range:h}]=c,u=new xe(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn);l.pushEditOperations([u],c.map(g=>({text:g.text,range:k.lift(g.range),forceMoveMarkers:!0})),g=>{for(const{range:f}of g)if(k.areIntersectingOrTouching(f,u))return[new xe(f.startLineNumber,f.startColumn,f.endLineNumber,f.endColumn)];return null})}return a.notify("format",s),!0}async function Sde(o,e,t,i,n,s){const r=e.documentRangeFormattingEditProvider.ordered(t);for(const a of r){const l=await Promise.resolve(a.provideDocumentRangeFormattingEdits(t,i,n,s)).catch(Mi);if(Bn(l))return await o.computeMoreMinimalEdits(t.uri,l)}}async function yde(o,e,t,i,n){const s=a6(e.documentFormattingEditProvider,e.documentRangeFormattingEditProvider,t);for(const r of s){const a=await Promise.resolve(r.provideDocumentFormattingEdits(t,i,n)).catch(Mi);if(Bn(a))return await o.computeMoreMinimalEdits(t.uri,a)}}function d6(o,e,t,i,n,s,r){const a=e.onTypeFormattingEditProvider.ordered(t);return a.length===0||a[0].autoFormatTriggerCharacters.indexOf(n)<0?Promise.resolve(void 0):Promise.resolve(a[0].provideOnTypeFormattingEdits(t,i,n,s,r)).catch(Mi).then(l=>o.computeMoreMinimalEdits(t.uri,l))}gt.registerCommand("_executeFormatRangeProvider",async function(o,...e){const[t,i,n]=e;Tt(Me.isUri(t)),Tt(k.isIRange(i));const s=o.get(ks),r=o.get(Lr),a=o.get(Se),l=await s.createModelReference(t);try{return Sde(r,a,l.object.textEditorModel,k.lift(i),n,st.None)}finally{l.dispose()}});gt.registerCommand("_executeFormatDocumentProvider",async function(o,...e){const[t,i]=e;Tt(Me.isUri(t));const n=o.get(ks),s=o.get(Lr),r=o.get(Se),a=await n.createModelReference(t);try{return yde(s,r,a.object.textEditorModel,i,st.None)}finally{a.dispose()}});gt.registerCommand("_executeFormatOnTypeProvider",async function(o,...e){const[t,i,n,s]=e;Tt(Me.isUri(t)),Tt(V.isIPosition(i)),Tt(typeof n=="string");const r=o.get(ks),a=o.get(Lr),l=o.get(Se),d=await r.createModelReference(t);try{return d6(a,l,d.object.textEditorModel,V.lift(i),n,s,st.None)}finally{d.dispose()}});sa.wrappingIndent.defaultValue=0;sa.glyphMargin.defaultValue=!1;sa.autoIndent.defaultValue=3;sa.overviewRulerLanes.defaultValue=2;Pu.setFormatterSelector((o,e,t)=>Promise.resolve(o[0]));const fs=j3();fs.editor=Dle();fs.languages=pde();const Lde=fs.CancellationTokenSource,xde=fs.Emitter,Dde=fs.KeyCode,kde=fs.KeyMod,Ide=fs.Position,Ede=fs.Range,Nde=fs.Selection,Tde=fs.SelectionDirection,Mde=fs.MarkerSeverity,Rde=fs.MarkerTag,Ade=fs.Uri,Pde=fs.Token,Ode=fs.editor,Fde=fs.languages,Qx=globalThis.MonacoEnvironment;(Qx?.globalAPI||typeof define=="function"&&define.amd)&&(globalThis.monaco=fs);typeof globalThis.require<"u"&&typeof globalThis.require.config=="function"&&globalThis.require.config({ignoreDuplicateModules:["vscode-languageserver-types","vscode-languageserver-types/main","vscode-languageserver-textdocument","vscode-languageserver-textdocument/main","vscode-nls","vscode-nls/vscode-nls","jsonc-parser","jsonc-parser/main","vscode-uri","vscode-uri/index","vs/basic-languages/typescript/typescript"]});const c6=Object.freeze(Object.defineProperty({__proto__:null,CancellationTokenSource:Lde,Emitter:xde,KeyCode:Dde,KeyMod:kde,MarkerSeverity:Mde,MarkerTag:Rde,Position:Ide,Range:Ede,Selection:Nde,SelectionDirection:Tde,Token:Pde,Uri:Ade,editor:Ode,languages:Fde},Symbol.toStringTag,{value:"Module"}));/*!-----------------------------------------------------------------------------
|
|
641
|
+
hint: use the 'bracket' attribute if matching on equal brackets is required.`);if(typeof a.open=="string"&&typeof a.token=="string"&&typeof a.close=="string")s.push({token:a.token+t.tokenPostfix,open:pc(t,a.open),close:pc(t,a.close)});else throw qt(t,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return t.brackets=s,t.noThrow=!0,t}function Mle(o){Yf.registerLanguage(o)}function Rle(){let o=[];return o=o.concat(Yf.getLanguages()),o}function Ale(o){return Pe.get(ni).languageIdCodec.encodeLanguageId(o)}function Ple(o,e){return Pe.withServices(()=>{const i=Pe.get(ni).onDidRequestRichLanguageFeatures(n=>{n===o&&(i.dispose(),e())});return i})}function Ole(o,e){return Pe.withServices(()=>{const i=Pe.get(ni).onDidRequestBasicLanguageFeatures(n=>{n===o&&(i.dispose(),e())});return i})}function Fle(o,e){if(!Pe.get(ni).isRegisteredLanguageId(o))throw new Error(`Cannot set configuration for unknown language ${o}`);return Pe.get(Wt).register(o,e,100)}class Ble{constructor(e,t){this._languageId=e,this._actual=t}dispose(){}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,i){if(typeof this._actual.tokenize=="function")return F0.adaptTokenize(this._languageId,this._actual,e,i);throw new Error("Not supported!")}tokenizeEncoded(e,t,i){const n=this._actual.tokenizeEncoded(e,i);return new gS(n.tokens,n.endState)}}class F0{constructor(e,t,i,n){this._languageId=e,this._actual=t,this._languageService=i,this._standaloneThemeService=n}dispose(){}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t){const i=[];let n=0;for(let s=0,r=e.length;s<r;s++){const a=e[s];let l=a.startIndex;s===0?l=0:l<n&&(l=n),i[s]=new F_(l,a.scopes,t),n=l}return i}static adaptTokenize(e,t,i,n){const s=t.tokenize(i,n),r=F0._toClassicTokens(s.tokens,e);let a;return s.endState.equals(n)?a=n:a=s.endState,new XT(r,a)}tokenize(e,t,i){return F0.adaptTokenize(this._languageId,this._actual,e,i)}_toBinaryTokens(e,t){const i=e.encodeLanguageId(this._languageId),n=this._standaloneThemeService.getColorTheme().tokenTheme,s=[];let r=0,a=0;for(let d=0,c=t.length;d<c;d++){const h=t[d],u=n.match(i,h.scopes)|1024;if(r>0&&s[r-1]===u)continue;let g=h.startIndex;d===0?g=0:g<a&&(g=a),s[r++]=g,s[r++]=u,a=g}const l=new Uint32Array(r);for(let d=0;d<r;d++)l[d]=s[d];return l}tokenizeEncoded(e,t,i){const n=this._actual.tokenize(e,i),s=this._toBinaryTokens(this._languageService.languageIdCodec,n.tokens);let r;return n.endState.equals(i)?r=i:r=n.endState,new gS(s,r)}}function Wle(o){return typeof o.getInitialState=="function"}function Vle(o){return"tokenizeEncoded"in o}function n6(o){return o&&typeof o.then=="function"}function Hle(o){const e=Pe.get(xr);if(o){const t=[null];for(let i=1,n=o.length;i<n;i++)t[i]=q.fromHex(o[i]);e.setColorMapOverride(t)}else e.setColorMapOverride(null)}function s6(o,e){return Vle(e)?new Ble(o,e):new F0(o,e,Pe.get(ni),Pe.get(xr))}function hR(o,e){const t=new Qz(async()=>{const i=await Promise.resolve(e.create());return i?Wle(i)?s6(o,i):new e0(Pe.get(ni),Pe.get(xr),o,i6(o,i),Pe.get(ft)):null});return Ti.registerFactory(o,t)}function zle(o,e){if(!Pe.get(ni).isRegisteredLanguageId(o))throw new Error(`Cannot set tokens provider for unknown language ${o}`);return n6(e)?hR(o,{create:()=>e}):Ti.register(o,s6(o,e))}function Ule(o,e){const t=i=>new e0(Pe.get(ni),Pe.get(xr),o,i6(o,i),Pe.get(ft));return n6(e)?hR(o,{create:()=>e}):Ti.register(o,t(e))}function $le(o,e){return Pe.get(Se).referenceProvider.register(o,e)}function Kle(o,e){return Pe.get(Se).renameProvider.register(o,e)}function jle(o,e){return Pe.get(Se).signatureHelpProvider.register(o,e)}function qle(o,e){return Pe.get(Se).hoverProvider.register(o,{provideHover:(i,n,s)=>{const r=i.getWordAtPosition(n);return Promise.resolve(e.provideHover(i,n,s)).then(a=>{if(a)return!a.range&&r&&(a.range=new k(n.lineNumber,r.startColumn,n.lineNumber,r.endColumn)),a.range||(a.range=new k(n.lineNumber,n.column,n.lineNumber,n.column)),a})}})}function Gle(o,e){return Pe.get(Se).documentSymbolProvider.register(o,e)}function Zle(o,e){return Pe.get(Se).documentHighlightProvider.register(o,e)}function Yle(o,e){return Pe.get(Se).linkedEditingRangeProvider.register(o,e)}function Xle(o,e){return Pe.get(Se).definitionProvider.register(o,e)}function Qle(o,e){return Pe.get(Se).implementationProvider.register(o,e)}function Jle(o,e){return Pe.get(Se).typeDefinitionProvider.register(o,e)}function ede(o,e){return Pe.get(Se).codeLensProvider.register(o,e)}function tde(o,e,t){return Pe.get(Se).codeActionProvider.register(o,{providedCodeActionKinds:t?.providedCodeActionKinds,documentation:t?.documentation,provideCodeActions:(n,s,r,a)=>{const d=Pe.get(yl).read({resource:n.uri}).filter(c=>k.areIntersectingOrTouching(c,s));return e.provideCodeActions(n,s,{markers:d,only:r.only,trigger:r.trigger},a)},resolveCodeAction:e.resolveCodeAction})}function ide(o,e){return Pe.get(Se).documentFormattingEditProvider.register(o,e)}function nde(o,e){return Pe.get(Se).documentRangeFormattingEditProvider.register(o,e)}function sde(o,e){return Pe.get(Se).onTypeFormattingEditProvider.register(o,e)}function ode(o,e){return Pe.get(Se).linkProvider.register(o,e)}function rde(o,e){return Pe.get(Se).completionProvider.register(o,e)}function ade(o,e){return Pe.get(Se).colorProvider.register(o,e)}function lde(o,e){return Pe.get(Se).foldingRangeProvider.register(o,e)}function dde(o,e){return Pe.get(Se).declarationProvider.register(o,e)}function cde(o,e){return Pe.get(Se).selectionRangeProvider.register(o,e)}function hde(o,e){return Pe.get(Se).documentSemanticTokensProvider.register(o,e)}function ude(o,e){return Pe.get(Se).documentRangeSemanticTokensProvider.register(o,e)}function gde(o,e){return Pe.get(Se).inlineCompletionsProvider.register(o,e)}function fde(o,e){return Pe.get(Se).inlayHintsProvider.register(o,e)}function pde(){return{register:Mle,getLanguages:Rle,onLanguage:Ple,onLanguageEncountered:Ole,getEncodedLanguageId:Ale,setLanguageConfiguration:Fle,setColorMap:Hle,registerTokensProviderFactory:hR,setTokensProvider:zle,setMonarchTokensProvider:Ule,registerReferenceProvider:$le,registerRenameProvider:Kle,registerCompletionItemProvider:rde,registerSignatureHelpProvider:jle,registerHoverProvider:qle,registerDocumentSymbolProvider:Gle,registerDocumentHighlightProvider:Zle,registerLinkedEditingRangeProvider:Yle,registerDefinitionProvider:Xle,registerImplementationProvider:Qle,registerTypeDefinitionProvider:Jle,registerCodeLensProvider:ede,registerCodeActionProvider:tde,registerDocumentFormattingEditProvider:ide,registerDocumentRangeFormattingEditProvider:nde,registerOnTypeFormattingEditProvider:sde,registerLinkProvider:ode,registerColorProvider:ade,registerFoldingRangeProvider:lde,registerDeclarationProvider:dde,registerSelectionRangeProvider:cde,registerDocumentSemanticTokensProvider:hde,registerDocumentRangeSemanticTokensProvider:ude,registerInlineCompletionsProvider:gde,registerInlayHintsProvider:fde,DocumentHighlightKind:ZD,CompletionItemKind:UD,CompletionItemTag:$D,CompletionItemInsertTextRule:zD,SymbolKind:Ck,SymbolTag:wk,IndentAction:tk,CompletionTriggerKind:KD,SignatureHelpTriggerKind:bk,InlayHintKind:nk,InlineCompletionTriggerKind:sk,CodeActionTriggerType:HD,FoldingRangeKind:as,SelectedSuggestionInfo:K3}}const uR=ot("IEditorCancelService"),o6=new be("cancellableOperation",!1,p("cancellableOperation","Whether the editor runs a cancellable operation, e.g. like 'Peek References'"));ct(uR,class{constructor(){this._tokens=new WeakMap}add(o,e){let t=this._tokens.get(o);t||(t=o.invokeWithinContext(n=>{const s=o6.bindTo(n.get(We)),r=new rs;return{key:s,tokens:r}}),this._tokens.set(o,t));let i;return t.key.set(!0),i=t.tokens.push(e),()=>{i&&(i(),t.key.set(!t.tokens.isEmpty()),i=void 0)}}cancel(o){const e=this._tokens.get(o);if(!e)return;const t=e.tokens.pop();t&&(t.cancel(),e.key.set(!e.tokens.isEmpty()))}},1);class mde extends Wi{constructor(e,t){super(t),this.editor=e,this._unregister=e.invokeWithinContext(i=>i.get(uR).add(e,this))}dispose(){this._unregister(),super.dispose()}}ue(new class extends cn{constructor(){super({id:"editor.cancelOperation",kbOpts:{weight:100,primary:9},precondition:o6})}runEditorCommand(o,e){o.get(uR).cancel(e)}});let r6=class QE{constructor(e,t){if(this.flags=t,(this.flags&1)!==0){const i=e.getModel();this.modelVersionId=i?jf("{0}#{1}",i.uri.toString(),i.getVersionId()):null}else this.modelVersionId=null;(this.flags&4)!==0?this.position=e.getPosition():this.position=null,(this.flags&2)!==0?this.selection=e.getSelection():this.selection=null,(this.flags&8)!==0?(this.scrollLeft=e.getScrollLeft(),this.scrollTop=e.getScrollTop()):(this.scrollLeft=-1,this.scrollTop=-1)}_equals(e){if(!(e instanceof QE))return!1;const t=e;return!(this.modelVersionId!==t.modelVersionId||this.scrollLeft!==t.scrollLeft||this.scrollTop!==t.scrollTop||!this.position&&t.position||this.position&&!t.position||this.position&&t.position&&!this.position.equals(t.position)||!this.selection&&t.selection||this.selection&&!t.selection||this.selection&&t.selection&&!this.selection.equalsRange(t.selection))}validate(e){return this._equals(new QE(e,this.flags))}};class Uc extends mde{constructor(e,t,i,n){super(e,n),this._listener=new se,t&4&&this._listener.add(e.onDidChangeCursorPosition(s=>{(!i||!k.containsPosition(i,s.position))&&this.cancel()})),t&2&&this._listener.add(e.onDidChangeCursorSelection(s=>{(!i||!k.containsRange(i,s.selection))&&this.cancel()})),t&8&&this._listener.add(e.onDidScrollChange(s=>this.cancel())),t&1&&(this._listener.add(e.onDidChangeModel(s=>this.cancel())),this._listener.add(e.onDidChangeModelContent(s=>this.cancel())))}dispose(){this._listener.dispose(),super.dispose()}}class gR extends Wi{constructor(e,t){super(t),this._listener=e.onDidChangeContent(()=>this.cancel())}dispose(){this._listener.dispose(),super.dispose()}}function $c(o){return o&&typeof o.getEditorType=="function"?o.getEditorType()===pv.ICodeEditor:!1}function _de(o){return o&&typeof o.getEditorType=="function"?o.getEditorType()===pv.IDiffEditor:!1}class vp{static _handleEolEdits(e,t){let i;const n=[];for(const s of t)typeof s.eol=="number"&&(i=s.eol),s.range&&typeof s.text=="string"&&n.push(s);return typeof i=="number"&&e.hasModel()&&e.getModel().pushEOL(i),n}static _isFullModelReplaceEdit(e,t){if(!e.hasModel())return!1;const i=e.getModel(),n=i.validateRange(t.range);return i.getFullModelRange().equalsRange(n)}static execute(e,t,i){i&&e.pushUndoStop();const n=na.capture(e),s=vp._handleEolEdits(e,t);s.length===1&&vp._isFullModelReplaceEdit(e,s[0])?e.executeEdits("formatEditsCommand",s.map(r=>oi.replace(k.lift(r.range),r.text))):e.executeEdits("formatEditsCommand",s.map(r=>oi.replaceMove(k.lift(r.range),r.text))),i&&e.pushUndoStop(),n.restoreRelativeVerticalPositionOfCursor(e)}}class HF{constructor(e){this.value=e,this._lower=e.toLowerCase()}static toKey(e){return typeof e=="string"?e.toLowerCase():e._lower}}class vde{constructor(e){if(this._set=new Set,e)for(const t of e)this.add(t)}add(e){this._set.add(HF.toKey(e))}has(e){return this._set.has(HF.toKey(e))}}function a6(o,e,t){const i=[],n=new vde,s=o.ordered(t);for(const a of s)i.push(a),a.extensionId&&n.add(a.extensionId);const r=e.ordered(t);for(const a of r){if(a.extensionId){if(n.has(a.extensionId))continue;n.add(a.extensionId)}i.push({displayName:a.displayName,extensionId:a.extensionId,provideDocumentFormattingEdits(l,d,c){return a.provideDocumentRangeFormattingEdits(l,l.getFullModelRange(),d,c)}})}return i}class Pu{static setFormatterSelector(e){return{dispose:Pu._selectors.unshift(e)}}static async select(e,t,i){if(e.length===0)return;const n=rt.first(Pu._selectors);if(n)return await n(e,t,i)}}Pu._selectors=new rs;async function l6(o,e,t,i,n,s,r){const a=o.get(Oe),{documentRangeFormattingEditProvider:l}=o.get(Se),d=$c(e)?e.getModel():e,c=l.ordered(d),h=await Pu.select(c,d,i);h&&(n.report(h),await a.invokeFunction(bde,h,e,t,s,r))}async function bde(o,e,t,i,n,s){var r,a;const l=o.get(Lr),d=o.get(Zs),c=o.get(WS);let h,u;$c(t)?(h=t.getModel(),u=new Uc(t,5,void 0,n)):(h=t,u=new gR(t,n));const g=[];let f=0;for(const C of BT(i).sort(k.compareRangesUsingStarts))f>0&&k.areIntersectingOrTouching(g[f-1],C)?g[f-1]=k.fromPositions(g[f-1].getStartPosition(),C.getEndPosition()):f=g.push(C);const m=async C=>{var w,y;d.trace("[format][provideDocumentRangeFormattingEdits] (request)",(w=e.extensionId)===null||w===void 0?void 0:w.value,C);const I=await e.provideDocumentRangeFormattingEdits(h,C,h.getFormattingOptions(),u.token)||[];return d.trace("[format][provideDocumentRangeFormattingEdits] (response)",(y=e.extensionId)===null||y===void 0?void 0:y.value,I),I},_=(C,w)=>{if(!C.length||!w.length)return!1;const y=C.reduce((I,D)=>k.plusRange(I,D.range),C[0].range);if(!w.some(I=>k.intersectRanges(y,I.range)))return!1;for(const I of C)for(const D of w)if(k.intersectRanges(I.range,D.range))return!0;return!1},v=[],b=[];try{if(typeof e.provideDocumentRangesFormattingEdits=="function"){d.trace("[format][provideDocumentRangeFormattingEdits] (request)",(r=e.extensionId)===null||r===void 0?void 0:r.value,g);const C=await e.provideDocumentRangesFormattingEdits(h,g,h.getFormattingOptions(),u.token)||[];d.trace("[format][provideDocumentRangeFormattingEdits] (response)",(a=e.extensionId)===null||a===void 0?void 0:a.value,C),b.push(C)}else{for(const C of g){if(u.token.isCancellationRequested)return!0;b.push(await m(C))}for(let C=0;C<g.length;++C)for(let w=C+1;w<g.length;++w){if(u.token.isCancellationRequested)return!0;if(_(b[C],b[w])){const y=k.plusRange(g[C],g[w]),I=await m(y);g.splice(w,1),g.splice(C,1),g.push(y),b.splice(w,1),b.splice(C,1),b.push(I),C=0,w=0}}}for(const C of b){if(u.token.isCancellationRequested)return!0;const w=await l.computeMoreMinimalEdits(h.uri,C);w&&v.push(...w)}}finally{u.dispose()}if(v.length===0)return!1;if($c(t))vp.execute(t,v,!0),t.revealPositionInCenterIfOutsideViewport(t.getPosition(),1);else{const[{range:C}]=v,w=new xe(C.startLineNumber,C.startColumn,C.endLineNumber,C.endColumn);h.pushEditOperations([w],v.map(y=>({text:y.text,range:k.lift(y.range),forceMoveMarkers:!0})),y=>{for(const{range:I}of y)if(k.areIntersectingOrTouching(I,w))return[new xe(I.startLineNumber,I.startColumn,I.endLineNumber,I.endColumn)];return null})}return c.notify("format",s),!0}async function Cde(o,e,t,i,n,s){const r=o.get(Oe),a=o.get(Se),l=$c(e)?e.getModel():e,d=a6(a.documentFormattingEditProvider,a.documentRangeFormattingEditProvider,l),c=await Pu.select(d,l,t);c&&(i.report(c),await r.invokeFunction(wde,c,e,t,n,s))}async function wde(o,e,t,i,n,s){const r=o.get(Lr),a=o.get(WS);let l,d;$c(t)?(l=t.getModel(),d=new Uc(t,5,void 0,n)):(l=t,d=new gR(t,n));let c;try{const h=await e.provideDocumentFormattingEdits(l,l.getFormattingOptions(),d.token);if(c=await r.computeMoreMinimalEdits(l.uri,h),d.token.isCancellationRequested)return!0}finally{d.dispose()}if(!c||c.length===0)return!1;if($c(t))vp.execute(t,c,i!==2),i!==2&&t.revealPositionInCenterIfOutsideViewport(t.getPosition(),1);else{const[{range:h}]=c,u=new xe(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn);l.pushEditOperations([u],c.map(g=>({text:g.text,range:k.lift(g.range),forceMoveMarkers:!0})),g=>{for(const{range:f}of g)if(k.areIntersectingOrTouching(f,u))return[new xe(f.startLineNumber,f.startColumn,f.endLineNumber,f.endColumn)];return null})}return a.notify("format",s),!0}async function Sde(o,e,t,i,n,s){const r=e.documentRangeFormattingEditProvider.ordered(t);for(const a of r){const l=await Promise.resolve(a.provideDocumentRangeFormattingEdits(t,i,n,s)).catch(Mi);if(Bn(l))return await o.computeMoreMinimalEdits(t.uri,l)}}async function yde(o,e,t,i,n){const s=a6(e.documentFormattingEditProvider,e.documentRangeFormattingEditProvider,t);for(const r of s){const a=await Promise.resolve(r.provideDocumentFormattingEdits(t,i,n)).catch(Mi);if(Bn(a))return await o.computeMoreMinimalEdits(t.uri,a)}}function d6(o,e,t,i,n,s,r){const a=e.onTypeFormattingEditProvider.ordered(t);return a.length===0||a[0].autoFormatTriggerCharacters.indexOf(n)<0?Promise.resolve(void 0):Promise.resolve(a[0].provideOnTypeFormattingEdits(t,i,n,s,r)).catch(Mi).then(l=>o.computeMoreMinimalEdits(t.uri,l))}gt.registerCommand("_executeFormatRangeProvider",async function(o,...e){const[t,i,n]=e;Tt(Me.isUri(t)),Tt(k.isIRange(i));const s=o.get(ks),r=o.get(Lr),a=o.get(Se),l=await s.createModelReference(t);try{return Sde(r,a,l.object.textEditorModel,k.lift(i),n,st.None)}finally{l.dispose()}});gt.registerCommand("_executeFormatDocumentProvider",async function(o,...e){const[t,i]=e;Tt(Me.isUri(t));const n=o.get(ks),s=o.get(Lr),r=o.get(Se),a=await n.createModelReference(t);try{return yde(s,r,a.object.textEditorModel,i,st.None)}finally{a.dispose()}});gt.registerCommand("_executeFormatOnTypeProvider",async function(o,...e){const[t,i,n,s]=e;Tt(Me.isUri(t)),Tt(V.isIPosition(i)),Tt(typeof n=="string");const r=o.get(ks),a=o.get(Lr),l=o.get(Se),d=await r.createModelReference(t);try{return d6(a,l,d.object.textEditorModel,V.lift(i),n,s,st.None)}finally{d.dispose()}});sa.wrappingIndent.defaultValue=0;sa.glyphMargin.defaultValue=!1;sa.autoIndent.defaultValue=3;sa.overviewRulerLanes.defaultValue=2;Pu.setFormatterSelector((o,e,t)=>Promise.resolve(o[0]));const fs=j3();fs.editor=Dle();fs.languages=pde();const Lde=fs.CancellationTokenSource,xde=fs.Emitter,Dde=fs.KeyCode,kde=fs.KeyMod,Ide=fs.Position,Ede=fs.Range,Nde=fs.Selection,Tde=fs.SelectionDirection,Mde=fs.MarkerSeverity,Rde=fs.MarkerTag,Ade=fs.Uri,Pde=fs.Token,Ode=fs.editor,Fde=fs.languages,Qx=globalThis.MonacoEnvironment;(Qx?.globalAPI||typeof define=="function"&&define.amd)&&(globalThis.monaco=fs);typeof globalThis.require<"u"&&typeof globalThis.require.config=="function"&&globalThis.require.config({ignoreDuplicateModules:["vscode-languageserver-types","vscode-languageserver-types/main","vscode-languageserver-textdocument","vscode-languageserver-textdocument/main","vscode-nls","vscode-nls/vscode-nls","jsonc-parser","jsonc-parser/main","vscode-uri","vscode-uri/index","vs/basic-languages/typescript/typescript"]});const c6=Object.freeze(Object.defineProperty({__proto__:null,CancellationTokenSource:Lde,Emitter:xde,KeyCode:Dde,KeyMod:kde,MarkerSeverity:Mde,MarkerTag:Rde,Position:Ide,Range:Ede,Selection:Nde,SelectionDirection:Tde,Token:Pde,Uri:Ade,editor:Ode,languages:Fde},Symbol.toStringTag,{value:"Module"}));class Jx{constructor(e,t,i,n){this.priority=e,this.range=t,this.initialMousePosX=i,this.initialMousePosY=n,this.type=1}equals(e){return e.type===1&&this.range.equalsRange(e.range)}canAdoptVisibleHover(e,t){return e.type===1&&t.lineNumber===this.range.startLineNumber}}class ZC{constructor(e,t,i,n,s,r){this.priority=e,this.owner=t,this.range=i,this.initialMousePosX=n,this.initialMousePosY=s,this.supportsMarkerHover=r,this.type=2}equals(e){return e.type===2&&this.owner===e.owner}canAdoptVisibleHover(e,t){return e.type===2&&this.owner===e.owner}}const ag=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}};/*!-----------------------------------------------------------------------------
|
|
642
642
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
643
643
|
* Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
|
|
644
644
|
* Released under the MIT license
|
|
645
645
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
646
|
-
*-----------------------------------------------------------------------------*/var Bde=Object.defineProperty,Wde=Object.getOwnPropertyDescriptor,Vde=Object.getOwnPropertyNames,Hde=Object.prototype.hasOwnProperty,zde=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Vde(e))!Hde.call(o,n)&&n!==t&&Bde(o,n,{get:()=>e[n],enumerable:!(i=Wde(e,n))||i.enumerable});return o},Ude=(o,e,t)=>(zde(o,e,"default"),t),qm={};Ude(qm,c6);var h6={},
|
|
646
|
+
*-----------------------------------------------------------------------------*/var Bde=Object.defineProperty,Wde=Object.getOwnPropertyDescriptor,Vde=Object.getOwnPropertyNames,Hde=Object.prototype.hasOwnProperty,zde=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Vde(e))!Hde.call(o,n)&&n!==t&&Bde(o,n,{get:()=>e[n],enumerable:!(i=Wde(e,n))||i.enumerable});return o},Ude=(o,e,t)=>(zde(o,e,"default"),t),qm={};Ude(qm,c6);var h6={},eD={},u6=class{static getOrCreate(o){return eD[o]||(eD[o]=new u6(o)),eD[o]}_languageId;_loadingTriggered;_lazyLoadPromise;_lazyLoadPromiseResolve;_lazyLoadPromiseReject;constructor(o){this._languageId=o,this._loadingTriggered=!1,this._lazyLoadPromise=new Promise((e,t)=>{this._lazyLoadPromiseResolve=e,this._lazyLoadPromiseReject=t})}load(){return this._loadingTriggered||(this._loadingTriggered=!0,h6[this._languageId].loader().then(o=>this._lazyLoadPromiseResolve(o),o=>this._lazyLoadPromiseReject(o))),this._lazyLoadPromise}};function $de(o){const e=o.id;h6[e]=o,qm.languages.register(o);const t=u6.getOrCreate(e);qm.languages.registerTokensProviderFactory(e,{create:async()=>(await t.load()).language}),qm.languages.onLanguageEncountered(e,async()=>{const i=await t.load();qm.languages.setLanguageConfiguration(e,i.conf)})}$de({id:"yaml",extensions:[".yaml",".yml"],aliases:["YAML","yaml","YML","yml"],mimetypes:["application/x-yaml","text/x-yaml"],loader:()=>u3(()=>import("./yaml.eb0f9c1e.DNvATgZi.js"),[],import.meta.url)});/*!-----------------------------------------------------------------------------
|
|
647
647
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
648
648
|
* Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
|
|
649
649
|
* Released under the MIT license
|
|
650
650
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
651
|
-
*-----------------------------------------------------------------------------*/var Kde=Object.defineProperty,jde=Object.getOwnPropertyDescriptor,qde=Object.getOwnPropertyNames,Gde=Object.prototype.hasOwnProperty,Zde=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of qde(e))!Gde.call(o,n)&&n!==t&&Kde(o,n,{get:()=>e[n],enumerable:!(i=jde(e,n))||i.enumerable});return o},Yde=(o,e,t)=>(Zde(o,e,"default"),t),Wv={};Yde(Wv,c6);var Xde=class{_onDidChange=new Wv.Emitter;_diagnosticsOptions;_modeConfiguration;_languageId;constructor(o,e,t){this._languageId=o,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(o){this._diagnosticsOptions=o||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(o){this._modeConfiguration=o||Object.create(null),this._onDidChange.fire(this)}},Qde={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},Jde={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},g6=new Xde("json",Qde,Jde);Wv.languages.json={jsonDefaults:g6};function ece(){return u3(()=>import("./jsonMode.
|
|
652
|
-
`):o}function UF(o){return o.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${o.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof o.code=="string"&&typeof o.errno=="number"&&typeof o.syscall=="string"?p("nodeExceptionMessage","A system error occurred ({0})",o.message):o.message||p("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}function f6(o=null,e=!1){if(!o)return p("error.defaultMessage","An unknown error occurred. Please consult the log for more details.");if(Array.isArray(o)){const t=Qr(o),i=f6(t[0],e);return t.length>1?p("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(ds(o))return o;if(o.detail){const t=o.detail;if(t.error)return eD(t.error,e);if(t.exception)return eD(t.exception,e)}return o.stack?eD(o,e):o.message?o.message:p("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}function tce(o){var e;const t=new Map;for(const i of o)t.set(i,((e=t.get(i))!==null&&e!==void 0?e:0)+1);return t}class S_{constructor(){this.chunkCount=0,this.chunkOccurrences=new Map,this.documents=new Map}calculateScores(e,t){const i=this.computeEmbedding(e),n=new Map,s=[];for(const[r,a]of this.documents){if(t.isCancellationRequested)return[];for(const l of a.chunks){const d=this.computeSimilarityScore(l,i,n);d>0&&s.push({key:r,score:d})}}return s}static termFrequencies(e){return tce(S_.splitTerms(e))}static*splitTerms(e){const t=i=>i.toLowerCase();for(const[i]of e.matchAll(new RegExp("\\b\\p{Letter}[\\p{Letter}\\d]{2,}\\b","gu"))){yield t(i);const n=i.replace(/([a-z])([A-Z])/g,"$1 $2").split(/\s+/g);if(n.length>1)for(const s of n)s.length>2&&new RegExp("\\p{Letter}{3,}","gu").test(s)&&(yield t(s))}}updateDocuments(e){var t;for(const{key:i}of e)this.deleteDocument(i);for(const i of e){const n=[];for(const s of i.textChunks){const r=S_.termFrequencies(s);for(const a of r.keys())this.chunkOccurrences.set(a,((t=this.chunkOccurrences.get(a))!==null&&t!==void 0?t:0)+1);n.push({text:s,tf:r})}this.chunkCount+=n.length,this.documents.set(i.key,{chunks:n})}return this}deleteDocument(e){const t=this.documents.get(e);if(t){this.documents.delete(e),this.chunkCount-=t.chunks.length;for(const i of t.chunks)for(const n of i.tf.keys()){const s=this.chunkOccurrences.get(n);if(typeof s=="number"){const r=s-1;r<=0?this.chunkOccurrences.delete(n):this.chunkOccurrences.set(n,r)}}}}computeSimilarityScore(e,t,i){let n=0;for(const[s,r]of Object.entries(t)){const a=e.tf.get(s);if(!a)continue;let l=i.get(s);typeof l!="number"&&(l=this.computeIdf(s),i.set(s,l));const d=a*l;n+=d*r}return n}computeEmbedding(e){const t=S_.termFrequencies(e);return this.computeTfidf(t)}computeIdf(e){var t;const i=(t=this.chunkOccurrences.get(e))!==null&&t!==void 0?t:0;return i>0?Math.log((this.chunkCount+1)/i):0}computeTfidf(e){const t=Object.create(null);for(const[i,n]of e){const s=this.computeIdf(i);s>0&&(t[i]=n*s)}return t}}function ice(o){var e,t;const i=o.slice(0);i.sort((s,r)=>r.score-s.score);const n=(t=(e=i[0])===null||e===void 0?void 0:e.score)!==null&&t!==void 0?t:0;if(n>0)for(const s of i)s.score/=n;return i}var hf;(function(o){o[o.NO_ACTION=0]="NO_ACTION",o[o.CLOSE_PICKER=1]="CLOSE_PICKER",o[o.REFRESH_PICKER=2]="REFRESH_PICKER",o[o.REMOVE_ITEM=3]="REMOVE_ITEM"})(hf||(hf={}));function tD(o){const e=o;return Array.isArray(e.items)}function $F(o){const e=o;return!!e.picks&&e.additionalPicks instanceof Promise}class nce extends K{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,i){var n;const s=new se;e.canAcceptInBackground=!!(!((n=this.options)===null||n===void 0)&&n.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let r;const a=s.add(new Cn),l=async()=>{const d=a.value=new se;r?.dispose(!0),e.busy=!1,r=new Wi(t);const c=r.token,h=e.value.substr(this.prefix.length).trim(),u=this._getPicks(h,d,c,i),g=(m,_)=>{var v;let b,C;if(tD(m)?(b=m.items,C=m.active):b=m,b.length===0){if(_)return!1;(h.length>0||e.hideInput)&&(!((v=this.options)===null||v===void 0)&&v.noResultsPick)&&(P_(this.options.noResultsPick)?b=[this.options.noResultsPick(h)]:b=[this.options.noResultsPick])}return e.items=b,C&&(e.activeItems=[C]),!0},f=async m=>{let _=!1,v=!1;await Promise.all([(async()=>{typeof m.mergeDelay=="number"&&(await Mc(m.mergeDelay),c.isCancellationRequested)||v||(_=g(m.picks,!0))})(),(async()=>{e.busy=!0;try{const b=await m.additionalPicks;if(c.isCancellationRequested)return;let C,w;tD(m.picks)?(C=m.picks.items,w=m.picks.active):C=m.picks;let y,I;if(tD(b)?(y=b.items,I=b.active):y=b,y.length>0||!_){let D;if(!w&&!I){const T=e.activeItems[0];T&&C.indexOf(T)!==-1&&(D=T)}g({items:[...C,...y],active:w||I||D})}}finally{c.isCancellationRequested||(e.busy=!1),v=!0}})()])};if(u!==null)if($F(u))await f(u);else if(!(u instanceof Promise))g(u);else{e.busy=!0;try{const m=await u;if(c.isCancellationRequested)return;$F(m)?await f(m):g(m)}finally{c.isCancellationRequested||(e.busy=!1)}}};return s.add(e.onDidChangeValue(()=>l())),l(),s.add(e.onDidAccept(d=>{const[c]=e.selectedItems;typeof c?.accept=="function"&&(d.inBackground||e.hide(),c.accept(e.keyMods,d))})),s.add(e.onDidTriggerItemButton(async({button:d,item:c})=>{var h,u;if(typeof c.trigger=="function"){const g=(u=(h=c.buttons)===null||h===void 0?void 0:h.indexOf(d))!==null&&u!==void 0?u:-1;if(g>=0){const f=c.trigger(g,e.keyMods),m=typeof f=="number"?f:await f;if(t.isCancellationRequested)return;switch(m){case hf.NO_ACTION:break;case hf.CLOSE_PICKER:e.hide();break;case hf.REFRESH_PICKER:l();break;case hf.REMOVE_ITEM:{const _=e.items.indexOf(c);if(_!==-1){const v=e.items.slice(),b=v.splice(_,1),C=e.activeItems.filter(y=>y!==b[0]),w=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=v,C&&(e.activeItems=C),e.keepScrollPosition=w}break}}}}})),s}}var p6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},qh=function(o,e){return function(t,i){e(t,i,o)}},Fh,zi;let Ou=Fh=class extends nce{constructor(e,t,i,n,s,r){super(Fh.PREFIX,e),this.instantiationService=t,this.keybindingService=i,this.commandService=n,this.telemetryService=s,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(Kc)),this.options=e}async _getPicks(e,t,i,n){var s,r,a,l;const d=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const c=_u(()=>{const v=new S_;v.updateDocuments(d.map(C=>({key:C.commandId,textChunks:[this.getTfIdfChunk(C)]})));const b=v.calculateScores(e,i);return ice(b).filter(C=>C.score>Fh.TFIDF_THRESHOLD).slice(0,Fh.TFIDF_MAX_RESULTS)}),h=[];for(const v of d){const b=(s=Fh.WORD_FILTER(e,v.label))!==null&&s!==void 0?s:void 0,C=v.commandAlias&&(r=Fh.WORD_FILTER(e,v.commandAlias))!==null&&r!==void 0?r:void 0;if(b||C)v.highlights={label:b,detail:this.options.showAlias?C:void 0},h.push(v);else if(e===v.commandId)h.push(v);else if(e.length>=3){const w=c();if(i.isCancellationRequested)return[];const y=w.find(I=>I.key===v.commandId);y&&(v.tfIdfScore=y.score,h.push(v))}}const u=new Map;for(const v of h){const b=u.get(v.label);b?(v.description=v.commandId,b.description=b.commandId):u.set(v.label,v)}h.sort((v,b)=>{if(v.tfIdfScore&&b.tfIdfScore)return v.tfIdfScore===b.tfIdfScore?v.label.localeCompare(b.label):b.tfIdfScore-v.tfIdfScore;if(v.tfIdfScore)return 1;if(b.tfIdfScore)return-1;const C=this.commandsHistory.peek(v.commandId),w=this.commandsHistory.peek(b.commandId);if(C&&w)return C>w?-1:1;if(C)return-1;if(w)return 1;if(this.options.suggestedCommandIds){const y=this.options.suggestedCommandIds.has(v.commandId),I=this.options.suggestedCommandIds.has(b.commandId);if(y&&I)return 0;if(y)return-1;if(I)return 1}return v.label.localeCompare(b.label)});const g=[];let f=!1,m=!0,_=!!this.options.suggestedCommandIds;for(let v=0;v<h.length;v++){const b=h[v];v===0&&this.commandsHistory.peek(b.commandId)&&(g.push({type:"separator",label:p("recentlyUsed","recently used")}),f=!0),m&&b.tfIdfScore!==void 0&&(g.push({type:"separator",label:p("suggested","similar commands")}),m=!1),_&&b.tfIdfScore===void 0&&!this.commandsHistory.peek(b.commandId)&&(!((a=this.options.suggestedCommandIds)===null||a===void 0)&&a.has(b.commandId))&&(g.push({type:"separator",label:p("commonlyUsed","commonly used")}),f=!0,_=!1),f&&b.tfIdfScore===void 0&&!this.commandsHistory.peek(b.commandId)&&!(!((l=this.options.suggestedCommandIds)===null||l===void 0)&&l.has(b.commandId))&&(g.push({type:"separator",label:p("morecCommands","other commands")}),f=!1),g.push(this.toCommandPick(b,n))}return this.hasAdditionalCommandPicks(e,i)?{picks:g,additionalPicks:(async()=>{var v;const b=await this.getAdditionalCommandPicks(d,h,e,i);if(i.isCancellationRequested)return[];const C=b.map(w=>this.toCommandPick(w,n));return m&&((v=C[0])===null||v===void 0?void 0:v.type)!=="separator"&&C.unshift({type:"separator",label:p("suggested","similar commands")}),C})()}:g}toCommandPick(e,t){if(e.type==="separator")return e;const i=this.keybindingService.lookupKeybinding(e.commandId),n=i?p("commandPickAriaLabelWithKeybinding","{0}, {1}",e.label,i.getAriaLabel()):e.label;return{...e,ariaLabel:n,detail:this.options.showAlias&&e.commandAlias!==e.label?e.commandAlias:void 0,keybinding:i,accept:async()=>{var s,r;this.commandsHistory.push(e.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.commandId,from:(s=t?.from)!==null&&s!==void 0?s:"quick open"});try{!((r=e.args)===null||r===void 0)&&r.length?await this.commandService.executeCommand(e.commandId,...e.args):await this.commandService.executeCommand(e.commandId)}catch(a){oa(a)||this.dialogService.error(p("canNotRun","Command '{0}' resulted in an error",e.label),f6(a))}}}}getTfIdfChunk({label:e,commandAlias:t,commandDescription:i}){let n=e;return t&&t!==e&&(n+=` - ${t}`),i&&i.value!==e&&(n+=` - ${i.value===i.original?i.value:`${i.value} (${i.original})`}`),n}};Ou.PREFIX=">";Ou.TFIDF_THRESHOLD=.5;Ou.TFIDF_MAX_RESULTS=5;Ou.WORD_FILTER=CM(S0,die,B7);Ou=Fh=p6([qh(1,Oe),qh(2,Pt),qh(3,ui),qh(4,Gs),qh(5,Dv)],Ou);let Kc=zi=class extends K{constructor(e,t){super(),this.storageService=e,this.configurationService=t,this.configuredCommandsHistoryLength=0,this.updateConfiguration(),this.load(),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.updateConfiguration(e))),this._register(this.storageService.onWillSaveState(e=>{e.reason===y0.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=zi.getConfiguredCommandHistoryLength(this.configurationService),zi.cache&&zi.cache.limit!==this.configuredCommandsHistoryLength&&(zi.cache.limit=this.configuredCommandsHistoryLength,zi.hasChanges=!0))}load(){const e=this.storageService.get(zi.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch{}const i=zi.cache=new oh(this.configuredCommandsHistoryLength,1);if(t){let n;t.usesLRU?n=t.entries:n=t.entries.sort((s,r)=>s.value-r.value),n.forEach(s=>i.set(s.key,s.value))}zi.counter=this.storageService.getNumber(zi.PREF_KEY_COUNTER,0,zi.counter)}push(e){zi.cache&&(zi.cache.set(e,zi.counter++),zi.hasChanges=!0)}peek(e){var t;return(t=zi.cache)===null||t===void 0?void 0:t.peek(e)}saveState(){if(!zi.cache||!zi.hasChanges)return;const e={usesLRU:!0,entries:[]};zi.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store(zi.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(zi.PREF_KEY_COUNTER,zi.counter,0,0),zi.hasChanges=!1}static getConfiguredCommandHistoryLength(e){var t,i;const s=(i=(t=e.getValue().workbench)===null||t===void 0?void 0:t.commandPalette)===null||i===void 0?void 0:i.history;return typeof s=="number"?s:zi.DEFAULT_COMMANDS_HISTORY_LENGTH}};Kc.DEFAULT_COMMANDS_HISTORY_LENGTH=50;Kc.PREF_KEY_CACHE="commandPalette.mru.cache";Kc.PREF_KEY_COUNTER="commandPalette.mru.counter";Kc.counter=1;Kc.hasChanges=!1;Kc=zi=p6([qh(0,da),qh(1,ft)],Kc);class sce extends Ou{constructor(e,t,i,n,s,r){super(e,t,i,n,s,r)}getCodeEditorCommandPicks(){const e=this.activeTextEditorControl;if(!e)return[];const t=[];for(const i of e.getSupportedActions())t.push({commandId:i.id,commandAlias:i.alias,label:DM(i.label)||i.id});return t}}var oce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Dg=function(o,e){return function(t,i){e(t,i,o)}};let B0=class extends sce{get activeTextEditorControl(){var e;return(e=this.codeEditorService.getFocusedCodeEditor())!==null&&e!==void 0?e:void 0}constructor(e,t,i,n,s,r){super({showAlias:!1},e,i,n,s,r),this.codeEditorService=t}async getCommandPicks(){return this.getCodeEditorCommandPicks()}hasAdditionalCommandPicks(){return!1}async getAdditionalCommandPicks(){return[]}};B0=oce([Dg(0,Oe),Dg(1,Dt),Dg(2,Pt),Dg(3,ui),Dg(4,Gs),Dg(5,Dv)],B0);class Vv extends we{constructor(){super({id:Vv.ID,label:iw.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(dh).quickAccess.show(B0.PREFIX)}}Vv.ID="editor.action.quickCommand";de(Vv);Ri.as(XM.Quickaccess).registerQuickAccessProvider({ctor:B0,prefix:B0.PREFIX,helpEntries:[{description:iw.quickCommandHelp,commandId:Vv.ID}]});class rce extends ko{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:{value:p("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),original:"Toggle Collapse Unchanged Regions"},icon:he.map,toggled:te.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:te.has("isInDiffEditor"),menu:{when:te.has("isInDiffEditor"),id:N.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(ft),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}Xt(rce);class m6 extends ko{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:{value:p("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),original:"Toggle Show Moved Code Blocks"},precondition:te.has("isInDiffEditor")})}run(e,...t){const i=e.get(ft),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}Xt(m6);class _6 extends ko{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:{value:p("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),original:"Toggle Use Inline View When Space Is Limited"},precondition:te.has("isInDiffEditor")})}run(e,...t){const i=e.get(ft),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}Xt(_6);vn.appendMenuItem(N.EditorTitle,{command:{id:new _6().desc.id,title:p("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:te.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:te.has("isInDiffEditor")},order:11,group:"1_diff",when:te.and(M.diffEditorRenderSideBySideInlineBreakpointReached,te.has("isInDiffEditor"))});vn.appendMenuItem(N.EditorTitle,{command:{id:new m6().desc.id,title:p("showMoves","Show Moved Code Blocks"),icon:he.move,toggled:Rp.create("config.diffEditor.experimental.showMoves",!0),precondition:te.has("isInDiffEditor")},order:10,group:"1_diff",when:te.has("isInDiffEditor")});const Ny={value:p("diffEditor","Diff Editor"),original:"Diff Editor"};class ace extends aa{constructor(){super({id:"diffEditor.switchSide",title:{value:p("switchSide","Switch Side"),original:"Switch Side"},icon:he.arrowSwap,precondition:te.has("isInDiffEditor"),f1:!0,category:Ny})}runEditorCommand(e,t,i){const n=qp(e);if(n instanceof zc){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}Xt(ace);class lce extends aa{constructor(){super({id:"diffEditor.exitCompareMove",title:{value:p("exitCompareMove","Exit Compare Move"),original:"Exit Compare Move"},icon:he.close,precondition:M.comparingMovedCode,f1:!1,category:Ny,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=qp(e);n instanceof zc&&n.exitCompareMove()}}Xt(lce);class dce extends aa{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:{value:p("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),original:"Collapse All Unchanged Regions"},icon:he.fold,precondition:te.has("isInDiffEditor"),f1:!0,category:Ny})}runEditorCommand(e,t,...i){const n=qp(e);n instanceof zc&&n.collapseAllUnchangedRegions()}}Xt(dce);class cce extends aa{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:{value:p("showAllUnchangedRegions","Show All Unchanged Regions"),original:"Show All Unchanged Regions"},icon:he.unfold,precondition:te.has("isInDiffEditor"),f1:!0,category:Ny})}runEditorCommand(e,t,...i){const n=qp(e);n instanceof zc&&n.showAllUnchangedRegions()}}Xt(cce);const v6={value:p("accessibleDiffViewer","Accessible Diff Viewer"),original:"Accessible Diff Viewer"};class jp extends ko{constructor(){super({id:jp.id,title:{value:p("editor.action.accessibleDiffViewer.next","Go to Next Difference"),original:"Go to Next Difference"},category:v6,precondition:te.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=qp(e);t?.accessibleDiffViewerNext()}}jp.id="editor.action.accessibleDiffViewer.next";vn.appendMenuItem(N.EditorTitle,{command:{id:jp.id,title:p("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:te.has("isInDiffEditor")},order:10,group:"2_diff",when:te.and(M.accessibleDiffViewerVisible.negate(),te.has("isInDiffEditor"))});class Hv extends ko{constructor(){super({id:Hv.id,title:{value:p("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),original:"Go to Previous Difference"},category:v6,precondition:te.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=qp(e);t?.accessibleDiffViewerPrev()}}Hv.id="editor.action.accessibleDiffViewer.prev";function qp(o){var e;const t=o.get(Dt),i=t.listDiffEditors(),n=(e=t.getFocusedCodeEditor())!==null&&e!==void 0?e:t.getActiveCodeEditor();if(!n)return null;for(let r=0,a=i.length;r<a;r++){const l=i[r];if(l.getModifiedEditor().getId()===n.getId()||l.getOriginalEditor().getId()===n.getId())return l}const s=wo();if(s)for(const r of i){const a=r.getContainerDomNode();if(hce(a,s))return r}return null}function hce(o,e){let t=e;for(;t;){if(t===o)return!0;t=t.parentElement}return!1}gt.registerCommandAlias("editor.action.diffReview.next",jp.id);Xt(jp);gt.registerCommandAlias("editor.action.diffReview.prev",Hv.id);Xt(Hv);var uce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},gce=function(o,e){return function(t,i){e(t,i,o)}},JE;const Ty=new be("selectionAnchorSet",!1);let fd=JE=class{static get(e){return e.getContribution(JE.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=Ty.bindTo(t),this.modelChangeListener=e.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}setSelectionAnchor(){if(this.editor.hasModel()){const e=this.editor.getPosition();this.editor.changeDecorations(t=>{this.decorationId&&t.removeDecoration(this.decorationId),this.decorationId=t.addDecoration(xe.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new Fn().appendText(p("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),js(p("anchorSet","Anchor set at {0}:{1}",e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){const t=this.editor.getPosition();this.editor.setSelection(xe.fromPositions(e.getStartPosition(),t)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){const e=this.decorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}};fd.ID="editor.contrib.selectionAnchorController";fd=JE=uce([gce(1,We)],fd);class fce extends we{constructor(){super({id:"editor.action.setSelectionAnchor",label:p("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:qi(2089,2080),weight:100}})}async run(e,t){var i;(i=fd.get(t))===null||i===void 0||i.setSelectionAnchor()}}class pce extends we{constructor(){super({id:"editor.action.goToSelectionAnchor",label:p("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:Ty})}async run(e,t){var i;(i=fd.get(t))===null||i===void 0||i.goToSelectionAnchor()}}class mce extends we{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:p("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:Ty,kbOpts:{kbExpr:M.editorTextFocus,primary:qi(2089,2089),weight:100}})}async run(e,t){var i;(i=fd.get(t))===null||i===void 0||i.selectFromAnchorToCursor()}}class _ce extends we{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:p("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:Ty,kbOpts:{kbExpr:M.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=fd.get(t))===null||i===void 0||i.cancelSelectionAnchor()}}yt(fd.ID,fd,4);de(fce);de(pce);de(mce);de(_ce);const vce=R("editorOverviewRuler.bracketMatchForeground",{dark:"#A0A0A0",light:"#A0A0A0",hcDark:"#A0A0A0",hcLight:"#A0A0A0"},p("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class bce extends we{constructor(){super({id:"editor.action.jumpToBracket",label:p("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=mr.get(t))===null||i===void 0||i.jumpToBracket()}}class Cce extends we{constructor(){super({id:"editor.action.selectToBracket",label:p("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:fH("smartSelect.selectToBracketDescription","Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(e,t,i){var n;let s=!0;i&&i.selectBrackets===!1&&(s=!1),(n=mr.get(t))===null||n===void 0||n.selectToBracket(s)}}class wce extends we{constructor(){super({id:"editor.action.removeBrackets",label:p("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=mr.get(t))===null||i===void 0||i.removeBrackets(this.id)}}class Sce{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}class mr extends K{static get(e){return e.getContribution(mr.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Rt(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(71),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition(t=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelContent(t=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModel(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelLanguageConfiguration(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeConfiguration(t=>{t.hasChanged(71)&&(this._matchBrackets=this._editor.getOption(71),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(e.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getSelections().map(i=>{const n=i.getStartPosition(),s=e.bracketPairs.matchBracket(n);let r=null;if(s)s[0].containsPosition(n)&&!s[1].containsPosition(n)?r=s[1].getStartPosition():s[1].containsPosition(n)&&(r=s[0].getStartPosition());else{const a=e.bracketPairs.findEnclosingBrackets(n);if(a)r=a[1].getStartPosition();else{const l=e.bracketPairs.findNextBracket(n);l&&l.range&&(r=l.range.getStartPosition())}}return r?new xe(r.lineNumber,r.column,r.lineNumber,r.column):new xe(n.lineNumber,n.column,n.lineNumber,n.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(n=>{const s=n.getStartPosition();let r=t.bracketPairs.matchBracket(s);if(!r&&(r=t.bracketPairs.findEnclosingBrackets(s),!r)){const d=t.bracketPairs.findNextBracket(s);d&&d.range&&(r=t.bracketPairs.matchBracket(d.range.getStartPosition()))}let a=null,l=null;if(r){r.sort(k.compareRangesUsingStarts);const[d,c]=r;if(a=e?d.getStartPosition():d.getEndPosition(),l=e?c.getEndPosition():c.getStartPosition(),c.containsPosition(s)){const h=a;a=l,l=h}}a&&l&&i.push(new xe(a.lineNumber,a.column,l.lineNumber,l.column))}),i.length>0&&(this._editor.setSelections(i),this._editor.revealRange(i[0]))}removeBrackets(e){if(!this._editor.hasModel())return;const t=this._editor.getModel();this._editor.getSelections().forEach(i=>{const n=i.getPosition();let s=t.bracketPairs.matchBracket(n);s||(s=t.bracketPairs.findEnclosingBrackets(n)),s&&(this._editor.pushUndoStop(),this._editor.executeEdits(e,[{range:s[0],text:""},{range:s[1],text:""}]),this._editor.pushUndoStop())})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();const e=[];let t=0;for(const i of this._lastBracketsData){const n=i.brackets;n&&(e[t++]={range:n[0],options:i.options},e[t++]={range:n[1],options:i.options})}this._decorations.set(e)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}const e=this._editor.getSelections();if(e.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}const t=this._editor.getModel(),i=t.getVersionId();let n=[];this._lastVersionId===i&&(n=this._lastBracketsData);const s=[];let r=0;for(let h=0,u=e.length;h<u;h++){const g=e[h];g.isEmpty()&&(s[r++]=g.getStartPosition())}s.length>1&&s.sort(V.compare);const a=[];let l=0,d=0;const c=n.length;for(let h=0,u=s.length;h<u;h++){const g=s[h];for(;d<c&&n[d].position.isBefore(g);)d++;if(d<c&&n[d].position.equals(g))a[l++]=n[d];else{let f=t.bracketPairs.matchBracket(g,20),m=mr._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!f&&this._matchBrackets==="always"&&(f=t.bracketPairs.findEnclosingBrackets(g,20),m=mr._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[l++]=new Sce(g,f,m)}}this._lastBracketsData=a,this._lastVersionId=i}}mr.ID="editor.contrib.bracketMatchingController";mr._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=Ze.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:fi(vce),position:Ko.Center}});mr._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=Ze.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});yt(mr.ID,mr,1);de(Cce);de(bce);de(wce);vn.appendMenuItem(N.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:p({},"Go to &&Bracket")},order:2});class yce{constructor(e,t){this._selection=e,this._isMovingLeft=t}getEditOperations(e,t){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;const i=this._selection.startLineNumber,n=this._selection.startColumn,s=this._selection.endColumn;if(!(this._isMovingLeft&&n===1)&&!(!this._isMovingLeft&&s===e.getLineMaxColumn(i)))if(this._isMovingLeft){const r=new k(i,n-1,i,n),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new k(i,s,i,s),a)}else{const r=new k(i,s,i,s+1),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new k(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new xe(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new xe(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class b6 extends we{constructor(e,t){super(t),this.left=e}run(e,t){if(!t.hasModel())return;const i=[],n=t.getSelections();for(const s of n)i.push(new yce(s,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class Lce extends b6{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:p("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:M.writable})}}class xce extends b6{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:p("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:M.writable})}}de(Lce);de(xce);class Dce extends we{constructor(){super({id:"editor.action.transposeLetters",label:p("transposeLetters.label","Transpose Letters"),alias:"Transpose Letters",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(e,t){if(!t.hasModel())return;const i=t.getModel(),n=[],s=t.getSelections();for(const r of s){if(!r.isEmpty())continue;const a=r.startLineNumber,l=r.startColumn,d=i.getLineMaxColumn(a);if(a===1&&(l===1||l===2&&d===2))continue;const c=l===d?r.getPosition():It.rightPosition(i,r.getPosition().lineNumber,r.getPosition().column),h=It.leftPosition(i,c),u=It.leftPosition(i,h),g=i.getValueInRange(k.fromPositions(u,h)),f=i.getValueInRange(k.fromPositions(h,c)),m=k.fromPositions(u,c);n.push(new kn(m,f+g))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}de(Dce);const Fu="9_cutcopypaste",kce=ol||document.queryCommandSupported("cut"),C6=ol||document.queryCommandSupported("copy"),Ice=typeof navigator.clipboard>"u"||zo?document.queryCommandSupported("paste"):!0;function fR(o){return o.register(),o}const Ece=kce?fR(new Pp({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:ol?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:N.MenubarEditMenu,group:"2_ccp",title:p({},"Cu&&t"),order:1},{menuId:N.EditorContext,group:Fu,title:p("actions.clipboard.cutLabel","Cut"),when:M.writable,order:1},{menuId:N.CommandPalette,group:"",title:p("actions.clipboard.cutLabel","Cut"),order:1},{menuId:N.SimpleEditorContext,group:Fu,title:p("actions.clipboard.cutLabel","Cut"),when:M.writable,order:1}]})):void 0,Nce=C6?fR(new Pp({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:ol?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:N.MenubarEditMenu,group:"2_ccp",title:p({},"&&Copy"),order:2},{menuId:N.EditorContext,group:Fu,title:p("actions.clipboard.copyLabel","Copy"),order:2},{menuId:N.CommandPalette,group:"",title:p("actions.clipboard.copyLabel","Copy"),order:1},{menuId:N.SimpleEditorContext,group:Fu,title:p("actions.clipboard.copyLabel","Copy"),order:2}]})):void 0;vn.appendMenuItem(N.MenubarEditMenu,{submenu:N.MenubarCopy,title:{value:p("copy as","Copy As"),original:"Copy As"},group:"2_ccp",order:3});vn.appendMenuItem(N.EditorContext,{submenu:N.EditorContextCopy,title:{value:p("copy as","Copy As"),original:"Copy As"},group:Fu,order:3});vn.appendMenuItem(N.EditorContext,{submenu:N.EditorContextShare,title:{value:p("share","Share"),original:"Share"},group:"11_share",order:-1,when:te.and(te.notEquals("resourceScheme","output"),M.editorTextFocus)});vn.appendMenuItem(N.EditorTitleContext,{submenu:N.EditorTitleContextShare,title:{value:p("share","Share"),original:"Share"},group:"11_share",order:-1});vn.appendMenuItem(N.ExplorerContext,{submenu:N.ExplorerContextShare,title:{value:p("share","Share"),original:"Share"},group:"11_share",order:-1});const iD=Ice?fR(new Pp({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:ol?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:N.MenubarEditMenu,group:"2_ccp",title:p({},"&&Paste"),order:4},{menuId:N.EditorContext,group:Fu,title:p("actions.clipboard.pasteLabel","Paste"),when:M.writable,order:4},{menuId:N.CommandPalette,group:"",title:p("actions.clipboard.pasteLabel","Paste"),order:1},{menuId:N.SimpleEditorContext,group:Fu,title:p("actions.clipboard.pasteLabel","Paste"),when:M.writable,order:4}]})):void 0;class Tce extends we{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:p("actions.clipboard.copyWithSyntaxHighlightingLabel","Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,weight:100}})}run(e,t){!t.hasModel()||!t.getOption(37)&&t.getSelection().isEmpty()||(sI.forceCopyWithSyntaxHighlighting=!0,t.focus(),t.getContainerDomNode().ownerDocument.execCommand("copy"),sI.forceCopyWithSyntaxHighlighting=!1)}}function w6(o,e){o&&(o.addImplementation(1e4,"code-editor",(t,i)=>{const n=t.get(Dt).getFocusedCodeEditor();if(n&&n.hasTextFocus()){const s=n.getOption(37),r=n.getSelection();return r&&r.isEmpty()&&!s||n.getContainerDomNode().ownerDocument.execCommand(e),!0}return!1}),o.addImplementation(0,"generic-dom",(t,i)=>(Ap().execCommand(e),!0)))}w6(Ece,"cut");w6(Nce,"copy");iD&&(iD.addImplementation(1e4,"code-editor",(o,e)=>{const t=o.get(Dt),i=o.get(Sd),n=t.getFocusedCodeEditor();return n&&n.hasTextFocus()?!n.getContainerDomNode().ownerDocument.execCommand("paste")&&th?(async()=>{const r=await i.readText();if(r!==""){const a=a0.INSTANCE.get(r);let l=!1,d=null,c=null;a&&(l=n.getOption(37)&&!!a.isFromEmptySelection,d=typeof a.multicursorText<"u"?a.multicursorText:null,c=a.mode),n.trigger("keyboard","paste",{text:r,pasteOnNewLine:l,multicursorText:d,mode:c})}})():!0:!1}),iD.addImplementation(0,"generic-dom",(o,e)=>(Ap().execCommand("paste"),!0)));C6&&de(Tce);class Be{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+Be.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(e){return new Be(this.value+Be.sep+e)}}Be.sep=".";Be.None=new Be("@@none@@");Be.Empty=new Be("");Be.QuickFix=new Be("quickfix");Be.Refactor=new Be("refactor");Be.RefactorExtract=Be.Refactor.append("extract");Be.RefactorInline=Be.Refactor.append("inline");Be.RefactorMove=Be.Refactor.append("move");Be.RefactorRewrite=Be.Refactor.append("rewrite");Be.Notebook=new Be("notebook");Be.Source=new Be("source");Be.SourceOrganizeImports=Be.Source.append("organizeImports");Be.SourceFixAll=Be.Source.append("fixAll");Be.SurroundWith=Be.Refactor.append("surround");var qs;(function(o){o.Refactor="refactor",o.RefactorPreview="refactor preview",o.Lightbulb="lightbulb",o.Default="other (default)",o.SourceAction="source action",o.QuickFix="quick fix action",o.FixAll="fix all",o.OrganizeImports="organize imports",o.AutoFix="auto fix",o.QuickFixHover="quick fix hover window",o.OnSave="save participants",o.ProblemsView="problems view"})(qs||(qs={}));function Mce(o,e){return!(o.include&&!o.include.intersects(e)||o.excludes&&o.excludes.some(t=>S6(e,t,o.include))||!o.includeSourceActions&&Be.Source.contains(e))}function Rce(o,e){const t=e.kind?new Be(e.kind):void 0;return!(o.include&&(!t||!o.include.contains(t))||o.excludes&&t&&o.excludes.some(i=>S6(t,i,o.include))||!o.includeSourceActions&&t&&Be.Source.contains(t)||o.onlyIncludePreferredActions&&!e.isPreferred)}function S6(o,e,t){return!(!e.contains(o)||t&&e.contains(t))}class Va{static fromUser(e,t){return!e||typeof e!="object"?new Va(t.kind,t.apply,!1):new Va(Va.getKindFromUser(e,t.kind),Va.getApplyFromUser(e,t.apply),Va.getPreferredUser(e))}static getApplyFromUser(e,t){switch(typeof e.apply=="string"?e.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return t}}static getKindFromUser(e,t){return typeof e.kind=="string"?new Be(e.kind):t}static getPreferredUser(e){return typeof e.preferred=="boolean"?e.preferred:!1}constructor(e,t,i){this.kind=e,this.apply=t,this.preferred=i}}class Ace{constructor(e,t,i){this.action=e,this.provider=t,this.highlightRange=i}async resolve(e){var t;if(!((t=this.provider)===null||t===void 0)&&t.resolveCodeAction&&!this.action.edit){let i;try{i=await this.provider.resolveCodeAction(this.action,e)}catch(n){Mi(n)}i&&(this.action.edit=i.edit)}return this}}const y6="editor.action.codeAction",pR="editor.action.quickFix",L6="editor.action.autoFix",x6="editor.action.refactor",D6="editor.action.sourceAction",mR="editor.action.organizeImports",_R="editor.action.fixAll";class y_ extends K{static codeActionsPreferredComparator(e,t){return e.isPreferred&&!t.isPreferred?-1:!e.isPreferred&&t.isPreferred?1:0}static codeActionsComparator({action:e},{action:t}){return e.isAI&&!t.isAI?1:!e.isAI&&t.isAI?-1:Bn(e.diagnostics)?Bn(t.diagnostics)?y_.codeActionsPreferredComparator(e,t):-1:Bn(t.diagnostics)?1:y_.codeActionsPreferredComparator(e,t)}constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(y_.codeActionsComparator),this.validActions=this.allActions.filter(({action:n})=>!n.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&Be.QuickFix.contains(new Be(e.kind))&&!!e.isPreferred)}get hasAIFix(){return this.validActions.some(({action:e})=>!!e.isAI)}get allAIFixes(){return this.validActions.every(({action:e})=>!!e.isAI)}}const KF={actions:[],documentation:void 0};async function L_(o,e,t,i,n,s){var r;const a=i.filter||{},l={...a,excludes:[...a.excludes||[],Be.Notebook]},d={only:(r=a.include)===null||r===void 0?void 0:r.value,trigger:i.type},c=new gR(e,s),h=i.type===2,u=Pce(o,e,h?l:a),g=new se,f=u.map(async _=>{try{n.report(_);const v=await _.provideCodeActions(e,t,d,c.token);if(v&&g.add(v),c.token.isCancellationRequested)return KF;const b=(v?.actions||[]).filter(w=>w&&Rce(a,w)),C=Fce(_,b,a.include);return{actions:b.map(w=>new Ace(w,_)),documentation:C}}catch(v){if(oa(v))throw v;return Mi(v),KF}}),m=o.onDidChange(()=>{const _=o.all(e);_i(_,u)||c.cancel()});try{const _=await Promise.all(f),v=_.map(C=>C.actions).flat(),b=[...Qr(_.map(C=>C.documentation)),...Oce(o,e,i,v)];return new y_(v,b,g)}finally{m.dispose(),c.dispose()}}function Pce(o,e,t){return o.all(e).filter(i=>i.providedCodeActionKinds?i.providedCodeActionKinds.some(n=>Mce(t,new Be(n))):!0)}function*Oce(o,e,t,i){var n,s,r;if(e&&i.length)for(const a of o.all(e))a._getAdditionalMenuItems&&(yield*(n=a._getAdditionalMenuItems)===null||n===void 0?void 0:n.call(a,{trigger:t.type,only:(r=(s=t.filter)===null||s===void 0?void 0:s.include)===null||r===void 0?void 0:r.value},i.map(l=>l.action)))}function Fce(o,e,t){if(!o.documentation)return;const i=o.documentation.map(n=>({kind:new Be(n.kind),command:n.command}));if(t){let n;for(const s of i)s.kind.contains(t)&&(n?n.kind.contains(s.kind)&&(n=s):n=s);if(n)return n?.command}for(const n of e)if(n.kind){for(const s of i)if(s.kind.contains(new Be(n.kind)))return s.command}}var Bw;(function(o){o.OnSave="onSave",o.FromProblemsView="fromProblemsView",o.FromCodeActions="fromCodeActions"})(Bw||(Bw={}));async function Bce(o,e,t,i,n=st.None){var s;const r=o.get(kv),a=o.get(ui),l=o.get(Gs),d=o.get(Vi);if(l.publicLog2("codeAction.applyCodeAction",{codeActionTitle:e.action.title,codeActionKind:e.action.kind,codeActionIsPreferred:!!e.action.isPreferred,reason:t}),await e.resolve(n),!n.isCancellationRequested&&!(!((s=e.action.edit)===null||s===void 0)&&s.edits.length&&!(await r.apply(e.action.edit,{editor:i?.editor,label:e.action.title,quotableLabel:e.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:t!==Bw.OnSave,showPreview:i?.preview})).isApplied)&&e.action.command)try{await a.executeCommand(e.action.command.id,...e.action.command.arguments||[])}catch(c){const h=Wce(c);d.error(typeof h=="string"?h:p("applyCodeActionFailed","An unknown error occurred while applying the code action"))}}function Wce(o){return typeof o=="string"?o:o instanceof Error&&typeof o.message=="string"?o.message:void 0}gt.registerCommand("_executeCodeActionProvider",async function(o,e,t,i,n){if(!(e instanceof Me))throw Wo();const{codeActionProvider:s}=o.get(Se),r=o.get(ii).getModel(e);if(!r)throw Wo();const a=xe.isISelection(t)?xe.liftSelection(t):k.isIRange(t)?r.validateRange(t):void 0;if(!a)throw Wo();const l=typeof i=="string"?new Be(i):void 0,d=await L_(s,r,a,{type:1,triggerAction:qs.Default,filter:{includeSourceActions:!0,include:l}},ld.None,st.None),c=[],h=Math.min(d.validActions.length,typeof n=="number"?n:0);for(let u=0;u<h;u++)c.push(d.validActions[u].resolve(st.None));try{return await Promise.all(c),d.validActions.map(u=>u.action)}finally{setTimeout(()=>d.dispose(),100)}});var Vce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Hce=function(o,e){return function(t,i){e(t,i,o)}},eN;let Ww=eN=class{constructor(e){this.keybindingService=e}getResolver(){const e=new sh(()=>this.keybindingService.getKeybindings().filter(t=>eN.codeActionCommands.indexOf(t.command)>=0).filter(t=>t.resolvedKeybinding).map(t=>{let i=t.commandArgs;return t.command===mR?i={kind:Be.SourceOrganizeImports.value}:t.command===_R&&(i={kind:Be.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...Va.fromUser(i,{kind:Be.None,apply:"never"})}}));return t=>{if(t.kind){const i=this.bestKeybindingForCodeAction(t,e.value);return i?.resolvedKeybinding}}}bestKeybindingForCodeAction(e,t){if(!e.kind)return;const i=new Be(e.kind);return t.filter(n=>n.kind.contains(i)).filter(n=>n.preferred?e.isPreferred:!0).reduceRight((n,s)=>n?n.kind.contains(s.kind)?s:n:s,void 0)}};Ww.codeActionCommands=[x6,y6,D6,mR,_R];Ww=eN=Vce([Hce(0,Pt)],Ww);R("symbolIcon.arrayForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.arrayForeground","The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.booleanForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.booleanForeground","The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},p("symbolIcon.classForeground","The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.colorForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.colorForeground","The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.constantForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.constantForeground","The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},p("symbolIcon.constructorForeground","The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},p("symbolIcon.enumeratorForeground","The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p("symbolIcon.enumeratorMemberForeground","The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},p("symbolIcon.eventForeground","The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p("symbolIcon.fieldForeground","The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.fileForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.fileForeground","The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.folderForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.folderForeground","The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},p("symbolIcon.functionForeground","The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p("symbolIcon.interfaceForeground","The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.keyForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.keyForeground","The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.keywordForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.keywordForeground","The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},p("symbolIcon.methodForeground","The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.moduleForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.moduleForeground","The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.namespaceForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.namespaceForeground","The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.nullForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.nullForeground","The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.numberForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.numberForeground","The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.objectForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.objectForeground","The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.operatorForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.operatorForeground","The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.packageForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.packageForeground","The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.propertyForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.propertyForeground","The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.referenceForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.referenceForeground","The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.snippetForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.snippetForeground","The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.stringForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.stringForeground","The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.structForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.structForeground","The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.textForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.textForeground","The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.typeParameterForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.typeParameterForeground","The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.unitForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.unitForeground","The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p("symbolIcon.variableForeground","The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const k6=Object.freeze({kind:Be.Empty,title:p("codeAction.widget.id.more","More Actions...")}),zce=Object.freeze([{kind:Be.QuickFix,title:p("codeAction.widget.id.quickfix","Quick Fix")},{kind:Be.RefactorExtract,title:p("codeAction.widget.id.extract","Extract"),icon:he.wrench},{kind:Be.RefactorInline,title:p("codeAction.widget.id.inline","Inline"),icon:he.wrench},{kind:Be.RefactorRewrite,title:p("codeAction.widget.id.convert","Rewrite"),icon:he.wrench},{kind:Be.RefactorMove,title:p("codeAction.widget.id.move","Move"),icon:he.wrench},{kind:Be.SurroundWith,title:p("codeAction.widget.id.surround","Surround With"),icon:he.symbolSnippet},{kind:Be.Source,title:p("codeAction.widget.id.source","Source Action"),icon:he.symbolFile},k6]);function Uce(o,e,t){if(!e)return o.map(s=>{var r;return{kind:"action",item:s,group:k6,disabled:!!s.action.disabled,label:s.action.disabled||s.action.title,canPreview:!!(!((r=s.action.edit)===null||r===void 0)&&r.edits.length)}});const i=zce.map(s=>({group:s,actions:[]}));for(const s of o){const r=s.action.kind?new Be(s.action.kind):Be.None;for(const a of i)if(a.group.kind.contains(r)){a.actions.push(s);break}}const n=[];for(const s of i)if(s.actions.length){n.push({kind:"header",group:s.group});for(const r of s.actions){const a=s.group;n.push({kind:"action",item:r,group:r.action.isAI?{title:a.title,kind:a.kind,icon:he.sparkle}:a,label:r.action.title,disabled:!!r.action.disabled,keybinding:t(r.action)})}}return n}var $ce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jF=function(o,e){return function(t,i){e(t,i,o)}},tN,uf;(function(o){o.Hidden={type:0};class e{constructor(i,n,s,r){this.actions=i,this.trigger=n,this.editorPosition=s,this.widgetPosition=r,this.type=1}}o.Showing=e})(uf||(uf={}));let Bu=tN=class extends K{constructor(e,t,i){super(),this._editor=e,this._keybindingService=t,this._onClick=this._register(new W),this.onClick=this._onClick.event,this._state=uf.Hidden,this._iconClasses=[],this._domNode=pe("div.lightBulbWidget"),this._register(Ot.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent(n=>{const s=this._editor.getModel();(this.state.type!==1||!s||this.state.editorPosition.lineNumber>=s.getLineCount())&&this.hide()})),this._register(F$(this._domNode,n=>{var s;if(this.state.type!==1)return;const r=this._editor.getOption(64).experimental.showAiIcon;if((r===As.On||r===As.OnCode)&&this.state.actions.allAIFixes&&this.state.actions.validActions.length===1){const h=this.state.actions.validActions[0].action;if(!((s=h.command)===null||s===void 0)&&s.id){i.executeCommand(h.command.id,...h.command.arguments||[]),n.preventDefault();return}}this._editor.focus(),n.preventDefault();const{top:a,height:l}=ji(this._domNode),d=this._editor.getOption(66);let c=Math.floor(d/3);this.state.widgetPosition.position!==null&&this.state.widgetPosition.position.lineNumber<this.state.editorPosition.lineNumber&&(c+=d),this._onClick.fire({x:n.posx,y:a+l+c,actions:this.state.actions,trigger:this.state.trigger})})),this._register(Q(this._domNode,"mouseenter",n=>{(n.buttons&1)===1&&this.hide()})),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(64)&&(this._editor.getOption(64).enabled||this.hide(),this._updateLightBulbTitleAndIcon())})),this._register(fe.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{var n,s,r,a;this._preferredKbLabel=(s=(n=this._keybindingService.lookupKeybinding(L6))===null||n===void 0?void 0:n.getLabel())!==null&&s!==void 0?s:void 0,this._quickFixKbLabel=(a=(r=this._keybindingService.lookupKeybinding(pR))===null||r===void 0?void 0:r.getLabel())!==null&&a!==void 0?a:void 0,this._updateLightBulbTitleAndIcon()}))}dispose(){super.dispose(),this._editor.removeContentWidget(this)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){return this._state.type===1?this._state.widgetPosition:null}update(e,t,i){if(e.validActions.length<=0)return this.hide();const n=this._editor.getOptions();if(!n.get(64).enabled)return this.hide();const s=this._editor.getModel();if(!s)return this.hide();const{lineNumber:r,column:a}=s.validatePosition(i),l=s.getOptions().tabSize,d=n.get(50),c=s.getLineContent(r),h=YS(c,l),u=d.spaceWidth*h>22,g=m=>m>2&&this._editor.getTopForLineNumber(m)===this._editor.getTopForLineNumber(m-1);let f=r;if(!u){if(r>1&&!g(r-1))f-=1;else if(!g(r+1))f+=1;else if(a*d.spaceWidth<22)return this.hide()}this.state=new uf.Showing(e,t,i,{position:{lineNumber:f,column:s.getLineContent(f).match(/^\S\s*$/)?2:1},preference:tN._posPref}),this._editor.layoutContentWidget(this)}hide(){this.state!==uf.Hidden&&(this.state=uf.Hidden,this._editor.layoutContentWidget(this))}get state(){return this._state}set state(e){this._state=e,this._updateLightBulbTitleAndIcon()}_updateLightBulbTitleAndIcon(){var e,t,i;if(this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],this.state.type!==1)return;const n=()=>{this._preferredKbLabel&&(this.title=p("preferredcodeActionWithKb","Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel))},s=()=>{this._quickFixKbLabel?this.title=p("codeActionWithKb","Show Code Actions ({0})",this._quickFixKbLabel):this.title=p("codeAction","Show Code Actions")};let r;const a=this._editor.getOption(64).experimental.showAiIcon;if(a===As.On||a===As.OnCode)if(a===As.On&&this.state.actions.allAIFixes)if(r=he.sparkleFilled,this.state.actions.allAIFixes&&this.state.actions.validActions.length===1)if(((e=this.state.actions.validActions[0].action.command)===null||e===void 0?void 0:e.id)==="inlineChat.start"){const l=(i=(t=this._keybindingService.lookupKeybinding("inlineChat.start"))===null||t===void 0?void 0:t.getLabel())!==null&&i!==void 0?i:void 0;this.title=l?p("codeActionStartInlineChatWithKb","Start Inline Chat ({0})",l):p("codeActionStartInlineChat","Start Inline Chat")}else this.title=p("codeActionTriggerAiAction","Trigger AI Action");else s();else this.state.actions.hasAutoFix?(this.state.actions.hasAIFix?r=he.lightbulbSparkleAutofix:r=he.lightbulbAutofix,n()):this.state.actions.hasAIFix?(r=he.lightbulbSparkle,s()):(r=he.lightBulb,s());else this.state.actions.hasAutoFix?(r=he.lightbulbAutofix,n()):(r=he.lightBulb,s());this._iconClasses=Re.asClassNameArray(r),this._domNode.classList.add(...this._iconClasses)}set title(e){this._domNode.title=e}};Bu.ID="editor.contrib.lightbulbWidget";Bu._posPref=[0];Bu=tN=$ce([jF(1,Pt),jF(2,ui)],Bu);var Kce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},qF=function(o,e){return function(t,i){e(t,i,o)}},iN;let pd=iN=class{constructor(e,t,i){this._options=e,this._languageService=t,this._openerService=i,this._onDidRenderAsync=new W,this.onDidRenderAsync=this._onDidRenderAsync.event}dispose(){this._onDidRenderAsync.dispose()}render(e,t,i){if(!e)return{element:document.createElement("span"),dispose:()=>{}};const n=new se,s=n.add(ly(e,{...this._getRenderOptions(e,n),...t},i));return s.element.classList.add("rendered-markdown"),{element:s.element,dispose:()=>n.dispose()}}_getRenderOptions(e,t){return{codeBlockRenderer:async(i,n)=>{var s,r,a;let l;i?l=this._languageService.getLanguageIdByLanguageName(i):this._options.editor&&(l=(s=this._options.editor.getModel())===null||s===void 0?void 0:s.getLanguageId()),l||(l=So);const d=await ree(this._languageService,n,l),c=document.createElement("span");if(c.innerHTML=(a=(r=iN._ttpTokenizer)===null||r===void 0?void 0:r.createHTML(d))!==null&&a!==void 0?a:d,this._options.editor){const h=this._options.editor.getOption(50);Tn(c,h)}else this._options.codeBlockFontFamily&&(c.style.fontFamily=this._options.codeBlockFontFamily);return this._options.codeBlockFontSize!==void 0&&(c.style.fontSize=this._options.codeBlockFontSize),c},asyncRenderCallback:()=>this._onDidRenderAsync.fire(),actionHandler:{callback:i=>I6(this._openerService,i,e.isTrusted),disposables:t}}}};pd._ttpTokenizer=vd("tokenizeToString",{createHTML(o){return o}});pd=iN=Kce([qF(1,ni),qF(2,Qs)],pd);async function I6(o,e,t){try{return await o.open(e,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:jce(t)})}catch(i){return Ge(i),!1}}function jce(o){return o===!0?!0:o&&Array.isArray(o.enabledCommands)?o.enabledCommands:!1}var qce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},GF=function(o,e){return function(t,i){e(t,i,o)}},ZC;let zs=ZC=class{static get(e){return e.getContribution(ZC.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new Cn,this._messageListeners=new se,this._mouseOverMessage=!1,this._editor=e,this._visible=ZC.MESSAGE_VISIBLE.bindTo(t)}dispose(){var e;(e=this._message)===null||e===void 0||e.dispose(),this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(e,t){js(_c(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=_c(e)?ly(e,{actionHandler:{callback:n=>I6(this._openerService,n,_c(e)?e.isTrusted:void 0),disposables:this._messageListeners}}):void 0,this._messageWidget.value=new ZF(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(fe.debounce(this._editor.onDidBlurEditorText,(n,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&Nn(wo(),this._messageWidget.value.getDomNode())||this.closeMessage()})),this._messageListeners.add(this._editor.onDidChangeCursorPosition(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidDispose(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidChangeModel(()=>this.closeMessage())),this._messageListeners.add(Q(this._messageWidget.value.getDomNode(),ge.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(Q(this._messageWidget.value.getDomNode(),ge.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let i;this._messageListeners.add(this._editor.onMouseMove(n=>{n.target.position&&(i?i.containsPosition(n.target.position)||this.closeMessage():i=new k(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(ZF.fadeOut(this._messageWidget.value))}};zs.ID="editor.contrib.messageController";zs.MESSAGE_VISIBLE=new be("messageVisible",!1,p("messageVisible","Whether the editor is currently showing an inline message"));zs=ZC=qce([GF(1,We),GF(2,Qs)],zs);const Gce=cn.bindToContribution(zs.get);ue(new Gce({id:"leaveEditorMessage",precondition:zs.MESSAGE_VISIBLE,handler:o=>o.closeMessage(),kbOpts:{weight:130,primary:9}}));let ZF=class{static fadeOut(e){const t=()=>{e.dispose(),clearTimeout(i),e.getDomNode().removeEventListener("animationend",t)},i=setTimeout(t,110);return e.getDomNode().addEventListener("animationend",t),e.getDomNode().classList.add("fadeOut"),{dispose:t}}constructor(e,{lineNumber:t,column:i},n){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=e,this._editor.revealLinesInCenterIfOutsideViewport(t,t,0),this._position={lineNumber:t,column:i},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";const s=document.createElement("div");s.classList.add("anchor","top"),this._domNode.appendChild(s);const r=document.createElement("div");typeof n=="string"?(r.classList.add("message"),r.textContent=n):(n.classList.add("message"),r.appendChild(n)),this._domNode.appendChild(r);const a=document.createElement("div");a.classList.add("anchor","below"),this._domNode.appendChild(a),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(e){this._domNode.classList.toggle("below",e===2)}};yt(zs.ID,zs,4);var E6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nN=function(o,e){return function(t,i){e(t,i,o)}};const N6="acceptSelectedCodeAction",T6="previewSelectedCodeAction";class Zce{get templateId(){return"header"}renderTemplate(e){e.classList.add("group-header");const t=document.createElement("span");return e.append(t),{container:e,text:t}}renderElement(e,t,i){var n,s;i.text.textContent=(s=(n=e.group)===null||n===void 0?void 0:n.title)!==null&&s!==void 0?s:""}disposeTemplate(e){}}let sN=class{get templateId(){return"action"}constructor(e,t){this._supportsPreview=e,this._keybindingService=t}renderTemplate(e){e.classList.add(this.templateId);const t=document.createElement("div");t.className="icon",e.append(t);const i=document.createElement("span");i.className="title",e.append(i);const n=new Mv(e,mo);return{container:e,icon:t,text:i,keybinding:n}}renderElement(e,t,i){var n,s,r;if(!((n=e.group)===null||n===void 0)&&n.icon?(i.icon.className=Re.asClassName(e.group.icon),e.group.icon.color&&(i.icon.style.color=Ce(e.group.icon.color.id))):(i.icon.className=Re.asClassName(he.lightBulb),i.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!e.item||!e.label)return;i.text.textContent=M6(e.label),i.keybinding.set(e.keybinding),J$(!!e.keybinding,i.keybinding.element);const a=(s=this._keybindingService.lookupKeybinding(N6))===null||s===void 0?void 0:s.getLabel(),l=(r=this._keybindingService.lookupKeybinding(T6))===null||r===void 0?void 0:r.getLabel();i.container.classList.toggle("option-disabled",e.disabled),e.disabled?i.container.title=e.label:a&&l?this._supportsPreview&&e.canPreview?i.container.title=p({},"{0} to apply, {1} to preview",a,l):i.container.title=p({},"{0} to apply",a):i.container.title=""}disposeTemplate(e){}};sN=E6([nN(1,Pt)],sN);class Yce extends UIEvent{constructor(){super("acceptSelectedAction")}}class YF extends UIEvent{constructor(){super("previewSelectedAction")}}function Xce(o){if(o.kind==="action")return o.label}let oN=class extends K{constructor(e,t,i,n,s,r){super(),this._delegate=n,this._contextViewService=s,this._keybindingService=r,this._actionLineHeight=24,this._headerLineHeight=26,this.cts=this._register(new Wi),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList");const a={getHeight:l=>l.kind==="header"?this._headerLineHeight:this._actionLineHeight,getTemplateId:l=>l.kind};this._list=this._register(new yr(e,this.domNode,a,[new sN(t,this._keybindingService),new Zce],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:Xce},accessibilityProvider:{getAriaLabel:l=>{if(l.kind==="action"){let d=l.label?M6(l?.label):"";return l.disabled&&(d=p({},"{0}, Disabled Reason: {1}",d,l.disabled)),d}return null},getWidgetAriaLabel:()=>p({},"Action Widget"),getRole:l=>l.kind==="action"?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(sg),this._register(this._list.onMouseClick(l=>this.onListClick(l))),this._register(this._list.onMouseOver(l=>this.onListHover(l))),this._register(this._list.onDidChangeFocus(()=>this.onFocus())),this._register(this._list.onDidChangeSelection(l=>this.onListSelection(l))),this._allMenuItems=i,this._list.splice(0,this._list.length,this._allMenuItems),this._list.length&&this.focusNext()}focusCondition(e){return!e.disabled&&e.kind==="action"}hide(e){this._delegate.onHide(e),this.cts.cancel(),this._contextViewService.hideContextView()}layout(e){const t=this._allMenuItems.filter(l=>l.kind==="header").length,n=this._allMenuItems.length*this._actionLineHeight+t*this._headerLineHeight-t*this._actionLineHeight;this._list.layout(n);let s=e;if(this._allMenuItems.length>=50)s=380;else{const l=this._allMenuItems.map((d,c)=>{const h=this.domNode.ownerDocument.getElementById(this._list.getElementID(c));if(h){h.style.width="auto";const u=h.getBoundingClientRect().width;return h.style.width="",u}return 0});s=Math.max(...l,e)}const a=Math.min(n,this.domNode.ownerDocument.body.clientHeight*.7);return this._list.layout(a,s),this.domNode.style.height=`${a}px`,this._list.domFocus(),s}focusPrevious(){this._list.focusPrevious(1,!0,void 0,this.focusCondition)}focusNext(){this._list.focusNext(1,!0,void 0,this.focusCondition)}acceptSelected(e){const t=this._list.getFocus();if(t.length===0)return;const i=t[0],n=this._list.element(i);if(!this.focusCondition(n))return;const s=e?new YF:new Yce;this._list.setSelection([i],s)}onListSelection(e){if(!e.elements.length)return;const t=e.elements[0];t.item&&this.focusCondition(t)?this._delegate.onSelect(t.item,e.browserEvent instanceof YF):this._list.setSelection([])}onFocus(){var e,t;this._list.domFocus();const i=this._list.getFocus();if(i.length===0)return;const n=i[0],s=this._list.element(n);(t=(e=this._delegate).onFocus)===null||t===void 0||t.call(e,s.item)}async onListHover(e){const t=e.element;if(t&&t.item&&this.focusCondition(t)){if(this._delegate.onHover&&!t.disabled&&t.kind==="action"){const i=await this._delegate.onHover(t.item,this.cts.token);t.canPreview=i?i.canPreview:void 0}e.index&&this._list.splice(e.index,1,[t])}this._list.setFocus(typeof e.index=="number"?[e.index]:[])}onListClick(e){e.element&&this.focusCondition(e.element)&&this._list.setFocus([])}};oN=E6([nN(4,bd),nN(5,Pt)],oN);function M6(o){return o.replace(/\r\n|\r|\n/g," ")}var Qce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nD=function(o,e){return function(t,i){e(t,i,o)}};R("actionBar.toggledBackground",{dark:Qh,light:Qh,hcDark:Qh,hcLight:Qh},p("actionBar.toggledBackground","Background color for toggled action items in action bar."));const Wu={Visible:new be("codeActionMenuVisible",!1,p("codeActionMenuVisible","Whether the action widget list is visible"))},ag=ot("actionWidgetService");let Vu=class extends K{get isVisible(){return Wu.Visible.getValue(this._contextKeyService)||!1}constructor(e,t,i){super(),this._contextViewService=e,this._contextKeyService=t,this._instantiationService=i,this._list=this._register(new Cn)}show(e,t,i,n,s,r,a){const l=Wu.Visible.bindTo(this._contextKeyService),d=this._instantiationService.createInstance(oN,e,t,i,n);this._contextViewService.showContextView({getAnchor:()=>s,render:c=>(l.set(!0),this._renderWidget(c,d,a??[])),onHide:c=>{l.reset(),this._onWidgetClosed(c)}},r,!1)}acceptSelected(e){var t;(t=this._list.value)===null||t===void 0||t.acceptSelected(e)}focusPrevious(){var e,t;(t=(e=this._list)===null||e===void 0?void 0:e.value)===null||t===void 0||t.focusPrevious()}focusNext(){var e,t;(t=(e=this._list)===null||e===void 0?void 0:e.value)===null||t===void 0||t.focusNext()}hide(){var e;(e=this._list.value)===null||e===void 0||e.hide(),this._list.clear()}_renderWidget(e,t,i){var n;const s=document.createElement("div");if(s.classList.add("action-widget"),e.appendChild(s),this._list.value=t,this._list.value)s.appendChild(this._list.value.domNode);else throw new Error("List has no value");const r=new se,a=document.createElement("div"),l=e.appendChild(a);l.classList.add("context-view-block"),r.add(Q(l,ge.MOUSE_DOWN,f=>f.stopPropagation()));const d=document.createElement("div"),c=e.appendChild(d);c.classList.add("context-view-pointerBlock"),r.add(Q(c,ge.POINTER_MOVE,()=>c.remove())),r.add(Q(c,ge.MOUSE_DOWN,()=>c.remove()));let h=0;if(i.length){const f=this._createActionBar(".action-widget-action-bar",i);f&&(s.appendChild(f.getContainer().parentElement),r.add(f),h=f.getContainer().offsetWidth)}const u=(n=this._list.value)===null||n===void 0?void 0:n.layout(h);s.style.width=`${u}px`;const g=r.add(dl(e));return r.add(g.onDidBlur(()=>this.hide())),r}_createActionBar(e,t){if(!t.length)return;const i=pe(e),n=new Go(i);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){var t;(t=this._list.value)===null||t===void 0||t.hide(e)}};Vu=Qce([nD(0,bd),nD(1,We),nD(2,Oe)],Vu);ct(ag,Vu,1);const zv=1100;Xt(class extends ko{constructor(){super({id:"hideCodeActionWidget",title:{value:p("hideCodeActionWidget.title","Hide action widget"),original:"Hide action widget"},precondition:Wu.Visible,keybinding:{weight:zv,primary:9,secondary:[1033]}})}run(o){o.get(ag).hide()}});Xt(class extends ko{constructor(){super({id:"selectPrevCodeAction",title:{value:p("selectPrevCodeAction.title","Select previous action"),original:"Select previous action"},precondition:Wu.Visible,keybinding:{weight:zv,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(o){const e=o.get(ag);e instanceof Vu&&e.focusPrevious()}});Xt(class extends ko{constructor(){super({id:"selectNextCodeAction",title:{value:p("selectNextCodeAction.title","Select next action"),original:"Select next action"},precondition:Wu.Visible,keybinding:{weight:zv,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(o){const e=o.get(ag);e instanceof Vu&&e.focusNext()}});Xt(class extends ko{constructor(){super({id:N6,title:{value:p("acceptSelected.title","Accept selected action"),original:"Accept selected action"},precondition:Wu.Visible,keybinding:{weight:zv,primary:3,secondary:[2137]}})}run(o){const e=o.get(ag);e instanceof Vu&&e.acceptSelected()}});Xt(class extends ko{constructor(){super({id:T6,title:{value:p("previewSelected.title","Preview selected action"),original:"Preview selected action"},precondition:Wu.Visible,keybinding:{weight:zv,primary:2051}})}run(o){const e=o.get(ag);e instanceof Vu&&e.acceptSelected(!0)}});const R6=new be("supportedCodeAction","");class Jce extends K{constructor(e,t,i,n=250){super(),this._editor=e,this._markerService=t,this._signalChange=i,this._delay=n,this._autoTriggerTimer=this._register(new Cr),this._register(this._markerService.onMarkerChanged(s=>this._onMarkerChanges(s))),this._register(this._editor.onDidChangeCursorPosition(()=>this._tryAutoTrigger()))}trigger(e){const t=this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);this._signalChange(t?{trigger:e,selection:t}:void 0)}_onMarkerChanges(e){const t=this._editor.getModel();t&&e.some(i=>J2(i,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:qs.Default})},this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(e){var t;if(!this._editor.hasModel())return;const i=this._editor.getModel(),n=this._editor.getSelection();if(n.isEmpty()&&e.type===2){const{lineNumber:s,column:r}=n.getPosition(),a=i.getLineContent(s);if(a.length===0){if(!(((t=this._editor.getOption(64).experimental)===null||t===void 0?void 0:t.showAiIcon)===As.On))return}else if(r===1){if(/\s/.test(a[0]))return}else if(r===i.getLineMaxColumn(s)){if(/\s/.test(a[a.length-1]))return}else if(/\s/.test(a[r-2])&&/\s/.test(a[r-1]))return}return n}}var Gh;(function(o){o.Empty={type:0};class e{constructor(i,n,s){this.trigger=i,this.position=n,this._cancellablePromise=s,this.type=1,this.actions=s.catch(r=>{if(oa(r))return A6;throw r})}cancel(){this._cancellablePromise.cancel()}}o.Triggered=e})(Gh||(Gh={}));const A6=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class ehe extends K{constructor(e,t,i,n,s,r){super(),this._editor=e,this._registry=t,this._markerService=i,this._progressService=s,this._configurationService=r,this._codeActionOracle=this._register(new Cn),this._state=Gh.Empty,this._onDidChangeState=this._register(new W),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=R6.bindTo(n),this._register(this._editor.onDidChangeModel(()=>this._update())),this._register(this._editor.onDidChangeModelLanguage(()=>this._update())),this._register(this._registry.onDidChange(()=>this._update())),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(Gh.Empty,!0))}_settingEnabledNearbyQuickfixes(){var e;const t=(e=this._editor)===null||e===void 0?void 0:e.getModel();return this._configurationService?this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:t?.uri}):!1}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(Gh.Empty);const e=this._editor.getModel();if(e&&this._registry.has(e)&&!this._editor.getOption(90)){const t=this._registry.all(e).flatMap(i=>{var n;return(n=i.providedCodeActionKinds)!==null&&n!==void 0?n:[]});this._supportedCodeActions.set(t.join(" ")),this._codeActionOracle.value=new Jce(this._editor,this._markerService,i=>{var n;if(!i){this.setState(Gh.Empty);return}const s=i.selection.getStartPosition(),r=Zi(async a=>{var l,d,c,h,u,g;if(this._settingEnabledNearbyQuickfixes()&&i.trigger.type===1&&(i.trigger.triggerAction===qs.QuickFix||!((d=(l=i.trigger.filter)===null||l===void 0?void 0:l.include)===null||d===void 0)&&d.contains(Be.QuickFix))){const f=await L_(this._registry,e,i.selection,i.trigger,ld.None,a),m=[...f.allActions];if(a.isCancellationRequested)return A6;if(!((c=f.validActions)===null||c===void 0?void 0:c.some(v=>v.action.kind?Be.QuickFix.contains(new Be(v.action.kind)):!1))){const v=this._markerService.read({resource:e.uri});if(v.length>0){const b=i.selection.getPosition();let C=b,w=Number.MAX_VALUE;const y=[...f.validActions];for(const D of v){const T=D.endColumn,P=D.endLineNumber,H=D.startLineNumber;if(P===b.lineNumber||H===b.lineNumber){C=new V(P,T);const Y={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:!((h=i.trigger.filter)===null||h===void 0)&&h.include?(u=i.trigger.filter)===null||u===void 0?void 0:u.include:Be.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:((g=i.trigger.context)===null||g===void 0?void 0:g.notAvailableMessage)||"",position:C}},B=new xe(C.lineNumber,C.column,C.lineNumber,C.column),U=await L_(this._registry,e,B,Y,ld.None,a);if(U.validActions.length!==0){for(const G of U.validActions)G.highlightRange=G.action.isPreferred;f.allActions.length===0&&m.push(...U.allActions),Math.abs(b.column-T)<w?y.unshift(...U.validActions):y.push(...U.validActions)}w=Math.abs(b.column-T)}}const I=y.filter((D,T,P)=>P.findIndex(H=>H.action.title===D.action.title)===T);return I.sort((D,T)=>D.action.isPreferred&&!T.action.isPreferred?-1:!D.action.isPreferred&&T.action.isPreferred||D.action.isAI&&!T.action.isAI?1:!D.action.isAI&&T.action.isAI?-1:0),{validActions:I,allActions:m,documentation:f.documentation,hasAutoFix:f.hasAutoFix,hasAIFix:f.hasAIFix,allAIFixes:f.allAIFixes,dispose:()=>{f.dispose()}}}}}return L_(this._registry,e,i.selection,i.trigger,ld.None,a)});i.trigger.type===1&&((n=this._progressService)===null||n===void 0||n.showWhile(r,250)),this.setState(new Gh.Triggered(i.trigger,s,r))},void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:qs.Default})}else this._supportedCodeActions.reset()}trigger(e){var t;(t=this._codeActionOracle.value)===null||t===void 0||t.trigger(e)}setState(e,t){e!==this._state&&(this._state.type===1&&this._state.cancel(),this._state=e,!t&&!this._disposed&&this._onDidChangeState.fire(e))}}var the=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},El=function(o,e){return function(t,i){e(t,i,o)}},YC;const ihe="quickfix-edit-highlight";let jc=YC=class extends K{static get(e){return e.getContribution(YC.ID)}constructor(e,t,i,n,s,r,a,l,d,c){super(),this._commandService=a,this._configurationService=l,this._actionWidgetService=d,this._instantiationService=c,this._activeCodeActions=this._register(new Cn),this._showDisabled=!1,this._disposed=!1,this._editor=e,this._model=this._register(new ehe(this._editor,s.codeActionProvider,t,i,r,l)),this._register(this._model.onDidChangeState(h=>this.update(h))),this._lightBulbWidget=new sh(()=>{const h=this._editor.getContribution(Bu.ID);return h&&this._register(h.onClick(u=>this.showCodeActionList(u.actions,u,{includeDisabledActions:!1,fromLightbulb:!0}))),h}),this._resolver=n.createInstance(Ww),this._register(this._editor.onDidLayoutChange(()=>this._actionWidgetService.hide()))}dispose(){this._disposed=!0,super.dispose()}showCodeActions(e,t,i){return this.showCodeActionList(t,i,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(e,t,i,n){var s;if(!this._editor.hasModel())return;(s=zs.get(this._editor))===null||s===void 0||s.closeMessage();const r=this._editor.getPosition();this._trigger({type:1,triggerAction:t,filter:i,autoApply:n,context:{notAvailableMessage:e,position:r}})}_trigger(e){return this._model.trigger(e)}async _applyCodeAction(e,t,i){try{await this._instantiationService.invokeFunction(Bce,e,Bw.FromCodeActions,{preview:i,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:qs.QuickFix,filter:{}})}}async update(e){var t,i,n,s,r,a,l;if(e.type!==1){(t=this._lightBulbWidget.rawValue)===null||t===void 0||t.hide();return}let d;try{d=await e.actions}catch(c){Ge(c);return}if(!this._disposed)if((i=this._lightBulbWidget.value)===null||i===void 0||i.update(d,e.trigger,e.position),e.trigger.type===1){if(!((n=e.trigger.filter)===null||n===void 0)&&n.include){const h=this.tryGetValidActionToApply(e.trigger,d);if(h){try{(s=this._lightBulbWidget.value)===null||s===void 0||s.hide(),await this._applyCodeAction(h,!1,!1)}finally{d.dispose()}return}if(e.trigger.context){const u=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,d);if(u&&u.action.disabled){(r=zs.get(this._editor))===null||r===void 0||r.showMessage(u.action.disabled,e.trigger.context.position),d.dispose();return}}}const c=!!(!((a=e.trigger.filter)===null||a===void 0)&&a.include);if(e.trigger.context&&(!d.allActions.length||!c&&!d.validActions.length)){(l=zs.get(this._editor))===null||l===void 0||l.showMessage(e.trigger.context.notAvailableMessage,e.trigger.context.position),this._activeCodeActions.value=d,d.dispose();return}this._activeCodeActions.value=d,this.showCodeActionList(d,this.toCoords(e.position),{includeDisabledActions:c,fromLightbulb:!1})}else this._actionWidgetService.isVisible?d.dispose():this._activeCodeActions.value=d}getInvalidActionThatWouldHaveBeenApplied(e,t){if(t.allActions.length&&(e.autoApply==="first"&&t.validActions.length===0||e.autoApply==="ifSingle"&&t.allActions.length===1))return t.allActions.find(({action:i})=>i.disabled)}tryGetValidActionToApply(e,t){if(t.validActions.length&&(e.autoApply==="first"&&t.validActions.length>0||e.autoApply==="ifSingle"&&t.validActions.length===1))return t.validActions[0]}async showCodeActionList(e,t,i){const n=this._editor.createDecorationsCollection(),s=this._editor.getDomNode();if(!s)return;const r=i.includeDisabledActions&&(this._showDisabled||e.validActions.length===0)?e.allActions:e.validActions;if(!r.length)return;const a=V.isIPosition(t)?this.toCoords(t):t,l={onSelect:async(d,c)=>{this._applyCodeAction(d,!0,!!c),this._actionWidgetService.hide(),n.clear()},onHide:()=>{var d;(d=this._editor)===null||d===void 0||d.focus(),n.clear()},onHover:async(d,c)=>{var h;if(await d.resolve(c),!c.isCancellationRequested)return{canPreview:!!(!((h=d.action.edit)===null||h===void 0)&&h.edits.length)}},onFocus:d=>{var c,h;if(d&&d.highlightRange&&d.action.diagnostics){const u=[{range:d.action.diagnostics[0],options:YC.DECORATION}];n.set(u);const g=d.action.diagnostics[0],f=(h=(c=this._editor.getModel())===null||c===void 0?void 0:c.getWordAtPosition({lineNumber:g.startLineNumber,column:g.startColumn}))===null||h===void 0?void 0:h.word;Du(p("editingNewSelection","Context: {0} at line {1} and column {2}.",f,g.startLineNumber,g.startColumn))}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,Uce(r,this._shouldShowHeaders(),this._resolver.getResolver()),l,a,s,this._getActionBarActions(e,t,i))}toCoords(e){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(e,1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(e),i=ji(this._editor.getDomNode()),n=i.left+t.left,s=i.top+t.top+t.height;return{x:n,y:s}}_shouldShowHeaders(){var e;const t=(e=this._editor)===null||e===void 0?void 0:e.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:t?.uri})}_getActionBarActions(e,t,i){if(i.fromLightbulb)return[];const n=e.documentation.map(s=>{var r;return{id:s.id,label:s.title,tooltip:(r=s.tooltip)!==null&&r!==void 0?r:"",class:void 0,enabled:!0,run:()=>{var a;return this._commandService.executeCommand(s.id,...(a=s.arguments)!==null&&a!==void 0?a:[])}}});return i.includeDisabledActions&&e.validActions.length>0&&e.allActions.length!==e.validActions.length&&n.push(this._showDisabled?{id:"hideMoreActions",label:p("hideMoreActions","Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,i))}:{id:"showMoreActions",label:p("showMoreActions","Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,i))}),n}};jc.ID="editor.contrib.codeActionController";jc.DECORATION=Ze.register({description:"quickfix-highlight",className:ihe});jc=YC=the([El(1,yl),El(2,We),El(3,Oe),El(4,Se),El(5,lh),El(6,ui),El(7,ft),El(8,ag),El(9,Oe)],jc);Sr((o,e)=>{((n,s)=>{s&&e.addRule(`.monaco-editor ${n} { background-color: ${s}; }`)})(".quickfix-edit-highlight",o.getColor(Ga));const i=o.getColor(Jd);i&&e.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${il(o.type)?"dotted":"solid"} ${i}; box-sizing: border-box; }`)});function Uv(o){return te.regex(R6.keys()[0],new RegExp("(\\s|^)"+yo(o.value)+"\\b"))}const vR={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:p("args.schema.kind","Kind of the code action to run.")},apply:{type:"string",description:p("args.schema.apply","Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[p("args.schema.apply.first","Always apply the first returned code action."),p("args.schema.apply.ifSingle","Apply the first returned code action if it is the only one."),p("args.schema.apply.never","Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:p("args.schema.preferred","Controls if only preferred code actions should be returned.")}}};function lg(o,e,t,i,n=qs.Default){if(o.hasModel()){const s=jc.get(o);s?.manualTriggerAtCurrentPosition(e,n,t,i)}}class nhe extends we{constructor(){super({id:pR,label:p("quickfix.trigger.label","Quick Fix..."),alias:"Quick Fix...",precondition:te.and(M.writable,M.hasCodeActionsProvider),kbOpts:{kbExpr:M.textInputFocus,primary:2137,weight:100}})}run(e,t){return lg(t,p("editor.action.quickFix.noneMessage","No code actions available"),void 0,void 0,qs.QuickFix)}}class she extends cn{constructor(){super({id:y6,precondition:te.and(M.writable,M.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:vR}]}})}runEditorCommand(e,t,i){const n=Va.fromUser(i,{kind:Be.Empty,apply:"ifSingle"});return lg(t,typeof i?.kind=="string"?n.preferred?p("editor.action.codeAction.noneMessage.preferred.kind","No preferred code actions for '{0}' available",i.kind):p("editor.action.codeAction.noneMessage.kind","No code actions for '{0}' available",i.kind):n.preferred?p("editor.action.codeAction.noneMessage.preferred","No preferred code actions available"):p("editor.action.codeAction.noneMessage","No code actions available"),{include:n.kind,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply)}}class ohe extends we{constructor(){super({id:x6,label:p("refactor.label","Refactor..."),alias:"Refactor...",precondition:te.and(M.writable,M.hasCodeActionsProvider),kbOpts:{kbExpr:M.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:te.and(M.writable,Uv(Be.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:vR}]}})}run(e,t,i){const n=Va.fromUser(i,{kind:Be.Refactor,apply:"never"});return lg(t,typeof i?.kind=="string"?n.preferred?p("editor.action.refactor.noneMessage.preferred.kind","No preferred refactorings for '{0}' available",i.kind):p("editor.action.refactor.noneMessage.kind","No refactorings for '{0}' available",i.kind):n.preferred?p("editor.action.refactor.noneMessage.preferred","No preferred refactorings available"):p("editor.action.refactor.noneMessage","No refactorings available"),{include:Be.Refactor.contains(n.kind)?n.kind:Be.None,onlyIncludePreferredActions:n.preferred},n.apply,qs.Refactor)}}class rhe extends we{constructor(){super({id:D6,label:p("source.label","Source Action..."),alias:"Source Action...",precondition:te.and(M.writable,M.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:te.and(M.writable,Uv(Be.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:vR}]}})}run(e,t,i){const n=Va.fromUser(i,{kind:Be.Source,apply:"never"});return lg(t,typeof i?.kind=="string"?n.preferred?p("editor.action.source.noneMessage.preferred.kind","No preferred source actions for '{0}' available",i.kind):p("editor.action.source.noneMessage.kind","No source actions for '{0}' available",i.kind):n.preferred?p("editor.action.source.noneMessage.preferred","No preferred source actions available"):p("editor.action.source.noneMessage","No source actions available"),{include:Be.Source.contains(n.kind)?n.kind:Be.None,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply,qs.SourceAction)}}class ahe extends we{constructor(){super({id:mR,label:p("organizeImports.label","Organize Imports"),alias:"Organize Imports",precondition:te.and(M.writable,Uv(Be.SourceOrganizeImports)),kbOpts:{kbExpr:M.textInputFocus,primary:1581,weight:100}})}run(e,t){return lg(t,p("editor.action.organize.noneMessage","No organize imports action available"),{include:Be.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",qs.OrganizeImports)}}class lhe extends we{constructor(){super({id:_R,label:p("fixAll.label","Fix All"),alias:"Fix All",precondition:te.and(M.writable,Uv(Be.SourceFixAll))})}run(e,t){return lg(t,p("fixAll.noneMessage","No fix all action available"),{include:Be.SourceFixAll,includeSourceActions:!0},"ifSingle",qs.FixAll)}}class dhe extends we{constructor(){super({id:L6,label:p("autoFix.label","Auto Fix..."),alias:"Auto Fix...",precondition:te.and(M.writable,Uv(Be.QuickFix)),kbOpts:{kbExpr:M.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(e,t){return lg(t,p("editor.action.autoFix.noneMessage","No auto fixes available"),{include:Be.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",qs.AutoFix)}}yt(jc.ID,jc,3);yt(Bu.ID,Bu,4);de(nhe);de(ohe);de(rhe);de(ahe);de(dhe);de(lhe);ue(new she);Ri.as(la.Configuration).registerConfiguration({...iy,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:p("showCodeActionHeaders","Enable/disable showing group headers in the Code Action menu."),default:!0}}});Ri.as(la.Configuration).registerConfiguration({...iy,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:5,description:p("includeNearbyQuickFixes","Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}});class rN{constructor(){this.lenses=[],this._disposables=new se}dispose(){this._disposables.dispose()}get isDisposed(){return this._disposables.isDisposed}add(e,t){this._disposables.add(e);for(const i of e.lenses)this.lenses.push({symbol:i,provider:t})}}async function P6(o,e,t){const i=o.ordered(e),n=new Map,s=new rN,r=i.map(async(a,l)=>{n.set(a,l);try{const d=await Promise.resolve(a.provideCodeLenses(e,t));d&&s.add(d,a)}catch(d){Mi(d)}});return await Promise.all(r),s.lenses=s.lenses.sort((a,l)=>a.symbol.range.startLineNumber<l.symbol.range.startLineNumber?-1:a.symbol.range.startLineNumber>l.symbol.range.startLineNumber?1:n.get(a.provider)<n.get(l.provider)?-1:n.get(a.provider)>n.get(l.provider)?1:a.symbol.range.startColumn<l.symbol.range.startColumn?-1:a.symbol.range.startColumn>l.symbol.range.startColumn?1:0),s}gt.registerCommand("_executeCodeLensProvider",function(o,...e){let[t,i]=e;Tt(Me.isUri(t)),Tt(typeof i=="number"||!i);const{codeLensProvider:n}=o.get(Se),s=o.get(ii).getModel(t);if(!s)throw Wo();const r=[],a=new se;return P6(n,s,st.None).then(l=>{a.add(l);const d=[];for(const c of l.lenses)i==null||c.symbol.command?r.push(c.symbol):i-- >0&&c.provider.resolveCodeLens&&d.push(Promise.resolve(c.provider.resolveCodeLens(s,c.symbol,st.None)).then(h=>r.push(h||c.symbol)));return Promise.all(d)}).then(()=>r).finally(()=>{setTimeout(()=>a.dispose(),100)})});var che=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},hhe=function(o,e){return function(t,i){e(t,i,o)}};const O6=ot("ICodeLensCache");class XF{constructor(e,t){this.lineCount=e,this.data=t}}let aN=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new oh(20,.75);const t="codelens/cache";Mm(hi,()=>e.remove(t,1));const i="codelens/cache2",n=e.get(i,1,"{}");this._deserialize(n),fe.once(e.onWillSaveState)(s=>{s.reason===y0.SHUTDOWN&&e.store(i,this._serialize(),1,1)})}put(e,t){const i=t.lenses.map(r=>{var a;return{range:r.symbol.range,command:r.symbol.command&&{id:"",title:(a=r.symbol.command)===null||a===void 0?void 0:a.title}}}),n=new rN;n.add({lenses:i,dispose:()=>{}},this._fakeProvider);const s=new XF(e.getLineCount(),n);this._cache.set(e.uri.toString(),s)}get(e){const t=this._cache.get(e.uri.toString());return t&&t.lineCount===e.getLineCount()?t.data:void 0}delete(e){this._cache.delete(e.uri.toString())}_serialize(){const e=Object.create(null);for(const[t,i]of this._cache){const n=new Set;for(const s of i.data.lenses)n.add(s.symbol.range.startLineNumber);e[t]={lineCount:i.lineCount,lines:[...n.values()]}}return JSON.stringify(e)}_deserialize(e){try{const t=JSON.parse(e);for(const i in t){const n=t[i],s=[];for(const a of n.lines)s.push({range:new k(a,1,a,11)});const r=new rN;r.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(i,new XF(n.lineCount,r))}}catch{}}};aN=che([hhe(0,da)],aN);ct(O6,aN,1);class uhe{constructor(e,t,i){this.afterColumn=1073741824,this.afterLineNumber=e,this.heightInPx=t,this._onHeight=i,this.suppressMouseDown=!0,this.domNode=document.createElement("div")}onComputedHeight(e){this._lastHeight===void 0?this._lastHeight=e:this._lastHeight!==e&&(this._lastHeight=e,this._onHeight())}isVisible(){return this._lastHeight!==0&&this.domNode.hasAttribute("monaco-visible-view-zone")}}class My{constructor(e,t){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id=`codelens.widget-${My._idPool++}`,this.updatePosition(t),this._domNode=document.createElement("span"),this._domNode.className="codelens-decoration"}withCommands(e,t){this._commands.clear();const i=[];let n=!1;for(let s=0;s<e.length;s++){const r=e[s];if(r&&(n=!0,r.command)){const a=vc(r.command.title.trim());r.command.id?(i.push(pe("a",{id:String(s),title:r.command.tooltip,role:"button"},...a)),this._commands.set(String(s),r.command)):i.push(pe("span",{title:r.command.tooltip},...a)),s+1<e.length&&i.push(pe("span",void 0," | "))}}n?(Wn(this._domNode,...i),this._isEmpty&&t&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Wn(this._domNode,pe("span",void 0,"no commands"))}getCommand(e){return e.parentElement===this._domNode?this._commands.get(e.id):void 0}getId(){return this._id}getDomNode(){return this._domNode}updatePosition(e){const t=this._editor.getModel().getLineFirstNonWhitespaceColumn(e);this._widgetPosition={position:{lineNumber:e,column:t},preference:[1]}}getPosition(){return this._widgetPosition||null}}My._idPool=0;class sD{constructor(){this._removeDecorations=[],this._addDecorations=[],this._addDecorationsCallbacks=[]}addDecoration(e,t){this._addDecorations.push(e),this._addDecorationsCallbacks.push(t)}removeDecoration(e){this._removeDecorations.push(e)}commit(e){const t=e.deltaDecorations(this._removeDecorations,this._addDecorations);for(let i=0,n=t.length;i<n;i++)this._addDecorationsCallbacks[i](t[i])}}const QF=Ze.register({collapseOnReplaceEdit:!0,description:"codelens"});class JF{constructor(e,t,i,n,s,r){this._isDisposed=!1,this._editor=t,this._data=e,this._decorationIds=[];let a;const l=[];this._data.forEach((d,c)=>{d.symbol.command&&l.push(d.symbol),i.addDecoration({range:d.symbol.range,options:QF},h=>this._decorationIds[c]=h),a?a=k.plusRange(a,d.symbol.range):a=k.lift(d.symbol.range)}),this._viewZone=new uhe(a.startLineNumber-1,s,r),this._viewZoneId=n.addZone(this._viewZone),l.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(l,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new My(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(e,t){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],t?.removeZone(this._viewZoneId),this._contentWidget&&(this._editor.removeContentWidget(this._contentWidget),this._contentWidget=void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some((e,t)=>{const i=this._editor.getModel().getDecorationRange(e),n=this._data[t].symbol;return!!(i&&k.isEmpty(n.range)===i.isEmpty())})}updateCodeLensSymbols(e,t){this._decorationIds.forEach(t.removeDecoration,t),this._decorationIds=[],this._data=e,this._data.forEach((i,n)=>{t.addDecoration({range:i.symbol.range,options:QF},s=>this._decorationIds[n]=s)})}updateHeight(e,t){this._viewZone.heightInPx=e,t.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(e){if(!this._viewZone.isVisible())return null;for(let t=0;t<this._decorationIds.length;t++){const i=e.getDecorationRange(this._decorationIds[t]);i&&(this._data[t].symbol.range=i)}return this._data}updateCommands(e){this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(e,!0);for(let t=0;t<this._data.length;t++){const i=e[t];if(i){const{symbol:n}=this._data[t];n.command=i.command||n.command}}}getCommand(e){var t;return(t=this._contentWidget)===null||t===void 0?void 0:t.getCommand(e)}getLineNumber(){const e=this._editor.getModel().getDecorationRange(this._decorationIds[0]);return e?e.startLineNumber:-1}update(e){if(this.isValid()){const t=this._editor.getModel().getDecorationRange(this._decorationIds[0]);t&&(this._viewZone.afterLineNumber=t.startLineNumber-1,e.layoutZone(this._viewZoneId),this._contentWidget&&(this._contentWidget.updatePosition(t.startLineNumber),this._editor.layoutContentWidget(this._contentWidget)))}}}var ghe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Sm=function(o,e){return function(t,i){e(t,i,o)}};let bp=class{constructor(e,t,i,n,s,r){this._editor=e,this._languageFeaturesService=t,this._commandService=n,this._notificationService=s,this._codeLensCache=r,this._disposables=new se,this._localToDispose=new se,this._lenses=[],this._oldCodeLensModels=new se,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new Rt(()=>this._resolveCodeLensesInViewport(),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{(a.hasChanged(50)||a.hasChanged(19)||a.hasChanged(18))&&this._updateLensStyle(),a.hasChanged(17)&&this._onModelChange()})),this._disposables.add(t.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}dispose(){var e;this._localDispose(),this._disposables.dispose(),this._oldCodeLensModels.dispose(),(e=this._currentCodeLensModel)===null||e===void 0||e.dispose()}_getLayoutInfo(){const e=Math.max(1.3,this._editor.getOption(66)/this._editor.getOption(52));let t=this._editor.getOption(19);return(!t||t<5)&&(t=this._editor.getOption(52)*.9|0),{fontSize:t,codeLensHeight:t*e|0}}_updateLensStyle(){const{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),i=this._editor.getOption(18),n=this._editor.getOption(50),{style:s}=this._editor.getContainerDomNode();s.setProperty("--vscode-editorCodeLens-lineHeight",`${e}px`),s.setProperty("--vscode-editorCodeLens-fontSize",`${t}px`),s.setProperty("--vscode-editorCodeLens-fontFeatureSettings",n.fontFeatureSettings),i&&(s.setProperty("--vscode-editorCodeLens-fontFamily",i),s.setProperty("--vscode-editorCodeLens-fontFamilyDefault",Vs.fontFamily)),this._editor.changeViewZones(r=>{for(const a of this._lenses)a.updateHeight(e,r)})}_localDispose(){var e,t,i;(e=this._getCodeLensModelPromise)===null||e===void 0||e.cancel(),this._getCodeLensModelPromise=void 0,(t=this._resolveCodeLensesPromise)===null||t===void 0||t.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),(i=this._currentCodeLensModel)===null||i===void 0||i.dispose()}_onModelChange(){this._localDispose();const e=this._editor.getModel();if(!e||!this._editor.getOption(17)||e.isTooLargeForTokenization())return;const t=this._codeLensCache.get(e);if(t&&this._renderCodeLensSymbols(t),!this._languageFeaturesService.codeLensProvider.has(e)){t&&Rc(()=>{const n=this._codeLensCache.get(e);t===n&&(this._codeLensCache.delete(e),this._onModelChange())},30*1e3,this._localToDispose);return}for(const n of this._languageFeaturesService.codeLensProvider.all(e))if(typeof n.onDidChange=="function"){const s=n.onDidChange(()=>i.schedule());this._localToDispose.add(s)}const i=new Rt(()=>{var n;const s=Date.now();(n=this._getCodeLensModelPromise)===null||n===void 0||n.cancel(),this._getCodeLensModelPromise=Zi(r=>P6(this._languageFeaturesService.codeLensProvider,e,r)),this._getCodeLensModelPromise.then(r=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=r,this._codeLensCache.put(e,r);const a=this._provideCodeLensDebounce.update(e,Date.now()-s);i.delay=a,this._renderCodeLensSymbols(r),this._resolveCodeLensesInViewportSoon()},Ge)},this._provideCodeLensDebounce.get(e));this._localToDispose.add(i),this._localToDispose.add(Ae(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{var n;this._editor.changeDecorations(s=>{this._editor.changeViewZones(r=>{const a=[];let l=-1;this._lenses.forEach(c=>{!c.isValid()||l===c.getLineNumber()?a.push(c):(c.update(r),l=c.getLineNumber())});const d=new sD;a.forEach(c=>{c.dispose(d,r),this._lenses.splice(this._lenses.indexOf(c),1)}),d.commit(s)})}),i.schedule(),this._resolveCodeLensesScheduler.cancel(),(n=this._resolveCodeLensesPromise)===null||n===void 0||n.cancel(),this._resolveCodeLensesPromise=void 0})),this._localToDispose.add(this._editor.onDidFocusEditorWidget(()=>{i.schedule()})),this._localToDispose.add(this._editor.onDidBlurEditorText(()=>{i.cancel()})),this._localToDispose.add(this._editor.onDidScrollChange(n=>{n.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(this._editor.onDidLayoutChange(()=>{this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(Ae(()=>{if(this._editor.getModel()){const n=na.capture(this._editor);this._editor.changeDecorations(s=>{this._editor.changeViewZones(r=>{this._disposeAllLenses(s,r)})}),n.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)})),this._localToDispose.add(this._editor.onMouseDown(n=>{if(n.target.type!==9)return;let s=n.target.element;if(s?.tagName==="SPAN"&&(s=s.parentElement),s?.tagName==="A")for(const r of this._lenses){const a=r.getCommand(s);if(a){this._commandService.executeCommand(a.id,...a.arguments||[]).catch(l=>this._notificationService.error(l));break}}})),i.schedule()}_disposeAllLenses(e,t){const i=new sD;for(const n of this._lenses)n.dispose(i,t);e&&i.commit(e),this._lenses.length=0}_renderCodeLensSymbols(e){if(!this._editor.hasModel())return;const t=this._editor.getModel().getLineCount(),i=[];let n;for(const a of e.lenses){const l=a.symbol.range.startLineNumber;l<1||l>t||(n&&n[n.length-1].symbol.range.startLineNumber===l?n.push(a):(n=[a],i.push(n)))}if(!i.length&&!this._lenses.length)return;const s=na.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(a=>{this._editor.changeViewZones(l=>{const d=new sD;let c=0,h=0;for(;h<i.length&&c<this._lenses.length;){const u=i[h][0].symbol.range.startLineNumber,g=this._lenses[c].getLineNumber();g<u?(this._lenses[c].dispose(d,l),this._lenses.splice(c,1)):g===u?(this._lenses[c].updateCodeLensSymbols(i[h],d),h++,c++):(this._lenses.splice(c,0,new JF(i[h],this._editor,d,l,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),c++,h++)}for(;c<this._lenses.length;)this._lenses[c].dispose(d,l),this._lenses.splice(c,1);for(;h<i.length;)this._lenses.push(new JF(i[h],this._editor,d,l,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),h++;d.commit(a)})}),s.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){var e;(e=this._resolveCodeLensesPromise)===null||e===void 0||e.cancel(),this._resolveCodeLensesPromise=void 0;const t=this._editor.getModel();if(!t)return;const i=[],n=[];if(this._lenses.forEach(a=>{const l=a.computeIfNecessary(t);l&&(i.push(l),n.push(a))}),i.length===0)return;const s=Date.now(),r=Zi(a=>{const l=i.map((d,c)=>{const h=new Array(d.length),u=d.map((g,f)=>!g.symbol.command&&typeof g.provider.resolveCodeLens=="function"?Promise.resolve(g.provider.resolveCodeLens(t,g.symbol,a)).then(m=>{h[f]=m},Mi):(h[f]=g.symbol,Promise.resolve(void 0)));return Promise.all(u).then(()=>{!a.isCancellationRequested&&!n[c].isDisposed()&&n[c].updateCommands(h)})});return Promise.all(l)});this._resolveCodeLensesPromise=r,this._resolveCodeLensesPromise.then(()=>{const a=this._resolveCodeLensesDebounce.update(t,Date.now()-s);this._resolveCodeLensesScheduler.delay=a,this._currentCodeLensModel&&this._codeLensCache.put(t,this._currentCodeLensModel),this._oldCodeLensModels.clear(),r===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)},a=>{Ge(a),r===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)})}async getModel(){var e;return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,!((e=this._currentCodeLensModel)===null||e===void 0)&&e.isDisposed?void 0:this._currentCodeLensModel}};bp.ID="css.editor.codeLens";bp=ghe([Sm(1,Se),Sm(2,Zo),Sm(3,ui),Sm(4,Vi),Sm(5,O6)],bp);yt(bp.ID,bp,1);de(class extends we{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:M.hasCodeLensProvider,label:p("showLensOnLine","Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}async run(e,t){if(!t.hasModel())return;const i=e.get(dh),n=e.get(ui),s=e.get(Vi),r=t.getSelection().positionLineNumber,a=t.getContribution(bp.ID);if(!a)return;const l=await a.getModel();if(!l)return;const d=[];for(const u of l.lenses)u.symbol.command&&u.symbol.range.startLineNumber===r&&d.push({label:u.symbol.command.title,command:u.symbol.command});if(d.length===0)return;const c=await i.pick(d,{canPickMany:!1,placeHolder:p("placeHolder","Select a command")});if(!c)return;let h=c.command;if(l.isDisposed){const u=await a.getModel(),g=u?.lenses.find(f=>{var m;return f.symbol.range.startLineNumber===r&&((m=f.symbol.command)===null||m===void 0?void 0:m.title)===h.title});if(!g||!g.symbol.command)return;h=g.symbol.command}try{await n.executeCommand(h.id,...h.arguments||[])}catch(u){s.error(u)}}});var fhe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},oD=function(o,e){return function(t,i){e(t,i,o)}};class bR{constructor(e,t){this._editorWorkerClient=new I2(e,!1,"editorWorkerService",t)}async provideDocumentColors(e,t){return this._editorWorkerClient.computeDefaultDocumentColors(e.uri)}provideColorPresentations(e,t,i){const n=t.range,s=t.color,r=s.alpha,a=new q(new ht(Math.round(255*s.red),Math.round(255*s.green),Math.round(255*s.blue),r)),l=r?q.Format.CSS.formatRGB(a):q.Format.CSS.formatRGBA(a),d=r?q.Format.CSS.formatHSL(a):q.Format.CSS.formatHSLA(a),c=r?q.Format.CSS.formatHex(a):q.Format.CSS.formatHexA(a),h=[];return h.push({label:l,textEdit:{range:n,text:l}}),h.push({label:d,textEdit:{range:n,text:d}}),h.push({label:c,textEdit:{range:n,text:c}}),h}}let lN=class extends K{constructor(e,t,i){super(),this._register(i.colorProvider.register("*",new bR(e,t)))}};lN=fhe([oD(0,ii),oD(1,Wt),oD(2,Se)],lN);yy(lN);async function F6(o,e,t,i=!0){return CR(new phe,o,e,t,i)}function B6(o,e,t,i){return Promise.resolve(t.provideColorPresentations(o,e,i))}class phe{constructor(){}async compute(e,t,i,n){const s=await e.provideDocumentColors(t,i);if(Array.isArray(s))for(const r of s)n.push({colorInfo:r,provider:e});return Array.isArray(s)}}class mhe{constructor(){}async compute(e,t,i,n){const s=await e.provideDocumentColors(t,i);if(Array.isArray(s))for(const r of s)n.push({range:r.range,color:[r.color.red,r.color.green,r.color.blue,r.color.alpha]});return Array.isArray(s)}}class _he{constructor(e){this.colorInfo=e}async compute(e,t,i,n){const s=await e.provideColorPresentations(t,this.colorInfo,st.None);return Array.isArray(s)&&n.push(...s),Array.isArray(s)}}async function CR(o,e,t,i,n){let s=!1,r;const a=[],l=e.ordered(t);for(let d=l.length-1;d>=0;d--){const c=l[d];if(c instanceof bR)r=c;else try{await o.compute(c,t,i,a)&&(s=!0)}catch(h){Mi(h)}}return s?a:r&&n?(await o.compute(r,t,i,a),a):[]}function W6(o,e){const{colorProvider:t}=o.get(Se),i=o.get(ii).getModel(e);if(!i)throw Wo();const n=o.get(ft).getValue("editor.defaultColorDecorators",{resource:e});return{model:i,colorProviderRegistry:t,isDefaultColorDecoratorsEnabled:n}}gt.registerCommand("_executeDocumentColorProvider",function(o,...e){const[t]=e;if(!(t instanceof Me))throw Wo();const{model:i,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:s}=W6(o,t);return CR(new mhe,n,i,st.None,s)});gt.registerCommand("_executeColorPresentationProvider",function(o,...e){const[t,i]=e,{uri:n,range:s}=i;if(!(n instanceof Me)||!Array.isArray(t)||t.length!==4||!k.isIRange(s))throw Wo();const{model:r,colorProviderRegistry:a,isDefaultColorDecoratorsEnabled:l}=W6(o,n),[d,c,h,u]=t;return CR(new _he({range:s,color:{red:d,green:c,blue:h,alpha:u}}),a,r,st.None,l)});var vhe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},rD=function(o,e){return function(t,i){e(t,i,o)}},dN;const V6=Object.create({});let qc=dN=class extends K{constructor(e,t,i,n){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=i,this._localToDispose=this._register(new se),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new vv(this._editor),this._decoratorLimitReporter=new bhe,this._colorDecorationClassRefs=this._register(new se),this._debounceInformation=n.for(i.colorProvider,"Document Colors",{min:dN.RECOMPUTE_TIME}),this._register(e.onDidChangeModel(()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()})),this._register(e.onDidChangeModelLanguage(()=>this.updateColors())),this._register(i.colorProvider.onDidChange(()=>this.updateColors())),this._register(e.onDidChangeConfiguration(s=>{const r=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(145);const a=r!==this._isColorDecoratorsEnabled||s.hasChanged(21),l=s.hasChanged(145);(a||l)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())})),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(145),this.updateColors()}isEnabled(){const e=this._editor.getModel();if(!e)return!1;const t=e.getLanguageId(),i=this._configurationService.getValue(t);if(i&&typeof i=="object"){const n=i.colorDecorators;if(n&&n.enable!==void 0&&!n.enable)return n.enable}return this._editor.getOption(20)}static get(e){return e.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;const e=this._editor.getModel();!e||!this._languageFeaturesService.colorProvider.has(e)||(this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._timeoutTimer||(this._timeoutTimer=new Cr,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=Zi(async e=>{const t=this._editor.getModel();if(!t)return[];const i=new Hn(!1),n=await F6(this._languageFeaturesService.colorProvider,t,e,this._isDefaultColorDecoratorsEnabled);return this._debounceInformation.update(t,i.elapsed()),n});try{const e=await this._computePromise;this.updateDecorations(e),this.updateColorDecorators(e),this._computePromise=null}catch(e){Ge(e)}}stop(){this._timeoutTimer&&(this._timeoutTimer.cancel(),this._timeoutTimer=null),this._computePromise&&(this._computePromise.cancel(),this._computePromise=null),this._localToDispose.clear()}updateDecorations(e){const t=e.map(i=>({range:{startLineNumber:i.colorInfo.range.startLineNumber,startColumn:i.colorInfo.range.startColumn,endLineNumber:i.colorInfo.range.endLineNumber,endColumn:i.colorInfo.range.endColumn},options:Ze.EMPTY}));this._editor.changeDecorations(i=>{this._decorationsIds=i.deltaDecorations(this._decorationsIds,t),this._colorDatas=new Map,this._decorationsIds.forEach((n,s)=>this._colorDatas.set(n,e[s]))})}updateColorDecorators(e){this._colorDecorationClassRefs.clear();const t=[],i=this._editor.getOption(21);for(let s=0;s<e.length&&t.length<i;s++){const{red:r,green:a,blue:l,alpha:d}=e[s].colorInfo.color,c=new ht(Math.round(r*255),Math.round(a*255),Math.round(l*255),d),h=`rgba(${c.r}, ${c.g}, ${c.b}, ${c.a})`,u=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:h}));t.push({range:{startLineNumber:e[s].colorInfo.range.startLineNumber,startColumn:e[s].colorInfo.range.startColumn,endLineNumber:e[s].colorInfo.range.endLineNumber,endColumn:e[s].colorInfo.range.endColumn},options:{description:"colorDetector",before:{content:J3,inlineClassName:`${u.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:V6}}})}const n=i<e.length?i:!1;this._decoratorLimitReporter.update(e.length,n),this._colorDecoratorIds.set(t)}removeAllDecorations(){this._editor.removeDecorations(this._decorationsIds),this._decorationsIds=[],this._colorDecoratorIds.clear(),this._colorDecorationClassRefs.clear()}getColorData(e){const t=this._editor.getModel();if(!t)return null;const i=t.getDecorationsInRange(k.fromPositions(e,e)).filter(n=>this._colorDatas.has(n.id));return i.length===0?null:this._colorDatas.get(i[0].id)}isColorDecoration(e){return this._colorDecoratorIds.has(e)}};qc.ID="editor.contrib.colorDetector";qc.RECOMPUTE_TIME=1e3;qc=dN=vhe([rD(1,ft),rD(2,Se),rD(3,Zo)],qc);class bhe{constructor(){this._onDidChange=new W,this._computed=0,this._limited=!1}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}yt(qc.ID,qc,1);class Che{get color(){return this._color}set color(e){this._color.equals(e)||(this._color=e,this._onDidChangeColor.fire(e))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(e){this._colorPresentations=e,this.presentationIndex>e.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}constructor(e,t,i){this.presentationIndex=i,this._onColorFlushed=new W,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new W,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new W,this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=e,this._color=e,this._colorPresentations=t}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(e,t){let i=-1;for(let n=0;n<this.colorPresentations.length;n++)if(t.toLowerCase()===this.colorPresentations[n].label){i=n;break}if(i===-1){const n=t.split("(")[0].toLowerCase();for(let s=0;s<this.colorPresentations.length;s++)if(this.colorPresentations[s].label.toLowerCase().startsWith(n)){i=s;break}}i!==-1&&i!==this.presentationIndex&&(this.presentationIndex=i,this._onDidChangePresentation.fire(this.presentation))}flushColor(){this._onColorFlushed.fire(this._color)}}const po=pe;class whe extends K{constructor(e,t,i,n=!1){super(),this.model=t,this.showingStandaloneColorPicker=n,this._closeButton=null,this._domNode=po(".colorpicker-header"),ie(e,this._domNode),this._pickedColorNode=ie(this._domNode,po(".picked-color")),ie(this._pickedColorNode,po("span.codicon.codicon-color-mode")),this._pickedColorPresentation=ie(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");const s=p("clickToToggleColorOptions","Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",s),this._originalColorNode=ie(this._domNode,po(".original-color")),this._originalColorNode.style.backgroundColor=q.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=i.getColorTheme().getColor(A1)||q.white,this._register(i.onDidColorThemeChange(r=>{this.backgroundColor=r.getColor(A1)||q.white})),this._register(Q(this._pickedColorNode,ge.CLICK,()=>this.model.selectNextColorPresentation())),this._register(Q(this._originalColorNode,ge.CLICK,()=>{this.model.color=this.model.originalColor,this.model.flushColor()})),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this._register(t.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=q.Format.CSS.format(t.color)||"",this._pickedColorNode.classList.toggle("light",t.color.rgba.a<.5?this.backgroundColor.isLighter():t.color.isLighter()),this.onDidChangeColor(this.model.color),this.showingStandaloneColorPicker&&(this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new She(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=q.Format.CSS.format(e)||"",this._pickedColorNode.classList.toggle("light",e.rgba.a<.5?this.backgroundColor.isLighter():e.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}}class She extends K{constructor(e){super(),this._onClicked=this._register(new W),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),ie(e,this._button);const t=document.createElement("div");t.classList.add("close-button-inner-div"),ie(this._button,t),ie(t,po(".button"+Re.asCSSSelector(Di("color-picker-close",he.close,p("closeIcon","Icon to close the color picker"))))).classList.add("close-icon"),this._button.onclick=()=>{this._onClicked.fire()}}}class yhe extends K{constructor(e,t,i,n=!1){super(),this.model=t,this.pixelRatio=i,this._insertButton=null,this._domNode=po(".colorpicker-body"),ie(e,this._domNode),this._saturationBox=new Lhe(this._domNode,this.model,this.pixelRatio),this._register(this._saturationBox),this._register(this._saturationBox.onDidChange(this.onDidSaturationValueChange,this)),this._register(this._saturationBox.onColorFlushed(this.flushColor,this)),this._opacityStrip=new xhe(this._domNode,this.model,n),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new Dhe(this._domNode,this.model,n),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),n&&(this._insertButton=this._register(new khe(this._domNode)),this._domNode.classList.add("standalone-colorpicker"))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:e,v:t}){const i=this.model.color.hsva;this.model.color=new q(new za(i.h,e,t,i.a))}onDidOpacityChange(e){const t=this.model.color.hsva;this.model.color=new q(new za(t.h,t.s,t.v,e))}onDidHueChange(e){const t=this.model.color.hsva,i=(1-e)*360;this.model.color=new q(new za(i===360?0:i,t.s,t.v,t.a))}get domNode(){return this._domNode}get saturationBox(){return this._saturationBox}get enterButton(){return this._insertButton}layout(){this._saturationBox.layout(),this._opacityStrip.layout(),this._hueStrip.layout()}}class Lhe extends K{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this._onDidChange=new W,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new W,this.onColorFlushed=this._onColorFlushed.event,this._domNode=po(".saturation-wrap"),ie(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",ie(this._domNode,this._canvas),this.selection=po(".saturation-selection"),ie(this._domNode,this.selection),this.layout(),this._register(Q(this._domNode,ge.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;this.monitor=this._register(new Bp);const t=ji(this._domNode);e.target!==this.selection&&this.onDidChangePosition(e.offsetX,e.offsetY),this.monitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>this.onDidChangePosition(n.pageX-t.left,n.pageY-t.top),()=>null);const i=Q(e.target.ownerDocument,ge.POINTER_UP,()=>{this._onColorFlushed.fire(),i.dispose(),this.monitor&&(this.monitor.stopMonitoring(!0),this.monitor=null)},!0)}onDidChangePosition(e,t){const i=Math.max(0,Math.min(1,e/this.width)),n=Math.max(0,Math.min(1,1-t/this.height));this.paintSelection(i,n),this._onDidChange.fire({s:i,v:n})}layout(){this.width=this._domNode.offsetWidth,this.height=this._domNode.offsetHeight,this._canvas.width=this.width*this.pixelRatio,this._canvas.height=this.height*this.pixelRatio,this.paint();const e=this.model.color.hsva;this.paintSelection(e.s,e.v)}paint(){const e=this.model.color.hsva,t=new q(new za(e.h,1,1,1)),i=this._canvas.getContext("2d"),n=i.createLinearGradient(0,0,this._canvas.width,0);n.addColorStop(0,"rgba(255, 255, 255, 1)"),n.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),n.addColorStop(1,"rgba(255, 255, 255, 0)");const s=i.createLinearGradient(0,0,0,this._canvas.height);s.addColorStop(0,"rgba(0, 0, 0, 0)"),s.addColorStop(1,"rgba(0, 0, 0, 1)"),i.rect(0,0,this._canvas.width,this._canvas.height),i.fillStyle=q.Format.CSS.format(t),i.fill(),i.fillStyle=n,i.fill(),i.fillStyle=s,i.fill()}paintSelection(e,t){this.selection.style.left=`${e*this.width}px`,this.selection.style.top=`${this.height-t*this.height}px`}onDidChangeColor(e){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();const t=e.hsva;this.paintSelection(t.s,t.v)}}class H6 extends K{constructor(e,t,i=!1){super(),this.model=t,this._onDidChange=new W,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new W,this.onColorFlushed=this._onColorFlushed.event,i?(this.domNode=ie(e,po(".standalone-strip")),this.overlay=ie(this.domNode,po(".standalone-overlay"))):(this.domNode=ie(e,po(".strip")),this.overlay=ie(this.domNode,po(".overlay"))),this.slider=ie(this.domNode,po(".slider")),this.slider.style.top="0px",this._register(Q(this.domNode,ge.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const e=this.getValue(this.model.color);this.updateSliderPosition(e)}onDidChangeColor(e){const t=this.getValue(e);this.updateSliderPosition(t)}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=this._register(new Bp),i=ji(this.domNode);this.domNode.classList.add("grabbing"),e.target!==this.slider&&this.onDidChangeTop(e.offsetY),t.startMonitoring(e.target,e.pointerId,e.buttons,s=>this.onDidChangeTop(s.pageY-i.top),()=>null);const n=Q(e.target.ownerDocument,ge.POINTER_UP,()=>{this._onColorFlushed.fire(),n.dispose(),t.stopMonitoring(!0),this.domNode.classList.remove("grabbing")},!0)}onDidChangeTop(e){const t=Math.max(0,Math.min(1,1-e/this.height));this.updateSliderPosition(t),this._onDidChange.fire(t)}updateSliderPosition(e){this.slider.style.top=`${(1-e)*this.height}px`}}class xhe extends H6{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(e){super.onDidChangeColor(e);const{r:t,g:i,b:n}=e.rgba,s=new q(new ht(t,i,n,1)),r=new q(new ht(t,i,n,0));this.overlay.style.background=`linear-gradient(to bottom, ${s} 0%, ${r} 100%)`}getValue(e){return e.hsva.a}}class Dhe extends H6{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("hue-strip")}getValue(e){return 1-e.hsva.h/360}}class khe extends K{constructor(e){super(),this._onClicked=this._register(new W),this.onClicked=this._onClicked.event,this._button=ie(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._button.onclick=t=>{this._onClicked.fire()}}get button(){return this._button}}class Ihe extends wr{constructor(e,t,i,n,s=!1){super(),this.model=t,this.pixelRatio=i,this._register(H_.onDidChange(()=>this.layout()));const r=po(".colorpicker-widget");e.appendChild(r),this.header=this._register(new whe(r,this.model,n,s)),this.body=this._register(new yhe(r,this.model,this.pixelRatio,s))}layout(){this.body.layout()}}var z6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},U6=function(o,e){return function(t,i){e(t,i,o)}};class Ehe{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n,this.forceShowAtRange=!0}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let Vw=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t){return[]}computeAsync(e,t,i){return Fi.fromPromise(this._computeAsync(e,t,i))}async _computeAsync(e,t,i){if(!this._editor.hasModel())return[];const n=qc.get(this._editor);if(!n)return[];for(const s of t){if(!n.isColorDecoration(s))continue;const r=n.getColorData(s.range.getStartPosition());if(r)return[await $6(this,this._editor.getModel(),r.colorInfo,r.provider)]}return[]}renderHoverParts(e,t){return K6(this,this._editor,this._themeService,t,e)}};Vw=z6([U6(1,tn)],Vw);class Nhe{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n}}let W0=class{constructor(e,t){this._editor=e,this._themeService=t,this._color=null}async createColorHover(e,t,i){if(!this._editor.hasModel()||!qc.get(this._editor))return null;const s=await F6(i,this._editor.getModel(),st.None);let r=null,a=null;for(const h of s){const u=h.colorInfo;k.containsRange(u.range,e.range)&&(r=u,a=h.provider)}const l=r??e,d=a??t,c=!!r;return{colorHover:await $6(this,this._editor.getModel(),l,d),foundInEditor:c}}async updateEditorModel(e){if(!this._editor.hasModel())return;const t=e.model;let i=new k(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await XC(this._editor.getModel(),t,this._color,i,e),i=j6(this._editor,i,t))}renderHoverParts(e,t){return K6(this,this._editor,this._themeService,t,e)}set color(e){this._color=e}get color(){return this._color}};W0=z6([U6(1,tn)],W0);async function $6(o,e,t,i){const n=e.getValueInRange(t.range),{red:s,green:r,blue:a,alpha:l}=t.color,d=new ht(Math.round(s*255),Math.round(r*255),Math.round(a*255),l),c=new q(d),h=await B6(e,t,i,st.None),u=new Che(c,[],0);return u.colorPresentations=h||[],u.guessColorPresentation(c,n),o instanceof Vw?new Ehe(o,k.lift(t.range),u,i):new Nhe(o,k.lift(t.range),u,i)}function K6(o,e,t,i,n){if(i.length===0||!e.hasModel())return K.None;if(n.setMinimumDimensions){const u=e.getOption(66)+8;n.setMinimumDimensions(new bt(302,u))}const s=new se,r=i[0],a=e.getModel(),l=r.model,d=s.add(new Ihe(n.fragment,l,e.getOption(141),t,o instanceof W0));n.setColorPicker(d);let c=!1,h=new k(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);if(o instanceof W0){const u=i[0].model.color;o.color=u,XC(a,l,u,h,r),s.add(l.onColorFlushed(g=>{o.color=g}))}else s.add(l.onColorFlushed(async u=>{await XC(a,l,u,h,r),c=!0,h=j6(e,h,l,n)}));return s.add(l.onDidChangeColor(u=>{XC(a,l,u,h,r)})),s.add(e.onDidChangeModelContent(u=>{c?c=!1:(n.hide(),e.focus())})),s}function j6(o,e,t,i){let n,s;if(t.presentation.textEdit){n=[t.presentation.textEdit],s=new k(t.presentation.textEdit.range.startLineNumber,t.presentation.textEdit.range.startColumn,t.presentation.textEdit.range.endLineNumber,t.presentation.textEdit.range.endColumn);const r=o.getModel()._setTrackedRange(null,s,3);o.pushUndoStop(),o.executeEdits("colorpicker",n),s=o.getModel()._getTrackedRange(r)||s}else n=[{range:e,text:t.presentation.label,forceMoveMarkers:!1}],s=e.setEndPosition(e.endLineNumber,e.startColumn+t.presentation.label.length),o.pushUndoStop(),o.executeEdits("colorpicker",n);return t.presentation.additionalTextEdits&&(n=[...t.presentation.additionalTextEdits],o.executeEdits("colorpicker",n),i&&i.hide()),o.pushUndoStop(),s}async function XC(o,e,t,i,n){const s=await B6(o,{range:i,color:{red:t.rgba.r/255,green:t.rgba.g/255,blue:t.rgba.b/255,alpha:t.rgba.a}},n.provider,st.None);e.colorPresentations=s||[]}function cN(o,e){return!!o[e]}class aD{constructor(e,t){this.target=e.target,this.isLeftClick=e.event.leftButton,this.isMiddleClick=e.event.middleButton,this.isRightClick=e.event.rightButton,this.hasTriggerModifier=cN(e.event,t.triggerModifier),this.hasSideBySideModifier=cN(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}}class e5{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=cN(e,t.triggerModifier)}}class qb{constructor(e,t,i,n){this.triggerKey=e,this.triggerModifier=t,this.triggerSideBySideKey=i,this.triggerSideBySideModifier=n}equals(e){return this.triggerKey===e.triggerKey&&this.triggerModifier===e.triggerModifier&&this.triggerSideBySideKey===e.triggerSideBySideKey&&this.triggerSideBySideModifier===e.triggerSideBySideModifier}}function t5(o){return o==="altKey"?ut?new qb(57,"metaKey",6,"altKey"):new qb(5,"ctrlKey",6,"altKey"):ut?new qb(6,"altKey",57,"metaKey"):new qb(6,"altKey",5,"ctrlKey")}class Ry extends K{constructor(e,t){var i;super(),this._onMouseMoveOrRelevantKeyDown=this._register(new W),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new W),this.onExecute=this._onExecute.event,this._onCancel=this._register(new W),this.onCancel=this._onCancel.event,this._editor=e,this._extractLineNumberFromMouseEvent=(i=t?.extractLineNumberFromMouseEvent)!==null&&i!==void 0?i:n=>n.target.position?n.target.position.lineNumber:0,this._opts=t5(this._editor.getOption(77)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration(n=>{if(n.hasChanged(77)){const s=t5(this._editor.getOption(77));if(this._opts.equals(s))return;this._opts=s,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}})),this._register(this._editor.onMouseMove(n=>this._onEditorMouseMove(new aD(n,this._opts)))),this._register(this._editor.onMouseDown(n=>this._onEditorMouseDown(new aD(n,this._opts)))),this._register(this._editor.onMouseUp(n=>this._onEditorMouseUp(new aD(n,this._opts)))),this._register(this._editor.onKeyDown(n=>this._onEditorKeyDown(new e5(n,this._opts)))),this._register(this._editor.onKeyUp(n=>this._onEditorKeyUp(new e5(n,this._opts)))),this._register(this._editor.onMouseDrag(()=>this._resetHandler())),this._register(this._editor.onDidChangeCursorSelection(n=>this._onDidChangeCursorSelection(n))),this._register(this._editor.onDidChangeModel(n=>this._resetHandler())),this._register(this._editor.onDidChangeModelContent(()=>this._resetHandler())),this._register(this._editor.onDidScrollChange(n=>{(n.scrollTopChanged||n.scrollLeftChanged)&&this._resetHandler()}))}_onDidChangeCursorSelection(e){e.selection&&e.selection.startColumn!==e.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(e){this._lastMouseMoveEvent=e,this._onMouseMoveOrRelevantKeyDown.fire([e,null])}_onEditorMouseDown(e){this._hasTriggerKeyOnMouseDown=e.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(e)}_onEditorMouseUp(e){const t=this._extractLineNumberFromMouseEvent(e);this._hasTriggerKeyOnMouseDown&&this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===t&&this._onExecute.fire(e)}_onEditorKeyDown(e){this._lastMouseMoveEvent&&(e.keyCodeIsTriggerKey||e.keyCodeIsSideBySideKey&&e.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,e]):e.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(e){e.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}}var The=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Nl=function(o,e){return function(t,i){e(t,i,o)}};let Gc=class extends rp{constructor(e,t,i,n,s,r,a,l,d,c,h,u,g){super(e,{...n.getRawOptions(),overflowWidgetsDomNode:n.getOverflowWidgetsDomNode()},i,s,r,a,l,d,c,h,u,g),this._parentEditor=n,this._overwriteOptions=t,super.updateOptions(this._overwriteOptions),this._register(n.onDidChangeConfiguration(f=>this._onParentConfigurationChanged(f)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(e){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(e){hS(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};Gc=The([Nl(4,Oe),Nl(5,Dt),Nl(6,ui),Nl(7,We),Nl(8,tn),Nl(9,Vi),Nl(10,Sl),Nl(11,Wt),Nl(12,Se)],Gc);const i5=new q(new ht(0,122,204)),Mhe={showArrow:!0,showFrame:!0,className:"",frameColor:i5,arrowColor:i5,keepEditorSelection:!1},Rhe="vs.editor.contrib.zoneWidget";class Ahe{constructor(e,t,i,n,s,r,a,l){this.id="",this.domNode=e,this.afterLineNumber=t,this.afterColumn=i,this.heightInLines=n,this.showInHiddenAreas=a,this.ordinal=l,this._onDomNodeTop=s,this._onComputedHeight=r}onDomNodeTop(e){this._onDomNodeTop(e)}onComputedHeight(e){this._onComputedHeight(e)}}class Phe{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}class Ay{constructor(e){this._editor=e,this._ruleName=Ay._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),Bk(this._ruleName)}set color(e){this._color!==e&&(this._color=e,this._updateStyle())}set height(e){this._height!==e&&(this._height=e,this._updateStyle())}_updateStyle(){Bk(this._ruleName),S1(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px; margin-left: -${this._height}px; `)}show(e){e.column===1&&(e={lineNumber:e.lineNumber,column:2}),this._decorations.set([{range:k.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}}Ay._IdGenerator=new IM(".arrow-decoration-");class Ohe{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new se,this.container=null,this._isShowing=!1,this.editor=e,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=Bl(t),hS(this.options,Mhe,!1),this.domNode=document.createElement("div"),this.options.isAccessible||(this.domNode.setAttribute("aria-hidden","true"),this.domNode.setAttribute("role","presentation")),this._disposables.add(this.editor.onDidLayoutChange(i=>{const n=this._getWidth(i);this.domNode.style.width=n+"px",this.domNode.style.left=this._getLeft(i)+"px",this._onWidth(n)}))}dispose(){this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._viewZone&&this.editor.changeViewZones(e=>{this._viewZone&&e.removeZone(this._viewZone.id),this._viewZone=null}),this._positionMarkerId.clear(),this._disposables.dispose()}create(){this.domNode.classList.add("zone-widget"),this.options.className&&this.domNode.classList.add(this.options.className),this.container=document.createElement("div"),this.container.classList.add("zone-widget-container"),this.domNode.appendChild(this.container),this.options.showArrow&&(this._arrow=new Ay(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(e){e.frameColor&&(this.options.frameColor=e.frameColor),e.arrowColor&&(this.options.arrowColor=e.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){const e=this.options.frameColor.toString();this.container.style.borderTopColor=e,this.container.style.borderBottomColor=e}if(this._arrow&&this.options.arrowColor){const e=this.options.arrowColor.toString();this._arrow.color=e}}_getWidth(e){return e.width-e.minimap.minimapWidth-e.verticalScrollbarWidth}_getLeft(e){return e.minimap.minimapWidth>0&&e.minimap.minimapLeft===0?e.minimap.minimapWidth:0}_onViewZoneTop(e){this.domNode.style.top=e+"px"}_onViewZoneHeight(e){var t;if(this.domNode.style.height=`${e}px`,this.container){const i=e-this._decoratingElementsHeight();this.container.style.height=`${i}px`;const n=this.editor.getLayoutInfo();this._doLayout(i,this._getWidth(n))}(t=this._resizeSash)===null||t===void 0||t.layout()}get position(){const e=this._positionMarkerId.getRange(0);if(e)return e.getStartPosition()}show(e,t){const i=k.isIRange(e)?k.lift(e):k.fromPositions(e);this._isShowing=!0,this._showImpl(i,t),this._isShowing=!1,this._positionMarkerId.set([{range:i,options:Ze.EMPTY}])}hide(){var e;this._viewZone&&(this.editor.changeViewZones(t=>{this._viewZone&&t.removeZone(this._viewZone.id)}),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),(e=this._arrow)===null||e===void 0||e.hide(),this._positionMarkerId.clear()}_decoratingElementsHeight(){const e=this.editor.getOption(66);let t=0;if(this.options.showArrow){const i=Math.round(e/3);t+=2*i}if(this.options.showFrame){const i=Math.round(e/9);t+=2*i}return t}_showImpl(e,t){const i=e.getStartPosition(),n=this.editor.getLayoutInfo(),s=this._getWidth(n);this.domNode.style.width=`${s}px`,this.domNode.style.left=this._getLeft(n)+"px";const r=document.createElement("div");r.style.overflow="hidden";const a=this.editor.getOption(66);if(!this.options.allowUnlimitedHeight){const u=Math.max(12,this.editor.getLayoutInfo().height/a*.8);t=Math.min(t,u)}let l=0,d=0;if(this._arrow&&this.options.showArrow&&(l=Math.round(a/3),this._arrow.height=l,this._arrow.show(i)),this.options.showFrame&&(d=Math.round(a/9)),this.editor.changeViewZones(u=>{this._viewZone&&u.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new Ahe(r,i.lineNumber,i.column,t,g=>this._onViewZoneTop(g),g=>this._onViewZoneHeight(g),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=u.addZone(this._viewZone),this._overlayWidget=new Phe(Rhe+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this.container&&this.options.showFrame){const u=this.options.frameWidth?this.options.frameWidth:d;this.container.style.borderTopWidth=u+"px",this.container.style.borderBottomWidth=u+"px"}const c=t*a-this._decoratingElementsHeight();this.container&&(this.container.style.top=l+"px",this.container.style.height=c+"px",this.container.style.overflow="hidden"),this._doLayout(c,s),this.options.keepEditorSelection||this.editor.setSelection(e);const h=this.editor.getModel();if(h){const u=h.validateRange(new k(e.startLineNumber,1,e.endLineNumber+1,1));this.revealRange(u,u.startLineNumber===h.getLineCount())}}revealRange(e,t){t?this.editor.revealLineNearTop(e.endLineNumber,0):this.editor.revealRange(e,0)}setCssClass(e,t){this.container&&(t&&this.container.classList.remove(t),this.container.classList.add(e))}_onWidth(e){}_doLayout(e,t){}_relayout(e){this._viewZone&&this._viewZone.heightInLines!==e&&this.editor.changeViewZones(t=>{this._viewZone&&(this._viewZone.heightInLines=e,t.layoutZone(this._viewZone.id))})}_initSash(){if(this._resizeSash)return;this._resizeSash=this._disposables.add(new An(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0);let e;this._disposables.add(this._resizeSash.onDidStart(t=>{this._viewZone&&(e={startY:t.startY,heightInLines:this._viewZone.heightInLines})})),this._disposables.add(this._resizeSash.onDidEnd(()=>{e=void 0})),this._disposables.add(this._resizeSash.onDidChange(t=>{if(e){const i=(t.currentY-e.startY)/this.editor.getOption(66),n=i<0?Math.ceil(i):Math.floor(i),s=e.heightInLines+n;s>5&&s<35&&this._relayout(s)}}))}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(this.domNode.style.height===null?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){const e=this.editor.getLayoutInfo();return e.width-e.minimap.minimapWidth}}var q6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},G6=function(o,e){return function(t,i){e(t,i,o)}};const Z6=ot("IPeekViewService");ct(Z6,class{constructor(){this._widgets=new Map}addExclusiveWidget(o,e){const t=this._widgets.get(o);t&&(t.listener.dispose(),t.widget.dispose());const i=()=>{const n=this._widgets.get(o);n&&n.widget===e&&(n.listener.dispose(),this._widgets.delete(o))};this._widgets.set(o,{widget:e,listener:e.onDidClose(i)})}},1);var xs;(function(o){o.inPeekEditor=new be("inReferenceSearchEditor",!0,p("inReferenceSearchEditor","Whether the current code editor is embedded inside peek")),o.notInPeekEditor=o.inPeekEditor.toNegated()})(xs||(xs={}));let V0=class{constructor(e,t){e instanceof Gc&&xs.inPeekEditor.bindTo(t)}dispose(){}};V0.ID="editor.contrib.referenceController";V0=q6([G6(1,We)],V0);yt(V0.ID,V0,0);function Fhe(o){const e=o.get(Dt).getFocusedCodeEditor();return e instanceof Gc?e.getParentEditor():e}const Bhe={headerBackgroundColor:q.white,primaryHeadingColor:q.fromHex("#333333"),secondaryHeadingColor:q.fromHex("#6c6c6cb3")};let Hw=class extends Ohe{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new W,this.onDidClose=this._onDidClose.event,hS(this.options,Bhe,!1)}dispose(){this.disposed||(this.disposed=!0,super.dispose(),this._onDidClose.fire(this))}style(e){const t=this.options;e.headerBackgroundColor&&(t.headerBackgroundColor=e.headerBackgroundColor),e.primaryHeadingColor&&(t.primaryHeadingColor=e.primaryHeadingColor),e.secondaryHeadingColor&&(t.secondaryHeadingColor=e.secondaryHeadingColor),super.style(e)}_applyStyles(){super._applyStyles();const e=this.options;this._headElement&&e.headerBackgroundColor&&(this._headElement.style.backgroundColor=e.headerBackgroundColor.toString()),this._primaryHeading&&e.primaryHeadingColor&&(this._primaryHeading.style.color=e.primaryHeadingColor.toString()),this._secondaryHeading&&e.secondaryHeadingColor&&(this._secondaryHeading.style.color=e.secondaryHeadingColor.toString()),this._bodyElement&&e.frameColor&&(this._bodyElement.style.borderColor=e.frameColor.toString())}_fillContainer(e){this.setCssClass("peekview-widget"),this._headElement=pe(".head"),this._bodyElement=pe(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=pe(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),vi(this._titleElement,"click",s=>this._onTitleClick(s))),ie(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=pe("span.filename"),this._secondaryHeading=pe("span.dirname"),this._metaHeading=pe("span.meta"),ie(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const i=pe(".peekview-actions");ie(this._headElement,i);const n=this._getActionBarOptions();this._actionbarWidget=new Go(i,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(new cs("peekview.close",p("label.close","Close"),Re.asClassName(he.close),!0,()=>(this.dispose(),Promise.resolve())),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:Kne.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(e){}setTitle(e,t){this._primaryHeading&&this._secondaryHeading&&(this._primaryHeading.innerText=e,this._primaryHeading.setAttribute("title",e),t?this._secondaryHeading.innerText=t:bn(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,Os(this._metaHeading)):is(this._metaHeading))}_doLayout(e,t){if(!this._isShowing&&e<0){this.dispose();return}const i=Math.ceil(this.editor.getOption(66)*1.2),n=Math.round(e-(i+2));this._doLayoutHead(i,t),this._doLayoutBody(n,t)}_doLayoutHead(e,t){this._headElement&&(this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(e,t){this._bodyElement&&(this._bodyElement.style.height=`${e}px`)}};Hw=q6([G6(2,Oe)],Hw);const Whe=R("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:q.black,hcLight:q.white},p("peekViewTitleBackground","Background color of the peek view title area.")),Y6=R("peekViewTitleLabel.foreground",{dark:q.white,light:q.black,hcDark:q.white,hcLight:cr},p("peekViewTitleForeground","Color of the peek view title.")),X6=R("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},p("peekViewTitleInfoForeground","Color of the peek view title info.")),Vhe=R("peekView.border",{dark:Ss,light:Ss,hcDark:dt,hcLight:dt},p("peekViewBorder","Color of the peek view borders and arrow.")),Hhe=R("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:q.black,hcLight:q.white},p("peekViewResultsBackground","Background color of the peek view result list."));R("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:q.white,hcLight:cr},p("peekViewResultsMatchForeground","Foreground color for line nodes in the peek view result list."));R("peekViewResult.fileForeground",{dark:q.white,light:"#1E1E1E",hcDark:q.white,hcLight:cr},p("peekViewResultsFileForeground","Foreground color for file nodes in the peek view result list."));R("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},p("peekViewResultsSelectionBackground","Background color of the selected entry in the peek view result list."));R("peekViewResult.selectionForeground",{dark:q.white,light:"#6C6C6C",hcDark:q.white,hcLight:cr},p("peekViewResultsSelectionForeground","Foreground color of the selected entry in the peek view result list."));const rc=R("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:q.black,hcLight:q.white},p("peekViewEditorBackground","Background color of the peek view editor."));R("peekViewEditorGutter.background",{dark:rc,light:rc,hcDark:rc,hcLight:rc},p("peekViewEditorGutterBackground","Background color of the gutter in the peek view editor."));R("peekViewEditorStickyScroll.background",{dark:rc,light:rc,hcDark:rc,hcLight:rc},p("peekViewEditorStickScrollBackground","Background color of sticky scroll in the peek view editor."));R("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},p("peekViewResultsMatchHighlight","Match highlight color in the peek view result list."));R("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},p("peekViewEditorMatchHighlight","Match highlight color in the peek view editor."));R("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:Zt,hcLight:Zt},p("peekViewEditorMatchHighlightBorder","Match highlight border in the peek view editor."));class Zc{constructor(e,t,i,n){this.isProviderFirst=e,this.parent=t,this.link=i,this._rangeCallback=n,this.id=$I.nextId()}get uri(){return this.link.uri}get range(){var e,t;return(t=(e=this._range)!==null&&e!==void 0?e:this.link.targetSelectionRange)!==null&&t!==void 0?t:this.link.range}set range(e){this._range=e,this._rangeCallback(this)}get ariaMessage(){var e;const t=(e=this.parent.getPreview(this))===null||e===void 0?void 0:e.preview(this.range);return t?p({},"{0} in {1} on line {2} at column {3}",t.value,qo(this.uri),this.range.startLineNumber,this.range.startColumn):p("aria.oneReference","in {0} on line {1} at column {2}",qo(this.uri),this.range.startLineNumber,this.range.startColumn)}}class zhe{constructor(e){this._modelReference=e}dispose(){this._modelReference.dispose()}preview(e,t=8){const i=this._modelReference.object.textEditorModel;if(!i)return;const{startLineNumber:n,startColumn:s,endLineNumber:r,endColumn:a}=e,l=i.getWordUntilPosition({lineNumber:n,column:s-t}),d=new k(n,l.startColumn,n,s),c=new k(r,a,r,1073741824),h=i.getValueInRange(d).replace(/^\s+/,""),u=i.getValueInRange(e),g=i.getValueInRange(c).replace(/\s+$/,"");return{value:h+u+g,highlight:{start:h.length,end:h.length+u.length}}}}class H0{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new xi}dispose(){Et(this._previews.values()),this._previews.clear()}getPreview(e){return this._previews.get(e.uri)}get ariaMessage(){const e=this.children.length;return e===1?p("aria.fileReferences.1","1 symbol in {0}, full path {1}",qo(this.uri),this.uri.fsPath):p("aria.fileReferences.N","{0} symbols in {1}, full path {2}",e,qo(this.uri),this.uri.fsPath)}async resolve(e){if(this._previews.size!==0)return this;for(const t of this.children)if(!this._previews.has(t.uri))try{const i=await e.createModelReference(t.uri);this._previews.set(t.uri,new zhe(i))}catch(i){Ge(i)}return this}}class Us{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new W,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;e.sort(Us._compareReferences);let n;for(const s of e)if((!n||!Yt.isEqual(n.uri,s.uri,!0))&&(n=new H0(this,s.uri),this.groups.push(n)),n.children.length===0||Us._compareReferences(s,n.children[n.children.length-1])!==0){const r=new Zc(i===s,n,s,a=>this._onDidChangeReferenceRange.fire(a));this.references.push(r),n.children.push(r)}}dispose(){Et(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new Us(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?p("aria.result.0","No results found"):this.references.length===1?p("aria.result.1","Found 1 symbol in {0}",this.references[0].uri.fsPath):this.groups.length===1?p("aria.result.n1","Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):p("aria.result.nm","Found {0} symbols in {1} files",this.references.length,this.groups.length)}nextOrPreviousReference(e,t){const{parent:i}=e;let n=i.children.indexOf(e);const s=i.children.length,r=i.parent.groups.length;return r===1||t&&n+1<s||!t&&n>0?(t?n=(n+1)%s:n=(n+s-1)%s,i.children[n]):(n=i.parent.groups.indexOf(i),t?(n=(n+1)%r,i.parent.groups[n].children[0]):(n=(n+r-1)%r,i.parent.groups[n].children[i.parent.groups[n].children.length-1]))}nearestReference(e,t){const i=this.references.map((n,s)=>({idx:s,prefixLen:bu(n.uri.toString(),e.toString()),offsetDist:Math.abs(n.range.startLineNumber-t.lineNumber)*100+Math.abs(n.range.startColumn-t.column)})).sort((n,s)=>n.prefixLen>s.prefixLen?-1:n.prefixLen<s.prefixLen?1:n.offsetDist<s.offsetDist?-1:n.offsetDist>s.offsetDist?1:0)[0];if(i)return this.references[i.idx]}referenceAt(e,t){for(const i of this.references)if(i.uri.toString()===e.toString()&&k.containsPosition(i.range,t))return i}firstReference(){for(const e of this.references)if(e.isProviderFirst)return e;return this.references[0]}static _compareReferences(e,t){return Yt.compare(e.uri,t.uri)||k.compareRangesUsingStarts(e.range,t.range)}}var Py=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Oy=function(o,e){return function(t,i){e(t,i,o)}},hN;let uN=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof Us||e instanceof H0}getChildren(e){if(e instanceof Us)return e.groups;if(e instanceof H0)return e.resolve(this._resolverService).then(t=>t.children);throw new Error("bad tree")}};uN=Py([Oy(0,ks)],uN);class Uhe{getHeight(){return 23}getTemplateId(e){return e instanceof H0?z0.id:$v.id}}let gN=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){var t;if(e instanceof Zc){const i=(t=e.parent.getPreview(e))===null||t===void 0?void 0:t.preview(e.range);if(i)return i.value}return qo(e.uri)}};gN=Py([Oy(0,Pt)],gN);class $he{getId(e){return e instanceof Zc?e.id:e.uri}}let fN=class extends K{constructor(e,t){super(),this._labelService=t;const i=document.createElement("div");i.classList.add("reference-file"),this.file=this._register(new Lw(i,{supportHighlights:!0})),this.badge=new gE(ie(i,pe(".count")),{},nB),e.appendChild(i)}set(e,t){const i=QS(e.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri),this._labelService.getUriLabel(i,{relative:!0}),{title:this._labelService.getUriLabel(e.uri),matches:t});const n=e.children.length;this.badge.setCount(n),n>1?this.badge.setTitleFormat(p("referencesCount","{0} references",n)):this.badge.setTitleFormat(p("referenceCount","{0} reference",n))}};fN=Py([Oy(1,ap)],fN);let z0=hN=class{constructor(e){this._instantiationService=e,this.templateId=hN.id}renderTemplate(e){return this._instantiationService.createInstance(fN,e)}renderElement(e,t,i){i.set(e.element,ry(e.filterData))}disposeTemplate(e){e.dispose()}};z0.id="FileReferencesRenderer";z0=hN=Py([Oy(0,Oe)],z0);class Khe{constructor(e){this.label=new Cc(e)}set(e,t){var i;const n=(i=e.parent.getPreview(e))===null||i===void 0?void 0:i.preview(e.range);if(!n||!n.value)this.label.set(`${qo(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`);else{const{value:s,highlight:r}=n;t&&!Xr.isDefault(t)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(s,ry(t))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(s,[r]))}}}class $v{constructor(){this.templateId=$v.id}renderTemplate(e){return new Khe(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(){}}$v.id="OneReferenceRenderer";class jhe{getWidgetAriaLabel(){return p("treeAriaLabel","References")}getAriaLabel(e){return e.ariaMessage}}var qhe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Tl=function(o,e){return function(t,i){e(t,i,o)}};class Fy{constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new se,this._callOnModelChange=new se,this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();const e=this._editor.getModel();if(e){for(const t of this._model.references)if(t.uri.toString()===e.uri.toString()){this._addDecorations(t.parent);return}}}_addDecorations(e){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(()=>this._onDecorationChanged()));const t=[],i=[];for(let n=0,s=e.children.length;n<s;n++){const r=e.children[n];this._decorationIgnoreSet.has(r.id)||r.uri.toString()===this._editor.getModel().uri.toString()&&(t.push({range:r.range,options:Fy.DecorationOptions}),i.push(n))}this._editor.changeDecorations(n=>{const s=n.deltaDecorations([],t);for(let r=0;r<s.length;r++)this._decorations.set(s[r],e.children[i[r]])})}_onDecorationChanged(){const e=[],t=this._editor.getModel();if(t){for(const[i,n]of this._decorations){const s=t.getDecorationRange(i);if(!s)continue;let r=!1;if(!k.equalsRange(s,n.range)){if(k.spansMultipleLines(s))r=!0;else{const a=n.range.endColumn-n.range.startColumn,l=s.endColumn-s.startColumn;a!==l&&(r=!0)}r?(this._decorationIgnoreSet.add(n.id),e.push(i)):n.range=s}}for(let i=0,n=e.length;i<n;i++)this._decorations.delete(e[i]);this._editor.removeDecorations(e)}}removeDecorations(){this._editor.removeDecorations([...this._decorations.keys()]),this._decorations.clear()}}Fy.DecorationOptions=Ze.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});class Ghe{constructor(){this.ratio=.7,this.heightInLines=18}static fromJSON(e){let t,i;try{const n=JSON.parse(e);t=n.ratio,i=n.heightInLines}catch{}return{ratio:t||.7,heightInLines:i||18}}}class Zhe extends cE{}let pN=class extends Hw{constructor(e,t,i,n,s,r,a,l,d,c,h,u){super(e,{showFrame:!1,showArrow:!0,isResizeable:!0,isAccessible:!0,supportOnTitleClick:!0},r),this._defaultTreeKeyboardSupport=t,this.layoutData=i,this._textModelResolverService=s,this._instantiationService=r,this._peekViewService=a,this._uriLabel=l,this._undoRedoService=d,this._keybindingService=c,this._languageService=h,this._languageConfigurationService=u,this._disposeOnNewModel=new se,this._callOnDispose=new se,this._onDidSelectReference=new W,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new bt(0,0),this._applyTheme(n.getColorTheme()),this._callOnDispose.add(n.onDidColorThemeChange(this._applyTheme.bind(this))),this._peekViewService.addExclusiveWidget(e,this),this.create()}dispose(){this.setModel(void 0),this._callOnDispose.dispose(),this._disposeOnNewModel.dispose(),Et(this._preview),Et(this._previewNotAvailableMessage),Et(this._tree),Et(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){const t=e.getColor(Vhe)||q.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(Whe)||q.transparent,primaryHeadingColor:e.getColor(Y6),secondaryHeadingColor:e.getColor(X6)})}show(e){super.show(e,this.layoutData.heightInLines||18)}focusOnReferenceTree(){this._tree.domFocus()}focusOnPreviewEditor(){this._preview.focus()}isPreviewEditorFocused(){return this._preview.hasTextFocus()}_onTitleClick(e){this._preview&&this._preview.getModel()&&this._onDidSelectReference.fire({element:this._getFocusedReference(),kind:e.ctrlKey||e.metaKey||e.altKey?"side":"open",source:"title"})}_fillBody(e){this.setCssClass("reference-zone-widget"),this._messageContainer=ie(e,pe("div.messages")),is(this._messageContainer),this._splitView=new aB(e,{orientation:1}),this._previewContainer=ie(e,pe("div.preview.inline"));const t={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!0},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._preview=this._instantiationService.createInstance(Gc,this._previewContainer,t,{},this.editor),is(this._previewContainer),this._previewNotAvailableMessage=new gl(p("missingPreviewMessage","no preview available"),So,gl.DEFAULT_CREATION_OPTIONS,null,this._undoRedoService,this._languageService,this._languageConfigurationService),this._treeContainer=ie(e,pe("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new jhe,keyboardNavigationLabelProvider:this._instantiationService.createInstance(gN),identityProvider:new $he,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:Hhe}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(vi(this._treeContainer,"keydown",s=>{s.equals(9)&&(this._keybindingService.dispatchEvent(s,s.target),s.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(Zhe,"ReferencesWidget",this._treeContainer,new Uhe,[this._instantiationService.createInstance(z0),this._instantiationService.createInstance($v)],this._instantiationService.createInstance(uN),i),this._splitView.addView({onDidChange:fe.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:s=>{this._preview.layout({height:this._dim.height,width:s})}},_w.Distribute),this._splitView.addView({onDidChange:fe.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:s=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${s}px`,this._tree.layout(this._dim.height,s)}},_w.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)},void 0));const n=(s,r)=>{s instanceof Zc&&(r==="show"&&this._revealReference(s,!1),this._onDidSelectReference.fire({element:s,kind:r,source:"tree"}))};this._tree.onDidOpen(s=>{s.sideBySide?n(s.element,"side"):s.editorOptions.pinned?n(s.element,"goto"):n(s.element,"show")}),is(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new bt(t,e),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(t),this._splitView.resizeView(0,t*this.layoutData.ratio)}setSelection(e){return this._revealReference(e,!0).then(()=>{this._model&&(this._tree.setSelection([e]),this._tree.setFocus([e]))})}setModel(e){return this._disposeOnNewModel.clear(),this._model=e,this._model?this._onNewModel():Promise.resolve()}_onNewModel(){return this._model?this._model.isEmpty?(this.setTitle(""),this._messageContainer.innerText=p("noResults","No results"),Os(this._messageContainer),Promise.resolve(void 0)):(is(this._messageContainer),this._decorationsManager=new Fy(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange(e=>this._tree.rerender(e))),this._disposeOnNewModel.add(this._preview.onMouseDown(e=>{const{event:t,target:i}=e;if(t.detail!==2)return;const n=this._getFocusedReference();n&&this._onDidSelectReference.fire({element:{uri:n.uri,range:i.range},kind:t.ctrlKey||t.metaKey||t.altKey?"side":"open",source:"editor"})})),this.container.classList.add("results-loaded"),Os(this._treeContainer),Os(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(this._model.groups.length===1?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){const[e]=this._tree.getFocus();if(e instanceof Zc)return e;if(e instanceof H0&&e.children.length>0)return e.children[0]}async revealReference(e){await this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:"goto",source:"tree"})}async _revealReference(e,t){if(this._revealedReference===e)return;this._revealedReference=e,e.uri.scheme!==Ye.inMemory?this.setTitle(AQ(e.uri),this._uriLabel.getUriLabel(QS(e.uri))):this.setTitle(p("peekView.alternateTitle","References"));const i=this._textModelResolverService.createModelReference(e.uri);this._tree.getInput()===e.parent?this._tree.reveal(e):(t&&this._tree.reveal(e.parent),await this._tree.expand(e.parent),this._tree.reveal(e));const n=await i;if(!this._model){n.dispose();return}Et(this._previewModelReference);const s=n.object;if(s){const r=this._preview.getModel()===s.textEditorModel?0:1,a=k.lift(e.range).collapseToStart();this._previewModelReference=n,this._preview.setModel(s.textEditorModel),this._preview.setSelection(a),this._preview.revealRangeInCenter(a,r)}else this._preview.setModel(this._previewNotAvailableMessage),n.dispose()}};pN=qhe([Tl(3,tn),Tl(4,ks),Tl(5,Oe),Tl(6,Z6),Tl(7,ap),Tl(8,JS),Tl(9,Pt),Tl(10,ni),Tl(11,Wt)],pN);var Yhe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kg=function(o,e){return function(t,i){e(t,i,o)}},QC;const dg=new be("referenceSearchVisible",!1,p("referenceSearchVisible","Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let Cp=QC=class{static get(e){return e.getContribution(QC.ID)}constructor(e,t,i,n,s,r,a,l){this._defaultTreeKeyboardSupport=e,this._editor=t,this._editorService=n,this._notificationService=s,this._instantiationService=r,this._storageService=a,this._configurationService=l,this._disposables=new se,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=dg.bindTo(i)}dispose(){var e,t;this._referenceSearchVisible.reset(),this._disposables.dispose(),(e=this._widget)===null||e===void 0||e.dispose(),(t=this._model)===null||t===void 0||t.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(e,t,i){let n;if(this._widget&&(n=this._widget.position),this.closeWidget(),n&&e.containsPosition(n))return;this._peekMode=i,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>{this.closeWidget()})),this._disposables.add(this._editor.onDidChangeModel(()=>{this._ignoreModelChangeEvent||this.closeWidget()}));const s="peekViewLayout",r=Ghe.fromJSON(this._storageService.get(s,0,"{}"));this._widget=this._instantiationService.createInstance(pN,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(p("labelLoading","Loading...")),this._widget.show(e),this._disposables.add(this._widget.onDidClose(()=>{t.cancel(),this._widget&&(this._storageService.store(s,JSON.stringify(this._widget.layoutData),0,1),this._widget=void 0),this.closeWidget()})),this._disposables.add(this._widget.onDidSelectReference(l=>{const{element:d,kind:c}=l;if(d)switch(c){case"open":(l.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))&&this.openReference(d,!1,!1);break;case"side":this.openReference(d,!0,!1);break;case"goto":i?this._gotoReference(d,!0):this.openReference(d,!1,!0);break}}));const a=++this._requestIdPool;t.then(l=>{var d;if(a!==this._requestIdPool||!this._widget){l.dispose();return}return(d=this._model)===null||d===void 0||d.dispose(),this._model=l,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(p("metaTitle.N","{0} ({1})",this._model.title,this._model.references.length));const c=this._editor.getModel().uri,h=new V(e.startLineNumber,e.startColumn),u=this._model.nearestReference(c,h);if(u)return this._widget.setSelection(u).then(()=>{this._widget&&this._editor.getOption(86)==="editor"&&this._widget.focusOnPreviewEditor()})}})},l=>{this._notificationService.error(l)})}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(e){if(!this._editor.hasModel()||!this._model||!this._widget)return;const t=this._widget.position;if(!t)return;const i=this._model.nearestReference(this._editor.getModel().uri,t);if(!i)return;const n=this._model.nextOrPreviousReference(i,e),s=this._editor.hasTextFocus(),r=this._widget.isPreviewEditorFocused();await this._widget.setSelection(n),await this._gotoReference(n,!1),s?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}async revealReference(e){!this._editor.hasModel()||!this._model||!this._widget||await this._widget.revealReference(e)}closeWidget(e=!0){var t,i;(t=this._widget)===null||t===void 0||t.dispose(),(i=this._model)===null||i===void 0||i.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,e&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(e,t){var i;(i=this._widget)===null||i===void 0||i.hide(),this._ignoreModelChangeEvent=!0;const n=k.lift(e.range).collapseToStart();return this._editorService.openCodeEditor({resource:e.uri,options:{selection:n,selectionSource:"code.jump",pinned:t}},this._editor).then(s=>{var r;if(this._ignoreModelChangeEvent=!1,!s||!this._widget){this.closeWidget();return}if(this._editor===s)this._widget.show(n),this._widget.focusOnReferenceTree();else{const a=QC.get(s),l=this._model.clone();this.closeWidget(),s.focus(),a?.toggleWidget(n,Zi(d=>Promise.resolve(l)),(r=this._peekMode)!==null&&r!==void 0?r:!1)}},s=>{this._ignoreModelChangeEvent=!1,Ge(s)})}openReference(e,t,i){t||this.closeWidget();const{uri:n,range:s}=e;this._editorService.openCodeEditor({resource:n,options:{selection:s,selectionSource:"code.jump",pinned:i}},this._editor,t)}};Cp.ID="editor.contrib.referencesController";Cp=QC=Yhe([kg(2,We),kg(3,Dt),kg(4,Vi),kg(5,Oe),kg(6,da),kg(7,ft)],Cp);function cg(o,e){const t=Fhe(o);if(!t)return;const i=Cp.get(t);i&&e(i)}Ls.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:qi(2089,60),when:te.or(dg,xs.inPeekEditor),handler(o){cg(o,e=>{e.changeFocusBetweenPreviewAndReferences()})}});Ls.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:te.or(dg,xs.inPeekEditor),handler(o){cg(o,e=>{e.goToNextOrPreviousReference(!0)})}});Ls.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:te.or(dg,xs.inPeekEditor),handler(o){cg(o,e=>{e.goToNextOrPreviousReference(!1)})}});gt.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");gt.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");gt.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");gt.registerCommand("closeReferenceSearch",o=>cg(o,e=>e.closeWidget()));Ls.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:te.and(xs.inPeekEditor,te.not("config.editor.stablePeek"))});Ls.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:te.and(dg,te.not("config.editor.stablePeek"))});Ls.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:te.and(dg,SB,KM.negate(),jM.negate()),handler(o){var e;const i=(e=o.get(Qo).lastFocusedList)===null||e===void 0?void 0:e.getFocus();Array.isArray(i)&&i[0]instanceof Zc&&cg(o,n=>n.revealReference(i[0]))}});Ls.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:te.and(dg,SB,KM.negate(),jM.negate()),handler(o){var e;const i=(e=o.get(Qo).lastFocusedList)===null||e===void 0?void 0:e.getFocus();Array.isArray(i)&&i[0]instanceof Zc&&cg(o,n=>n.openReference(i[0],!0,!0))}});gt.registerCommand("openReference",o=>{var e;const i=(e=o.get(Qo).lastFocusedList)===null||e===void 0?void 0:e.getFocus();Array.isArray(i)&&i[0]instanceof Zc&&cg(o,n=>n.openReference(i[0],!1,!0))});var Q6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Gm=function(o,e){return function(t,i){e(t,i,o)}};const wR=new be("hasSymbols",!1,p("hasSymbols","Whether there are symbol locations that can be navigated via keyboard-only.")),By=ot("ISymbolNavigationService");let mN=class{constructor(e,t,i,n){this._editorService=t,this._notificationService=i,this._keybindingService=n,this._currentModel=void 0,this._currentIdx=-1,this._ignoreEditorChange=!1,this._ctxHasSymbols=wR.bindTo(e)}reset(){var e,t;this._ctxHasSymbols.reset(),(e=this._currentState)===null||e===void 0||e.dispose(),(t=this._currentMessage)===null||t===void 0||t.dispose(),this._currentModel=void 0,this._currentIdx=-1}put(e){const t=e.parent.parent;if(t.references.length<=1){this.reset();return}this._currentModel=t,this._currentIdx=t.references.indexOf(e),this._ctxHasSymbols.set(!0),this._showMessage();const i=new _N(this._editorService),n=i.onDidChange(s=>{if(this._ignoreEditorChange)return;const r=this._editorService.getActiveCodeEditor();if(!r)return;const a=r.getModel(),l=r.getPosition();if(!a||!l)return;let d=!1,c=!1;for(const h of t.references)if(J2(h.uri,a.uri))d=!0,c=c||k.containsPosition(h.range,l);else if(d)break;(!d||!c)&&this.reset()});this._currentState=fr(i,n)}revealNext(e){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;const t=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:t.uri,options:{selection:k.collapseToStart(t.range),selectionRevealType:3}},e).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){var e;(e=this._currentMessage)===null||e===void 0||e.dispose();const t=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),i=t?p("location.kb","Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,t.getLabel()):p("location","Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(i)}};mN=Q6([Gm(0,We),Gm(1,Dt),Gm(2,Vi),Gm(3,Pt)],mN);ct(By,mN,1);ue(new class extends cn{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:wR,kbOpts:{weight:100,primary:70}})}runEditorCommand(o,e){return o.get(By).revealNext(e)}});Ls.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:wR,primary:9,handler(o){o.get(By).reset()}});let _N=class{constructor(e){this._listener=new Map,this._disposables=new se,this._onDidChange=new W,this.onDidChange=this._onDidChange.event,this._disposables.add(e.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(e.onCodeEditorAdd(this._onDidAddEditor,this)),e.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),Et(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,fr(e.onDidChangeCursorPosition(t=>this._onDidChange.fire({editor:e})),e.onDidChangeModelContent(t=>this._onDidChange.fire({editor:e}))))}_onDidRemoveEditor(e){var t;(t=this._listener.get(e))===null||t===void 0||t.dispose(),this._listener.delete(e)}};_N=Q6([Gm(0,Dt)],_N);async function Kv(o,e,t,i){const s=t.ordered(o).map(a=>Promise.resolve(i(a,o,e)).then(void 0,l=>{Mi(l)})),r=await Promise.all(s);return Qr(r.flat())}function Wy(o,e,t,i){return Kv(e,t,o,(n,s,r)=>n.provideDefinition(s,r,i))}function J6(o,e,t,i){return Kv(e,t,o,(n,s,r)=>n.provideDeclaration(s,r,i))}function eW(o,e,t,i){return Kv(e,t,o,(n,s,r)=>n.provideImplementation(s,r,i))}function tW(o,e,t,i){return Kv(e,t,o,(n,s,r)=>n.provideTypeDefinition(s,r,i))}function Vy(o,e,t,i,n){return Kv(e,t,o,async(s,r,a)=>{const l=await s.provideReferences(r,a,{includeDeclaration:!0},n);if(!i||!l||l.length!==2)return l;const d=await s.provideReferences(r,a,{includeDeclaration:!1},n);return d&&d.length===1?d:l})}async function jv(o){const e=await o(),t=new Us(e,""),i=t.references.map(n=>n.link);return t.dispose(),i}Cl("_executeDefinitionProvider",(o,e,t)=>{const i=o.get(Se),n=Wy(i.definitionProvider,e,t,st.None);return jv(()=>n)});Cl("_executeTypeDefinitionProvider",(o,e,t)=>{const i=o.get(Se),n=tW(i.typeDefinitionProvider,e,t,st.None);return jv(()=>n)});Cl("_executeDeclarationProvider",(o,e,t)=>{const i=o.get(Se),n=J6(i.declarationProvider,e,t,st.None);return jv(()=>n)});Cl("_executeReferenceProvider",(o,e,t)=>{const i=o.get(Se),n=Vy(i.referenceProvider,e,t,!1,st.None);return jv(()=>n)});Cl("_executeImplementationProvider",(o,e,t)=>{const i=o.get(Se),n=eW(i.implementationProvider,e,t,st.None);return jv(()=>n)});var ym,Lm,xm,Gb,Zb,Yb,Xb,Qb;vn.appendMenuItem(N.EditorContext,{submenu:N.EditorContextPeek,title:p("peek.submenu","Peek"),group:"navigation",order:100});class wp{static is(e){return!e||typeof e!="object"?!1:!!(e instanceof wp||V.isIPosition(e.position)&&e.model)}constructor(e,t){this.model=e,this.position=t}}class Yn extends aa{static all(){return Yn._allSymbolNavigationCommands.values()}static _patchConfig(e){const t={...e,f1:!0};if(t.menu)for(const i of rt.wrap(t.menu))(i.id===N.EditorContext||i.id===N.EditorContextPeek)&&(i.when=te.and(e.precondition,i.when));return t}constructor(e,t){super(Yn._patchConfig(t)),this.configuration=e,Yn._allSymbolNavigationCommands.set(t.id,this)}runEditorCommand(e,t,i,n){if(!t.hasModel())return Promise.resolve(void 0);const s=e.get(Vi),r=e.get(Dt),a=e.get(lh),l=e.get(By),d=e.get(Se),c=e.get(Oe),h=t.getModel(),u=t.getPosition(),g=wp.is(i)?i:new wp(h,u),f=new Uc(t,5),m=DS(this._getLocationModel(d,g.model,g.position,f.token),f.token).then(async _=>{var v;if(!_||f.token.isCancellationRequested)return;js(_.ariaMessage);let b;if(_.referenceAt(h.uri,u)){const w=this._getAlternativeCommand(t);!Yn._activeAlternativeCommands.has(w)&&Yn._allSymbolNavigationCommands.has(w)&&(b=Yn._allSymbolNavigationCommands.get(w))}const C=_.references.length;if(C===0){if(!this.configuration.muteMessage){const w=h.getWordAtPosition(u);(v=zs.get(t))===null||v===void 0||v.showMessage(this._getNoResultFoundMessage(w),u)}}else if(C===1&&b)Yn._activeAlternativeCommands.add(this.desc.id),c.invokeFunction(w=>b.runEditorCommand(w,t,i,n).finally(()=>{Yn._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(r,l,t,_,n)},_=>{s.error(_)}).finally(()=>{f.dispose()});return a.showWhile(m,250),m}async _onResult(e,t,i,n,s){const r=this._getGoToPreference(i);if(!(i instanceof Gc)&&(this.configuration.openInPeek||r==="peek"&&n.references.length>1))this._openInPeek(i,n,s);else{const a=n.firstReference(),l=n.references.length>1&&r==="gotoAndPeek",d=await this._openReference(i,e,a,this.configuration.openToSide,!l);l&&d?this._openInPeek(d,n,s):n.dispose(),r==="goto"&&t.put(a)}}async _openReference(e,t,i,n,s){let r;if(Xz(i)&&(r=i.targetSelectionRange),r||(r=i.range),!r)return;const a=await t.openCodeEditor({resource:i.uri,options:{selection:k.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},e,n);if(a){if(s){const l=a.getModel(),d=a.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===l&&d.clear()},350)}return a}}_openInPeek(e,t,i){const n=Cp.get(e);n&&e.hasModel()?n.toggleWidget(i??e.getSelection(),Zi(s=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}}Yn._allSymbolNavigationCommands=new Map;Yn._activeAlternativeCommands=new Set;class qv extends Yn{async _getLocationModel(e,t,i,n){return new Us(await Wy(e.definitionProvider,t,i,n),p("def.title","Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?p("noResultWord","No definition found for '{0}'",e.word):p("generic.noResults","No definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleDefinitions}}Xt((ym=class extends qv{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:ym.id,title:{value:p("actions.goToDecl.label","Go to Definition"),original:"Go to Definition",mnemonicTitle:p({},"Go to &&Definition")},precondition:te.and(M.hasDefinitionProvider,M.isInWalkThroughSnippet.toNegated()),keybinding:[{when:M.editorTextFocus,primary:70,weight:100},{when:te.and(M.editorTextFocus,bB),primary:2118,weight:100}],menu:[{id:N.EditorContext,group:"navigation",order:1.1},{id:N.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),gt.registerCommandAlias("editor.action.goToDeclaration",ym.id)}},ym.id="editor.action.revealDefinition",ym));Xt((Lm=class extends qv{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:Lm.id,title:{value:p("actions.goToDeclToSide.label","Open Definition to the Side"),original:"Open Definition to the Side"},precondition:te.and(M.hasDefinitionProvider,M.isInWalkThroughSnippet.toNegated()),keybinding:[{when:M.editorTextFocus,primary:qi(2089,70),weight:100},{when:te.and(M.editorTextFocus,bB),primary:qi(2089,2118),weight:100}]}),gt.registerCommandAlias("editor.action.openDeclarationToTheSide",Lm.id)}},Lm.id="editor.action.revealDefinitionAside",Lm));Xt((xm=class extends qv{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:xm.id,title:{value:p("actions.previewDecl.label","Peek Definition"),original:"Peek Definition"},precondition:te.and(M.hasDefinitionProvider,xs.notInPeekEditor,M.isInWalkThroughSnippet.toNegated()),keybinding:{when:M.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:N.EditorContextPeek,group:"peek",order:2}}),gt.registerCommandAlias("editor.action.previewDeclaration",xm.id)}},xm.id="editor.action.peekDefinition",xm));class iW extends Yn{async _getLocationModel(e,t,i,n){return new Us(await J6(e.declarationProvider,t,i,n),p("decl.title","Declarations"))}_getNoResultFoundMessage(e){return e&&e.word?p("decl.noResultWord","No declaration found for '{0}'",e.word):p("decl.generic.noResults","No declaration found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDeclarationCommand}_getGoToPreference(e){return e.getOption(58).multipleDeclarations}}Xt((Gb=class extends iW{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Gb.id,title:{value:p("actions.goToDeclaration.label","Go to Declaration"),original:"Go to Declaration",mnemonicTitle:p({},"Go to &&Declaration")},precondition:te.and(M.hasDeclarationProvider,M.isInWalkThroughSnippet.toNegated()),menu:[{id:N.EditorContext,group:"navigation",order:1.3},{id:N.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(e){return e&&e.word?p("decl.noResultWord","No declaration found for '{0}'",e.word):p("decl.generic.noResults","No declaration found")}},Gb.id="editor.action.revealDeclaration",Gb));Xt(class extends iW{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:{value:p("actions.peekDecl.label","Peek Declaration"),original:"Peek Declaration"},precondition:te.and(M.hasDeclarationProvider,xs.notInPeekEditor,M.isInWalkThroughSnippet.toNegated()),menu:{id:N.EditorContextPeek,group:"peek",order:3}})}});class nW extends Yn{async _getLocationModel(e,t,i,n){return new Us(await tW(e.typeDefinitionProvider,t,i,n),p("typedef.title","Type Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?p("goToTypeDefinition.noResultWord","No type definition found for '{0}'",e.word):p("goToTypeDefinition.generic.noResults","No type definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeTypeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleTypeDefinitions}}Xt((Zb=class extends nW{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Zb.ID,title:{value:p("actions.goToTypeDefinition.label","Go to Type Definition"),original:"Go to Type Definition",mnemonicTitle:p({},"Go to &&Type Definition")},precondition:te.and(M.hasTypeDefinitionProvider,M.isInWalkThroughSnippet.toNegated()),keybinding:{when:M.editorTextFocus,primary:0,weight:100},menu:[{id:N.EditorContext,group:"navigation",order:1.4},{id:N.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}},Zb.ID="editor.action.goToTypeDefinition",Zb));Xt((Yb=class extends nW{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Yb.ID,title:{value:p("actions.peekTypeDefinition.label","Peek Type Definition"),original:"Peek Type Definition"},precondition:te.and(M.hasTypeDefinitionProvider,xs.notInPeekEditor,M.isInWalkThroughSnippet.toNegated()),menu:{id:N.EditorContextPeek,group:"peek",order:4}})}},Yb.ID="editor.action.peekTypeDefinition",Yb));class sW extends Yn{async _getLocationModel(e,t,i,n){return new Us(await eW(e.implementationProvider,t,i,n),p("impl.title","Implementations"))}_getNoResultFoundMessage(e){return e&&e.word?p("goToImplementation.noResultWord","No implementation found for '{0}'",e.word):p("goToImplementation.generic.noResults","No implementation found")}_getAlternativeCommand(e){return e.getOption(58).alternativeImplementationCommand}_getGoToPreference(e){return e.getOption(58).multipleImplementations}}Xt((Xb=class extends sW{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Xb.ID,title:{value:p("actions.goToImplementation.label","Go to Implementations"),original:"Go to Implementations",mnemonicTitle:p({},"Go to &&Implementations")},precondition:te.and(M.hasImplementationProvider,M.isInWalkThroughSnippet.toNegated()),keybinding:{when:M.editorTextFocus,primary:2118,weight:100},menu:[{id:N.EditorContext,group:"navigation",order:1.45},{id:N.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}},Xb.ID="editor.action.goToImplementation",Xb));Xt((Qb=class extends sW{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Qb.ID,title:{value:p("actions.peekImplementation.label","Peek Implementations"),original:"Peek Implementations"},precondition:te.and(M.hasImplementationProvider,xs.notInPeekEditor,M.isInWalkThroughSnippet.toNegated()),keybinding:{when:M.editorTextFocus,primary:3142,weight:100},menu:{id:N.EditorContextPeek,group:"peek",order:5}})}},Qb.ID="editor.action.peekImplementation",Qb));class oW extends Yn{_getNoResultFoundMessage(e){return e?p("references.no","No references found for '{0}'",e.word):p("references.noGeneric","No references found")}_getAlternativeCommand(e){return e.getOption(58).alternativeReferenceCommand}_getGoToPreference(e){return e.getOption(58).multipleReferences}}Xt(class extends oW{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{value:p("goToReferences.label","Go to References"),original:"Go to References",mnemonicTitle:p({},"Go to &&References")},precondition:te.and(M.hasReferenceProvider,xs.notInPeekEditor,M.isInWalkThroughSnippet.toNegated()),keybinding:{when:M.editorTextFocus,primary:1094,weight:100},menu:[{id:N.EditorContext,group:"navigation",order:1.45},{id:N.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(e,t,i,n){return new Us(await Vy(e.referenceProvider,t,i,!0,n),p("ref.title","References"))}});Xt(class extends oW{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:{value:p("references.action.label","Peek References"),original:"Peek References"},precondition:te.and(M.hasReferenceProvider,xs.notInPeekEditor,M.isInWalkThroughSnippet.toNegated()),menu:{id:N.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(e,t,i,n){return new Us(await Vy(e.referenceProvider,t,i,!1,n),p("ref.title","References"))}});class Xhe extends Yn{constructor(e,t,i){super(e,{id:"editor.action.goToLocation",title:{value:p("label.generic","Go to Any Symbol"),original:"Go to Any Symbol"},precondition:te.and(xs.notInPeekEditor,M.isInWalkThroughSnippet.toNegated())}),this._references=t,this._gotoMultipleBehaviour=i}async _getLocationModel(e,t,i,n){return new Us(this._references,p("generic.title","Locations"))}_getNoResultFoundMessage(e){return e&&p("generic.noResult","No results for '{0}'",e.word)||""}_getGoToPreference(e){var t;return(t=this._gotoMultipleBehaviour)!==null&&t!==void 0?t:e.getOption(58).multipleReferences}_getAlternativeCommand(){return""}}gt.registerCommand({id:"editor.action.goToLocations",metadata:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:Me},{name:"position",description:"The position at which to start",constraint:V.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto"},{name:"noResultsMessage",description:"Human readable message that shows when locations is empty."}]},handler:async(o,e,t,i,n,s,r)=>{Tt(Me.isUri(e)),Tt(V.isIPosition(t)),Tt(Array.isArray(i)),Tt(typeof n>"u"||typeof n=="string"),Tt(typeof r>"u"||typeof r=="boolean");const a=o.get(Dt),l=await a.openCodeEditor({resource:e},a.getFocusedCodeEditor());if($c(l))return l.setPosition(t),l.revealPositionInCenterIfOutsideViewport(t,0),l.invokeWithinContext(d=>{const c=new class extends Xhe{_getNoResultFoundMessage(h){return s||super._getNoResultFoundMessage(h)}}({muteMessage:!s,openInPeek:!!r,openToSide:!1},i,n);d.get(Oe).invokeFunction(c.run.bind(c),l)})}});gt.registerCommand({id:"editor.action.peekLocations",metadata:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:Me},{name:"position",description:"The position at which to start",constraint:V.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto"}]},handler:async(o,e,t,i,n)=>{o.get(ui).executeCommand("editor.action.goToLocations",e,t,i,n,void 0,!0)}});gt.registerCommand({id:"editor.action.findReferences",handler:(o,e,t)=>{Tt(Me.isUri(e)),Tt(V.isIPosition(t));const i=o.get(Se),n=o.get(Dt);return n.openCodeEditor({resource:e},n.getFocusedCodeEditor()).then(s=>{if(!$c(s)||!s.hasModel())return;const r=Cp.get(s);if(!r)return;const a=Zi(d=>Vy(i.referenceProvider,s.getModel(),V.lift(t),!1,d).then(c=>new Us(c,p("ref.title","References")))),l=new k(t.lineNumber,t.column,t.lineNumber,t.column);return Promise.resolve(r.toggleWidget(l,a,!1))})}});gt.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");var Qhe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},lD=function(o,e){return function(t,i){e(t,i,o)}},Zm;let Hu=Zm=class{constructor(e,t,i,n){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=n,this.toUnhook=new se,this.toUnhookForKeyboard=new se,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();const s=new Ry(e);this.toUnhook.add(s),this.toUnhook.add(s.onMouseMoveOrRelevantKeyDown(([r,a])=>{this.startFindDefinitionFromMouse(r,a??void 0)})),this.toUnhook.add(s.onExecute(r=>{this.isEnabled(r)&&this.gotoDefinition(r.target.position,r.hasSideBySideModifier).catch(a=>{Ge(a)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(s.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(e){return e.getContribution(Zm.ID)}async startFindDefinitionFromCursor(e){await this.startFindDefinition(e),this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition(()=>{this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()})),this.toUnhookForKeyboard.add(this.editor.onKeyDown(t=>{t&&(this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear())}))}startFindDefinitionFromMouse(e,t){if(e.target.type===9&&this.linkDecorations.length>0)return;if(!this.editor.hasModel()||!this.isEnabled(e,t)){this.currentWordAtPosition=null,this.removeLinkDecorations();return}const i=e.target.position;this.startFindDefinition(i)}async startFindDefinition(e){var t;this.toUnhookForKeyboard.clear();const i=e?(t=this.editor.getModel())===null||t===void 0?void 0:t.getWordAtPosition(e):null;if(!i){this.currentWordAtPosition=null,this.removeLinkDecorations();return}if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===i.startColumn&&this.currentWordAtPosition.endColumn===i.endColumn&&this.currentWordAtPosition.word===i.word)return;this.currentWordAtPosition=i;const n=new r6(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=Zi(a=>this.findDefinition(e,a));let s;try{s=await this.previousPromise}catch(a){Ge(a);return}if(!s||!s.length||!n.validate(this.editor)){this.removeLinkDecorations();return}const r=s[0].originSelectionRange?k.lift(s[0].originSelectionRange):new k(e.lineNumber,i.startColumn,e.lineNumber,i.endColumn);if(s.length>1){let a=r;for(const{originSelectionRange:l}of s)l&&(a=k.plusRange(a,l));this.addDecoration(a,new Fn().appendText(p("multipleResults","Click to show {0} definitions.",s.length)))}else{const a=s[0];if(!a.uri)return;this.textModelResolverService.createModelReference(a.uri).then(l=>{if(!l.object||!l.object.textEditorModel){l.dispose();return}const{object:{textEditorModel:d}}=l,{startLineNumber:c}=a.range;if(c<1||c>d.getLineCount()){l.dispose();return}const h=this.getPreviewValue(d,c,a),u=this.languageService.guessLanguageIdByFilepathOrFirstLine(d.uri);this.addDecoration(r,h?new Fn().appendCodeblock(u||"",h):void 0),l.dispose()})}}getPreviewValue(e,t,i){let n=i.range;return n.endLineNumber-n.startLineNumber>=Zm.MAX_SOURCE_PREVIEW_LINES&&(n=this.getPreviewRangeBasedOnIndentation(e,t)),this.stripIndentationFromPreviewRange(e,t,n)}stripIndentationFromPreviewRange(e,t,i){let s=e.getLineFirstNonWhitespaceColumn(t);for(let a=t+1;a<i.endLineNumber;a++){const l=e.getLineFirstNonWhitespaceColumn(a);s=Math.min(s,l)}return e.getValueInRange(i).replace(new RegExp(`^\\s{${s-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(e,t){const i=e.getLineFirstNonWhitespaceColumn(t),n=Math.min(e.getLineCount(),t+Zm.MAX_SOURCE_PREVIEW_LINES);let s=t+1;for(;s<n;s++){const r=e.getLineFirstNonWhitespaceColumn(s);if(i===r)break}return new k(t,1,s+1,1)}addDecoration(e,t){const i={range:e,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:t}};this.linkDecorations.set([i])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(e,t){var i;return this.editor.hasModel()&&e.isLeftClick&&e.isNoneOrSingleMouseDown&&e.target.type===6&&!(((i=e.target.detail.injectedText)===null||i===void 0?void 0:i.options)instanceof Hc)&&(e.hasTriggerModifier||(t?t.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(e,t){const i=this.editor.getModel();return i?Wy(this.languageFeaturesService.definitionProvider,i,e,t):Promise.resolve(null)}gotoDefinition(e,t){return this.editor.setPosition(e),this.editor.invokeWithinContext(i=>{const n=!t&&this.editor.getOption(87)&&!this.isInPeekEditor(i);return new qv({openToSide:t,openInPeek:n,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(i)})}isInPeekEditor(e){const t=e.get(We);return xs.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};Hu.ID="editor.contrib.gotodefinitionatposition";Hu.MAX_SOURCE_PREVIEW_LINES=8;Hu=Zm=Qhe([lD(1,ks),lD(2,ni),lD(3,Se)],Hu);yt(Hu.ID,Hu,2);const Jb=pe;class rW extends K{constructor(){super(),this.containerDomNode=document.createElement("div"),this.containerDomNode.className="monaco-hover",this.containerDomNode.tabIndex=0,this.containerDomNode.setAttribute("role","tooltip"),this.contentsDomNode=document.createElement("div"),this.contentsDomNode.className="monaco-hover-content",this.scrollbar=this._register(new Cv(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}}class SR extends K{static render(e,t,i){return new SR(e,t,i)}constructor(e,t,i){super(),this.actionContainer=ie(e,Jb("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=ie(this.actionContainer,Jb("a.action")),this.action.setAttribute("role","button"),t.iconClass&&ie(this.action,Jb(`span.icon.${t.iconClass}`));const n=ie(this.action,Jb("span"));n.textContent=i?`${t.label} (${i})`:t.label,this._register(Q(this.actionContainer,ge.CLICK,s=>{s.stopPropagation(),s.preventDefault(),t.run(this.actionContainer)})),this._register(Q(this.actionContainer,ge.KEY_DOWN,s=>{const r=new Gt(s);(r.equals(3)||r.equals(10))&&(s.stopPropagation(),s.preventDefault(),t.run(this.actionContainer))})),this.setEnabled(!0)}setEnabled(e){e?(this.actionContainer.classList.remove("disabled"),this.actionContainer.removeAttribute("aria-disabled")):(this.actionContainer.classList.add("disabled"),this.actionContainer.setAttribute("aria-disabled","true"))}}function Jhe(o,e){return o&&e?p("acessibleViewHint","Inspect this in the accessible view with {0}.",e):o?p("acessibleViewHintNoKbOpen","Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding."):""}let eue=class{constructor(e,t,i){this.value=e,this.isComplete=t,this.hasLoadingMessage=i}};class aW extends K{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new W),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new Rt(()=>this._triggerAsyncComputation(),0)),this._secondWaitScheduler=this._register(new Rt(()=>this._triggerSyncComputation(),0)),this._loadingMessageScheduler=this._register(new Rt(()=>this._triggerLoadingMessage(),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),super.dispose()}get _hoverTime(){return this._editor.getOption(60).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(e,t=!0){this._state=e,t&&this._fireResult()}_triggerAsyncComputation(){this._setState(2),this._secondWaitScheduler.schedule(this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=o$(e=>this._computer.computeAsync(e)),(async()=>{try{for await(const e of this._asyncIterable)e&&(this._result.push(e),this._fireResult());this._asyncIterableDone=!0,(this._state===3||this._state===4)&&this._setState(0)}catch(e){Ge(e)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync())),this._setState(this._asyncIterableDone?0:3)}_triggerLoadingMessage(){this._state===3&&this._setState(4)}_fireResult(){if(this._state===1||this._state===2)return;const e=this._state===0,t=this._state===4;this._onResult.fire(new eue(this._result.slice(0),e,t))}start(e){if(e===0)this._state===0&&(this._setState(1),this._firstWaitScheduler.schedule(this._firstWaitTime),this._loadingMessageScheduler.schedule(this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(),this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break;case 2:this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break}}cancel(){this._firstWaitScheduler.cancel(),this._secondWaitScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._result=[],this._setState(0,!1)}}class dD{constructor(e,t,i,n){this.priority=e,this.range=t,this.initialMousePosX=i,this.initialMousePosY=n,this.type=1}equals(e){return e.type===1&&this.range.equalsRange(e.range)}canAdoptVisibleHover(e,t){return e.type===1&&t.lineNumber===this.range.startLineNumber}}class JC{constructor(e,t,i,n,s,r){this.priority=e,this.owner=t,this.range=i,this.initialMousePosX=n,this.initialMousePosY=s,this.supportsMarkerHover=r,this.type=2}equals(e){return e.type===2&&this.owner===e.owner}canAdoptVisibleHover(e,t){return e.type===2&&this.owner===e.owner}}const hg=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}};class yR{constructor(){this._onDidWillResize=new W,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new W,this.onDidResize=this._onDidResize.event,this._sashListener=new se,this._size=new bt(0,0),this._minSize=new bt(0,0),this._maxSize=new bt(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new An(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new An(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new An(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:pw.North}),this._southSash=new An(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:pw.South}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let e,t=0,i=0;this._sashListener.add(fe.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)(()=>{e===void 0&&(this._onDidWillResize.fire(),e=this._size,t=0,i=0)})),this._sashListener.add(fe.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)(()=>{e!==void 0&&(e=void 0,t=0,i=0,this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(this._eastSash.onDidChange(n=>{e&&(i=n.currentX-n.startX,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))})),this._sashListener.add(this._westSash.onDidChange(n=>{e&&(i=-(n.currentX-n.startX),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))})),this._sashListener.add(this._northSash.onDidChange(n=>{e&&(t=-(n.currentY-n.startY),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))})),this._sashListener.add(this._southSash.onDidChange(n=>{e&&(t=n.currentY-n.startY,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))})),this._sashListener.add(fe.any(this._eastSash.onDidReset,this._westSash.onDidReset)(n=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(fe.any(this._northSash.onDidReset,this._southSash.onDidReset)(n=>{this._preferredSize&&(this.layout(this._preferredSize.height,this._size.width),this._onDidResize.fire({dimension:this._size,done:!0}))}))}dispose(){this._northSash.dispose(),this._southSash.dispose(),this._eastSash.dispose(),this._westSash.dispose(),this._sashListener.dispose(),this._onDidResize.dispose(),this._onDidWillResize.dispose(),this.domNode.remove()}enableSashes(e,t,i,n){this._northSash.state=e?3:0,this._eastSash.state=t?3:0,this._southSash.state=i?3:0,this._westSash.state=n?3:0}layout(e=this.size.height,t=this.size.width){const{height:i,width:n}=this._minSize,{height:s,width:r}=this._maxSize;e=Math.max(i,Math.min(s,e)),t=Math.max(n,Math.min(r,t));const a=new bt(t,e);bt.equals(a,this._size)||(this.domNode.style.height=e+"px",this.domNode.style.width=t+"px",this._size=a,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(e){this._maxSize=e}get maxSize(){return this._maxSize}set minSize(e){this._minSize=e}get minSize(){return this._minSize}set preferredSize(e){this._preferredSize=e}get preferredSize(){return this._preferredSize}}const tue=30,iue=24;class nue extends K{constructor(e,t=new bt(10,10)){super(),this._editor=e,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new yR),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=bt.lift(t),this._resizableNode.layout(t.height,t.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize(i=>{this._resize(new bt(i.dimension.width,i.dimension.height)),i.done&&(this._isResizing=!1)})),this._register(this._resizableNode.onDidWillResize(()=>{this._isResizing=!0}))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){var e;return!((e=this._contentPosition)===null||e===void 0)&&e.position?V.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);return!t||!i?void 0:ji(t).top+i.top-tue}_availableVerticalSpaceBelow(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);if(!t||!i)return;const n=ji(t),s=Lu(t.ownerDocument.body),r=n.top+i.top+i.height;return s.height-r-iue}_findPositionPreference(e,t){var i,n;const s=Math.min((i=this._availableVerticalSpaceBelow(t))!==null&&i!==void 0?i:1/0,e),r=Math.min((n=this._availableVerticalSpaceAbove(t))!==null&&n!==void 0?n:1/0,e),a=Math.min(Math.max(r,s),e),l=Math.min(e,a);let d;return this._editor.getOption(60).above?d=l<=r?1:2:d=l<=s?2:1,d===1?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),d}_resize(e){this._resizableNode.layout(e.height,e.width)}}var LR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ru=function(o,e){return function(t,i){e(t,i,o)}},e1,Ca;const n5=pe;let zw=e1=class extends K{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._currentResult=null,this._widget=this._register(this._instantiationService.createInstance(yc,this._editor)),this._participants=[];for(const n of hg.getAll())this._participants.push(this._instantiationService.createInstance(n,this._editor));this._participants.sort((n,s)=>n.hoverOrdinal-s.hoverOrdinal),this._computer=new $w(this._editor,this._participants),this._hoverOperation=this._register(new aW(this._editor,this._computer)),this._register(this._hoverOperation.onResult(n=>{if(!this._computer.anchor)return;const s=n.hasLoadingMessage?this._addLoadingMessage(n.value):n.value;this._withResult(new lW(this._computer.anchor,s,n.isComplete))})),this._register(vi(this._widget.getDomNode(),"keydown",n=>{n.equals(9)&&this.hide()})),this._register(Ti.onDidChange(()=>{this._widget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)}))}get widget(){return this._widget}maybeShowAt(e){if(this._widget.isResizing)return!0;const t=[];for(const n of this._participants)if(n.suggestHoverAnchor){const s=n.suggestHoverAnchor(e);s&&t.push(s)}const i=e.target;if(i.type===6&&t.push(new dD(0,i.range,e.event.posx,e.event.posy)),i.type===7){const n=this._editor.getOption(50).typicalHalfwidthCharacterWidth/2;!i.detail.isAfterLines&&typeof i.detail.horizontalDistanceToText=="number"&&i.detail.horizontalDistanceToText<n&&t.push(new dD(0,i.range,e.event.posx,e.event.posy))}return t.length===0?this._startShowingOrUpdateHover(null,0,0,!1,e):(t.sort((n,s)=>s.priority-n.priority),this._startShowingOrUpdateHover(t[0],0,0,!1,e))}startShowingAtRange(e,t,i,n){this._startShowingOrUpdateHover(new dD(0,e,void 0,void 0),t,i,n,null)}_startShowingOrUpdateHover(e,t,i,n,s){return!this._widget.position||!this._currentResult?e?(this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):!1:this._editor.getOption(60).sticky&&s&&this._widget.isMouseGettingCloser(s.event.posx,s.event.posy)?(e&&this._startHoverOperationIfNecessary(e,t,i,n,!0),!0):e?e&&this._currentResult.anchor.equals(e)?!0:e.canAdoptVisibleHover(this._currentResult.anchor,this._widget.position)?(this._setCurrentResult(this._currentResult.filter(e)),this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):(this._setCurrentResult(null),!1)}_startHoverOperationIfNecessary(e,t,i,n,s){this._computer.anchor&&this._computer.anchor.equals(e)||(this._hoverOperation.cancel(),this._computer.anchor=e,this._computer.shouldFocus=n,this._computer.source=i,this._computer.insistOnKeepingHoverVisible=s,this._hoverOperation.start(t))}_setCurrentResult(e){this._currentResult!==e&&(e&&e.messages.length===0&&(e=null),this._currentResult=e,this._currentResult?this._renderMessages(this._currentResult.anchor,this._currentResult.messages):this._widget.hide())}hide(){this._computer.anchor=null,this._hoverOperation.cancel(),this._setCurrentResult(null)}get isColorPickerVisible(){return this._widget.isColorPickerVisible}get isVisibleFromKeyboard(){return this._widget.isVisibleFromKeyboard}get isVisible(){return this._widget.isVisible}get isFocused(){return this._widget.isFocused}get isResizing(){return this._widget.isResizing}containsNode(e){return e?this._widget.getDomNode().contains(e):!1}_addLoadingMessage(e){if(this._computer.anchor){for(const t of this._participants)if(t.createLoadingMessage){const i=t.createLoadingMessage(this._computer.anchor);if(i)return e.slice(0).concat([i])}}return e}_withResult(e){this._widget.position&&this._currentResult&&this._currentResult.isComplete&&(!e.isComplete||this._computer.insistOnKeepingHoverVisible&&e.messages.length===0)||this._setCurrentResult(e)}_renderMessages(e,t){const{showAtPosition:i,showAtSecondaryPosition:n,highlightRange:s}=e1.computeHoverRanges(this._editor,e.range,t),r=new se,a=r.add(new Uw(this._keybindingService)),l=document.createDocumentFragment();let d=null;const c={fragment:l,statusBar:a,setColorPicker:u=>d=u,onContentsChanged:()=>this._widget.onContentsChanged(),setMinimumDimensions:u=>this._widget.setMinimumDimensions(u),hide:()=>this.hide()};for(const u of this._participants){const g=t.filter(f=>f.owner===u);g.length>0&&r.add(u.renderHoverParts(c,g))}const h=t.some(u=>u.isBeforeContent);if(a.hasContent&&l.appendChild(a.hoverElement),l.hasChildNodes()){if(s){const u=this._editor.createDecorationsCollection();u.set([{range:s,options:e1._DECORATION_OPTIONS}]),r.add(Ae(()=>{u.clear()}))}this._widget.showAt(l,new oue(d,i,n,this._editor.getOption(60).above,this._computer.shouldFocus,this._computer.source,h,e.initialMousePosX,e.initialMousePosY,r))}else r.dispose()}static computeHoverRanges(e,t,i){let n=1;if(e.hasModel()){const d=e._getViewModel(),c=d.coordinatesConverter,h=c.convertModelRangeToViewRange(t),u=new V(h.startLineNumber,d.getLineMinColumn(h.startLineNumber));n=c.convertViewPositionToModelPosition(u).column}const s=t.startLineNumber;let r=t.startColumn,a=i[0].range,l=null;for(const d of i)a=k.plusRange(a,d.range),d.range.startLineNumber===s&&d.range.endLineNumber===s&&(r=Math.max(Math.min(r,d.range.startColumn),n)),d.forceShowAtRange&&(l=d.range);return{showAtPosition:l?l.getStartPosition():new V(s,t.startColumn),showAtSecondaryPosition:l?l.getStartPosition():new V(s,r),highlightRange:a}}focus(){this._widget.focus()}scrollUp(){this._widget.scrollUp()}scrollDown(){this._widget.scrollDown()}scrollLeft(){this._widget.scrollLeft()}scrollRight(){this._widget.scrollRight()}pageUp(){this._widget.pageUp()}pageDown(){this._widget.pageDown()}goToTop(){this._widget.goToTop()}goToBottom(){this._widget.goToBottom()}};zw._DECORATION_OPTIONS=Ze.register({description:"content-hover-highlight",className:"hoverHighlight"});zw=e1=LR([ru(1,Oe),ru(2,Pt)],zw);class lW{constructor(e,t,i){this.anchor=e,this.messages=t,this.isComplete=i}filter(e){const t=this.messages.filter(i=>i.isValidForHoverAnchor(e));return t.length===this.messages.length?this:new sue(this,this.anchor,t,this.isComplete)}}class sue extends lW{constructor(e,t,i,n){super(t,i,n),this.original=e}filter(e){return this.original.filter(e)}}class oue{constructor(e,t,i,n,s,r,a,l,d,c){this.colorPicker=e,this.showAtPosition=t,this.showAtSecondaryPosition=i,this.preferAbove=n,this.stoleFocus=s,this.source=r,this.isBeforeContent=a,this.initialMousePosX=l,this.initialMousePosY=d,this.disposables=c,this.closestMouseDistance=void 0}}const s5=30,cD=10,rue=6;let yc=Ca=class extends nue{get isColorPickerVisible(){var e;return!!(!((e=this._visibleData)===null||e===void 0)&&e.colorPicker)}get isVisibleFromKeyboard(){var e;return((e=this._visibleData)===null||e===void 0?void 0:e.source)===1}get isVisible(){var e;return(e=this._hoverVisibleKey.get())!==null&&e!==void 0?e:!1}get isFocused(){var e;return(e=this._hoverFocusedKey.get())!==null&&e!==void 0?e:!1}constructor(e,t,i,n,s){const r=e.getOption(66)+8,a=150,l=new bt(a,r);super(e,l),this._configurationService=i,this._accessibilityService=n,this._keybindingService=s,this._hover=this._register(new rW),this._minimumSize=l,this._hoverVisibleKey=M.hoverVisible.bindTo(t),this._hoverFocusedKey=M.hoverFocused.bindTo(t),ie(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._register(this._editor.onDidLayoutChange(()=>{this.isVisible&&this._updateMaxDimensions()})),this._register(this._editor.onDidChangeConfiguration(c=>{c.hasChanged(50)&&this._updateFont()}));const d=this._register(dl(this._resizableNode.domNode));this._register(d.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(d.onDidBlur(()=>{this._hoverFocusedKey.set(!1)})),this._setHoverData(void 0),this._editor.addContentWidget(this)}dispose(){var e;super.dispose(),(e=this._visibleData)===null||e===void 0||e.disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return Ca.ID}static _applyDimensions(e,t,i){const n=typeof t=="number"?`${t}px`:t,s=typeof i=="number"?`${i}px`:i;e.style.width=n,e.style.height=s}_setContentsDomNodeDimensions(e,t){const i=this._hover.contentsDomNode;return Ca._applyDimensions(i,e,t)}_setContainerDomNodeDimensions(e,t){const i=this._hover.containerDomNode;return Ca._applyDimensions(i,e,t)}_setHoverWidgetDimensions(e,t){this._setContentsDomNodeDimensions(e,t),this._setContainerDomNodeDimensions(e,t),this._layoutContentWidget()}static _applyMaxDimensions(e,t,i){const n=typeof t=="number"?`${t}px`:t,s=typeof i=="number"?`${i}px`:i;e.style.maxWidth=n,e.style.maxHeight=s}_setHoverWidgetMaxDimensions(e,t){Ca._applyMaxDimensions(this._hover.contentsDomNode,e,t),Ca._applyMaxDimensions(this._hover.containerDomNode,e,t),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth",typeof e=="number"?`${e}px`:e),this._layoutContentWidget()}_hasHorizontalScrollbar(){const e=this._hover.scrollbar.getScrollDimensions();return e.scrollWidth>e.width}_adjustContentsBottomPadding(){const e=this._hover.contentsDomNode,t=`${this._hover.scrollbar.options.horizontalScrollbarSize}px`;e.style.paddingBottom!==t&&(e.style.paddingBottom=t)}_setAdjustedHoverWidgetDimensions(e){this._setHoverWidgetMaxDimensions("none","none");const t=e.width,i=e.height;this._setHoverWidgetDimensions(t,i),this._hasHorizontalScrollbar()&&(this._adjustContentsBottomPadding(),this._setContentsDomNodeDimensions(t,i-cD))}_updateResizableNodeMaxDimensions(){var e,t;const i=(e=this._findMaximumRenderingWidth())!==null&&e!==void 0?e:1/0,n=(t=this._findMaximumRenderingHeight())!==null&&t!==void 0?t:1/0;this._resizableNode.maxSize=new bt(i,n),this._setHoverWidgetMaxDimensions(i,n)}_resize(e){var t,i;Ca._lastDimensions=new bt(e.width,e.height),this._setAdjustedHoverWidgetDimensions(e),this._resizableNode.layout(e.height,e.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),(i=(t=this._visibleData)===null||t===void 0?void 0:t.colorPicker)===null||i===void 0||i.layout()}_findAvailableSpaceVertically(){var e;const t=(e=this._visibleData)===null||e===void 0?void 0:e.showAtPosition;if(t)return this._positionPreference===1?this._availableVerticalSpaceAbove(t):this._availableVerticalSpaceBelow(t)}_findMaximumRenderingHeight(){const e=this._findAvailableSpaceVertically();if(!e)return;let t=rue;return Array.from(this._hover.contentsDomNode.children).forEach(i=>{t+=i.clientHeight}),this._hasHorizontalScrollbar()&&(t+=cD),Math.min(e,t)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");const e=Array.from(this._hover.contentsDomNode.children).some(t=>t.scrollWidth>t.clientWidth);return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),e}_findMaximumRenderingWidth(){if(!this._editor||!this._editor.hasModel())return;const e=this._isHoverTextOverflowing(),t=typeof this._contentWidth>"u"?0:this._contentWidth-2;return e||this._hover.containerDomNode.clientWidth<t?Lu(this._hover.containerDomNode.ownerDocument.body).width-14:this._hover.containerDomNode.clientWidth+2}isMouseGettingCloser(e,t){if(!this._visibleData)return!1;if(typeof this._visibleData.initialMousePosX>"u"||typeof this._visibleData.initialMousePosY>"u")return this._visibleData.initialMousePosX=e,this._visibleData.initialMousePosY=t,!1;const i=ji(this.getDomNode());typeof this._visibleData.closestMouseDistance>"u"&&(this._visibleData.closestMouseDistance=o5(this._visibleData.initialMousePosX,this._visibleData.initialMousePosY,i.left,i.top,i.width,i.height));const n=o5(e,t,i.left,i.top,i.width,i.height);return n>this._visibleData.closestMouseDistance+4?!1:(this._visibleData.closestMouseDistance=Math.min(this._visibleData.closestMouseDistance,n),!0)}_setHoverData(e){var t;(t=this._visibleData)===null||t===void 0||t.disposables.dispose(),this._visibleData=e,this._hoverVisibleKey.set(!!e),this._hover.containerDomNode.classList.toggle("hidden",!e)}_updateFont(){const{fontSize:e,lineHeight:t}=this._editor.getOption(50),i=this._hover.contentsDomNode;i.style.fontSize=`${e}px`,i.style.lineHeight=`${t/e}`,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(s=>this._editor.applyFontInfo(s))}_updateContent(e){const t=this._hover.contentsDomNode;t.style.paddingBottom="",t.textContent="",t.appendChild(e)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){const e=Math.max(this._editor.getLayoutInfo().height/4,250,Ca._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,500,Ca._lastDimensions.width);this._setHoverWidgetMaxDimensions(t,e)}_render(e,t){this._setHoverData(t),this._updateFont(),this._updateContent(e),this._updateMaxDimensions(),this.onContentsChanged(),this._editor.render()}getPosition(){var e;return this._visibleData?{position:this._visibleData.showAtPosition,secondaryPosition:this._visibleData.showAtSecondaryPosition,positionAffinity:this._visibleData.isBeforeContent?3:void 0,preference:[(e=this._positionPreference)!==null&&e!==void 0?e:1]}:null}showAt(e,t){var i,n,s,r;if(!this._editor||!this._editor.hasModel())return;this._render(e,t);const a=Xh(this._hover.containerDomNode),l=t.showAtPosition;this._positionPreference=(i=this._findPositionPreference(a,l))!==null&&i!==void 0?i:1,this.onContentsChanged(),t.stoleFocus&&this._hover.containerDomNode.focus(),(n=t.colorPicker)===null||n===void 0||n.layout();const c=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&Jhe(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),(r=(s=this._keybindingService.lookupKeybinding("editor.action.accessibleView"))===null||s===void 0?void 0:s.getAriaLabel())!==null&&r!==void 0?r:"");c&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+c)}hide(){if(!this._visibleData)return;const e=this._visibleData.stoleFocus||this._hoverFocusedKey.get();this._setHoverData(void 0),this._resizableNode.maxSize=new bt(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),e&&this._editor.focus()}_removeConstraintsRenderNormally(){const e=this._editor.getLayoutInfo();this._resizableNode.layout(e.height,e.width),this._setHoverWidgetDimensions("auto","auto")}_adjustHoverHeightForScrollbar(e){var t;const i=this._hover.containerDomNode,n=this._hover.contentsDomNode,s=(t=this._findMaximumRenderingHeight())!==null&&t!==void 0?t:1/0;this._setContainerDomNodeDimensions(vs(i),Math.min(s,e)),this._setContentsDomNodeDimensions(vs(n),Math.min(s,e-cD))}setMinimumDimensions(e){this._minimumSize=new bt(Math.max(this._minimumSize.width,e.width),Math.max(this._minimumSize.height,e.height)),this._updateMinimumWidth()}_updateMinimumWidth(){const e=typeof this._contentWidth>"u"?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new bt(e,this._minimumSize.height)}onContentsChanged(){var e;this._removeConstraintsRenderNormally();const t=this._hover.containerDomNode;let i=Xh(t),n=vs(t);if(this._resizableNode.layout(i,n),this._setHoverWidgetDimensions(n,i),i=Xh(t),n=vs(t),this._contentWidth=n,this._updateMinimumWidth(),this._resizableNode.layout(i,n),this._hasHorizontalScrollbar()&&(this._adjustContentsBottomPadding(),this._adjustHoverHeightForScrollbar(i)),!((e=this._visibleData)===null||e===void 0)&&e.showAtPosition){const s=Xh(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(s,this._visibleData.showAtPosition)}this._layoutContentWidget()}focus(){this._hover.containerDomNode.focus()}scrollUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:e-t.lineHeight})}scrollDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:e+t.lineHeight})}scrollLeft(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e-s5})}scrollRight(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+s5})}pageUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e-t})}pageDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e+t})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}};yc.ID="editor.contrib.resizableContentHoverWidget";yc._lastDimensions=new bt(0,0);yc=Ca=LR([ru(1,We),ru(2,ft),ru(3,Sl),ru(4,Pt)],yc);let Uw=class extends K{get hasContent(){return this._hasContent}constructor(e){super(),this._keybindingService=e,this._hasContent=!1,this.hoverElement=n5("div.hover-row.status-bar"),this.actionsElement=ie(this.hoverElement,n5("div.actions"))}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;return this._hasContent=!0,this._register(SR.render(this.actionsElement,e,i))}append(e){const t=ie(this.actionsElement,e);return this._hasContent=!0,t}};Uw=LR([ru(0,Pt)],Uw);class $w{get anchor(){return this._anchor}set anchor(e){this._anchor=e}get shouldFocus(){return this._shouldFocus}set shouldFocus(e){this._shouldFocus=e}get source(){return this._source}set source(e){this._source=e}get insistOnKeepingHoverVisible(){return this._insistOnKeepingHoverVisible}set insistOnKeepingHoverVisible(e){this._insistOnKeepingHoverVisible=e}constructor(e,t){this._editor=e,this._participants=t,this._anchor=null,this._shouldFocus=!1,this._source=0,this._insistOnKeepingHoverVisible=!1}static _getLineDecorations(e,t){if(t.type!==1&&!t.supportsMarkerHover)return[];const i=e.getModel(),n=t.range.startLineNumber;if(n>i.getLineCount())return[];const s=i.getLineMaxColumn(n);return e.getLineDecorations(n).filter(r=>{if(r.options.isWholeLine)return!0;const a=r.range.startLineNumber===n?r.range.startColumn:1,l=r.range.endLineNumber===n?r.range.endColumn:s;if(r.options.showIfCollapsed){if(a>t.range.startColumn+1||t.range.endColumn-1>l)return!1}else if(a>t.range.startColumn||t.range.endColumn>l)return!1;return!0})}computeAsync(e){const t=this._anchor;if(!this._editor.hasModel()||!t)return Fi.EMPTY;const i=$w._getLineDecorations(this._editor,t);return Fi.merge(this._participants.map(n=>n.computeAsync?n.computeAsync(t,i,e):Fi.EMPTY))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const e=$w._getLineDecorations(this._editor,this._anchor);let t=[];for(const i of this._participants)t=t.concat(i.computeSync(this._anchor,e));return Qr(t)}}function o5(o,e,t,i,n,s){const r=t+n/2,a=i+s/2,l=Math.max(Math.abs(o-r)-n/2,0),d=Math.max(Math.abs(e-a)-s/2,0);return Math.sqrt(l*l+d*d)}const r5=pe;class Vf extends K{constructor(e,t,i){super(),this._renderDisposeables=this._register(new se),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new rW),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new pd({editor:this._editor},t,i)),this._computer=new aue(this._editor),this._hoverOperation=this._register(new aW(this._editor,this._computer)),this._register(this._hoverOperation.onResult(n=>{this._withResult(n.value)})),this._register(this._editor.onDidChangeModelDecorations(()=>this._onModelDecorationsChanged())),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(50)&&this._updateFont()})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return Vf.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(t=>this._editor.applyFontInfo(t))}_onModelDecorationsChanged(){this._isVisible&&(this._hoverOperation.cancel(),this._hoverOperation.start(0))}startShowingAt(e){this._computer.lineNumber!==e&&(this._hoverOperation.cancel(),this.hide(),this._computer.lineNumber=e,this._hoverOperation.start(0))}hide(){this._computer.lineNumber=-1,this._hoverOperation.cancel(),this._isVisible&&(this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible))}_withResult(e){this._messages=e,this._messages.length>0?this._renderMessages(this._computer.lineNumber,this._messages):this.hide()}_renderMessages(e,t){this._renderDisposeables.clear();const i=document.createDocumentFragment();for(const n of t){const s=r5("div.hover-row.markdown-hover"),r=ie(s,r5("div.hover-contents")),a=this._renderDisposeables.add(this._markdownRenderer.render(n.value));r.appendChild(a.element),i.appendChild(s)}this._updateContents(i),this._showAt(e)}_updateContents(e){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(e),this._updateFont()}_showAt(e){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));const t=this._editor.getLayoutInfo(),i=this._editor.getTopForLineNumber(e),n=this._editor.getScrollTop(),s=this._editor.getOption(66),r=this._hover.containerDomNode.clientHeight,a=i-n-(r-s)/2;this._hover.containerDomNode.style.left=`${t.glyphMarginLeft+t.glyphMarginWidth}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(a),0)}px`}}Vf.ID="editor.contrib.modesGlyphHoverWidget";class aue{get lineNumber(){return this._lineNumber}set lineNumber(e){this._lineNumber=e}constructor(e){this._editor=e,this._lineNumber=-1}computeSync(){const e=n=>({value:n}),t=this._editor.getLineDecorations(this._lineNumber),i=[];if(!t)return i;for(const n of t){if(!n.options.glyphMarginClassName)continue;const s=n.options.glyphMarginHoverMessage;!s||hp(s)||i.push(...BT(s).map(e))}return i}}class lue{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}async function due(o,e,t,i,n){try{const s=await Promise.resolve(o.provideHover(t,i,n));if(s&&hue(s))return new lue(o,s,e)}catch(s){Mi(s)}}function xR(o,e,t,i){const s=o.ordered(e).map((r,a)=>due(r,a,e,t,i));return Fi.fromPromises(s).coalesce()}function cue(o,e,t,i){return xR(o,e,t,i).map(n=>n.hover).toPromise()}Cl("_executeHoverProvider",(o,e,t)=>{const i=o.get(Se);return cue(i.hoverProvider,e,t,st.None)});function hue(o){const e=typeof o.range<"u",t=typeof o.contents<"u"&&o.contents&&o.contents.length>0;return e&&t}var uue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},eC=function(o,e){return function(t,i){e(t,i,o)}};const a5=pe;class Kr{constructor(e,t,i,n,s){this.owner=e,this.range=t,this.contents=i,this.isBeforeContent=n,this.ordinal=s}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let Kw=class{constructor(e,t,i,n,s){this._editor=e,this._languageService=t,this._openerService=i,this._configurationService=n,this._languageFeaturesService=s,this.hoverOrdinal=3}createLoadingMessage(e){return new Kr(this,e.range,[new Fn().appendText(p("modesContentHover.loading","Loading..."))],!1,2e3)}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),n=e.range.startLineNumber,s=i.getLineMaxColumn(n),r=[];let a=1e3;const l=i.getLineLength(n),d=i.getLanguageIdAtPosition(e.range.startLineNumber,e.range.startColumn),c=this._editor.getOption(116),h=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:d});let u=!1;c>=0&&l>c&&e.range.startColumn>=c&&(u=!0,r.push(new Kr(this,e.range,[{value:p("stopped rendering","Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,a++))),!u&&typeof h=="number"&&l>=h&&r.push(new Kr(this,e.range,[{value:p("too many characters","Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,a++));let g=!1;for(const f of t){const m=f.range.startLineNumber===n?f.range.startColumn:1,_=f.range.endLineNumber===n?f.range.endColumn:s,v=f.options.hoverMessage;if(!v||hp(v))continue;f.options.beforeContentClassName&&(g=!0);const b=new k(e.range.startLineNumber,m,e.range.startLineNumber,_);r.push(new Kr(this,b,BT(v),g,a++))}return r}computeAsync(e,t,i){if(!this._editor.hasModel()||e.type!==1)return Fi.EMPTY;const n=this._editor.getModel();if(!this._languageFeaturesService.hoverProvider.has(n))return Fi.EMPTY;const s=new V(e.range.startLineNumber,e.range.startColumn);return xR(this._languageFeaturesService.hoverProvider,n,s,i).filter(r=>!hp(r.hover.contents)).map(r=>{const a=r.hover.range?k.lift(r.hover.range):e.range;return new Kr(this,a,r.hover.contents,!1,r.ordinal)})}renderHoverParts(e,t){return dW(e,t,this._editor,this._languageService,this._openerService)}};Kw=uue([eC(1,ni),eC(2,Qs),eC(3,ft),eC(4,Se)],Kw);function dW(o,e,t,i,n){e.sort((r,a)=>r.ordinal-a.ordinal);const s=new se;for(const r of e)for(const a of r.contents){if(hp(a))continue;const l=a5("div.hover-row.markdown-hover"),d=ie(l,a5("div.hover-contents")),c=s.add(new pd({editor:t},i,n));s.add(c.onDidRenderAsync(()=>{d.className="hover-contents code-hover-contents",o.onContentsChanged()}));const h=s.add(c.render(a));d.appendChild(h.element),o.fragment.appendChild(l)}return s}var cW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jw=function(o,e){return function(t,i){e(t,i,o)}};class l5{constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let vN=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new W,this.onDidChange=this._onDidChange.event,this._dispoables=new se,this._markers=[],this._nextIdx=-1,Me.isUri(e)?this._resourceFilter=a=>a.toString()===e.toString():e&&(this._resourceFilter=e);const n=this._configService.getValue("problems.sortOrder"),s=(a,l)=>{let d=V_(a.resource.toString(),l.resource.toString());return d===0&&(n==="position"?d=k.compareRangesUsingStarts(a,l)||ci.compare(a.severity,l.severity):d=ci.compare(a.severity,l.severity)||k.compareRangesUsingStarts(a,l)),d},r=()=>{this._markers=this._markerService.read({resource:Me.isUri(e)?e:void 0,severities:ci.Error|ci.Warning|ci.Info}),typeof e=="function"&&(this._markers=this._markers.filter(a=>this._resourceFilter(a.resource))),this._markers.sort(s)};r(),this._dispoables.add(t.onMarkerChanged(a=>{(!this._resourceFilter||a.some(l=>this._resourceFilter(l)))&&(r(),this._nextIdx=-1,this._onDidChange.fire())}))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(e){return!this._resourceFilter&&!e?!0:!this._resourceFilter||!e?!1:this._resourceFilter(e)}get selected(){const e=this._markers[this._nextIdx];return e&&new l5(e,this._nextIdx+1,this._markers.length)}_initIdx(e,t,i){let n=!1,s=this._markers.findIndex(r=>r.resource.toString()===e.uri.toString());s<0&&(s=M_(this._markers,{resource:e.uri},(r,a)=>V_(r.resource.toString(),a.resource.toString())),s<0&&(s=~s));for(let r=s;r<this._markers.length;r++){let a=k.lift(this._markers[r]);if(a.isEmpty()){const l=e.getWordAtPosition(a.getStartPosition());l&&(a=new k(a.startLineNumber,l.startColumn,a.startLineNumber,l.endColumn))}if(t&&(a.containsPosition(t)||t.isBeforeOrEqual(a.getStartPosition()))){this._nextIdx=r,n=!0;break}if(this._markers[r].resource.toString()!==e.uri.toString())break}n||(this._nextIdx=i?0:this._markers.length-1),this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(e,t,i){if(this._markers.length===0)return!1;const n=this._nextIdx;return this._nextIdx===-1?this._initIdx(t,i,e):e?this._nextIdx=(this._nextIdx+1)%this._markers.length:e||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),n!==this._nextIdx}find(e,t){let i=this._markers.findIndex(n=>n.resource.toString()===e.toString());if(!(i<0)){for(;i<this._markers.length;i++)if(k.containsPosition(this._markers[i],t))return new l5(this._markers[i],i+1,this._markers.length)}}};vN=cW([jw(1,yl),jw(2,ft)],vN);const hW=ot("IMarkerNavigationService");let bN=class{constructor(e,t){this._markerService=e,this._configService=t,this._provider=new rs}getMarkerList(e){for(const t of this._provider){const i=t.getMarkerList(e);if(i)return i}return new vN(e,this._markerService,this._configService)}};bN=cW([jw(0,yl),jw(1,ft)],bN);ct(hW,bN,1);var CN;(function(o){function e(t){switch(t){case Si.Ignore:return"severity-ignore "+Re.asClassName(he.info);case Si.Info:return Re.asClassName(he.info);case Si.Warning:return Re.asClassName(he.warning);case Si.Error:return Re.asClassName(he.error);default:return""}}o.className=e})(CN||(CN={}));var gue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ig=function(o,e){return function(t,i){e(t,i,o)}},wN;class fue{constructor(e,t,i,n,s){this._openerService=n,this._labelService=s,this._lines=0,this._longestLineLength=0,this._relatedDiagnostics=new WeakMap,this._disposables=new se,this._editor=t;const r=document.createElement("div");r.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),r.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),r.appendChild(this._relatedBlock),this._disposables.add(vi(this._relatedBlock,"click",a=>{a.preventDefault();const l=this._relatedDiagnostics.get(a.target);l&&i(l)})),this._scrollable=new k8(r,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),e.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll(a=>{r.style.left=`-${a.scrollLeft}px`,r.style.top=`-${a.scrollTop}px`})),this._disposables.add(this._scrollable)}dispose(){Et(this._disposables)}update(e){const{source:t,message:i,relatedInformation:n,code:s}=e;let r=(t?.length||0)+2;s&&(typeof s=="string"?r+=s.length:r+=s.value.length);const a=ll(i);this._lines=a.length,this._longestLineLength=0;for(const u of a)this._longestLineLength=Math.max(u.length+r,this._longestLineLength);bn(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(e)),this._editor.applyFontInfo(this._messageBlock);let l=this._messageBlock;for(const u of a)l=document.createElement("div"),l.innerText=u,u===""&&(l.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(l);if(t||s){const u=document.createElement("span");if(u.classList.add("details"),l.appendChild(u),t){const g=document.createElement("span");g.innerText=t,g.classList.add("source"),u.appendChild(g)}if(s)if(typeof s=="string"){const g=document.createElement("span");g.innerText=`(${s})`,g.classList.add("code"),u.appendChild(g)}else{this._codeLink=pe("a.code-link"),this._codeLink.setAttribute("href",`${s.target.toString()}`),this._codeLink.onclick=f=>{this._openerService.open(s.target,{allowCommands:!0}),f.preventDefault(),f.stopPropagation()};const g=ie(this._codeLink,pe("span"));g.innerText=s.value,u.appendChild(this._codeLink)}}if(bn(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),Bn(n)){const u=this._relatedBlock.appendChild(document.createElement("div"));u.style.paddingTop=`${Math.floor(this._editor.getOption(66)*.66)}px`,this._lines+=1;for(const g of n){const f=document.createElement("div"),m=document.createElement("a");m.classList.add("filename"),m.innerText=`${this._labelService.getUriBasenameLabel(g.resource)}(${g.startLineNumber}, ${g.startColumn}): `,m.title=this._labelService.getUriLabel(g.resource),this._relatedDiagnostics.set(m,g);const _=document.createElement("span");_.innerText=g.message,f.appendChild(m),f.appendChild(_),this._lines+=1,u.appendChild(f)}}const d=this._editor.getOption(50),c=Math.ceil(d.typicalFullwidthCharacterWidth*this._longestLineLength*.75),h=d.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:c,scrollHeight:h})}layout(e,t){this._scrollable.getDomNode().style.height=`${e}px`,this._scrollable.getDomNode().style.width=`${t}px`,this._scrollable.setScrollDimensions({width:t,height:e})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(e){let t="";switch(e.severity){case ci.Error:t=p("Error","Error");break;case ci.Warning:t=p("Warning","Warning");break;case ci.Info:t=p("Info","Info");break;case ci.Hint:t=p("Hint","Hint");break}let i=p("marker aria","{0} at {1}. ",t,e.startLineNumber+":"+e.startColumn);const n=this._editor.getModel();return n&&e.startLineNumber<=n.getLineCount()&&e.startLineNumber>=1&&(i=`${n.getLineContent(e.startLineNumber)}, ${i}`),i}}let Sp=wN=class extends Hw{constructor(e,t,i,n,s,r,a){super(e,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},s),this._themeService=t,this._openerService=i,this._menuService=n,this._contextKeyService=r,this._labelService=a,this._callOnDispose=new se,this._onDidSelectRelatedInformation=new W,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=ci.Warning,this._backgroundColor=q.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(vue);let t=SN,i=pue;this._severity===ci.Warning?(t=t1,i=mue):this._severity===ci.Info&&(t=yN,i=_ue);const n=e.getColor(t),s=e.getColor(i);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:s,primaryHeadingColor:e.getColor(Y6),secondaryHeadingColor:e.getColor(X6)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),super.dispose()}_fillHead(e){super._fillHead(e),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun(n=>this.editor.focus()));const t=[],i=this._menuService.createMenu(wN.TitleMenu,this._contextKeyService);NM(i,void 0,t),this._actionbarWidget.push(t,{label:!1,icon:!0,index:0}),i.dispose()}_fillTitleIcon(e){this._icon=ie(e,pe(""))}_fillBody(e){this._parentContainer=e,e.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),e.appendChild(this._container),this._message=new fue(this._container,this.editor,t=>this._onDidSelectRelatedInformation.fire(t),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(e,t,i){this._container.classList.remove("stale"),this._message.update(e),this._severity=e.severity,this._applyTheme(this._themeService.getColorTheme());const n=k.lift(e),s=this.editor.getPosition(),r=s&&n.containsPosition(s)?s:n.getStartPosition();super.show(r,this.computeRequiredHeight());const a=this.editor.getModel();if(a){const l=i>1?p("problems","{0} of {1} problems",t,i):p("change","{0} of {1} problem",t,i);this.setTitle(qo(a.uri),l)}this._icon.className=`codicon ${CN.className(ci.toSeverity(this._severity))}`,this.editor.revealPositionNearTop(r,0),this.editor.focus()}updateMarker(e){this._container.classList.remove("stale"),this._message.update(e)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._heightInPixel=e,this._message.layout(e,t),this._container.style.height=`${e}px`}_onWidth(e){this._message.layout(this._heightInPixel,e)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}};Sp.TitleMenu=new N("gotoErrorTitleMenu");Sp=wN=gue([Ig(1,tn),Ig(2,Qs),Ig(3,ra),Ig(4,Oe),Ig(5,We),Ig(6,ap)],Sp);const d5=s0(Ka,pG),c5=s0(vo,i0),h5=s0(Ss,n0),SN=R("editorMarkerNavigationError.background",{dark:d5,light:d5,hcDark:dt,hcLight:dt},p("editorMarkerNavigationError","Editor marker navigation widget error color.")),pue=R("editorMarkerNavigationError.headerBackground",{dark:Ee(SN,.1),light:Ee(SN,.1),hcDark:null,hcLight:null},p("editorMarkerNavigationErrorHeaderBackground","Editor marker navigation widget error heading background.")),t1=R("editorMarkerNavigationWarning.background",{dark:c5,light:c5,hcDark:dt,hcLight:dt},p("editorMarkerNavigationWarning","Editor marker navigation widget warning color.")),mue=R("editorMarkerNavigationWarning.headerBackground",{dark:Ee(t1,.1),light:Ee(t1,.1),hcDark:"#0C141F",hcLight:Ee(t1,.2)},p("editorMarkerNavigationWarningBackground","Editor marker navigation widget warning heading background.")),yN=R("editorMarkerNavigationInfo.background",{dark:h5,light:h5,hcDark:dt,hcLight:dt},p("editorMarkerNavigationInfo","Editor marker navigation widget info color.")),_ue=R("editorMarkerNavigationInfo.headerBackground",{dark:Ee(yN,.1),light:Ee(yN,.1),hcDark:null,hcLight:null},p("editorMarkerNavigationInfoHeaderBackground","Editor marker navigation widget info heading background.")),vue=R("editorMarkerNavigation.background",{dark:en,light:en,hcDark:en,hcLight:en},p("editorMarkerNavigationBackground","Editor marker navigation widget background."));var bue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},tC=function(o,e){return function(t,i){e(t,i,o)}},Ym;let Yc=Ym=class{static get(e){return e.getContribution(Ym.ID)}constructor(e,t,i,n,s){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=n,this._instantiationService=s,this._sessionDispoables=new se,this._editor=e,this._widgetVisible=uW.bindTo(this._contextKeyService)}dispose(){this._cleanUp(),this._sessionDispoables.dispose()}_cleanUp(){this._widgetVisible.reset(),this._sessionDispoables.clear(),this._widget=void 0,this._model=void 0}_getOrCreateModel(e){if(this._model&&this._model.matches(e))return this._model;let t=!1;return this._model&&(t=!0,this._cleanUp()),this._model=this._markerNavigationService.getMarkerList(e),t&&this._model.move(!0,this._editor.getModel(),this._editor.getPosition()),this._widget=this._instantiationService.createInstance(Sp,this._editor),this._widget.onDidClose(()=>this.close(),this,this._sessionDispoables),this._widgetVisible.set(!0),this._sessionDispoables.add(this._model),this._sessionDispoables.add(this._widget),this._sessionDispoables.add(this._editor.onDidChangeCursorPosition(i=>{var n,s,r;(!(!((n=this._model)===null||n===void 0)&&n.selected)||!k.containsPosition((s=this._model)===null||s===void 0?void 0:s.selected.marker,i.position))&&((r=this._model)===null||r===void 0||r.resetIndex())})),this._sessionDispoables.add(this._model.onDidChange(()=>{if(!this._widget||!this._widget.position||!this._model)return;const i=this._model.find(this._editor.getModel().uri,this._widget.position);i?this._widget.updateMarker(i.marker):this._widget.showStale()})),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation(i=>{this._editorService.openCodeEditor({resource:i.resource,options:{pinned:!0,revealIfOpened:!0,selection:k.lift(i).collapseToStart()}},this._editor),this.close(!1)})),this._sessionDispoables.add(this._editor.onDidChangeModel(()=>this._cleanUp())),this._model}close(e=!0){this._cleanUp(),e&&this._editor.focus()}showAtMarker(e){if(this._editor.hasModel()){const t=this._getOrCreateModel(this._editor.getModel().uri);t.resetIndex(),t.move(!0,this._editor.getModel(),new V(e.startLineNumber,e.startColumn)),t.selected&&this._widget.showAtMarker(t.selected.marker,t.selected.index,t.selected.total)}}async nagivate(e,t){var i,n;if(this._editor.hasModel()){const s=this._getOrCreateModel(t?void 0:this._editor.getModel().uri);if(s.move(e,this._editor.getModel(),this._editor.getPosition()),!s.selected)return;if(s.selected.marker.resource.toString()!==this._editor.getModel().uri.toString()){this._cleanUp();const r=await this._editorService.openCodeEditor({resource:s.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:s.selected.marker}},this._editor);r&&((i=Ym.get(r))===null||i===void 0||i.close(),(n=Ym.get(r))===null||n===void 0||n.nagivate(e,t))}else this._widget.showAtMarker(s.selected.marker,s.selected.index,s.selected.total)}}};Yc.ID="editor.contrib.markerController";Yc=Ym=bue([tC(1,hW),tC(2,We),tC(3,Dt),tC(4,Oe)],Yc);class Hy extends we{constructor(e,t,i){super(i),this._next=e,this._multiFile=t}async run(e,t){var i;t.hasModel()&&((i=Yc.get(t))===null||i===void 0||i.nagivate(this._next,this._multiFile))}}class Lc extends Hy{constructor(){super(!0,!1,{id:Lc.ID,label:Lc.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:578,weight:100},menuOpts:{menuId:Sp.TitleMenu,title:Lc.LABEL,icon:Di("marker-navigation-next",he.arrowDown,p("nextMarkerIcon","Icon for goto next marker.")),group:"navigation",order:1}})}}Lc.ID="editor.action.marker.next";Lc.LABEL=p("markerAction.next.label","Go to Next Problem (Error, Warning, Info)");class fu extends Hy{constructor(){super(!1,!1,{id:fu.ID,label:fu.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:1602,weight:100},menuOpts:{menuId:Sp.TitleMenu,title:fu.LABEL,icon:Di("marker-navigation-previous",he.arrowUp,p("previousMarkerIcon","Icon for goto previous marker.")),group:"navigation",order:2}})}}fu.ID="editor.action.marker.prev";fu.LABEL=p("markerAction.previous.label","Go to Previous Problem (Error, Warning, Info)");class Cue extends Hy{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:p("markerAction.nextInFiles.label","Go to Next Problem in Files (Error, Warning, Info)"),alias:"Go to Next Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:66,weight:100},menuOpts:{menuId:N.MenubarGoMenu,title:p({},"Next &&Problem"),group:"6_problem_nav",order:1}})}}class wue extends Hy{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:p("markerAction.previousInFiles.label","Go to Previous Problem in Files (Error, Warning, Info)"),alias:"Go to Previous Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:1090,weight:100},menuOpts:{menuId:N.MenubarGoMenu,title:p({},"Previous &&Problem"),group:"6_problem_nav",order:2}})}}yt(Yc.ID,Yc,4);de(Lc);de(fu);de(Cue);de(wue);const uW=new be("markersNavigationVisible",!1),Sue=cn.bindToContribution(Yc.get);ue(new Sue({id:"closeMarkersNavigation",precondition:uW,handler:o=>o.close(),kbOpts:{weight:150,kbExpr:M.focus,primary:9,secondary:[1033]}}));var yue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},hD=function(o,e){return function(t,i){e(t,i,o)}};const er=pe;class Lue{constructor(e,t,i){this.owner=e,this.range=t,this.marker=i}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}const u5={type:1,filter:{include:Be.QuickFix},triggerAction:qs.QuickFixHover};let LN=class{constructor(e,t,i,n){this._editor=e,this._markerDecorationsService=t,this._openerService=i,this._languageFeaturesService=n,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1&&!e.supportsMarkerHover)return[];const i=this._editor.getModel(),n=e.range.startLineNumber,s=i.getLineMaxColumn(n),r=[];for(const a of t){const l=a.range.startLineNumber===n?a.range.startColumn:1,d=a.range.endLineNumber===n?a.range.endColumn:s,c=this._markerDecorationsService.getMarker(i.uri,a);if(!c)continue;const h=new k(e.range.startLineNumber,l,e.range.startLineNumber,d);r.push(new Lue(this,h,c))}return r}renderHoverParts(e,t){if(!t.length)return K.None;const i=new se;t.forEach(s=>e.fragment.appendChild(this.renderMarkerHover(s,i)));const n=t.length===1?t[0]:t.sort((s,r)=>ci.compare(s.marker.severity,r.marker.severity))[0];return this.renderMarkerStatusbar(e,n,i),i}renderMarkerHover(e,t){const i=er("div.hover-row"),n=ie(i,er("div.marker.hover-contents")),{source:s,message:r,code:a,relatedInformation:l}=e.marker;this._editor.applyFontInfo(n);const d=ie(n,er("span"));if(d.style.whiteSpace="pre-wrap",d.innerText=r,s||a)if(a&&typeof a!="string"){const c=er("span");if(s){const f=ie(c,er("span"));f.innerText=s}const h=ie(c,er("a.code-link"));h.setAttribute("href",a.target.toString()),t.add(Q(h,"click",f=>{this._openerService.open(a.target,{allowCommands:!0}),f.preventDefault(),f.stopPropagation()}));const u=ie(h,er("span"));u.innerText=a.value;const g=ie(n,c);g.style.opacity="0.6",g.style.paddingLeft="6px"}else{const c=ie(n,er("span"));c.style.opacity="0.6",c.style.paddingLeft="6px",c.innerText=s&&a?`${s}(${a})`:s||`(${a})`}if(Bn(l))for(const{message:c,resource:h,startLineNumber:u,startColumn:g}of l){const f=ie(n,er("div"));f.style.marginTop="8px";const m=ie(f,er("a"));m.innerText=`${qo(h)}(${u}, ${g}): `,m.style.cursor="pointer",t.add(Q(m,"click",v=>{v.stopPropagation(),v.preventDefault(),this._openerService&&this._openerService.open(h,{fromUserGesture:!0,editorOptions:{selection:{startLineNumber:u,startColumn:g}}}).catch(Ge)}));const _=ie(f,er("span"));_.innerText=c,this._editor.applyFontInfo(_)}return i}renderMarkerStatusbar(e,t,i){if((t.marker.severity===ci.Error||t.marker.severity===ci.Warning||t.marker.severity===ci.Info)&&e.statusBar.addAction({label:p("view problem","View Problem"),commandId:Lc.ID,run:()=>{var n;e.hide(),(n=Yc.get(this._editor))===null||n===void 0||n.showAtMarker(t.marker),this._editor.focus()}}),!this._editor.getOption(90)){const n=e.statusBar.append(er("div"));this.recentMarkerCodeActionsInfo&&(gw.makeKey(this.recentMarkerCodeActionsInfo.marker)===gw.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(n.textContent=p("noQuickFixes","No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const s=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?K.None:i.add(Rc(()=>n.textContent=p("checkingForQuickFixes","Checking for quick fixes..."),200));n.textContent||(n.textContent=" ");const r=this.getCodeActions(t.marker);i.add(Ae(()=>r.cancel())),r.then(a=>{if(s.dispose(),this.recentMarkerCodeActionsInfo={marker:t.marker,hasCodeActions:a.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions){a.dispose(),n.textContent=p("noQuickFixes","No quick fixes available");return}n.style.display="none";let l=!1;i.add(Ae(()=>{l||a.dispose()})),e.statusBar.addAction({label:p("quick fixes","Quick Fix..."),commandId:pR,run:d=>{l=!0;const c=jc.get(this._editor),h=ji(d);e.hide(),c?.showCodeActions(u5,a,{x:h.left,y:h.top,width:h.width,height:h.height})}})},Ge)}}getCodeActions(e){return Zi(t=>L_(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new k(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),u5,ld.None,t))}};LN=yue([hD(1,R2),hD(2,Qs),hD(3,Se)],LN);const gW="editor.action.inlineSuggest.commit",fW="editor.action.inlineSuggest.showPrevious",pW="editor.action.inlineSuggest.showNext";var DR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jr=function(o,e){return function(t,i){e(t,i,o)}},i1;let xN=class extends K{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=pi(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).showToolbar==="always"),this.sessionPosition=void 0,this.position=Xe(this,n=>{var s,r,a;const l=(s=this.model.read(n))===null||s===void 0?void 0:s.ghostText.read(n);if(!this.alwaysShowToolbar.read(n)||!l||l.parts.length===0)return this.sessionPosition=void 0,null;const d=l.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==l.lineNumber&&(this.sessionPosition=void 0);const c=new V(l.lineNumber,Math.min(d,(a=(r=this.sessionPosition)===null||r===void 0?void 0:r.column)!==null&&a!==void 0?a:Number.MAX_SAFE_INTEGER));return this.sessionPosition=c,c}),this._register(yd((n,s)=>{const r=this.model.read(n);if(!r||!this.alwaysShowToolbar.read(n))return;const a=s.add(this.instantiationService.createInstance(Xc,this.editor,!0,this.position,r.selectedInlineCompletionIndex,r.inlineCompletionsCount,r.selectedInlineCompletion.map(l=>{var d;return(d=l?.inlineCompletion.source.inlineCompletions.commands)!==null&&d!==void 0?d:[]})));e.addContentWidget(a),s.add(Ae(()=>e.removeContentWidget(a))),s.add(xt(l=>{this.position.read(l)&&r.lastTriggerKind.read(l)!==od.Explicit&&r.triggerExplicitly()}))}))}};xN=DR([jr(2,Oe)],xN);const xue=Di("inline-suggestion-hints-next",he.chevronRight,p("parameterHintsNextIcon","Icon for show next parameter hint.")),Due=Di("inline-suggestion-hints-previous",he.chevronLeft,p("parameterHintsPreviousIcon","Icon for show previous parameter hint."));let Xc=i1=class extends K{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(e,t,i){const n=new cs(e,t,i,!0,()=>this._commandService.executeCommand(e)),s=this.keybindingService.lookupKeybinding(e,this._contextKeyService);let r=t;return s&&(r=p({},"{0} ({1})",t,s.getLabel())),n.tooltip=r,n}constructor(e,t,i,n,s,r,a,l,d,c,h){super(),this.editor=e,this.withBorder=t,this._position=i,this._currentSuggestionIdx=n,this._suggestionCount=s,this._extraCommands=r,this._commandService=a,this.keybindingService=d,this._contextKeyService=c,this._menuService=h,this.id=`InlineSuggestionHintsContentWidget${i1.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Jt("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Jt("div@toolBar")]),this.previousAction=this.createCommandAction(fW,p("previous","Previous"),Re.asClassName(Due)),this.availableSuggestionCountAction=new cs("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(pW,p("next","Next"),Re.asClassName(xue)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(N.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Rt(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new Rt(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this.lastCommands=[],this.toolBar=this._register(l.createInstance(DN,this.nodes.toolBar,N.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:u=>u.startsWith("primary")},actionViewItemProvider:(u,g)=>{if(u instanceof _r)return l.createInstance(Iue,u,void 0);if(u===this.availableSuggestionCountAction){const f=new kue(void 0,u,{label:!0,icon:!1});return f.setClass("availableSuggestionCount"),f}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(u=>{i1._dropDownVisible=u})),this._register(xt(u=>{this._position.read(u),this.editor.layoutContentWidget(this)})),this._register(xt(u=>{const g=this._suggestionCount.read(u),f=this._currentSuggestionIdx.read(u);g!==void 0?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${f+1}/${g}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),g!==void 0&&g>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(xt(u=>{const g=this._extraCommands.read(u);if(_i(this.lastCommands,g))return;this.lastCommands=g;const f=g.map(m=>({class:void 0,id:m.id,enabled:!0,tooltip:m.tooltip||"",label:m.title,run:_=>this._commandService.executeCommand(m.id)}));for(const[m,_]of this.inlineCompletionsActionsMenus.getActions())for(const v of _)v instanceof _r&&f.push(v);f.length>0&&f.unshift(new dn),this.toolBar.setAdditionalSecondaryActions(f)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};Xc._dropDownVisible=!1;Xc.id=0;Xc=i1=DR([jr(6,ui),jr(7,Oe),jr(8,Pt),jr(9,We),jr(10,ra)],Xc);class kue extends up{constructor(){super(...arguments),this._className=void 0}setClass(e){this._className=e}render(e){super.render(e),this._className&&e.classList.add(this._className)}}let Iue=class extends Nu{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Jt("div.keybinding").root;new Mv(t,mo,{disableTitle:!0,...boe}).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}},DN=class extends Ow{constructor(e,t,i,n,s,r,a,l){super(e,{resetMenu:t,...i},n,s,r,a,l),this.menuId=t,this.options2=i,this.menuService=n,this.contextKeyService=s,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){var e,t,i,n,s,r,a;const l=[],d=[];NM(this.menu,(e=this.options2)===null||e===void 0?void 0:e.menuOptions,{primary:l,secondary:d},(i=(t=this.options2)===null||t===void 0?void 0:t.toolbarOptions)===null||i===void 0?void 0:i.primaryGroup,(s=(n=this.options2)===null||n===void 0?void 0:n.toolbarOptions)===null||s===void 0?void 0:s.shouldInlineSubmenu,(a=(r=this.options2)===null||r===void 0?void 0:r.toolbarOptions)===null||a===void 0?void 0:a.useSeparatorsInPrimaryActions),d.push(...this.additionalActions),l.unshift(...this.prependedPrimaryActions),this.setActions(l,d)}setPrependedPrimaryActions(e){_i(this.prependedPrimaryActions,e,(t,i)=>t===i)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){_i(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};DN=DR([jr(3,ra),jr(4,We),jr(5,Yo),jr(6,Pt),jr(7,Gs)],DN);var Eue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},iC=function(o,e){return function(t,i){e(t,i,o)}},kN;let Ds=kN=class extends K{static get(e){return e.getContribution(kN.ID)}constructor(e,t,i,n,s){super(),this._editor=e,this._instantiationService=t,this._openerService=i,this._languageService=n,this._keybindingService=s,this._toUnhook=new se,this._hoverActivatedByColorDecoratorClick=!1,this._isMouseDown=!1,this._hoverClicked=!1,this._contentWidget=null,this._glyphWidget=null,this._reactToEditorMouseMoveRunner=this._register(new Rt(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookEvents(),this._register(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(60)&&(this._unhookEvents(),this._hookEvents())}))}_hookEvents(){const e=this._editor.getOption(60);this._isHoverEnabled=e.enabled,this._isHoverSticky=e.sticky,this._hidingDelay=e.hidingDelay,this._isHoverEnabled?(this._toUnhook.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._toUnhook.add(this._editor.onMouseUp(t=>this._onEditorMouseUp(t))),this._toUnhook.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._toUnhook.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._toUnhook.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._toUnhook.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._toUnhook.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._toUnhook.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this._hideWidgets()})),this._toUnhook.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._toUnhook.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_unhookEvents(){this._toUnhook.clear()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(e){var t;this._isMouseDown=!0;const i=e.target;if(i.type===9&&i.detail===yc.ID){this._hoverClicked=!0;return}i.type===12&&i.detail===Vf.ID||(i.type!==12&&(this._hoverClicked=!1),!((t=this._contentWidget)===null||t===void 0)&&t.widget.isResizing||this._hideWidgets())}_onEditorMouseUp(e){this._isMouseDown=!1}_onEditorMouseLeave(e){var t,i;this._cancelScheduler();const n=e.event.browserEvent.relatedTarget;!((t=this._contentWidget)===null||t===void 0)&&t.widget.isResizing||!((i=this._contentWidget)===null||i===void 0)&&i.containsNode(n)||this._hideWidgets()}_isMouseOverWidget(e){var t,i,n,s,r;const a=e.target;return!!(this._isHoverSticky&&a.type===9&&a.detail===yc.ID||this._isHoverSticky&&(!((t=this._contentWidget)===null||t===void 0)&&t.containsNode((i=e.event.browserEvent.view)===null||i===void 0?void 0:i.document.activeElement))&&!(!((s=(n=e.event.browserEvent.view)===null||n===void 0?void 0:n.getSelection())===null||s===void 0)&&s.isCollapsed)||!this._isHoverSticky&&a.type===9&&a.detail===yc.ID&&(!((r=this._contentWidget)===null||r===void 0)&&r.isColorPickerVisible)||this._isHoverSticky&&a.type===12&&a.detail===Vf.ID)}_onEditorMouseMove(e){var t,i,n,s;if(this._mouseMoveEvent=e,!((t=this._contentWidget)===null||t===void 0)&&t.isFocused||!((i=this._contentWidget)===null||i===void 0)&&i.isResizing||this._isMouseDown&&this._hoverClicked||this._isHoverSticky&&(!((n=this._contentWidget)===null||n===void 0)&&n.isVisibleFromKeyboard))return;if(this._isMouseOverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}if(!((s=this._contentWidget)===null||s===void 0)&&s.isVisible&&this._isHoverSticky&&this._hidingDelay>0){this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(this._hidingDelay);return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){var t,i,n;if(!e)return;const s=e.target,r=(t=s.element)===null||t===void 0?void 0:t.classList.contains("colorpicker-color-decoration"),a=this._editor.getOption(146);if(r&&(a==="click"&&!this._hoverActivatedByColorDecoratorClick||a==="hover"&&!this._isHoverEnabled||a==="clickAndHover"&&!this._isHoverEnabled&&!this._hoverActivatedByColorDecoratorClick)||!r&&!this._isHoverEnabled&&!this._hoverActivatedByColorDecoratorClick){this._hideWidgets();return}if(this._getOrCreateContentWidget().maybeShowAt(e)){(i=this._glyphWidget)===null||i===void 0||i.hide();return}if(s.type===2&&s.position){(n=this._contentWidget)===null||n===void 0||n.hide(),this._glyphWidget||(this._glyphWidget=new Vf(this._editor,this._languageService,this._openerService)),this._glyphWidget.startShowingAt(s.position.lineNumber);return}this._hideWidgets()}_onKeyDown(e){var t;if(!this._editor.hasModel())return;const i=this._keybindingService.softDispatch(e,this._editor.getDomNode()),n=i.kind===1||i.kind===2&&i.commandId==="editor.action.showHover"&&((t=this._contentWidget)===null||t===void 0?void 0:t.isVisible);e.keyCode!==5&&e.keyCode!==6&&e.keyCode!==57&&e.keyCode!==4&&!n&&this._hideWidgets()}_hideWidgets(){var e,t,i;this._isMouseDown&&this._hoverClicked&&(!((e=this._contentWidget)===null||e===void 0)&&e.isColorPickerVisible)||Xc.dropDownVisible||(this._hoverActivatedByColorDecoratorClick=!1,this._hoverClicked=!1,(t=this._glyphWidget)===null||t===void 0||t.hide(),(i=this._contentWidget)===null||i===void 0||i.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(zw,this._editor)),this._contentWidget}showContentHover(e,t,i,n,s=!1){this._hoverActivatedByColorDecoratorClick=s,this._getOrCreateContentWidget().startShowingAtRange(e,t,i,n)}focus(){var e;(e=this._contentWidget)===null||e===void 0||e.focus()}scrollUp(){var e;(e=this._contentWidget)===null||e===void 0||e.scrollUp()}scrollDown(){var e;(e=this._contentWidget)===null||e===void 0||e.scrollDown()}scrollLeft(){var e;(e=this._contentWidget)===null||e===void 0||e.scrollLeft()}scrollRight(){var e;(e=this._contentWidget)===null||e===void 0||e.scrollRight()}pageUp(){var e;(e=this._contentWidget)===null||e===void 0||e.pageUp()}pageDown(){var e;(e=this._contentWidget)===null||e===void 0||e.pageDown()}goToTop(){var e;(e=this._contentWidget)===null||e===void 0||e.goToTop()}goToBottom(){var e;(e=this._contentWidget)===null||e===void 0||e.goToBottom()}get isColorPickerVisible(){var e;return(e=this._contentWidget)===null||e===void 0?void 0:e.isColorPickerVisible}get isHoverVisible(){var e;return(e=this._contentWidget)===null||e===void 0?void 0:e.isVisible}dispose(){var e,t;super.dispose(),this._unhookEvents(),this._toUnhook.dispose(),(e=this._glyphWidget)===null||e===void 0||e.dispose(),(t=this._contentWidget)===null||t===void 0||t.dispose()}};Ds.ID="editor.contrib.hover";Ds=kN=Eue([iC(1,Oe),iC(2,Qs),iC(3,ni),iC(4,Pt)],Ds);var Rr;(function(o){o.NoAutoFocus="noAutoFocus",o.FocusIfVisible="focusIfVisible",o.AutoFocusImmediately="autoFocusImmediately"})(Rr||(Rr={}));class Nue extends we{constructor(){super({id:"editor.action.showHover",label:p({},"Show or Focus Hover"),metadata:{description:"Show or Focus Hover",args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if and when the hover should take focus upon being triggered by this action.",enum:[Rr.NoAutoFocus,Rr.FocusIfVisible,Rr.AutoFocusImmediately],enumDescriptions:[p("showOrFocusHover.focus.noAutoFocus","The hover will not automatically take focus."),p("showOrFocusHover.focus.focusIfVisible","The hover will take focus only if it is already visible."),p("showOrFocusHover.focus.autoFocusImmediately","The hover will automatically take focus when it appears.")],default:Rr.FocusIfVisible}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:qi(2089,2087),weight:100}})}run(e,t,i){if(!t.hasModel())return;const n=Ds.get(t);if(!n)return;const s=i?.focus;let r=Rr.FocusIfVisible;s in Rr?r=s:typeof s=="boolean"&&s&&(r=Rr.AutoFocusImmediately);const a=d=>{const c=t.getPosition(),h=new k(c.lineNumber,c.column,c.lineNumber,c.column);n.showContentHover(h,1,1,d)},l=t.getOption(2)===2;n.isHoverVisible?r!==Rr.NoAutoFocus?n.focus():a(l):a(l||r===Rr.AutoFocusImmediately)}}class Tue extends we{constructor(){super({id:"editor.action.showDefinitionPreviewHover",label:p({},"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0})}run(e,t){const i=Ds.get(t);if(!i)return;const n=t.getPosition();if(!n)return;const s=new k(n.lineNumber,n.column,n.lineNumber,n.column),r=Hu.get(t);if(!r)return;r.startFindDefinitionFromCursor(n).then(()=>{i.showContentHover(s,1,1,!0)})}}class Mue extends we{constructor(){super({id:"editor.action.scrollUpHover",label:p({},"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:16,weight:100}})}run(e,t){const i=Ds.get(t);i&&i.scrollUp()}}class Rue extends we{constructor(){super({id:"editor.action.scrollDownHover",label:p({},"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:18,weight:100}})}run(e,t){const i=Ds.get(t);i&&i.scrollDown()}}class Aue extends we{constructor(){super({id:"editor.action.scrollLeftHover",label:p({},"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:15,weight:100}})}run(e,t){const i=Ds.get(t);i&&i.scrollLeft()}}class Pue extends we{constructor(){super({id:"editor.action.scrollRightHover",label:p({},"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:17,weight:100}})}run(e,t){const i=Ds.get(t);i&&i.scrollRight()}}class Oue extends we{constructor(){super({id:"editor.action.pageUpHover",label:p({},"Page Up Hover"),alias:"Page Up Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:11,secondary:[528],weight:100}})}run(e,t){const i=Ds.get(t);i&&i.pageUp()}}class Fue extends we{constructor(){super({id:"editor.action.pageDownHover",label:p({},"Page Down Hover"),alias:"Page Down Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:12,secondary:[530],weight:100}})}run(e,t){const i=Ds.get(t);i&&i.pageDown()}}class Bue extends we{constructor(){super({id:"editor.action.goToTopHover",label:p({},"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:14,secondary:[2064],weight:100}})}run(e,t){const i=Ds.get(t);i&&i.goToTop()}}class Wue extends we{constructor(){super({id:"editor.action.goToBottomHover",label:p({},"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:13,secondary:[2066],weight:100}})}run(e,t){const i=Ds.get(t);i&&i.goToBottom()}}yt(Ds.ID,Ds,2);de(Nue);de(Tue);de(Mue);de(Rue);de(Aue);de(Pue);de(Oue);de(Fue);de(Bue);de(Wue);hg.register(Kw);hg.register(LN);Sr((o,e)=>{const t=o.getColor(NG);t&&(e.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${t.transparent(.5)}; }`))});class IN extends K{constructor(e){super(),this._editor=e,this._register(e.onMouseDown(t=>this.onMouseDown(t)))}dispose(){super.dispose()}onMouseDown(e){const t=this._editor.getOption(146);if(t!=="click"&&t!=="clickAndHover")return;const i=e.target;if(i.type!==6||!i.detail.injectedText||i.detail.injectedText.options.attachedData!==V6||!i.range)return;const n=this._editor.getContribution(Ds.ID);if(n&&!n.isColorPickerVisible){const s=new k(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1);n.showContentHover(s,1,0,!1,!0)}}}IN.ID="editor.contrib.colorContribution";yt(IN.ID,IN,2);hg.register(Vw);var mW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Hr=function(o,e){return function(t,i){e(t,i,o)}},EN,NN;let Qc=EN=class extends K{constructor(e,t,i,n,s,r,a){super(),this._editor=e,this._modelService=i,this._keybindingService=n,this._instantiationService=s,this._languageFeatureService=r,this._languageConfigurationService=a,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=M.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=M.standaloneColorPickerFocused.bindTo(t)}showOrFocus(){var e;this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||(e=this._standaloneColorPickerWidget)===null||e===void 0||e.focus():this._standaloneColorPickerWidget=new qw(this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused,this._instantiationService,this._modelService,this._keybindingService,this._languageFeatureService,this._languageConfigurationService))}hide(){var e;this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),(e=this._standaloneColorPickerWidget)===null||e===void 0||e.hide(),this._editor.focus()}insertColor(){var e;(e=this._standaloneColorPickerWidget)===null||e===void 0||e.updateEditor(),this.hide()}static get(e){return e.getContribution(EN.ID)}};Qc.ID="editor.contrib.standaloneColorPickerController";Qc=EN=mW([Hr(1,We),Hr(2,ii),Hr(3,Pt),Hr(4,Oe),Hr(5,Se),Hr(6,Wt)],Qc);yt(Qc.ID,Qc,1);const g5=8,Vue=22;let qw=NN=class extends K{constructor(e,t,i,n,s,r,a,l){var d;super(),this._editor=e,this._standaloneColorPickerVisible=t,this._standaloneColorPickerFocused=i,this._modelService=s,this._keybindingService=r,this._languageFeaturesService=a,this._languageConfigurationService=l,this.allowEditorOverflow=!0,this._position=void 0,this._body=document.createElement("div"),this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new W),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=n.createInstance(W0,this._editor),this._position=(d=this._editor._getViewModel())===null||d===void 0?void 0:d.getPrimaryCursorState().modelState.position;const c=this._editor.getSelection(),h=c?{startLineNumber:c.startLineNumber,startColumn:c.startColumn,endLineNumber:c.endLineNumber,endColumn:c.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},u=this._register(dl(this._body));this._register(u.onDidBlur(g=>{this.hide()})),this._register(u.onDidFocus(g=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(g=>{var f;const m=(f=g.target.element)===null||f===void 0?void 0:f.classList;m&&m.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(g=>{this._render(g.value,g.foundInEditor)})),this._start(h),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return NN.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;const e=this._editor.getOption(60).above;return{position:this._position,secondaryPosition:this._position,preference:e?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}async _start(e){const t=await this._computeAsync(e);t&&this._onResult.fire(new Hue(t.result,t.foundInEditor))}async _computeAsync(e){if(!this._editor.hasModel())return null;const t={range:e,color:{red:0,green:0,blue:0,alpha:1}},i=await this._standaloneColorPickerParticipant.createColorHover(t,new bR(this._modelService,this._languageConfigurationService),this._languageFeaturesService.colorProvider);return i?{result:i.colorHover,foundInEditor:i.foundInEditor}:null}_render(e,t){const i=document.createDocumentFragment(),n=this._register(new Uw(this._keybindingService));let s;const r={fragment:i,statusBar:n,setColorPicker:m=>s=m,onContentsChanged:()=>{},hide:()=>this.hide()};if(this._colorHover=e,this._register(this._standaloneColorPickerParticipant.renderHoverParts(r,[e])),s===void 0)return;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(this._editor.getLayoutInfo().width*.66,500)+"px",this._body.tabIndex=0,this._body.appendChild(i),s.layout();const a=s.body,l=a.saturationBox.domNode.clientWidth,d=a.domNode.clientWidth-l-Vue-g5,c=s.body.enterButton;c?.onClicked(()=>{this.updateEditor(),this.hide()});const h=s.header,u=h.pickedColorNode;u.style.width=l+g5+"px";const g=h.originalColorNode;g.style.width=d+"px";const f=s.header.closeButton;f?.onClicked(()=>{this.hide()}),t&&(c&&(c.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}};qw.ID="editor.contrib.standaloneColorPickerWidget";qw=NN=mW([Hr(3,Oe),Hr(4,ii),Hr(5,Pt),Hr(6,Se),Hr(7,Wt)],qw);class Hue{constructor(e,t){this.value=e,this.foundInEditor=t}}class zue extends aa{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{value:p("showOrFocusStandaloneColorPicker","Show or Focus Standalone Color Picker"),mnemonicTitle:p({},"&&Show or Focus Standalone Color Picker"),original:"Show or Focus Standalone Color Picker"},precondition:void 0,menu:[{id:N.CommandPalette}]})}runEditorCommand(e,t){var i;(i=Qc.get(t))===null||i===void 0||i.showOrFocus()}}class Uue extends we{constructor(){super({id:"editor.action.hideColorPicker",label:p({},"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:M.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100}})}run(e,t){var i;(i=Qc.get(t))===null||i===void 0||i.hide()}}class $ue extends we{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:p({},"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:M.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100}})}run(e,t){var i;(i=Qc.get(t))===null||i===void 0||i.insertColor()}}de(Uue);de($ue);Xt(zue);class ac{constructor(e,t,i){this.languageConfigurationService=i,this._selection=e,this._insertSpace=t,this._usedEndToken=null}static _haystackHasNeedleAtOffset(e,t,i){if(i<0)return!1;const n=t.length,s=e.length;if(i+n>s)return!1;for(let r=0;r<n;r++){const a=e.charCodeAt(i+r),l=t.charCodeAt(r);if(a!==l&&!(a>=65&&a<=90&&a+32===l)&&!(l>=65&&l<=90&&l+32===a))return!1}return!0}_createOperationsForBlockComment(e,t,i,n,s,r){const a=e.startLineNumber,l=e.startColumn,d=e.endLineNumber,c=e.endColumn,h=s.getLineContent(a),u=s.getLineContent(d);let g=h.lastIndexOf(t,l-1+t.length),f=u.indexOf(i,c-1-i.length);if(g!==-1&&f!==-1)if(a===d)h.substring(g+t.length,f).indexOf(i)>=0&&(g=-1,f=-1);else{const _=h.substring(g+t.length),v=u.substring(0,f);(_.indexOf(i)>=0||v.indexOf(i)>=0)&&(g=-1,f=-1)}let m;g!==-1&&f!==-1?(n&&g+t.length<h.length&&h.charCodeAt(g+t.length)===32&&(t=t+" "),n&&f>0&&u.charCodeAt(f-1)===32&&(i=" "+i,f-=1),m=ac._createRemoveBlockCommentOperations(new k(a,g+t.length+1,d,f+1),t,i)):(m=ac._createAddBlockCommentOperations(e,t,i,this._insertSpace),this._usedEndToken=m.length===1?i:null);for(const _ of m)r.addTrackedEditOperation(_.range,_.text)}static _createRemoveBlockCommentOperations(e,t,i){const n=[];return k.isEmpty(e)?n.push(oi.delete(new k(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(n.push(oi.delete(new k(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),n.push(oi.delete(new k(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),n}static _createAddBlockCommentOperations(e,t,i,n){const s=[];return k.isEmpty(e)?s.push(oi.replace(new k(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(s.push(oi.insert(new V(e.startLineNumber,e.startColumn),t+(n?" ":""))),s.push(oi.insert(new V(e.endLineNumber,e.endColumn),(n?" ":"")+i))),s}getEditOperations(e,t){const i=this._selection.startLineNumber,n=this._selection.startColumn;e.tokenization.tokenizeIfCheap(i);const s=e.getLanguageIdAtPosition(i,n),r=this.languageConfigurationService.getLanguageConfiguration(s).comments;!r||!r.blockCommentStartToken||!r.blockCommentEndToken||this._createOperationsForBlockComment(this._selection,r.blockCommentStartToken,r.blockCommentEndToken,this._insertSpace,e,t)}computeCursorState(e,t){const i=t.getInverseEditOperations();if(i.length===2){const n=i[0],s=i[1];return new xe(n.range.endLineNumber,n.range.endColumn,s.range.startLineNumber,s.range.startColumn)}else{const n=i[0].range,s=this._usedEndToken?-this._usedEndToken.length-1:0;return new xe(n.endLineNumber,n.endColumn+s,n.endLineNumber,n.endColumn+s)}}}class Fl{constructor(e,t,i,n,s,r,a){this.languageConfigurationService=e,this._selection=t,this._tabSize=i,this._type=n,this._insertSpace=s,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=a||!1}static _gatherPreflightCommentStrings(e,t,i,n){e.tokenization.tokenizeIfCheap(t);const s=e.getLanguageIdAtPosition(t,1),r=n.getLanguageConfiguration(s).comments,a=r?r.lineCommentToken:null;if(!a)return null;const l=[];for(let d=0,c=i-t+1;d<c;d++)l[d]={ignore:!1,commentStr:a,commentStrOffset:0,commentStrLength:a.length};return l}static _analyzeLines(e,t,i,n,s,r,a,l){let d=!0,c;e===0?c=!0:e===1?c=!1:c=!0;for(let h=0,u=n.length;h<u;h++){const g=n[h],f=s+h;if(f===s&&a){g.ignore=!0;continue}const m=i.getLineContent(f),_=Xn(m);if(_===-1){g.ignore=r,g.commentStrOffset=m.length;continue}if(d=!1,g.ignore=!1,g.commentStrOffset=_,c&&!ac._haystackHasNeedleAtOffset(m,g.commentStr,_)&&(e===0?c=!1:e===1||(g.ignore=!0)),c&&t){const v=_+g.commentStrLength;v<m.length&&m.charCodeAt(v)===32&&(g.commentStrLength+=1)}}if(e===0&&d){c=!1;for(let h=0,u=n.length;h<u;h++)n[h].ignore=!1}return{supported:!0,shouldRemoveComments:c,lines:n}}static _gatherPreflightData(e,t,i,n,s,r,a,l){const d=Fl._gatherPreflightCommentStrings(i,n,s,l);return d===null?{supported:!1}:Fl._analyzeLines(e,t,i,d,n,r,a,l)}_executeLineComments(e,t,i,n){let s;i.shouldRemoveComments?s=Fl._createRemoveLineCommentsOperations(i.lines,n.startLineNumber):(Fl._normalizeInsertionPoint(e,i.lines,n.startLineNumber,this._tabSize),s=this._createAddLineCommentsOperations(i.lines,n.startLineNumber));const r=new V(n.positionLineNumber,n.positionColumn);for(let a=0,l=s.length;a<l;a++)t.addEditOperation(s[a].range,s[a].text),k.isEmpty(s[a].range)&&k.getStartPosition(s[a].range).equals(r)&&e.getLineContent(r.lineNumber).length+1===r.column&&(this._deltaColumn=(s[a].text||"").length);this._selectionId=t.trackSelection(n)}_attemptRemoveBlockComment(e,t,i,n){let s=t.startLineNumber,r=t.endLineNumber;const a=n.length+Math.max(e.getLineFirstNonWhitespaceColumn(t.startLineNumber),t.startColumn);let l=e.getLineContent(s).lastIndexOf(i,a-1),d=e.getLineContent(r).indexOf(n,t.endColumn-1-i.length);return l!==-1&&d===-1&&(d=e.getLineContent(s).indexOf(n,l+i.length),r=s),l===-1&&d!==-1&&(l=e.getLineContent(r).lastIndexOf(i,d),s=r),t.isEmpty()&&(l===-1||d===-1)&&(l=e.getLineContent(s).indexOf(i),l!==-1&&(d=e.getLineContent(s).indexOf(n,l+i.length))),l!==-1&&e.getLineContent(s).charCodeAt(l+i.length)===32&&(i+=" "),d!==-1&&e.getLineContent(r).charCodeAt(d-1)===32&&(n=" "+n,d-=1),l!==-1&&d!==-1?ac._createRemoveBlockCommentOperations(new k(s,l+i.length+1,r,d+1),i,n):null}_executeBlockComment(e,t,i){e.tokenization.tokenizeIfCheap(i.startLineNumber);const n=e.getLanguageIdAtPosition(i.startLineNumber,1),s=this.languageConfigurationService.getLanguageConfiguration(n).comments;if(!s||!s.blockCommentStartToken||!s.blockCommentEndToken)return;const r=s.blockCommentStartToken,a=s.blockCommentEndToken;let l=this._attemptRemoveBlockComment(e,i,r,a);if(!l){if(i.isEmpty()){const d=e.getLineContent(i.startLineNumber);let c=Xn(d);c===-1&&(c=d.length),l=ac._createAddBlockCommentOperations(new k(i.startLineNumber,c+1,i.startLineNumber,d.length+1),r,a,this._insertSpace)}else l=ac._createAddBlockCommentOperations(new k(i.startLineNumber,e.getLineFirstNonWhitespaceColumn(i.startLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),r,a,this._insertSpace);l.length===1&&(this._deltaColumn=r.length+1)}this._selectionId=t.trackSelection(i);for(const d of l)t.addEditOperation(d.range,d.text)}getEditOperations(e,t){let i=this._selection;if(this._moveEndPositionDown=!1,i.startLineNumber===i.endLineNumber&&this._ignoreFirstLine){t.addEditOperation(new k(i.startLineNumber,e.getLineMaxColumn(i.startLineNumber),i.startLineNumber+1,1),i.startLineNumber===e.getLineCount()?"":`
|
|
651
|
+
*-----------------------------------------------------------------------------*/var Kde=Object.defineProperty,jde=Object.getOwnPropertyDescriptor,qde=Object.getOwnPropertyNames,Gde=Object.prototype.hasOwnProperty,Zde=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of qde(e))!Gde.call(o,n)&&n!==t&&Kde(o,n,{get:()=>e[n],enumerable:!(i=jde(e,n))||i.enumerable});return o},Yde=(o,e,t)=>(Zde(o,e,"default"),t),Wv={};Yde(Wv,c6);var Xde=class{_onDidChange=new Wv.Emitter;_diagnosticsOptions;_modeConfiguration;_languageId;constructor(o,e,t){this._languageId=o,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(o){this._diagnosticsOptions=o||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(o){this._modeConfiguration=o||Object.create(null),this._onDidChange.fire(this)}},Qde={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},Jde={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},g6=new Xde("json",Qde,Jde);Wv.languages.json={jsonDefaults:g6};function ece(){return u3(()=>import("./jsonMode.eb0f9c1e.C3ukgfVD.js"),[],import.meta.url)}Wv.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});Wv.languages.onLanguage("json",()=>{ece().then(o=>o.setupMode(g6))});function tD(o,e){return e&&(o.stack||o.stacktrace)?p("stackTrace.format","{0}: {1}",UF(o),zF(o.stack)||zF(o.stacktrace)):UF(o)}function zF(o){return Array.isArray(o)?o.join(`
|
|
652
|
+
`):o}function UF(o){return o.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${o.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof o.code=="string"&&typeof o.errno=="number"&&typeof o.syscall=="string"?p("nodeExceptionMessage","A system error occurred ({0})",o.message):o.message||p("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}function f6(o=null,e=!1){if(!o)return p("error.defaultMessage","An unknown error occurred. Please consult the log for more details.");if(Array.isArray(o)){const t=Qr(o),i=f6(t[0],e);return t.length>1?p("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(ds(o))return o;if(o.detail){const t=o.detail;if(t.error)return tD(t.error,e);if(t.exception)return tD(t.exception,e)}return o.stack?tD(o,e):o.message?o.message:p("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}function tce(o){var e;const t=new Map;for(const i of o)t.set(i,((e=t.get(i))!==null&&e!==void 0?e:0)+1);return t}class S_{constructor(){this.chunkCount=0,this.chunkOccurrences=new Map,this.documents=new Map}calculateScores(e,t){const i=this.computeEmbedding(e),n=new Map,s=[];for(const[r,a]of this.documents){if(t.isCancellationRequested)return[];for(const l of a.chunks){const d=this.computeSimilarityScore(l,i,n);d>0&&s.push({key:r,score:d})}}return s}static termFrequencies(e){return tce(S_.splitTerms(e))}static*splitTerms(e){const t=i=>i.toLowerCase();for(const[i]of e.matchAll(new RegExp("\\b\\p{Letter}[\\p{Letter}\\d]{2,}\\b","gu"))){yield t(i);const n=i.replace(/([a-z])([A-Z])/g,"$1 $2").split(/\s+/g);if(n.length>1)for(const s of n)s.length>2&&new RegExp("\\p{Letter}{3,}","gu").test(s)&&(yield t(s))}}updateDocuments(e){var t;for(const{key:i}of e)this.deleteDocument(i);for(const i of e){const n=[];for(const s of i.textChunks){const r=S_.termFrequencies(s);for(const a of r.keys())this.chunkOccurrences.set(a,((t=this.chunkOccurrences.get(a))!==null&&t!==void 0?t:0)+1);n.push({text:s,tf:r})}this.chunkCount+=n.length,this.documents.set(i.key,{chunks:n})}return this}deleteDocument(e){const t=this.documents.get(e);if(t){this.documents.delete(e),this.chunkCount-=t.chunks.length;for(const i of t.chunks)for(const n of i.tf.keys()){const s=this.chunkOccurrences.get(n);if(typeof s=="number"){const r=s-1;r<=0?this.chunkOccurrences.delete(n):this.chunkOccurrences.set(n,r)}}}}computeSimilarityScore(e,t,i){let n=0;for(const[s,r]of Object.entries(t)){const a=e.tf.get(s);if(!a)continue;let l=i.get(s);typeof l!="number"&&(l=this.computeIdf(s),i.set(s,l));const d=a*l;n+=d*r}return n}computeEmbedding(e){const t=S_.termFrequencies(e);return this.computeTfidf(t)}computeIdf(e){var t;const i=(t=this.chunkOccurrences.get(e))!==null&&t!==void 0?t:0;return i>0?Math.log((this.chunkCount+1)/i):0}computeTfidf(e){const t=Object.create(null);for(const[i,n]of e){const s=this.computeIdf(i);s>0&&(t[i]=n*s)}return t}}function ice(o){var e,t;const i=o.slice(0);i.sort((s,r)=>r.score-s.score);const n=(t=(e=i[0])===null||e===void 0?void 0:e.score)!==null&&t!==void 0?t:0;if(n>0)for(const s of i)s.score/=n;return i}var hf;(function(o){o[o.NO_ACTION=0]="NO_ACTION",o[o.CLOSE_PICKER=1]="CLOSE_PICKER",o[o.REFRESH_PICKER=2]="REFRESH_PICKER",o[o.REMOVE_ITEM=3]="REMOVE_ITEM"})(hf||(hf={}));function iD(o){const e=o;return Array.isArray(e.items)}function $F(o){const e=o;return!!e.picks&&e.additionalPicks instanceof Promise}class nce extends K{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,i){var n;const s=new se;e.canAcceptInBackground=!!(!((n=this.options)===null||n===void 0)&&n.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let r;const a=s.add(new Cn),l=async()=>{const d=a.value=new se;r?.dispose(!0),e.busy=!1,r=new Wi(t);const c=r.token,h=e.value.substr(this.prefix.length).trim(),u=this._getPicks(h,d,c,i),g=(m,_)=>{var v;let b,C;if(iD(m)?(b=m.items,C=m.active):b=m,b.length===0){if(_)return!1;(h.length>0||e.hideInput)&&(!((v=this.options)===null||v===void 0)&&v.noResultsPick)&&(P_(this.options.noResultsPick)?b=[this.options.noResultsPick(h)]:b=[this.options.noResultsPick])}return e.items=b,C&&(e.activeItems=[C]),!0},f=async m=>{let _=!1,v=!1;await Promise.all([(async()=>{typeof m.mergeDelay=="number"&&(await Mc(m.mergeDelay),c.isCancellationRequested)||v||(_=g(m.picks,!0))})(),(async()=>{e.busy=!0;try{const b=await m.additionalPicks;if(c.isCancellationRequested)return;let C,w;iD(m.picks)?(C=m.picks.items,w=m.picks.active):C=m.picks;let y,I;if(iD(b)?(y=b.items,I=b.active):y=b,y.length>0||!_){let D;if(!w&&!I){const T=e.activeItems[0];T&&C.indexOf(T)!==-1&&(D=T)}g({items:[...C,...y],active:w||I||D})}}finally{c.isCancellationRequested||(e.busy=!1),v=!0}})()])};if(u!==null)if($F(u))await f(u);else if(!(u instanceof Promise))g(u);else{e.busy=!0;try{const m=await u;if(c.isCancellationRequested)return;$F(m)?await f(m):g(m)}finally{c.isCancellationRequested||(e.busy=!1)}}};return s.add(e.onDidChangeValue(()=>l())),l(),s.add(e.onDidAccept(d=>{const[c]=e.selectedItems;typeof c?.accept=="function"&&(d.inBackground||e.hide(),c.accept(e.keyMods,d))})),s.add(e.onDidTriggerItemButton(async({button:d,item:c})=>{var h,u;if(typeof c.trigger=="function"){const g=(u=(h=c.buttons)===null||h===void 0?void 0:h.indexOf(d))!==null&&u!==void 0?u:-1;if(g>=0){const f=c.trigger(g,e.keyMods),m=typeof f=="number"?f:await f;if(t.isCancellationRequested)return;switch(m){case hf.NO_ACTION:break;case hf.CLOSE_PICKER:e.hide();break;case hf.REFRESH_PICKER:l();break;case hf.REMOVE_ITEM:{const _=e.items.indexOf(c);if(_!==-1){const v=e.items.slice(),b=v.splice(_,1),C=e.activeItems.filter(y=>y!==b[0]),w=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=v,C&&(e.activeItems=C),e.keepScrollPosition=w}break}}}}})),s}}var p6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},qh=function(o,e){return function(t,i){e(t,i,o)}},Fh,zi;let Ou=Fh=class extends nce{constructor(e,t,i,n,s,r){super(Fh.PREFIX,e),this.instantiationService=t,this.keybindingService=i,this.commandService=n,this.telemetryService=s,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(Kc)),this.options=e}async _getPicks(e,t,i,n){var s,r,a,l;const d=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const c=_u(()=>{const v=new S_;v.updateDocuments(d.map(C=>({key:C.commandId,textChunks:[this.getTfIdfChunk(C)]})));const b=v.calculateScores(e,i);return ice(b).filter(C=>C.score>Fh.TFIDF_THRESHOLD).slice(0,Fh.TFIDF_MAX_RESULTS)}),h=[];for(const v of d){const b=(s=Fh.WORD_FILTER(e,v.label))!==null&&s!==void 0?s:void 0,C=v.commandAlias&&(r=Fh.WORD_FILTER(e,v.commandAlias))!==null&&r!==void 0?r:void 0;if(b||C)v.highlights={label:b,detail:this.options.showAlias?C:void 0},h.push(v);else if(e===v.commandId)h.push(v);else if(e.length>=3){const w=c();if(i.isCancellationRequested)return[];const y=w.find(I=>I.key===v.commandId);y&&(v.tfIdfScore=y.score,h.push(v))}}const u=new Map;for(const v of h){const b=u.get(v.label);b?(v.description=v.commandId,b.description=b.commandId):u.set(v.label,v)}h.sort((v,b)=>{if(v.tfIdfScore&&b.tfIdfScore)return v.tfIdfScore===b.tfIdfScore?v.label.localeCompare(b.label):b.tfIdfScore-v.tfIdfScore;if(v.tfIdfScore)return 1;if(b.tfIdfScore)return-1;const C=this.commandsHistory.peek(v.commandId),w=this.commandsHistory.peek(b.commandId);if(C&&w)return C>w?-1:1;if(C)return-1;if(w)return 1;if(this.options.suggestedCommandIds){const y=this.options.suggestedCommandIds.has(v.commandId),I=this.options.suggestedCommandIds.has(b.commandId);if(y&&I)return 0;if(y)return-1;if(I)return 1}return v.label.localeCompare(b.label)});const g=[];let f=!1,m=!0,_=!!this.options.suggestedCommandIds;for(let v=0;v<h.length;v++){const b=h[v];v===0&&this.commandsHistory.peek(b.commandId)&&(g.push({type:"separator",label:p("recentlyUsed","recently used")}),f=!0),m&&b.tfIdfScore!==void 0&&(g.push({type:"separator",label:p("suggested","similar commands")}),m=!1),_&&b.tfIdfScore===void 0&&!this.commandsHistory.peek(b.commandId)&&(!((a=this.options.suggestedCommandIds)===null||a===void 0)&&a.has(b.commandId))&&(g.push({type:"separator",label:p("commonlyUsed","commonly used")}),f=!0,_=!1),f&&b.tfIdfScore===void 0&&!this.commandsHistory.peek(b.commandId)&&!(!((l=this.options.suggestedCommandIds)===null||l===void 0)&&l.has(b.commandId))&&(g.push({type:"separator",label:p("morecCommands","other commands")}),f=!1),g.push(this.toCommandPick(b,n))}return this.hasAdditionalCommandPicks(e,i)?{picks:g,additionalPicks:(async()=>{var v;const b=await this.getAdditionalCommandPicks(d,h,e,i);if(i.isCancellationRequested)return[];const C=b.map(w=>this.toCommandPick(w,n));return m&&((v=C[0])===null||v===void 0?void 0:v.type)!=="separator"&&C.unshift({type:"separator",label:p("suggested","similar commands")}),C})()}:g}toCommandPick(e,t){if(e.type==="separator")return e;const i=this.keybindingService.lookupKeybinding(e.commandId),n=i?p("commandPickAriaLabelWithKeybinding","{0}, {1}",e.label,i.getAriaLabel()):e.label;return{...e,ariaLabel:n,detail:this.options.showAlias&&e.commandAlias!==e.label?e.commandAlias:void 0,keybinding:i,accept:async()=>{var s,r;this.commandsHistory.push(e.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.commandId,from:(s=t?.from)!==null&&s!==void 0?s:"quick open"});try{!((r=e.args)===null||r===void 0)&&r.length?await this.commandService.executeCommand(e.commandId,...e.args):await this.commandService.executeCommand(e.commandId)}catch(a){oa(a)||this.dialogService.error(p("canNotRun","Command '{0}' resulted in an error",e.label),f6(a))}}}}getTfIdfChunk({label:e,commandAlias:t,commandDescription:i}){let n=e;return t&&t!==e&&(n+=` - ${t}`),i&&i.value!==e&&(n+=` - ${i.value===i.original?i.value:`${i.value} (${i.original})`}`),n}};Ou.PREFIX=">";Ou.TFIDF_THRESHOLD=.5;Ou.TFIDF_MAX_RESULTS=5;Ou.WORD_FILTER=CM(S0,die,B7);Ou=Fh=p6([qh(1,Oe),qh(2,Pt),qh(3,ui),qh(4,Gs),qh(5,Dv)],Ou);let Kc=zi=class extends K{constructor(e,t){super(),this.storageService=e,this.configurationService=t,this.configuredCommandsHistoryLength=0,this.updateConfiguration(),this.load(),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.updateConfiguration(e))),this._register(this.storageService.onWillSaveState(e=>{e.reason===y0.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=zi.getConfiguredCommandHistoryLength(this.configurationService),zi.cache&&zi.cache.limit!==this.configuredCommandsHistoryLength&&(zi.cache.limit=this.configuredCommandsHistoryLength,zi.hasChanges=!0))}load(){const e=this.storageService.get(zi.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch{}const i=zi.cache=new oh(this.configuredCommandsHistoryLength,1);if(t){let n;t.usesLRU?n=t.entries:n=t.entries.sort((s,r)=>s.value-r.value),n.forEach(s=>i.set(s.key,s.value))}zi.counter=this.storageService.getNumber(zi.PREF_KEY_COUNTER,0,zi.counter)}push(e){zi.cache&&(zi.cache.set(e,zi.counter++),zi.hasChanges=!0)}peek(e){var t;return(t=zi.cache)===null||t===void 0?void 0:t.peek(e)}saveState(){if(!zi.cache||!zi.hasChanges)return;const e={usesLRU:!0,entries:[]};zi.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store(zi.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(zi.PREF_KEY_COUNTER,zi.counter,0,0),zi.hasChanges=!1}static getConfiguredCommandHistoryLength(e){var t,i;const s=(i=(t=e.getValue().workbench)===null||t===void 0?void 0:t.commandPalette)===null||i===void 0?void 0:i.history;return typeof s=="number"?s:zi.DEFAULT_COMMANDS_HISTORY_LENGTH}};Kc.DEFAULT_COMMANDS_HISTORY_LENGTH=50;Kc.PREF_KEY_CACHE="commandPalette.mru.cache";Kc.PREF_KEY_COUNTER="commandPalette.mru.counter";Kc.counter=1;Kc.hasChanges=!1;Kc=zi=p6([qh(0,da),qh(1,ft)],Kc);class sce extends Ou{constructor(e,t,i,n,s,r){super(e,t,i,n,s,r)}getCodeEditorCommandPicks(){const e=this.activeTextEditorControl;if(!e)return[];const t=[];for(const i of e.getSupportedActions())t.push({commandId:i.id,commandAlias:i.alias,label:DM(i.label)||i.id});return t}}var oce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Dg=function(o,e){return function(t,i){e(t,i,o)}};let B0=class extends sce{get activeTextEditorControl(){var e;return(e=this.codeEditorService.getFocusedCodeEditor())!==null&&e!==void 0?e:void 0}constructor(e,t,i,n,s,r){super({showAlias:!1},e,i,n,s,r),this.codeEditorService=t}async getCommandPicks(){return this.getCodeEditorCommandPicks()}hasAdditionalCommandPicks(){return!1}async getAdditionalCommandPicks(){return[]}};B0=oce([Dg(0,Oe),Dg(1,Dt),Dg(2,Pt),Dg(3,ui),Dg(4,Gs),Dg(5,Dv)],B0);class Vv extends we{constructor(){super({id:Vv.ID,label:iw.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(dh).quickAccess.show(B0.PREFIX)}}Vv.ID="editor.action.quickCommand";de(Vv);Ri.as(XM.Quickaccess).registerQuickAccessProvider({ctor:B0,prefix:B0.PREFIX,helpEntries:[{description:iw.quickCommandHelp,commandId:Vv.ID}]});class rce extends ko{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:{value:p("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),original:"Toggle Collapse Unchanged Regions"},icon:he.map,toggled:te.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:te.has("isInDiffEditor"),menu:{when:te.has("isInDiffEditor"),id:N.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(ft),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}Xt(rce);class m6 extends ko{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:{value:p("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),original:"Toggle Show Moved Code Blocks"},precondition:te.has("isInDiffEditor")})}run(e,...t){const i=e.get(ft),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}Xt(m6);class _6 extends ko{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:{value:p("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),original:"Toggle Use Inline View When Space Is Limited"},precondition:te.has("isInDiffEditor")})}run(e,...t){const i=e.get(ft),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}Xt(_6);vn.appendMenuItem(N.EditorTitle,{command:{id:new _6().desc.id,title:p("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:te.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:te.has("isInDiffEditor")},order:11,group:"1_diff",when:te.and(M.diffEditorRenderSideBySideInlineBreakpointReached,te.has("isInDiffEditor"))});vn.appendMenuItem(N.EditorTitle,{command:{id:new m6().desc.id,title:p("showMoves","Show Moved Code Blocks"),icon:he.move,toggled:Rp.create("config.diffEditor.experimental.showMoves",!0),precondition:te.has("isInDiffEditor")},order:10,group:"1_diff",when:te.has("isInDiffEditor")});const Ny={value:p("diffEditor","Diff Editor"),original:"Diff Editor"};class ace extends aa{constructor(){super({id:"diffEditor.switchSide",title:{value:p("switchSide","Switch Side"),original:"Switch Side"},icon:he.arrowSwap,precondition:te.has("isInDiffEditor"),f1:!0,category:Ny})}runEditorCommand(e,t,i){const n=qp(e);if(n instanceof zc){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}Xt(ace);class lce extends aa{constructor(){super({id:"diffEditor.exitCompareMove",title:{value:p("exitCompareMove","Exit Compare Move"),original:"Exit Compare Move"},icon:he.close,precondition:M.comparingMovedCode,f1:!1,category:Ny,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=qp(e);n instanceof zc&&n.exitCompareMove()}}Xt(lce);class dce extends aa{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:{value:p("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),original:"Collapse All Unchanged Regions"},icon:he.fold,precondition:te.has("isInDiffEditor"),f1:!0,category:Ny})}runEditorCommand(e,t,...i){const n=qp(e);n instanceof zc&&n.collapseAllUnchangedRegions()}}Xt(dce);class cce extends aa{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:{value:p("showAllUnchangedRegions","Show All Unchanged Regions"),original:"Show All Unchanged Regions"},icon:he.unfold,precondition:te.has("isInDiffEditor"),f1:!0,category:Ny})}runEditorCommand(e,t,...i){const n=qp(e);n instanceof zc&&n.showAllUnchangedRegions()}}Xt(cce);const v6={value:p("accessibleDiffViewer","Accessible Diff Viewer"),original:"Accessible Diff Viewer"};class jp extends ko{constructor(){super({id:jp.id,title:{value:p("editor.action.accessibleDiffViewer.next","Go to Next Difference"),original:"Go to Next Difference"},category:v6,precondition:te.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=qp(e);t?.accessibleDiffViewerNext()}}jp.id="editor.action.accessibleDiffViewer.next";vn.appendMenuItem(N.EditorTitle,{command:{id:jp.id,title:p("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:te.has("isInDiffEditor")},order:10,group:"2_diff",when:te.and(M.accessibleDiffViewerVisible.negate(),te.has("isInDiffEditor"))});class Hv extends ko{constructor(){super({id:Hv.id,title:{value:p("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),original:"Go to Previous Difference"},category:v6,precondition:te.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=qp(e);t?.accessibleDiffViewerPrev()}}Hv.id="editor.action.accessibleDiffViewer.prev";function qp(o){var e;const t=o.get(Dt),i=t.listDiffEditors(),n=(e=t.getFocusedCodeEditor())!==null&&e!==void 0?e:t.getActiveCodeEditor();if(!n)return null;for(let r=0,a=i.length;r<a;r++){const l=i[r];if(l.getModifiedEditor().getId()===n.getId()||l.getOriginalEditor().getId()===n.getId())return l}const s=wo();if(s)for(const r of i){const a=r.getContainerDomNode();if(hce(a,s))return r}return null}function hce(o,e){let t=e;for(;t;){if(t===o)return!0;t=t.parentElement}return!1}gt.registerCommandAlias("editor.action.diffReview.next",jp.id);Xt(jp);gt.registerCommandAlias("editor.action.diffReview.prev",Hv.id);Xt(Hv);var uce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},gce=function(o,e){return function(t,i){e(t,i,o)}},JE;const Ty=new be("selectionAnchorSet",!1);let fd=JE=class{static get(e){return e.getContribution(JE.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=Ty.bindTo(t),this.modelChangeListener=e.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}setSelectionAnchor(){if(this.editor.hasModel()){const e=this.editor.getPosition();this.editor.changeDecorations(t=>{this.decorationId&&t.removeDecoration(this.decorationId),this.decorationId=t.addDecoration(xe.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new Fn().appendText(p("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),js(p("anchorSet","Anchor set at {0}:{1}",e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){const t=this.editor.getPosition();this.editor.setSelection(xe.fromPositions(e.getStartPosition(),t)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){const e=this.decorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}};fd.ID="editor.contrib.selectionAnchorController";fd=JE=uce([gce(1,We)],fd);class fce extends we{constructor(){super({id:"editor.action.setSelectionAnchor",label:p("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:qi(2089,2080),weight:100}})}async run(e,t){var i;(i=fd.get(t))===null||i===void 0||i.setSelectionAnchor()}}class pce extends we{constructor(){super({id:"editor.action.goToSelectionAnchor",label:p("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:Ty})}async run(e,t){var i;(i=fd.get(t))===null||i===void 0||i.goToSelectionAnchor()}}class mce extends we{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:p("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:Ty,kbOpts:{kbExpr:M.editorTextFocus,primary:qi(2089,2089),weight:100}})}async run(e,t){var i;(i=fd.get(t))===null||i===void 0||i.selectFromAnchorToCursor()}}class _ce extends we{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:p("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:Ty,kbOpts:{kbExpr:M.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=fd.get(t))===null||i===void 0||i.cancelSelectionAnchor()}}yt(fd.ID,fd,4);de(fce);de(pce);de(mce);de(_ce);const vce=R("editorOverviewRuler.bracketMatchForeground",{dark:"#A0A0A0",light:"#A0A0A0",hcDark:"#A0A0A0",hcLight:"#A0A0A0"},p("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class bce extends we{constructor(){super({id:"editor.action.jumpToBracket",label:p("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=mr.get(t))===null||i===void 0||i.jumpToBracket()}}class Cce extends we{constructor(){super({id:"editor.action.selectToBracket",label:p("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:fH("smartSelect.selectToBracketDescription","Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(e,t,i){var n;let s=!0;i&&i.selectBrackets===!1&&(s=!1),(n=mr.get(t))===null||n===void 0||n.selectToBracket(s)}}class wce extends we{constructor(){super({id:"editor.action.removeBrackets",label:p("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=mr.get(t))===null||i===void 0||i.removeBrackets(this.id)}}class Sce{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}class mr extends K{static get(e){return e.getContribution(mr.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Rt(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(71),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition(t=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelContent(t=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModel(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelLanguageConfiguration(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeConfiguration(t=>{t.hasChanged(71)&&(this._matchBrackets=this._editor.getOption(71),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(e.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getSelections().map(i=>{const n=i.getStartPosition(),s=e.bracketPairs.matchBracket(n);let r=null;if(s)s[0].containsPosition(n)&&!s[1].containsPosition(n)?r=s[1].getStartPosition():s[1].containsPosition(n)&&(r=s[0].getStartPosition());else{const a=e.bracketPairs.findEnclosingBrackets(n);if(a)r=a[1].getStartPosition();else{const l=e.bracketPairs.findNextBracket(n);l&&l.range&&(r=l.range.getStartPosition())}}return r?new xe(r.lineNumber,r.column,r.lineNumber,r.column):new xe(n.lineNumber,n.column,n.lineNumber,n.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(n=>{const s=n.getStartPosition();let r=t.bracketPairs.matchBracket(s);if(!r&&(r=t.bracketPairs.findEnclosingBrackets(s),!r)){const d=t.bracketPairs.findNextBracket(s);d&&d.range&&(r=t.bracketPairs.matchBracket(d.range.getStartPosition()))}let a=null,l=null;if(r){r.sort(k.compareRangesUsingStarts);const[d,c]=r;if(a=e?d.getStartPosition():d.getEndPosition(),l=e?c.getEndPosition():c.getStartPosition(),c.containsPosition(s)){const h=a;a=l,l=h}}a&&l&&i.push(new xe(a.lineNumber,a.column,l.lineNumber,l.column))}),i.length>0&&(this._editor.setSelections(i),this._editor.revealRange(i[0]))}removeBrackets(e){if(!this._editor.hasModel())return;const t=this._editor.getModel();this._editor.getSelections().forEach(i=>{const n=i.getPosition();let s=t.bracketPairs.matchBracket(n);s||(s=t.bracketPairs.findEnclosingBrackets(n)),s&&(this._editor.pushUndoStop(),this._editor.executeEdits(e,[{range:s[0],text:""},{range:s[1],text:""}]),this._editor.pushUndoStop())})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();const e=[];let t=0;for(const i of this._lastBracketsData){const n=i.brackets;n&&(e[t++]={range:n[0],options:i.options},e[t++]={range:n[1],options:i.options})}this._decorations.set(e)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}const e=this._editor.getSelections();if(e.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}const t=this._editor.getModel(),i=t.getVersionId();let n=[];this._lastVersionId===i&&(n=this._lastBracketsData);const s=[];let r=0;for(let h=0,u=e.length;h<u;h++){const g=e[h];g.isEmpty()&&(s[r++]=g.getStartPosition())}s.length>1&&s.sort(V.compare);const a=[];let l=0,d=0;const c=n.length;for(let h=0,u=s.length;h<u;h++){const g=s[h];for(;d<c&&n[d].position.isBefore(g);)d++;if(d<c&&n[d].position.equals(g))a[l++]=n[d];else{let f=t.bracketPairs.matchBracket(g,20),m=mr._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!f&&this._matchBrackets==="always"&&(f=t.bracketPairs.findEnclosingBrackets(g,20),m=mr._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[l++]=new Sce(g,f,m)}}this._lastBracketsData=a,this._lastVersionId=i}}mr.ID="editor.contrib.bracketMatchingController";mr._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=Ze.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:fi(vce),position:Ko.Center}});mr._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=Ze.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});yt(mr.ID,mr,1);de(Cce);de(bce);de(wce);vn.appendMenuItem(N.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:p({},"Go to &&Bracket")},order:2});class yce{constructor(e,t){this._selection=e,this._isMovingLeft=t}getEditOperations(e,t){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;const i=this._selection.startLineNumber,n=this._selection.startColumn,s=this._selection.endColumn;if(!(this._isMovingLeft&&n===1)&&!(!this._isMovingLeft&&s===e.getLineMaxColumn(i)))if(this._isMovingLeft){const r=new k(i,n-1,i,n),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new k(i,s,i,s),a)}else{const r=new k(i,s,i,s+1),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new k(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new xe(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new xe(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class b6 extends we{constructor(e,t){super(t),this.left=e}run(e,t){if(!t.hasModel())return;const i=[],n=t.getSelections();for(const s of n)i.push(new yce(s,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class Lce extends b6{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:p("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:M.writable})}}class xce extends b6{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:p("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:M.writable})}}de(Lce);de(xce);class Dce extends we{constructor(){super({id:"editor.action.transposeLetters",label:p("transposeLetters.label","Transpose Letters"),alias:"Transpose Letters",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(e,t){if(!t.hasModel())return;const i=t.getModel(),n=[],s=t.getSelections();for(const r of s){if(!r.isEmpty())continue;const a=r.startLineNumber,l=r.startColumn,d=i.getLineMaxColumn(a);if(a===1&&(l===1||l===2&&d===2))continue;const c=l===d?r.getPosition():It.rightPosition(i,r.getPosition().lineNumber,r.getPosition().column),h=It.leftPosition(i,c),u=It.leftPosition(i,h),g=i.getValueInRange(k.fromPositions(u,h)),f=i.getValueInRange(k.fromPositions(h,c)),m=k.fromPositions(u,c);n.push(new kn(m,f+g))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}de(Dce);const Fu="9_cutcopypaste",kce=ol||document.queryCommandSupported("cut"),C6=ol||document.queryCommandSupported("copy"),Ice=typeof navigator.clipboard>"u"||zo?document.queryCommandSupported("paste"):!0;function fR(o){return o.register(),o}const Ece=kce?fR(new Pp({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:ol?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:N.MenubarEditMenu,group:"2_ccp",title:p({},"Cu&&t"),order:1},{menuId:N.EditorContext,group:Fu,title:p("actions.clipboard.cutLabel","Cut"),when:M.writable,order:1},{menuId:N.CommandPalette,group:"",title:p("actions.clipboard.cutLabel","Cut"),order:1},{menuId:N.SimpleEditorContext,group:Fu,title:p("actions.clipboard.cutLabel","Cut"),when:M.writable,order:1}]})):void 0,Nce=C6?fR(new Pp({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:ol?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:N.MenubarEditMenu,group:"2_ccp",title:p({},"&&Copy"),order:2},{menuId:N.EditorContext,group:Fu,title:p("actions.clipboard.copyLabel","Copy"),order:2},{menuId:N.CommandPalette,group:"",title:p("actions.clipboard.copyLabel","Copy"),order:1},{menuId:N.SimpleEditorContext,group:Fu,title:p("actions.clipboard.copyLabel","Copy"),order:2}]})):void 0;vn.appendMenuItem(N.MenubarEditMenu,{submenu:N.MenubarCopy,title:{value:p("copy as","Copy As"),original:"Copy As"},group:"2_ccp",order:3});vn.appendMenuItem(N.EditorContext,{submenu:N.EditorContextCopy,title:{value:p("copy as","Copy As"),original:"Copy As"},group:Fu,order:3});vn.appendMenuItem(N.EditorContext,{submenu:N.EditorContextShare,title:{value:p("share","Share"),original:"Share"},group:"11_share",order:-1,when:te.and(te.notEquals("resourceScheme","output"),M.editorTextFocus)});vn.appendMenuItem(N.EditorTitleContext,{submenu:N.EditorTitleContextShare,title:{value:p("share","Share"),original:"Share"},group:"11_share",order:-1});vn.appendMenuItem(N.ExplorerContext,{submenu:N.ExplorerContextShare,title:{value:p("share","Share"),original:"Share"},group:"11_share",order:-1});const nD=Ice?fR(new Pp({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:ol?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:N.MenubarEditMenu,group:"2_ccp",title:p({},"&&Paste"),order:4},{menuId:N.EditorContext,group:Fu,title:p("actions.clipboard.pasteLabel","Paste"),when:M.writable,order:4},{menuId:N.CommandPalette,group:"",title:p("actions.clipboard.pasteLabel","Paste"),order:1},{menuId:N.SimpleEditorContext,group:Fu,title:p("actions.clipboard.pasteLabel","Paste"),when:M.writable,order:4}]})):void 0;class Tce extends we{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:p("actions.clipboard.copyWithSyntaxHighlightingLabel","Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,weight:100}})}run(e,t){!t.hasModel()||!t.getOption(37)&&t.getSelection().isEmpty()||(sI.forceCopyWithSyntaxHighlighting=!0,t.focus(),t.getContainerDomNode().ownerDocument.execCommand("copy"),sI.forceCopyWithSyntaxHighlighting=!1)}}function w6(o,e){o&&(o.addImplementation(1e4,"code-editor",(t,i)=>{const n=t.get(Dt).getFocusedCodeEditor();if(n&&n.hasTextFocus()){const s=n.getOption(37),r=n.getSelection();return r&&r.isEmpty()&&!s||n.getContainerDomNode().ownerDocument.execCommand(e),!0}return!1}),o.addImplementation(0,"generic-dom",(t,i)=>(Ap().execCommand(e),!0)))}w6(Ece,"cut");w6(Nce,"copy");nD&&(nD.addImplementation(1e4,"code-editor",(o,e)=>{const t=o.get(Dt),i=o.get(Sd),n=t.getFocusedCodeEditor();return n&&n.hasTextFocus()?!n.getContainerDomNode().ownerDocument.execCommand("paste")&&th?(async()=>{const r=await i.readText();if(r!==""){const a=a0.INSTANCE.get(r);let l=!1,d=null,c=null;a&&(l=n.getOption(37)&&!!a.isFromEmptySelection,d=typeof a.multicursorText<"u"?a.multicursorText:null,c=a.mode),n.trigger("keyboard","paste",{text:r,pasteOnNewLine:l,multicursorText:d,mode:c})}})():!0:!1}),nD.addImplementation(0,"generic-dom",(o,e)=>(Ap().execCommand("paste"),!0)));C6&&de(Tce);class Be{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+Be.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(e){return new Be(this.value+Be.sep+e)}}Be.sep=".";Be.None=new Be("@@none@@");Be.Empty=new Be("");Be.QuickFix=new Be("quickfix");Be.Refactor=new Be("refactor");Be.RefactorExtract=Be.Refactor.append("extract");Be.RefactorInline=Be.Refactor.append("inline");Be.RefactorMove=Be.Refactor.append("move");Be.RefactorRewrite=Be.Refactor.append("rewrite");Be.Notebook=new Be("notebook");Be.Source=new Be("source");Be.SourceOrganizeImports=Be.Source.append("organizeImports");Be.SourceFixAll=Be.Source.append("fixAll");Be.SurroundWith=Be.Refactor.append("surround");var qs;(function(o){o.Refactor="refactor",o.RefactorPreview="refactor preview",o.Lightbulb="lightbulb",o.Default="other (default)",o.SourceAction="source action",o.QuickFix="quick fix action",o.FixAll="fix all",o.OrganizeImports="organize imports",o.AutoFix="auto fix",o.QuickFixHover="quick fix hover window",o.OnSave="save participants",o.ProblemsView="problems view"})(qs||(qs={}));function Mce(o,e){return!(o.include&&!o.include.intersects(e)||o.excludes&&o.excludes.some(t=>S6(e,t,o.include))||!o.includeSourceActions&&Be.Source.contains(e))}function Rce(o,e){const t=e.kind?new Be(e.kind):void 0;return!(o.include&&(!t||!o.include.contains(t))||o.excludes&&t&&o.excludes.some(i=>S6(t,i,o.include))||!o.includeSourceActions&&t&&Be.Source.contains(t)||o.onlyIncludePreferredActions&&!e.isPreferred)}function S6(o,e,t){return!(!e.contains(o)||t&&e.contains(t))}class Va{static fromUser(e,t){return!e||typeof e!="object"?new Va(t.kind,t.apply,!1):new Va(Va.getKindFromUser(e,t.kind),Va.getApplyFromUser(e,t.apply),Va.getPreferredUser(e))}static getApplyFromUser(e,t){switch(typeof e.apply=="string"?e.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return t}}static getKindFromUser(e,t){return typeof e.kind=="string"?new Be(e.kind):t}static getPreferredUser(e){return typeof e.preferred=="boolean"?e.preferred:!1}constructor(e,t,i){this.kind=e,this.apply=t,this.preferred=i}}class Ace{constructor(e,t,i){this.action=e,this.provider=t,this.highlightRange=i}async resolve(e){var t;if(!((t=this.provider)===null||t===void 0)&&t.resolveCodeAction&&!this.action.edit){let i;try{i=await this.provider.resolveCodeAction(this.action,e)}catch(n){Mi(n)}i&&(this.action.edit=i.edit)}return this}}const y6="editor.action.codeAction",pR="editor.action.quickFix",L6="editor.action.autoFix",x6="editor.action.refactor",D6="editor.action.sourceAction",mR="editor.action.organizeImports",_R="editor.action.fixAll";class y_ extends K{static codeActionsPreferredComparator(e,t){return e.isPreferred&&!t.isPreferred?-1:!e.isPreferred&&t.isPreferred?1:0}static codeActionsComparator({action:e},{action:t}){return e.isAI&&!t.isAI?1:!e.isAI&&t.isAI?-1:Bn(e.diagnostics)?Bn(t.diagnostics)?y_.codeActionsPreferredComparator(e,t):-1:Bn(t.diagnostics)?1:y_.codeActionsPreferredComparator(e,t)}constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(y_.codeActionsComparator),this.validActions=this.allActions.filter(({action:n})=>!n.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&Be.QuickFix.contains(new Be(e.kind))&&!!e.isPreferred)}get hasAIFix(){return this.validActions.some(({action:e})=>!!e.isAI)}get allAIFixes(){return this.validActions.every(({action:e})=>!!e.isAI)}}const KF={actions:[],documentation:void 0};async function L_(o,e,t,i,n,s){var r;const a=i.filter||{},l={...a,excludes:[...a.excludes||[],Be.Notebook]},d={only:(r=a.include)===null||r===void 0?void 0:r.value,trigger:i.type},c=new gR(e,s),h=i.type===2,u=Pce(o,e,h?l:a),g=new se,f=u.map(async _=>{try{n.report(_);const v=await _.provideCodeActions(e,t,d,c.token);if(v&&g.add(v),c.token.isCancellationRequested)return KF;const b=(v?.actions||[]).filter(w=>w&&Rce(a,w)),C=Fce(_,b,a.include);return{actions:b.map(w=>new Ace(w,_)),documentation:C}}catch(v){if(oa(v))throw v;return Mi(v),KF}}),m=o.onDidChange(()=>{const _=o.all(e);_i(_,u)||c.cancel()});try{const _=await Promise.all(f),v=_.map(C=>C.actions).flat(),b=[...Qr(_.map(C=>C.documentation)),...Oce(o,e,i,v)];return new y_(v,b,g)}finally{m.dispose(),c.dispose()}}function Pce(o,e,t){return o.all(e).filter(i=>i.providedCodeActionKinds?i.providedCodeActionKinds.some(n=>Mce(t,new Be(n))):!0)}function*Oce(o,e,t,i){var n,s,r;if(e&&i.length)for(const a of o.all(e))a._getAdditionalMenuItems&&(yield*(n=a._getAdditionalMenuItems)===null||n===void 0?void 0:n.call(a,{trigger:t.type,only:(r=(s=t.filter)===null||s===void 0?void 0:s.include)===null||r===void 0?void 0:r.value},i.map(l=>l.action)))}function Fce(o,e,t){if(!o.documentation)return;const i=o.documentation.map(n=>({kind:new Be(n.kind),command:n.command}));if(t){let n;for(const s of i)s.kind.contains(t)&&(n?n.kind.contains(s.kind)&&(n=s):n=s);if(n)return n?.command}for(const n of e)if(n.kind){for(const s of i)if(s.kind.contains(new Be(n.kind)))return s.command}}var Bw;(function(o){o.OnSave="onSave",o.FromProblemsView="fromProblemsView",o.FromCodeActions="fromCodeActions"})(Bw||(Bw={}));async function Bce(o,e,t,i,n=st.None){var s;const r=o.get(kv),a=o.get(ui),l=o.get(Gs),d=o.get(Vi);if(l.publicLog2("codeAction.applyCodeAction",{codeActionTitle:e.action.title,codeActionKind:e.action.kind,codeActionIsPreferred:!!e.action.isPreferred,reason:t}),await e.resolve(n),!n.isCancellationRequested&&!(!((s=e.action.edit)===null||s===void 0)&&s.edits.length&&!(await r.apply(e.action.edit,{editor:i?.editor,label:e.action.title,quotableLabel:e.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:t!==Bw.OnSave,showPreview:i?.preview})).isApplied)&&e.action.command)try{await a.executeCommand(e.action.command.id,...e.action.command.arguments||[])}catch(c){const h=Wce(c);d.error(typeof h=="string"?h:p("applyCodeActionFailed","An unknown error occurred while applying the code action"))}}function Wce(o){return typeof o=="string"?o:o instanceof Error&&typeof o.message=="string"?o.message:void 0}gt.registerCommand("_executeCodeActionProvider",async function(o,e,t,i,n){if(!(e instanceof Me))throw Wo();const{codeActionProvider:s}=o.get(Se),r=o.get(ii).getModel(e);if(!r)throw Wo();const a=xe.isISelection(t)?xe.liftSelection(t):k.isIRange(t)?r.validateRange(t):void 0;if(!a)throw Wo();const l=typeof i=="string"?new Be(i):void 0,d=await L_(s,r,a,{type:1,triggerAction:qs.Default,filter:{includeSourceActions:!0,include:l}},ld.None,st.None),c=[],h=Math.min(d.validActions.length,typeof n=="number"?n:0);for(let u=0;u<h;u++)c.push(d.validActions[u].resolve(st.None));try{return await Promise.all(c),d.validActions.map(u=>u.action)}finally{setTimeout(()=>d.dispose(),100)}});var Vce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Hce=function(o,e){return function(t,i){e(t,i,o)}},eN;let Ww=eN=class{constructor(e){this.keybindingService=e}getResolver(){const e=new sh(()=>this.keybindingService.getKeybindings().filter(t=>eN.codeActionCommands.indexOf(t.command)>=0).filter(t=>t.resolvedKeybinding).map(t=>{let i=t.commandArgs;return t.command===mR?i={kind:Be.SourceOrganizeImports.value}:t.command===_R&&(i={kind:Be.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...Va.fromUser(i,{kind:Be.None,apply:"never"})}}));return t=>{if(t.kind){const i=this.bestKeybindingForCodeAction(t,e.value);return i?.resolvedKeybinding}}}bestKeybindingForCodeAction(e,t){if(!e.kind)return;const i=new Be(e.kind);return t.filter(n=>n.kind.contains(i)).filter(n=>n.preferred?e.isPreferred:!0).reduceRight((n,s)=>n?n.kind.contains(s.kind)?s:n:s,void 0)}};Ww.codeActionCommands=[x6,y6,D6,mR,_R];Ww=eN=Vce([Hce(0,Pt)],Ww);R("symbolIcon.arrayForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.arrayForeground","The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.booleanForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.booleanForeground","The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},p("symbolIcon.classForeground","The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.colorForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.colorForeground","The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.constantForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.constantForeground","The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},p("symbolIcon.constructorForeground","The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},p("symbolIcon.enumeratorForeground","The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p("symbolIcon.enumeratorMemberForeground","The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},p("symbolIcon.eventForeground","The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p("symbolIcon.fieldForeground","The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.fileForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.fileForeground","The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.folderForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.folderForeground","The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},p("symbolIcon.functionForeground","The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p("symbolIcon.interfaceForeground","The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.keyForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.keyForeground","The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.keywordForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.keywordForeground","The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},p("symbolIcon.methodForeground","The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.moduleForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.moduleForeground","The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.namespaceForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.namespaceForeground","The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.nullForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.nullForeground","The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.numberForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.numberForeground","The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.objectForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.objectForeground","The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.operatorForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.operatorForeground","The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.packageForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.packageForeground","The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.propertyForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.propertyForeground","The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.referenceForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.referenceForeground","The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.snippetForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.snippetForeground","The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.stringForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.stringForeground","The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.structForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.structForeground","The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.textForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.textForeground","The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.typeParameterForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.typeParameterForeground","The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.unitForeground",{dark:le,light:le,hcDark:le,hcLight:le},p("symbolIcon.unitForeground","The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));R("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p("symbolIcon.variableForeground","The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const k6=Object.freeze({kind:Be.Empty,title:p("codeAction.widget.id.more","More Actions...")}),zce=Object.freeze([{kind:Be.QuickFix,title:p("codeAction.widget.id.quickfix","Quick Fix")},{kind:Be.RefactorExtract,title:p("codeAction.widget.id.extract","Extract"),icon:he.wrench},{kind:Be.RefactorInline,title:p("codeAction.widget.id.inline","Inline"),icon:he.wrench},{kind:Be.RefactorRewrite,title:p("codeAction.widget.id.convert","Rewrite"),icon:he.wrench},{kind:Be.RefactorMove,title:p("codeAction.widget.id.move","Move"),icon:he.wrench},{kind:Be.SurroundWith,title:p("codeAction.widget.id.surround","Surround With"),icon:he.symbolSnippet},{kind:Be.Source,title:p("codeAction.widget.id.source","Source Action"),icon:he.symbolFile},k6]);function Uce(o,e,t){if(!e)return o.map(s=>{var r;return{kind:"action",item:s,group:k6,disabled:!!s.action.disabled,label:s.action.disabled||s.action.title,canPreview:!!(!((r=s.action.edit)===null||r===void 0)&&r.edits.length)}});const i=zce.map(s=>({group:s,actions:[]}));for(const s of o){const r=s.action.kind?new Be(s.action.kind):Be.None;for(const a of i)if(a.group.kind.contains(r)){a.actions.push(s);break}}const n=[];for(const s of i)if(s.actions.length){n.push({kind:"header",group:s.group});for(const r of s.actions){const a=s.group;n.push({kind:"action",item:r,group:r.action.isAI?{title:a.title,kind:a.kind,icon:he.sparkle}:a,label:r.action.title,disabled:!!r.action.disabled,keybinding:t(r.action)})}}return n}var $ce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jF=function(o,e){return function(t,i){e(t,i,o)}},tN,uf;(function(o){o.Hidden={type:0};class e{constructor(i,n,s,r){this.actions=i,this.trigger=n,this.editorPosition=s,this.widgetPosition=r,this.type=1}}o.Showing=e})(uf||(uf={}));let Bu=tN=class extends K{constructor(e,t,i){super(),this._editor=e,this._keybindingService=t,this._onClick=this._register(new W),this.onClick=this._onClick.event,this._state=uf.Hidden,this._iconClasses=[],this._domNode=pe("div.lightBulbWidget"),this._register(Ot.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent(n=>{const s=this._editor.getModel();(this.state.type!==1||!s||this.state.editorPosition.lineNumber>=s.getLineCount())&&this.hide()})),this._register(F$(this._domNode,n=>{var s;if(this.state.type!==1)return;const r=this._editor.getOption(64).experimental.showAiIcon;if((r===As.On||r===As.OnCode)&&this.state.actions.allAIFixes&&this.state.actions.validActions.length===1){const h=this.state.actions.validActions[0].action;if(!((s=h.command)===null||s===void 0)&&s.id){i.executeCommand(h.command.id,...h.command.arguments||[]),n.preventDefault();return}}this._editor.focus(),n.preventDefault();const{top:a,height:l}=ji(this._domNode),d=this._editor.getOption(66);let c=Math.floor(d/3);this.state.widgetPosition.position!==null&&this.state.widgetPosition.position.lineNumber<this.state.editorPosition.lineNumber&&(c+=d),this._onClick.fire({x:n.posx,y:a+l+c,actions:this.state.actions,trigger:this.state.trigger})})),this._register(Q(this._domNode,"mouseenter",n=>{(n.buttons&1)===1&&this.hide()})),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(64)&&(this._editor.getOption(64).enabled||this.hide(),this._updateLightBulbTitleAndIcon())})),this._register(fe.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{var n,s,r,a;this._preferredKbLabel=(s=(n=this._keybindingService.lookupKeybinding(L6))===null||n===void 0?void 0:n.getLabel())!==null&&s!==void 0?s:void 0,this._quickFixKbLabel=(a=(r=this._keybindingService.lookupKeybinding(pR))===null||r===void 0?void 0:r.getLabel())!==null&&a!==void 0?a:void 0,this._updateLightBulbTitleAndIcon()}))}dispose(){super.dispose(),this._editor.removeContentWidget(this)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){return this._state.type===1?this._state.widgetPosition:null}update(e,t,i){if(e.validActions.length<=0)return this.hide();const n=this._editor.getOptions();if(!n.get(64).enabled)return this.hide();const s=this._editor.getModel();if(!s)return this.hide();const{lineNumber:r,column:a}=s.validatePosition(i),l=s.getOptions().tabSize,d=n.get(50),c=s.getLineContent(r),h=YS(c,l),u=d.spaceWidth*h>22,g=m=>m>2&&this._editor.getTopForLineNumber(m)===this._editor.getTopForLineNumber(m-1);let f=r;if(!u){if(r>1&&!g(r-1))f-=1;else if(!g(r+1))f+=1;else if(a*d.spaceWidth<22)return this.hide()}this.state=new uf.Showing(e,t,i,{position:{lineNumber:f,column:s.getLineContent(f).match(/^\S\s*$/)?2:1},preference:tN._posPref}),this._editor.layoutContentWidget(this)}hide(){this.state!==uf.Hidden&&(this.state=uf.Hidden,this._editor.layoutContentWidget(this))}get state(){return this._state}set state(e){this._state=e,this._updateLightBulbTitleAndIcon()}_updateLightBulbTitleAndIcon(){var e,t,i;if(this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],this.state.type!==1)return;const n=()=>{this._preferredKbLabel&&(this.title=p("preferredcodeActionWithKb","Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel))},s=()=>{this._quickFixKbLabel?this.title=p("codeActionWithKb","Show Code Actions ({0})",this._quickFixKbLabel):this.title=p("codeAction","Show Code Actions")};let r;const a=this._editor.getOption(64).experimental.showAiIcon;if(a===As.On||a===As.OnCode)if(a===As.On&&this.state.actions.allAIFixes)if(r=he.sparkleFilled,this.state.actions.allAIFixes&&this.state.actions.validActions.length===1)if(((e=this.state.actions.validActions[0].action.command)===null||e===void 0?void 0:e.id)==="inlineChat.start"){const l=(i=(t=this._keybindingService.lookupKeybinding("inlineChat.start"))===null||t===void 0?void 0:t.getLabel())!==null&&i!==void 0?i:void 0;this.title=l?p("codeActionStartInlineChatWithKb","Start Inline Chat ({0})",l):p("codeActionStartInlineChat","Start Inline Chat")}else this.title=p("codeActionTriggerAiAction","Trigger AI Action");else s();else this.state.actions.hasAutoFix?(this.state.actions.hasAIFix?r=he.lightbulbSparkleAutofix:r=he.lightbulbAutofix,n()):this.state.actions.hasAIFix?(r=he.lightbulbSparkle,s()):(r=he.lightBulb,s());else this.state.actions.hasAutoFix?(r=he.lightbulbAutofix,n()):(r=he.lightBulb,s());this._iconClasses=Re.asClassNameArray(r),this._domNode.classList.add(...this._iconClasses)}set title(e){this._domNode.title=e}};Bu.ID="editor.contrib.lightbulbWidget";Bu._posPref=[0];Bu=tN=$ce([jF(1,Pt),jF(2,ui)],Bu);var Kce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},qF=function(o,e){return function(t,i){e(t,i,o)}},iN;let pd=iN=class{constructor(e,t,i){this._options=e,this._languageService=t,this._openerService=i,this._onDidRenderAsync=new W,this.onDidRenderAsync=this._onDidRenderAsync.event}dispose(){this._onDidRenderAsync.dispose()}render(e,t,i){if(!e)return{element:document.createElement("span"),dispose:()=>{}};const n=new se,s=n.add(ly(e,{...this._getRenderOptions(e,n),...t},i));return s.element.classList.add("rendered-markdown"),{element:s.element,dispose:()=>n.dispose()}}_getRenderOptions(e,t){return{codeBlockRenderer:async(i,n)=>{var s,r,a;let l;i?l=this._languageService.getLanguageIdByLanguageName(i):this._options.editor&&(l=(s=this._options.editor.getModel())===null||s===void 0?void 0:s.getLanguageId()),l||(l=So);const d=await ree(this._languageService,n,l),c=document.createElement("span");if(c.innerHTML=(a=(r=iN._ttpTokenizer)===null||r===void 0?void 0:r.createHTML(d))!==null&&a!==void 0?a:d,this._options.editor){const h=this._options.editor.getOption(50);Tn(c,h)}else this._options.codeBlockFontFamily&&(c.style.fontFamily=this._options.codeBlockFontFamily);return this._options.codeBlockFontSize!==void 0&&(c.style.fontSize=this._options.codeBlockFontSize),c},asyncRenderCallback:()=>this._onDidRenderAsync.fire(),actionHandler:{callback:i=>I6(this._openerService,i,e.isTrusted),disposables:t}}}};pd._ttpTokenizer=vd("tokenizeToString",{createHTML(o){return o}});pd=iN=Kce([qF(1,ni),qF(2,Qs)],pd);async function I6(o,e,t){try{return await o.open(e,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:jce(t)})}catch(i){return Ge(i),!1}}function jce(o){return o===!0?!0:o&&Array.isArray(o.enabledCommands)?o.enabledCommands:!1}var qce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},GF=function(o,e){return function(t,i){e(t,i,o)}},YC;let zs=YC=class{static get(e){return e.getContribution(YC.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new Cn,this._messageListeners=new se,this._mouseOverMessage=!1,this._editor=e,this._visible=YC.MESSAGE_VISIBLE.bindTo(t)}dispose(){var e;(e=this._message)===null||e===void 0||e.dispose(),this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(e,t){js(_c(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=_c(e)?ly(e,{actionHandler:{callback:n=>I6(this._openerService,n,_c(e)?e.isTrusted:void 0),disposables:this._messageListeners}}):void 0,this._messageWidget.value=new ZF(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(fe.debounce(this._editor.onDidBlurEditorText,(n,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&Nn(wo(),this._messageWidget.value.getDomNode())||this.closeMessage()})),this._messageListeners.add(this._editor.onDidChangeCursorPosition(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidDispose(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidChangeModel(()=>this.closeMessage())),this._messageListeners.add(Q(this._messageWidget.value.getDomNode(),ge.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(Q(this._messageWidget.value.getDomNode(),ge.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let i;this._messageListeners.add(this._editor.onMouseMove(n=>{n.target.position&&(i?i.containsPosition(n.target.position)||this.closeMessage():i=new k(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(ZF.fadeOut(this._messageWidget.value))}};zs.ID="editor.contrib.messageController";zs.MESSAGE_VISIBLE=new be("messageVisible",!1,p("messageVisible","Whether the editor is currently showing an inline message"));zs=YC=qce([GF(1,We),GF(2,Qs)],zs);const Gce=cn.bindToContribution(zs.get);ue(new Gce({id:"leaveEditorMessage",precondition:zs.MESSAGE_VISIBLE,handler:o=>o.closeMessage(),kbOpts:{weight:130,primary:9}}));let ZF=class{static fadeOut(e){const t=()=>{e.dispose(),clearTimeout(i),e.getDomNode().removeEventListener("animationend",t)},i=setTimeout(t,110);return e.getDomNode().addEventListener("animationend",t),e.getDomNode().classList.add("fadeOut"),{dispose:t}}constructor(e,{lineNumber:t,column:i},n){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=e,this._editor.revealLinesInCenterIfOutsideViewport(t,t,0),this._position={lineNumber:t,column:i},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";const s=document.createElement("div");s.classList.add("anchor","top"),this._domNode.appendChild(s);const r=document.createElement("div");typeof n=="string"?(r.classList.add("message"),r.textContent=n):(n.classList.add("message"),r.appendChild(n)),this._domNode.appendChild(r);const a=document.createElement("div");a.classList.add("anchor","below"),this._domNode.appendChild(a),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(e){this._domNode.classList.toggle("below",e===2)}};yt(zs.ID,zs,4);var E6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nN=function(o,e){return function(t,i){e(t,i,o)}};const N6="acceptSelectedCodeAction",T6="previewSelectedCodeAction";class Zce{get templateId(){return"header"}renderTemplate(e){e.classList.add("group-header");const t=document.createElement("span");return e.append(t),{container:e,text:t}}renderElement(e,t,i){var n,s;i.text.textContent=(s=(n=e.group)===null||n===void 0?void 0:n.title)!==null&&s!==void 0?s:""}disposeTemplate(e){}}let sN=class{get templateId(){return"action"}constructor(e,t){this._supportsPreview=e,this._keybindingService=t}renderTemplate(e){e.classList.add(this.templateId);const t=document.createElement("div");t.className="icon",e.append(t);const i=document.createElement("span");i.className="title",e.append(i);const n=new Mv(e,mo);return{container:e,icon:t,text:i,keybinding:n}}renderElement(e,t,i){var n,s,r;if(!((n=e.group)===null||n===void 0)&&n.icon?(i.icon.className=Re.asClassName(e.group.icon),e.group.icon.color&&(i.icon.style.color=Ce(e.group.icon.color.id))):(i.icon.className=Re.asClassName(he.lightBulb),i.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!e.item||!e.label)return;i.text.textContent=M6(e.label),i.keybinding.set(e.keybinding),J$(!!e.keybinding,i.keybinding.element);const a=(s=this._keybindingService.lookupKeybinding(N6))===null||s===void 0?void 0:s.getLabel(),l=(r=this._keybindingService.lookupKeybinding(T6))===null||r===void 0?void 0:r.getLabel();i.container.classList.toggle("option-disabled",e.disabled),e.disabled?i.container.title=e.label:a&&l?this._supportsPreview&&e.canPreview?i.container.title=p({},"{0} to apply, {1} to preview",a,l):i.container.title=p({},"{0} to apply",a):i.container.title=""}disposeTemplate(e){}};sN=E6([nN(1,Pt)],sN);class Yce extends UIEvent{constructor(){super("acceptSelectedAction")}}class YF extends UIEvent{constructor(){super("previewSelectedAction")}}function Xce(o){if(o.kind==="action")return o.label}let oN=class extends K{constructor(e,t,i,n,s,r){super(),this._delegate=n,this._contextViewService=s,this._keybindingService=r,this._actionLineHeight=24,this._headerLineHeight=26,this.cts=this._register(new Wi),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList");const a={getHeight:l=>l.kind==="header"?this._headerLineHeight:this._actionLineHeight,getTemplateId:l=>l.kind};this._list=this._register(new yr(e,this.domNode,a,[new sN(t,this._keybindingService),new Zce],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:Xce},accessibilityProvider:{getAriaLabel:l=>{if(l.kind==="action"){let d=l.label?M6(l?.label):"";return l.disabled&&(d=p({},"{0}, Disabled Reason: {1}",d,l.disabled)),d}return null},getWidgetAriaLabel:()=>p({},"Action Widget"),getRole:l=>l.kind==="action"?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(sg),this._register(this._list.onMouseClick(l=>this.onListClick(l))),this._register(this._list.onMouseOver(l=>this.onListHover(l))),this._register(this._list.onDidChangeFocus(()=>this.onFocus())),this._register(this._list.onDidChangeSelection(l=>this.onListSelection(l))),this._allMenuItems=i,this._list.splice(0,this._list.length,this._allMenuItems),this._list.length&&this.focusNext()}focusCondition(e){return!e.disabled&&e.kind==="action"}hide(e){this._delegate.onHide(e),this.cts.cancel(),this._contextViewService.hideContextView()}layout(e){const t=this._allMenuItems.filter(l=>l.kind==="header").length,n=this._allMenuItems.length*this._actionLineHeight+t*this._headerLineHeight-t*this._actionLineHeight;this._list.layout(n);let s=e;if(this._allMenuItems.length>=50)s=380;else{const l=this._allMenuItems.map((d,c)=>{const h=this.domNode.ownerDocument.getElementById(this._list.getElementID(c));if(h){h.style.width="auto";const u=h.getBoundingClientRect().width;return h.style.width="",u}return 0});s=Math.max(...l,e)}const a=Math.min(n,this.domNode.ownerDocument.body.clientHeight*.7);return this._list.layout(a,s),this.domNode.style.height=`${a}px`,this._list.domFocus(),s}focusPrevious(){this._list.focusPrevious(1,!0,void 0,this.focusCondition)}focusNext(){this._list.focusNext(1,!0,void 0,this.focusCondition)}acceptSelected(e){const t=this._list.getFocus();if(t.length===0)return;const i=t[0],n=this._list.element(i);if(!this.focusCondition(n))return;const s=e?new YF:new Yce;this._list.setSelection([i],s)}onListSelection(e){if(!e.elements.length)return;const t=e.elements[0];t.item&&this.focusCondition(t)?this._delegate.onSelect(t.item,e.browserEvent instanceof YF):this._list.setSelection([])}onFocus(){var e,t;this._list.domFocus();const i=this._list.getFocus();if(i.length===0)return;const n=i[0],s=this._list.element(n);(t=(e=this._delegate).onFocus)===null||t===void 0||t.call(e,s.item)}async onListHover(e){const t=e.element;if(t&&t.item&&this.focusCondition(t)){if(this._delegate.onHover&&!t.disabled&&t.kind==="action"){const i=await this._delegate.onHover(t.item,this.cts.token);t.canPreview=i?i.canPreview:void 0}e.index&&this._list.splice(e.index,1,[t])}this._list.setFocus(typeof e.index=="number"?[e.index]:[])}onListClick(e){e.element&&this.focusCondition(e.element)&&this._list.setFocus([])}};oN=E6([nN(4,bd),nN(5,Pt)],oN);function M6(o){return o.replace(/\r\n|\r|\n/g," ")}var Qce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},sD=function(o,e){return function(t,i){e(t,i,o)}};R("actionBar.toggledBackground",{dark:Qh,light:Qh,hcDark:Qh,hcLight:Qh},p("actionBar.toggledBackground","Background color for toggled action items in action bar."));const Wu={Visible:new be("codeActionMenuVisible",!1,p("codeActionMenuVisible","Whether the action widget list is visible"))},lg=ot("actionWidgetService");let Vu=class extends K{get isVisible(){return Wu.Visible.getValue(this._contextKeyService)||!1}constructor(e,t,i){super(),this._contextViewService=e,this._contextKeyService=t,this._instantiationService=i,this._list=this._register(new Cn)}show(e,t,i,n,s,r,a){const l=Wu.Visible.bindTo(this._contextKeyService),d=this._instantiationService.createInstance(oN,e,t,i,n);this._contextViewService.showContextView({getAnchor:()=>s,render:c=>(l.set(!0),this._renderWidget(c,d,a??[])),onHide:c=>{l.reset(),this._onWidgetClosed(c)}},r,!1)}acceptSelected(e){var t;(t=this._list.value)===null||t===void 0||t.acceptSelected(e)}focusPrevious(){var e,t;(t=(e=this._list)===null||e===void 0?void 0:e.value)===null||t===void 0||t.focusPrevious()}focusNext(){var e,t;(t=(e=this._list)===null||e===void 0?void 0:e.value)===null||t===void 0||t.focusNext()}hide(){var e;(e=this._list.value)===null||e===void 0||e.hide(),this._list.clear()}_renderWidget(e,t,i){var n;const s=document.createElement("div");if(s.classList.add("action-widget"),e.appendChild(s),this._list.value=t,this._list.value)s.appendChild(this._list.value.domNode);else throw new Error("List has no value");const r=new se,a=document.createElement("div"),l=e.appendChild(a);l.classList.add("context-view-block"),r.add(Q(l,ge.MOUSE_DOWN,f=>f.stopPropagation()));const d=document.createElement("div"),c=e.appendChild(d);c.classList.add("context-view-pointerBlock"),r.add(Q(c,ge.POINTER_MOVE,()=>c.remove())),r.add(Q(c,ge.MOUSE_DOWN,()=>c.remove()));let h=0;if(i.length){const f=this._createActionBar(".action-widget-action-bar",i);f&&(s.appendChild(f.getContainer().parentElement),r.add(f),h=f.getContainer().offsetWidth)}const u=(n=this._list.value)===null||n===void 0?void 0:n.layout(h);s.style.width=`${u}px`;const g=r.add(dl(e));return r.add(g.onDidBlur(()=>this.hide())),r}_createActionBar(e,t){if(!t.length)return;const i=pe(e),n=new Go(i);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){var t;(t=this._list.value)===null||t===void 0||t.hide(e)}};Vu=Qce([sD(0,bd),sD(1,We),sD(2,Oe)],Vu);ct(lg,Vu,1);const zv=1100;Xt(class extends ko{constructor(){super({id:"hideCodeActionWidget",title:{value:p("hideCodeActionWidget.title","Hide action widget"),original:"Hide action widget"},precondition:Wu.Visible,keybinding:{weight:zv,primary:9,secondary:[1033]}})}run(o){o.get(lg).hide()}});Xt(class extends ko{constructor(){super({id:"selectPrevCodeAction",title:{value:p("selectPrevCodeAction.title","Select previous action"),original:"Select previous action"},precondition:Wu.Visible,keybinding:{weight:zv,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(o){const e=o.get(lg);e instanceof Vu&&e.focusPrevious()}});Xt(class extends ko{constructor(){super({id:"selectNextCodeAction",title:{value:p("selectNextCodeAction.title","Select next action"),original:"Select next action"},precondition:Wu.Visible,keybinding:{weight:zv,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(o){const e=o.get(lg);e instanceof Vu&&e.focusNext()}});Xt(class extends ko{constructor(){super({id:N6,title:{value:p("acceptSelected.title","Accept selected action"),original:"Accept selected action"},precondition:Wu.Visible,keybinding:{weight:zv,primary:3,secondary:[2137]}})}run(o){const e=o.get(lg);e instanceof Vu&&e.acceptSelected()}});Xt(class extends ko{constructor(){super({id:T6,title:{value:p("previewSelected.title","Preview selected action"),original:"Preview selected action"},precondition:Wu.Visible,keybinding:{weight:zv,primary:2051}})}run(o){const e=o.get(lg);e instanceof Vu&&e.acceptSelected(!0)}});const R6=new be("supportedCodeAction","");class Jce extends K{constructor(e,t,i,n=250){super(),this._editor=e,this._markerService=t,this._signalChange=i,this._delay=n,this._autoTriggerTimer=this._register(new Cr),this._register(this._markerService.onMarkerChanged(s=>this._onMarkerChanges(s))),this._register(this._editor.onDidChangeCursorPosition(()=>this._tryAutoTrigger()))}trigger(e){const t=this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);this._signalChange(t?{trigger:e,selection:t}:void 0)}_onMarkerChanges(e){const t=this._editor.getModel();t&&e.some(i=>J2(i,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:qs.Default})},this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(e){var t;if(!this._editor.hasModel())return;const i=this._editor.getModel(),n=this._editor.getSelection();if(n.isEmpty()&&e.type===2){const{lineNumber:s,column:r}=n.getPosition(),a=i.getLineContent(s);if(a.length===0){if(!(((t=this._editor.getOption(64).experimental)===null||t===void 0?void 0:t.showAiIcon)===As.On))return}else if(r===1){if(/\s/.test(a[0]))return}else if(r===i.getLineMaxColumn(s)){if(/\s/.test(a[a.length-1]))return}else if(/\s/.test(a[r-2])&&/\s/.test(a[r-1]))return}return n}}var Gh;(function(o){o.Empty={type:0};class e{constructor(i,n,s){this.trigger=i,this.position=n,this._cancellablePromise=s,this.type=1,this.actions=s.catch(r=>{if(oa(r))return A6;throw r})}cancel(){this._cancellablePromise.cancel()}}o.Triggered=e})(Gh||(Gh={}));const A6=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class ehe extends K{constructor(e,t,i,n,s,r){super(),this._editor=e,this._registry=t,this._markerService=i,this._progressService=s,this._configurationService=r,this._codeActionOracle=this._register(new Cn),this._state=Gh.Empty,this._onDidChangeState=this._register(new W),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=R6.bindTo(n),this._register(this._editor.onDidChangeModel(()=>this._update())),this._register(this._editor.onDidChangeModelLanguage(()=>this._update())),this._register(this._registry.onDidChange(()=>this._update())),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(Gh.Empty,!0))}_settingEnabledNearbyQuickfixes(){var e;const t=(e=this._editor)===null||e===void 0?void 0:e.getModel();return this._configurationService?this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:t?.uri}):!1}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(Gh.Empty);const e=this._editor.getModel();if(e&&this._registry.has(e)&&!this._editor.getOption(90)){const t=this._registry.all(e).flatMap(i=>{var n;return(n=i.providedCodeActionKinds)!==null&&n!==void 0?n:[]});this._supportedCodeActions.set(t.join(" ")),this._codeActionOracle.value=new Jce(this._editor,this._markerService,i=>{var n;if(!i){this.setState(Gh.Empty);return}const s=i.selection.getStartPosition(),r=Zi(async a=>{var l,d,c,h,u,g;if(this._settingEnabledNearbyQuickfixes()&&i.trigger.type===1&&(i.trigger.triggerAction===qs.QuickFix||!((d=(l=i.trigger.filter)===null||l===void 0?void 0:l.include)===null||d===void 0)&&d.contains(Be.QuickFix))){const f=await L_(this._registry,e,i.selection,i.trigger,ld.None,a),m=[...f.allActions];if(a.isCancellationRequested)return A6;if(!((c=f.validActions)===null||c===void 0?void 0:c.some(v=>v.action.kind?Be.QuickFix.contains(new Be(v.action.kind)):!1))){const v=this._markerService.read({resource:e.uri});if(v.length>0){const b=i.selection.getPosition();let C=b,w=Number.MAX_VALUE;const y=[...f.validActions];for(const D of v){const T=D.endColumn,P=D.endLineNumber,H=D.startLineNumber;if(P===b.lineNumber||H===b.lineNumber){C=new V(P,T);const Y={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:!((h=i.trigger.filter)===null||h===void 0)&&h.include?(u=i.trigger.filter)===null||u===void 0?void 0:u.include:Be.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:((g=i.trigger.context)===null||g===void 0?void 0:g.notAvailableMessage)||"",position:C}},B=new xe(C.lineNumber,C.column,C.lineNumber,C.column),U=await L_(this._registry,e,B,Y,ld.None,a);if(U.validActions.length!==0){for(const G of U.validActions)G.highlightRange=G.action.isPreferred;f.allActions.length===0&&m.push(...U.allActions),Math.abs(b.column-T)<w?y.unshift(...U.validActions):y.push(...U.validActions)}w=Math.abs(b.column-T)}}const I=y.filter((D,T,P)=>P.findIndex(H=>H.action.title===D.action.title)===T);return I.sort((D,T)=>D.action.isPreferred&&!T.action.isPreferred?-1:!D.action.isPreferred&&T.action.isPreferred||D.action.isAI&&!T.action.isAI?1:!D.action.isAI&&T.action.isAI?-1:0),{validActions:I,allActions:m,documentation:f.documentation,hasAutoFix:f.hasAutoFix,hasAIFix:f.hasAIFix,allAIFixes:f.allAIFixes,dispose:()=>{f.dispose()}}}}}return L_(this._registry,e,i.selection,i.trigger,ld.None,a)});i.trigger.type===1&&((n=this._progressService)===null||n===void 0||n.showWhile(r,250)),this.setState(new Gh.Triggered(i.trigger,s,r))},void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:qs.Default})}else this._supportedCodeActions.reset()}trigger(e){var t;(t=this._codeActionOracle.value)===null||t===void 0||t.trigger(e)}setState(e,t){e!==this._state&&(this._state.type===1&&this._state.cancel(),this._state=e,!t&&!this._disposed&&this._onDidChangeState.fire(e))}}var the=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},El=function(o,e){return function(t,i){e(t,i,o)}},XC;const ihe="quickfix-edit-highlight";let jc=XC=class extends K{static get(e){return e.getContribution(XC.ID)}constructor(e,t,i,n,s,r,a,l,d,c){super(),this._commandService=a,this._configurationService=l,this._actionWidgetService=d,this._instantiationService=c,this._activeCodeActions=this._register(new Cn),this._showDisabled=!1,this._disposed=!1,this._editor=e,this._model=this._register(new ehe(this._editor,s.codeActionProvider,t,i,r,l)),this._register(this._model.onDidChangeState(h=>this.update(h))),this._lightBulbWidget=new sh(()=>{const h=this._editor.getContribution(Bu.ID);return h&&this._register(h.onClick(u=>this.showCodeActionList(u.actions,u,{includeDisabledActions:!1,fromLightbulb:!0}))),h}),this._resolver=n.createInstance(Ww),this._register(this._editor.onDidLayoutChange(()=>this._actionWidgetService.hide()))}dispose(){this._disposed=!0,super.dispose()}showCodeActions(e,t,i){return this.showCodeActionList(t,i,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(e,t,i,n){var s;if(!this._editor.hasModel())return;(s=zs.get(this._editor))===null||s===void 0||s.closeMessage();const r=this._editor.getPosition();this._trigger({type:1,triggerAction:t,filter:i,autoApply:n,context:{notAvailableMessage:e,position:r}})}_trigger(e){return this._model.trigger(e)}async _applyCodeAction(e,t,i){try{await this._instantiationService.invokeFunction(Bce,e,Bw.FromCodeActions,{preview:i,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:qs.QuickFix,filter:{}})}}async update(e){var t,i,n,s,r,a,l;if(e.type!==1){(t=this._lightBulbWidget.rawValue)===null||t===void 0||t.hide();return}let d;try{d=await e.actions}catch(c){Ge(c);return}if(!this._disposed)if((i=this._lightBulbWidget.value)===null||i===void 0||i.update(d,e.trigger,e.position),e.trigger.type===1){if(!((n=e.trigger.filter)===null||n===void 0)&&n.include){const h=this.tryGetValidActionToApply(e.trigger,d);if(h){try{(s=this._lightBulbWidget.value)===null||s===void 0||s.hide(),await this._applyCodeAction(h,!1,!1)}finally{d.dispose()}return}if(e.trigger.context){const u=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,d);if(u&&u.action.disabled){(r=zs.get(this._editor))===null||r===void 0||r.showMessage(u.action.disabled,e.trigger.context.position),d.dispose();return}}}const c=!!(!((a=e.trigger.filter)===null||a===void 0)&&a.include);if(e.trigger.context&&(!d.allActions.length||!c&&!d.validActions.length)){(l=zs.get(this._editor))===null||l===void 0||l.showMessage(e.trigger.context.notAvailableMessage,e.trigger.context.position),this._activeCodeActions.value=d,d.dispose();return}this._activeCodeActions.value=d,this.showCodeActionList(d,this.toCoords(e.position),{includeDisabledActions:c,fromLightbulb:!1})}else this._actionWidgetService.isVisible?d.dispose():this._activeCodeActions.value=d}getInvalidActionThatWouldHaveBeenApplied(e,t){if(t.allActions.length&&(e.autoApply==="first"&&t.validActions.length===0||e.autoApply==="ifSingle"&&t.allActions.length===1))return t.allActions.find(({action:i})=>i.disabled)}tryGetValidActionToApply(e,t){if(t.validActions.length&&(e.autoApply==="first"&&t.validActions.length>0||e.autoApply==="ifSingle"&&t.validActions.length===1))return t.validActions[0]}async showCodeActionList(e,t,i){const n=this._editor.createDecorationsCollection(),s=this._editor.getDomNode();if(!s)return;const r=i.includeDisabledActions&&(this._showDisabled||e.validActions.length===0)?e.allActions:e.validActions;if(!r.length)return;const a=V.isIPosition(t)?this.toCoords(t):t,l={onSelect:async(d,c)=>{this._applyCodeAction(d,!0,!!c),this._actionWidgetService.hide(),n.clear()},onHide:()=>{var d;(d=this._editor)===null||d===void 0||d.focus(),n.clear()},onHover:async(d,c)=>{var h;if(await d.resolve(c),!c.isCancellationRequested)return{canPreview:!!(!((h=d.action.edit)===null||h===void 0)&&h.edits.length)}},onFocus:d=>{var c,h;if(d&&d.highlightRange&&d.action.diagnostics){const u=[{range:d.action.diagnostics[0],options:XC.DECORATION}];n.set(u);const g=d.action.diagnostics[0],f=(h=(c=this._editor.getModel())===null||c===void 0?void 0:c.getWordAtPosition({lineNumber:g.startLineNumber,column:g.startColumn}))===null||h===void 0?void 0:h.word;Du(p("editingNewSelection","Context: {0} at line {1} and column {2}.",f,g.startLineNumber,g.startColumn))}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,Uce(r,this._shouldShowHeaders(),this._resolver.getResolver()),l,a,s,this._getActionBarActions(e,t,i))}toCoords(e){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(e,1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(e),i=ji(this._editor.getDomNode()),n=i.left+t.left,s=i.top+t.top+t.height;return{x:n,y:s}}_shouldShowHeaders(){var e;const t=(e=this._editor)===null||e===void 0?void 0:e.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:t?.uri})}_getActionBarActions(e,t,i){if(i.fromLightbulb)return[];const n=e.documentation.map(s=>{var r;return{id:s.id,label:s.title,tooltip:(r=s.tooltip)!==null&&r!==void 0?r:"",class:void 0,enabled:!0,run:()=>{var a;return this._commandService.executeCommand(s.id,...(a=s.arguments)!==null&&a!==void 0?a:[])}}});return i.includeDisabledActions&&e.validActions.length>0&&e.allActions.length!==e.validActions.length&&n.push(this._showDisabled?{id:"hideMoreActions",label:p("hideMoreActions","Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,i))}:{id:"showMoreActions",label:p("showMoreActions","Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,i))}),n}};jc.ID="editor.contrib.codeActionController";jc.DECORATION=Ze.register({description:"quickfix-highlight",className:ihe});jc=XC=the([El(1,yl),El(2,We),El(3,Oe),El(4,Se),El(5,lh),El(6,ui),El(7,ft),El(8,lg),El(9,Oe)],jc);Sr((o,e)=>{((n,s)=>{s&&e.addRule(`.monaco-editor ${n} { background-color: ${s}; }`)})(".quickfix-edit-highlight",o.getColor(Ga));const i=o.getColor(Jd);i&&e.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${il(o.type)?"dotted":"solid"} ${i}; box-sizing: border-box; }`)});function Uv(o){return te.regex(R6.keys()[0],new RegExp("(\\s|^)"+yo(o.value)+"\\b"))}const vR={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:p("args.schema.kind","Kind of the code action to run.")},apply:{type:"string",description:p("args.schema.apply","Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[p("args.schema.apply.first","Always apply the first returned code action."),p("args.schema.apply.ifSingle","Apply the first returned code action if it is the only one."),p("args.schema.apply.never","Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:p("args.schema.preferred","Controls if only preferred code actions should be returned.")}}};function dg(o,e,t,i,n=qs.Default){if(o.hasModel()){const s=jc.get(o);s?.manualTriggerAtCurrentPosition(e,n,t,i)}}class nhe extends we{constructor(){super({id:pR,label:p("quickfix.trigger.label","Quick Fix..."),alias:"Quick Fix...",precondition:te.and(M.writable,M.hasCodeActionsProvider),kbOpts:{kbExpr:M.textInputFocus,primary:2137,weight:100}})}run(e,t){return dg(t,p("editor.action.quickFix.noneMessage","No code actions available"),void 0,void 0,qs.QuickFix)}}class she extends cn{constructor(){super({id:y6,precondition:te.and(M.writable,M.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:vR}]}})}runEditorCommand(e,t,i){const n=Va.fromUser(i,{kind:Be.Empty,apply:"ifSingle"});return dg(t,typeof i?.kind=="string"?n.preferred?p("editor.action.codeAction.noneMessage.preferred.kind","No preferred code actions for '{0}' available",i.kind):p("editor.action.codeAction.noneMessage.kind","No code actions for '{0}' available",i.kind):n.preferred?p("editor.action.codeAction.noneMessage.preferred","No preferred code actions available"):p("editor.action.codeAction.noneMessage","No code actions available"),{include:n.kind,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply)}}class ohe extends we{constructor(){super({id:x6,label:p("refactor.label","Refactor..."),alias:"Refactor...",precondition:te.and(M.writable,M.hasCodeActionsProvider),kbOpts:{kbExpr:M.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:te.and(M.writable,Uv(Be.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:vR}]}})}run(e,t,i){const n=Va.fromUser(i,{kind:Be.Refactor,apply:"never"});return dg(t,typeof i?.kind=="string"?n.preferred?p("editor.action.refactor.noneMessage.preferred.kind","No preferred refactorings for '{0}' available",i.kind):p("editor.action.refactor.noneMessage.kind","No refactorings for '{0}' available",i.kind):n.preferred?p("editor.action.refactor.noneMessage.preferred","No preferred refactorings available"):p("editor.action.refactor.noneMessage","No refactorings available"),{include:Be.Refactor.contains(n.kind)?n.kind:Be.None,onlyIncludePreferredActions:n.preferred},n.apply,qs.Refactor)}}class rhe extends we{constructor(){super({id:D6,label:p("source.label","Source Action..."),alias:"Source Action...",precondition:te.and(M.writable,M.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:te.and(M.writable,Uv(Be.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:vR}]}})}run(e,t,i){const n=Va.fromUser(i,{kind:Be.Source,apply:"never"});return dg(t,typeof i?.kind=="string"?n.preferred?p("editor.action.source.noneMessage.preferred.kind","No preferred source actions for '{0}' available",i.kind):p("editor.action.source.noneMessage.kind","No source actions for '{0}' available",i.kind):n.preferred?p("editor.action.source.noneMessage.preferred","No preferred source actions available"):p("editor.action.source.noneMessage","No source actions available"),{include:Be.Source.contains(n.kind)?n.kind:Be.None,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply,qs.SourceAction)}}class ahe extends we{constructor(){super({id:mR,label:p("organizeImports.label","Organize Imports"),alias:"Organize Imports",precondition:te.and(M.writable,Uv(Be.SourceOrganizeImports)),kbOpts:{kbExpr:M.textInputFocus,primary:1581,weight:100}})}run(e,t){return dg(t,p("editor.action.organize.noneMessage","No organize imports action available"),{include:Be.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",qs.OrganizeImports)}}class lhe extends we{constructor(){super({id:_R,label:p("fixAll.label","Fix All"),alias:"Fix All",precondition:te.and(M.writable,Uv(Be.SourceFixAll))})}run(e,t){return dg(t,p("fixAll.noneMessage","No fix all action available"),{include:Be.SourceFixAll,includeSourceActions:!0},"ifSingle",qs.FixAll)}}class dhe extends we{constructor(){super({id:L6,label:p("autoFix.label","Auto Fix..."),alias:"Auto Fix...",precondition:te.and(M.writable,Uv(Be.QuickFix)),kbOpts:{kbExpr:M.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(e,t){return dg(t,p("editor.action.autoFix.noneMessage","No auto fixes available"),{include:Be.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",qs.AutoFix)}}yt(jc.ID,jc,3);yt(Bu.ID,Bu,4);de(nhe);de(ohe);de(rhe);de(ahe);de(dhe);de(lhe);ue(new she);Ri.as(la.Configuration).registerConfiguration({...iy,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:p("showCodeActionHeaders","Enable/disable showing group headers in the Code Action menu."),default:!0}}});Ri.as(la.Configuration).registerConfiguration({...iy,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:5,description:p("includeNearbyQuickFixes","Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}});class rN{constructor(){this.lenses=[],this._disposables=new se}dispose(){this._disposables.dispose()}get isDisposed(){return this._disposables.isDisposed}add(e,t){this._disposables.add(e);for(const i of e.lenses)this.lenses.push({symbol:i,provider:t})}}async function P6(o,e,t){const i=o.ordered(e),n=new Map,s=new rN,r=i.map(async(a,l)=>{n.set(a,l);try{const d=await Promise.resolve(a.provideCodeLenses(e,t));d&&s.add(d,a)}catch(d){Mi(d)}});return await Promise.all(r),s.lenses=s.lenses.sort((a,l)=>a.symbol.range.startLineNumber<l.symbol.range.startLineNumber?-1:a.symbol.range.startLineNumber>l.symbol.range.startLineNumber?1:n.get(a.provider)<n.get(l.provider)?-1:n.get(a.provider)>n.get(l.provider)?1:a.symbol.range.startColumn<l.symbol.range.startColumn?-1:a.symbol.range.startColumn>l.symbol.range.startColumn?1:0),s}gt.registerCommand("_executeCodeLensProvider",function(o,...e){let[t,i]=e;Tt(Me.isUri(t)),Tt(typeof i=="number"||!i);const{codeLensProvider:n}=o.get(Se),s=o.get(ii).getModel(t);if(!s)throw Wo();const r=[],a=new se;return P6(n,s,st.None).then(l=>{a.add(l);const d=[];for(const c of l.lenses)i==null||c.symbol.command?r.push(c.symbol):i-- >0&&c.provider.resolveCodeLens&&d.push(Promise.resolve(c.provider.resolveCodeLens(s,c.symbol,st.None)).then(h=>r.push(h||c.symbol)));return Promise.all(d)}).then(()=>r).finally(()=>{setTimeout(()=>a.dispose(),100)})});var che=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},hhe=function(o,e){return function(t,i){e(t,i,o)}};const O6=ot("ICodeLensCache");class XF{constructor(e,t){this.lineCount=e,this.data=t}}let aN=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new oh(20,.75);const t="codelens/cache";Mm(hi,()=>e.remove(t,1));const i="codelens/cache2",n=e.get(i,1,"{}");this._deserialize(n),fe.once(e.onWillSaveState)(s=>{s.reason===y0.SHUTDOWN&&e.store(i,this._serialize(),1,1)})}put(e,t){const i=t.lenses.map(r=>{var a;return{range:r.symbol.range,command:r.symbol.command&&{id:"",title:(a=r.symbol.command)===null||a===void 0?void 0:a.title}}}),n=new rN;n.add({lenses:i,dispose:()=>{}},this._fakeProvider);const s=new XF(e.getLineCount(),n);this._cache.set(e.uri.toString(),s)}get(e){const t=this._cache.get(e.uri.toString());return t&&t.lineCount===e.getLineCount()?t.data:void 0}delete(e){this._cache.delete(e.uri.toString())}_serialize(){const e=Object.create(null);for(const[t,i]of this._cache){const n=new Set;for(const s of i.data.lenses)n.add(s.symbol.range.startLineNumber);e[t]={lineCount:i.lineCount,lines:[...n.values()]}}return JSON.stringify(e)}_deserialize(e){try{const t=JSON.parse(e);for(const i in t){const n=t[i],s=[];for(const a of n.lines)s.push({range:new k(a,1,a,11)});const r=new rN;r.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(i,new XF(n.lineCount,r))}}catch{}}};aN=che([hhe(0,da)],aN);ct(O6,aN,1);class uhe{constructor(e,t,i){this.afterColumn=1073741824,this.afterLineNumber=e,this.heightInPx=t,this._onHeight=i,this.suppressMouseDown=!0,this.domNode=document.createElement("div")}onComputedHeight(e){this._lastHeight===void 0?this._lastHeight=e:this._lastHeight!==e&&(this._lastHeight=e,this._onHeight())}isVisible(){return this._lastHeight!==0&&this.domNode.hasAttribute("monaco-visible-view-zone")}}class My{constructor(e,t){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id=`codelens.widget-${My._idPool++}`,this.updatePosition(t),this._domNode=document.createElement("span"),this._domNode.className="codelens-decoration"}withCommands(e,t){this._commands.clear();const i=[];let n=!1;for(let s=0;s<e.length;s++){const r=e[s];if(r&&(n=!0,r.command)){const a=vc(r.command.title.trim());r.command.id?(i.push(pe("a",{id:String(s),title:r.command.tooltip,role:"button"},...a)),this._commands.set(String(s),r.command)):i.push(pe("span",{title:r.command.tooltip},...a)),s+1<e.length&&i.push(pe("span",void 0," | "))}}n?(Wn(this._domNode,...i),this._isEmpty&&t&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Wn(this._domNode,pe("span",void 0,"no commands"))}getCommand(e){return e.parentElement===this._domNode?this._commands.get(e.id):void 0}getId(){return this._id}getDomNode(){return this._domNode}updatePosition(e){const t=this._editor.getModel().getLineFirstNonWhitespaceColumn(e);this._widgetPosition={position:{lineNumber:e,column:t},preference:[1]}}getPosition(){return this._widgetPosition||null}}My._idPool=0;class oD{constructor(){this._removeDecorations=[],this._addDecorations=[],this._addDecorationsCallbacks=[]}addDecoration(e,t){this._addDecorations.push(e),this._addDecorationsCallbacks.push(t)}removeDecoration(e){this._removeDecorations.push(e)}commit(e){const t=e.deltaDecorations(this._removeDecorations,this._addDecorations);for(let i=0,n=t.length;i<n;i++)this._addDecorationsCallbacks[i](t[i])}}const QF=Ze.register({collapseOnReplaceEdit:!0,description:"codelens"});class JF{constructor(e,t,i,n,s,r){this._isDisposed=!1,this._editor=t,this._data=e,this._decorationIds=[];let a;const l=[];this._data.forEach((d,c)=>{d.symbol.command&&l.push(d.symbol),i.addDecoration({range:d.symbol.range,options:QF},h=>this._decorationIds[c]=h),a?a=k.plusRange(a,d.symbol.range):a=k.lift(d.symbol.range)}),this._viewZone=new uhe(a.startLineNumber-1,s,r),this._viewZoneId=n.addZone(this._viewZone),l.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(l,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new My(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(e,t){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],t?.removeZone(this._viewZoneId),this._contentWidget&&(this._editor.removeContentWidget(this._contentWidget),this._contentWidget=void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some((e,t)=>{const i=this._editor.getModel().getDecorationRange(e),n=this._data[t].symbol;return!!(i&&k.isEmpty(n.range)===i.isEmpty())})}updateCodeLensSymbols(e,t){this._decorationIds.forEach(t.removeDecoration,t),this._decorationIds=[],this._data=e,this._data.forEach((i,n)=>{t.addDecoration({range:i.symbol.range,options:QF},s=>this._decorationIds[n]=s)})}updateHeight(e,t){this._viewZone.heightInPx=e,t.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(e){if(!this._viewZone.isVisible())return null;for(let t=0;t<this._decorationIds.length;t++){const i=e.getDecorationRange(this._decorationIds[t]);i&&(this._data[t].symbol.range=i)}return this._data}updateCommands(e){this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(e,!0);for(let t=0;t<this._data.length;t++){const i=e[t];if(i){const{symbol:n}=this._data[t];n.command=i.command||n.command}}}getCommand(e){var t;return(t=this._contentWidget)===null||t===void 0?void 0:t.getCommand(e)}getLineNumber(){const e=this._editor.getModel().getDecorationRange(this._decorationIds[0]);return e?e.startLineNumber:-1}update(e){if(this.isValid()){const t=this._editor.getModel().getDecorationRange(this._decorationIds[0]);t&&(this._viewZone.afterLineNumber=t.startLineNumber-1,e.layoutZone(this._viewZoneId),this._contentWidget&&(this._contentWidget.updatePosition(t.startLineNumber),this._editor.layoutContentWidget(this._contentWidget)))}}}var ghe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Sm=function(o,e){return function(t,i){e(t,i,o)}};let bp=class{constructor(e,t,i,n,s,r){this._editor=e,this._languageFeaturesService=t,this._commandService=n,this._notificationService=s,this._codeLensCache=r,this._disposables=new se,this._localToDispose=new se,this._lenses=[],this._oldCodeLensModels=new se,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new Rt(()=>this._resolveCodeLensesInViewport(),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{(a.hasChanged(50)||a.hasChanged(19)||a.hasChanged(18))&&this._updateLensStyle(),a.hasChanged(17)&&this._onModelChange()})),this._disposables.add(t.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}dispose(){var e;this._localDispose(),this._disposables.dispose(),this._oldCodeLensModels.dispose(),(e=this._currentCodeLensModel)===null||e===void 0||e.dispose()}_getLayoutInfo(){const e=Math.max(1.3,this._editor.getOption(66)/this._editor.getOption(52));let t=this._editor.getOption(19);return(!t||t<5)&&(t=this._editor.getOption(52)*.9|0),{fontSize:t,codeLensHeight:t*e|0}}_updateLensStyle(){const{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),i=this._editor.getOption(18),n=this._editor.getOption(50),{style:s}=this._editor.getContainerDomNode();s.setProperty("--vscode-editorCodeLens-lineHeight",`${e}px`),s.setProperty("--vscode-editorCodeLens-fontSize",`${t}px`),s.setProperty("--vscode-editorCodeLens-fontFeatureSettings",n.fontFeatureSettings),i&&(s.setProperty("--vscode-editorCodeLens-fontFamily",i),s.setProperty("--vscode-editorCodeLens-fontFamilyDefault",Vs.fontFamily)),this._editor.changeViewZones(r=>{for(const a of this._lenses)a.updateHeight(e,r)})}_localDispose(){var e,t,i;(e=this._getCodeLensModelPromise)===null||e===void 0||e.cancel(),this._getCodeLensModelPromise=void 0,(t=this._resolveCodeLensesPromise)===null||t===void 0||t.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),(i=this._currentCodeLensModel)===null||i===void 0||i.dispose()}_onModelChange(){this._localDispose();const e=this._editor.getModel();if(!e||!this._editor.getOption(17)||e.isTooLargeForTokenization())return;const t=this._codeLensCache.get(e);if(t&&this._renderCodeLensSymbols(t),!this._languageFeaturesService.codeLensProvider.has(e)){t&&Rc(()=>{const n=this._codeLensCache.get(e);t===n&&(this._codeLensCache.delete(e),this._onModelChange())},30*1e3,this._localToDispose);return}for(const n of this._languageFeaturesService.codeLensProvider.all(e))if(typeof n.onDidChange=="function"){const s=n.onDidChange(()=>i.schedule());this._localToDispose.add(s)}const i=new Rt(()=>{var n;const s=Date.now();(n=this._getCodeLensModelPromise)===null||n===void 0||n.cancel(),this._getCodeLensModelPromise=Zi(r=>P6(this._languageFeaturesService.codeLensProvider,e,r)),this._getCodeLensModelPromise.then(r=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=r,this._codeLensCache.put(e,r);const a=this._provideCodeLensDebounce.update(e,Date.now()-s);i.delay=a,this._renderCodeLensSymbols(r),this._resolveCodeLensesInViewportSoon()},Ge)},this._provideCodeLensDebounce.get(e));this._localToDispose.add(i),this._localToDispose.add(Ae(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{var n;this._editor.changeDecorations(s=>{this._editor.changeViewZones(r=>{const a=[];let l=-1;this._lenses.forEach(c=>{!c.isValid()||l===c.getLineNumber()?a.push(c):(c.update(r),l=c.getLineNumber())});const d=new oD;a.forEach(c=>{c.dispose(d,r),this._lenses.splice(this._lenses.indexOf(c),1)}),d.commit(s)})}),i.schedule(),this._resolveCodeLensesScheduler.cancel(),(n=this._resolveCodeLensesPromise)===null||n===void 0||n.cancel(),this._resolveCodeLensesPromise=void 0})),this._localToDispose.add(this._editor.onDidFocusEditorWidget(()=>{i.schedule()})),this._localToDispose.add(this._editor.onDidBlurEditorText(()=>{i.cancel()})),this._localToDispose.add(this._editor.onDidScrollChange(n=>{n.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(this._editor.onDidLayoutChange(()=>{this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(Ae(()=>{if(this._editor.getModel()){const n=na.capture(this._editor);this._editor.changeDecorations(s=>{this._editor.changeViewZones(r=>{this._disposeAllLenses(s,r)})}),n.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)})),this._localToDispose.add(this._editor.onMouseDown(n=>{if(n.target.type!==9)return;let s=n.target.element;if(s?.tagName==="SPAN"&&(s=s.parentElement),s?.tagName==="A")for(const r of this._lenses){const a=r.getCommand(s);if(a){this._commandService.executeCommand(a.id,...a.arguments||[]).catch(l=>this._notificationService.error(l));break}}})),i.schedule()}_disposeAllLenses(e,t){const i=new oD;for(const n of this._lenses)n.dispose(i,t);e&&i.commit(e),this._lenses.length=0}_renderCodeLensSymbols(e){if(!this._editor.hasModel())return;const t=this._editor.getModel().getLineCount(),i=[];let n;for(const a of e.lenses){const l=a.symbol.range.startLineNumber;l<1||l>t||(n&&n[n.length-1].symbol.range.startLineNumber===l?n.push(a):(n=[a],i.push(n)))}if(!i.length&&!this._lenses.length)return;const s=na.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(a=>{this._editor.changeViewZones(l=>{const d=new oD;let c=0,h=0;for(;h<i.length&&c<this._lenses.length;){const u=i[h][0].symbol.range.startLineNumber,g=this._lenses[c].getLineNumber();g<u?(this._lenses[c].dispose(d,l),this._lenses.splice(c,1)):g===u?(this._lenses[c].updateCodeLensSymbols(i[h],d),h++,c++):(this._lenses.splice(c,0,new JF(i[h],this._editor,d,l,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),c++,h++)}for(;c<this._lenses.length;)this._lenses[c].dispose(d,l),this._lenses.splice(c,1);for(;h<i.length;)this._lenses.push(new JF(i[h],this._editor,d,l,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),h++;d.commit(a)})}),s.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){var e;(e=this._resolveCodeLensesPromise)===null||e===void 0||e.cancel(),this._resolveCodeLensesPromise=void 0;const t=this._editor.getModel();if(!t)return;const i=[],n=[];if(this._lenses.forEach(a=>{const l=a.computeIfNecessary(t);l&&(i.push(l),n.push(a))}),i.length===0)return;const s=Date.now(),r=Zi(a=>{const l=i.map((d,c)=>{const h=new Array(d.length),u=d.map((g,f)=>!g.symbol.command&&typeof g.provider.resolveCodeLens=="function"?Promise.resolve(g.provider.resolveCodeLens(t,g.symbol,a)).then(m=>{h[f]=m},Mi):(h[f]=g.symbol,Promise.resolve(void 0)));return Promise.all(u).then(()=>{!a.isCancellationRequested&&!n[c].isDisposed()&&n[c].updateCommands(h)})});return Promise.all(l)});this._resolveCodeLensesPromise=r,this._resolveCodeLensesPromise.then(()=>{const a=this._resolveCodeLensesDebounce.update(t,Date.now()-s);this._resolveCodeLensesScheduler.delay=a,this._currentCodeLensModel&&this._codeLensCache.put(t,this._currentCodeLensModel),this._oldCodeLensModels.clear(),r===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)},a=>{Ge(a),r===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)})}async getModel(){var e;return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,!((e=this._currentCodeLensModel)===null||e===void 0)&&e.isDisposed?void 0:this._currentCodeLensModel}};bp.ID="css.editor.codeLens";bp=ghe([Sm(1,Se),Sm(2,Zo),Sm(3,ui),Sm(4,Vi),Sm(5,O6)],bp);yt(bp.ID,bp,1);de(class extends we{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:M.hasCodeLensProvider,label:p("showLensOnLine","Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}async run(e,t){if(!t.hasModel())return;const i=e.get(dh),n=e.get(ui),s=e.get(Vi),r=t.getSelection().positionLineNumber,a=t.getContribution(bp.ID);if(!a)return;const l=await a.getModel();if(!l)return;const d=[];for(const u of l.lenses)u.symbol.command&&u.symbol.range.startLineNumber===r&&d.push({label:u.symbol.command.title,command:u.symbol.command});if(d.length===0)return;const c=await i.pick(d,{canPickMany:!1,placeHolder:p("placeHolder","Select a command")});if(!c)return;let h=c.command;if(l.isDisposed){const u=await a.getModel(),g=u?.lenses.find(f=>{var m;return f.symbol.range.startLineNumber===r&&((m=f.symbol.command)===null||m===void 0?void 0:m.title)===h.title});if(!g||!g.symbol.command)return;h=g.symbol.command}try{await n.executeCommand(h.id,...h.arguments||[])}catch(u){s.error(u)}}});var fhe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},rD=function(o,e){return function(t,i){e(t,i,o)}};class bR{constructor(e,t){this._editorWorkerClient=new I2(e,!1,"editorWorkerService",t)}async provideDocumentColors(e,t){return this._editorWorkerClient.computeDefaultDocumentColors(e.uri)}provideColorPresentations(e,t,i){const n=t.range,s=t.color,r=s.alpha,a=new q(new ht(Math.round(255*s.red),Math.round(255*s.green),Math.round(255*s.blue),r)),l=r?q.Format.CSS.formatRGB(a):q.Format.CSS.formatRGBA(a),d=r?q.Format.CSS.formatHSL(a):q.Format.CSS.formatHSLA(a),c=r?q.Format.CSS.formatHex(a):q.Format.CSS.formatHexA(a),h=[];return h.push({label:l,textEdit:{range:n,text:l}}),h.push({label:d,textEdit:{range:n,text:d}}),h.push({label:c,textEdit:{range:n,text:c}}),h}}let lN=class extends K{constructor(e,t,i){super(),this._register(i.colorProvider.register("*",new bR(e,t)))}};lN=fhe([rD(0,ii),rD(1,Wt),rD(2,Se)],lN);yy(lN);async function F6(o,e,t,i=!0){return CR(new phe,o,e,t,i)}function B6(o,e,t,i){return Promise.resolve(t.provideColorPresentations(o,e,i))}class phe{constructor(){}async compute(e,t,i,n){const s=await e.provideDocumentColors(t,i);if(Array.isArray(s))for(const r of s)n.push({colorInfo:r,provider:e});return Array.isArray(s)}}class mhe{constructor(){}async compute(e,t,i,n){const s=await e.provideDocumentColors(t,i);if(Array.isArray(s))for(const r of s)n.push({range:r.range,color:[r.color.red,r.color.green,r.color.blue,r.color.alpha]});return Array.isArray(s)}}class _he{constructor(e){this.colorInfo=e}async compute(e,t,i,n){const s=await e.provideColorPresentations(t,this.colorInfo,st.None);return Array.isArray(s)&&n.push(...s),Array.isArray(s)}}async function CR(o,e,t,i,n){let s=!1,r;const a=[],l=e.ordered(t);for(let d=l.length-1;d>=0;d--){const c=l[d];if(c instanceof bR)r=c;else try{await o.compute(c,t,i,a)&&(s=!0)}catch(h){Mi(h)}}return s?a:r&&n?(await o.compute(r,t,i,a),a):[]}function W6(o,e){const{colorProvider:t}=o.get(Se),i=o.get(ii).getModel(e);if(!i)throw Wo();const n=o.get(ft).getValue("editor.defaultColorDecorators",{resource:e});return{model:i,colorProviderRegistry:t,isDefaultColorDecoratorsEnabled:n}}gt.registerCommand("_executeDocumentColorProvider",function(o,...e){const[t]=e;if(!(t instanceof Me))throw Wo();const{model:i,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:s}=W6(o,t);return CR(new mhe,n,i,st.None,s)});gt.registerCommand("_executeColorPresentationProvider",function(o,...e){const[t,i]=e,{uri:n,range:s}=i;if(!(n instanceof Me)||!Array.isArray(t)||t.length!==4||!k.isIRange(s))throw Wo();const{model:r,colorProviderRegistry:a,isDefaultColorDecoratorsEnabled:l}=W6(o,n),[d,c,h,u]=t;return CR(new _he({range:s,color:{red:d,green:c,blue:h,alpha:u}}),a,r,st.None,l)});var vhe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},aD=function(o,e){return function(t,i){e(t,i,o)}},dN;const V6=Object.create({});let qc=dN=class extends K{constructor(e,t,i,n){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=i,this._localToDispose=this._register(new se),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new vv(this._editor),this._decoratorLimitReporter=new bhe,this._colorDecorationClassRefs=this._register(new se),this._debounceInformation=n.for(i.colorProvider,"Document Colors",{min:dN.RECOMPUTE_TIME}),this._register(e.onDidChangeModel(()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()})),this._register(e.onDidChangeModelLanguage(()=>this.updateColors())),this._register(i.colorProvider.onDidChange(()=>this.updateColors())),this._register(e.onDidChangeConfiguration(s=>{const r=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(145);const a=r!==this._isColorDecoratorsEnabled||s.hasChanged(21),l=s.hasChanged(145);(a||l)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())})),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(145),this.updateColors()}isEnabled(){const e=this._editor.getModel();if(!e)return!1;const t=e.getLanguageId(),i=this._configurationService.getValue(t);if(i&&typeof i=="object"){const n=i.colorDecorators;if(n&&n.enable!==void 0&&!n.enable)return n.enable}return this._editor.getOption(20)}static get(e){return e.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;const e=this._editor.getModel();!e||!this._languageFeaturesService.colorProvider.has(e)||(this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._timeoutTimer||(this._timeoutTimer=new Cr,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=Zi(async e=>{const t=this._editor.getModel();if(!t)return[];const i=new Hn(!1),n=await F6(this._languageFeaturesService.colorProvider,t,e,this._isDefaultColorDecoratorsEnabled);return this._debounceInformation.update(t,i.elapsed()),n});try{const e=await this._computePromise;this.updateDecorations(e),this.updateColorDecorators(e),this._computePromise=null}catch(e){Ge(e)}}stop(){this._timeoutTimer&&(this._timeoutTimer.cancel(),this._timeoutTimer=null),this._computePromise&&(this._computePromise.cancel(),this._computePromise=null),this._localToDispose.clear()}updateDecorations(e){const t=e.map(i=>({range:{startLineNumber:i.colorInfo.range.startLineNumber,startColumn:i.colorInfo.range.startColumn,endLineNumber:i.colorInfo.range.endLineNumber,endColumn:i.colorInfo.range.endColumn},options:Ze.EMPTY}));this._editor.changeDecorations(i=>{this._decorationsIds=i.deltaDecorations(this._decorationsIds,t),this._colorDatas=new Map,this._decorationsIds.forEach((n,s)=>this._colorDatas.set(n,e[s]))})}updateColorDecorators(e){this._colorDecorationClassRefs.clear();const t=[],i=this._editor.getOption(21);for(let s=0;s<e.length&&t.length<i;s++){const{red:r,green:a,blue:l,alpha:d}=e[s].colorInfo.color,c=new ht(Math.round(r*255),Math.round(a*255),Math.round(l*255),d),h=`rgba(${c.r}, ${c.g}, ${c.b}, ${c.a})`,u=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:h}));t.push({range:{startLineNumber:e[s].colorInfo.range.startLineNumber,startColumn:e[s].colorInfo.range.startColumn,endLineNumber:e[s].colorInfo.range.endLineNumber,endColumn:e[s].colorInfo.range.endColumn},options:{description:"colorDetector",before:{content:J3,inlineClassName:`${u.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:V6}}})}const n=i<e.length?i:!1;this._decoratorLimitReporter.update(e.length,n),this._colorDecoratorIds.set(t)}removeAllDecorations(){this._editor.removeDecorations(this._decorationsIds),this._decorationsIds=[],this._colorDecoratorIds.clear(),this._colorDecorationClassRefs.clear()}getColorData(e){const t=this._editor.getModel();if(!t)return null;const i=t.getDecorationsInRange(k.fromPositions(e,e)).filter(n=>this._colorDatas.has(n.id));return i.length===0?null:this._colorDatas.get(i[0].id)}isColorDecoration(e){return this._colorDecoratorIds.has(e)}};qc.ID="editor.contrib.colorDetector";qc.RECOMPUTE_TIME=1e3;qc=dN=vhe([aD(1,ft),aD(2,Se),aD(3,Zo)],qc);class bhe{constructor(){this._onDidChange=new W,this._computed=0,this._limited=!1}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}yt(qc.ID,qc,1);class Che{get color(){return this._color}set color(e){this._color.equals(e)||(this._color=e,this._onDidChangeColor.fire(e))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(e){this._colorPresentations=e,this.presentationIndex>e.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}constructor(e,t,i){this.presentationIndex=i,this._onColorFlushed=new W,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new W,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new W,this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=e,this._color=e,this._colorPresentations=t}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(e,t){let i=-1;for(let n=0;n<this.colorPresentations.length;n++)if(t.toLowerCase()===this.colorPresentations[n].label){i=n;break}if(i===-1){const n=t.split("(")[0].toLowerCase();for(let s=0;s<this.colorPresentations.length;s++)if(this.colorPresentations[s].label.toLowerCase().startsWith(n)){i=s;break}}i!==-1&&i!==this.presentationIndex&&(this.presentationIndex=i,this._onDidChangePresentation.fire(this.presentation))}flushColor(){this._onColorFlushed.fire(this._color)}}const po=pe;class whe extends K{constructor(e,t,i,n=!1){super(),this.model=t,this.showingStandaloneColorPicker=n,this._closeButton=null,this._domNode=po(".colorpicker-header"),ie(e,this._domNode),this._pickedColorNode=ie(this._domNode,po(".picked-color")),ie(this._pickedColorNode,po("span.codicon.codicon-color-mode")),this._pickedColorPresentation=ie(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");const s=p("clickToToggleColorOptions","Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",s),this._originalColorNode=ie(this._domNode,po(".original-color")),this._originalColorNode.style.backgroundColor=q.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=i.getColorTheme().getColor(A1)||q.white,this._register(i.onDidColorThemeChange(r=>{this.backgroundColor=r.getColor(A1)||q.white})),this._register(Q(this._pickedColorNode,ge.CLICK,()=>this.model.selectNextColorPresentation())),this._register(Q(this._originalColorNode,ge.CLICK,()=>{this.model.color=this.model.originalColor,this.model.flushColor()})),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this._register(t.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=q.Format.CSS.format(t.color)||"",this._pickedColorNode.classList.toggle("light",t.color.rgba.a<.5?this.backgroundColor.isLighter():t.color.isLighter()),this.onDidChangeColor(this.model.color),this.showingStandaloneColorPicker&&(this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new She(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=q.Format.CSS.format(e)||"",this._pickedColorNode.classList.toggle("light",e.rgba.a<.5?this.backgroundColor.isLighter():e.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}}class She extends K{constructor(e){super(),this._onClicked=this._register(new W),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),ie(e,this._button);const t=document.createElement("div");t.classList.add("close-button-inner-div"),ie(this._button,t),ie(t,po(".button"+Re.asCSSSelector(Di("color-picker-close",he.close,p("closeIcon","Icon to close the color picker"))))).classList.add("close-icon"),this._button.onclick=()=>{this._onClicked.fire()}}}class yhe extends K{constructor(e,t,i,n=!1){super(),this.model=t,this.pixelRatio=i,this._insertButton=null,this._domNode=po(".colorpicker-body"),ie(e,this._domNode),this._saturationBox=new Lhe(this._domNode,this.model,this.pixelRatio),this._register(this._saturationBox),this._register(this._saturationBox.onDidChange(this.onDidSaturationValueChange,this)),this._register(this._saturationBox.onColorFlushed(this.flushColor,this)),this._opacityStrip=new xhe(this._domNode,this.model,n),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new Dhe(this._domNode,this.model,n),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),n&&(this._insertButton=this._register(new khe(this._domNode)),this._domNode.classList.add("standalone-colorpicker"))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:e,v:t}){const i=this.model.color.hsva;this.model.color=new q(new za(i.h,e,t,i.a))}onDidOpacityChange(e){const t=this.model.color.hsva;this.model.color=new q(new za(t.h,t.s,t.v,e))}onDidHueChange(e){const t=this.model.color.hsva,i=(1-e)*360;this.model.color=new q(new za(i===360?0:i,t.s,t.v,t.a))}get domNode(){return this._domNode}get saturationBox(){return this._saturationBox}get enterButton(){return this._insertButton}layout(){this._saturationBox.layout(),this._opacityStrip.layout(),this._hueStrip.layout()}}class Lhe extends K{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this._onDidChange=new W,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new W,this.onColorFlushed=this._onColorFlushed.event,this._domNode=po(".saturation-wrap"),ie(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",ie(this._domNode,this._canvas),this.selection=po(".saturation-selection"),ie(this._domNode,this.selection),this.layout(),this._register(Q(this._domNode,ge.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;this.monitor=this._register(new Bp);const t=ji(this._domNode);e.target!==this.selection&&this.onDidChangePosition(e.offsetX,e.offsetY),this.monitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>this.onDidChangePosition(n.pageX-t.left,n.pageY-t.top),()=>null);const i=Q(e.target.ownerDocument,ge.POINTER_UP,()=>{this._onColorFlushed.fire(),i.dispose(),this.monitor&&(this.monitor.stopMonitoring(!0),this.monitor=null)},!0)}onDidChangePosition(e,t){const i=Math.max(0,Math.min(1,e/this.width)),n=Math.max(0,Math.min(1,1-t/this.height));this.paintSelection(i,n),this._onDidChange.fire({s:i,v:n})}layout(){this.width=this._domNode.offsetWidth,this.height=this._domNode.offsetHeight,this._canvas.width=this.width*this.pixelRatio,this._canvas.height=this.height*this.pixelRatio,this.paint();const e=this.model.color.hsva;this.paintSelection(e.s,e.v)}paint(){const e=this.model.color.hsva,t=new q(new za(e.h,1,1,1)),i=this._canvas.getContext("2d"),n=i.createLinearGradient(0,0,this._canvas.width,0);n.addColorStop(0,"rgba(255, 255, 255, 1)"),n.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),n.addColorStop(1,"rgba(255, 255, 255, 0)");const s=i.createLinearGradient(0,0,0,this._canvas.height);s.addColorStop(0,"rgba(0, 0, 0, 0)"),s.addColorStop(1,"rgba(0, 0, 0, 1)"),i.rect(0,0,this._canvas.width,this._canvas.height),i.fillStyle=q.Format.CSS.format(t),i.fill(),i.fillStyle=n,i.fill(),i.fillStyle=s,i.fill()}paintSelection(e,t){this.selection.style.left=`${e*this.width}px`,this.selection.style.top=`${this.height-t*this.height}px`}onDidChangeColor(e){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();const t=e.hsva;this.paintSelection(t.s,t.v)}}class H6 extends K{constructor(e,t,i=!1){super(),this.model=t,this._onDidChange=new W,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new W,this.onColorFlushed=this._onColorFlushed.event,i?(this.domNode=ie(e,po(".standalone-strip")),this.overlay=ie(this.domNode,po(".standalone-overlay"))):(this.domNode=ie(e,po(".strip")),this.overlay=ie(this.domNode,po(".overlay"))),this.slider=ie(this.domNode,po(".slider")),this.slider.style.top="0px",this._register(Q(this.domNode,ge.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const e=this.getValue(this.model.color);this.updateSliderPosition(e)}onDidChangeColor(e){const t=this.getValue(e);this.updateSliderPosition(t)}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=this._register(new Bp),i=ji(this.domNode);this.domNode.classList.add("grabbing"),e.target!==this.slider&&this.onDidChangeTop(e.offsetY),t.startMonitoring(e.target,e.pointerId,e.buttons,s=>this.onDidChangeTop(s.pageY-i.top),()=>null);const n=Q(e.target.ownerDocument,ge.POINTER_UP,()=>{this._onColorFlushed.fire(),n.dispose(),t.stopMonitoring(!0),this.domNode.classList.remove("grabbing")},!0)}onDidChangeTop(e){const t=Math.max(0,Math.min(1,1-e/this.height));this.updateSliderPosition(t),this._onDidChange.fire(t)}updateSliderPosition(e){this.slider.style.top=`${(1-e)*this.height}px`}}class xhe extends H6{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(e){super.onDidChangeColor(e);const{r:t,g:i,b:n}=e.rgba,s=new q(new ht(t,i,n,1)),r=new q(new ht(t,i,n,0));this.overlay.style.background=`linear-gradient(to bottom, ${s} 0%, ${r} 100%)`}getValue(e){return e.hsva.a}}class Dhe extends H6{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("hue-strip")}getValue(e){return 1-e.hsva.h/360}}class khe extends K{constructor(e){super(),this._onClicked=this._register(new W),this.onClicked=this._onClicked.event,this._button=ie(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._button.onclick=t=>{this._onClicked.fire()}}get button(){return this._button}}class Ihe extends wr{constructor(e,t,i,n,s=!1){super(),this.model=t,this.pixelRatio=i,this._register(H_.onDidChange(()=>this.layout()));const r=po(".colorpicker-widget");e.appendChild(r),this.header=this._register(new whe(r,this.model,n,s)),this.body=this._register(new yhe(r,this.model,this.pixelRatio,s))}layout(){this.body.layout()}}var z6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},U6=function(o,e){return function(t,i){e(t,i,o)}};class Ehe{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n,this.forceShowAtRange=!0}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let Vw=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t){return[]}computeAsync(e,t,i){return Fi.fromPromise(this._computeAsync(e,t,i))}async _computeAsync(e,t,i){if(!this._editor.hasModel())return[];const n=qc.get(this._editor);if(!n)return[];for(const s of t){if(!n.isColorDecoration(s))continue;const r=n.getColorData(s.range.getStartPosition());if(r)return[await $6(this,this._editor.getModel(),r.colorInfo,r.provider)]}return[]}renderHoverParts(e,t){return K6(this,this._editor,this._themeService,t,e)}};Vw=z6([U6(1,tn)],Vw);class Nhe{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n}}let W0=class{constructor(e,t){this._editor=e,this._themeService=t,this._color=null}async createColorHover(e,t,i){if(!this._editor.hasModel()||!qc.get(this._editor))return null;const s=await F6(i,this._editor.getModel(),st.None);let r=null,a=null;for(const h of s){const u=h.colorInfo;k.containsRange(u.range,e.range)&&(r=u,a=h.provider)}const l=r??e,d=a??t,c=!!r;return{colorHover:await $6(this,this._editor.getModel(),l,d),foundInEditor:c}}async updateEditorModel(e){if(!this._editor.hasModel())return;const t=e.model;let i=new k(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await QC(this._editor.getModel(),t,this._color,i,e),i=j6(this._editor,i,t))}renderHoverParts(e,t){return K6(this,this._editor,this._themeService,t,e)}set color(e){this._color=e}get color(){return this._color}};W0=z6([U6(1,tn)],W0);async function $6(o,e,t,i){const n=e.getValueInRange(t.range),{red:s,green:r,blue:a,alpha:l}=t.color,d=new ht(Math.round(s*255),Math.round(r*255),Math.round(a*255),l),c=new q(d),h=await B6(e,t,i,st.None),u=new Che(c,[],0);return u.colorPresentations=h||[],u.guessColorPresentation(c,n),o instanceof Vw?new Ehe(o,k.lift(t.range),u,i):new Nhe(o,k.lift(t.range),u,i)}function K6(o,e,t,i,n){if(i.length===0||!e.hasModel())return K.None;if(n.setMinimumDimensions){const u=e.getOption(66)+8;n.setMinimumDimensions(new bt(302,u))}const s=new se,r=i[0],a=e.getModel(),l=r.model,d=s.add(new Ihe(n.fragment,l,e.getOption(141),t,o instanceof W0));n.setColorPicker(d);let c=!1,h=new k(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);if(o instanceof W0){const u=i[0].model.color;o.color=u,QC(a,l,u,h,r),s.add(l.onColorFlushed(g=>{o.color=g}))}else s.add(l.onColorFlushed(async u=>{await QC(a,l,u,h,r),c=!0,h=j6(e,h,l,n)}));return s.add(l.onDidChangeColor(u=>{QC(a,l,u,h,r)})),s.add(e.onDidChangeModelContent(u=>{c?c=!1:(n.hide(),e.focus())})),s}function j6(o,e,t,i){let n,s;if(t.presentation.textEdit){n=[t.presentation.textEdit],s=new k(t.presentation.textEdit.range.startLineNumber,t.presentation.textEdit.range.startColumn,t.presentation.textEdit.range.endLineNumber,t.presentation.textEdit.range.endColumn);const r=o.getModel()._setTrackedRange(null,s,3);o.pushUndoStop(),o.executeEdits("colorpicker",n),s=o.getModel()._getTrackedRange(r)||s}else n=[{range:e,text:t.presentation.label,forceMoveMarkers:!1}],s=e.setEndPosition(e.endLineNumber,e.startColumn+t.presentation.label.length),o.pushUndoStop(),o.executeEdits("colorpicker",n);return t.presentation.additionalTextEdits&&(n=[...t.presentation.additionalTextEdits],o.executeEdits("colorpicker",n),i&&i.hide()),o.pushUndoStop(),s}async function QC(o,e,t,i,n){const s=await B6(o,{range:i,color:{red:t.rgba.r/255,green:t.rgba.g/255,blue:t.rgba.b/255,alpha:t.rgba.a}},n.provider,st.None);e.colorPresentations=s||[]}function cN(o,e){return!!o[e]}class lD{constructor(e,t){this.target=e.target,this.isLeftClick=e.event.leftButton,this.isMiddleClick=e.event.middleButton,this.isRightClick=e.event.rightButton,this.hasTriggerModifier=cN(e.event,t.triggerModifier),this.hasSideBySideModifier=cN(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}}class e5{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=cN(e,t.triggerModifier)}}class qb{constructor(e,t,i,n){this.triggerKey=e,this.triggerModifier=t,this.triggerSideBySideKey=i,this.triggerSideBySideModifier=n}equals(e){return this.triggerKey===e.triggerKey&&this.triggerModifier===e.triggerModifier&&this.triggerSideBySideKey===e.triggerSideBySideKey&&this.triggerSideBySideModifier===e.triggerSideBySideModifier}}function t5(o){return o==="altKey"?ut?new qb(57,"metaKey",6,"altKey"):new qb(5,"ctrlKey",6,"altKey"):ut?new qb(6,"altKey",57,"metaKey"):new qb(6,"altKey",5,"ctrlKey")}class Ry extends K{constructor(e,t){var i;super(),this._onMouseMoveOrRelevantKeyDown=this._register(new W),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new W),this.onExecute=this._onExecute.event,this._onCancel=this._register(new W),this.onCancel=this._onCancel.event,this._editor=e,this._extractLineNumberFromMouseEvent=(i=t?.extractLineNumberFromMouseEvent)!==null&&i!==void 0?i:n=>n.target.position?n.target.position.lineNumber:0,this._opts=t5(this._editor.getOption(77)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration(n=>{if(n.hasChanged(77)){const s=t5(this._editor.getOption(77));if(this._opts.equals(s))return;this._opts=s,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}})),this._register(this._editor.onMouseMove(n=>this._onEditorMouseMove(new lD(n,this._opts)))),this._register(this._editor.onMouseDown(n=>this._onEditorMouseDown(new lD(n,this._opts)))),this._register(this._editor.onMouseUp(n=>this._onEditorMouseUp(new lD(n,this._opts)))),this._register(this._editor.onKeyDown(n=>this._onEditorKeyDown(new e5(n,this._opts)))),this._register(this._editor.onKeyUp(n=>this._onEditorKeyUp(new e5(n,this._opts)))),this._register(this._editor.onMouseDrag(()=>this._resetHandler())),this._register(this._editor.onDidChangeCursorSelection(n=>this._onDidChangeCursorSelection(n))),this._register(this._editor.onDidChangeModel(n=>this._resetHandler())),this._register(this._editor.onDidChangeModelContent(()=>this._resetHandler())),this._register(this._editor.onDidScrollChange(n=>{(n.scrollTopChanged||n.scrollLeftChanged)&&this._resetHandler()}))}_onDidChangeCursorSelection(e){e.selection&&e.selection.startColumn!==e.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(e){this._lastMouseMoveEvent=e,this._onMouseMoveOrRelevantKeyDown.fire([e,null])}_onEditorMouseDown(e){this._hasTriggerKeyOnMouseDown=e.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(e)}_onEditorMouseUp(e){const t=this._extractLineNumberFromMouseEvent(e);this._hasTriggerKeyOnMouseDown&&this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===t&&this._onExecute.fire(e)}_onEditorKeyDown(e){this._lastMouseMoveEvent&&(e.keyCodeIsTriggerKey||e.keyCodeIsSideBySideKey&&e.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,e]):e.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(e){e.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}}var The=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Nl=function(o,e){return function(t,i){e(t,i,o)}};let Gc=class extends rp{constructor(e,t,i,n,s,r,a,l,d,c,h,u,g){super(e,{...n.getRawOptions(),overflowWidgetsDomNode:n.getOverflowWidgetsDomNode()},i,s,r,a,l,d,c,h,u,g),this._parentEditor=n,this._overwriteOptions=t,super.updateOptions(this._overwriteOptions),this._register(n.onDidChangeConfiguration(f=>this._onParentConfigurationChanged(f)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(e){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(e){hS(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};Gc=The([Nl(4,Oe),Nl(5,Dt),Nl(6,ui),Nl(7,We),Nl(8,tn),Nl(9,Vi),Nl(10,Sl),Nl(11,Wt),Nl(12,Se)],Gc);const i5=new q(new ht(0,122,204)),Mhe={showArrow:!0,showFrame:!0,className:"",frameColor:i5,arrowColor:i5,keepEditorSelection:!1},Rhe="vs.editor.contrib.zoneWidget";class Ahe{constructor(e,t,i,n,s,r,a,l){this.id="",this.domNode=e,this.afterLineNumber=t,this.afterColumn=i,this.heightInLines=n,this.showInHiddenAreas=a,this.ordinal=l,this._onDomNodeTop=s,this._onComputedHeight=r}onDomNodeTop(e){this._onDomNodeTop(e)}onComputedHeight(e){this._onComputedHeight(e)}}class Phe{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}class Ay{constructor(e){this._editor=e,this._ruleName=Ay._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),Bk(this._ruleName)}set color(e){this._color!==e&&(this._color=e,this._updateStyle())}set height(e){this._height!==e&&(this._height=e,this._updateStyle())}_updateStyle(){Bk(this._ruleName),S1(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px; margin-left: -${this._height}px; `)}show(e){e.column===1&&(e={lineNumber:e.lineNumber,column:2}),this._decorations.set([{range:k.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}}Ay._IdGenerator=new IM(".arrow-decoration-");class Ohe{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new se,this.container=null,this._isShowing=!1,this.editor=e,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=Bl(t),hS(this.options,Mhe,!1),this.domNode=document.createElement("div"),this.options.isAccessible||(this.domNode.setAttribute("aria-hidden","true"),this.domNode.setAttribute("role","presentation")),this._disposables.add(this.editor.onDidLayoutChange(i=>{const n=this._getWidth(i);this.domNode.style.width=n+"px",this.domNode.style.left=this._getLeft(i)+"px",this._onWidth(n)}))}dispose(){this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._viewZone&&this.editor.changeViewZones(e=>{this._viewZone&&e.removeZone(this._viewZone.id),this._viewZone=null}),this._positionMarkerId.clear(),this._disposables.dispose()}create(){this.domNode.classList.add("zone-widget"),this.options.className&&this.domNode.classList.add(this.options.className),this.container=document.createElement("div"),this.container.classList.add("zone-widget-container"),this.domNode.appendChild(this.container),this.options.showArrow&&(this._arrow=new Ay(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(e){e.frameColor&&(this.options.frameColor=e.frameColor),e.arrowColor&&(this.options.arrowColor=e.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){const e=this.options.frameColor.toString();this.container.style.borderTopColor=e,this.container.style.borderBottomColor=e}if(this._arrow&&this.options.arrowColor){const e=this.options.arrowColor.toString();this._arrow.color=e}}_getWidth(e){return e.width-e.minimap.minimapWidth-e.verticalScrollbarWidth}_getLeft(e){return e.minimap.minimapWidth>0&&e.minimap.minimapLeft===0?e.minimap.minimapWidth:0}_onViewZoneTop(e){this.domNode.style.top=e+"px"}_onViewZoneHeight(e){var t;if(this.domNode.style.height=`${e}px`,this.container){const i=e-this._decoratingElementsHeight();this.container.style.height=`${i}px`;const n=this.editor.getLayoutInfo();this._doLayout(i,this._getWidth(n))}(t=this._resizeSash)===null||t===void 0||t.layout()}get position(){const e=this._positionMarkerId.getRange(0);if(e)return e.getStartPosition()}show(e,t){const i=k.isIRange(e)?k.lift(e):k.fromPositions(e);this._isShowing=!0,this._showImpl(i,t),this._isShowing=!1,this._positionMarkerId.set([{range:i,options:Ze.EMPTY}])}hide(){var e;this._viewZone&&(this.editor.changeViewZones(t=>{this._viewZone&&t.removeZone(this._viewZone.id)}),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),(e=this._arrow)===null||e===void 0||e.hide(),this._positionMarkerId.clear()}_decoratingElementsHeight(){const e=this.editor.getOption(66);let t=0;if(this.options.showArrow){const i=Math.round(e/3);t+=2*i}if(this.options.showFrame){const i=Math.round(e/9);t+=2*i}return t}_showImpl(e,t){const i=e.getStartPosition(),n=this.editor.getLayoutInfo(),s=this._getWidth(n);this.domNode.style.width=`${s}px`,this.domNode.style.left=this._getLeft(n)+"px";const r=document.createElement("div");r.style.overflow="hidden";const a=this.editor.getOption(66);if(!this.options.allowUnlimitedHeight){const u=Math.max(12,this.editor.getLayoutInfo().height/a*.8);t=Math.min(t,u)}let l=0,d=0;if(this._arrow&&this.options.showArrow&&(l=Math.round(a/3),this._arrow.height=l,this._arrow.show(i)),this.options.showFrame&&(d=Math.round(a/9)),this.editor.changeViewZones(u=>{this._viewZone&&u.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new Ahe(r,i.lineNumber,i.column,t,g=>this._onViewZoneTop(g),g=>this._onViewZoneHeight(g),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=u.addZone(this._viewZone),this._overlayWidget=new Phe(Rhe+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this.container&&this.options.showFrame){const u=this.options.frameWidth?this.options.frameWidth:d;this.container.style.borderTopWidth=u+"px",this.container.style.borderBottomWidth=u+"px"}const c=t*a-this._decoratingElementsHeight();this.container&&(this.container.style.top=l+"px",this.container.style.height=c+"px",this.container.style.overflow="hidden"),this._doLayout(c,s),this.options.keepEditorSelection||this.editor.setSelection(e);const h=this.editor.getModel();if(h){const u=h.validateRange(new k(e.startLineNumber,1,e.endLineNumber+1,1));this.revealRange(u,u.startLineNumber===h.getLineCount())}}revealRange(e,t){t?this.editor.revealLineNearTop(e.endLineNumber,0):this.editor.revealRange(e,0)}setCssClass(e,t){this.container&&(t&&this.container.classList.remove(t),this.container.classList.add(e))}_onWidth(e){}_doLayout(e,t){}_relayout(e){this._viewZone&&this._viewZone.heightInLines!==e&&this.editor.changeViewZones(t=>{this._viewZone&&(this._viewZone.heightInLines=e,t.layoutZone(this._viewZone.id))})}_initSash(){if(this._resizeSash)return;this._resizeSash=this._disposables.add(new An(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0);let e;this._disposables.add(this._resizeSash.onDidStart(t=>{this._viewZone&&(e={startY:t.startY,heightInLines:this._viewZone.heightInLines})})),this._disposables.add(this._resizeSash.onDidEnd(()=>{e=void 0})),this._disposables.add(this._resizeSash.onDidChange(t=>{if(e){const i=(t.currentY-e.startY)/this.editor.getOption(66),n=i<0?Math.ceil(i):Math.floor(i),s=e.heightInLines+n;s>5&&s<35&&this._relayout(s)}}))}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(this.domNode.style.height===null?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){const e=this.editor.getLayoutInfo();return e.width-e.minimap.minimapWidth}}var q6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},G6=function(o,e){return function(t,i){e(t,i,o)}};const Z6=ot("IPeekViewService");ct(Z6,class{constructor(){this._widgets=new Map}addExclusiveWidget(o,e){const t=this._widgets.get(o);t&&(t.listener.dispose(),t.widget.dispose());const i=()=>{const n=this._widgets.get(o);n&&n.widget===e&&(n.listener.dispose(),this._widgets.delete(o))};this._widgets.set(o,{widget:e,listener:e.onDidClose(i)})}},1);var xs;(function(o){o.inPeekEditor=new be("inReferenceSearchEditor",!0,p("inReferenceSearchEditor","Whether the current code editor is embedded inside peek")),o.notInPeekEditor=o.inPeekEditor.toNegated()})(xs||(xs={}));let V0=class{constructor(e,t){e instanceof Gc&&xs.inPeekEditor.bindTo(t)}dispose(){}};V0.ID="editor.contrib.referenceController";V0=q6([G6(1,We)],V0);yt(V0.ID,V0,0);function Fhe(o){const e=o.get(Dt).getFocusedCodeEditor();return e instanceof Gc?e.getParentEditor():e}const Bhe={headerBackgroundColor:q.white,primaryHeadingColor:q.fromHex("#333333"),secondaryHeadingColor:q.fromHex("#6c6c6cb3")};let Hw=class extends Ohe{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new W,this.onDidClose=this._onDidClose.event,hS(this.options,Bhe,!1)}dispose(){this.disposed||(this.disposed=!0,super.dispose(),this._onDidClose.fire(this))}style(e){const t=this.options;e.headerBackgroundColor&&(t.headerBackgroundColor=e.headerBackgroundColor),e.primaryHeadingColor&&(t.primaryHeadingColor=e.primaryHeadingColor),e.secondaryHeadingColor&&(t.secondaryHeadingColor=e.secondaryHeadingColor),super.style(e)}_applyStyles(){super._applyStyles();const e=this.options;this._headElement&&e.headerBackgroundColor&&(this._headElement.style.backgroundColor=e.headerBackgroundColor.toString()),this._primaryHeading&&e.primaryHeadingColor&&(this._primaryHeading.style.color=e.primaryHeadingColor.toString()),this._secondaryHeading&&e.secondaryHeadingColor&&(this._secondaryHeading.style.color=e.secondaryHeadingColor.toString()),this._bodyElement&&e.frameColor&&(this._bodyElement.style.borderColor=e.frameColor.toString())}_fillContainer(e){this.setCssClass("peekview-widget"),this._headElement=pe(".head"),this._bodyElement=pe(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=pe(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),vi(this._titleElement,"click",s=>this._onTitleClick(s))),ie(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=pe("span.filename"),this._secondaryHeading=pe("span.dirname"),this._metaHeading=pe("span.meta"),ie(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const i=pe(".peekview-actions");ie(this._headElement,i);const n=this._getActionBarOptions();this._actionbarWidget=new Go(i,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(new cs("peekview.close",p("label.close","Close"),Re.asClassName(he.close),!0,()=>(this.dispose(),Promise.resolve())),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:Kne.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(e){}setTitle(e,t){this._primaryHeading&&this._secondaryHeading&&(this._primaryHeading.innerText=e,this._primaryHeading.setAttribute("title",e),t?this._secondaryHeading.innerText=t:bn(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,Os(this._metaHeading)):is(this._metaHeading))}_doLayout(e,t){if(!this._isShowing&&e<0){this.dispose();return}const i=Math.ceil(this.editor.getOption(66)*1.2),n=Math.round(e-(i+2));this._doLayoutHead(i,t),this._doLayoutBody(n,t)}_doLayoutHead(e,t){this._headElement&&(this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(e,t){this._bodyElement&&(this._bodyElement.style.height=`${e}px`)}};Hw=q6([G6(2,Oe)],Hw);const Whe=R("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:q.black,hcLight:q.white},p("peekViewTitleBackground","Background color of the peek view title area.")),Y6=R("peekViewTitleLabel.foreground",{dark:q.white,light:q.black,hcDark:q.white,hcLight:cr},p("peekViewTitleForeground","Color of the peek view title.")),X6=R("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},p("peekViewTitleInfoForeground","Color of the peek view title info.")),Vhe=R("peekView.border",{dark:Ss,light:Ss,hcDark:dt,hcLight:dt},p("peekViewBorder","Color of the peek view borders and arrow.")),Hhe=R("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:q.black,hcLight:q.white},p("peekViewResultsBackground","Background color of the peek view result list."));R("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:q.white,hcLight:cr},p("peekViewResultsMatchForeground","Foreground color for line nodes in the peek view result list."));R("peekViewResult.fileForeground",{dark:q.white,light:"#1E1E1E",hcDark:q.white,hcLight:cr},p("peekViewResultsFileForeground","Foreground color for file nodes in the peek view result list."));R("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},p("peekViewResultsSelectionBackground","Background color of the selected entry in the peek view result list."));R("peekViewResult.selectionForeground",{dark:q.white,light:"#6C6C6C",hcDark:q.white,hcLight:cr},p("peekViewResultsSelectionForeground","Foreground color of the selected entry in the peek view result list."));const rc=R("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:q.black,hcLight:q.white},p("peekViewEditorBackground","Background color of the peek view editor."));R("peekViewEditorGutter.background",{dark:rc,light:rc,hcDark:rc,hcLight:rc},p("peekViewEditorGutterBackground","Background color of the gutter in the peek view editor."));R("peekViewEditorStickyScroll.background",{dark:rc,light:rc,hcDark:rc,hcLight:rc},p("peekViewEditorStickScrollBackground","Background color of sticky scroll in the peek view editor."));R("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},p("peekViewResultsMatchHighlight","Match highlight color in the peek view result list."));R("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},p("peekViewEditorMatchHighlight","Match highlight color in the peek view editor."));R("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:Zt,hcLight:Zt},p("peekViewEditorMatchHighlightBorder","Match highlight border in the peek view editor."));class Zc{constructor(e,t,i,n){this.isProviderFirst=e,this.parent=t,this.link=i,this._rangeCallback=n,this.id=$I.nextId()}get uri(){return this.link.uri}get range(){var e,t;return(t=(e=this._range)!==null&&e!==void 0?e:this.link.targetSelectionRange)!==null&&t!==void 0?t:this.link.range}set range(e){this._range=e,this._rangeCallback(this)}get ariaMessage(){var e;const t=(e=this.parent.getPreview(this))===null||e===void 0?void 0:e.preview(this.range);return t?p({},"{0} in {1} on line {2} at column {3}",t.value,qo(this.uri),this.range.startLineNumber,this.range.startColumn):p("aria.oneReference","in {0} on line {1} at column {2}",qo(this.uri),this.range.startLineNumber,this.range.startColumn)}}class zhe{constructor(e){this._modelReference=e}dispose(){this._modelReference.dispose()}preview(e,t=8){const i=this._modelReference.object.textEditorModel;if(!i)return;const{startLineNumber:n,startColumn:s,endLineNumber:r,endColumn:a}=e,l=i.getWordUntilPosition({lineNumber:n,column:s-t}),d=new k(n,l.startColumn,n,s),c=new k(r,a,r,1073741824),h=i.getValueInRange(d).replace(/^\s+/,""),u=i.getValueInRange(e),g=i.getValueInRange(c).replace(/\s+$/,"");return{value:h+u+g,highlight:{start:h.length,end:h.length+u.length}}}}class H0{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new xi}dispose(){Et(this._previews.values()),this._previews.clear()}getPreview(e){return this._previews.get(e.uri)}get ariaMessage(){const e=this.children.length;return e===1?p("aria.fileReferences.1","1 symbol in {0}, full path {1}",qo(this.uri),this.uri.fsPath):p("aria.fileReferences.N","{0} symbols in {1}, full path {2}",e,qo(this.uri),this.uri.fsPath)}async resolve(e){if(this._previews.size!==0)return this;for(const t of this.children)if(!this._previews.has(t.uri))try{const i=await e.createModelReference(t.uri);this._previews.set(t.uri,new zhe(i))}catch(i){Ge(i)}return this}}class Us{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new W,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;e.sort(Us._compareReferences);let n;for(const s of e)if((!n||!Yt.isEqual(n.uri,s.uri,!0))&&(n=new H0(this,s.uri),this.groups.push(n)),n.children.length===0||Us._compareReferences(s,n.children[n.children.length-1])!==0){const r=new Zc(i===s,n,s,a=>this._onDidChangeReferenceRange.fire(a));this.references.push(r),n.children.push(r)}}dispose(){Et(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new Us(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?p("aria.result.0","No results found"):this.references.length===1?p("aria.result.1","Found 1 symbol in {0}",this.references[0].uri.fsPath):this.groups.length===1?p("aria.result.n1","Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):p("aria.result.nm","Found {0} symbols in {1} files",this.references.length,this.groups.length)}nextOrPreviousReference(e,t){const{parent:i}=e;let n=i.children.indexOf(e);const s=i.children.length,r=i.parent.groups.length;return r===1||t&&n+1<s||!t&&n>0?(t?n=(n+1)%s:n=(n+s-1)%s,i.children[n]):(n=i.parent.groups.indexOf(i),t?(n=(n+1)%r,i.parent.groups[n].children[0]):(n=(n+r-1)%r,i.parent.groups[n].children[i.parent.groups[n].children.length-1]))}nearestReference(e,t){const i=this.references.map((n,s)=>({idx:s,prefixLen:bu(n.uri.toString(),e.toString()),offsetDist:Math.abs(n.range.startLineNumber-t.lineNumber)*100+Math.abs(n.range.startColumn-t.column)})).sort((n,s)=>n.prefixLen>s.prefixLen?-1:n.prefixLen<s.prefixLen?1:n.offsetDist<s.offsetDist?-1:n.offsetDist>s.offsetDist?1:0)[0];if(i)return this.references[i.idx]}referenceAt(e,t){for(const i of this.references)if(i.uri.toString()===e.toString()&&k.containsPosition(i.range,t))return i}firstReference(){for(const e of this.references)if(e.isProviderFirst)return e;return this.references[0]}static _compareReferences(e,t){return Yt.compare(e.uri,t.uri)||k.compareRangesUsingStarts(e.range,t.range)}}var Py=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Oy=function(o,e){return function(t,i){e(t,i,o)}},hN;let uN=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof Us||e instanceof H0}getChildren(e){if(e instanceof Us)return e.groups;if(e instanceof H0)return e.resolve(this._resolverService).then(t=>t.children);throw new Error("bad tree")}};uN=Py([Oy(0,ks)],uN);class Uhe{getHeight(){return 23}getTemplateId(e){return e instanceof H0?z0.id:$v.id}}let gN=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){var t;if(e instanceof Zc){const i=(t=e.parent.getPreview(e))===null||t===void 0?void 0:t.preview(e.range);if(i)return i.value}return qo(e.uri)}};gN=Py([Oy(0,Pt)],gN);class $he{getId(e){return e instanceof Zc?e.id:e.uri}}let fN=class extends K{constructor(e,t){super(),this._labelService=t;const i=document.createElement("div");i.classList.add("reference-file"),this.file=this._register(new Lw(i,{supportHighlights:!0})),this.badge=new gE(ie(i,pe(".count")),{},nB),e.appendChild(i)}set(e,t){const i=QS(e.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri),this._labelService.getUriLabel(i,{relative:!0}),{title:this._labelService.getUriLabel(e.uri),matches:t});const n=e.children.length;this.badge.setCount(n),n>1?this.badge.setTitleFormat(p("referencesCount","{0} references",n)):this.badge.setTitleFormat(p("referenceCount","{0} reference",n))}};fN=Py([Oy(1,ap)],fN);let z0=hN=class{constructor(e){this._instantiationService=e,this.templateId=hN.id}renderTemplate(e){return this._instantiationService.createInstance(fN,e)}renderElement(e,t,i){i.set(e.element,ry(e.filterData))}disposeTemplate(e){e.dispose()}};z0.id="FileReferencesRenderer";z0=hN=Py([Oy(0,Oe)],z0);class Khe{constructor(e){this.label=new Cc(e)}set(e,t){var i;const n=(i=e.parent.getPreview(e))===null||i===void 0?void 0:i.preview(e.range);if(!n||!n.value)this.label.set(`${qo(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`);else{const{value:s,highlight:r}=n;t&&!Xr.isDefault(t)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(s,ry(t))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(s,[r]))}}}class $v{constructor(){this.templateId=$v.id}renderTemplate(e){return new Khe(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(){}}$v.id="OneReferenceRenderer";class jhe{getWidgetAriaLabel(){return p("treeAriaLabel","References")}getAriaLabel(e){return e.ariaMessage}}var qhe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Tl=function(o,e){return function(t,i){e(t,i,o)}};class Fy{constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new se,this._callOnModelChange=new se,this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();const e=this._editor.getModel();if(e){for(const t of this._model.references)if(t.uri.toString()===e.uri.toString()){this._addDecorations(t.parent);return}}}_addDecorations(e){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(()=>this._onDecorationChanged()));const t=[],i=[];for(let n=0,s=e.children.length;n<s;n++){const r=e.children[n];this._decorationIgnoreSet.has(r.id)||r.uri.toString()===this._editor.getModel().uri.toString()&&(t.push({range:r.range,options:Fy.DecorationOptions}),i.push(n))}this._editor.changeDecorations(n=>{const s=n.deltaDecorations([],t);for(let r=0;r<s.length;r++)this._decorations.set(s[r],e.children[i[r]])})}_onDecorationChanged(){const e=[],t=this._editor.getModel();if(t){for(const[i,n]of this._decorations){const s=t.getDecorationRange(i);if(!s)continue;let r=!1;if(!k.equalsRange(s,n.range)){if(k.spansMultipleLines(s))r=!0;else{const a=n.range.endColumn-n.range.startColumn,l=s.endColumn-s.startColumn;a!==l&&(r=!0)}r?(this._decorationIgnoreSet.add(n.id),e.push(i)):n.range=s}}for(let i=0,n=e.length;i<n;i++)this._decorations.delete(e[i]);this._editor.removeDecorations(e)}}removeDecorations(){this._editor.removeDecorations([...this._decorations.keys()]),this._decorations.clear()}}Fy.DecorationOptions=Ze.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});class Ghe{constructor(){this.ratio=.7,this.heightInLines=18}static fromJSON(e){let t,i;try{const n=JSON.parse(e);t=n.ratio,i=n.heightInLines}catch{}return{ratio:t||.7,heightInLines:i||18}}}class Zhe extends cE{}let pN=class extends Hw{constructor(e,t,i,n,s,r,a,l,d,c,h,u){super(e,{showFrame:!1,showArrow:!0,isResizeable:!0,isAccessible:!0,supportOnTitleClick:!0},r),this._defaultTreeKeyboardSupport=t,this.layoutData=i,this._textModelResolverService=s,this._instantiationService=r,this._peekViewService=a,this._uriLabel=l,this._undoRedoService=d,this._keybindingService=c,this._languageService=h,this._languageConfigurationService=u,this._disposeOnNewModel=new se,this._callOnDispose=new se,this._onDidSelectReference=new W,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new bt(0,0),this._applyTheme(n.getColorTheme()),this._callOnDispose.add(n.onDidColorThemeChange(this._applyTheme.bind(this))),this._peekViewService.addExclusiveWidget(e,this),this.create()}dispose(){this.setModel(void 0),this._callOnDispose.dispose(),this._disposeOnNewModel.dispose(),Et(this._preview),Et(this._previewNotAvailableMessage),Et(this._tree),Et(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){const t=e.getColor(Vhe)||q.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(Whe)||q.transparent,primaryHeadingColor:e.getColor(Y6),secondaryHeadingColor:e.getColor(X6)})}show(e){super.show(e,this.layoutData.heightInLines||18)}focusOnReferenceTree(){this._tree.domFocus()}focusOnPreviewEditor(){this._preview.focus()}isPreviewEditorFocused(){return this._preview.hasTextFocus()}_onTitleClick(e){this._preview&&this._preview.getModel()&&this._onDidSelectReference.fire({element:this._getFocusedReference(),kind:e.ctrlKey||e.metaKey||e.altKey?"side":"open",source:"title"})}_fillBody(e){this.setCssClass("reference-zone-widget"),this._messageContainer=ie(e,pe("div.messages")),is(this._messageContainer),this._splitView=new aB(e,{orientation:1}),this._previewContainer=ie(e,pe("div.preview.inline"));const t={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!0},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._preview=this._instantiationService.createInstance(Gc,this._previewContainer,t,{},this.editor),is(this._previewContainer),this._previewNotAvailableMessage=new gl(p("missingPreviewMessage","no preview available"),So,gl.DEFAULT_CREATION_OPTIONS,null,this._undoRedoService,this._languageService,this._languageConfigurationService),this._treeContainer=ie(e,pe("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new jhe,keyboardNavigationLabelProvider:this._instantiationService.createInstance(gN),identityProvider:new $he,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:Hhe}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(vi(this._treeContainer,"keydown",s=>{s.equals(9)&&(this._keybindingService.dispatchEvent(s,s.target),s.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(Zhe,"ReferencesWidget",this._treeContainer,new Uhe,[this._instantiationService.createInstance(z0),this._instantiationService.createInstance($v)],this._instantiationService.createInstance(uN),i),this._splitView.addView({onDidChange:fe.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:s=>{this._preview.layout({height:this._dim.height,width:s})}},_w.Distribute),this._splitView.addView({onDidChange:fe.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:s=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${s}px`,this._tree.layout(this._dim.height,s)}},_w.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)},void 0));const n=(s,r)=>{s instanceof Zc&&(r==="show"&&this._revealReference(s,!1),this._onDidSelectReference.fire({element:s,kind:r,source:"tree"}))};this._tree.onDidOpen(s=>{s.sideBySide?n(s.element,"side"):s.editorOptions.pinned?n(s.element,"goto"):n(s.element,"show")}),is(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new bt(t,e),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(t),this._splitView.resizeView(0,t*this.layoutData.ratio)}setSelection(e){return this._revealReference(e,!0).then(()=>{this._model&&(this._tree.setSelection([e]),this._tree.setFocus([e]))})}setModel(e){return this._disposeOnNewModel.clear(),this._model=e,this._model?this._onNewModel():Promise.resolve()}_onNewModel(){return this._model?this._model.isEmpty?(this.setTitle(""),this._messageContainer.innerText=p("noResults","No results"),Os(this._messageContainer),Promise.resolve(void 0)):(is(this._messageContainer),this._decorationsManager=new Fy(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange(e=>this._tree.rerender(e))),this._disposeOnNewModel.add(this._preview.onMouseDown(e=>{const{event:t,target:i}=e;if(t.detail!==2)return;const n=this._getFocusedReference();n&&this._onDidSelectReference.fire({element:{uri:n.uri,range:i.range},kind:t.ctrlKey||t.metaKey||t.altKey?"side":"open",source:"editor"})})),this.container.classList.add("results-loaded"),Os(this._treeContainer),Os(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(this._model.groups.length===1?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){const[e]=this._tree.getFocus();if(e instanceof Zc)return e;if(e instanceof H0&&e.children.length>0)return e.children[0]}async revealReference(e){await this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:"goto",source:"tree"})}async _revealReference(e,t){if(this._revealedReference===e)return;this._revealedReference=e,e.uri.scheme!==Ye.inMemory?this.setTitle(AQ(e.uri),this._uriLabel.getUriLabel(QS(e.uri))):this.setTitle(p("peekView.alternateTitle","References"));const i=this._textModelResolverService.createModelReference(e.uri);this._tree.getInput()===e.parent?this._tree.reveal(e):(t&&this._tree.reveal(e.parent),await this._tree.expand(e.parent),this._tree.reveal(e));const n=await i;if(!this._model){n.dispose();return}Et(this._previewModelReference);const s=n.object;if(s){const r=this._preview.getModel()===s.textEditorModel?0:1,a=k.lift(e.range).collapseToStart();this._previewModelReference=n,this._preview.setModel(s.textEditorModel),this._preview.setSelection(a),this._preview.revealRangeInCenter(a,r)}else this._preview.setModel(this._previewNotAvailableMessage),n.dispose()}};pN=qhe([Tl(3,tn),Tl(4,ks),Tl(5,Oe),Tl(6,Z6),Tl(7,ap),Tl(8,JS),Tl(9,Pt),Tl(10,ni),Tl(11,Wt)],pN);var Yhe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kg=function(o,e){return function(t,i){e(t,i,o)}},JC;const cg=new be("referenceSearchVisible",!1,p("referenceSearchVisible","Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let Cp=JC=class{static get(e){return e.getContribution(JC.ID)}constructor(e,t,i,n,s,r,a,l){this._defaultTreeKeyboardSupport=e,this._editor=t,this._editorService=n,this._notificationService=s,this._instantiationService=r,this._storageService=a,this._configurationService=l,this._disposables=new se,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=cg.bindTo(i)}dispose(){var e,t;this._referenceSearchVisible.reset(),this._disposables.dispose(),(e=this._widget)===null||e===void 0||e.dispose(),(t=this._model)===null||t===void 0||t.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(e,t,i){let n;if(this._widget&&(n=this._widget.position),this.closeWidget(),n&&e.containsPosition(n))return;this._peekMode=i,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>{this.closeWidget()})),this._disposables.add(this._editor.onDidChangeModel(()=>{this._ignoreModelChangeEvent||this.closeWidget()}));const s="peekViewLayout",r=Ghe.fromJSON(this._storageService.get(s,0,"{}"));this._widget=this._instantiationService.createInstance(pN,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(p("labelLoading","Loading...")),this._widget.show(e),this._disposables.add(this._widget.onDidClose(()=>{t.cancel(),this._widget&&(this._storageService.store(s,JSON.stringify(this._widget.layoutData),0,1),this._widget=void 0),this.closeWidget()})),this._disposables.add(this._widget.onDidSelectReference(l=>{const{element:d,kind:c}=l;if(d)switch(c){case"open":(l.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))&&this.openReference(d,!1,!1);break;case"side":this.openReference(d,!0,!1);break;case"goto":i?this._gotoReference(d,!0):this.openReference(d,!1,!0);break}}));const a=++this._requestIdPool;t.then(l=>{var d;if(a!==this._requestIdPool||!this._widget){l.dispose();return}return(d=this._model)===null||d===void 0||d.dispose(),this._model=l,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(p("metaTitle.N","{0} ({1})",this._model.title,this._model.references.length));const c=this._editor.getModel().uri,h=new V(e.startLineNumber,e.startColumn),u=this._model.nearestReference(c,h);if(u)return this._widget.setSelection(u).then(()=>{this._widget&&this._editor.getOption(86)==="editor"&&this._widget.focusOnPreviewEditor()})}})},l=>{this._notificationService.error(l)})}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(e){if(!this._editor.hasModel()||!this._model||!this._widget)return;const t=this._widget.position;if(!t)return;const i=this._model.nearestReference(this._editor.getModel().uri,t);if(!i)return;const n=this._model.nextOrPreviousReference(i,e),s=this._editor.hasTextFocus(),r=this._widget.isPreviewEditorFocused();await this._widget.setSelection(n),await this._gotoReference(n,!1),s?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}async revealReference(e){!this._editor.hasModel()||!this._model||!this._widget||await this._widget.revealReference(e)}closeWidget(e=!0){var t,i;(t=this._widget)===null||t===void 0||t.dispose(),(i=this._model)===null||i===void 0||i.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,e&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(e,t){var i;(i=this._widget)===null||i===void 0||i.hide(),this._ignoreModelChangeEvent=!0;const n=k.lift(e.range).collapseToStart();return this._editorService.openCodeEditor({resource:e.uri,options:{selection:n,selectionSource:"code.jump",pinned:t}},this._editor).then(s=>{var r;if(this._ignoreModelChangeEvent=!1,!s||!this._widget){this.closeWidget();return}if(this._editor===s)this._widget.show(n),this._widget.focusOnReferenceTree();else{const a=JC.get(s),l=this._model.clone();this.closeWidget(),s.focus(),a?.toggleWidget(n,Zi(d=>Promise.resolve(l)),(r=this._peekMode)!==null&&r!==void 0?r:!1)}},s=>{this._ignoreModelChangeEvent=!1,Ge(s)})}openReference(e,t,i){t||this.closeWidget();const{uri:n,range:s}=e;this._editorService.openCodeEditor({resource:n,options:{selection:s,selectionSource:"code.jump",pinned:i}},this._editor,t)}};Cp.ID="editor.contrib.referencesController";Cp=JC=Yhe([kg(2,We),kg(3,Dt),kg(4,Vi),kg(5,Oe),kg(6,da),kg(7,ft)],Cp);function hg(o,e){const t=Fhe(o);if(!t)return;const i=Cp.get(t);i&&e(i)}Ls.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:qi(2089,60),when:te.or(cg,xs.inPeekEditor),handler(o){hg(o,e=>{e.changeFocusBetweenPreviewAndReferences()})}});Ls.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:te.or(cg,xs.inPeekEditor),handler(o){hg(o,e=>{e.goToNextOrPreviousReference(!0)})}});Ls.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:te.or(cg,xs.inPeekEditor),handler(o){hg(o,e=>{e.goToNextOrPreviousReference(!1)})}});gt.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");gt.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");gt.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");gt.registerCommand("closeReferenceSearch",o=>hg(o,e=>e.closeWidget()));Ls.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:te.and(xs.inPeekEditor,te.not("config.editor.stablePeek"))});Ls.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:te.and(cg,te.not("config.editor.stablePeek"))});Ls.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:te.and(cg,SB,KM.negate(),jM.negate()),handler(o){var e;const i=(e=o.get(Qo).lastFocusedList)===null||e===void 0?void 0:e.getFocus();Array.isArray(i)&&i[0]instanceof Zc&&hg(o,n=>n.revealReference(i[0]))}});Ls.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:te.and(cg,SB,KM.negate(),jM.negate()),handler(o){var e;const i=(e=o.get(Qo).lastFocusedList)===null||e===void 0?void 0:e.getFocus();Array.isArray(i)&&i[0]instanceof Zc&&hg(o,n=>n.openReference(i[0],!0,!0))}});gt.registerCommand("openReference",o=>{var e;const i=(e=o.get(Qo).lastFocusedList)===null||e===void 0?void 0:e.getFocus();Array.isArray(i)&&i[0]instanceof Zc&&hg(o,n=>n.openReference(i[0],!1,!0))});var Q6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Gm=function(o,e){return function(t,i){e(t,i,o)}};const wR=new be("hasSymbols",!1,p("hasSymbols","Whether there are symbol locations that can be navigated via keyboard-only.")),By=ot("ISymbolNavigationService");let mN=class{constructor(e,t,i,n){this._editorService=t,this._notificationService=i,this._keybindingService=n,this._currentModel=void 0,this._currentIdx=-1,this._ignoreEditorChange=!1,this._ctxHasSymbols=wR.bindTo(e)}reset(){var e,t;this._ctxHasSymbols.reset(),(e=this._currentState)===null||e===void 0||e.dispose(),(t=this._currentMessage)===null||t===void 0||t.dispose(),this._currentModel=void 0,this._currentIdx=-1}put(e){const t=e.parent.parent;if(t.references.length<=1){this.reset();return}this._currentModel=t,this._currentIdx=t.references.indexOf(e),this._ctxHasSymbols.set(!0),this._showMessage();const i=new _N(this._editorService),n=i.onDidChange(s=>{if(this._ignoreEditorChange)return;const r=this._editorService.getActiveCodeEditor();if(!r)return;const a=r.getModel(),l=r.getPosition();if(!a||!l)return;let d=!1,c=!1;for(const h of t.references)if(J2(h.uri,a.uri))d=!0,c=c||k.containsPosition(h.range,l);else if(d)break;(!d||!c)&&this.reset()});this._currentState=fr(i,n)}revealNext(e){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;const t=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:t.uri,options:{selection:k.collapseToStart(t.range),selectionRevealType:3}},e).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){var e;(e=this._currentMessage)===null||e===void 0||e.dispose();const t=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),i=t?p("location.kb","Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,t.getLabel()):p("location","Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(i)}};mN=Q6([Gm(0,We),Gm(1,Dt),Gm(2,Vi),Gm(3,Pt)],mN);ct(By,mN,1);ue(new class extends cn{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:wR,kbOpts:{weight:100,primary:70}})}runEditorCommand(o,e){return o.get(By).revealNext(e)}});Ls.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:wR,primary:9,handler(o){o.get(By).reset()}});let _N=class{constructor(e){this._listener=new Map,this._disposables=new se,this._onDidChange=new W,this.onDidChange=this._onDidChange.event,this._disposables.add(e.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(e.onCodeEditorAdd(this._onDidAddEditor,this)),e.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),Et(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,fr(e.onDidChangeCursorPosition(t=>this._onDidChange.fire({editor:e})),e.onDidChangeModelContent(t=>this._onDidChange.fire({editor:e}))))}_onDidRemoveEditor(e){var t;(t=this._listener.get(e))===null||t===void 0||t.dispose(),this._listener.delete(e)}};_N=Q6([Gm(0,Dt)],_N);async function Kv(o,e,t,i){const s=t.ordered(o).map(a=>Promise.resolve(i(a,o,e)).then(void 0,l=>{Mi(l)})),r=await Promise.all(s);return Qr(r.flat())}function Wy(o,e,t,i){return Kv(e,t,o,(n,s,r)=>n.provideDefinition(s,r,i))}function J6(o,e,t,i){return Kv(e,t,o,(n,s,r)=>n.provideDeclaration(s,r,i))}function eW(o,e,t,i){return Kv(e,t,o,(n,s,r)=>n.provideImplementation(s,r,i))}function tW(o,e,t,i){return Kv(e,t,o,(n,s,r)=>n.provideTypeDefinition(s,r,i))}function Vy(o,e,t,i,n){return Kv(e,t,o,async(s,r,a)=>{const l=await s.provideReferences(r,a,{includeDeclaration:!0},n);if(!i||!l||l.length!==2)return l;const d=await s.provideReferences(r,a,{includeDeclaration:!1},n);return d&&d.length===1?d:l})}async function jv(o){const e=await o(),t=new Us(e,""),i=t.references.map(n=>n.link);return t.dispose(),i}Cl("_executeDefinitionProvider",(o,e,t)=>{const i=o.get(Se),n=Wy(i.definitionProvider,e,t,st.None);return jv(()=>n)});Cl("_executeTypeDefinitionProvider",(o,e,t)=>{const i=o.get(Se),n=tW(i.typeDefinitionProvider,e,t,st.None);return jv(()=>n)});Cl("_executeDeclarationProvider",(o,e,t)=>{const i=o.get(Se),n=J6(i.declarationProvider,e,t,st.None);return jv(()=>n)});Cl("_executeReferenceProvider",(o,e,t)=>{const i=o.get(Se),n=Vy(i.referenceProvider,e,t,!1,st.None);return jv(()=>n)});Cl("_executeImplementationProvider",(o,e,t)=>{const i=o.get(Se),n=eW(i.implementationProvider,e,t,st.None);return jv(()=>n)});var ym,Lm,xm,Gb,Zb,Yb,Xb,Qb;vn.appendMenuItem(N.EditorContext,{submenu:N.EditorContextPeek,title:p("peek.submenu","Peek"),group:"navigation",order:100});class wp{static is(e){return!e||typeof e!="object"?!1:!!(e instanceof wp||V.isIPosition(e.position)&&e.model)}constructor(e,t){this.model=e,this.position=t}}class Yn extends aa{static all(){return Yn._allSymbolNavigationCommands.values()}static _patchConfig(e){const t={...e,f1:!0};if(t.menu)for(const i of rt.wrap(t.menu))(i.id===N.EditorContext||i.id===N.EditorContextPeek)&&(i.when=te.and(e.precondition,i.when));return t}constructor(e,t){super(Yn._patchConfig(t)),this.configuration=e,Yn._allSymbolNavigationCommands.set(t.id,this)}runEditorCommand(e,t,i,n){if(!t.hasModel())return Promise.resolve(void 0);const s=e.get(Vi),r=e.get(Dt),a=e.get(lh),l=e.get(By),d=e.get(Se),c=e.get(Oe),h=t.getModel(),u=t.getPosition(),g=wp.is(i)?i:new wp(h,u),f=new Uc(t,5),m=DS(this._getLocationModel(d,g.model,g.position,f.token),f.token).then(async _=>{var v;if(!_||f.token.isCancellationRequested)return;js(_.ariaMessage);let b;if(_.referenceAt(h.uri,u)){const w=this._getAlternativeCommand(t);!Yn._activeAlternativeCommands.has(w)&&Yn._allSymbolNavigationCommands.has(w)&&(b=Yn._allSymbolNavigationCommands.get(w))}const C=_.references.length;if(C===0){if(!this.configuration.muteMessage){const w=h.getWordAtPosition(u);(v=zs.get(t))===null||v===void 0||v.showMessage(this._getNoResultFoundMessage(w),u)}}else if(C===1&&b)Yn._activeAlternativeCommands.add(this.desc.id),c.invokeFunction(w=>b.runEditorCommand(w,t,i,n).finally(()=>{Yn._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(r,l,t,_,n)},_=>{s.error(_)}).finally(()=>{f.dispose()});return a.showWhile(m,250),m}async _onResult(e,t,i,n,s){const r=this._getGoToPreference(i);if(!(i instanceof Gc)&&(this.configuration.openInPeek||r==="peek"&&n.references.length>1))this._openInPeek(i,n,s);else{const a=n.firstReference(),l=n.references.length>1&&r==="gotoAndPeek",d=await this._openReference(i,e,a,this.configuration.openToSide,!l);l&&d?this._openInPeek(d,n,s):n.dispose(),r==="goto"&&t.put(a)}}async _openReference(e,t,i,n,s){let r;if(Xz(i)&&(r=i.targetSelectionRange),r||(r=i.range),!r)return;const a=await t.openCodeEditor({resource:i.uri,options:{selection:k.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},e,n);if(a){if(s){const l=a.getModel(),d=a.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===l&&d.clear()},350)}return a}}_openInPeek(e,t,i){const n=Cp.get(e);n&&e.hasModel()?n.toggleWidget(i??e.getSelection(),Zi(s=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}}Yn._allSymbolNavigationCommands=new Map;Yn._activeAlternativeCommands=new Set;class qv extends Yn{async _getLocationModel(e,t,i,n){return new Us(await Wy(e.definitionProvider,t,i,n),p("def.title","Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?p("noResultWord","No definition found for '{0}'",e.word):p("generic.noResults","No definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleDefinitions}}Xt((ym=class extends qv{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:ym.id,title:{value:p("actions.goToDecl.label","Go to Definition"),original:"Go to Definition",mnemonicTitle:p({},"Go to &&Definition")},precondition:te.and(M.hasDefinitionProvider,M.isInWalkThroughSnippet.toNegated()),keybinding:[{when:M.editorTextFocus,primary:70,weight:100},{when:te.and(M.editorTextFocus,bB),primary:2118,weight:100}],menu:[{id:N.EditorContext,group:"navigation",order:1.1},{id:N.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),gt.registerCommandAlias("editor.action.goToDeclaration",ym.id)}},ym.id="editor.action.revealDefinition",ym));Xt((Lm=class extends qv{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:Lm.id,title:{value:p("actions.goToDeclToSide.label","Open Definition to the Side"),original:"Open Definition to the Side"},precondition:te.and(M.hasDefinitionProvider,M.isInWalkThroughSnippet.toNegated()),keybinding:[{when:M.editorTextFocus,primary:qi(2089,70),weight:100},{when:te.and(M.editorTextFocus,bB),primary:qi(2089,2118),weight:100}]}),gt.registerCommandAlias("editor.action.openDeclarationToTheSide",Lm.id)}},Lm.id="editor.action.revealDefinitionAside",Lm));Xt((xm=class extends qv{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:xm.id,title:{value:p("actions.previewDecl.label","Peek Definition"),original:"Peek Definition"},precondition:te.and(M.hasDefinitionProvider,xs.notInPeekEditor,M.isInWalkThroughSnippet.toNegated()),keybinding:{when:M.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:N.EditorContextPeek,group:"peek",order:2}}),gt.registerCommandAlias("editor.action.previewDeclaration",xm.id)}},xm.id="editor.action.peekDefinition",xm));class iW extends Yn{async _getLocationModel(e,t,i,n){return new Us(await J6(e.declarationProvider,t,i,n),p("decl.title","Declarations"))}_getNoResultFoundMessage(e){return e&&e.word?p("decl.noResultWord","No declaration found for '{0}'",e.word):p("decl.generic.noResults","No declaration found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDeclarationCommand}_getGoToPreference(e){return e.getOption(58).multipleDeclarations}}Xt((Gb=class extends iW{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Gb.id,title:{value:p("actions.goToDeclaration.label","Go to Declaration"),original:"Go to Declaration",mnemonicTitle:p({},"Go to &&Declaration")},precondition:te.and(M.hasDeclarationProvider,M.isInWalkThroughSnippet.toNegated()),menu:[{id:N.EditorContext,group:"navigation",order:1.3},{id:N.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(e){return e&&e.word?p("decl.noResultWord","No declaration found for '{0}'",e.word):p("decl.generic.noResults","No declaration found")}},Gb.id="editor.action.revealDeclaration",Gb));Xt(class extends iW{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:{value:p("actions.peekDecl.label","Peek Declaration"),original:"Peek Declaration"},precondition:te.and(M.hasDeclarationProvider,xs.notInPeekEditor,M.isInWalkThroughSnippet.toNegated()),menu:{id:N.EditorContextPeek,group:"peek",order:3}})}});class nW extends Yn{async _getLocationModel(e,t,i,n){return new Us(await tW(e.typeDefinitionProvider,t,i,n),p("typedef.title","Type Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?p("goToTypeDefinition.noResultWord","No type definition found for '{0}'",e.word):p("goToTypeDefinition.generic.noResults","No type definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeTypeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleTypeDefinitions}}Xt((Zb=class extends nW{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Zb.ID,title:{value:p("actions.goToTypeDefinition.label","Go to Type Definition"),original:"Go to Type Definition",mnemonicTitle:p({},"Go to &&Type Definition")},precondition:te.and(M.hasTypeDefinitionProvider,M.isInWalkThroughSnippet.toNegated()),keybinding:{when:M.editorTextFocus,primary:0,weight:100},menu:[{id:N.EditorContext,group:"navigation",order:1.4},{id:N.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}},Zb.ID="editor.action.goToTypeDefinition",Zb));Xt((Yb=class extends nW{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Yb.ID,title:{value:p("actions.peekTypeDefinition.label","Peek Type Definition"),original:"Peek Type Definition"},precondition:te.and(M.hasTypeDefinitionProvider,xs.notInPeekEditor,M.isInWalkThroughSnippet.toNegated()),menu:{id:N.EditorContextPeek,group:"peek",order:4}})}},Yb.ID="editor.action.peekTypeDefinition",Yb));class sW extends Yn{async _getLocationModel(e,t,i,n){return new Us(await eW(e.implementationProvider,t,i,n),p("impl.title","Implementations"))}_getNoResultFoundMessage(e){return e&&e.word?p("goToImplementation.noResultWord","No implementation found for '{0}'",e.word):p("goToImplementation.generic.noResults","No implementation found")}_getAlternativeCommand(e){return e.getOption(58).alternativeImplementationCommand}_getGoToPreference(e){return e.getOption(58).multipleImplementations}}Xt((Xb=class extends sW{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Xb.ID,title:{value:p("actions.goToImplementation.label","Go to Implementations"),original:"Go to Implementations",mnemonicTitle:p({},"Go to &&Implementations")},precondition:te.and(M.hasImplementationProvider,M.isInWalkThroughSnippet.toNegated()),keybinding:{when:M.editorTextFocus,primary:2118,weight:100},menu:[{id:N.EditorContext,group:"navigation",order:1.45},{id:N.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}},Xb.ID="editor.action.goToImplementation",Xb));Xt((Qb=class extends sW{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Qb.ID,title:{value:p("actions.peekImplementation.label","Peek Implementations"),original:"Peek Implementations"},precondition:te.and(M.hasImplementationProvider,xs.notInPeekEditor,M.isInWalkThroughSnippet.toNegated()),keybinding:{when:M.editorTextFocus,primary:3142,weight:100},menu:{id:N.EditorContextPeek,group:"peek",order:5}})}},Qb.ID="editor.action.peekImplementation",Qb));class oW extends Yn{_getNoResultFoundMessage(e){return e?p("references.no","No references found for '{0}'",e.word):p("references.noGeneric","No references found")}_getAlternativeCommand(e){return e.getOption(58).alternativeReferenceCommand}_getGoToPreference(e){return e.getOption(58).multipleReferences}}Xt(class extends oW{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{value:p("goToReferences.label","Go to References"),original:"Go to References",mnemonicTitle:p({},"Go to &&References")},precondition:te.and(M.hasReferenceProvider,xs.notInPeekEditor,M.isInWalkThroughSnippet.toNegated()),keybinding:{when:M.editorTextFocus,primary:1094,weight:100},menu:[{id:N.EditorContext,group:"navigation",order:1.45},{id:N.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(e,t,i,n){return new Us(await Vy(e.referenceProvider,t,i,!0,n),p("ref.title","References"))}});Xt(class extends oW{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:{value:p("references.action.label","Peek References"),original:"Peek References"},precondition:te.and(M.hasReferenceProvider,xs.notInPeekEditor,M.isInWalkThroughSnippet.toNegated()),menu:{id:N.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(e,t,i,n){return new Us(await Vy(e.referenceProvider,t,i,!1,n),p("ref.title","References"))}});class Xhe extends Yn{constructor(e,t,i){super(e,{id:"editor.action.goToLocation",title:{value:p("label.generic","Go to Any Symbol"),original:"Go to Any Symbol"},precondition:te.and(xs.notInPeekEditor,M.isInWalkThroughSnippet.toNegated())}),this._references=t,this._gotoMultipleBehaviour=i}async _getLocationModel(e,t,i,n){return new Us(this._references,p("generic.title","Locations"))}_getNoResultFoundMessage(e){return e&&p("generic.noResult","No results for '{0}'",e.word)||""}_getGoToPreference(e){var t;return(t=this._gotoMultipleBehaviour)!==null&&t!==void 0?t:e.getOption(58).multipleReferences}_getAlternativeCommand(){return""}}gt.registerCommand({id:"editor.action.goToLocations",metadata:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:Me},{name:"position",description:"The position at which to start",constraint:V.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto"},{name:"noResultsMessage",description:"Human readable message that shows when locations is empty."}]},handler:async(o,e,t,i,n,s,r)=>{Tt(Me.isUri(e)),Tt(V.isIPosition(t)),Tt(Array.isArray(i)),Tt(typeof n>"u"||typeof n=="string"),Tt(typeof r>"u"||typeof r=="boolean");const a=o.get(Dt),l=await a.openCodeEditor({resource:e},a.getFocusedCodeEditor());if($c(l))return l.setPosition(t),l.revealPositionInCenterIfOutsideViewport(t,0),l.invokeWithinContext(d=>{const c=new class extends Xhe{_getNoResultFoundMessage(h){return s||super._getNoResultFoundMessage(h)}}({muteMessage:!s,openInPeek:!!r,openToSide:!1},i,n);d.get(Oe).invokeFunction(c.run.bind(c),l)})}});gt.registerCommand({id:"editor.action.peekLocations",metadata:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:Me},{name:"position",description:"The position at which to start",constraint:V.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto"}]},handler:async(o,e,t,i,n)=>{o.get(ui).executeCommand("editor.action.goToLocations",e,t,i,n,void 0,!0)}});gt.registerCommand({id:"editor.action.findReferences",handler:(o,e,t)=>{Tt(Me.isUri(e)),Tt(V.isIPosition(t));const i=o.get(Se),n=o.get(Dt);return n.openCodeEditor({resource:e},n.getFocusedCodeEditor()).then(s=>{if(!$c(s)||!s.hasModel())return;const r=Cp.get(s);if(!r)return;const a=Zi(d=>Vy(i.referenceProvider,s.getModel(),V.lift(t),!1,d).then(c=>new Us(c,p("ref.title","References")))),l=new k(t.lineNumber,t.column,t.lineNumber,t.column);return Promise.resolve(r.toggleWidget(l,a,!1))})}});gt.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");var Qhe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},dD=function(o,e){return function(t,i){e(t,i,o)}},Zm;let Hu=Zm=class{constructor(e,t,i,n){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=n,this.toUnhook=new se,this.toUnhookForKeyboard=new se,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();const s=new Ry(e);this.toUnhook.add(s),this.toUnhook.add(s.onMouseMoveOrRelevantKeyDown(([r,a])=>{this.startFindDefinitionFromMouse(r,a??void 0)})),this.toUnhook.add(s.onExecute(r=>{this.isEnabled(r)&&this.gotoDefinition(r.target.position,r.hasSideBySideModifier).catch(a=>{Ge(a)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(s.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(e){return e.getContribution(Zm.ID)}async startFindDefinitionFromCursor(e){await this.startFindDefinition(e),this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition(()=>{this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()})),this.toUnhookForKeyboard.add(this.editor.onKeyDown(t=>{t&&(this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear())}))}startFindDefinitionFromMouse(e,t){if(e.target.type===9&&this.linkDecorations.length>0)return;if(!this.editor.hasModel()||!this.isEnabled(e,t)){this.currentWordAtPosition=null,this.removeLinkDecorations();return}const i=e.target.position;this.startFindDefinition(i)}async startFindDefinition(e){var t;this.toUnhookForKeyboard.clear();const i=e?(t=this.editor.getModel())===null||t===void 0?void 0:t.getWordAtPosition(e):null;if(!i){this.currentWordAtPosition=null,this.removeLinkDecorations();return}if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===i.startColumn&&this.currentWordAtPosition.endColumn===i.endColumn&&this.currentWordAtPosition.word===i.word)return;this.currentWordAtPosition=i;const n=new r6(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=Zi(a=>this.findDefinition(e,a));let s;try{s=await this.previousPromise}catch(a){Ge(a);return}if(!s||!s.length||!n.validate(this.editor)){this.removeLinkDecorations();return}const r=s[0].originSelectionRange?k.lift(s[0].originSelectionRange):new k(e.lineNumber,i.startColumn,e.lineNumber,i.endColumn);if(s.length>1){let a=r;for(const{originSelectionRange:l}of s)l&&(a=k.plusRange(a,l));this.addDecoration(a,new Fn().appendText(p("multipleResults","Click to show {0} definitions.",s.length)))}else{const a=s[0];if(!a.uri)return;this.textModelResolverService.createModelReference(a.uri).then(l=>{if(!l.object||!l.object.textEditorModel){l.dispose();return}const{object:{textEditorModel:d}}=l,{startLineNumber:c}=a.range;if(c<1||c>d.getLineCount()){l.dispose();return}const h=this.getPreviewValue(d,c,a),u=this.languageService.guessLanguageIdByFilepathOrFirstLine(d.uri);this.addDecoration(r,h?new Fn().appendCodeblock(u||"",h):void 0),l.dispose()})}}getPreviewValue(e,t,i){let n=i.range;return n.endLineNumber-n.startLineNumber>=Zm.MAX_SOURCE_PREVIEW_LINES&&(n=this.getPreviewRangeBasedOnIndentation(e,t)),this.stripIndentationFromPreviewRange(e,t,n)}stripIndentationFromPreviewRange(e,t,i){let s=e.getLineFirstNonWhitespaceColumn(t);for(let a=t+1;a<i.endLineNumber;a++){const l=e.getLineFirstNonWhitespaceColumn(a);s=Math.min(s,l)}return e.getValueInRange(i).replace(new RegExp(`^\\s{${s-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(e,t){const i=e.getLineFirstNonWhitespaceColumn(t),n=Math.min(e.getLineCount(),t+Zm.MAX_SOURCE_PREVIEW_LINES);let s=t+1;for(;s<n;s++){const r=e.getLineFirstNonWhitespaceColumn(s);if(i===r)break}return new k(t,1,s+1,1)}addDecoration(e,t){const i={range:e,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:t}};this.linkDecorations.set([i])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(e,t){var i;return this.editor.hasModel()&&e.isLeftClick&&e.isNoneOrSingleMouseDown&&e.target.type===6&&!(((i=e.target.detail.injectedText)===null||i===void 0?void 0:i.options)instanceof Hc)&&(e.hasTriggerModifier||(t?t.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(e,t){const i=this.editor.getModel();return i?Wy(this.languageFeaturesService.definitionProvider,i,e,t):Promise.resolve(null)}gotoDefinition(e,t){return this.editor.setPosition(e),this.editor.invokeWithinContext(i=>{const n=!t&&this.editor.getOption(87)&&!this.isInPeekEditor(i);return new qv({openToSide:t,openInPeek:n,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(i)})}isInPeekEditor(e){const t=e.get(We);return xs.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};Hu.ID="editor.contrib.gotodefinitionatposition";Hu.MAX_SOURCE_PREVIEW_LINES=8;Hu=Zm=Qhe([dD(1,ks),dD(2,ni),dD(3,Se)],Hu);yt(Hu.ID,Hu,2);const Jb=pe;class rW extends K{constructor(){super(),this.containerDomNode=document.createElement("div"),this.containerDomNode.className="monaco-hover",this.containerDomNode.tabIndex=0,this.containerDomNode.setAttribute("role","tooltip"),this.contentsDomNode=document.createElement("div"),this.contentsDomNode.className="monaco-hover-content",this.scrollbar=this._register(new Cv(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}}class SR extends K{static render(e,t,i){return new SR(e,t,i)}constructor(e,t,i){super(),this.actionContainer=ie(e,Jb("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=ie(this.actionContainer,Jb("a.action")),this.action.setAttribute("role","button"),t.iconClass&&ie(this.action,Jb(`span.icon.${t.iconClass}`));const n=ie(this.action,Jb("span"));n.textContent=i?`${t.label} (${i})`:t.label,this._register(Q(this.actionContainer,ge.CLICK,s=>{s.stopPropagation(),s.preventDefault(),t.run(this.actionContainer)})),this._register(Q(this.actionContainer,ge.KEY_DOWN,s=>{const r=new Gt(s);(r.equals(3)||r.equals(10))&&(s.stopPropagation(),s.preventDefault(),t.run(this.actionContainer))})),this.setEnabled(!0)}setEnabled(e){e?(this.actionContainer.classList.remove("disabled"),this.actionContainer.removeAttribute("aria-disabled")):(this.actionContainer.classList.add("disabled"),this.actionContainer.setAttribute("aria-disabled","true"))}}function Jhe(o,e){return o&&e?p("acessibleViewHint","Inspect this in the accessible view with {0}.",e):o?p("acessibleViewHintNoKbOpen","Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding."):""}let eue=class{constructor(e,t,i){this.value=e,this.isComplete=t,this.hasLoadingMessage=i}};class aW extends K{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new W),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new Rt(()=>this._triggerAsyncComputation(),0)),this._secondWaitScheduler=this._register(new Rt(()=>this._triggerSyncComputation(),0)),this._loadingMessageScheduler=this._register(new Rt(()=>this._triggerLoadingMessage(),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),super.dispose()}get _hoverTime(){return this._editor.getOption(60).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(e,t=!0){this._state=e,t&&this._fireResult()}_triggerAsyncComputation(){this._setState(2),this._secondWaitScheduler.schedule(this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=o$(e=>this._computer.computeAsync(e)),(async()=>{try{for await(const e of this._asyncIterable)e&&(this._result.push(e),this._fireResult());this._asyncIterableDone=!0,(this._state===3||this._state===4)&&this._setState(0)}catch(e){Ge(e)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync())),this._setState(this._asyncIterableDone?0:3)}_triggerLoadingMessage(){this._state===3&&this._setState(4)}_fireResult(){if(this._state===1||this._state===2)return;const e=this._state===0,t=this._state===4;this._onResult.fire(new eue(this._result.slice(0),e,t))}start(e){if(e===0)this._state===0&&(this._setState(1),this._firstWaitScheduler.schedule(this._firstWaitTime),this._loadingMessageScheduler.schedule(this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(),this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break;case 2:this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break}}cancel(){this._firstWaitScheduler.cancel(),this._secondWaitScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._result=[],this._setState(0,!1)}}class yR{constructor(){this._onDidWillResize=new W,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new W,this.onDidResize=this._onDidResize.event,this._sashListener=new se,this._size=new bt(0,0),this._minSize=new bt(0,0),this._maxSize=new bt(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new An(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new An(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new An(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:pw.North}),this._southSash=new An(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:pw.South}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let e,t=0,i=0;this._sashListener.add(fe.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)(()=>{e===void 0&&(this._onDidWillResize.fire(),e=this._size,t=0,i=0)})),this._sashListener.add(fe.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)(()=>{e!==void 0&&(e=void 0,t=0,i=0,this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(this._eastSash.onDidChange(n=>{e&&(i=n.currentX-n.startX,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))})),this._sashListener.add(this._westSash.onDidChange(n=>{e&&(i=-(n.currentX-n.startX),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))})),this._sashListener.add(this._northSash.onDidChange(n=>{e&&(t=-(n.currentY-n.startY),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))})),this._sashListener.add(this._southSash.onDidChange(n=>{e&&(t=n.currentY-n.startY,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))})),this._sashListener.add(fe.any(this._eastSash.onDidReset,this._westSash.onDidReset)(n=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(fe.any(this._northSash.onDidReset,this._southSash.onDidReset)(n=>{this._preferredSize&&(this.layout(this._preferredSize.height,this._size.width),this._onDidResize.fire({dimension:this._size,done:!0}))}))}dispose(){this._northSash.dispose(),this._southSash.dispose(),this._eastSash.dispose(),this._westSash.dispose(),this._sashListener.dispose(),this._onDidResize.dispose(),this._onDidWillResize.dispose(),this.domNode.remove()}enableSashes(e,t,i,n){this._northSash.state=e?3:0,this._eastSash.state=t?3:0,this._southSash.state=i?3:0,this._westSash.state=n?3:0}layout(e=this.size.height,t=this.size.width){const{height:i,width:n}=this._minSize,{height:s,width:r}=this._maxSize;e=Math.max(i,Math.min(s,e)),t=Math.max(n,Math.min(r,t));const a=new bt(t,e);bt.equals(a,this._size)||(this.domNode.style.height=e+"px",this.domNode.style.width=t+"px",this._size=a,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(e){this._maxSize=e}get maxSize(){return this._maxSize}set minSize(e){this._minSize=e}get minSize(){return this._minSize}set preferredSize(e){this._preferredSize=e}get preferredSize(){return this._preferredSize}}const tue=30,iue=24;class nue extends K{constructor(e,t=new bt(10,10)){super(),this._editor=e,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new yR),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=bt.lift(t),this._resizableNode.layout(t.height,t.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize(i=>{this._resize(new bt(i.dimension.width,i.dimension.height)),i.done&&(this._isResizing=!1)})),this._register(this._resizableNode.onDidWillResize(()=>{this._isResizing=!0}))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){var e;return!((e=this._contentPosition)===null||e===void 0)&&e.position?V.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);return!t||!i?void 0:ji(t).top+i.top-tue}_availableVerticalSpaceBelow(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);if(!t||!i)return;const n=ji(t),s=Lu(t.ownerDocument.body),r=n.top+i.top+i.height;return s.height-r-iue}_findPositionPreference(e,t){var i,n;const s=Math.min((i=this._availableVerticalSpaceBelow(t))!==null&&i!==void 0?i:1/0,e),r=Math.min((n=this._availableVerticalSpaceAbove(t))!==null&&n!==void 0?n:1/0,e),a=Math.min(Math.max(r,s),e),l=Math.min(e,a);let d;return this._editor.getOption(60).above?d=l<=r?1:2:d=l<=s?2:1,d===1?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),d}_resize(e){this._resizableNode.layout(e.height,e.width)}}var LR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ru=function(o,e){return function(t,i){e(t,i,o)}},e1,Ca;const n5=pe;let zw=e1=class extends K{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._currentResult=null,this._widget=this._register(this._instantiationService.createInstance(yc,this._editor)),this._participants=[];for(const n of ag.getAll())this._participants.push(this._instantiationService.createInstance(n,this._editor));this._participants.sort((n,s)=>n.hoverOrdinal-s.hoverOrdinal),this._computer=new $w(this._editor,this._participants),this._hoverOperation=this._register(new aW(this._editor,this._computer)),this._register(this._hoverOperation.onResult(n=>{if(!this._computer.anchor)return;const s=n.hasLoadingMessage?this._addLoadingMessage(n.value):n.value;this._withResult(new lW(this._computer.anchor,s,n.isComplete))})),this._register(vi(this._widget.getDomNode(),"keydown",n=>{n.equals(9)&&this.hide()})),this._register(Ti.onDidChange(()=>{this._widget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)}))}get widget(){return this._widget}maybeShowAt(e){if(this._widget.isResizing)return!0;const t=[];for(const n of this._participants)if(n.suggestHoverAnchor){const s=n.suggestHoverAnchor(e);s&&t.push(s)}const i=e.target;if(i.type===6&&t.push(new Jx(0,i.range,e.event.posx,e.event.posy)),i.type===7){const n=this._editor.getOption(50).typicalHalfwidthCharacterWidth/2;!i.detail.isAfterLines&&typeof i.detail.horizontalDistanceToText=="number"&&i.detail.horizontalDistanceToText<n&&t.push(new Jx(0,i.range,e.event.posx,e.event.posy))}return t.length===0?this._startShowingOrUpdateHover(null,0,0,!1,e):(t.sort((n,s)=>s.priority-n.priority),this._startShowingOrUpdateHover(t[0],0,0,!1,e))}startShowingAtRange(e,t,i,n){this._startShowingOrUpdateHover(new Jx(0,e,void 0,void 0),t,i,n,null)}_startShowingOrUpdateHover(e,t,i,n,s){return!this._widget.position||!this._currentResult?e?(this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):!1:this._editor.getOption(60).sticky&&s&&this._widget.isMouseGettingCloser(s.event.posx,s.event.posy)?(e&&this._startHoverOperationIfNecessary(e,t,i,n,!0),!0):e?e&&this._currentResult.anchor.equals(e)?!0:e.canAdoptVisibleHover(this._currentResult.anchor,this._widget.position)?(this._setCurrentResult(this._currentResult.filter(e)),this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):(this._setCurrentResult(null),!1)}_startHoverOperationIfNecessary(e,t,i,n,s){this._computer.anchor&&this._computer.anchor.equals(e)||(this._hoverOperation.cancel(),this._computer.anchor=e,this._computer.shouldFocus=n,this._computer.source=i,this._computer.insistOnKeepingHoverVisible=s,this._hoverOperation.start(t))}_setCurrentResult(e){this._currentResult!==e&&(e&&e.messages.length===0&&(e=null),this._currentResult=e,this._currentResult?this._renderMessages(this._currentResult.anchor,this._currentResult.messages):this._widget.hide())}hide(){this._computer.anchor=null,this._hoverOperation.cancel(),this._setCurrentResult(null)}get isColorPickerVisible(){return this._widget.isColorPickerVisible}get isVisibleFromKeyboard(){return this._widget.isVisibleFromKeyboard}get isVisible(){return this._widget.isVisible}get isFocused(){return this._widget.isFocused}get isResizing(){return this._widget.isResizing}containsNode(e){return e?this._widget.getDomNode().contains(e):!1}_addLoadingMessage(e){if(this._computer.anchor){for(const t of this._participants)if(t.createLoadingMessage){const i=t.createLoadingMessage(this._computer.anchor);if(i)return e.slice(0).concat([i])}}return e}_withResult(e){this._widget.position&&this._currentResult&&this._currentResult.isComplete&&(!e.isComplete||this._computer.insistOnKeepingHoverVisible&&e.messages.length===0)||this._setCurrentResult(e)}_renderMessages(e,t){const{showAtPosition:i,showAtSecondaryPosition:n,highlightRange:s}=e1.computeHoverRanges(this._editor,e.range,t),r=new se,a=r.add(new Uw(this._keybindingService)),l=document.createDocumentFragment();let d=null;const c={fragment:l,statusBar:a,setColorPicker:u=>d=u,onContentsChanged:()=>this._widget.onContentsChanged(),setMinimumDimensions:u=>this._widget.setMinimumDimensions(u),hide:()=>this.hide()};for(const u of this._participants){const g=t.filter(f=>f.owner===u);g.length>0&&r.add(u.renderHoverParts(c,g))}const h=t.some(u=>u.isBeforeContent);if(a.hasContent&&l.appendChild(a.hoverElement),l.hasChildNodes()){if(s){const u=this._editor.createDecorationsCollection();u.set([{range:s,options:e1._DECORATION_OPTIONS}]),r.add(Ae(()=>{u.clear()}))}this._widget.showAt(l,new oue(d,i,n,this._editor.getOption(60).above,this._computer.shouldFocus,this._computer.source,h,e.initialMousePosX,e.initialMousePosY,r))}else r.dispose()}static computeHoverRanges(e,t,i){let n=1;if(e.hasModel()){const d=e._getViewModel(),c=d.coordinatesConverter,h=c.convertModelRangeToViewRange(t),u=new V(h.startLineNumber,d.getLineMinColumn(h.startLineNumber));n=c.convertViewPositionToModelPosition(u).column}const s=t.startLineNumber;let r=t.startColumn,a=i[0].range,l=null;for(const d of i)a=k.plusRange(a,d.range),d.range.startLineNumber===s&&d.range.endLineNumber===s&&(r=Math.max(Math.min(r,d.range.startColumn),n)),d.forceShowAtRange&&(l=d.range);return{showAtPosition:l?l.getStartPosition():new V(s,t.startColumn),showAtSecondaryPosition:l?l.getStartPosition():new V(s,r),highlightRange:a}}focus(){this._widget.focus()}scrollUp(){this._widget.scrollUp()}scrollDown(){this._widget.scrollDown()}scrollLeft(){this._widget.scrollLeft()}scrollRight(){this._widget.scrollRight()}pageUp(){this._widget.pageUp()}pageDown(){this._widget.pageDown()}goToTop(){this._widget.goToTop()}goToBottom(){this._widget.goToBottom()}};zw._DECORATION_OPTIONS=Ze.register({description:"content-hover-highlight",className:"hoverHighlight"});zw=e1=LR([ru(1,Oe),ru(2,Pt)],zw);class lW{constructor(e,t,i){this.anchor=e,this.messages=t,this.isComplete=i}filter(e){const t=this.messages.filter(i=>i.isValidForHoverAnchor(e));return t.length===this.messages.length?this:new sue(this,this.anchor,t,this.isComplete)}}class sue extends lW{constructor(e,t,i,n){super(t,i,n),this.original=e}filter(e){return this.original.filter(e)}}class oue{constructor(e,t,i,n,s,r,a,l,d,c){this.colorPicker=e,this.showAtPosition=t,this.showAtSecondaryPosition=i,this.preferAbove=n,this.stoleFocus=s,this.source=r,this.isBeforeContent=a,this.initialMousePosX=l,this.initialMousePosY=d,this.disposables=c,this.closestMouseDistance=void 0}}const s5=30,cD=10,rue=6;let yc=Ca=class extends nue{get isColorPickerVisible(){var e;return!!(!((e=this._visibleData)===null||e===void 0)&&e.colorPicker)}get isVisibleFromKeyboard(){var e;return((e=this._visibleData)===null||e===void 0?void 0:e.source)===1}get isVisible(){var e;return(e=this._hoverVisibleKey.get())!==null&&e!==void 0?e:!1}get isFocused(){var e;return(e=this._hoverFocusedKey.get())!==null&&e!==void 0?e:!1}constructor(e,t,i,n,s){const r=e.getOption(66)+8,a=150,l=new bt(a,r);super(e,l),this._configurationService=i,this._accessibilityService=n,this._keybindingService=s,this._hover=this._register(new rW),this._minimumSize=l,this._hoverVisibleKey=M.hoverVisible.bindTo(t),this._hoverFocusedKey=M.hoverFocused.bindTo(t),ie(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._register(this._editor.onDidLayoutChange(()=>{this.isVisible&&this._updateMaxDimensions()})),this._register(this._editor.onDidChangeConfiguration(c=>{c.hasChanged(50)&&this._updateFont()}));const d=this._register(dl(this._resizableNode.domNode));this._register(d.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(d.onDidBlur(()=>{this._hoverFocusedKey.set(!1)})),this._setHoverData(void 0),this._editor.addContentWidget(this)}dispose(){var e;super.dispose(),(e=this._visibleData)===null||e===void 0||e.disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return Ca.ID}static _applyDimensions(e,t,i){const n=typeof t=="number"?`${t}px`:t,s=typeof i=="number"?`${i}px`:i;e.style.width=n,e.style.height=s}_setContentsDomNodeDimensions(e,t){const i=this._hover.contentsDomNode;return Ca._applyDimensions(i,e,t)}_setContainerDomNodeDimensions(e,t){const i=this._hover.containerDomNode;return Ca._applyDimensions(i,e,t)}_setHoverWidgetDimensions(e,t){this._setContentsDomNodeDimensions(e,t),this._setContainerDomNodeDimensions(e,t),this._layoutContentWidget()}static _applyMaxDimensions(e,t,i){const n=typeof t=="number"?`${t}px`:t,s=typeof i=="number"?`${i}px`:i;e.style.maxWidth=n,e.style.maxHeight=s}_setHoverWidgetMaxDimensions(e,t){Ca._applyMaxDimensions(this._hover.contentsDomNode,e,t),Ca._applyMaxDimensions(this._hover.containerDomNode,e,t),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth",typeof e=="number"?`${e}px`:e),this._layoutContentWidget()}_hasHorizontalScrollbar(){const e=this._hover.scrollbar.getScrollDimensions();return e.scrollWidth>e.width}_adjustContentsBottomPadding(){const e=this._hover.contentsDomNode,t=`${this._hover.scrollbar.options.horizontalScrollbarSize}px`;e.style.paddingBottom!==t&&(e.style.paddingBottom=t)}_setAdjustedHoverWidgetDimensions(e){this._setHoverWidgetMaxDimensions("none","none");const t=e.width,i=e.height;this._setHoverWidgetDimensions(t,i),this._hasHorizontalScrollbar()&&(this._adjustContentsBottomPadding(),this._setContentsDomNodeDimensions(t,i-cD))}_updateResizableNodeMaxDimensions(){var e,t;const i=(e=this._findMaximumRenderingWidth())!==null&&e!==void 0?e:1/0,n=(t=this._findMaximumRenderingHeight())!==null&&t!==void 0?t:1/0;this._resizableNode.maxSize=new bt(i,n),this._setHoverWidgetMaxDimensions(i,n)}_resize(e){var t,i;Ca._lastDimensions=new bt(e.width,e.height),this._setAdjustedHoverWidgetDimensions(e),this._resizableNode.layout(e.height,e.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),(i=(t=this._visibleData)===null||t===void 0?void 0:t.colorPicker)===null||i===void 0||i.layout()}_findAvailableSpaceVertically(){var e;const t=(e=this._visibleData)===null||e===void 0?void 0:e.showAtPosition;if(t)return this._positionPreference===1?this._availableVerticalSpaceAbove(t):this._availableVerticalSpaceBelow(t)}_findMaximumRenderingHeight(){const e=this._findAvailableSpaceVertically();if(!e)return;let t=rue;return Array.from(this._hover.contentsDomNode.children).forEach(i=>{t+=i.clientHeight}),this._hasHorizontalScrollbar()&&(t+=cD),Math.min(e,t)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");const e=Array.from(this._hover.contentsDomNode.children).some(t=>t.scrollWidth>t.clientWidth);return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),e}_findMaximumRenderingWidth(){if(!this._editor||!this._editor.hasModel())return;const e=this._isHoverTextOverflowing(),t=typeof this._contentWidth>"u"?0:this._contentWidth-2;return e||this._hover.containerDomNode.clientWidth<t?Lu(this._hover.containerDomNode.ownerDocument.body).width-14:this._hover.containerDomNode.clientWidth+2}isMouseGettingCloser(e,t){if(!this._visibleData)return!1;if(typeof this._visibleData.initialMousePosX>"u"||typeof this._visibleData.initialMousePosY>"u")return this._visibleData.initialMousePosX=e,this._visibleData.initialMousePosY=t,!1;const i=ji(this.getDomNode());typeof this._visibleData.closestMouseDistance>"u"&&(this._visibleData.closestMouseDistance=o5(this._visibleData.initialMousePosX,this._visibleData.initialMousePosY,i.left,i.top,i.width,i.height));const n=o5(e,t,i.left,i.top,i.width,i.height);return n>this._visibleData.closestMouseDistance+4?!1:(this._visibleData.closestMouseDistance=Math.min(this._visibleData.closestMouseDistance,n),!0)}_setHoverData(e){var t;(t=this._visibleData)===null||t===void 0||t.disposables.dispose(),this._visibleData=e,this._hoverVisibleKey.set(!!e),this._hover.containerDomNode.classList.toggle("hidden",!e)}_updateFont(){const{fontSize:e,lineHeight:t}=this._editor.getOption(50),i=this._hover.contentsDomNode;i.style.fontSize=`${e}px`,i.style.lineHeight=`${t/e}`,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(s=>this._editor.applyFontInfo(s))}_updateContent(e){const t=this._hover.contentsDomNode;t.style.paddingBottom="",t.textContent="",t.appendChild(e)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){const e=Math.max(this._editor.getLayoutInfo().height/4,250,Ca._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,500,Ca._lastDimensions.width);this._setHoverWidgetMaxDimensions(t,e)}_render(e,t){this._setHoverData(t),this._updateFont(),this._updateContent(e),this._updateMaxDimensions(),this.onContentsChanged(),this._editor.render()}getPosition(){var e;return this._visibleData?{position:this._visibleData.showAtPosition,secondaryPosition:this._visibleData.showAtSecondaryPosition,positionAffinity:this._visibleData.isBeforeContent?3:void 0,preference:[(e=this._positionPreference)!==null&&e!==void 0?e:1]}:null}showAt(e,t){var i,n,s,r;if(!this._editor||!this._editor.hasModel())return;this._render(e,t);const a=Xh(this._hover.containerDomNode),l=t.showAtPosition;this._positionPreference=(i=this._findPositionPreference(a,l))!==null&&i!==void 0?i:1,this.onContentsChanged(),t.stoleFocus&&this._hover.containerDomNode.focus(),(n=t.colorPicker)===null||n===void 0||n.layout();const c=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&Jhe(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),(r=(s=this._keybindingService.lookupKeybinding("editor.action.accessibleView"))===null||s===void 0?void 0:s.getAriaLabel())!==null&&r!==void 0?r:"");c&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+c)}hide(){if(!this._visibleData)return;const e=this._visibleData.stoleFocus||this._hoverFocusedKey.get();this._setHoverData(void 0),this._resizableNode.maxSize=new bt(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),e&&this._editor.focus()}_removeConstraintsRenderNormally(){const e=this._editor.getLayoutInfo();this._resizableNode.layout(e.height,e.width),this._setHoverWidgetDimensions("auto","auto")}_adjustHoverHeightForScrollbar(e){var t;const i=this._hover.containerDomNode,n=this._hover.contentsDomNode,s=(t=this._findMaximumRenderingHeight())!==null&&t!==void 0?t:1/0;this._setContainerDomNodeDimensions(vs(i),Math.min(s,e)),this._setContentsDomNodeDimensions(vs(n),Math.min(s,e-cD))}setMinimumDimensions(e){this._minimumSize=new bt(Math.max(this._minimumSize.width,e.width),Math.max(this._minimumSize.height,e.height)),this._updateMinimumWidth()}_updateMinimumWidth(){const e=typeof this._contentWidth>"u"?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new bt(e,this._minimumSize.height)}onContentsChanged(){var e;this._removeConstraintsRenderNormally();const t=this._hover.containerDomNode;let i=Xh(t),n=vs(t);if(this._resizableNode.layout(i,n),this._setHoverWidgetDimensions(n,i),i=Xh(t),n=vs(t),this._contentWidth=n,this._updateMinimumWidth(),this._resizableNode.layout(i,n),this._hasHorizontalScrollbar()&&(this._adjustContentsBottomPadding(),this._adjustHoverHeightForScrollbar(i)),!((e=this._visibleData)===null||e===void 0)&&e.showAtPosition){const s=Xh(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(s,this._visibleData.showAtPosition)}this._layoutContentWidget()}focus(){this._hover.containerDomNode.focus()}scrollUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:e-t.lineHeight})}scrollDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:e+t.lineHeight})}scrollLeft(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e-s5})}scrollRight(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+s5})}pageUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e-t})}pageDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e+t})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}};yc.ID="editor.contrib.resizableContentHoverWidget";yc._lastDimensions=new bt(0,0);yc=Ca=LR([ru(1,We),ru(2,ft),ru(3,Sl),ru(4,Pt)],yc);let Uw=class extends K{get hasContent(){return this._hasContent}constructor(e){super(),this._keybindingService=e,this._hasContent=!1,this.hoverElement=n5("div.hover-row.status-bar"),this.actionsElement=ie(this.hoverElement,n5("div.actions"))}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;return this._hasContent=!0,this._register(SR.render(this.actionsElement,e,i))}append(e){const t=ie(this.actionsElement,e);return this._hasContent=!0,t}};Uw=LR([ru(0,Pt)],Uw);class $w{get anchor(){return this._anchor}set anchor(e){this._anchor=e}get shouldFocus(){return this._shouldFocus}set shouldFocus(e){this._shouldFocus=e}get source(){return this._source}set source(e){this._source=e}get insistOnKeepingHoverVisible(){return this._insistOnKeepingHoverVisible}set insistOnKeepingHoverVisible(e){this._insistOnKeepingHoverVisible=e}constructor(e,t){this._editor=e,this._participants=t,this._anchor=null,this._shouldFocus=!1,this._source=0,this._insistOnKeepingHoverVisible=!1}static _getLineDecorations(e,t){if(t.type!==1&&!t.supportsMarkerHover)return[];const i=e.getModel(),n=t.range.startLineNumber;if(n>i.getLineCount())return[];const s=i.getLineMaxColumn(n);return e.getLineDecorations(n).filter(r=>{if(r.options.isWholeLine)return!0;const a=r.range.startLineNumber===n?r.range.startColumn:1,l=r.range.endLineNumber===n?r.range.endColumn:s;if(r.options.showIfCollapsed){if(a>t.range.startColumn+1||t.range.endColumn-1>l)return!1}else if(a>t.range.startColumn||t.range.endColumn>l)return!1;return!0})}computeAsync(e){const t=this._anchor;if(!this._editor.hasModel()||!t)return Fi.EMPTY;const i=$w._getLineDecorations(this._editor,t);return Fi.merge(this._participants.map(n=>n.computeAsync?n.computeAsync(t,i,e):Fi.EMPTY))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const e=$w._getLineDecorations(this._editor,this._anchor);let t=[];for(const i of this._participants)t=t.concat(i.computeSync(this._anchor,e));return Qr(t)}}function o5(o,e,t,i,n,s){const r=t+n/2,a=i+s/2,l=Math.max(Math.abs(o-r)-n/2,0),d=Math.max(Math.abs(e-a)-s/2,0);return Math.sqrt(l*l+d*d)}const r5=pe;class Vf extends K{constructor(e,t,i){super(),this._renderDisposeables=this._register(new se),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new rW),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new pd({editor:this._editor},t,i)),this._computer=new aue(this._editor),this._hoverOperation=this._register(new aW(this._editor,this._computer)),this._register(this._hoverOperation.onResult(n=>{this._withResult(n.value)})),this._register(this._editor.onDidChangeModelDecorations(()=>this._onModelDecorationsChanged())),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(50)&&this._updateFont()})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return Vf.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(t=>this._editor.applyFontInfo(t))}_onModelDecorationsChanged(){this._isVisible&&(this._hoverOperation.cancel(),this._hoverOperation.start(0))}startShowingAt(e){this._computer.lineNumber!==e&&(this._hoverOperation.cancel(),this.hide(),this._computer.lineNumber=e,this._hoverOperation.start(0))}hide(){this._computer.lineNumber=-1,this._hoverOperation.cancel(),this._isVisible&&(this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible))}_withResult(e){this._messages=e,this._messages.length>0?this._renderMessages(this._computer.lineNumber,this._messages):this.hide()}_renderMessages(e,t){this._renderDisposeables.clear();const i=document.createDocumentFragment();for(const n of t){const s=r5("div.hover-row.markdown-hover"),r=ie(s,r5("div.hover-contents")),a=this._renderDisposeables.add(this._markdownRenderer.render(n.value));r.appendChild(a.element),i.appendChild(s)}this._updateContents(i),this._showAt(e)}_updateContents(e){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(e),this._updateFont()}_showAt(e){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));const t=this._editor.getLayoutInfo(),i=this._editor.getTopForLineNumber(e),n=this._editor.getScrollTop(),s=this._editor.getOption(66),r=this._hover.containerDomNode.clientHeight,a=i-n-(r-s)/2;this._hover.containerDomNode.style.left=`${t.glyphMarginLeft+t.glyphMarginWidth}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(a),0)}px`}}Vf.ID="editor.contrib.modesGlyphHoverWidget";class aue{get lineNumber(){return this._lineNumber}set lineNumber(e){this._lineNumber=e}constructor(e){this._editor=e,this._lineNumber=-1}computeSync(){const e=n=>({value:n}),t=this._editor.getLineDecorations(this._lineNumber),i=[];if(!t)return i;for(const n of t){if(!n.options.glyphMarginClassName)continue;const s=n.options.glyphMarginHoverMessage;!s||hp(s)||i.push(...BT(s).map(e))}return i}}class lue{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}async function due(o,e,t,i,n){try{const s=await Promise.resolve(o.provideHover(t,i,n));if(s&&hue(s))return new lue(o,s,e)}catch(s){Mi(s)}}function xR(o,e,t,i){const s=o.ordered(e).map((r,a)=>due(r,a,e,t,i));return Fi.fromPromises(s).coalesce()}function cue(o,e,t,i){return xR(o,e,t,i).map(n=>n.hover).toPromise()}Cl("_executeHoverProvider",(o,e,t)=>{const i=o.get(Se);return cue(i.hoverProvider,e,t,st.None)});function hue(o){const e=typeof o.range<"u",t=typeof o.contents<"u"&&o.contents&&o.contents.length>0;return e&&t}var uue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},eC=function(o,e){return function(t,i){e(t,i,o)}};const a5=pe;class Kr{constructor(e,t,i,n,s){this.owner=e,this.range=t,this.contents=i,this.isBeforeContent=n,this.ordinal=s}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let Kw=class{constructor(e,t,i,n,s){this._editor=e,this._languageService=t,this._openerService=i,this._configurationService=n,this._languageFeaturesService=s,this.hoverOrdinal=3}createLoadingMessage(e){return new Kr(this,e.range,[new Fn().appendText(p("modesContentHover.loading","Loading..."))],!1,2e3)}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),n=e.range.startLineNumber,s=i.getLineMaxColumn(n),r=[];let a=1e3;const l=i.getLineLength(n),d=i.getLanguageIdAtPosition(e.range.startLineNumber,e.range.startColumn),c=this._editor.getOption(116),h=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:d});let u=!1;c>=0&&l>c&&e.range.startColumn>=c&&(u=!0,r.push(new Kr(this,e.range,[{value:p("stopped rendering","Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,a++))),!u&&typeof h=="number"&&l>=h&&r.push(new Kr(this,e.range,[{value:p("too many characters","Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,a++));let g=!1;for(const f of t){const m=f.range.startLineNumber===n?f.range.startColumn:1,_=f.range.endLineNumber===n?f.range.endColumn:s,v=f.options.hoverMessage;if(!v||hp(v))continue;f.options.beforeContentClassName&&(g=!0);const b=new k(e.range.startLineNumber,m,e.range.startLineNumber,_);r.push(new Kr(this,b,BT(v),g,a++))}return r}computeAsync(e,t,i){if(!this._editor.hasModel()||e.type!==1)return Fi.EMPTY;const n=this._editor.getModel();if(!this._languageFeaturesService.hoverProvider.has(n))return Fi.EMPTY;const s=new V(e.range.startLineNumber,e.range.startColumn);return xR(this._languageFeaturesService.hoverProvider,n,s,i).filter(r=>!hp(r.hover.contents)).map(r=>{const a=r.hover.range?k.lift(r.hover.range):e.range;return new Kr(this,a,r.hover.contents,!1,r.ordinal)})}renderHoverParts(e,t){return dW(e,t,this._editor,this._languageService,this._openerService)}};Kw=uue([eC(1,ni),eC(2,Qs),eC(3,ft),eC(4,Se)],Kw);function dW(o,e,t,i,n){e.sort((r,a)=>r.ordinal-a.ordinal);const s=new se;for(const r of e)for(const a of r.contents){if(hp(a))continue;const l=a5("div.hover-row.markdown-hover"),d=ie(l,a5("div.hover-contents")),c=s.add(new pd({editor:t},i,n));s.add(c.onDidRenderAsync(()=>{d.className="hover-contents code-hover-contents",o.onContentsChanged()}));const h=s.add(c.render(a));d.appendChild(h.element),o.fragment.appendChild(l)}return s}var cW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jw=function(o,e){return function(t,i){e(t,i,o)}};class l5{constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let vN=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new W,this.onDidChange=this._onDidChange.event,this._dispoables=new se,this._markers=[],this._nextIdx=-1,Me.isUri(e)?this._resourceFilter=a=>a.toString()===e.toString():e&&(this._resourceFilter=e);const n=this._configService.getValue("problems.sortOrder"),s=(a,l)=>{let d=V_(a.resource.toString(),l.resource.toString());return d===0&&(n==="position"?d=k.compareRangesUsingStarts(a,l)||ci.compare(a.severity,l.severity):d=ci.compare(a.severity,l.severity)||k.compareRangesUsingStarts(a,l)),d},r=()=>{this._markers=this._markerService.read({resource:Me.isUri(e)?e:void 0,severities:ci.Error|ci.Warning|ci.Info}),typeof e=="function"&&(this._markers=this._markers.filter(a=>this._resourceFilter(a.resource))),this._markers.sort(s)};r(),this._dispoables.add(t.onMarkerChanged(a=>{(!this._resourceFilter||a.some(l=>this._resourceFilter(l)))&&(r(),this._nextIdx=-1,this._onDidChange.fire())}))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(e){return!this._resourceFilter&&!e?!0:!this._resourceFilter||!e?!1:this._resourceFilter(e)}get selected(){const e=this._markers[this._nextIdx];return e&&new l5(e,this._nextIdx+1,this._markers.length)}_initIdx(e,t,i){let n=!1,s=this._markers.findIndex(r=>r.resource.toString()===e.uri.toString());s<0&&(s=M_(this._markers,{resource:e.uri},(r,a)=>V_(r.resource.toString(),a.resource.toString())),s<0&&(s=~s));for(let r=s;r<this._markers.length;r++){let a=k.lift(this._markers[r]);if(a.isEmpty()){const l=e.getWordAtPosition(a.getStartPosition());l&&(a=new k(a.startLineNumber,l.startColumn,a.startLineNumber,l.endColumn))}if(t&&(a.containsPosition(t)||t.isBeforeOrEqual(a.getStartPosition()))){this._nextIdx=r,n=!0;break}if(this._markers[r].resource.toString()!==e.uri.toString())break}n||(this._nextIdx=i?0:this._markers.length-1),this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(e,t,i){if(this._markers.length===0)return!1;const n=this._nextIdx;return this._nextIdx===-1?this._initIdx(t,i,e):e?this._nextIdx=(this._nextIdx+1)%this._markers.length:e||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),n!==this._nextIdx}find(e,t){let i=this._markers.findIndex(n=>n.resource.toString()===e.toString());if(!(i<0)){for(;i<this._markers.length;i++)if(k.containsPosition(this._markers[i],t))return new l5(this._markers[i],i+1,this._markers.length)}}};vN=cW([jw(1,yl),jw(2,ft)],vN);const hW=ot("IMarkerNavigationService");let bN=class{constructor(e,t){this._markerService=e,this._configService=t,this._provider=new rs}getMarkerList(e){for(const t of this._provider){const i=t.getMarkerList(e);if(i)return i}return new vN(e,this._markerService,this._configService)}};bN=cW([jw(0,yl),jw(1,ft)],bN);ct(hW,bN,1);var CN;(function(o){function e(t){switch(t){case Si.Ignore:return"severity-ignore "+Re.asClassName(he.info);case Si.Info:return Re.asClassName(he.info);case Si.Warning:return Re.asClassName(he.warning);case Si.Error:return Re.asClassName(he.error);default:return""}}o.className=e})(CN||(CN={}));var gue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ig=function(o,e){return function(t,i){e(t,i,o)}},wN;class fue{constructor(e,t,i,n,s){this._openerService=n,this._labelService=s,this._lines=0,this._longestLineLength=0,this._relatedDiagnostics=new WeakMap,this._disposables=new se,this._editor=t;const r=document.createElement("div");r.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),r.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),r.appendChild(this._relatedBlock),this._disposables.add(vi(this._relatedBlock,"click",a=>{a.preventDefault();const l=this._relatedDiagnostics.get(a.target);l&&i(l)})),this._scrollable=new k8(r,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),e.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll(a=>{r.style.left=`-${a.scrollLeft}px`,r.style.top=`-${a.scrollTop}px`})),this._disposables.add(this._scrollable)}dispose(){Et(this._disposables)}update(e){const{source:t,message:i,relatedInformation:n,code:s}=e;let r=(t?.length||0)+2;s&&(typeof s=="string"?r+=s.length:r+=s.value.length);const a=ll(i);this._lines=a.length,this._longestLineLength=0;for(const u of a)this._longestLineLength=Math.max(u.length+r,this._longestLineLength);bn(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(e)),this._editor.applyFontInfo(this._messageBlock);let l=this._messageBlock;for(const u of a)l=document.createElement("div"),l.innerText=u,u===""&&(l.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(l);if(t||s){const u=document.createElement("span");if(u.classList.add("details"),l.appendChild(u),t){const g=document.createElement("span");g.innerText=t,g.classList.add("source"),u.appendChild(g)}if(s)if(typeof s=="string"){const g=document.createElement("span");g.innerText=`(${s})`,g.classList.add("code"),u.appendChild(g)}else{this._codeLink=pe("a.code-link"),this._codeLink.setAttribute("href",`${s.target.toString()}`),this._codeLink.onclick=f=>{this._openerService.open(s.target,{allowCommands:!0}),f.preventDefault(),f.stopPropagation()};const g=ie(this._codeLink,pe("span"));g.innerText=s.value,u.appendChild(this._codeLink)}}if(bn(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),Bn(n)){const u=this._relatedBlock.appendChild(document.createElement("div"));u.style.paddingTop=`${Math.floor(this._editor.getOption(66)*.66)}px`,this._lines+=1;for(const g of n){const f=document.createElement("div"),m=document.createElement("a");m.classList.add("filename"),m.innerText=`${this._labelService.getUriBasenameLabel(g.resource)}(${g.startLineNumber}, ${g.startColumn}): `,m.title=this._labelService.getUriLabel(g.resource),this._relatedDiagnostics.set(m,g);const _=document.createElement("span");_.innerText=g.message,f.appendChild(m),f.appendChild(_),this._lines+=1,u.appendChild(f)}}const d=this._editor.getOption(50),c=Math.ceil(d.typicalFullwidthCharacterWidth*this._longestLineLength*.75),h=d.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:c,scrollHeight:h})}layout(e,t){this._scrollable.getDomNode().style.height=`${e}px`,this._scrollable.getDomNode().style.width=`${t}px`,this._scrollable.setScrollDimensions({width:t,height:e})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(e){let t="";switch(e.severity){case ci.Error:t=p("Error","Error");break;case ci.Warning:t=p("Warning","Warning");break;case ci.Info:t=p("Info","Info");break;case ci.Hint:t=p("Hint","Hint");break}let i=p("marker aria","{0} at {1}. ",t,e.startLineNumber+":"+e.startColumn);const n=this._editor.getModel();return n&&e.startLineNumber<=n.getLineCount()&&e.startLineNumber>=1&&(i=`${n.getLineContent(e.startLineNumber)}, ${i}`),i}}let Sp=wN=class extends Hw{constructor(e,t,i,n,s,r,a){super(e,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},s),this._themeService=t,this._openerService=i,this._menuService=n,this._contextKeyService=r,this._labelService=a,this._callOnDispose=new se,this._onDidSelectRelatedInformation=new W,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=ci.Warning,this._backgroundColor=q.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(vue);let t=SN,i=pue;this._severity===ci.Warning?(t=t1,i=mue):this._severity===ci.Info&&(t=yN,i=_ue);const n=e.getColor(t),s=e.getColor(i);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:s,primaryHeadingColor:e.getColor(Y6),secondaryHeadingColor:e.getColor(X6)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),super.dispose()}_fillHead(e){super._fillHead(e),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun(n=>this.editor.focus()));const t=[],i=this._menuService.createMenu(wN.TitleMenu,this._contextKeyService);NM(i,void 0,t),this._actionbarWidget.push(t,{label:!1,icon:!0,index:0}),i.dispose()}_fillTitleIcon(e){this._icon=ie(e,pe(""))}_fillBody(e){this._parentContainer=e,e.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),e.appendChild(this._container),this._message=new fue(this._container,this.editor,t=>this._onDidSelectRelatedInformation.fire(t),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(e,t,i){this._container.classList.remove("stale"),this._message.update(e),this._severity=e.severity,this._applyTheme(this._themeService.getColorTheme());const n=k.lift(e),s=this.editor.getPosition(),r=s&&n.containsPosition(s)?s:n.getStartPosition();super.show(r,this.computeRequiredHeight());const a=this.editor.getModel();if(a){const l=i>1?p("problems","{0} of {1} problems",t,i):p("change","{0} of {1} problem",t,i);this.setTitle(qo(a.uri),l)}this._icon.className=`codicon ${CN.className(ci.toSeverity(this._severity))}`,this.editor.revealPositionNearTop(r,0),this.editor.focus()}updateMarker(e){this._container.classList.remove("stale"),this._message.update(e)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._heightInPixel=e,this._message.layout(e,t),this._container.style.height=`${e}px`}_onWidth(e){this._message.layout(this._heightInPixel,e)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}};Sp.TitleMenu=new N("gotoErrorTitleMenu");Sp=wN=gue([Ig(1,tn),Ig(2,Qs),Ig(3,ra),Ig(4,Oe),Ig(5,We),Ig(6,ap)],Sp);const d5=s0(Ka,pG),c5=s0(vo,i0),h5=s0(Ss,n0),SN=R("editorMarkerNavigationError.background",{dark:d5,light:d5,hcDark:dt,hcLight:dt},p("editorMarkerNavigationError","Editor marker navigation widget error color.")),pue=R("editorMarkerNavigationError.headerBackground",{dark:Ee(SN,.1),light:Ee(SN,.1),hcDark:null,hcLight:null},p("editorMarkerNavigationErrorHeaderBackground","Editor marker navigation widget error heading background.")),t1=R("editorMarkerNavigationWarning.background",{dark:c5,light:c5,hcDark:dt,hcLight:dt},p("editorMarkerNavigationWarning","Editor marker navigation widget warning color.")),mue=R("editorMarkerNavigationWarning.headerBackground",{dark:Ee(t1,.1),light:Ee(t1,.1),hcDark:"#0C141F",hcLight:Ee(t1,.2)},p("editorMarkerNavigationWarningBackground","Editor marker navigation widget warning heading background.")),yN=R("editorMarkerNavigationInfo.background",{dark:h5,light:h5,hcDark:dt,hcLight:dt},p("editorMarkerNavigationInfo","Editor marker navigation widget info color.")),_ue=R("editorMarkerNavigationInfo.headerBackground",{dark:Ee(yN,.1),light:Ee(yN,.1),hcDark:null,hcLight:null},p("editorMarkerNavigationInfoHeaderBackground","Editor marker navigation widget info heading background.")),vue=R("editorMarkerNavigation.background",{dark:en,light:en,hcDark:en,hcLight:en},p("editorMarkerNavigationBackground","Editor marker navigation widget background."));var bue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},tC=function(o,e){return function(t,i){e(t,i,o)}},Ym;let Yc=Ym=class{static get(e){return e.getContribution(Ym.ID)}constructor(e,t,i,n,s){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=n,this._instantiationService=s,this._sessionDispoables=new se,this._editor=e,this._widgetVisible=uW.bindTo(this._contextKeyService)}dispose(){this._cleanUp(),this._sessionDispoables.dispose()}_cleanUp(){this._widgetVisible.reset(),this._sessionDispoables.clear(),this._widget=void 0,this._model=void 0}_getOrCreateModel(e){if(this._model&&this._model.matches(e))return this._model;let t=!1;return this._model&&(t=!0,this._cleanUp()),this._model=this._markerNavigationService.getMarkerList(e),t&&this._model.move(!0,this._editor.getModel(),this._editor.getPosition()),this._widget=this._instantiationService.createInstance(Sp,this._editor),this._widget.onDidClose(()=>this.close(),this,this._sessionDispoables),this._widgetVisible.set(!0),this._sessionDispoables.add(this._model),this._sessionDispoables.add(this._widget),this._sessionDispoables.add(this._editor.onDidChangeCursorPosition(i=>{var n,s,r;(!(!((n=this._model)===null||n===void 0)&&n.selected)||!k.containsPosition((s=this._model)===null||s===void 0?void 0:s.selected.marker,i.position))&&((r=this._model)===null||r===void 0||r.resetIndex())})),this._sessionDispoables.add(this._model.onDidChange(()=>{if(!this._widget||!this._widget.position||!this._model)return;const i=this._model.find(this._editor.getModel().uri,this._widget.position);i?this._widget.updateMarker(i.marker):this._widget.showStale()})),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation(i=>{this._editorService.openCodeEditor({resource:i.resource,options:{pinned:!0,revealIfOpened:!0,selection:k.lift(i).collapseToStart()}},this._editor),this.close(!1)})),this._sessionDispoables.add(this._editor.onDidChangeModel(()=>this._cleanUp())),this._model}close(e=!0){this._cleanUp(),e&&this._editor.focus()}showAtMarker(e){if(this._editor.hasModel()){const t=this._getOrCreateModel(this._editor.getModel().uri);t.resetIndex(),t.move(!0,this._editor.getModel(),new V(e.startLineNumber,e.startColumn)),t.selected&&this._widget.showAtMarker(t.selected.marker,t.selected.index,t.selected.total)}}async nagivate(e,t){var i,n;if(this._editor.hasModel()){const s=this._getOrCreateModel(t?void 0:this._editor.getModel().uri);if(s.move(e,this._editor.getModel(),this._editor.getPosition()),!s.selected)return;if(s.selected.marker.resource.toString()!==this._editor.getModel().uri.toString()){this._cleanUp();const r=await this._editorService.openCodeEditor({resource:s.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:s.selected.marker}},this._editor);r&&((i=Ym.get(r))===null||i===void 0||i.close(),(n=Ym.get(r))===null||n===void 0||n.nagivate(e,t))}else this._widget.showAtMarker(s.selected.marker,s.selected.index,s.selected.total)}}};Yc.ID="editor.contrib.markerController";Yc=Ym=bue([tC(1,hW),tC(2,We),tC(3,Dt),tC(4,Oe)],Yc);class Hy extends we{constructor(e,t,i){super(i),this._next=e,this._multiFile=t}async run(e,t){var i;t.hasModel()&&((i=Yc.get(t))===null||i===void 0||i.nagivate(this._next,this._multiFile))}}class Lc extends Hy{constructor(){super(!0,!1,{id:Lc.ID,label:Lc.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:578,weight:100},menuOpts:{menuId:Sp.TitleMenu,title:Lc.LABEL,icon:Di("marker-navigation-next",he.arrowDown,p("nextMarkerIcon","Icon for goto next marker.")),group:"navigation",order:1}})}}Lc.ID="editor.action.marker.next";Lc.LABEL=p("markerAction.next.label","Go to Next Problem (Error, Warning, Info)");class fu extends Hy{constructor(){super(!1,!1,{id:fu.ID,label:fu.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:1602,weight:100},menuOpts:{menuId:Sp.TitleMenu,title:fu.LABEL,icon:Di("marker-navigation-previous",he.arrowUp,p("previousMarkerIcon","Icon for goto previous marker.")),group:"navigation",order:2}})}}fu.ID="editor.action.marker.prev";fu.LABEL=p("markerAction.previous.label","Go to Previous Problem (Error, Warning, Info)");class Cue extends Hy{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:p("markerAction.nextInFiles.label","Go to Next Problem in Files (Error, Warning, Info)"),alias:"Go to Next Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:66,weight:100},menuOpts:{menuId:N.MenubarGoMenu,title:p({},"Next &&Problem"),group:"6_problem_nav",order:1}})}}class wue extends Hy{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:p("markerAction.previousInFiles.label","Go to Previous Problem in Files (Error, Warning, Info)"),alias:"Go to Previous Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:1090,weight:100},menuOpts:{menuId:N.MenubarGoMenu,title:p({},"Previous &&Problem"),group:"6_problem_nav",order:2}})}}yt(Yc.ID,Yc,4);de(Lc);de(fu);de(Cue);de(wue);const uW=new be("markersNavigationVisible",!1),Sue=cn.bindToContribution(Yc.get);ue(new Sue({id:"closeMarkersNavigation",precondition:uW,handler:o=>o.close(),kbOpts:{weight:150,kbExpr:M.focus,primary:9,secondary:[1033]}}));var yue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},hD=function(o,e){return function(t,i){e(t,i,o)}};const er=pe;class Lue{constructor(e,t,i){this.owner=e,this.range=t,this.marker=i}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}const u5={type:1,filter:{include:Be.QuickFix},triggerAction:qs.QuickFixHover};let LN=class{constructor(e,t,i,n){this._editor=e,this._markerDecorationsService=t,this._openerService=i,this._languageFeaturesService=n,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1&&!e.supportsMarkerHover)return[];const i=this._editor.getModel(),n=e.range.startLineNumber,s=i.getLineMaxColumn(n),r=[];for(const a of t){const l=a.range.startLineNumber===n?a.range.startColumn:1,d=a.range.endLineNumber===n?a.range.endColumn:s,c=this._markerDecorationsService.getMarker(i.uri,a);if(!c)continue;const h=new k(e.range.startLineNumber,l,e.range.startLineNumber,d);r.push(new Lue(this,h,c))}return r}renderHoverParts(e,t){if(!t.length)return K.None;const i=new se;t.forEach(s=>e.fragment.appendChild(this.renderMarkerHover(s,i)));const n=t.length===1?t[0]:t.sort((s,r)=>ci.compare(s.marker.severity,r.marker.severity))[0];return this.renderMarkerStatusbar(e,n,i),i}renderMarkerHover(e,t){const i=er("div.hover-row"),n=ie(i,er("div.marker.hover-contents")),{source:s,message:r,code:a,relatedInformation:l}=e.marker;this._editor.applyFontInfo(n);const d=ie(n,er("span"));if(d.style.whiteSpace="pre-wrap",d.innerText=r,s||a)if(a&&typeof a!="string"){const c=er("span");if(s){const f=ie(c,er("span"));f.innerText=s}const h=ie(c,er("a.code-link"));h.setAttribute("href",a.target.toString()),t.add(Q(h,"click",f=>{this._openerService.open(a.target,{allowCommands:!0}),f.preventDefault(),f.stopPropagation()}));const u=ie(h,er("span"));u.innerText=a.value;const g=ie(n,c);g.style.opacity="0.6",g.style.paddingLeft="6px"}else{const c=ie(n,er("span"));c.style.opacity="0.6",c.style.paddingLeft="6px",c.innerText=s&&a?`${s}(${a})`:s||`(${a})`}if(Bn(l))for(const{message:c,resource:h,startLineNumber:u,startColumn:g}of l){const f=ie(n,er("div"));f.style.marginTop="8px";const m=ie(f,er("a"));m.innerText=`${qo(h)}(${u}, ${g}): `,m.style.cursor="pointer",t.add(Q(m,"click",v=>{v.stopPropagation(),v.preventDefault(),this._openerService&&this._openerService.open(h,{fromUserGesture:!0,editorOptions:{selection:{startLineNumber:u,startColumn:g}}}).catch(Ge)}));const _=ie(f,er("span"));_.innerText=c,this._editor.applyFontInfo(_)}return i}renderMarkerStatusbar(e,t,i){if((t.marker.severity===ci.Error||t.marker.severity===ci.Warning||t.marker.severity===ci.Info)&&e.statusBar.addAction({label:p("view problem","View Problem"),commandId:Lc.ID,run:()=>{var n;e.hide(),(n=Yc.get(this._editor))===null||n===void 0||n.showAtMarker(t.marker),this._editor.focus()}}),!this._editor.getOption(90)){const n=e.statusBar.append(er("div"));this.recentMarkerCodeActionsInfo&&(gw.makeKey(this.recentMarkerCodeActionsInfo.marker)===gw.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(n.textContent=p("noQuickFixes","No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const s=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?K.None:i.add(Rc(()=>n.textContent=p("checkingForQuickFixes","Checking for quick fixes..."),200));n.textContent||(n.textContent=" ");const r=this.getCodeActions(t.marker);i.add(Ae(()=>r.cancel())),r.then(a=>{if(s.dispose(),this.recentMarkerCodeActionsInfo={marker:t.marker,hasCodeActions:a.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions){a.dispose(),n.textContent=p("noQuickFixes","No quick fixes available");return}n.style.display="none";let l=!1;i.add(Ae(()=>{l||a.dispose()})),e.statusBar.addAction({label:p("quick fixes","Quick Fix..."),commandId:pR,run:d=>{l=!0;const c=jc.get(this._editor),h=ji(d);e.hide(),c?.showCodeActions(u5,a,{x:h.left,y:h.top,width:h.width,height:h.height})}})},Ge)}}getCodeActions(e){return Zi(t=>L_(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new k(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),u5,ld.None,t))}};LN=yue([hD(1,R2),hD(2,Qs),hD(3,Se)],LN);const gW="editor.action.inlineSuggest.commit",fW="editor.action.inlineSuggest.showPrevious",pW="editor.action.inlineSuggest.showNext";var DR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jr=function(o,e){return function(t,i){e(t,i,o)}},i1;let xN=class extends K{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=pi(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).showToolbar==="always"),this.sessionPosition=void 0,this.position=Xe(this,n=>{var s,r,a;const l=(s=this.model.read(n))===null||s===void 0?void 0:s.ghostText.read(n);if(!this.alwaysShowToolbar.read(n)||!l||l.parts.length===0)return this.sessionPosition=void 0,null;const d=l.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==l.lineNumber&&(this.sessionPosition=void 0);const c=new V(l.lineNumber,Math.min(d,(a=(r=this.sessionPosition)===null||r===void 0?void 0:r.column)!==null&&a!==void 0?a:Number.MAX_SAFE_INTEGER));return this.sessionPosition=c,c}),this._register(yd((n,s)=>{const r=this.model.read(n);if(!r||!this.alwaysShowToolbar.read(n))return;const a=s.add(this.instantiationService.createInstance(Xc,this.editor,!0,this.position,r.selectedInlineCompletionIndex,r.inlineCompletionsCount,r.selectedInlineCompletion.map(l=>{var d;return(d=l?.inlineCompletion.source.inlineCompletions.commands)!==null&&d!==void 0?d:[]})));e.addContentWidget(a),s.add(Ae(()=>e.removeContentWidget(a))),s.add(xt(l=>{this.position.read(l)&&r.lastTriggerKind.read(l)!==od.Explicit&&r.triggerExplicitly()}))}))}};xN=DR([jr(2,Oe)],xN);const xue=Di("inline-suggestion-hints-next",he.chevronRight,p("parameterHintsNextIcon","Icon for show next parameter hint.")),Due=Di("inline-suggestion-hints-previous",he.chevronLeft,p("parameterHintsPreviousIcon","Icon for show previous parameter hint."));let Xc=i1=class extends K{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(e,t,i){const n=new cs(e,t,i,!0,()=>this._commandService.executeCommand(e)),s=this.keybindingService.lookupKeybinding(e,this._contextKeyService);let r=t;return s&&(r=p({},"{0} ({1})",t,s.getLabel())),n.tooltip=r,n}constructor(e,t,i,n,s,r,a,l,d,c,h){super(),this.editor=e,this.withBorder=t,this._position=i,this._currentSuggestionIdx=n,this._suggestionCount=s,this._extraCommands=r,this._commandService=a,this.keybindingService=d,this._contextKeyService=c,this._menuService=h,this.id=`InlineSuggestionHintsContentWidget${i1.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Jt("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Jt("div@toolBar")]),this.previousAction=this.createCommandAction(fW,p("previous","Previous"),Re.asClassName(Due)),this.availableSuggestionCountAction=new cs("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(pW,p("next","Next"),Re.asClassName(xue)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(N.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Rt(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new Rt(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this.lastCommands=[],this.toolBar=this._register(l.createInstance(DN,this.nodes.toolBar,N.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:u=>u.startsWith("primary")},actionViewItemProvider:(u,g)=>{if(u instanceof _r)return l.createInstance(Iue,u,void 0);if(u===this.availableSuggestionCountAction){const f=new kue(void 0,u,{label:!0,icon:!1});return f.setClass("availableSuggestionCount"),f}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(u=>{i1._dropDownVisible=u})),this._register(xt(u=>{this._position.read(u),this.editor.layoutContentWidget(this)})),this._register(xt(u=>{const g=this._suggestionCount.read(u),f=this._currentSuggestionIdx.read(u);g!==void 0?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${f+1}/${g}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),g!==void 0&&g>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(xt(u=>{const g=this._extraCommands.read(u);if(_i(this.lastCommands,g))return;this.lastCommands=g;const f=g.map(m=>({class:void 0,id:m.id,enabled:!0,tooltip:m.tooltip||"",label:m.title,run:_=>this._commandService.executeCommand(m.id)}));for(const[m,_]of this.inlineCompletionsActionsMenus.getActions())for(const v of _)v instanceof _r&&f.push(v);f.length>0&&f.unshift(new dn),this.toolBar.setAdditionalSecondaryActions(f)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};Xc._dropDownVisible=!1;Xc.id=0;Xc=i1=DR([jr(6,ui),jr(7,Oe),jr(8,Pt),jr(9,We),jr(10,ra)],Xc);class kue extends up{constructor(){super(...arguments),this._className=void 0}setClass(e){this._className=e}render(e){super.render(e),this._className&&e.classList.add(this._className)}}let Iue=class extends Nu{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Jt("div.keybinding").root;new Mv(t,mo,{disableTitle:!0,...boe}).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}},DN=class extends Ow{constructor(e,t,i,n,s,r,a,l){super(e,{resetMenu:t,...i},n,s,r,a,l),this.menuId=t,this.options2=i,this.menuService=n,this.contextKeyService=s,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){var e,t,i,n,s,r,a;const l=[],d=[];NM(this.menu,(e=this.options2)===null||e===void 0?void 0:e.menuOptions,{primary:l,secondary:d},(i=(t=this.options2)===null||t===void 0?void 0:t.toolbarOptions)===null||i===void 0?void 0:i.primaryGroup,(s=(n=this.options2)===null||n===void 0?void 0:n.toolbarOptions)===null||s===void 0?void 0:s.shouldInlineSubmenu,(a=(r=this.options2)===null||r===void 0?void 0:r.toolbarOptions)===null||a===void 0?void 0:a.useSeparatorsInPrimaryActions),d.push(...this.additionalActions),l.unshift(...this.prependedPrimaryActions),this.setActions(l,d)}setPrependedPrimaryActions(e){_i(this.prependedPrimaryActions,e,(t,i)=>t===i)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){_i(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};DN=DR([jr(3,ra),jr(4,We),jr(5,Yo),jr(6,Pt),jr(7,Gs)],DN);var Eue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},iC=function(o,e){return function(t,i){e(t,i,o)}},kN;let Ds=kN=class extends K{static get(e){return e.getContribution(kN.ID)}constructor(e,t,i,n,s){super(),this._editor=e,this._instantiationService=t,this._openerService=i,this._languageService=n,this._keybindingService=s,this._toUnhook=new se,this._hoverActivatedByColorDecoratorClick=!1,this._isMouseDown=!1,this._hoverClicked=!1,this._contentWidget=null,this._glyphWidget=null,this._reactToEditorMouseMoveRunner=this._register(new Rt(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookEvents(),this._register(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(60)&&(this._unhookEvents(),this._hookEvents())}))}_hookEvents(){const e=this._editor.getOption(60);this._isHoverEnabled=e.enabled,this._isHoverSticky=e.sticky,this._hidingDelay=e.hidingDelay,this._isHoverEnabled?(this._toUnhook.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._toUnhook.add(this._editor.onMouseUp(t=>this._onEditorMouseUp(t))),this._toUnhook.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._toUnhook.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._toUnhook.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._toUnhook.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._toUnhook.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._toUnhook.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this._hideWidgets()})),this._toUnhook.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._toUnhook.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_unhookEvents(){this._toUnhook.clear()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(e){var t;this._isMouseDown=!0;const i=e.target;if(i.type===9&&i.detail===yc.ID){this._hoverClicked=!0;return}i.type===12&&i.detail===Vf.ID||(i.type!==12&&(this._hoverClicked=!1),!((t=this._contentWidget)===null||t===void 0)&&t.widget.isResizing||this._hideWidgets())}_onEditorMouseUp(e){this._isMouseDown=!1}_onEditorMouseLeave(e){var t,i;this._cancelScheduler();const n=e.event.browserEvent.relatedTarget;!((t=this._contentWidget)===null||t===void 0)&&t.widget.isResizing||!((i=this._contentWidget)===null||i===void 0)&&i.containsNode(n)||this._hideWidgets()}_isMouseOverWidget(e){var t,i,n,s,r;const a=e.target;return!!(this._isHoverSticky&&a.type===9&&a.detail===yc.ID||this._isHoverSticky&&(!((t=this._contentWidget)===null||t===void 0)&&t.containsNode((i=e.event.browserEvent.view)===null||i===void 0?void 0:i.document.activeElement))&&!(!((s=(n=e.event.browserEvent.view)===null||n===void 0?void 0:n.getSelection())===null||s===void 0)&&s.isCollapsed)||!this._isHoverSticky&&a.type===9&&a.detail===yc.ID&&(!((r=this._contentWidget)===null||r===void 0)&&r.isColorPickerVisible)||this._isHoverSticky&&a.type===12&&a.detail===Vf.ID)}_onEditorMouseMove(e){var t,i,n,s;if(this._mouseMoveEvent=e,!((t=this._contentWidget)===null||t===void 0)&&t.isFocused||!((i=this._contentWidget)===null||i===void 0)&&i.isResizing||this._isMouseDown&&this._hoverClicked||this._isHoverSticky&&(!((n=this._contentWidget)===null||n===void 0)&&n.isVisibleFromKeyboard))return;if(this._isMouseOverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}if(!((s=this._contentWidget)===null||s===void 0)&&s.isVisible&&this._isHoverSticky&&this._hidingDelay>0){this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(this._hidingDelay);return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){var t,i,n;if(!e)return;const s=e.target,r=(t=s.element)===null||t===void 0?void 0:t.classList.contains("colorpicker-color-decoration"),a=this._editor.getOption(146);if(r&&(a==="click"&&!this._hoverActivatedByColorDecoratorClick||a==="hover"&&!this._isHoverEnabled||a==="clickAndHover"&&!this._isHoverEnabled&&!this._hoverActivatedByColorDecoratorClick)||!r&&!this._isHoverEnabled&&!this._hoverActivatedByColorDecoratorClick){this._hideWidgets();return}if(this._getOrCreateContentWidget().maybeShowAt(e)){(i=this._glyphWidget)===null||i===void 0||i.hide();return}if(s.type===2&&s.position){(n=this._contentWidget)===null||n===void 0||n.hide(),this._glyphWidget||(this._glyphWidget=new Vf(this._editor,this._languageService,this._openerService)),this._glyphWidget.startShowingAt(s.position.lineNumber);return}this._hideWidgets()}_onKeyDown(e){var t;if(!this._editor.hasModel())return;const i=this._keybindingService.softDispatch(e,this._editor.getDomNode()),n=i.kind===1||i.kind===2&&i.commandId==="editor.action.showHover"&&((t=this._contentWidget)===null||t===void 0?void 0:t.isVisible);e.keyCode!==5&&e.keyCode!==6&&e.keyCode!==57&&e.keyCode!==4&&!n&&this._hideWidgets()}_hideWidgets(){var e,t,i;this._isMouseDown&&this._hoverClicked&&(!((e=this._contentWidget)===null||e===void 0)&&e.isColorPickerVisible)||Xc.dropDownVisible||(this._hoverActivatedByColorDecoratorClick=!1,this._hoverClicked=!1,(t=this._glyphWidget)===null||t===void 0||t.hide(),(i=this._contentWidget)===null||i===void 0||i.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(zw,this._editor)),this._contentWidget}showContentHover(e,t,i,n,s=!1){this._hoverActivatedByColorDecoratorClick=s,this._getOrCreateContentWidget().startShowingAtRange(e,t,i,n)}focus(){var e;(e=this._contentWidget)===null||e===void 0||e.focus()}scrollUp(){var e;(e=this._contentWidget)===null||e===void 0||e.scrollUp()}scrollDown(){var e;(e=this._contentWidget)===null||e===void 0||e.scrollDown()}scrollLeft(){var e;(e=this._contentWidget)===null||e===void 0||e.scrollLeft()}scrollRight(){var e;(e=this._contentWidget)===null||e===void 0||e.scrollRight()}pageUp(){var e;(e=this._contentWidget)===null||e===void 0||e.pageUp()}pageDown(){var e;(e=this._contentWidget)===null||e===void 0||e.pageDown()}goToTop(){var e;(e=this._contentWidget)===null||e===void 0||e.goToTop()}goToBottom(){var e;(e=this._contentWidget)===null||e===void 0||e.goToBottom()}get isColorPickerVisible(){var e;return(e=this._contentWidget)===null||e===void 0?void 0:e.isColorPickerVisible}get isHoverVisible(){var e;return(e=this._contentWidget)===null||e===void 0?void 0:e.isVisible}dispose(){var e,t;super.dispose(),this._unhookEvents(),this._toUnhook.dispose(),(e=this._glyphWidget)===null||e===void 0||e.dispose(),(t=this._contentWidget)===null||t===void 0||t.dispose()}};Ds.ID="editor.contrib.hover";Ds=kN=Eue([iC(1,Oe),iC(2,Qs),iC(3,ni),iC(4,Pt)],Ds);var Rr;(function(o){o.NoAutoFocus="noAutoFocus",o.FocusIfVisible="focusIfVisible",o.AutoFocusImmediately="autoFocusImmediately"})(Rr||(Rr={}));class Nue extends we{constructor(){super({id:"editor.action.showHover",label:p({},"Show or Focus Hover"),metadata:{description:"Show or Focus Hover",args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if and when the hover should take focus upon being triggered by this action.",enum:[Rr.NoAutoFocus,Rr.FocusIfVisible,Rr.AutoFocusImmediately],enumDescriptions:[p("showOrFocusHover.focus.noAutoFocus","The hover will not automatically take focus."),p("showOrFocusHover.focus.focusIfVisible","The hover will take focus only if it is already visible."),p("showOrFocusHover.focus.autoFocusImmediately","The hover will automatically take focus when it appears.")],default:Rr.FocusIfVisible}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:qi(2089,2087),weight:100}})}run(e,t,i){if(!t.hasModel())return;const n=Ds.get(t);if(!n)return;const s=i?.focus;let r=Rr.FocusIfVisible;s in Rr?r=s:typeof s=="boolean"&&s&&(r=Rr.AutoFocusImmediately);const a=d=>{const c=t.getPosition(),h=new k(c.lineNumber,c.column,c.lineNumber,c.column);n.showContentHover(h,1,1,d)},l=t.getOption(2)===2;n.isHoverVisible?r!==Rr.NoAutoFocus?n.focus():a(l):a(l||r===Rr.AutoFocusImmediately)}}class Tue extends we{constructor(){super({id:"editor.action.showDefinitionPreviewHover",label:p({},"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0})}run(e,t){const i=Ds.get(t);if(!i)return;const n=t.getPosition();if(!n)return;const s=new k(n.lineNumber,n.column,n.lineNumber,n.column),r=Hu.get(t);if(!r)return;r.startFindDefinitionFromCursor(n).then(()=>{i.showContentHover(s,1,1,!0)})}}class Mue extends we{constructor(){super({id:"editor.action.scrollUpHover",label:p({},"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:16,weight:100}})}run(e,t){const i=Ds.get(t);i&&i.scrollUp()}}class Rue extends we{constructor(){super({id:"editor.action.scrollDownHover",label:p({},"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:18,weight:100}})}run(e,t){const i=Ds.get(t);i&&i.scrollDown()}}class Aue extends we{constructor(){super({id:"editor.action.scrollLeftHover",label:p({},"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:15,weight:100}})}run(e,t){const i=Ds.get(t);i&&i.scrollLeft()}}class Pue extends we{constructor(){super({id:"editor.action.scrollRightHover",label:p({},"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:17,weight:100}})}run(e,t){const i=Ds.get(t);i&&i.scrollRight()}}class Oue extends we{constructor(){super({id:"editor.action.pageUpHover",label:p({},"Page Up Hover"),alias:"Page Up Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:11,secondary:[528],weight:100}})}run(e,t){const i=Ds.get(t);i&&i.pageUp()}}class Fue extends we{constructor(){super({id:"editor.action.pageDownHover",label:p({},"Page Down Hover"),alias:"Page Down Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:12,secondary:[530],weight:100}})}run(e,t){const i=Ds.get(t);i&&i.pageDown()}}class Bue extends we{constructor(){super({id:"editor.action.goToTopHover",label:p({},"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:14,secondary:[2064],weight:100}})}run(e,t){const i=Ds.get(t);i&&i.goToTop()}}class Wue extends we{constructor(){super({id:"editor.action.goToBottomHover",label:p({},"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:13,secondary:[2066],weight:100}})}run(e,t){const i=Ds.get(t);i&&i.goToBottom()}}yt(Ds.ID,Ds,2);de(Nue);de(Tue);de(Mue);de(Rue);de(Aue);de(Pue);de(Oue);de(Fue);de(Bue);de(Wue);ag.register(Kw);ag.register(LN);Sr((o,e)=>{const t=o.getColor(NG);t&&(e.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${t.transparent(.5)}; }`))});class IN extends K{constructor(e){super(),this._editor=e,this._register(e.onMouseDown(t=>this.onMouseDown(t)))}dispose(){super.dispose()}onMouseDown(e){const t=this._editor.getOption(146);if(t!=="click"&&t!=="clickAndHover")return;const i=e.target;if(i.type!==6||!i.detail.injectedText||i.detail.injectedText.options.attachedData!==V6||!i.range)return;const n=this._editor.getContribution(Ds.ID);if(n&&!n.isColorPickerVisible){const s=new k(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1);n.showContentHover(s,1,0,!1,!0)}}}IN.ID="editor.contrib.colorContribution";yt(IN.ID,IN,2);ag.register(Vw);var mW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Hr=function(o,e){return function(t,i){e(t,i,o)}},EN,NN;let Qc=EN=class extends K{constructor(e,t,i,n,s,r,a){super(),this._editor=e,this._modelService=i,this._keybindingService=n,this._instantiationService=s,this._languageFeatureService=r,this._languageConfigurationService=a,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=M.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=M.standaloneColorPickerFocused.bindTo(t)}showOrFocus(){var e;this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||(e=this._standaloneColorPickerWidget)===null||e===void 0||e.focus():this._standaloneColorPickerWidget=new qw(this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused,this._instantiationService,this._modelService,this._keybindingService,this._languageFeatureService,this._languageConfigurationService))}hide(){var e;this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),(e=this._standaloneColorPickerWidget)===null||e===void 0||e.hide(),this._editor.focus()}insertColor(){var e;(e=this._standaloneColorPickerWidget)===null||e===void 0||e.updateEditor(),this.hide()}static get(e){return e.getContribution(EN.ID)}};Qc.ID="editor.contrib.standaloneColorPickerController";Qc=EN=mW([Hr(1,We),Hr(2,ii),Hr(3,Pt),Hr(4,Oe),Hr(5,Se),Hr(6,Wt)],Qc);yt(Qc.ID,Qc,1);const g5=8,Vue=22;let qw=NN=class extends K{constructor(e,t,i,n,s,r,a,l){var d;super(),this._editor=e,this._standaloneColorPickerVisible=t,this._standaloneColorPickerFocused=i,this._modelService=s,this._keybindingService=r,this._languageFeaturesService=a,this._languageConfigurationService=l,this.allowEditorOverflow=!0,this._position=void 0,this._body=document.createElement("div"),this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new W),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=n.createInstance(W0,this._editor),this._position=(d=this._editor._getViewModel())===null||d===void 0?void 0:d.getPrimaryCursorState().modelState.position;const c=this._editor.getSelection(),h=c?{startLineNumber:c.startLineNumber,startColumn:c.startColumn,endLineNumber:c.endLineNumber,endColumn:c.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},u=this._register(dl(this._body));this._register(u.onDidBlur(g=>{this.hide()})),this._register(u.onDidFocus(g=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(g=>{var f;const m=(f=g.target.element)===null||f===void 0?void 0:f.classList;m&&m.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(g=>{this._render(g.value,g.foundInEditor)})),this._start(h),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return NN.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;const e=this._editor.getOption(60).above;return{position:this._position,secondaryPosition:this._position,preference:e?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}async _start(e){const t=await this._computeAsync(e);t&&this._onResult.fire(new Hue(t.result,t.foundInEditor))}async _computeAsync(e){if(!this._editor.hasModel())return null;const t={range:e,color:{red:0,green:0,blue:0,alpha:1}},i=await this._standaloneColorPickerParticipant.createColorHover(t,new bR(this._modelService,this._languageConfigurationService),this._languageFeaturesService.colorProvider);return i?{result:i.colorHover,foundInEditor:i.foundInEditor}:null}_render(e,t){const i=document.createDocumentFragment(),n=this._register(new Uw(this._keybindingService));let s;const r={fragment:i,statusBar:n,setColorPicker:m=>s=m,onContentsChanged:()=>{},hide:()=>this.hide()};if(this._colorHover=e,this._register(this._standaloneColorPickerParticipant.renderHoverParts(r,[e])),s===void 0)return;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(this._editor.getLayoutInfo().width*.66,500)+"px",this._body.tabIndex=0,this._body.appendChild(i),s.layout();const a=s.body,l=a.saturationBox.domNode.clientWidth,d=a.domNode.clientWidth-l-Vue-g5,c=s.body.enterButton;c?.onClicked(()=>{this.updateEditor(),this.hide()});const h=s.header,u=h.pickedColorNode;u.style.width=l+g5+"px";const g=h.originalColorNode;g.style.width=d+"px";const f=s.header.closeButton;f?.onClicked(()=>{this.hide()}),t&&(c&&(c.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}};qw.ID="editor.contrib.standaloneColorPickerWidget";qw=NN=mW([Hr(3,Oe),Hr(4,ii),Hr(5,Pt),Hr(6,Se),Hr(7,Wt)],qw);class Hue{constructor(e,t){this.value=e,this.foundInEditor=t}}class zue extends aa{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{value:p("showOrFocusStandaloneColorPicker","Show or Focus Standalone Color Picker"),mnemonicTitle:p({},"&&Show or Focus Standalone Color Picker"),original:"Show or Focus Standalone Color Picker"},precondition:void 0,menu:[{id:N.CommandPalette}]})}runEditorCommand(e,t){var i;(i=Qc.get(t))===null||i===void 0||i.showOrFocus()}}class Uue extends we{constructor(){super({id:"editor.action.hideColorPicker",label:p({},"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:M.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100}})}run(e,t){var i;(i=Qc.get(t))===null||i===void 0||i.hide()}}class $ue extends we{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:p({},"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:M.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100}})}run(e,t){var i;(i=Qc.get(t))===null||i===void 0||i.insertColor()}}de(Uue);de($ue);Xt(zue);class ac{constructor(e,t,i){this.languageConfigurationService=i,this._selection=e,this._insertSpace=t,this._usedEndToken=null}static _haystackHasNeedleAtOffset(e,t,i){if(i<0)return!1;const n=t.length,s=e.length;if(i+n>s)return!1;for(let r=0;r<n;r++){const a=e.charCodeAt(i+r),l=t.charCodeAt(r);if(a!==l&&!(a>=65&&a<=90&&a+32===l)&&!(l>=65&&l<=90&&l+32===a))return!1}return!0}_createOperationsForBlockComment(e,t,i,n,s,r){const a=e.startLineNumber,l=e.startColumn,d=e.endLineNumber,c=e.endColumn,h=s.getLineContent(a),u=s.getLineContent(d);let g=h.lastIndexOf(t,l-1+t.length),f=u.indexOf(i,c-1-i.length);if(g!==-1&&f!==-1)if(a===d)h.substring(g+t.length,f).indexOf(i)>=0&&(g=-1,f=-1);else{const _=h.substring(g+t.length),v=u.substring(0,f);(_.indexOf(i)>=0||v.indexOf(i)>=0)&&(g=-1,f=-1)}let m;g!==-1&&f!==-1?(n&&g+t.length<h.length&&h.charCodeAt(g+t.length)===32&&(t=t+" "),n&&f>0&&u.charCodeAt(f-1)===32&&(i=" "+i,f-=1),m=ac._createRemoveBlockCommentOperations(new k(a,g+t.length+1,d,f+1),t,i)):(m=ac._createAddBlockCommentOperations(e,t,i,this._insertSpace),this._usedEndToken=m.length===1?i:null);for(const _ of m)r.addTrackedEditOperation(_.range,_.text)}static _createRemoveBlockCommentOperations(e,t,i){const n=[];return k.isEmpty(e)?n.push(oi.delete(new k(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(n.push(oi.delete(new k(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),n.push(oi.delete(new k(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),n}static _createAddBlockCommentOperations(e,t,i,n){const s=[];return k.isEmpty(e)?s.push(oi.replace(new k(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(s.push(oi.insert(new V(e.startLineNumber,e.startColumn),t+(n?" ":""))),s.push(oi.insert(new V(e.endLineNumber,e.endColumn),(n?" ":"")+i))),s}getEditOperations(e,t){const i=this._selection.startLineNumber,n=this._selection.startColumn;e.tokenization.tokenizeIfCheap(i);const s=e.getLanguageIdAtPosition(i,n),r=this.languageConfigurationService.getLanguageConfiguration(s).comments;!r||!r.blockCommentStartToken||!r.blockCommentEndToken||this._createOperationsForBlockComment(this._selection,r.blockCommentStartToken,r.blockCommentEndToken,this._insertSpace,e,t)}computeCursorState(e,t){const i=t.getInverseEditOperations();if(i.length===2){const n=i[0],s=i[1];return new xe(n.range.endLineNumber,n.range.endColumn,s.range.startLineNumber,s.range.startColumn)}else{const n=i[0].range,s=this._usedEndToken?-this._usedEndToken.length-1:0;return new xe(n.endLineNumber,n.endColumn+s,n.endLineNumber,n.endColumn+s)}}}class Fl{constructor(e,t,i,n,s,r,a){this.languageConfigurationService=e,this._selection=t,this._tabSize=i,this._type=n,this._insertSpace=s,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=a||!1}static _gatherPreflightCommentStrings(e,t,i,n){e.tokenization.tokenizeIfCheap(t);const s=e.getLanguageIdAtPosition(t,1),r=n.getLanguageConfiguration(s).comments,a=r?r.lineCommentToken:null;if(!a)return null;const l=[];for(let d=0,c=i-t+1;d<c;d++)l[d]={ignore:!1,commentStr:a,commentStrOffset:0,commentStrLength:a.length};return l}static _analyzeLines(e,t,i,n,s,r,a,l){let d=!0,c;e===0?c=!0:e===1?c=!1:c=!0;for(let h=0,u=n.length;h<u;h++){const g=n[h],f=s+h;if(f===s&&a){g.ignore=!0;continue}const m=i.getLineContent(f),_=Xn(m);if(_===-1){g.ignore=r,g.commentStrOffset=m.length;continue}if(d=!1,g.ignore=!1,g.commentStrOffset=_,c&&!ac._haystackHasNeedleAtOffset(m,g.commentStr,_)&&(e===0?c=!1:e===1||(g.ignore=!0)),c&&t){const v=_+g.commentStrLength;v<m.length&&m.charCodeAt(v)===32&&(g.commentStrLength+=1)}}if(e===0&&d){c=!1;for(let h=0,u=n.length;h<u;h++)n[h].ignore=!1}return{supported:!0,shouldRemoveComments:c,lines:n}}static _gatherPreflightData(e,t,i,n,s,r,a,l){const d=Fl._gatherPreflightCommentStrings(i,n,s,l);return d===null?{supported:!1}:Fl._analyzeLines(e,t,i,d,n,r,a,l)}_executeLineComments(e,t,i,n){let s;i.shouldRemoveComments?s=Fl._createRemoveLineCommentsOperations(i.lines,n.startLineNumber):(Fl._normalizeInsertionPoint(e,i.lines,n.startLineNumber,this._tabSize),s=this._createAddLineCommentsOperations(i.lines,n.startLineNumber));const r=new V(n.positionLineNumber,n.positionColumn);for(let a=0,l=s.length;a<l;a++)t.addEditOperation(s[a].range,s[a].text),k.isEmpty(s[a].range)&&k.getStartPosition(s[a].range).equals(r)&&e.getLineContent(r.lineNumber).length+1===r.column&&(this._deltaColumn=(s[a].text||"").length);this._selectionId=t.trackSelection(n)}_attemptRemoveBlockComment(e,t,i,n){let s=t.startLineNumber,r=t.endLineNumber;const a=n.length+Math.max(e.getLineFirstNonWhitespaceColumn(t.startLineNumber),t.startColumn);let l=e.getLineContent(s).lastIndexOf(i,a-1),d=e.getLineContent(r).indexOf(n,t.endColumn-1-i.length);return l!==-1&&d===-1&&(d=e.getLineContent(s).indexOf(n,l+i.length),r=s),l===-1&&d!==-1&&(l=e.getLineContent(r).lastIndexOf(i,d),s=r),t.isEmpty()&&(l===-1||d===-1)&&(l=e.getLineContent(s).indexOf(i),l!==-1&&(d=e.getLineContent(s).indexOf(n,l+i.length))),l!==-1&&e.getLineContent(s).charCodeAt(l+i.length)===32&&(i+=" "),d!==-1&&e.getLineContent(r).charCodeAt(d-1)===32&&(n=" "+n,d-=1),l!==-1&&d!==-1?ac._createRemoveBlockCommentOperations(new k(s,l+i.length+1,r,d+1),i,n):null}_executeBlockComment(e,t,i){e.tokenization.tokenizeIfCheap(i.startLineNumber);const n=e.getLanguageIdAtPosition(i.startLineNumber,1),s=this.languageConfigurationService.getLanguageConfiguration(n).comments;if(!s||!s.blockCommentStartToken||!s.blockCommentEndToken)return;const r=s.blockCommentStartToken,a=s.blockCommentEndToken;let l=this._attemptRemoveBlockComment(e,i,r,a);if(!l){if(i.isEmpty()){const d=e.getLineContent(i.startLineNumber);let c=Xn(d);c===-1&&(c=d.length),l=ac._createAddBlockCommentOperations(new k(i.startLineNumber,c+1,i.startLineNumber,d.length+1),r,a,this._insertSpace)}else l=ac._createAddBlockCommentOperations(new k(i.startLineNumber,e.getLineFirstNonWhitespaceColumn(i.startLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),r,a,this._insertSpace);l.length===1&&(this._deltaColumn=r.length+1)}this._selectionId=t.trackSelection(i);for(const d of l)t.addEditOperation(d.range,d.text)}getEditOperations(e,t){let i=this._selection;if(this._moveEndPositionDown=!1,i.startLineNumber===i.endLineNumber&&this._ignoreFirstLine){t.addEditOperation(new k(i.startLineNumber,e.getLineMaxColumn(i.startLineNumber),i.startLineNumber+1,1),i.startLineNumber===e.getLineCount()?"":`
|
|
653
653
|
`),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=Fl._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 xe(i.selectionStartLineNumber,i.selectionStartColumn+this._deltaColumn,i.positionLineNumber,i.positionColumn+this._deltaColumn)}static _createRemoveLineCommentsOperations(e,t){const i=[];for(let n=0,s=e.length;n<s;n++){const r=e[n];r.ignore||i.push(oi.delete(new k(t+n,r.commentStrOffset+1,t+n,r.commentStrOffset+r.commentStrLength+1)))}return i}_createAddLineCommentsOperations(e,t){const i=[],n=this._insertSpace?" ":"";for(let s=0,r=e.length;s<r;s++){const a=e[s];a.ignore||i.push(oi.insert(new V(t+s,a.commentStrOffset+1),a.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 s=1073741824,r,a;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,g=t[l].commentStrOffset;h<s&&u<g;u++)h=Fl.nextVisibleColumn(h,n,c.charCodeAt(u)===9,1);h<s&&(s=h)}s=Math.floor(s/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(r=0,a=t[l].commentStrOffset;h<s&&r<a;r++)h=Fl.nextVisibleColumn(h,n,c.charCodeAt(r)===9,1);h>s?t[l].commentStrOffset=r-1:t[l].commentStrOffset=r}}}class kR extends we{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(Wt);if(!t.hasModel())return;const n=t.getModel(),s=[],r=n.getOptions(),a=t.getOption(23),l=t.getSelections().map((c,h)=>({selection:c,index:h,ignoreFirstLine:!1}));l.sort((c,h)=>k.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)s.push(new Fl(i,c.selection,r.tabSize,this._type,a.insertSpace,a.ignoreEmptyLines,c.ignoreFirstLine));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class Kue extends kR{constructor(){super(0,{id:"editor.action.commentLine",label:p("comment.line","Toggle Line Comment"),alias:"Toggle Line Comment",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:N.MenubarEditMenu,group:"5_insert",title:p({},"&&Toggle Line Comment"),order:1}})}}class jue extends kR{constructor(){super(1,{id:"editor.action.addCommentLine",label:p("comment.line.add","Add Line Comment"),alias:"Add Line Comment",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:qi(2089,2081),weight:100}})}}class que extends kR{constructor(){super(2,{id:"editor.action.removeCommentLine",label:p("comment.line.remove","Remove Line Comment"),alias:"Remove Line Comment",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:qi(2089,2099),weight:100}})}}class Gue extends we{constructor(){super({id:"editor.action.blockComment",label:p("comment.block","Toggle Block Comment"),alias:"Toggle Block Comment",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:N.MenubarEditMenu,group:"5_insert",title:p({},"Toggle &&Block Comment"),order:2}})}run(e,t){const i=e.get(Wt);if(!t.hasModel())return;const n=t.getOption(23),s=[],r=t.getSelections();for(const a of r)s.push(new ac(a,n.insertSpace,i));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}de(Kue);de(jue);de(que);de(Gue);var Zue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kh=function(o,e){return function(t,i){e(t,i,o)}},TN;let yp=TN=class{static get(e){return e.getContribution(TN.ID)}constructor(e,t,i,n,s,r,a,l){this._contextMenuService=t,this._contextViewService=i,this._contextKeyService=n,this._keybindingService=s,this._menuService=r,this._configurationService=a,this._workspaceContextService=l,this._toDispose=new se,this._contextMenuIsBeingShownCount=0,this._editor=e,this._toDispose.add(this._editor.onContextMenu(d=>this._onContextMenu(d))),this._toDispose.add(this._editor.onMouseWheel(d=>{if(this._contextMenuIsBeingShownCount>0){const c=this._contextViewService.getContextViewElement(),h=d.srcElement;h.shadowRoot&&xu(c)===h.shadowRoot||this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown(d=>{this._editor.getOption(24)&&d.keyCode===58&&(d.preventDefault(),d.stopPropagation(),this.showContextMenu())}))}_onContextMenu(e){if(!this._editor.hasModel())return;if(!this._editor.getOption(24)){this._editor.focus(),e.target.position&&!this._editor.getSelection().containsPosition(e.target.position)&&this._editor.setPosition(e.target.position);return}if(e.target.type===12||e.target.type===6&&e.target.detail.injectedText)return;if(e.event.preventDefault(),e.event.stopPropagation(),e.target.type===11)return this._showScrollbarContextMenu(e.event);if(e.target.type!==6&&e.target.type!==7&&e.target.type!==1)return;if(this._editor.focus(),e.target.position){let i=!1;for(const n of this._editor.getSelections())if(n.containsPosition(e.target.position)){i=!0;break}i||this._editor.setPosition(e.target.position)}let t=null;e.target.type!==1&&(t=e.event),this.showContextMenu(t)}showContextMenu(e){if(!this._editor.getOption(24)||!this._editor.hasModel())return;const t=this._getMenuActions(this._editor.getModel(),this._editor.isSimpleWidget?N.SimpleEditorContext:N.EditorContext);t.length>0&&this._doShowContextMenu(t,e)}_getMenuActions(e,t){const i=[],n=this._menuService.createMenu(t,this._contextKeyService),s=n.getActions({arg:e.uri});n.dispose();for(const r of s){const[,a]=r;let l=0;for(const d of a)if(d instanceof $_){const c=this._getMenuActions(e,d.item.submenu);c.length>0&&(i.push(new Gf(d.id,d.label,c)),l++)}else i.push(d),l++;l&&i.push(new dn)}return i.length&&i.pop(),i}_doShowContextMenu(e,t=null){if(!this._editor.hasModel())return;const i=this._editor.getOption(60);this._editor.updateOptions({hover:{enabled:!1}});let n=t;if(!n){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const r=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),a=ji(this._editor.getDomNode()),l=a.left+r.left,d=a.top+r.top+r.height;n={x:l,y:d}}const s=this._editor.getOption(126)&&!rl;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:s?this._editor.getDomNode():void 0,getAnchor:()=>n,getActions:()=>e,getActionViewItem:r=>{const a=this._keybindingFor(r);if(a)return new up(r,r,{label:!0,keybinding:a.getLabel(),isMenu:!0});const l=r;return typeof l.getActionViewItem=="function"?l.getActionViewItem():new up(r,r,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:r=>this._keybindingFor(r),onHide:r=>{this._contextMenuIsBeingShownCount--,this._editor.updateOptions({hover:i})}})}_showScrollbarContextMenu(e){if(!this._editor.hasModel()||$te(this._workspaceContextService.getWorkspace()))return;const t=this._editor.getOption(72);let i=0;const n=d=>({id:`menu-action-${++i}`,label:d.label,tooltip:"",class:void 0,enabled:typeof d.enabled>"u"?!0:d.enabled,checked:d.checked,run:d.run}),s=(d,c)=>new Gf(`menu-action-${++i}`,d,c,void 0),r=(d,c,h,u,g)=>{if(!c)return n({label:d,enabled:c,run:()=>{}});const f=_=>()=>{this._configurationService.updateValue(h,_)},m=[];for(const _ of g)m.push(n({label:_.label,checked:u===_.value,run:f(_.value)}));return s(d,m)},a=[];a.push(n({label:p("context.minimap.minimap","Minimap"),checked:t.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!t.enabled)}})),a.push(new dn),a.push(n({label:p("context.minimap.renderCharacters","Render Characters"),enabled:t.enabled,checked:t.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!t.renderCharacters)}})),a.push(r(p("context.minimap.size","Vertical size"),t.enabled,"editor.minimap.size",t.size,[{label:p("context.minimap.size.proportional","Proportional"),value:"proportional"},{label:p("context.minimap.size.fill","Fill"),value:"fill"},{label:p("context.minimap.size.fit","Fit"),value:"fit"}])),a.push(r(p("context.minimap.slider","Slider"),t.enabled,"editor.minimap.showSlider",t.showSlider,[{label:p("context.minimap.slider.mouseover","Mouse Over"),value:"mouseover"},{label:p("context.minimap.slider.always","Always"),value:"always"}]));const l=this._editor.getOption(126)&&!rl;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:l?this._editor.getDomNode():void 0,getAnchor:()=>e,getActions:()=>a,onHide:d=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(e){return this._keybindingService.lookupKeybinding(e.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};yp.ID="editor.contrib.contextmenu";yp=TN=Zue([kh(1,Yo),kh(2,bd),kh(3,We),kh(4,Pt),kh(5,ra),kh(6,ft),kh(7,Eu)],yp);class Yue extends we{constructor(){super({id:"editor.action.showContextMenu",label:p("action.showContextMenu.label","Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:1092,weight:100}})}run(e,t){var i;(i=yp.get(t))===null||i===void 0||i.showContextMenu()}}yt(yp.ID,yp,2);de(Yue);class uD{constructor(e){this.selections=e}equals(e){const t=this.selections.length,i=e.selections.length;if(t!==i)return!1;for(let n=0;n<t;n++)if(!this.selections[n].equalsSelection(e.selections[n]))return!1;return!0}}class gD{constructor(e,t,i){this.cursorState=e,this.scrollTop=t,this.scrollLeft=i}}class zu extends K{static get(e){return e.getContribution(zu.ID)}constructor(e){super(),this._editor=e,this._isCursorUndoRedo=!1,this._undoStack=[],this._redoStack=[],this._register(e.onDidChangeModel(t=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeModelContent(t=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeCursorSelection(t=>{if(this._isCursorUndoRedo||!t.oldSelections||t.oldModelVersionId!==t.modelVersionId)return;const i=new uD(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new gD(i,e.getScrollTop(),e.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())}))}cursorUndo(){!this._editor.hasModel()||this._undoStack.length===0||(this._redoStack.push(new gD(new uD(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){!this._editor.hasModel()||this._redoStack.length===0||(this._undoStack.push(new gD(new uD(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._redoStack.pop()))}_applyState(e){this._isCursorUndoRedo=!0,this._editor.setSelections(e.cursorState.selections),this._editor.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),this._isCursorUndoRedo=!1}}zu.ID="editor.contrib.cursorUndoRedoController";class Xue extends we{constructor(){super({id:"cursorUndo",label:p("cursor.undo","Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:2099,weight:100}})}run(e,t,i){var n;(n=zu.get(t))===null||n===void 0||n.cursorUndo()}}class Que extends we{constructor(){super({id:"cursorRedo",label:p("cursor.redo","Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(e,t,i){var n;(n=zu.get(t))===null||n===void 0||n.cursorRedo()}}yt(zu.ID,zu,0);de(Xue);de(Que);class Jue{constructor(e,t,i){this.selection=e,this.targetPosition=t,this.copy=i,this.targetSelection=null}getEditOperations(e,t){const i=e.getValueInRange(this.selection);if(this.copy||t.addEditOperation(this.selection,null),t.addEditOperation(new k(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),i),this.selection.containsPosition(this.targetPosition)&&!(this.copy&&(this.selection.getEndPosition().equals(this.targetPosition)||this.selection.getStartPosition().equals(this.targetPosition)))){this.targetSelection=this.selection;return}if(this.copy){this.targetSelection=new xe(this.targetPosition.lineNumber,this.targetPosition.column,this.selection.endLineNumber-this.selection.startLineNumber+this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber>this.selection.endLineNumber){this.targetSelection=new xe(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber<this.selection.endLineNumber){this.targetSelection=new xe(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber+this.selection.endLineNumber-this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}this.selection.endColumn<=this.targetPosition.column?this.targetSelection=new xe(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column-this.selection.endColumn+this.selection.startColumn:this.targetPosition.column-this.selection.endColumn+this.selection.startColumn,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column:this.selection.endColumn):this.targetSelection=new xe(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column+this.selection.endColumn-this.selection.startColumn)}computeCursorState(e,t){return this.targetSelection}}function Eg(o){return ut?o.altKey:o.ctrlKey}class dd extends K{constructor(e){super(),this._editor=e,this._dndDecorationIds=this._editor.createDecorationsCollection(),this._register(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._register(this._editor.onMouseUp(t=>this._onEditorMouseUp(t))),this._register(this._editor.onMouseDrag(t=>this._onEditorMouseDrag(t))),this._register(this._editor.onMouseDrop(t=>this._onEditorMouseDrop(t))),this._register(this._editor.onMouseDropCanceled(()=>this._onEditorMouseDropCanceled())),this._register(this._editor.onKeyDown(t=>this.onEditorKeyDown(t))),this._register(this._editor.onKeyUp(t=>this.onEditorKeyUp(t))),this._register(this._editor.onDidBlurEditorWidget(()=>this.onEditorBlur())),this._register(this._editor.onDidBlurEditorText(()=>this.onEditorBlur())),this._mouseDown=!1,this._modifierPressed=!1,this._dragSelection=null}onEditorBlur(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1}onEditorKeyDown(e){!this._editor.getOption(35)||this._editor.getOption(22)||(Eg(e)&&(this._modifierPressed=!0),this._mouseDown&&Eg(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){!this._editor.getOption(35)||this._editor.getOption(22)||(Eg(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===dd.TRIGGER_KEY_VALUE&&this._editor.updateOptions({mouseStyle:"default"}))}_onEditorMouseDown(e){this._mouseDown=!0}_onEditorMouseUp(e){this._mouseDown=!1,this._editor.updateOptions({mouseStyle:"text"})}_onEditorMouseDrag(e){const t=e.target;if(this._dragSelection===null){const n=(this._editor.getSelections()||[]).filter(s=>t.position&&s.containsPosition(t.position));if(n.length===1)this._dragSelection=n[0];else return}Eg(e.event)?this._editor.updateOptions({mouseStyle:"copy"}):this._editor.updateOptions({mouseStyle:"default"}),t.position&&(this._dragSelection.containsPosition(t.position)?this._removeDecoration():this.showAt(t.position))}_onEditorMouseDropCanceled(){this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}_onEditorMouseDrop(e){if(e.target&&(this._hitContent(e.target)||this._hitMargin(e.target))&&e.target.position){const t=new V(e.target.position.lineNumber,e.target.position.column);if(this._dragSelection===null){let i=null;if(e.event.shiftKey){const n=this._editor.getSelection();if(n){const{selectionStartLineNumber:s,selectionStartColumn:r}=n;i=[new xe(s,r,t.lineNumber,t.column)]}}else i=(this._editor.getSelections()||[]).map(n=>n.containsPosition(t)?new xe(t.lineNumber,t.column,t.lineNumber,t.column):n);this._editor.setSelections(i||[],"mouse",3)}else(!this._dragSelection.containsPosition(t)||(Eg(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(dd.ID,new Jue(this._dragSelection,t,Eg(e.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}showAt(e){this._dndDecorationIds.set([{range:new k(e.lineNumber,e.column,e.lineNumber,e.column),options:dd._DECORATION_OPTIONS}]),this._editor.revealPosition(e,1)}_removeDecoration(){this._dndDecorationIds.clear()}_hitContent(e){return e.type===6||e.type===7}_hitMargin(e){return e.type===2||e.type===3||e.type===4}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}}dd.ID="editor.contrib.dragAndDrop";dd.TRIGGER_KEY_VALUE=ut?6:5;dd._DECORATION_OPTIONS=Ze.register({description:"dnd-target",className:"dnd-target"});yt(dd.ID,dd,2);const zy=function(){if(typeof crypto=="object"&&typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let o;typeof crypto=="object"&&typeof crypto.getRandomValues=="function"?o=crypto.getRandomValues.bind(crypto):o=function(i){for(let n=0;n<i.length;n++)i[n]=Math.floor(Math.random()*256);return i};const e=new Uint8Array(16),t=[];for(let i=0;i<256;i++)t.push(i.toString(16).padStart(2,"0"));return function(){o(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let n=0,s="";return s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+="-",s+=t[e[n++]],s+=t[e[n++]],s+="-",s+=t[e[n++]],s+=t[e[n++]],s+="-",s+=t[e[n++]],s+=t[e[n++]],s+="-",s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s}}();function IR(o){return{asString:async()=>o,asFile:()=>{},value:typeof o=="string"?o:void 0}}function ege(o,e,t){const i={id:zy(),name:o,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class _W{constructor(){this._entries=new Map}get size(){let e=0;for(const t of this._entries)e++;return e}has(e){return this._entries.has(this.toKey(e))}matches(e){const t=[...this._entries.keys()];return rt.some(this,([i,n])=>n.asFile())&&t.push("files"),bW(Gw(e),t)}get(e){var t;return(t=this._entries.get(this.toKey(e)))===null||t===void 0?void 0:t[0]}append(e,t){const i=this._entries.get(e);i?i.push(t):this._entries.set(this.toKey(e),[t])}replace(e,t){this._entries.set(this.toKey(e),[t])}delete(e){this._entries.delete(this.toKey(e))}*[Symbol.iterator](){for(const[e,t]of this._entries)for(const i of t)yield[e,i]}toKey(e){return Gw(e)}}function Gw(o){return o.toLowerCase()}function vW(o,e){return bW(Gw(o),e.map(Gw))}function bW(o,e){if(o==="*/*")return e.length>0;if(e.includes(o))return!0;const t=o.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!t)return!1;const[i,n,s]=t;return s==="*"?e.some(r=>r.startsWith(n+"/")):!1}const Uy=Object.freeze({create:o=>Ic(o.map(e=>e.toString())).join(`\r
|
|
654
654
|
`),split:o=>o.split(`\r
|
|
655
655
|
`),parse:o=>Uy.split(o).filter(e=>!e.startsWith("#"))}),f5={EDITORS:"CodeEditors",FILES:"CodeFiles"};class tge{}const ige={DragAndDropContribution:"workbench.contributions.dragAndDrop"};Ri.add(ige.DragAndDropContribution,new tge);class U0{constructor(){}static getInstance(){return U0.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}}U0.INSTANCE=new U0;function CW(o){const e=new _W;for(const t of o.items){const i=t.type;if(t.kind==="string"){const n=new Promise(s=>t.getAsString(s));e.append(i,IR(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,nge(n))}}return e}function nge(o){const e=o.path?Me.parse(o.path):void 0;return ege(o.name,e,async()=>new Uint8Array(await o.arrayBuffer()))}const sge=Object.freeze([f5.EDITORS,f5.FILES,w0.RESOURCES,w0.INTERNAL_URI_LIST]);function wW(o,e=!1){const t=CW(o),i=t.get(w0.INTERNAL_URI_LIST);if(i)t.replace(Li.uriList,i);else if(e||!t.has(Li.uriList)){const n=[];for(const s of o.items){const r=s.getAsFile();if(r){const a=r.path;try{a?n.push(Me.file(a).toString()):n.push(Me.parse(r.name,!0).toString())}catch{}}}n.length&&t.replace(Li.uriList,IR(Uy.create(n)))}for(const n of sge)t.delete(n);return t}function oge(o,e,t){var i,n;return{edits:[...e.map(s=>new ad(o,typeof t.insertText=="string"?{range:s,text:t.insertText,insertAsSnippet:!1}:{range:s,text:t.insertText.snippet,insertAsSnippet:!0})),...(n=(i=t.additionalEdit)===null||i===void 0?void 0:i.edits)!==null&&n!==void 0?n:[]]}}function SW(o){var e;function t(a,l){return"providerId"in a&&a.providerId===l.providerId||"mimeType"in a&&a.mimeType===l.handledMimeType}const i=new Map;for(const a of o)for(const l of(e=a.yieldTo)!==null&&e!==void 0?e:[])for(const d of o)if(d!==a&&t(l,d)){let c=i.get(a);c||(c=[],i.set(a,c)),c.push(d)}if(!i.size)return Array.from(o);const n=new Set,s=[];function r(a){if(!a.length)return[];const l=a[0];if(s.includes(l))return console.warn(`Yield to cycle detected for ${l.providerId}`),a;if(n.has(l))return r(a.slice(1));let d=[];const c=i.get(l);return c&&(s.push(l),d=r(c),s.pop()),n.add(l),[...d,l,...r(a.slice(1))]}return r(Array.from(o))}var rge=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},age=function(o,e){return function(t,i){e(t,i,o)}};const lge=Ze.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:J3,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}});class $y extends K{constructor(e,t,i,n,s){super(),this.typeId=e,this.editor=t,this.range=i,this.delegate=s,this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this.create(n),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(e){this.domNode=pe(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=pe("span.icon");this.domNode.append(t),t.classList.add(...Re.asClassNameArray(he.loading),"codicon-modifier-spin");const i=()=>{const n=this.editor.getOption(66);this.domNode.style.height=`${n}px`,this.domNode.style.width=`${Math.ceil(.8*n)}px`};i(),this._register(this.editor.onDidChangeConfiguration(n=>{(n.hasChanged(52)||n.hasChanged(66))&&i()})),this._register(Q(this.domNode,ge.CLICK,n=>{this.delegate.cancel()}))}getId(){return $y.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}}$y.baseId="editor.widget.inlineProgressWidget";let Zw=class extends K{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new Cn),this._currentWidget=new Cn,this._operationIdPool=0,this._currentDecorations=t.createDecorationsCollection()}async showWhile(e,t,i){const n=this._operationIdPool++;this._currentOperation=n,this.clear(),this._showPromise.value=Rc(()=>{const s=k.fromPositions(e);this._currentDecorations.set([{range:s,options:lge}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance($y,this.id,this._editor,s,t,i))},this._showDelay);try{return await i}finally{this._currentOperation===n&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};Zw=rge([age(2,Oe)],Zw);var yW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},x_=function(o,e){return function(t,i){e(t,i,o)}},MN;let Yw=MN=class extends K{constructor(e,t,i,n,s,r,a,l,d,c){super(),this.typeId=e,this.editor=t,this.showCommand=n,this.range=s,this.edits=r,this.onSelectNewEdit=a,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(Ae(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(Ae(()=>this.editor.removeContentWidget(this))),this._register(this.editor.onDidChangeCursorPosition(h=>{s.containsPosition(h.position)||this.dispose()})),this._register(fe.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=pe(".post-edit-widget"),this.button=this._register(new yw(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Q(this.domNode,ge.CLICK,()=>this.showSelector()))}getId(){return MN.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=ji(this.button.element);return{x:e.left+e.width,y:e.top+e.height}},getActions:()=>this.edits.allEdits.map((e,t)=>bf({id:"",label:e.label,checked:t===this.edits.activeEditIndex,run:()=>{if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}}))})}};Yw.baseId="editor.widget.postEditWidget";Yw=MN=yW([x_(7,Yo),x_(8,We),x_(9,Pt)],Yw);let Xw=class extends K{constructor(e,t,i,n,s,r){super(),this._id=e,this._editor=t,this._visibleContext=i,this._showCommand=n,this._instantiationService=s,this._bulkEditService=r,this._currentWidget=this._register(new Cn),this._register(fe.any(t.onDidChangeModel,t.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(e,t,i,n){var s,r;const a=this._editor.getModel();if(!a||!e.length)return;const l=t.allEdits[t.activeEditIndex];if(!l)return;let d=[];(typeof l.insertText=="string"?l.insertText==="":l.insertText.snippet==="")?d=[]:d=e.map(_=>new ad(a.uri,typeof l.insertText=="string"?{range:_,text:l.insertText,insertAsSnippet:!1}:{range:_,text:l.insertText.snippet,insertAsSnippet:!0}));const h={edits:[...d,...(r=(s=l.additionalEdit)===null||s===void 0?void 0:s.edits)!==null&&r!==void 0?r:[]]},u=e[0],g=a.deltaDecorations([],[{range:u,options:{description:"paste-line-suffix",stickiness:0}}]);let f,m;try{f=await this._bulkEditService.apply(h,{editor:this._editor,token:n}),m=a.getDecorationRange(g[0])}finally{a.deltaDecorations(g,[])}i&&f.isApplied&&t.allEdits.length>1&&this.show(m??u,t,async _=>{const v=this._editor.getModel();v&&(await v.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:_,allEdits:t.allEdits},i,n))})}show(e,t,i){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(Yw,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()}};Xw=yW([x_(4,Oe),x_(5,kv)],Xw);var dge=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ng=function(o,e){return function(t,i){e(t,i,o)}},RN;const LW="editor.changePasteType",xW=new be("pasteWidgetVisible",!1,p("pasteWidgetVisible","Whether the paste widget is showing")),fD="application/vnd.code.copyMetadata";let Uu=RN=class extends K{static get(e){return e.getContribution(RN.ID)}constructor(e,t,i,n,s,r,a){super(),this._bulkEditService=i,this._clipboardService=n,this._languageFeaturesService=s,this._quickInputService=r,this._progressService=a,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 Zw("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(Xw,"pasteIntoEditor",e,xW,{id:LW,label:p("postPasteWidgetTitle","Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(e){this._editor.focus();try{this._pasteAsActionContext={preferredId:e},Ap().execCommand("paste")}finally{this._pasteAsActionContext=void 0}}isPasteAsEnabled(){return this._editor.getOption(84).enabled&&!this._editor.getOption(90)}handleCopy(e){var t,i;if(!this._editor.hasTextFocus()||(th&&this._clipboardService.writeResources([]),!e.clipboardData||!this.isPasteAsEnabled()))return;const n=this._editor.getModel(),s=this._editor.getSelections();if(!n||!s?.length)return;const r=this._editor.getOption(37);let a=s;const l=s.length===1&&s[0].isEmpty();if(l){if(!r)return;a=[new k(a[0].startLineNumber,1,a[0].startLineNumber,1+n.getLineLength(a[0].startLineNumber))]}const d=(t=this._editor._getViewModel())===null||t===void 0?void 0:t.getPlainTextToCopy(s,r,Vn),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 g=CW(e.clipboardData),f=u.flatMap(v=>{var b;return(b=v.copyMimeTypes)!==null&&b!==void 0?b:[]}),m=zy();this.setCopyMetadata(e.clipboardData,{id:m,providerCopyMimeTypes:f,defaultPastePayload:h});const _=Zi(async v=>{const b=Qr(await Promise.all(u.map(async C=>{try{return await C.prepareDocumentPaste(n,a,g,v)}catch(w){console.error(w);return}})));b.reverse();for(const C of b)for(const[w,y]of C)g.replace(w,y);return g});(i=this._currentCopyOperation)===null||i===void 0||i.dataTransferPromise.cancel(),this._currentCopyOperation={handle:m,dataTransferPromise:_}}async handlePaste(e){var t,i;if(!e.clipboardData||!this._editor.hasTextFocus())return;(t=this._currentPasteOperation)===null||t===void 0||t.cancel(),this._currentPasteOperation=void 0;const n=this._editor.getModel(),s=this._editor.getSelections();if(!s?.length||!n||!this.isPasteAsEnabled())return;const r=this.fetchCopyMetadata(e),a=wW(e.clipboardData);a.delete(fD);const l=[...e.clipboardData.types,...(i=r?.providerCopyMimeTypes)!==null&&i!==void 0?i:[],Li.uriList],d=this._languageFeaturesService.documentPasteEditProvider.ordered(n).filter(c=>{var h;return(h=c.pasteMimeTypes)===null||h===void 0?void 0:h.some(u=>vW(u,l))});d.length&&(e.preventDefault(),e.stopImmediatePropagation(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferredId,d,s,a,r):this.doPasteInline(d,s,a,r))}doPasteInline(e,t,i,n){const s=Zi(async r=>{const a=this._editor;if(!a.hasModel())return;const l=a.getModel(),d=new Uc(a,3,void 0,r);try{if(await this.mergeInDataFromCopy(i,n,d.token),d.token.isCancellationRequested)return;const c=e.filter(u=>p5(u,i));if(!c.length||c.length===1&&c[0].id==="text"){await this.applyDefaultPasteHandler(i,n,d.token);return}const h=await this.getPasteEdits(c,i,l,t,d.token);if(d.token.isCancellationRequested)return;if(h.length===1&&h[0].providerId==="text"){await this.applyDefaultPasteHandler(i,n,d.token);return}if(h.length){const u=a.getOption(84).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:0,allEdits:h},u,d.token)}await this.applyDefaultPasteHandler(i,n,d.token)}finally{d.dispose(),this._currentPasteOperation===s&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),p("pasteIntoEditorProgress","Running paste handlers. Click to cancel"),s),this._currentPasteOperation=s}showPasteAsPick(e,t,i,n,s){const r=Zi(async a=>{const l=this._editor;if(!l.hasModel())return;const d=l.getModel(),c=new Uc(l,3,void 0,a);try{if(await this.mergeInDataFromCopy(n,s,c.token),c.token.isCancellationRequested)return;let h=t.filter(m=>p5(m,n));e&&(h=h.filter(m=>m.id===e));const u=await this.getPasteEdits(h,n,d,i,c.token);if(c.token.isCancellationRequested||!u.length)return;let g;if(e)g=u.at(0);else{const m=await this._quickInputService.pick(u.map(_=>({label:_.label,description:_.providerId,detail:_.detail,edit:_})),{placeHolder:p("pasteAsPickerPlaceholder","Select Paste Action")});g=m?.edit}if(!g)return;const f=oge(d.uri,i,g);await this._bulkEditService.apply(f,{editor:this._editor})}finally{c.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:p("pasteAsProgress","Running paste handlers")},()=>r)}setCopyMetadata(e,t){e.setData(fD,JSON.stringify(t))}fetchCopyMetadata(e){var t;if(!e.clipboardData)return;const i=e.clipboardData.getData(fD);if(i)try{return JSON.parse(i)}catch{return}const[n,s]=rI.getTextData(e.clipboardData);if(s)return{defaultPastePayload:{mode:s.mode,multicursorText:(t=s.multicursorText)!==null&&t!==void 0?t:null,pasteOnNewLine:!!s.isFromEmptySelection}}}async mergeInDataFromCopy(e,t,i){var n;if(t?.id&&((n=this._currentCopyOperation)===null||n===void 0?void 0:n.handle)===t.id){const s=await this._currentCopyOperation.dataTransferPromise;if(i.isCancellationRequested)return;for(const[r,a]of s)e.replace(r,a)}if(!e.has(Li.uriList)){const s=await this._clipboardService.readResources();if(i.isCancellationRequested)return;s.length&&e.append(Li.uriList,IR(Uy.create(s)))}}async getPasteEdits(e,t,i,n,s){const r=await DS(Promise.all(e.map(async l=>{var d;try{const c=await((d=l.provideDocumentPasteEdits)===null||d===void 0?void 0:d.call(l,i,n,t,s));if(c)return{...c,providerId:l.id}}catch(c){console.error(c)}})),s),a=Qr(r??[]);return SW(a)}async applyDefaultPasteHandler(e,t,i){var n,s,r;const a=(n=e.get(Li.text))!==null&&n!==void 0?n:e.get("text");if(!a)return;const l=await a.asString();if(i.isCancellationRequested)return;const d={text:l,pasteOnNewLine:(s=t?.defaultPastePayload.pasteOnNewLine)!==null&&s!==void 0?s:!1,multicursorText:(r=t?.defaultPastePayload.multicursorText)!==null&&r!==void 0?r:null,mode:null};this._editor.trigger("keyboard","paste",d)}};Uu.ID="editor.contrib.copyPasteActionController";Uu=RN=dge([Ng(1,Oe),Ng(2,kv),Ng(3,Sd),Ng(4,Se),Ng(5,dh),Ng(6,R7)],Uu);function p5(o,e){var t;return!!(!((t=o.pasteMimeTypes)===null||t===void 0)&&t.some(i=>e.matches(i)))}var ER=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$0=function(o,e){return function(t,i){e(t,i,o)}};const NR=p("builtIn","Built-in");class TR{async provideDocumentPasteEdits(e,t,i,n){const s=await this.getEdit(i,n);return s?{insertText:s.insertText,label:s.label,detail:s.detail,handledMimeType:s.handledMimeType,yieldTo:s.yieldTo}:void 0}async provideDocumentOnDropEdits(e,t,i,n){const s=await this.getEdit(i,n);return s?{insertText:s.insertText,label:s.label,handledMimeType:s.handledMimeType,yieldTo:s.yieldTo}:void 0}}class DW extends TR{constructor(){super(...arguments),this.id="text",this.dropMimeTypes=[Li.text],this.pasteMimeTypes=[Li.text]}async getEdit(e,t){const i=e.get(Li.text);if(!i||e.has(Li.uriList))return;const n=await i.asString();return{handledMimeType:Li.text,label:p("text.label","Insert Plain Text"),detail:NR,insertText:n}}}class kW extends TR{constructor(){super(...arguments),this.id="uri",this.dropMimeTypes=[Li.uriList],this.pasteMimeTypes=[Li.uriList]}async getEdit(e,t){const i=await IW(e);if(!i.length||t.isCancellationRequested)return;let n=0;const s=i.map(({uri:a,originalText:l})=>a.scheme===Ye.file?a.fsPath:(n++,l)).join(" ");let r;return n>0?r=i.length>1?p("defaultDropProvider.uriList.uris","Insert Uris"):p("defaultDropProvider.uriList.uri","Insert Uri"):r=i.length>1?p("defaultDropProvider.uriList.paths","Insert Paths"):p("defaultDropProvider.uriList.path","Insert Path"),{handledMimeType:Li.uriList,insertText:s,label:r,detail:NR}}}let Qw=class extends TR{constructor(e){super(),this._workspaceContextService=e,this.id="relativePath",this.dropMimeTypes=[Li.uriList],this.pasteMimeTypes=[Li.uriList]}async getEdit(e,t){const i=await IW(e);if(!i.length||t.isCancellationRequested)return;const n=Qr(i.map(({uri:s})=>{const r=this._workspaceContextService.getWorkspaceFolder(s);return r?BQ(r.uri,s):void 0}));if(n.length)return{handledMimeType:Li.uriList,insertText:n.join(" "),label:i.length>1?p("defaultDropProvider.uriList.relativePaths","Insert Relative Paths"):p("defaultDropProvider.uriList.relativePath","Insert Relative Path"),detail:NR}}};Qw=ER([$0(0,Eu)],Qw);async function IW(o){const e=o.get(Li.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const n of Uy.parse(t))try{i.push({uri:Me.parse(n),originalText:n})}catch{}return i}let AN=class extends K{constructor(e,t){super(),this._register(e.documentOnDropEditProvider.register("*",new DW)),this._register(e.documentOnDropEditProvider.register("*",new kW)),this._register(e.documentOnDropEditProvider.register("*",new Qw(t)))}};AN=ER([$0(0,Se),$0(1,Eu)],AN);let PN=class extends K{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new DW)),this._register(e.documentPasteEditProvider.register("*",new kW)),this._register(e.documentPasteEditProvider.register("*",new Qw(t)))}};PN=ER([$0(0,Se),$0(1,Eu)],PN);yt(Uu.ID,Uu,0);yy(PN);ue(new class extends cn{constructor(){super({id:LW,precondition:xW,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e,t){var i;return(i=Uu.get(e))===null||i===void 0?void 0:i.changePasteType()}});de(class extends we{constructor(){super({id:"editor.action.pasteAs",label:p("pasteAs","Paste As..."),alias:"Paste As...",precondition:void 0,metadata:{description:"Paste as",args:[{name:"args",schema:{type:"object",properties:{id:{type:"string",description:p("pasteAs.id","The id of the paste edit to try applying. If not provided, the editor will show a picker.")}}}}]}})}run(o,e,t){var i;const n=typeof t?.id=="string"?t.id:void 0;return(i=Uu.get(e))===null||i===void 0?void 0:i.pasteAs(n)}});class cge{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(e){if(e&&this._dragOperations.has(e)){const t=this._dragOperations.get(e);return this._dragOperations.delete(e),t}}}class m5{constructor(e){this.identifier=e}}const EW=ot("treeViewsDndService");ct(EW,cge,1);var hge=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nC=function(o,e){return function(t,i){e(t,i,o)}},ON;const NW="editor.experimental.dropIntoEditor.defaultProvider",TW="editor.changeDropType",MW=new be("dropWidgetVisible",!1,p("dropWidgetVisible","Whether the drop widget is showing"));let Lp=ON=class extends K{static get(e){return e.getContribution(ON.ID)}constructor(e,t,i,n,s){super(),this._configService=i,this._languageFeaturesService=n,this._treeViewsDragAndDropService=s,this.treeItemsTransfer=U0.getInstance(),this._dropProgressManager=this._register(t.createInstance(Zw,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(Xw,"dropIntoEditor",e,MW,{id:TW,label:p("postDropWidgetTitle","Show drop options...")})),this._register(e.onDropIntoEditor(r=>this.onDropIntoEditor(e,r.position,r.event)))}changeDropType(){this._postDropWidgetManager.tryShowSelector()}async onDropIntoEditor(e,t,i){var n;if(!i.dataTransfer||!e.hasModel())return;(n=this._currentOperation)===null||n===void 0||n.cancel(),e.focus(),e.setPosition(t);const s=Zi(async r=>{const a=new Uc(e,1,void 0,r);try{const l=await this.extractDataTransferData(i);if(l.size===0||a.token.isCancellationRequested)return;const d=e.getModel();if(!d)return;const c=this._languageFeaturesService.documentOnDropEditProvider.ordered(d).filter(u=>u.dropMimeTypes?u.dropMimeTypes.some(g=>l.matches(g)):!0),h=await this.getDropEdits(c,d,t,l,a);if(a.token.isCancellationRequested)return;if(h.length){const u=this.getInitialActiveEditIndex(d,h),g=e.getOption(36).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([k.fromPositions(t)],{activeEditIndex:u,allEdits:h},g,r)}}finally{a.dispose(),this._currentOperation===s&&(this._currentOperation=void 0)}});this._dropProgressManager.showWhile(t,p("dropIntoEditorProgress","Running drop handlers. Click to cancel"),s),this._currentOperation=s}async getDropEdits(e,t,i,n,s){const r=await DS(Promise.all(e.map(async l=>{try{const d=await l.provideDocumentOnDropEdits(t,i,n,s.token);if(d)return{...d,providerId:l.id}}catch(d){console.error(d)}})),s.token),a=Qr(r??[]);return SW(a)}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(NW,{resource:e.uri});for(const[n,s]of Object.entries(i)){const r=t.findIndex(a=>s===a.providerId&&a.handledMimeType&&vW(n,[a.handledMimeType]));if(r>=0)return r}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new _W;const t=wW(e.dataTransfer);if(this.treeItemsTransfer.hasData(m5.prototype)){const i=this.treeItemsTransfer.getData(m5.prototype);if(Array.isArray(i))for(const n of i){const s=await this._treeViewsDragAndDropService.removeDragOperationTransfer(n.identifier);if(s)for(const[r,a]of s)t.replace(r,a)}}return t}};Lp.ID="editor.contrib.dropIntoEditorController";Lp=ON=hge([nC(1,Oe),nC(2,ft),nC(3,Se),nC(4,EW)],Lp);yt(Lp.ID,Lp,2);ue(new class extends cn{constructor(){super({id:TW,precondition:MW,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e,t){var i;(i=Lp.get(e))===null||i===void 0||i.changeDropType()}});yy(AN);Ri.as(la.Configuration).registerConfiguration({...iy,properties:{[NW]:{type:"object",scope:5,description:p("defaultProviderDescription","Configures the default drop provider to use for content of a given mime type."),default:{},additionalProperties:{type:"string"}}}});class Gn{constructor(e){this._editor=e,this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null,this._startPosition=this._editor.getPosition()}dispose(){this._editor.removeDecorations(this._allDecorations()),this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}reset(){this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}getCount(){return this._decorations.length}getFindScope(){return this._findScopeDecorationIds[0]?this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]):null}getFindScopes(){if(this._findScopeDecorationIds.length){const e=this._findScopeDecorationIds.map(t=>this._editor.getModel().getDecorationRange(t)).filter(t=>!!t);if(e.length)return e}return null}getStartPosition(){return this._startPosition}setStartPosition(e){this._startPosition=e,this.setCurrentFindMatch(null)}_getDecorationIndex(e){const t=this._decorations.indexOf(e);return t>=0?t+1:1}getDecorationRangeAt(e){const t=e<this._decorations.length?this._decorations[e]:null;return t?this._editor.getModel().getDecorationRange(t):null}getCurrentMatchesPosition(e){const t=this._editor.getModel().getDecorationsInRange(e);for(const i of t){const n=i.options;if(n===Gn._FIND_MATCH_DECORATION||n===Gn._CURRENT_FIND_MATCH_DECORATION)return this._getDecorationIndex(i.id)}return 0}setCurrentFindMatch(e){let t=null,i=0;if(e)for(let n=0,s=this._decorations.length;n<s;n++){const r=this._editor.getModel().getDecorationRange(this._decorations[n]);if(e.equalsRange(r)){t=this._decorations[n],i=n+1;break}}return(this._highlightedDecorationId!==null||t!==null)&&this._editor.changeDecorations(n=>{if(this._highlightedDecorationId!==null&&(n.changeDecorationOptions(this._highlightedDecorationId,Gn._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),t!==null&&(this._highlightedDecorationId=t,n.changeDecorationOptions(this._highlightedDecorationId,Gn._CURRENT_FIND_MATCH_DECORATION)),this._rangeHighlightDecorationId!==null&&(n.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),t!==null){let s=this._editor.getModel().getDecorationRange(t);if(s.startLineNumber!==s.endLineNumber&&s.endColumn===1){const r=s.endLineNumber-1,a=this._editor.getModel().getLineMaxColumn(r);s=new k(s.startLineNumber,s.startColumn,r,a)}this._rangeHighlightDecorationId=n.addDecoration(s,Gn._RANGE_HIGHLIGHT_DECORATION)}}),i}set(e,t){this._editor.changeDecorations(i=>{let n=Gn._FIND_MATCH_DECORATION;const s=[];if(e.length>1e3){n=Gn._FIND_MATCH_NO_OVERVIEW_DECORATION;const a=this._editor.getModel().getLineCount(),d=this._editor.getLayoutInfo().height/a,c=Math.max(2,Math.ceil(3/d));let h=e[0].range.startLineNumber,u=e[0].range.endLineNumber;for(let g=1,f=e.length;g<f;g++){const m=e[g].range;u+c>=m.startLineNumber?m.endLineNumber>u&&(u=m.endLineNumber):(s.push({range:new k(h,1,u,1),options:Gn._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),h=m.startLineNumber,u=m.endLineNumber)}s.push({range:new k(h,1,u,1),options:Gn._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}const r=new Array(e.length);for(let a=0,l=e.length;a<l;a++)r[a]={range:e[a].range,options:n};this._decorations=i.deltaDecorations(this._decorations,r),this._overviewRulerApproximateDecorations=i.deltaDecorations(this._overviewRulerApproximateDecorations,s),this._rangeHighlightDecorationId&&(i.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),this._findScopeDecorationIds.length&&(this._findScopeDecorationIds.forEach(a=>i.removeDecoration(a)),this._findScopeDecorationIds=[]),t?.length&&(this._findScopeDecorationIds=t.map(a=>i.addDecoration(a,Gn._FIND_SCOPE_DECORATION)))})}matchBeforePosition(e){if(this._decorations.length===0)return null;for(let t=this._decorations.length-1;t>=0;t--){const i=this._decorations[t],n=this._editor.getModel().getDecorationRange(i);if(!(!n||n.endLineNumber>e.lineNumber)){if(n.endLineNumber<e.lineNumber)return n;if(!(n.endColumn>e.column))return n}}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(e){if(this._decorations.length===0)return null;for(let t=0,i=this._decorations.length;t<i;t++){const n=this._decorations[t],s=this._editor.getModel().getDecorationRange(n);if(!(!s||s.startLineNumber<e.lineNumber)){if(s.startLineNumber>e.lineNumber)return s;if(!(s.startColumn<e.column))return s}}return this._editor.getModel().getDecorationRange(this._decorations[0])}_allDecorations(){let e=[];return e=e.concat(this._decorations),e=e.concat(this._overviewRulerApproximateDecorations),this._findScopeDecorationIds.length&&e.push(...this._findScopeDecorationIds),this._rangeHighlightDecorationId&&e.push(this._rangeHighlightDecorationId),e}}Gn._CURRENT_FIND_MATCH_DECORATION=Ze.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",showIfCollapsed:!0,overviewRuler:{color:fi(W2),position:Ko.Center},minimap:{color:fi(ef),position:Hs.Inline}});Gn._FIND_MATCH_DECORATION=Ze.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",showIfCollapsed:!0,overviewRuler:{color:fi(W2),position:Ko.Center},minimap:{color:fi(ef),position:Hs.Inline}});Gn._FIND_MATCH_NO_OVERVIEW_DECORATION=Ze.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0});Gn._FIND_MATCH_ONLY_OVERVIEW_DECORATION=Ze.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:fi(W2),position:Ko.Center}});Gn._RANGE_HIGHLIGHT_DECORATION=Ze.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0});Gn._FIND_SCOPE_DECORATION=Ze.register({description:"find-scope",className:"findScope",isWholeLine:!0});class uge{constructor(e,t,i){this._editorSelection=e,this._ranges=t,this._replaceStrings=i,this._trackedEditorSelectionId=null}getEditOperations(e,t){if(this._ranges.length>0){const i=[];for(let r=0;r<this._ranges.length;r++)i.push({range:this._ranges[r],text:this._replaceStrings[r]});i.sort((r,a)=>k.compareRangesUsingStarts(r.range,a.range));const n=[];let s=i[0];for(let r=1;r<i.length;r++)s.range.endLineNumber===i[r].range.startLineNumber&&s.range.endColumn===i[r].range.startColumn?(s.range=s.range.plusRange(i[r].range),s.text=s.text+i[r].text):(n.push(s),s=i[r]);n.push(s);for(const r of n)t.addEditOperation(r.range,r.text)}this._trackedEditorSelectionId=t.trackSelection(this._editorSelection)}computeCursorState(e,t){return t.getTrackedSelection(this._trackedEditorSelectionId)}}function RW(o,e){if(o&&o[0]!==""){const t=_5(o,e,"-"),i=_5(o,e,"_");return t&&!i?v5(o,e,"-"):!t&&i?v5(o,e,"_"):o[0].toUpperCase()===o[0]?e.toUpperCase():o[0].toLowerCase()===o[0]?e.toLowerCase():cU(o[0][0])&&e.length>0?e[0].toUpperCase()+e.substr(1):o[0][0].toUpperCase()!==o[0][0]&&e.length>0?e[0].toLowerCase()+e.substr(1):e}else return e}function _5(o,e,t){return o[0].indexOf(t)!==-1&&e.indexOf(t)!==-1&&o[0].split(t).length===e.split(t).length}function v5(o,e,t){const i=e.split(t),n=o[0].split(t);let s="";return i.forEach((r,a)=>{s+=RW([n[a]],r)+t}),s.slice(0,-1)}class b5{constructor(e){this.staticValue=e,this.kind=0}}class gge{constructor(e){this.pieces=e,this.kind=1}}class xp{static fromStaticValue(e){return new xp([pu.staticValue(e)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(e){!e||e.length===0?this._state=new b5(""):e.length===1&&e[0].staticValue!==null?this._state=new b5(e[0].staticValue):this._state=new gge(e)}buildReplaceString(e,t){if(this._state.kind===0)return t?RW(e,this._state.staticValue):this._state.staticValue;let i="";for(let n=0,s=this._state.pieces.length;n<s;n++){const r=this._state.pieces[n];if(r.staticValue!==null){i+=r.staticValue;continue}let a=xp._substitute(r.matchIndex,e);if(r.caseOps!==null&&r.caseOps.length>0){const l=[],d=r.caseOps.length;let c=0;for(let h=0,u=a.length;h<u;h++){if(c>=d){l.push(a.slice(h));break}switch(r.caseOps[c]){case"U":l.push(a[h].toUpperCase());break;case"u":l.push(a[h].toUpperCase()),c++;break;case"L":l.push(a[h].toLowerCase());break;case"l":l.push(a[h].toLowerCase()),c++;break;default:l.push(a[h])}}a=l.join("")}i+=a}return i}static _substitute(e,t){if(t===null)return"";if(e===0)return t[0];let i="";for(;e>0;){if(e<t.length)return(t[e]||"")+i;i=String(e%10)+i,e=Math.floor(e/10)}return"$"+i}}class pu{static staticValue(e){return new pu(e,-1,null)}static caseOps(e,t){return new pu(null,e,t)}constructor(e,t,i){this.staticValue=e,this.matchIndex=t,!i||i.length===0?this.caseOps=null:this.caseOps=i.slice(0)}}class fge{constructor(e){this._source=e,this._lastCharIndex=0,this._result=[],this._resultLen=0,this._currentStaticPiece=""}emitUnchanged(e){this._emitStatic(this._source.substring(this._lastCharIndex,e)),this._lastCharIndex=e}emitStatic(e,t){this._emitStatic(e),this._lastCharIndex=t}_emitStatic(e){e.length!==0&&(this._currentStaticPiece+=e)}emitMatchIndex(e,t,i){this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=pu.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=pu.caseOps(e,i),this._lastCharIndex=t}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=pu.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new xp(this._result)}}function pge(o){if(!o||o.length===0)return new xp(null);const e=[],t=new fge(o);for(let i=0,n=o.length;i<n;i++){const s=o.charCodeAt(i);if(s===92){if(i++,i>=n)break;const r=o.charCodeAt(i);switch(r){case 92:t.emitUnchanged(i-1),t.emitStatic("\\",i+1);break;case 110:t.emitUnchanged(i-1),t.emitStatic(`
|
|
@@ -698,7 +698,7 @@ The flag will not be saved for the future.
|
|
|
698
698
|
`,a+=`distance: ${e.distance} (localityBonus-setting)
|
|
699
699
|
`,a+=`index: ${e.idx}, based on ${e.completion.sortText&&`sortText: "${e.completion.sortText}"`||"label"}
|
|
700
700
|
`,a+=`commit_chars: ${(n=e.completion.commitCharacters)===null||n===void 0?void 0:n.join("")}
|
|
701
|
-
`,r=new Fn().appendCodeblock("empty",a),s=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!KR(e)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),s){const a=s.length>1e5?`${s.substr(0,1e5)}…`:s;this._type.textContent=a,this._type.title=a,Os(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(a))}else bn(this._type),this._type.title="",is(this._type),this.domNode.classList.add("no-type");if(bn(this._docs),typeof r=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=r;else if(r){this._docs.classList.add("markdown-docs"),bn(this._docs);const a=this._markdownRenderer.render(r);this._docs.appendChild(a.element),this._renderDisposeable.add(a),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=a=>{a.preventDefault(),a.stopPropagation()},this._close.onclick=a=>{a.preventDefault(),a.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 size(){return this._size}layout(e,t){const i=new bt(e,t);bt.equals(i,this._size)||(this._size=i,W$(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}};tT=zpe([Upe(1,Oe)],tT);class $pe{constructor(e,t){this.widget=e,this._editor=t,this._disposables=new se,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new yR,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(e.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let i,n,s=0,r=0;this._disposables.add(this._resizable.onDidWillResize(()=>{i=this._topLeft,n=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(a=>{if(i&&n){this.widget.layout(a.dimension.width,a.dimension.height);let l=!1;a.west&&(r=n.width-a.dimension.width,l=!0),a.north&&(s=n.height-a.dimension.height,l=!0),l&&this._applyTopLeft({top:i.top+s,left:i.left+r})}a.done&&(i=void 0,n=void 0,s=0,r=0,this._userSize=a.dimension)})),this._disposables.add(this.widget.onDidChangeContents(()=>{var a;this._anchorBox&&this._placeAtAnchor(this._anchorBox,(a=this._userSize)!==null&&a!==void 0?a: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 null}show(){this._added||(this._editor.addOverlayWidget(this),this.getDomNode().style.position="fixed",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 s=Lu(this.getDomNode().ownerDocument.body),r=this.widget.getLayoutInfo(),a=new bt(220,2*r.lineHeight),l=e.top,d=function(){const C=s.width-(e.left+e.width+r.borderWidth+r.horizontalPadding),w=-r.borderWidth+e.left+e.width,y=new bt(C,s.height-e.top-r.borderHeight-r.verticalPadding),I=y.with(void 0,e.top+e.height-r.borderHeight-r.verticalPadding);return{top:l,left:w,fit:C-t.width,maxSizeTop:y,maxSizeBottom:I,minSize:a.with(Math.min(C,a.width))}}(),c=function(){const C=e.left-r.borderWidth-r.horizontalPadding,w=Math.max(r.horizontalPadding,e.left-t.width-r.borderWidth),y=new bt(C,s.height-e.top-r.borderHeight-r.verticalPadding),I=y.with(void 0,e.top+e.height-r.borderHeight-r.verticalPadding);return{top:l,left:w,fit:C-t.width,maxSizeTop:y,maxSizeBottom:I,minSize:a.with(Math.min(C,a.width))}}(),h=function(){const C=e.left,w=-r.borderWidth+e.top+e.height,y=new bt(e.width-r.borderHeight,s.height-e.top-e.height-r.verticalPadding);return{top:w,left:C,fit:y.height-t.height,maxSizeBottom:y,maxSizeTop:y,minSize:a.with(y.width)}}(),u=[d,c,h],g=(n=u.find(C=>C.fit>=0))!==null&&n!==void 0?n:u.sort((C,w)=>w.fit-C.fit)[0],f=e.top+e.height-r.borderHeight;let m,_=t.height;const v=Math.max(g.maxSizeTop.height,g.maxSizeBottom.height);_>v&&(_=v);let b;i?_<=g.maxSizeTop.height?(m=!0,b=g.maxSizeTop):(m=!1,b=g.maxSizeBottom):_<=g.maxSizeBottom.height?(m=!1,b=g.maxSizeBottom):(m=!0,b=g.maxSizeTop),this._applyTopLeft({left:g.left,top:m?g.top:f-_}),this.getDomNode().style.position="fixed",this._resizable.enableSashes(!m,g===d,m,g!==d),this._resizable.minSize=g.minSize,this._resizable.maxSize=b,this._resizable.layout(_,Math.min(b.width,t.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(e){this._topLeft=e,this.getDomNode().style.left=`${this._topLeft.left}px`,this.getDomNode().style.top=`${this._topLeft.top}px`}}var Xa;(function(o){o[o.FILE=0]="FILE",o[o.FOLDER=1]="FOLDER",o[o.ROOT_FOLDER=2]="ROOT_FOLDER"})(Xa||(Xa={}));const Kpe=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function uC(o,e,t,i){const n=i===Xa.ROOT_FOLDER?["rootfolder-icon"]:i===Xa.FOLDER?["folder-icon"]:["file-icon"];if(t){let s;if(t.scheme===Ye.data)s=Wc.parseMetaData(t).get(Wc.META_DATA_LABEL);else{const r=t.path.match(Kpe);r?(s=gC(r[2].toLowerCase()),r[1]&&n.push(`${gC(r[1].toLowerCase())}-name-dir-icon`)):s=gC(t.authority.toLowerCase())}if(i===Xa.ROOT_FOLDER)n.push(`${s}-root-name-folder-icon`);else if(i===Xa.FOLDER)n.push(`${s}-name-folder-icon`);else{if(s){if(n.push(`${s}-name-file-icon`),n.push("name-file-icon"),s.length<=255){const a=s.split(".");for(let l=1;l<a.length;l++)n.push(`${a.slice(l).join(".")}-ext-file-icon`)}n.push("ext-file-icon")}const r=jpe(o,e,t);r&&n.push(`${gC(r)}-lang-file-icon`)}}return n}function jpe(o,e,t){if(!t)return null;let i=null;if(t.scheme===Ye.data){const s=Wc.parseMetaData(t).get(Wc.META_DATA_MIME);s&&(i=e.getLanguageIdByMimeType(s))}else{const n=o.getModel(t);n&&(i=n.getLanguageId())}return i&&i!==So?i:e.guessLanguageIdByFilepathOrFirstLine(t)}function gC(o){return o.replace(/[\11\12\14\15\40]/g,"/")}var qpe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},CD=function(o,e){return function(t,i){e(t,i,o)}},Nd;function eV(o){return`suggest-aria-id:${o}`}const Gpe=Di("suggest-more-info",he.chevronRight,p("suggestMoreInfoIcon","Icon for more information in the suggest widget.")),Zpe=new(Nd=class{extract(e,t){if(e.textLabel.match(Nd._regexStrict))return t[0]=e.textLabel,!0;if(e.completion.detail&&e.completion.detail.match(Nd._regexStrict))return t[0]=e.completion.detail,!0;if(typeof e.completion.documentation=="string"){const i=Nd._regexRelaxed.exec(e.completion.documentation);if(i&&(i.index===0||i.index+i[0].length===e.completion.documentation.length))return t[0]=i[0],!0}return!1}},Nd._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/,Nd._regexStrict=new RegExp(`^${Nd._regexRelaxed.source}$`,"i"),Nd);let iT=class{constructor(e,t,i,n){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=n,this._onDidToggleDetails=new W,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=new se,i=e;i.classList.add("show-file-icons");const n=ie(e,pe(".icon")),s=ie(n,pe("span.colorspan")),r=ie(e,pe(".contents")),a=ie(r,pe(".main")),l=ie(a,pe(".icon-label.codicon")),d=ie(a,pe("span.left")),c=ie(a,pe("span.right")),h=new Lw(d,{supportHighlights:!0,supportIcons:!0});t.add(h);const u=ie(d,pe("span.signature-label")),g=ie(d,pe("span.qualifier-label")),f=ie(c,pe("span.details-label")),m=ie(c,pe("span.readMore"+Re.asCSSSelector(Gpe)));m.title=p("readMore","Read More");const _=()=>{const v=this._editor.getOptions(),b=v.get(50),C=b.getMassagedFontFamily(),w=b.fontFeatureSettings,y=v.get(118)||b.fontSize,I=v.get(119)||b.lineHeight,D=b.fontWeight,T=b.letterSpacing,P=`${y}px`,H=`${I}px`,Y=`${T}px`;i.style.fontSize=P,i.style.fontWeight=D,i.style.letterSpacing=Y,a.style.fontFamily=C,a.style.fontFeatureSettings=w,a.style.lineHeight=H,n.style.height=H,n.style.width=H,m.style.height=H,m.style.width=H};return _(),t.add(this._editor.onDidChangeConfiguration(v=>{(v.hasChanged(50)||v.hasChanged(118)||v.hasChanged(119))&&_()})),{root:i,left:d,right:c,icon:n,colorspan:s,iconLabel:h,iconContainer:l,parametersLabel:u,qualifierLabel:g,detailsLabel:f,readMore:m,disposables:t}}renderElement(e,t,i){const{completion:n}=e;i.root.id=eV(t),i.colorspan.style.backgroundColor="";const s={labelEscapeNewLines:!0,matches:ry(e.score)},r=[];if(n.kind===19&&Zpe.extract(e,r))i.icon.className="icon customcolor",i.iconContainer.className="icon hide",i.colorspan.style.backgroundColor=r[0];else if(n.kind===20&&this._themeService.getFileIconTheme().hasFileIcons){i.icon.className="icon hide",i.iconContainer.className="icon hide";const a=uC(this._modelService,this._languageService,Me.from({scheme:"fake",path:e.textLabel}),Xa.FILE),l=uC(this._modelService,this._languageService,Me.from({scheme:"fake",path:n.detail}),Xa.FILE);s.extraClasses=a.length>l.length?a:l}else n.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons?(i.icon.className="icon hide",i.iconContainer.className="icon hide",s.extraClasses=[uC(this._modelService,this._languageService,Me.from({scheme:"fake",path:e.textLabel}),Xa.FOLDER),uC(this._modelService,this._languageService,Me.from({scheme:"fake",path:n.detail}),Xa.FOLDER)].flat()):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...Re.asClassNameArray(B_.toIcon(n.kind))));n.tags&&n.tags.indexOf(1)>=0&&(s.extraClasses=(s.extraClasses||[]).concat(["deprecated"]),s.matches=[]),i.iconLabel.setLabel(e.textLabel,void 0,s),typeof n.label=="string"?(i.parametersLabel.textContent="",i.detailsLabel.textContent=wD(n.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=wD(n.label.detail||""),i.detailsLabel.textContent=wD(n.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(117).showInlineDetails?Os(i.detailsLabel):is(i.detailsLabel),KR(e)?(i.right.classList.add("can-expand-details"),Os(i.readMore),i.readMore.onmousedown=a=>{a.stopPropagation(),a.preventDefault()},i.readMore.onclick=a=>{a.stopPropagation(),a.preventDefault(),this._onDidToggleDetails.fire()}):(i.right.classList.remove("can-expand-details"),is(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};iT=qpe([CD(1,ii),CD(2,ni),CD(3,tn)],iT);function wD(o){return o.replace(/\r\n|\r|\n/g,"")}var Ype=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},fC=function(o,e){return function(t,i){e(t,i,o)}},Vg;R("editorSuggestWidget.background",{dark:mi,light:mi,hcDark:mi,hcLight:mi},p("editorSuggestWidgetBackground","Background color of the suggest widget."));R("editorSuggestWidget.border",{dark:qa,light:qa,hcDark:qa,hcLight:qa},p("editorSuggestWidgetBorder","Border color of the suggest widget."));const pC=R("editorSuggestWidget.foreground",{dark:cr,light:cr,hcDark:cr,hcLight:cr},p("editorSuggestWidgetForeground","Foreground color of the suggest widget."));R("editorSuggestWidget.selectedForeground",{dark:Jh,light:Jh,hcDark:Jh,hcLight:Jh},p("editorSuggestWidgetSelectedForeground","Foreground color of the selected entry in the suggest widget."));R("editorSuggestWidget.selectedIconForeground",{dark:Yg,light:Yg,hcDark:Yg,hcLight:Yg},p("editorSuggestWidgetSelectedIconForeground","Icon foreground color of the selected entry in the suggest widget."));const Xpe=R("editorSuggestWidget.selectedBackground",{dark:eu,light:eu,hcDark:eu,hcLight:eu},p("editorSuggestWidgetSelectedBackground","Background color of the selected entry in the suggest widget."));R("editorSuggestWidget.highlightForeground",{dark:hr,light:hr,hcDark:hr,hcLight:hr},p("editorSuggestWidgetHighlightForeground","Color of the match highlights in the suggest widget."));R("editorSuggestWidget.focusHighlightForeground",{dark:hb,light:hb,hcDark:hb,hcLight:hb},p("editorSuggestWidgetFocusHighlightForeground","Color of the match highlights in the suggest widget when an item is focused."));R("editorSuggestWidgetStatus.foreground",{dark:Ee(pC,.5),light:Ee(pC,.5),hcDark:Ee(pC,.5),hcLight:Ee(pC,.5)},p("editorSuggestWidgetStatusForeground","Foreground color of the suggest widget status."));class Qpe{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof Gc}`}restore(){var e;const t=(e=this._service.get(this._key,0))!==null&&e!==void 0?e:"";try{const i=JSON.parse(t);if(bt.is(i))return bt.lift(i)}catch{}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}}let X0=Vg=class{constructor(e,t,i,n,s){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._pendingLayout=new Cn,this._pendingShowDetails=new Cn,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new Cr,this._disposables=new se,this._onDidSelect=new vu,this._onDidFocus=new vu,this._onDidHide=new W,this._onDidShow=new W,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new W,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new yR,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new Jpe(this,e),this._persistedSize=new Qpe(t,e);class r{constructor(g,f,m=!1,_=!1){this.persistedSize=g,this.currentSize=f,this.persistHeight=m,this.persistWidth=_}}let a;this._disposables.add(this.element.onDidWillResize(()=>{this._contentWidget.lockPreference(),a=new r(this._persistedSize.restore(),this.element.size)})),this._disposables.add(this.element.onDidResize(u=>{var g,f,m,_;if(this._resize(u.dimension.width,u.dimension.height),a&&(a.persistHeight=a.persistHeight||!!u.north||!!u.south,a.persistWidth=a.persistWidth||!!u.east||!!u.west),!!u.done){if(a){const{itemHeight:v,defaultSize:b}=this.getLayoutInfo(),C=Math.round(v/2);let{width:w,height:y}=this.element.size;(!a.persistHeight||Math.abs(a.currentSize.height-y)<=C)&&(y=(f=(g=a.persistedSize)===null||g===void 0?void 0:g.height)!==null&&f!==void 0?f:b.height),(!a.persistWidth||Math.abs(a.currentSize.width-w)<=C)&&(w=(_=(m=a.persistedSize)===null||m===void 0?void 0:m.width)!==null&&_!==void 0?_:b.width),this._persistedSize.store(new bt(w,y))}this._contentWidget.unlockPreference(),a=void 0}})),this._messageElement=ie(this.element.domNode,pe(".message")),this._listElement=ie(this.element.domNode,pe(".tree"));const l=this._disposables.add(s.createInstance(tT,this.editor));l.onDidClose(this.toggleDetails,this,this._disposables),this._details=new $pe(l,this.editor);const d=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(117).showIcons);d();const c=s.createInstance(iT,this.editor);this._disposables.add(c),this._disposables.add(c.onDidToggleDetails(()=>this.toggleDetails())),this._list=new yr("SuggestWidget",this._listElement,{getHeight:u=>this.getLayoutInfo().itemHeight,getTemplateId:u=>"suggestion"},[c],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>p("suggest","Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:u=>{let g=u.textLabel;if(typeof u.completion.label!="string"){const{detail:v,description:b}=u.completion.label;v&&b?g=p("label.full","{0} {1}, {2}",g,v,b):v?g=p("label.detail","{0} {1}",g,v):b&&(g=p("label.desc","{0}, {1}",g,b))}if(!u.isResolved||!this._isDetailsVisible())return g;const{documentation:f,detail:m}=u.completion,_=jf("{0}{1}",m||"",f?typeof f=="string"?f:f.value:"");return p("ariaCurrenttSuggestionReadDetails","{0}, docs: {1}",g,_)}}}),this._list.style(zp({listInactiveFocusBackground:Xpe,listInactiveFocusOutline:Zt})),this._status=s.createInstance(eT,this.element.domNode,xc);const h=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(117).showStatusBar);h(),this._disposables.add(n.onDidColorThemeChange(u=>this._onThemeChange(u))),this._onThemeChange(n.getColorTheme()),this._disposables.add(this._list.onMouseDown(u=>this._onListMouseDownOrTap(u))),this._disposables.add(this._list.onTap(u=>this._onListMouseDownOrTap(u))),this._disposables.add(this._list.onDidChangeSelection(u=>this._onListSelection(u))),this._disposables.add(this._list.onDidChangeFocus(u=>this._onListFocus(u))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(u=>{u.hasChanged(117)&&(h(),d())})),this._ctxSuggestWidgetVisible=Qe.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=Qe.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=Qe.MultipleSuggestions.bindTo(i),this._ctxSuggestWidgetHasFocusedSuggestion=Qe.HasFocusedSuggestion.bindTo(i),this._disposables.add(vi(this._details.widget.domNode,"keydown",u=>{this._onDetailsKeydown.fire(u)})),this._disposables.add(this.editor.onMouseDown(u=>this._onEditorMouseDown(u)))}dispose(){var e;this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),(e=this._loadingTimeout)===null||e===void 0||e.dispose(),this._pendingLayout.dispose(),this._pendingShowDetails.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose()}_onEditorMouseDown(e){this._details.widget.domNode.contains(e.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(e.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){this._state!==0&&this._contentWidget.layout()}_onListMouseDownOrTap(e){typeof e.element>"u"||typeof e.index>"u"||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation(),this._select(e.element,e.index))}_onListSelection(e){e.elements.length&&this._select(e.elements[0],e.indexes[0])}_select(e,t){const i=this._completionModel;i&&(this._onDidSelect.fire({item:e,index:t,model:i}),this.editor.focus())}_onThemeChange(e){this._details.widget.borderWidth=il(e.type)?2:1}_onListFocus(e){var t;if(this._ignoreFocusEvents)return;if(!e.elements.length){this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0),this.editor.setAriaOptions({activeDescendant:void 0}),this._ctxSuggestWidgetHasFocusedSuggestion.set(!1);return}if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);const i=e.elements[0],n=e.indexes[0];i!==this._focusedItem&&((t=this._currentSuggestionDetails)===null||t===void 0||t.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=i,this._list.reveal(n),this._currentSuggestionDetails=Zi(async s=>{const r=Rc(()=>{this._isDetailsVisible()&&this.showDetails(!0)},250),a=s.onCancellationRequested(()=>r.dispose());try{return await i.resolve(s)}finally{r.dispose(),a.dispose()}}),this._currentSuggestionDetails.then(()=>{n>=this._list.length||i!==this._list.element(n)||(this._ignoreFocusEvents=!0,this._list.splice(n,1,[i]),this._list.setFocus([n]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this.showDetails(!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:eV(n)}))}).catch(Ge)),this._onDidFocus.fire({item:i,index:n,model:this._completionModel})}_setState(e){if(this._state!==e)switch(this._state=e,this.element.domNode.classList.toggle("frozen",e===4),this.element.domNode.classList.remove("message"),e){case 0:is(this._messageElement,this._listElement,this._status.element),this._details.hide(!0),this._status.hide(),this._contentWidget.hide(),this._ctxSuggestWidgetVisible.reset(),this._ctxSuggestWidgetMultipleSuggestions.reset(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=Vg.LOADING_MESSAGE,is(this._listElement,this._status.element),Os(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Du(Vg.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=Vg.NO_SUGGESTIONS_MESSAGE,is(this._listElement,this._status.element),Os(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Du(Vg.NO_SUGGESTIONS_MESSAGE);break;case 3:is(this._messageElement),Os(this._listElement,this._status.element),this._show();break;case 4:is(this._messageElement),Os(this._listElement,this._status.element),this._show();break;case 5:is(this._messageElement),Os(this._listElement,this._status.element),this._details.show(),this._show();break}}_show(){this._status.show(),this._contentWidget.show(),this._layout(this._persistedSize.restore()),this._ctxSuggestWidgetVisible.set(!0),this._showTimeout.cancelAndSet(()=>{this.element.domNode.classList.add("visible"),this._onDidShow.fire(this)},100)}showTriggered(e,t){this._state===0&&(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!e,this._isAuto||(this._loadingTimeout=Rc(()=>this._setState(1),t)))}showSuggestions(e,t,i,n,s){var r,a;if(this._contentWidget.setPosition(this.editor.getPosition()),(r=this._loadingTimeout)===null||r===void 0||r.dispose(),(a=this._currentSuggestionDetails)===null||a===void 0||a.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==e&&(this._completionModel=e),i&&this._state!==2&&this._state!==0){this._setState(4);return}const l=this._completionModel.items.length,d=l===0;if(this._ctxSuggestWidgetMultipleSuggestions.set(l>1),d){this._setState(n?0:2),this._completionModel=void 0;return}this._focusedItem=void 0,this._onDidFocus.pause(),this._onDidSelect.pause();try{this._list.splice(0,this._list.length,this._completionModel.items),this._setState(i?4:3),this._list.reveal(t,0),this._list.setFocus(s?[]:[t])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=C1(Ue(this.element.domNode),()=>{this._pendingLayout.clear(),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")})}focusSelected(){this._list.length>0&&this._list.setFocus([0])}selectNextPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageDown(),!0;case 1:return!this._isAuto;default:return this._list.focusNextPage(),!0}}selectNext(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusNext(1,!0),!0}}selectLast(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollBottom(),!0;case 1:return!this._isAuto;default:return this._list.focusLast(),!0}}selectPreviousPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageUp(),!0;case 1:return!this._isAuto;default:return this._list.focusPreviousPage(),!0}}selectPrevious(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusPrevious(1,!0),!1}}selectFirst(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollTop(),!0;case 1:return!this._isAuto;default:return this._list.focusFirst(),!0}}getFocusedItem(){if(this._state!==0&&this._state!==2&&this._state!==1&&this._completionModel&&this._list.getFocus().length>0)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}toggleDetailsFocus(){this._state===5?(this._setState(3),this._details.widget.domNode.classList.remove("focused")):this._state===3&&this._isDetailsVisible()&&(this._setState(5),this._details.widget.domNode.classList.add("focused"))}toggleDetails(){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):(KR(this._list.getFocusedElements()[0])||this._explainMode)&&(this._state===3||this._state===5||this._state===4)&&(this._ctxSuggestWidgetDetailsVisible.set(!0),this._setDetailsVisible(!0),this.showDetails(!1))}showDetails(e){this._pendingShowDetails.value=C1(Ue(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show(),e?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._positionDetails(),this.editor.focus(),this.element.domNode.classList.add("shows-details")})}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this.showDetails(!1):this.toggleDetails())}resetPersistedSize(){this._persistedSize.reset()}hideWidget(){var e;this._pendingLayout.clear(),this._pendingShowDetails.clear(),(e=this._loadingTimeout)===null||e===void 0||e.dispose(),this._setState(0),this._onDidHide.fire(this),this.element.clearSashHoverState();const t=this._persistedSize.restore(),i=Math.ceil(this.getLayoutInfo().itemHeight*4.3);t&&t.height<i&&this._persistedSize.store(t.with(void 0,i))}isFrozen(){return this._state===4}_afterRender(e){if(e===null){this._isDetailsVisible()&&this._details.hide();return}this._state===2||this._state===1||(this._isDetailsVisible()&&this._details.show(),this._positionDetails())}_layout(e){var t,i,n;if(!this.editor.hasModel()||!this.editor.getDomNode())return;const s=Lu(this.element.domNode.ownerDocument.body),r=this.getLayoutInfo();e||(e=r.defaultSize);let a=e.height,l=e.width;if(this._status.element.style.height=`${r.itemHeight}px`,this._state===2||this._state===1)a=r.itemHeight+r.borderHeight,l=r.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new bt(l,a),this._contentWidget.setPreference(2);else{const d=s.width-r.borderHeight-2*r.horizontalPadding;l>d&&(l=d);const c=this._completionModel?this._completionModel.stats.pLabelLen*r.typicalHalfwidthCharacterWidth:l,h=r.statusBarHeight+this._list.contentHeight+r.borderHeight,u=r.itemHeight+r.statusBarHeight,g=ji(this.editor.getDomNode()),f=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),m=g.top+f.top+f.height,_=Math.min(s.height-m-r.verticalPadding,h),v=g.top+f.top-r.verticalPadding,b=Math.min(v,h);let C=Math.min(Math.max(b,_)+r.borderHeight,h);a===((t=this._cappedHeight)===null||t===void 0?void 0:t.capped)&&(a=this._cappedHeight.wanted),a<u&&(a=u),a>C&&(a=C),a>_||this._forceRenderingAbove&&v>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),C=b):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),C=_),this.element.preferredSize=new bt(c,r.defaultSize.height),this.element.maxSize=new bt(d,C),this.element.minSize=new bt(220,u),this._cappedHeight=a===h?{wanted:(n=(i=this._cappedHeight)===null||i===void 0?void 0:i.wanted)!==null&&n!==void 0?n:e.height,capped:a}:void 0}this._resize(l,a)}_resize(e,t){const{width:i,height:n}=this.element.maxSize;e=Math.min(i,e),t=Math.min(n,t);const{statusBarHeight:s}=this.getLayoutInfo();this._list.layout(t-s,e),this._listElement.style.height=`${t-s}px`,this.element.layout(t,e),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){var e;this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,((e=this._contentWidget.getPosition())===null||e===void 0?void 0:e.preference[0])===2)}getLayoutInfo(){const e=this.editor.getOption(50),t=Ms(this.editor.getOption(119)||e.lineHeight,8,1e3),i=!this.editor.getOption(117).showStatusBar||this._state===2||this._state===1?0:t,n=this._details.widget.borderWidth,s=2*n;return{itemHeight:t,statusBarHeight:i,borderWidth:n,borderHeight:s,typicalHalfwidthCharacterWidth:e.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new bt(430,i+12*t+s)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(e){this._storageService.store("expandSuggestionDocs",e,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}};X0.LOADING_MESSAGE=p("suggestWidget.loading","Loading...");X0.NO_SUGGESTIONS_MESSAGE=p("suggestWidget.noSuggestions","No suggestions.");X0=Vg=Ype([fC(1,da),fC(2,We),fC(3,tn),fC(4,Oe)],X0);class Jpe{constructor(e,t){this._widget=e,this._editor=t,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._preferenceLocked=!1,this._added=!1,this._hidden=!1}dispose(){this._added&&(this._added=!1,this._editor.removeContentWidget(this))}getId(){return"editor.widget.suggestWidget"}getDomNode(){return this._widget.element.domNode}show(){this._hidden=!1,this._added||(this._added=!0,this._editor.addContentWidget(this))}hide(){this._hidden||(this._hidden=!0,this.layout())}layout(){this._editor.layoutContentWidget(this)}getPosition(){return this._hidden||!this._position||!this._preference?null:{position:this._position,preference:[this._preference]}}beforeRender(){const{height:e,width:t}=this._widget.element.size,{borderWidth:i,horizontalPadding:n}=this._widget.getLayoutInfo();return new bt(t+2*i+n,e+2*i)}afterRender(e){this._widget._afterRender(e)}setPreference(e){this._preferenceLocked||(this._preference=e)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(e){this._position=e}}var eme=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Mg=function(o,e){return function(t,i){e(t,i,o)}},nT;class tme{constructor(e,t){if(this._model=e,this._position=t,e.getLineMaxColumn(t.lineNumber)!==t.column){const n=e.getOffsetAt(t),s=e.getPositionAt(n+1);this._marker=e.deltaDecorations([],[{range:k.fromPositions(t,s),options:{description:"suggest-line-suffix",stickiness:1}}])}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.deltaDecorations(this._marker,[])}delta(e){if(this._model.isDisposed()||this._position.lineNumber!==e.lineNumber)return 0;if(this._marker){const t=this._model.getDecorationRange(this._marker[0]);return this._model.getOffsetAt(t.getStartPosition())-this._model.getOffsetAt(e)}else return this._model.getLineMaxColumn(e.lineNumber)-e.column}}let gr=nT=class{static get(e){return e.getContribution(nT.ID)}constructor(e,t,i,n,s,r,a){this._memoryService=t,this._commandService=i,this._contextKeyService=n,this._instantiationService=s,this._logService=r,this._telemetryService=a,this._lineSuffix=new Cn,this._toDispose=new se,this._selectors=new ime(h=>h.priority),this._onWillInsertSuggestItem=new W,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=e,this.model=s.createInstance(JN,this.editor),this._selectors.register({priority:0,select:(h,u,g)=>this._memoryService.select(h,u,g)});const l=Qe.InsertMode.bindTo(n);l.set(e.getOption(117).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>l.set(e.getOption(117).insertMode))),this.widget=this._toDispose.add(new WL(Ue(e.getDomNode()),()=>{const h=this._instantiationService.createInstance(X0,this.editor);this._toDispose.add(h),this._toDispose.add(h.onDidSelect(_=>this._insertSuggestion(_,0),this));const u=new Fpe(this.editor,h,this.model,_=>this._insertSuggestion(_,2));this._toDispose.add(u);const g=Qe.MakesTextEdit.bindTo(this._contextKeyService),f=Qe.HasInsertAndReplaceRange.bindTo(this._contextKeyService),m=Qe.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(Ae(()=>{g.reset(),f.reset(),m.reset()})),this._toDispose.add(h.onDidFocus(({item:_})=>{const v=this.editor.getPosition(),b=_.editStart.column,C=v.column;let w=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!_.completion.additionalTextEdits&&!(_.completion.insertTextRules&4)&&C-b===_.completion.insertText.length&&(w=this.editor.getModel().getValueInRange({startLineNumber:v.lineNumber,startColumn:b,endLineNumber:v.lineNumber,endColumn:C})!==_.completion.insertText),g.set(w),f.set(!V.equals(_.editInsertEnd,_.editReplaceEnd)),m.set(!!_.provider.resolveCompletionItem||!!_.completion.documentation||_.completion.detail!==_.completion.label)})),this._toDispose.add(h.onDetailsKeyDown(_=>{if(_.toKeyCodeChord().equals(new gd(!0,!1,!1,!1,33))||ut&&_.toKeyCodeChord().equals(new gd(!1,!1,!1,!0,33))){_.stopPropagation();return}_.toKeyCodeChord().isModifierKey()||this.editor.focus()})),h})),this._overtypingCapturer=this._toDispose.add(new WL(Ue(e.getDomNode()),()=>this._toDispose.add(new Jy(this.editor,this.model)))),this._alternatives=this._toDispose.add(new WL(Ue(e.getDomNode()),()=>this._toDispose.add(new Ku(this.editor,this._contextKeyService)))),this._toDispose.add(s.createInstance(Y0,e)),this._toDispose.add(this.model.onDidTrigger(h=>{this.widget.value.showTriggered(h.auto,h.shy?250:50),this._lineSuffix.value=new tme(this.editor.getModel(),h.position)})),this._toDispose.add(this.model.onDidSuggest(h=>{if(h.triggerOptions.shy)return;let u=-1;for(const f of this._selectors.itemsOrderedByPriorityDesc)if(u=f.select(this.editor.getModel(),this.editor.getPosition(),h.completionModel.items),u!==-1)break;u===-1&&(u=0);let g=!1;if(h.triggerOptions.auto){const f=this.editor.getOption(117);f.selectionMode==="never"||f.selectionMode==="always"?g=f.selectionMode==="never":f.selectionMode==="whenTriggerCharacter"?g=h.triggerOptions.triggerKind!==1:f.selectionMode==="whenQuickSuggestion"&&(g=h.triggerOptions.triggerKind===1&&!h.triggerOptions.refilter)}this.widget.value.showSuggestions(h.completionModel,u,h.isFrozen,h.triggerOptions.auto,g)})),this._toDispose.add(this.model.onDidCancel(h=>{h.retrigger||this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{this.model.cancel(),this.model.clear()}));const d=Qe.AcceptSuggestionsOnEnter.bindTo(n),c=()=>{const h=this.editor.getOption(1);d.set(h==="on"||h==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>c())),c()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(e,t){if(!e||!e.item){this._alternatives.value.reset(),this.model.cancel(),this.model.clear();return}if(!this.editor.hasModel())return;const i=wn.get(this.editor);if(!i)return;this._onWillInsertSuggestItem.fire({item:e.item});const n=this.editor.getModel(),s=n.getAlternativeVersionId(),{item:r}=e,a=[],l=new Wi;t&1||this.editor.pushUndoStop();const d=this.getOverwriteInfo(r,!!(t&8));this._memoryService.memorize(n,this.editor.getPosition(),r);const c=r.isResolved;let h=-1,u=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const f=na.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(m=>oi.replaceMove(k.lift(m.range),m.text))),f.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!c){const f=new Hn;let m;const _=n.onDidChangeContent(w=>{if(w.isFlush){l.cancel(),_.dispose();return}for(const y of w.changes){const I=k.getEndPosition(y.range);(!m||V.isBefore(I,m))&&(m=I)}}),v=t;t|=2;let b=!1;const C=this.editor.onWillType(()=>{C.dispose(),b=!0,v&2||this.editor.pushUndoStop()});a.push(r.resolve(l.token).then(()=>{if(!r.completion.additionalTextEdits||l.token.isCancellationRequested)return;if(m&&r.completion.additionalTextEdits.some(y=>V.isBefore(m,k.getStartPosition(y.range))))return!1;b&&this.editor.pushUndoStop();const w=na.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(y=>oi.replaceMove(k.lift(y.range),y.text))),w.restoreRelativeVerticalPositionOfCursor(this.editor),(b||!(v&2))&&this.editor.pushUndoStop(),!0}).then(w=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",f.elapsed(),w),u=w===!0?1:w===!1?0:-2}).finally(()=>{_.dispose(),C.dispose()}))}let{insertText:g}=r.completion;if(r.completion.insertTextRules&4||(g=Dp.escape(g)),this.model.cancel(),i.insert(g,{overwriteBefore:d.overwriteBefore,overwriteAfter:d.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(r.completion.insertTextRules&1),clipboardText:e.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value}),t&2||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===Zv.id)this.model.trigger({auto:!0,retrigger:!0});else{const f=new Hn;a.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(m=>{r.completion.extensionId?Mi(m):Ge(m)}).finally(()=>{h=f.elapsed()}))}t&4&&this._alternatives.value.set(e,f=>{for(l.cancel();n.canUndo();){s!==n.getAlternativeVersionId()&&n.undo(),this._insertSuggestion(f,3|(t&8?8:0));break}}),this._alertCompletionItem(r),Promise.all(a).finally(()=>{this._reportSuggestionAcceptedTelemetry(r,n,c,h,u),this.model.clear(),l.dispose()})}_reportSuggestionAcceptedTelemetry(e,t,i,n,s){var r,a,l;Math.floor(Math.random()*100)!==0&&this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:(a=(r=e.extensionId)===null||r===void 0?void 0:r.value)!==null&&a!==void 0?a:"unknown",providerId:(l=e.provider._debugDisplayName)!==null&&l!==void 0?l:"unknown",kind:e.completion.kind,basenameHash:f2(qo(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:PQ(t.uri),resolveInfo:e.provider.resolveCompletionItem?i?1:0:-1,resolveDuration:e.resolveDuration,commandDuration:n,additionalEditsAsync:s})}getOverwriteInfo(e,t){Tt(this.editor.hasModel());let i=this.editor.getOption(117).insertMode==="replace";t&&(i=!i);const n=e.position.column-e.editStart.column,s=(i?e.editReplaceEnd.column:e.editInsertEnd.column)-e.position.column,r=this.editor.getPosition().column-e.position.column,a=this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0;return{overwriteBefore:n+r,overwriteAfter:s+a}}_alertCompletionItem(e){if(Bn(e.completion.additionalTextEdits)){const t=p("aria.alert.snippet","Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length);js(t)}}triggerSuggest(e,t,i){this.editor.hasModel()&&(this.model.trigger({auto:t??!1,completionOptions:{providerFilter:e,kindFilter:i?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(e){if(!this.editor.hasModel())return;const t=this.editor.getPosition(),i=()=>{t.equals(this.editor.getPosition())&&this._commandService.executeCommand(e.fallback)},n=s=>{if(s.completion.insertTextRules&4||s.completion.additionalTextEdits)return!0;const r=this.editor.getPosition(),a=s.editStart.column,l=r.column;return l-a!==s.completion.insertText.length?!0:this.editor.getModel().getValueInRange({startLineNumber:r.lineNumber,startColumn:a,endLineNumber:r.lineNumber,endColumn:l})!==s.completion.insertText};fe.once(this.model.onDidTrigger)(s=>{const r=[];fe.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{Et(r),i()},void 0,r),this.model.onDidSuggest(({completionModel:a})=>{if(Et(r),a.items.length===0){i();return}const l=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),a.items),d=a.items[l];if(!n(d)){i();return}this.editor.pushUndoStop(),this._insertSuggestion({index:l,item:d,model:a},7)},void 0,r)}),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(t,0),this.editor.focus()}acceptSelectedSuggestion(e,t){const i=this.widget.value.getFocusedItem();let n=0;e&&(n|=4),t&&(n|=8),this._insertSuggestion(i,n)}acceptNextSuggestion(){this._alternatives.value.next()}acceptPrevSuggestion(){this._alternatives.value.prev()}cancelSuggestWidget(){this.model.cancel(),this.model.clear(),this.widget.value.hideWidget()}focusSuggestion(){this.widget.value.focusSelected()}selectNextSuggestion(){this.widget.value.selectNext()}selectNextPageSuggestion(){this.widget.value.selectNextPage()}selectLastSuggestion(){this.widget.value.selectLast()}selectPrevSuggestion(){this.widget.value.selectPrevious()}selectPrevPageSuggestion(){this.widget.value.selectPreviousPage()}selectFirstSuggestion(){this.widget.value.selectFirst()}toggleSuggestionDetails(){this.widget.value.toggleDetails()}toggleExplainMode(){this.widget.value.toggleExplainMode()}toggleSuggestionFocus(){this.widget.value.toggleDetailsFocus()}resetWidgetSize(){this.widget.value.resetPersistedSize()}forceRenderingAbove(){this.widget.value.forceRenderingAbove()}stopForceRenderingAbove(){this.widget.isInitialized&&this.widget.value.stopForceRenderingAbove()}registerSelector(e){return this._selectors.register(e)}};gr.ID="editor.contrib.suggestController";gr=nT=eme([Mg(1,Qy),Mg(2,ui),Mg(3,We),Mg(4,Oe),Mg(5,Zs),Mg(6,Gs)],gr);class ime{constructor(e){this.prioritySelector=e,this._items=new Array}register(e){if(this._items.indexOf(e)!==-1)throw new Error("Value is already registered");return this._items.push(e),this._items.sort((t,i)=>this.prioritySelector(i)-this.prioritySelector(t)),{dispose:()=>{const t=this._items.indexOf(e);t>=0&&this._items.splice(t,1)}}}get itemsOrderedByPriorityDesc(){return this._items}}class Zv extends we{constructor(){super({id:Zv.id,label:p("suggest.trigger.label","Trigger Suggest"),alias:"Trigger Suggest",precondition:te.and(M.writable,M.hasCompletionItemProvider,Qe.Visible.toNegated()),kbOpts:{kbExpr:M.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const n=gr.get(t);if(!n)return;let s;i&&typeof i=="object"&&i.auto===!0&&(s=!0),n.triggerSuggest(void 0,s,void 0)}}Zv.id="editor.action.triggerSuggest";yt(gr.ID,gr,2);de(Zv);const xo=190,ps=cn.bindToContribution(gr.get);ue(new ps({id:"acceptSelectedSuggestion",precondition:te.and(Qe.Visible,Qe.HasFocusedSuggestion),handler(o){o.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:te.and(Qe.Visible,M.textInputFocus),weight:xo},{primary:3,kbExpr:te.and(Qe.Visible,M.textInputFocus,Qe.AcceptSuggestionsOnEnter,Qe.MakesTextEdit),weight:xo}],menuOpts:[{menuId:xc,title:p("accept.insert","Insert"),group:"left",order:1,when:Qe.HasInsertAndReplaceRange.toNegated()},{menuId:xc,title:p("accept.insert","Insert"),group:"left",order:1,when:te.and(Qe.HasInsertAndReplaceRange,Qe.InsertMode.isEqualTo("insert"))},{menuId:xc,title:p("accept.replace","Replace"),group:"left",order:1,when:te.and(Qe.HasInsertAndReplaceRange,Qe.InsertMode.isEqualTo("replace"))}]}));ue(new ps({id:"acceptAlternativeSelectedSuggestion",precondition:te.and(Qe.Visible,M.textInputFocus,Qe.HasFocusedSuggestion),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:1027,secondary:[1026]},handler(o){o.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:xc,group:"left",order:2,when:te.and(Qe.HasInsertAndReplaceRange,Qe.InsertMode.isEqualTo("insert")),title:p("accept.replace","Replace")},{menuId:xc,group:"left",order:2,when:te.and(Qe.HasInsertAndReplaceRange,Qe.InsertMode.isEqualTo("replace")),title:p("accept.insert","Insert")}]}));gt.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");ue(new ps({id:"hideSuggestWidget",precondition:Qe.Visible,handler:o=>o.cancelSuggestWidget(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:9,secondary:[1033]}}));ue(new ps({id:"selectNextSuggestion",precondition:te.and(Qe.Visible,te.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:o=>o.selectNextSuggestion(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}}));ue(new ps({id:"selectNextPageSuggestion",precondition:te.and(Qe.Visible,te.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:o=>o.selectNextPageSuggestion(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:12,secondary:[2060]}}));ue(new ps({id:"selectLastSuggestion",precondition:te.and(Qe.Visible,te.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:o=>o.selectLastSuggestion()}));ue(new ps({id:"selectPrevSuggestion",precondition:te.and(Qe.Visible,te.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevSuggestion(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));ue(new ps({id:"selectPrevPageSuggestion",precondition:te.and(Qe.Visible,te.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevPageSuggestion(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:11,secondary:[2059]}}));ue(new ps({id:"selectFirstSuggestion",precondition:te.and(Qe.Visible,te.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:o=>o.selectFirstSuggestion()}));ue(new ps({id:"focusSuggestion",precondition:te.and(Qe.Visible,Qe.HasFocusedSuggestion.negate()),handler:o=>o.focusSuggestion(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));ue(new ps({id:"focusAndAcceptSuggestion",precondition:te.and(Qe.Visible,Qe.HasFocusedSuggestion.negate()),handler:o=>{o.focusSuggestion(),o.acceptSelectedSuggestion(!0,!1)}}));ue(new ps({id:"toggleSuggestionDetails",precondition:te.and(Qe.Visible,Qe.HasFocusedSuggestion),handler:o=>o.toggleSuggestionDetails(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:xc,group:"right",order:1,when:te.and(Qe.DetailsVisible,Qe.CanResolve),title:p("detail.more","show less")},{menuId:xc,group:"right",order:1,when:te.and(Qe.DetailsVisible.toNegated(),Qe.CanResolve),title:p("detail.less","show more")}]}));ue(new ps({id:"toggleExplainMode",precondition:Qe.Visible,handler:o=>o.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));ue(new ps({id:"toggleSuggestionFocus",precondition:Qe.Visible,handler:o=>o.toggleSuggestionFocus(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:2570,mac:{primary:778}}}));ue(new ps({id:"insertBestCompletion",precondition:te.and(M.textInputFocus,te.equals("config.editor.tabCompletion","on"),Y0.AtEnd,Qe.Visible.toNegated(),Ku.OtherSuggestions.toNegated(),wn.InSnippetMode.toNegated()),handler:(o,e)=>{o.triggerSuggestAndAcceptBest(os(e)?{fallback:"tab",...e}:{fallback:"tab"})},kbOpts:{weight:xo,primary:2}}));ue(new ps({id:"insertNextSuggestion",precondition:te.and(M.textInputFocus,te.equals("config.editor.tabCompletion","on"),Ku.OtherSuggestions,Qe.Visible.toNegated(),wn.InSnippetMode.toNegated()),handler:o=>o.acceptNextSuggestion(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:2}}));ue(new ps({id:"insertPrevSuggestion",precondition:te.and(M.textInputFocus,te.equals("config.editor.tabCompletion","on"),Ku.OtherSuggestions,Qe.Visible.toNegated(),wn.InSnippetMode.toNegated()),handler:o=>o.acceptPrevSuggestion(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:1026}}));de(class extends we{constructor(){super({id:"editor.action.resetSuggestSize",label:p("suggest.reset.label","Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(o,e){var t;(t=gr.get(e))===null||t===void 0||t.resetWidgetSize()}});class nme extends K{get selectedItem(){return this._selectedItem}constructor(e,t,i,n){super(),this.editor=e,this.suggestControllerPreselector=t,this.checkModelVersion=i,this.onWillAccept=n,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._selectedItem=Ct(this,void 0),this._register(e.onKeyDown(r=>{r.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))})),this._register(e.onKeyUp(r=>{r.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))}));const s=gr.get(this.editor);if(s){this._register(s.registerSelector({priority:100,select:(l,d,c)=>{var h;ti(v=>this.checkModelVersion(v));const u=this.editor.getModel();if(!u)return-1;const g=(h=this.suggestControllerPreselector())===null||h===void 0?void 0:h.removeCommonPrefix(u);if(!g)return-1;const f=V.lift(d),m=c.map((v,b)=>{const w=I_.fromSuggestion(s,u,f,v,this.isShiftKeyPressed).toSingleTextEdit().removeCommonPrefix(u),y=g.augments(w);return{index:b,valid:y,prefixLength:w.text.length,suggestItem:v}}).filter(v=>v&&v.valid&&v.prefixLength>0),_=L2(m,Bo(v=>v.prefixLength,nd));return _?_.index:-1}}));let r=!1;const a=()=>{r||(r=!0,this._register(s.widget.value.onDidShow(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})),this._register(s.widget.value.onDidHide(()=>{this.isSuggestWidgetVisible=!1,this.update(!1)})),this._register(s.widget.value.onDidFocus(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})))};this._register(fe.once(s.model.onDidTrigger)(l=>{a()})),this._register(s.onWillInsertSuggestItem(l=>{const d=this.editor.getPosition(),c=this.editor.getModel();if(!d||!c)return;const h=I_.fromSuggestion(s,c,d,l.item,this.isShiftKeyPressed);this.onWillAccept(h)}))}this.update(this._isActive)}update(e){const t=this.getSuggestItemInfo();(this._isActive!==e||!sme(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,ti(i=>{this.checkModelVersion(i),this._selectedItem.set(this._isActive?this._currentSuggestItemInfo:void 0,i)}))}getSuggestItemInfo(){const e=gr.get(this.editor);if(!e||!this.isSuggestWidgetVisible)return;const t=e.widget.value.getFocusedItem(),i=this.editor.getPosition(),n=this.editor.getModel();if(!(!t||!i||!n))return I_.fromSuggestion(e,n,i,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){const e=gr.get(this.editor);e?.stopForceRenderingAbove()}forceRenderingAbove(){const e=gr.get(this.editor);e?.forceRenderingAbove()}}class I_{static fromSuggestion(e,t,i,n,s){let{insertText:r}=n.completion,a=!1;if(n.completion.insertTextRules&4){const d=new Dp().parse(r);d.children.length<100&&iS.adjustWhitespace(t,i,!0,d),r=d.toString(),a=!0}const l=e.getOverwriteInfo(n,s);return new I_(k.fromPositions(i.delta(0,-l.overwriteBefore),i.delta(0,Math.max(l.overwriteAfter,0))),r,n.completion.kind,a)}constructor(e,t,i,n){this.range=e,this.insertText=t,this.completionItemKind=i,this.isSnippetText=n}equals(e){return this.range.equalsRange(e.range)&&this.insertText===e.insertText&&this.completionItemKind===e.completionItemKind&&this.isSnippetText===e.isSnippetText}toSelectedSuggestionInfo(){return new K3(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new kp(this.range,this.insertText)}}function sme(o,e){return o===e?!0:!o||!e?!1:o.equals(e)}var ome=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Td=function(o,e){return function(t,i){e(t,i,o)}},sT;let Do=sT=class extends K{static get(e){return e.getContribution(sT.ID)}constructor(e,t,i,n,s,r,a,l,d){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._configurationService=n,this._commandService=s,this._debounceService=r,this._languageFeaturesService=a,this._audioCueService=l,this._keybindingService=d,this.model=Iw("inlineCompletionModel",void 0),this._textModelVersionId=Ct(this,-1),this._cursorPosition=Ct(this,new V(1,1)),this._suggestWidgetAdaptor=this._register(new nme(this.editor,()=>{var u,g;return(g=(u=this.model.get())===null||u===void 0?void 0:u.selectedInlineCompletion.get())===null||g===void 0?void 0:g.toSingleTextEdit(void 0)},u=>this.updateObservables(u,ro.Other),u=>{ti(g=>{var f;this.updateObservables(g,ro.Other),(f=this.model.get())===null||f===void 0||f.handleSuggestAccepted(u)})})),this._enabled=pi(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).enabled),this._ghostTextWidget=this._register(this._instantiationService.createInstance(GN,this.editor,{ghostText:this.model.map((u,g)=>u?.ghostText.read(g)),minReservedLineCount:Ew(0),targetTextModel:this.model.map(u=>u?.textModel)})),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this._playAudioCueSignal=nR(this),this._isReadonly=pi(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(90)),this._textModel=pi(this.editor.onDidChangeModel,()=>this.editor.getModel()),this._textModelIfWritable=Xe(u=>this._isReadonly.read(u)?void 0:this._textModel.read(u)),this._register(new ln(this._contextKeyService,this.model)),this._register(xt(u=>{const g=this._textModelIfWritable.read(u);ti(f=>{if(this.model.set(void 0,f),this.updateObservables(f,ro.Other),g){const m=t.createInstance(YN,g,this._suggestWidgetAdaptor.selectedItem,this._cursorPosition,this._textModelVersionId,this._debounceValue,pi(e.onDidChangeConfiguration,()=>e.getOption(117).preview),pi(e.onDidChangeConfiguration,()=>e.getOption(117).previewMode),pi(e.onDidChangeConfiguration,()=>e.getOption(62).mode),this._enabled);this.model.set(m,f)}})}));const c=u=>{var g;return u.isUndoing?ro.Undo:u.isRedoing?ro.Redo:!((g=this.model.get())===null||g===void 0)&&g.isAcceptingPartially?ro.AcceptWord:ro.Other};this._register(e.onDidChangeModelContent(u=>ti(g=>this.updateObservables(g,c(u))))),this._register(e.onDidChangeCursorPosition(u=>ti(g=>{var f;this.updateObservables(g,ro.Other),(u.reason===3||u.source==="api")&&((f=this.model.get())===null||f===void 0||f.stop(g))}))),this._register(e.onDidType(()=>ti(u=>{var g;this.updateObservables(u,ro.Other),this._enabled.get()&&((g=this.model.get())===null||g===void 0||g.trigger(u))}))),this._register(this._commandService.onDidExecuteCommand(u=>{new Set([If.Tab.id,If.DeleteLeft.id,If.DeleteRight.id,gW,"acceptSelectedSuggestion"]).has(u.commandId)&&e.hasTextFocus()&&this._enabled.get()&&ti(f=>{var m;(m=this.model.get())===null||m===void 0||m.trigger(f)})})),this._register(this.editor.onDidBlurEditorWidget(()=>{this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(62).keepOnBlur||Xc.dropDownVisible||ti(u=>{var g;(g=this.model.get())===null||g===void 0||g.stop(u)})})),this._register(xt(u=>{var g;const f=(g=this.model.read(u))===null||g===void 0?void 0:g.state.read(u);f?.suggestItem?f.ghostText.lineCount>=2&&this._suggestWidgetAdaptor.forceRenderingAbove():this._suggestWidgetAdaptor.stopForceRenderingAbove()})),this._register(Ae(()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}));let h;this._register(Fv({handleChange:(u,g)=>(u.didChange(this._playAudioCueSignal)&&(h=void 0),!0)},async u=>{this._playAudioCueSignal.read(u);const g=this.model.read(u),f=g?.state.read(u);if(!g||!f||!f.inlineCompletion){h=void 0;return}if(f.inlineCompletion.semanticId!==h){h=f.inlineCompletion.semanticId;const m=g.textModel.getLineContent(f.ghostText.lineNumber);this._audioCueService.playAudioCue(tt.inlineSuggestion).then(()=>{this.editor.getOption(8)&&this.provideScreenReaderUpdate(f.ghostText.renderForScreenReader(m))})}})),this._register(new xN(this.editor,this.model,this._instantiationService)),this._register(this._configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})}playAudioCue(e){this._playAudioCueSignal.trigger(e)}provideScreenReaderUpdate(e){const t=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),i=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let n;!t&&i&&this.editor.getOption(147)&&(n=p("showAccessibleViewHint","Inspect this in the accessible view ({0})",i.getAriaLabel())),js(n?e+", "+n:e)}updateObservables(e,t){var i,n;const s=this.editor.getModel();this._textModelVersionId.set((i=s?.getVersionId())!==null&&i!==void 0?i:-1,e,t),this._cursorPosition.set((n=this.editor.getPosition())!==null&&n!==void 0?n:new V(1,1),e)}shouldShowHoverAt(e){var t;const i=(t=this.model.get())===null||t===void 0?void 0:t.ghostText.get();return i?i.parts.some(n=>e.containsPosition(new V(i.lineNumber,n.column))):!1}shouldShowHoverAtViewZone(e){return this._ghostTextWidget.ownsViewZone(e)}};Do.ID="editor.contrib.inlineCompletionsController";Do=sT=ome([Td(1,Oe),Td(2,We),Td(3,ft),Td(4,ui),Td(5,Zo),Td(6,Se),Td(7,Pv),Td(8,Pt)],Do);class eL extends we{constructor(){super({id:eL.ID,label:p("action.inlineSuggest.showNext","Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:te.and(M.writable,ln.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){var i;const n=Do.get(t);(i=n?.model.get())===null||i===void 0||i.next()}}eL.ID=pW;class tL extends we{constructor(){super({id:tL.ID,label:p("action.inlineSuggest.showPrevious","Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:te.and(M.writable,ln.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){var i;const n=Do.get(t);(i=n?.model.get())===null||i===void 0||i.previous()}}tL.ID=fW;class rme extends we{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:p("action.inlineSuggest.trigger","Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:M.writable})}async run(e,t){const i=Do.get(t);await Ore(async n=>{var s;await((s=i?.model.get())===null||s===void 0?void 0:s.triggerExplicitly(n)),i?.playAudioCue(n)})}}class ame extends we{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:p("action.inlineSuggest.acceptNextWord","Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:te.and(M.writable,ln.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:te.and(M.writable,ln.inlineSuggestionVisible)},menuOpts:[{menuId:N.InlineSuggestionToolbar,title:p("acceptWord","Accept Word"),group:"primary",order:2}]})}async run(e,t){var i;const n=Do.get(t);await((i=n?.model.get())===null||i===void 0?void 0:i.acceptNextWord(n.editor))}}class lme extends we{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:p("action.inlineSuggest.acceptNextLine","Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:te.and(M.writable,ln.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:N.InlineSuggestionToolbar,title:p("acceptLine","Accept Line"),group:"secondary",order:2}]})}async run(e,t){var i;const n=Do.get(t);await((i=n?.model.get())===null||i===void 0?void 0:i.acceptNextLine(n.editor))}}class dme extends we{constructor(){super({id:gW,label:p("action.inlineSuggest.accept","Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:ln.inlineSuggestionVisible,menuOpts:[{menuId:N.InlineSuggestionToolbar,title:p("accept","Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:te.and(ln.inlineSuggestionVisible,M.tabMovesFocus.toNegated(),ln.inlineSuggestionHasIndentationLessThanTabSize,Qe.Visible.toNegated(),M.hoverFocused.toNegated())}})}async run(e,t){var i;const n=Do.get(t);n&&((i=n.model.get())===null||i===void 0||i.accept(n.editor),n.editor.focus())}}class iL extends we{constructor(){super({id:iL.ID,label:p("action.inlineSuggest.hide","Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:ln.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=Do.get(t);ti(n=>{var s;(s=i?.model.get())===null||s===void 0||s.stop(n)})}}iL.ID="editor.action.inlineSuggest.hide";class nL extends ko{constructor(){super({id:nL.ID,title:p("action.inlineSuggest.alwaysShowToolbar","Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:N.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:te.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(e,t){const i=e.get(ft),s=i.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";i.updateValue("editor.inlineSuggest.showToolbar",s)}}nL.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";var cme=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Im=function(o,e){return function(t,i){e(t,i,o)}};class hme{constructor(e,t,i){this.owner=e,this.range=t,this.controller=i}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let oT=class{constructor(e,t,i,n,s,r){this._editor=e,this._languageService=t,this._openerService=i,this.accessibilityService=n,this._instantiationService=s,this._telemetryService=r,this.hoverOrdinal=4}suggestHoverAnchor(e){const t=Do.get(this._editor);if(!t)return null;const i=e.target;if(i.type===8){const n=i.detail;if(t.shouldShowHoverAtViewZone(n.viewZoneId))return new JC(1e3,this,k.fromPositions(this._editor.getModel().validatePosition(n.positionBefore||n.position)),e.event.posx,e.event.posy,!1)}return i.type===7&&t.shouldShowHoverAt(i.range)?new JC(1e3,this,i.range,e.event.posx,e.event.posy,!1):i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range)?new JC(1e3,this,i.range,e.event.posx,e.event.posy,!1):null}computeSync(e,t){if(this._editor.getOption(62).showToolbar!=="onHover")return[];const i=Do.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new hme(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new se,n=t[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(8)&&this.renderScreenReaderText(e,n,i);const s=n.controller.model.get(),r=this._instantiationService.createInstance(Xc,this._editor,!1,Ew(null),s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.selectedInlineCompletion.map(a=>{var l;return(l=a?.inlineCompletion.source.inlineCompletions.commands)!==null&&l!==void 0?l:[]}));return e.fragment.appendChild(r.getDomNode()),s.triggerExplicitly(),i.add(r),i}renderScreenReaderText(e,t,i){const n=pe,s=n("div.hover-row.markdown-hover"),r=ie(s,n("div.hover-contents",{"aria-live":"assertive"})),a=i.add(new pd({editor:this._editor},this._languageService,this._openerService)),l=d=>{i.add(a.onDidRenderAsync(()=>{r.className="hover-contents code-hover-contents",e.onContentsChanged()}));const c=p("inlineSuggestionFollows","Suggestion:"),h=i.add(a.render(new Fn().appendText(c).appendCodeblock("text",d)));r.replaceChildren(h.element)};i.add(xt(d=>{var c;const h=(c=t.controller.model.read(d))===null||c===void 0?void 0:c.ghostText.read(d);if(h){const u=this._editor.getModel().getLineContent(h.lineNumber);l(h.renderForScreenReader(u))}else Wn(r)})),e.fragment.appendChild(s)}};oT=cme([Im(1,ni),Im(2,Qs),Im(3,Sl),Im(4,Oe),Im(5,Gs)],oT);yt(Do.ID,Do,3);de(rme);de(eL);de(tL);de(ame);de(lme);de(dme);de(iL);Xt(nL);hg.register(oT);function Ts(o,e){let t=0;for(let i=0;i<o.length;i++)o.charAt(i)===" "?t+=e:t++;return t}function E_(o,e,t){o=o<0?0:o;let i="";if(!t){const n=Math.floor(o/e);o=o%e;for(let s=0;s<n;s++)i+=" "}for(let n=0;n<o;n++)i+=" ";return i}var ume=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},gme=function(o,e){return function(t,i){e(t,i,o)}};function tV(o,e,t,i,n){if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return[];const s=e.getLanguageConfiguration(o.getLanguageId()).indentationRules;if(!s)return[];for(i=Math.min(i,o.getLineCount());t<=i&&s.unIndentedLinePattern;){const _=o.getLineContent(t);if(!s.unIndentedLinePattern.test(_))break;t++}if(t>i-1)return[];const{tabSize:r,indentSize:a,insertSpaces:l}=o.getOptions(),d=(_,v)=>(v=v||1,Po.shiftIndent(_,_.length+v,r,a,l)),c=(_,v)=>(v=v||1,Po.unshiftIndent(_,_.length+v,r,a,l)),h=[];let u;const g=o.getLineContent(t);let f=g;u=Ft(g);let m=u;s.increaseIndentPattern&&s.increaseIndentPattern.test(f)?(m=d(m),u=d(u)):s.indentNextLinePattern&&s.indentNextLinePattern.test(f)&&(m=d(m)),t++;for(let _=t;_<=i;_++){const v=o.getLineContent(_),b=Ft(v),C=m+v.substring(b.length);s.decreaseIndentPattern&&s.decreaseIndentPattern.test(C)&&(m=c(m),u=c(u)),b!==m&&h.push(oi.replaceMove(new xe(_,1,_,b.length+1),j2(m,a,l))),!(s.unIndentedLinePattern&&s.unIndentedLinePattern.test(v))&&(s.increaseIndentPattern&&s.increaseIndentPattern.test(C)?(u=d(u),m=u):s.indentNextLinePattern&&s.indentNextLinePattern.test(C)?m=d(m):m=u)}return h}class sL extends we{constructor(){super({id:sL.ID,label:p("indentationToSpaces","Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:M.writable})}run(e,t){const i=t.getModel();if(!i)return;const n=i.getOptions(),s=t.getSelection();if(!s)return;const r=new _me(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}}sL.ID="editor.action.indentationToSpaces";class oL extends we{constructor(){super({id:oL.ID,label:p("indentationToTabs","Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:M.writable})}run(e,t){const i=t.getModel();if(!i)return;const n=i.getOptions(),s=t.getSelection();if(!s)return;const r=new vme(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}}oL.ID="editor.action.indentationToTabs";class jR extends we{constructor(e,t,i){super(i),this.insertSpaces=e,this.displaySizeOnly=t}run(e,t){const i=e.get(dh),n=e.get(ii),s=t.getModel();if(!s)return;const r=n.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget),a=s.getOptions(),l=[1,2,3,4,5,6,7,8].map(c=>({id:c.toString(),label:c.toString(),description:c===r.tabSize&&c===a.tabSize?p("configuredTabSize","Configured Tab Size"):c===r.tabSize?p("defaultTabSize","Default Tab Size"):c===a.tabSize?p("currentTabSize","Current Tab Size"):void 0})),d=Math.min(s.getOptions().tabSize-1,7);setTimeout(()=>{i.pick(l,{placeHolder:p({},"Select Tab Size for Current File"),activeItem:l[d]}).then(c=>{if(c&&s&&!s.isDisposed()){const h=parseInt(c.label,10);this.displaySizeOnly?s.updateOptions({tabSize:h}):s.updateOptions({tabSize:h,indentSize:h,insertSpaces:this.insertSpaces})}})},50)}}class rL extends jR{constructor(){super(!1,!1,{id:rL.ID,label:p("indentUsingTabs","Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0})}}rL.ID="editor.action.indentUsingTabs";class aL extends jR{constructor(){super(!0,!1,{id:aL.ID,label:p("indentUsingSpaces","Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0})}}aL.ID="editor.action.indentUsingSpaces";class lL extends jR{constructor(){super(!0,!0,{id:lL.ID,label:p("changeTabDisplaySize","Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0})}}lL.ID="editor.action.changeTabDisplaySize";class dL extends we{constructor(){super({id:dL.ID,label:p("detectIndentation","Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0})}run(e,t){const i=e.get(ii),n=t.getModel();if(!n)return;const s=i.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget);n.detectIndentation(s.insertSpaces,s.tabSize)}}dL.ID="editor.action.detectIndentation";class fme extends we{constructor(){super({id:"editor.action.reindentlines",label:p("editor.reindentlines","Reindent Lines"),alias:"Reindent Lines",precondition:M.writable})}run(e,t){const i=e.get(Wt),n=t.getModel();if(!n)return;const s=tV(n,i,1,n.getLineCount());s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}}class pme extends we{constructor(){super({id:"editor.action.reindentselectedlines",label:p("editor.reindentselectedlines","Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:M.writable})}run(e,t){const i=e.get(Wt),n=t.getModel();if(!n)return;const s=t.getSelections();if(s===null)return;const r=[];for(const a of s){let l=a.startLineNumber,d=a.endLineNumber;if(l!==d&&a.endColumn===1&&d--,l===1){if(l===d)continue}else l--;const c=tV(n,i,l,d);r.push(...c)}r.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop())}}class mme{constructor(e,t){this._initialSelection=t,this._edits=[],this._selectionId=null;for(const i of e)i.range&&typeof i.text=="string"&&this._edits.push(i)}getEditOperations(e,t){for(const n of this._edits)t.addEditOperation(k.lift(n.range),n.text);let i=!1;Array.isArray(this._edits)&&this._edits.length===1&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!1))),i||(this._selectionId=t.trackSelection(this._initialSelection))}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}let Q0=class{constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new se,this.callOnModel=new se,this.callOnDispose.add(e.onDidChangeConfiguration(()=>this.update())),this.callOnDispose.add(e.onDidChangeModel(()=>this.update())),this.callOnDispose.add(e.onDidChangeModelLanguage(()=>this.update()))}update(){this.callOnModel.clear(),!(this.editor.getOption(12)<4||this.editor.getOption(55))&&this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste(({range:e})=>{this.trigger(e)}))}trigger(e){const t=this.editor.getSelections();if(t===null||t.length>1)return;const i=this.editor.getModel();if(!i||!i.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber))return;const n=this.editor.getOption(12),{tabSize:s,indentSize:r,insertSpaces:a}=i.getOptions(),l=[],d={shiftIndent:g=>Po.shiftIndent(g,g.length+1,s,r,a),unshiftIndent:g=>Po.unshiftIndent(g,g.length+1,s,r,a)};let c=e.startLineNumber;for(;c<=e.endLineNumber;){if(this.shouldIgnoreLine(i,c)){c++;continue}break}if(c>e.endLineNumber)return;let h=i.getLineContent(c);if(!/\S/.test(h.substring(0,e.startColumn-1))){const g=r_(n,i,i.getLanguageId(),c,d,this._languageConfigurationService);if(g!==null){const f=Ft(h),m=Ts(g,s),_=Ts(f,s);if(m!==_){const v=E_(m,s,a);l.push({range:new k(c,1,c,f.length+1),text:v}),h=v+h.substr(f.length)}else{const v=W8(i,c,this._languageConfigurationService);if(v===0||v===8)return}}}const u=c;for(;c<e.endLineNumber;){if(!/\S/.test(i.getLineContent(c+1))){c++;continue}break}if(c!==e.endLineNumber){const f=r_(n,{tokenization:{getLineTokens:m=>i.tokenization.getLineTokens(m),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(m,_)=>i.getLanguageIdAtPosition(m,_)},getLineContent:m=>m===u?h:i.getLineContent(m)},i.getLanguageId(),c+1,d,this._languageConfigurationService);if(f!==null){const m=Ts(f,s),_=Ts(Ft(i.getLineContent(c+1)),s);if(m!==_){const v=m-_;for(let b=c+1;b<=e.endLineNumber;b++){const C=i.getLineContent(b),w=Ft(C),I=Ts(w,s)+v,D=E_(I,s,a);D!==w&&l.push({range:new k(b,1,b,w.length+1),text:D})}}}}if(l.length>0){this.editor.pushUndoStop();const g=new mme(l,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",g),this.editor.pushUndoStop()}}shouldIgnoreLine(e,t){e.tokenization.forceTokenization(t);const i=e.getLineFirstNonWhitespaceColumn(t);if(i===0)return!0;const n=e.tokenization.getLineTokens(t);if(n.getCount()>0){const s=n.findTokenIndexAtOffset(i);if(s>=0&&n.getStandardTokenType(s)===1)return!0}return!1}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}};Q0.ID="editor.contrib.autoIndentOnPaste";Q0=ume([gme(1,Wt)],Q0);function iV(o,e,t,i){if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return;let n="";for(let r=0;r<t;r++)n+=" ";const s=new RegExp(n,"gi");for(let r=1,a=o.getLineCount();r<=a;r++){let l=o.getLineFirstNonWhitespaceColumn(r);if(l===0&&(l=o.getLineMaxColumn(r)),l===1)continue;const d=new k(r,1,r,l),c=o.getValueInRange(d),h=i?c.replace(/\t/ig,n):c.replace(s," ");e.addEditOperation(d,h)}}class _me{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),iV(e,t,this.tabSize,!0)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}class vme{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),iV(e,t,this.tabSize,!1)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}yt(Q0.ID,Q0,2);de(sL);de(oL);de(rL);de(aL);de(lL);de(dL);de(fme);de(pme);class nV{constructor(e,t){this.range=e,this.direction=t}}class qR{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new qR(this.hint,e.anchor,this.provider);return t._isResolved=this._isResolved,t._currentResolve=this._currentResolve,t}async resolve(e){if(typeof this.provider.resolveInlayHint=="function"){if(this._currentResolve)return await this._currentResolve,e.isCancellationRequested?void 0:this.resolve(e);this._isResolved||(this._currentResolve=this._doResolve(e).finally(()=>this._currentResolve=void 0)),await this._currentResolve}}async _doResolve(e){var t,i;try{const n=await Promise.resolve(this.provider.resolveInlayHint(this.hint,e));this.hint.tooltip=(t=n?.tooltip)!==null&&t!==void 0?t:this.hint.tooltip,this.hint.label=(i=n?.label)!==null&&i!==void 0?i:this.hint.label,this._isResolved=!0}catch(n){Mi(n),this._isResolved=!1}}}class J0{static async create(e,t,i,n){const s=[],r=e.ordered(t).reverse().map(a=>i.map(async l=>{try{const d=await a.provideInlayHints(t,l,n);d?.hints.length&&s.push([d,a])}catch(d){Mi(d)}}));if(await Promise.all(r.flat()),n.isCancellationRequested||t.isDisposed())throw new ih;return new J0(i,s,t)}constructor(e,t,i){this._disposables=new se,this.ranges=e,this.provider=new Set;const n=[];for(const[s,r]of t){this._disposables.add(s),this.provider.add(r);for(const a of s.hints){const l=i.validatePosition(a.position);let d="before";const c=J0._getRangeAtPosition(i,l);let h;c.getStartPosition().isBefore(l)?(h=k.fromPositions(c.getStartPosition(),l),d="after"):(h=k.fromPositions(l,c.getEndPosition()),d="before"),n.push(new qR(a,new nV(h,d),r))}}this.items=n.sort((s,r)=>V.compare(s.hint.position,r.hint.position))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(e,t){const i=t.lineNumber,n=e.getWordAtPosition(t);if(n)return new k(i,n.startColumn,i,n.endColumn);e.tokenization.tokenizeIfCheap(i);const s=e.tokenization.getLineTokens(i),r=t.column-1,a=s.findTokenIndexAtOffset(r);let l=s.getStartOffset(a),d=s.getEndOffset(a);return d-l===1&&(l===r&&a>1?(l=s.getStartOffset(a-1),d=s.getEndOffset(a-1)):d===r&&a<s.getCount()-1&&(l=s.getStartOffset(a+1),d=s.getEndOffset(a+1))),new k(i,l+1,i,d+1)}}function bme(o){return Me.from({scheme:Ye.command,path:o.id,query:o.arguments&&encodeURIComponent(JSON.stringify(o.arguments))}).toString()}async function Cme(o,e,t,i){var n;const s=o.get(ks),r=o.get(Yo),a=o.get(ui),l=o.get(Oe),d=o.get(Vi);if(await i.item.resolve(st.None),!i.part.location)return;const c=i.part.location,h=[],u=new Set(vn.getMenuItems(N.EditorContext).map(f=>Kg(f)?f.command.id:zy()));for(const f of Yn.all())u.has(f.desc.id)&&h.push(new cs(f.desc.id,_r.label(f.desc,{renderShortTitle:!0}),void 0,!0,async()=>{const m=await s.createModelReference(c.uri);try{const _=new wp(m.object.textEditorModel,k.getStartPosition(c.range)),v=i.item.anchor.range;await l.invokeFunction(f.runEditorCommand.bind(f),e,_,v)}finally{m.dispose()}}));if(i.part.command){const{command:f}=i.part;h.push(new dn),h.push(new cs(f.id,f.title,void 0,!0,async()=>{var m;try{await a.executeCommand(f.id,...(m=f.arguments)!==null&&m!==void 0?m:[])}catch(_){d.notify({severity:ey.Error,source:i.item.provider.displayName,message:_})}}))}const g=e.getOption(126);r.showContextMenu({domForShadowRoot:g&&(n=e.getDomNode())!==null&&n!==void 0?n:void 0,getAnchor:()=>{const f=ji(t);return{x:f.left,y:f.top+f.height+8}},getActions:()=>h,onHide:()=>{e.focus()},autoSelectFirstItem:!0})}async function sV(o,e,t,i){const s=await o.get(ks).createModelReference(i.uri);await t.invokeWithinContext(async r=>{const a=e.hasSideBySideModifier,l=r.get(We),d=xs.inPeekEditor.getValue(l),c=!a&&t.getOption(87)&&!d;return new qv({openToSide:a,openInPeek:c,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new wp(s.object.textEditorModel,k.getStartPosition(i.range)),k.lift(i.range))}),s.dispose()}var wme=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Rg=function(o,e){return function(t,i){e(t,i,o)}},n1;class nS{constructor(){this._entries=new oh(50)}get(e){const t=nS._key(e);return this._entries.get(t)}set(e,t){const i=nS._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const oV=ot("IInlayHintsCache");ct(oV,nS,1);class rT{constructor(e,t){this.item=e,this.index=t}get part(){const e=this.item.hint.label;return typeof e=="string"?{label:e}:e[this.index]}}class Sme{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}let ju=n1=class{static get(e){var t;return(t=e.getContribution(n1.ID))!==null&&t!==void 0?t:void 0}constructor(e,t,i,n,s,r,a){this._editor=e,this._languageFeaturesService=t,this._inlayHintsCache=n,this._commandService=s,this._notificationService=r,this._instaService=a,this._disposables=new se,this._sessionDisposables=new se,this._decorationsMetadata=new Map,this._ruleFactory=new vv(this._editor),this._activeRenderMode=0,this._debounceInfo=i.for(t.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(t.inlayHintsProvider.onDidChange(()=>this._update())),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(l=>{l.hasChanged(139)&&this._update()})),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const e=this._editor.getOption(139);if(e.enabled==="off")return;const t=this._editor.getModel();if(!t||!this._languageFeaturesService.inlayHintsProvider.has(t))return;const i=this._inlayHintsCache.get(t);i&&this._updateHintsDecorators([t.getFullModelRange()],i),this._sessionDisposables.add(Ae(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));let n;const s=new Set,r=new Rt(async()=>{const a=Date.now();n?.dispose(!0),n=new Wi;const l=t.onWillDispose(()=>n?.cancel());try{const d=n.token,c=await J0.create(this._languageFeaturesService.inlayHintsProvider,t,this._getHintsRanges(),d);if(r.delay=this._debounceInfo.update(t,Date.now()-a),d.isCancellationRequested){c.dispose();return}for(const h of c.provider)typeof h.onDidChangeInlayHints=="function"&&!s.has(h)&&(s.add(h),this._sessionDisposables.add(h.onDidChangeInlayHints(()=>{r.isScheduled()||r.schedule()})));this._sessionDisposables.add(c),this._updateHintsDecorators(c.ranges,c.items),this._cacheHintsForFastRestore(t)}catch(d){Ge(d)}finally{n.dispose(),l.dispose()}},this._debounceInfo.get(t));if(this._sessionDisposables.add(r),this._sessionDisposables.add(Ae(()=>n?.dispose(!0))),r.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange(a=>{(a.scrollTopChanged||!r.isScheduled())&&r.schedule()})),this._sessionDisposables.add(this._editor.onDidChangeModelContent(a=>{const l=Math.max(r.delay,1250);r.schedule(l)})),e.enabled==="on")this._activeRenderMode=0;else{let a,l;e.enabled==="onUnlessPressed"?(a=0,l=1):(a=1,l=0),this._activeRenderMode=a,this._sessionDisposables.add(Yl.getInstance().event(d=>{if(!this._editor.hasModel())return;const c=d.altKey&&d.ctrlKey&&!(d.shiftKey||d.metaKey)?l:a;if(c!==this._activeRenderMode){this._activeRenderMode=c;const h=this._editor.getModel(),u=this._copyInlayHintsWithCurrentAnchor(h);this._updateHintsDecorators([h.getFullModelRange()],u),r.schedule(0)}}))}this._sessionDisposables.add(this._installDblClickGesture(()=>r.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){const e=new se,t=e.add(new Ry(this._editor)),i=new se;return e.add(i),e.add(t.onMouseMoveOrRelevantKeyDown(n=>{const[s]=n,r=this._getInlayHintLabelPart(s),a=this._editor.getModel();if(!r||!a){i.clear();return}const l=new Wi;i.add(Ae(()=>l.dispose(!0))),r.item.resolve(l.token),this._activeInlayHintPart=r.part.command||r.part.location?new Sme(r,s.hasTriggerModifier):void 0;const d=a.validatePosition(r.item.hint.position).lineNumber,c=new k(d,1,d,a.getLineMaxColumn(d)),h=this._getInlineHintsForRange(c);this._updateHintsDecorators([c],h),i.add(Ae(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([c],h)}))})),e.add(t.onCancel(()=>i.clear())),e.add(t.onExecute(async n=>{const s=this._getInlayHintLabelPart(n);if(s){const r=s.part;r.location?this._instaService.invokeFunction(sV,n,this._editor,r.location):WD.is(r.command)&&await this._invokeCommand(r.command,s.item)}})),e}_getInlineHintsForRange(e){const t=new Set;for(const i of this._decorationsMetadata.values())e.containsRange(i.item.anchor.range)&&t.add(i.item);return Array.from(t)}_installDblClickGesture(e){return this._editor.onMouseUp(async t=>{if(t.event.detail!==2)return;const i=this._getInlayHintLabelPart(t);if(i&&(t.event.preventDefault(),await i.item.resolve(st.None),Bn(i.item.hint.textEdits))){const n=i.item.hint.textEdits.map(s=>oi.replace(k.lift(s.range),s.text));this._editor.executeEdits("inlayHint.default",n),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!(e.event.target instanceof HTMLElement))return;const t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(Cme,this._editor,e.event.target,t)})}_getInlayHintLabelPart(e){var t;if(e.target.type!==6)return;const i=(t=e.target.detail.injectedText)===null||t===void 0?void 0:t.options;if(i instanceof Hc&&i?.attachedData instanceof rT)return i.attachedData}async _invokeCommand(e,t){var i;try{await this._commandService.executeCommand(e.id,...(i=e.arguments)!==null&&i!==void 0?i:[])}catch(n){this._notificationService.notify({severity:ey.Error,source:t.provider.displayName,message:n})}}_cacheHintsForFastRestore(e){const t=this._copyInlayHintsWithCurrentAnchor(e);this._inlayHintsCache.set(e,t)}_copyInlayHintsWithCurrentAnchor(e){const t=new Map;for(const[i,n]of this._decorationsMetadata){if(t.has(n.item))continue;const s=e.getDecorationRange(i);if(s){const r=new nV(s,n.item.anchor.direction),a=n.item.with({anchor:r});t.set(n.item,a)}}return Array.from(t.values())}_getHintsRanges(){const t=this._editor.getModel(),i=this._editor.getVisibleRangesPlusViewportAboveBelow(),n=[];for(const s of i.sort(k.compareRangesUsingStarts)){const r=t.validateRange(new k(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));n.length===0||!k.areIntersectingOrTouching(n[n.length-1],r)?n.push(r):n[n.length-1]=k.plusRange(n[n.length-1],r)}return n}_updateHintsDecorators(e,t){var i,n;const s=[],r=(m,_,v,b,C)=>{const w={content:v,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:_.className,cursorStops:b,attachedData:C};s.push({item:m,classNameRef:_,decoration:{range:m.anchor.range,options:{description:"InlayHint",showIfCollapsed:m.anchor.range.isEmpty(),collapseOnReplaceEdit:!m.anchor.range.isEmpty(),stickiness:0,[m.anchor.direction]:this._activeRenderMode===0?w:void 0}}})},a=(m,_)=>{const v=this._ruleFactory.createClassNameRef({width:`${l/3|0}px`,display:"inline-block"});r(m,v," ",_?Gr.Right:Gr.None)},{fontSize:l,fontFamily:d,padding:c,isUniform:h}=this._getLayoutInfo(),u="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(u,d);for(const m of t){m.hint.paddingLeft&&a(m,!1);const _=typeof m.hint.label=="string"?[{label:m.hint.label}]:m.hint.label;for(let v=0;v<_.length;v++){const b=_[v],C=v===0,w=v===_.length-1,y={fontSize:`${l}px`,fontFamily:`var(${u}), ${Vs.fontFamily}`,verticalAlign:h?"baseline":"middle",unicodeBidi:"isolate"};Bn(m.hint.textEdits)&&(y.cursor="default"),this._fillInColors(y,m.hint),(b.command||b.location)&&((i=this._activeInlayHintPart)===null||i===void 0?void 0:i.part.item)===m&&this._activeInlayHintPart.part.index===v&&(y.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(y.color=fi(TG),y.cursor="pointer")),c&&(C&&w?(y.padding=`1px ${Math.max(1,l/4)|0}px`,y.borderRadius=`${l/4|0}px`):C?(y.padding=`1px 0 1px ${Math.max(1,l/4)|0}px`,y.borderRadius=`${l/4|0}px 0 0 ${l/4|0}px`):w?(y.padding=`1px ${Math.max(1,l/4)|0}px 1px 0`,y.borderRadius=`0 ${l/4|0}px ${l/4|0}px 0`):y.padding="1px 0 1px 0"),r(m,this._ruleFactory.createClassNameRef(y),yme(b.label),w&&!m.hint.paddingRight?Gr.Right:Gr.None,new rT(m,v))}if(m.hint.paddingRight&&a(m,!0),s.length>n1._MAX_DECORATORS)break}const g=[];for(const m of e)for(const{id:_}of(n=this._editor.getDecorationsInRange(m))!==null&&n!==void 0?n:[]){const v=this._decorationsMetadata.get(_);v&&(g.push(_),v.classNameRef.dispose(),this._decorationsMetadata.delete(_))}const f=na.capture(this._editor);this._editor.changeDecorations(m=>{const _=m.deltaDecorations(g,s.map(v=>v.decoration));for(let v=0;v<_.length;v++){const b=s[v];this._decorationsMetadata.set(_[v],b)}}),f.restore(this._editor)}_fillInColors(e,t){t.kind===p1.Parameter?(e.backgroundColor=fi(PG),e.color=fi(AG)):t.kind===p1.Type?(e.backgroundColor=fi(RG),e.color=fi(MG)):(e.backgroundColor=fi(Jl),e.color=fi(Ql))}_getLayoutInfo(){const e=this._editor.getOption(139),t=e.padding,i=this._editor.getOption(52),n=this._editor.getOption(49);let s=e.fontSize;(!s||s<5||s>i)&&(s=i);const r=e.fontFamily||n;return{fontSize:s,fontFamily:r,padding:t,isUniform:!t&&r===n&&s===i}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(const e of this._decorationsMetadata.values())e.classNameRef.dispose();this._decorationsMetadata.clear()}};ju.ID="editor.contrib.InlayHints";ju._MAX_DECORATORS=1500;ju=n1=wme([Rg(1,Se),Rg(2,Zo),Rg(3,oV),Rg(4,ui),Rg(5,Vi),Rg(6,Oe)],ju);function yme(o){return o.replace(/[ \t]/g," ")}gt.registerCommand("_executeInlayHintProvider",async(o,...e)=>{const[t,i]=e;Tt(Me.isUri(t)),Tt(k.isIRange(i));const{inlayHintsProvider:n}=o.get(Se),s=await o.get(ks).createModelReference(t);try{const r=await J0.create(n,s.object.textEditorModel,[k.lift(i)],st.None),a=r.items.map(l=>l.hint);return setTimeout(()=>r.dispose(),0),a}finally{s.dispose()}});var Lme=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Em=function(o,e){return function(t,i){e(t,i,o)}};class Q5 extends JC{constructor(e,t,i,n){super(10,t,e.item.anchor.range,i,n,!0),this.part=e}}let aT=class extends Kw{constructor(e,t,i,n,s,r){super(e,t,i,n,r),this._resolverService=s,this.hoverOrdinal=6}suggestHoverAnchor(e){var t;if(!ju.get(this._editor)||e.target.type!==6)return null;const n=(t=e.target.detail.injectedText)===null||t===void 0?void 0:t.options;return n instanceof Hc&&n.attachedData instanceof rT?new Q5(n.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,i){return e instanceof Q5?new Fi(async n=>{const{part:s}=e;if(await s.item.resolve(i),i.isCancellationRequested)return;let r;typeof s.item.hint.tooltip=="string"?r=new Fn().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(r=s.item.hint.tooltip),r&&n.emitOne(new Kr(this,e.range,[r],!1,0)),Bn(s.item.hint.textEdits)&&n.emitOne(new Kr(this,e.range,[new Fn().appendText(p("hint.dbl","Double-click to insert"))],!1,10001));let a;if(typeof s.part.tooltip=="string"?a=new Fn().appendText(s.part.tooltip):s.part.tooltip&&(a=s.part.tooltip),a&&n.emitOne(new Kr(this,e.range,[a],!1,1)),s.part.location||s.part.command){let d;const h=this._editor.getOption(77)==="altKey"?ut?p("links.navigate.kb.meta.mac","cmd + click"):p("links.navigate.kb.meta","ctrl + click"):ut?p("links.navigate.kb.alt.mac","option + click"):p("links.navigate.kb.alt","alt + click");s.part.location&&s.part.command?d=new Fn().appendText(p("hint.defAndCommand","Go to Definition ({0}), right click for more",h)):s.part.location?d=new Fn().appendText(p("hint.def","Go to Definition ({0})",h)):s.part.command&&(d=new Fn(`[${p("hint.cmd","Execute Command")}](${bme(s.part.command)} "${s.part.command.title}") (${h})`,{isTrusted:!0})),d&&n.emitOne(new Kr(this,e.range,[d],!1,1e4))}const l=await this._resolveInlayHintLabelPartHover(s,i);for await(const d of l)n.emitOne(d)}):Fi.EMPTY}async _resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return Fi.EMPTY;const{uri:i,range:n}=e.part.location,s=await this._resolverService.createModelReference(i);try{const r=s.object.textEditorModel;return this._languageFeaturesService.hoverProvider.has(r)?xR(this._languageFeaturesService.hoverProvider,r,new V(n.startLineNumber,n.startColumn),t).filter(a=>!hp(a.hover.contents)).map(a=>new Kr(this,e.item.anchor.range,a.hover.contents,!1,2+a.ordinal)):Fi.EMPTY}finally{s.dispose()}}};aT=Lme([Em(1,ni),Em(2,Qs),Em(3,ft),Em(4,ks),Em(5,Se)],aT);yt(ju.ID,ju,1);hg.register(aT);class xme{constructor(e,t,i){this._editRange=e,this._originalSelection=t,this._text=i}getEditOperations(e,t){t.addTrackedEditOperation(this._editRange,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return this._originalSelection.isEmpty()?new xe(n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn),n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn)):new xe(n.endLineNumber,n.endColumn-this._text.length,n.endLineNumber,n.endColumn)}}var Dme=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kme=function(o,e){return function(t,i){e(t,i,o)}},s1;let Jc=s1=class{static get(e){return e.getContribution(s1.ID)}constructor(e,t){this.editor=e,this.editorWorkerService=t,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(e,t){var i;(i=this.currentRequest)===null||i===void 0||i.cancel();const n=this.editor.getSelection(),s=this.editor.getModel();if(!s||!n)return;let r=n;if(r.startLineNumber!==r.endLineNumber)return;const a=new r6(this.editor,5),l=s.uri;return this.editorWorkerService.canNavigateValueSet(l)?(this.currentRequest=Zi(d=>this.editorWorkerService.navigateValueSet(l,r,t)),this.currentRequest.then(d=>{var c;if(!d||!d.range||!d.value||!a.validate(this.editor))return;const h=k.lift(d.range);let u=d.range;const g=d.value.length-(r.endColumn-r.startColumn);u={startLineNumber:u.startLineNumber,startColumn:u.startColumn,endLineNumber:u.endLineNumber,endColumn:u.startColumn+d.value.length},g>1&&(r=new xe(r.startLineNumber,r.startColumn,r.endLineNumber,r.endColumn+g-1));const f=new xme(h,r,d.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,f),this.editor.pushUndoStop(),this.decorations.set([{range:u,options:s1.DECORATION}]),(c=this.decorationRemover)===null||c===void 0||c.cancel(),this.decorationRemover=Mc(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(Ge)}).catch(Ge)):Promise.resolve(void 0)}};Jc.ID="editor.contrib.inPlaceReplaceController";Jc.DECORATION=Ze.register({description:"in-place-replace",className:"valueSetReplacement"});Jc=s1=Dme([kme(1,Lr)],Jc);class Ime extends we{constructor(){super({id:"editor.action.inPlaceReplace.up",label:p("InPlaceReplaceAction.previous.label","Replace with Previous Value"),alias:"Replace with Previous Value",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:3159,weight:100}})}run(e,t){const i=Jc.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}class Eme extends we{constructor(){super({id:"editor.action.inPlaceReplace.down",label:p("InPlaceReplaceAction.next.label","Replace with Next Value"),alias:"Replace with Next Value",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:3161,weight:100}})}run(e,t){const i=Jc.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}yt(Jc.ID,Jc,4);de(Ime);de(Eme);class Nme extends we{constructor(){super({id:"expandLineSelection",label:p("expandLineSelection","Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:M.textInputFocus,primary:2090}})}run(e,t,i){if(i=i||{},!t.hasModel())return;const n=t._getViewModel();n.model.pushStackElement(),n.setCursorStates(i.source,3,un.expandLineSelection(n,n.getCursorStates())),n.revealPrimaryCursor(i.source,!0)}}de(Nme);class Tme{constructor(e,t){this._selection=e,this._cursors=t,this._selectionId=null}getEditOperations(e,t){const i=Mme(e,this._cursors);for(let n=0,s=i.length;n<s;n++){const r=i[n];t.addEditOperation(r.range,r.text)}this._selectionId=t.trackSelection(this._selection)}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}function Mme(o,e){e.sort((r,a)=>r.lineNumber===a.lineNumber?r.column-a.column:r.lineNumber-a.lineNumber);for(let r=e.length-2;r>=0;r--)e[r].lineNumber===e[r+1].lineNumber&&e.splice(r,1);const t=[];let i=0,n=0;const s=e.length;for(let r=1,a=o.getLineCount();r<=a;r++){const l=o.getLineContent(r),d=l.length+1;let c=0;if(n<s&&e[n].lineNumber===r&&(c=e[n].column,n++,c===d)||l.length===0)continue;const h=Yr(l);let u=0;if(h===-1)u=1;else if(h!==l.length-1)u=h+2;else continue;u=Math.max(c,u),t[i++]=oi.delete(new k(r,u,r,d))}return t}class rV{constructor(e,t,i){this._selection=e,this._isCopyingDown=t,this._noop=i||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(e,t){let i=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,i.startLineNumber<i.endLineNumber&&i.endColumn===1&&(this._endLineNumberDelta=1,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const n=[];for(let r=i.startLineNumber;r<=i.endLineNumber;r++)n.push(e.getLineContent(r));const s=n.join(`
|
|
701
|
+
`,r=new Fn().appendCodeblock("empty",a),s=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!KR(e)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),s){const a=s.length>1e5?`${s.substr(0,1e5)}…`:s;this._type.textContent=a,this._type.title=a,Os(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(a))}else bn(this._type),this._type.title="",is(this._type),this.domNode.classList.add("no-type");if(bn(this._docs),typeof r=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=r;else if(r){this._docs.classList.add("markdown-docs"),bn(this._docs);const a=this._markdownRenderer.render(r);this._docs.appendChild(a.element),this._renderDisposeable.add(a),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=a=>{a.preventDefault(),a.stopPropagation()},this._close.onclick=a=>{a.preventDefault(),a.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 size(){return this._size}layout(e,t){const i=new bt(e,t);bt.equals(i,this._size)||(this._size=i,W$(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}};tT=zpe([Upe(1,Oe)],tT);class $pe{constructor(e,t){this.widget=e,this._editor=t,this._disposables=new se,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new yR,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(e.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let i,n,s=0,r=0;this._disposables.add(this._resizable.onDidWillResize(()=>{i=this._topLeft,n=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(a=>{if(i&&n){this.widget.layout(a.dimension.width,a.dimension.height);let l=!1;a.west&&(r=n.width-a.dimension.width,l=!0),a.north&&(s=n.height-a.dimension.height,l=!0),l&&this._applyTopLeft({top:i.top+s,left:i.left+r})}a.done&&(i=void 0,n=void 0,s=0,r=0,this._userSize=a.dimension)})),this._disposables.add(this.widget.onDidChangeContents(()=>{var a;this._anchorBox&&this._placeAtAnchor(this._anchorBox,(a=this._userSize)!==null&&a!==void 0?a: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 null}show(){this._added||(this._editor.addOverlayWidget(this),this.getDomNode().style.position="fixed",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 s=Lu(this.getDomNode().ownerDocument.body),r=this.widget.getLayoutInfo(),a=new bt(220,2*r.lineHeight),l=e.top,d=function(){const C=s.width-(e.left+e.width+r.borderWidth+r.horizontalPadding),w=-r.borderWidth+e.left+e.width,y=new bt(C,s.height-e.top-r.borderHeight-r.verticalPadding),I=y.with(void 0,e.top+e.height-r.borderHeight-r.verticalPadding);return{top:l,left:w,fit:C-t.width,maxSizeTop:y,maxSizeBottom:I,minSize:a.with(Math.min(C,a.width))}}(),c=function(){const C=e.left-r.borderWidth-r.horizontalPadding,w=Math.max(r.horizontalPadding,e.left-t.width-r.borderWidth),y=new bt(C,s.height-e.top-r.borderHeight-r.verticalPadding),I=y.with(void 0,e.top+e.height-r.borderHeight-r.verticalPadding);return{top:l,left:w,fit:C-t.width,maxSizeTop:y,maxSizeBottom:I,minSize:a.with(Math.min(C,a.width))}}(),h=function(){const C=e.left,w=-r.borderWidth+e.top+e.height,y=new bt(e.width-r.borderHeight,s.height-e.top-e.height-r.verticalPadding);return{top:w,left:C,fit:y.height-t.height,maxSizeBottom:y,maxSizeTop:y,minSize:a.with(y.width)}}(),u=[d,c,h],g=(n=u.find(C=>C.fit>=0))!==null&&n!==void 0?n:u.sort((C,w)=>w.fit-C.fit)[0],f=e.top+e.height-r.borderHeight;let m,_=t.height;const v=Math.max(g.maxSizeTop.height,g.maxSizeBottom.height);_>v&&(_=v);let b;i?_<=g.maxSizeTop.height?(m=!0,b=g.maxSizeTop):(m=!1,b=g.maxSizeBottom):_<=g.maxSizeBottom.height?(m=!1,b=g.maxSizeBottom):(m=!0,b=g.maxSizeTop),this._applyTopLeft({left:g.left,top:m?g.top:f-_}),this.getDomNode().style.position="fixed",this._resizable.enableSashes(!m,g===d,m,g!==d),this._resizable.minSize=g.minSize,this._resizable.maxSize=b,this._resizable.layout(_,Math.min(b.width,t.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(e){this._topLeft=e,this.getDomNode().style.left=`${this._topLeft.left}px`,this.getDomNode().style.top=`${this._topLeft.top}px`}}var Xa;(function(o){o[o.FILE=0]="FILE",o[o.FOLDER=1]="FOLDER",o[o.ROOT_FOLDER=2]="ROOT_FOLDER"})(Xa||(Xa={}));const Kpe=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function uC(o,e,t,i){const n=i===Xa.ROOT_FOLDER?["rootfolder-icon"]:i===Xa.FOLDER?["folder-icon"]:["file-icon"];if(t){let s;if(t.scheme===Ye.data)s=Wc.parseMetaData(t).get(Wc.META_DATA_LABEL);else{const r=t.path.match(Kpe);r?(s=gC(r[2].toLowerCase()),r[1]&&n.push(`${gC(r[1].toLowerCase())}-name-dir-icon`)):s=gC(t.authority.toLowerCase())}if(i===Xa.ROOT_FOLDER)n.push(`${s}-root-name-folder-icon`);else if(i===Xa.FOLDER)n.push(`${s}-name-folder-icon`);else{if(s){if(n.push(`${s}-name-file-icon`),n.push("name-file-icon"),s.length<=255){const a=s.split(".");for(let l=1;l<a.length;l++)n.push(`${a.slice(l).join(".")}-ext-file-icon`)}n.push("ext-file-icon")}const r=jpe(o,e,t);r&&n.push(`${gC(r)}-lang-file-icon`)}}return n}function jpe(o,e,t){if(!t)return null;let i=null;if(t.scheme===Ye.data){const s=Wc.parseMetaData(t).get(Wc.META_DATA_MIME);s&&(i=e.getLanguageIdByMimeType(s))}else{const n=o.getModel(t);n&&(i=n.getLanguageId())}return i&&i!==So?i:e.guessLanguageIdByFilepathOrFirstLine(t)}function gC(o){return o.replace(/[\11\12\14\15\40]/g,"/")}var qpe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},CD=function(o,e){return function(t,i){e(t,i,o)}},Nd;function eV(o){return`suggest-aria-id:${o}`}const Gpe=Di("suggest-more-info",he.chevronRight,p("suggestMoreInfoIcon","Icon for more information in the suggest widget.")),Zpe=new(Nd=class{extract(e,t){if(e.textLabel.match(Nd._regexStrict))return t[0]=e.textLabel,!0;if(e.completion.detail&&e.completion.detail.match(Nd._regexStrict))return t[0]=e.completion.detail,!0;if(typeof e.completion.documentation=="string"){const i=Nd._regexRelaxed.exec(e.completion.documentation);if(i&&(i.index===0||i.index+i[0].length===e.completion.documentation.length))return t[0]=i[0],!0}return!1}},Nd._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/,Nd._regexStrict=new RegExp(`^${Nd._regexRelaxed.source}$`,"i"),Nd);let iT=class{constructor(e,t,i,n){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=n,this._onDidToggleDetails=new W,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=new se,i=e;i.classList.add("show-file-icons");const n=ie(e,pe(".icon")),s=ie(n,pe("span.colorspan")),r=ie(e,pe(".contents")),a=ie(r,pe(".main")),l=ie(a,pe(".icon-label.codicon")),d=ie(a,pe("span.left")),c=ie(a,pe("span.right")),h=new Lw(d,{supportHighlights:!0,supportIcons:!0});t.add(h);const u=ie(d,pe("span.signature-label")),g=ie(d,pe("span.qualifier-label")),f=ie(c,pe("span.details-label")),m=ie(c,pe("span.readMore"+Re.asCSSSelector(Gpe)));m.title=p("readMore","Read More");const _=()=>{const v=this._editor.getOptions(),b=v.get(50),C=b.getMassagedFontFamily(),w=b.fontFeatureSettings,y=v.get(118)||b.fontSize,I=v.get(119)||b.lineHeight,D=b.fontWeight,T=b.letterSpacing,P=`${y}px`,H=`${I}px`,Y=`${T}px`;i.style.fontSize=P,i.style.fontWeight=D,i.style.letterSpacing=Y,a.style.fontFamily=C,a.style.fontFeatureSettings=w,a.style.lineHeight=H,n.style.height=H,n.style.width=H,m.style.height=H,m.style.width=H};return _(),t.add(this._editor.onDidChangeConfiguration(v=>{(v.hasChanged(50)||v.hasChanged(118)||v.hasChanged(119))&&_()})),{root:i,left:d,right:c,icon:n,colorspan:s,iconLabel:h,iconContainer:l,parametersLabel:u,qualifierLabel:g,detailsLabel:f,readMore:m,disposables:t}}renderElement(e,t,i){const{completion:n}=e;i.root.id=eV(t),i.colorspan.style.backgroundColor="";const s={labelEscapeNewLines:!0,matches:ry(e.score)},r=[];if(n.kind===19&&Zpe.extract(e,r))i.icon.className="icon customcolor",i.iconContainer.className="icon hide",i.colorspan.style.backgroundColor=r[0];else if(n.kind===20&&this._themeService.getFileIconTheme().hasFileIcons){i.icon.className="icon hide",i.iconContainer.className="icon hide";const a=uC(this._modelService,this._languageService,Me.from({scheme:"fake",path:e.textLabel}),Xa.FILE),l=uC(this._modelService,this._languageService,Me.from({scheme:"fake",path:n.detail}),Xa.FILE);s.extraClasses=a.length>l.length?a:l}else n.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons?(i.icon.className="icon hide",i.iconContainer.className="icon hide",s.extraClasses=[uC(this._modelService,this._languageService,Me.from({scheme:"fake",path:e.textLabel}),Xa.FOLDER),uC(this._modelService,this._languageService,Me.from({scheme:"fake",path:n.detail}),Xa.FOLDER)].flat()):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...Re.asClassNameArray(B_.toIcon(n.kind))));n.tags&&n.tags.indexOf(1)>=0&&(s.extraClasses=(s.extraClasses||[]).concat(["deprecated"]),s.matches=[]),i.iconLabel.setLabel(e.textLabel,void 0,s),typeof n.label=="string"?(i.parametersLabel.textContent="",i.detailsLabel.textContent=wD(n.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=wD(n.label.detail||""),i.detailsLabel.textContent=wD(n.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(117).showInlineDetails?Os(i.detailsLabel):is(i.detailsLabel),KR(e)?(i.right.classList.add("can-expand-details"),Os(i.readMore),i.readMore.onmousedown=a=>{a.stopPropagation(),a.preventDefault()},i.readMore.onclick=a=>{a.stopPropagation(),a.preventDefault(),this._onDidToggleDetails.fire()}):(i.right.classList.remove("can-expand-details"),is(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};iT=qpe([CD(1,ii),CD(2,ni),CD(3,tn)],iT);function wD(o){return o.replace(/\r\n|\r|\n/g,"")}var Ype=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},fC=function(o,e){return function(t,i){e(t,i,o)}},Vg;R("editorSuggestWidget.background",{dark:mi,light:mi,hcDark:mi,hcLight:mi},p("editorSuggestWidgetBackground","Background color of the suggest widget."));R("editorSuggestWidget.border",{dark:qa,light:qa,hcDark:qa,hcLight:qa},p("editorSuggestWidgetBorder","Border color of the suggest widget."));const pC=R("editorSuggestWidget.foreground",{dark:cr,light:cr,hcDark:cr,hcLight:cr},p("editorSuggestWidgetForeground","Foreground color of the suggest widget."));R("editorSuggestWidget.selectedForeground",{dark:Jh,light:Jh,hcDark:Jh,hcLight:Jh},p("editorSuggestWidgetSelectedForeground","Foreground color of the selected entry in the suggest widget."));R("editorSuggestWidget.selectedIconForeground",{dark:Yg,light:Yg,hcDark:Yg,hcLight:Yg},p("editorSuggestWidgetSelectedIconForeground","Icon foreground color of the selected entry in the suggest widget."));const Xpe=R("editorSuggestWidget.selectedBackground",{dark:eu,light:eu,hcDark:eu,hcLight:eu},p("editorSuggestWidgetSelectedBackground","Background color of the selected entry in the suggest widget."));R("editorSuggestWidget.highlightForeground",{dark:hr,light:hr,hcDark:hr,hcLight:hr},p("editorSuggestWidgetHighlightForeground","Color of the match highlights in the suggest widget."));R("editorSuggestWidget.focusHighlightForeground",{dark:hb,light:hb,hcDark:hb,hcLight:hb},p("editorSuggestWidgetFocusHighlightForeground","Color of the match highlights in the suggest widget when an item is focused."));R("editorSuggestWidgetStatus.foreground",{dark:Ee(pC,.5),light:Ee(pC,.5),hcDark:Ee(pC,.5),hcLight:Ee(pC,.5)},p("editorSuggestWidgetStatusForeground","Foreground color of the suggest widget status."));class Qpe{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof Gc}`}restore(){var e;const t=(e=this._service.get(this._key,0))!==null&&e!==void 0?e:"";try{const i=JSON.parse(t);if(bt.is(i))return bt.lift(i)}catch{}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}}let X0=Vg=class{constructor(e,t,i,n,s){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._pendingLayout=new Cn,this._pendingShowDetails=new Cn,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new Cr,this._disposables=new se,this._onDidSelect=new vu,this._onDidFocus=new vu,this._onDidHide=new W,this._onDidShow=new W,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new W,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new yR,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new Jpe(this,e),this._persistedSize=new Qpe(t,e);class r{constructor(g,f,m=!1,_=!1){this.persistedSize=g,this.currentSize=f,this.persistHeight=m,this.persistWidth=_}}let a;this._disposables.add(this.element.onDidWillResize(()=>{this._contentWidget.lockPreference(),a=new r(this._persistedSize.restore(),this.element.size)})),this._disposables.add(this.element.onDidResize(u=>{var g,f,m,_;if(this._resize(u.dimension.width,u.dimension.height),a&&(a.persistHeight=a.persistHeight||!!u.north||!!u.south,a.persistWidth=a.persistWidth||!!u.east||!!u.west),!!u.done){if(a){const{itemHeight:v,defaultSize:b}=this.getLayoutInfo(),C=Math.round(v/2);let{width:w,height:y}=this.element.size;(!a.persistHeight||Math.abs(a.currentSize.height-y)<=C)&&(y=(f=(g=a.persistedSize)===null||g===void 0?void 0:g.height)!==null&&f!==void 0?f:b.height),(!a.persistWidth||Math.abs(a.currentSize.width-w)<=C)&&(w=(_=(m=a.persistedSize)===null||m===void 0?void 0:m.width)!==null&&_!==void 0?_:b.width),this._persistedSize.store(new bt(w,y))}this._contentWidget.unlockPreference(),a=void 0}})),this._messageElement=ie(this.element.domNode,pe(".message")),this._listElement=ie(this.element.domNode,pe(".tree"));const l=this._disposables.add(s.createInstance(tT,this.editor));l.onDidClose(this.toggleDetails,this,this._disposables),this._details=new $pe(l,this.editor);const d=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(117).showIcons);d();const c=s.createInstance(iT,this.editor);this._disposables.add(c),this._disposables.add(c.onDidToggleDetails(()=>this.toggleDetails())),this._list=new yr("SuggestWidget",this._listElement,{getHeight:u=>this.getLayoutInfo().itemHeight,getTemplateId:u=>"suggestion"},[c],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>p("suggest","Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:u=>{let g=u.textLabel;if(typeof u.completion.label!="string"){const{detail:v,description:b}=u.completion.label;v&&b?g=p("label.full","{0} {1}, {2}",g,v,b):v?g=p("label.detail","{0} {1}",g,v):b&&(g=p("label.desc","{0}, {1}",g,b))}if(!u.isResolved||!this._isDetailsVisible())return g;const{documentation:f,detail:m}=u.completion,_=jf("{0}{1}",m||"",f?typeof f=="string"?f:f.value:"");return p("ariaCurrenttSuggestionReadDetails","{0}, docs: {1}",g,_)}}}),this._list.style(zp({listInactiveFocusBackground:Xpe,listInactiveFocusOutline:Zt})),this._status=s.createInstance(eT,this.element.domNode,xc);const h=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(117).showStatusBar);h(),this._disposables.add(n.onDidColorThemeChange(u=>this._onThemeChange(u))),this._onThemeChange(n.getColorTheme()),this._disposables.add(this._list.onMouseDown(u=>this._onListMouseDownOrTap(u))),this._disposables.add(this._list.onTap(u=>this._onListMouseDownOrTap(u))),this._disposables.add(this._list.onDidChangeSelection(u=>this._onListSelection(u))),this._disposables.add(this._list.onDidChangeFocus(u=>this._onListFocus(u))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(u=>{u.hasChanged(117)&&(h(),d())})),this._ctxSuggestWidgetVisible=Qe.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=Qe.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=Qe.MultipleSuggestions.bindTo(i),this._ctxSuggestWidgetHasFocusedSuggestion=Qe.HasFocusedSuggestion.bindTo(i),this._disposables.add(vi(this._details.widget.domNode,"keydown",u=>{this._onDetailsKeydown.fire(u)})),this._disposables.add(this.editor.onMouseDown(u=>this._onEditorMouseDown(u)))}dispose(){var e;this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),(e=this._loadingTimeout)===null||e===void 0||e.dispose(),this._pendingLayout.dispose(),this._pendingShowDetails.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose()}_onEditorMouseDown(e){this._details.widget.domNode.contains(e.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(e.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){this._state!==0&&this._contentWidget.layout()}_onListMouseDownOrTap(e){typeof e.element>"u"||typeof e.index>"u"||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation(),this._select(e.element,e.index))}_onListSelection(e){e.elements.length&&this._select(e.elements[0],e.indexes[0])}_select(e,t){const i=this._completionModel;i&&(this._onDidSelect.fire({item:e,index:t,model:i}),this.editor.focus())}_onThemeChange(e){this._details.widget.borderWidth=il(e.type)?2:1}_onListFocus(e){var t;if(this._ignoreFocusEvents)return;if(!e.elements.length){this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0),this.editor.setAriaOptions({activeDescendant:void 0}),this._ctxSuggestWidgetHasFocusedSuggestion.set(!1);return}if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);const i=e.elements[0],n=e.indexes[0];i!==this._focusedItem&&((t=this._currentSuggestionDetails)===null||t===void 0||t.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=i,this._list.reveal(n),this._currentSuggestionDetails=Zi(async s=>{const r=Rc(()=>{this._isDetailsVisible()&&this.showDetails(!0)},250),a=s.onCancellationRequested(()=>r.dispose());try{return await i.resolve(s)}finally{r.dispose(),a.dispose()}}),this._currentSuggestionDetails.then(()=>{n>=this._list.length||i!==this._list.element(n)||(this._ignoreFocusEvents=!0,this._list.splice(n,1,[i]),this._list.setFocus([n]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this.showDetails(!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:eV(n)}))}).catch(Ge)),this._onDidFocus.fire({item:i,index:n,model:this._completionModel})}_setState(e){if(this._state!==e)switch(this._state=e,this.element.domNode.classList.toggle("frozen",e===4),this.element.domNode.classList.remove("message"),e){case 0:is(this._messageElement,this._listElement,this._status.element),this._details.hide(!0),this._status.hide(),this._contentWidget.hide(),this._ctxSuggestWidgetVisible.reset(),this._ctxSuggestWidgetMultipleSuggestions.reset(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=Vg.LOADING_MESSAGE,is(this._listElement,this._status.element),Os(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Du(Vg.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=Vg.NO_SUGGESTIONS_MESSAGE,is(this._listElement,this._status.element),Os(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Du(Vg.NO_SUGGESTIONS_MESSAGE);break;case 3:is(this._messageElement),Os(this._listElement,this._status.element),this._show();break;case 4:is(this._messageElement),Os(this._listElement,this._status.element),this._show();break;case 5:is(this._messageElement),Os(this._listElement,this._status.element),this._details.show(),this._show();break}}_show(){this._status.show(),this._contentWidget.show(),this._layout(this._persistedSize.restore()),this._ctxSuggestWidgetVisible.set(!0),this._showTimeout.cancelAndSet(()=>{this.element.domNode.classList.add("visible"),this._onDidShow.fire(this)},100)}showTriggered(e,t){this._state===0&&(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!e,this._isAuto||(this._loadingTimeout=Rc(()=>this._setState(1),t)))}showSuggestions(e,t,i,n,s){var r,a;if(this._contentWidget.setPosition(this.editor.getPosition()),(r=this._loadingTimeout)===null||r===void 0||r.dispose(),(a=this._currentSuggestionDetails)===null||a===void 0||a.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==e&&(this._completionModel=e),i&&this._state!==2&&this._state!==0){this._setState(4);return}const l=this._completionModel.items.length,d=l===0;if(this._ctxSuggestWidgetMultipleSuggestions.set(l>1),d){this._setState(n?0:2),this._completionModel=void 0;return}this._focusedItem=void 0,this._onDidFocus.pause(),this._onDidSelect.pause();try{this._list.splice(0,this._list.length,this._completionModel.items),this._setState(i?4:3),this._list.reveal(t,0),this._list.setFocus(s?[]:[t])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=C1(Ue(this.element.domNode),()=>{this._pendingLayout.clear(),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")})}focusSelected(){this._list.length>0&&this._list.setFocus([0])}selectNextPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageDown(),!0;case 1:return!this._isAuto;default:return this._list.focusNextPage(),!0}}selectNext(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusNext(1,!0),!0}}selectLast(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollBottom(),!0;case 1:return!this._isAuto;default:return this._list.focusLast(),!0}}selectPreviousPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageUp(),!0;case 1:return!this._isAuto;default:return this._list.focusPreviousPage(),!0}}selectPrevious(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusPrevious(1,!0),!1}}selectFirst(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollTop(),!0;case 1:return!this._isAuto;default:return this._list.focusFirst(),!0}}getFocusedItem(){if(this._state!==0&&this._state!==2&&this._state!==1&&this._completionModel&&this._list.getFocus().length>0)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}toggleDetailsFocus(){this._state===5?(this._setState(3),this._details.widget.domNode.classList.remove("focused")):this._state===3&&this._isDetailsVisible()&&(this._setState(5),this._details.widget.domNode.classList.add("focused"))}toggleDetails(){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):(KR(this._list.getFocusedElements()[0])||this._explainMode)&&(this._state===3||this._state===5||this._state===4)&&(this._ctxSuggestWidgetDetailsVisible.set(!0),this._setDetailsVisible(!0),this.showDetails(!1))}showDetails(e){this._pendingShowDetails.value=C1(Ue(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show(),e?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._positionDetails(),this.editor.focus(),this.element.domNode.classList.add("shows-details")})}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this.showDetails(!1):this.toggleDetails())}resetPersistedSize(){this._persistedSize.reset()}hideWidget(){var e;this._pendingLayout.clear(),this._pendingShowDetails.clear(),(e=this._loadingTimeout)===null||e===void 0||e.dispose(),this._setState(0),this._onDidHide.fire(this),this.element.clearSashHoverState();const t=this._persistedSize.restore(),i=Math.ceil(this.getLayoutInfo().itemHeight*4.3);t&&t.height<i&&this._persistedSize.store(t.with(void 0,i))}isFrozen(){return this._state===4}_afterRender(e){if(e===null){this._isDetailsVisible()&&this._details.hide();return}this._state===2||this._state===1||(this._isDetailsVisible()&&this._details.show(),this._positionDetails())}_layout(e){var t,i,n;if(!this.editor.hasModel()||!this.editor.getDomNode())return;const s=Lu(this.element.domNode.ownerDocument.body),r=this.getLayoutInfo();e||(e=r.defaultSize);let a=e.height,l=e.width;if(this._status.element.style.height=`${r.itemHeight}px`,this._state===2||this._state===1)a=r.itemHeight+r.borderHeight,l=r.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new bt(l,a),this._contentWidget.setPreference(2);else{const d=s.width-r.borderHeight-2*r.horizontalPadding;l>d&&(l=d);const c=this._completionModel?this._completionModel.stats.pLabelLen*r.typicalHalfwidthCharacterWidth:l,h=r.statusBarHeight+this._list.contentHeight+r.borderHeight,u=r.itemHeight+r.statusBarHeight,g=ji(this.editor.getDomNode()),f=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),m=g.top+f.top+f.height,_=Math.min(s.height-m-r.verticalPadding,h),v=g.top+f.top-r.verticalPadding,b=Math.min(v,h);let C=Math.min(Math.max(b,_)+r.borderHeight,h);a===((t=this._cappedHeight)===null||t===void 0?void 0:t.capped)&&(a=this._cappedHeight.wanted),a<u&&(a=u),a>C&&(a=C),a>_||this._forceRenderingAbove&&v>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),C=b):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),C=_),this.element.preferredSize=new bt(c,r.defaultSize.height),this.element.maxSize=new bt(d,C),this.element.minSize=new bt(220,u),this._cappedHeight=a===h?{wanted:(n=(i=this._cappedHeight)===null||i===void 0?void 0:i.wanted)!==null&&n!==void 0?n:e.height,capped:a}:void 0}this._resize(l,a)}_resize(e,t){const{width:i,height:n}=this.element.maxSize;e=Math.min(i,e),t=Math.min(n,t);const{statusBarHeight:s}=this.getLayoutInfo();this._list.layout(t-s,e),this._listElement.style.height=`${t-s}px`,this.element.layout(t,e),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){var e;this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,((e=this._contentWidget.getPosition())===null||e===void 0?void 0:e.preference[0])===2)}getLayoutInfo(){const e=this.editor.getOption(50),t=Ms(this.editor.getOption(119)||e.lineHeight,8,1e3),i=!this.editor.getOption(117).showStatusBar||this._state===2||this._state===1?0:t,n=this._details.widget.borderWidth,s=2*n;return{itemHeight:t,statusBarHeight:i,borderWidth:n,borderHeight:s,typicalHalfwidthCharacterWidth:e.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new bt(430,i+12*t+s)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(e){this._storageService.store("expandSuggestionDocs",e,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}};X0.LOADING_MESSAGE=p("suggestWidget.loading","Loading...");X0.NO_SUGGESTIONS_MESSAGE=p("suggestWidget.noSuggestions","No suggestions.");X0=Vg=Ype([fC(1,da),fC(2,We),fC(3,tn),fC(4,Oe)],X0);class Jpe{constructor(e,t){this._widget=e,this._editor=t,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._preferenceLocked=!1,this._added=!1,this._hidden=!1}dispose(){this._added&&(this._added=!1,this._editor.removeContentWidget(this))}getId(){return"editor.widget.suggestWidget"}getDomNode(){return this._widget.element.domNode}show(){this._hidden=!1,this._added||(this._added=!0,this._editor.addContentWidget(this))}hide(){this._hidden||(this._hidden=!0,this.layout())}layout(){this._editor.layoutContentWidget(this)}getPosition(){return this._hidden||!this._position||!this._preference?null:{position:this._position,preference:[this._preference]}}beforeRender(){const{height:e,width:t}=this._widget.element.size,{borderWidth:i,horizontalPadding:n}=this._widget.getLayoutInfo();return new bt(t+2*i+n,e+2*i)}afterRender(e){this._widget._afterRender(e)}setPreference(e){this._preferenceLocked||(this._preference=e)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(e){this._position=e}}var eme=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Mg=function(o,e){return function(t,i){e(t,i,o)}},nT;class tme{constructor(e,t){if(this._model=e,this._position=t,e.getLineMaxColumn(t.lineNumber)!==t.column){const n=e.getOffsetAt(t),s=e.getPositionAt(n+1);this._marker=e.deltaDecorations([],[{range:k.fromPositions(t,s),options:{description:"suggest-line-suffix",stickiness:1}}])}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.deltaDecorations(this._marker,[])}delta(e){if(this._model.isDisposed()||this._position.lineNumber!==e.lineNumber)return 0;if(this._marker){const t=this._model.getDecorationRange(this._marker[0]);return this._model.getOffsetAt(t.getStartPosition())-this._model.getOffsetAt(e)}else return this._model.getLineMaxColumn(e.lineNumber)-e.column}}let gr=nT=class{static get(e){return e.getContribution(nT.ID)}constructor(e,t,i,n,s,r,a){this._memoryService=t,this._commandService=i,this._contextKeyService=n,this._instantiationService=s,this._logService=r,this._telemetryService=a,this._lineSuffix=new Cn,this._toDispose=new se,this._selectors=new ime(h=>h.priority),this._onWillInsertSuggestItem=new W,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=e,this.model=s.createInstance(JN,this.editor),this._selectors.register({priority:0,select:(h,u,g)=>this._memoryService.select(h,u,g)});const l=Qe.InsertMode.bindTo(n);l.set(e.getOption(117).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>l.set(e.getOption(117).insertMode))),this.widget=this._toDispose.add(new WL(Ue(e.getDomNode()),()=>{const h=this._instantiationService.createInstance(X0,this.editor);this._toDispose.add(h),this._toDispose.add(h.onDidSelect(_=>this._insertSuggestion(_,0),this));const u=new Fpe(this.editor,h,this.model,_=>this._insertSuggestion(_,2));this._toDispose.add(u);const g=Qe.MakesTextEdit.bindTo(this._contextKeyService),f=Qe.HasInsertAndReplaceRange.bindTo(this._contextKeyService),m=Qe.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(Ae(()=>{g.reset(),f.reset(),m.reset()})),this._toDispose.add(h.onDidFocus(({item:_})=>{const v=this.editor.getPosition(),b=_.editStart.column,C=v.column;let w=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!_.completion.additionalTextEdits&&!(_.completion.insertTextRules&4)&&C-b===_.completion.insertText.length&&(w=this.editor.getModel().getValueInRange({startLineNumber:v.lineNumber,startColumn:b,endLineNumber:v.lineNumber,endColumn:C})!==_.completion.insertText),g.set(w),f.set(!V.equals(_.editInsertEnd,_.editReplaceEnd)),m.set(!!_.provider.resolveCompletionItem||!!_.completion.documentation||_.completion.detail!==_.completion.label)})),this._toDispose.add(h.onDetailsKeyDown(_=>{if(_.toKeyCodeChord().equals(new gd(!0,!1,!1,!1,33))||ut&&_.toKeyCodeChord().equals(new gd(!1,!1,!1,!0,33))){_.stopPropagation();return}_.toKeyCodeChord().isModifierKey()||this.editor.focus()})),h})),this._overtypingCapturer=this._toDispose.add(new WL(Ue(e.getDomNode()),()=>this._toDispose.add(new Jy(this.editor,this.model)))),this._alternatives=this._toDispose.add(new WL(Ue(e.getDomNode()),()=>this._toDispose.add(new Ku(this.editor,this._contextKeyService)))),this._toDispose.add(s.createInstance(Y0,e)),this._toDispose.add(this.model.onDidTrigger(h=>{this.widget.value.showTriggered(h.auto,h.shy?250:50),this._lineSuffix.value=new tme(this.editor.getModel(),h.position)})),this._toDispose.add(this.model.onDidSuggest(h=>{if(h.triggerOptions.shy)return;let u=-1;for(const f of this._selectors.itemsOrderedByPriorityDesc)if(u=f.select(this.editor.getModel(),this.editor.getPosition(),h.completionModel.items),u!==-1)break;u===-1&&(u=0);let g=!1;if(h.triggerOptions.auto){const f=this.editor.getOption(117);f.selectionMode==="never"||f.selectionMode==="always"?g=f.selectionMode==="never":f.selectionMode==="whenTriggerCharacter"?g=h.triggerOptions.triggerKind!==1:f.selectionMode==="whenQuickSuggestion"&&(g=h.triggerOptions.triggerKind===1&&!h.triggerOptions.refilter)}this.widget.value.showSuggestions(h.completionModel,u,h.isFrozen,h.triggerOptions.auto,g)})),this._toDispose.add(this.model.onDidCancel(h=>{h.retrigger||this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{this.model.cancel(),this.model.clear()}));const d=Qe.AcceptSuggestionsOnEnter.bindTo(n),c=()=>{const h=this.editor.getOption(1);d.set(h==="on"||h==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>c())),c()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(e,t){if(!e||!e.item){this._alternatives.value.reset(),this.model.cancel(),this.model.clear();return}if(!this.editor.hasModel())return;const i=wn.get(this.editor);if(!i)return;this._onWillInsertSuggestItem.fire({item:e.item});const n=this.editor.getModel(),s=n.getAlternativeVersionId(),{item:r}=e,a=[],l=new Wi;t&1||this.editor.pushUndoStop();const d=this.getOverwriteInfo(r,!!(t&8));this._memoryService.memorize(n,this.editor.getPosition(),r);const c=r.isResolved;let h=-1,u=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const f=na.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(m=>oi.replaceMove(k.lift(m.range),m.text))),f.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!c){const f=new Hn;let m;const _=n.onDidChangeContent(w=>{if(w.isFlush){l.cancel(),_.dispose();return}for(const y of w.changes){const I=k.getEndPosition(y.range);(!m||V.isBefore(I,m))&&(m=I)}}),v=t;t|=2;let b=!1;const C=this.editor.onWillType(()=>{C.dispose(),b=!0,v&2||this.editor.pushUndoStop()});a.push(r.resolve(l.token).then(()=>{if(!r.completion.additionalTextEdits||l.token.isCancellationRequested)return;if(m&&r.completion.additionalTextEdits.some(y=>V.isBefore(m,k.getStartPosition(y.range))))return!1;b&&this.editor.pushUndoStop();const w=na.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(y=>oi.replaceMove(k.lift(y.range),y.text))),w.restoreRelativeVerticalPositionOfCursor(this.editor),(b||!(v&2))&&this.editor.pushUndoStop(),!0}).then(w=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",f.elapsed(),w),u=w===!0?1:w===!1?0:-2}).finally(()=>{_.dispose(),C.dispose()}))}let{insertText:g}=r.completion;if(r.completion.insertTextRules&4||(g=Dp.escape(g)),this.model.cancel(),i.insert(g,{overwriteBefore:d.overwriteBefore,overwriteAfter:d.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(r.completion.insertTextRules&1),clipboardText:e.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value}),t&2||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===Zv.id)this.model.trigger({auto:!0,retrigger:!0});else{const f=new Hn;a.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(m=>{r.completion.extensionId?Mi(m):Ge(m)}).finally(()=>{h=f.elapsed()}))}t&4&&this._alternatives.value.set(e,f=>{for(l.cancel();n.canUndo();){s!==n.getAlternativeVersionId()&&n.undo(),this._insertSuggestion(f,3|(t&8?8:0));break}}),this._alertCompletionItem(r),Promise.all(a).finally(()=>{this._reportSuggestionAcceptedTelemetry(r,n,c,h,u),this.model.clear(),l.dispose()})}_reportSuggestionAcceptedTelemetry(e,t,i,n,s){var r,a,l;Math.floor(Math.random()*100)!==0&&this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:(a=(r=e.extensionId)===null||r===void 0?void 0:r.value)!==null&&a!==void 0?a:"unknown",providerId:(l=e.provider._debugDisplayName)!==null&&l!==void 0?l:"unknown",kind:e.completion.kind,basenameHash:f2(qo(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:PQ(t.uri),resolveInfo:e.provider.resolveCompletionItem?i?1:0:-1,resolveDuration:e.resolveDuration,commandDuration:n,additionalEditsAsync:s})}getOverwriteInfo(e,t){Tt(this.editor.hasModel());let i=this.editor.getOption(117).insertMode==="replace";t&&(i=!i);const n=e.position.column-e.editStart.column,s=(i?e.editReplaceEnd.column:e.editInsertEnd.column)-e.position.column,r=this.editor.getPosition().column-e.position.column,a=this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0;return{overwriteBefore:n+r,overwriteAfter:s+a}}_alertCompletionItem(e){if(Bn(e.completion.additionalTextEdits)){const t=p("aria.alert.snippet","Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length);js(t)}}triggerSuggest(e,t,i){this.editor.hasModel()&&(this.model.trigger({auto:t??!1,completionOptions:{providerFilter:e,kindFilter:i?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(e){if(!this.editor.hasModel())return;const t=this.editor.getPosition(),i=()=>{t.equals(this.editor.getPosition())&&this._commandService.executeCommand(e.fallback)},n=s=>{if(s.completion.insertTextRules&4||s.completion.additionalTextEdits)return!0;const r=this.editor.getPosition(),a=s.editStart.column,l=r.column;return l-a!==s.completion.insertText.length?!0:this.editor.getModel().getValueInRange({startLineNumber:r.lineNumber,startColumn:a,endLineNumber:r.lineNumber,endColumn:l})!==s.completion.insertText};fe.once(this.model.onDidTrigger)(s=>{const r=[];fe.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{Et(r),i()},void 0,r),this.model.onDidSuggest(({completionModel:a})=>{if(Et(r),a.items.length===0){i();return}const l=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),a.items),d=a.items[l];if(!n(d)){i();return}this.editor.pushUndoStop(),this._insertSuggestion({index:l,item:d,model:a},7)},void 0,r)}),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(t,0),this.editor.focus()}acceptSelectedSuggestion(e,t){const i=this.widget.value.getFocusedItem();let n=0;e&&(n|=4),t&&(n|=8),this._insertSuggestion(i,n)}acceptNextSuggestion(){this._alternatives.value.next()}acceptPrevSuggestion(){this._alternatives.value.prev()}cancelSuggestWidget(){this.model.cancel(),this.model.clear(),this.widget.value.hideWidget()}focusSuggestion(){this.widget.value.focusSelected()}selectNextSuggestion(){this.widget.value.selectNext()}selectNextPageSuggestion(){this.widget.value.selectNextPage()}selectLastSuggestion(){this.widget.value.selectLast()}selectPrevSuggestion(){this.widget.value.selectPrevious()}selectPrevPageSuggestion(){this.widget.value.selectPreviousPage()}selectFirstSuggestion(){this.widget.value.selectFirst()}toggleSuggestionDetails(){this.widget.value.toggleDetails()}toggleExplainMode(){this.widget.value.toggleExplainMode()}toggleSuggestionFocus(){this.widget.value.toggleDetailsFocus()}resetWidgetSize(){this.widget.value.resetPersistedSize()}forceRenderingAbove(){this.widget.value.forceRenderingAbove()}stopForceRenderingAbove(){this.widget.isInitialized&&this.widget.value.stopForceRenderingAbove()}registerSelector(e){return this._selectors.register(e)}};gr.ID="editor.contrib.suggestController";gr=nT=eme([Mg(1,Qy),Mg(2,ui),Mg(3,We),Mg(4,Oe),Mg(5,Zs),Mg(6,Gs)],gr);class ime{constructor(e){this.prioritySelector=e,this._items=new Array}register(e){if(this._items.indexOf(e)!==-1)throw new Error("Value is already registered");return this._items.push(e),this._items.sort((t,i)=>this.prioritySelector(i)-this.prioritySelector(t)),{dispose:()=>{const t=this._items.indexOf(e);t>=0&&this._items.splice(t,1)}}}get itemsOrderedByPriorityDesc(){return this._items}}class Zv extends we{constructor(){super({id:Zv.id,label:p("suggest.trigger.label","Trigger Suggest"),alias:"Trigger Suggest",precondition:te.and(M.writable,M.hasCompletionItemProvider,Qe.Visible.toNegated()),kbOpts:{kbExpr:M.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const n=gr.get(t);if(!n)return;let s;i&&typeof i=="object"&&i.auto===!0&&(s=!0),n.triggerSuggest(void 0,s,void 0)}}Zv.id="editor.action.triggerSuggest";yt(gr.ID,gr,2);de(Zv);const xo=190,ps=cn.bindToContribution(gr.get);ue(new ps({id:"acceptSelectedSuggestion",precondition:te.and(Qe.Visible,Qe.HasFocusedSuggestion),handler(o){o.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:te.and(Qe.Visible,M.textInputFocus),weight:xo},{primary:3,kbExpr:te.and(Qe.Visible,M.textInputFocus,Qe.AcceptSuggestionsOnEnter,Qe.MakesTextEdit),weight:xo}],menuOpts:[{menuId:xc,title:p("accept.insert","Insert"),group:"left",order:1,when:Qe.HasInsertAndReplaceRange.toNegated()},{menuId:xc,title:p("accept.insert","Insert"),group:"left",order:1,when:te.and(Qe.HasInsertAndReplaceRange,Qe.InsertMode.isEqualTo("insert"))},{menuId:xc,title:p("accept.replace","Replace"),group:"left",order:1,when:te.and(Qe.HasInsertAndReplaceRange,Qe.InsertMode.isEqualTo("replace"))}]}));ue(new ps({id:"acceptAlternativeSelectedSuggestion",precondition:te.and(Qe.Visible,M.textInputFocus,Qe.HasFocusedSuggestion),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:1027,secondary:[1026]},handler(o){o.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:xc,group:"left",order:2,when:te.and(Qe.HasInsertAndReplaceRange,Qe.InsertMode.isEqualTo("insert")),title:p("accept.replace","Replace")},{menuId:xc,group:"left",order:2,when:te.and(Qe.HasInsertAndReplaceRange,Qe.InsertMode.isEqualTo("replace")),title:p("accept.insert","Insert")}]}));gt.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");ue(new ps({id:"hideSuggestWidget",precondition:Qe.Visible,handler:o=>o.cancelSuggestWidget(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:9,secondary:[1033]}}));ue(new ps({id:"selectNextSuggestion",precondition:te.and(Qe.Visible,te.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:o=>o.selectNextSuggestion(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}}));ue(new ps({id:"selectNextPageSuggestion",precondition:te.and(Qe.Visible,te.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:o=>o.selectNextPageSuggestion(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:12,secondary:[2060]}}));ue(new ps({id:"selectLastSuggestion",precondition:te.and(Qe.Visible,te.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:o=>o.selectLastSuggestion()}));ue(new ps({id:"selectPrevSuggestion",precondition:te.and(Qe.Visible,te.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevSuggestion(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));ue(new ps({id:"selectPrevPageSuggestion",precondition:te.and(Qe.Visible,te.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevPageSuggestion(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:11,secondary:[2059]}}));ue(new ps({id:"selectFirstSuggestion",precondition:te.and(Qe.Visible,te.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:o=>o.selectFirstSuggestion()}));ue(new ps({id:"focusSuggestion",precondition:te.and(Qe.Visible,Qe.HasFocusedSuggestion.negate()),handler:o=>o.focusSuggestion(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));ue(new ps({id:"focusAndAcceptSuggestion",precondition:te.and(Qe.Visible,Qe.HasFocusedSuggestion.negate()),handler:o=>{o.focusSuggestion(),o.acceptSelectedSuggestion(!0,!1)}}));ue(new ps({id:"toggleSuggestionDetails",precondition:te.and(Qe.Visible,Qe.HasFocusedSuggestion),handler:o=>o.toggleSuggestionDetails(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:xc,group:"right",order:1,when:te.and(Qe.DetailsVisible,Qe.CanResolve),title:p("detail.more","show less")},{menuId:xc,group:"right",order:1,when:te.and(Qe.DetailsVisible.toNegated(),Qe.CanResolve),title:p("detail.less","show more")}]}));ue(new ps({id:"toggleExplainMode",precondition:Qe.Visible,handler:o=>o.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));ue(new ps({id:"toggleSuggestionFocus",precondition:Qe.Visible,handler:o=>o.toggleSuggestionFocus(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:2570,mac:{primary:778}}}));ue(new ps({id:"insertBestCompletion",precondition:te.and(M.textInputFocus,te.equals("config.editor.tabCompletion","on"),Y0.AtEnd,Qe.Visible.toNegated(),Ku.OtherSuggestions.toNegated(),wn.InSnippetMode.toNegated()),handler:(o,e)=>{o.triggerSuggestAndAcceptBest(os(e)?{fallback:"tab",...e}:{fallback:"tab"})},kbOpts:{weight:xo,primary:2}}));ue(new ps({id:"insertNextSuggestion",precondition:te.and(M.textInputFocus,te.equals("config.editor.tabCompletion","on"),Ku.OtherSuggestions,Qe.Visible.toNegated(),wn.InSnippetMode.toNegated()),handler:o=>o.acceptNextSuggestion(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:2}}));ue(new ps({id:"insertPrevSuggestion",precondition:te.and(M.textInputFocus,te.equals("config.editor.tabCompletion","on"),Ku.OtherSuggestions,Qe.Visible.toNegated(),wn.InSnippetMode.toNegated()),handler:o=>o.acceptPrevSuggestion(),kbOpts:{weight:xo,kbExpr:M.textInputFocus,primary:1026}}));de(class extends we{constructor(){super({id:"editor.action.resetSuggestSize",label:p("suggest.reset.label","Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(o,e){var t;(t=gr.get(e))===null||t===void 0||t.resetWidgetSize()}});class nme extends K{get selectedItem(){return this._selectedItem}constructor(e,t,i,n){super(),this.editor=e,this.suggestControllerPreselector=t,this.checkModelVersion=i,this.onWillAccept=n,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._selectedItem=Ct(this,void 0),this._register(e.onKeyDown(r=>{r.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))})),this._register(e.onKeyUp(r=>{r.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))}));const s=gr.get(this.editor);if(s){this._register(s.registerSelector({priority:100,select:(l,d,c)=>{var h;ti(v=>this.checkModelVersion(v));const u=this.editor.getModel();if(!u)return-1;const g=(h=this.suggestControllerPreselector())===null||h===void 0?void 0:h.removeCommonPrefix(u);if(!g)return-1;const f=V.lift(d),m=c.map((v,b)=>{const w=I_.fromSuggestion(s,u,f,v,this.isShiftKeyPressed).toSingleTextEdit().removeCommonPrefix(u),y=g.augments(w);return{index:b,valid:y,prefixLength:w.text.length,suggestItem:v}}).filter(v=>v&&v.valid&&v.prefixLength>0),_=L2(m,Bo(v=>v.prefixLength,nd));return _?_.index:-1}}));let r=!1;const a=()=>{r||(r=!0,this._register(s.widget.value.onDidShow(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})),this._register(s.widget.value.onDidHide(()=>{this.isSuggestWidgetVisible=!1,this.update(!1)})),this._register(s.widget.value.onDidFocus(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})))};this._register(fe.once(s.model.onDidTrigger)(l=>{a()})),this._register(s.onWillInsertSuggestItem(l=>{const d=this.editor.getPosition(),c=this.editor.getModel();if(!d||!c)return;const h=I_.fromSuggestion(s,c,d,l.item,this.isShiftKeyPressed);this.onWillAccept(h)}))}this.update(this._isActive)}update(e){const t=this.getSuggestItemInfo();(this._isActive!==e||!sme(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,ti(i=>{this.checkModelVersion(i),this._selectedItem.set(this._isActive?this._currentSuggestItemInfo:void 0,i)}))}getSuggestItemInfo(){const e=gr.get(this.editor);if(!e||!this.isSuggestWidgetVisible)return;const t=e.widget.value.getFocusedItem(),i=this.editor.getPosition(),n=this.editor.getModel();if(!(!t||!i||!n))return I_.fromSuggestion(e,n,i,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){const e=gr.get(this.editor);e?.stopForceRenderingAbove()}forceRenderingAbove(){const e=gr.get(this.editor);e?.forceRenderingAbove()}}class I_{static fromSuggestion(e,t,i,n,s){let{insertText:r}=n.completion,a=!1;if(n.completion.insertTextRules&4){const d=new Dp().parse(r);d.children.length<100&&iS.adjustWhitespace(t,i,!0,d),r=d.toString(),a=!0}const l=e.getOverwriteInfo(n,s);return new I_(k.fromPositions(i.delta(0,-l.overwriteBefore),i.delta(0,Math.max(l.overwriteAfter,0))),r,n.completion.kind,a)}constructor(e,t,i,n){this.range=e,this.insertText=t,this.completionItemKind=i,this.isSnippetText=n}equals(e){return this.range.equalsRange(e.range)&&this.insertText===e.insertText&&this.completionItemKind===e.completionItemKind&&this.isSnippetText===e.isSnippetText}toSelectedSuggestionInfo(){return new K3(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new kp(this.range,this.insertText)}}function sme(o,e){return o===e?!0:!o||!e?!1:o.equals(e)}var ome=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Td=function(o,e){return function(t,i){e(t,i,o)}},sT;let Do=sT=class extends K{static get(e){return e.getContribution(sT.ID)}constructor(e,t,i,n,s,r,a,l,d){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._configurationService=n,this._commandService=s,this._debounceService=r,this._languageFeaturesService=a,this._audioCueService=l,this._keybindingService=d,this.model=Iw("inlineCompletionModel",void 0),this._textModelVersionId=Ct(this,-1),this._cursorPosition=Ct(this,new V(1,1)),this._suggestWidgetAdaptor=this._register(new nme(this.editor,()=>{var u,g;return(g=(u=this.model.get())===null||u===void 0?void 0:u.selectedInlineCompletion.get())===null||g===void 0?void 0:g.toSingleTextEdit(void 0)},u=>this.updateObservables(u,ro.Other),u=>{ti(g=>{var f;this.updateObservables(g,ro.Other),(f=this.model.get())===null||f===void 0||f.handleSuggestAccepted(u)})})),this._enabled=pi(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).enabled),this._ghostTextWidget=this._register(this._instantiationService.createInstance(GN,this.editor,{ghostText:this.model.map((u,g)=>u?.ghostText.read(g)),minReservedLineCount:Ew(0),targetTextModel:this.model.map(u=>u?.textModel)})),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this._playAudioCueSignal=nR(this),this._isReadonly=pi(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(90)),this._textModel=pi(this.editor.onDidChangeModel,()=>this.editor.getModel()),this._textModelIfWritable=Xe(u=>this._isReadonly.read(u)?void 0:this._textModel.read(u)),this._register(new ln(this._contextKeyService,this.model)),this._register(xt(u=>{const g=this._textModelIfWritable.read(u);ti(f=>{if(this.model.set(void 0,f),this.updateObservables(f,ro.Other),g){const m=t.createInstance(YN,g,this._suggestWidgetAdaptor.selectedItem,this._cursorPosition,this._textModelVersionId,this._debounceValue,pi(e.onDidChangeConfiguration,()=>e.getOption(117).preview),pi(e.onDidChangeConfiguration,()=>e.getOption(117).previewMode),pi(e.onDidChangeConfiguration,()=>e.getOption(62).mode),this._enabled);this.model.set(m,f)}})}));const c=u=>{var g;return u.isUndoing?ro.Undo:u.isRedoing?ro.Redo:!((g=this.model.get())===null||g===void 0)&&g.isAcceptingPartially?ro.AcceptWord:ro.Other};this._register(e.onDidChangeModelContent(u=>ti(g=>this.updateObservables(g,c(u))))),this._register(e.onDidChangeCursorPosition(u=>ti(g=>{var f;this.updateObservables(g,ro.Other),(u.reason===3||u.source==="api")&&((f=this.model.get())===null||f===void 0||f.stop(g))}))),this._register(e.onDidType(()=>ti(u=>{var g;this.updateObservables(u,ro.Other),this._enabled.get()&&((g=this.model.get())===null||g===void 0||g.trigger(u))}))),this._register(this._commandService.onDidExecuteCommand(u=>{new Set([If.Tab.id,If.DeleteLeft.id,If.DeleteRight.id,gW,"acceptSelectedSuggestion"]).has(u.commandId)&&e.hasTextFocus()&&this._enabled.get()&&ti(f=>{var m;(m=this.model.get())===null||m===void 0||m.trigger(f)})})),this._register(this.editor.onDidBlurEditorWidget(()=>{this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(62).keepOnBlur||Xc.dropDownVisible||ti(u=>{var g;(g=this.model.get())===null||g===void 0||g.stop(u)})})),this._register(xt(u=>{var g;const f=(g=this.model.read(u))===null||g===void 0?void 0:g.state.read(u);f?.suggestItem?f.ghostText.lineCount>=2&&this._suggestWidgetAdaptor.forceRenderingAbove():this._suggestWidgetAdaptor.stopForceRenderingAbove()})),this._register(Ae(()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}));let h;this._register(Fv({handleChange:(u,g)=>(u.didChange(this._playAudioCueSignal)&&(h=void 0),!0)},async u=>{this._playAudioCueSignal.read(u);const g=this.model.read(u),f=g?.state.read(u);if(!g||!f||!f.inlineCompletion){h=void 0;return}if(f.inlineCompletion.semanticId!==h){h=f.inlineCompletion.semanticId;const m=g.textModel.getLineContent(f.ghostText.lineNumber);this._audioCueService.playAudioCue(tt.inlineSuggestion).then(()=>{this.editor.getOption(8)&&this.provideScreenReaderUpdate(f.ghostText.renderForScreenReader(m))})}})),this._register(new xN(this.editor,this.model,this._instantiationService)),this._register(this._configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})}playAudioCue(e){this._playAudioCueSignal.trigger(e)}provideScreenReaderUpdate(e){const t=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),i=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let n;!t&&i&&this.editor.getOption(147)&&(n=p("showAccessibleViewHint","Inspect this in the accessible view ({0})",i.getAriaLabel())),js(n?e+", "+n:e)}updateObservables(e,t){var i,n;const s=this.editor.getModel();this._textModelVersionId.set((i=s?.getVersionId())!==null&&i!==void 0?i:-1,e,t),this._cursorPosition.set((n=this.editor.getPosition())!==null&&n!==void 0?n:new V(1,1),e)}shouldShowHoverAt(e){var t;const i=(t=this.model.get())===null||t===void 0?void 0:t.ghostText.get();return i?i.parts.some(n=>e.containsPosition(new V(i.lineNumber,n.column))):!1}shouldShowHoverAtViewZone(e){return this._ghostTextWidget.ownsViewZone(e)}};Do.ID="editor.contrib.inlineCompletionsController";Do=sT=ome([Td(1,Oe),Td(2,We),Td(3,ft),Td(4,ui),Td(5,Zo),Td(6,Se),Td(7,Pv),Td(8,Pt)],Do);class eL extends we{constructor(){super({id:eL.ID,label:p("action.inlineSuggest.showNext","Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:te.and(M.writable,ln.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){var i;const n=Do.get(t);(i=n?.model.get())===null||i===void 0||i.next()}}eL.ID=pW;class tL extends we{constructor(){super({id:tL.ID,label:p("action.inlineSuggest.showPrevious","Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:te.and(M.writable,ln.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){var i;const n=Do.get(t);(i=n?.model.get())===null||i===void 0||i.previous()}}tL.ID=fW;class rme extends we{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:p("action.inlineSuggest.trigger","Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:M.writable})}async run(e,t){const i=Do.get(t);await Ore(async n=>{var s;await((s=i?.model.get())===null||s===void 0?void 0:s.triggerExplicitly(n)),i?.playAudioCue(n)})}}class ame extends we{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:p("action.inlineSuggest.acceptNextWord","Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:te.and(M.writable,ln.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:te.and(M.writable,ln.inlineSuggestionVisible)},menuOpts:[{menuId:N.InlineSuggestionToolbar,title:p("acceptWord","Accept Word"),group:"primary",order:2}]})}async run(e,t){var i;const n=Do.get(t);await((i=n?.model.get())===null||i===void 0?void 0:i.acceptNextWord(n.editor))}}class lme extends we{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:p("action.inlineSuggest.acceptNextLine","Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:te.and(M.writable,ln.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:N.InlineSuggestionToolbar,title:p("acceptLine","Accept Line"),group:"secondary",order:2}]})}async run(e,t){var i;const n=Do.get(t);await((i=n?.model.get())===null||i===void 0?void 0:i.acceptNextLine(n.editor))}}class dme extends we{constructor(){super({id:gW,label:p("action.inlineSuggest.accept","Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:ln.inlineSuggestionVisible,menuOpts:[{menuId:N.InlineSuggestionToolbar,title:p("accept","Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:te.and(ln.inlineSuggestionVisible,M.tabMovesFocus.toNegated(),ln.inlineSuggestionHasIndentationLessThanTabSize,Qe.Visible.toNegated(),M.hoverFocused.toNegated())}})}async run(e,t){var i;const n=Do.get(t);n&&((i=n.model.get())===null||i===void 0||i.accept(n.editor),n.editor.focus())}}class iL extends we{constructor(){super({id:iL.ID,label:p("action.inlineSuggest.hide","Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:ln.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=Do.get(t);ti(n=>{var s;(s=i?.model.get())===null||s===void 0||s.stop(n)})}}iL.ID="editor.action.inlineSuggest.hide";class nL extends ko{constructor(){super({id:nL.ID,title:p("action.inlineSuggest.alwaysShowToolbar","Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:N.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:te.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(e,t){const i=e.get(ft),s=i.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";i.updateValue("editor.inlineSuggest.showToolbar",s)}}nL.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";var cme=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Im=function(o,e){return function(t,i){e(t,i,o)}};class hme{constructor(e,t,i){this.owner=e,this.range=t,this.controller=i}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let oT=class{constructor(e,t,i,n,s,r){this._editor=e,this._languageService=t,this._openerService=i,this.accessibilityService=n,this._instantiationService=s,this._telemetryService=r,this.hoverOrdinal=4}suggestHoverAnchor(e){const t=Do.get(this._editor);if(!t)return null;const i=e.target;if(i.type===8){const n=i.detail;if(t.shouldShowHoverAtViewZone(n.viewZoneId))return new ZC(1e3,this,k.fromPositions(this._editor.getModel().validatePosition(n.positionBefore||n.position)),e.event.posx,e.event.posy,!1)}return i.type===7&&t.shouldShowHoverAt(i.range)?new ZC(1e3,this,i.range,e.event.posx,e.event.posy,!1):i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range)?new ZC(1e3,this,i.range,e.event.posx,e.event.posy,!1):null}computeSync(e,t){if(this._editor.getOption(62).showToolbar!=="onHover")return[];const i=Do.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new hme(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new se,n=t[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(8)&&this.renderScreenReaderText(e,n,i);const s=n.controller.model.get(),r=this._instantiationService.createInstance(Xc,this._editor,!1,Ew(null),s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.selectedInlineCompletion.map(a=>{var l;return(l=a?.inlineCompletion.source.inlineCompletions.commands)!==null&&l!==void 0?l:[]}));return e.fragment.appendChild(r.getDomNode()),s.triggerExplicitly(),i.add(r),i}renderScreenReaderText(e,t,i){const n=pe,s=n("div.hover-row.markdown-hover"),r=ie(s,n("div.hover-contents",{"aria-live":"assertive"})),a=i.add(new pd({editor:this._editor},this._languageService,this._openerService)),l=d=>{i.add(a.onDidRenderAsync(()=>{r.className="hover-contents code-hover-contents",e.onContentsChanged()}));const c=p("inlineSuggestionFollows","Suggestion:"),h=i.add(a.render(new Fn().appendText(c).appendCodeblock("text",d)));r.replaceChildren(h.element)};i.add(xt(d=>{var c;const h=(c=t.controller.model.read(d))===null||c===void 0?void 0:c.ghostText.read(d);if(h){const u=this._editor.getModel().getLineContent(h.lineNumber);l(h.renderForScreenReader(u))}else Wn(r)})),e.fragment.appendChild(s)}};oT=cme([Im(1,ni),Im(2,Qs),Im(3,Sl),Im(4,Oe),Im(5,Gs)],oT);yt(Do.ID,Do,3);de(rme);de(eL);de(tL);de(ame);de(lme);de(dme);de(iL);Xt(nL);ag.register(oT);function Ts(o,e){let t=0;for(let i=0;i<o.length;i++)o.charAt(i)===" "?t+=e:t++;return t}function E_(o,e,t){o=o<0?0:o;let i="";if(!t){const n=Math.floor(o/e);o=o%e;for(let s=0;s<n;s++)i+=" "}for(let n=0;n<o;n++)i+=" ";return i}var ume=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},gme=function(o,e){return function(t,i){e(t,i,o)}};function tV(o,e,t,i,n){if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return[];const s=e.getLanguageConfiguration(o.getLanguageId()).indentationRules;if(!s)return[];for(i=Math.min(i,o.getLineCount());t<=i&&s.unIndentedLinePattern;){const _=o.getLineContent(t);if(!s.unIndentedLinePattern.test(_))break;t++}if(t>i-1)return[];const{tabSize:r,indentSize:a,insertSpaces:l}=o.getOptions(),d=(_,v)=>(v=v||1,Po.shiftIndent(_,_.length+v,r,a,l)),c=(_,v)=>(v=v||1,Po.unshiftIndent(_,_.length+v,r,a,l)),h=[];let u;const g=o.getLineContent(t);let f=g;u=Ft(g);let m=u;s.increaseIndentPattern&&s.increaseIndentPattern.test(f)?(m=d(m),u=d(u)):s.indentNextLinePattern&&s.indentNextLinePattern.test(f)&&(m=d(m)),t++;for(let _=t;_<=i;_++){const v=o.getLineContent(_),b=Ft(v),C=m+v.substring(b.length);s.decreaseIndentPattern&&s.decreaseIndentPattern.test(C)&&(m=c(m),u=c(u)),b!==m&&h.push(oi.replaceMove(new xe(_,1,_,b.length+1),j2(m,a,l))),!(s.unIndentedLinePattern&&s.unIndentedLinePattern.test(v))&&(s.increaseIndentPattern&&s.increaseIndentPattern.test(C)?(u=d(u),m=u):s.indentNextLinePattern&&s.indentNextLinePattern.test(C)?m=d(m):m=u)}return h}class sL extends we{constructor(){super({id:sL.ID,label:p("indentationToSpaces","Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:M.writable})}run(e,t){const i=t.getModel();if(!i)return;const n=i.getOptions(),s=t.getSelection();if(!s)return;const r=new _me(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}}sL.ID="editor.action.indentationToSpaces";class oL extends we{constructor(){super({id:oL.ID,label:p("indentationToTabs","Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:M.writable})}run(e,t){const i=t.getModel();if(!i)return;const n=i.getOptions(),s=t.getSelection();if(!s)return;const r=new vme(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}}oL.ID="editor.action.indentationToTabs";class jR extends we{constructor(e,t,i){super(i),this.insertSpaces=e,this.displaySizeOnly=t}run(e,t){const i=e.get(dh),n=e.get(ii),s=t.getModel();if(!s)return;const r=n.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget),a=s.getOptions(),l=[1,2,3,4,5,6,7,8].map(c=>({id:c.toString(),label:c.toString(),description:c===r.tabSize&&c===a.tabSize?p("configuredTabSize","Configured Tab Size"):c===r.tabSize?p("defaultTabSize","Default Tab Size"):c===a.tabSize?p("currentTabSize","Current Tab Size"):void 0})),d=Math.min(s.getOptions().tabSize-1,7);setTimeout(()=>{i.pick(l,{placeHolder:p({},"Select Tab Size for Current File"),activeItem:l[d]}).then(c=>{if(c&&s&&!s.isDisposed()){const h=parseInt(c.label,10);this.displaySizeOnly?s.updateOptions({tabSize:h}):s.updateOptions({tabSize:h,indentSize:h,insertSpaces:this.insertSpaces})}})},50)}}class rL extends jR{constructor(){super(!1,!1,{id:rL.ID,label:p("indentUsingTabs","Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0})}}rL.ID="editor.action.indentUsingTabs";class aL extends jR{constructor(){super(!0,!1,{id:aL.ID,label:p("indentUsingSpaces","Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0})}}aL.ID="editor.action.indentUsingSpaces";class lL extends jR{constructor(){super(!0,!0,{id:lL.ID,label:p("changeTabDisplaySize","Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0})}}lL.ID="editor.action.changeTabDisplaySize";class dL extends we{constructor(){super({id:dL.ID,label:p("detectIndentation","Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0})}run(e,t){const i=e.get(ii),n=t.getModel();if(!n)return;const s=i.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget);n.detectIndentation(s.insertSpaces,s.tabSize)}}dL.ID="editor.action.detectIndentation";class fme extends we{constructor(){super({id:"editor.action.reindentlines",label:p("editor.reindentlines","Reindent Lines"),alias:"Reindent Lines",precondition:M.writable})}run(e,t){const i=e.get(Wt),n=t.getModel();if(!n)return;const s=tV(n,i,1,n.getLineCount());s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}}class pme extends we{constructor(){super({id:"editor.action.reindentselectedlines",label:p("editor.reindentselectedlines","Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:M.writable})}run(e,t){const i=e.get(Wt),n=t.getModel();if(!n)return;const s=t.getSelections();if(s===null)return;const r=[];for(const a of s){let l=a.startLineNumber,d=a.endLineNumber;if(l!==d&&a.endColumn===1&&d--,l===1){if(l===d)continue}else l--;const c=tV(n,i,l,d);r.push(...c)}r.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop())}}class mme{constructor(e,t){this._initialSelection=t,this._edits=[],this._selectionId=null;for(const i of e)i.range&&typeof i.text=="string"&&this._edits.push(i)}getEditOperations(e,t){for(const n of this._edits)t.addEditOperation(k.lift(n.range),n.text);let i=!1;Array.isArray(this._edits)&&this._edits.length===1&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!1))),i||(this._selectionId=t.trackSelection(this._initialSelection))}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}let Q0=class{constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new se,this.callOnModel=new se,this.callOnDispose.add(e.onDidChangeConfiguration(()=>this.update())),this.callOnDispose.add(e.onDidChangeModel(()=>this.update())),this.callOnDispose.add(e.onDidChangeModelLanguage(()=>this.update()))}update(){this.callOnModel.clear(),!(this.editor.getOption(12)<4||this.editor.getOption(55))&&this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste(({range:e})=>{this.trigger(e)}))}trigger(e){const t=this.editor.getSelections();if(t===null||t.length>1)return;const i=this.editor.getModel();if(!i||!i.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber))return;const n=this.editor.getOption(12),{tabSize:s,indentSize:r,insertSpaces:a}=i.getOptions(),l=[],d={shiftIndent:g=>Po.shiftIndent(g,g.length+1,s,r,a),unshiftIndent:g=>Po.unshiftIndent(g,g.length+1,s,r,a)};let c=e.startLineNumber;for(;c<=e.endLineNumber;){if(this.shouldIgnoreLine(i,c)){c++;continue}break}if(c>e.endLineNumber)return;let h=i.getLineContent(c);if(!/\S/.test(h.substring(0,e.startColumn-1))){const g=r_(n,i,i.getLanguageId(),c,d,this._languageConfigurationService);if(g!==null){const f=Ft(h),m=Ts(g,s),_=Ts(f,s);if(m!==_){const v=E_(m,s,a);l.push({range:new k(c,1,c,f.length+1),text:v}),h=v+h.substr(f.length)}else{const v=W8(i,c,this._languageConfigurationService);if(v===0||v===8)return}}}const u=c;for(;c<e.endLineNumber;){if(!/\S/.test(i.getLineContent(c+1))){c++;continue}break}if(c!==e.endLineNumber){const f=r_(n,{tokenization:{getLineTokens:m=>i.tokenization.getLineTokens(m),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(m,_)=>i.getLanguageIdAtPosition(m,_)},getLineContent:m=>m===u?h:i.getLineContent(m)},i.getLanguageId(),c+1,d,this._languageConfigurationService);if(f!==null){const m=Ts(f,s),_=Ts(Ft(i.getLineContent(c+1)),s);if(m!==_){const v=m-_;for(let b=c+1;b<=e.endLineNumber;b++){const C=i.getLineContent(b),w=Ft(C),I=Ts(w,s)+v,D=E_(I,s,a);D!==w&&l.push({range:new k(b,1,b,w.length+1),text:D})}}}}if(l.length>0){this.editor.pushUndoStop();const g=new mme(l,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",g),this.editor.pushUndoStop()}}shouldIgnoreLine(e,t){e.tokenization.forceTokenization(t);const i=e.getLineFirstNonWhitespaceColumn(t);if(i===0)return!0;const n=e.tokenization.getLineTokens(t);if(n.getCount()>0){const s=n.findTokenIndexAtOffset(i);if(s>=0&&n.getStandardTokenType(s)===1)return!0}return!1}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}};Q0.ID="editor.contrib.autoIndentOnPaste";Q0=ume([gme(1,Wt)],Q0);function iV(o,e,t,i){if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return;let n="";for(let r=0;r<t;r++)n+=" ";const s=new RegExp(n,"gi");for(let r=1,a=o.getLineCount();r<=a;r++){let l=o.getLineFirstNonWhitespaceColumn(r);if(l===0&&(l=o.getLineMaxColumn(r)),l===1)continue;const d=new k(r,1,r,l),c=o.getValueInRange(d),h=i?c.replace(/\t/ig,n):c.replace(s," ");e.addEditOperation(d,h)}}class _me{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),iV(e,t,this.tabSize,!0)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}class vme{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),iV(e,t,this.tabSize,!1)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}yt(Q0.ID,Q0,2);de(sL);de(oL);de(rL);de(aL);de(lL);de(dL);de(fme);de(pme);class nV{constructor(e,t){this.range=e,this.direction=t}}class qR{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new qR(this.hint,e.anchor,this.provider);return t._isResolved=this._isResolved,t._currentResolve=this._currentResolve,t}async resolve(e){if(typeof this.provider.resolveInlayHint=="function"){if(this._currentResolve)return await this._currentResolve,e.isCancellationRequested?void 0:this.resolve(e);this._isResolved||(this._currentResolve=this._doResolve(e).finally(()=>this._currentResolve=void 0)),await this._currentResolve}}async _doResolve(e){var t,i;try{const n=await Promise.resolve(this.provider.resolveInlayHint(this.hint,e));this.hint.tooltip=(t=n?.tooltip)!==null&&t!==void 0?t:this.hint.tooltip,this.hint.label=(i=n?.label)!==null&&i!==void 0?i:this.hint.label,this._isResolved=!0}catch(n){Mi(n),this._isResolved=!1}}}class J0{static async create(e,t,i,n){const s=[],r=e.ordered(t).reverse().map(a=>i.map(async l=>{try{const d=await a.provideInlayHints(t,l,n);d?.hints.length&&s.push([d,a])}catch(d){Mi(d)}}));if(await Promise.all(r.flat()),n.isCancellationRequested||t.isDisposed())throw new ih;return new J0(i,s,t)}constructor(e,t,i){this._disposables=new se,this.ranges=e,this.provider=new Set;const n=[];for(const[s,r]of t){this._disposables.add(s),this.provider.add(r);for(const a of s.hints){const l=i.validatePosition(a.position);let d="before";const c=J0._getRangeAtPosition(i,l);let h;c.getStartPosition().isBefore(l)?(h=k.fromPositions(c.getStartPosition(),l),d="after"):(h=k.fromPositions(l,c.getEndPosition()),d="before"),n.push(new qR(a,new nV(h,d),r))}}this.items=n.sort((s,r)=>V.compare(s.hint.position,r.hint.position))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(e,t){const i=t.lineNumber,n=e.getWordAtPosition(t);if(n)return new k(i,n.startColumn,i,n.endColumn);e.tokenization.tokenizeIfCheap(i);const s=e.tokenization.getLineTokens(i),r=t.column-1,a=s.findTokenIndexAtOffset(r);let l=s.getStartOffset(a),d=s.getEndOffset(a);return d-l===1&&(l===r&&a>1?(l=s.getStartOffset(a-1),d=s.getEndOffset(a-1)):d===r&&a<s.getCount()-1&&(l=s.getStartOffset(a+1),d=s.getEndOffset(a+1))),new k(i,l+1,i,d+1)}}function bme(o){return Me.from({scheme:Ye.command,path:o.id,query:o.arguments&&encodeURIComponent(JSON.stringify(o.arguments))}).toString()}async function Cme(o,e,t,i){var n;const s=o.get(ks),r=o.get(Yo),a=o.get(ui),l=o.get(Oe),d=o.get(Vi);if(await i.item.resolve(st.None),!i.part.location)return;const c=i.part.location,h=[],u=new Set(vn.getMenuItems(N.EditorContext).map(f=>Kg(f)?f.command.id:zy()));for(const f of Yn.all())u.has(f.desc.id)&&h.push(new cs(f.desc.id,_r.label(f.desc,{renderShortTitle:!0}),void 0,!0,async()=>{const m=await s.createModelReference(c.uri);try{const _=new wp(m.object.textEditorModel,k.getStartPosition(c.range)),v=i.item.anchor.range;await l.invokeFunction(f.runEditorCommand.bind(f),e,_,v)}finally{m.dispose()}}));if(i.part.command){const{command:f}=i.part;h.push(new dn),h.push(new cs(f.id,f.title,void 0,!0,async()=>{var m;try{await a.executeCommand(f.id,...(m=f.arguments)!==null&&m!==void 0?m:[])}catch(_){d.notify({severity:ey.Error,source:i.item.provider.displayName,message:_})}}))}const g=e.getOption(126);r.showContextMenu({domForShadowRoot:g&&(n=e.getDomNode())!==null&&n!==void 0?n:void 0,getAnchor:()=>{const f=ji(t);return{x:f.left,y:f.top+f.height+8}},getActions:()=>h,onHide:()=>{e.focus()},autoSelectFirstItem:!0})}async function sV(o,e,t,i){const s=await o.get(ks).createModelReference(i.uri);await t.invokeWithinContext(async r=>{const a=e.hasSideBySideModifier,l=r.get(We),d=xs.inPeekEditor.getValue(l),c=!a&&t.getOption(87)&&!d;return new qv({openToSide:a,openInPeek:c,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new wp(s.object.textEditorModel,k.getStartPosition(i.range)),k.lift(i.range))}),s.dispose()}var wme=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Rg=function(o,e){return function(t,i){e(t,i,o)}},n1;class nS{constructor(){this._entries=new oh(50)}get(e){const t=nS._key(e);return this._entries.get(t)}set(e,t){const i=nS._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const oV=ot("IInlayHintsCache");ct(oV,nS,1);class rT{constructor(e,t){this.item=e,this.index=t}get part(){const e=this.item.hint.label;return typeof e=="string"?{label:e}:e[this.index]}}class Sme{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}let ju=n1=class{static get(e){var t;return(t=e.getContribution(n1.ID))!==null&&t!==void 0?t:void 0}constructor(e,t,i,n,s,r,a){this._editor=e,this._languageFeaturesService=t,this._inlayHintsCache=n,this._commandService=s,this._notificationService=r,this._instaService=a,this._disposables=new se,this._sessionDisposables=new se,this._decorationsMetadata=new Map,this._ruleFactory=new vv(this._editor),this._activeRenderMode=0,this._debounceInfo=i.for(t.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(t.inlayHintsProvider.onDidChange(()=>this._update())),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(l=>{l.hasChanged(139)&&this._update()})),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const e=this._editor.getOption(139);if(e.enabled==="off")return;const t=this._editor.getModel();if(!t||!this._languageFeaturesService.inlayHintsProvider.has(t))return;const i=this._inlayHintsCache.get(t);i&&this._updateHintsDecorators([t.getFullModelRange()],i),this._sessionDisposables.add(Ae(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));let n;const s=new Set,r=new Rt(async()=>{const a=Date.now();n?.dispose(!0),n=new Wi;const l=t.onWillDispose(()=>n?.cancel());try{const d=n.token,c=await J0.create(this._languageFeaturesService.inlayHintsProvider,t,this._getHintsRanges(),d);if(r.delay=this._debounceInfo.update(t,Date.now()-a),d.isCancellationRequested){c.dispose();return}for(const h of c.provider)typeof h.onDidChangeInlayHints=="function"&&!s.has(h)&&(s.add(h),this._sessionDisposables.add(h.onDidChangeInlayHints(()=>{r.isScheduled()||r.schedule()})));this._sessionDisposables.add(c),this._updateHintsDecorators(c.ranges,c.items),this._cacheHintsForFastRestore(t)}catch(d){Ge(d)}finally{n.dispose(),l.dispose()}},this._debounceInfo.get(t));if(this._sessionDisposables.add(r),this._sessionDisposables.add(Ae(()=>n?.dispose(!0))),r.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange(a=>{(a.scrollTopChanged||!r.isScheduled())&&r.schedule()})),this._sessionDisposables.add(this._editor.onDidChangeModelContent(a=>{const l=Math.max(r.delay,1250);r.schedule(l)})),e.enabled==="on")this._activeRenderMode=0;else{let a,l;e.enabled==="onUnlessPressed"?(a=0,l=1):(a=1,l=0),this._activeRenderMode=a,this._sessionDisposables.add(Yl.getInstance().event(d=>{if(!this._editor.hasModel())return;const c=d.altKey&&d.ctrlKey&&!(d.shiftKey||d.metaKey)?l:a;if(c!==this._activeRenderMode){this._activeRenderMode=c;const h=this._editor.getModel(),u=this._copyInlayHintsWithCurrentAnchor(h);this._updateHintsDecorators([h.getFullModelRange()],u),r.schedule(0)}}))}this._sessionDisposables.add(this._installDblClickGesture(()=>r.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){const e=new se,t=e.add(new Ry(this._editor)),i=new se;return e.add(i),e.add(t.onMouseMoveOrRelevantKeyDown(n=>{const[s]=n,r=this._getInlayHintLabelPart(s),a=this._editor.getModel();if(!r||!a){i.clear();return}const l=new Wi;i.add(Ae(()=>l.dispose(!0))),r.item.resolve(l.token),this._activeInlayHintPart=r.part.command||r.part.location?new Sme(r,s.hasTriggerModifier):void 0;const d=a.validatePosition(r.item.hint.position).lineNumber,c=new k(d,1,d,a.getLineMaxColumn(d)),h=this._getInlineHintsForRange(c);this._updateHintsDecorators([c],h),i.add(Ae(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([c],h)}))})),e.add(t.onCancel(()=>i.clear())),e.add(t.onExecute(async n=>{const s=this._getInlayHintLabelPart(n);if(s){const r=s.part;r.location?this._instaService.invokeFunction(sV,n,this._editor,r.location):WD.is(r.command)&&await this._invokeCommand(r.command,s.item)}})),e}_getInlineHintsForRange(e){const t=new Set;for(const i of this._decorationsMetadata.values())e.containsRange(i.item.anchor.range)&&t.add(i.item);return Array.from(t)}_installDblClickGesture(e){return this._editor.onMouseUp(async t=>{if(t.event.detail!==2)return;const i=this._getInlayHintLabelPart(t);if(i&&(t.event.preventDefault(),await i.item.resolve(st.None),Bn(i.item.hint.textEdits))){const n=i.item.hint.textEdits.map(s=>oi.replace(k.lift(s.range),s.text));this._editor.executeEdits("inlayHint.default",n),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!(e.event.target instanceof HTMLElement))return;const t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(Cme,this._editor,e.event.target,t)})}_getInlayHintLabelPart(e){var t;if(e.target.type!==6)return;const i=(t=e.target.detail.injectedText)===null||t===void 0?void 0:t.options;if(i instanceof Hc&&i?.attachedData instanceof rT)return i.attachedData}async _invokeCommand(e,t){var i;try{await this._commandService.executeCommand(e.id,...(i=e.arguments)!==null&&i!==void 0?i:[])}catch(n){this._notificationService.notify({severity:ey.Error,source:t.provider.displayName,message:n})}}_cacheHintsForFastRestore(e){const t=this._copyInlayHintsWithCurrentAnchor(e);this._inlayHintsCache.set(e,t)}_copyInlayHintsWithCurrentAnchor(e){const t=new Map;for(const[i,n]of this._decorationsMetadata){if(t.has(n.item))continue;const s=e.getDecorationRange(i);if(s){const r=new nV(s,n.item.anchor.direction),a=n.item.with({anchor:r});t.set(n.item,a)}}return Array.from(t.values())}_getHintsRanges(){const t=this._editor.getModel(),i=this._editor.getVisibleRangesPlusViewportAboveBelow(),n=[];for(const s of i.sort(k.compareRangesUsingStarts)){const r=t.validateRange(new k(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));n.length===0||!k.areIntersectingOrTouching(n[n.length-1],r)?n.push(r):n[n.length-1]=k.plusRange(n[n.length-1],r)}return n}_updateHintsDecorators(e,t){var i,n;const s=[],r=(m,_,v,b,C)=>{const w={content:v,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:_.className,cursorStops:b,attachedData:C};s.push({item:m,classNameRef:_,decoration:{range:m.anchor.range,options:{description:"InlayHint",showIfCollapsed:m.anchor.range.isEmpty(),collapseOnReplaceEdit:!m.anchor.range.isEmpty(),stickiness:0,[m.anchor.direction]:this._activeRenderMode===0?w:void 0}}})},a=(m,_)=>{const v=this._ruleFactory.createClassNameRef({width:`${l/3|0}px`,display:"inline-block"});r(m,v," ",_?Gr.Right:Gr.None)},{fontSize:l,fontFamily:d,padding:c,isUniform:h}=this._getLayoutInfo(),u="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(u,d);for(const m of t){m.hint.paddingLeft&&a(m,!1);const _=typeof m.hint.label=="string"?[{label:m.hint.label}]:m.hint.label;for(let v=0;v<_.length;v++){const b=_[v],C=v===0,w=v===_.length-1,y={fontSize:`${l}px`,fontFamily:`var(${u}), ${Vs.fontFamily}`,verticalAlign:h?"baseline":"middle",unicodeBidi:"isolate"};Bn(m.hint.textEdits)&&(y.cursor="default"),this._fillInColors(y,m.hint),(b.command||b.location)&&((i=this._activeInlayHintPart)===null||i===void 0?void 0:i.part.item)===m&&this._activeInlayHintPart.part.index===v&&(y.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(y.color=fi(TG),y.cursor="pointer")),c&&(C&&w?(y.padding=`1px ${Math.max(1,l/4)|0}px`,y.borderRadius=`${l/4|0}px`):C?(y.padding=`1px 0 1px ${Math.max(1,l/4)|0}px`,y.borderRadius=`${l/4|0}px 0 0 ${l/4|0}px`):w?(y.padding=`1px ${Math.max(1,l/4)|0}px 1px 0`,y.borderRadius=`0 ${l/4|0}px ${l/4|0}px 0`):y.padding="1px 0 1px 0"),r(m,this._ruleFactory.createClassNameRef(y),yme(b.label),w&&!m.hint.paddingRight?Gr.Right:Gr.None,new rT(m,v))}if(m.hint.paddingRight&&a(m,!0),s.length>n1._MAX_DECORATORS)break}const g=[];for(const m of e)for(const{id:_}of(n=this._editor.getDecorationsInRange(m))!==null&&n!==void 0?n:[]){const v=this._decorationsMetadata.get(_);v&&(g.push(_),v.classNameRef.dispose(),this._decorationsMetadata.delete(_))}const f=na.capture(this._editor);this._editor.changeDecorations(m=>{const _=m.deltaDecorations(g,s.map(v=>v.decoration));for(let v=0;v<_.length;v++){const b=s[v];this._decorationsMetadata.set(_[v],b)}}),f.restore(this._editor)}_fillInColors(e,t){t.kind===p1.Parameter?(e.backgroundColor=fi(PG),e.color=fi(AG)):t.kind===p1.Type?(e.backgroundColor=fi(RG),e.color=fi(MG)):(e.backgroundColor=fi(Jl),e.color=fi(Ql))}_getLayoutInfo(){const e=this._editor.getOption(139),t=e.padding,i=this._editor.getOption(52),n=this._editor.getOption(49);let s=e.fontSize;(!s||s<5||s>i)&&(s=i);const r=e.fontFamily||n;return{fontSize:s,fontFamily:r,padding:t,isUniform:!t&&r===n&&s===i}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(const e of this._decorationsMetadata.values())e.classNameRef.dispose();this._decorationsMetadata.clear()}};ju.ID="editor.contrib.InlayHints";ju._MAX_DECORATORS=1500;ju=n1=wme([Rg(1,Se),Rg(2,Zo),Rg(3,oV),Rg(4,ui),Rg(5,Vi),Rg(6,Oe)],ju);function yme(o){return o.replace(/[ \t]/g," ")}gt.registerCommand("_executeInlayHintProvider",async(o,...e)=>{const[t,i]=e;Tt(Me.isUri(t)),Tt(k.isIRange(i));const{inlayHintsProvider:n}=o.get(Se),s=await o.get(ks).createModelReference(t);try{const r=await J0.create(n,s.object.textEditorModel,[k.lift(i)],st.None),a=r.items.map(l=>l.hint);return setTimeout(()=>r.dispose(),0),a}finally{s.dispose()}});var Lme=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Em=function(o,e){return function(t,i){e(t,i,o)}};class Q5 extends ZC{constructor(e,t,i,n){super(10,t,e.item.anchor.range,i,n,!0),this.part=e}}let aT=class extends Kw{constructor(e,t,i,n,s,r){super(e,t,i,n,r),this._resolverService=s,this.hoverOrdinal=6}suggestHoverAnchor(e){var t;if(!ju.get(this._editor)||e.target.type!==6)return null;const n=(t=e.target.detail.injectedText)===null||t===void 0?void 0:t.options;return n instanceof Hc&&n.attachedData instanceof rT?new Q5(n.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,i){return e instanceof Q5?new Fi(async n=>{const{part:s}=e;if(await s.item.resolve(i),i.isCancellationRequested)return;let r;typeof s.item.hint.tooltip=="string"?r=new Fn().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(r=s.item.hint.tooltip),r&&n.emitOne(new Kr(this,e.range,[r],!1,0)),Bn(s.item.hint.textEdits)&&n.emitOne(new Kr(this,e.range,[new Fn().appendText(p("hint.dbl","Double-click to insert"))],!1,10001));let a;if(typeof s.part.tooltip=="string"?a=new Fn().appendText(s.part.tooltip):s.part.tooltip&&(a=s.part.tooltip),a&&n.emitOne(new Kr(this,e.range,[a],!1,1)),s.part.location||s.part.command){let d;const h=this._editor.getOption(77)==="altKey"?ut?p("links.navigate.kb.meta.mac","cmd + click"):p("links.navigate.kb.meta","ctrl + click"):ut?p("links.navigate.kb.alt.mac","option + click"):p("links.navigate.kb.alt","alt + click");s.part.location&&s.part.command?d=new Fn().appendText(p("hint.defAndCommand","Go to Definition ({0}), right click for more",h)):s.part.location?d=new Fn().appendText(p("hint.def","Go to Definition ({0})",h)):s.part.command&&(d=new Fn(`[${p("hint.cmd","Execute Command")}](${bme(s.part.command)} "${s.part.command.title}") (${h})`,{isTrusted:!0})),d&&n.emitOne(new Kr(this,e.range,[d],!1,1e4))}const l=await this._resolveInlayHintLabelPartHover(s,i);for await(const d of l)n.emitOne(d)}):Fi.EMPTY}async _resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return Fi.EMPTY;const{uri:i,range:n}=e.part.location,s=await this._resolverService.createModelReference(i);try{const r=s.object.textEditorModel;return this._languageFeaturesService.hoverProvider.has(r)?xR(this._languageFeaturesService.hoverProvider,r,new V(n.startLineNumber,n.startColumn),t).filter(a=>!hp(a.hover.contents)).map(a=>new Kr(this,e.item.anchor.range,a.hover.contents,!1,2+a.ordinal)):Fi.EMPTY}finally{s.dispose()}}};aT=Lme([Em(1,ni),Em(2,Qs),Em(3,ft),Em(4,ks),Em(5,Se)],aT);yt(ju.ID,ju,1);ag.register(aT);class xme{constructor(e,t,i){this._editRange=e,this._originalSelection=t,this._text=i}getEditOperations(e,t){t.addTrackedEditOperation(this._editRange,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return this._originalSelection.isEmpty()?new xe(n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn),n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn)):new xe(n.endLineNumber,n.endColumn-this._text.length,n.endLineNumber,n.endColumn)}}var Dme=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kme=function(o,e){return function(t,i){e(t,i,o)}},s1;let Jc=s1=class{static get(e){return e.getContribution(s1.ID)}constructor(e,t){this.editor=e,this.editorWorkerService=t,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(e,t){var i;(i=this.currentRequest)===null||i===void 0||i.cancel();const n=this.editor.getSelection(),s=this.editor.getModel();if(!s||!n)return;let r=n;if(r.startLineNumber!==r.endLineNumber)return;const a=new r6(this.editor,5),l=s.uri;return this.editorWorkerService.canNavigateValueSet(l)?(this.currentRequest=Zi(d=>this.editorWorkerService.navigateValueSet(l,r,t)),this.currentRequest.then(d=>{var c;if(!d||!d.range||!d.value||!a.validate(this.editor))return;const h=k.lift(d.range);let u=d.range;const g=d.value.length-(r.endColumn-r.startColumn);u={startLineNumber:u.startLineNumber,startColumn:u.startColumn,endLineNumber:u.endLineNumber,endColumn:u.startColumn+d.value.length},g>1&&(r=new xe(r.startLineNumber,r.startColumn,r.endLineNumber,r.endColumn+g-1));const f=new xme(h,r,d.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,f),this.editor.pushUndoStop(),this.decorations.set([{range:u,options:s1.DECORATION}]),(c=this.decorationRemover)===null||c===void 0||c.cancel(),this.decorationRemover=Mc(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(Ge)}).catch(Ge)):Promise.resolve(void 0)}};Jc.ID="editor.contrib.inPlaceReplaceController";Jc.DECORATION=Ze.register({description:"in-place-replace",className:"valueSetReplacement"});Jc=s1=Dme([kme(1,Lr)],Jc);class Ime extends we{constructor(){super({id:"editor.action.inPlaceReplace.up",label:p("InPlaceReplaceAction.previous.label","Replace with Previous Value"),alias:"Replace with Previous Value",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:3159,weight:100}})}run(e,t){const i=Jc.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}class Eme extends we{constructor(){super({id:"editor.action.inPlaceReplace.down",label:p("InPlaceReplaceAction.next.label","Replace with Next Value"),alias:"Replace with Next Value",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:3161,weight:100}})}run(e,t){const i=Jc.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}yt(Jc.ID,Jc,4);de(Ime);de(Eme);class Nme extends we{constructor(){super({id:"expandLineSelection",label:p("expandLineSelection","Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:M.textInputFocus,primary:2090}})}run(e,t,i){if(i=i||{},!t.hasModel())return;const n=t._getViewModel();n.model.pushStackElement(),n.setCursorStates(i.source,3,un.expandLineSelection(n,n.getCursorStates())),n.revealPrimaryCursor(i.source,!0)}}de(Nme);class Tme{constructor(e,t){this._selection=e,this._cursors=t,this._selectionId=null}getEditOperations(e,t){const i=Mme(e,this._cursors);for(let n=0,s=i.length;n<s;n++){const r=i[n];t.addEditOperation(r.range,r.text)}this._selectionId=t.trackSelection(this._selection)}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}function Mme(o,e){e.sort((r,a)=>r.lineNumber===a.lineNumber?r.column-a.column:r.lineNumber-a.lineNumber);for(let r=e.length-2;r>=0;r--)e[r].lineNumber===e[r+1].lineNumber&&e.splice(r,1);const t=[];let i=0,n=0;const s=e.length;for(let r=1,a=o.getLineCount();r<=a;r++){const l=o.getLineContent(r),d=l.length+1;let c=0;if(n<s&&e[n].lineNumber===r&&(c=e[n].column,n++,c===d)||l.length===0)continue;const h=Yr(l);let u=0;if(h===-1)u=1;else if(h!==l.length-1)u=h+2;else continue;u=Math.max(c,u),t[i++]=oi.delete(new k(r,u,r,d))}return t}class rV{constructor(e,t,i){this._selection=e,this._isCopyingDown=t,this._noop=i||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(e,t){let i=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,i.startLineNumber<i.endLineNumber&&i.endColumn===1&&(this._endLineNumberDelta=1,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const n=[];for(let r=i.startLineNumber;r<=i.endLineNumber;r++)n.push(e.getLineContent(r));const s=n.join(`
|
|
702
702
|
`);s===""&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?t.addEditOperation(new k(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber+1,1),i.endLineNumber===e.getLineCount()?"":`
|
|
703
703
|
`):this._isCopyingDown?t.addEditOperation(new k(i.startLineNumber,1,i.startLineNumber,1),s+`
|
|
704
704
|
`):t.addEditOperation(new k(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),`
|
|
@@ -711,4 +711,4 @@ The flag will not be saved for the future.
|
|
|
711
711
|
`);return new iv(e,t,n,d,s,r,c)}constructor(e,t,i,n,s,r,a){this._editor=e,this.findController=t,this.isDisconnectedFromFindController=i,this.searchText=n,this.wholeWord=s,this.matchCase=r,this.currentMatch=a}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new CC(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 CC(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(129):null,!1);return i?new xe(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 CC(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 CC(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(129):null,!1);return i?new xe(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(129):null,!1,1073741824):t.findMatches(this.searchText,!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(129):null,!1,1073741824)}}class qu extends K{static get(e){return e.getContribution(qu.ID)}constructor(e){super(),this._sessionDispose=this._register(new se),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=iv.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 xe(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.getState().matchCase;if(!pV(this._editor.getModel(),t,n)){const r=this._editor.getModel(),a=[];for(let l=0,d=t.length;l<d;l++)a[l]=this._expandEmptyToWord(r,t[l]);this._editor.setSelections(a);return}}}this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToNextFindMatch())}}addSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToPreviousFindMatch())}moveSelectionToNextFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToNextFindMatch())}moveSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToPreviousFindMatch())}selectAll(e){if(!this._editor.hasModel())return;let t=null;const i=e.getState();if(i.isRevealed&&i.searchString.length>0&&i.isRegex){const n=this._editor.getModel();i.searchScope?t=n.findMatches(i.searchString,i.searchScope,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(129):null,!1,1073741824):t=n.findMatches(i.searchString,!0,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(129):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(e),!this._session)return;t=this._session.selectAll(i.searchScope)}if(t.length>0){const n=this._editor.getSelection();for(let s=0,r=t.length;s<r;s++){const a=t[s];if(a.range.intersectRanges(n)){t[s]=t[0],t[0]=a;break}}this._setSelections(t.map(s=>new xe(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn)))}}}qu.ID="editor.contrib.multiCursorController";class Qp extends we{run(e,t){const i=qu.get(t);if(!i)return;const n=t._getViewModel();if(n){const s=n.getCursorStates(),r=us.get(t);if(r)this._run(i,r);else{const a=e.get(Oe).createInstance(us,t);this._run(i,a),a.dispose()}uh(s,n.getCursorStates())}}}class D_e extends Qp{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:p("addSelectionToNextFindMatch","Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:2082,weight:100},menuOpts:{menuId:N.MenubarSelectionMenu,group:"3_multi",title:p({},"Add &&Next Occurrence"),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}}class k_e extends Qp{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:p("addSelectionToPreviousFindMatch","Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:N.MenubarSelectionMenu,group:"3_multi",title:p({},"Add P&&revious Occurrence"),order:6}})}_run(e,t){e.addSelectionToPreviousFindMatch(t)}}class I_e extends Qp{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:p("moveSelectionToNextFindMatch","Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:qi(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}}class E_e extends Qp{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:p("moveSelectionToPreviousFindMatch","Move Last Selection To Previous Find Match"),alias:"Move Last Selection To Previous Find Match",precondition:void 0})}_run(e,t){e.moveSelectionToPreviousFindMatch(t)}}class N_e extends Qp{constructor(){super({id:"editor.action.selectHighlights",label:p("selectAllOccurrencesOfFindMatch","Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:3114,weight:100},menuOpts:{menuId:N.MenubarSelectionMenu,group:"3_multi",title:p({},"Select All &&Occurrences"),order:7}})}_run(e,t){e.selectAll(t)}}class T_e extends Qp{constructor(){super({id:"editor.action.changeAll",label:p("changeAll.label","Change All Occurrences"),alias:"Change All Occurrences",precondition:te.and(M.writable,M.editorTextFocus),kbOpts:{kbExpr:M.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(e,t){e.selectAll(t)}}class M_e{constructor(e,t,i,n,s){this._model=e,this._searchText=t,this._matchCase=i,this._wordSeparators=n,this._modelVersionId=this._model.getVersionId(),this._cachedFindMatches=null,s&&this._model===s._model&&this._searchText===s._searchText&&this._matchCase===s._matchCase&&this._wordSeparators===s._wordSeparators&&this._modelVersionId===s._modelVersionId&&(this._cachedFindMatches=s._cachedFindMatches)}findMatches(){return this._cachedFindMatches===null&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map(e=>e.range),this._cachedFindMatches.sort(k.compareRangesUsingStarts)),this._cachedFindMatches}}let nv=hT=class extends K{constructor(e,t){super(),this._languageFeaturesService=t,this.editor=e,this._isEnabled=e.getOption(107),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new Rt(()=>this._update(),300)),this.state=null,this._register(e.onDidChangeConfiguration(n=>{this._isEnabled=e.getOption(107)})),this._register(e.onDidChangeCursorSelection(n=>{this._isEnabled&&(n.selection.isEmpty()?n.reason===3?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())})),this._register(e.onDidChangeModel(n=>{this._setState(null)})),this._register(e.onDidChangeModelContent(n=>{this._isEnabled&&this.updateSoon.schedule()}));const i=us.get(e);i&&this._register(i.getState().onFindReplaceStateChange(n=>{this._update()})),this.updateSoon.schedule()}_update(){this._setState(hT._createState(this.state,this._isEnabled,this.editor))}static _createState(e,t,i){if(!t||!i.hasModel())return null;const n=i.getSelection();if(n.startLineNumber!==n.endLineNumber)return null;const s=qu.get(i);if(!s)return null;const r=us.get(i);if(!r)return null;let a=s.getSession(r);if(!a){const c=i.getSelections();if(c.length>1){const u=r.getState().matchCase;if(!pV(i.getModel(),c,u))return null}a=iv.create(i,r)}if(!a||a.currentMatch||/^[ \t]+$/.test(a.searchText)||a.searchText.length>200)return null;const l=r.getState(),d=l.matchCase;if(l.isRevealed){let c=l.searchString;d||(c=c.toLowerCase());let h=a.searchText;if(d||(h=h.toLowerCase()),c===h&&a.matchCase===l.matchCase&&a.wholeWord===l.wholeWord&&!l.isRegex)return null}return new M_e(i.getModel(),a.searchText,a.matchCase,a.wholeWord?i.getOption(129):null,e)}_setState(e){if(this.state=e,!this.state){this._decorations.clear();return}if(!this.editor.hasModel())return;const t=this.editor.getModel();if(t.isTooLargeForTokenization())return;const i=this.state.findMatches(),n=this.editor.getSelections();n.sort(k.compareRangesUsingStarts);const s=[];for(let d=0,c=0,h=i.length,u=n.length;d<h;){const g=i[d];if(c>=u)s.push(g),d++;else{const f=k.compareRangesUsingStarts(g,n[c]);f<0?((n[c].isEmpty()||!k.areIntersecting(g,n[c]))&&s.push(g),d++):(f>0||d++,c++)}}const r=this.editor.getOption(80)!=="off",a=this._languageFeaturesService.documentHighlightProvider.has(t)&&r,l=s.map(d=>({range:d,options:v_e(a)}));this._decorations.set(l)}dispose(){this._setState(null),super.dispose()}};nv.ID="editor.contrib.selectionHighlighter";nv=hT=b_e([C_e(1,Se)],nv);function pV(o,e,t){const i=e3(o,e[0],!t);for(let n=1,s=e.length;n<s;n++){const r=e[n];if(r.isEmpty())return!1;const a=e3(o,r,!t);if(i!==a)return!1}return!0}function e3(o,e,t){const i=o.getValueInRange(e);return t?i.toLowerCase():i}class R_e extends we{constructor(){super({id:"editor.action.focusNextCursor",label:p("mutlicursor.focusNextCursor","Focus Next Cursor"),metadata:{description:p("mutlicursor.focusNextCursor.description","Focuses the next cursor"),args:[]},alias:"Focus Next Cursor",precondition:void 0})}run(e,t,i){if(!t.hasModel())return;const n=t._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();const s=Array.from(n.getCursorStates()),r=s.shift();r&&(s.push(r),n.setCursorStates(i.source,3,s),n.revealPrimaryCursor(i.source,!0),uh(s,n.getCursorStates()))}}class A_e extends we{constructor(){super({id:"editor.action.focusPreviousCursor",label:p("mutlicursor.focusPreviousCursor","Focus Previous Cursor"),metadata:{description:p("mutlicursor.focusPreviousCursor.description","Focuses the previous cursor"),args:[]},alias:"Focus Previous Cursor",precondition:void 0})}run(e,t,i){if(!t.hasModel())return;const n=t._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();const s=Array.from(n.getCursorStates()),r=s.pop();r&&(s.unshift(r),n.setCursorStates(i.source,3,s),n.revealPrimaryCursor(i.source,!0),uh(s,n.getCursorStates()))}}yt(qu.ID,qu,4);yt(nv.ID,nv,1);de(w_e);de(S_e);de(y_e);de(D_e);de(k_e);de(I_e);de(E_e);de(N_e);de(T_e);de(L_e);de(x_e);de(R_e);de(A_e);const Gu={Visible:new be("parameterHintsVisible",!1),MultipleSignatures:new be("parameterHintsMultipleSignatures",!1)};async function mV(o,e,t,i,n){const s=o.ordered(e);for(const r of s)try{const a=await r.provideSignatureHelp(e,t,n,i);if(a)return a}catch(a){Mi(a)}}gt.registerCommand("_executeSignatureHelpProvider",async(o,...e)=>{const[t,i,n]=e;Tt(Me.isUri(t)),Tt(V.isIPosition(i)),Tt(typeof n=="string"||!n);const s=o.get(Se),r=await o.get(ks).createModelReference(t);try{const a=await mV(s.signatureHelpProvider,r.object.textEditorModel,V.lift(i),{triggerKind:Ja.Invoke,isRetrigger:!1,triggerCharacter:n},st.None);return a?(setTimeout(()=>a.dispose(),0),a.value):void 0}finally{r.dispose()}});var Hd;(function(o){o.Default={type:0};class e{constructor(n,s){this.request=n,this.previouslyActiveHints=s,this.type=2}}o.Pending=e;class t{constructor(n){this.hints=n,this.type=1}}o.Active=t})(Hd||(Hd={}));class hL extends K{constructor(e,t,i=hL.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new W),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=Hd.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new Cn),this.triggerChars=new k1,this.retriggerChars=new k1,this.triggerId=0,this.editor=e,this.providers=t,this.throttledDelayer=new vr(i),this._register(this.editor.onDidBlurEditorWidget(()=>this.cancel())),this._register(this.editor.onDidChangeConfiguration(()=>this.onEditorConfigurationChange())),this._register(this.editor.onDidChangeModel(n=>this.onModelChanged())),this._register(this.editor.onDidChangeModelLanguage(n=>this.onModelChanged())),this._register(this.editor.onDidChangeCursorSelection(n=>this.onCursorChange(n))),this._register(this.editor.onDidChangeModelContent(n=>this.onModelContentChange())),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType(n=>this.onDidType(n))),this.onEditorConfigurationChange(),this.onModelChanged()}get state(){return this._state}set state(e){this._state.type===2&&this._state.request.cancel(),this._state=e}cancel(e=!1){this.state=Hd.Default,this.throttledDelayer.cancel(),e||this._onChangedHints.fire(void 0)}trigger(e,t){const i=this.editor.getModel();if(!i||!this.providers.has(i))return;const n=++this.triggerId;this._pendingTriggers.push(e),this.throttledDelayer.trigger(()=>this.doTrigger(n),t).catch(Ge)}next(){if(this.state.type!==1)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t%e===e-1,n=this.editor.getOption(85).cycle;if((e<2||i)&&!n){this.cancel();return}this.updateActiveSignature(i&&n?0:t+1)}previous(){if(this.state.type!==1)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t===0,n=this.editor.getOption(85).cycle;if((e<2||i)&&!n){this.cancel();return}this.updateActiveSignature(i&&n?e-1:t-1)}updateActiveSignature(e){this.state.type===1&&(this.state=new Hd.Active({...this.state.hints,activeSignature:e}),this._onChangedHints.fire(this.state.hints))}async doTrigger(e){const t=this.state.type===1||this.state.type===2,i=this.getLastActiveHints();if(this.cancel(!0),this._pendingTriggers.length===0)return!1;const n=this._pendingTriggers.reduce(P_e);this._pendingTriggers=[];const s={triggerKind:n.triggerKind,triggerCharacter:n.triggerCharacter,isRetrigger:t,activeSignatureHelp:i};if(!this.editor.hasModel())return!1;const r=this.editor.getModel(),a=this.editor.getPosition();this.state=new Hd.Pending(Zi(l=>mV(this.providers,r,a,s,l)),i);try{const l=await this.state.request;return e!==this.triggerId?(l?.dispose(),!1):!l||!l.value.signatures||l.value.signatures.length===0?(l?.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1):(this.state=new Hd.Active(l.value),this._lastSignatureHelpResult.value=l,this._onChangedHints.fire(this.state.hints),!0)}catch(l){return e===this.triggerId&&(this.state=Hd.Default),Ge(l),!1}}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return this.state.type===1||this.state.type===2||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars.clear(),this.retriggerChars.clear();const e=this.editor.getModel();if(e)for(const t of this.providers.ordered(e)){for(const i of t.signatureHelpTriggerCharacters||[])if(i.length){const n=i.charCodeAt(0);this.triggerChars.add(n),this.retriggerChars.add(n)}for(const i of t.signatureHelpRetriggerCharacters||[])i.length&&this.retriggerChars.add(i.charCodeAt(0))}}onDidType(e){if(!this.triggerOnType)return;const t=e.length-1,i=e.charCodeAt(t);(this.triggerChars.has(i)||this.isTriggered&&this.retriggerChars.has(i))&&this.trigger({triggerKind:Ja.TriggerCharacter,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:Ja.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:Ja.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(85).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}}hL.DEFAULT_DELAY=120;function P_e(o,e){switch(e.triggerKind){case Ja.Invoke:return e;case Ja.ContentChange:return o;case Ja.TriggerCharacter:default:return e}}var O_e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},SD=function(o,e){return function(t,i){e(t,i,o)}},uT;const to=pe,F_e=Di("parameter-hints-next",he.chevronDown,p("parameterHintsNextIcon","Icon for show next parameter hint.")),B_e=Di("parameter-hints-previous",he.chevronUp,p("parameterHintsPreviousIcon","Icon for show previous parameter hint."));let oS=uT=class extends K{constructor(e,t,i,n,s){super(),this.editor=e,this.model=t,this.renderDisposeables=this._register(new se),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new pd({editor:e},s,n)),this.keyVisible=Gu.Visible.bindTo(i),this.keyMultipleSignatures=Gu.MultipleSignatures.bindTo(i)}createParameterHintDOMNodes(){const e=to(".editor-widget.parameter-hints-widget"),t=ie(e,to(".phwrapper"));t.tabIndex=-1;const i=ie(t,to(".controls")),n=ie(i,to(".button"+Re.asCSSSelector(B_e))),s=ie(i,to(".overloads")),r=ie(i,to(".button"+Re.asCSSSelector(F_e)));this._register(Q(n,"click",u=>{Je.stop(u),this.previous()})),this._register(Q(r,"click",u=>{Je.stop(u),this.next()}));const a=to(".body"),l=new Cv(a,{alwaysConsumeMouseWheel:!0});this._register(l),t.appendChild(l.getDomNode());const d=ie(a,to(".signature")),c=ie(a,to(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:d,overloads:s,docs:c,scrollbar:l},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(u=>{this.visible&&this.editor.layoutContentWidget(this)}));const h=()=>{if(!this.domNodes)return;const u=this.editor.getOption(50);this.domNodes.element.style.fontSize=`${u.fontSize}px`,this.domNodes.element.style.lineHeight=`${u.lineHeight/u.fontSize}`};h(),this._register(fe.chain(this.editor.onDidChangeConfiguration.bind(this.editor),u=>u.filter(g=>g.hasChanged(50)))(h)),this._register(this.editor.onDidLayoutChange(u=>this.updateMaxHeight())),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout(()=>{var e;(e=this.domNodes)===null||e===void 0||e.element.classList.add("visible")},100),this.editor.layoutContentWidget(this))}hide(){var e;this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,(e=this.domNodes)===null||e===void 0||e.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(e){var t;if(this.renderDisposeables.clear(),!this.domNodes)return;const i=e.signatures.length>1;this.domNodes.element.classList.toggle("multiple",i),this.keyMultipleSignatures.set(i),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const n=e.signatures[e.activeSignature];if(!n)return;const s=ie(this.domNodes.signature,to(".code")),r=this.editor.getOption(50);s.style.fontSize=`${r.fontSize}px`,s.style.fontFamily=r.fontFamily;const a=n.parameters.length>0,l=(t=n.activeParameter)!==null&&t!==void 0?t:e.activeParameter;if(a)this.renderParameters(s,n,l);else{const h=ie(s,to("span"));h.textContent=n.label}const d=n.parameters[l];if(d?.documentation){const h=to("span.documentation");if(typeof d.documentation=="string")h.textContent=d.documentation;else{const u=this.renderMarkdownDocs(d.documentation);h.appendChild(u.element)}ie(this.domNodes.docs,to("p",{},h))}if(n.documentation!==void 0)if(typeof n.documentation=="string")ie(this.domNodes.docs,to("p",{},n.documentation));else{const h=this.renderMarkdownDocs(n.documentation);ie(this.domNodes.docs,h.element)}const c=this.hasDocs(n,d);if(this.domNodes.signature.classList.toggle("has-docs",c),this.domNodes.docs.classList.toggle("empty",!c),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,"0")+"/"+e.signatures.length,d){let h="";const u=n.parameters[l];Array.isArray(u.label)?h=n.label.substring(u.label[0],u.label[1]):h=u.label,u.documentation&&(h+=typeof u.documentation=="string"?`, ${u.documentation}`:`, ${u.documentation.value}`),n.documentation&&(h+=typeof n.documentation=="string"?`, ${n.documentation}`:`, ${n.documentation.value}`),this.announcedLabel!==h&&(js(p("hint","{0}, hint",h)),this.announcedLabel=h)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){const t=this.renderDisposeables.add(this.markdownRenderer.render(e,{asyncRenderCallback:()=>{var i;(i=this.domNodes)===null||i===void 0||i.scrollbar.scanDomNode()}}));return t.element.classList.add("markdown-docs"),t}hasDocs(e,t){return!!(t&&typeof t.documentation=="string"&&Zd(t.documentation).length>0||t&&typeof t.documentation=="object"&&Zd(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&Zd(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&Zd(e.documentation.value).length>0)}renderParameters(e,t,i){const[n,s]=this.getParameterLabelOffsets(t,i),r=document.createElement("span");r.textContent=t.label.substring(0,n);const a=document.createElement("span");a.textContent=t.label.substring(n,s),a.className="parameter active";const l=document.createElement("span");l.textContent=t.label.substring(s),ie(e,r,a,l)}getParameterLabelOffsets(e,t){const i=e.parameters[t];if(i){if(Array.isArray(i.label))return i.label;if(i.label.length){const n=new RegExp(`(\\W|^)${yo(i.label)}(?=\\W|$)`,"g");n.test(e.label);const s=n.lastIndex-i.label.length;return s>=0?[s,n.lastIndex]:[0,0]}else return[0,0]}else return[0,0]}next(){this.editor.focus(),this.model.next()}previous(){this.editor.focus(),this.model.previous()}getDomNode(){return this.domNodes||this.createParameterHintDOMNodes(),this.domNodes.element}getId(){return uT.ID}updateMaxHeight(){if(!this.domNodes)return;const t=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=t;const i=this.domNodes.element.getElementsByClassName("phwrapper");i.length&&(i[0].style.maxHeight=t)}};oS.ID="editor.widget.parameterHintsWidget";oS=uT=O_e([SD(2,We),SD(3,Qs),SD(4,ni)],oS);R("editorHoverWidget.highlightForeground",{dark:hr,light:hr,hcDark:hr,hcLight:hr},p("editorHoverWidgetHighlightForeground","Foreground color of the active item in the parameter hint."));var W_e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},t3=function(o,e){return function(t,i){e(t,i,o)}},gT;let Zu=gT=class extends K{static get(e){return e.getContribution(gT.ID)}constructor(e,t,i){super(),this.editor=e,this.model=this._register(new hL(e,i.signatureHelpProvider)),this._register(this.model.onChangedHints(n=>{var s;n?(this.widget.value.show(),this.widget.value.render(n)):(s=this.widget.rawValue)===null||s===void 0||s.hide()})),this.widget=new sh(()=>this._register(t.createInstance(oS,this.editor,this.model)))}cancel(){this.model.cancel()}previous(){var e;(e=this.widget.rawValue)===null||e===void 0||e.previous()}next(){var e;(e=this.widget.rawValue)===null||e===void 0||e.next()}trigger(e){this.model.trigger(e,0)}};Zu.ID="editor.controller.parameterHints";Zu=gT=W_e([t3(1,Oe),t3(2,Se)],Zu);class V_e extends we{constructor(){super({id:"editor.action.triggerParameterHints",label:p("parameterHints.trigger.label","Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:M.hasSignatureHelpProvider,kbOpts:{kbExpr:M.editorTextFocus,primary:3082,weight:100}})}run(e,t){const i=Zu.get(t);i?.trigger({triggerKind:Ja.Invoke})}}yt(Zu.ID,Zu,2);de(V_e);const GR=175,ZR=cn.bindToContribution(Zu.get);ue(new ZR({id:"closeParameterHints",precondition:Gu.Visible,handler:o=>o.cancel(),kbOpts:{weight:GR,kbExpr:M.focus,primary:9,secondary:[1033]}}));ue(new ZR({id:"showPrevParameterHint",precondition:te.and(Gu.Visible,Gu.MultipleSignatures),handler:o=>o.previous(),kbOpts:{weight:GR,kbExpr:M.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));ue(new ZR({id:"showNextParameterHint",precondition:te.and(Gu.Visible,Gu.MultipleSignatures),handler:o=>o.next(),kbOpts:{weight:GR,kbExpr:M.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var H_e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},yD=function(o,e){return function(t,i){e(t,i,o)}};const uL=new be("renameInputVisible",!1,p("renameInputVisible","Whether the rename input widget is visible"));let fT=class{constructor(e,t,i,n,s){this._editor=e,this._acceptKeybindings=t,this._themeService=i,this._keybindingService=n,this._disposables=new se,this.allowEditorOverflow=!0,this._visibleContextKey=uL.bindTo(s),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(50)&&this._updateFont()})),this._disposables.add(i.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="monaco-editor rename-box",this._input=document.createElement("input"),this._input.className="rename-input",this._input.type="text",this._input.setAttribute("aria-label",p("renameAriaLabel","Rename input. Type new name and press Enter to commit.")),this._domNode.appendChild(this._input),this._label=document.createElement("div"),this._label.className="rename-label",this._domNode.appendChild(this._label),this._updateFont(),this._updateStyles(this._themeService.getColorTheme())),this._domNode}_updateStyles(e){var t,i,n,s;if(!this._input||!this._domNode)return;const r=e.getColor(Ua),a=e.getColor(P2);this._domNode.style.backgroundColor=String((t=e.getColor(mi))!==null&&t!==void 0?t:""),this._domNode.style.boxShadow=r?` 0 0 8px 2px ${r}`:"",this._domNode.style.border=a?`1px solid ${a}`:"",this._domNode.style.color=String((i=e.getColor(g8))!==null&&i!==void 0?i:""),this._input.style.backgroundColor=String((n=e.getColor(u8))!==null&&n!==void 0?n:"");const l=e.getColor(f8);this._input.style.borderWidth=l?"1px":"0px",this._input.style.borderStyle=l?"solid":"none",this._input.style.borderColor=(s=l?.toString())!==null&&s!==void 0?s:"none"}_updateFont(){if(!this._input||!this._label)return;const e=this._editor.getOption(50);this._input.style.fontFamily=e.fontFamily,this._input.style.fontWeight=e.fontWeight,this._input.style.fontSize=`${e.fontSize}px`,this._label.style.fontSize=`${e.fontSize*.8}px`}getPosition(){return this._visible?{position:this._position,preference:[2,1]}:null}beforeRender(){var e,t;const[i,n]=this._acceptKeybindings;return this._label.innerText=p({},"{0} to Rename, {1} to Preview",(e=this._keybindingService.lookupKeybinding(i))===null||e===void 0?void 0:e.getLabel(),(t=this._keybindingService.lookupKeybinding(n))===null||t===void 0?void 0:t.getLabel()),null}afterRender(e){e||this.cancelInput(!0)}acceptInput(e){var t;(t=this._currentAcceptInput)===null||t===void 0||t.call(this,e)}cancelInput(e){var t;(t=this._currentCancelInput)===null||t===void 0||t.call(this,e)}getInput(e,t,i,n,s,r){this._domNode.classList.toggle("preview",s),this._position=new V(e.startLineNumber,e.startColumn),this._input.value=t,this._input.setAttribute("selectionStart",i.toString()),this._input.setAttribute("selectionEnd",n.toString()),this._input.size=Math.max((e.endColumn-e.startColumn)*1.1,20);const a=new se;return new Promise(l=>{this._currentCancelInput=d=>(this._currentAcceptInput=void 0,this._currentCancelInput=void 0,l(d),!0),this._currentAcceptInput=d=>{if(this._input.value.trim().length===0||this._input.value===t){this.cancelInput(!0);return}this._currentAcceptInput=void 0,this._currentCancelInput=void 0,l({newName:this._input.value,wantsPreview:s&&d})},a.add(r.onCancellationRequested(()=>this.cancelInput(!0))),a.add(this._editor.onDidBlurEditorWidget(()=>{var d;return this.cancelInput(!(!((d=this._domNode)===null||d===void 0)&&d.ownerDocument.hasFocus()))})),this._show()}).finally(()=>{a.dispose(),this._hide()})}_show(){this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout(()=>{this._input.focus(),this._input.setSelectionRange(parseInt(this._input.getAttribute("selectionStart")),parseInt(this._input.getAttribute("selectionEnd")))},100)}_hide(){this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}};fT=H_e([yD(2,tn),yD(3,Pt),yD(4,We)],fT);var z_e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Eh=function(o,e){return function(t,i){e(t,i,o)}},pT;class YR{constructor(e,t,i){this.model=e,this.position=t,this._providerRenameIdx=0,this._providers=i.ordered(e)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(e){const t=[];for(this._providerRenameIdx=0;this._providerRenameIdx<this._providers.length;this._providerRenameIdx++){const n=this._providers[this._providerRenameIdx];if(!n.resolveRenameLocation)break;const s=await n.resolveRenameLocation(this.model,this.position,e);if(s){if(s.rejectReason){t.push(s.rejectReason);continue}return s}}this._providerRenameIdx=0;const i=this.model.getWordAtPosition(this.position);return i?{range:new k(this.position.lineNumber,i.startColumn,this.position.lineNumber,i.endColumn),text:i.word,rejectReason:t.length>0?t.join(`
|
|
712
712
|
`):void 0}:{range:k.fromPositions(this.position),text:"",rejectReason:t.length>0?t.join(`
|
|
713
713
|
`):void 0}}async provideRenameEdits(e,t){return this._provideRenameEdits(e,this._providerRenameIdx,[],t)}async _provideRenameEdits(e,t,i,n){const s=this._providers[t];if(!s)return{edits:[],rejectReason:i.join(`
|
|
714
|
-
`)};const r=await s.provideRenameEdits(this.model,this.position,e,n);if(r){if(r.rejectReason)return this._provideRenameEdits(e,t+1,i.concat(r.rejectReason),n)}else return this._provideRenameEdits(e,t+1,i.concat(p("no result","No result.")),n);return r}}async function U_e(o,e,t,i){const n=new YR(e,t,o),s=await n.resolveRenameLocation(st.None);return s?.rejectReason?{edits:[],rejectReason:s.rejectReason}:n.provideRenameEdits(i,st.None)}let Yu=pT=class{static get(e){return e.getContribution(pT.ID)}constructor(e,t,i,n,s,r,a,l){this.editor=e,this._instaService=t,this._notificationService=i,this._bulkEditService=n,this._progressService=s,this._logService=r,this._configService=a,this._languageFeaturesService=l,this._disposableStore=new se,this._cts=new Wi,this._renameInputField=this._disposableStore.add(this._instaService.createInstance(fT,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){var e,t;if(this._cts.dispose(!0),this._cts=new Wi,!this.editor.hasModel())return;const i=this.editor.getPosition(),n=new YR(this.editor.getModel(),i,this._languageFeaturesService.renameProvider);if(!n.hasProvider())return;const s=new Uc(this.editor,5,void 0,this._cts.token);let r;try{const f=n.resolveRenameLocation(s.token);this._progressService.showWhile(f,250),r=await f}catch(f){(e=zs.get(this.editor))===null||e===void 0||e.showMessage(f||p("resolveRenameLocationFailed","An unknown error occurred while resolving rename location"),i);return}finally{s.dispose()}if(!r)return;if(r.rejectReason){(t=zs.get(this.editor))===null||t===void 0||t.showMessage(r.rejectReason,i);return}if(s.token.isCancellationRequested)return;const a=new Uc(this.editor,5,r.range,this._cts.token),l=this.editor.getSelection();let d=0,c=r.text.length;!k.isEmpty(l)&&!k.spansMultipleLines(l)&&k.containsRange(r.range,l)&&(d=Math.max(0,l.startColumn-r.range.startColumn),c=Math.min(r.range.endColumn,l.endColumn)-r.range.startColumn);const h=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),u=await this._renameInputField.getInput(r.range,r.text,d,c,h,a.token);if(typeof u=="boolean"){u&&this.editor.focus(),a.dispose();return}this.editor.focus();const g=DS(n.provideRenameEdits(u.newName,a.token),a.token).then(async f=>{if(!(!f||!this.editor.hasModel())){if(f.rejectReason){this._notificationService.info(f.rejectReason);return}this.editor.setSelection(k.fromPositions(this.editor.getSelection().getPosition())),this._bulkEditService.apply(f,{editor:this.editor,showPreview:u.wantsPreview,label:p("label","Renaming '{0}' to '{1}'",r?.text,u.newName),code:"undoredo.rename",quotableLabel:p("quotableLabel","Renaming {0} to {1}",r?.text,u.newName),respectAutoSaveConfig:!0}).then(m=>{m.ariaSummary&&js(p("aria","Successfully renamed '{0}' to '{1}'. Summary: {2}",r.text,u.newName,m.ariaSummary))}).catch(m=>{this._notificationService.error(p("rename.failedApply","Rename failed to apply edits")),this._logService.error(m)})}},f=>{this._notificationService.error(p("rename.failed","Rename failed to compute edits")),this._logService.error(f)}).finally(()=>{a.dispose()});return this._progressService.showWhile(g,250),g}acceptRenameInput(e){this._renameInputField.acceptInput(e)}cancelRenameInput(){this._renameInputField.cancelInput(!0)}};Yu.ID="editor.contrib.renameController";Yu=pT=z_e([Eh(1,Oe),Eh(2,Vi),Eh(3,kv),Eh(4,lh),Eh(5,Zs),Eh(6,k2),Eh(7,Se)],Yu);class $_e extends we{constructor(){super({id:"editor.action.rename",label:p("rename.label","Rename Symbol"),alias:"Rename Symbol",precondition:te.and(M.writable,M.hasRenameProvider),kbOpts:{kbExpr:M.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(Dt),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return Me.isUri(n)&&V.isIPosition(s)?i.openCodeEditor({resource:n},i.getActiveCodeEditor()).then(r=>{r&&(r.setPosition(s),r.invokeWithinContext(a=>(this.reportTelemetry(a,r),this.run(a,r))))},Ge):super.runCommand(e,t)}run(e,t){const i=Yu.get(t);return i?i.run():Promise.resolve()}}yt(Yu.ID,Yu,4);de($_e);const XR=cn.bindToContribution(Yu.get);ue(new XR({id:"acceptRenameInput",precondition:uL,handler:o=>o.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:te.and(M.focus,te.not("isComposing")),primary:3}}));ue(new XR({id:"acceptRenameInputWithPreview",precondition:te.and(uL,te.has("config.editor.rename.enablePreview")),handler:o=>o.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:te.and(M.focus,te.not("isComposing")),primary:1027}}));ue(new XR({id:"cancelRenameInput",precondition:uL,handler:o=>o.cancelRenameInput(),kbOpts:{weight:199,kbExpr:M.focus,primary:9,secondary:[1033]}}));Cl("_executeDocumentRenameProvider",function(o,e,t,...i){const[n]=i;Tt(typeof n=="string");const{renameProvider:s}=o.get(Se);return U_e(s,e,t,n)});Cl("_executePrepareRename",async function(o,e,t){const{renameProvider:i}=o.get(Se),s=await new YR(e,t,i).resolveRenameLocation(st.None);if(s?.rejectReason)throw new Error(s.rejectReason);return s});Ri.as(la.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:p("enablePreview","Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});function K_e(o){for(let e=0,t=o.length;e<t;e+=4){const i=o[e+0],n=o[e+1],s=o[e+2],r=o[e+3];o[e+0]=r,o[e+1]=s,o[e+2]=n,o[e+3]=i}}function j_e(o){const e=new Uint8Array(o.buffer,o.byteOffset,o.length*4);return D3()||K_e(e),AS.wrap(e)}function _V(o){const e=new Uint32Array(q_e(o));let t=0;if(e[t++]=o.id,o.type==="full")e[t++]=1,e[t++]=o.data.length,e.set(o.data,t),t+=o.data.length;else{e[t++]=2,e[t++]=o.deltas.length;for(const i of o.deltas)e[t++]=i.start,e[t++]=i.deleteCount,i.data?(e[t++]=i.data.length,e.set(i.data,t),t+=i.data.length):e[t++]=0}return j_e(e)}function q_e(o){let e=0;if(e+=2,o.type==="full")e+=1+o.data.length;else{e+=1,e+=3*o.deltas.length;for(const t of o.deltas)t.data&&(e+=t.data.length)}return e}function gL(o){return o&&!!o.data}function vV(o){return o&&Array.isArray(o.edits)}class G_e{constructor(e,t,i){this.provider=e,this.tokens=t,this.error=i}}function bV(o,e){return o.has(e)}function Z_e(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function CV(o,e,t,i,n){const s=Z_e(o,e),r=await Promise.all(s.map(async a=>{let l,d=null;try{l=await a.provideDocumentSemanticTokens(e,a===t?i:null,n)}catch(c){d=c,l=null}return(!l||!gL(l)&&!vV(l))&&(l=null),new G_e(a,l,d)}));for(const a of r){if(a.error)throw a.error;if(a.tokens)return a}return r.length>0?r[0]:null}function Y_e(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:null}class X_e{constructor(e,t){this.provider=e,this.tokens=t}}function Q_e(o,e){return o.has(e)}function wV(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function QR(o,e,t,i){const n=wV(o,e),s=await Promise.all(n.map(async r=>{let a;try{a=await r.provideDocumentRangeSemanticTokens(e,t,i)}catch(l){Mi(l),a=null}return(!a||!gL(a))&&(a=null),new X_e(r,a)}));for(const r of s)if(r.tokens)return r;return s.length>0?s[0]:null}gt.registerCommand("_provideDocumentSemanticTokensLegend",async(o,...e)=>{const[t]=e;Tt(t instanceof Me);const i=o.get(ii).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(Se),s=Y_e(n,i);return s?s[0].getLegend():o.get(ui).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)});gt.registerCommand("_provideDocumentSemanticTokens",async(o,...e)=>{const[t]=e;Tt(t instanceof Me);const i=o.get(ii).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(Se);if(!bV(n,i))return o.get(ui).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const s=await CV(n,i,null,null,st.None);if(!s)return;const{provider:r,tokens:a}=s;if(!a||!gL(a))return;const l=_V({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),l});gt.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(o,...e)=>{const[t,i]=e;Tt(t instanceof Me);const n=o.get(ii).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(Se),r=wV(s,n);if(r.length===0)return;if(r.length===1)return r[0].getLegend();if(!i||!k.isIRange(i))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),r[0].getLegend();const a=await QR(s,n,k.lift(i),st.None);if(a)return a.provider.getLegend()});gt.registerCommand("_provideDocumentRangeSemanticTokens",async(o,...e)=>{const[t,i]=e;Tt(t instanceof Me),Tt(k.isIRange(i));const n=o.get(ii).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(Se),r=await QR(s,n,k.lift(i),st.None);if(!(!r||!r.tokens))return _V({id:0,type:"full",data:r.tokens.data})});const JR="editor.semanticHighlighting";function mT(o,e,t){var i;const n=(i=t.getValue(JR,{overrideIdentifier:o.getLanguageId(),resource:o.uri}))===null||i===void 0?void 0:i.enabled;return typeof n=="boolean"?n:e.getColorTheme().semanticHighlighting}var SV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Na=function(o,e){return function(t,i){e(t,i,o)}},Wd;let _T=class extends K{constructor(e,t,i,n,s,r){super(),this._watchers=Object.create(null);const a=c=>{this._watchers[c.uri.toString()]=new sv(c,e,i,s,r)},l=(c,h)=>{h.dispose(),delete this._watchers[c.uri.toString()]},d=()=>{for(const c of t.getModels()){const h=this._watchers[c.uri.toString()];mT(c,i,n)?h||a(c):h&&l(c,h)}};this._register(t.onModelAdded(c=>{mT(c,i,n)&&a(c)})),this._register(t.onModelRemoved(c=>{const h=this._watchers[c.uri.toString()];h&&l(c,h)})),this._register(n.onDidChangeConfiguration(c=>{c.affectsConfiguration(JR)&&d()})),this._register(i.onDidColorThemeChange(d))}dispose(){for(const e of Object.values(this._watchers))e.dispose();super.dispose()}};_T=SV([Na(0,ty),Na(1,ii),Na(2,tn),Na(3,ft),Na(4,Zo),Na(5,Se)],_T);let sv=Wd=class extends K{constructor(e,t,i,n,s){super(),this._semanticTokensStylingService=t,this._isDisposed=!1,this._model=e,this._provider=s.documentSemanticTokensProvider,this._debounceInformation=n.for(this._provider,"DocumentSemanticTokens",{min:Wd.REQUEST_MIN_DELAY,max:Wd.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Rt(()=>this._fetchDocumentSemanticTokensNow(),Wd.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._documentProvidersChangeListeners=[],this._providersChangedDuringRequest=!1,this._register(this._model.onDidChangeContent(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeAttached(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeLanguage(()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(0)}));const r=()=>{Et(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const a of this._provider.all(e))typeof a.onDidChange=="function"&&this._documentProvidersChangeListeners.push(a.onDidChange(()=>{if(this._currentDocumentRequestCancellationTokenSource){this._providersChangedDuringRequest=!0;return}this._fetchDocumentSemanticTokens.schedule(0)}))};r(),this._register(this._provider.onDidChange(()=>{r(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(i.onDidColorThemeChange(a=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._fetchDocumentSemanticTokens.schedule(0)}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),Et(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!bV(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new Wi,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=CV(this._provider,this._model,t,i,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;const s=[],r=this._model.onDidChangeContent(l=>{s.push(l)}),a=new Hn(!1);n.then(l=>{if(this._debounceInformation.update(this._model,a.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,r.dispose(),!l)this._setDocumentSemanticTokens(null,null,null,s);else{const{provider:d,tokens:c}=l,h=this._semanticTokensStylingService.getStyling(d);this._setDocumentSemanticTokens(d,c||null,h,s)}},l=>{l&&(oa(l)||typeof l.message=="string"&&l.message.indexOf("busy")!==-1)||Ge(l),this._currentDocumentRequestCancellationTokenSource=null,r.dispose(),(s.length>0||this._providersChangedDuringRequest)&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))})}static _copy(e,t,i,n,s){s=Math.min(s,i.length-n,e.length-t);for(let r=0;r<s;r++)i[n+r]=e[t+r]}_setDocumentSemanticTokens(e,t,i,n){const s=this._currentDocumentResponse,r=()=>{(n.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed){e&&t&&e.releaseDocumentSemanticTokens(t.resultId);return}if(!e||!i){this._model.tokenization.setSemanticTokens(null,!1);return}if(!t){this._model.tokenization.setSemanticTokens(null,!0),r();return}if(vV(t)){if(!s){this._model.tokenization.setSemanticTokens(null,!0);return}if(t.edits.length===0)t={resultId:t.resultId,data:s.data};else{let a=0;for(const u of t.edits)a+=(u.data?u.data.length:0)-u.deleteCount;const l=s.data,d=new Uint32Array(l.length+a);let c=l.length,h=d.length;for(let u=t.edits.length-1;u>=0;u--){const g=t.edits[u];if(g.start>l.length){i.warnInvalidEditStart(s.resultId,t.resultId,u,g.start,l.length),this._model.tokenization.setSemanticTokens(null,!0);return}const f=c-(g.start+g.deleteCount);f>0&&(Wd._copy(l,c-f,d,h-f,f),h-=f),g.data&&(Wd._copy(g.data,0,d,h-g.data.length,g.data.length),h-=g.data.length),c=g.start}c>0&&Wd._copy(l,0,d,0,c),t={resultId:t.resultId,data:d}}}if(gL(t)){this._currentDocumentResponse=new J_e(e,t.resultId,t.data);const a=k7(t,i,this._model.getLanguageId());if(n.length>0)for(const l of n)for(const d of a)for(const c of l.changes)d.applyEdit(c.range,c.text);this._model.tokenization.setSemanticTokens(a,!0)}else this._model.tokenization.setSemanticTokens(null,!0);r()}};sv.REQUEST_MIN_DELAY=300;sv.REQUEST_MAX_DELAY=2e3;sv=Wd=SV([Na(1,ty),Na(2,tn),Na(3,Zo),Na(4,Se)],sv);class J_e{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}yy(_T);var e0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Nm=function(o,e){return function(t,i){e(t,i,o)}};let ov=class extends K{constructor(e,t,i,n,s,r){super(),this._semanticTokensStylingService=t,this._themeService=i,this._configurationService=n,this._editor=e,this._provider=r.documentRangeSemanticTokensProvider,this._debounceInformation=s.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new Rt(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[];const a=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))};this._register(this._editor.onDidScrollChange(()=>{a()})),this._register(this._editor.onDidChangeModel(()=>{this._cancelAll(),a()})),this._register(this._editor.onDidChangeModelContent(l=>{this._cancelAll(),a()})),this._register(this._provider.onDidChange(()=>{this._cancelAll(),a()})),this._register(this._configurationService.onDidChangeConfiguration(l=>{l.affectsConfiguration(JR)&&(this._cancelAll(),a())})),this._register(this._themeService.onDidColorThemeChange(()=>{this._cancelAll(),a()})),a()}_cancelAll(){for(const e of this._outstandingRequests)e.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(e){for(let t=0,i=this._outstandingRequests.length;t<i;t++)if(this._outstandingRequests[t]===e){this._outstandingRequests.splice(t,1);return}}_tokenizeViewportNow(){if(!this._editor.hasModel())return;const e=this._editor.getModel();if(e.tokenization.hasCompleteSemanticTokens())return;if(!mT(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!Q_e(this._provider,e)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}const t=this._editor.getVisibleRangesPlusViewportAboveBelow();this._outstandingRequests=this._outstandingRequests.concat(t.map(i=>this._requestRange(e,i)))}_requestRange(e,t){const i=e.getVersionId(),n=Zi(r=>Promise.resolve(QR(this._provider,e,t,r))),s=new Hn(!1);return n.then(r=>{if(this._debounceInformation.update(e,s.elapsed()),!r||!r.tokens||e.isDisposed()||e.getVersionId()!==i)return;const{provider:a,tokens:l}=r,d=this._semanticTokensStylingService.getStyling(a);e.tokenization.setPartialSemanticTokens(t,k7(l,d,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}};ov.ID="editor.contrib.viewportSemanticTokens";ov=e0e([Nm(1,ty),Nm(2,tn),Nm(3,ft),Nm(4,Zo),Nm(5,Se)],ov);yt(ov.ID,ov,1);class t0e{constructor(e=!0){this.selectSubwords=e}provideSelectionRanges(e,t){const i=[];for(const n of t){const s=[];i.push(s),this.selectSubwords&&this._addInWordRanges(s,e,n),this._addWordRanges(s,e,n),this._addWhitespaceLine(s,e,n),s.push({range:e.getFullModelRange()})}return i}_addInWordRanges(e,t,i){const n=t.getWordAtPosition(i);if(!n)return;const{word:s,startColumn:r}=n,a=i.column-r;let l=a,d=a,c=0;for(;l>=0;l--){const h=s.charCodeAt(l);if(l!==a&&(h===95||h===45))break;if(Yd(h)&&Da(c))break;c=h}for(l+=1;d<s.length;d++){const h=s.charCodeAt(d);if(Da(h)&&Yd(c))break;if(h===95||h===45)break;c=h}l<d&&e.push({range:new k(i.lineNumber,r+l,i.lineNumber,r+d)})}_addWordRanges(e,t,i){const n=t.getWordAtPosition(i);n&&e.push({range:new k(i.lineNumber,n.startColumn,i.lineNumber,n.endColumn)})}_addWhitespaceLine(e,t,i){t.getLineLength(i.lineNumber)>0&&t.getLineFirstNonWhitespaceColumn(i.lineNumber)===0&&t.getLineLastNonWhitespaceColumn(i.lineNumber)===0&&e.push({range:new k(i.lineNumber,1,i.lineNumber,t.getLineMaxColumn(i.lineNumber))})}}var i0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},n0e=function(o,e){return function(t,i){e(t,i,o)}},vT;class eA{constructor(e,t){this.index=e,this.ranges=t}mov(e){const t=this.index+(e?1:-1);if(t<0||t>=this.ranges.length)return this;const i=new eA(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}let Ep=vT=class{static get(e){return e.getContribution(vT.ID)}constructor(e,t){this._editor=e,this._languageFeaturesService=t,this._ignoreSelection=!1}dispose(){var e;(e=this._selectionListener)===null||e===void 0||e.dispose()}async run(e){if(!this._editor.hasModel())return;const t=this._editor.getSelections(),i=this._editor.getModel();if(this._state||await LV(this._languageFeaturesService.selectionRangeProvider,i,t.map(s=>s.getPosition()),this._editor.getOption(112),st.None).then(s=>{var r;if(!(!Bn(s)||s.length!==t.length)&&!(!this._editor.hasModel()||!_i(this._editor.getSelections(),t,(a,l)=>a.equalsSelection(l)))){for(let a=0;a<s.length;a++)s[a]=s[a].filter(l=>l.containsPosition(t[a].getStartPosition())&&l.containsPosition(t[a].getEndPosition())),s[a].unshift(t[a]);this._state=s.map(a=>new eA(0,a)),(r=this._selectionListener)===null||r===void 0||r.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition(()=>{var a;this._ignoreSelection||((a=this._selectionListener)===null||a===void 0||a.dispose(),this._state=void 0)})}}),!this._state)return;this._state=this._state.map(s=>s.mov(e));const n=this._state.map(s=>xe.fromPositions(s.ranges[s.index].getStartPosition(),s.ranges[s.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}};Ep.ID="editor.contrib.smartSelectController";Ep=vT=i0e([n0e(1,Se)],Ep);class yV extends we{constructor(e,t){super(t),this._forward=e}async run(e,t){const i=Ep.get(t);i&&await i.run(this._forward)}}class s0e extends yV{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:p("smartSelect.expand","Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:N.MenubarSelectionMenu,group:"1_basic",title:p({},"&&Expand Selection"),order:2}})}}gt.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class o0e extends yV{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:p("smartSelect.shrink","Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:N.MenubarSelectionMenu,group:"1_basic",title:p({},"&&Shrink Selection"),order:3}})}}yt(Ep.ID,Ep,4);de(s0e);de(o0e);async function LV(o,e,t,i,n){const s=o.all(e).concat(new t0e(i.selectSubwords));s.length===1&&s.unshift(new ao);const r=[],a=[];for(const l of s)r.push(Promise.resolve(l.provideSelectionRanges(e,t,n)).then(d=>{if(Bn(d)&&d.length===t.length)for(let c=0;c<t.length;c++){a[c]||(a[c]=[]);for(const h of d[c])k.isIRange(h.range)&&k.containsPosition(h.range,t[c])&&a[c].push(k.lift(h.range))}},Mi));return await Promise.all(r),a.map(l=>{if(l.length===0)return[];l.sort((u,g)=>V.isBefore(u.getStartPosition(),g.getStartPosition())?1:V.isBefore(g.getStartPosition(),u.getStartPosition())||V.isBefore(u.getEndPosition(),g.getEndPosition())?-1:V.isBefore(g.getEndPosition(),u.getEndPosition())?1:0);const d=[];let c;for(const u of l)(!c||k.containsRange(u,c)&&!k.equalsRange(u,c))&&(d.push(u),c=u);if(!i.selectLeadingAndTrailingWhitespace)return d;const h=[d[0]];for(let u=1;u<d.length;u++){const g=d[u-1],f=d[u];if(f.startLineNumber!==g.startLineNumber||f.endLineNumber!==g.endLineNumber){const m=new k(g.startLineNumber,e.getLineFirstNonWhitespaceColumn(g.startLineNumber),g.endLineNumber,e.getLineLastNonWhitespaceColumn(g.endLineNumber));m.containsRange(g)&&!m.equalsRange(g)&&f.containsRange(m)&&!f.equalsRange(m)&&h.push(m);const _=new k(g.startLineNumber,1,g.endLineNumber,e.getLineMaxColumn(g.endLineNumber));_.containsRange(g)&&!_.equalsRange(m)&&f.containsRange(_)&&!f.equalsRange(_)&&h.push(_)}h.push(f)}return h})}gt.registerCommand("_executeSelectionRangeProvider",async function(o,...e){const[t,i]=e;Tt(Me.isUri(t));const n=o.get(Se).selectionRangeProvider,s=await o.get(ks).createModelReference(t);try{return LV(n,s.object.textEditorModel,i,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},st.None)}finally{s.dispose()}});const r0e=Object.freeze({View:{value:p("view","View"),original:"View"},Help:{value:p("help","Help"),original:"Help"},Test:{value:p("test","Test"),original:"Test"},File:{value:p("file","File"),original:"File"},Preferences:{value:p("preferences","Preferences"),original:"Preferences"},Developer:{value:p({},"Developer"),original:"Developer"}});class i3{constructor(e,t,i,n=null){this.startLineNumbers=e,this.endLineNumbers=t,this.lastLineRelativePosition=i,this.showEndForLine=n}equals(e){return!!e&&this.lastLineRelativePosition===e.lastLineRelativePosition&&this.showEndForLine===e.showEndForLine&&_i(this.startLineNumbers,e.startLineNumbers)&&_i(this.endLineNumbers,e.endLineNumbers)}}const n3=vd("stickyScrollViewLayer",{createHTML:o=>o}),LD="data-sticky-line-index",s3="data-sticky-is-line",a0e="data-sticky-is-line-number",o3="data-sticky-is-folding-icon";class l0e extends K{constructor(e){super(),this._editor=e,this._foldingIconStore=new se,this._rootDomNode=document.createElement("div"),this._lineNumbersDomNode=document.createElement("div"),this._linesDomNodeScrollable=document.createElement("div"),this._linesDomNode=document.createElement("div"),this._lineHeight=this._editor.getOption(66),this._stickyLines=[],this._lineNumbers=[],this._lastLineRelativePosition=0,this._minContentWidthInPx=0,this._isOnGlyphMargin=!1,this._lineNumbersDomNode.className="sticky-widget-line-numbers",this._lineNumbersDomNode.setAttribute("role","none"),this._linesDomNode.className="sticky-widget-lines",this._linesDomNode.setAttribute("role","list"),this._linesDomNodeScrollable.className="sticky-widget-lines-scrollable",this._linesDomNodeScrollable.appendChild(this._linesDomNode),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",e instanceof Gc),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable);const t=()=>{this._linesDomNode.style.left=this._editor.getOption(114).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(114)&&t(),i.hasChanged(66)&&(this._lineHeight=this._editor.getOption(66))})),this._register(this._editor.onDidScrollChange(i=>{i.scrollLeftChanged&&t(),i.scrollWidthChanged&&this._updateWidgetWidth()})),this._register(this._editor.onDidChangeModel(()=>{t(),this._updateWidgetWidth()})),this._register(this._foldingIconStore),t(),this._register(this._editor.onDidLayoutChange(i=>{this._updateWidgetWidth()})),this._updateWidgetWidth()}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getStickyLineForLine(e){return this._stickyLines.find(t=>t.lineNumber===e)}getCurrentLines(){return this._lineNumbers}setState(e,t,i=1/0){if((!this._previousState&&!e||this._previousState&&this._previousState.equals(e))&&i===1/0)return;this._previousState=e;const n=this._stickyLines;if(this._clearStickyWidget(),!e||!this._editor._getViewModel())return;if(e.startLineNumbers.length*this._lineHeight+e.lastLineRelativePosition>0){this._lastLineRelativePosition=e.lastLineRelativePosition;const r=[...e.startLineNumbers];e.showEndForLine!==null&&(r[e.showEndForLine]=e.endLineNumbers[e.showEndForLine]),this._lineNumbers=r}else this._lastLineRelativePosition=0,this._lineNumbers=[];this._renderRootNode(n,t,i)}_updateWidgetWidth(){const e=this._editor.getLayoutInfo(),t=e.contentLeft;this._lineNumbersDomNode.style.width=`${t}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",`${this._editor.getScrollWidth()-e.verticalScrollbarWidth}px`),this._rootDomNode.style.width=`${e.width-e.verticalScrollbarWidth}px`}_clearStickyWidget(){this._stickyLines=[],this._foldingIconStore.clear(),bn(this._lineNumbersDomNode),bn(this._linesDomNode),this._rootDomNode.style.display="none"}_useFoldingOpacityTransition(e){this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition",`opacity ${e?.5:0}s`)}_setFoldingIconsVisibility(e){for(const t of this._stickyLines){const i=t.foldingIcon;i&&i.setVisible(e?!0:i.isCollapsed)}}async _renderRootNode(e,t,i=1/0){const n=this._editor.getLayoutInfo();for(const[r,a]of this._lineNumbers.entries()){const l=e[r],d=a>=i||l?.lineNumber!==a?this._renderChildNode(r,a,t,n):this._updateTopAndZIndexOfStickyLine(l);d&&(this._linesDomNode.appendChild(d.lineDomNode),this._lineNumbersDomNode.appendChild(d.lineNumberDomNode),this._stickyLines.push(d))}t&&(this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin));const s=this._lineNumbers.length*this._lineHeight+this._lastLineRelativePosition;if(s===0){this._clearStickyWidget();return}this._rootDomNode.style.display="block",this._lineNumbersDomNode.style.height=`${s}px`,this._linesDomNodeScrollable.style.height=`${s}px`,this._rootDomNode.style.height=`${s}px`,this._rootDomNode.style.marginLeft="0px",this._updateMinContentWidth(),this._editor.layoutOverlayWidget(this)}_setFoldingHoverListeners(){this._editor.getOption(109)==="mouseover"&&(this._foldingIconStore.add(Q(this._lineNumbersDomNode,ge.MOUSE_ENTER,t=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(Q(this._lineNumbersDomNode,ge.MOUSE_LEAVE,()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)})))}_renderChildNode(e,t,i,n){const s=this._editor._getViewModel();if(!s)return;const r=s.coordinatesConverter.convertModelPositionToViewPosition(new V(t,1)).lineNumber,a=s.getViewLineRenderingData(r),l=this._editor.getOption(67);let d;try{d=Ws.filter(a.inlineDecorations,r,a.minColumn,a.maxColumn)}catch{d=[]}const c=new rh(!0,!0,a.content,a.continuesWithWrappedLine,a.isBasicASCII,a.containsRTL,0,a.tokens,d,a.tabSize,a.startVisibleColumn,1,1,1,500,"none",!0,!0,null),h=new Op(2e3),u=mv(c,h);let g;n3?g=n3.createHTML(h.build()):g=h.build();const f=document.createElement("span");f.setAttribute(LD,String(e)),f.setAttribute(s3,""),f.setAttribute("role","listitem"),f.tabIndex=0,f.className="sticky-line-content",f.classList.add(`stickyLine${t}`),f.style.lineHeight=`${this._lineHeight}px`,f.innerHTML=g;const m=document.createElement("span");m.setAttribute(LD,String(e)),m.setAttribute(a0e,""),m.className="sticky-line-number",m.style.lineHeight=`${this._lineHeight}px`;const _=n.contentLeft;m.style.width=`${_}px`;const v=document.createElement("span");l.renderType===1||l.renderType===3&&t%10===0?v.innerText=t.toString():l.renderType===2&&(v.innerText=Math.abs(t-this._editor.getPosition().lineNumber).toString()),v.className="sticky-line-number-inner",v.style.lineHeight=`${this._lineHeight}px`,v.style.width=`${n.lineNumbersWidth}px`,v.style.paddingLeft=`${n.lineNumbersLeft}px`,m.appendChild(v);const b=this._renderFoldingIconForLine(i,t);b&&m.appendChild(b.domNode),this._editor.applyFontInfo(f),this._editor.applyFontInfo(v),m.style.lineHeight=`${this._lineHeight}px`,f.style.lineHeight=`${this._lineHeight}px`,m.style.height=`${this._lineHeight}px`,f.style.height=`${this._lineHeight}px`;const C=new d0e(e,t,f,m,b,u.characterMapping);return this._updateTopAndZIndexOfStickyLine(C)}_updateTopAndZIndexOfStickyLine(e){var t;const i=e.index,n=e.lineDomNode,s=e.lineNumberDomNode,r=i===this._lineNumbers.length-1,a="0",l="1";n.style.zIndex=r?a:l,s.style.zIndex=r?a:l;const d=`${i*this._lineHeight+this._lastLineRelativePosition+(!((t=e.foldingIcon)===null||t===void 0)&&t.isCollapsed?1:0)}px`,c=`${i*this._lineHeight}px`;return n.style.top=r?d:c,s.style.top=r?d:c,e}_renderFoldingIconForLine(e,t){const i=this._editor.getOption(109);if(!e||i==="never")return;const n=e.regions,s=n.findRange(t),r=n.getStartLineNumber(s);if(!(t===r))return;const l=n.isCollapsed(s),d=new c0e(l,r,n.getEndLineNumber(s),this._lineHeight);return d.setVisible(this._isOnGlyphMargin?!0:l||i==="always"),d.domNode.setAttribute(o3,""),d}_updateMinContentWidth(){this._minContentWidthInPx=0;for(const e of this._stickyLines)e.lineDomNode.scrollWidth>this._minContentWidthInPx&&(this._minContentWidthInPx=e.lineDomNode.scrollWidth);this._minContentWidthInPx+=this._editor.getLayoutInfo().verticalScrollbarWidth}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:null}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(e){0<=e&&e<this._stickyLines.length&&this._stickyLines[e].lineDomNode.focus()}getEditorPositionFromNode(e){if(!e||e.children.length>0)return null;const t=this._getRenderedStickyLineFromChildDomNode(e);if(!t)return null;const i=z2(t.characterMapping,e,0);return new V(t.lineNumber,i)}getLineNumberFromChildDomNode(e){var t,i;return(i=(t=this._getRenderedStickyLineFromChildDomNode(e))===null||t===void 0?void 0:t.lineNumber)!==null&&i!==void 0?i:null}_getRenderedStickyLineFromChildDomNode(e){const t=this.getLineIndexFromChildDomNode(e);return t===null||t<0||t>=this._stickyLines.length?null:this._stickyLines[t]}getLineIndexFromChildDomNode(e){const t=this._getAttributeValue(e,LD);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,s3)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,o3)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){const i=e.getAttribute(t);if(i!==null)return i;e=e.parentElement}}}class d0e{constructor(e,t,i,n,s,r){this.index=e,this.lineNumber=t,this.lineDomNode=i,this.lineNumberDomNode=n,this.foldingIcon=s,this.characterMapping=r}}class c0e{constructor(e,t,i,n){this.isCollapsed=e,this.foldingStartLine=t,this.foldingEndLine=i,this.dimension=n,this.domNode=document.createElement("div"),this.domNode.style.width=`${n}px`,this.domNode.style.height=`${n}px`,this.domNode.className=Re.asClassName(e?Zy:Gy)}setVisible(e){this.domNode.style.cursor=e?"pointer":"default",this.domNode.style.opacity=e?"1":"0"}}class N_{constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}}class rS{constructor(e,t,i){this.range=e,this.children=t,this.parent=i}}class xV{constructor(e,t,i,n){this.uri=e,this.version=t,this.element=i,this.outlineProviderId=n}}var fL=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},rv=function(o,e){return function(t,i){e(t,i,o)}},T_;(function(o){o.OUTLINE_MODEL="outlineModel",o.FOLDING_PROVIDER_MODEL="foldingProviderModel",o.INDENTATION_MODEL="indentationModel"})(T_||(T_={}));var dc;(function(o){o[o.VALID=0]="VALID",o[o.INVALID=1]="INVALID",o[o.CANCELED=2]="CANCELED"})(dc||(dc={}));let bT=class extends K{constructor(e,t,i,n){super(),this._editor=e,this._languageConfigurationService=t,this._languageFeaturesService=i,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new vr(300)),this._updateOperation=this._register(new se);const s=new CT(i),r=new ST(this._editor,i),a=new wT(this._editor,t);switch(n){case T_.OUTLINE_MODEL:this._modelProviders.push(s),this._modelProviders.push(r),this._modelProviders.push(a);break;case T_.FOLDING_PROVIDER_MODEL:this._modelProviders.push(r),this._modelProviders.push(a);break;case T_.INDENTATION_MODEL:this._modelProviders.push(a);break}}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}async update(e,t,i){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),await this._updateScheduler.trigger(async()=>{for(const n of this._modelProviders){const{statusPromise:s,modelPromise:r}=n.computeStickyModel(e,t,i);this._modelPromise=r;const a=await s;if(this._modelPromise!==r)return null;switch(a){case dc.CANCELED:return this._updateOperation.clear(),null;case dc.VALID:return n.stickyModel}}return null}).catch(n=>(Ge(n),null))}};bT=fL([rv(1,Wt),rv(2,Se)],bT);class DV{constructor(){this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,dc.INVALID}computeStickyModel(e,t,i){if(i.isCancellationRequested||!this.isProviderValid(e))return{statusPromise:this._invalid(),modelPromise:null};const n=Zi(s=>this.createModelFromProvider(e,t,s));return{statusPromise:n.then(s=>this.isModelValid(s)?i.isCancellationRequested?dc.CANCELED:(this._stickyModel=this.createStickyModel(e,t,i,s),dc.VALID):this._invalid()).then(void 0,s=>(Ge(s),dc.CANCELED)),modelPromise:n}}isModelValid(e){return!0}isProviderValid(e){return!0}}let CT=class extends DV{constructor(e){super(),this._languageFeaturesService=e}createModelFromProvider(e,t,i){return zl.create(this._languageFeaturesService.documentSymbolProvider,e,i)}createStickyModel(e,t,i,n){var s;const{stickyOutlineElement:r,providerID:a}=this._stickyModelFromOutlineModel(n,(s=this._stickyModel)===null||s===void 0?void 0:s.outlineProviderId);return new xV(e.uri,t,r,a)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(rt.first(e.children.values())instanceof YW){const a=rt.find(e.children.values(),l=>l.id===t);if(a)i=a.children;else{let l="",d=-1,c;for(const[h,u]of e.children.entries()){const g=this._findSumOfRangesOfGroup(u);g>d&&(c=u,d=g,l=u.id)}t=l,i=c.children}}else i=e.children;const n=[],s=Array.from(i.values()).sort((a,l)=>{const d=new N_(a.symbol.range.startLineNumber,a.symbol.range.endLineNumber),c=new N_(l.symbol.range.startLineNumber,l.symbol.range.endLineNumber);return this._comparator(d,c)});for(const a of s)n.push(this._stickyModelFromOutlineElement(a,a.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new rS(void 0,n,void 0),providerID:t}}_stickyModelFromOutlineElement(e,t){const i=[];for(const s of e.children.values())if(s.symbol.selectionRange.startLineNumber!==s.symbol.range.endLineNumber)if(s.symbol.selectionRange.startLineNumber!==t)i.push(this._stickyModelFromOutlineElement(s,s.symbol.selectionRange.startLineNumber));else for(const r of s.children.values())i.push(this._stickyModelFromOutlineElement(r,s.symbol.selectionRange.startLineNumber));i.sort((s,r)=>this._comparator(s.range,r.range));const n=new N_(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new rS(n,i,void 0)}_comparator(e,t){return e.startLineNumber!==t.startLineNumber?e.startLineNumber-t.startLineNumber:t.endLineNumber-e.endLineNumber}_findSumOfRangesOfGroup(e){let t=0;for(const i of e.children.values())t+=this._findSumOfRangesOfGroup(i);return e instanceof zN?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};CT=fL([rv(0,Se)],CT);class kV extends DV{constructor(e){super(),this._foldingLimitReporter=new qW(e)}createStickyModel(e,t,i,n){const s=this._fromFoldingRegions(n);return new xV(e.uri,t,s,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){const t=e.length,i=[],n=new rS(void 0,[],void 0);for(let s=0;s<t;s++){const r=e.getParentIndex(s);let a;r!==-1?a=i[r]:a=n;const l=new rS(new N_(e.getStartLineNumber(s),e.getEndLineNumber(s)+1),[],a);a.children.push(l),i.push(l)}return n}}let wT=class extends kV{constructor(e,t){super(e),this._languageConfigurationService=t}createModelFromProvider(e,t,i){return new FR(e,this._languageConfigurationService,this._foldingLimitReporter).compute(i)}};wT=fL([rv(1,Wt)],wT);let ST=class extends kV{constructor(e,t){super(e),this._languageFeaturesService=t}isProviderValid(e){return _l.getFoldingRangeProviders(this._languageFeaturesService,e).length>0}createModelFromProvider(e,t,i){const n=_l.getFoldingRangeProviders(this._languageFeaturesService,e);return new WR(e,n,()=>this.createModelFromProvider(e,t,i),this._foldingLimitReporter,void 0).compute(i)}};ST=fL([rv(1,Se)],ST);var h0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},r3=function(o,e){return function(t,i){e(t,i,o)}};class u0e{constructor(e,t,i){this.startLineNumber=e,this.endLineNumber=t,this.nestingDepth=i}}let yT=class extends K{constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new W),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._options=null,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new se),this._updateSoon=this._register(new Rt(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(114)&&this.readConfiguration()})),this.readConfiguration()}readConfiguration(){this._stickyModelProvider=null,this._sessionStore.clear(),this._options=this._editor.getOption(114),this._options.enabled&&(this._stickyModelProvider=this._sessionStore.add(new bT(this._editor,this._languageConfigurationService,this._languageFeaturesService,this._options.defaultModel)),this._sessionStore.add(this._editor.onDidChangeModel(()=>{this._model=null,this._onDidChangeStickyScroll.fire(),this.update()})),this._sessionStore.add(this._editor.onDidChangeHiddenAreas(()=>this.update())),this._sessionStore.add(this._editor.onDidChangeModelContent(()=>this._updateSoon.schedule())),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>this.update())),this.update())}getVersionId(){var e;return(e=this._model)===null||e===void 0?void 0:e.version}async update(){var e;(e=this._cts)===null||e===void 0||e.dispose(!0),this._cts=new Wi,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(e){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization()){this._model=null;return}const t=this._editor.getModel(),i=t.getVersionId(),n=await this._stickyModelProvider.update(t,i,e);e.isCancellationRequested||(this._model=n)}updateIndex(e){return e===-1?e=0:e<0&&(e=-e-2),e}getCandidateStickyLinesIntersectingFromStickyModel(e,t,i,n,s){if(t.children.length===0)return;let r=s;const a=[];for(let c=0;c<t.children.length;c++){const h=t.children[c];h.range&&a.push(h.range.startLineNumber)}const l=this.updateIndex(M_(a,e.startLineNumber,(c,h)=>c-h)),d=this.updateIndex(M_(a,e.startLineNumber+n,(c,h)=>c-h));for(let c=l;c<=d;c++){const h=t.children[c];if(!h)return;if(h.range){const u=h.range.startLineNumber,g=h.range.endLineNumber;e.startLineNumber<=g+1&&u-1<=e.endLineNumber&&u!==r&&(r=u,i.push(new u0e(u,g-1,n+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,h,i,n+1,u))}else this.getCandidateStickyLinesIntersectingFromStickyModel(e,h,i,n,s)}}getCandidateStickyLinesIntersecting(e){var t,i;if(!(!((t=this._model)===null||t===void 0)&&t.element))return[];let n=[];this.getCandidateStickyLinesIntersectingFromStickyModel(e,this._model.element,n,0,-1);const s=(i=this._editor._getViewModel())===null||i===void 0?void 0:i.getHiddenAreas();if(s)for(const r of s)n=n.filter(a=>!(a.startLineNumber>=r.startLineNumber&&a.endLineNumber<=r.endLineNumber+1));return n}};yT=h0e([r3(1,Se),r3(2,Wt)],yT);var g0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ag=function(o,e){return function(t,i){e(t,i,o)}},LT;let vl=LT=class extends K{constructor(e,t,i,n,s,r,a){super(),this._editor=e,this._contextMenuService=t,this._languageFeaturesService=i,this._instaService=n,this._contextKeyService=a,this._sessionStore=new se,this._foldingModel=null,this._maxStickyLines=Number.MAX_SAFE_INTEGER,this._candidateDefinitionsLength=-1,this._focusedStickyElementIndex=-1,this._enabled=!1,this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1,this._endLineNumbers=[],this._showEndForLine=null,this._stickyScrollWidget=new l0e(this._editor),this._stickyLineCandidateProvider=new yT(this._editor,i,s),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=new i3([],[],0),this._readConfiguration();const l=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration(c=>{(c.hasChanged(114)||c.hasChanged(72)||c.hasChanged(66)||c.hasChanged(109))&&this._readConfiguration()})),this._register(Q(l,ge.CONTEXT_MENU,async c=>{this._onContextMenu(Ue(l),c)})),this._stickyScrollFocusedContextKey=M.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=M.stickyScrollVisible.bindTo(this._contextKeyService);const d=this._register(dl(l));this._register(d.onDidBlur(c=>{this._positionRevealed===!1&&l.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(d.onDidFocus(c=>{this.focus()})),this._registerMouseListeners(),this._register(Q(l,ge.MOUSE_DOWN,c=>{this._onMouseDown=!0}))}static get(e){return e.getContribution(LT.ID)}_disposeFocusStickyScrollStore(){var e;this._stickyScrollFocusedContextKey.set(!1),(e=this._focusDisposableStore)===null||e===void 0||e.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}focus(){if(this._onMouseDown){this._onMouseDown=!1,this._editor.focus();return}this._stickyScrollFocusedContextKey.get()!==!0&&(this._focused=!0,this._focusDisposableStore=new se,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex<this._stickyScrollWidget.lineNumberCount-1&&this._focusNav(!0)}focusPrevious(){this._focusedStickyElementIndex>0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(e){this._focusedStickyElementIndex=e?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){const e=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:e[this._focusedStickyElementIndex],column:1})}_revealPosition(e){this._reveaInEditor(e,()=>this._editor.revealPosition(e))}_revealLineInCenterIfOutsideViewport(e){this._reveaInEditor(e,()=>this._editor.revealLineInCenterIfOutsideViewport(e.lineNumber,0))}_reveaInEditor(e,t){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,t(),this._editor.setSelection(k.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){const e=this._register(new se),t=this._register(new Ry(this._editor,{extractLineNumberFromMouseEvent:s=>{const r=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);return r?r.lineNumber:0}})),i=s=>{if(!this._editor.hasModel()||s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return null;const r=s.target.element;if(!r||r.innerText!==r.innerHTML)return null;const a=this._stickyScrollWidget.getEditorPositionFromNode(r);return a?{range:new k(a.lineNumber,a.column,a.lineNumber,a.column+r.innerText.length),textElement:r}:null},n=this._stickyScrollWidget.getDomNode();this._register(vi(n,ge.CLICK,s=>{if(s.ctrlKey||s.altKey||s.metaKey||!s.leftButton)return;if(s.shiftKey){const d=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(d===null)return;const c=new V(this._endLineNumbers[d],1);this._revealLineInCenterIfOutsideViewport(c);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(s.target)){const d=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);this._toggleFoldingRegionForLine(d);return}if(!this._stickyScrollWidget.isInStickyLine(s.target))return;let l=this._stickyScrollWidget.getEditorPositionFromNode(s.target);if(!l){const d=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);if(d===null)return;l=new V(d,1)}this._revealPosition(l)})),this._register(vi(n,ge.MOUSE_MOVE,s=>{if(s.shiftKey){const r=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(r===null||this._showEndForLine!==null&&this._showEndForLine===r)return;this._showEndForLine=r,this._renderStickyScroll();return}this._showEndForLine!==null&&(this._showEndForLine=null,this._renderStickyScroll())})),this._register(Q(n,ge.MOUSE_LEAVE,s=>{this._showEndForLine!==null&&(this._showEndForLine=null,this._renderStickyScroll())})),this._register(t.onMouseMoveOrRelevantKeyDown(([s,r])=>{const a=i(s);if(!a||!s.hasTriggerModifier||!this._editor.hasModel()){e.clear();return}const{range:l,textElement:d}=a;if(!l.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=l,e.clear();else if(d.style.textDecoration==="underline")return;const c=new Wi;e.add(Ae(()=>c.dispose(!0)));let h;Wy(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new V(l.startLineNumber,l.startColumn+1),c.token).then(u=>{if(!c.token.isCancellationRequested)if(u.length!==0){this._candidateDefinitionsLength=u.length;const g=d;h!==g?(e.clear(),h=g,h.style.textDecoration="underline",e.add(Ae(()=>{h.style.textDecoration="none"}))):h||(h=g,h.style.textDecoration="underline",e.add(Ae(()=>{h.style.textDecoration="none"})))}else e.clear()})})),this._register(t.onCancel(()=>{e.clear()})),this._register(t.onExecute(async s=>{if(s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return;const r=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);r&&(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:r.lineNumber,column:1})),this._instaService.invokeFunction(sV,s,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor}))}))}_onContextMenu(e,t){const i=new lr(e,t);this._contextMenuService.showContextMenu({menuId:N.StickyScrollContext,getAnchor:()=>i})}_toggleFoldingRegionForLine(e){if(!this._foldingModel||e===null)return;const t=this._stickyScrollWidget.getStickyLineForLine(e),i=t?.foldingIcon;if(!i)return;zW(this._foldingModel,Number.MAX_VALUE,[e]),i.isCollapsed=!i.isCollapsed;const n=(i.isCollapsed?this._editor.getTopForLineNumber(i.foldingEndLine):this._editor.getTopForLineNumber(i.foldingStartLine))-this._editor.getOption(66)*t.index+1;this._editor.setScrollTop(n),this._renderStickyScroll(e)}_readConfiguration(){const e=this._editor.getOption(114);if(e.enabled===!1){this._editor.removeOverlayWidget(this._stickyScrollWidget),this._sessionStore.clear(),this._enabled=!1;return}else e.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange(i=>{i.scrollTopChanged&&(this._showEndForLine=null,this._renderStickyScroll())})),this._sessionStore.add(this._editor.onDidLayoutChange(()=>this._onDidResize())),this._sessionStore.add(this._editor.onDidChangeModelTokens(i=>this._onTokensChange(i))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(()=>{this._showEndForLine=null,this._renderStickyScroll()})),this._enabled=!0);this._editor.getOption(67).renderType===2&&this._sessionStore.add(this._editor.onDidChangeCursorPosition(()=>{this._showEndForLine=null,this._renderStickyScroll(-1)}))}_needsUpdate(e){const t=this._stickyScrollWidget.getCurrentLines();for(const i of t)for(const n of e.ranges)if(i>=n.fromLineNumber&&i<=n.toLineNumber)return!0;return!1}_onTokensChange(e){this._needsUpdate(e)&&this._renderStickyScroll(-1)}_onDidResize(){const t=this._editor.getLayoutInfo().height/this._editor.getOption(66);this._maxStickyLines=Math.round(t*.25)}async _renderStickyScroll(e=1/0){var t,i;const n=this._editor.getModel();if(!n||n.isTooLargeForTokenization()){this._foldingModel=null,this._stickyScrollWidget.setState(void 0,null,e);return}const s=this._stickyLineCandidateProvider.getVersionId();if(s===void 0||s===n.getVersionId())if(this._foldingModel=(i=await((t=_l.get(this._editor))===null||t===void 0?void 0:t.getFoldingModel()))!==null&&i!==void 0?i:null,this._widgetState=this.findScrollWidgetState(),this._stickyScrollVisibleContextKey.set(this._widgetState.startLineNumbers.length!==0),!this._focused)this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e);else if(this._focusedStickyElementIndex===-1)this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,this._focusedStickyElementIndex!==-1&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{const r=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e),this._stickyScrollWidget.lineNumberCount===0?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(r)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}}findScrollWidgetState(){const e=this._editor.getOption(66),t=Math.min(this._maxStickyLines,this._editor.getOption(114).maxLineCount),i=this._editor.getScrollTop();let n=0;const s=[],r=[],a=this._editor.getVisibleRanges();if(a.length!==0){const l=new N_(a[0].startLineNumber,a[a.length-1].endLineNumber),d=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(l);for(const c of d){const h=c.startLineNumber,u=c.endLineNumber,g=c.nestingDepth;if(u-h>0){const f=(g-1)*e,m=g*e,_=this._editor.getBottomForLineNumber(h)-i,v=this._editor.getTopForLineNumber(u)-i,b=this._editor.getBottomForLineNumber(u)-i;if(f>v&&f<=b){s.push(h),r.push(u+1),n=b-m;break}else m>_&&m<=b&&(s.push(h),r.push(u+1));if(s.length===t)break}}}return this._endLineNumbers=r,new i3(s,r,n,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};vl.ID="store.contrib.stickyScrollController";vl=LT=g0e([Ag(1,Yo),Ag(2,Se),Ag(3,Oe),Ag(4,Wt),Ag(5,Zo),Ag(6,We)],vl);class f0e extends ko{constructor(){super({id:"editor.action.toggleStickyScroll",title:{value:p("toggleStickyScroll","Toggle Sticky Scroll"),mnemonicTitle:p({},"&&Toggle Sticky Scroll"),original:"Toggle Sticky Scroll"},category:r0e.View,toggled:{condition:te.equals("config.editor.stickyScroll.enabled",!0),title:p("stickyScroll","Sticky Scroll"),mnemonicTitle:p({},"&&Sticky Scroll")},menu:[{id:N.CommandPalette},{id:N.MenubarAppearanceMenu,group:"4_editor",order:3},{id:N.StickyScrollContext}]})}async run(e){const t=e.get(ft),i=!t.getValue("editor.stickyScroll.enabled");return t.updateValue("editor.stickyScroll.enabled",i)}}const pL=100;class p0e extends aa{constructor(){super({id:"editor.action.focusStickyScroll",title:{value:p("focusStickyScroll","Focus Sticky Scroll"),mnemonicTitle:p({},"&&Focus Sticky Scroll"),original:"Focus Sticky Scroll"},precondition:te.and(te.has("config.editor.stickyScroll.enabled"),M.stickyScrollVisible),menu:[{id:N.CommandPalette}]})}runEditorCommand(e,t){var i;(i=vl.get(t))===null||i===void 0||i.focus()}}class m0e extends aa{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:{value:p("selectNextStickyScrollLine.title","Select next sticky scroll line"),original:"Select next sticky scroll line"},precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:pL,primary:18}})}runEditorCommand(e,t){var i;(i=vl.get(t))===null||i===void 0||i.focusNext()}}class _0e extends aa{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:{value:p("selectPreviousStickyScrollLine.title","Select previous sticky scroll line"),original:"Select previous sticky scroll line"},precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:pL,primary:16}})}runEditorCommand(e,t){var i;(i=vl.get(t))===null||i===void 0||i.focusPrevious()}}class v0e extends aa{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:{value:p("goToFocusedStickyScrollLine.title","Go to focused sticky scroll line"),original:"Go to focused sticky scroll line"},precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:pL,primary:3}})}runEditorCommand(e,t){var i;(i=vl.get(t))===null||i===void 0||i.goToFocused()}}class b0e extends aa{constructor(){super({id:"editor.action.selectEditor",title:{value:p("selectEditor.title","Select Editor"),original:"Select Editor"},precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:pL,primary:9}})}runEditorCommand(e,t){var i;(i=vl.get(t))===null||i===void 0||i.selectEditor()}}yt(vl.ID,vl,1);Xt(f0e);Xt(p0e);Xt(_0e);Xt(m0e);Xt(v0e);Xt(b0e);var tA=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},mu=function(o,e){return function(t,i){e(t,i,o)}},Bh;class C0e{constructor(e,t,i,n,s,r){this.range=e,this.insertText=t,this.filterText=i,this.additionalTextEdits=n,this.command=s,this.completion=r}}let xT=class extends bz{constructor(e,t,i,n,s,r){super(s.disposable),this.model=e,this.line=t,this.word=i,this.completionModel=n,this._suggestMemoryService=r}canBeReused(e,t,i){return this.model===e&&this.line===t&&this.word.word.length>0&&this.word.startColumn===i.startColumn&&this.word.endColumn<i.endColumn&&this.completionModel.getIncompleteProvider().size===0}get items(){var e;const t=[],{items:i}=this.completionModel,n=this._suggestMemoryService.select(this.model,{lineNumber:this.line,column:this.word.endColumn+this.completionModel.lineContext.characterCountDelta},i),s=rt.slice(i,n),r=rt.slice(i,0,n);let a=5;for(const l of rt.concat(s,r)){if(l.score===Xr.Default)continue;const d=new k(l.editStart.lineNumber,l.editStart.column,l.editInsertEnd.lineNumber,l.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),c=l.completion.insertTextRules&&l.completion.insertTextRules&4?{snippet:l.completion.insertText}:l.completion.insertText;t.push(new C0e(d,c,(e=l.filterTextLow)!==null&&e!==void 0?e:l.labelLow,l.completion.additionalTextEdits,l.completion.command,l)),a-->=0&&l.resolve(st.None)}return t}};xT=tA([mu(5,Qy)],xT);let DT=class{constructor(e,t,i,n){this._getEditorOption=e,this._languageFeatureService=t,this._clipboardService=i,this._suggestMemoryService=n}async provideInlineCompletions(e,t,i,n){var s;if(i.selectedSuggestionInfo)return;const r=this._getEditorOption(88,e);if(ff.isAllOff(r))return;e.tokenization.tokenizeIfCheap(t.lineNumber);const a=e.tokenization.getLineTokens(t.lineNumber),l=a.getStandardTokenType(a.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(ff.valueFor(r,l)!=="inline")return;let d=e.getWordAtPosition(t),c;if(d?.word||(c=this._getTriggerCharacterInfo(e,t)),!d?.word&&!c||(d||(d=e.getWordUntilPosition(t)),d.endColumn!==t.column))return;let h;const u=e.getValueInRange(new k(t.lineNumber,1,t.lineNumber,t.column));if(!c&&(!((s=this._lastResult)===null||s===void 0)&&s.canBeReused(e,t.lineNumber,d))){const g=new X5(u,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=g,this._lastResult.acquire(),h=this._lastResult}else{const g=await HR(this._languageFeatureService.completionProvider,e,t,new G0(void 0,void 0,c?.providers),c&&{triggerKind:1,triggerCharacter:c.ch},n);let f;g.needsClipboard&&(f=await this._clipboardService.readText());const m=new Gd(g.items,t.column,new X5(u,0),zr.None,this._getEditorOption(117,e),this._getEditorOption(111,e),{boostFullMatch:!1,firstMatchCanBeWeak:!1},f);h=new xT(e,t.lineNumber,d,m,g,this._suggestMemoryService)}return this._lastResult=h,h}handleItemDidShow(e,t){t.completion.resolve(st.None)}freeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){var i;const n=e.getValueInRange(k.fromPositions({lineNumber:t.lineNumber,column:t.column-1},t)),s=new Set;for(const r of this._languageFeatureService.completionProvider.all(e))!((i=r.triggerCharacters)===null||i===void 0)&&i.includes(n)&&s.add(r);if(s.size!==0)return{providers:s,ch:n}}};DT=tA([mu(1,Se),mu(2,Sd),mu(3,Qy)],DT);let aS=Bh=class{constructor(e,t,i,n){if(++Bh._counter===1){const s=n.createInstance(DT,(r,a)=>{var l;return((l=i.listCodeEditors().find(c=>c.getModel()===a))!==null&&l!==void 0?l:e).getOption(r)});Bh._disposable=t.inlineCompletionsProvider.register("*",s)}}dispose(){var e;--Bh._counter===0&&((e=Bh._disposable)===null||e===void 0||e.dispose(),Bh._disposable=void 0)}};aS._counter=0;aS=Bh=tA([mu(1,Se),mu(2,Dt),mu(3,Oe)],aS);yt("suggest.inlineCompletionsProvider",aS,0);class w0e extends we{constructor(){super({id:"editor.action.forceRetokenize",label:p("forceRetokenize","Developer: Force Retokenize"),alias:"Developer: Force Retokenize",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getModel();i.tokenization.resetTokenization();const n=new Hn;i.tokenization.forceTokenization(i.getLineCount()),n.stop(),console.log(`tokenization took ${n.elapsed()}`)}}de(w0e);class mL extends ko{constructor(){super({id:mL.ID,title:{value:p({},"Toggle Tab Key Moves Focus"),original:"Toggle Tab Key Moves Focus"},precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},f1:!0})}run(){const t=!Jf.getTabFocusMode();Jf.setTabFocusMode(t),js(t?p("toggle.tabMovesFocus.on","Pressing Tab will now move focus to the next focusable element"):p("toggle.tabMovesFocus.off","Pressing Tab will now insert the tab character"))}}mL.ID="editor.action.toggleTabFocusMode";Xt(mL);var S0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},y0e=function(o,e){return function(t,i){e(t,i,o)}};let kT=class extends K{get enabled(){return this._enabled}set enabled(e){e?(this.el.setAttribute("aria-disabled","false"),this.el.tabIndex=0,this.el.style.pointerEvents="auto",this.el.style.opacity="1",this.el.style.cursor="pointer",this._enabled=!1):(this.el.setAttribute("aria-disabled","true"),this.el.tabIndex=-1,this.el.style.pointerEvents="none",this.el.style.opacity="0.4",this.el.style.cursor="default",this._enabled=!0),this._enabled=e}constructor(e,t,i={},n){var s;super(),this._link=t,this._enabled=!0,this.el=ie(e,pe("a.monaco-link",{tabIndex:(s=t.tabIndex)!==null&&s!==void 0?s:0,href:t.href,title:t.title},t.label)),this.el.setAttribute("role","button");const r=this._register(new at(this.el,"click")),a=this._register(new at(this.el,"keypress")),l=fe.chain(a.event,h=>h.map(u=>new Gt(u)).filter(u=>u.keyCode===3)),d=this._register(new at(this.el,Bt.Tap)).event;this._register(Ot.addTarget(this.el));const c=fe.any(r.event,l,d);this._register(c(h=>{this.enabled&&(Je.stop(h,!0),i?.opener?i.opener(this._link.href):n.open(this._link.href,{allowCommands:!0}))})),this.enabled=!0}};kT=S0e([y0e(3,Qs)],kT);var IV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},EV=function(o,e){return function(t,i){e(t,i,o)}};const L0e=26;let IT=class extends K{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(ET))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(e){this.banner.show({...e,onClose:()=>{var t;this.hide(),(t=e.onClose)===null||t===void 0||t.call(e)}}),this._editor.setBanner(this.banner.element,L0e)}};IT=IV([EV(1,Oe)],IT);let ET=class extends K{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(pd,{}),this.element=pe("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(e){if(e.ariaLabel)return e.ariaLabel;if(typeof e.message=="string")return e.message}getBannerMessage(e){if(typeof e=="string"){const t=pe("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){bn(this.element)}show(e){bn(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=ie(this.element,pe("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(pe(`div${Re.asCSSSelector(e.icon)}`));const n=ie(this.element,pe("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=ie(this.element,pe("div.message-actions-container")),e.actions)for(const r of e.actions)this._register(this.instantiationService.createInstance(kT,this.messageActionsContainer,{...r,tabIndex:-1},{}));const s=ie(this.element,pe("div.action-container"));this.actionBar=this._register(new Go(s)),this.actionBar.push(this._register(new cs("banner.close","Close Banner",Re.asClassName(PB),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};ET=IV([EV(0,Oe)],ET);var iA=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},zf=function(o,e){return function(t,i){e(t,i,o)}};const x0e=Di("extensions-warning-message",he.warning,p("warningIcon","Icon shown with a warning message in the extensions editor."));let Np=class extends K{constructor(e,t,i,n){super(),this._editor=e,this._editorWorkerService=t,this._workspaceTrustService=i,this._highlighter=null,this._bannerClosed=!1,this._updateState=s=>{if(s&&s.hasMore){if(this._bannerClosed)return;const r=Math.max(s.ambiguousCharacterCount,s.nonBasicAsciiCharacterCount,s.invisibleCharacterCount);let a;if(s.nonBasicAsciiCharacterCount>=r)a={message:p("unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters","This document contains many non-basic ASCII unicode characters"),command:new em};else if(s.ambiguousCharacterCount>=r)a={message:p("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters","This document contains many ambiguous unicode characters"),command:new gh};else if(s.invisibleCharacterCount>=r)a={message:p("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters","This document contains many invisible unicode characters"),command:new Jp};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:a.message,icon:x0e,actions:[{label:a.command.shortLabel,href:`command:${a.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(IT,e)),this._register(this._editor.onDidChangeModel(()=>{this._bannerClosed=!1,this._updateHighlighter()})),this._options=e.getOption(124),this._register(i.onDidChangeTrust(s=>{this._updateHighlighter()})),this._register(e.onDidChangeConfiguration(s=>{s.hasChanged(124)&&(this._options=e.getOption(124),this._updateHighlighter())})),this._updateHighlighter()}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;const e=D0e(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([e.nonBasicASCII,e.ambiguousCharacters,e.invisibleCharacters].every(i=>i===!1))return;const t={nonBasicASCII:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments,includeStrings:e.includeStrings,allowedCodePoints:Object.keys(e.allowedCharacters).map(i=>i.codePointAt(0)),allowedLocales:Object.keys(e.allowedLocales).map(i=>i==="_os"?new Intl.NumberFormat().resolvedOptions().locale:i==="_vscode"?wH:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new NT(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new k0e(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}};Np.ID="editor.contrib.unicodeHighlighter";Np=iA([zf(1,Lr),zf(2,P7),zf(3,Oe)],Np);function D0e(o,e){return{nonBasicASCII:e.nonBasicASCII===so?!o:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments===so?!o:e.includeComments,includeStrings:e.includeStrings===so?!o:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}let NT=class extends K{constructor(e,t,i,n){super(),this._editor=e,this._options=t,this._updateState=i,this._editorWorkerService=n,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Rt(()=>this._update(),250)),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then(t=>{if(this._model.isDisposed()||this._model.getVersionId()!==e)return;this._updateState(t);const i=[];if(!t.hasMore)for(const n of t.ranges)i.push({range:n,options:lS.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();if(!lM(t,e))return null;const i=t.getValueInRange(e.range);return{reason:NV(i,this._options),inComment:dM(t,e),inString:cM(t,e)}}};NT=iA([zf(3,Lr)],NT);class k0e extends K{constructor(e,t,i){super(),this._editor=e,this._options=t,this._updateState=i,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Rt(()=>this._update(),250)),this._register(this._editor.onDidLayoutChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidScrollChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeHiddenAreas(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._editor.getVisibleRanges(),t=[],i={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(const n of e){const s=S2.computeUnicodeHighlights(this._model,this._options,n);for(const r of s.ranges)i.ranges.push(r);i.ambiguousCharacterCount+=i.ambiguousCharacterCount,i.invisibleCharacterCount+=i.invisibleCharacterCount,i.nonBasicAsciiCharacterCount+=i.nonBasicAsciiCharacterCount,i.hasMore=i.hasMore||s.hasMore}if(!i.hasMore)for(const n of i.ranges)t.push({range:n,options:lS.instance.getDecorationFromOptions(this._options)});this._updateState(i),this._decorations.set(t)}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel(),i=t.getValueInRange(e.range);return lM(t,e)?{reason:NV(i,this._options),inComment:dM(t,e),inString:cM(t,e)}:null}}let TT=class{constructor(e,t,i){this._editor=e,this._languageService=t,this._openerService=i,this.hoverOrdinal=5}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),n=this._editor.getContribution(Np.ID);if(!n)return[];const s=[],r=new Set;let a=300;for(const l of t){const d=n.getDecorationInfo(l);if(!d)continue;const h=i.getValueInRange(l.range).codePointAt(0),u=xD(h);let g;switch(d.reason.kind){case 0:{uv(d.reason.confusableWith)?g=p("unicodeHighlight.characterIsAmbiguousASCII","The character {0} could be confused with the ASCII character {1}, which is more common in source code.",u,xD(d.reason.confusableWith.codePointAt(0))):g=p("unicodeHighlight.characterIsAmbiguous","The character {0} could be confused with the character {1}, which is more common in source code.",u,xD(d.reason.confusableWith.codePointAt(0)));break}case 1:g=p("unicodeHighlight.characterIsInvisible","The character {0} is invisible.",u);break;case 2:g=p("unicodeHighlight.characterIsNonBasicAscii","The character {0} is not a basic ASCII character.",u);break}if(r.has(g))continue;r.add(g);const f={codePoint:h,reason:d.reason,inComment:d.inComment,inString:d.inString},m=p("unicodeHighlight.adjustSettings","Adjust settings"),_=`command:${Yv.ID}?${encodeURIComponent(JSON.stringify(f))}`,v=new Fn("",!0).appendMarkdown(g).appendText(" ").appendLink(_,m);s.push(new Kr(this,l.range,[v],!1,a++))}return s}renderHoverParts(e,t){return dW(e,t,this._editor,this._languageService,this._openerService)}};TT=iA([zf(1,ni),zf(2,Qs)],TT);function MT(o){return`U+${o.toString(16).padStart(4,"0")}`}function xD(o){let e=`\`${MT(o)}\``;return tl.isInvisibleCharacter(o)||(e+=` "${`${I0e(o)}`}"`),e}function I0e(o){return o===96?"`` ` ``":"`"+String.fromCodePoint(o)+"`"}function NV(o,e){return S2.computeUnicodeHighlightReason(o,e)}class lS{constructor(){this.map=new Map}getDecorationFromOptions(e){return this.getDecoration(!e.includeComments,!e.includeStrings)}getDecoration(e,t){const i=`${e}${t}`;let n=this.map.get(i);return n||(n=Ze.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:e,hideInStringTokens:t}),this.map.set(i,n)),n}}lS.instance=new lS;class E0e extends we{constructor(){super({id:gh.ID,label:p("action.unicodeHighlight.disableHighlightingInComments","Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=p("unicodeHighlight.disableHighlightingInComments.shortLabel","Disable Highlight In Comments")}async run(e,t,i){const n=e?.get(ft);n&&this.runAction(n)}async runAction(e){await e.updateValue(Cs.includeComments,!1,2)}}class N0e extends we{constructor(){super({id:gh.ID,label:p("action.unicodeHighlight.disableHighlightingInStrings","Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=p("unicodeHighlight.disableHighlightingInStrings.shortLabel","Disable Highlight In Strings")}async run(e,t,i){const n=e?.get(ft);n&&this.runAction(n)}async runAction(e){await e.updateValue(Cs.includeStrings,!1,2)}}class gh extends we{constructor(){super({id:gh.ID,label:p("action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters","Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=p("unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel","Disable Ambiguous Highlight")}async run(e,t,i){const n=e?.get(ft);n&&this.runAction(n)}async runAction(e){await e.updateValue(Cs.ambiguousCharacters,!1,2)}}gh.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";class Jp extends we{constructor(){super({id:Jp.ID,label:p("action.unicodeHighlight.disableHighlightingOfInvisibleCharacters","Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=p("unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel","Disable Invisible Highlight")}async run(e,t,i){const n=e?.get(ft);n&&this.runAction(n)}async runAction(e){await e.updateValue(Cs.invisibleCharacters,!1,2)}}Jp.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";class em extends we{constructor(){super({id:em.ID,label:p("action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters","Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=p("unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel","Disable Non ASCII Highlight")}async run(e,t,i){const n=e?.get(ft);n&&this.runAction(n)}async runAction(e){await e.updateValue(Cs.nonBasicASCII,!1,2)}}em.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";class Yv extends we{constructor(){super({id:Yv.ID,label:p("action.unicodeHighlight.showExcludeOptions","Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}async run(e,t,i){const{codePoint:n,reason:s,inString:r,inComment:a}=i,l=String.fromCodePoint(n),d=e.get(dh),c=e.get(ft);function h(f){return tl.isInvisibleCharacter(f)?p("unicodeHighlight.excludeInvisibleCharFromBeingHighlighted","Exclude {0} (invisible character) from being highlighted",MT(f)):p("unicodeHighlight.excludeCharFromBeingHighlighted","Exclude {0} from being highlighted",`${MT(f)} "${l}"`)}const u=[];if(s.kind===0)for(const f of s.notAmbiguousInLocales)u.push({label:p("unicodeHighlight.allowCommonCharactersInLanguage",'Allow unicode characters that are more common in the language "{0}".',f),run:async()=>{M0e(c,[f])}});if(u.push({label:h(n),run:()=>T0e(c,[n])}),a){const f=new E0e;u.push({label:f.label,run:async()=>f.runAction(c)})}else if(r){const f=new N0e;u.push({label:f.label,run:async()=>f.runAction(c)})}if(s.kind===0){const f=new gh;u.push({label:f.label,run:async()=>f.runAction(c)})}else if(s.kind===1){const f=new Jp;u.push({label:f.label,run:async()=>f.runAction(c)})}else if(s.kind===2){const f=new em;u.push({label:f.label,run:async()=>f.runAction(c)})}else R0e(s);const g=await d.pick(u,{title:p("unicodeHighlight.configureUnicodeHighlightOptions","Configure Unicode Highlight Options")});g&&await g.run()}}Yv.ID="editor.action.unicodeHighlight.showExcludeOptions";async function T0e(o,e){const t=o.getValue(Cs.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const n of e)i[String.fromCodePoint(n)]=!0;await o.updateValue(Cs.allowedCharacters,i,2)}async function M0e(o,e){var t;const i=(t=o.inspect(Cs.allowedLocales).user)===null||t===void 0?void 0:t.value;let n;typeof i=="object"&&i?n=Object.assign({},i):n={};for(const s of e)n[s]=!0;await o.updateValue(Cs.allowedLocales,n,2)}function R0e(o){throw new Error(`Unexpected value: ${o}`)}de(gh);de(Jp);de(em);de(Yv);yt(Np.ID,Np,1);hg.register(TT);var A0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},a3=function(o,e){return function(t,i){e(t,i,o)}};const TV="ignoreUnusualLineTerminators";function P0e(o,e,t){o.setModelProperty(e.uri,TV,t)}function O0e(o,e){return o.getModelProperty(e.uri,TV)}let av=class extends K{constructor(e,t,i){super(),this._editor=e,this._dialogService=t,this._codeEditorService=i,this._isPresentingDialog=!1,this._config=this._editor.getOption(125),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(125)&&(this._config=this._editor.getOption(125),this._checkForUnusualLineTerminators())})),this._register(this._editor.onDidChangeModel(()=>{this._checkForUnusualLineTerminators()})),this._register(this._editor.onDidChangeModelContent(n=>{n.isUndoing||this._checkForUnusualLineTerminators()})),this._checkForUnusualLineTerminators()}async _checkForUnusualLineTerminators(){if(this._config==="off"||!this._editor.hasModel())return;const e=this._editor.getModel();if(!e.mightContainUnusualLineTerminators()||O0e(this._codeEditorService,e)===!0||this._editor.getOption(90))return;if(this._config==="auto"){e.removeUnusualLineTerminators(this._editor.getSelections());return}if(this._isPresentingDialog)return;let i;try{this._isPresentingDialog=!0,i=await this._dialogService.confirm({title:p("unusualLineTerminators.title","Unusual Line Terminators"),message:p("unusualLineTerminators.message","Detected unusual line terminators"),detail:p("unusualLineTerminators.detail","The file '{0}' contains one or more unusual line terminator characters, like Line Separator (LS) or Paragraph Separator (PS).\n\nIt is recommended to remove them from the file. This can be configured via `editor.unusualLineTerminators`.",qo(e.uri)),primaryButton:p({key:"unusualLineTerminators.fix",comment:["&& denotes a mnemonic"]},"&&Remove Unusual Line Terminators"),cancelButton:p("unusualLineTerminators.ignore","Ignore")})}finally{this._isPresentingDialog=!1}if(!i.confirmed){P0e(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}};av.ID="editor.contrib.unusualLineTerminatorsDetector";av=A0e([a3(1,Dv),a3(2,Dt)],av);yt(av.ID,av,1);var MV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},r1=function(o,e){return function(t,i){e(t,i,o)}},Ei,RT;const _L=new be("hasWordHighlights",!1);function RV(o,e,t,i){const n=o.ordered(e);return c2(n.map(s=>()=>Promise.resolve(s.provideDocumentHighlights(e,t,i)).then(void 0,Mi)),Bn).then(s=>{if(s){const r=new xi;return r.set(e.uri,s),r}return new xi})}function F0e(o,e,t,i,n,s){const r=o.ordered(e);return c2(r.map(a=>()=>{const l=s.filter(d=>mM(a.selector,d.uri,d.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(a.provideMultiDocumentHighlights(e,t,l,n)).then(void 0,Mi)}),a=>a instanceof xi&&a.size>0)}class nA{constructor(e,t,i){this._model=e,this._selection=t,this._wordSeparators=i,this._wordRange=this._getCurrentWordRange(e,t),this._result=null}get result(){return this._result||(this._result=Zi(e=>this._compute(this._model,this._selection,this._wordSeparators,e))),this._result}_getCurrentWordRange(e,t){const i=e.getWordAtPosition(t.getPosition());return i?new k(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):null}isValid(e,t,i){const n=t.startLineNumber,s=t.startColumn,r=t.endColumn,a=this._getCurrentWordRange(e,t);let l=!!(this._wordRange&&this._wordRange.equalsRange(a));for(let d=0,c=i.length;!l&&d<c;d++){const h=i.getRange(d);h&&h.startLineNumber===n&&h.startColumn<=s&&h.endColumn>=r&&(l=!0)}return l}cancel(){this.result.cancel()}}class B0e extends nA{constructor(e,t,i,n){super(e,t,i),this._providers=n}_compute(e,t,i,n){return RV(this._providers,e,t.getPosition(),n).then(s=>s||new xi)}}class W0e extends nA{constructor(e,t,i,n,s){super(e,t,i),this._providers=n,this._otherModels=s}_compute(e,t,i,n){return F0e(this._providers,e,t.getPosition(),i,n,this._otherModels).then(s=>s||new xi)}}class AV extends nA{constructor(e,t,i,n,s){super(e,t,n),this._otherModels=s,this._selectionIsEmpty=t.isEmpty(),this._word=i}_compute(e,t,i,n){return Mc(250,n).then(()=>{const s=new xi;let r;if(this._word?r=this._word:r=e.getWordAtPosition(t.getPosition()),!r)return new xi;const a=[e,...this._otherModels];for(const l of a){if(l.isDisposed())continue;const c=l.findMatches(r.word,!0,!1,!0,i,!1).map(h=>({range:h.range,kind:W_.Text}));c&&s.set(l.uri,c)}return s})}isValid(e,t,i){const n=t.isEmpty();return this._selectionIsEmpty!==n?!1:super.isValid(e,t,i)}}function V0e(o,e,t,i,n){return o.has(e)?new B0e(e,t,n,o):new AV(e,t,i,n,[])}function H0e(o,e,t,i,n,s){return o.has(e)?new W0e(e,t,n,o,s):new AV(e,t,i,n,s)}Cl("_executeDocumentHighlights",async(o,e,t)=>{const i=o.get(Se),n=await RV(i.documentHighlightProvider,e,t,st.None);return n?.get(e.uri)});let lv=Ei=class{constructor(e,t,i,n,s){this.toUnhook=new se,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new xi,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=s,this._hasWordHighlights=_L.bindTo(n),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(80),this.model=this.editor.getModel(),this.toUnhook.add(e.onDidChangeCursorPosition(r=>{this._ignorePositionChangeEvent||this.occurrencesHighlight!=="off"&&this._onPositionChanged(r)})),this.toUnhook.add(e.onDidChangeModelContent(r=>{this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(r=>{!r.newModelUrl&&r.oldModelUrl?this._stopSingular():Ei.query&&this._run()})),this.toUnhook.add(e.onDidChangeConfiguration(r=>{const a=this.editor.getOption(80);this.occurrencesHighlight!==a&&(this.occurrencesHighlight=a,this._stopAll())})),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,Ei.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight!=="off"&&this._run()}_getSortedHighlights(){return this.decorations.getRanges().sort(k.compareRangesUsingStarts)}moveNext(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))+1)%e.length,n=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);const s=this._getWord();if(s){const r=this.editor.getModel().getLineContent(n.startLineNumber);js(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}moveBack(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))-1+e.length)%e.length,n=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);const s=this._getWord();if(s){const r=this.editor.getModel().getLineContent(n.startLineNumber);js(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=Ei.storedDecorations.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),Ei.storedDecorations.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(){const e=this.codeEditorService.listCodeEditors();for(const t of e){if(!t.hasModel())continue;const i=Ei.storedDecorations.get(t.getModel().uri);if(!i)continue;t.removeDecorations(i),Ei.storedDecorations.delete(t.getModel().uri);const n=md.get(t);n?.wordHighlighter&&n.wordHighlighter.decorations.length>0&&(n.wordHighlighter.decorations.clear(),n.wordHighlighter._hasWordHighlights.set(!1))}}_stopSingular(){var e,t,i,n;this._removeSingleDecorations(),this.editor.hasWidgetFocus()&&(((e=this.editor.getModel())===null||e===void 0?void 0:e.uri.scheme)!==Ye.vscodeNotebookCell&&((i=(t=Ei.query)===null||t===void 0?void 0:t.modelInfo)===null||i===void 0?void 0:i.model.uri.scheme)!==Ye.vscodeNotebookCell?(Ei.query=null,this._run()):!((n=Ei.query)===null||n===void 0)&&n.modelInfo&&(Ei.query.modelInfo=null)),this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_stopAll(){this._removeAllDecorations(),this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_onPositionChanged(e){var t;if(this.occurrencesHighlight==="off"){this._stopAll();return}if(e.reason!==3&&((t=this.editor.getModel())===null||t===void 0?void 0:t.uri.scheme)!==Ye.vscodeNotebookCell){this._stopAll();return}this._run()}_getWord(){const e=this.editor.getSelection(),t=e.startLineNumber,i=e.startColumn;return this.model.isDisposed()?null:this.model.getWordAtPosition({lineNumber:t,column:i})}getOtherModelsToHighlight(e){if(!e)return[];if(e.uri.scheme===Ye.vscodeNotebookCell){const s=[],r=this.codeEditorService.listCodeEditors();for(const a of r){const l=a.getModel();l&&l!==e&&l.uri.scheme===Ye.vscodeNotebookCell&&s.push(l)}return s}const i=[],n=this.codeEditorService.listCodeEditors();for(const s of n){if(!_de(s))continue;const r=s.getModel();r&&e===r.modified&&i.push(r.modified)}if(i.length)return i;if(this.occurrencesHighlight==="singleFile")return[];for(const s of n){const r=s.getModel();r&&r!==e&&i.push(r)}return i}_run(){var e,t;let i;if(this.editor.hasWidgetFocus()){const n=this.editor.getSelection();if(!n||n.startLineNumber!==n.endLineNumber){this._stopAll();return}const s=n.startColumn,r=n.endColumn,a=this._getWord();if(!a||a.startColumn>s||a.endColumn<r){Ei.query=null,this._stopAll();return}i=this.workerRequest&&this.workerRequest.isValid(this.model,n,this.decorations),Ei.query={modelInfo:{model:this.model,selection:n},word:a}}else if(Ei.query===null)return;if(this.lastCursorPositionChangeTime=new Date().getTime(),i)this.workerRequestCompleted&&this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1,this._beginRenderDecorations());else{this._stopAll();const n=++this.workerRequestTokenId;this.workerRequestCompleted=!1;const s=this.getOtherModelsToHighlight(this.editor.getModel()),r=!!(!Ei.query.modelInfo&&Ei.query.word||((e=Ei.query.modelInfo)===null||e===void 0?void 0:e.model.uri)!==this.model.uri);!Ei.query.modelInfo||Ei.query.modelInfo.model.uri!==this.model.uri?this.workerRequest=this.computeWithModel(this.model,this.editor.getSelection(),r?Ei.query.word:null,s):this.workerRequest=this.computeWithModel(Ei.query.modelInfo.model,Ei.query.modelInfo.selection,Ei.query.word,s),(t=this.workerRequest)===null||t===void 0||t.result.then(a=>{n===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=a||[],this._beginRenderDecorations())},Ge)}}computeWithModel(e,t,i,n){return n.length?H0e(this.multiDocumentProviders,e,t,i,this.editor.getOption(129),n):V0e(this.providers,e,t,i,this.editor.getOption(129))}_beginRenderDecorations(){const e=new Date().getTime(),t=this.lastCursorPositionChangeTime+250;e>=t?(this.renderDecorationsTimer=-1,this.renderDecorations()):this.renderDecorationsTimer=setTimeout(()=>{this.renderDecorations()},t-e)}renderDecorations(){var e,t,i;this.renderDecorationsTimer=-1;const n=this.codeEditorService.listCodeEditors();for(const s of n){const r=md.get(s);if(!r)continue;const a=[],l=(e=s.getModel())===null||e===void 0?void 0:e.uri;if(l&&this.workerRequestValue.has(l)){const d=Ei.storedDecorations.get(l),c=this.workerRequestValue.get(l);if(c)for(const u of c)a.push({range:u.range,options:__e(u.kind)});let h=[];s.changeDecorations(u=>{h=u.deltaDecorations(d??[],a)}),Ei.storedDecorations=Ei.storedDecorations.set(l,h),a.length>0&&((t=r.wordHighlighter)===null||t===void 0||t.decorations.set(a),(i=r.wordHighlighter)===null||i===void 0||i._hasWordHighlights.set(!0))}}}dispose(){this._stopSingular(),this.toUnhook.dispose()}};lv.storedDecorations=new xi;lv.query=null;lv=Ei=MV([r1(4,Dt)],lv);let md=RT=class extends K{static get(e){return e.getContribution(RT.ID)}constructor(e,t,i,n){super(),this._wordHighlighter=null;const s=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new lv(e,i.documentHighlightProvider,i.multiDocumentHighlightProvider,t,n))};this._register(e.onDidChangeModel(r=>{this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),s()})),s()}get wordHighlighter(){return this._wordHighlighter}saveViewState(){return!!(this._wordHighlighter&&this._wordHighlighter.hasDecorations())}moveNext(){var e;(e=this._wordHighlighter)===null||e===void 0||e.moveNext()}moveBack(){var e;(e=this._wordHighlighter)===null||e===void 0||e.moveBack()}restoreViewState(e){this._wordHighlighter&&e&&this._wordHighlighter.restore()}dispose(){this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),super.dispose()}};md.ID="editor.contrib.wordHighlighter";md=RT=MV([r1(1,We),r1(2,Se),r1(3,Dt)],md);class PV extends we{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=md.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}class z0e extends PV{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:p("wordHighlight.next.label","Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:_L,kbOpts:{kbExpr:M.editorTextFocus,primary:65,weight:100}})}}class U0e extends PV{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:p("wordHighlight.previous.label","Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:_L,kbOpts:{kbExpr:M.editorTextFocus,primary:1089,weight:100}})}}class $0e extends we{constructor(){super({id:"editor.action.wordHighlight.trigger",label:p("wordHighlight.trigger.label","Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:_L.toNegated(),kbOpts:{kbExpr:M.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const n=md.get(t);n&&n.restoreViewState(!0)}}yt(md.ID,md,0);de(z0e);de(U0e);de($0e);class vL extends cn{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const n=$o(t.getOption(129)),s=t.getModel(),a=t.getSelections().map(l=>{const d=new V(l.positionLineNumber,l.positionColumn),c=this._move(n,s,d,this._wordNavigationType);return this._moveTo(l,c,this._inSelectionMode)});if(s.pushStackElement(),t._getViewModel().setCursorStates("moveWordCommand",3,a.map(l=>mt.fromModelSelection(l))),a.length===1){const l=new V(a[0].positionLineNumber,a[0].positionColumn);t.revealPosition(l,0)}}_moveTo(e,t,i){return i?new xe(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new xe(t.lineNumber,t.column,t.lineNumber,t.column)}}class fh extends vL{_move(e,t,i,n){return St.moveWordLeft(e,t,i,n)}}class ph extends vL{_move(e,t,i,n){return St.moveWordRight(e,t,i,n)}}class K0e extends fh{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class j0e extends fh{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class q0e extends fh{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:te.and(M.textInputFocus,(e=te.and(_v,gy))===null||e===void 0?void 0:e.negate()),primary:2063,mac:{primary:527},weight:100}})}}class G0e extends fh{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class Z0e extends fh{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class Y0e extends fh{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:te.and(M.textInputFocus,(e=te.and(_v,gy))===null||e===void 0?void 0:e.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class X0e extends fh{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,n){return super._move($o(sa.wordSeparators.defaultValue),t,i,n)}}class Q0e extends fh{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,n){return super._move($o(sa.wordSeparators.defaultValue),t,i,n)}}class J0e extends ph{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class eve extends ph{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:te.and(M.textInputFocus,(e=te.and(_v,gy))===null||e===void 0?void 0:e.negate()),primary:2065,mac:{primary:529},weight:100}})}}class tve extends ph{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class ive extends ph{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class nve extends ph{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:te.and(M.textInputFocus,(e=te.and(_v,gy))===null||e===void 0?void 0:e.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class sve extends ph{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class ove extends ph{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,n){return super._move($o(sa.wordSeparators.defaultValue),t,i,n)}}class rve extends ph{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,n){return super._move($o(sa.wordSeparators.defaultValue),t,i,n)}}class bL extends cn{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const n=e.get(Wt);if(!t.hasModel())return;const s=$o(t.getOption(129)),r=t.getModel(),a=t.getSelections(),l=t.getOption(6),d=t.getOption(11),c=n.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),h=t._getViewModel(),u=a.map(g=>{const f=this._delete({wordSeparators:s,model:r,selection:g,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:t.getOption(9),autoClosingBrackets:l,autoClosingQuotes:d,autoClosingPairs:c,autoClosedCharacters:h.getCursorAutoClosedCharacters()},this._wordNavigationType);return new kn(f,"")});t.pushUndoStop(),t.executeCommands(this.id,u),t.pushUndoStop()}}class sA extends bL{_delete(e,t){const i=St.deleteWordLeft(e,t);return i||new k(1,1,1,1)}}class oA extends bL{_delete(e,t){const i=St.deleteWordRight(e,t);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new k(n,s,n,s)}}class ave extends sA{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:M.writable})}}class lve extends sA{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:M.writable})}}class dve extends sA{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class cve extends oA{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:M.writable})}}class hve extends oA{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:M.writable})}}class uve extends oA{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class gve extends we{constructor(){super({id:"deleteInsideWord",precondition:M.writable,label:p("deleteInsideWord","Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const n=$o(t.getOption(129)),s=t.getModel(),a=t.getSelections().map(l=>{const d=St.deleteInsideWord(n,s,l);return new kn(d,"")});t.pushUndoStop(),t.executeCommands(this.id,a),t.pushUndoStop()}}ue(new K0e);ue(new j0e);ue(new q0e);ue(new G0e);ue(new Z0e);ue(new Y0e);ue(new J0e);ue(new eve);ue(new tve);ue(new ive);ue(new nve);ue(new sve);ue(new X0e);ue(new Q0e);ue(new ove);ue(new rve);ue(new ave);ue(new lve);ue(new dve);ue(new cve);ue(new hve);ue(new uve);de(gve);class fve extends bL{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){const i=qS.deleteWordPartLeft(e);return i||new k(1,1,1,1)}}class pve extends bL{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){const i=qS.deleteWordPartRight(e);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new k(n,s,n,s)}}class OV extends vL{_move(e,t,i,n){return qS.moveWordPartLeft(e,t,i)}}class mve extends OV{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}gt.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class _ve extends OV{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}gt.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class FV extends vL{_move(e,t,i,n){return qS.moveWordPartRight(e,t,i)}}class vve extends FV{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class bve extends FV{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}ue(new fve);ue(new pve);ue(new mve);ue(new _ve);ue(new vve);ue(new bve);class AT extends K{constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const e=zs.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(91);t||(this.editor.isSimpleWidget?t=new Fn(p("editor.simple.readonly","Cannot edit in read-only input")):t=new Fn(p("editor.readonly","Cannot edit in read-only editor"))),e.showMessage(t,this.editor.getPosition())}}}AT.ID="editor.contrib.readOnlyMessageController";yt(AT.ID,AT,2);export{Sve as B,xde as E,Dde as K,Mde as M,Ide as P,Ede as R,Ade as U,u3 as _,ID as a,Ode as e,Fde as l,c6 as m,Hg as p};
|
|
714
|
+
`)};const r=await s.provideRenameEdits(this.model,this.position,e,n);if(r){if(r.rejectReason)return this._provideRenameEdits(e,t+1,i.concat(r.rejectReason),n)}else return this._provideRenameEdits(e,t+1,i.concat(p("no result","No result.")),n);return r}}async function U_e(o,e,t,i){const n=new YR(e,t,o),s=await n.resolveRenameLocation(st.None);return s?.rejectReason?{edits:[],rejectReason:s.rejectReason}:n.provideRenameEdits(i,st.None)}let Yu=pT=class{static get(e){return e.getContribution(pT.ID)}constructor(e,t,i,n,s,r,a,l){this.editor=e,this._instaService=t,this._notificationService=i,this._bulkEditService=n,this._progressService=s,this._logService=r,this._configService=a,this._languageFeaturesService=l,this._disposableStore=new se,this._cts=new Wi,this._renameInputField=this._disposableStore.add(this._instaService.createInstance(fT,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){var e,t;if(this._cts.dispose(!0),this._cts=new Wi,!this.editor.hasModel())return;const i=this.editor.getPosition(),n=new YR(this.editor.getModel(),i,this._languageFeaturesService.renameProvider);if(!n.hasProvider())return;const s=new Uc(this.editor,5,void 0,this._cts.token);let r;try{const f=n.resolveRenameLocation(s.token);this._progressService.showWhile(f,250),r=await f}catch(f){(e=zs.get(this.editor))===null||e===void 0||e.showMessage(f||p("resolveRenameLocationFailed","An unknown error occurred while resolving rename location"),i);return}finally{s.dispose()}if(!r)return;if(r.rejectReason){(t=zs.get(this.editor))===null||t===void 0||t.showMessage(r.rejectReason,i);return}if(s.token.isCancellationRequested)return;const a=new Uc(this.editor,5,r.range,this._cts.token),l=this.editor.getSelection();let d=0,c=r.text.length;!k.isEmpty(l)&&!k.spansMultipleLines(l)&&k.containsRange(r.range,l)&&(d=Math.max(0,l.startColumn-r.range.startColumn),c=Math.min(r.range.endColumn,l.endColumn)-r.range.startColumn);const h=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),u=await this._renameInputField.getInput(r.range,r.text,d,c,h,a.token);if(typeof u=="boolean"){u&&this.editor.focus(),a.dispose();return}this.editor.focus();const g=DS(n.provideRenameEdits(u.newName,a.token),a.token).then(async f=>{if(!(!f||!this.editor.hasModel())){if(f.rejectReason){this._notificationService.info(f.rejectReason);return}this.editor.setSelection(k.fromPositions(this.editor.getSelection().getPosition())),this._bulkEditService.apply(f,{editor:this.editor,showPreview:u.wantsPreview,label:p("label","Renaming '{0}' to '{1}'",r?.text,u.newName),code:"undoredo.rename",quotableLabel:p("quotableLabel","Renaming {0} to {1}",r?.text,u.newName),respectAutoSaveConfig:!0}).then(m=>{m.ariaSummary&&js(p("aria","Successfully renamed '{0}' to '{1}'. Summary: {2}",r.text,u.newName,m.ariaSummary))}).catch(m=>{this._notificationService.error(p("rename.failedApply","Rename failed to apply edits")),this._logService.error(m)})}},f=>{this._notificationService.error(p("rename.failed","Rename failed to compute edits")),this._logService.error(f)}).finally(()=>{a.dispose()});return this._progressService.showWhile(g,250),g}acceptRenameInput(e){this._renameInputField.acceptInput(e)}cancelRenameInput(){this._renameInputField.cancelInput(!0)}};Yu.ID="editor.contrib.renameController";Yu=pT=z_e([Eh(1,Oe),Eh(2,Vi),Eh(3,kv),Eh(4,lh),Eh(5,Zs),Eh(6,k2),Eh(7,Se)],Yu);class $_e extends we{constructor(){super({id:"editor.action.rename",label:p("rename.label","Rename Symbol"),alias:"Rename Symbol",precondition:te.and(M.writable,M.hasRenameProvider),kbOpts:{kbExpr:M.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(Dt),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return Me.isUri(n)&&V.isIPosition(s)?i.openCodeEditor({resource:n},i.getActiveCodeEditor()).then(r=>{r&&(r.setPosition(s),r.invokeWithinContext(a=>(this.reportTelemetry(a,r),this.run(a,r))))},Ge):super.runCommand(e,t)}run(e,t){const i=Yu.get(t);return i?i.run():Promise.resolve()}}yt(Yu.ID,Yu,4);de($_e);const XR=cn.bindToContribution(Yu.get);ue(new XR({id:"acceptRenameInput",precondition:uL,handler:o=>o.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:te.and(M.focus,te.not("isComposing")),primary:3}}));ue(new XR({id:"acceptRenameInputWithPreview",precondition:te.and(uL,te.has("config.editor.rename.enablePreview")),handler:o=>o.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:te.and(M.focus,te.not("isComposing")),primary:1027}}));ue(new XR({id:"cancelRenameInput",precondition:uL,handler:o=>o.cancelRenameInput(),kbOpts:{weight:199,kbExpr:M.focus,primary:9,secondary:[1033]}}));Cl("_executeDocumentRenameProvider",function(o,e,t,...i){const[n]=i;Tt(typeof n=="string");const{renameProvider:s}=o.get(Se);return U_e(s,e,t,n)});Cl("_executePrepareRename",async function(o,e,t){const{renameProvider:i}=o.get(Se),s=await new YR(e,t,i).resolveRenameLocation(st.None);if(s?.rejectReason)throw new Error(s.rejectReason);return s});Ri.as(la.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:p("enablePreview","Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});function K_e(o){for(let e=0,t=o.length;e<t;e+=4){const i=o[e+0],n=o[e+1],s=o[e+2],r=o[e+3];o[e+0]=r,o[e+1]=s,o[e+2]=n,o[e+3]=i}}function j_e(o){const e=new Uint8Array(o.buffer,o.byteOffset,o.length*4);return D3()||K_e(e),AS.wrap(e)}function _V(o){const e=new Uint32Array(q_e(o));let t=0;if(e[t++]=o.id,o.type==="full")e[t++]=1,e[t++]=o.data.length,e.set(o.data,t),t+=o.data.length;else{e[t++]=2,e[t++]=o.deltas.length;for(const i of o.deltas)e[t++]=i.start,e[t++]=i.deleteCount,i.data?(e[t++]=i.data.length,e.set(i.data,t),t+=i.data.length):e[t++]=0}return j_e(e)}function q_e(o){let e=0;if(e+=2,o.type==="full")e+=1+o.data.length;else{e+=1,e+=3*o.deltas.length;for(const t of o.deltas)t.data&&(e+=t.data.length)}return e}function gL(o){return o&&!!o.data}function vV(o){return o&&Array.isArray(o.edits)}class G_e{constructor(e,t,i){this.provider=e,this.tokens=t,this.error=i}}function bV(o,e){return o.has(e)}function Z_e(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function CV(o,e,t,i,n){const s=Z_e(o,e),r=await Promise.all(s.map(async a=>{let l,d=null;try{l=await a.provideDocumentSemanticTokens(e,a===t?i:null,n)}catch(c){d=c,l=null}return(!l||!gL(l)&&!vV(l))&&(l=null),new G_e(a,l,d)}));for(const a of r){if(a.error)throw a.error;if(a.tokens)return a}return r.length>0?r[0]:null}function Y_e(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:null}class X_e{constructor(e,t){this.provider=e,this.tokens=t}}function Q_e(o,e){return o.has(e)}function wV(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function QR(o,e,t,i){const n=wV(o,e),s=await Promise.all(n.map(async r=>{let a;try{a=await r.provideDocumentRangeSemanticTokens(e,t,i)}catch(l){Mi(l),a=null}return(!a||!gL(a))&&(a=null),new X_e(r,a)}));for(const r of s)if(r.tokens)return r;return s.length>0?s[0]:null}gt.registerCommand("_provideDocumentSemanticTokensLegend",async(o,...e)=>{const[t]=e;Tt(t instanceof Me);const i=o.get(ii).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(Se),s=Y_e(n,i);return s?s[0].getLegend():o.get(ui).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)});gt.registerCommand("_provideDocumentSemanticTokens",async(o,...e)=>{const[t]=e;Tt(t instanceof Me);const i=o.get(ii).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(Se);if(!bV(n,i))return o.get(ui).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const s=await CV(n,i,null,null,st.None);if(!s)return;const{provider:r,tokens:a}=s;if(!a||!gL(a))return;const l=_V({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),l});gt.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(o,...e)=>{const[t,i]=e;Tt(t instanceof Me);const n=o.get(ii).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(Se),r=wV(s,n);if(r.length===0)return;if(r.length===1)return r[0].getLegend();if(!i||!k.isIRange(i))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),r[0].getLegend();const a=await QR(s,n,k.lift(i),st.None);if(a)return a.provider.getLegend()});gt.registerCommand("_provideDocumentRangeSemanticTokens",async(o,...e)=>{const[t,i]=e;Tt(t instanceof Me),Tt(k.isIRange(i));const n=o.get(ii).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(Se),r=await QR(s,n,k.lift(i),st.None);if(!(!r||!r.tokens))return _V({id:0,type:"full",data:r.tokens.data})});const JR="editor.semanticHighlighting";function mT(o,e,t){var i;const n=(i=t.getValue(JR,{overrideIdentifier:o.getLanguageId(),resource:o.uri}))===null||i===void 0?void 0:i.enabled;return typeof n=="boolean"?n:e.getColorTheme().semanticHighlighting}var SV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Na=function(o,e){return function(t,i){e(t,i,o)}},Wd;let _T=class extends K{constructor(e,t,i,n,s,r){super(),this._watchers=Object.create(null);const a=c=>{this._watchers[c.uri.toString()]=new sv(c,e,i,s,r)},l=(c,h)=>{h.dispose(),delete this._watchers[c.uri.toString()]},d=()=>{for(const c of t.getModels()){const h=this._watchers[c.uri.toString()];mT(c,i,n)?h||a(c):h&&l(c,h)}};this._register(t.onModelAdded(c=>{mT(c,i,n)&&a(c)})),this._register(t.onModelRemoved(c=>{const h=this._watchers[c.uri.toString()];h&&l(c,h)})),this._register(n.onDidChangeConfiguration(c=>{c.affectsConfiguration(JR)&&d()})),this._register(i.onDidColorThemeChange(d))}dispose(){for(const e of Object.values(this._watchers))e.dispose();super.dispose()}};_T=SV([Na(0,ty),Na(1,ii),Na(2,tn),Na(3,ft),Na(4,Zo),Na(5,Se)],_T);let sv=Wd=class extends K{constructor(e,t,i,n,s){super(),this._semanticTokensStylingService=t,this._isDisposed=!1,this._model=e,this._provider=s.documentSemanticTokensProvider,this._debounceInformation=n.for(this._provider,"DocumentSemanticTokens",{min:Wd.REQUEST_MIN_DELAY,max:Wd.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Rt(()=>this._fetchDocumentSemanticTokensNow(),Wd.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._documentProvidersChangeListeners=[],this._providersChangedDuringRequest=!1,this._register(this._model.onDidChangeContent(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeAttached(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeLanguage(()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(0)}));const r=()=>{Et(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const a of this._provider.all(e))typeof a.onDidChange=="function"&&this._documentProvidersChangeListeners.push(a.onDidChange(()=>{if(this._currentDocumentRequestCancellationTokenSource){this._providersChangedDuringRequest=!0;return}this._fetchDocumentSemanticTokens.schedule(0)}))};r(),this._register(this._provider.onDidChange(()=>{r(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(i.onDidColorThemeChange(a=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._fetchDocumentSemanticTokens.schedule(0)}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),Et(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!bV(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new Wi,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=CV(this._provider,this._model,t,i,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;const s=[],r=this._model.onDidChangeContent(l=>{s.push(l)}),a=new Hn(!1);n.then(l=>{if(this._debounceInformation.update(this._model,a.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,r.dispose(),!l)this._setDocumentSemanticTokens(null,null,null,s);else{const{provider:d,tokens:c}=l,h=this._semanticTokensStylingService.getStyling(d);this._setDocumentSemanticTokens(d,c||null,h,s)}},l=>{l&&(oa(l)||typeof l.message=="string"&&l.message.indexOf("busy")!==-1)||Ge(l),this._currentDocumentRequestCancellationTokenSource=null,r.dispose(),(s.length>0||this._providersChangedDuringRequest)&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))})}static _copy(e,t,i,n,s){s=Math.min(s,i.length-n,e.length-t);for(let r=0;r<s;r++)i[n+r]=e[t+r]}_setDocumentSemanticTokens(e,t,i,n){const s=this._currentDocumentResponse,r=()=>{(n.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed){e&&t&&e.releaseDocumentSemanticTokens(t.resultId);return}if(!e||!i){this._model.tokenization.setSemanticTokens(null,!1);return}if(!t){this._model.tokenization.setSemanticTokens(null,!0),r();return}if(vV(t)){if(!s){this._model.tokenization.setSemanticTokens(null,!0);return}if(t.edits.length===0)t={resultId:t.resultId,data:s.data};else{let a=0;for(const u of t.edits)a+=(u.data?u.data.length:0)-u.deleteCount;const l=s.data,d=new Uint32Array(l.length+a);let c=l.length,h=d.length;for(let u=t.edits.length-1;u>=0;u--){const g=t.edits[u];if(g.start>l.length){i.warnInvalidEditStart(s.resultId,t.resultId,u,g.start,l.length),this._model.tokenization.setSemanticTokens(null,!0);return}const f=c-(g.start+g.deleteCount);f>0&&(Wd._copy(l,c-f,d,h-f,f),h-=f),g.data&&(Wd._copy(g.data,0,d,h-g.data.length,g.data.length),h-=g.data.length),c=g.start}c>0&&Wd._copy(l,0,d,0,c),t={resultId:t.resultId,data:d}}}if(gL(t)){this._currentDocumentResponse=new J_e(e,t.resultId,t.data);const a=k7(t,i,this._model.getLanguageId());if(n.length>0)for(const l of n)for(const d of a)for(const c of l.changes)d.applyEdit(c.range,c.text);this._model.tokenization.setSemanticTokens(a,!0)}else this._model.tokenization.setSemanticTokens(null,!0);r()}};sv.REQUEST_MIN_DELAY=300;sv.REQUEST_MAX_DELAY=2e3;sv=Wd=SV([Na(1,ty),Na(2,tn),Na(3,Zo),Na(4,Se)],sv);class J_e{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}yy(_T);var e0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Nm=function(o,e){return function(t,i){e(t,i,o)}};let ov=class extends K{constructor(e,t,i,n,s,r){super(),this._semanticTokensStylingService=t,this._themeService=i,this._configurationService=n,this._editor=e,this._provider=r.documentRangeSemanticTokensProvider,this._debounceInformation=s.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new Rt(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[];const a=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))};this._register(this._editor.onDidScrollChange(()=>{a()})),this._register(this._editor.onDidChangeModel(()=>{this._cancelAll(),a()})),this._register(this._editor.onDidChangeModelContent(l=>{this._cancelAll(),a()})),this._register(this._provider.onDidChange(()=>{this._cancelAll(),a()})),this._register(this._configurationService.onDidChangeConfiguration(l=>{l.affectsConfiguration(JR)&&(this._cancelAll(),a())})),this._register(this._themeService.onDidColorThemeChange(()=>{this._cancelAll(),a()})),a()}_cancelAll(){for(const e of this._outstandingRequests)e.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(e){for(let t=0,i=this._outstandingRequests.length;t<i;t++)if(this._outstandingRequests[t]===e){this._outstandingRequests.splice(t,1);return}}_tokenizeViewportNow(){if(!this._editor.hasModel())return;const e=this._editor.getModel();if(e.tokenization.hasCompleteSemanticTokens())return;if(!mT(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!Q_e(this._provider,e)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}const t=this._editor.getVisibleRangesPlusViewportAboveBelow();this._outstandingRequests=this._outstandingRequests.concat(t.map(i=>this._requestRange(e,i)))}_requestRange(e,t){const i=e.getVersionId(),n=Zi(r=>Promise.resolve(QR(this._provider,e,t,r))),s=new Hn(!1);return n.then(r=>{if(this._debounceInformation.update(e,s.elapsed()),!r||!r.tokens||e.isDisposed()||e.getVersionId()!==i)return;const{provider:a,tokens:l}=r,d=this._semanticTokensStylingService.getStyling(a);e.tokenization.setPartialSemanticTokens(t,k7(l,d,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}};ov.ID="editor.contrib.viewportSemanticTokens";ov=e0e([Nm(1,ty),Nm(2,tn),Nm(3,ft),Nm(4,Zo),Nm(5,Se)],ov);yt(ov.ID,ov,1);class t0e{constructor(e=!0){this.selectSubwords=e}provideSelectionRanges(e,t){const i=[];for(const n of t){const s=[];i.push(s),this.selectSubwords&&this._addInWordRanges(s,e,n),this._addWordRanges(s,e,n),this._addWhitespaceLine(s,e,n),s.push({range:e.getFullModelRange()})}return i}_addInWordRanges(e,t,i){const n=t.getWordAtPosition(i);if(!n)return;const{word:s,startColumn:r}=n,a=i.column-r;let l=a,d=a,c=0;for(;l>=0;l--){const h=s.charCodeAt(l);if(l!==a&&(h===95||h===45))break;if(Yd(h)&&Da(c))break;c=h}for(l+=1;d<s.length;d++){const h=s.charCodeAt(d);if(Da(h)&&Yd(c))break;if(h===95||h===45)break;c=h}l<d&&e.push({range:new k(i.lineNumber,r+l,i.lineNumber,r+d)})}_addWordRanges(e,t,i){const n=t.getWordAtPosition(i);n&&e.push({range:new k(i.lineNumber,n.startColumn,i.lineNumber,n.endColumn)})}_addWhitespaceLine(e,t,i){t.getLineLength(i.lineNumber)>0&&t.getLineFirstNonWhitespaceColumn(i.lineNumber)===0&&t.getLineLastNonWhitespaceColumn(i.lineNumber)===0&&e.push({range:new k(i.lineNumber,1,i.lineNumber,t.getLineMaxColumn(i.lineNumber))})}}var i0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},n0e=function(o,e){return function(t,i){e(t,i,o)}},vT;class eA{constructor(e,t){this.index=e,this.ranges=t}mov(e){const t=this.index+(e?1:-1);if(t<0||t>=this.ranges.length)return this;const i=new eA(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}let Ep=vT=class{static get(e){return e.getContribution(vT.ID)}constructor(e,t){this._editor=e,this._languageFeaturesService=t,this._ignoreSelection=!1}dispose(){var e;(e=this._selectionListener)===null||e===void 0||e.dispose()}async run(e){if(!this._editor.hasModel())return;const t=this._editor.getSelections(),i=this._editor.getModel();if(this._state||await LV(this._languageFeaturesService.selectionRangeProvider,i,t.map(s=>s.getPosition()),this._editor.getOption(112),st.None).then(s=>{var r;if(!(!Bn(s)||s.length!==t.length)&&!(!this._editor.hasModel()||!_i(this._editor.getSelections(),t,(a,l)=>a.equalsSelection(l)))){for(let a=0;a<s.length;a++)s[a]=s[a].filter(l=>l.containsPosition(t[a].getStartPosition())&&l.containsPosition(t[a].getEndPosition())),s[a].unshift(t[a]);this._state=s.map(a=>new eA(0,a)),(r=this._selectionListener)===null||r===void 0||r.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition(()=>{var a;this._ignoreSelection||((a=this._selectionListener)===null||a===void 0||a.dispose(),this._state=void 0)})}}),!this._state)return;this._state=this._state.map(s=>s.mov(e));const n=this._state.map(s=>xe.fromPositions(s.ranges[s.index].getStartPosition(),s.ranges[s.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}};Ep.ID="editor.contrib.smartSelectController";Ep=vT=i0e([n0e(1,Se)],Ep);class yV extends we{constructor(e,t){super(t),this._forward=e}async run(e,t){const i=Ep.get(t);i&&await i.run(this._forward)}}class s0e extends yV{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:p("smartSelect.expand","Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:N.MenubarSelectionMenu,group:"1_basic",title:p({},"&&Expand Selection"),order:2}})}}gt.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class o0e extends yV{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:p("smartSelect.shrink","Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:N.MenubarSelectionMenu,group:"1_basic",title:p({},"&&Shrink Selection"),order:3}})}}yt(Ep.ID,Ep,4);de(s0e);de(o0e);async function LV(o,e,t,i,n){const s=o.all(e).concat(new t0e(i.selectSubwords));s.length===1&&s.unshift(new ao);const r=[],a=[];for(const l of s)r.push(Promise.resolve(l.provideSelectionRanges(e,t,n)).then(d=>{if(Bn(d)&&d.length===t.length)for(let c=0;c<t.length;c++){a[c]||(a[c]=[]);for(const h of d[c])k.isIRange(h.range)&&k.containsPosition(h.range,t[c])&&a[c].push(k.lift(h.range))}},Mi));return await Promise.all(r),a.map(l=>{if(l.length===0)return[];l.sort((u,g)=>V.isBefore(u.getStartPosition(),g.getStartPosition())?1:V.isBefore(g.getStartPosition(),u.getStartPosition())||V.isBefore(u.getEndPosition(),g.getEndPosition())?-1:V.isBefore(g.getEndPosition(),u.getEndPosition())?1:0);const d=[];let c;for(const u of l)(!c||k.containsRange(u,c)&&!k.equalsRange(u,c))&&(d.push(u),c=u);if(!i.selectLeadingAndTrailingWhitespace)return d;const h=[d[0]];for(let u=1;u<d.length;u++){const g=d[u-1],f=d[u];if(f.startLineNumber!==g.startLineNumber||f.endLineNumber!==g.endLineNumber){const m=new k(g.startLineNumber,e.getLineFirstNonWhitespaceColumn(g.startLineNumber),g.endLineNumber,e.getLineLastNonWhitespaceColumn(g.endLineNumber));m.containsRange(g)&&!m.equalsRange(g)&&f.containsRange(m)&&!f.equalsRange(m)&&h.push(m);const _=new k(g.startLineNumber,1,g.endLineNumber,e.getLineMaxColumn(g.endLineNumber));_.containsRange(g)&&!_.equalsRange(m)&&f.containsRange(_)&&!f.equalsRange(_)&&h.push(_)}h.push(f)}return h})}gt.registerCommand("_executeSelectionRangeProvider",async function(o,...e){const[t,i]=e;Tt(Me.isUri(t));const n=o.get(Se).selectionRangeProvider,s=await o.get(ks).createModelReference(t);try{return LV(n,s.object.textEditorModel,i,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},st.None)}finally{s.dispose()}});const r0e=Object.freeze({View:{value:p("view","View"),original:"View"},Help:{value:p("help","Help"),original:"Help"},Test:{value:p("test","Test"),original:"Test"},File:{value:p("file","File"),original:"File"},Preferences:{value:p("preferences","Preferences"),original:"Preferences"},Developer:{value:p({},"Developer"),original:"Developer"}});class i3{constructor(e,t,i,n=null){this.startLineNumbers=e,this.endLineNumbers=t,this.lastLineRelativePosition=i,this.showEndForLine=n}equals(e){return!!e&&this.lastLineRelativePosition===e.lastLineRelativePosition&&this.showEndForLine===e.showEndForLine&&_i(this.startLineNumbers,e.startLineNumbers)&&_i(this.endLineNumbers,e.endLineNumbers)}}const n3=vd("stickyScrollViewLayer",{createHTML:o=>o}),LD="data-sticky-line-index",s3="data-sticky-is-line",a0e="data-sticky-is-line-number",o3="data-sticky-is-folding-icon";class l0e extends K{constructor(e){super(),this._editor=e,this._foldingIconStore=new se,this._rootDomNode=document.createElement("div"),this._lineNumbersDomNode=document.createElement("div"),this._linesDomNodeScrollable=document.createElement("div"),this._linesDomNode=document.createElement("div"),this._lineHeight=this._editor.getOption(66),this._stickyLines=[],this._lineNumbers=[],this._lastLineRelativePosition=0,this._minContentWidthInPx=0,this._isOnGlyphMargin=!1,this._lineNumbersDomNode.className="sticky-widget-line-numbers",this._lineNumbersDomNode.setAttribute("role","none"),this._linesDomNode.className="sticky-widget-lines",this._linesDomNode.setAttribute("role","list"),this._linesDomNodeScrollable.className="sticky-widget-lines-scrollable",this._linesDomNodeScrollable.appendChild(this._linesDomNode),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",e instanceof Gc),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable);const t=()=>{this._linesDomNode.style.left=this._editor.getOption(114).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(114)&&t(),i.hasChanged(66)&&(this._lineHeight=this._editor.getOption(66))})),this._register(this._editor.onDidScrollChange(i=>{i.scrollLeftChanged&&t(),i.scrollWidthChanged&&this._updateWidgetWidth()})),this._register(this._editor.onDidChangeModel(()=>{t(),this._updateWidgetWidth()})),this._register(this._foldingIconStore),t(),this._register(this._editor.onDidLayoutChange(i=>{this._updateWidgetWidth()})),this._updateWidgetWidth()}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getStickyLineForLine(e){return this._stickyLines.find(t=>t.lineNumber===e)}getCurrentLines(){return this._lineNumbers}setState(e,t,i=1/0){if((!this._previousState&&!e||this._previousState&&this._previousState.equals(e))&&i===1/0)return;this._previousState=e;const n=this._stickyLines;if(this._clearStickyWidget(),!e||!this._editor._getViewModel())return;if(e.startLineNumbers.length*this._lineHeight+e.lastLineRelativePosition>0){this._lastLineRelativePosition=e.lastLineRelativePosition;const r=[...e.startLineNumbers];e.showEndForLine!==null&&(r[e.showEndForLine]=e.endLineNumbers[e.showEndForLine]),this._lineNumbers=r}else this._lastLineRelativePosition=0,this._lineNumbers=[];this._renderRootNode(n,t,i)}_updateWidgetWidth(){const e=this._editor.getLayoutInfo(),t=e.contentLeft;this._lineNumbersDomNode.style.width=`${t}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",`${this._editor.getScrollWidth()-e.verticalScrollbarWidth}px`),this._rootDomNode.style.width=`${e.width-e.verticalScrollbarWidth}px`}_clearStickyWidget(){this._stickyLines=[],this._foldingIconStore.clear(),bn(this._lineNumbersDomNode),bn(this._linesDomNode),this._rootDomNode.style.display="none"}_useFoldingOpacityTransition(e){this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition",`opacity ${e?.5:0}s`)}_setFoldingIconsVisibility(e){for(const t of this._stickyLines){const i=t.foldingIcon;i&&i.setVisible(e?!0:i.isCollapsed)}}async _renderRootNode(e,t,i=1/0){const n=this._editor.getLayoutInfo();for(const[r,a]of this._lineNumbers.entries()){const l=e[r],d=a>=i||l?.lineNumber!==a?this._renderChildNode(r,a,t,n):this._updateTopAndZIndexOfStickyLine(l);d&&(this._linesDomNode.appendChild(d.lineDomNode),this._lineNumbersDomNode.appendChild(d.lineNumberDomNode),this._stickyLines.push(d))}t&&(this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin));const s=this._lineNumbers.length*this._lineHeight+this._lastLineRelativePosition;if(s===0){this._clearStickyWidget();return}this._rootDomNode.style.display="block",this._lineNumbersDomNode.style.height=`${s}px`,this._linesDomNodeScrollable.style.height=`${s}px`,this._rootDomNode.style.height=`${s}px`,this._rootDomNode.style.marginLeft="0px",this._updateMinContentWidth(),this._editor.layoutOverlayWidget(this)}_setFoldingHoverListeners(){this._editor.getOption(109)==="mouseover"&&(this._foldingIconStore.add(Q(this._lineNumbersDomNode,ge.MOUSE_ENTER,t=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(Q(this._lineNumbersDomNode,ge.MOUSE_LEAVE,()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)})))}_renderChildNode(e,t,i,n){const s=this._editor._getViewModel();if(!s)return;const r=s.coordinatesConverter.convertModelPositionToViewPosition(new V(t,1)).lineNumber,a=s.getViewLineRenderingData(r),l=this._editor.getOption(67);let d;try{d=Ws.filter(a.inlineDecorations,r,a.minColumn,a.maxColumn)}catch{d=[]}const c=new rh(!0,!0,a.content,a.continuesWithWrappedLine,a.isBasicASCII,a.containsRTL,0,a.tokens,d,a.tabSize,a.startVisibleColumn,1,1,1,500,"none",!0,!0,null),h=new Op(2e3),u=mv(c,h);let g;n3?g=n3.createHTML(h.build()):g=h.build();const f=document.createElement("span");f.setAttribute(LD,String(e)),f.setAttribute(s3,""),f.setAttribute("role","listitem"),f.tabIndex=0,f.className="sticky-line-content",f.classList.add(`stickyLine${t}`),f.style.lineHeight=`${this._lineHeight}px`,f.innerHTML=g;const m=document.createElement("span");m.setAttribute(LD,String(e)),m.setAttribute(a0e,""),m.className="sticky-line-number",m.style.lineHeight=`${this._lineHeight}px`;const _=n.contentLeft;m.style.width=`${_}px`;const v=document.createElement("span");l.renderType===1||l.renderType===3&&t%10===0?v.innerText=t.toString():l.renderType===2&&(v.innerText=Math.abs(t-this._editor.getPosition().lineNumber).toString()),v.className="sticky-line-number-inner",v.style.lineHeight=`${this._lineHeight}px`,v.style.width=`${n.lineNumbersWidth}px`,v.style.paddingLeft=`${n.lineNumbersLeft}px`,m.appendChild(v);const b=this._renderFoldingIconForLine(i,t);b&&m.appendChild(b.domNode),this._editor.applyFontInfo(f),this._editor.applyFontInfo(v),m.style.lineHeight=`${this._lineHeight}px`,f.style.lineHeight=`${this._lineHeight}px`,m.style.height=`${this._lineHeight}px`,f.style.height=`${this._lineHeight}px`;const C=new d0e(e,t,f,m,b,u.characterMapping);return this._updateTopAndZIndexOfStickyLine(C)}_updateTopAndZIndexOfStickyLine(e){var t;const i=e.index,n=e.lineDomNode,s=e.lineNumberDomNode,r=i===this._lineNumbers.length-1,a="0",l="1";n.style.zIndex=r?a:l,s.style.zIndex=r?a:l;const d=`${i*this._lineHeight+this._lastLineRelativePosition+(!((t=e.foldingIcon)===null||t===void 0)&&t.isCollapsed?1:0)}px`,c=`${i*this._lineHeight}px`;return n.style.top=r?d:c,s.style.top=r?d:c,e}_renderFoldingIconForLine(e,t){const i=this._editor.getOption(109);if(!e||i==="never")return;const n=e.regions,s=n.findRange(t),r=n.getStartLineNumber(s);if(!(t===r))return;const l=n.isCollapsed(s),d=new c0e(l,r,n.getEndLineNumber(s),this._lineHeight);return d.setVisible(this._isOnGlyphMargin?!0:l||i==="always"),d.domNode.setAttribute(o3,""),d}_updateMinContentWidth(){this._minContentWidthInPx=0;for(const e of this._stickyLines)e.lineDomNode.scrollWidth>this._minContentWidthInPx&&(this._minContentWidthInPx=e.lineDomNode.scrollWidth);this._minContentWidthInPx+=this._editor.getLayoutInfo().verticalScrollbarWidth}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:null}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(e){0<=e&&e<this._stickyLines.length&&this._stickyLines[e].lineDomNode.focus()}getEditorPositionFromNode(e){if(!e||e.children.length>0)return null;const t=this._getRenderedStickyLineFromChildDomNode(e);if(!t)return null;const i=z2(t.characterMapping,e,0);return new V(t.lineNumber,i)}getLineNumberFromChildDomNode(e){var t,i;return(i=(t=this._getRenderedStickyLineFromChildDomNode(e))===null||t===void 0?void 0:t.lineNumber)!==null&&i!==void 0?i:null}_getRenderedStickyLineFromChildDomNode(e){const t=this.getLineIndexFromChildDomNode(e);return t===null||t<0||t>=this._stickyLines.length?null:this._stickyLines[t]}getLineIndexFromChildDomNode(e){const t=this._getAttributeValue(e,LD);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,s3)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,o3)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){const i=e.getAttribute(t);if(i!==null)return i;e=e.parentElement}}}class d0e{constructor(e,t,i,n,s,r){this.index=e,this.lineNumber=t,this.lineDomNode=i,this.lineNumberDomNode=n,this.foldingIcon=s,this.characterMapping=r}}class c0e{constructor(e,t,i,n){this.isCollapsed=e,this.foldingStartLine=t,this.foldingEndLine=i,this.dimension=n,this.domNode=document.createElement("div"),this.domNode.style.width=`${n}px`,this.domNode.style.height=`${n}px`,this.domNode.className=Re.asClassName(e?Zy:Gy)}setVisible(e){this.domNode.style.cursor=e?"pointer":"default",this.domNode.style.opacity=e?"1":"0"}}class N_{constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}}class rS{constructor(e,t,i){this.range=e,this.children=t,this.parent=i}}class xV{constructor(e,t,i,n){this.uri=e,this.version=t,this.element=i,this.outlineProviderId=n}}var fL=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},rv=function(o,e){return function(t,i){e(t,i,o)}},T_;(function(o){o.OUTLINE_MODEL="outlineModel",o.FOLDING_PROVIDER_MODEL="foldingProviderModel",o.INDENTATION_MODEL="indentationModel"})(T_||(T_={}));var dc;(function(o){o[o.VALID=0]="VALID",o[o.INVALID=1]="INVALID",o[o.CANCELED=2]="CANCELED"})(dc||(dc={}));let bT=class extends K{constructor(e,t,i,n){super(),this._editor=e,this._languageConfigurationService=t,this._languageFeaturesService=i,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new vr(300)),this._updateOperation=this._register(new se);const s=new CT(i),r=new ST(this._editor,i),a=new wT(this._editor,t);switch(n){case T_.OUTLINE_MODEL:this._modelProviders.push(s),this._modelProviders.push(r),this._modelProviders.push(a);break;case T_.FOLDING_PROVIDER_MODEL:this._modelProviders.push(r),this._modelProviders.push(a);break;case T_.INDENTATION_MODEL:this._modelProviders.push(a);break}}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}async update(e,t,i){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),await this._updateScheduler.trigger(async()=>{for(const n of this._modelProviders){const{statusPromise:s,modelPromise:r}=n.computeStickyModel(e,t,i);this._modelPromise=r;const a=await s;if(this._modelPromise!==r)return null;switch(a){case dc.CANCELED:return this._updateOperation.clear(),null;case dc.VALID:return n.stickyModel}}return null}).catch(n=>(Ge(n),null))}};bT=fL([rv(1,Wt),rv(2,Se)],bT);class DV{constructor(){this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,dc.INVALID}computeStickyModel(e,t,i){if(i.isCancellationRequested||!this.isProviderValid(e))return{statusPromise:this._invalid(),modelPromise:null};const n=Zi(s=>this.createModelFromProvider(e,t,s));return{statusPromise:n.then(s=>this.isModelValid(s)?i.isCancellationRequested?dc.CANCELED:(this._stickyModel=this.createStickyModel(e,t,i,s),dc.VALID):this._invalid()).then(void 0,s=>(Ge(s),dc.CANCELED)),modelPromise:n}}isModelValid(e){return!0}isProviderValid(e){return!0}}let CT=class extends DV{constructor(e){super(),this._languageFeaturesService=e}createModelFromProvider(e,t,i){return zl.create(this._languageFeaturesService.documentSymbolProvider,e,i)}createStickyModel(e,t,i,n){var s;const{stickyOutlineElement:r,providerID:a}=this._stickyModelFromOutlineModel(n,(s=this._stickyModel)===null||s===void 0?void 0:s.outlineProviderId);return new xV(e.uri,t,r,a)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(rt.first(e.children.values())instanceof YW){const a=rt.find(e.children.values(),l=>l.id===t);if(a)i=a.children;else{let l="",d=-1,c;for(const[h,u]of e.children.entries()){const g=this._findSumOfRangesOfGroup(u);g>d&&(c=u,d=g,l=u.id)}t=l,i=c.children}}else i=e.children;const n=[],s=Array.from(i.values()).sort((a,l)=>{const d=new N_(a.symbol.range.startLineNumber,a.symbol.range.endLineNumber),c=new N_(l.symbol.range.startLineNumber,l.symbol.range.endLineNumber);return this._comparator(d,c)});for(const a of s)n.push(this._stickyModelFromOutlineElement(a,a.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new rS(void 0,n,void 0),providerID:t}}_stickyModelFromOutlineElement(e,t){const i=[];for(const s of e.children.values())if(s.symbol.selectionRange.startLineNumber!==s.symbol.range.endLineNumber)if(s.symbol.selectionRange.startLineNumber!==t)i.push(this._stickyModelFromOutlineElement(s,s.symbol.selectionRange.startLineNumber));else for(const r of s.children.values())i.push(this._stickyModelFromOutlineElement(r,s.symbol.selectionRange.startLineNumber));i.sort((s,r)=>this._comparator(s.range,r.range));const n=new N_(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new rS(n,i,void 0)}_comparator(e,t){return e.startLineNumber!==t.startLineNumber?e.startLineNumber-t.startLineNumber:t.endLineNumber-e.endLineNumber}_findSumOfRangesOfGroup(e){let t=0;for(const i of e.children.values())t+=this._findSumOfRangesOfGroup(i);return e instanceof zN?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};CT=fL([rv(0,Se)],CT);class kV extends DV{constructor(e){super(),this._foldingLimitReporter=new qW(e)}createStickyModel(e,t,i,n){const s=this._fromFoldingRegions(n);return new xV(e.uri,t,s,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){const t=e.length,i=[],n=new rS(void 0,[],void 0);for(let s=0;s<t;s++){const r=e.getParentIndex(s);let a;r!==-1?a=i[r]:a=n;const l=new rS(new N_(e.getStartLineNumber(s),e.getEndLineNumber(s)+1),[],a);a.children.push(l),i.push(l)}return n}}let wT=class extends kV{constructor(e,t){super(e),this._languageConfigurationService=t}createModelFromProvider(e,t,i){return new FR(e,this._languageConfigurationService,this._foldingLimitReporter).compute(i)}};wT=fL([rv(1,Wt)],wT);let ST=class extends kV{constructor(e,t){super(e),this._languageFeaturesService=t}isProviderValid(e){return _l.getFoldingRangeProviders(this._languageFeaturesService,e).length>0}createModelFromProvider(e,t,i){const n=_l.getFoldingRangeProviders(this._languageFeaturesService,e);return new WR(e,n,()=>this.createModelFromProvider(e,t,i),this._foldingLimitReporter,void 0).compute(i)}};ST=fL([rv(1,Se)],ST);var h0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},r3=function(o,e){return function(t,i){e(t,i,o)}};class u0e{constructor(e,t,i){this.startLineNumber=e,this.endLineNumber=t,this.nestingDepth=i}}let yT=class extends K{constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new W),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._options=null,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new se),this._updateSoon=this._register(new Rt(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(114)&&this.readConfiguration()})),this.readConfiguration()}readConfiguration(){this._stickyModelProvider=null,this._sessionStore.clear(),this._options=this._editor.getOption(114),this._options.enabled&&(this._stickyModelProvider=this._sessionStore.add(new bT(this._editor,this._languageConfigurationService,this._languageFeaturesService,this._options.defaultModel)),this._sessionStore.add(this._editor.onDidChangeModel(()=>{this._model=null,this._onDidChangeStickyScroll.fire(),this.update()})),this._sessionStore.add(this._editor.onDidChangeHiddenAreas(()=>this.update())),this._sessionStore.add(this._editor.onDidChangeModelContent(()=>this._updateSoon.schedule())),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>this.update())),this.update())}getVersionId(){var e;return(e=this._model)===null||e===void 0?void 0:e.version}async update(){var e;(e=this._cts)===null||e===void 0||e.dispose(!0),this._cts=new Wi,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(e){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization()){this._model=null;return}const t=this._editor.getModel(),i=t.getVersionId(),n=await this._stickyModelProvider.update(t,i,e);e.isCancellationRequested||(this._model=n)}updateIndex(e){return e===-1?e=0:e<0&&(e=-e-2),e}getCandidateStickyLinesIntersectingFromStickyModel(e,t,i,n,s){if(t.children.length===0)return;let r=s;const a=[];for(let c=0;c<t.children.length;c++){const h=t.children[c];h.range&&a.push(h.range.startLineNumber)}const l=this.updateIndex(M_(a,e.startLineNumber,(c,h)=>c-h)),d=this.updateIndex(M_(a,e.startLineNumber+n,(c,h)=>c-h));for(let c=l;c<=d;c++){const h=t.children[c];if(!h)return;if(h.range){const u=h.range.startLineNumber,g=h.range.endLineNumber;e.startLineNumber<=g+1&&u-1<=e.endLineNumber&&u!==r&&(r=u,i.push(new u0e(u,g-1,n+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,h,i,n+1,u))}else this.getCandidateStickyLinesIntersectingFromStickyModel(e,h,i,n,s)}}getCandidateStickyLinesIntersecting(e){var t,i;if(!(!((t=this._model)===null||t===void 0)&&t.element))return[];let n=[];this.getCandidateStickyLinesIntersectingFromStickyModel(e,this._model.element,n,0,-1);const s=(i=this._editor._getViewModel())===null||i===void 0?void 0:i.getHiddenAreas();if(s)for(const r of s)n=n.filter(a=>!(a.startLineNumber>=r.startLineNumber&&a.endLineNumber<=r.endLineNumber+1));return n}};yT=h0e([r3(1,Se),r3(2,Wt)],yT);var g0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ag=function(o,e){return function(t,i){e(t,i,o)}},LT;let vl=LT=class extends K{constructor(e,t,i,n,s,r,a){super(),this._editor=e,this._contextMenuService=t,this._languageFeaturesService=i,this._instaService=n,this._contextKeyService=a,this._sessionStore=new se,this._foldingModel=null,this._maxStickyLines=Number.MAX_SAFE_INTEGER,this._candidateDefinitionsLength=-1,this._focusedStickyElementIndex=-1,this._enabled=!1,this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1,this._endLineNumbers=[],this._showEndForLine=null,this._stickyScrollWidget=new l0e(this._editor),this._stickyLineCandidateProvider=new yT(this._editor,i,s),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=new i3([],[],0),this._readConfiguration();const l=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration(c=>{(c.hasChanged(114)||c.hasChanged(72)||c.hasChanged(66)||c.hasChanged(109))&&this._readConfiguration()})),this._register(Q(l,ge.CONTEXT_MENU,async c=>{this._onContextMenu(Ue(l),c)})),this._stickyScrollFocusedContextKey=M.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=M.stickyScrollVisible.bindTo(this._contextKeyService);const d=this._register(dl(l));this._register(d.onDidBlur(c=>{this._positionRevealed===!1&&l.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(d.onDidFocus(c=>{this.focus()})),this._registerMouseListeners(),this._register(Q(l,ge.MOUSE_DOWN,c=>{this._onMouseDown=!0}))}static get(e){return e.getContribution(LT.ID)}_disposeFocusStickyScrollStore(){var e;this._stickyScrollFocusedContextKey.set(!1),(e=this._focusDisposableStore)===null||e===void 0||e.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}focus(){if(this._onMouseDown){this._onMouseDown=!1,this._editor.focus();return}this._stickyScrollFocusedContextKey.get()!==!0&&(this._focused=!0,this._focusDisposableStore=new se,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex<this._stickyScrollWidget.lineNumberCount-1&&this._focusNav(!0)}focusPrevious(){this._focusedStickyElementIndex>0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(e){this._focusedStickyElementIndex=e?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){const e=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:e[this._focusedStickyElementIndex],column:1})}_revealPosition(e){this._reveaInEditor(e,()=>this._editor.revealPosition(e))}_revealLineInCenterIfOutsideViewport(e){this._reveaInEditor(e,()=>this._editor.revealLineInCenterIfOutsideViewport(e.lineNumber,0))}_reveaInEditor(e,t){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,t(),this._editor.setSelection(k.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){const e=this._register(new se),t=this._register(new Ry(this._editor,{extractLineNumberFromMouseEvent:s=>{const r=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);return r?r.lineNumber:0}})),i=s=>{if(!this._editor.hasModel()||s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return null;const r=s.target.element;if(!r||r.innerText!==r.innerHTML)return null;const a=this._stickyScrollWidget.getEditorPositionFromNode(r);return a?{range:new k(a.lineNumber,a.column,a.lineNumber,a.column+r.innerText.length),textElement:r}:null},n=this._stickyScrollWidget.getDomNode();this._register(vi(n,ge.CLICK,s=>{if(s.ctrlKey||s.altKey||s.metaKey||!s.leftButton)return;if(s.shiftKey){const d=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(d===null)return;const c=new V(this._endLineNumbers[d],1);this._revealLineInCenterIfOutsideViewport(c);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(s.target)){const d=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);this._toggleFoldingRegionForLine(d);return}if(!this._stickyScrollWidget.isInStickyLine(s.target))return;let l=this._stickyScrollWidget.getEditorPositionFromNode(s.target);if(!l){const d=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);if(d===null)return;l=new V(d,1)}this._revealPosition(l)})),this._register(vi(n,ge.MOUSE_MOVE,s=>{if(s.shiftKey){const r=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(r===null||this._showEndForLine!==null&&this._showEndForLine===r)return;this._showEndForLine=r,this._renderStickyScroll();return}this._showEndForLine!==null&&(this._showEndForLine=null,this._renderStickyScroll())})),this._register(Q(n,ge.MOUSE_LEAVE,s=>{this._showEndForLine!==null&&(this._showEndForLine=null,this._renderStickyScroll())})),this._register(t.onMouseMoveOrRelevantKeyDown(([s,r])=>{const a=i(s);if(!a||!s.hasTriggerModifier||!this._editor.hasModel()){e.clear();return}const{range:l,textElement:d}=a;if(!l.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=l,e.clear();else if(d.style.textDecoration==="underline")return;const c=new Wi;e.add(Ae(()=>c.dispose(!0)));let h;Wy(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new V(l.startLineNumber,l.startColumn+1),c.token).then(u=>{if(!c.token.isCancellationRequested)if(u.length!==0){this._candidateDefinitionsLength=u.length;const g=d;h!==g?(e.clear(),h=g,h.style.textDecoration="underline",e.add(Ae(()=>{h.style.textDecoration="none"}))):h||(h=g,h.style.textDecoration="underline",e.add(Ae(()=>{h.style.textDecoration="none"})))}else e.clear()})})),this._register(t.onCancel(()=>{e.clear()})),this._register(t.onExecute(async s=>{if(s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return;const r=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);r&&(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:r.lineNumber,column:1})),this._instaService.invokeFunction(sV,s,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor}))}))}_onContextMenu(e,t){const i=new lr(e,t);this._contextMenuService.showContextMenu({menuId:N.StickyScrollContext,getAnchor:()=>i})}_toggleFoldingRegionForLine(e){if(!this._foldingModel||e===null)return;const t=this._stickyScrollWidget.getStickyLineForLine(e),i=t?.foldingIcon;if(!i)return;zW(this._foldingModel,Number.MAX_VALUE,[e]),i.isCollapsed=!i.isCollapsed;const n=(i.isCollapsed?this._editor.getTopForLineNumber(i.foldingEndLine):this._editor.getTopForLineNumber(i.foldingStartLine))-this._editor.getOption(66)*t.index+1;this._editor.setScrollTop(n),this._renderStickyScroll(e)}_readConfiguration(){const e=this._editor.getOption(114);if(e.enabled===!1){this._editor.removeOverlayWidget(this._stickyScrollWidget),this._sessionStore.clear(),this._enabled=!1;return}else e.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange(i=>{i.scrollTopChanged&&(this._showEndForLine=null,this._renderStickyScroll())})),this._sessionStore.add(this._editor.onDidLayoutChange(()=>this._onDidResize())),this._sessionStore.add(this._editor.onDidChangeModelTokens(i=>this._onTokensChange(i))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(()=>{this._showEndForLine=null,this._renderStickyScroll()})),this._enabled=!0);this._editor.getOption(67).renderType===2&&this._sessionStore.add(this._editor.onDidChangeCursorPosition(()=>{this._showEndForLine=null,this._renderStickyScroll(-1)}))}_needsUpdate(e){const t=this._stickyScrollWidget.getCurrentLines();for(const i of t)for(const n of e.ranges)if(i>=n.fromLineNumber&&i<=n.toLineNumber)return!0;return!1}_onTokensChange(e){this._needsUpdate(e)&&this._renderStickyScroll(-1)}_onDidResize(){const t=this._editor.getLayoutInfo().height/this._editor.getOption(66);this._maxStickyLines=Math.round(t*.25)}async _renderStickyScroll(e=1/0){var t,i;const n=this._editor.getModel();if(!n||n.isTooLargeForTokenization()){this._foldingModel=null,this._stickyScrollWidget.setState(void 0,null,e);return}const s=this._stickyLineCandidateProvider.getVersionId();if(s===void 0||s===n.getVersionId())if(this._foldingModel=(i=await((t=_l.get(this._editor))===null||t===void 0?void 0:t.getFoldingModel()))!==null&&i!==void 0?i:null,this._widgetState=this.findScrollWidgetState(),this._stickyScrollVisibleContextKey.set(this._widgetState.startLineNumbers.length!==0),!this._focused)this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e);else if(this._focusedStickyElementIndex===-1)this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,this._focusedStickyElementIndex!==-1&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{const r=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e),this._stickyScrollWidget.lineNumberCount===0?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(r)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}}findScrollWidgetState(){const e=this._editor.getOption(66),t=Math.min(this._maxStickyLines,this._editor.getOption(114).maxLineCount),i=this._editor.getScrollTop();let n=0;const s=[],r=[],a=this._editor.getVisibleRanges();if(a.length!==0){const l=new N_(a[0].startLineNumber,a[a.length-1].endLineNumber),d=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(l);for(const c of d){const h=c.startLineNumber,u=c.endLineNumber,g=c.nestingDepth;if(u-h>0){const f=(g-1)*e,m=g*e,_=this._editor.getBottomForLineNumber(h)-i,v=this._editor.getTopForLineNumber(u)-i,b=this._editor.getBottomForLineNumber(u)-i;if(f>v&&f<=b){s.push(h),r.push(u+1),n=b-m;break}else m>_&&m<=b&&(s.push(h),r.push(u+1));if(s.length===t)break}}}return this._endLineNumbers=r,new i3(s,r,n,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};vl.ID="store.contrib.stickyScrollController";vl=LT=g0e([Ag(1,Yo),Ag(2,Se),Ag(3,Oe),Ag(4,Wt),Ag(5,Zo),Ag(6,We)],vl);class f0e extends ko{constructor(){super({id:"editor.action.toggleStickyScroll",title:{value:p("toggleStickyScroll","Toggle Sticky Scroll"),mnemonicTitle:p({},"&&Toggle Sticky Scroll"),original:"Toggle Sticky Scroll"},category:r0e.View,toggled:{condition:te.equals("config.editor.stickyScroll.enabled",!0),title:p("stickyScroll","Sticky Scroll"),mnemonicTitle:p({},"&&Sticky Scroll")},menu:[{id:N.CommandPalette},{id:N.MenubarAppearanceMenu,group:"4_editor",order:3},{id:N.StickyScrollContext}]})}async run(e){const t=e.get(ft),i=!t.getValue("editor.stickyScroll.enabled");return t.updateValue("editor.stickyScroll.enabled",i)}}const pL=100;class p0e extends aa{constructor(){super({id:"editor.action.focusStickyScroll",title:{value:p("focusStickyScroll","Focus Sticky Scroll"),mnemonicTitle:p({},"&&Focus Sticky Scroll"),original:"Focus Sticky Scroll"},precondition:te.and(te.has("config.editor.stickyScroll.enabled"),M.stickyScrollVisible),menu:[{id:N.CommandPalette}]})}runEditorCommand(e,t){var i;(i=vl.get(t))===null||i===void 0||i.focus()}}class m0e extends aa{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:{value:p("selectNextStickyScrollLine.title","Select next sticky scroll line"),original:"Select next sticky scroll line"},precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:pL,primary:18}})}runEditorCommand(e,t){var i;(i=vl.get(t))===null||i===void 0||i.focusNext()}}class _0e extends aa{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:{value:p("selectPreviousStickyScrollLine.title","Select previous sticky scroll line"),original:"Select previous sticky scroll line"},precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:pL,primary:16}})}runEditorCommand(e,t){var i;(i=vl.get(t))===null||i===void 0||i.focusPrevious()}}class v0e extends aa{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:{value:p("goToFocusedStickyScrollLine.title","Go to focused sticky scroll line"),original:"Go to focused sticky scroll line"},precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:pL,primary:3}})}runEditorCommand(e,t){var i;(i=vl.get(t))===null||i===void 0||i.goToFocused()}}class b0e extends aa{constructor(){super({id:"editor.action.selectEditor",title:{value:p("selectEditor.title","Select Editor"),original:"Select Editor"},precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:pL,primary:9}})}runEditorCommand(e,t){var i;(i=vl.get(t))===null||i===void 0||i.selectEditor()}}yt(vl.ID,vl,1);Xt(f0e);Xt(p0e);Xt(_0e);Xt(m0e);Xt(v0e);Xt(b0e);var tA=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},mu=function(o,e){return function(t,i){e(t,i,o)}},Bh;class C0e{constructor(e,t,i,n,s,r){this.range=e,this.insertText=t,this.filterText=i,this.additionalTextEdits=n,this.command=s,this.completion=r}}let xT=class extends bz{constructor(e,t,i,n,s,r){super(s.disposable),this.model=e,this.line=t,this.word=i,this.completionModel=n,this._suggestMemoryService=r}canBeReused(e,t,i){return this.model===e&&this.line===t&&this.word.word.length>0&&this.word.startColumn===i.startColumn&&this.word.endColumn<i.endColumn&&this.completionModel.getIncompleteProvider().size===0}get items(){var e;const t=[],{items:i}=this.completionModel,n=this._suggestMemoryService.select(this.model,{lineNumber:this.line,column:this.word.endColumn+this.completionModel.lineContext.characterCountDelta},i),s=rt.slice(i,n),r=rt.slice(i,0,n);let a=5;for(const l of rt.concat(s,r)){if(l.score===Xr.Default)continue;const d=new k(l.editStart.lineNumber,l.editStart.column,l.editInsertEnd.lineNumber,l.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),c=l.completion.insertTextRules&&l.completion.insertTextRules&4?{snippet:l.completion.insertText}:l.completion.insertText;t.push(new C0e(d,c,(e=l.filterTextLow)!==null&&e!==void 0?e:l.labelLow,l.completion.additionalTextEdits,l.completion.command,l)),a-->=0&&l.resolve(st.None)}return t}};xT=tA([mu(5,Qy)],xT);let DT=class{constructor(e,t,i,n){this._getEditorOption=e,this._languageFeatureService=t,this._clipboardService=i,this._suggestMemoryService=n}async provideInlineCompletions(e,t,i,n){var s;if(i.selectedSuggestionInfo)return;const r=this._getEditorOption(88,e);if(ff.isAllOff(r))return;e.tokenization.tokenizeIfCheap(t.lineNumber);const a=e.tokenization.getLineTokens(t.lineNumber),l=a.getStandardTokenType(a.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(ff.valueFor(r,l)!=="inline")return;let d=e.getWordAtPosition(t),c;if(d?.word||(c=this._getTriggerCharacterInfo(e,t)),!d?.word&&!c||(d||(d=e.getWordUntilPosition(t)),d.endColumn!==t.column))return;let h;const u=e.getValueInRange(new k(t.lineNumber,1,t.lineNumber,t.column));if(!c&&(!((s=this._lastResult)===null||s===void 0)&&s.canBeReused(e,t.lineNumber,d))){const g=new X5(u,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=g,this._lastResult.acquire(),h=this._lastResult}else{const g=await HR(this._languageFeatureService.completionProvider,e,t,new G0(void 0,void 0,c?.providers),c&&{triggerKind:1,triggerCharacter:c.ch},n);let f;g.needsClipboard&&(f=await this._clipboardService.readText());const m=new Gd(g.items,t.column,new X5(u,0),zr.None,this._getEditorOption(117,e),this._getEditorOption(111,e),{boostFullMatch:!1,firstMatchCanBeWeak:!1},f);h=new xT(e,t.lineNumber,d,m,g,this._suggestMemoryService)}return this._lastResult=h,h}handleItemDidShow(e,t){t.completion.resolve(st.None)}freeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){var i;const n=e.getValueInRange(k.fromPositions({lineNumber:t.lineNumber,column:t.column-1},t)),s=new Set;for(const r of this._languageFeatureService.completionProvider.all(e))!((i=r.triggerCharacters)===null||i===void 0)&&i.includes(n)&&s.add(r);if(s.size!==0)return{providers:s,ch:n}}};DT=tA([mu(1,Se),mu(2,Sd),mu(3,Qy)],DT);let aS=Bh=class{constructor(e,t,i,n){if(++Bh._counter===1){const s=n.createInstance(DT,(r,a)=>{var l;return((l=i.listCodeEditors().find(c=>c.getModel()===a))!==null&&l!==void 0?l:e).getOption(r)});Bh._disposable=t.inlineCompletionsProvider.register("*",s)}}dispose(){var e;--Bh._counter===0&&((e=Bh._disposable)===null||e===void 0||e.dispose(),Bh._disposable=void 0)}};aS._counter=0;aS=Bh=tA([mu(1,Se),mu(2,Dt),mu(3,Oe)],aS);yt("suggest.inlineCompletionsProvider",aS,0);class w0e extends we{constructor(){super({id:"editor.action.forceRetokenize",label:p("forceRetokenize","Developer: Force Retokenize"),alias:"Developer: Force Retokenize",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getModel();i.tokenization.resetTokenization();const n=new Hn;i.tokenization.forceTokenization(i.getLineCount()),n.stop(),console.log(`tokenization took ${n.elapsed()}`)}}de(w0e);class mL extends ko{constructor(){super({id:mL.ID,title:{value:p({},"Toggle Tab Key Moves Focus"),original:"Toggle Tab Key Moves Focus"},precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},f1:!0})}run(){const t=!Jf.getTabFocusMode();Jf.setTabFocusMode(t),js(t?p("toggle.tabMovesFocus.on","Pressing Tab will now move focus to the next focusable element"):p("toggle.tabMovesFocus.off","Pressing Tab will now insert the tab character"))}}mL.ID="editor.action.toggleTabFocusMode";Xt(mL);var S0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},y0e=function(o,e){return function(t,i){e(t,i,o)}};let kT=class extends K{get enabled(){return this._enabled}set enabled(e){e?(this.el.setAttribute("aria-disabled","false"),this.el.tabIndex=0,this.el.style.pointerEvents="auto",this.el.style.opacity="1",this.el.style.cursor="pointer",this._enabled=!1):(this.el.setAttribute("aria-disabled","true"),this.el.tabIndex=-1,this.el.style.pointerEvents="none",this.el.style.opacity="0.4",this.el.style.cursor="default",this._enabled=!0),this._enabled=e}constructor(e,t,i={},n){var s;super(),this._link=t,this._enabled=!0,this.el=ie(e,pe("a.monaco-link",{tabIndex:(s=t.tabIndex)!==null&&s!==void 0?s:0,href:t.href,title:t.title},t.label)),this.el.setAttribute("role","button");const r=this._register(new at(this.el,"click")),a=this._register(new at(this.el,"keypress")),l=fe.chain(a.event,h=>h.map(u=>new Gt(u)).filter(u=>u.keyCode===3)),d=this._register(new at(this.el,Bt.Tap)).event;this._register(Ot.addTarget(this.el));const c=fe.any(r.event,l,d);this._register(c(h=>{this.enabled&&(Je.stop(h,!0),i?.opener?i.opener(this._link.href):n.open(this._link.href,{allowCommands:!0}))})),this.enabled=!0}};kT=S0e([y0e(3,Qs)],kT);var IV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},EV=function(o,e){return function(t,i){e(t,i,o)}};const L0e=26;let IT=class extends K{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(ET))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(e){this.banner.show({...e,onClose:()=>{var t;this.hide(),(t=e.onClose)===null||t===void 0||t.call(e)}}),this._editor.setBanner(this.banner.element,L0e)}};IT=IV([EV(1,Oe)],IT);let ET=class extends K{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(pd,{}),this.element=pe("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(e){if(e.ariaLabel)return e.ariaLabel;if(typeof e.message=="string")return e.message}getBannerMessage(e){if(typeof e=="string"){const t=pe("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){bn(this.element)}show(e){bn(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=ie(this.element,pe("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(pe(`div${Re.asCSSSelector(e.icon)}`));const n=ie(this.element,pe("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=ie(this.element,pe("div.message-actions-container")),e.actions)for(const r of e.actions)this._register(this.instantiationService.createInstance(kT,this.messageActionsContainer,{...r,tabIndex:-1},{}));const s=ie(this.element,pe("div.action-container"));this.actionBar=this._register(new Go(s)),this.actionBar.push(this._register(new cs("banner.close","Close Banner",Re.asClassName(PB),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};ET=IV([EV(0,Oe)],ET);var iA=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},zf=function(o,e){return function(t,i){e(t,i,o)}};const x0e=Di("extensions-warning-message",he.warning,p("warningIcon","Icon shown with a warning message in the extensions editor."));let Np=class extends K{constructor(e,t,i,n){super(),this._editor=e,this._editorWorkerService=t,this._workspaceTrustService=i,this._highlighter=null,this._bannerClosed=!1,this._updateState=s=>{if(s&&s.hasMore){if(this._bannerClosed)return;const r=Math.max(s.ambiguousCharacterCount,s.nonBasicAsciiCharacterCount,s.invisibleCharacterCount);let a;if(s.nonBasicAsciiCharacterCount>=r)a={message:p("unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters","This document contains many non-basic ASCII unicode characters"),command:new em};else if(s.ambiguousCharacterCount>=r)a={message:p("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters","This document contains many ambiguous unicode characters"),command:new gh};else if(s.invisibleCharacterCount>=r)a={message:p("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters","This document contains many invisible unicode characters"),command:new Jp};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:a.message,icon:x0e,actions:[{label:a.command.shortLabel,href:`command:${a.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(IT,e)),this._register(this._editor.onDidChangeModel(()=>{this._bannerClosed=!1,this._updateHighlighter()})),this._options=e.getOption(124),this._register(i.onDidChangeTrust(s=>{this._updateHighlighter()})),this._register(e.onDidChangeConfiguration(s=>{s.hasChanged(124)&&(this._options=e.getOption(124),this._updateHighlighter())})),this._updateHighlighter()}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;const e=D0e(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([e.nonBasicASCII,e.ambiguousCharacters,e.invisibleCharacters].every(i=>i===!1))return;const t={nonBasicASCII:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments,includeStrings:e.includeStrings,allowedCodePoints:Object.keys(e.allowedCharacters).map(i=>i.codePointAt(0)),allowedLocales:Object.keys(e.allowedLocales).map(i=>i==="_os"?new Intl.NumberFormat().resolvedOptions().locale:i==="_vscode"?wH:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new NT(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new k0e(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}};Np.ID="editor.contrib.unicodeHighlighter";Np=iA([zf(1,Lr),zf(2,P7),zf(3,Oe)],Np);function D0e(o,e){return{nonBasicASCII:e.nonBasicASCII===so?!o:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments===so?!o:e.includeComments,includeStrings:e.includeStrings===so?!o:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}let NT=class extends K{constructor(e,t,i,n){super(),this._editor=e,this._options=t,this._updateState=i,this._editorWorkerService=n,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Rt(()=>this._update(),250)),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then(t=>{if(this._model.isDisposed()||this._model.getVersionId()!==e)return;this._updateState(t);const i=[];if(!t.hasMore)for(const n of t.ranges)i.push({range:n,options:lS.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();if(!lM(t,e))return null;const i=t.getValueInRange(e.range);return{reason:NV(i,this._options),inComment:dM(t,e),inString:cM(t,e)}}};NT=iA([zf(3,Lr)],NT);class k0e extends K{constructor(e,t,i){super(),this._editor=e,this._options=t,this._updateState=i,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Rt(()=>this._update(),250)),this._register(this._editor.onDidLayoutChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidScrollChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeHiddenAreas(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._editor.getVisibleRanges(),t=[],i={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(const n of e){const s=S2.computeUnicodeHighlights(this._model,this._options,n);for(const r of s.ranges)i.ranges.push(r);i.ambiguousCharacterCount+=i.ambiguousCharacterCount,i.invisibleCharacterCount+=i.invisibleCharacterCount,i.nonBasicAsciiCharacterCount+=i.nonBasicAsciiCharacterCount,i.hasMore=i.hasMore||s.hasMore}if(!i.hasMore)for(const n of i.ranges)t.push({range:n,options:lS.instance.getDecorationFromOptions(this._options)});this._updateState(i),this._decorations.set(t)}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel(),i=t.getValueInRange(e.range);return lM(t,e)?{reason:NV(i,this._options),inComment:dM(t,e),inString:cM(t,e)}:null}}let TT=class{constructor(e,t,i){this._editor=e,this._languageService=t,this._openerService=i,this.hoverOrdinal=5}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),n=this._editor.getContribution(Np.ID);if(!n)return[];const s=[],r=new Set;let a=300;for(const l of t){const d=n.getDecorationInfo(l);if(!d)continue;const h=i.getValueInRange(l.range).codePointAt(0),u=xD(h);let g;switch(d.reason.kind){case 0:{uv(d.reason.confusableWith)?g=p("unicodeHighlight.characterIsAmbiguousASCII","The character {0} could be confused with the ASCII character {1}, which is more common in source code.",u,xD(d.reason.confusableWith.codePointAt(0))):g=p("unicodeHighlight.characterIsAmbiguous","The character {0} could be confused with the character {1}, which is more common in source code.",u,xD(d.reason.confusableWith.codePointAt(0)));break}case 1:g=p("unicodeHighlight.characterIsInvisible","The character {0} is invisible.",u);break;case 2:g=p("unicodeHighlight.characterIsNonBasicAscii","The character {0} is not a basic ASCII character.",u);break}if(r.has(g))continue;r.add(g);const f={codePoint:h,reason:d.reason,inComment:d.inComment,inString:d.inString},m=p("unicodeHighlight.adjustSettings","Adjust settings"),_=`command:${Yv.ID}?${encodeURIComponent(JSON.stringify(f))}`,v=new Fn("",!0).appendMarkdown(g).appendText(" ").appendLink(_,m);s.push(new Kr(this,l.range,[v],!1,a++))}return s}renderHoverParts(e,t){return dW(e,t,this._editor,this._languageService,this._openerService)}};TT=iA([zf(1,ni),zf(2,Qs)],TT);function MT(o){return`U+${o.toString(16).padStart(4,"0")}`}function xD(o){let e=`\`${MT(o)}\``;return tl.isInvisibleCharacter(o)||(e+=` "${`${I0e(o)}`}"`),e}function I0e(o){return o===96?"`` ` ``":"`"+String.fromCodePoint(o)+"`"}function NV(o,e){return S2.computeUnicodeHighlightReason(o,e)}class lS{constructor(){this.map=new Map}getDecorationFromOptions(e){return this.getDecoration(!e.includeComments,!e.includeStrings)}getDecoration(e,t){const i=`${e}${t}`;let n=this.map.get(i);return n||(n=Ze.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:e,hideInStringTokens:t}),this.map.set(i,n)),n}}lS.instance=new lS;class E0e extends we{constructor(){super({id:gh.ID,label:p("action.unicodeHighlight.disableHighlightingInComments","Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=p("unicodeHighlight.disableHighlightingInComments.shortLabel","Disable Highlight In Comments")}async run(e,t,i){const n=e?.get(ft);n&&this.runAction(n)}async runAction(e){await e.updateValue(Cs.includeComments,!1,2)}}class N0e extends we{constructor(){super({id:gh.ID,label:p("action.unicodeHighlight.disableHighlightingInStrings","Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=p("unicodeHighlight.disableHighlightingInStrings.shortLabel","Disable Highlight In Strings")}async run(e,t,i){const n=e?.get(ft);n&&this.runAction(n)}async runAction(e){await e.updateValue(Cs.includeStrings,!1,2)}}class gh extends we{constructor(){super({id:gh.ID,label:p("action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters","Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=p("unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel","Disable Ambiguous Highlight")}async run(e,t,i){const n=e?.get(ft);n&&this.runAction(n)}async runAction(e){await e.updateValue(Cs.ambiguousCharacters,!1,2)}}gh.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";class Jp extends we{constructor(){super({id:Jp.ID,label:p("action.unicodeHighlight.disableHighlightingOfInvisibleCharacters","Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=p("unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel","Disable Invisible Highlight")}async run(e,t,i){const n=e?.get(ft);n&&this.runAction(n)}async runAction(e){await e.updateValue(Cs.invisibleCharacters,!1,2)}}Jp.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";class em extends we{constructor(){super({id:em.ID,label:p("action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters","Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=p("unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel","Disable Non ASCII Highlight")}async run(e,t,i){const n=e?.get(ft);n&&this.runAction(n)}async runAction(e){await e.updateValue(Cs.nonBasicASCII,!1,2)}}em.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";class Yv extends we{constructor(){super({id:Yv.ID,label:p("action.unicodeHighlight.showExcludeOptions","Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}async run(e,t,i){const{codePoint:n,reason:s,inString:r,inComment:a}=i,l=String.fromCodePoint(n),d=e.get(dh),c=e.get(ft);function h(f){return tl.isInvisibleCharacter(f)?p("unicodeHighlight.excludeInvisibleCharFromBeingHighlighted","Exclude {0} (invisible character) from being highlighted",MT(f)):p("unicodeHighlight.excludeCharFromBeingHighlighted","Exclude {0} from being highlighted",`${MT(f)} "${l}"`)}const u=[];if(s.kind===0)for(const f of s.notAmbiguousInLocales)u.push({label:p("unicodeHighlight.allowCommonCharactersInLanguage",'Allow unicode characters that are more common in the language "{0}".',f),run:async()=>{M0e(c,[f])}});if(u.push({label:h(n),run:()=>T0e(c,[n])}),a){const f=new E0e;u.push({label:f.label,run:async()=>f.runAction(c)})}else if(r){const f=new N0e;u.push({label:f.label,run:async()=>f.runAction(c)})}if(s.kind===0){const f=new gh;u.push({label:f.label,run:async()=>f.runAction(c)})}else if(s.kind===1){const f=new Jp;u.push({label:f.label,run:async()=>f.runAction(c)})}else if(s.kind===2){const f=new em;u.push({label:f.label,run:async()=>f.runAction(c)})}else R0e(s);const g=await d.pick(u,{title:p("unicodeHighlight.configureUnicodeHighlightOptions","Configure Unicode Highlight Options")});g&&await g.run()}}Yv.ID="editor.action.unicodeHighlight.showExcludeOptions";async function T0e(o,e){const t=o.getValue(Cs.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const n of e)i[String.fromCodePoint(n)]=!0;await o.updateValue(Cs.allowedCharacters,i,2)}async function M0e(o,e){var t;const i=(t=o.inspect(Cs.allowedLocales).user)===null||t===void 0?void 0:t.value;let n;typeof i=="object"&&i?n=Object.assign({},i):n={};for(const s of e)n[s]=!0;await o.updateValue(Cs.allowedLocales,n,2)}function R0e(o){throw new Error(`Unexpected value: ${o}`)}de(gh);de(Jp);de(em);de(Yv);yt(Np.ID,Np,1);ag.register(TT);var A0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},a3=function(o,e){return function(t,i){e(t,i,o)}};const TV="ignoreUnusualLineTerminators";function P0e(o,e,t){o.setModelProperty(e.uri,TV,t)}function O0e(o,e){return o.getModelProperty(e.uri,TV)}let av=class extends K{constructor(e,t,i){super(),this._editor=e,this._dialogService=t,this._codeEditorService=i,this._isPresentingDialog=!1,this._config=this._editor.getOption(125),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(125)&&(this._config=this._editor.getOption(125),this._checkForUnusualLineTerminators())})),this._register(this._editor.onDidChangeModel(()=>{this._checkForUnusualLineTerminators()})),this._register(this._editor.onDidChangeModelContent(n=>{n.isUndoing||this._checkForUnusualLineTerminators()})),this._checkForUnusualLineTerminators()}async _checkForUnusualLineTerminators(){if(this._config==="off"||!this._editor.hasModel())return;const e=this._editor.getModel();if(!e.mightContainUnusualLineTerminators()||O0e(this._codeEditorService,e)===!0||this._editor.getOption(90))return;if(this._config==="auto"){e.removeUnusualLineTerminators(this._editor.getSelections());return}if(this._isPresentingDialog)return;let i;try{this._isPresentingDialog=!0,i=await this._dialogService.confirm({title:p("unusualLineTerminators.title","Unusual Line Terminators"),message:p("unusualLineTerminators.message","Detected unusual line terminators"),detail:p("unusualLineTerminators.detail","The file '{0}' contains one or more unusual line terminator characters, like Line Separator (LS) or Paragraph Separator (PS).\n\nIt is recommended to remove them from the file. This can be configured via `editor.unusualLineTerminators`.",qo(e.uri)),primaryButton:p({key:"unusualLineTerminators.fix",comment:["&& denotes a mnemonic"]},"&&Remove Unusual Line Terminators"),cancelButton:p("unusualLineTerminators.ignore","Ignore")})}finally{this._isPresentingDialog=!1}if(!i.confirmed){P0e(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}};av.ID="editor.contrib.unusualLineTerminatorsDetector";av=A0e([a3(1,Dv),a3(2,Dt)],av);yt(av.ID,av,1);var MV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},r1=function(o,e){return function(t,i){e(t,i,o)}},Ei,RT;const _L=new be("hasWordHighlights",!1);function RV(o,e,t,i){const n=o.ordered(e);return c2(n.map(s=>()=>Promise.resolve(s.provideDocumentHighlights(e,t,i)).then(void 0,Mi)),Bn).then(s=>{if(s){const r=new xi;return r.set(e.uri,s),r}return new xi})}function F0e(o,e,t,i,n,s){const r=o.ordered(e);return c2(r.map(a=>()=>{const l=s.filter(d=>mM(a.selector,d.uri,d.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(a.provideMultiDocumentHighlights(e,t,l,n)).then(void 0,Mi)}),a=>a instanceof xi&&a.size>0)}class nA{constructor(e,t,i){this._model=e,this._selection=t,this._wordSeparators=i,this._wordRange=this._getCurrentWordRange(e,t),this._result=null}get result(){return this._result||(this._result=Zi(e=>this._compute(this._model,this._selection,this._wordSeparators,e))),this._result}_getCurrentWordRange(e,t){const i=e.getWordAtPosition(t.getPosition());return i?new k(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):null}isValid(e,t,i){const n=t.startLineNumber,s=t.startColumn,r=t.endColumn,a=this._getCurrentWordRange(e,t);let l=!!(this._wordRange&&this._wordRange.equalsRange(a));for(let d=0,c=i.length;!l&&d<c;d++){const h=i.getRange(d);h&&h.startLineNumber===n&&h.startColumn<=s&&h.endColumn>=r&&(l=!0)}return l}cancel(){this.result.cancel()}}class B0e extends nA{constructor(e,t,i,n){super(e,t,i),this._providers=n}_compute(e,t,i,n){return RV(this._providers,e,t.getPosition(),n).then(s=>s||new xi)}}class W0e extends nA{constructor(e,t,i,n,s){super(e,t,i),this._providers=n,this._otherModels=s}_compute(e,t,i,n){return F0e(this._providers,e,t.getPosition(),i,n,this._otherModels).then(s=>s||new xi)}}class AV extends nA{constructor(e,t,i,n,s){super(e,t,n),this._otherModels=s,this._selectionIsEmpty=t.isEmpty(),this._word=i}_compute(e,t,i,n){return Mc(250,n).then(()=>{const s=new xi;let r;if(this._word?r=this._word:r=e.getWordAtPosition(t.getPosition()),!r)return new xi;const a=[e,...this._otherModels];for(const l of a){if(l.isDisposed())continue;const c=l.findMatches(r.word,!0,!1,!0,i,!1).map(h=>({range:h.range,kind:W_.Text}));c&&s.set(l.uri,c)}return s})}isValid(e,t,i){const n=t.isEmpty();return this._selectionIsEmpty!==n?!1:super.isValid(e,t,i)}}function V0e(o,e,t,i,n){return o.has(e)?new B0e(e,t,n,o):new AV(e,t,i,n,[])}function H0e(o,e,t,i,n,s){return o.has(e)?new W0e(e,t,n,o,s):new AV(e,t,i,n,s)}Cl("_executeDocumentHighlights",async(o,e,t)=>{const i=o.get(Se),n=await RV(i.documentHighlightProvider,e,t,st.None);return n?.get(e.uri)});let lv=Ei=class{constructor(e,t,i,n,s){this.toUnhook=new se,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new xi,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=s,this._hasWordHighlights=_L.bindTo(n),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(80),this.model=this.editor.getModel(),this.toUnhook.add(e.onDidChangeCursorPosition(r=>{this._ignorePositionChangeEvent||this.occurrencesHighlight!=="off"&&this._onPositionChanged(r)})),this.toUnhook.add(e.onDidChangeModelContent(r=>{this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(r=>{!r.newModelUrl&&r.oldModelUrl?this._stopSingular():Ei.query&&this._run()})),this.toUnhook.add(e.onDidChangeConfiguration(r=>{const a=this.editor.getOption(80);this.occurrencesHighlight!==a&&(this.occurrencesHighlight=a,this._stopAll())})),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,Ei.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight!=="off"&&this._run()}_getSortedHighlights(){return this.decorations.getRanges().sort(k.compareRangesUsingStarts)}moveNext(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))+1)%e.length,n=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);const s=this._getWord();if(s){const r=this.editor.getModel().getLineContent(n.startLineNumber);js(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}moveBack(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))-1+e.length)%e.length,n=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);const s=this._getWord();if(s){const r=this.editor.getModel().getLineContent(n.startLineNumber);js(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=Ei.storedDecorations.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),Ei.storedDecorations.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(){const e=this.codeEditorService.listCodeEditors();for(const t of e){if(!t.hasModel())continue;const i=Ei.storedDecorations.get(t.getModel().uri);if(!i)continue;t.removeDecorations(i),Ei.storedDecorations.delete(t.getModel().uri);const n=md.get(t);n?.wordHighlighter&&n.wordHighlighter.decorations.length>0&&(n.wordHighlighter.decorations.clear(),n.wordHighlighter._hasWordHighlights.set(!1))}}_stopSingular(){var e,t,i,n;this._removeSingleDecorations(),this.editor.hasWidgetFocus()&&(((e=this.editor.getModel())===null||e===void 0?void 0:e.uri.scheme)!==Ye.vscodeNotebookCell&&((i=(t=Ei.query)===null||t===void 0?void 0:t.modelInfo)===null||i===void 0?void 0:i.model.uri.scheme)!==Ye.vscodeNotebookCell?(Ei.query=null,this._run()):!((n=Ei.query)===null||n===void 0)&&n.modelInfo&&(Ei.query.modelInfo=null)),this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_stopAll(){this._removeAllDecorations(),this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_onPositionChanged(e){var t;if(this.occurrencesHighlight==="off"){this._stopAll();return}if(e.reason!==3&&((t=this.editor.getModel())===null||t===void 0?void 0:t.uri.scheme)!==Ye.vscodeNotebookCell){this._stopAll();return}this._run()}_getWord(){const e=this.editor.getSelection(),t=e.startLineNumber,i=e.startColumn;return this.model.isDisposed()?null:this.model.getWordAtPosition({lineNumber:t,column:i})}getOtherModelsToHighlight(e){if(!e)return[];if(e.uri.scheme===Ye.vscodeNotebookCell){const s=[],r=this.codeEditorService.listCodeEditors();for(const a of r){const l=a.getModel();l&&l!==e&&l.uri.scheme===Ye.vscodeNotebookCell&&s.push(l)}return s}const i=[],n=this.codeEditorService.listCodeEditors();for(const s of n){if(!_de(s))continue;const r=s.getModel();r&&e===r.modified&&i.push(r.modified)}if(i.length)return i;if(this.occurrencesHighlight==="singleFile")return[];for(const s of n){const r=s.getModel();r&&r!==e&&i.push(r)}return i}_run(){var e,t;let i;if(this.editor.hasWidgetFocus()){const n=this.editor.getSelection();if(!n||n.startLineNumber!==n.endLineNumber){this._stopAll();return}const s=n.startColumn,r=n.endColumn,a=this._getWord();if(!a||a.startColumn>s||a.endColumn<r){Ei.query=null,this._stopAll();return}i=this.workerRequest&&this.workerRequest.isValid(this.model,n,this.decorations),Ei.query={modelInfo:{model:this.model,selection:n},word:a}}else if(Ei.query===null)return;if(this.lastCursorPositionChangeTime=new Date().getTime(),i)this.workerRequestCompleted&&this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1,this._beginRenderDecorations());else{this._stopAll();const n=++this.workerRequestTokenId;this.workerRequestCompleted=!1;const s=this.getOtherModelsToHighlight(this.editor.getModel()),r=!!(!Ei.query.modelInfo&&Ei.query.word||((e=Ei.query.modelInfo)===null||e===void 0?void 0:e.model.uri)!==this.model.uri);!Ei.query.modelInfo||Ei.query.modelInfo.model.uri!==this.model.uri?this.workerRequest=this.computeWithModel(this.model,this.editor.getSelection(),r?Ei.query.word:null,s):this.workerRequest=this.computeWithModel(Ei.query.modelInfo.model,Ei.query.modelInfo.selection,Ei.query.word,s),(t=this.workerRequest)===null||t===void 0||t.result.then(a=>{n===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=a||[],this._beginRenderDecorations())},Ge)}}computeWithModel(e,t,i,n){return n.length?H0e(this.multiDocumentProviders,e,t,i,this.editor.getOption(129),n):V0e(this.providers,e,t,i,this.editor.getOption(129))}_beginRenderDecorations(){const e=new Date().getTime(),t=this.lastCursorPositionChangeTime+250;e>=t?(this.renderDecorationsTimer=-1,this.renderDecorations()):this.renderDecorationsTimer=setTimeout(()=>{this.renderDecorations()},t-e)}renderDecorations(){var e,t,i;this.renderDecorationsTimer=-1;const n=this.codeEditorService.listCodeEditors();for(const s of n){const r=md.get(s);if(!r)continue;const a=[],l=(e=s.getModel())===null||e===void 0?void 0:e.uri;if(l&&this.workerRequestValue.has(l)){const d=Ei.storedDecorations.get(l),c=this.workerRequestValue.get(l);if(c)for(const u of c)a.push({range:u.range,options:__e(u.kind)});let h=[];s.changeDecorations(u=>{h=u.deltaDecorations(d??[],a)}),Ei.storedDecorations=Ei.storedDecorations.set(l,h),a.length>0&&((t=r.wordHighlighter)===null||t===void 0||t.decorations.set(a),(i=r.wordHighlighter)===null||i===void 0||i._hasWordHighlights.set(!0))}}}dispose(){this._stopSingular(),this.toUnhook.dispose()}};lv.storedDecorations=new xi;lv.query=null;lv=Ei=MV([r1(4,Dt)],lv);let md=RT=class extends K{static get(e){return e.getContribution(RT.ID)}constructor(e,t,i,n){super(),this._wordHighlighter=null;const s=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new lv(e,i.documentHighlightProvider,i.multiDocumentHighlightProvider,t,n))};this._register(e.onDidChangeModel(r=>{this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),s()})),s()}get wordHighlighter(){return this._wordHighlighter}saveViewState(){return!!(this._wordHighlighter&&this._wordHighlighter.hasDecorations())}moveNext(){var e;(e=this._wordHighlighter)===null||e===void 0||e.moveNext()}moveBack(){var e;(e=this._wordHighlighter)===null||e===void 0||e.moveBack()}restoreViewState(e){this._wordHighlighter&&e&&this._wordHighlighter.restore()}dispose(){this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),super.dispose()}};md.ID="editor.contrib.wordHighlighter";md=RT=MV([r1(1,We),r1(2,Se),r1(3,Dt)],md);class PV extends we{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=md.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}class z0e extends PV{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:p("wordHighlight.next.label","Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:_L,kbOpts:{kbExpr:M.editorTextFocus,primary:65,weight:100}})}}class U0e extends PV{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:p("wordHighlight.previous.label","Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:_L,kbOpts:{kbExpr:M.editorTextFocus,primary:1089,weight:100}})}}class $0e extends we{constructor(){super({id:"editor.action.wordHighlight.trigger",label:p("wordHighlight.trigger.label","Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:_L.toNegated(),kbOpts:{kbExpr:M.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const n=md.get(t);n&&n.restoreViewState(!0)}}yt(md.ID,md,0);de(z0e);de(U0e);de($0e);class vL extends cn{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const n=$o(t.getOption(129)),s=t.getModel(),a=t.getSelections().map(l=>{const d=new V(l.positionLineNumber,l.positionColumn),c=this._move(n,s,d,this._wordNavigationType);return this._moveTo(l,c,this._inSelectionMode)});if(s.pushStackElement(),t._getViewModel().setCursorStates("moveWordCommand",3,a.map(l=>mt.fromModelSelection(l))),a.length===1){const l=new V(a[0].positionLineNumber,a[0].positionColumn);t.revealPosition(l,0)}}_moveTo(e,t,i){return i?new xe(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new xe(t.lineNumber,t.column,t.lineNumber,t.column)}}class fh extends vL{_move(e,t,i,n){return St.moveWordLeft(e,t,i,n)}}class ph extends vL{_move(e,t,i,n){return St.moveWordRight(e,t,i,n)}}class K0e extends fh{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class j0e extends fh{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class q0e extends fh{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:te.and(M.textInputFocus,(e=te.and(_v,gy))===null||e===void 0?void 0:e.negate()),primary:2063,mac:{primary:527},weight:100}})}}class G0e extends fh{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class Z0e extends fh{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class Y0e extends fh{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:te.and(M.textInputFocus,(e=te.and(_v,gy))===null||e===void 0?void 0:e.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class X0e extends fh{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,n){return super._move($o(sa.wordSeparators.defaultValue),t,i,n)}}class Q0e extends fh{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,n){return super._move($o(sa.wordSeparators.defaultValue),t,i,n)}}class J0e extends ph{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class eve extends ph{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:te.and(M.textInputFocus,(e=te.and(_v,gy))===null||e===void 0?void 0:e.negate()),primary:2065,mac:{primary:529},weight:100}})}}class tve extends ph{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class ive extends ph{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class nve extends ph{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:te.and(M.textInputFocus,(e=te.and(_v,gy))===null||e===void 0?void 0:e.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class sve extends ph{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class ove extends ph{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,n){return super._move($o(sa.wordSeparators.defaultValue),t,i,n)}}class rve extends ph{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,n){return super._move($o(sa.wordSeparators.defaultValue),t,i,n)}}class bL extends cn{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const n=e.get(Wt);if(!t.hasModel())return;const s=$o(t.getOption(129)),r=t.getModel(),a=t.getSelections(),l=t.getOption(6),d=t.getOption(11),c=n.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),h=t._getViewModel(),u=a.map(g=>{const f=this._delete({wordSeparators:s,model:r,selection:g,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:t.getOption(9),autoClosingBrackets:l,autoClosingQuotes:d,autoClosingPairs:c,autoClosedCharacters:h.getCursorAutoClosedCharacters()},this._wordNavigationType);return new kn(f,"")});t.pushUndoStop(),t.executeCommands(this.id,u),t.pushUndoStop()}}class sA extends bL{_delete(e,t){const i=St.deleteWordLeft(e,t);return i||new k(1,1,1,1)}}class oA extends bL{_delete(e,t){const i=St.deleteWordRight(e,t);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new k(n,s,n,s)}}class ave extends sA{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:M.writable})}}class lve extends sA{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:M.writable})}}class dve extends sA{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class cve extends oA{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:M.writable})}}class hve extends oA{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:M.writable})}}class uve extends oA{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class gve extends we{constructor(){super({id:"deleteInsideWord",precondition:M.writable,label:p("deleteInsideWord","Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const n=$o(t.getOption(129)),s=t.getModel(),a=t.getSelections().map(l=>{const d=St.deleteInsideWord(n,s,l);return new kn(d,"")});t.pushUndoStop(),t.executeCommands(this.id,a),t.pushUndoStop()}}ue(new K0e);ue(new j0e);ue(new q0e);ue(new G0e);ue(new Z0e);ue(new Y0e);ue(new J0e);ue(new eve);ue(new tve);ue(new ive);ue(new nve);ue(new sve);ue(new X0e);ue(new Q0e);ue(new ove);ue(new rve);ue(new ave);ue(new lve);ue(new dve);ue(new cve);ue(new hve);ue(new uve);de(gve);class fve extends bL{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){const i=qS.deleteWordPartLeft(e);return i||new k(1,1,1,1)}}class pve extends bL{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){const i=qS.deleteWordPartRight(e);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new k(n,s,n,s)}}class OV extends vL{_move(e,t,i,n){return qS.moveWordPartLeft(e,t,i)}}class mve extends OV{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}gt.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class _ve extends OV{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}gt.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class FV extends vL{_move(e,t,i,n){return qS.moveWordPartRight(e,t,i)}}class vve extends FV{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class bve extends FV{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}ue(new fve);ue(new pve);ue(new mve);ue(new _ve);ue(new vve);ue(new bve);class AT extends K{constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const e=zs.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(91);t||(this.editor.isSimpleWidget?t=new Fn(p("editor.simple.readonly","Cannot edit in read-only input")):t=new Fn(p("editor.readonly","Cannot edit in read-only editor"))),e.showMessage(t,this.editor.getPosition())}}}AT.ID="editor.contrib.readOnlyMessageController";yt(AT.ID,AT,2);export{Sve as B,xde as E,ag as H,Dde as K,Mde as M,Ide as P,Ede as R,Ade as U,u3 as _,ID as a,kde as b,Ode as e,Fde as l,c6 as m,Hg as p};
|