u&&(u=f)}return u}d(i,"getMaxCharCode");const n=Math.max(i(o),i(e));function s(c){if(c<0)throw new Error("unexpected");return n+c+1}d(s,"getUniqueCharCode");function r(c){let u=0,h=0;const g=new Int32Array(c.length);for(let f=0,p=c.length;fa,"getElements")},{getElements:d(()=>l,"getElements")}).ComputeDiff(!1).changes}d(nV,"smartDiff");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},sV=function(o,e){return function(t,i){e(t,i,o)}};let qA=class extends W{static{d(this,"InlineCompletionsSource")}constructor(e,t,i,n,s){super(),this.textModel=e,this.versionId=t,this._debounceValue=i,this.languageFeaturesService=n,this.languageConfigurationService=s,this._updateOperation=this._register(new dn),this.inlineCompletions=Iv("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=Iv("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent(()=>{this._updateOperation.clear()}))}fetch(e,t,i){var n,s;const r=new i0e(e,t,this.textModel.getVersionId()),a=t.selectedSuggestionInfo?this.suggestWidgetInlineCompletions:this.inlineCompletions;if(!((n=this._updateOperation.value)===null||n===void 0)&&n.request.satisfies(r))return this._updateOperation.value.promise;if(!((s=a.get())===null||s===void 0)&&s.request.satisfies(r))return Promise.resolve(!0);const l=!!this._updateOperation.value;this._updateOperation.clear();const c=new ui,u=(async()=>{if((l||t.triggerKind===Bd.Automatic)&&await t0e(this._debounceValue.get(this.textModel),c.token),c.token.isCancellationRequested||this.textModel.getVersionId()!==r.versionId)return!1;const f=new Date,p=await qve(this.languageFeaturesService.inlineCompletionsProvider,e,this.textModel,t,c.token,this.languageConfigurationService);if(c.token.isCancellationRequested||this.textModel.getVersionId()!==r.versionId)return!1;const _=new Date;this._debounceValue.update(this.textModel,_.getTime()-f.getTime());const b=new s0e(p,r,this.textModel,this.versionId);if(i){const v=i.toInlineCompletion(void 0);i.canBeReused(this.textModel,e)&&!p.has(v)&&b.prepend(i.inlineCompletion,v.range,!0)}return this._updateOperation.clear(),Wt(v=>{a.set(b,v)}),!0})(),h=new n0e(r,c,u);return this._updateOperation.value=h,u}clear(e){this._updateOperation.clear(),this.inlineCompletions.set(void 0,e),this.suggestWidgetInlineCompletions.set(void 0,e)}clearSuggestWidgetInlineCompletions(e){var t;!((t=this._updateOperation.value)===null||t===void 0)&&t.request.context.selectedSuggestionInfo&&this._updateOperation.clear(),this.suggestWidgetInlineCompletions.set(void 0,e)}cancelUpdate(){this._updateOperation.clear()}};qA=e0e([sV(3,me),sV(4,Kt)],qA);function t0e(o,e){return new Promise(t=>{let i;const n=setTimeout(()=>{i&&i.dispose(),t()},o);e&&(i=e.onCancellationRequested(()=>{clearTimeout(n),i&&i.dispose(),t()}))})}d(t0e,"wait$1");class i0e{static{d(this,"UpdateRequest")}constructor(e,t,i){this.position=e,this.context=t,this.versionId=i}satisfies(e){return this.position.equals(e.position)&&xae(this.context.selectedSuggestionInfo,e.context.selectedSuggestionInfo,W9())&&(e.context.triggerKind===Bd.Automatic||this.context.triggerKind===Bd.Explicit)&&this.versionId===e.versionId}}class n0e{static{d(this,"UpdateOperation")}constructor(e,t,i){this.request=e,this.cancellationTokenSource=t,this.promise=i}dispose(){this.cancellationTokenSource.cancel()}}class s0e{static{d(this,"UpToDateInlineCompletions")}get inlineCompletions(){return this._inlineCompletions}constructor(e,t,i,n){this.inlineCompletionProviderResult=e,this.request=t,this._textModel=i,this._versionId=n,this._refCount=1,this._prependedInlineCompletionItems=[];const s=i.deltaDecorations([],e.completions.map(r=>({range:r.range,options:{description:"inline-completion-tracking-range"}})));this._inlineCompletions=e.completions.map((r,a)=>new oV(r,s[a],this._textModel,this._versionId))}clone(){return this._refCount++,this}dispose(){if(this._refCount--,this._refCount===0){setTimeout(()=>{this._textModel.isDisposed()||this._textModel.deltaDecorations(this._inlineCompletions.map(e=>e.decorationId),[])},0),this.inlineCompletionProviderResult.dispose();for(const e of this._prependedInlineCompletionItems)e.source.removeRef()}}prepend(e,t,i){i&&e.source.addRef();const n=this._textModel.deltaDecorations([],[{range:t,options:{description:"inline-completion-tracking-range"}}])[0];this._inlineCompletions.unshift(new oV(e,n,this._textModel,this._versionId)),this._prependedInlineCompletionItems.push(e)}}class oV{static{d(this,"InlineCompletionWithUpdatedRange")}get forwardStable(){var e;return(e=this.inlineCompletion.source.inlineCompletions.enableForwardStability)!==null&&e!==void 0?e:!1}constructor(e,t,i,n){this.inlineCompletion=e,this.decorationId=t,this._textModel=i,this._modelVersion=n,this.semanticId=JSON.stringify([this.inlineCompletion.filterText,this.inlineCompletion.insertText,this.inlineCompletion.range.getStartPosition().toString()]),this._updatedRange=Sd({owner:this,equalsFn:k.equalsRange},s=>(this._modelVersion.read(s),this._textModel.getDecorationRange(this.decorationId)))}toInlineCompletion(e){var t;return this.inlineCompletion.withRange((t=this._updatedRange.read(e))!==null&&t!==void 0?t:nT)}toSingleTextEdit(e){var t;return new ic((t=this._updatedRange.read(e))!==null&&t!==void 0?t:nT,this.inlineCompletion.insertText)}isVisible(e,t,i){const n=lg(this._toFilterTextReplacement(i),e),s=this._updatedRange.read(i);if(!s||!this.inlineCompletion.range.getStartPosition().equals(s.getStartPosition())||t.lineNumber!==n.range.startLineNumber)return!1;const r=e.getValueInRange(n.range,1),a=n.text,l=Math.max(0,t.column-n.range.startColumn);let c=a.substring(0,l),u=a.substring(l),h=r.substring(0,l),g=r.substring(l);const f=e.getLineIndentColumn(n.range.startLineNumber);return n.range.startColumn<=f&&(h=h.trimStart(),h.length===0&&(g=g.trimStart()),c=c.trimStart(),c.length===0&&(u=u.trimStart())),c.startsWith(h)&&!!y9(g,u)}canBeReused(e,t){const i=this._updatedRange.read(void 0);return!!i&&i.containsPosition(t)&&this.isVisible(e,t,void 0)&&ws.ofRange(i).isGreaterThanOrEqualTo(ws.ofRange(this.inlineCompletion.range))}_toFilterTextReplacement(e){var t;return new ic((t=this._updatedRange.read(e))!==null&&t!==void 0?t:nT,this.inlineCompletion.filterText)}}const nT=new k(1,1,1,1),Qe={Visible:K2,HasFocusedSuggestion:new ce("suggestWidgetHasFocusedSuggestion",!1,m("suggestWidgetHasSelection","Whether any suggestion is focused")),DetailsVisible:new ce("suggestWidgetDetailsVisible",!1,m("suggestWidgetDetailsVisible","Whether suggestion details are visible")),MultipleSuggestions:new ce("suggestWidgetMultipleSuggestions",!1,m("suggestWidgetMultipleSuggestions","Whether there are multiple suggestions to pick from")),MakesTextEdit:new ce("suggestionMakesTextEdit",!0,m("suggestionMakesTextEdit","Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new ce("acceptSuggestionOnEnter",!0,m("acceptSuggestionOnEnter","Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new ce("suggestionHasInsertAndReplaceRange",!1,m("suggestionHasInsertAndReplaceRange","Whether the current suggestion has insert and replace behaviour")),InsertMode:new ce("suggestionInsertMode",void 0,{type:"string",description:m("suggestionInsertMode","Whether the default behaviour is to insert or replace")}),CanResolve:new ce("suggestionCanResolve",!1,m("suggestionCanResolve","Whether the current suggestion supports to resolve further details"))},pu=new T("suggestWidgetStatusBar");class o0e{static{d(this,"CompletionItem")}constructor(e,t,i,n){var s;this.position=e,this.completion=t,this.container=i,this.provider=n,this.isInvalid=!1,this.score=La.Default,this.distance=0,this.textLabel=typeof t.label=="string"?t.label:(s=t.label)===null||s===void 0?void 0:s.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=t.sortText&&t.sortText.toLowerCase(),this.filterTextLow=t.filterText&&t.filterText.toLowerCase(),this.extensionId=t.extensionId,k.isIRange(t.range)?(this.editStart=new H(t.range.startLineNumber,t.range.startColumn),this.editInsertEnd=new H(t.range.endLineNumber,t.range.endColumn),this.editReplaceEnd=new H(t.range.endLineNumber,t.range.endColumn),this.isInvalid=this.isInvalid||k.spansMultipleLines(t.range)||t.range.startLineNumber!==e.lineNumber):(this.editStart=new H(t.range.insert.startLineNumber,t.range.insert.startColumn),this.editInsertEnd=new H(t.range.insert.endLineNumber,t.range.insert.endColumn),this.editReplaceEnd=new H(t.range.replace.endLineNumber,t.range.replace.endColumn),this.isInvalid=this.isInvalid||k.spansMultipleLines(t.range.insert)||k.spansMultipleLines(t.range.replace)||t.range.insert.startLineNumber!==e.lineNumber||t.range.replace.startLineNumber!==e.lineNumber||t.range.insert.startColumn!==t.range.replace.startColumn),typeof n.resolveCompletionItem!="function"&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return this._resolveDuration!==void 0}get resolveDuration(){return this._resolveDuration!==void 0?this._resolveDuration:-1}async resolve(e){if(!this._resolveCache){const t=e.onCancellationRequested(()=>{this._resolveCache=void 0,this._resolveDuration=void 0}),i=new En(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,e)).then(n=>{Object.assign(this.completion,n),this._resolveDuration=i.elapsed()},n=>{Gr(n)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{t.dispose()})}return this._resolveCache}}class r0{static{d(this,"CompletionOptions")}constructor(e=2,t=new Set,i=new Set,n=new Map,s=!0){this.snippetSortOrder=e,this.kindFilter=t,this.providerFilter=i,this.providerItemsToReuse=n,this.showDeprecated=s}}r0.default=new r0;let r0e;function a0e(){return r0e}d(a0e,"getSnippetSuggestSupport");class l0e{static{d(this,"CompletionItemModel")}constructor(e,t,i,n){this.items=e,this.needsClipboard=t,this.durations=i,this.disposable=n}}async function Q2(o,e,t,i=r0.default,n={triggerKind:0},s=ot.None){const r=new En;t=t.clone();const a=e.getWordAtPosition(t),l=a?new k(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn):k.fromPositions(t),c={replace:l,insert:l.setEndPosition(t.lineNumber,t.column)},u=[],h=new Y,g=[];let f=!1;const p=d((b,v,C)=>{var w,S,y;let x=!1;if(!v)return x;for(const D of v.suggestions)if(!i.kindFilter.has(D.kind)){if(!i.showDeprecated&&(!((w=D?.tags)===null||w===void 0)&&w.includes(1)))continue;D.range||(D.range=c),D.sortText||(D.sortText=typeof D.label=="string"?D.label:D.label.label),!f&&D.insertTextRules&&D.insertTextRules&4&&(f=Tg.guessNeedsClipboard(D.insertText)),u.push(new o0e(t,D,v,b)),x=!0}return Ky(v)&&h.add(v),g.push({providerName:(S=b._debugDisplayName)!==null&&S!==void 0?S:"unknown_provider",elapsedProvider:(y=v.duration)!==null&&y!==void 0?y:-1,elapsedOverall:C.elapsed()}),x},"onCompletionList"),_=(async()=>{})();for(const b of o.orderedGroups(e)){let v=!1;if(await Promise.all(b.map(async C=>{if(i.providerItemsToReuse.has(C)){const w=i.providerItemsToReuse.get(C);w.forEach(S=>u.push(S)),v=v||w.length>0;return}if(!(i.providerFilter.size>0&&!i.providerFilter.has(C)))try{const w=new En,S=await C.provideCompletionItems(e,t,n,s);v=p(C,S,w)||v}catch(w){Li(w)}})),v||s.isCancellationRequested)break}return await _,s.isCancellationRequested?(h.dispose(),Promise.reject(new Ta)):new l0e(u.sort(u0e(i.snippetSortOrder)),f,{entries:g,elapsed:r.elapsed()},h)}d(Q2,"provideSuggestionItems");function J2(o,e){if(o.sortTextLow&&e.sortTextLow){if(o.sortTextLowe.sortTextLow)return 1}return o.textLabele.textLabel?1:o.completion.kind-e.completion.kind}d(J2,"defaultComparator");function d0e(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===27)return-1;if(e.completion.kind===27)return 1}return J2(o,e)}d(d0e,"snippetUpComparator");function c0e(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===27)return 1;if(e.completion.kind===27)return-1}return J2(o,e)}d(c0e,"snippetDownComparator");const Rx=new Map;Rx.set(0,d0e);Rx.set(2,c0e);Rx.set(1,J2);function u0e(o){return Rx.get(o)}d(u0e,"getSuggestionComparator");ut.registerCommand("_executeCompletionItemProvider",async(o,...e)=>{const[t,i,n,s]=e;_t(Te.isUri(t)),_t(H.isIPosition(i)),_t(typeof n=="string"||!n),_t(typeof s=="number"||!s);const{completionProvider:r}=o.get(me),a=await o.get(Ys).createModelReference(t);try{const l={incomplete:!1,suggestions:[]},c=[],u=a.object.textEditorModel.validatePosition(i),h=await Q2(r,a.object.textEditorModel,u,void 0,{triggerCharacter:n??void 0,triggerKind:n?1:0});for(const g of h.items)c.length<(s??0)&&c.push(g.resolve(ot.None)),l.incomplete=l.incomplete||g.container.incomplete,l.suggestions.push(g.completion);try{return await Promise.all(c),l}finally{setTimeout(()=>h.disposable.dispose(),100)}}finally{a.dispose()}});function h0e(o,e){var t;(t=o.getContribution("editor.contrib.suggestController"))===null||t===void 0||t.triggerSuggest(new Set().add(e),void 0,!0)}d(h0e,"showSimpleSuggestions");class lp{static{d(this,"QuickSuggestionsOptions")}static isAllOff(e){return e.other==="off"&&e.comments==="off"&&e.strings==="off"}static isAllOn(e){return e.other==="on"&&e.comments==="on"&&e.strings==="on"}static valueFor(e,t){switch(t){case 1:return e.comments;case 2:return e.strings;default:return e.other}}}function rV(o,e=Hn){return Tie(o,e)?o.charAt(0).toUpperCase()+o.slice(1):o}d(rV,"normalizeDriveLetter");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},f0e=function(o,e){return function(t,i){e(t,i,o)}};class aV{static{d(this,"CompositeSnippetVariableResolver")}constructor(e){this._delegates=e}resolve(e){for(const t of this._delegates){const i=t.resolve(e);if(i!==void 0)return i}}}class lV{static{d(this,"SelectionBasedVariableResolver")}constructor(e,t,i,n){this._model=e,this._selection=t,this._selectionIdx=i,this._overtypingCapturer=n}resolve(e){const{name:t}=e;if(t==="SELECTION"||t==="TM_SELECTED_TEXT"){let i=this._model.getValueInRange(this._selection)||void 0,n=this._selection.startLineNumber!==this._selection.endLineNumber;if(!i&&this._overtypingCapturer){const s=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);s&&(i=s.value,n=s.multiline)}if(i&&n&&e.snippet){const s=this._model.getLineContent(this._selection.startLineNumber),r=Vt(s,0,this._selection.startColumn-1);let a=r;e.snippet.walk(c=>c===e?!1:(c instanceof ms&&(a=Vt(Kl(c.value).pop())),!0));const l=wu(a,r);i=i.replace(/(\r\n|\r|\n)(.*)/g,(c,u,h)=>`${u}${a.substr(l)}${h}`)}return i}else{if(t==="TM_CURRENT_LINE")return this._model.getLineContent(this._selection.positionLineNumber);if(t==="TM_CURRENT_WORD"){const i=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return i&&i.word||void 0}else{if(t==="TM_LINE_INDEX")return String(this._selection.positionLineNumber-1);if(t==="TM_LINE_NUMBER")return String(this._selection.positionLineNumber);if(t==="CURSOR_INDEX")return String(this._selectionIdx);if(t==="CURSOR_NUMBER")return String(this._selectionIdx+1)}}}}class dV{static{d(this,"ModelBasedVariableResolver")}constructor(e,t){this._labelService=e,this._model=t}resolve(e){const{name:t}=e;if(t==="TM_FILENAME")return ru(this._model.uri.fsPath);if(t==="TM_FILENAME_BASE"){const i=ru(this._model.uri.fsPath),n=i.lastIndexOf(".");return n<=0?i:i.slice(0,n)}else{if(t==="TM_DIRECTORY")return _W(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(TL(this._model.uri));if(t==="TM_FILEPATH")return this._labelService.getUriLabel(this._model.uri);if(t==="RELATIVE_FILEPATH")return this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0})}}}class cV{static{d(this,"ClipboardBasedVariableResolver")}constructor(e,t,i,n){this._readClipboardText=e,this._selectionIdx=t,this._selectionCount=i,this._spread=n}resolve(e){if(e.name!=="CLIPBOARD")return;const t=this._readClipboardText();if(t){if(this._spread){const i=t.split(/\r\n|\n|\r/).filter(n=>!xW(n));if(i.length===this._selectionCount)return i[this._selectionIdx]}return t}}}let Ny=class{static{d(this,"CommentBasedVariableResolver")}constructor(e,t,i){this._model=e,this._selection=t,this._languageConfigurationService=i}resolve(e){const{name:t}=e,i=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),n=this._languageConfigurationService.getLanguageConfiguration(i).comments;if(n){if(t==="LINE_COMMENT")return n.lineCommentToken||void 0;if(t==="BLOCK_COMMENT_START")return n.blockCommentStartToken||void 0;if(t==="BLOCK_COMMENT_END")return n.blockCommentEndToken||void 0}}};Ny=g0e([f0e(2,Kt)],Ny);class _a{static{d(this,"TimeBasedVariableResolver")}constructor(){this._date=new Date}resolve(e){const{name:t}=e;if(t==="CURRENT_YEAR")return String(this._date.getFullYear());if(t==="CURRENT_YEAR_SHORT")return String(this._date.getFullYear()).slice(-2);if(t==="CURRENT_MONTH")return String(this._date.getMonth().valueOf()+1).padStart(2,"0");if(t==="CURRENT_DATE")return String(this._date.getDate().valueOf()).padStart(2,"0");if(t==="CURRENT_HOUR")return String(this._date.getHours().valueOf()).padStart(2,"0");if(t==="CURRENT_MINUTE")return String(this._date.getMinutes().valueOf()).padStart(2,"0");if(t==="CURRENT_SECOND")return String(this._date.getSeconds().valueOf()).padStart(2,"0");if(t==="CURRENT_DAY_NAME")return _a.dayNames[this._date.getDay()];if(t==="CURRENT_DAY_NAME_SHORT")return _a.dayNamesShort[this._date.getDay()];if(t==="CURRENT_MONTH_NAME")return _a.monthNames[this._date.getMonth()];if(t==="CURRENT_MONTH_NAME_SHORT")return _a.monthNamesShort[this._date.getMonth()];if(t==="CURRENT_SECONDS_UNIX")return String(Math.floor(this._date.getTime()/1e3));if(t==="CURRENT_TIMEZONE_OFFSET"){const i=this._date.getTimezoneOffset(),n=i>0?"-":"+",s=Math.trunc(Math.abs(i/60)),r=s<10?"0"+s:s,a=Math.abs(i)-s*60,l=a<10?"0"+a:a;return n+r+":"+l}}}_a.dayNames=[m("Sunday","Sunday"),m("Monday","Monday"),m("Tuesday","Tuesday"),m("Wednesday","Wednesday"),m("Thursday","Thursday"),m("Friday","Friday"),m("Saturday","Saturday")];_a.dayNamesShort=[m("SundayShort","Sun"),m("MondayShort","Mon"),m("TuesdayShort","Tue"),m("WednesdayShort","Wed"),m("ThursdayShort","Thu"),m("FridayShort","Fri"),m("SaturdayShort","Sat")];_a.monthNames=[m("January","January"),m("February","February"),m("March","March"),m("April","April"),m("May","May"),m("June","June"),m("July","July"),m("August","August"),m("September","September"),m("October","October"),m("November","November"),m("December","December")];_a.monthNamesShort=[m("JanuaryShort","Jan"),m("FebruaryShort","Feb"),m("MarchShort","Mar"),m("AprilShort","Apr"),m("MayShort","May"),m("JuneShort","Jun"),m("JulyShort","Jul"),m("AugustShort","Aug"),m("SeptemberShort","Sep"),m("OctoberShort","Oct"),m("NovemberShort","Nov"),m("DecemberShort","Dec")];class uV{static{d(this,"WorkspaceBasedVariableResolver")}constructor(e){this._workspaceService=e}resolve(e){if(!this._workspaceService)return;const t=Jre(this._workspaceService.getWorkspace());if(!Xre(t)){if(e.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(t);if(e.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(t)}}_resolveWorkspaceName(e){if(KI(e))return ru(e.uri.path);let t=ru(e.configPath.path);return t.endsWith($I)&&(t=t.substr(0,t.length-$I.length-1)),t}_resoveWorkspacePath(e){if(KI(e))return rV(e.uri.fsPath);const t=ru(e.configPath.path);let i=e.configPath.fsPath;return i.endsWith(t)&&(i=i.substr(0,i.length-t.length-1)),i?rV(i):"/"}}class hV{static{d(this,"RandomBasedVariableResolver")}resolve(e){const{name:t}=e;if(t==="RANDOM")return Math.random().toString().slice(-6);if(t==="RANDOM_HEX")return Math.random().toString(16).slice(-6);if(t==="UUID")return px()}}var p0e=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},m0e=function(o,e){return function(t,i){e(t,i,o)}},ta;class Yo{static{d(this,"OneSnippet")}constructor(e,t,i){this._editor=e,this._snippet=t,this._snippetLineLeadingWhitespace=i,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=yO(t.placeholders,Zo.compareByIndex),this._placeholderGroupsIdx=-1}initialize(e){this._offset=e.newPosition}dispose(){this._placeholderDecorations&&this._editor.removeDecorations([...this._placeholderDecorations.values()]),this._placeholderGroups.length=0}_initDecorations(){if(this._offset===-1)throw new Error("Snippet not initialized!");if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;const e=this._editor.getModel();this._editor.changeDecorations(t=>{for(const i of this._snippet.placeholders){const n=this._snippet.offset(i),s=this._snippet.fullLen(i),r=k.fromPositions(e.getPositionAt(this._offset+n),e.getPositionAt(this._offset+n+s)),a=i.isFinalTabstop?Yo._decor.inactiveFinal:Yo._decor.inactive,l=t.addDecoration(r,a);this._placeholderDecorations.set(i,l)}})}move(e){if(!this._editor.hasModel())return[];if(this._initDecorations(),this._placeholderGroupsIdx>=0){const n=[];for(const s of this._placeholderGroups[this._placeholderGroupsIdx])if(s.transform){const r=this._placeholderDecorations.get(s),a=this._editor.getModel().getDecorationRange(r),l=this._editor.getModel().getValueInRange(a),c=s.transform.resolve(l).split(/\r\n|\r|\n/);for(let u=1;u0&&this._editor.executeEdits("snippet.placeholderTransform",n)}let t=!1;e===!0&&this._placeholderGroupsIdx0&&(this._placeholderGroupsIdx-=1,t=!0);const i=this._editor.getModel().changeDecorations(n=>{const s=new Set,r=[];for(const a of this._placeholderGroups[this._placeholderGroupsIdx]){const l=this._placeholderDecorations.get(a),c=this._editor.getModel().getDecorationRange(l);r.push(new be(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn)),t=t&&this._hasPlaceholderBeenCollapsed(a),n.changeDecorationOptions(l,a.isFinalTabstop?Yo._decor.activeFinal:Yo._decor.active),s.add(a);for(const u of this._snippet.enclosingPlaceholders(a)){const h=this._placeholderDecorations.get(u);n.changeDecorationOptions(h,u.isFinalTabstop?Yo._decor.activeFinal:Yo._decor.active),s.add(u)}}for(const[a,l]of this._placeholderDecorations)s.has(a)||n.changeDecorationOptions(l,a.isFinalTabstop?Yo._decor.inactiveFinal:Yo._decor.inactive);return r});return t?this.move(e):i??[]}_hasPlaceholderBeenCollapsed(e){let t=e;for(;t;){if(t instanceof Zo){const i=this._placeholderDecorations.get(t);if(this._editor.getModel().getDecorationRange(i).isEmpty()&&t.toString().length>0)return!0}t=t.parent}return!1}get isAtFirstPlaceholder(){return this._placeholderGroupsIdx<=0||this._placeholderGroups.length===0}get isAtLastPlaceholder(){return this._placeholderGroupsIdx===this._placeholderGroups.length-1}get hasPlaceholder(){return this._snippet.placeholders.length>0}get isTrivialSnippet(){if(this._snippet.placeholders.length===0)return!0;if(this._snippet.placeholders.length===1){const[e]=this._snippet.placeholders;if(e.isFinalTabstop&&this._snippet.rightMostDescendant===e)return!0}return!1}computePossibleSelections(){const e=new Map;for(const t of this._placeholderGroups){let i;for(const n of t){if(n.isFinalTabstop)break;i||(i=[],e.set(n.index,i));const s=this._placeholderDecorations.get(n),r=this._editor.getModel().getDecorationRange(s);if(!r){e.delete(n.index);break}i.push(r)}}return e}get activeChoice(){if(!this._placeholderDecorations)return;const e=this._placeholderGroups[this._placeholderGroupsIdx][0];if(!e?.choice)return;const t=this._placeholderDecorations.get(e);if(!t)return;const i=this._editor.getModel().getDecorationRange(t);if(i)return{range:i,choice:e.choice}}get hasChoice(){let e=!1;return this._snippet.walk(t=>(e=t instanceof $m,!e)),e}merge(e){const t=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations(i=>{for(const n of this._placeholderGroups[this._placeholderGroupsIdx]){const s=e.shift();console.assert(s._offset!==-1),console.assert(!s._placeholderDecorations);const r=s._snippet.placeholderInfo.last.index;for(const l of s._snippet.placeholderInfo.all)l.isFinalTabstop?l.index=n.index+(r+1)/this._nestingLevel:l.index=n.index+l.index/this._nestingLevel;this._snippet.replace(n,s._snippet.children);const a=this._placeholderDecorations.get(n);i.removeDecoration(a),this._placeholderDecorations.delete(n);for(const l of s._snippet.placeholders){const c=s._snippet.offset(l),u=s._snippet.fullLen(l),h=k.fromPositions(t.getPositionAt(s._offset+c),t.getPositionAt(s._offset+c+u)),g=i.addDecoration(h,Yo._decor.inactive);this._placeholderDecorations.set(l,g)}}this._placeholderGroups=yO(this._snippet.placeholders,Zo.compareByIndex)})}}Yo._decor={active:$e.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:$e.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:$e.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:$e.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};const gV={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let Ry=ta=class{static{d(this,"SnippetSession")}static adjustWhitespace(e,t,i,n,s){const r=e.getLineContent(t.lineNumber),a=Vt(r,0,t.column-1);let l;return n.walk(c=>{if(!(c instanceof ms)||c.parent instanceof $m||s&&!s.has(c))return!0;const u=c.value.split(/\r\n|\r|\n/);if(i){const g=n.offset(c);if(g===0)u[0]=e.normalizeIndentation(u[0]);else{l=l??n.toString();const f=l.charCodeAt(g-1);(f===10||f===13)&&(u[0]=e.normalizeIndentation(a+u[0]))}for(let f=1;fS.get(Sg)),p=e.invokeWithinContext(S=>new dV(S.get(rm),g)),_=d(()=>a,"readClipboardText"),b=g.getValueInRange(ta.adjustSelection(g,e.getSelection(),i,0)),v=g.getValueInRange(ta.adjustSelection(g,e.getSelection(),0,n)),C=g.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber),w=e.getSelections().map((S,y)=>({selection:S,idx:y})).sort((S,y)=>k.compareRangesUsingStarts(S.selection,y.selection));for(const{selection:S,idx:y}of w){let x=ta.adjustSelection(g,S,i,0),D=ta.adjustSelection(g,S,0,n);b!==g.getValueInRange(x)&&(x=S),v!==g.getValueInRange(D)&&(D=S);const E=S.setStartPosition(x.startLineNumber,x.startColumn).setEndPosition(D.endLineNumber,D.endColumn),A=new Tg().parse(t,!0,s),z=E.getStartPosition(),O=ta.adjustWhitespace(g,z,r||y>0&&C!==g.getLineFirstNonWhitespaceColumn(S.positionLineNumber),A);A.resolveVariables(new aV([p,new cV(_,y,w.length,e.getOption(79)==="spread"),new lV(g,S,y,l),new Ny(g,S,c),new _a,new uV(f),new hV])),u[y]=ai.replace(E,A.toString()),u[y].identifier={major:y,minor:0},u[y]._isTracked=!0,h[y]=new Yo(e,A,O)}return{edits:u,snippets:h}}static createEditsAndSnippetsFromEdits(e,t,i,n,s,r,a){if(!e.hasModel()||t.length===0)return{edits:[],snippets:[]};const l=[],c=e.getModel(),u=new Tg,h=new lC,g=new aV([e.invokeWithinContext(p=>new dV(p.get(rm),c)),new cV(()=>s,0,e.getSelections().length,e.getOption(79)==="spread"),new lV(c,e.getSelection(),0,r),new Ny(c,e.getSelection(),a),new _a,new uV(e.invokeWithinContext(p=>p.get(Sg))),new hV]);t=t.sort((p,_)=>k.compareRangesUsingStarts(p.range,_.range));let f=0;for(let p=0;p0){const y=t[p-1].range,x=k.fromPositions(y.getEndPosition(),_.getStartPosition()),D=new ms(c.getValueInRange(x));h.appendChild(D),f+=D.value.length}const v=u.parseFragment(b,h);ta.adjustWhitespace(c,_.getStartPosition(),!0,h,new Set(v)),h.resolveVariables(g);const C=h.toString(),w=C.slice(f);f=C.length;const S=ai.replace(_,w);S.identifier={major:p,minor:0},S._isTracked=!0,l.push(S)}return u.ensureFinalTabstop(h,i,!0),{edits:l,snippets:[new Yo(e,h,"")]}}constructor(e,t,i=gV,n){this._editor=e,this._template=t,this._options=i,this._languageConfigurationService=n,this._templateMerges=[],this._snippets=[]}dispose(){Ot(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(){if(!this._editor.hasModel())return;const{edits:e,snippets:t}=typeof this._template=="string"?ta.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):ta.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=t,this._editor.executeEdits("snippet",e,i=>{const n=i.filter(s=>!!s.identifier);for(let s=0;sbe.fromPositions(s.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(e,t=gV){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);const{edits:i,snippets:n}=ta.createEditsAndSnippetsFromSelections(this._editor,e,t.overwriteBefore,t.overwriteAfter,!0,t.adjustWhitespace,t.clipboardText,t.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",i,s=>{const r=s.filter(l=>!!l.identifier);for(let l=0;lbe.fromPositions(l.range.getEndPosition()))})}next(){const e=this._move(!0);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}prev(){const e=this._move(!1);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}_move(e){const t=[];for(const i of this._snippets){const n=i.move(e);t.push(...n)}return t}get isAtFirstPlaceholder(){return this._snippets[0].isAtFirstPlaceholder}get isAtLastPlaceholder(){return this._snippets[0].isAtLastPlaceholder}get hasPlaceholder(){return this._snippets[0].hasPlaceholder}get hasChoice(){return this._snippets[0].hasChoice}get activeChoice(){return this._snippets[0].activeChoice}isSelectionWithinPlaceholders(){if(!this.hasPlaceholder)return!1;const e=this._editor.getSelections();if(e.length{s.push(...n.get(r))})}e.sort(k.compareRangesUsingStarts);for(const[i,n]of t){if(n.length!==e.length){t.delete(i);continue}n.sort(k.compareRangesUsingStarts);for(let s=0;s0}};Ry=ta=p0e([m0e(3,Kt)],Ry);var _0e=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},Pw=function(o,e){return function(t,i){e(t,i,o)}},Of;const fV={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let In=Of=class{static{d(this,"SnippetController2")}static get(e){return e.getContribution(Of.ID)}constructor(e,t,i,n,s){this._editor=e,this._logService=t,this._languageFeaturesService=i,this._languageConfigurationService=s,this._snippetListener=new Y,this._modelVersionId=-1,this._inSnippet=Of.InSnippetMode.bindTo(n),this._hasNextTabstop=Of.HasNextTabstop.bindTo(n),this._hasPrevTabstop=Of.HasPrevTabstop.bindTo(n)}dispose(){var e;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),(e=this._session)===null||e===void 0||e.dispose(),this._snippetListener.dispose()}insert(e,t){try{this._doInsert(e,typeof t>"u"?fV:{...fV,...t})}catch(i){this.cancel(),this._logService.error(i),this._logService.error("snippet_error"),this._logService.error("insert_template=",e),this._logService.error("existing_template=",this._session?this._session._logInfo():"")}}_doInsert(e,t){var i;if(this._editor.hasModel()){if(this._snippetListener.clear(),t.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&typeof e!="string"&&this.cancel(),this._session?(_t(typeof e=="string"),this._session.merge(e,t)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new Ry(this._editor,e,t,this._languageConfigurationService),this._session.insert()),t.undoStopAfter&&this._editor.getModel().pushStackElement(),!((i=this._session)===null||i===void 0)&&i.hasChoice){const n={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:d((u,h)=>{if(!this._session||u!==this._editor.getModel()||!H.equals(this._editor.getPosition(),h))return;const{activeChoice:g}=this._session;if(!g||g.choice.options.length===0)return;const f=u.getValueInRange(g.range),p=!!g.choice.options.find(b=>b.value===f),_=[];for(let b=0;b{r?.dispose(),a=!1},"disable"),c=d(()=>{a||(r=this._languageFeaturesService.completionProvider.register({language:s.getLanguageId(),pattern:s.uri.fsPath,scheme:s.uri.scheme,exclusive:!0},n),this._snippetListener.add(r),a=!0)},"enable");this._choiceCompletions={provider:n,enable:c,disable:l}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent(n=>n.isFlush&&this.cancel())),this._snippetListener.add(this._editor.onDidChangeModel(()=>this.cancel())),this._snippetListener.add(this._editor.onDidChangeCursorSelection(()=>this._updateState()))}}_updateState(){if(!(!this._session||!this._editor.hasModel())){if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){var e;if(!this._session||!this._editor.hasModel()){this._currentChoice=void 0;return}const{activeChoice:t}=this._session;if(!t||!this._choiceCompletions){(e=this._choiceCompletions)===null||e===void 0||e.disable(),this._currentChoice=void 0;return}this._currentChoice!==t.choice&&(this._currentChoice=t.choice,this._choiceCompletions.enable(),queueMicrotask(()=>{h0e(this._editor,this._choiceCompletions.provider)}))}finish(){for(;this._inSnippet.get();)this.next()}cancel(e=!1){var t;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._snippetListener.clear(),this._currentChoice=void 0,(t=this._session)===null||t===void 0||t.dispose(),this._session=void 0,this._modelVersionId=-1,e&&this._editor.setSelections([this._editor.getSelection()])}prev(){var e;(e=this._session)===null||e===void 0||e.prev(),this._updateState()}next(){var e;(e=this._session)===null||e===void 0||e.next(),this._updateState()}isInSnippet(){return!!this._inSnippet.get()}};In.ID="snippetController2";In.InSnippetMode=new ce("inSnippetMode",!1,m("inSnippetMode","Whether the editor in current in snippet mode"));In.HasNextTabstop=new ce("hasNextTabstop",!1,m("hasNextTabstop","Whether there is a next tab stop when in snippet mode"));In.HasPrevTabstop=new ce("hasPrevTabstop",!1,m("hasPrevTabstop","Whether there is a previous tab stop when in snippet mode"));In=Of=_0e([Pw(1,qn),Pw(2,me),Pw(3,Ne),Pw(4,Kt)],In);vt(In.ID,In,4);const Px=Ji.bindToContribution(In.get);de(new Px({id:"jumpToNextSnippetPlaceholder",precondition:j.and(In.InSnippetMode,In.HasNextTabstop),handler:d(o=>o.next(),"handler"),kbOpts:{weight:130,kbExpr:I.textInputFocus,primary:2}}));de(new Px({id:"jumpToPrevSnippetPlaceholder",precondition:j.and(In.InSnippetMode,In.HasPrevTabstop),handler:d(o=>o.prev(),"handler"),kbOpts:{weight:130,kbExpr:I.textInputFocus,primary:1026}}));de(new Px({id:"leaveSnippet",precondition:In.InSnippetMode,handler:d(o=>o.cancel(!0),"handler"),kbOpts:{weight:130,kbExpr:I.textInputFocus,primary:9,secondary:[1033]}}));de(new Px({id:"acceptSnippet",precondition:In.InSnippetMode,handler:d(o=>o.finish(),"handler")}));var b0e=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},sT=function(o,e){return function(t,i){e(t,i,o)}},wo;(function(o){o[o.Undo=0]="Undo",o[o.Redo=1]="Redo",o[o.AcceptWord=2]="AcceptWord",o[o.Other=3]="Other"})(wo||(wo={}));let YA=class extends W{static{d(this,"InlineCompletionsModel")}get isAcceptingPartially(){return this._isAcceptingPartially}constructor(e,t,i,n,s,r,a,l,c,u,h,g){super(),this.textModel=e,this.selectedSuggestItem=t,this.textModelVersionId=i,this._positions=n,this._debounceValue=s,this._suggestPreviewEnabled=r,this._suggestPreviewMode=a,this._inlineSuggestMode=l,this._enabled=c,this._instantiationService=u,this._commandService=h,this._languageConfigurationService=g,this._source=this._register(this._instantiationService.createInstance(qA,this.textModel,this.textModelVersionId,this._debounceValue)),this._isActive=gt(this,!1),this._forceUpdateExplicitlySignal=GL(this),this._selectedInlineCompletionId=gt(this,void 0),this._primaryPosition=Be(this,p=>{var _;return(_=this._positions.read(p)[0])!==null&&_!==void 0?_:new H(1,1)}),this._isAcceptingPartially=!1,this._preserveCurrentCompletionReasons=new Set([wo.Redo,wo.Undo,wo.AcceptWord]),this._fetchInlineCompletionsPromise=Fae({owner:this,createEmptyChangeSummary:d(()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:Bd.Automatic}),"createEmptyChangeSummary"),handleChange:d((p,_)=>(p.didChange(this.textModelVersionId)&&this._preserveCurrentCompletionReasons.has(p.change)?_.preserveCurrentCompletion=!0:p.didChange(this._forceUpdateExplicitlySignal)&&(_.inlineCompletionTriggerKind=Bd.Explicit),!0),"handleChange")},(p,_)=>{if(this._forceUpdateExplicitlySignal.read(p),!(this._enabled.read(p)&&this.selectedSuggestItem.read(p)||this._isActive.read(p))){this._source.cancelUpdate();return}this.textModelVersionId.read(p);const v=this._source.suggestWidgetInlineCompletions.get(),C=this.selectedSuggestItem.read(p);if(v&&!C){const D=this._source.inlineCompletions.get();Wt(E=>{(!D||v.request.versionId>D.request.versionId)&&this._source.inlineCompletions.set(v.clone(),E),this._source.clearSuggestWidgetInlineCompletions(E)})}const w=this._primaryPosition.read(p),S={triggerKind:_.inlineCompletionTriggerKind,selectedSuggestionInfo:C?.toSelectedSuggestionInfo()},y=this.selectedInlineCompletion.get(),x=_.preserveCurrentCompletion||y?.forwardStable?y:void 0;return this._source.fetch(w,S,x)}),this._filteredInlineCompletionItems=Sd({owner:this,equalsFn:QI()},p=>{const _=this._source.inlineCompletions.read(p);if(!_)return[];const b=this._primaryPosition.read(p);return _.inlineCompletions.filter(C=>C.isVisible(this.textModel,b,p))}),this.selectedInlineCompletionIndex=Be(this,p=>{const _=this._selectedInlineCompletionId.read(p),b=this._filteredInlineCompletionItems.read(p),v=this._selectedInlineCompletionId===void 0?-1:b.findIndex(C=>C.semanticId===_);return v===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):v}),this.selectedInlineCompletion=Be(this,p=>{const _=this._filteredInlineCompletionItems.read(p),b=this.selectedInlineCompletionIndex.read(p);return _[b]}),this.activeCommands=Sd({owner:this,equalsFn:QI()},p=>{var _,b;return(b=(_=this.selectedInlineCompletion.read(p))===null||_===void 0?void 0:_.inlineCompletion.source.inlineCompletions.commands)!==null&&b!==void 0?b:[]}),this.lastTriggerKind=this._source.inlineCompletions.map(this,p=>p?.request.context.triggerKind),this.inlineCompletionsCount=Be(this,p=>{if(this.lastTriggerKind.read(p)===Bd.Explicit)return this._filteredInlineCompletionItems.read(p).length}),this.state=Sd({owner:this,equalsFn:d((p,_)=>!p||!_?p===_:X3(p.ghostTexts,_.ghostTexts)&&p.inlineCompletion===_.inlineCompletion&&p.suggestItem===_.suggestItem,"equalsFn")},p=>{var _,b;const v=this.textModel,C=this.selectedSuggestItem.read(p);if(C){const w=lg(C.toSingleTextEdit(),v),S=this._computeAugmentation(w,p);if(!this._suggestPreviewEnabled.read(p)&&!S)return;const x=(_=S?.edit)!==null&&_!==void 0?_:w,D=S?S.edit.text.length-w.text.length:0,E=this._suggestPreviewMode.read(p),A=this._positions.read(p),z=[x,...oT(this.textModel,A,x)],O=z.map((V,$)=>tV(V,v,E,A[$],D)).filter(kl),P=(b=O[0])!==null&&b!==void 0?b:new o0(x.range.endLineNumber,[]);return{edits:z,primaryGhostText:P,ghostTexts:O,inlineCompletion:S?.completion,suggestItem:C}}else{if(!this._isActive.read(p))return;const w=this.selectedInlineCompletion.read(p);if(!w)return;const S=w.toSingleTextEdit(p),y=this._inlineSuggestMode.read(p),x=this._positions.read(p),D=[S,...oT(this.textModel,x,S)],E=D.map((A,z)=>tV(A,v,y,x[z],0)).filter(kl);return E[0]?{edits:D,primaryGhostText:E[0],ghostTexts:E,inlineCompletion:w,suggestItem:void 0}:void 0}}),this.ghostTexts=Sd({owner:this,equalsFn:X3},p=>{const _=this.state.read(p);if(_)return _.ghostTexts}),this.primaryGhostText=Sd({owner:this,equalsFn:pU},p=>{const _=this.state.read(p);if(_)return _?.primaryGhostText}),this._register(Z0(this._fetchInlineCompletionsPromise));let f;this._register(Je(p=>{var _,b;const v=this.state.read(p),C=v?.inlineCompletion;if(C?.semanticId!==f?.semanticId&&(f=C,C)){const w=C.inlineCompletion,S=w.source;(b=(_=S.provider).handleItemDidShow)===null||b===void 0||b.call(_,S.inlineCompletions,w.sourceInlineCompletion,w.insertText)}}))}async trigger(e){this._isActive.set(!0,e),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e){Ev(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineCompletionsPromise.get()}stop(e){Ev(e,t=>{this._isActive.set(!1,t),this._source.clear(t)})}_computeAugmentation(e,t){const i=this.textModel,n=this._source.suggestWidgetInlineCompletions.read(t),s=n?n.inlineCompletions:[this.selectedInlineCompletion.read(t)].filter(kl);return cX(s,a=>{let l=a.toSingleTextEdit(t);return l=lg(l,i,k.fromPositions(l.range.getStartPosition(),e.range.getEndPosition())),vU(l,e)?{completion:a,edit:l}:void 0})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();const t=this._filteredInlineCompletionItems.get()||[];if(t.length>0){const i=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[i].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}async accept(e){var t;if(e.getModel()!==this.textModel)throw new At;const i=this.state.get();if(!i||i.primaryGhostText.isEmpty()||!i.inlineCompletion)return;const n=i.inlineCompletion.toInlineCompletion(void 0);if(e.pushUndoStop(),n.snippetInfo)e.executeEdits("inlineSuggestion.accept",[ai.replace(n.range,""),...n.additionalTextEdits]),e.setPosition(n.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),(t=In.get(e))===null||t===void 0||t.insert(n.snippetInfo.snippet,{undoStopBefore:!1});else{const s=i.edits,r=pV(s).map(a=>be.fromPositions(a));e.executeEdits("inlineSuggestion.accept",[...s.map(a=>ai.replace(a.range,a.text)),...n.additionalTextEdits]),e.setSelections(r,"inlineCompletionAccept")}n.command&&n.source.addRef(),Wt(s=>{this._source.clear(s),this._isActive.set(!1,s)}),n.command&&(await this._commandService.executeCommand(n.command.id,...n.command.arguments||[]).then(void 0,Li),n.source.removeRef())}async acceptNextWord(e){await this._acceptNext(e,(t,i)=>{const n=this.textModel.getLanguageIdAtPosition(t.lineNumber,t.column),s=this._languageConfigurationService.getLanguageConfiguration(n),r=new RegExp(s.wordDefinition.source,s.wordDefinition.flags.replace("g","")),a=i.match(r);let l=0;a&&a.index!==void 0?a.index===0?l=a[0].length:l=a.index:l=i.length;const u=/\s+/g.exec(i);return u&&u.index!==void 0&&u.index+u[0].length{const n=i.match(/\n/);return n&&n.index!==void 0?n.index+1:i.length},1)}async _acceptNext(e,t,i){if(e.getModel()!==this.textModel)throw new At;const n=this.state.get();if(!n||n.primaryGhostText.isEmpty()||!n.inlineCompletion)return;const s=n.primaryGhostText,r=n.inlineCompletion.toInlineCompletion(void 0);if(r.snippetInfo||r.filterText!==r.insertText){await this.accept(e);return}const a=s.parts[0],l=new H(s.lineNumber,a.column),c=a.text,u=t(l,c);if(u===c.length&&s.parts.length===1){this.accept(e);return}const h=c.substring(0,u),g=this._positions.get(),f=g[0];r.source.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();const p=k.fromPositions(f,l),_=e.getModel().getValueInRange(p)+h,b=new ic(p,_),v=[b,...oT(this.textModel,g,b)],C=pV(v).map(w=>be.fromPositions(w));e.executeEdits("inlineSuggestion.accept",v.map(w=>ai.replace(w.range,w.text))),e.setSelections(C,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1)}finally{this._isAcceptingPartially=!1}if(r.source.provider.handlePartialAccept){const p=k.fromPositions(r.range.getStartPosition(),ws.ofText(h).addToPosition(l)),_=e.getModel().getValueInRange(p,1);r.source.provider.handlePartialAccept(r.source.inlineCompletions,r.sourceInlineCompletion,_.length,{kind:i})}}finally{r.source.removeRef()}}handleSuggestAccepted(e){var t,i;const n=lg(e.toSingleTextEdit(),this.textModel),s=this._computeAugmentation(n,void 0);if(!s)return;const r=s.completion.inlineCompletion;(i=(t=r.source.provider).handlePartialAccept)===null||i===void 0||i.call(t,r.source.inlineCompletions,r.sourceInlineCompletion,n.text.length,{kind:2})}};YA=b0e([sT(9,xe),sT(10,Qt),sT(11,Kt)],YA);function oT(o,e,t){if(e.length===1)return[];const i=e[0],n=e.slice(1),s=t.range.getStartPosition(),r=t.range.getEndPosition(),a=o.getValueInRange(k.fromPositions(i,r)),l=Z3(i,s);if(l.lineNumber<1)return Ue(new At(`positionWithinTextEdit line number should be bigger than 0.
+ Invalid subtraction between ${i.toString()} and ${s.toString()}`)),[];const c=v0e(t.text,l);return n.map(u=>{const h=zve(Z3(u,s),r),g=o.getValueInRange(k.fromPositions(u,h)),f=wu(a,g),p=k.fromPositions(u,u.delta(0,f));return new ic(p,c)})}d(oT,"getSecondaryEdits");function v0e(o,e){let t="";const i=H$(o);for(let n=e.lineNumber-1;nk.compareRangesUsingStarts(s.range,r.range)),i=new NR(e.apply(o)).getNewRanges();return e.inverse().apply(i).map(s=>s.getEndPosition())}d(pV,"getEndPositionsAfterApplying");var C0e=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},mV=function(o,e){return function(t,i){e(t,i,o)}},Q_;class eO{static{d(this,"Memory")}constructor(e){this.name=e}select(e,t,i){if(i.length===0)return 0;const n=i[0].score[0];for(let s=0;sl&&h.type===i[c].completion.kind&&h.insertText===i[c].completion.insertText&&(l=h.touch,a=c),i[c].completion.preselect&&r===-1)return r=c}return a!==-1?a:r!==-1?r:0}toJSON(){return this._cache.toJSON()}fromJSON(e){this._cache.clear();const t=0;for(const[i,n]of e)n.touch=t,n.type=typeof n.type=="number"?n.type:Gb.fromString(n.type),this._cache.set(i,n);this._seq=this._cache.size}}class S0e extends eO{static{d(this,"PrefixMemory")}constructor(){super("recentlyUsedByPrefix"),this._trie=Tp.forStrings(),this._seq=0}memorize(e,t,i){const{word:n}=e.getWordUntilPosition(t),s=`${e.getLanguageId()}/${n}`;this._trie.set(s,{type:i.completion.kind,insertText:i.completion.insertText,touch:this._seq++})}select(e,t,i){const{word:n}=e.getWordUntilPosition(t);if(!n)return super.select(e,t,i);const s=`${e.getLanguageId()}/${n}`;let r=this._trie.get(s);if(r||(r=this._trie.findSubstr(s)),r)for(let a=0;ae.push([i,t])),e.sort((t,i)=>-(t[1].touch-i[1].touch)).forEach((t,i)=>t[1].touch=i),e.slice(0,200)}fromJSON(e){if(this._trie.clear(),e.length>0){this._seq=e[0][1].touch+1;for(const[t,i]of e)i.type=typeof i.type=="number"?i.type:Gb.fromString(i.type),this._trie.set(t,i)}}}let a0=Q_=class{static{d(this,"SuggestMemoryService")}constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new Y,this._persistSoon=new Pt(()=>this._saveState(),500),this._disposables.add(e.onWillSaveState(i=>{i.reason===Av.SHUTDOWN&&this._saveState()}))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(e,t,i){this._withStrategy(e,t).memorize(e,t,i),this._persistSoon.schedule()}select(e,t,i){return this._withStrategy(e,t).select(e,t,i)}_withStrategy(e,t){var i;const n=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:e.getLanguageIdAtPosition(t.lineNumber,t.column),resource:e.uri});if(((i=this._strategy)===null||i===void 0?void 0:i.name)!==n){this._saveState();const s=Q_._strategyCtors.get(n)||CU;this._strategy=new s;try{const a=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,l=this._storageService.get(`${Q_._storagePrefix}/${n}`,a);l&&this._strategy.fromJSON(JSON.parse(l))}catch{}}return this._strategy}_saveState(){if(this._strategy){const t=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,i=JSON.stringify(this._strategy);this._storageService.store(`${Q_._storagePrefix}/${this._strategy.name}`,i,t,1)}}};a0._strategyCtors=new Map([["recentlyUsedByPrefix",S0e],["recentlyUsed",w0e],["first",CU]]);a0._storagePrefix="suggest/memories";a0=Q_=C0e([mV(0,jr),mV(1,et)],a0);const Ox=rt("ISuggestMemories");ht(Ox,a0,1);var y0e=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},L0e=function(o,e){return function(t,i){e(t,i,o)}},XA;let l0=XA=class{static{d(this,"WordContextKey")}constructor(e,t){this._editor=e,this._enabled=!1,this._ckAtEnd=XA.AtEnd.bindTo(t),this._configListener=this._editor.onDidChangeConfiguration(i=>i.hasChanged(123)&&this._update()),this._update()}dispose(){var e;this._configListener.dispose(),(e=this._selectionListener)===null||e===void 0||e.dispose(),this._ckAtEnd.reset()}_update(){const e=this._editor.getOption(123)==="on";if(this._enabled!==e)if(this._enabled=e,this._enabled){const t=d(()=>{if(!this._editor.hasModel()){this._ckAtEnd.set(!1);return}const i=this._editor.getModel(),n=this._editor.getSelection(),s=i.getWordAtPosition(n.getStartPosition());if(!s){this._ckAtEnd.set(!1);return}this._ckAtEnd.set(s.endColumn===n.getStartPosition().column)},"checkForWordEnd");this._selectionListener=this._editor.onDidChangeCursorSelection(t),t()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}};l0.AtEnd=new ce("atEndOfWord",!1);l0=XA=y0e([L0e(1,Ne)],l0);var x0e=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},k0e=function(o,e){return function(t,i){e(t,i,o)}},J_;let Og=J_=class{static{d(this,"SuggestAlternatives")}constructor(e,t){this._editor=e,this._index=0,this._ckOtherSuggestions=J_.OtherSuggestions.bindTo(t)}dispose(){this.reset()}reset(){var e;this._ckOtherSuggestions.reset(),(e=this._listener)===null||e===void 0||e.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:e,index:t},i){if(e.items.length===0){this.reset();return}if(J_._moveIndex(!0,e,t)===t){this.reset();return}this._acceptNext=i,this._model=e,this._index=t,this._listener=this._editor.onDidChangeCursorPosition(()=>{this._ignore||this.reset()}),this._ckOtherSuggestions.set(!0)}static _moveIndex(e,t,i){let n=i;for(let s=t.items.length;s>0&&(n=(n+t.items.length+(e?1:-1))%t.items.length,!(n===i||!t.items[n].completion.additionalTextEdits));s--);return n}next(){this._move(!0)}prev(){this._move(!1)}_move(e){if(this._model)try{this._ignore=!0,this._index=J_._moveIndex(e,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};Og.OtherSuggestions=new ce("hasOtherSuggestions",!1);Og=J_=x0e([k0e(1,Ne)],Og);class D0e{static{d(this,"CommitCharacterController")}constructor(e,t,i,n){this._disposables=new Y,this._disposables.add(i.onDidSuggest(s=>{s.completionModel.items.length===0&&this.reset()})),this._disposables.add(i.onDidCancel(s=>{this.reset()})),this._disposables.add(t.onDidShow(()=>this._onItem(t.getFocusedItem()))),this._disposables.add(t.onDidFocus(this._onItem,this)),this._disposables.add(t.onDidHide(this.reset,this)),this._disposables.add(e.onWillType(s=>{if(this._active&&!t.isFrozen()&&i.state!==0){const r=s.charCodeAt(s.length-1);this._active.acceptCharacters.has(r)&&e.getOption(0)&&n(this._active.item)}}))}_onItem(e){if(!e||!$n(e.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===e.item)return;const t=new nS;for(const i of e.item.completion.commitCharacters)i.length>0&&t.add(i.charCodeAt(0));this._active={acceptCharacters:t,item:e}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}}class So{static{d(this,"BracketSelectionRangeProvider")}async provideSelectionRanges(e,t){const i=[];for(const n of t){const s=[];i.push(s);const r=new Map;await new Promise(a=>So._bracketsRightYield(a,0,e,n,r)),await new Promise(a=>So._bracketsLeftYield(a,0,e,n,r,s))}return i}static _bracketsRightYield(e,t,i,n,s){const r=new Map,a=Date.now();for(;;){if(t>=So._maxRounds){e();break}if(!n){e();break}const l=i.bracketPairs.findNextBracket(n);if(!l){e();break}if(Date.now()-a>So._maxDuration){setTimeout(()=>So._bracketsRightYield(e,t+1,i,n,s));break}if(l.bracketInfo.isOpeningBracket){const u=l.bracketInfo.bracketText,h=r.has(u)?r.get(u):0;r.set(u,h+1)}else{const u=l.bracketInfo.getOpeningBrackets()[0].bracketText;let h=r.has(u)?r.get(u):0;if(h-=1,r.set(u,Math.max(0,h)),h<0){let g=s.get(u);g||(g=new vs,s.set(u,g)),g.push(l.range)}}n=l.range.getEndPosition()}}static _bracketsLeftYield(e,t,i,n,s,r){const a=new Map,l=Date.now();for(;;){if(t>=So._maxRounds&&s.size===0){e();break}if(!n){e();break}const c=i.bracketPairs.findPrevBracket(n);if(!c){e();break}if(Date.now()-l>So._maxDuration){setTimeout(()=>So._bracketsLeftYield(e,t+1,i,n,s,r));break}if(c.bracketInfo.isOpeningBracket){const h=c.bracketInfo.bracketText;let g=a.has(h)?a.get(h):0;if(g-=1,a.set(h,Math.max(0,g)),g<0){const f=s.get(h);if(f){const p=f.shift();f.size===0&&s.delete(h);const _=k.fromPositions(c.range.getEndPosition(),p.getStartPosition()),b=k.fromPositions(c.range.getStartPosition(),p.getEndPosition());r.push({range:_}),r.push({range:b}),So._addBracketLeading(i,b,r)}}}else{const h=c.bracketInfo.getOpeningBrackets()[0].bracketText,g=a.has(h)?a.get(h):0;a.set(h,g+1)}n=c.range.getStartPosition()}}static _addBracketLeading(e,t,i){if(t.startLineNumber===t.endLineNumber)return;const n=t.startLineNumber,s=e.getLineFirstNonWhitespaceColumn(n);s!==0&&s!==t.startColumn&&(i.push({range:k.fromPositions(new H(n,s),t.getEndPosition())}),i.push({range:k.fromPositions(new H(n,1),t.getEndPosition())}));const r=n-1;if(r>0){const a=e.getLineFirstNonWhitespaceColumn(r);a===t.startColumn&&a!==e.getLineLastNonWhitespaceColumn(r)&&(i.push({range:k.fromPositions(new H(r,a),t.getEndPosition())}),i.push({range:k.fromPositions(new H(r,1),t.getEndPosition())}))}}}So._maxDuration=30;So._maxRounds=2;class ua{static{d(this,"WordDistance")}static async create(e,t){if(!t.getOption(118).localityBonus||!t.hasModel())return ua.None;const i=t.getModel(),n=t.getPosition();if(!e.canComputeWordRanges(i.uri))return ua.None;const[s]=await new So().provideSelectionRanges(i,[n]);if(s.length===0)return ua.None;const r=await e.computeWordRanges(i.uri,s[0].range);if(!r)return ua.None;const a=i.getWordUntilPosition(n);return delete r[a.word],new class extends ua{distance(l,c){if(!n.equals(t.getPosition()))return 0;if(c.kind===17)return 2<<20;const u=typeof c.label=="string"?c.label:c.label.label,h=r[u];if($V(h))return 2<<20;const g=Vb(h,k.fromPositions(l),k.compareRangesUsingStarts),f=g>=0?h[g]:h[Math.max(0,~g-1)];let p=s.length;for(const _ of s){if(!k.containsRange(_.range,f))break;p-=1}return p}}}}ua.None=new class extends ua{distance(){return 0}};let _V=class{static{d(this,"LineContext")}constructor(e,t){this.leadingLineContent=e,this.characterCountDelta=t}};class Vc{static{d(this,"CompletionModel")}constructor(e,t,i,n,s,r,a=RL.default,l=void 0){this.clipboardText=l,this._snippetCompareFn=Vc._compareCompletionItems,this._items=e,this._column=t,this._wordDistance=n,this._options=s,this._refilterKind=1,this._lineContext=i,this._fuzzyScoreOptions=a,r==="top"?this._snippetCompareFn=Vc._compareCompletionItemsSnippetsUp:r==="bottom"&&(this._snippetCompareFn=Vc._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(e){(this._lineContext.leadingLineContent!==e.leadingLineContent||this._lineContext.characterCountDelta!==e.characterCountDelta)&&(this._refilterKind=this._lineContext.characterCountDelta0&&i[0].container.incomplete&&e.add(t);return e}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){this._refilterKind!==0&&this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;const e=[],{leadingLineContent:t,characterCountDelta:i}=this._lineContext;let n="",s="";const r=this._refilterKind===1?this._items:this._filteredItems,a=[],l=!this._options.filterGraceful||r.length>2e3?wg:Aoe;for(let c=0;c=f)u.score=La.Default;else if(typeof u.completion.filterText=="string"){const _=l(n,s,p,u.completion.filterText,u.filterTextLow,0,this._fuzzyScoreOptions);if(!_)continue;yE(u.completion.filterText,u.textLabel)===0?u.score=_:(u.score=Toe(n,s,p,u.textLabel,u.labelLow,0),u.score[0]=_[0])}else{const _=l(n,s,p,u.textLabel,u.labelLow,0,this._fuzzyScoreOptions);if(!_)continue;u.score=_}}u.idx=c,u.distance=this._wordDistance.distance(u.position,u.completion),a.push(u),e.push(u.textLabel.length)}this._filteredItems=a.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:e.length?vT(e.length-.85,e,(c,u)=>c-u):0}}static _compareCompletionItems(e,t){return e.score[0]>t.score[0]?-1:e.score[0]t.distance?1:e.idxt.idx?1:0}static _compareCompletionItemsSnippetsDown(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===27)return 1;if(t.completion.kind===27)return-1}return Vc._compareCompletionItems(e,t)}static _compareCompletionItemsSnippetsUp(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===27)return-1;if(t.completion.kind===27)return 1}return Vc._compareCompletionItems(e,t)}}var T0e=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},wc=function(o,e){return function(t,i){e(t,i,o)}},ZA;class vh{static{d(this,"LineContext")}static shouldAutoTrigger(e){if(!e.hasModel())return!1;const t=e.getModel(),i=e.getPosition();t.tokenization.tokenizeIfCheap(i.lineNumber);const n=t.getWordAtPosition(i);return!(!n||n.endColumn!==i.column&&n.startColumn+1!==i.column||!isNaN(Number(n.word)))}constructor(e,t,i){this.leadingLineContent=e.getLineContent(t.lineNumber).substr(0,t.column-1),this.leadingWord=e.getWordUntilPosition(t),this.lineNumber=t.lineNumber,this.column=t.column,this.triggerOptions=i}}function E0e(o,e,t){if(!e.getContextKeyValue(_n.inlineSuggestionVisible.key))return!0;const i=e.getContextKeyValue(_n.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}d(E0e,"canShowQuickSuggest");function I0e(o,e,t){if(!e.getContextKeyValue("inlineSuggestionVisible"))return!0;const i=e.getContextKeyValue(_n.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}d(I0e,"canShowSuggestOnTriggerCharacters");let Py=ZA=class{static{d(this,"SuggestModel")}constructor(e,t,i,n,s,r,a,l,c){this._editor=e,this._editorWorkerService=t,this._clipboardService=i,this._telemetryService=n,this._logService=s,this._contextKeyService=r,this._configurationService=a,this._languageFeaturesService=l,this._envService=c,this._toDispose=new Y,this._triggerCharacterListener=new Y,this._triggerQuickSuggest=new $r,this._triggerState=void 0,this._completionDisposables=new Y,this._onDidCancel=new F,this._onDidTrigger=new F,this._onDidSuggest=new F,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new be(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeModelLanguage(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeConfiguration(()=>{this._updateTriggerCharacters()})),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange(()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()}));let u=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{u=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{u=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection(h=>{u||this._onCursorChange(h)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{!u&&this._triggerState!==void 0&&this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){Ot(this._triggerCharacterListener),Ot([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(91)||!this._editor.hasModel()||!this._editor.getOption(121))return;const e=new Map;for(const i of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(const n of i.triggerCharacters||[]){let s=e.get(n);s||(s=new Set,s.add(a0e()),e.set(n,s)),s.add(i)}const t=d(i=>{var n;if(!I0e(this._editor,this._contextKeyService,this._configurationService)||vh.shouldAutoTrigger(this._editor))return;if(!i){const a=this._editor.getPosition();i=this._editor.getModel().getLineContent(a.lineNumber).substr(0,a.column-1)}let s="";hg(i.charCodeAt(i.length-1))?on(i.charCodeAt(i.length-2))&&(s=i.substr(i.length-2)):s=i.charAt(i.length-1);const r=e.get(s);if(r){const a=new Map;if(this._completionModel)for(const[l,c]of this._completionModel.getItemsByProvider())r.has(l)||a.set(l,c);this.trigger({auto:!0,triggerKind:1,triggerCharacter:s,retrigger:!!this._completionModel,clipboardText:(n=this._completionModel)===null||n===void 0?void 0:n.clipboardText,completionOptions:{providerFilter:r,providerItemsToReuse:a}})}},"checkTriggerCharacter");this._triggerCharacterListener.add(this._editor.onDidType(t)),this._triggerCharacterListener.add(this._editor.onDidCompositionEnd(()=>t()))}get state(){return this._triggerState?this._triggerState.auto?2:1:0}cancel(e=!1){var t;this._triggerState!==void 0&&(this._triggerQuickSuggest.cancel(),(t=this._requestToken)===null||t===void 0||t.cancel(),this._requestToken=void 0,this._triggerState=void 0,this._completionModel=void 0,this._context=void 0,this._onDidCancel.fire({retrigger:e}))}clear(){this._completionDisposables.clear()}_updateActiveSuggestSession(){this._triggerState!==void 0&&(!this._editor.hasModel()||!this._languageFeaturesService.completionProvider.has(this._editor.getModel())?this.cancel():this.trigger({auto:this._triggerState.auto,retrigger:!0}))}_onCursorChange(e){if(!this._editor.hasModel())return;const t=this._currentSelection;if(this._currentSelection=this._editor.getSelection(),!e.selection.isEmpty()||e.reason!==0&&e.reason!==3||e.source!=="keyboard"&&e.source!=="deleteLeft"){this.cancel();return}this._triggerState===void 0&&e.reason===0?(t.containsRange(this._currentSelection)||t.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))&&this._doTriggerQuickSuggest():this._triggerState!==void 0&&e.reason===3&&this._refilterCompletionItems()}_onCompositionEnd(){this._triggerState===void 0?this._doTriggerQuickSuggest():this._refilterCompletionItems()}_doTriggerQuickSuggest(){var e;lp.isAllOff(this._editor.getOption(89))||this._editor.getOption(118).snippetsPreventQuickSuggestions&&(!((e=In.get(this._editor))===null||e===void 0)&&e.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!vh.shouldAutoTrigger(this._editor)||!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;const t=this._editor.getModel(),i=this._editor.getPosition(),n=this._editor.getOption(89);if(!lp.isAllOff(n)){if(!lp.isAllOn(n)){t.tokenization.tokenizeIfCheap(i.lineNumber);const s=t.tokenization.getLineTokens(i.lineNumber),r=s.getStandardTokenType(s.findTokenIndexAtOffset(Math.max(i.column-1-1,0)));if(lp.valueFor(n,r)!=="on")return}E0e(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(t)&&this.trigger({auto:!0})}},this._editor.getOption(90)))}_refilterCompletionItems(){_t(this._editor.hasModel()),_t(this._triggerState!==void 0);const e=this._editor.getModel(),t=this._editor.getPosition(),i=new vh(e,t,{...this._triggerState,refilter:!0});this._onNewContext(i)}trigger(e){var t,i,n,s,r,a;if(!this._editor.hasModel())return;const l=this._editor.getModel(),c=new vh(l,this._editor.getPosition(),e);this.cancel(e.retrigger),this._triggerState=e,this._onDidTrigger.fire({auto:e.auto,shy:(t=e.shy)!==null&&t!==void 0?t:!1,position:this._editor.getPosition()}),this._context=c;let u={triggerKind:(i=e.triggerKind)!==null&&i!==void 0?i:0};e.triggerCharacter&&(u={triggerKind:1,triggerCharacter:e.triggerCharacter}),this._requestToken=new ui;const h=this._editor.getOption(112);let g=1;switch(h){case"top":g=0;break;case"bottom":g=2;break}const{itemKind:f,showDeprecated:p}=ZA.createSuggestFilter(this._editor),_=new r0(g,(s=(n=e.completionOptions)===null||n===void 0?void 0:n.kindFilter)!==null&&s!==void 0?s:f,(r=e.completionOptions)===null||r===void 0?void 0:r.providerFilter,(a=e.completionOptions)===null||a===void 0?void 0:a.providerItemsToReuse,p),b=ua.create(this._editorWorkerService,this._editor),v=Q2(this._languageFeaturesService.completionProvider,l,this._editor.getPosition(),_,u,this._requestToken.token);Promise.all([v,b]).then(async([C,w])=>{var S;if((S=this._requestToken)===null||S===void 0||S.dispose(),!this._editor.hasModel())return;let y=e?.clipboardText;if(!y&&C.needsClipboard&&(y=await this._clipboardService.readText()),this._triggerState===void 0)return;const x=this._editor.getModel(),D=new vh(x,this._editor.getPosition(),e),E={...RL.default,firstMatchCanBeWeak:!this._editor.getOption(118).matchOnWordStartOnly};if(this._completionModel=new Vc(C.items,this._context.column,{leadingLineContent:D.leadingLineContent,characterCountDelta:D.column-this._context.column},w,this._editor.getOption(118),this._editor.getOption(112),E,y),this._completionDisposables.add(C.disposable),this._onNewContext(D),this._reportDurationsTelemetry(C.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(const A of C.items)A.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${A.provider._debugDisplayName}`,A.completion)}).catch(Ue)}_reportDurationsTelemetry(e){this._telemetryGate++%230===0&&setTimeout(()=>{this._telemetryService.publicLog2("suggest.durations.json",{data:JSON.stringify(e)}),this._logService.debug("suggest.durations.json",e)})}static createSuggestFilter(e){const t=new Set;e.getOption(112)==="none"&&t.add(27);const n=e.getOption(118);return n.showMethods||t.add(0),n.showFunctions||t.add(1),n.showConstructors||t.add(2),n.showFields||t.add(3),n.showVariables||t.add(4),n.showClasses||t.add(5),n.showStructs||t.add(6),n.showInterfaces||t.add(7),n.showModules||t.add(8),n.showProperties||t.add(9),n.showEvents||t.add(10),n.showOperators||t.add(11),n.showUnits||t.add(12),n.showValues||t.add(13),n.showConstants||t.add(14),n.showEnums||t.add(15),n.showEnumMembers||t.add(16),n.showKeywords||t.add(17),n.showWords||t.add(18),n.showColors||t.add(19),n.showFiles||t.add(20),n.showReferences||t.add(21),n.showColors||t.add(22),n.showFolders||t.add(23),n.showTypeParameters||t.add(24),n.showSnippets||t.add(27),n.showUsers||t.add(25),n.showIssues||t.add(26),{itemKind:t,showDeprecated:n.showDeprecated}}_onNewContext(e){if(this._context){if(e.lineNumber!==this._context.lineNumber){this.cancel();return}if(Vt(e.leadingLineContent)!==Vt(this._context.leadingLineContent)){this.cancel();return}if(e.columnthis._context.leadingWord.startColumn){if(vh.shouldAutoTrigger(this._editor)&&this._context){const i=this._completionModel.getItemsByProvider();this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerItemsToReuse:i}})}return}if(e.column>this._context.column&&this._completionModel.getIncompleteProvider().size>0&&e.leadingWord.word.length!==0){const t=new Map,i=new Set;for(const[n,s]of this._completionModel.getItemsByProvider())s.length>0&&s[0].container.incomplete?i.add(n):t.set(n,s);this.trigger({auto:this._context.triggerOptions.auto,triggerKind:2,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerFilter:i,providerItemsToReuse:t}})}else{const t=this._completionModel.lineContext;let i=!1;if(this._completionModel.lineContext={leadingLineContent:e.leadingLineContent,characterCountDelta:e.column-this._context.column},this._completionModel.items.length===0){const n=vh.shouldAutoTrigger(this._editor);if(!this._context){this.cancel();return}if(n&&this._context.leadingWord.endColumn0,i&&e.leadingWord.word.length===0){this.cancel();return}}this._onDidSuggest.fire({completionModel:this._completionModel,triggerOptions:e.triggerOptions,isFrozen:i})}}}}};Py=ZA=T0e([wc(1,_r),wc(2,gc),wc(3,Vn),wc(4,qn),wc(5,Ne),wc(6,et),wc(7,me),wc(8,yP)],Py);class Fx{static{d(this,"OvertypingCapturer")}constructor(e,t){this._disposables=new Y,this._lastOvertyped=[],this._locked=!1,this._disposables.add(e.onWillType(()=>{if(this._locked||!e.hasModel())return;const i=e.getSelections(),n=i.length;let s=!1;for(let a=0;aFx._maxSelectionLength)return;this._lastOvertyped[a]={value:r.getValueInRange(l),multiline:l.startLineNumber!==l.endLineNumber}}})),this._disposables.add(t.onDidTrigger(i=>{this._locked=!0})),this._disposables.add(t.onDidCancel(i=>{this._locked=!1}))}getLastOvertypedInfo(e){if(e>=0&&e=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},rT=function(o,e){return function(t,i){e(t,i,o)}};let A0e=class wU extends Iu{static{d(this,"StatusBarViewItem")}updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();this.label&&(this.label.textContent=m({key:"content",comment:["A label","A keybinding"]},"{0} ({1})",this._action.label,wU.symbolPrintEnter(e)))}static symbolPrintEnter(e){var t;return(t=e.getLabel())===null||t===void 0?void 0:t.replace(/\benter\b/gi,"⏎")}},QA=class{static{d(this,"SuggestWidgetStatus")}constructor(e,t,i,n,s){this._menuId=t,this._menuService=n,this._contextKeyService=s,this._menuDisposables=new Y,this.element=Q(e,ie(".suggest-status-bar"));const r=d(a=>a instanceof oo?i.createInstance(A0e,a,void 0):void 0,"actionViewItemProvider");this._leftActions=new gr(this.element,{actionViewItemProvider:r}),this._rightActions=new gr(this.element,{actionViewItemProvider:r}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this._leftActions.dispose(),this._rightActions.dispose(),this.element.remove()}show(){const e=this._menuService.createMenu(this._menuId,this._contextKeyService),t=d(()=>{const i=[],n=[];for(const[s,r]of e.getActions())s==="left"?i.push(...r):n.push(...r);this._leftActions.clear(),this._leftActions.push(i),this._rightActions.clear(),this._rightActions.push(n)},"renderMenu");this._menuDisposables.add(e.onDidChange(()=>t())),this._menuDisposables.add(e)}hide(){this._menuDisposables.clear()}};QA=M0e([rT(2,xe),rT(3,Uo),rT(4,Ne)],QA);var N0e=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},R0e=function(o,e){return function(t,i){e(t,i,o)}};function tO(o){return!!o&&!!(o.completion.documentation||o.completion.detail&&o.completion.detail!==o.completion.label)}d(tO,"canExpandCompletionItem");let JA=class{static{d(this,"SuggestDetailsWidget")}constructor(e,t){this._editor=e,this._onDidClose=new F,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new F,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new Y,this._renderDisposeable=new Y,this._borderWidth=1,this._size=new wt(330,0),this.domNode=ie(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=t.createInstance(Hl,{editor:e}),this._body=ie(".body"),this._scrollbar=new V0(this._body,{alwaysConsumeMouseWheel:!0}),Q(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=Q(this._body,ie(".header")),this._close=Q(this._header,ie("span"+Ae.asCSSSelector(re.close))),this._close.title=m("details.close","Close"),this._type=Q(this._header,ie("p.type")),this._docs=Q(this._body,ie("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(50)&&this._configureFont()}))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose()}_configureFont(){const e=this._editor.getOptions(),t=e.get(50),i=t.getMassagedFontFamily(),n=e.get(119)||t.fontSize,s=e.get(120)||t.lineHeight,r=t.fontWeight,a=`${n}px`,l=`${s}px`;this.domNode.style.fontSize=a,this.domNode.style.lineHeight=`${s/n}`,this.domNode.style.fontWeight=r,this.domNode.style.fontFeatureSettings=t.fontFeatureSettings,this._type.style.fontFamily=i,this._close.style.height=l,this._close.style.width=l}getLayoutInfo(){const e=this._editor.getOption(120)||this._editor.getOption(50).lineHeight,t=this._borderWidth,i=t*2;return{lineHeight:e,borderWidth:t,borderHeight:i,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=m("loading","Loading..."),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,this.getLayoutInfo().lineHeight*2),this._onDidChangeContents.fire(this)}renderItem(e,t){var i,n;this._renderDisposeable.clear();let{detail:s,documentation:r}=e.completion;if(t){let a="";a+=`score: ${e.score[0]}
+`,a+=`prefix: ${(i=e.word)!==null&&i!==void 0?i:"(no prefix)"}
+`,a+=`word: ${e.completion.filterText?e.completion.filterText+" (filterText)":e.textLabel}
+`,a+=`distance: ${e.distance} (localityBonus-setting)
+`,a+=`index: ${e.idx}, based on ${e.completion.sortText&&`sortText: "${e.completion.sortText}"`||"label"}
+`,a+=`commit_chars: ${(n=e.completion.commitCharacters)===null||n===void 0?void 0:n.join("")}
+`,r=new Gn().appendCodeblock("empty",a),s=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!tO(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,to(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(a))}else kn(this._type),this._type.title="",fs(this._type),this.domNode.classList.add("no-type");if(kn(this._docs),typeof r=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=r;else if(r){this._docs.classList.add("markdown-docs"),kn(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 isEmpty(){return this.domNode.classList.contains("no-docs")}get size(){return this._size}layout(e,t){const i=new wt(e,t);wt.equals(i,this._size)||(this._size=i,$j(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}};JA=N0e([R0e(1,xe)],JA);class P0e{static{d(this,"SuggestDetailsOverlay")}constructor(e,t){this.widget=e,this._editor=t,this.allowEditorOverflow=!0,this._disposables=new Y,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new H2,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 this._topLeft?{preference:this._topLeft}:null}show(){this._added||(this._editor.addOverlayWidget(this),this._added=!0)}hide(e=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),e&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(e,t){var i;const n=e.getBoundingClientRect();this._anchorBox=n,this._preferAlignAtTop=t,this._placeAtAnchor(this._anchorBox,(i=this._userSize)!==null&&i!==void 0?i:this.widget.size,t)}_placeAtAnchor(e,t,i){var n;const s=ec(this.getDomNode().ownerDocument.body),r=this.widget.getLayoutInfo(),a=new wt(220,2*r.lineHeight),l=e.top,c=function(){const x=s.width-(e.left+e.width+r.borderWidth+r.horizontalPadding),D=-r.borderWidth+e.left+e.width,E=new wt(x,s.height-e.top-r.borderHeight-r.verticalPadding),A=E.with(void 0,e.top+e.height-r.borderHeight-r.verticalPadding);return{top:l,left:D,fit:x-t.width,maxSizeTop:E,maxSizeBottom:A,minSize:a.with(Math.min(x,a.width))}}(),u=function(){const x=e.left-r.borderWidth-r.horizontalPadding,D=Math.max(r.horizontalPadding,e.left-t.width-r.borderWidth),E=new wt(x,s.height-e.top-r.borderHeight-r.verticalPadding),A=E.with(void 0,e.top+e.height-r.borderHeight-r.verticalPadding);return{top:l,left:D,fit:x-t.width,maxSizeTop:E,maxSizeBottom:A,minSize:a.with(Math.min(x,a.width))}}(),h=function(){const x=e.left,D=-r.borderWidth+e.top+e.height,E=new wt(e.width-r.borderHeight,s.height-e.top-e.height-r.verticalPadding);return{top:D,left:x,fit:E.height-t.height,maxSizeBottom:E,maxSizeTop:E,minSize:a.with(E.width)}}(),g=[c,u,h],f=(n=g.find(x=>x.fit>=0))!==null&&n!==void 0?n:g.sort((x,D)=>D.fit-x.fit)[0],p=e.top+e.height-r.borderHeight;let _,b=t.height;const v=Math.max(f.maxSizeTop.height,f.maxSizeBottom.height);b>v&&(b=v);let C;i?b<=f.maxSizeTop.height?(_=!0,C=f.maxSizeTop):(_=!1,C=f.maxSizeBottom):b<=f.maxSizeBottom.height?(_=!1,C=f.maxSizeBottom):(_=!0,C=f.maxSizeTop);let{top:w,left:S}=f;!_&&b>e.height&&(w=p-b);const y=this._editor.getDomNode();if(y){const x=y.getBoundingClientRect();w-=x.top,S-=x.left}this._applyTopLeft({left:S,top:w}),this._resizable.enableSashes(!_,f===c,_,f!==c),this._resizable.minSize=f.minSize,this._resizable.maxSize=C,this._resizable.layout(b,Math.min(C.width,t.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(e){this._topLeft=e,this._editor.layoutOverlayWidget(this)}}var Ll;(function(o){o[o.FILE=0]="FILE",o[o.FOLDER=1]="FOLDER",o[o.ROOT_FOLDER=2]="ROOT_FOLDER"})(Ll||(Ll={}));const O0e=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function Ow(o,e,t,i,n){if(Ae.isThemeIcon(n))return[`codicon-${n.id}`,"predefined-file-icon"];if(Te.isUri(n))return[];const s=i===Ll.ROOT_FOLDER?["rootfolder-icon"]:i===Ll.FOLDER?["folder-icon"]:["file-icon"];if(t){let r;if(t.scheme===Fe.data)r=Du.parseMetaData(t).get(Du.META_DATA_LABEL);else{const a=t.path.match(O0e);a?(r=Fw(a[2].toLowerCase()),a[1]&&s.push(`${Fw(a[1].toLowerCase())}-name-dir-icon`)):r=Fw(t.authority.toLowerCase())}if(i===Ll.ROOT_FOLDER)s.push(`${r}-root-name-folder-icon`);else if(i===Ll.FOLDER)s.push(`${r}-name-folder-icon`);else{if(r){if(s.push(`${r}-name-file-icon`),s.push("name-file-icon"),r.length<=255){const l=r.split(".");for(let c=1;c=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},aT=function(o,e){return function(t,i){e(t,i,o)}},Sc;function SU(o){return`suggest-aria-id:${o}`}d(SU,"getAriaId");const V0e=bi("suggest-more-info",re.chevronRight,m("suggestMoreInfoIcon","Icon for more information in the suggest widget.")),W0e=new(Sc=class{static{d(this,"ColorExtractor")}extract(e,t){if(e.textLabel.match(Sc._regexStrict))return t[0]=e.textLabel,!0;if(e.completion.detail&&e.completion.detail.match(Sc._regexStrict))return t[0]=e.completion.detail,!0;if(e.completion.documentation){const i=typeof e.completion.documentation=="string"?e.completion.documentation:e.completion.documentation.value,n=Sc._regexRelaxed.exec(i);if(n&&(n.index===0||n.index+n[0].length===i.length))return t[0]=n[0],!0}return!1}},Sc._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*\))/,Sc._regexStrict=new RegExp(`^${Sc._regexRelaxed.source}$`,"i"),Sc);let eN=class{static{d(this,"ItemRenderer")}constructor(e,t,i,n){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=n,this._onDidToggleDetails=new F,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=new Y,i=e;i.classList.add("show-file-icons");const n=Q(e,ie(".icon")),s=Q(n,ie("span.colorspan")),r=Q(e,ie(".contents")),a=Q(r,ie(".main")),l=Q(a,ie(".icon-label.codicon")),c=Q(a,ie("span.left")),u=Q(a,ie("span.right")),h=new ey(c,{supportHighlights:!0,supportIcons:!0});t.add(h);const g=Q(c,ie("span.signature-label")),f=Q(c,ie("span.qualifier-label")),p=Q(u,ie("span.details-label")),_=Q(u,ie("span.readMore"+Ae.asCSSSelector(V0e)));return _.title=m("readMore","Read More"),{root:i,left:c,right:u,icon:n,colorspan:s,iconLabel:h,iconContainer:l,parametersLabel:g,qualifierLabel:f,detailsLabel:p,readMore:_,disposables:t,configureFont:d(()=>{const v=this._editor.getOptions(),C=v.get(50),w=C.getMassagedFontFamily(),S=C.fontFeatureSettings,y=v.get(119)||C.fontSize,x=v.get(120)||C.lineHeight,D=C.fontWeight,E=C.letterSpacing,A=`${y}px`,z=`${x}px`,O=`${E}px`;i.style.fontSize=A,i.style.fontWeight=D,i.style.letterSpacing=O,a.style.fontFamily=w,a.style.fontFeatureSettings=S,a.style.lineHeight=z,n.style.height=z,n.style.width=z,_.style.height=z,_.style.width=z},"configureFont")}}renderElement(e,t,i){i.configureFont();const{completion:n}=e;i.root.id=SU(t),i.colorspan.style.backgroundColor="";const s={labelEscapeNewLines:!0,matches:$0(e.score)},r=[];if(n.kind===19&&W0e.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=Ow(this._modelService,this._languageService,Te.from({scheme:"fake",path:e.textLabel}),Ll.FILE),l=Ow(this._modelService,this._languageService,Te.from({scheme:"fake",path:n.detail}),Ll.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=[Ow(this._modelService,this._languageService,Te.from({scheme:"fake",path:e.textLabel}),Ll.FOLDER),Ow(this._modelService,this._languageService,Te.from({scheme:"fake",path:n.detail}),Ll.FOLDER)].flat()):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...Ae.asClassNameArray(Gb.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=lT(n.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=lT(n.label.detail||""),i.detailsLabel.textContent=lT(n.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(118).showInlineDetails?to(i.detailsLabel):fs(i.detailsLabel),tO(e)?(i.right.classList.add("can-expand-details"),to(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"),fs(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};eN=H0e([aT(1,li),aT(2,oi),aT(3,en)],eN);function lT(o){return o.replace(/\r\n|\r|\n/g,"")}d(lT,"stripNewLines");var B0e=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},Hw=function(o,e){return function(t,i){e(t,i,o)}},Ff;M("editorSuggestWidget.background",{dark:Ai,light:Ai,hcDark:Ai,hcLight:Ai},m("editorSuggestWidgetBackground","Background color of the suggest widget."));M("editorSuggestWidget.border",{dark:Td,light:Td,hcDark:Td,hcLight:Td},m("editorSuggestWidgetBorder","Border color of the suggest widget."));const Vw=M("editorSuggestWidget.foreground",{dark:sr,light:sr,hcDark:sr,hcLight:sr},m("editorSuggestWidgetForeground","Foreground color of the suggest widget."));M("editorSuggestWidget.selectedForeground",{dark:jc,light:jc,hcDark:jc,hcLight:jc},m("editorSuggestWidgetSelectedForeground","Foreground color of the selected entry in the suggest widget."));M("editorSuggestWidget.selectedIconForeground",{dark:Xf,light:Xf,hcDark:Xf,hcLight:Xf},m("editorSuggestWidgetSelectedIconForeground","Icon foreground color of the selected entry in the suggest widget."));const z0e=M("editorSuggestWidget.selectedBackground",{dark:qc,light:qc,hcDark:qc,hcLight:qc},m("editorSuggestWidgetSelectedBackground","Background color of the selected entry in the suggest widget."));M("editorSuggestWidget.highlightForeground",{dark:Fr,light:Fr,hcDark:Fr,hcLight:Fr},m("editorSuggestWidgetHighlightForeground","Color of the match highlights in the suggest widget."));M("editorSuggestWidget.focusHighlightForeground",{dark:OC,light:OC,hcDark:OC,hcLight:OC},m("editorSuggestWidgetFocusHighlightForeground","Color of the match highlights in the suggest widget when an item is focused."));M("editorSuggestWidgetStatus.foreground",{dark:ye(Vw,.5),light:ye(Vw,.5),hcDark:ye(Vw,.5),hcLight:ye(Vw,.5)},m("editorSuggestWidgetStatusForeground","Foreground color of the suggest widget status."));class U0e{static{d(this,"PersistedWidgetSize")}constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof Ou}`}restore(){var e;const t=(e=this._service.get(this._key,0))!==null&&e!==void 0?e:"";try{const i=JSON.parse(t);if(wt.is(i))return wt.lift(i)}catch{}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}}let d0=Ff=class{static{d(this,"SuggestWidget")}constructor(e,t,i,n,s){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._pendingLayout=new dn,this._pendingShowDetails=new dn,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new $r,this._disposables=new Y,this._onDidSelect=new cg,this._onDidFocus=new cg,this._onDidHide=new F,this._onDidShow=new F,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new F,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new H2,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new G0e(this,e),this._persistedSize=new U0e(t,e);class r{static{d(this,"ResizeState")}constructor(f,p,_=!1,b=!1){this.persistedSize=f,this.currentSize=p,this.persistHeight=_,this.persistWidth=b}}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(g=>{var f,p,_,b;if(this._resize(g.dimension.width,g.dimension.height),a&&(a.persistHeight=a.persistHeight||!!g.north||!!g.south,a.persistWidth=a.persistWidth||!!g.east||!!g.west),!!g.done){if(a){const{itemHeight:v,defaultSize:C}=this.getLayoutInfo(),w=Math.round(v/2);let{width:S,height:y}=this.element.size;(!a.persistHeight||Math.abs(a.currentSize.height-y)<=w)&&(y=(p=(f=a.persistedSize)===null||f===void 0?void 0:f.height)!==null&&p!==void 0?p:C.height),(!a.persistWidth||Math.abs(a.currentSize.width-S)<=w)&&(S=(b=(_=a.persistedSize)===null||_===void 0?void 0:_.width)!==null&&b!==void 0?b:C.width),this._persistedSize.store(new wt(S,y))}this._contentWidget.unlockPreference(),a=void 0}})),this._messageElement=Q(this.element.domNode,ie(".message")),this._listElement=Q(this.element.domNode,ie(".tree"));const l=this._disposables.add(s.createInstance(JA,this.editor));l.onDidClose(this.toggleDetails,this,this._disposables),this._details=new P0e(l,this.editor);const c=d(()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(118).showIcons),"applyIconStyle");c();const u=s.createInstance(eN,this.editor);this._disposables.add(u),this._disposables.add(u.onDidToggleDetails(()=>this.toggleDetails())),this._list=new Ko("SuggestWidget",this._listElement,{getHeight:d(g=>this.getLayoutInfo().itemHeight,"getHeight"),getTemplateId:d(g=>"suggestion","getTemplateId")},[u],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:d(()=>"option","getRole"),getWidgetAriaLabel:d(()=>m("suggest","Suggest"),"getWidgetAriaLabel"),getWidgetRole:d(()=>"listbox","getWidgetRole"),getAriaLabel:d(g=>{let f=g.textLabel;if(typeof g.completion.label!="string"){const{detail:v,description:C}=g.completion.label;v&&C?f=m("label.full","{0} {1}, {2}",f,v,C):v?f=m("label.detail","{0} {1}",f,v):C&&(f=m("label.desc","{0}, {1}",f,C))}if(!g.isResolved||!this._isDetailsVisible())return f;const{documentation:p,detail:_}=g.completion,b=ug("{0}{1}",_||"",p?typeof p=="string"?p:p.value:"");return m("ariaCurrenttSuggestionReadDetails","{0}, docs: {1}",f,b)},"getAriaLabel")}}),this._list.style(Qg({listInactiveFocusBackground:z0e,listInactiveFocusOutline:ii})),this._status=s.createInstance(QA,this.element.domNode,pu);const h=d(()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(118).showStatusBar),"applyStatusBarStyle");h(),this._disposables.add(n.onDidColorThemeChange(g=>this._onThemeChange(g))),this._onThemeChange(n.getColorTheme()),this._disposables.add(this._list.onMouseDown(g=>this._onListMouseDownOrTap(g))),this._disposables.add(this._list.onTap(g=>this._onListMouseDownOrTap(g))),this._disposables.add(this._list.onDidChangeSelection(g=>this._onListSelection(g))),this._disposables.add(this._list.onDidChangeFocus(g=>this._onListFocus(g))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(g=>{g.hasChanged(118)&&(h(),c()),this._completionModel&&(g.hasChanged(50)||g.hasChanged(119)||g.hasChanged(120))&&this._list.splice(0,this._list.length,this._completionModel.items)})),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(yi(this._details.widget.domNode,"keydown",g=>{this._onDetailsKeydown.fire(g)})),this._disposables.add(this.editor.onMouseDown(g=>this._onEditorMouseDown(g)))}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=ya(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=ln(async s=>{const r=yu(()=>{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:SU(n)}))}).catch(Ue)),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:fs(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=Ff.LOADING_MESSAGE,fs(this._listElement,this._status.element),to(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Pl(Ff.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=Ff.NO_SUGGESTIONS_MESSAGE,fs(this._listElement,this._status.element),to(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Pl(Ff.NO_SUGGESTIONS_MESSAGE);break;case 3:fs(this._messageElement),to(this._listElement,this._status.element),this._show();break;case 4:fs(this._messageElement),to(this._listElement,this._status.element),this._show();break;case 5:fs(this._messageElement),to(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=yu(()=>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,c=l===0;if(this._ctxSuggestWidgetMultipleSuggestions.set(l>1),c){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=X1(De(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")):(tO(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=X1(De(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._details.widget.isEmpty?this._details.hide():(this._positionDetails(),this.element.domNode.classList.add("shows-details")),this.editor.focus()})}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.heightc&&(l=c);const u=this._completionModel?this._completionModel.stats.pLabelLen*r.typicalHalfwidthCharacterWidth:l,h=r.statusBarHeight+this._list.contentHeight+r.borderHeight,g=r.itemHeight+r.statusBarHeight,f=Fi(this.editor.getDomNode()),p=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),_=f.top+p.top+p.height,b=Math.min(s.height-_-r.verticalPadding,h),v=f.top+p.top-r.verticalPadding,C=Math.min(v,h);let w=Math.min(Math.max(C,b)+r.borderHeight,h);a===((t=this._cappedHeight)===null||t===void 0?void 0:t.capped)&&(a=this._cappedHeight.wanted),aw&&(a=w),a>b||this._forceRenderingAbove&&v>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),w=C):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),w=b),this.element.preferredSize=new wt(u,r.defaultSize.height),this.element.maxSize=new wt(c,w),this.element.minSize=new wt(220,g),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=hs(this.editor.getOption(120)||e.lineHeight,8,1e3),i=!this.editor.getOption(118).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 wt(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}};d0.LOADING_MESSAGE=m("suggestWidget.loading","Loading...");d0.NO_SUGGESTIONS_MESSAGE=m("suggestWidget.noSuggestions","No suggestions.");d0=Ff=B0e([Hw(1,jr),Hw(2,Ne),Hw(3,en),Hw(4,xe)],d0);class G0e{static{d(this,"SuggestContentWidget")}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 wt(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 K0e=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},xf=function(o,e){return function(t,i){e(t,i,o)}},tN;class $0e{static{d(this,"LineSuffix")}constructor(e,t){if(this._model=e,this._position=t,this._decorationOptions=$e.register({description:"suggest-line-suffix",stickiness:1}),e.getLineMaxColumn(t.lineNumber)!==t.column){const n=e.getOffsetAt(t),s=e.getPositionAt(n+1);e.changeDecorations(r=>{this._marker&&r.removeDecoration(this._marker),this._marker=r.addDecoration(k.fromPositions(t,s),this._decorationOptions)})}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.changeDecorations(e=>{e.removeDecoration(this._marker),this._marker=void 0})}delta(e){if(this._model.isDisposed()||this._position.lineNumber!==e.lineNumber)return 0;if(this._marker){const t=this._model.getDecorationRange(this._marker);return this._model.getOffsetAt(t.getStartPosition())-this._model.getOffsetAt(e)}else return this._model.getLineMaxColumn(e.lineNumber)-e.column}}let Hr=tN=class{static{d(this,"SuggestController")}static get(e){return e.getContribution(tN.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 dn,this._toDispose=new Y,this._selectors=new j0e(h=>h.priority),this._onWillInsertSuggestItem=new F,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=e,this.model=s.createInstance(Py,this.editor),this._selectors.register({priority:0,select:d((h,g,f)=>this._memoryService.select(h,g,f),"select")});const l=Qe.InsertMode.bindTo(n);l.set(e.getOption(118).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>l.set(e.getOption(118).insertMode))),this.widget=this._toDispose.add(new Lk(De(e.getDomNode()),()=>{const h=this._instantiationService.createInstance(d0,this.editor);this._toDispose.add(h),this._toDispose.add(h.onDidSelect(b=>this._insertSuggestion(b,0),this));const g=new D0e(this.editor,h,this.model,b=>this._insertSuggestion(b,2));this._toDispose.add(g);const f=Qe.MakesTextEdit.bindTo(this._contextKeyService),p=Qe.HasInsertAndReplaceRange.bindTo(this._contextKeyService),_=Qe.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(we(()=>{f.reset(),p.reset(),_.reset()})),this._toDispose.add(h.onDidFocus(({item:b})=>{const v=this.editor.getPosition(),C=b.editStart.column,w=v.column;let S=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!b.completion.additionalTextEdits&&!(b.completion.insertTextRules&4)&&w-C===b.completion.insertText.length&&(S=this.editor.getModel().getValueInRange({startLineNumber:v.lineNumber,startColumn:C,endLineNumber:v.lineNumber,endColumn:w})!==b.completion.insertText),f.set(S),p.set(!H.equals(b.editInsertEnd,b.editReplaceEnd)),_.set(!!b.provider.resolveCompletionItem||!!b.completion.documentation||b.completion.detail!==b.completion.label)})),this._toDispose.add(h.onDetailsKeyDown(b=>{if(b.toKeyCodeChord().equals(new Qd(!0,!1,!1,!1,33))||nt&&b.toKeyCodeChord().equals(new Qd(!1,!1,!1,!0,33))){b.stopPropagation();return}b.toKeyCodeChord().isModifierKey()||this.editor.focus()})),h})),this._overtypingCapturer=this._toDispose.add(new Lk(De(e.getDomNode()),()=>this._toDispose.add(new Fx(this.editor,this.model)))),this._alternatives=this._toDispose.add(new Lk(De(e.getDomNode()),()=>this._toDispose.add(new Og(this.editor,this._contextKeyService)))),this._toDispose.add(s.createInstance(l0,e)),this._toDispose.add(this.model.onDidTrigger(h=>{this.widget.value.showTriggered(h.auto,h.shy?250:50),this._lineSuffix.value=new $0e(this.editor.getModel(),h.position)})),this._toDispose.add(this.model.onDidSuggest(h=>{if(h.triggerOptions.shy)return;let g=-1;for(const p of this._selectors.itemsOrderedByPriorityDesc)if(g=p.select(this.editor.getModel(),this.editor.getPosition(),h.completionModel.items),g!==-1)break;if(g===-1&&(g=0),this.model.state===0)return;let f=!1;if(h.triggerOptions.auto){const p=this.editor.getOption(118);p.selectionMode==="never"||p.selectionMode==="always"?f=p.selectionMode==="never":p.selectionMode==="whenTriggerCharacter"?f=h.triggerOptions.triggerKind!==1:p.selectionMode==="whenQuickSuggestion"&&(f=h.triggerOptions.triggerKind===1&&!h.triggerOptions.refilter)}this.widget.value.showSuggestions(h.completionModel,g,h.isFrozen,h.triggerOptions.auto,f)})),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 c=Qe.AcceptSuggestionsOnEnter.bindTo(n),u=d(()=>{const h=this.editor.getOption(1);c.set(h==="on"||h==="smart")},"updateFromConfig");this._toDispose.add(this.editor.onDidChangeConfiguration(()=>u())),u()}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=In.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 ui;t&1||this.editor.pushUndoStop();const c=this.getOverwriteInfo(r,!!(t&8));this._memoryService.memorize(n,this.editor.getPosition(),r);const u=r.isResolved;let h=-1,g=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const p=Oa.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(_=>{let b=k.lift(_.range);if(b.startLineNumber===r.position.lineNumber&&b.startColumn>r.position.column){const v=this.editor.getPosition().column-r.position.column,C=v,w=k.spansMultipleLines(b)?0:v;b=new k(b.startLineNumber,b.startColumn+C,b.endLineNumber,b.endColumn+w)}return ai.replaceMove(b,_.text)})),p.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!u){const p=new En;let _;const b=n.onDidChangeContent(S=>{if(S.isFlush){l.cancel(),b.dispose();return}for(const y of S.changes){const x=k.getEndPosition(y.range);(!_||H.isBefore(x,_))&&(_=x)}}),v=t;t|=2;let C=!1;const w=this.editor.onWillType(()=>{w.dispose(),C=!0,v&2||this.editor.pushUndoStop()});a.push(r.resolve(l.token).then(()=>{if(!r.completion.additionalTextEdits||l.token.isCancellationRequested)return;if(_&&r.completion.additionalTextEdits.some(y=>H.isBefore(_,k.getStartPosition(y.range))))return!1;C&&this.editor.pushUndoStop();const S=Oa.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(y=>ai.replaceMove(k.lift(y.range),y.text))),S.restoreRelativeVerticalPositionOfCursor(this.editor),(C||!(v&2))&&this.editor.pushUndoStop(),!0}).then(S=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",p.elapsed(),S),g=S===!0?1:S===!1?0:-2}).finally(()=>{b.dispose(),w.dispose()}))}let{insertText:f}=r.completion;if(r.completion.insertTextRules&4||(f=Tg.escape(f)),this.model.cancel(),i.insert(f,{overwriteBefore:c.overwriteBefore,overwriteAfter:c.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===mC.id)this.model.trigger({auto:!0,retrigger:!0});else{const p=new En;a.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(_=>{r.completion.extensionId?Li(_):Ue(_)}).finally(()=>{h=p.elapsed()}))}t&4&&this._alternatives.value.set(e,p=>{for(l.cancel();n.canUndo();){s!==n.getAlternativeVersionId()&&n.undo(),this._insertSuggestion(p,3|(t&8?8:0));break}}),this._alertCompletionItem(r),Promise.all(a).finally(()=>{this._reportSuggestionAcceptedTelemetry(r,n,u,h,g),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:qy(ur(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:Mie(t.uri),resolveInfo:e.provider.resolveCompletionItem?i?1:0:-1,resolveDuration:e.resolveDuration,commandDuration:n,additionalEditsAsync:s})}getOverwriteInfo(e,t){_t(this.editor.hasModel());let i=this.editor.getOption(118).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($n(e.completion.additionalTextEdits)){const t=m("aria.alert.snippet","Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length);$s(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=d(()=>{t.equals(this.editor.getPosition())&&this._commandService.executeCommand(e.fallback)},"fallback"),n=d(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},"makesTextEdit");le.once(this.model.onDidTrigger)(s=>{const r=[];le.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{Ot(r),i()},void 0,r),this.model.onDidSuggest(({completionModel:a})=>{if(Ot(r),a.items.length===0){i();return}const l=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),a.items),c=a.items[l];if(!n(c)){i();return}this.editor.pushUndoStop(),this._insertSuggestion({index:l,item:c,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)}};Hr.ID="editor.contrib.suggestController";Hr=tN=K0e([xf(1,Ox),xf(2,Qt),xf(3,Ne),xf(4,xe),xf(5,qn),xf(6,Vn)],Hr);class j0e{static{d(this,"PriorityRegistry")}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:d(()=>{const t=this._items.indexOf(e);t>=0&&this._items.splice(t,1)},"dispose")}}get itemsOrderedByPriorityDesc(){return this._items}}class mC extends ue{static{d(this,"TriggerSuggestAction")}constructor(){super({id:mC.id,label:m("suggest.trigger.label","Trigger Suggest"),alias:"Trigger Suggest",precondition:j.and(I.writable,I.hasCompletionItemProvider,Qe.Visible.toNegated()),kbOpts:{kbExpr:I.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const n=Hr.get(t);if(!n)return;let s;i&&typeof i=="object"&&i.auto===!0&&(s=!0),n.triggerSuggest(void 0,s,void 0)}}mC.id="editor.action.triggerSuggest";vt(Hr.ID,Hr,2);ee(mC);const Bo=190,Rs=Ji.bindToContribution(Hr.get);de(new Rs({id:"acceptSelectedSuggestion",precondition:j.and(Qe.Visible,Qe.HasFocusedSuggestion),handler(o){o.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:j.and(Qe.Visible,I.textInputFocus),weight:Bo},{primary:3,kbExpr:j.and(Qe.Visible,I.textInputFocus,Qe.AcceptSuggestionsOnEnter,Qe.MakesTextEdit),weight:Bo}],menuOpts:[{menuId:pu,title:m("accept.insert","Insert"),group:"left",order:1,when:Qe.HasInsertAndReplaceRange.toNegated()},{menuId:pu,title:m("accept.insert","Insert"),group:"left",order:1,when:j.and(Qe.HasInsertAndReplaceRange,Qe.InsertMode.isEqualTo("insert"))},{menuId:pu,title:m("accept.replace","Replace"),group:"left",order:1,when:j.and(Qe.HasInsertAndReplaceRange,Qe.InsertMode.isEqualTo("replace"))}]}));de(new Rs({id:"acceptAlternativeSelectedSuggestion",precondition:j.and(Qe.Visible,I.textInputFocus,Qe.HasFocusedSuggestion),kbOpts:{weight:Bo,kbExpr:I.textInputFocus,primary:1027,secondary:[1026]},handler(o){o.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:pu,group:"left",order:2,when:j.and(Qe.HasInsertAndReplaceRange,Qe.InsertMode.isEqualTo("insert")),title:m("accept.replace","Replace")},{menuId:pu,group:"left",order:2,when:j.and(Qe.HasInsertAndReplaceRange,Qe.InsertMode.isEqualTo("replace")),title:m("accept.insert","Insert")}]}));ut.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");de(new Rs({id:"hideSuggestWidget",precondition:Qe.Visible,handler:d(o=>o.cancelSuggestWidget(),"handler"),kbOpts:{weight:Bo,kbExpr:I.textInputFocus,primary:9,secondary:[1033]}}));de(new Rs({id:"selectNextSuggestion",precondition:j.and(Qe.Visible,j.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:d(o=>o.selectNextSuggestion(),"handler"),kbOpts:{weight:Bo,kbExpr:I.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}}));de(new Rs({id:"selectNextPageSuggestion",precondition:j.and(Qe.Visible,j.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:d(o=>o.selectNextPageSuggestion(),"handler"),kbOpts:{weight:Bo,kbExpr:I.textInputFocus,primary:12,secondary:[2060]}}));de(new Rs({id:"selectLastSuggestion",precondition:j.and(Qe.Visible,j.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:d(o=>o.selectLastSuggestion(),"handler")}));de(new Rs({id:"selectPrevSuggestion",precondition:j.and(Qe.Visible,j.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:d(o=>o.selectPrevSuggestion(),"handler"),kbOpts:{weight:Bo,kbExpr:I.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));de(new Rs({id:"selectPrevPageSuggestion",precondition:j.and(Qe.Visible,j.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:d(o=>o.selectPrevPageSuggestion(),"handler"),kbOpts:{weight:Bo,kbExpr:I.textInputFocus,primary:11,secondary:[2059]}}));de(new Rs({id:"selectFirstSuggestion",precondition:j.and(Qe.Visible,j.or(Qe.MultipleSuggestions,Qe.HasFocusedSuggestion.negate())),handler:d(o=>o.selectFirstSuggestion(),"handler")}));de(new Rs({id:"focusSuggestion",precondition:j.and(Qe.Visible,Qe.HasFocusedSuggestion.negate()),handler:d(o=>o.focusSuggestion(),"handler"),kbOpts:{weight:Bo,kbExpr:I.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));de(new Rs({id:"focusAndAcceptSuggestion",precondition:j.and(Qe.Visible,Qe.HasFocusedSuggestion.negate()),handler:d(o=>{o.focusSuggestion(),o.acceptSelectedSuggestion(!0,!1)},"handler")}));de(new Rs({id:"toggleSuggestionDetails",precondition:j.and(Qe.Visible,Qe.HasFocusedSuggestion),handler:d(o=>o.toggleSuggestionDetails(),"handler"),kbOpts:{weight:Bo,kbExpr:I.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:pu,group:"right",order:1,when:j.and(Qe.DetailsVisible,Qe.CanResolve),title:m("detail.more","show less")},{menuId:pu,group:"right",order:1,when:j.and(Qe.DetailsVisible.toNegated(),Qe.CanResolve),title:m("detail.less","show more")}]}));de(new Rs({id:"toggleExplainMode",precondition:Qe.Visible,handler:d(o=>o.toggleExplainMode(),"handler"),kbOpts:{weight:100,primary:2138}}));de(new Rs({id:"toggleSuggestionFocus",precondition:Qe.Visible,handler:d(o=>o.toggleSuggestionFocus(),"handler"),kbOpts:{weight:Bo,kbExpr:I.textInputFocus,primary:2570,mac:{primary:778}}}));de(new Rs({id:"insertBestCompletion",precondition:j.and(I.textInputFocus,j.equals("config.editor.tabCompletion","on"),l0.AtEnd,Qe.Visible.toNegated(),Og.OtherSuggestions.toNegated(),In.InSnippetMode.toNegated()),handler:d((o,e)=>{o.triggerSuggestAndAcceptBest(bs(e)?{fallback:"tab",...e}:{fallback:"tab"})},"handler"),kbOpts:{weight:Bo,primary:2}}));de(new Rs({id:"insertNextSuggestion",precondition:j.and(I.textInputFocus,j.equals("config.editor.tabCompletion","on"),Og.OtherSuggestions,Qe.Visible.toNegated(),In.InSnippetMode.toNegated()),handler:d(o=>o.acceptNextSuggestion(),"handler"),kbOpts:{weight:Bo,kbExpr:I.textInputFocus,primary:2}}));de(new Rs({id:"insertPrevSuggestion",precondition:j.and(I.textInputFocus,j.equals("config.editor.tabCompletion","on"),Og.OtherSuggestions,Qe.Visible.toNegated(),In.InSnippetMode.toNegated()),handler:d(o=>o.acceptPrevSuggestion(),"handler"),kbOpts:{weight:Bo,kbExpr:I.textInputFocus,primary:1026}}));ee(class extends ue{constructor(){super({id:"editor.action.resetSuggestSize",label:m("suggest.reset.label","Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(o,e){var t;(t=Hr.get(e))===null||t===void 0||t.resetWidgetSize()}});class q0e extends W{static{d(this,"SuggestWidgetAdaptor")}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=gt(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=Hr.get(this.editor);if(s){this._register(s.registerSelector({priority:100,select:d((l,c,u)=>{Wt(v=>this.checkModelVersion(v));const h=this.editor.getModel();if(!h)return-1;const g=this.suggestControllerPreselector(),f=g?lg(g,h):void 0;if(!f)return-1;const p=H.lift(c),_=u.map((v,C)=>{const w=Rb.fromSuggestion(s,h,p,v,this.isShiftKeyPressed),S=lg(w.toSingleTextEdit(),h),y=vU(f,S);return{index:C,valid:y,prefixLength:S.text.length,suggestItem:v}}).filter(v=>v&&v.valid&&v.prefixLength>0),b=AR(_,Us(v=>v.prefixLength,Vr));return b?b.index:-1},"select")}));let r=!1;const a=d(()=>{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)})))},"bindToSuggestWidget");this._register(le.once(s.model.onDidTrigger)(l=>{a()})),this._register(s.onWillInsertSuggestItem(l=>{const c=this.editor.getPosition(),u=this.editor.getModel();if(!c||!u)return;const h=Rb.fromSuggestion(s,u,c,l.item,this.isShiftKeyPressed);this.onWillAccept(h)}))}this.update(this._isActive)}update(e){const t=this.getSuggestItemInfo();(this._isActive!==e||!Y0e(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,Wt(i=>{this.checkModelVersion(i),this._selectedItem.set(this._isActive?this._currentSuggestItemInfo:void 0,i)}))}getSuggestItemInfo(){const e=Hr.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 Rb.fromSuggestion(e,n,i,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){const e=Hr.get(this.editor);e?.stopForceRenderingAbove()}forceRenderingAbove(){const e=Hr.get(this.editor);e?.forceRenderingAbove()}}class Rb{static{d(this,"SuggestItemInfo")}static fromSuggestion(e,t,i,n,s){let{insertText:r}=n.completion,a=!1;if(n.completion.insertTextRules&4){const c=new Tg().parse(r);c.children.length<100&&Ry.adjustWhitespace(t,i,!0,c),r=c.toString(),a=!0}const l=e.getOverwriteInfo(n,s);return new Rb(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 SW(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new ic(this.range,this.insertText)}}function Y0e(o,e){return o===e?!0:!o||!e?!1:o.equals(e)}d(Y0e,"suggestItemInfoEquals");var X0e=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)}},iN;let zo=iN=class extends W{static{d(this,"InlineCompletionsController")}static get(e){return e.getContribution(iN.ID)}constructor(e,t,i,n,s,r,a,l,c,u){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._configurationService=n,this._commandService=s,this._debounceService=r,this._languageFeaturesService=a,this._accessibilitySignalService=l,this._keybindingService=c,this._accessibilityService=u,this.model=this._register(Iv("inlineCompletionModel",void 0)),this._textModelVersionId=gt(this,-1),this._positions=Pae({owner:this,equalsFn:QI(W9())},[new H(1,1)]),this._suggestWidgetAdaptor=this._register(new q0e(this.editor,()=>{var _,b;return(b=(_=this.model.get())===null||_===void 0?void 0:_.selectedInlineCompletion.get())===null||b===void 0?void 0:b.toSingleTextEdit(void 0)},_=>this.updateObservables(_,wo.Other),_=>{Wt(b=>{var v;this.updateObservables(b,wo.Other),(v=this.model.get())===null||v===void 0||v.handleSuggestAccepted(_)})})),this._enabledInConfig=Mt(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).enabled),this._isScreenReaderEnabled=Mt(this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=Mt(this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress")===!0),this._enabled=Be(this,_=>this._enabledInConfig.read(_)&&(!this._isScreenReaderEnabled.read(_)||!this._editorDictationInProgress.read(_))),this._fontFamily=Mt(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).fontFamily),this._ghostTexts=Be(this,_=>{var b;const v=this.model.read(_);return(b=v?.ghostTexts.read(_))!==null&&b!==void 0?b:[]}),this._stablizedGhostTexts=Z0e(this._ghostTexts,this._store),this._ghostTextWidgets=Uae(this,this._stablizedGhostTexts,(_,b)=>b.add(this._instantiationService.createInstance(jA,this.editor,{ghostText:_,minReservedLineCount:ma(0),targetTextModel:this.model.map(v=>v?.textModel)}))).recomputeInitiallyAndOnChange(this._store),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this._playAccessibilitySignal=GL(this),this._isReadonly=Mt(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(91)),this._textModel=Mt(this.editor.onDidChangeModel,()=>this.editor.getModel()),this._textModelIfWritable=Be(_=>this._isReadonly.read(_)?void 0:this._textModel.read(_)),this._register(new _n(this._contextKeyService,this.model)),this._register(Je(_=>{const b=this._textModelIfWritable.read(_);Wt(v=>{if(this.model.set(void 0,v),this.updateObservables(v,wo.Other),b){const C=t.createInstance(YA,b,this._suggestWidgetAdaptor.selectedItem,this._textModelVersionId,this._positions,this._debounceValue,Mt(e.onDidChangeConfiguration,()=>e.getOption(118).preview),Mt(e.onDidChangeConfiguration,()=>e.getOption(118).previewMode),Mt(e.onDidChangeConfiguration,()=>e.getOption(62).mode),this._enabled);this.model.set(C,v)}})}));const h=this._register(eB());this._register(Je(_=>{const b=this._fontFamily.read(_);h.setStyle(b===""||b==="default"?"":`
+.monaco-editor .ghost-text-decoration,
+.monaco-editor .ghost-text-decoration-preview,
+.monaco-editor .ghost-text {
+ font-family: ${b};
+}`)}));const g=d(_=>{var b;return _.isUndoing?wo.Undo:_.isRedoing?wo.Redo:!((b=this.model.get())===null||b===void 0)&&b.isAcceptingPartially?wo.AcceptWord:wo.Other},"getReason");this._register(e.onDidChangeModelContent(_=>Wt(b=>this.updateObservables(b,g(_))))),this._register(e.onDidChangeCursorPosition(_=>Wt(b=>{var v;this.updateObservables(b,wo.Other),(_.reason===3||_.source==="api")&&((v=this.model.get())===null||v===void 0||v.stop(b))}))),this._register(e.onDidType(()=>Wt(_=>{var b;this.updateObservables(_,wo.Other),this._enabled.get()&&((b=this.model.get())===null||b===void 0||b.trigger(_))}))),this._register(this._commandService.onDidExecuteCommand(_=>{new Set([wp.Tab.id,wp.DeleteLeft.id,wp.DeleteRight.id,Lz,"acceptSelectedSuggestion"]).has(_.commandId)&&e.hasTextFocus()&&this._enabled.get()&&Wt(v=>{var C;(C=this.model.get())===null||C===void 0||C.trigger(v)})})),this._register(this.editor.onDidBlurEditorWidget(()=>{this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(62).keepOnBlur||Pu.dropDownVisible||Wt(_=>{var b;(b=this.model.get())===null||b===void 0||b.stop(_)})})),this._register(Je(_=>{var b;const v=(b=this.model.read(_))===null||b===void 0?void 0:b.state.read(_);v?.suggestItem?v.primaryGhostText.lineCount>=2&&this._suggestWidgetAdaptor.forceRenderingAbove():this._suggestWidgetAdaptor.stopForceRenderingAbove()})),this._register(we(()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}));const f=this._register(new Y);let p;this._register(X0({handleChange:d((_,b)=>(_.didChange(this._playAccessibilitySignal)&&(p=void 0),!0),"handleChange")},async(_,b)=>{this._playAccessibilitySignal.read(_);const v=this.model.read(_),C=v?.state.read(_);if(!v||!C||!C.inlineCompletion){p=void 0;return}if(C.inlineCompletion.semanticId!==p){f.clear(),p=C.inlineCompletion.semanticId;const w=v.textModel.getLineContent(C.primaryGhostText.lineNumber);await Jd(50,NO(f)),await K9(this._suggestWidgetAdaptor.selectedItem,Bs,()=>!1,NO(f)),await this._accessibilitySignalService.playSignal(Ve.inlineSuggestion),this.editor.getOption(8)&&this.provideScreenReaderUpdate(C.primaryGhostText.renderForScreenReader(w))}})),this._register(new wA(this.editor,this.model,this._instantiationService)),this._register(this._configurationService.onDidChangeConfiguration(_=>{_.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})}playAccessibilitySignal(e){this._playAccessibilitySignal.trigger(e)}provideScreenReaderUpdate(e){const t=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),i=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let n;!t&&i&&this.editor.getOption(149)&&(n=m("showAccessibleViewHint","Inspect this in the accessible view ({0})",i.getAriaLabel())),$s(n?e+", "+n:e)}updateObservables(e,t){var i,n,s;const r=this.editor.getModel();this._textModelVersionId.set((i=r?.getVersionId())!==null&&i!==void 0?i:-1,e,t),this._positions.set((s=(n=this.editor.getSelections())===null||n===void 0?void 0:n.map(a=>a.getPosition()))!==null&&s!==void 0?s:[new H(1,1)],e)}shouldShowHoverAt(e){var t;const i=(t=this.model.get())===null||t===void 0?void 0:t.primaryGhostText.get();return i?i.parts.some(n=>e.containsPosition(new H(i.lineNumber,n.column))):!1}shouldShowHoverAtViewZone(e){var t,i;return(i=(t=this._ghostTextWidgets.get()[0])===null||t===void 0?void 0:t.ownsViewZone(e))!==null&&i!==void 0?i:!1}};zo.ID="editor.contrib.inlineCompletionsController";zo=iN=X0e([od(1,xe),od(2,Ne),od(3,et),od(4,Qt),od(5,pr),od(6,me),od(7,Qu),od(8,yt),od(9,ho)],zo);function Z0e(o,e){const t=gt("result",[]),i=[];return e.add(Je(n=>{const s=o.read(n);Wt(r=>{if(s.length!==i.length){i.length=s.length;for(let a=0;aa.set(s[l],r))})})),t}d(Z0e,"convertItemsToStableObservables");class Hx extends ue{static{d(this,"ShowNextInlineSuggestionAction")}constructor(){super({id:Hx.ID,label:m("action.inlineSuggest.showNext","Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:j.and(I.writable,_n.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){var i;const n=zo.get(t);(i=n?.model.get())===null||i===void 0||i.next()}}Hx.ID=kz;class Vx extends ue{static{d(this,"ShowPreviousInlineSuggestionAction")}constructor(){super({id:Vx.ID,label:m("action.inlineSuggest.showPrevious","Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:j.and(I.writable,_n.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){var i;const n=zo.get(t);(i=n?.model.get())===null||i===void 0||i.previous()}}Vx.ID=xz;class Q0e extends ue{static{d(this,"TriggerInlineSuggestionAction")}constructor(){super({id:"editor.action.inlineSuggest.trigger",label:m("action.inlineSuggest.trigger","Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:I.writable})}async run(e,t){const i=zo.get(t);await Rae(async n=>{var s;await((s=i?.model.get())===null||s===void 0?void 0:s.triggerExplicitly(n)),i?.playAccessibilitySignal(n)})}}class J0e extends ue{static{d(this,"AcceptNextWordOfInlineCompletion")}constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:m("action.inlineSuggest.acceptNextWord","Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:j.and(I.writable,_n.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:j.and(I.writable,_n.inlineSuggestionVisible)},menuOpts:[{menuId:T.InlineSuggestionToolbar,title:m("acceptWord","Accept Word"),group:"primary",order:2}]})}async run(e,t){var i;const n=zo.get(t);await((i=n?.model.get())===null||i===void 0?void 0:i.acceptNextWord(n.editor))}}class eCe extends ue{static{d(this,"AcceptNextLineOfInlineCompletion")}constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:m("action.inlineSuggest.acceptNextLine","Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:j.and(I.writable,_n.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:T.InlineSuggestionToolbar,title:m("acceptLine","Accept Line"),group:"secondary",order:2}]})}async run(e,t){var i;const n=zo.get(t);await((i=n?.model.get())===null||i===void 0?void 0:i.acceptNextLine(n.editor))}}class tCe extends ue{static{d(this,"AcceptInlineCompletion")}constructor(){super({id:Lz,label:m("action.inlineSuggest.accept","Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:_n.inlineSuggestionVisible,menuOpts:[{menuId:T.InlineSuggestionToolbar,title:m("accept","Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:j.and(_n.inlineSuggestionVisible,I.tabMovesFocus.toNegated(),_n.inlineSuggestionHasIndentationLessThanTabSize,Qe.Visible.toNegated(),I.hoverFocused.toNegated())}})}async run(e,t){var i;const n=zo.get(t);n&&((i=n.model.get())===null||i===void 0||i.accept(n.editor),n.editor.focus())}}class Wx extends ue{static{d(this,"HideInlineCompletion")}constructor(){super({id:Wx.ID,label:m("action.inlineSuggest.hide","Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:_n.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=zo.get(t);Wt(n=>{var s;(s=i?.model.get())===null||s===void 0||s.stop(n)})}}Wx.ID="editor.action.inlineSuggest.hide";class Bx extends Is{static{d(this,"ToggleAlwaysShowInlineSuggestionToolbar")}constructor(){super({id:Bx.ID,title:m("action.inlineSuggest.alwaysShowToolbar","Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:T.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:j.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(e,t){const i=e.get(et),s=i.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";i.updateValue("editor.inlineSuggest.showToolbar",s)}}Bx.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";var iCe=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},E_=function(o,e){return function(t,i){e(t,i,o)}};class nCe{static{d(this,"InlineCompletionsHover")}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 nN=class{static{d(this,"InlineCompletionsHoverParticipant")}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=zo.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 og(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 og(1e3,this,i.range,e.event.posx,e.event.posy,!1):i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range)?new og(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=zo.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new nCe(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new Y,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(Pu,this._editor,!1,ma(null),s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.activeCommands);return e.fragment.appendChild(r.getDomNode()),s.triggerExplicitly(),i.add(r),i}renderScreenReaderText(e,t,i){const n=ie,s=n("div.hover-row.markdown-hover"),r=Q(s,n("div.hover-contents",{"aria-live":"assertive"})),a=i.add(new Hl({editor:this._editor},this._languageService,this._openerService)),l=d(c=>{i.add(a.onDidRenderAsync(()=>{r.className="hover-contents code-hover-contents",e.onContentsChanged()}));const u=m("inlineSuggestionFollows","Suggestion:"),h=i.add(a.render(new Gn().appendText(u).appendCodeblock("text",c)));r.replaceChildren(h.element)},"render");i.add(Je(c=>{var u;const h=(u=t.controller.model.read(c))===null||u===void 0?void 0:u.primaryGhostText.read(c);if(h){const g=this._editor.getModel().getLineContent(h.lineNumber);l(h.renderForScreenReader(g))}else Dn(r)})),e.fragment.appendChild(s)}};nN=iCe([E_(1,oi),E_(2,po),E_(3,ho),E_(4,xe),E_(5,Vn)],nN);class sCe extends W{static{d(this,"InlineCompletionsAccessibleView")}constructor(){super()}}const zx=new class{static{d(this,"AccessibleViewRegistry")}constructor(){this._implementations=[]}register(e){return this._implementations.push(e),{dispose:d(()=>{const t=this._implementations.indexOf(e);t!==-1&&this._implementations.splice(t,1),e.dispose()},"dispose")}}getImplementations(){return this._implementations}};vt(zo.ID,zo,3);ee(Q0e);ee(Hx);ee(Vx);ee(J0e);ee(eCe);ee(tCe);ee(Wx);zt(Bx);Ju.register(nN);zx.register(new sCe);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},dT=function(o,e){return function(t,i){e(t,i,o)}},eb;let Fg=eb=class{static{d(this,"GotoDefinitionAtPositionEditorContribution")}constructor(e,t,i,n){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=n,this.toUnhook=new Y,this.toUnhookForKeyboard=new Y,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();const s=new Cx(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=>{Ue(a)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(s.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(e){return e.getContribution(eb.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 u6(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=ln(a=>this.findDefinition(e,a));let s;try{s=await this.previousPromise}catch(a){Ue(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 Gn().appendText(m("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:c}}=l,{startLineNumber:u}=a.range;if(u<1||u>c.getLineCount()){l.dispose();return}const h=this.getPreviewValue(c,u,a),g=this.languageService.guessLanguageIdByFilepathOrFirstLine(c.uri);this.addDecoration(r,h?new Gn().appendCodeblock(g||"",h):void 0),l.dispose()})}}getPreviewValue(e,t,i){let n=i.range;return n.endLineNumber-n.startLineNumber>=eb.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{const n=!t&&this.editor.getOption(88)&&!this.isInPeekEditor(i);return new fC({openToSide:t,openInPeek:n,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(i)})}isInPeekEditor(e){const t=e.get(Ne);return qs.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};Fg.ID="editor.contrib.gotodefinitionatposition";Fg.MAX_SOURCE_PREVIEW_LINES=8;Fg=eb=oCe([dT(1,Ys),dT(2,oi),dT(3,me)],Fg);vt(Fg.ID,Fg,2);var yU=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)}};class bV{static{d(this,"MarkerCoordinate")}constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let sN=class{static{d(this,"MarkerList")}constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new F,this.onDidChange=this._onDidChange.event,this._dispoables=new Y,this._markers=[],this._nextIdx=-1,Te.isUri(e)?this._resourceFilter=a=>a.toString()===e.toString():e&&(this._resourceFilter=e);const n=this._configService.getValue("problems.sortOrder"),s=d((a,l)=>{let c=qb(a.resource.toString(),l.resource.toString());return c===0&&(n==="position"?c=k.compareRangesUsingStarts(a,l)||_i.compare(a.severity,l.severity):c=_i.compare(a.severity,l.severity)||k.compareRangesUsingStarts(a,l)),c},"compareMarker"),r=d(()=>{this._markers=this._markerService.read({resource:Te.isUri(e)?e:void 0,severities:_i.Error|_i.Warning|_i.Info}),typeof e=="function"&&(this._markers=this._markers.filter(a=>this._resourceFilter(a.resource))),this._markers.sort(s)},"updateMarker");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 bV(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=Vb(this._markers,{resource:e.uri},(r,a)=>qb(r.resource.toString(),a.resource.toString())),s<0&&(s=~s));for(let r=s;rn.resource.toString()===e.toString());if(!(i<0)){for(;i=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},kf=function(o,e){return function(t,i){e(t,i,o)}},aN;class aCe{static{d(this,"MessageWidget")}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 Y,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(yi(this._relatedBlock,"click",a=>{a.preventDefault();const l=this._relatedDiagnostics.get(a.target);l&&i(l)})),this._scrollable=new d7(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(){Ot(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=Kl(i);this._lines=a.length,this._longestLineLength=0;for(const g of a)this._longestLineLength=Math.max(g.length+r,this._longestLineLength);kn(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(e)),this._editor.applyFontInfo(this._messageBlock);let l=this._messageBlock;for(const g of a)l=document.createElement("div"),l.innerText=g,g===""&&(l.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(l);if(t||s){const g=document.createElement("span");if(g.classList.add("details"),l.appendChild(g),t){const f=document.createElement("span");f.innerText=t,f.classList.add("source"),g.appendChild(f)}if(s)if(typeof s=="string"){const f=document.createElement("span");f.innerText=`(${s})`,f.classList.add("code"),g.appendChild(f)}else{this._codeLink=ie("a.code-link"),this._codeLink.setAttribute("href",`${s.target.toString()}`),this._codeLink.onclick=p=>{this._openerService.open(s.target,{allowCommands:!0}),p.preventDefault(),p.stopPropagation()};const f=Q(this._codeLink,ie("span"));f.innerText=s.value,g.appendChild(this._codeLink)}}if(kn(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),$n(n)){const g=this._relatedBlock.appendChild(document.createElement("div"));g.style.paddingTop=`${Math.floor(this._editor.getOption(67)*.66)}px`,this._lines+=1;for(const f of n){const p=document.createElement("div"),_=document.createElement("a");_.classList.add("filename"),_.innerText=`${this._labelService.getUriBasenameLabel(f.resource)}(${f.startLineNumber}, ${f.startColumn}): `,_.title=this._labelService.getUriLabel(f.resource),this._relatedDiagnostics.set(_,f);const b=document.createElement("span");b.innerText=f.message,p.appendChild(_),p.appendChild(b),this._lines+=1,g.appendChild(p)}}const c=this._editor.getOption(50),u=Math.ceil(c.typicalFullwidthCharacterWidth*this._longestLineLength*.75),h=c.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:u,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 _i.Error:t=m("Error","Error");break;case _i.Warning:t=m("Warning","Warning");break;case _i.Info:t=m("Info","Info");break;case _i.Hint:t=m("Hint","Hint");break}let i=m("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 ym=aN=class extends Ly{static{d(this,"MarkerNavigationWidget")}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 Y,this._onDidSelectRelatedInformation=new F,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=_i.Warning,this._backgroundColor=U.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(uCe);let t=lN,i=lCe;this._severity===_i.Warning?(t=E1,i=dCe):this._severity===_i.Info&&(t=dN,i=cCe);const n=e.getColor(t),s=e.getColor(i);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:s,primaryHeadingColor:e.getColor(Rz),secondaryHeadingColor:e.getColor(Pz)})}_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(aN.TitleMenu,this._contextKeyService);jL(i,void 0,t),this._actionbarWidget.push(t,{label:!1,icon:!0,index:0}),i.dispose()}_fillTitleIcon(e){this._icon=Q(e,ie(""))}_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 aCe(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?m("problems","{0} of {1} problems",t,i):m("change","{0} of {1} problem",t,i);this.setTitle(ur(a.uri),l)}this._icon.className=`codicon ${rN.className(_i.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()}};ym.TitleMenu=new T("gotoErrorTitleMenu");ym=aN=rCe([kf(1,en),kf(2,po),kf(3,Uo),kf(4,xe),kf(5,Ne),kf(6,rm)],ym);const vV=lv(Cl,zZ),CV=lv(ss,dv),wV=lv(zs,cv),lN=M("editorMarkerNavigationError.background",{dark:vV,light:vV,hcDark:lt,hcLight:lt},m("editorMarkerNavigationError","Editor marker navigation widget error color.")),lCe=M("editorMarkerNavigationError.headerBackground",{dark:ye(lN,.1),light:ye(lN,.1),hcDark:null,hcLight:null},m("editorMarkerNavigationErrorHeaderBackground","Editor marker navigation widget error heading background.")),E1=M("editorMarkerNavigationWarning.background",{dark:CV,light:CV,hcDark:lt,hcLight:lt},m("editorMarkerNavigationWarning","Editor marker navigation widget warning color.")),dCe=M("editorMarkerNavigationWarning.headerBackground",{dark:ye(E1,.1),light:ye(E1,.1),hcDark:"#0C141F",hcLight:ye(E1,.2)},m("editorMarkerNavigationWarningBackground","Editor marker navigation widget warning heading background.")),dN=M("editorMarkerNavigationInfo.background",{dark:wV,light:wV,hcDark:lt,hcLight:lt},m("editorMarkerNavigationInfo","Editor marker navigation widget info color.")),cCe=M("editorMarkerNavigationInfo.headerBackground",{dark:ye(dN,.1),light:ye(dN,.1),hcDark:null,hcLight:null},m("editorMarkerNavigationInfoHeaderBackground","Editor marker navigation widget info heading background.")),uCe=M("editorMarkerNavigation.background",{dark:an,light:an,hcDark:an,hcLight:an},m("editorMarkerNavigationBackground","Editor marker navigation widget background."));var hCe=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},Ww=function(o,e){return function(t,i){e(t,i,o)}},tb;let Bu=tb=class{static{d(this,"MarkerController")}static get(e){return e.getContribution(tb.ID)}constructor(e,t,i,n,s){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=n,this._instantiationService=s,this._sessionDispoables=new Y,this._editor=e,this._widgetVisible=xU.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(ym,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 H(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=tb.get(r))===null||i===void 0||i.close(),(n=tb.get(r))===null||n===void 0||n.nagivate(e,t))}else this._widget.showAtMarker(s.selected.marker,s.selected.index,s.selected.total)}}};Bu.ID="editor.contrib.markerController";Bu=tb=hCe([Ww(1,LU),Ww(2,Ne),Ww(3,bt),Ww(4,xe)],Bu);class Ux extends ue{static{d(this,"MarkerNavigationAction")}constructor(e,t,i){super(i),this._next=e,this._multiFile=t}async run(e,t){var i;t.hasModel()&&((i=Bu.get(t))===null||i===void 0||i.nagivate(this._next,this._multiFile))}}class mu extends Ux{static{d(this,"NextMarkerAction")}constructor(){super(!0,!1,{id:mu.ID,label:mu.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:I.focus,primary:578,weight:100},menuOpts:{menuId:ym.TitleMenu,title:mu.LABEL,icon:bi("marker-navigation-next",re.arrowDown,m("nextMarkerIcon","Icon for goto next marker.")),group:"navigation",order:1}})}}mu.ID="editor.action.marker.next";mu.LABEL=m("markerAction.next.label","Go to Next Problem (Error, Warning, Info)");class dg extends Ux{static{d(this,"PrevMarkerAction")}constructor(){super(!1,!1,{id:dg.ID,label:dg.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:I.focus,primary:1602,weight:100},menuOpts:{menuId:ym.TitleMenu,title:dg.LABEL,icon:bi("marker-navigation-previous",re.arrowUp,m("previousMarkerIcon","Icon for goto previous marker.")),group:"navigation",order:2}})}}dg.ID="editor.action.marker.prev";dg.LABEL=m("markerAction.previous.label","Go to Previous Problem (Error, Warning, Info)");class gCe extends Ux{static{d(this,"NextMarkerInFilesAction")}constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:m("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:I.focus,primary:66,weight:100},menuOpts:{menuId:T.MenubarGoMenu,title:m({key:"miGotoNextProblem",comment:["&& denotes a mnemonic"]},"Next &&Problem"),group:"6_problem_nav",order:1}})}}class fCe extends Ux{static{d(this,"PrevMarkerInFilesAction")}constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:m("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:I.focus,primary:1090,weight:100},menuOpts:{menuId:T.MenubarGoMenu,title:m({key:"miGotoPreviousProblem",comment:["&& denotes a mnemonic"]},"Previous &&Problem"),group:"6_problem_nav",order:2}})}}vt(Bu.ID,Bu,4);ee(mu);ee(dg);ee(gCe);ee(fCe);const xU=new ce("markersNavigationVisible",!1),pCe=Ji.bindToContribution(Bu.get);de(new pCe({id:"closeMarkersNavigation",precondition:xU,handler:d(o=>o.close(),"handler"),kbOpts:{weight:150,kbExpr:I.focus,primary:9,secondary:[1033]}}));var ia;(function(o){o.NoAutoFocus="noAutoFocus",o.FocusIfVisible="focusIfVisible",o.AutoFocusImmediately="autoFocusImmediately"})(ia||(ia={}));class mCe extends ue{static{d(this,"ShowOrFocusHoverAction")}constructor(){super({id:yz,label:m({key:"showOrFocusHover",comment:["Label for action that will trigger the showing/focusing of a hover in the editor.","If the hover is not visible, it will show the hover.","This allows for users to show the hover without using the mouse."]},"Show or Focus Hover"),metadata:{description:He("showOrFocusHoverDescription","Show or focus the editor hover which shows documentation, references, and other content for a symbol at the current cursor position."),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:[ia.NoAutoFocus,ia.FocusIfVisible,ia.AutoFocusImmediately],enumDescriptions:[m("showOrFocusHover.focus.noAutoFocus","The hover will not automatically take focus."),m("showOrFocusHover.focus.focusIfVisible","The hover will take focus only if it is already visible."),m("showOrFocusHover.focus.autoFocusImmediately","The hover will automatically take focus when it appears.")],default:ia.FocusIfVisible}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:I.editorTextFocus,primary:ji(2089,2087),weight:100}})}run(e,t,i){if(!t.hasModel())return;const n=rs.get(t);if(!n)return;const s=i?.focus;let r=ia.FocusIfVisible;Object.values(ia).includes(s)?r=s:typeof s=="boolean"&&s&&(r=ia.AutoFocusImmediately);const a=d(c=>{const u=t.getPosition(),h=new k(u.lineNumber,u.column,u.lineNumber,u.column);n.showContentHover(h,1,1,c)},"showContentHover"),l=t.getOption(2)===2;n.isHoverVisible?r!==ia.NoAutoFocus?n.focus():a(l):a(l||r===ia.AutoFocusImmediately)}}class _Ce extends ue{static{d(this,"ShowDefinitionPreviewHoverAction")}constructor(){super({id:Ame,label:m({key:"showDefinitionPreviewHover",comment:["Label for action that will trigger the showing of definition preview hover in the editor.","This allows for users to show the definition preview hover without using the mouse."]},"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0,metadata:{description:He("showDefinitionPreviewHoverDescription","Show the definition preview hover in the editor.")}})}run(e,t){const i=rs.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=Fg.get(t);if(!r)return;r.startFindDefinitionFromCursor(n).then(()=>{i.showContentHover(s,1,1,!0)})}}class bCe extends ue{static{d(this,"ScrollUpHoverAction")}constructor(){super({id:Nme,label:m({key:"scrollUpHover",comment:["Action that allows to scroll up in the hover widget with the up arrow when the hover widget is focused."]},"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:I.hoverFocused,kbOpts:{kbExpr:I.hoverFocused,primary:16,weight:100},metadata:{description:He("scrollUpHoverDescription","Scroll up the editor hover.")}})}run(e,t){const i=rs.get(t);i&&i.scrollUp()}}class vCe extends ue{static{d(this,"ScrollDownHoverAction")}constructor(){super({id:Rme,label:m({key:"scrollDownHover",comment:["Action that allows to scroll down in the hover widget with the up arrow when the hover widget is focused."]},"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:I.hoverFocused,kbOpts:{kbExpr:I.hoverFocused,primary:18,weight:100},metadata:{description:He("scrollDownHoverDescription","Scroll down the editor hover.")}})}run(e,t){const i=rs.get(t);i&&i.scrollDown()}}class CCe extends ue{static{d(this,"ScrollLeftHoverAction")}constructor(){super({id:Pme,label:m({key:"scrollLeftHover",comment:["Action that allows to scroll left in the hover widget with the left arrow when the hover widget is focused."]},"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:I.hoverFocused,kbOpts:{kbExpr:I.hoverFocused,primary:15,weight:100},metadata:{description:He("scrollLeftHoverDescription","Scroll left the editor hover.")}})}run(e,t){const i=rs.get(t);i&&i.scrollLeft()}}class wCe extends ue{static{d(this,"ScrollRightHoverAction")}constructor(){super({id:Ome,label:m({key:"scrollRightHover",comment:["Action that allows to scroll right in the hover widget with the right arrow when the hover widget is focused."]},"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:I.hoverFocused,kbOpts:{kbExpr:I.hoverFocused,primary:17,weight:100},metadata:{description:He("scrollRightHoverDescription","Scroll right the editor hover.")}})}run(e,t){const i=rs.get(t);i&&i.scrollRight()}}class SCe extends ue{static{d(this,"PageUpHoverAction")}constructor(){super({id:Fme,label:m({key:"pageUpHover",comment:["Action that allows to page up in the hover widget with the page up command when the hover widget is focused."]},"Page Up Hover"),alias:"Page Up Hover",precondition:I.hoverFocused,kbOpts:{kbExpr:I.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:He("pageUpHoverDescription","Page up the editor hover.")}})}run(e,t){const i=rs.get(t);i&&i.pageUp()}}class yCe extends ue{static{d(this,"PageDownHoverAction")}constructor(){super({id:Hme,label:m({key:"pageDownHover",comment:["Action that allows to page down in the hover widget with the page down command when the hover widget is focused."]},"Page Down Hover"),alias:"Page Down Hover",precondition:I.hoverFocused,kbOpts:{kbExpr:I.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:He("pageDownHoverDescription","Page down the editor hover.")}})}run(e,t){const i=rs.get(t);i&&i.pageDown()}}class LCe extends ue{static{d(this,"GoToTopHoverAction")}constructor(){super({id:Vme,label:m({key:"goToTopHover",comment:["Action that allows to go to the top of the hover widget with the home command when the hover widget is focused."]},"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:I.hoverFocused,kbOpts:{kbExpr:I.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:He("goToTopHoverDescription","Go to the top of the editor hover.")}})}run(e,t){const i=rs.get(t);i&&i.goToTop()}}class xCe extends ue{static{d(this,"GoToBottomHoverAction")}constructor(){super({id:Wme,label:m({key:"goToBottomHover",comment:["Action that allows to go to the bottom in the hover widget with the end command when the hover widget is focused."]},"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:I.hoverFocused,kbOpts:{kbExpr:I.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:He("goToBottomHoverDescription","Go to the bottom of the editor hover.")}})}run(e,t){const i=rs.get(t);i&&i.goToBottom()}}class kCe extends ue{static{d(this,"IncreaseHoverVerbosityLevel")}constructor(){super({id:bx,label:Bme,alias:"Increase Hover Verbosity Level",precondition:I.hoverVisible})}run(e,t,i){var n;(n=rs.get(t))===null||n===void 0||n.updateMarkdownHoverVerbosityLevel(xo.Increase,i?.index,i?.focus)}}class DCe extends ue{static{d(this,"DecreaseHoverVerbosityLevel")}constructor(){super({id:vx,label:zme,alias:"Decrease Hover Verbosity Level",precondition:I.hoverVisible})}run(e,t,i){var n;(n=rs.get(t))===null||n===void 0||n.updateMarkdownHoverVerbosityLevel(xo.Decrease,i?.index,i?.focus)}}var TCe=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},cT=function(o,e){return function(t,i){e(t,i,o)}};const Lr=ie;class ECe{static{d(this,"MarkerHover")}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 SV={type:1,filter:{include:ti.QuickFix},triggerAction:co.QuickFixHover};let cN=class{static{d(this,"MarkerHoverParticipant")}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,c=a.range.endLineNumber===n?a.range.endColumn:s,u=this._markerDecorationsService.getMarker(i.uri,a);if(!u)continue;const h=new k(e.range.startLineNumber,l,e.range.startLineNumber,c);r.push(new ECe(this,h,u))}return r}renderHoverParts(e,t){if(!t.length)return W.None;const i=new Y;t.forEach(s=>e.fragment.appendChild(this.renderMarkerHover(s,i)));const n=t.length===1?t[0]:t.sort((s,r)=>_i.compare(s.marker.severity,r.marker.severity))[0];return this.renderMarkerStatusbar(e,n,i),i}renderMarkerHover(e,t){const i=Lr("div.hover-row");i.tabIndex=0;const n=Q(i,Lr("div.marker.hover-contents")),{source:s,message:r,code:a,relatedInformation:l}=e.marker;this._editor.applyFontInfo(n);const c=Q(n,Lr("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=r,s||a)if(a&&typeof a!="string"){const u=Lr("span");if(s){const p=Q(u,Lr("span"));p.innerText=s}const h=Q(u,Lr("a.code-link"));h.setAttribute("href",a.target.toString()),t.add(G(h,"click",p=>{this._openerService.open(a.target,{allowCommands:!0}),p.preventDefault(),p.stopPropagation()}));const g=Q(h,Lr("span"));g.innerText=a.value;const f=Q(n,u);f.style.opacity="0.6",f.style.paddingLeft="6px"}else{const u=Q(n,Lr("span"));u.style.opacity="0.6",u.style.paddingLeft="6px",u.innerText=s&&a?`${s}(${a})`:s||`(${a})`}if($n(l))for(const{message:u,resource:h,startLineNumber:g,startColumn:f}of l){const p=Q(n,Lr("div"));p.style.marginTop="8px";const _=Q(p,Lr("a"));_.innerText=`${ur(h)}(${g}, ${f}): `,_.style.cursor="pointer",t.add(G(_,"click",v=>{v.stopPropagation(),v.preventDefault(),this._openerService&&this._openerService.open(h,{fromUserGesture:!0,editorOptions:{selection:{startLineNumber:g,startColumn:f}}}).catch(Ue)}));const b=Q(p,Lr("span"));b.innerText=u,this._editor.applyFontInfo(b)}return i}renderMarkerStatusbar(e,t,i){if(t.marker.severity===_i.Error||t.marker.severity===_i.Warning||t.marker.severity===_i.Info){const n=Bu.get(this._editor);n&&e.statusBar.addAction({label:m("view problem","View Problem"),commandId:mu.ID,run:d(()=>{e.hide(),n.showAtMarker(t.marker),this._editor.focus()},"run")})}if(!this._editor.getOption(91)){const n=e.statusBar.append(Lr("div"));this.recentMarkerCodeActionsInfo&&(zS.makeKey(this.recentMarkerCodeActionsInfo.marker)===zS.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(n.textContent=m("noQuickFixes","No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const s=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?W.None:yu(()=>n.textContent=m("checkingForQuickFixes","Checking for quick fixes..."),200,i);n.textContent||(n.textContent=" ");const r=this.getCodeActions(t.marker);i.add(we(()=>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=m("noQuickFixes","No quick fixes available");return}n.style.display="none";let l=!1;i.add(we(()=>{l||a.dispose()})),e.statusBar.addAction({label:m("quick fixes","Quick Fix..."),commandId:M2,run:d(c=>{l=!0;const u=Nu.get(this._editor),h=Fi(c);e.hide(),u?.showCodeActions(SV,a,{x:h.left,y:h.top,width:h.width,height:h.height})},"run")})},Ue)}}getCodeActions(e){return ln(t=>Mb(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new k(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),SV,Kd.None,t))}};cN=TCe([cT(1,BR),cT(2,po),cT(3,me)],cN);var yV;(function(o){o.intro=m("intro","Focus on the hover widget to cycle through the hover parts with the Tab key."),o.increaseVerbosity=m("increaseVerbosity","- The focused hover part verbosity level can be increased with the Increase Hover Verbosity command.",bx),o.decreaseVerbosity=m("decreaseVerbosity","- The focused hover part verbosity level can be decreased with the Decrease Hover Verbosity command.",vx),o.hoverContent=m("contentHover","The last focused hover content is the following.")})(yV||(yV={}));class ICe{static{d(this,"HoverAccessibleView")}dispose(){var e;(e=this._provider)===null||e===void 0||e.dispose()}}class MCe{static{d(this,"HoverAccessibilityHelp")}dispose(){var e;(e=this._provider)===null||e===void 0||e.dispose()}}class ACe{static{d(this,"ExtHoverAccessibleView")}dispose(){}}vt(rs.ID,rs,2);ee(mCe);ee(_Ce);ee(bCe);ee(vCe);ee(CCe);ee(wCe);ee(SCe);ee(yCe);ee(LCe);ee(xCe);ee(kCe);ee(DCe);Ju.register(Qv);Ju.register(cN);fr((o,e)=>{const t=o.getColor(XB);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)}; }`))});zx.register(new ICe);zx.register(new MCe);zx.register(new ACe);function Qs(o,e){let t=0;for(let i=0;ii-1)return[];const{tabSize:r,indentSize:a,insertSpaces:l}=o.getOptions(),c=d((_,b)=>(b=b||1,tr.shiftIndent(_,_.length+b,r,a,l)),"shiftIndent"),u=d((_,b)=>(b=b||1,tr.unshiftIndent(_,_.length+b,r,a,l)),"unshiftIndent"),h=[],g=o.getLineContent(t);let f=Vt(g),p=f;s.shouldIncrease(t)?(p=c(p),f=c(f)):s.shouldIndentNextLine(t)&&(p=c(p)),t++;for(let _=t;_<=i;_++){if(NCe(o,_))continue;const b=o.getLineContent(_),v=Vt(b),C=p;s.shouldDecrease(_,C)&&(p=u(p),f=u(f)),v!==p&&h.push(ai.replaceMove(new be(_,1,_,v.length+1),QR(p,a,l))),!s.shouldIgnore(_)&&(s.shouldIncrease(_,C)?(f=c(f),p=f):s.shouldIndentNextLine(_,C)?p=c(p):p=f)}return h}d(kU,"getReindentEditOperations");function NCe(o,e){return o.tokenization.isCheapToTokenize(e)?o.tokenization.getLineTokens(e).getStandardTokenType(0)===2:!1}d(NCe,"doesLineStartWithString");var RCe=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},PCe=function(o,e){return function(t,i){e(t,i,o)}};class Gx extends ue{static{d(this,"IndentationToSpacesAction")}constructor(){super({id:Gx.ID,label:m("indentationToSpaces","Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:I.writable,metadata:{description:He("indentationToSpacesDescription","Convert the tab indentation to spaces.")}})}run(e,t){const i=t.getModel();if(!i)return;const n=i.getOptions(),s=t.getSelection();if(!s)return;const r=new WCe(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}}Gx.ID="editor.action.indentationToSpaces";class Kx extends ue{static{d(this,"IndentationToTabsAction")}constructor(){super({id:Kx.ID,label:m("indentationToTabs","Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:I.writable,metadata:{description:He("indentationToTabsDescription","Convert the spaces indentation to tabs.")}})}run(e,t){const i=t.getModel();if(!i)return;const n=i.getOptions(),s=t.getSelection();if(!s)return;const r=new BCe(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}}Kx.ID="editor.action.indentationToTabs";class iO extends ue{static{d(this,"ChangeIndentationSizeAction")}constructor(e,t,i){super(i),this.insertSpaces=e,this.displaySizeOnly=t}run(e,t){const i=e.get(br),n=e.get(li),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(u=>({id:u.toString(),label:u.toString(),description:u===r.tabSize&&u===a.tabSize?m("configuredTabSize","Configured Tab Size"):u===r.tabSize?m("defaultTabSize","Default Tab Size"):u===a.tabSize?m("currentTabSize","Current Tab Size"):void 0})),c=Math.min(s.getOptions().tabSize-1,7);setTimeout(()=>{i.pick(l,{placeHolder:m({key:"selectTabWidth",comment:["Tab corresponds to the tab key"]},"Select Tab Size for Current File"),activeItem:l[c]}).then(u=>{if(u&&s&&!s.isDisposed()){const h=parseInt(u.label,10);this.displaySizeOnly?s.updateOptions({tabSize:h}):s.updateOptions({tabSize:h,indentSize:h,insertSpaces:this.insertSpaces})}})},50)}}class $x extends iO{static{d(this,"IndentUsingTabs")}constructor(){super(!1,!1,{id:$x.ID,label:m("indentUsingTabs","Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0,metadata:{description:He("indentUsingTabsDescription","Use indentation with tabs.")}})}}$x.ID="editor.action.indentUsingTabs";class jx extends iO{static{d(this,"IndentUsingSpaces")}constructor(){super(!0,!1,{id:jx.ID,label:m("indentUsingSpaces","Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0,metadata:{description:He("indentUsingSpacesDescription","Use indentation with spaces.")}})}}jx.ID="editor.action.indentUsingSpaces";class qx extends iO{static{d(this,"ChangeTabDisplaySize")}constructor(){super(!0,!0,{id:qx.ID,label:m("changeTabDisplaySize","Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0,metadata:{description:He("changeTabDisplaySizeDescription","Change the space size equivalent of the tab.")}})}}qx.ID="editor.action.changeTabDisplaySize";class Yx extends ue{static{d(this,"DetectIndentation")}constructor(){super({id:Yx.ID,label:m("detectIndentation","Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0,metadata:{description:He("detectIndentationDescription","Detect the indentation from content.")}})}run(e,t){const i=e.get(li),n=t.getModel();if(!n)return;const s=i.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget);n.detectIndentation(s.insertSpaces,s.tabSize)}}Yx.ID="editor.action.detectIndentation";class OCe extends ue{static{d(this,"ReindentLinesAction")}constructor(){super({id:"editor.action.reindentlines",label:m("editor.reindentlines","Reindent Lines"),alias:"Reindent Lines",precondition:I.writable,metadata:{description:He("editor.reindentlinesDescription","Reindent the lines of the editor.")}})}run(e,t){const i=e.get(Kt),n=t.getModel();if(!n)return;const s=kU(n,i,1,n.getLineCount());s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}}class FCe extends ue{static{d(this,"ReindentSelectedLinesAction")}constructor(){super({id:"editor.action.reindentselectedlines",label:m("editor.reindentselectedlines","Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:I.writable,metadata:{description:He("editor.reindentselectedlinesDescription","Reindent the selected lines of the editor.")}})}run(e,t){const i=e.get(Kt),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,c=a.endLineNumber;if(l!==c&&a.endColumn===1&&c--,l===1){if(l===c)continue}else l--;const u=kU(n,i,l,c);r.push(...u)}r.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop())}}class HCe{static{d(this,"AutoIndentOnPasteCommand")}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 c0=class{static{d(this,"AutoIndentOnPaste")}constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new Y,this.callOnModel=new Y,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||VCe(i,e)||!i.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber))return;const n=this.editor.getOption(12),{tabSize:s,indentSize:r,insertSpaces:a}=i.getOptions(),l=[],c={shiftIndent:d(f=>tr.shiftIndent(f,f.length+1,s,r,a),"shiftIndent"),unshiftIndent:d(f=>tr.unshiftIndent(f,f.length+1,s,r,a),"unshiftIndent")};let u=e.startLineNumber;for(;u<=e.endLineNumber;){if(this.shouldIgnoreLine(i,u)){u++;continue}break}if(u>e.endLineNumber)return;let h=i.getLineContent(u);if(!/\S/.test(h.substring(0,e.startColumn-1))){const f=hb(n,i,i.getLanguageId(),u,c,this._languageConfigurationService);if(f!==null){const p=Vt(h),_=Qs(f,s),b=Qs(p,s);if(_!==b){const v=Pb(_,s,a);l.push({range:new k(u,1,u,p.length+1),text:v}),h=v+h.substr(p.length)}else{const v=L7(i,u,this._languageConfigurationService);if(v===0||v===8)return}}}const g=u;for(;ui.tokenization.getLineTokens(_),"getLineTokens"),getLanguageId:d(()=>i.getLanguageId(),"getLanguageId"),getLanguageIdAtPosition:d((_,b)=>i.getLanguageIdAtPosition(_,b),"getLanguageIdAtPosition")},getLineContent:d(_=>_===g?h:i.getLineContent(_),"getLineContent")},i.getLanguageId(),u+1,c,this._languageConfigurationService);if(p!==null){const _=Qs(p,s),b=Qs(Vt(i.getLineContent(u+1)),s);if(_!==b){const v=_-b;for(let C=u+1;C<=e.endLineNumber;C++){const w=i.getLineContent(C),S=Vt(w),x=Qs(S,s)+v,D=Pb(x,s,a);D!==S&&l.push({range:new k(C,1,C,S.length+1),text:D})}}}}if(l.length>0){this.editor.pushUndoStop();const f=new HCe(l,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",f),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()}};c0.ID="editor.contrib.autoIndentOnPaste";c0=RCe([PCe(1,Kt)],c0);function VCe(o,e){const t=d(i=>ZX(o,i)===2,"isPositionInString");return t(e.getStartPosition())||t(e.getEndPosition())}d(VCe,"isStartOrEndInString");function DU(o,e,t,i){if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return;let n="";for(let r=0;r=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)}},I1;let zu=I1=class{static{d(this,"InPlaceReplaceController")}static get(e){return e.getContribution(I1.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 u6(this.editor,5),l=s.uri;return this.editorWorkerService.canNavigateValueSet(l)?(this.currentRequest=ln(c=>this.editorWorkerService.navigateValueSet(l,r,t)),this.currentRequest.then(c=>{var u;if(!c||!c.range||!c.value||!a.validate(this.editor))return;const h=k.lift(c.range);let g=c.range;const f=c.value.length-(r.endColumn-r.startColumn);g={startLineNumber:g.startLineNumber,startColumn:g.startColumn,endLineNumber:g.endLineNumber,endColumn:g.startColumn+c.value.length},f>1&&(r=new be(r.startLineNumber,r.startColumn,r.endLineNumber,r.endColumn+f-1));const p=new zCe(h,r,c.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,p),this.editor.pushUndoStop(),this.decorations.set([{range:g,options:I1.DECORATION}]),(u=this.decorationRemover)===null||u===void 0||u.cancel(),this.decorationRemover=Jd(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(Ue)}).catch(Ue)):Promise.resolve(void 0)}};zu.ID="editor.contrib.inPlaceReplaceController";zu.DECORATION=$e.register({description:"in-place-replace",className:"valueSetReplacement"});zu=I1=UCe([GCe(1,_r)],zu);class KCe extends ue{static{d(this,"InPlaceReplaceUp")}constructor(){super({id:"editor.action.inPlaceReplace.up",label:m("InPlaceReplaceAction.previous.label","Replace with Previous Value"),alias:"Replace with Previous Value",precondition:I.writable,kbOpts:{kbExpr:I.editorTextFocus,primary:3159,weight:100}})}run(e,t){const i=zu.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}class $Ce extends ue{static{d(this,"InPlaceReplaceDown")}constructor(){super({id:"editor.action.inPlaceReplace.down",label:m("InPlaceReplaceAction.next.label","Replace with Next Value"),alias:"Replace with Next Value",precondition:I.writable,kbOpts:{kbExpr:I.editorTextFocus,primary:3161,weight:100}})}run(e,t){const i=zu.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}vt(zu.ID,zu,4);ee(KCe);ee($Ce);class jCe extends ue{static{d(this,"ExpandLineSelectionAction")}constructor(){super({id:"expandLineSelection",label:m("expandLineSelection","Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:I.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,wn.expandLineSelection(n,n.getCursorStates())),n.revealAllCursors(i.source,!0)}}ee(jCe);class qCe{static{d(this,"TrimTrailingWhitespaceCommand")}constructor(e,t,i){this._selection=e,this._cursors=t,this._selectionId=null,this._trimInRegexesAndStrings=i}getEditOperations(e,t){const i=YCe(e,this._cursors,this._trimInRegexesAndStrings);for(let n=0,s=i.length;na.lineNumber===l.lineNumber?a.column-l.column:a.lineNumber-l.lineNumber);for(let a=e.length-2;a>=0;a--)e[a].lineNumber===e[a+1].lineNumber&&e.splice(a,1);const i=[];let n=0,s=0;const r=e.length;for(let a=1,l=o.getLineCount();a<=l;a++){const c=o.getLineContent(a),u=c.length+1;let h=0;if(s=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},ZCe=function(o,e){return function(t,i){e(t,i,o)}};let uN=class{static{d(this,"MoveLinesCommand")}constructor(e,t,i,n){this._languageConfigurationService=n,this._selection=e,this._isMovingDown=t,this._autoIndent=i,this._selectionId=null,this._moveEndLineSelectionShrink=!1}getEditOperations(e,t){const i=d(()=>e.getLanguageId(),"getLanguageId"),n=d((h,g)=>e.getLanguageIdAtPosition(h,g),"getLanguageIdAtPosition"),s=e.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===s){this._selectionId=t.trackSelection(this._selection);return}if(!this._isMovingDown&&this._selection.startLineNumber===1){this._selectionId=t.trackSelection(this._selection);return}this._moveEndPositionDown=!1;let r=this._selection;r.startLineNumberC===r.startLineNumber?e.tokenization.getLineTokens(h):e.tokenization.getLineTokens(C),"getLineTokens"),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:d(C=>C===r.startLineNumber?e.getLineContent(h):e.getLineContent(C),"getLineContent")},v=hb(this._autoIndent,b,e.getLanguageIdAtPosition(h,1),r.startLineNumber,u,this._languageConfigurationService);if(v!==null){const C=Vt(e.getLineContent(h)),w=Qs(v,a),S=Qs(C,a);w!==S&&(f=Pb(w,a,c)+this.trimStart(g))}}t.addEditOperation(new k(r.startLineNumber,1,r.startLineNumber,1),f+`
+`);const _=this.matchEnterRuleMovingDown(e,u,a,r.startLineNumber,h,f);if(_!==null)_!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,c,_);else{const b={tokenization:{getLineTokens:d(C=>C===r.startLineNumber?e.tokenization.getLineTokens(h):C>=r.startLineNumber+1&&C<=r.endLineNumber+1?e.tokenization.getLineTokens(C-1):e.tokenization.getLineTokens(C),"getLineTokens"),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:d(C=>C===r.startLineNumber?f:C>=r.startLineNumber+1&&C<=r.endLineNumber+1?e.getLineContent(C-1):e.getLineContent(C),"getLineContent")},v=hb(this._autoIndent,b,e.getLanguageIdAtPosition(h,1),r.startLineNumber+1,u,this._languageConfigurationService);if(v!==null){const C=Vt(e.getLineContent(r.startLineNumber)),w=Qs(v,a),S=Qs(C,a);if(w!==S){const y=w-S;this.getIndentEditsOfMovingBlock(e,t,r,a,c,y)}}}}else t.addEditOperation(new k(r.startLineNumber,1,r.startLineNumber,1),f+`
+`)}else if(h=r.startLineNumber-1,g=e.getLineContent(h),t.addEditOperation(new k(h,1,h+1,1),null),t.addEditOperation(new k(r.endLineNumber,e.getLineMaxColumn(r.endLineNumber),r.endLineNumber,e.getLineMaxColumn(r.endLineNumber)),`
+`+g),this.shouldAutoIndent(e,r)){const f={tokenization:{getLineTokens:d(_=>_===h?e.tokenization.getLineTokens(r.startLineNumber):e.tokenization.getLineTokens(_),"getLineTokens"),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:d(_=>_===h?e.getLineContent(r.startLineNumber):e.getLineContent(_),"getLineContent")},p=this.matchEnterRule(e,u,a,r.startLineNumber,r.startLineNumber-2);if(p!==null)p!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,c,p);else{const _=hb(this._autoIndent,f,e.getLanguageIdAtPosition(r.startLineNumber,1),h,u,this._languageConfigurationService);if(_!==null){const b=Vt(e.getLineContent(r.startLineNumber)),v=Qs(_,a),C=Qs(b,a);if(v!==C){const w=v-C;this.getIndentEditsOfMovingBlock(e,t,r,a,c,w)}}}}}this._selectionId=t.trackSelection(r)}buildIndentConverter(e,t,i){return{shiftIndent:d(n=>tr.shiftIndent(n,n.length+1,e,t,i),"shiftIndent"),unshiftIndent:d(n=>tr.unshiftIndent(n,n.length+1,e,t,i),"unshiftIndent")}}parseEnterResult(e,t,i,n,s){if(s){let r=s.indentation;s.indentAction===Bi.None||s.indentAction===Bi.Indent?r=s.indentation+s.appendText:s.indentAction===Bi.IndentOutdent?r=s.indentation:s.indentAction===Bi.Outdent&&(r=t.unshiftIndent(s.indentation)+s.appendText);const a=e.getLineContent(n);if(this.trimStart(a).indexOf(this.trimStart(r))>=0){const l=Vt(e.getLineContent(n));let c=Vt(r);const u=L7(e,n,this._languageConfigurationService);u!==null&&u&2&&(c=t.unshiftIndent(c));const h=Qs(c,i),g=Qs(l,i);return h-g}}return null}matchEnterRuleMovingDown(e,t,i,n,s,r){if(Ca(r)>=0){const a=e.getLineMaxColumn(s),l=Cp(this._autoIndent,e,new k(s,a,s,a),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,l)}else{let a=n-1;for(;a>=1;){const u=e.getLineContent(a);if(Ca(u)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const l=e.getLineMaxColumn(a),c=Cp(this._autoIndent,e,new k(a,l,a,l),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,c)}}matchEnterRule(e,t,i,n,s,r){let a=s;for(;a>=1;){let u;if(a===s&&r!==void 0?u=r:u=e.getLineContent(a),Ca(u)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const l=e.getLineMaxColumn(a),c=Cp(this._autoIndent,e,new k(a,l,a,l),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,c)}trimStart(e){return e.replace(/^\s+/,"")}shouldAutoIndent(e,t){if(this._autoIndent<4||!e.tokenization.isCheapToTokenize(t.startLineNumber))return!1;const i=e.getLanguageIdAtPosition(t.startLineNumber,1),n=e.getLanguageIdAtPosition(t.endLineNumber,1);return!(i!==n||this._languageConfigurationService.getLanguageConfiguration(i).indentRulesSupport===null)}getIndentEditsOfMovingBlock(e,t,i,n,s,r){for(let a=i.startLineNumber;a<=i.endLineNumber;a++){const l=e.getLineContent(a),c=Vt(l),h=Qs(c,n)+r,g=Pb(h,n,s);g!==c&&(t.addEditOperation(new k(a,1,a,c.length+1),g),a===i.endLineNumber&&i.endColumn<=c.length+1&&g===""&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&i.startLineNumber=n)return null;const s=[];for(let a=i;a<=n;a++)s.push(o.getLineContent(a));let r=s.slice(0);return r.sort(_u.getCollator().compare),t===!0&&(r=r.reverse()),{startLineNumber:i,endLineNumber:n,before:s,after:r}}d(EU,"getSortData");function QCe(o,e,t){const i=EU(o,e,t);return i?ai.replace(new k(i.startLineNumber,1,i.endLineNumber,o.getLineMaxColumn(i.endLineNumber)),i.after.join(`
+`)):null}d(QCe,"sortLines");class IU extends ue{static{d(this,"AbstractCopyLinesAction")}constructor(e,t){super(t),this.down=e}run(e,t){if(!t.hasModel())return;const i=t.getSelections().map((r,a)=>({selection:r,index:a,ignore:!1}));i.sort((r,a)=>k.compareRangesUsingStarts(r.selection,a.selection));let n=i[0];for(let r=1;rnew H(u.positionLineNumber,u.positionColumn)));const s=t.getSelection();if(s===null)return;const r=e.get(et),a=t.getModel(),l=r.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:a?.getLanguageId(),resource:a?.uri}),c=new qCe(s,n,l);t.pushUndoStop(),t.executeCommands(this.id,[c]),t.pushUndoStop()}}Xx.ID="editor.action.trimTrailingWhitespace";class awe extends ue{static{d(this,"DeleteLinesAction")}constructor(){super({id:"editor.action.deleteLines",label:m("lines.delete","Delete Line"),alias:"Delete Line",precondition:I.writable,kbOpts:{kbExpr:I.textInputFocus,primary:3113,weight:100}})}run(e,t){if(!t.hasModel())return;const i=this._getLinesToRemove(t),n=t.getModel();if(n.getLineCount()===1&&n.getLineMaxColumn(1)===1)return;let s=0;const r=[],a=[];for(let l=0,c=i.length;l1&&(h-=1,f=n.getLineMaxColumn(h)),r.push(ai.replace(new be(h,f,g,p),"")),a.push(new be(h-s,u.positionColumn,h-s,u.positionColumn)),s+=u.endLineNumber-u.startLineNumber+1}t.pushUndoStop(),t.executeEdits(this.id,r,a),t.pushUndoStop()}_getLinesToRemove(e){const t=e.getSelections().map(s=>{let r=s.endLineNumber;return s.startLineNumbers.startLineNumber===r.startLineNumber?s.endLineNumber-r.endLineNumber:s.startLineNumber-r.startLineNumber);const i=[];let n=t[0];for(let s=1;s=t[s].startLineNumber?n.endLineNumber=t[s].endLineNumber:(i.push(n),n=t[s]);return i.push(n),i}}class lwe extends ue{static{d(this,"IndentLinesAction")}constructor(){super({id:"editor.action.indentLines",label:m("lines.indent","Indent Line"),alias:"Indent Line",precondition:I.writable,kbOpts:{kbExpr:I.editorTextFocus,primary:2142,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,di.indent(i.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}}class dwe extends ue{static{d(this,"OutdentLinesAction")}constructor(){super({id:"editor.action.outdentLines",label:m("lines.outdent","Outdent Line"),alias:"Outdent Line",precondition:I.writable,kbOpts:{kbExpr:I.editorTextFocus,primary:2140,weight:100}})}run(e,t){wp.Outdent.runEditorCommand(e,t,null)}}class cwe extends ue{static{d(this,"InsertLineBeforeAction")}constructor(){super({id:"editor.action.insertLineBefore",label:m("lines.insertBefore","Insert Line Above"),alias:"Insert Line Above",precondition:I.writable,kbOpts:{kbExpr:I.editorTextFocus,primary:3075,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,di.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}}class uwe extends ue{static{d(this,"InsertLineAfterAction")}constructor(){super({id:"editor.action.insertLineAfter",label:m("lines.insertAfter","Insert Line Below"),alias:"Insert Line Below",precondition:I.writable,kbOpts:{kbExpr:I.editorTextFocus,primary:2051,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,di.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}}class NU extends ue{static{d(this,"AbstractDeleteAllToBoundaryAction")}run(e,t){if(!t.hasModel())return;const i=t.getSelection(),n=this._getRangesToDelete(t),s=[];for(let l=0,c=n.length-1;lai.replace(l,""));t.pushUndoStop(),t.executeEdits(this.id,a,r),t.pushUndoStop()}}class hwe extends NU{static{d(this,"DeleteAllLeftAction")}constructor(){super({id:"deleteAllLeft",label:m("lines.deleteAllLeft","Delete All Left"),alias:"Delete All Left",precondition:I.writable,kbOpts:{kbExpr:I.textInputFocus,primary:0,mac:{primary:2049},weight:100}})}_getEndCursorState(e,t){let i=null;const n=[];let s=0;return t.forEach(r=>{let a;if(r.endColumn===1&&s>0){const l=r.startLineNumber-s;a=new be(l,r.startColumn,l,r.startColumn)}else a=new be(r.startLineNumber,r.startColumn,r.startLineNumber,r.startColumn);s+=r.endLineNumber-r.startLineNumber,r.intersectRanges(e)?i=a:n.push(a)}),i&&n.unshift(i),n}_getRangesToDelete(e){const t=e.getSelections();if(t===null)return[];let i=t;const n=e.getModel();return n===null?[]:(i.sort(k.compareRangesUsingStarts),i=i.map(s=>{if(s.isEmpty())if(s.startColumn===1){const r=Math.max(1,s.startLineNumber-1),a=s.startLineNumber===1?1:n.getLineLength(r)+1;return new k(r,a,s.startLineNumber,1)}else return new k(s.startLineNumber,1,s.startLineNumber,s.startColumn);else return new k(s.startLineNumber,1,s.endLineNumber,s.endColumn)}),i)}}class gwe extends NU{static{d(this,"DeleteAllRightAction")}constructor(){super({id:"deleteAllRight",label:m("lines.deleteAllRight","Delete All Right"),alias:"Delete All Right",precondition:I.writable,kbOpts:{kbExpr:I.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100}})}_getEndCursorState(e,t){let i=null;const n=[];for(let s=0,r=t.length,a=0;s{if(s.isEmpty()){const r=t.getLineMaxColumn(s.startLineNumber);return s.startColumn===r?new k(s.startLineNumber,s.startColumn,s.startLineNumber+1,1):new k(s.startLineNumber,s.startColumn,s.startLineNumber,r)}return s});return n.sort(k.compareRangesUsingStarts),n}}class fwe extends ue{static{d(this,"JoinLinesAction")}constructor(){super({id:"editor.action.joinLines",label:m("lines.joinLines","Join Lines"),alias:"Join Lines",precondition:I.writable,kbOpts:{kbExpr:I.editorTextFocus,primary:0,mac:{primary:296},weight:100}})}run(e,t){const i=t.getSelections();if(i===null)return;let n=t.getSelection();if(n===null)return;i.sort(k.compareRangesUsingStarts);const s=[],r=i.reduce((g,f)=>g.isEmpty()?g.endLineNumber===f.startLineNumber?(n.equalsSelection(g)&&(n=f),f):f.startLineNumber>g.endLineNumber+1?(s.push(g),f):new be(g.startLineNumber,g.startColumn,f.endLineNumber,f.endColumn):f.startLineNumber>g.endLineNumber?(s.push(g),f):new be(g.startLineNumber,g.startColumn,f.endLineNumber,f.endColumn));s.push(r);const a=t.getModel();if(a===null)return;const l=[],c=[];let u=n,h=0;for(let g=0,f=s.length;g=1){let z=!0;y===""&&(z=!1),z&&(y.charAt(y.length-1)===" "||y.charAt(y.length-1)===" ")&&(z=!1,y=y.replace(/[\s\uFEFF\xA0]+$/g," "));const O=E.substr(A-1);y+=(z?" ":"")+O,z?v=O.length+1:v=O.length}else v=0}const x=new k(_,b,C,w);if(!x.isEmpty()){let D;p.isEmpty()?(l.push(ai.replace(x,y)),D=new be(x.startLineNumber-h,y.length-v+1,_-h,y.length-v+1)):p.startLineNumber===p.endLineNumber?(l.push(ai.replace(x,y)),D=new be(p.startLineNumber-h,p.startColumn,p.endLineNumber-h,p.endColumn)):(l.push(ai.replace(x,y)),D=new be(p.startLineNumber-h,p.startColumn,p.startLineNumber-h,y.length-S)),k.intersectRanges(x,n)!==null?u=D:c.push(D)}h+=x.endLineNumber-x.startLineNumber}c.unshift(u),t.pushUndoStop(),t.executeEdits(this.id,l,c),t.pushUndoStop()}}class pwe extends ue{static{d(this,"TransposeAction")}constructor(){super({id:"editor.action.transpose",label:m("editor.transpose","Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:I.writable})}run(e,t){const i=t.getSelections();if(i===null)return;const n=t.getModel();if(n===null)return;const s=[];for(let r=0,a=i.length;r=u){if(c.lineNumber===n.getLineCount())continue;const h=new k(c.lineNumber,Math.max(1,c.column-1),c.lineNumber+1,1),g=n.getValueInRange(h).split("").reverse().join("");s.push(new An(new be(c.lineNumber,Math.max(1,c.column-1),c.lineNumber+1,1),g))}else{const h=new k(c.lineNumber,Math.max(1,c.column-1),c.lineNumber,c.column+1),g=n.getValueInRange(h).split("").reverse().join("");s.push(new JR(h,g,new be(c.lineNumber,c.column+1,c.lineNumber,c.column+1)))}}t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class af extends ue{static{d(this,"AbstractCaseAction")}run(e,t){const i=t.getSelections();if(i===null)return;const n=t.getModel();if(n===null)return;const s=t.getOption(131),r=[];for(const a of i)if(a.isEmpty()){const l=a.getStartPosition(),c=t.getConfiguredWordAtPosition(l);if(!c)continue;const u=new k(l.lineNumber,c.startColumn,l.lineNumber,c.endColumn),h=n.getValueInRange(u);r.push(ai.replace(u,this._modifyText(h,s)))}else{const l=n.getValueInRange(a);r.push(ai.replace(a,this._modifyText(l,s)))}t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop()}}class mwe extends af{static{d(this,"UpperCaseAction")}constructor(){super({id:"editor.action.transformToUppercase",label:m("editor.transformToUppercase","Transform to Uppercase"),alias:"Transform to Uppercase",precondition:I.writable})}_modifyText(e,t){return e.toLocaleUpperCase()}}class _we extends af{static{d(this,"LowerCaseAction")}constructor(){super({id:"editor.action.transformToLowercase",label:m("editor.transformToLowercase","Transform to Lowercase"),alias:"Transform to Lowercase",precondition:I.writable})}_modifyText(e,t){return e.toLocaleLowerCase()}}class mc{static{d(this,"BackwardsCompatibleRegExp")}constructor(e,t){this._pattern=e,this._flags=t,this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch{}}return this._actual}isSupported(){return this.get()!==null}}class u0 extends af{static{d(this,"TitleCaseAction")}constructor(){super({id:"editor.action.transformToTitlecase",label:m("editor.transformToTitlecase","Transform to Title Case"),alias:"Transform to Title Case",precondition:I.writable})}_modifyText(e,t){const i=u0.titleBoundary.get();return i?e.toLocaleLowerCase().replace(i,n=>n.toLocaleUpperCase()):e}}u0.titleBoundary=new mc("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");class bu extends af{static{d(this,"SnakeCaseAction")}constructor(){super({id:"editor.action.transformToSnakecase",label:m("editor.transformToSnakecase","Transform to Snake Case"),alias:"Transform to Snake Case",precondition:I.writable})}_modifyText(e,t){const i=bu.caseBoundary.get(),n=bu.singleLetters.get();return!i||!n?e:e.replace(i,"$1_$2").replace(n,"$1_$2$3").toLocaleLowerCase()}}bu.caseBoundary=new mc("(\\p{Ll})(\\p{Lu})","gmu");bu.singleLetters=new mc("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");class h0 extends af{static{d(this,"CamelCaseAction")}constructor(){super({id:"editor.action.transformToCamelcase",label:m("editor.transformToCamelcase","Transform to Camel Case"),alias:"Transform to Camel Case",precondition:I.writable})}_modifyText(e,t){const i=h0.wordBoundary.get();if(!i)return e;const n=e.split(i);return n.shift()+n.map(r=>r.substring(0,1).toLocaleUpperCase()+r.substring(1)).join("")}}h0.wordBoundary=new mc("[_\\s-]","gm");class Hg extends af{static{d(this,"PascalCaseAction")}constructor(){super({id:"editor.action.transformToPascalcase",label:m("editor.transformToPascalcase","Transform to Pascal Case"),alias:"Transform to Pascal Case",precondition:I.writable})}_modifyText(e,t){const i=Hg.wordBoundary.get(),n=Hg.wordBoundaryToMaintain.get();return!i||!n?e:e.split(n).map(a=>a.split(i)).flat().map(a=>a.substring(0,1).toLocaleUpperCase()+a.substring(1)).join("")}}Hg.wordBoundary=new mc("[_\\s-]","gm");Hg.wordBoundaryToMaintain=new mc("(?<=\\.)","gm");class qd extends af{static{d(this,"KebabCaseAction")}static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(t=>t.isSupported())}constructor(){super({id:"editor.action.transformToKebabcase",label:m("editor.transformToKebabcase","Transform to Kebab Case"),alias:"Transform to Kebab Case",precondition:I.writable})}_modifyText(e,t){const i=qd.caseBoundary.get(),n=qd.singleLetters.get(),s=qd.underscoreBoundary.get();return!i||!n||!s?e:e.replace(s,"$1-$3").replace(i,"$1-$2").replace(n,"$1-$2").toLocaleLowerCase()}}qd.caseBoundary=new mc("(\\p{Ll})(\\p{Lu})","gmu");qd.singleLetters=new mc("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu");qd.underscoreBoundary=new mc("(\\S)(_)(\\S)","gm");ee(JCe);ee(ewe);ee(twe);ee(iwe);ee(nwe);ee(swe);ee(owe);ee(rwe);ee(Xx);ee(awe);ee(lwe);ee(dwe);ee(cwe);ee(uwe);ee(hwe);ee(gwe);ee(fwe);ee(pwe);ee(mwe);ee(_we);bu.caseBoundary.isSupported()&&bu.singleLetters.isSupported()&&ee(bu);h0.wordBoundary.isSupported()&&ee(h0);Hg.wordBoundary.isSupported()&&ee(Hg);u0.titleBoundary.isSupported()&&ee(u0);qd.isSupported()&&ee(qd);var bwe=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},Bw=function(o,e){return function(t,i){e(t,i,o)}},M1;const RU=new ce("LinkedEditingInputVisible",!1),vwe="linked-editing-decoration";let Uu=M1=class extends W{static{d(this,"LinkedEditingContribution")}static get(e){return e.getContribution(M1.ID)}constructor(e,t,i,n,s){super(),this.languageConfigurationService=n,this._syncRangesToken=0,this._localToDispose=this._register(new Y),this._editor=e,this._providers=i.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=RU.bindTo(t),this._debounceInformation=s.for(this._providers,"Linked Editing",{max:200}),this._currentDecorations=this._editor.createDecorationsCollection(),this._languageWordPattern=null,this._currentWordPattern=null,this._ignoreChangeEvent=!1,this._localToDispose=this._register(new Y),this._rangeUpdateTriggerPromise=null,this._rangeSyncTriggerPromise=null,this._currentRequestCts=null,this._currentRequestPosition=null,this._currentRequestModelVersion=null,this._register(this._editor.onDidChangeModel(()=>this.reinitialize(!0))),this._register(this._editor.onDidChangeConfiguration(r=>{(r.hasChanged(70)||r.hasChanged(93))&&this.reinitialize(!1)})),this._register(this._providers.onDidChange(()=>this.reinitialize(!1))),this._register(this._editor.onDidChangeModelLanguage(()=>this.reinitialize(!0))),this.reinitialize(!0)}reinitialize(e){const t=this._editor.getModel(),i=t!==null&&(this._editor.getOption(70)||this._editor.getOption(93))&&this._providers.has(t);if(i===this._enabled&&!e||(this._enabled=i,this.clearRanges(),this._localToDispose.clear(),!i||t===null))return;this._localToDispose.add(le.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));const n=new zr(this._debounceInformation.get(t)),s=d(()=>{var l;this._rangeUpdateTriggerPromise=n.trigger(()=>this.updateRanges(),(l=this._debounceDuration)!==null&&l!==void 0?l:this._debounceInformation.get(t))},"triggerRangeUpdate"),r=new zr(0),a=d(l=>{this._rangeSyncTriggerPromise=r.trigger(()=>this._syncRanges(l))},"triggerRangeSync");this._localToDispose.add(this._editor.onDidChangeCursorPosition(()=>{s()})),this._localToDispose.add(this._editor.onDidChangeModelContent(l=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){const c=this._currentDecorations.getRange(0);if(c&&l.changes.every(u=>c.intersectRanges(u.range))){a(this._syncRangesToken);return}}s()})),this._localToDispose.add({dispose:d(()=>{n.dispose(),r.dispose()},"dispose")}),this.updateRanges()}_syncRanges(e){if(!this._editor.hasModel()||e!==this._syncRangesToken||this._currentDecorations.length===0)return;const t=this._editor.getModel(),i=this._currentDecorations.getRange(0);if(!i||i.startLineNumber!==i.endLineNumber)return this.clearRanges();const n=t.getValueInRange(i);if(this._currentWordPattern){const r=n.match(this._currentWordPattern);if((r?r[0].length:0)!==n.length)return this.clearRanges()}const s=[];for(let r=1,a=this._currentDecorations.length;r1){this.clearRanges();return}const i=this._editor.getModel(),n=i.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===n){if(t.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){const r=this._currentDecorations.getRange(0);if(r&&r.containsPosition(t))return}}this.clearRanges(),this._currentRequestPosition=t,this._currentRequestModelVersion=n;const s=this._currentRequestCts=new ui;try{const r=new En(!1),a=await PU(this._providers,i,t,s.token);if(this._debounceInformation.update(i,r.elapsed()),s!==this._currentRequestCts||(this._currentRequestCts=null,n!==i.getVersionId()))return;let l=[];a?.ranges&&(l=a.ranges),this._currentWordPattern=a?.wordPattern||this._languageWordPattern;let c=!1;for(let h=0,g=l.length;h({range:h,options:M1.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(u),this._syncRangesToken++}catch(r){Gr(r)||Ue(r),(this._currentRequestCts===s||!this._currentRequestCts)&&this.clearRanges()}}};Uu.ID="editor.contrib.linkedEditing";Uu.DECORATION=$e.register({description:"linked-editing",stickiness:0,className:vwe});Uu=M1=bwe([Bw(1,Ne),Bw(2,me),Bw(3,Kt),Bw(4,pr)],Uu);class Cwe extends ue{static{d(this,"LinkedEditingAction")}constructor(){super({id:"editor.action.linkedEditing",label:m("linkedEditing.label","Start Linked Editing"),alias:"Start Linked Editing",precondition:j.and(I.writable,I.hasRenameProvider),kbOpts:{kbExpr:I.editorTextFocus,primary:3132,weight:100}})}runCommand(e,t){const i=e.get(bt),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return Te.isUri(n)&&H.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))))},Ue):super.runCommand(e,t)}run(e,t){const i=Uu.get(t);return i?Promise.resolve(i.updateRanges(!0)):Promise.resolve()}}const wwe=Ji.bindToContribution(Uu.get);de(new wwe({id:"cancelLinkedEditingInput",precondition:RU,handler:d(o=>o.clearRanges(),"handler"),kbOpts:{kbExpr:I.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function PU(o,e,t,i){const n=o.ordered(e);return pR(n.map(s=>async()=>{try{return await s.provideLinkedEditingRanges(e,t,i)}catch(r){Li(r);return}}),s=>!!s&&$n(s?.ranges))}d(PU,"getLinkedEditingRanges");M("editor.linkedEditingBackground",{dark:U.fromHex("#f00").transparent(.3),light:U.fromHex("#f00").transparent(.3),hcDark:U.fromHex("#f00").transparent(.3),hcLight:U.white},m("editorLinkedEditingBackground","Background color when the editor auto renames on type."));jl("_executeLinkedEditingProvider",(o,e,t)=>{const{linkedEditingRangeProvider:i}=o.get(me);return PU(i,e,t,ot.None)});vt(Uu.ID,Uu,1);ee(Cwe);let Swe=class{static{d(this,"Link")}constructor(e,t){this._link=e,this._provider=t}toJSON(){return{range:this.range,url:this.url,tooltip:this.tooltip}}get range(){return this._link.range}get url(){return this._link.url}get tooltip(){return this._link.tooltip}async resolve(e){return this._link.url?this._link.url:typeof this._provider.resolveLink=="function"?Promise.resolve(this._provider.resolveLink(this._link,e)).then(t=>(this._link=t||this._link,this._link.url?this.resolve(e):Promise.reject(new Error("missing")))):Promise.reject(new Error("missing"))}};class Fy{static{d(this,"LinksList")}constructor(e){this._disposables=new Y;let t=[];for(const[i,n]of e){const s=i.links.map(r=>new Swe(r,n));t=Fy._union(t,s),Ky(i)&&this._disposables.add(i)}this.links=t}dispose(){this._disposables.dispose(),this.links.length=0}static _union(e,t){const i=[];let n,s,r,a;for(n=0,r=0,s=e.length,a=t.length;nPromise.resolve(s.provideLinks(e,t)).then(a=>{a&&(i[r]=[a,s])},Li));return Promise.all(n).then(()=>{const s=new Fy(ka(i));return t.isCancellationRequested?(s.dispose(),new Fy([])):s})}d(OU,"getLinks");ut.registerCommand("_executeLinkProvider",async(o,...e)=>{let[t,i]=e;_t(t instanceof Te),typeof i!="number"&&(i=0);const{linkProvider:n}=o.get(me),s=o.get(li).getModel(t);if(!s)return[];const r=await OU(n,s,ot.None);if(!r)return[];for(let l=0;l=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},zw=function(o,e){return function(t,i){e(t,i,o)}},hN;let Lm=hN=class extends W{static{d(this,"LinkDetector")}static get(e){return e.getContribution(hN.ID)}constructor(e,t,i,n,s){super(),this.editor=e,this.openerService=t,this.notificationService=i,this.languageFeaturesService=n,this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=s.for(this.providers,"Links",{min:1e3,max:4e3}),this.computeLinks=this._register(new Pt(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new Cx(e));this._register(r.onMouseMoveOrRelevantKeyDown(([a,l])=>{this._onEditorMouseMove(a,l)})),this._register(r.onExecute(a=>{this.onEditorMouseUp(a)})),this._register(r.onCancel(a=>{this.cleanUpActiveLinkDecoration()})),this._register(e.onDidChangeConfiguration(a=>{a.hasChanged(71)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))})),this._register(e.onDidChangeModelContent(a=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))})),this._register(e.onDidChangeModel(a=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)})),this._register(e.onDidChangeModelLanguage(a=>{this.stop(),this.computeLinks.schedule(0)})),this._register(this.providers.onDidChange(a=>{this.stop(),this.computeLinks.schedule(0)})),this.computeLinks.schedule(0)}async computeLinksNow(){if(!this.editor.hasModel()||!this.editor.getOption(71))return;const e=this.editor.getModel();if(!e.isTooLargeForSyncing()&&this.providers.has(e)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=ln(t=>OU(this.providers,e,t));try{const t=new En(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){Ue(t)}finally{this.computePromise=null}}}updateDecorations(e){const t=this.editor.getOption(78)==="altKey",i=[],n=Object.keys(this.currentOccurrences);for(const r of n){const a=this.currentOccurrences[r];i.push(a.decorationId)}const s=[];if(e)for(const r of e)s.push(Pp.decoration(r,t));this.editor.changeDecorations(r=>{const a=r.deltaDecorations(i,s);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let l=0,c=a.length;l{n.activate(s,i),this.activeLinkDecorationId=n.decorationId})}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){const e=this.editor.getOption(78)==="altKey";if(this.activeLinkDecorationId){const t=this.currentOccurrences[this.activeLinkDecorationId];t&&this.editor.changeDecorations(i=>{t.deactivate(i,e)}),this.activeLinkDecorationId=null}}onEditorMouseUp(e){if(!this.isEnabled(e))return;const t=this.getLinkOccurrence(e.target.position);t&&this.openLinkOccurrence(t,e.hasSideBySideModifier,!0)}openLinkOccurrence(e,t,i=!1){if(!this.openerService)return;const{link:n}=e;n.resolve(ot.None).then(s=>{if(typeof s=="string"&&this.editor.hasModel()){const r=this.editor.getModel().uri;if(r.scheme===Fe.file&&s.startsWith(`${Fe.file}:`)){const a=Te.parse(s);if(a.scheme===Fe.file){const l=el(a);let c=null;l.startsWith("/./")||l.startsWith("\\.\\")?c=`.${l.substr(1)}`:(l.startsWith("//./")||l.startsWith("\\\\.\\"))&&(c=`.${l.substr(2)}`),c&&(s=Aie(r,c))}}}return this.openerService.open(s,{openToSide:t,fromUserGesture:i,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})},s=>{const r=s instanceof Error?s.message:s;r==="invalid"?this.notificationService.warn(m("invalid.url","Failed to open this link because it is not well-formed: {0}",n.url.toString())):r==="missing"?this.notificationService.warn(m("missing.url","Failed to open this link because its target is missing.")):Ue(s)})}getLinkOccurrence(e){if(!this.editor.hasModel()||!e)return null;const t=this.editor.getModel().getDecorationsInRange({startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:e.lineNumber,endColumn:e.column},0,!0);for(const i of t){const n=this.currentOccurrences[i.id];if(n)return n}return null}isEnabled(e,t){return!!(e.target.type===6&&(e.hasTriggerModifier||t&&t.keyCodeIsTriggerKey))}stop(){var e;this.computeLinks.cancel(),this.activeLinksList&&((e=this.activeLinksList)===null||e===void 0||e.dispose(),this.activeLinksList=null),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop()}};Lm.ID="editor.linkDetector";Lm=hN=ywe([zw(1,po),zw(2,Ri),zw(3,me),zw(4,pr)],Lm);const LV={general:$e.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:$e.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class Pp{static{d(this,"LinkOccurrence")}static decoration(e,t){return{range:e.range,options:Pp._getOptions(e,t,!1)}}static _getOptions(e,t,i){const n={...i?LV.active:LV.general};return n.hoverMessage=Lwe(e,t),n}constructor(e,t){this.link=e,this.decorationId=t}activate(e,t){e.changeDecorationOptions(this.decorationId,Pp._getOptions(this.link,t,!0))}deactivate(e,t){e.changeDecorationOptions(this.decorationId,Pp._getOptions(this.link,t,!1))}}function Lwe(o,e){const t=o.url&&/^command:/i.test(o.url.toString()),i=o.tooltip?o.tooltip:t?m("links.navigate.executeCmd","Execute command"):m("links.navigate.follow","Follow link"),n=e?nt?m("links.navigate.kb.meta.mac","cmd + click"):m("links.navigate.kb.meta","ctrl + click"):nt?m("links.navigate.kb.alt.mac","option + click"):m("links.navigate.kb.alt","alt + click");if(o.url){let s="";if(/^command:/i.test(o.url.toString())){const a=o.url.toString().match(/^command:([^?#]+)/);if(a){const l=a[1];s=m("tooltip.explanation","Execute command {0}",l)}}return new Gn("",!0).appendLink(o.url.toString(!0).replace(/ /g,"%20"),i,s).appendMarkdown(` (${n})`)}else return new Gn().appendText(`${i} (${n})`)}d(Lwe,"getHoverMessage");class xwe extends ue{static{d(this,"OpenLinkAction")}constructor(){super({id:"editor.action.openLink",label:m("label","Open Link"),alias:"Open Link",precondition:void 0})}run(e,t){const i=Lm.get(t);if(!i||!t.hasModel())return;const n=t.getSelections();for(const s of n){const r=i.getLinkOccurrence(s.getEndPosition());r&&i.openLinkOccurrence(r,!1)}}}vt(Lm.ID,Lm,1);ee(xwe);class gN extends W{static{d(this,"LongLinesHelper")}constructor(e){super(),this._editor=e,this._register(this._editor.onMouseDown(t=>{const i=this._editor.getOption(117);i>=0&&t.target.type===6&&t.target.position.column>=i&&this._editor.updateOptions({stopRenderingLineAfter:-1})}))}}gN.ID="editor.contrib.longLinesHelper";vt(gN.ID,gN,2);const Uw=M("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},m("wordHighlight","Background color of a symbol during read-access, like reading a variable. The color must not be opaque so as not to hide underlying decorations."),!0);M("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},m("wordHighlightStrong","Background color of a symbol during write-access, like writing to a variable. The color must not be opaque so as not to hide underlying decorations."),!0);M("editor.wordHighlightTextBackground",{light:Uw,dark:Uw,hcDark:Uw,hcLight:Uw},m("wordHighlightText","Background color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0);const Gw=M("editor.wordHighlightBorder",{light:null,dark:null,hcDark:ii,hcLight:ii},m("wordHighlightBorder","Border color of a symbol during read-access, like reading a variable."));M("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:ii,hcLight:ii},m("wordHighlightStrongBorder","Border color of a symbol during write-access, like writing to a variable."));M("editor.wordHighlightTextBorder",{light:Gw,dark:Gw,hcDark:Gw,hcLight:Gw},m("wordHighlightTextBorder","Border color of a textual occurrence for a symbol."));const kwe=M("editorOverviewRuler.wordHighlightForeground",{dark:"#A0A0A0CC",light:"#A0A0A0CC",hcDark:"#A0A0A0CC",hcLight:"#A0A0A0CC"},m("overviewRulerWordHighlightForeground","Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),Dwe=M("editorOverviewRuler.wordHighlightStrongForeground",{dark:"#C0A0C0CC",light:"#C0A0C0CC",hcDark:"#C0A0C0CC",hcLight:"#C0A0C0CC"},m("overviewRulerWordHighlightStrongForeground","Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),Twe=M("editorOverviewRuler.wordHighlightTextForeground",{dark:H_,light:H_,hcDark:H_,hcLight:H_},m("overviewRulerWordHighlightTextForeground","Overview ruler marker color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0),Ewe=$e.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:pi(Dwe),position:Vo.Center},minimap:{color:pi(bL),position:1}}),Iwe=$e.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:pi(Twe),position:Vo.Center},minimap:{color:pi(bL),position:1}}),Mwe=$e.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:pi(H_),position:Vo.Center},minimap:{color:pi(bL),position:1}}),Awe=$e.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),Nwe=$e.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:pi(kwe),position:Vo.Center},minimap:{color:pi(bL),position:1}});function Rwe(o){return o===$b.Write?Ewe:o===$b.Text?Iwe:Nwe}d(Rwe,"getHighlightDecorationOptions");function Pwe(o){return o?Awe:Mwe}d(Pwe,"getSelectionHighlightDecorationOptions");fr((o,e)=>{const t=o.getColor(UR);t&&e.addRule(`.monaco-editor .selectionHighlight { background-color: ${t.transparent(.5)}; }`)});var Owe=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},Fwe=function(o,e){return function(t,i){e(t,i,o)}},fN;function eh(o,e){const t=e.filter(i=>!o.find(n=>n.equals(i)));if(t.length>=1){const i=t.map(s=>`line ${s.viewState.position.lineNumber} column ${s.viewState.position.column}`).join(", "),n=t.length===1?m("cursorAdded","Cursor added: {0}",i):m("cursorsAdded","Cursors added: {0}",i);Pl(n)}}d(eh,"announceCursorChange");class Hwe extends ue{static{d(this,"InsertCursorAbove")}constructor(){super({id:"editor.action.insertCursorAbove",label:m("mutlicursor.insertAbove","Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:I.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:T.MenubarSelectionMenu,group:"3_multi",title:m({key:"miInsertCursorAbove",comment:["&& denotes a mnemonic"]},"&&Add Cursor Above"),order:2}})}run(e,t,i){if(!t.hasModel())return;let n=!0;i&&i.logicalLine===!1&&(n=!1);const s=t._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const r=s.getCursorStates();s.setCursorStates(i.source,3,wn.addCursorUp(s,r,n)),s.revealTopMostCursor(i.source),eh(r,s.getCursorStates())}}class Vwe extends ue{static{d(this,"InsertCursorBelow")}constructor(){super({id:"editor.action.insertCursorBelow",label:m("mutlicursor.insertBelow","Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:I.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:T.MenubarSelectionMenu,group:"3_multi",title:m({key:"miInsertCursorBelow",comment:["&& denotes a mnemonic"]},"A&&dd Cursor Below"),order:3}})}run(e,t,i){if(!t.hasModel())return;let n=!0;i&&i.logicalLine===!1&&(n=!1);const s=t._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const r=s.getCursorStates();s.setCursorStates(i.source,3,wn.addCursorDown(s,r,n)),s.revealBottomMostCursor(i.source),eh(r,s.getCursorStates())}}class Wwe extends ue{static{d(this,"InsertCursorAtEndOfEachLineSelected")}constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:m("mutlicursor.insertAtEndOfEachLineSelected","Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:I.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:T.MenubarSelectionMenu,group:"3_multi",title:m({key:"miInsertCursorAtEndOfEachLineSelected",comment:["&& denotes a mnemonic"]},"Add C&&ursors to Line Ends"),order:4}})}getCursorsForSelection(e,t,i){if(!e.isEmpty()){for(let n=e.startLineNumber;n1&&i.push(new be(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn))}}run(e,t){if(!t.hasModel())return;const i=t.getModel(),n=t.getSelections(),s=t._getViewModel(),r=s.getCursorStates(),a=[];n.forEach(l=>this.getCursorsForSelection(l,i,a)),a.length>0&&t.setSelections(a),eh(r,s.getCursorStates())}}class Bwe extends ue{static{d(this,"InsertCursorAtEndOfLineSelected")}constructor(){super({id:"editor.action.addCursorsToBottom",label:m("mutlicursor.addCursorsToBottom","Add Cursors To Bottom"),alias:"Add Cursors To Bottom",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getSelections(),n=t.getModel().getLineCount(),s=[];for(let l=i[0].startLineNumber;l<=n;l++)s.push(new be(l,i[0].startColumn,l,i[0].endColumn));const r=t._getViewModel(),a=r.getCursorStates();s.length>0&&t.setSelections(s),eh(a,r.getCursorStates())}}class zwe extends ue{static{d(this,"InsertCursorAtTopOfLineSelected")}constructor(){super({id:"editor.action.addCursorsToTop",label:m("mutlicursor.addCursorsToTop","Add Cursors To Top"),alias:"Add Cursors To Top",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getSelections(),n=[];for(let a=i[0].startLineNumber;a>=1;a--)n.push(new be(a,i[0].startColumn,a,i[0].endColumn));const s=t._getViewModel(),r=s.getCursorStates();n.length>0&&t.setSelections(n),eh(r,s.getCursorStates())}}class Kw{static{d(this,"MultiCursorSessionResult")}constructor(e,t,i){this.selections=e,this.revealRange=t,this.revealScrollType=i}}class g0{static{d(this,"MultiCursorSession")}static create(e,t){if(!e.hasModel())return null;const i=t.getState();if(!e.hasTextFocus()&&i.isRevealed&&i.searchString.length>0)return new g0(e,t,!1,i.searchString,i.wholeWord,i.matchCase,null);let n=!1,s,r;const a=e.getSelections();a.length===1&&a[0].isEmpty()?(n=!0,s=!0,r=!0):(s=i.wholeWord,r=i.matchCase);const l=e.getSelection();let c,u=null;if(l.isEmpty()){const h=e.getConfiguredWordAtPosition(l.getStartPosition());if(!h)return null;c=h.word,u=new be(l.startLineNumber,h.startColumn,l.startLineNumber,h.endColumn)}else c=e.getModel().getValueInRange(l).replace(/\r\n/g,`
+`);return new g0(e,t,n,c,s,r,u)}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 Kw(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 Kw(t.slice(0,t.length-1).concat(e),e,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const n=this.currentMatch;return this.currentMatch=null,n}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findNextMatch(this.searchText,t.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(131):null,!1);return i?new be(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 Kw(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 Kw(t.slice(0,t.length-1).concat(e),e,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const n=this.currentMatch;return this.currentMatch=null,n}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findPreviousMatch(this.searchText,t.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(131):null,!1);return i?new be(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}selectAll(e){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();const t=this._editor.getModel();return e?t.findMatches(this.searchText,e,!1,this.matchCase,this.wholeWord?this._editor.getOption(131):null,!1,1073741824):t.findMatches(this.searchText,!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(131):null,!1,1073741824)}}class Vg extends W{static{d(this,"MultiCursorSelectionController")}static get(e){return e.getContribution(Vg.ID)}constructor(e){super(),this._sessionDispose=this._register(new Y),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=g0.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 be(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(!FU(this._editor.getModel(),t,n)){const r=this._editor.getModel(),a=[];for(let l=0,c=t.length;l0&&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(131):null,!1,1073741824):t=n.findMatches(i.searchString,!0,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(131):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;snew be(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn)))}}}Vg.ID="editor.contrib.multiCursorController";class Ym extends ue{static{d(this,"MultiCursorSelectionControllerAction")}run(e,t){const i=Vg.get(t);if(!i)return;const n=t._getViewModel();if(n){const s=n.getCursorStates(),r=Es.get(t);if(r)this._run(i,r);else{const a=e.get(xe).createInstance(Es,t);this._run(i,a),a.dispose()}eh(s,n.getCursorStates())}}}class Uwe extends Ym{static{d(this,"AddSelectionToNextFindMatchAction")}constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:m("addSelectionToNextFindMatch","Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:I.focus,primary:2082,weight:100},menuOpts:{menuId:T.MenubarSelectionMenu,group:"3_multi",title:m({key:"miAddSelectionToNextFindMatch",comment:["&& denotes a mnemonic"]},"Add &&Next Occurrence"),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}}class Gwe extends Ym{static{d(this,"AddSelectionToPreviousFindMatchAction")}constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:m("addSelectionToPreviousFindMatch","Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:T.MenubarSelectionMenu,group:"3_multi",title:m({key:"miAddSelectionToPreviousFindMatch",comment:["&& denotes a mnemonic"]},"Add P&&revious Occurrence"),order:6}})}_run(e,t){e.addSelectionToPreviousFindMatch(t)}}class Kwe extends Ym{static{d(this,"MoveSelectionToNextFindMatchAction")}constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:m("moveSelectionToNextFindMatch","Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:I.focus,primary:ji(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}}class $we extends Ym{static{d(this,"MoveSelectionToPreviousFindMatchAction")}constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:m("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 jwe extends Ym{static{d(this,"SelectHighlightsAction")}constructor(){super({id:"editor.action.selectHighlights",label:m("selectAllOccurrencesOfFindMatch","Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:I.focus,primary:3114,weight:100},menuOpts:{menuId:T.MenubarSelectionMenu,group:"3_multi",title:m({key:"miSelectHighlights",comment:["&& denotes a mnemonic"]},"Select All &&Occurrences"),order:7}})}_run(e,t){e.selectAll(t)}}class qwe extends Ym{static{d(this,"CompatChangeAll")}constructor(){super({id:"editor.action.changeAll",label:m("changeAll.label","Change All Occurrences"),alias:"Change All Occurrences",precondition:j.and(I.writable,I.editorTextFocus),kbOpts:{kbExpr:I.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(e,t){e.selectAll(t)}}class Ywe{static{d(this,"SelectionHighlighterState")}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 f0=fN=class extends W{static{d(this,"SelectionHighlighter")}constructor(e,t){super(),this._languageFeaturesService=t,this.editor=e,this._isEnabled=e.getOption(108),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new Pt(()=>this._update(),300)),this.state=null,this._register(e.onDidChangeConfiguration(n=>{this._isEnabled=e.getOption(108)})),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=Es.get(e);i&&this._register(i.getState().onFindReplaceStateChange(n=>{this._update()})),this.updateSoon.schedule()}_update(){this._setState(fN._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=Vg.get(i);if(!s)return null;const r=Es.get(i);if(!r)return null;let a=s.getSession(r);if(!a){const u=i.getSelections();if(u.length>1){const g=r.getState().matchCase;if(!FU(i.getModel(),u,g))return null}a=g0.create(i,r)}if(!a||a.currentMatch||/^[ \t]+$/.test(a.searchText)||a.searchText.length>200)return null;const l=r.getState(),c=l.matchCase;if(l.isRevealed){let u=l.searchString;c||(u=u.toLowerCase());let h=a.searchText;if(c||(h=h.toLowerCase()),u===h&&a.matchCase===l.matchCase&&a.wholeWord===l.wholeWord&&!l.isRegex)return null}return new Ywe(i.getModel(),a.searchText,a.matchCase,a.wholeWord?i.getOption(131):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 c=0,u=0,h=i.length,g=n.length;c=g)s.push(f),c++;else{const p=k.compareRangesUsingStarts(f,n[u]);p<0?((n[u].isEmpty()||!k.areIntersecting(f,n[u]))&&s.push(f),c++):(p>0||c++,u++)}}const r=this.editor.getOption(81)!=="off",a=this._languageFeaturesService.documentHighlightProvider.has(t)&&r,l=s.map(c=>({range:c,options:Pwe(a)}));this._decorations.set(l)}dispose(){this._setState(null),super.dispose()}};f0.ID="editor.contrib.selectionHighlighter";f0=fN=Owe([Fwe(1,me)],f0);function FU(o,e,t){const i=xV(o,e[0],!t);for(let n=1,s=e.length;n=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},n1e=function(o,e){return function(t,i){e(t,i,o)}};const uT="inline-edit";let pN=class extends W{static{d(this,"GhostTextWidget")}constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=gt(this,!1),this.currentTextModel=Mt(this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=Be(this,n=>{var s;if(this.isDisposed.read(n))return;const r=this.currentTextModel.read(n);if(r!==this.model.targetTextModel.read(n))return;const a=this.model.ghostText.read(n);if(!a)return;let l=(s=this.model.range)===null||s===void 0?void 0:s.read(n);l&&l.startLineNumber===l.endLineNumber&&l.startColumn===l.endColumn&&(l=void 0);const c=(l?l.startLineNumber===l.endLineNumber:!0)&&a.parts.length===1&&a.parts[0].lines.length===1,u=a.parts.length===1&&a.parts[0].lines.every(w=>w.length===0),h=[],g=[];function f(w,S){if(g.length>0){const y=g[g.length-1];S&&y.decorations.push(new Ss(y.content.length+1,y.content.length+1+w[0].length,S,0)),y.content+=w[0],w=w.slice(1)}for(const y of w)g.push({content:y,decorations:S?[new Ss(1,y.length+1,S,0)]:[]})}d(f,"addToAdditionalLines");const p=r.getLineContent(a.lineNumber);let _,b=0;if(!u){for(const w of a.parts){let S=w.lines;l&&!c&&(f(S,uT),S=[]),_===void 0?(h.push({column:w.column,text:S[0],preview:w.preview}),S=S.slice(1)):f([p.substring(b,w.column-1)],void 0),S.length>0&&(f(S,uT),_===void 0&&w.column<=p.length&&(_=w.column)),b=w.column-1}_!==void 0&&f([p.substring(b)],void 0)}const v=_!==void 0?new mU(_,p.length+1):void 0,C=c||!l?a.lineNumber:l.endLineNumber-1;return{inlineTexts:h,additionalLines:g,hiddenRange:v,lineNumber:C,additionalReservedLineCount:this.model.minReservedLineCount.read(n),targetTextModel:r,range:l,isSingleLine:c,isPureRemove:u,backgroundColoring:this.model.backgroundColoring.read(n)}}),this.decorations=Be(this,n=>{const s=this.uiState.read(n);if(!s)return[];const r=[];if(s.hiddenRange&&r.push({range:s.hiddenRange.toRange(s.lineNumber),options:{inlineClassName:"inline-edit-hidden",description:"inline-edit-hidden"}}),s.range){const a=[];if(s.isSingleLine)a.push(s.range);else if(s.isPureRemove){const c=s.range.endLineNumber-s.range.startLineNumber;for(let u=0;u{const s=this.uiState.read(n);return s&&!s.isPureRemove?{lineNumber:s.lineNumber,additionalLines:s.additionalLines,minReservedLineCount:s.additionalReservedLineCount,targetTextModel:s.targetTextModel}:void 0}))),this._register(we(()=>{this.isDisposed.set(!0,void 0)})),this._register(_U(this.editor,this.decorations))}ownsViewZone(e){return this.additionalLinesWidget.viewZoneId===e}};pN=i1e([n1e(2,oi)],pN);var nO=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},dl=function(o,e){return function(t,i){e(t,i,o)}},A1;let mN=class extends W{static{d(this,"InlineEditHintsWidget")}constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Mt(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).showToolbar==="always"),this.sessionPosition=void 0,this.position=Be(this,n=>{var s,r,a;const l=(s=this.model.read(n))===null||s===void 0?void 0:s.widget.model.ghostText.read(n);if(!this.alwaysShowToolbar.read(n)||!l||l.parts.length===0)return this.sessionPosition=void 0,null;const c=l.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==l.lineNumber&&(this.sessionPosition=void 0);const u=new H(l.lineNumber,Math.min(c,(a=(r=this.sessionPosition)===null||r===void 0?void 0:r.column)!==null&&a!==void 0?a:Number.MAX_SAFE_INTEGER));return this.sessionPosition=u,u}),this._register(hr((n,s)=>{if(!this.model.read(n)||!this.alwaysShowToolbar.read(n))return;const a=s.add(this.instantiationService.createInstance(xm,this.editor,!0,this.position));e.addContentWidget(a),s.add(we(()=>e.removeContentWidget(a)))}))}};mN=nO([dl(2,xe)],mN);let xm=A1=class extends W{static{d(this,"InlineEditHintsContentWidget")}constructor(e,t,i,n,s,r){super(),this.editor=e,this.withBorder=t,this._position=i,this._contextKeyService=s,this._menuService=r,this.id=`InlineEditHintsContentWidget${A1.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Ct("div.inlineEditHints",{className:this.withBorder?".withBorder":""},[Ct("div@toolBar")]),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(T.InlineEditActions,this._contextKeyService)),this.toolBar=this._register(n.createInstance(_N,this.nodes.toolBar,this.editor,T.InlineEditToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:d(a=>a.startsWith("primary"),"primaryGroup")},actionViewItemProvider:d((a,l)=>{if(a instanceof oo)return n.createInstance(s1e,a,void 0)},"actionViewItemProvider"),telemetrySource:"InlineEditToolbar"})),this._register(this.toolBar.onDidChangeDropdownVisibility(a=>{A1._dropDownVisible=a})),this._register(Je(a=>{this._position.read(a),this.editor.layoutContentWidget(this)})),this._register(Je(a=>{const l=[];for(const[c,u]of this.inlineCompletionsActionsMenus.getActions())for(const h of u)h instanceof oo&&l.push(h);l.length>0&&l.unshift(new $i),this.toolBar.setAdditionalSecondaryActions(l)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};xm._dropDownVisible=!1;xm.id=0;xm=A1=nO([dl(3,xe),dl(4,Ne),dl(5,Uo)],xm);class s1e extends Iu{static{d(this,"StatusBarViewItem")}updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Ct("div.keybinding").root;this._register(new Bm(t,io,{disableTitle:!0,...A8})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineEditStatusBarItemLabel")}}updateTooltip(){}}let _N=class extends Uv{static{d(this,"CustomizedMenuWorkbenchToolBar")}constructor(e,t,i,n,s,r,a,l,c,u){super(e,{resetMenu:i,...n},s,r,a,l,c,u),this.editor=t,this.menuId=i,this.options2=n,this.menuService=s,this.contextKeyService=r,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._store.add(this.editor.onDidChangeCursorPosition(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){var e,t,i,n,s,r,a;const l=[],c=[];jL(this.menu,(e=this.options2)===null||e===void 0?void 0:e.menuOptions,{primary:l,secondary:c},(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),c.push(...this.additionalActions),l.unshift(...this.prependedPrimaryActions),this.setActions(l,c)}setAdditionalSecondaryActions(e){ci(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};_N=nO([dl(4,Uo),dl(5,Ne),dl(6,fo),dl(7,yt),dl(8,Qt),dl(9,Vn)],_N);var o1e=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},I_=function(o,e){return function(t,i){e(t,i,o)}},Yh;class r1e{static{d(this,"InlineEditWidget")}constructor(e,t){this.widget=e,this.edit=t}dispose(){this.widget.dispose()}}let Qi=Yh=class extends W{static{d(this,"InlineEditController")}static get(e){return e.getContribution(Yh.ID)}constructor(e,t,i,n,s,r){super(),this.editor=e,this.instantiationService=t,this.contextKeyService=i,this.languageFeaturesService=n,this._commandService=s,this._configurationService=r,this._isVisibleContext=Yh.inlineEditVisibleContext.bindTo(this.contextKeyService),this._isCursorAtInlineEditContext=Yh.cursorAtInlineEditContext.bindTo(this.contextKeyService),this._currentEdit=this._register(Iv(this,void 0)),this._isAccepting=gt(this,!1),this._enabled=Mt(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).enabled),this._fontFamily=Mt(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).fontFamily),this._backgroundColoring=Mt(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).backgroundColoring);const a=Kn("InlineEditController.modelContentChangedSignal",e.onDidChangeModelContent);this._register(Je(g=>{this._enabled.read(g)&&(a.read(g),!this._isAccepting.read(g)&&this.getInlineEdit(e,!0))}));const l=Mt(e.onDidChangeCursorPosition,()=>e.getPosition());this._register(Je(g=>{if(!this._enabled.read(g))return;const f=l.read(g);f&&this.checkCursorPosition(f)})),this._register(Je(g=>{const f=this._currentEdit.read(g);if(this._isCursorAtInlineEditContext.set(!1),!f){this._isVisibleContext.set(!1);return}this._isVisibleContext.set(!0);const p=e.getPosition();p&&this.checkCursorPosition(p)}));const c=Kn("InlineEditController.editorBlurSignal",e.onDidBlurEditorWidget);this._register(Je(async g=>{var f;this._enabled.read(g)&&(c.read(g),!(this._configurationService.getValue("editor.experimentalInlineEdit.keepOnBlur")||e.getOption(63).keepOnBlur)&&((f=this._currentRequestCts)===null||f===void 0||f.dispose(!0),this._currentRequestCts=void 0,await this.clear(!1)))}));const u=Kn("InlineEditController.editorFocusSignal",e.onDidFocusEditorText);this._register(Je(g=>{this._enabled.read(g)&&(u.read(g),this.getInlineEdit(e,!0))}));const h=this._register(eB());this._register(Je(g=>{const f=this._fontFamily.read(g);h.setStyle(f===""||f==="default"?"":`
+.monaco-editor .inline-edit-decoration,
+.monaco-editor .inline-edit-decoration-preview,
+.monaco-editor .inline-edit {
+ font-family: ${f};
+}`)})),this._register(new mN(this.editor,this._currentEdit,this.instantiationService))}checkCursorPosition(e){var t;if(!this._currentEdit){this._isCursorAtInlineEditContext.set(!1);return}const i=(t=this._currentEdit.get())===null||t===void 0?void 0:t.edit;if(!i){this._isCursorAtInlineEditContext.set(!1);return}this._isCursorAtInlineEditContext.set(k.containsPosition(i.range,e))}validateInlineEdit(e,t){var i,n;if(t.text.includes(`
+`)&&t.range.startLineNumber!==t.range.endLineNumber&&t.range.startColumn!==t.range.endColumn){if(t.range.startColumn!==1)return!1;const r=t.range.endLineNumber,a=t.range.endColumn,l=(n=(i=e.getModel())===null||i===void 0?void 0:i.getLineLength(r))!==null&&n!==void 0?n:0;if(a!==l+1)return!1}return!0}async fetchInlineEdit(e,t){this._currentRequestCts&&this._currentRequestCts.dispose(!0);const i=e.getModel();if(!i)return;const n=i.getVersionId(),s=this.languageFeaturesService.inlineEditProvider.all(i);if(s.length===0)return;const r=s[0];this._currentRequestCts=new ui;const a=this._currentRequestCts.token,l=t?K1.Automatic:K1.Invoke;if(t&&await a1e(50,a),a.isCancellationRequested||i.isDisposed()||i.getVersionId()!==n)return;const u=await r.provideInlineEdit(i,{triggerKind:l},a);if(u&&!(a.isCancellationRequested||i.isDisposed()||i.getVersionId()!==n)&&this.validateInlineEdit(e,u))return u}async getInlineEdit(e,t){var i;this._isCursorAtInlineEditContext.set(!1),await this.clear();const n=await this.fetchInlineEdit(e,t);if(!n)return;const s=n.range.endLineNumber,r=n.range.endColumn,a=n.text.endsWith(`
+`)&&!(n.range.startLineNumber===n.range.endLineNumber&&n.range.startColumn===n.range.endColumn)?n.text.slice(0,-1):n.text,l=new o0(s,[new My(r,a,!1)]),c=this.instantiationService.createInstance(pN,this.editor,{ghostText:ma(l),minReservedLineCount:ma(0),targetTextModel:ma((i=this.editor.getModel())!==null&&i!==void 0?i:void 0),range:ma(n.range),backgroundColoring:this._backgroundColoring});this._currentEdit.set(new r1e(c,n),void 0)}async trigger(){await this.getInlineEdit(this.editor,!1)}async jumpBack(){this._jumpBackPosition&&(this.editor.setPosition(this._jumpBackPosition),this.editor.revealPositionInCenterIfOutsideViewport(this._jumpBackPosition))}async accept(){var e;this._isAccepting.set(!0,void 0);const t=(e=this._currentEdit.get())===null||e===void 0?void 0:e.edit;if(!t)return;let i=t.text;t.text.startsWith(`
+`)&&(i=t.text.substring(1)),this.editor.pushUndoStop(),this.editor.executeEdits("acceptCurrent",[ai.replace(k.lift(t.range),i)]),t.accepted&&await this._commandService.executeCommand(t.accepted.id,...t.accepted.arguments||[]).then(void 0,Li),this.freeEdit(t),Wt(n=>{this._currentEdit.set(void 0,n),this._isAccepting.set(!1,n)})}jumpToCurrent(){var e,t;this._jumpBackPosition=(e=this.editor.getSelection())===null||e===void 0?void 0:e.getStartPosition();const i=(t=this._currentEdit.get())===null||t===void 0?void 0:t.edit;if(!i)return;const n=H.lift({lineNumber:i.range.startLineNumber,column:i.range.startColumn});this.editor.setPosition(n),this.editor.revealPositionInCenterIfOutsideViewport(n)}async clear(e=!0){var t;const i=(t=this._currentEdit.get())===null||t===void 0?void 0:t.edit;i&&i?.rejected&&e&&await this._commandService.executeCommand(i.rejected.id,...i.rejected.arguments||[]).then(void 0,Li),i&&this.freeEdit(i),this._currentEdit.set(void 0,void 0)}freeEdit(e){const t=this.editor.getModel();if(!t)return;const i=this.languageFeaturesService.inlineEditProvider.all(t);i.length!==0&&i[0].freeInlineEdit(e)}shouldShowHoverAt(e){const t=this._currentEdit.get();if(!t)return!1;const i=t.edit,n=t.widget.model;if(k.containsPosition(i.range,e.getStartPosition())||k.containsPosition(i.range,e.getEndPosition()))return!0;const r=n.ghostText.get();return r?r.parts.some(a=>e.containsPosition(new H(r.lineNumber,a.column))):!1}shouldShowHoverAtViewZone(e){var t,i;return(i=(t=this._currentEdit.get())===null||t===void 0?void 0:t.widget.ownsViewZone(e))!==null&&i!==void 0?i:!1}};Qi.ID="editor.contrib.inlineEditController";Qi.inlineEditVisibleKey="inlineEditVisible";Qi.inlineEditVisibleContext=new ce(Yh.inlineEditVisibleKey,!1);Qi.cursorAtInlineEditKey="cursorAtInlineEdit";Qi.cursorAtInlineEditContext=new ce(Yh.cursorAtInlineEditKey,!1);Qi=Yh=o1e([I_(1,xe),I_(2,Ne),I_(3,me),I_(4,Qt),I_(5,et)],Qi);function a1e(o,e){return new Promise(t=>{let i;const n=setTimeout(()=>{i&&i.dispose(),t()},o);e&&(i=e.onCancellationRequested(()=>{clearTimeout(n),i&&i.dispose(),t()}))})}d(a1e,"wait");class l1e extends ue{static{d(this,"AcceptInlineEdit")}constructor(){super({id:Qwe,label:"Accept Inline Edit",alias:"Accept Inline Edit",precondition:j.and(I.writable,Qi.inlineEditVisibleContext),kbOpts:[{weight:101,primary:2,kbExpr:j.and(I.writable,Qi.inlineEditVisibleContext,Qi.cursorAtInlineEditContext)}],menuOpts:[{menuId:T.InlineEditToolbar,title:"Accept",group:"primary",order:1}]})}async run(e,t){const i=Qi.get(t);await i?.accept()}}class d1e extends ue{static{d(this,"TriggerInlineEdit")}constructor(){const e=j.and(I.writable,j.not(Qi.inlineEditVisibleKey));super({id:"editor.action.inlineEdit.trigger",label:"Trigger Inline Edit",alias:"Trigger Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e}})}async run(e,t){const i=Qi.get(t);i?.trigger()}}class c1e extends ue{static{d(this,"JumpToInlineEdit")}constructor(){const e=j.and(I.writable,Qi.inlineEditVisibleContext,j.not(Qi.cursorAtInlineEditKey));super({id:e1e,label:"Jump to Inline Edit",alias:"Jump to Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e},menuOpts:[{menuId:T.InlineEditToolbar,title:"Jump To Edit",group:"primary",order:3,when:e}]})}async run(e,t){const i=Qi.get(t);i?.jumpToCurrent()}}class u1e extends ue{static{d(this,"JumpBackInlineEdit")}constructor(){const e=j.and(I.writable,Qi.cursorAtInlineEditContext);super({id:t1e,label:"Jump Back from Inline Edit",alias:"Jump Back from Inline Edit",precondition:e,kbOpts:{weight:110,primary:2646,kbExpr:e},menuOpts:[{menuId:T.InlineEditToolbar,title:"Jump Back",group:"primary",order:3,when:e}]})}async run(e,t){const i=Qi.get(t);i?.jumpBack()}}class h1e extends ue{static{d(this,"RejectInlineEdit")}constructor(){const e=j.and(I.writable,Qi.inlineEditVisibleContext);super({id:Jwe,label:"Reject Inline Edit",alias:"Reject Inline Edit",precondition:e,kbOpts:{weight:100,primary:9,kbExpr:e},menuOpts:[{menuId:T.InlineEditToolbar,title:"Reject",group:"secondary",order:2}]})}async run(e,t){const i=Qi.get(t);await i?.clear()}}var g1e=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},kV=function(o,e){return function(t,i){e(t,i,o)}};class f1e{static{d(this,"InlineEditHover")}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 bN=class{static{d(this,"InlineEditHoverParticipant")}constructor(e,t,i){this._editor=e,this._instantiationService=t,this._telemetryService=i,this.hoverOrdinal=5}suggestHoverAnchor(e){const t=Qi.get(this._editor);if(!t)return null;const i=e.target;if(i.type===8){const n=i.detail;if(t.shouldShowHoverAtViewZone(n.viewZoneId)){const s=i.range;return new og(1e3,this,s,e.event.posx,e.event.posy,!1)}}return i.type===7&&t.shouldShowHoverAt(i.range)?new og(1e3,this,i.range,e.event.posx,e.event.posy,!1):i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range)?new og(1e3,this,i.range,e.event.posx,e.event.posy,!1):null}computeSync(e,t){if(this._editor.getOption(63).showToolbar!=="onHover")return[];const i=Qi.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new f1e(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new Y;this._telemetryService.publicLog2("inlineEditHover.shown");const n=this._instantiationService.createInstance(xm,this._editor,!1,ma(null));return e.fragment.appendChild(n.getDomNode()),i.add(n),i}};bN=g1e([kV(1,xe),kV(2,Vn)],bN);ee(l1e);ee(h1e);ee(c1e);ee(u1e);ee(d1e);vt(Qi.ID,Qi,3);Ju.register(bN);const Wg={Visible:new ce("parameterHintsVisible",!1),MultipleSignatures:new ce("parameterHintsMultipleSignatures",!1)};async function HU(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){Li(a)}}d(HU,"provideSignatureHelp");ut.registerCommand("_executeSignatureHelpProvider",async(o,...e)=>{const[t,i,n]=e;_t(Te.isUri(t)),_t(H.isIPosition(i)),_t(typeof n=="string"||!n);const s=o.get(me),r=await o.get(Ys).createModelReference(t);try{const a=await HU(s.signatureHelpProvider,r.object.textEditorModel,H.lift(i),{triggerKind:Dl.Invoke,isRetrigger:!1,triggerCharacter:n},ot.None);return a?(setTimeout(()=>a.dispose(),0),a.value):void 0}finally{r.dispose()}});var Ac;(function(o){o.Default={type:0};class e{static{d(this,"Pending")}constructor(n,s){this.request=n,this.previouslyActiveHints=s,this.type=2}}o.Pending=e;class t{static{d(this,"Active")}constructor(n){this.hints=n,this.type=1}}o.Active=t})(Ac||(Ac={}));class Zx extends W{static{d(this,"ParameterHintsModel")}constructor(e,t,i=Zx.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new F),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=Ac.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new dn),this.triggerChars=new nS,this.retriggerChars=new nS,this.triggerId=0,this.editor=e,this.providers=t,this.throttledDelayer=new zr(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=Ac.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(Ue)}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(86).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(86).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 Ac.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(p1e);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 Ac.Pending(ln(l=>HU(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 Ac.Active(l.value),this._lastSignatureHelpResult.value=l,this._onChangedHints.fire(this.state.hints),!0)}catch(l){return e===this.triggerId&&(this.state=Ac.Default),Ue(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:Dl.TriggerCharacter,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:Dl.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:Dl.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(86).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}}Zx.DEFAULT_DELAY=120;function p1e(o,e){switch(e.triggerKind){case Dl.Invoke:return e;case Dl.ContentChange:return o;case Dl.TriggerCharacter:default:return e}}d(p1e,"mergeTriggerContexts");var m1e=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},$w=function(o,e){return function(t,i){e(t,i,o)}},vN;const _o=ie,_1e=bi("parameter-hints-next",re.chevronDown,m("parameterHintsNextIcon","Icon for show next parameter hint.")),b1e=bi("parameter-hints-previous",re.chevronUp,m("parameterHintsPreviousIcon","Icon for show previous parameter hint."));let Hy=vN=class extends W{static{d(this,"ParameterHintsWidget")}constructor(e,t,i,n,s,r){super(),this.editor=e,this.model=t,this.telemetryService=r,this.renderDisposeables=this._register(new Y),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new Hl({editor:e},s,n)),this.keyVisible=Wg.Visible.bindTo(i),this.keyMultipleSignatures=Wg.MultipleSignatures.bindTo(i)}createParameterHintDOMNodes(){const e=_o(".editor-widget.parameter-hints-widget"),t=Q(e,_o(".phwrapper"));t.tabIndex=-1;const i=Q(t,_o(".controls")),n=Q(i,_o(".button"+Ae.asCSSSelector(b1e))),s=Q(i,_o(".overloads")),r=Q(i,_o(".button"+Ae.asCSSSelector(_1e)));this._register(G(n,"click",g=>{dt.stop(g),this.previous()})),this._register(G(r,"click",g=>{dt.stop(g),this.next()}));const a=_o(".body"),l=new V0(a,{alwaysConsumeMouseWheel:!0});this._register(l),t.appendChild(l.getDomNode());const c=Q(a,_o(".signature")),u=Q(a,_o(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:c,overloads:s,docs:u,scrollbar:l},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(g=>{this.visible&&this.editor.layoutContentWidget(this)}));const h=d(()=>{if(!this.domNodes)return;const g=this.editor.getOption(50);this.domNodes.element.style.fontSize=`${g.fontSize}px`,this.domNodes.element.style.lineHeight=`${g.lineHeight/g.fontSize}`},"updateFont");h(),this._register(le.chain(this.editor.onDidChangeConfiguration.bind(this.editor),g=>g.filter(f=>f.hasChanged(50)))(h)),this._register(this.editor.onDidLayoutChange(g=>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=Q(this.domNodes.signature,_o(".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=Q(s,_o("span"));h.textContent=n.label}const c=n.parameters[l];if(c?.documentation){const h=_o("span.documentation");if(typeof c.documentation=="string")h.textContent=c.documentation;else{const g=this.renderMarkdownDocs(c.documentation);h.appendChild(g.element)}Q(this.domNodes.docs,_o("p",{},h))}if(n.documentation!==void 0)if(typeof n.documentation=="string")Q(this.domNodes.docs,_o("p",{},n.documentation));else{const h=this.renderMarkdownDocs(n.documentation);Q(this.domNodes.docs,h.element)}const u=this.hasDocs(n,c);if(this.domNodes.signature.classList.toggle("has-docs",u),this.domNodes.docs.classList.toggle("empty",!u),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,"0")+"/"+e.signatures.length,c){let h="";const g=n.parameters[l];Array.isArray(g.label)?h=n.label.substring(g.label[0],g.label[1]):h=g.label,g.documentation&&(h+=typeof g.documentation=="string"?`, ${g.documentation}`:`, ${g.documentation.value}`),n.documentation&&(h+=typeof n.documentation=="string"?`, ${n.documentation}`:`, ${n.documentation.value}`),this.announcedLabel!==h&&($s(m("hint","{0}, hint",h)),this.announcedLabel=h)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){const t=new En,i=this.renderDisposeables.add(this.markdownRenderer.render(e,{asyncRenderCallback:d(()=>{var s;(s=this.domNodes)===null||s===void 0||s.scrollbar.scanDomNode()},"asyncRenderCallback")}));i.element.classList.add("markdown-docs");const n=t.elapsed();return n>300&&this.telemetryService.publicLog2("parameterHints.parseMarkdown",{renderDuration:n}),i}hasDocs(e,t){return!!(t&&typeof t.documentation=="string"&&Bc(t.documentation).length>0||t&&typeof t.documentation=="object"&&Bc(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&Bc(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&Bc(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),Q(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|^)${Fo(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 vN.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)}};Hy.ID="editor.widget.parameterHintsWidget";Hy=vN=m1e([$w(2,Ne),$w(3,po),$w(4,oi),$w(5,Vn)],Hy);M("editorHoverWidget.highlightForeground",{dark:Fr,light:Fr,hcDark:Fr,hcLight:Fr},m("editorHoverWidgetHighlightForeground","Foreground color of the active item in the parameter hint."));var v1e=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},DV=function(o,e){return function(t,i){e(t,i,o)}},CN;let Bg=CN=class extends W{static{d(this,"ParameterHintsController")}static get(e){return e.getContribution(CN.ID)}constructor(e,t,i){super(),this.editor=e,this.model=this._register(new Zx(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 Kr(()=>this._register(t.createInstance(Hy,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)}};Bg.ID="editor.controller.parameterHints";Bg=CN=v1e([DV(1,xe),DV(2,me)],Bg);class C1e extends ue{static{d(this,"TriggerParameterHintsAction")}constructor(){super({id:"editor.action.triggerParameterHints",label:m("parameterHints.trigger.label","Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:I.hasSignatureHelpProvider,kbOpts:{kbExpr:I.editorTextFocus,primary:3082,weight:100}})}run(e,t){const i=Bg.get(t);i?.trigger({triggerKind:Dl.Invoke})}}vt(Bg.ID,Bg,2);ee(C1e);const sO=175,oO=Ji.bindToContribution(Bg.get);de(new oO({id:"closeParameterHints",precondition:Wg.Visible,handler:d(o=>o.cancel(),"handler"),kbOpts:{weight:sO,kbExpr:I.focus,primary:9,secondary:[1033]}}));de(new oO({id:"showPrevParameterHint",precondition:j.and(Wg.Visible,Wg.MultipleSignatures),handler:d(o=>o.previous(),"handler"),kbOpts:{weight:sO,kbExpr:I.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));de(new oO({id:"showNextParameterHint",precondition:j.and(Wg.Visible,Wg.MultipleSignatures),handler:d(o=>o.next(),"handler"),kbOpts:{weight:sO,kbExpr:I.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var w1e=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)}};const Xm=new ce("renameInputVisible",!1,m("renameInputVisible","Whether the rename input widget is visible"));new ce("renameInputFocused",!1,m("renameInputFocused","Whether the rename input widget is focused"));let wN=class{static{d(this,"RenameWidget")}constructor(e,t,i,n,s,r){this._editor=e,this._acceptKeybindings=t,this._themeService=i,this._keybindingService=n,this._logService=r,this.allowEditorOverflow=!0,this._disposables=new Y,this._visibleContextKey=Xm.bindTo(s),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new En,this._inputWithButton=new S1e,this._disposables.add(this._inputWithButton),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{a.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._domNode.appendChild(this._inputWithButton.domNode),this._renameCandidateListView=this._disposables.add(new rO(this._domNode,{fontInfo:this._editor.getOption(50),onFocusChange:d(e=>{this._inputWithButton.input.value=e,this._isEditingRenameCandidate=!1},"onFocusChange"),onSelectionChange:d(()=>{this._isEditingRenameCandidate=!1,this.acceptInput(!1)},"onSelectionChange")})),this._disposables.add(this._inputWithButton.onDidInputChange(()=>{var e,t,i,n;((e=this._renameCandidateListView)===null||e===void 0?void 0:e.focusedCandidate)!==void 0&&(this._isEditingRenameCandidate=!0),(t=this._timeBeforeFirstInputFieldEdit)!==null&&t!==void 0||(this._timeBeforeFirstInputFieldEdit=this._beforeFirstInputFieldEditSW.elapsed()),((i=this._renameCandidateProvidersCts)===null||i===void 0?void 0:i.token.isCancellationRequested)===!1&&this._renameCandidateProvidersCts.cancel(),(n=this._renameCandidateListView)===null||n===void 0||n.clearFocus()})),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,r;if(!this._domNode)return;const a=e.getColor(Ad),l=e.getColor(ZB);this._domNode.style.backgroundColor=String((t=e.getColor(Ai))!==null&&t!==void 0?t:""),this._domNode.style.boxShadow=a?` 0 0 8px 2px ${a}`:"",this._domNode.style.border=l?`1px solid ${l}`:"",this._domNode.style.color=String((i=e.getColor(JB))!==null&&i!==void 0?i:"");const c=e.getColor(e7);this._inputWithButton.domNode.style.backgroundColor=String((n=e.getColor(eI))!==null&&n!==void 0?n:""),this._inputWithButton.input.style.backgroundColor=String((s=e.getColor(eI))!==null&&s!==void 0?s:""),this._inputWithButton.domNode.style.borderWidth=c?"1px":"0px",this._inputWithButton.domNode.style.borderStyle=c?"solid":"none",this._inputWithButton.domNode.style.borderColor=(r=c?.toString())!==null&&r!==void 0?r:"none"}_updateFont(){if(this._domNode===void 0)return;_t(this._label!==void 0,"RenameWidget#_updateFont: _label must not be undefined given _domNode is defined"),this._editor.applyFontInfo(this._inputWithButton.input);const e=this._editor.getOption(50);this._label.style.fontSize=`${this._computeLabelFontSize(e.fontSize)}px`}_computeLabelFontSize(e){return e*.8}getPosition(){if(!this._visible||!this._editor.hasModel()||!this._editor.getDomNode())return null;const e=ec(this.getDomNode().ownerDocument.body),t=Fi(this._editor.getDomNode()),i=this._getTopForPosition();this._nPxAvailableAbove=i+t.top,this._nPxAvailableBelow=e.height-this._nPxAvailableAbove;const n=this._editor.getOption(67),{totalHeight:s}=zg.getLayoutInfo({lineHeight:n}),r=this._nPxAvailableBelow>s*6?[2,1]:[1,2];return{position:this._position,preference:r}}beforeRender(){var e,t;const[i,n]=this._acceptKeybindings;return this._label.innerText=m({key:"label",comment:['placeholders are keybindings, e.g "F2 to Rename, Shift+F2 to Preview"']},"{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()),this._domNode.style.minWidth="200px",null}afterRender(e){if(this._trace("invoking afterRender, position: ",e?"not null":"null"),e===null){this.cancelInput(!0,"afterRender (because position is null)");return}if(!this._editor.hasModel()||!this._editor.getDomNode())return;_t(this._renameCandidateListView),_t(this._nPxAvailableAbove!==void 0),_t(this._nPxAvailableBelow!==void 0);const t=xd(this._inputWithButton.domNode),i=xd(this._label);let n;e===2?n=this._nPxAvailableBelow:n=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:n-i-t,width:Js(this._inputWithButton.domNode)})}acceptInput(e){var t;this._trace("invoking acceptInput"),(t=this._currentAcceptInput)===null||t===void 0||t.call(this,e)}cancelInput(e,t){var i;this._trace(`invoking cancelInput, caller: ${t}, _currentCancelInput: ${this._currentAcceptInput?"not undefined":"undefined"}`),(i=this._currentCancelInput)===null||i===void 0||i.call(this,e)}focusNextRenameSuggestion(){var e;!((e=this._renameCandidateListView)===null||e===void 0)&&e.focusNext()||(this._inputWithButton.input.value=this._currentName)}focusPreviousRenameSuggestion(){var e;!((e=this._renameCandidateListView)===null||e===void 0)&&e.focusPrevious()||(this._inputWithButton.input.value=this._currentName)}getInput(e,t,i,n,s){const{start:r,end:a}=this._getSelection(e,t);this._renameCts=s;const l=new Y;this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,n===void 0?this._inputWithButton.button.style.display="none":(this._inputWithButton.button.style.display="flex",this._requestRenameCandidatesOnce=n,this._requestRenameCandidates(t,!1),l.add(G(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(t,!0))),l.add(G(this._inputWithButton.button,te.KEY_DOWN,u=>{const h=new Bt(u);(h.equals(3)||h.equals(10))&&(h.stopPropagation(),h.preventDefault(),this._requestRenameCandidates(t,!0))}))),this._isEditingRenameCandidate=!1,this._domNode.classList.toggle("preview",i),this._position=new H(e.startLineNumber,e.startColumn),this._currentName=t,this._inputWithButton.input.value=t,this._inputWithButton.input.setAttribute("selectionStart",r.toString()),this._inputWithButton.input.setAttribute("selectionEnd",a.toString()),this._inputWithButton.input.size=Math.max((e.endColumn-e.startColumn)*1.1,20),this._beforeFirstInputFieldEditSW.reset(),l.add(we(()=>{this._renameCts=void 0,s.dispose(!0)})),l.add(we(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),l.add(we(()=>this._candidates.clear()));const c=new I0;return c.p.finally(()=>{l.dispose(),this._hide()}),this._currentCancelInput=u=>{var h;return this._trace("invoking _currentCancelInput"),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,(h=this._renameCandidateListView)===null||h===void 0||h.clearCandidates(),c.complete(u),!0},this._currentAcceptInput=u=>{this._trace("invoking _currentAcceptInput"),_t(this._renameCandidateListView!==void 0);const h=this._renameCandidateListView.nCandidates;let g,f;const p=this._renameCandidateListView.focusedCandidate;if(p!==void 0?(this._trace("using new name from renameSuggestion"),g=p,f={k:"renameSuggestion"}):(this._trace("using new name from inputField"),g=this._inputWithButton.input.value,f=this._isEditingRenameCandidate?{k:"userEditedRenameSuggestion"}:{k:"inputField"}),g===t||g.trim().length===0){this.cancelInput(!0,"_currentAcceptInput (because newName === value || newName.trim().length === 0)");return}this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView.clearCandidates(),c.complete({newName:g,wantsPreview:i&&u,stats:{source:f,nRenameSuggestions:h,timeBeforeFirstInputFieldEdit:this._timeBeforeFirstInputFieldEdit,nRenameSuggestionsInvocations:this._nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:this._hadAutomaticRenameSuggestionsInvocation}})},l.add(s.token.onCancellationRequested(()=>this.cancelInput(!0,"cts.token.onCancellationRequested"))),l.add(this._editor.onDidBlurEditorWidget(()=>{var u;return this.cancelInput(!(!((u=this._domNode)===null||u===void 0)&&u.ownerDocument.hasFocus()),"editor.onDidBlurEditorWidget")})),this._show(),c.p}_requestRenameCandidates(e,t){if(this._requestRenameCandidatesOnce!==void 0&&(this._renameCandidateProvidersCts!==void 0&&this._renameCandidateProvidersCts.dispose(!0),_t(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new ui;const i=t?jb.Invoke:jb.Automatic,n=this._requestRenameCandidatesOnce(i,this._renameCandidateProvidersCts.token);if(n.length===0){this._inputWithButton.setSparkleButton();return}t||(this._hadAutomaticRenameSuggestionsInvocation=!0),this._nRenameSuggestionsInvocations+=1,this._inputWithButton.setStopButton(),this._updateRenameCandidates(n,e,this._renameCts.token)}}_getSelection(e,t){_t(this._editor.hasModel());const i=this._editor.getSelection();let n=0,s=t.length;return!k.isEmpty(i)&&!k.spansMultipleLines(i)&&k.containsRange(e,i)&&(n=Math.max(0,i.startColumn-e.startColumn),s=Math.min(e.endColumn,i.endColumn)-e.startColumn),{start:n,end:s}}_show(){this._trace("invoking _show"),this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout(()=>{this._inputWithButton.input.focus(),this._inputWithButton.input.setSelectionRange(parseInt(this._inputWithButton.input.getAttribute("selectionStart")),parseInt(this._inputWithButton.input.getAttribute("selectionEnd")))},100)}async _updateRenameCandidates(e,t,i){const n=d((...c)=>this._trace("_updateRenameCandidates",...c),"trace");n("start");const s=await E0(Promise.allSettled(e),i);if(this._inputWithButton.setSparkleButton(),s===void 0){n("returning early - received updateRenameCandidates results - undefined");return}const r=s.flatMap(c=>c.status==="fulfilled"&&kl(c.value)?c.value:[]);n(`received updateRenameCandidates results - total (unfiltered) ${r.length} candidates.`);const a=Yd(r,c=>c.newSymbolName);n(`distinct candidates - ${a.length} candidates.`);const l=a.filter(({newSymbolName:c})=>c.trim().length>0&&c!==this._inputWithButton.input.value&&c!==t&&!this._candidates.has(c));if(n(`valid distinct candidates - ${r.length} candidates.`),l.forEach(c=>this._candidates.add(c.newSymbolName)),l.length<1){n("returning early - no valid distinct candidates");return}n("setting candidates"),this._renameCandidateListView.setCandidates(l),n("asking editor to re-layout"),this._editor.layoutContentWidget(this)}_hide(){this._trace("invoked _hide"),this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}_getTopForPosition(){const e=this._editor.getVisibleRanges();let t;return e.length>0?t=e[0].startLineNumber:(this._logService.warn("RenameWidget#_getTopForPosition: this should not happen - visibleRanges is empty"),t=Math.max(1,this._position.lineNumber-5)),this._editor.getTopForLineNumber(this._position.lineNumber)-this._editor.getTopForLineNumber(t)}_trace(...e){this._logService.trace("RenameWidget",...e)}};wN=w1e([jw(2,en),jw(3,yt),jw(4,Ne),jw(5,qn)],wN);class rO{static{d(this,"RenameCandidateListView")}constructor(e,t){this._disposables=new Y,this._availableHeight=0,this._minimumWidth=0,this._lineHeight=t.fontInfo.lineHeight,this._typicalHalfwidthCharacterWidth=t.fontInfo.typicalHalfwidthCharacterWidth,this._listContainer=document.createElement("div"),this._listContainer.className="rename-box rename-candidate-list-container",e.appendChild(this._listContainer),this._listWidget=rO._createListWidget(this._listContainer,this._candidateViewHeight,t.fontInfo),this._listWidget.onDidChangeFocus(i=>{i.elements.length===1&&t.onFocusChange(i.elements[0].newSymbolName)},this._disposables),this._listWidget.onDidChangeSelection(i=>{i.elements.length===1&&t.onSelectionChange()},this._disposables),this._disposables.add(this._listWidget.onDidBlur(i=>{this._listWidget.setFocus([])})),this._listWidget.style(Qg({listInactiveFocusForeground:jc,listInactiveFocusBackground:qc}))}dispose(){this._listWidget.dispose(),this._disposables.dispose()}layout({height:e,width:t}){this._availableHeight=e,this._minimumWidth=t}setCandidates(e){this._listWidget.splice(0,0,e);const t=this._pickListHeight(this._listWidget.length),i=this._pickListWidth(e);this._listWidget.layout(t,i),this._listContainer.style.height=`${t}px`,this._listContainer.style.width=`${i}px`,Pl(m("renameSuggestionsReceivedAria","Received {0} rename suggestions",e.length))}clearCandidates(){this._listContainer.style.height="0px",this._listContainer.style.width="0px",this._listWidget.splice(0,this._listWidget.length,[])}get nCandidates(){return this._listWidget.length}get focusedCandidate(){if(this._listWidget.length===0)return;const e=this._listWidget.getSelectedElements()[0];if(e!==void 0)return e.newSymbolName;const t=this._listWidget.getFocusedElements()[0];if(t!==void 0)return t.newSymbolName}focusNext(){if(this._listWidget.length===0)return!1;const e=this._listWidget.getFocus();if(e.length===0)return this._listWidget.focusFirst(),this._listWidget.reveal(0),!0;if(e[0]===this._listWidget.length-1)return this._listWidget.setFocus([]),this._listWidget.reveal(0),!1;{this._listWidget.focusNext();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}}focusPrevious(){if(this._listWidget.length===0)return!1;const e=this._listWidget.getFocus();if(e.length===0){this._listWidget.focusLast();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}else{if(e[0]===0)return this._listWidget.setFocus([]),!1;{this._listWidget.focusPrevious();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}}}clearFocus(){this._listWidget.setFocus([])}get _candidateViewHeight(){const{totalHeight:e}=zg.getLayoutInfo({lineHeight:this._lineHeight});return e}_pickListHeight(e){const t=this._candidateViewHeight*e;return Math.min(t,this._availableHeight,this._candidateViewHeight*7)}_pickListWidth(e){const t=Math.ceil(Math.max(...e.map(n=>n.newSymbolName.length))*this._typicalHalfwidthCharacterWidth);return Math.max(this._minimumWidth,25+t+10)}static _createListWidget(e,t,i){const n=new class{getTemplateId(r){return"candidate"}getHeight(r){return t}},s=new class{constructor(){this.templateId="candidate"}renderTemplate(r){return new zg(r,i)}renderElement(r,a,l){l.populate(r)}disposeTemplate(r){r.dispose()}};return new Ko("NewSymbolNameCandidates",e,n,[s],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}}class S1e{static{d(this,"InputWithButton")}constructor(){this._onDidInputChange=new F,this.onDidInputChange=this._onDidInputChange.event,this._disposables=new Y}get domNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="rename-input-with-button",this._domNode.style.display="flex",this._domNode.style.flexDirection="row",this._domNode.style.alignItems="center",this._inputNode=document.createElement("input"),this._inputNode.className="rename-input",this._inputNode.type="text",this._inputNode.style.border="none",this._inputNode.setAttribute("aria-label",m("renameAriaLabel","Rename input. Type new name and press Enter to commit.")),this._domNode.appendChild(this._inputNode),this._buttonNode=document.createElement("div"),this._buttonNode.className="rename-suggestions-button",this._buttonNode.setAttribute("tabindex","0"),this._buttonGenHoverText=m("generateRenameSuggestionsButton","Generate new name suggestions"),this._buttonCancelHoverText=m("cancelRenameSuggestionsButton","Cancel"),this._buttonHover=Ba().setupUpdatableHover(As("element"),this._buttonNode,this._buttonGenHoverText),this._disposables.add(this._buttonHover),this._domNode.appendChild(this._buttonNode),this._disposables.add(G(this.input,te.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(G(this.input,te.KEY_DOWN,e=>{const t=new Bt(e);(t.keyCode===15||t.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(G(this.input,te.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(G(this.input,te.FOCUS,()=>{this.domNode.style.outlineWidth="1px",this.domNode.style.outlineStyle="solid",this.domNode.style.outlineOffset="-1px",this.domNode.style.outlineColor="var(--vscode-focusBorder)"})),this._disposables.add(G(this.input,te.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return _t(this._inputNode),this._inputNode}get button(){return _t(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){var e,t;this._buttonState="sparkle",(e=this._sparkleIcon)!==null&&e!==void 0||(this._sparkleIcon=Cg(re.sparkle)),kn(this.button),this.button.appendChild(this._sparkleIcon),this.button.setAttribute("aria-label","Generating new name suggestions"),(t=this._buttonHover)===null||t===void 0||t.update(this._buttonGenHoverText),this.input.focus()}setStopButton(){var e,t;this._buttonState="stop",(e=this._stopIcon)!==null&&e!==void 0||(this._stopIcon=Cg(re.primitiveSquare)),kn(this.button),this.button.appendChild(this._stopIcon),this.button.setAttribute("aria-label","Cancel generating new name suggestions"),(t=this._buttonHover)===null||t===void 0||t.update(this._buttonCancelHoverText),this.input.focus()}dispose(){this._disposables.dispose()}}class zg{static{d(this,"RenameCandidateView")}constructor(e,t){this._domNode=document.createElement("div"),this._domNode.className="rename-box rename-candidate",this._domNode.style.display="flex",this._domNode.style.columnGap="5px",this._domNode.style.alignItems="center",this._domNode.style.height=`${t.lineHeight}px`,this._domNode.style.padding=`${zg._PADDING}px`;const i=document.createElement("div");i.style.display="flex",i.style.alignItems="center",i.style.width=i.style.height=`${t.lineHeight*.8}px`,this._domNode.appendChild(i),this._icon=Cg(re.sparkle),this._icon.style.display="none",i.appendChild(this._icon),this._label=document.createElement("div"),Tn(this._label,t),this._domNode.appendChild(this._label),e.appendChild(this._domNode)}populate(e){this._updateIcon(e),this._updateLabel(e)}_updateIcon(e){var t;const i=!!(!((t=e.tags)===null||t===void 0)&&t.includes(ET.AIGenerated));this._icon.style.display=i?"inherit":"none"}_updateLabel(e){this._label.innerText=e.newSymbolName}static getLayoutInfo({lineHeight:e}){return{totalHeight:e+zg._PADDING*2}}dispose(){}}zg._PADDING=2;var y1e=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},yc=function(o,e){return function(t,i){e(t,i,o)}},SN;class aO{static{d(this,"RenameSkeleton")}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._providerRenameIdx0?t.join(`
+`):void 0}:{range:k.fromPositions(this.position),text:"",rejectReason:t.length>0?t.join(`
+`):void 0}}async provideRenameEdits(e,t){return this._provideRenameEdits(e,this._providerRenameIdx,[],t)}async _provideRenameEdits(e,t,i,n){const s=this._providers[t];if(!s)return{edits:[],rejectReason:i.join(`
+`)};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(m("no result","No result.")),n);return r}}async function L1e(o,e,t,i){const n=new aO(e,t,o),s=await n.resolveRenameLocation(ot.None);return s?.rejectReason?{edits:[],rejectReason:s.rejectReason}:n.provideRenameEdits(i,ot.None)}d(L1e,"rename");let ac=SN=class{static{d(this,"RenameController")}static get(e){return e.getContribution(SN.ID)}constructor(e,t,i,n,s,r,a,l,c){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._telemetryService=c,this._disposableStore=new Y,this._cts=new ui,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(wN,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){var e,t;const i=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new ui,!this.editor.hasModel()){i("editor has no model");return}const n=this.editor.getPosition(),s=new aO(this.editor.getModel(),n,this._languageFeaturesService.renameProvider);if(!s.hasProvider()){i("skeleton has no provider");return}const r=new Au(this.editor,5,void 0,this._cts.token);let a;try{i("resolving rename location");const b=s.resolveRenameLocation(r.token);this._progressService.showWhile(b,250),a=await b,i("resolved rename location")}catch(b){b instanceof Ta?i("resolve rename location cancelled",JSON.stringify(b,null," ")):(i("resolve rename location failed",b instanceof Error?b:JSON.stringify(b,null," ")),(typeof b=="string"||xa(b))&&((e=xs.get(this.editor))===null||e===void 0||e.showMessage(b||m("resolveRenameLocationFailed","An unknown error occurred while resolving rename location"),n)));return}finally{r.dispose()}if(!a){i("returning early - no loc");return}if(a.rejectReason){i(`returning early - rejected with reason: ${a.rejectReason}`,a.rejectReason),(t=xs.get(this.editor))===null||t===void 0||t.showMessage(a.rejectReason,n);return}if(r.token.isCancellationRequested){i("returning early - cts1 cancelled");return}const l=new Au(this.editor,5,a.range,this._cts.token),c=this.editor.getModel(),u=this._languageFeaturesService.newSymbolNamesProvider.all(c),h=await Promise.all(u.map(async b=>{var v;return[b,(v=await b.supportsAutomaticNewSymbolNamesTriggerKind)!==null&&v!==void 0?v:!1]})),g=d((b,v)=>{let C=h.slice();return b===jb.Automatic&&(C=C.filter(([w,S])=>S)),C.map(([w])=>w.provideNewSymbolNames(c,a.range,b,v))},"requestRenameSuggestions");i("creating rename input field and awaiting its result");const f=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),p=await this._renameWidget.getInput(a.range,a.text,f,u.length>0?g:void 0,l);if(i("received response from rename input field"),u.length>0&&this._reportTelemetry(u.length,c.getLanguageId(),p),typeof p=="boolean"){i(`returning early - rename input field response - ${p}`),p&&this.editor.focus(),l.dispose();return}this.editor.focus(),i("requesting rename edits");const _=E0(s.provideRenameEdits(p.newName,l.token),l.token).then(async b=>{if(!b){i("returning early - no rename edits result");return}if(!this.editor.hasModel()){i("returning early - no model after rename edits are provided");return}if(b.rejectReason){i(`returning early - rejected with reason: ${b.rejectReason}`),this._notificationService.info(b.rejectReason);return}this.editor.setSelection(k.fromPositions(this.editor.getSelection().getPosition())),i("applying edits"),this._bulkEditService.apply(b,{editor:this.editor,showPreview:p.wantsPreview,label:m("label","Renaming '{0}' to '{1}'",a?.text,p.newName),code:"undoredo.rename",quotableLabel:m("quotableLabel","Renaming {0} to {1}",a?.text,p.newName),respectAutoSaveConfig:!0}).then(v=>{i("edits applied"),v.ariaSummary&&$s(m("aria","Successfully renamed '{0}' to '{1}'. Summary: {2}",a.text,p.newName,v.ariaSummary))}).catch(v=>{i(`error when applying edits ${JSON.stringify(v,null," ")}`),this._notificationService.error(m("rename.failedApply","Rename failed to apply edits")),this._logService.error(v)})},b=>{i("error when providing rename edits",JSON.stringify(b,null," ")),this._notificationService.error(m("rename.failed","Rename failed to compute edits")),this._logService.error(b)}).finally(()=>{l.dispose()});return i("returning rename operation"),this._progressService.showWhile(_,250),_}acceptRenameInput(e){this._renameWidget.acceptInput(e)}cancelRenameInput(){this._renameWidget.cancelInput(!0,"cancelRenameInput command")}focusNextRenameSuggestion(){this._renameWidget.focusNextRenameSuggestion()}focusPreviousRenameSuggestion(){this._renameWidget.focusPreviousRenameSuggestion()}_reportTelemetry(e,t,i){const n=typeof i=="boolean"?{kind:"cancelled",languageId:t,nRenameSuggestionProviders:e}:{kind:"accepted",languageId:t,nRenameSuggestionProviders:e,source:i.stats.source.k,nRenameSuggestions:i.stats.nRenameSuggestions,timeBeforeFirstInputFieldEdit:i.stats.timeBeforeFirstInputFieldEdit,wantsPreview:i.wantsPreview,nRenameSuggestionsInvocations:i.stats.nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:i.stats.hadAutomaticRenameSuggestionsInvocation};this._telemetryService.publicLog2("renameInvokedEvent",n)}};ac.ID="editor.contrib.renameController";ac=SN=y1e([yc(1,xe),yc(2,Ri),yc(3,j0),yc(4,Xu),yc(5,qn),yc(6,PR),yc(7,me),yc(8,Vn)],ac);class x1e extends ue{static{d(this,"RenameAction")}constructor(){super({id:"editor.action.rename",label:m("rename.label","Rename Symbol"),alias:"Rename Symbol",precondition:j.and(I.writable,I.hasRenameProvider),kbOpts:{kbExpr:I.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(bt),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return Te.isUri(n)&&H.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))))},Ue):super.runCommand(e,t)}run(e,t){const i=e.get(qn),n=ac.get(t);return n?(i.trace("[RenameAction] got controller, running..."),n.run()):(i.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}}vt(ac.ID,ac,4);ee(x1e);const lO=Ji.bindToContribution(ac.get);de(new lO({id:"acceptRenameInput",precondition:Xm,handler:d(o=>o.acceptRenameInput(!1),"handler"),kbOpts:{weight:199,kbExpr:j.and(I.focus,j.not("isComposing")),primary:3}}));de(new lO({id:"acceptRenameInputWithPreview",precondition:j.and(Xm,j.has("config.editor.rename.enablePreview")),handler:d(o=>o.acceptRenameInput(!0),"handler"),kbOpts:{weight:199,kbExpr:j.and(I.focus,j.not("isComposing")),primary:2051}}));de(new lO({id:"cancelRenameInput",precondition:Xm,handler:d(o=>o.cancelRenameInput(),"handler"),kbOpts:{weight:199,kbExpr:I.focus,primary:9,secondary:[1033]}}));zt(class extends Is{static{d(this,"FocusNextRenameSuggestion")}constructor(){super({id:"focusNextRenameSuggestion",title:{...He("focusNextRenameSuggestion","Focus Next Rename Suggestion")},precondition:Xm,keybinding:[{primary:18,weight:199}]})}run(e){const t=e.get(bt).getFocusedCodeEditor();if(!t)return;const i=ac.get(t);i&&i.focusNextRenameSuggestion()}});zt(class extends Is{static{d(this,"FocusPreviousRenameSuggestion")}constructor(){super({id:"focusPreviousRenameSuggestion",title:{...He("focusPreviousRenameSuggestion","Focus Previous Rename Suggestion")},precondition:Xm,keybinding:[{primary:16,weight:199}]})}run(e){const t=e.get(bt).getFocusedCodeEditor();if(!t)return;const i=ac.get(t);i&&i.focusPreviousRenameSuggestion()}});jl("_executeDocumentRenameProvider",function(o,e,t,...i){const[n]=i;_t(typeof n=="string");const{renameProvider:s}=o.get(me);return L1e(s,e,t,n)});jl("_executePrepareRename",async function(o,e,t){const{renameProvider:i}=o.get(me),s=await new aO(e,t,i).resolveRenameLocation(ot.None);if(s?.rejectReason)throw new Error(s.rejectReason);return s});hi.as(Va.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:m("enablePreview","Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});var k1e=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},TV=function(o,e){return function(t,i){e(t,i,o)}};let p0=class extends W{static{d(this,"SectionHeaderDetector")}constructor(e,t,i){super(),this.editor=e,this.languageConfigurationService=t,this.editorWorkerService=i,this.decorations=this.editor.createDecorationsCollection(),this.options=this.createOptions(e.getOption(73)),this.computePromise=null,this.currentOccurrences={},this._register(e.onDidChangeModel(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(e.onDidChangeModelLanguage(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(t.onDidChange(n=>{var s;const r=(s=this.editor.getModel())===null||s===void 0?void 0:s.getLanguageId();r&&n.affects(r)&&(this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(e.onDidChangeConfiguration(n=>{this.options&&!n.hasChanged(73)||(this.options=this.createOptions(e.getOption(73)),this.updateDecorations([]),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(this.editor.onDidChangeModelContent(n=>{this.computeSectionHeaders.schedule()})),this._register(e.onDidChangeModelTokens(n=>{this.computeSectionHeaders.isScheduled()||this.computeSectionHeaders.schedule(1e3)})),this.computeSectionHeaders=this._register(new Pt(()=>{this.findSectionHeaders()},250)),this.computeSectionHeaders.schedule(0)}createOptions(e){if(!e||!this.editor.hasModel())return;const t=this.editor.getModel().getLanguageId();if(!t)return;const i=this.languageConfigurationService.getLanguageConfiguration(t).comments,n=this.languageConfigurationService.getLanguageConfiguration(t).foldingRules;if(!(!i&&!n?.markers))return{foldingRules:n,findMarkSectionHeaders:e.showMarkSectionHeaders,findRegionSectionHeaders:e.showRegionSectionHeaders}}findSectionHeaders(){var e,t;if(!this.editor.hasModel()||!(!((e=this.options)===null||e===void 0)&&e.findMarkSectionHeaders)&&!(!((t=this.options)===null||t===void 0)&&t.findRegionSectionHeaders))return;const i=this.editor.getModel();if(i.isDisposed()||i.isTooLargeForSyncing())return;const n=i.getVersionId();this.editorWorkerService.findSectionHeaders(i.uri,this.options).then(s=>{i.isDisposed()||i.getVersionId()!==n||this.updateDecorations(s)})}updateDecorations(e){const t=this.editor.getModel();t&&(e=e.filter(s=>{if(!s.shouldBeInComments)return!0;const r=t.validateRange(s.range),a=t.tokenization.getLineTokens(r.startLineNumber),l=a.findTokenIndexAtOffset(r.startColumn-1),c=a.getStandardTokenType(l);return a.getLanguageId(l)===t.getLanguageId()&&c===1}));const i=Object.values(this.currentOccurrences).map(s=>s.decorationId),n=e.map(s=>D1e(s));this.editor.changeDecorations(s=>{const r=s.deltaDecorations(i,n);this.currentOccurrences={};for(let a=0,l=r.length;a0?t[0]:[]}d(A1e,"getDocumentSemanticTokensProviders");async function zU(o,e,t,i,n){const s=A1e(o,e),r=await Promise.all(s.map(async a=>{let l,c=null;try{l=await a.provideDocumentSemanticTokens(e,a===t?i:null,n)}catch(u){c=u,l=null}return(!l||!Qx(l)&&!WU(l))&&(l=null),new M1e(a,l,c)}));for(const a of r){if(a.error)throw a.error;if(a.tokens)return a}return r.length>0?r[0]:null}d(zU,"getDocumentSemanticTokens");function N1e(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:null}d(N1e,"_getDocumentSemanticTokensProviderHighestGroup");class R1e{static{d(this,"DocumentRangeSemanticTokensResult")}constructor(e,t){this.provider=e,this.tokens=t}}function P1e(o,e){return o.has(e)}d(P1e,"hasDocumentRangeSemanticTokensProvider");function UU(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}d(UU,"getDocumentRangeSemanticTokensProviders");async function dO(o,e,t,i){const n=UU(o,e),s=await Promise.all(n.map(async r=>{let a;try{a=await r.provideDocumentRangeSemanticTokens(e,t,i)}catch(l){Li(l),a=null}return(!a||!Qx(a))&&(a=null),new R1e(r,a)}));for(const r of s)if(r.tokens)return r;return s.length>0?s[0]:null}d(dO,"getDocumentRangeSemanticTokens");ut.registerCommand("_provideDocumentSemanticTokensLegend",async(o,...e)=>{const[t]=e;_t(t instanceof Te);const i=o.get(li).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(me),s=N1e(n,i);return s?s[0].getLegend():o.get(Qt).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)});ut.registerCommand("_provideDocumentSemanticTokens",async(o,...e)=>{const[t]=e;_t(t instanceof Te);const i=o.get(li).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(me);if(!BU(n,i))return o.get(Qt).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const s=await zU(n,i,null,null,ot.None);if(!s)return;const{provider:r,tokens:a}=s;if(!a||!Qx(a))return;const l=VU({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),l});ut.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(o,...e)=>{const[t,i]=e;_t(t instanceof Te);const n=o.get(li).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(me),r=UU(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 dO(s,n,k.lift(i),ot.None);if(a)return a.provider.getLegend()});ut.registerCommand("_provideDocumentRangeSemanticTokens",async(o,...e)=>{const[t,i]=e;_t(t instanceof Te),_t(k.isIRange(i));const n=o.get(li).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(me),r=await dO(s,n,k.lift(i),ot.None);if(!(!r||!r.tokens))return VU({id:0,type:"full",data:r.tokens.data})});const cO="editor.semanticHighlighting";function N1(o,e,t){var i;const n=(i=t.getValue(cO,{overrideIdentifier:o.getLanguageId(),resource:o.uri}))===null||i===void 0?void 0:i.enabled;return typeof n=="boolean"?n:e.getColorTheme().semanticHighlighting}d(N1,"isSemanticColoringEnabled");var GU=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},cl=function(o,e){return function(t,i){e(t,i,o)}},Ic;let yN=class extends W{static{d(this,"DocumentSemanticTokensFeature")}constructor(e,t,i,n,s,r){super(),this._watchers=Object.create(null);const a=d(u=>{this._watchers[u.uri.toString()]=new m0(u,e,i,s,r)},"register"),l=d((u,h)=>{h.dispose(),delete this._watchers[u.uri.toString()]},"deregister"),c=d(()=>{for(const u of t.getModels()){const h=this._watchers[u.uri.toString()];N1(u,i,n)?h||a(u):h&&l(u,h)}},"handleSettingOrThemeChange");t.getModels().forEach(u=>{N1(u,i,n)&&a(u)}),this._register(t.onModelAdded(u=>{N1(u,i,n)&&a(u)})),this._register(t.onModelRemoved(u=>{const h=this._watchers[u.uri.toString()];h&&l(u,h)})),this._register(n.onDidChangeConfiguration(u=>{u.affectsConfiguration(cO)&&c()})),this._register(i.onDidColorThemeChange(c))}dispose(){for(const e of Object.values(this._watchers))e.dispose();super.dispose()}};yN=GU([cl(0,ML),cl(1,li),cl(2,en),cl(3,et),cl(4,pr),cl(5,me)],yN);let m0=Ic=class extends W{static{d(this,"ModelSemanticColoring")}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:Ic.REQUEST_MIN_DELAY,max:Ic.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Pt(()=>this._fetchDocumentSemanticTokensNow(),Ic.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=d(()=>{Ot(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)}))},"bindDocumentChangeListeners");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),Ot(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!BU(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new ui,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=zU(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 En(!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:c,tokens:u}=l,h=this._semanticTokensStylingService.getStyling(c);this._setDocumentSemanticTokens(c,u||null,h,s)}},l=>{l&&(Gr(l)||typeof l.message=="string"&&l.message.indexOf("busy")!==-1)||Ue(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{(n.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))},"rescheduleIfNeeded");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(WU(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 g of t.edits)a+=(g.data?g.data.length:0)-g.deleteCount;const l=s.data,c=new Uint32Array(l.length+a);let u=l.length,h=c.length;for(let g=t.edits.length-1;g>=0;g--){const f=t.edits[g];if(f.start>l.length){i.warnInvalidEditStart(s.resultId,t.resultId,g,f.start,l.length),this._model.tokenization.setSemanticTokens(null,!0);return}const p=u-(f.start+f.deleteCount);p>0&&(Ic._copy(l,u-p,c,h-p,p),h-=p),f.data&&(Ic._copy(f.data,0,c,h-f.data.length,f.data.length),h-=f.data.length),u=f.start}u>0&&Ic._copy(l,0,c,0,u),t={resultId:t.resultId,data:c}}}if(Qx(t)){this._currentDocumentResponse=new O1e(e,t.resultId,t.data);const a=h9(t,i,this._model.getLanguageId());if(n.length>0)for(const l of n)for(const c of a)for(const u of l.changes)c.applyEdit(u.range,u.text);this._model.tokenization.setSemanticTokens(a,!0)}else this._model.tokenization.setSemanticTokens(null,!0);r()}};m0.REQUEST_MIN_DELAY=300;m0.REQUEST_MAX_DELAY=2e3;m0=Ic=GU([cl(1,ML),cl(2,en),cl(3,pr),cl(4,me)],m0);class O1e{static{d(this,"SemanticTokensResponse")}constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}nC(yN);var F1e=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},M_=function(o,e){return function(t,i){e(t,i,o)}};let _0=class extends W{static{d(this,"ViewportSemanticTokensContribution")}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 Pt(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[];const a=d(()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))},"scheduleTokenizeViewport");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(cO)&&(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;tthis._requestRange(e,i)))}_requestRange(e,t){const i=e.getVersionId(),n=ln(r=>Promise.resolve(dO(this._provider,e,t,r))),s=new En(!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,c=this._semanticTokensStylingService.getStyling(a);e.tokenization.setPartialSemanticTokens(t,h9(l,c,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}};_0.ID="editor.contrib.viewportSemanticTokens";_0=F1e([M_(1,ML),M_(2,en),M_(3,et),M_(4,pr),M_(5,me)],_0);vt(_0.ID,_0,1);class H1e{static{d(this,"WordSelectionRangeProvider")}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,c=a,u=0;for(;l>=0;l--){const h=s.charCodeAt(l);if(l!==a&&(h===95||h===45))break;if(zc(h)&&rl(u))break;u=h}for(l+=1;c0&&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 V1e=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},W1e=function(o,e){return function(t,i){e(t,i,o)}},LN;class uO{static{d(this,"SelectionRanges")}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 uO(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}let km=LN=class{static{d(this,"SmartSelectController")}static get(e){return e.getContribution(LN.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 $U(this._languageFeaturesService.selectionRangeProvider,i,t.map(s=>s.getPosition()),this._editor.getOption(113),ot.None).then(s=>{var r;if(!(!$n(s)||s.length!==t.length)&&!(!this._editor.hasModel()||!ci(this._editor.getSelections(),t,(a,l)=>a.equalsSelection(l)))){for(let a=0;al.containsPosition(t[a].getStartPosition())&&l.containsPosition(t[a].getEndPosition())),s[a].unshift(t[a]);this._state=s.map(a=>new uO(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=>be.fromPositions(s.ranges[s.index].getStartPosition(),s.ranges[s.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}};km.ID="editor.contrib.smartSelectController";km=LN=V1e([W1e(1,me)],km);class KU extends ue{static{d(this,"AbstractSmartSelect")}constructor(e,t){super(t),this._forward=e}async run(e,t){const i=km.get(t);i&&await i.run(this._forward)}}class B1e extends KU{static{d(this,"GrowSelectionAction")}constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:m("smartSelect.expand","Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:I.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:T.MenubarSelectionMenu,group:"1_basic",title:m({key:"miSmartSelectGrow",comment:["&& denotes a mnemonic"]},"&&Expand Selection"),order:2}})}}ut.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class z1e extends KU{static{d(this,"ShrinkSelectionAction")}constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:m("smartSelect.shrink","Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:I.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:T.MenubarSelectionMenu,group:"1_basic",title:m({key:"miSmartSelectShrink",comment:["&& denotes a mnemonic"]},"&&Shrink Selection"),order:3}})}}vt(km.ID,km,4);ee(B1e);ee(z1e);async function $U(o,e,t,i,n){const s=o.all(e).concat(new H1e(i.selectSubwords));s.length===1&&s.unshift(new So);const r=[],a=[];for(const l of s)r.push(Promise.resolve(l.provideSelectionRanges(e,t,n)).then(c=>{if($n(c)&&c.length===t.length)for(let u=0;u{if(l.length===0)return[];l.sort((g,f)=>H.isBefore(g.getStartPosition(),f.getStartPosition())?1:H.isBefore(f.getStartPosition(),g.getStartPosition())||H.isBefore(g.getEndPosition(),f.getEndPosition())?-1:H.isBefore(f.getEndPosition(),g.getEndPosition())?1:0);const c=[];let u;for(const g of l)(!u||k.containsRange(g,u)&&!k.equalsRange(g,u))&&(c.push(g),u=g);if(!i.selectLeadingAndTrailingWhitespace)return c;const h=[c[0]];for(let g=1;go,"createHTML")}),hT="data-sticky-line-index",MV="data-sticky-is-line",G1e="data-sticky-is-line-number",AV="data-sticky-is-folding-icon";class K1e extends W{static{d(this,"StickyScrollWidget")}constructor(e){super(),this._editor=e,this._foldingIconStore=new Y,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(67),this._renderedStickyLines=[],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 Ou),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable);const t=d(()=>{this._linesDomNode.style.left=this._editor.getOption(115).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"},"updateScrollLeftPosition");this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(115)&&t(),i.hasChanged(67)&&(this._lineHeight=this._editor.getOption(67))})),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}getRenderedStickyLine(e){return this._renderedStickyLines.find(t=>t.lineNumber===e)}getCurrentLines(){return this._lineNumbers}setState(e,t,i){if(i===void 0&&(!this._previousState&&!e||this._previousState&&this._previousState.equals(e)))return;const n=this._isWidgetHeightZero(e),s=n?void 0:e,r=n?0:this._findLineToRebuildWidgetFrom(e,i);this._renderRootNode(s,t,r),this._previousState=e}_isWidgetHeightZero(e){if(!e)return!0;const t=e.startLineNumbers.length*this._lineHeight+e.lastLineRelativePosition;if(t>0){this._lastLineRelativePosition=e.lastLineRelativePosition;const i=[...e.startLineNumbers];e.showEndForLine!==null&&(i[e.showEndForLine]=e.endLineNumbers[e.showEndForLine]),this._lineNumbers=i}else this._lastLineRelativePosition=0,this._lineNumbers=[];return t===0}_findLineToRebuildWidgetFrom(e,t){if(!e||!this._previousState)return 0;if(t!==void 0)return t;const i=this._previousState,n=e.startLineNumbers.findIndex(s=>!i.startLineNumbers.includes(s));return n===-1?0:n}_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`}_clearStickyLinesFromLine(e){this._foldingIconStore.clear();for(let t=e;ta.scrollWidth))+n.verticalScrollbarWidth,this._editor.layoutOverlayWidget(this)}_setFoldingHoverListeners(){this._editor.getOption(110)==="mouseover"&&(this._foldingIconStore.add(G(this._lineNumbersDomNode,te.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(G(this._lineNumbersDomNode,te.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 H(t,1)).lineNumber,a=s.getViewLineRenderingData(r),l=this._editor.getOption(68);let c;try{c=Ss.filter(a.inlineDecorations,r,a.minColumn,a.maxColumn)}catch{c=[]}const u=new ju(!0,!0,a.content,a.continuesWithWrappedLine,a.isBasicASCII,a.containsRTL,0,a.tokens,c,a.tabSize,a.startVisibleColumn,1,1,1,500,"none",!0,!0,null),h=new Rm(2e3),g=P0(u,h);let f;IV?f=IV.createHTML(h.build()):f=h.build();const p=document.createElement("span");p.setAttribute(hT,String(e)),p.setAttribute(MV,""),p.setAttribute("role","listitem"),p.tabIndex=0,p.className="sticky-line-content",p.classList.add(`stickyLine${t}`),p.style.lineHeight=`${this._lineHeight}px`,p.innerHTML=f;const _=document.createElement("span");_.setAttribute(hT,String(e)),_.setAttribute(G1e,""),_.className="sticky-line-number",_.style.lineHeight=`${this._lineHeight}px`;const b=n.contentLeft;_.style.width=`${b}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`,_.appendChild(v);const C=this._renderFoldingIconForLine(i,t);C&&_.appendChild(C.domNode),this._editor.applyFontInfo(p),this._editor.applyFontInfo(v),_.style.lineHeight=`${this._lineHeight}px`,p.style.lineHeight=`${this._lineHeight}px`,_.style.height=`${this._lineHeight}px`,p.style.height=`${this._lineHeight}px`;const w=new $1e(e,t,p,_,C,g.characterMapping,p.scrollWidth);return this._updateTopAndZIndexOfStickyLine(w)}_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 c=`${i*this._lineHeight+this._lastLineRelativePosition+(!((t=e.foldingIcon)===null||t===void 0)&&t.isCollapsed?1:0)}px`,u=`${i*this._lineHeight}px`;return n.style.top=r?c:u,s.style.top=r?c:u,e}_renderFoldingIconForLine(e,t){const i=this._editor.getOption(110);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),c=new j1e(l,r,n.getEndLineNumber(s),this._lineHeight);return c.setVisible(this._isOnGlyphMargin?!0:l||i==="always"),c.domNode.setAttribute(AV,""),c}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:2,stackOridinal:10}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(e){0<=e&&e0)return null;const t=this._getRenderedStickyLineFromChildDomNode(e);if(!t)return null;const i=YR(t.characterMapping,e,0);return new H(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._renderedStickyLines.length?null:this._renderedStickyLines[t]}getLineIndexFromChildDomNode(e){const t=this._getAttributeValue(e,hT);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,MV)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,AV)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){const i=e.getAttribute(t);if(i!==null)return i;e=e.parentElement}}}class $1e{static{d(this,"RenderedStickyLine")}constructor(e,t,i,n,s,r,a){this.index=e,this.lineNumber=t,this.lineDomNode=i,this.lineNumberDomNode=n,this.foldingIcon=s,this.characterMapping=r,this.scrollWidth=a}}class j1e{static{d(this,"StickyFoldingIcon")}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=Ae.asClassName(e?Ax:Mx)}setVisible(e){this.domNode.style.cursor=e?"pointer":"default",this.domNode.style.opacity=e?"1":"0"}}class Ob{static{d(this,"StickyRange")}constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}}class Vy{static{d(this,"StickyElement")}constructor(e,t,i){this.range=e,this.children=t,this.parent=i}}class jU{static{d(this,"StickyModel")}constructor(e,t,i,n){this.uri=e,this.version=t,this.element=i,this.outlineProviderId=n}}var Jx=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},b0=function(o,e){return function(t,i){e(t,i,o)}},Fb;(function(o){o.OUTLINE_MODEL="outlineModel",o.FOLDING_PROVIDER_MODEL="foldingProviderModel",o.INDENTATION_MODEL="indentationModel"})(Fb||(Fb={}));var su;(function(o){o[o.VALID=0]="VALID",o[o.INVALID=1]="INVALID",o[o.CANCELED=2]="CANCELED"})(su||(su={}));let xN=class extends W{static{d(this,"StickyModelProvider")}constructor(e,t,i,n){switch(super(),this._editor=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new zr(300)),this._updateOperation=this._register(new Y),this._editor.getOption(115).defaultModel){case Fb.OUTLINE_MODEL:this._modelProviders.push(new kN(this._editor,n));case Fb.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new TN(this._editor,t,n));case Fb.INDENTATION_MODEL:this._modelProviders.push(new DN(this._editor,i));break}}dispose(){this._modelProviders.forEach(e=>e.dispose()),this._updateOperation.clear(),this._cancelModelPromise(),super.dispose()}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}async update(e){return this._updateOperation.clear(),this._updateOperation.add({dispose:d(()=>{this._cancelModelPromise(),this._updateScheduler.cancel()},"dispose")}),this._cancelModelPromise(),await this._updateScheduler.trigger(async()=>{for(const t of this._modelProviders){const{statusPromise:i,modelPromise:n}=t.computeStickyModel(e);this._modelPromise=n;const s=await i;if(this._modelPromise!==n)return null;switch(s){case su.CANCELED:return this._updateOperation.clear(),null;case su.VALID:return t.stickyModel}}return null}).catch(t=>(Ue(t),null))}};xN=Jx([b0(2,xe),b0(3,me)],xN);class qU extends W{static{d(this,"StickyModelCandidateProvider")}constructor(e){super(),this._editor=e,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,su.INVALID}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};const t=ln(i=>this.createModelFromProvider(i));return{statusPromise:t.then(i=>this.isModelValid(i)?e.isCancellationRequested?su.CANCELED:(this._stickyModel=this.createStickyModel(e,i),su.VALID):this._invalid()).then(void 0,i=>(Ue(i),su.CANCELED)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}}let kN=class extends qU{static{d(this,"StickyModelFromCandidateOutlineProvider")}constructor(e,t){super(e),this._languageFeaturesService=t}createModelFromProvider(e){return md.create(this._languageFeaturesService.documentSymbolProvider,this._editor.getModel(),e)}createStickyModel(e,t){var i;const{stickyOutlineElement:n,providerID:s}=this._stickyModelFromOutlineModel(t,(i=this._stickyModel)===null||i===void 0?void 0:i.outlineProviderId),r=this._editor.getModel();return new jU(r.uri,r.getVersionId(),n,s)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(ct.first(e.children.values())instanceof fU){const a=ct.find(e.children.values(),l=>l.id===t);if(a)i=a.children;else{let l="",c=-1,u;for(const[h,g]of e.children.entries()){const f=this._findSumOfRangesOfGroup(g);f>c&&(u=g,c=f,l=g.id)}t=l,i=u.children}}else i=e.children;const n=[],s=Array.from(i.values()).sort((a,l)=>{const c=new Ob(a.symbol.range.startLineNumber,a.symbol.range.endLineNumber),u=new Ob(l.symbol.range.startLineNumber,l.symbol.range.endLineNumber);return this._comparator(c,u)});for(const a of s)n.push(this._stickyModelFromOutlineElement(a,a.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new Vy(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 Ob(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new Vy(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 GA?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};kN=Jx([b0(1,me)],kN);class YU extends qU{static{d(this,"StickyModelFromCandidateFoldingProvider")}constructor(e){super(e),this._foldingLimitReporter=new uU(e)}createStickyModel(e,t){const i=this._fromFoldingRegions(t),n=this._editor.getModel();return new jU(n.uri,n.getVersionId(),i,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){const t=e.length,i=[],n=new Vy(void 0,[],void 0);for(let s=0;s0&&(this.provider=this._register(new Z2(e.getModel(),n,t,this._foldingLimitReporter,void 0)))}isProviderValid(){return this.provider!==void 0}async createModelFromProvider(e){var t,i;return(i=(t=this.provider)===null||t===void 0?void 0:t.compute(e))!==null&&i!==void 0?i:null}};TN=Jx([b0(2,me)],TN);var q1e=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},NV=function(o,e){return function(t,i){e(t,i,o)}};class Y1e{static{d(this,"StickyLineCandidate")}constructor(e,t,i){this.startLineNumber=e,this.endLineNumber=t,this.nestingDepth=i}}let EN=class extends W{static{d(this,"StickyLineCandidateProvider")}constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new F),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new Y),this._updateSoon=this._register(new Pt(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(115)&&this.readConfiguration()})),this.readConfiguration()}readConfiguration(){this._sessionStore.clear(),this._editor.getOption(115).enabled&&(this._sessionStore.add(this._editor.onDidChangeModel(()=>{this._model=null,this.updateStickyModelProvider(),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._sessionStore.add(we(()=>{var t;(t=this._stickyModelProvider)===null||t===void 0||t.dispose(),this._stickyModelProvider=null})),this.updateStickyModelProvider(),this.update())}getVersionId(){var e;return(e=this._model)===null||e===void 0?void 0:e.version}updateStickyModelProvider(){var e;(e=this._stickyModelProvider)===null||e===void 0||e.dispose(),this._stickyModelProvider=null;const t=this._editor;t.hasModel()&&(this._stickyModelProvider=new xN(t,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){var e;(e=this._cts)===null||e===void 0||e.dispose(!0),this._cts=new ui,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=await this._stickyModelProvider.update(e);e.isCancellationRequested||(this._model=t)}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 u=0;uu-h)),c=this.updateIndex(Vb(a,e.startLineNumber+n,(u,h)=>u-h));for(let u=l;u<=c;u++){const h=t.children[u];if(!h)return;if(h.range){const g=h.range.startLineNumber,f=h.range.endLineNumber;e.startLineNumber<=f+1&&g-1<=e.endLineNumber&&g!==r&&(r=g,i.push(new Y1e(g,f-1,n+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,h,i,n+1,g))}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}};EN=q1e([NV(1,me),NV(2,Kt)],EN);var X1e=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},Df=function(o,e){return function(t,i){e(t,i,o)}},IN;let Gl=IN=class extends W{static{d(this,"StickyScrollController")}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 Y,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 K1e(this._editor),this._stickyLineCandidateProvider=new EN(this._editor,i,s),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=new EV([],[],0),this._onDidResize(),this._readConfiguration();const l=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration(u=>{this._readConfigurationChange(u)})),this._register(G(l,te.CONTEXT_MENU,async u=>{this._onContextMenu(De(l),u)})),this._stickyScrollFocusedContextKey=I.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=I.stickyScrollVisible.bindTo(this._contextKeyService);const c=this._register(Ia(l));this._register(c.onDidBlur(u=>{this._positionRevealed===!1&&l.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(c.onDidFocus(u=>{this.focus()})),this._registerMouseListeners(),this._register(G(l,te.MOUSE_DOWN,u=>{this._onMouseDown=!0}))}static get(e){return e.getContribution(IN.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 Y,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex0&&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 Y),t=this._register(new Cx(this._editor,{extractLineNumberFromMouseEvent:d(s=>{const r=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);return r?r.lineNumber:0},"extractLineNumberFromMouseEvent")})),i=d(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},"getMouseEventTarget"),n=this._stickyScrollWidget.getDomNode();this._register(yi(n,te.CLICK,s=>{if(s.ctrlKey||s.altKey||s.metaKey||!s.leftButton)return;if(s.shiftKey){const c=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(c===null)return;const u=new H(this._endLineNumbers[c],1);this._revealLineInCenterIfOutsideViewport(u);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(s.target)){const c=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);this._toggleFoldingRegionForLine(c);return}if(!this._stickyScrollWidget.isInStickyLine(s.target))return;let l=this._stickyScrollWidget.getEditorPositionFromNode(s.target);if(!l){const c=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);if(c===null)return;l=new H(c,1)}this._revealPosition(l)})),this._register(yi(n,te.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(G(n,te.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:c}=a;if(!l.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=l,e.clear();else if(c.style.textDecoration==="underline")return;const u=new ui;e.add(we(()=>u.dispose(!0)));let h;kx(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new H(l.startLineNumber,l.startColumn+1),u.token).then(g=>{if(!u.token.isCancellationRequested)if(g.length!==0){this._candidateDefinitionsLength=g.length;const f=c;h!==f?(e.clear(),h=f,h.style.textDecoration="underline",e.add(we(()=>{h.style.textDecoration="none"}))):h||(h=f,h.style.textDecoration="underline",e.add(we(()=>{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._editor.hasModel()||!this._stickyRangeProjectedOnEditor||(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:r.lineNumber,column:1})),this._instaService.invokeFunction(Gz,s,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){const i=new Rr(e,t);this._contextMenuService.showContextMenu({menuId:T.StickyScrollContext,getAnchor:d(()=>i,"getAnchor")})}_toggleFoldingRegionForLine(e){if(!this._foldingModel||e===null)return;const t=this._stickyScrollWidget.getRenderedStickyLine(e),i=t?.foldingIcon;if(!i)return;rU(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(67)*t.index+1;this._editor.setScrollTop(n),this._renderStickyScroll(e)}_readConfiguration(){const e=this._editor.getOption(115);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(68).renderType===2&&this._sessionStore.add(this._editor.onDidChangeCursorPosition(()=>{this._showEndForLine=null,this._renderStickyScroll(0)}))}_readConfigurationChange(e){(e.hasChanged(115)||e.hasChanged(73)||e.hasChanged(67)||e.hasChanged(110)||e.hasChanged(68))&&this._readConfiguration(),e.hasChanged(68)&&this._renderStickyScroll(0)}_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(0)}_onDidResize(){const t=this._editor.getLayoutInfo().height/this._editor.getOption(67);this._maxStickyLines=Math.round(t*.25)}async _renderStickyScroll(e){var t,i;const n=this._editor.getModel();if(!n||n.isTooLargeForTokenization()){this._foldingModel=null,this._stickyScrollWidget.setState(void 0,null);return}const s=this._stickyLineCandidateProvider.getVersionId();if(s===void 0||s===n.getVersionId())if(this._foldingModel=(i=await((t=rc.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(67),t=Math.min(this._maxStickyLines,this._editor.getOption(115).maxLineCount),i=this._editor.getScrollTop();let n=0;const s=[],r=[],a=this._editor.getVisibleRanges();if(a.length!==0){const l=new Ob(a[0].startLineNumber,a[a.length-1].endLineNumber),c=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(l);for(const u of c){const h=u.startLineNumber,g=u.endLineNumber,f=u.nestingDepth;if(g-h>0){const p=(f-1)*e,_=f*e,b=this._editor.getBottomForLineNumber(h)-i,v=this._editor.getTopForLineNumber(g)-i,C=this._editor.getBottomForLineNumber(g)-i;if(p>v&&p<=C){s.push(h),r.push(g+1),n=C-_;break}else _>b&&_<=C&&(s.push(h),r.push(g+1));if(s.length===t)break}}}return this._endLineNumbers=r,new EV(s,r,n,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};Gl.ID="store.contrib.stickyScrollController";Gl=IN=X1e([Df(1,fo),Df(2,me),Df(3,xe),Df(4,Kt),Df(5,pr),Df(6,Ne)],Gl);class Z1e extends Is{static{d(this,"ToggleStickyScroll")}constructor(){super({id:"editor.action.toggleStickyScroll",title:{...He("toggleEditorStickyScroll","Toggle Editor Sticky Scroll"),mnemonicTitle:m({key:"mitoggleStickyScroll",comment:["&& denotes a mnemonic"]},"&&Toggle Editor Sticky Scroll")},metadata:{description:He("toggleEditorStickyScroll.description","Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:U1e.View,toggled:{condition:j.equals("config.editor.stickyScroll.enabled",!0),title:m("stickyScroll","Sticky Scroll"),mnemonicTitle:m({key:"miStickyScroll",comment:["&& denotes a mnemonic"]},"&&Sticky Scroll")},menu:[{id:T.CommandPalette},{id:T.MenubarAppearanceMenu,group:"4_editor",order:3},{id:T.StickyScrollContext}]})}async run(e){const t=e.get(et),i=!t.getValue("editor.stickyScroll.enabled");return t.updateValue("editor.stickyScroll.enabled",i)}}const ek=100;class Q1e extends Ha{static{d(this,"FocusStickyScroll")}constructor(){super({id:"editor.action.focusStickyScroll",title:{...He("focusStickyScroll","Focus on the editor sticky scroll"),mnemonicTitle:m({key:"mifocusStickyScroll",comment:["&& denotes a mnemonic"]},"&&Focus Sticky Scroll")},precondition:j.and(j.has("config.editor.stickyScroll.enabled"),I.stickyScrollVisible),menu:[{id:T.CommandPalette}]})}runEditorCommand(e,t){var i;(i=Gl.get(t))===null||i===void 0||i.focus()}}class J1e extends Ha{static{d(this,"SelectNextStickyScrollLine")}constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:He("selectNextStickyScrollLine.title","Select the next editor sticky scroll line"),precondition:I.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:ek,primary:18}})}runEditorCommand(e,t){var i;(i=Gl.get(t))===null||i===void 0||i.focusNext()}}class eSe extends Ha{static{d(this,"SelectPreviousStickyScrollLine")}constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:He("selectPreviousStickyScrollLine.title","Select the previous sticky scroll line"),precondition:I.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:ek,primary:16}})}runEditorCommand(e,t){var i;(i=Gl.get(t))===null||i===void 0||i.focusPrevious()}}class tSe extends Ha{static{d(this,"GoToStickyScrollLine")}constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:He("goToFocusedStickyScrollLine.title","Go to the focused sticky scroll line"),precondition:I.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:ek,primary:3}})}runEditorCommand(e,t){var i;(i=Gl.get(t))===null||i===void 0||i.goToFocused()}}class iSe extends Ha{static{d(this,"SelectEditor")}constructor(){super({id:"editor.action.selectEditor",title:He("selectEditor.title","Select Editor"),precondition:I.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:ek,primary:9}})}runEditorCommand(e,t){var i;(i=Gl.get(t))===null||i===void 0||i.selectEditor()}}vt(Gl.ID,Gl,1);zt(Z1e);zt(Q1e);zt(eSe);zt(J1e);zt(tSe);zt(iSe);var XU=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},ib=function(o,e){return function(t,i){e(t,i,o)}};class nSe{static{d(this,"SuggestInlineCompletion")}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 MN=class extends GK{static{d(this,"InlineCompletionResults")}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=0&&l.resolve(ot.None)}return t}};MN=XU([ib(5,Ox)],MN);let AN=class extends W{static{d(this,"SuggestInlineCompletions")}constructor(e,t,i,n){super(),this._languageFeatureService=e,this._clipboardService=t,this._suggestMemoryService=i,this._editorService=n,this._store.add(e.inlineCompletionsProvider.register("*",this))}async provideInlineCompletions(e,t,i,n){var s;if(i.selectedSuggestionInfo)return;let r;for(const p of this._editorService.listCodeEditors())if(p.getModel()===e){r=p;break}if(!r)return;const a=r.getOption(89);if(lp.isAllOff(a))return;e.tokenization.tokenizeIfCheap(t.lineNumber);const l=e.tokenization.getLineTokens(t.lineNumber),c=l.getStandardTokenType(l.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(lp.valueFor(a,c)!=="inline")return;let u=e.getWordAtPosition(t),h;if(u?.word||(h=this._getTriggerCharacterInfo(e,t)),!u?.word&&!h||(u||(u=e.getWordUntilPosition(t)),u.endColumn!==t.column))return;let g;const f=e.getValueInRange(new k(t.lineNumber,1,t.lineNumber,t.column));if(!h&&(!((s=this._lastResult)===null||s===void 0)&&s.canBeReused(e,t.lineNumber,u))){const p=new _V(f,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=p,this._lastResult.acquire(),g=this._lastResult}else{const p=await Q2(this._languageFeatureService.completionProvider,e,t,new r0(void 0,Py.createSuggestFilter(r).itemKind,h?.providers),h&&{triggerKind:1,triggerCharacter:h.ch},n);let _;p.needsClipboard&&(_=await this._clipboardService.readText());const b=new Vc(p.items,t.column,new _V(f,0),ua.None,r.getOption(118),r.getOption(112),{boostFullMatch:!1,firstMatchCanBeWeak:!1},_);g=new MN(e,t.lineNumber,u,b,p,this._suggestMemoryService)}return this._lastResult=g,g}handleItemDidShow(e,t){t.completion.resolve(ot.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}}};AN=XU([ib(0,me),ib(1,gc),ib(2,Ox),ib(3,bt)],AN);nC(AN);class sSe extends ue{static{d(this,"ForceRetokenizeAction")}constructor(){super({id:"editor.action.forceRetokenize",label:m("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 En;i.tokenization.forceTokenization(i.getLineCount()),n.stop(),console.log(`tokenization took ${n.elapsed()}`)}}ee(sSe);class tk extends Is{static{d(this,"ToggleTabFocusModeAction")}constructor(){super({id:tk.ID,title:He({key:"toggle.tabMovesFocus",comment:["Turn on/off use of tab key for moving focus around VS Code"]},"Toggle Tab Key Moves Focus"),precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},metadata:{description:He("tabMovesFocusDescriptions","Determines whether the tab key moves focus around the workbench or inserts the tab character in the current editor. This is also called tab trapping, tab navigation, or tab focus mode.")},f1:!0})}run(){const t=!qp.getTabFocusMode();qp.setTabFocusMode(t),$s(t?m("toggle.tabMovesFocus.on","Pressing Tab will now move focus to the next focusable element"):m("toggle.tabMovesFocus.off","Pressing Tab will now insert the tab character"))}}tk.ID="editor.action.toggleTabFocusMode";zt(tk);var oSe=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)}};let NN=class extends W{static{d(this,"Link")}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,s){var r,a;super(),this._link=t,this._hoverService=n,this._enabled=!0,this.el=Q(e,ie("a.monaco-link",{tabIndex:(r=t.tabIndex)!==null&&r!==void 0?r:0,href:t.href},t.label)),this.hoverDelegate=(a=i.hoverDelegate)!==null&&a!==void 0?a:As("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");const l=this._register(new at(this.el,"click")),c=this._register(new at(this.el,"keypress")),u=le.chain(c.event,f=>f.map(p=>new Bt(p)).filter(p=>p.keyCode===3)),h=this._register(new at(this.el,Gt.Tap)).event;this._register(Ut.addTarget(this.el));const g=le.any(l.event,u,h);this._register(g(f=>{this.enabled&&(dt.stop(f,!0),i?.opener?i.opener(this._link.href):s.open(this._link.href,{allowCommands:!0}))})),this.enabled=!0}setTooltip(e){this.hoverDelegate.showNativeHover?this.el.title=e??"":!this.hover&&e?this.hover=this._register(this._hoverService.setupUpdatableHover(this.hoverDelegate,this.el,e)):this.hover&&this.hover.update(e)}};NN=oSe([RV(3,Yl),RV(4,po)],NN);var ZU=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},QU=function(o,e){return function(t,i){e(t,i,o)}};const rSe=26;let RN=class extends W{static{d(this,"BannerController")}constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(PN))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(e){this.banner.show({...e,onClose:d(()=>{var t;this.hide(),(t=e.onClose)===null||t===void 0||t.call(e)},"onClose")}),this._editor.setBanner(this.banner.element,rSe)}};RN=ZU([QU(1,xe)],RN);let PN=class extends W{static{d(this,"Banner")}constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(Hl,{}),this.element=ie("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=ie("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){kn(this.element)}show(e){kn(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=Q(this.element,ie("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(ie(`div${Ae.asCSSSelector(e.icon)}`));const n=Q(this.element,ie("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=Q(this.element,ie("div.message-actions-container")),e.actions)for(const r of e.actions)this._register(this.instantiationService.createInstance(NN,this.messageActionsContainer,{...r,tabIndex:-1},{}));const s=Q(this.element,ie("div.action-container"));this.actionBar=this._register(new gr(s)),this.actionBar.push(this._register(new so("banner.close","Close Banner",Ae.asClassName(B8),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};PN=ZU([QU(0,xe)],PN);var hO=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},Op=function(o,e){return function(t,i){e(t,i,o)}};const aSe=bi("extensions-warning-message",re.warning,m("warningIcon","Icon shown with a warning message in the extensions editor."));let Dm=class extends W{static{d(this,"UnicodeHighlighter")}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:m("unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters","This document contains many non-basic ASCII unicode characters"),command:new Qm};else if(s.ambiguousCharacterCount>=r)a={message:m("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters","This document contains many ambiguous unicode characters"),command:new th};else if(s.invisibleCharacterCount>=r)a={message:m("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters","This document contains many invisible unicode characters"),command:new Zm};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:a.message,icon:aSe,actions:[{label:a.command.shortLabel,href:`command:${a.command.id}`}],onClose:d(()=>{this._bannerClosed=!0},"onClose")})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(RN,e)),this._register(this._editor.onDidChangeModel(()=>{this._bannerClosed=!1,this._updateHighlighter()})),this._options=e.getOption(125),this._register(i.onDidChangeTrust(s=>{this._updateHighlighter()})),this._register(e.onDidChangeConfiguration(s=>{s.hasChanged(125)&&(this._options=e.getOption(125),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=lSe(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"?UG:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new ON(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new dSe(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}};Dm.ID="editor.contrib.unicodeHighlighter";Dm=hO([Op(1,_r),Op(2,F9),Op(3,xe)],Dm);function lSe(o,e){return{nonBasicASCII:e.nonBasicASCII===vo?!o:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments===vo?!o:e.includeComments,includeStrings:e.includeStrings===vo?!o:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}d(lSe,"resolveOptions");let ON=class extends W{static{d(this,"DocumentUnicodeHighlighter")}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 Pt(()=>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:Wy.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();if(!vP(t,e))return null;const i=t.getValueInRange(e.range);return{reason:eG(i,this._options),inComment:CP(t,e),inString:wP(t,e)}}};ON=hO([Op(3,_r)],ON);class dSe extends W{static{d(this,"ViewportUnicodeHighlighter")}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 Pt(()=>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=IR.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:Wy.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 vP(t,e)?{reason:eG(i,this._options),inComment:CP(t,e),inString:wP(t,e)}:null}}const JU=m("unicodeHighlight.configureUnicodeHighlightOptions","Configure Unicode Highlight Options");let FN=class{static{d(this,"UnicodeHighlighterHoverParticipant")}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(Dm.ID);if(!n)return[];const s=[],r=new Set;let a=300;for(const l of t){const c=n.getDecorationInfo(l);if(!c)continue;const h=i.getValueInRange(l.range).codePointAt(0),g=gT(h);let f;switch(c.reason.kind){case 0:{D0(c.reason.confusableWith)?f=m("unicodeHighlight.characterIsAmbiguousASCII","The character {0} could be confused with the ASCII character {1}, which is more common in source code.",g,gT(c.reason.confusableWith.codePointAt(0))):f=m("unicodeHighlight.characterIsAmbiguous","The character {0} could be confused with the character {1}, which is more common in source code.",g,gT(c.reason.confusableWith.codePointAt(0)));break}case 1:f=m("unicodeHighlight.characterIsInvisible","The character {0} is invisible.",g);break;case 2:f=m("unicodeHighlight.characterIsNonBasicAscii","The character {0} is not a basic ASCII character.",g);break}if(r.has(f))continue;r.add(f);const p={codePoint:h,reason:c.reason,inComment:c.inComment,inString:c.inString},_=m("unicodeHighlight.adjustSettings","Adjust settings"),b=`command:${_C.ID}?${encodeURIComponent(JSON.stringify(p))}`,v=new Gn("",!0).appendMarkdown(f).appendText(" ").appendLink(b,_,JU);s.push(new fa(this,l.range,[v],!1,a++))}return s}renderHoverParts(e,t){return a_e(e,t,this._editor,this._languageService,this._openerService)}};FN=hO([Op(1,oi),Op(2,po)],FN);function HN(o){return`U+${o.toString(16).padStart(4,"0")}`}d(HN,"codePointToHex");function gT(o){let e=`\`${HN(o)}\``;return Tl.isInvisibleCharacter(o)||(e+=` "${`${cSe(o)}`}"`),e}d(gT,"formatCodePointMarkdown");function cSe(o){return o===96?"`` ` ``":"`"+String.fromCodePoint(o)+"`"}d(cSe,"renderCodePointAsInlineCode");function eG(o,e){return IR.computeUnicodeHighlightReason(o,e)}d(eG,"computeReason");class Wy{static{d(this,"Decorations")}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=$e.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}}Wy.instance=new Wy;class uSe extends ue{static{d(this,"DisableHighlightingInCommentsAction")}constructor(){super({id:th.ID,label:m("action.unicodeHighlight.disableHighlightingInComments","Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=m("unicodeHighlight.disableHighlightingInComments.shortLabel","Disable Highlight In Comments")}async run(e,t,i){const n=e?.get(et);n&&this.runAction(n)}async runAction(e){await e.updateValue(Vs.includeComments,!1,2)}}class hSe extends ue{static{d(this,"DisableHighlightingInStringsAction")}constructor(){super({id:th.ID,label:m("action.unicodeHighlight.disableHighlightingInStrings","Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=m("unicodeHighlight.disableHighlightingInStrings.shortLabel","Disable Highlight In Strings")}async run(e,t,i){const n=e?.get(et);n&&this.runAction(n)}async runAction(e){await e.updateValue(Vs.includeStrings,!1,2)}}class th extends ue{static{d(this,"DisableHighlightingOfAmbiguousCharactersAction")}constructor(){super({id:th.ID,label:m("action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters","Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=m("unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel","Disable Ambiguous Highlight")}async run(e,t,i){const n=e?.get(et);n&&this.runAction(n)}async runAction(e){await e.updateValue(Vs.ambiguousCharacters,!1,2)}}th.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";class Zm extends ue{static{d(this,"DisableHighlightingOfInvisibleCharactersAction")}constructor(){super({id:Zm.ID,label:m("action.unicodeHighlight.disableHighlightingOfInvisibleCharacters","Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=m("unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel","Disable Invisible Highlight")}async run(e,t,i){const n=e?.get(et);n&&this.runAction(n)}async runAction(e){await e.updateValue(Vs.invisibleCharacters,!1,2)}}Zm.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";class Qm extends ue{static{d(this,"DisableHighlightingOfNonBasicAsciiCharactersAction")}constructor(){super({id:Qm.ID,label:m("action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters","Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=m("unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel","Disable Non ASCII Highlight")}async run(e,t,i){const n=e?.get(et);n&&this.runAction(n)}async runAction(e){await e.updateValue(Vs.nonBasicASCII,!1,2)}}Qm.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";class _C extends ue{static{d(this,"ShowExcludeOptions")}constructor(){super({id:_C.ID,label:m("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),c=e.get(br),u=e.get(et);function h(p){return Tl.isInvisibleCharacter(p)?m("unicodeHighlight.excludeInvisibleCharFromBeingHighlighted","Exclude {0} (invisible character) from being highlighted",HN(p)):m("unicodeHighlight.excludeCharFromBeingHighlighted","Exclude {0} from being highlighted",`${HN(p)} "${l}"`)}d(h,"getExcludeCharFromBeingHighlightedLabel");const g=[];if(s.kind===0)for(const p of s.notAmbiguousInLocales)g.push({label:m("unicodeHighlight.allowCommonCharactersInLanguage",'Allow unicode characters that are more common in the language "{0}".',p),run:d(async()=>{fSe(u,[p])},"run")});if(g.push({label:h(n),run:d(()=>gSe(u,[n]),"run")}),a){const p=new uSe;g.push({label:p.label,run:d(async()=>p.runAction(u),"run")})}else if(r){const p=new hSe;g.push({label:p.label,run:d(async()=>p.runAction(u),"run")})}if(s.kind===0){const p=new th;g.push({label:p.label,run:d(async()=>p.runAction(u),"run")})}else if(s.kind===1){const p=new Zm;g.push({label:p.label,run:d(async()=>p.runAction(u),"run")})}else if(s.kind===2){const p=new Qm;g.push({label:p.label,run:d(async()=>p.runAction(u),"run")})}else pSe(s);const f=await c.pick(g,{title:JU});f&&await f.run()}}_C.ID="editor.action.unicodeHighlight.showExcludeOptions";async function gSe(o,e){const t=o.getValue(Vs.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const n of e)i[String.fromCodePoint(n)]=!0;await o.updateValue(Vs.allowedCharacters,i,2)}d(gSe,"excludeCharFromBeingHighlighted");async function fSe(o,e){var t;const i=(t=o.inspect(Vs.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(Vs.allowedLocales,n,2)}d(fSe,"excludeLocaleFromBeingHighlighted");function pSe(o){throw new Error(`Unexpected value: ${o}`)}d(pSe,"expectNever");ee(th);ee(Zm);ee(Qm);ee(_C);vt(Dm.ID,Dm,1);Ju.register(FN);var mSe=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},PV=function(o,e){return function(t,i){e(t,i,o)}};const tG="ignoreUnusualLineTerminators";function _Se(o,e,t){o.setModelProperty(e.uri,tG,t)}d(_Se,"writeIgnoreState");function bSe(o,e){return o.getModelProperty(e.uri,tG)}d(bSe,"readIgnoreState");let v0=class extends W{static{d(this,"UnusualLineTerminatorsDetector")}constructor(e,t,i){super(),this._editor=e,this._dialogService=t,this._codeEditorService=i,this._isPresentingDialog=!1,this._config=this._editor.getOption(126),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(126)&&(this._config=this._editor.getOption(126),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()||bSe(this._codeEditorService,e)===!0||this._editor.getOption(91))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:m("unusualLineTerminators.title","Unusual Line Terminators"),message:m("unusualLineTerminators.message","Detected unusual line terminators"),detail:m("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`.",ur(e.uri)),primaryButton:m({key:"unusualLineTerminators.fix",comment:["&& denotes a mnemonic"]},"&&Remove Unusual Line Terminators"),cancelButton:m("unusualLineTerminators.ignore","Ignore")})}finally{this._isPresentingDialog=!1}if(!i.confirmed){_Se(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}};v0.ID="editor.contrib.unusualLineTerminatorsDetector";v0=mSe([PV(1,K0),PV(2,bt)],v0);vt(v0.ID,v0,1);var iG=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)}},Xi,VN;const ik=new ce("hasWordHighlights",!1);function nG(o,e,t,i){const n=o.ordered(e);return pR(n.map(s=>()=>Promise.resolve(s.provideDocumentHighlights(e,t,i)).then(void 0,Li)),$n).then(s=>{if(s){const r=new Mi;return r.set(e.uri,s),r}return new Mi})}d(nG,"getOccurrencesAtPosition");function vSe(o,e,t,i,n,s){const r=o.ordered(e);return pR(r.map(a=>()=>{const l=s.filter(c=>IB(c)).filter(c=>xP(a.selector,c.uri,c.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(a.provideMultiDocumentHighlights(e,t,l,n)).then(void 0,Li)}),a=>a instanceof Mi&&a.size>0)}d(vSe,"getOccurrencesAcrossMultipleModels");class gO{static{d(this,"OccurenceAtPositionRequest")}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=ln(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 c=0,u=i.length;!l&&c=r&&(l=!0)}return l}cancel(){this.result.cancel()}}class CSe extends gO{static{d(this,"SemanticOccurenceAtPositionRequest")}constructor(e,t,i,n){super(e,t,i),this._providers=n}_compute(e,t,i,n){return nG(this._providers,e,t.getPosition(),n).then(s=>s||new Mi)}}class wSe extends gO{static{d(this,"MultiModelOccurenceRequest")}constructor(e,t,i,n,s){super(e,t,i),this._providers=n,this._otherModels=s}_compute(e,t,i,n){return vSe(this._providers,e,t.getPosition(),i,n,this._otherModels).then(s=>s||new Mi)}}class sG extends gO{static{d(this,"TextualOccurenceRequest")}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 Jd(250,n).then(()=>{const s=new Mi;let r;if(this._word?r=this._word:r=e.getWordAtPosition(t.getPosition()),!r)return new Mi;const a=[e,...this._otherModels];for(const l of a){if(l.isDisposed())continue;const u=l.findMatches(r.word,!0,!1,!0,i,!1).map(h=>({range:h.range,kind:$b.Text}));u&&s.set(l.uri,u)}return s})}isValid(e,t,i){const n=t.isEmpty();return this._selectionIsEmpty!==n?!1:super.isValid(e,t,i)}}function SSe(o,e,t,i,n){return o.has(e)?new CSe(e,t,n,o):new sG(e,t,i,n,[])}d(SSe,"computeOccurencesAtPosition");function ySe(o,e,t,i,n,s){return o.has(e)?new wSe(e,t,n,o,s):new sG(e,t,i,n,s)}d(ySe,"computeOccurencesMultiModel");jl("_executeDocumentHighlights",async(o,e,t)=>{const i=o.get(me),n=await nG(i.documentHighlightProvider,e,t,ot.None);return n?.get(e.uri)});let C0=Xi=class{static{d(this,"WordHighlighter")}constructor(e,t,i,n,s){this.toUnhook=new Y,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new Mi,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=s,this._hasWordHighlights=ik.bindTo(n),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(81),this.model=this.editor.getModel(),this.toUnhook.add(e.onDidChangeCursorPosition(r=>{this._ignorePositionChangeEvent||this.occurrencesHighlight!=="off"&&this._onPositionChanged(r)})),this.toUnhook.add(e.onDidFocusEditorText(r=>{this.occurrencesHighlight!=="off"&&(this.workerRequest||this._run())})),this.toUnhook.add(e.onDidChangeModelContent(r=>{this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(r=>{!r.newModelUrl&&r.oldModelUrl?this._stopSingular():Xi.query&&this._run()})),this.toUnhook.add(e.onDidChangeConfiguration(r=>{const a=this.editor.getOption(81);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,Xi.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);$s(`${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);$s(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=Xi.storedDecorations.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),Xi.storedDecorations.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(){const e=this.codeEditorService.listCodeEditors(),t=[];for(const i of e){if(!i.hasModel())continue;const n=Xi.storedDecorations.get(i.getModel().uri);if(!n)continue;i.removeDecorations(n),t.push(i.getModel().uri);const s=lc.get(i);s?.wordHighlighter&&s.wordHighlighter.decorations.length>0&&(s.wordHighlighter.decorations.clear(),s.wordHighlighter.workerRequest=null,s.wordHighlighter._hasWordHighlights.set(!1))}for(const i of t)Xi.storedDecorations.delete(i)}_stopSingular(){var e,t,i,n;this._removeSingleDecorations(),this.editor.hasTextFocus()&&(((e=this.editor.getModel())===null||e===void 0?void 0:e.uri.scheme)!==Fe.vscodeNotebookCell&&((i=(t=Xi.query)===null||t===void 0?void 0:t.modelInfo)===null||i===void 0?void 0:i.model.uri.scheme)!==Fe.vscodeNotebookCell?(Xi.query=null,this._run()):!((n=Xi.query)===null||n===void 0)&&n.modelInfo&&(Xi.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)!==Fe.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===Fe.vscodeNotebookCell){const s=[],r=this.codeEditorService.listCodeEditors();for(const a of r){const l=a.getModel();l&&l!==e&&l.uri.scheme===Fe.vscodeNotebookCell&&s.push(l)}return s}const i=[],n=this.codeEditorService.listCodeEditors();for(const s of n){if(!C2(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;let t;if(this.editor.hasTextFocus()){const n=this.editor.getSelection();if(!n||n.startLineNumber!==n.endLineNumber){Xi.query=null,this._stopAll();return}const s=n.startColumn,r=n.endColumn,a=this._getWord();if(!a||a.startColumn>s||a.endColumn{n===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=r||[],this._beginRenderDecorations())},Ue)}}computeWithModel(e,t,i,n){return n.length?ySe(this.multiDocumentProviders,e,t,i,this.editor.getOption(131),n):SSe(this.providers,e,t,i,this.editor.getOption(131))}_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=lc.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 c=Xi.storedDecorations.get(l),u=this.workerRequestValue.get(l);if(u)for(const g of u)g.range&&a.push({range:g.range,options:Rwe(g.kind)});let h=[];s.changeDecorations(g=>{h=g.deltaDecorations(c??[],a)}),Xi.storedDecorations=Xi.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()}};C0.storedDecorations=new Mi;C0.query=null;C0=Xi=iG([R1(4,bt)],C0);let lc=VN=class extends W{static{d(this,"WordHighlighterContribution")}static get(e){return e.getContribution(VN.ID)}constructor(e,t,i,n){super(),this._wordHighlighter=null;const s=d(()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new C0(e,i.documentHighlightProvider,i.multiDocumentHighlightProvider,t,n))},"createWordHighlighterIfPossible");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()}};lc.ID="editor.contrib.wordHighlighter";lc=VN=iG([R1(1,Ne),R1(2,me),R1(3,bt)],lc);class oG extends ue{static{d(this,"WordHighlightNavigationAction")}constructor(e,t){super(t),this._isNext=e}run(e,t){const i=lc.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}class LSe extends oG{static{d(this,"NextWordHighlightAction")}constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:m("wordHighlight.next.label","Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:ik,kbOpts:{kbExpr:I.editorTextFocus,primary:65,weight:100}})}}class xSe extends oG{static{d(this,"PrevWordHighlightAction")}constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:m("wordHighlight.previous.label","Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:ik,kbOpts:{kbExpr:I.editorTextFocus,primary:1089,weight:100}})}}class kSe extends ue{static{d(this,"TriggerWordHighlightAction")}constructor(){super({id:"editor.action.wordHighlight.trigger",label:m("wordHighlight.trigger.label","Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:ik.toNegated(),kbOpts:{kbExpr:I.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const n=lc.get(t);n&&n.restoreViewState(!0)}}vt(lc.ID,lc,0);ee(LSe);ee(xSe);ee(kSe);class nk extends Ji{static{d(this,"MoveWordCommand")}constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const n=cr(t.getOption(131),t.getOption(130)),s=t.getModel(),a=t.getSelections().map(l=>{const c=new H(l.positionLineNumber,l.positionColumn),u=this._move(n,s,c,this._wordNavigationType);return this._moveTo(l,u,this._inSelectionMode)});if(s.pushStackElement(),t._getViewModel().setCursorStates("moveWordCommand",3,a.map(l=>mt.fromModelSelection(l))),a.length===1){const l=new H(a[0].positionLineNumber,a[0].positionColumn);t.revealPosition(l,0)}}_moveTo(e,t,i){return i?new be(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new be(t.lineNumber,t.column,t.lineNumber,t.column)}}class ih extends nk{static{d(this,"WordLeftCommand")}_move(e,t,i,n){return Lt.moveWordLeft(e,t,i,n)}}class nh extends nk{static{d(this,"WordRightCommand")}_move(e,t,i,n){return Lt.moveWordRight(e,t,i,n)}}class DSe extends ih{static{d(this,"CursorWordStartLeft")}constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class TSe extends ih{static{d(this,"CursorWordEndLeft")}constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class ESe extends ih{static{d(this,"CursorWordLeft")}constructor(){var e;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:j.and(I.textInputFocus,(e=j.and(O0,ZL))===null||e===void 0?void 0:e.negate()),primary:2063,mac:{primary:527},weight:100}})}}class ISe extends ih{static{d(this,"CursorWordStartLeftSelect")}constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class MSe extends ih{static{d(this,"CursorWordEndLeftSelect")}constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class ASe extends ih{static{d(this,"CursorWordLeftSelect")}constructor(){var e;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:j.and(I.textInputFocus,(e=j.and(O0,ZL))===null||e===void 0?void 0:e.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class NSe extends ih{static{d(this,"CursorWordAccessibilityLeft")}constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,n){return super._move(cr(Fa.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n)}}class RSe extends ih{static{d(this,"CursorWordAccessibilityLeftSelect")}constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,n){return super._move(cr(Fa.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n)}}class PSe extends nh{static{d(this,"CursorWordStartRight")}constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class OSe extends nh{static{d(this,"CursorWordEndRight")}constructor(){var e;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:j.and(I.textInputFocus,(e=j.and(O0,ZL))===null||e===void 0?void 0:e.negate()),primary:2065,mac:{primary:529},weight:100}})}}class FSe extends nh{static{d(this,"CursorWordRight")}constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class HSe extends nh{static{d(this,"CursorWordStartRightSelect")}constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class VSe extends nh{static{d(this,"CursorWordEndRightSelect")}constructor(){var e;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:j.and(I.textInputFocus,(e=j.and(O0,ZL))===null||e===void 0?void 0:e.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class WSe extends nh{static{d(this,"CursorWordRightSelect")}constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class BSe extends nh{static{d(this,"CursorWordAccessibilityRight")}constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,n){return super._move(cr(Fa.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n)}}class zSe extends nh{static{d(this,"CursorWordAccessibilityRightSelect")}constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,n){return super._move(cr(Fa.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n)}}class sk extends Ji{static{d(this,"DeleteWordCommand")}constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const n=e.get(Kt);if(!t.hasModel())return;const s=cr(t.getOption(131),t.getOption(130)),r=t.getModel(),a=t.getSelections(),l=t.getOption(6),c=t.getOption(11),u=n.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),h=t._getViewModel(),g=a.map(f=>{const p=this._delete({wordSeparators:s,model:r,selection:f,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:t.getOption(9),autoClosingBrackets:l,autoClosingQuotes:c,autoClosingPairs:u,autoClosedCharacters:h.getCursorAutoClosedCharacters()},this._wordNavigationType);return new An(p,"")});t.pushUndoStop(),t.executeCommands(this.id,g),t.pushUndoStop()}}class fO extends sk{static{d(this,"DeleteWordLeftCommand")}_delete(e,t){const i=Lt.deleteWordLeft(e,t);return i||new k(1,1,1,1)}}class pO extends sk{static{d(this,"DeleteWordRightCommand")}_delete(e,t){const i=Lt.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 USe extends fO{static{d(this,"DeleteWordStartLeft")}constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:I.writable})}}class GSe extends fO{static{d(this,"DeleteWordEndLeft")}constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:I.writable})}}class KSe extends fO{static{d(this,"DeleteWordLeft")}constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:I.writable,kbOpts:{kbExpr:I.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class $Se extends pO{static{d(this,"DeleteWordStartRight")}constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:I.writable})}}class jSe extends pO{static{d(this,"DeleteWordEndRight")}constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:I.writable})}}class qSe extends pO{static{d(this,"DeleteWordRight")}constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:I.writable,kbOpts:{kbExpr:I.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class YSe extends ue{static{d(this,"DeleteInsideWord")}constructor(){super({id:"deleteInsideWord",precondition:I.writable,label:m("deleteInsideWord","Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const n=cr(t.getOption(131),t.getOption(130)),s=t.getModel(),a=t.getSelections().map(l=>{const c=Lt.deleteInsideWord(n,s,l);return new An(c,"")});t.pushUndoStop(),t.executeCommands(this.id,a),t.pushUndoStop()}}de(new DSe);de(new TSe);de(new ESe);de(new ISe);de(new MSe);de(new ASe);de(new PSe);de(new OSe);de(new FSe);de(new HSe);de(new VSe);de(new WSe);de(new NSe);de(new RSe);de(new BSe);de(new zSe);de(new USe);de(new GSe);de(new KSe);de(new $Se);de(new jSe);de(new qSe);ee(YSe);class XSe extends sk{static{d(this,"DeleteWordPartLeft")}constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:I.writable,kbOpts:{kbExpr:I.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){const i=yL.deleteWordPartLeft(e);return i||new k(1,1,1,1)}}class ZSe extends sk{static{d(this,"DeleteWordPartRight")}constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:I.writable,kbOpts:{kbExpr:I.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){const i=yL.deleteWordPartRight(e);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new k(n,s,n,s)}}class rG extends nk{static{d(this,"WordPartLeftCommand")}_move(e,t,i,n){return yL.moveWordPartLeft(e,t,i)}}class QSe extends rG{static{d(this,"CursorWordPartLeft")}constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:I.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}ut.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class JSe extends rG{static{d(this,"CursorWordPartLeftSelect")}constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:I.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}ut.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class aG extends nk{static{d(this,"WordPartRightCommand")}_move(e,t,i,n){return yL.moveWordPartRight(e,t,i)}}class eye extends aG{static{d(this,"CursorWordPartRight")}constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:I.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class tye extends aG{static{d(this,"CursorWordPartRightSelect")}constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:I.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}de(new XSe);de(new ZSe);de(new QSe);de(new JSe);de(new eye);de(new tye);class WN extends W{static{d(this,"ReadOnlyMessageController")}constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const e=xs.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(92);t||(this.editor.isSimpleWidget?t=new Gn(m("editor.simple.readonly","Cannot edit in read-only input")):t=new Gn(m("editor.readonly","Cannot edit in read-only editor"))),e.showMessage(t,this.editor.getPosition())}}}WN.ID="editor.contrib.readOnlyMessageController";vt(WN.ID,WN,2);var iye=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},OV=function(o,e){return function(t,i){e(t,i,o)}};let BN=class extends W{static{d(this,"DiffEditorBreadcrumbsSource")}constructor(e,t,i){super(),this._textModel=e,this._languageFeaturesService=t,this._outlineModelService=i,this._currentModel=gt(this,void 0);const n=Kn("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),s=Kn("_textModel.onDidChangeContent",le.debounce(r=>this._textModel.onDidChangeContent(r),()=>{},100));this._register(hr(async(r,a)=>{n.read(r),s.read(r);const l=a.add(new Lue),c=await this._outlineModelService.getOrCreate(this._textModel,l.token);a.isDisposed||this._currentModel.set(c,void 0)}))}getBreadcrumbItems(e,t){const i=this._currentModel.read(t);if(!i)return[];const n=i.asListOfDocumentSymbols().filter(s=>e.contains(s.range.startLineNumber)&&!e.contains(s.range.endLineNumber));return n.sort(qV(Us(s=>s.range.endLineNumber-s.range.startLineNumber,Vr))),n.map(s=>({name:s.name,kind:s.kind,startLineNumber:s.range.startLineNumber}))}};BN=iye([OV(1,me),OV(2,pC)],BN);Gv.setBreadcrumbsSourceFactory((o,e)=>e.createInstance(BN,o));class zN extends W{static{d(this,"IPadShowKeyboard")}constructor(e){super(),this.editor=e,this.widget=null,Da&&(this._register(e.onDidChangeConfiguration(()=>this.update())),this.update())}update(){const e=!this.editor.getOption(91);!this.widget&&e?this.widget=new ok(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}}zN.ID="editor.contrib.iPadShowKeyboard";class ok extends W{static{d(this,"ShowKeyboardWidget")}constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(G(this._domNode,"touchstart",t=>{this.editor.focus()})),this._register(G(this._domNode,"focus",t=>{this.editor.focus()})),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return ok.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}}ok.ID="editor.contrib.ShowKeyboardWidget";vt(zN.ID,zN,3);var nye=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},FV=function(o,e){return function(t,i){e(t,i,o)}},UN;let Tm=UN=class extends W{static{d(this,"InspectTokensController")}static get(e){return e.getContribution(UN.ID)}constructor(e,t,i){super(),this._editor=e,this._languageService=i,this._widget=null,this._register(this._editor.onDidChangeModel(n=>this.stop())),this._register(this._editor.onDidChangeModelLanguage(n=>this.stop())),this._register(fi.onDidChange(n=>this.stop())),this._register(this._editor.onKeyUp(n=>n.keyCode===9&&this.stop()))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&(this._widget=new rk(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}};Tm.ID="editor.contrib.inspectTokens";Tm=UN=nye([FV(1,$o),FV(2,oi)],Tm);class sye extends ue{static{d(this,"InspectTokens")}constructor(){super({id:"editor.action.inspectTokens",label:jI.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(e,t){const i=Tm.get(t);i?.launch()}}function oye(o){let e="";for(let t=0,i=o.length;tjp,"getInitialState"),tokenize:d((n,s,r)=>FR(e,r),"tokenize"),tokenizeEncoded:d((n,s,r)=>pL(i,r),"tokenizeEncoded")}}d(rye,"getSafeTokenizationSupport");class rk extends W{static{d(this,"InspectTokensWidget")}constructor(e,t){super(),this.allowEditorOverflow=!0,this._editor=e,this._languageService=t,this._model=this._editor.getModel(),this._domNode=document.createElement("div"),this._domNode.className="tokens-inspect-widget",this._tokenizationSupport=rye(this._languageService.languageIdCodec,this._model.getLanguageId()),this._compute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition(i=>this._compute(this._editor.getPosition()))),this._editor.addContentWidget(this)}dispose(){this._editor.removeContentWidget(this),super.dispose()}getId(){return rk._ID}_compute(e){const t=this._getTokensAtLine(e.lineNumber);let i=0;for(let l=t.tokens1.length-1;l>=0;l--){const c=t.tokens1[l];if(e.column-1>=c.offset){i=l;break}}let n=0;for(let l=t.tokens2.length>>>1;l>=0;l--)if(e.column-1>=t.tokens2[l<<1]){n=l;break}const s=this._model.getLineContent(e.lineNumber);let r="";if(i=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},HV=function(o,e){return function(t,i){e(t,i,o)}},nb;let By=nb=class{static{d(this,"HelpQuickAccessProvider")}constructor(e,t){this.quickInputService=e,this.keybindingService=t,this.registry=hi.as(Jg.Quickaccess)}provide(e){const t=new Y;return t.add(e.onDidAccept(()=>{const[i]=e.selectedItems;i&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})})),t.add(e.onDidChangeValue(i=>{const n=this.registry.getQuickAccessProvider(i.substr(nb.PREFIX.length));n&&n.prefix&&n.prefix!==nb.PREFIX&&this.quickInputService.quickAccess.show(n.prefix,{preserveValue:!0})})),e.items=this.getQuickAccessProviders().filter(i=>i.prefix!==nb.PREFIX),t}getQuickAccessProviders(){return this.registry.getQuickAccessProviders().sort((t,i)=>t.prefix.localeCompare(i.prefix)).flatMap(t=>this.createPicks(t))}createPicks(e){return e.helpEntries.map(t=>{const i=t.prefix||e.prefix,n=i||"…";return{prefix:i,label:n,keybinding:t.commandId?this.keybindingService.lookupKeybinding(t.commandId):void 0,ariaLabel:m("helpPickAriaLabel","{0}, {1}",n,t.description),description:t.description}})}};By.PREFIX="?";By=nb=aye([HV(0,br),HV(1,yt)],By);hi.as(Jg.Quickaccess).registerQuickAccessProvider({ctor:By,prefix:"",helpEntries:[{description:qI.helpQuickAccessActionLabel}]});class lG{static{d(this,"AbstractEditorNavigationQuickAccessProvider")}constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t,i){var n;const s=new Y;e.canAcceptInBackground=!!(!((n=this.options)===null||n===void 0)&&n.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;const r=s.add(new dn);return r.value=this.doProvide(e,t,i),s.add(this.onDidActiveTextEditorControlChange(()=>{r.value=void 0,r.value=this.doProvide(e,t)})),s}doProvide(e,t,i){var n;const s=new Y,r=this.activeTextEditorControl;if(r&&this.canProvideWithTextEditor(r)){const a={editor:r},l=h6(r);if(l){let c=(n=r.saveViewState())!==null&&n!==void 0?n:void 0;s.add(l.onDidChangeCursorPosition(()=>{var u;c=(u=r.saveViewState())!==null&&u!==void 0?u:void 0})),a.restoreViewState=()=>{c&&r===this.activeTextEditorControl&&r.restoreViewState(c)},s.add(Cu(t.onCancellationRequested)(()=>{var u;return(u=a.restoreViewState)===null||u===void 0?void 0:u.call(a)}))}s.add(we(()=>this.clearDecorations(r))),s.add(this.provideWithTextEditor(a,e,t,i))}else s.add(this.provideWithoutTextEditor(e,t));return s}canProvideWithTextEditor(e){return!0}gotoLocation({editor:e},t){e.setSelection(t.range,"code.jump"),e.revealRangeInCenter(t.range,0),t.preserveFocus||e.focus();const i=e.getModel();i&&"getLineContent"in i&&Pl(`${i.getLineContent(t.range.startLineNumber)}`)}getModel(e){var t;return C2(e)?(t=e.getModel())===null||t===void 0?void 0:t.modified:e.getModel()}addDecorations(e,t){e.changeDecorations(i=>{const n=[];this.rangeHighlightDecorationId&&(n.push(this.rangeHighlightDecorationId.overviewRulerDecorationId),n.push(this.rangeHighlightDecorationId.rangeHighlightId),this.rangeHighlightDecorationId=void 0);const s=[{range:t,options:{description:"quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"quick-access-range-highlight-overview",overviewRuler:{color:pi(p7),position:Vo.Full}}}],[r,a]=i.deltaDecorations(n,s);this.rangeHighlightDecorationId={rangeHighlightId:r,overviewRulerDecorationId:a}})}clearDecorations(e){const t=this.rangeHighlightDecorationId;t&&(e.changeDecorations(i=>{i.deltaDecorations([t.overviewRulerDecorationId,t.rangeHighlightId],[])}),this.rangeHighlightDecorationId=void 0)}}class ak extends lG{static{d(this,"AbstractGotoLineQuickAccessProvider")}constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(e){const t=m("cannotRunGotoLine","Open a text editor first to go to a line.");return e.items=[{label:t}],e.ariaLabel=t,W.None}provideWithTextEditor(e,t,i){const n=e.editor,s=new Y;s.add(t.onDidAccept(l=>{const[c]=t.selectedItems;if(c){if(!this.isValidLineNumber(n,c.lineNumber))return;this.gotoLocation(e,{range:this.toRange(c.lineNumber,c.column),keyMods:t.keyMods,preserveFocus:l.inBackground}),l.inBackground||t.hide()}}));const r=d(()=>{const l=this.parsePosition(n,t.value.trim().substr(ak.PREFIX.length)),c=this.getPickLabel(n,l.lineNumber,l.column);if(t.items=[{lineNumber:l.lineNumber,column:l.column,label:c}],t.ariaLabel=c,!this.isValidLineNumber(n,l.lineNumber)){this.clearDecorations(n);return}const u=this.toRange(l.lineNumber,l.column);n.revealRangeInCenter(u,0),this.addDecorations(n,u)},"updatePickerAndEditor");r(),s.add(t.onDidChangeValue(()=>r()));const a=h6(n);return a&&a.getOptions().get(68).renderType===2&&(a.updateOptions({lineNumbers:"on"}),s.add(we(()=>a.updateOptions({lineNumbers:"relative"})))),s}toRange(e=1,t=1){return{startLineNumber:e,startColumn:t,endLineNumber:e,endColumn:t}}parsePosition(e,t){const i=t.split(/,|:|#/).map(s=>parseInt(s,10)).filter(s=>!isNaN(s)),n=this.lineCount(e)+1;return{lineNumber:i[0]>0?i[0]:n+i[0],column:i[1]}}getPickLabel(e,t,i){if(this.isValidLineNumber(e,t))return this.isValidColumn(e,t,i)?m("gotoLineColumnLabel","Go to line {0} and character {1}.",t,i):m("gotoLineLabel","Go to line {0}.",t);const n=e.getPosition()||{lineNumber:1,column:1},s=this.lineCount(e);return s>1?m("gotoLineLabelEmptyWithLimit","Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",n.lineNumber,n.column,s):m("gotoLineLabelEmpty","Current Line: {0}, Character: {1}. Type a line number to navigate to.",n.lineNumber,n.column)}isValidLineNumber(e,t){return!t||typeof t!="number"?!1:t>0&&t<=this.lineCount(e)}isValidColumn(e,t,i){if(!i||typeof i!="number")return!1;const n=this.getModel(e);if(!n)return!1;const s={lineNumber:t,column:i};return n.validatePosition(s).equals(s)}lineCount(e){var t,i;return(i=(t=this.getModel(e))===null||t===void 0?void 0:t.getLineCount())!==null&&i!==void 0?i:0}}ak.PREFIX=":";var lye=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},dye=function(o,e){return function(t,i){e(t,i,o)}};let w0=class extends ak{static{d(this,"StandaloneGotoLineQuickAccessProvider")}constructor(e){super(),this.editorService=e,this.onDidActiveTextEditorControlChange=le.None}get activeTextEditorControl(){var e;return(e=this.editorService.getFocusedCodeEditor())!==null&&e!==void 0?e:void 0}};w0=lye([dye(0,bt)],w0);let mO=class dG extends ue{static{d(this,"GotoLineAction")}constructor(){super({id:dG.ID,label:AS.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:I.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(br).quickAccess.show(w0.PREFIX)}};mO.ID="editor.action.gotoLine";ee(mO);hi.as(Jg.Quickaccess).registerQuickAccessProvider({ctor:w0,prefix:w0.PREFIX,helpEntries:[{description:AS.gotoLineActionLabel,commandId:mO.ID}]});const cG=[void 0,[]];function fT(o,e,t=0,i=0){const n=e;return n.values&&n.values.length>1?cye(o,n.values,t,i):uG(o,e,t,i)}d(fT,"scoreFuzzy2");function cye(o,e,t,i){let n=0;const s=[];for(const r of e){const[a,l]=uG(o,r,t,i);if(typeof a!="number")return cG;n+=a,s.push(...l)}return[n,uye(s)]}d(cye,"doScoreFuzzy2Multiple");function uG(o,e,t,i){const n=wg(e.original,e.originalLowercase,t,o,o.toLowerCase(),i,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],$0(n)]:cG}d(uG,"doScoreFuzzy2Single");function uye(o){const e=o.sort((n,s)=>n.start-s.start),t=[];let i;for(const n of e)!i||!hye(i,n)?(i=n,t.push(n)):(i.start=Math.min(i.start,n.start),i.end=Math.max(i.end,n.end));return t}d(uye,"normalizeMatches");function hye(o,e){return!(o.end=0,r=VV(o);let a;const l=o.split(hG);if(l.length>1)for(const c of l){const u=VV(c),{pathNormalized:h,normalized:g,normalizedLowercase:f}=WV(c);g&&(a||(a=[]),a.push({original:c,originalLowercase:c.toLowerCase(),pathNormalized:h,normalized:g,normalizedLowercase:f,expectContiguousMatch:u}))}return{original:o,originalLowercase:e,pathNormalized:t,normalized:i,normalizedLowercase:n,values:a,containsPathSeparator:s,expectContiguousMatch:r}}d(GN,"prepareQuery");function WV(o){let e;Hn?e=o.replace(/\//g,va):e=o.replace(/\\/g,va);const t=O$(e).replace(/\s|"/g,"");return{pathNormalized:e,normalized:t,normalizedLowercase:t.toLowerCase()}}d(WV,"normalizeQuery");function BV(o){return Array.isArray(o)?GN(o.map(e=>e.original).join(hG)):GN(o.original)}d(BV,"pieceToQuery");var gye=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},zV=function(o,e){return function(t,i){e(t,i,o)}},Fp;let Al=Fp=class extends lG{static{d(this,"AbstractGotoSymbolQuickAccessProvider")}constructor(e,t,i=Object.create(null)){super(i),this._languageFeaturesService=e,this._outlineModelService=t,this.options=i,this.options.canAcceptInBackground=!0}provideWithoutTextEditor(e){return this.provideLabelPick(e,m("cannotRunGotoSymbolWithoutEditor","To go to a symbol, first open a text editor with symbol information.")),W.None}provideWithTextEditor(e,t,i,n){const s=e.editor,r=this.getModel(s);return r?this._languageFeaturesService.documentSymbolProvider.has(r)?this.doProvideWithEditorSymbols(e,r,t,i,n):this.doProvideWithoutEditorSymbols(e,r,t,i):W.None}doProvideWithoutEditorSymbols(e,t,i,n){const s=new Y;return this.provideLabelPick(i,m("cannotRunGotoSymbolWithoutSymbolProvider","The active text editor does not provide symbol information.")),(async()=>!await this.waitForLanguageSymbolRegistry(t,s)||n.isCancellationRequested||s.add(this.doProvideWithEditorSymbols(e,t,i,n)))(),s}provideLabelPick(e,t){e.items=[{label:t,index:0,kind:14}],e.ariaLabel=t}async waitForLanguageSymbolRegistry(e,t){if(this._languageFeaturesService.documentSymbolProvider.has(e))return!0;const i=new I0,n=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(n.dispose(),i.complete(!0))}));return t.add(we(()=>i.complete(!1))),i.p}doProvideWithEditorSymbols(e,t,i,n,s){var r;const a=e.editor,l=new Y;l.add(i.onDidAccept(g=>{var f;const[p]=i.selectedItems;p&&p.range&&(this.gotoLocation(e,{range:p.range.selection,keyMods:i.keyMods,preserveFocus:g.inBackground}),(f=s?.handleAccept)===null||f===void 0||f.call(s,p),g.inBackground||i.hide())})),l.add(i.onDidTriggerItemButton(({item:g})=>{g&&g.range&&(this.gotoLocation(e,{range:g.range.selection,keyMods:i.keyMods,forceSideBySide:!0}),i.hide())}));const c=this.getDocumentSymbols(t,n);let u;const h=d(async g=>{u?.dispose(!0),i.busy=!1,u=new ui(n),i.busy=!0;try{const f=GN(i.value.substr(Fp.PREFIX.length).trim()),p=await this.doGetSymbolPicks(c,f,void 0,u.token,t);if(n.isCancellationRequested)return;if(p.length>0){if(i.items=p,g&&f.original.length===0){const _=ev(p,b=>!!(b.type!=="separator"&&b.range&&k.containsPosition(b.range.decoration,g)));_&&(i.activeItems=[_])}}else f.original.length>0?this.provideLabelPick(i,m("noMatchingSymbolResults","No matching editor symbols")):this.provideLabelPick(i,m("noSymbolResults","No editor symbols"))}finally{n.isCancellationRequested||(i.busy=!1)}},"updatePickerItems");return l.add(i.onDidChangeValue(()=>h(void 0))),h((r=a.getSelection())===null||r===void 0?void 0:r.getPosition()),l.add(i.onDidChangeActive(()=>{const[g]=i.activeItems;g&&g.range&&(a.revealRangeInCenter(g.range.selection,0),this.addDecorations(a,g.range.decoration))})),l}async doGetSymbolPicks(e,t,i,n,s){var r,a;const l=await e;if(n.isCancellationRequested)return[];const c=t.original.indexOf(Fp.SCOPE_PREFIX)===0,u=c?1:0;let h,g;t.values&&t.values.length>1?(h=BV(t.values[0]),g=BV(t.values.slice(1))):h=t;let f;const p=(a=(r=this.options)===null||r===void 0?void 0:r.openSideBySideDirection)===null||a===void 0?void 0:a.call(r);p&&(f=[{iconClass:p==="right"?Ae.asClassName(re.splitHorizontal):Ae.asClassName(re.splitVertical),tooltip:p==="right"?m("openToSide","Open to the Side"):m("openToBottom","Open to the Bottom")}]);const _=[];for(let C=0;Cu){let V=!1;if(h!==t&&([E,A]=fT(y,{...t,values:void 0},u,x),typeof E=="number"&&(V=!0)),typeof E!="number"&&([E,A]=fT(y,h,u,x),typeof E!="number"))continue;if(!V&&g){if(D&&g.original.length>0&&([z,O]=fT(D,g)),typeof z!="number")continue;typeof E=="number"&&(E+=z)}}const P=w.tags&&w.tags.indexOf(1)>=0;_.push({index:C,kind:w.kind,score:E,label:y,ariaLabel:T$(w.name,w.kind),description:D,highlights:P?void 0:{label:A,description:O},range:{selection:k.collapseToStart(w.selectionRange),decoration:w.range},uri:s.uri,symbolName:S,strikethrough:P,buttons:f})}const b=_.sort((C,w)=>c?this.compareByKindAndScore(C,w):this.compareByScore(C,w));let v=[];if(c){let y=function(){w&&typeof C=="number"&&S>0&&(w.label=ug(mT[C]||pT,S))};d(y,"updateLastSeparatorLabel");let C,w,S=0;for(const x of b)C!==x.kind?(y(),C=x.kind,S=1,w={type:"separator"},v.push(w)):S++,v.push(x);y()}else b.length>0&&(v=[{label:m("symbols","symbols ({0})",_.length),type:"separator"},...b]);return v}compareByScore(e,t){if(typeof e.score!="number"&&typeof t.score=="number")return 1;if(typeof e.score=="number"&&typeof t.score!="number")return-1;if(typeof e.score=="number"&&typeof t.score=="number"){if(e.score>t.score)return-1;if(e.scoret.index?1:0}compareByKindAndScore(e,t){const i=mT[e.kind]||pT,n=mT[t.kind]||pT,s=i.localeCompare(n);return s===0?this.compareByScore(e,t):s}async getDocumentSymbols(e,t){const i=await this._outlineModelService.getOrCreate(e,t);return t.isCancellationRequested?[]:i.asListOfDocumentSymbols()}};Al.PREFIX="@";Al.SCOPE_PREFIX=":";Al.PREFIX_BY_CATEGORY=`${Fp.PREFIX}${Fp.SCOPE_PREFIX}`;Al=Fp=gye([zV(0,me),zV(1,pC)],Al);const pT=m("property","properties ({0})"),mT={5:m("method","methods ({0})"),11:m("function","functions ({0})"),8:m("_constructor","constructors ({0})"),12:m("variable","variables ({0})"),4:m("class","classes ({0})"),22:m("struct","structs ({0})"),23:m("event","events ({0})"),24:m("operator","operators ({0})"),10:m("interface","interfaces ({0})"),2:m("namespace","namespaces ({0})"),3:m("package","packages ({0})"),25:m("typeParameter","type parameters ({0})"),1:m("modules","modules ({0})"),6:m("property","properties ({0})"),9:m("enum","enumerations ({0})"),21:m("enumMember","enumeration members ({0})"),14:m("string","strings ({0})"),0:m("file","files ({0})"),17:m("array","arrays ({0})"),15:m("number","numbers ({0})"),16:m("boolean","booleans ({0})"),18:m("object","objects ({0})"),19:m("key","keys ({0})"),7:m("field","fields ({0})"),13:m("constant","constants ({0})")};var fye=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},_T=function(o,e){return function(t,i){e(t,i,o)}};let KN=class extends Al{static{d(this,"StandaloneGotoSymbolQuickAccessProvider")}constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=le.None}get activeTextEditorControl(){var e;return(e=this.editorService.getFocusedCodeEditor())!==null&&e!==void 0?e:void 0}};KN=fye([_T(0,bt),_T(1,me),_T(2,pC)],KN);class bC extends ue{static{d(this,"GotoSymbolAction")}constructor(){super({id:bC.ID,label:xv.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:I.hasDocumentSymbolProvider,kbOpts:{kbExpr:I.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get(br).quickAccess.show(Al.PREFIX,{itemActivation:oa.NONE})}}bC.ID="editor.action.quickOutline";ee(bC);hi.as(Jg.Quickaccess).registerQuickAccessProvider({ctor:KN,prefix:Al.PREFIX,helpEntries:[{description:xv.quickOutlineActionLabel,prefix:Al.PREFIX,commandId:bC.ID},{description:xv.quickOutlineByCategoryActionLabel,prefix:Al.PREFIX_BY_CATEGORY}]});function pye(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}d(pye,"countMapFrom");class Hb{static{d(this,"TfIdfCalculator")}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 c=this.computeSimilarityScore(l,i,n);c>0&&s.push({key:r,score:c})}}return s}static termFrequencies(e){return pye(Hb.splitTerms(e))}static*splitTerms(e){const t=d(i=>i.toLowerCase(),"normalize");for(const[i]of e.matchAll(/\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&&/\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=Hb.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 c=a*l;n+=c*r}return n}computeEmbedding(e){const t=Hb.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 mye(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}d(mye,"normalizeTfIdfScores");var dp;(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"})(dp||(dp={}));function bT(o){const e=o;return Array.isArray(e.items)}d(bT,"isPicksWithActive");function UV(o){const e=o;return!!e.picks&&e.additionalPicks instanceof Promise}d(UV,"isFastAndSlowPicks");class _ye extends W{static{d(this,"PickerQuickAccessProvider")}constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,i){var n;const s=new Y;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 dn),l=d(async()=>{var u;const h=a.value=new Y;r?.dispose(!0),e.busy=!1,r=new ui(t);const g=r.token;let f=e.value.substring(this.prefix.length);!((u=this.options)===null||u===void 0)&&u.shouldSkipTrimPickFilter||(f=f.trim());const p=this._getPicks(f,h,g,i),_=d((v,C)=>{var w;let S,y;if(bT(v)?(S=v.items,y=v.active):S=v,S.length===0){if(C)return!1;(f.length>0||e.hideInput)&&(!((w=this.options)===null||w===void 0)&&w.noResultsPick)&&(Bb(this.options.noResultsPick)?S=[this.options.noResultsPick(f)]:S=[this.options.noResultsPick])}return e.items=S,y&&(e.activeItems=[y]),!0},"applyPicks"),b=d(async v=>{let C=!1,w=!1;await Promise.all([(async()=>{typeof v.mergeDelay=="number"&&(await Jd(v.mergeDelay),g.isCancellationRequested)||w||(C=_(v.picks,!0))})(),(async()=>{e.busy=!0;try{const S=await v.additionalPicks;if(g.isCancellationRequested)return;let y,x;bT(v.picks)?(y=v.picks.items,x=v.picks.active):y=v.picks;let D,E;if(bT(S)?(D=S.items,E=S.active):D=S,D.length>0||!C){let A;if(!x&&!E){const z=e.activeItems[0];z&&y.indexOf(z)!==-1&&(A=z)}_({items:[...y,...D],active:x||E||A})}}finally{g.isCancellationRequested||(e.busy=!1),w=!0}})()])},"applyFastAndSlowPicks");if(p!==null)if(UV(p))await b(p);else if(!(p instanceof Promise))_(p);else{e.busy=!0;try{const v=await p;if(g.isCancellationRequested)return;UV(v)?await b(v):_(v)}finally{g.isCancellationRequested||(e.busy=!1)}}},"updatePickerItems");s.add(e.onDidChangeValue(()=>l())),l(),s.add(e.onDidAccept(u=>{var h;if(i?.handleAccept){u.inBackground||e.hide(),(h=i.handleAccept)===null||h===void 0||h.call(i,e.activeItems[0]);return}const[g]=e.selectedItems;typeof g?.accept=="function"&&(u.inBackground||e.hide(),g.accept(e.keyMods,u))}));const c=d(async(u,h)=>{var g,f;if(typeof h.trigger!="function")return;const p=(f=(g=h.buttons)===null||g===void 0?void 0:g.indexOf(u))!==null&&f!==void 0?f:-1;if(p>=0){const _=h.trigger(p,e.keyMods),b=typeof _=="number"?_:await _;if(t.isCancellationRequested)return;switch(b){case dp.NO_ACTION:break;case dp.CLOSE_PICKER:e.hide();break;case dp.REFRESH_PICKER:l();break;case dp.REMOVE_ITEM:{const v=e.items.indexOf(h);if(v!==-1){const C=e.items.slice(),w=C.splice(v,1),S=e.activeItems.filter(x=>x!==w[0]),y=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=C,S&&(e.activeItems=S),e.keepScrollPosition=y}break}}}},"buttonTrigger");return s.add(e.onDidTriggerItemButton(({button:u,item:h})=>c(u,h))),s.add(e.onDidTriggerSeparatorButton(({button:u,separator:h})=>c(u,h))),s}}var gG=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},Wc=function(o,e){return function(t,i){e(t,i,o)}},Dh,Ui;let Ug=Dh=class extends _ye{static{d(this,"AbstractCommandsQuickAccessProvider")}constructor(e,t,i,n,s,r){super(Dh.PREFIX,e),this.instantiationService=t,this.keybindingService=i,this.commandService=n,this.telemetryService=s,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(Gu)),this.options=e}async _getPicks(e,t,i,n){var s,r,a,l;const c=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const u=Cu(()=>{const v=new Hb;v.updateDocuments(c.map(w=>({key:w.commandId,textChunks:[this.getTfIdfChunk(w)]})));const C=v.calculateScores(e,i);return mye(C).filter(w=>w.score>Dh.TFIDF_THRESHOLD).slice(0,Dh.TFIDF_MAX_RESULTS)}),h=[];for(const v of c){const C=(s=Dh.WORD_FILTER(e,v.label))!==null&&s!==void 0?s:void 0,w=v.commandAlias&&(r=Dh.WORD_FILTER(e,v.commandAlias))!==null&&r!==void 0?r:void 0;if(C||w)v.highlights={label:C,detail:this.options.showAlias?w:void 0},h.push(v);else if(e===v.commandId)h.push(v);else if(e.length>=3){const S=u();if(i.isCancellationRequested)return[];const y=S.find(x=>x.key===v.commandId);y&&(v.tfIdfScore=y.score,h.push(v))}}const g=new Map;for(const v of h){const C=g.get(v.label);C?(v.description=v.commandId,C.description=C.commandId):g.set(v.label,v)}h.sort((v,C)=>{if(v.tfIdfScore&&C.tfIdfScore)return v.tfIdfScore===C.tfIdfScore?v.label.localeCompare(C.label):C.tfIdfScore-v.tfIdfScore;if(v.tfIdfScore)return 1;if(C.tfIdfScore)return-1;const w=this.commandsHistory.peek(v.commandId),S=this.commandsHistory.peek(C.commandId);if(w&&S)return w>S?-1:1;if(w)return-1;if(S)return 1;if(this.options.suggestedCommandIds){const y=this.options.suggestedCommandIds.has(v.commandId),x=this.options.suggestedCommandIds.has(C.commandId);if(y&&x)return 0;if(y)return-1;if(x)return 1}return v.label.localeCompare(C.label)});const f=[];let p=!1,_=!0,b=!!this.options.suggestedCommandIds;for(let v=0;v{var v;const C=await this.getAdditionalCommandPicks(c,h,e,i);if(i.isCancellationRequested)return[];const w=C.map(S=>this.toCommandPick(S,n));return _&&((v=w[0])===null||v===void 0?void 0:v.type)!=="separator"&&w.unshift({type:"separator",label:m("suggested","similar commands")}),w})()}:f}toCommandPick(e,t){if(e.type==="separator")return e;const i=this.keybindingService.lookupKeybinding(e.commandId),n=i?m("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:d(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){Gr(a)||this.dialogService.error(m("canNotRun","Command '{0}' resulted in an error",e.label),vy(a))}},"accept")}}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}};Ug.PREFIX=">";Ug.TFIDF_THRESHOLD=.5;Ug.TFIDF_MAX_RESULTS=5;Ug.WORD_FILTER=TP(Sv,Loe,S9);Ug=Dh=gG([Wc(1,xe),Wc(2,yt),Wc(3,Qt),Wc(4,Vn),Wc(5,K0)],Ug);let Gu=Ui=class extends W{static{d(this,"CommandsHistory")}constructor(e,t,i){super(),this.storageService=e,this.configurationService=t,this.logService=i,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===Av.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=Ui.getConfiguredCommandHistoryLength(this.configurationService),Ui.cache&&Ui.cache.limit!==this.configuredCommandsHistoryLength&&(Ui.cache.limit=this.configuredCommandsHistoryLength,Ui.hasChanges=!0))}load(){const e=this.storageService.get(Ui.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch(n){this.logService.error(`[CommandsHistory] invalid data: ${n}`)}const i=Ui.cache=new ql(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))}Ui.counter=this.storageService.getNumber(Ui.PREF_KEY_COUNTER,0,Ui.counter)}push(e){Ui.cache&&(Ui.cache.set(e,Ui.counter++),Ui.hasChanges=!0)}peek(e){var t;return(t=Ui.cache)===null||t===void 0?void 0:t.peek(e)}saveState(){if(!Ui.cache||!Ui.hasChanges)return;const e={usesLRU:!0,entries:[]};Ui.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store(Ui.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(Ui.PREF_KEY_COUNTER,Ui.counter,0,0),Ui.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:Ui.DEFAULT_COMMANDS_HISTORY_LENGTH}};Gu.DEFAULT_COMMANDS_HISTORY_LENGTH=50;Gu.PREF_KEY_CACHE="commandPalette.mru.cache";Gu.PREF_KEY_COUNTER="commandPalette.mru.counter";Gu.counter=1;Gu.hasChanges=!1;Gu=Ui=gG([Wc(0,jr),Wc(1,et),Wc(2,qn)],Gu);class bye extends Ug{static{d(this,"AbstractEditorCommandsQuickAccessProvider")}constructor(e,t,i,n,s,r){super(e,t,i,n,s,r)}getCodeEditorCommandPicks(){var e;const t=this.activeTextEditorControl;if(!t)return[];const i=[];for(const n of t.getSupportedActions()){let s;!((e=n.metadata)===null||e===void 0)&&e.description&&(ule(n.metadata.description)?s=n.metadata.description:s={original:n.metadata.description,value:n.metadata.description}),i.push({commandId:n.id,commandAlias:n.alias,commandDescription:s,label:RP(n.label)||n.id})}return i}}var vye=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},Tf=function(o,e){return function(t,i){e(t,i,o)}};let S0=class extends bye{static{d(this,"StandaloneCommandsQuickAccessProvider")}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[]}};S0=vye([Tf(0,xe),Tf(1,bt),Tf(2,yt),Tf(3,Qt),Tf(4,Vn),Tf(5,K0)],S0);class vC extends ue{static{d(this,"GotoLineAction")}constructor(){super({id:vC.ID,label:NS.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:I.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(br).quickAccess.show(S0.PREFIX)}}vC.ID="editor.action.quickCommand";ee(vC);hi.as(Jg.Quickaccess).registerQuickAccessProvider({ctor:S0,prefix:S0.PREFIX,helpEntries:[{description:NS.quickCommandHelp,commandId:vC.ID}]});var Cye=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},Ef=function(o,e){return function(t,i){e(t,i,o)}};let $N=class extends Hu{static{d(this,"StandaloneReferencesController")}constructor(e,t,i,n,s,r,a){super(!0,e,t,i,n,s,r,a)}};$N=Cye([Ef(1,Ne),Ef(2,bt),Ef(3,Ri),Ef(4,xe),Ef(5,jr),Ef(6,et)],$N);vt(Hu.ID,$N,4);class wye extends ue{static{d(this,"ToggleHighContrast")}constructor(){super({id:"editor.action.toggleHighContrast",label:YI.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(e,t){const i=e.get($o),n=i.getColorTheme();ya(n.type)?(i.setTheme(this._originalThemeName||(Zp(n.type)?Ap:yd)),this._originalThemeName=null):(i.setTheme(Zp(n.type)?ng:sg),this._originalThemeName=n.themeName)}}ee(wye);function Sye(o){return new Worker("/assets/editor.worker-BufSirVc.js",{name:o?.name})}d(Sye,"WorkerWrapper$1");function yye(o){return new Worker("/assets/ts.worker-BXxyDhSf.js",{name:o?.name})}d(yye,"WorkerWrapper");var GV={"jsx-runtime.d.ts":`export * from "./types/jsx";
+`,"package.json":`{
+ "name": "solid-js",
+ "description": "A declarative JavaScript library for building user interfaces.",
+ "version": "1.8.18",
+ "author": "Ryan Carniato",
+ "license": "MIT",
+ "homepage": "https://solidjs.com",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/solidjs/solid"
+ },
+ "main": "./dist/server.cjs",
+ "module": "./dist/server.js",
+ "browser": {
+ "./dist/server.cjs": "./dist/solid.cjs",
+ "./dist/server.js": "./dist/solid.js"
+ },
+ "unpkg": "./dist/solid.cjs",
+ "types": "types/index.d.ts",
+ "sideEffects": false,
+ "type": "module",
+ "files": [
+ "dist",
+ "store/dist",
+ "store/types",
+ "store/package.json",
+ "web/dist",
+ "web/types",
+ "web/package.json",
+ "web/storage/dist",
+ "web/storage/types",
+ "web/storage/package.json",
+ "h/dist",
+ "h/types",
+ "h/package.json",
+ "h/jsx-runtime/dist",
+ "h/jsx-runtime/types",
+ "h/jsx-runtime/package.json",
+ "h/jsx-dev-runtime/package.json",
+ "html/dist",
+ "html/types",
+ "html/package.json",
+ "universal/dist",
+ "universal/types",
+ "universal/package.json",
+ "types",
+ "jsx-runtime.d.ts"
+ ],
+ "exports": {
+ ".": {
+ "worker": {
+ "types": "./types/index.d.ts",
+ "import": "./dist/server.js",
+ "require": "./dist/server.cjs"
+ },
+ "browser": {
+ "development": {
+ "types": "./types/index.d.ts",
+ "import": "./dist/dev.js",
+ "require": "./dist/dev.cjs"
+ },
+ "types": "./types/index.d.ts",
+ "import": "./dist/solid.js",
+ "require": "./dist/solid.cjs"
+ },
+ "deno": {
+ "types": "./types/index.d.ts",
+ "import": "./dist/server.js",
+ "require": "./dist/server.cjs"
+ },
+ "node": {
+ "types": "./types/index.d.ts",
+ "import": "./dist/server.js",
+ "require": "./dist/server.cjs"
+ },
+ "development": {
+ "types": "./types/index.d.ts",
+ "import": "./dist/dev.js",
+ "require": "./dist/dev.cjs"
+ },
+ "types": "./types/index.d.ts",
+ "import": "./dist/solid.js",
+ "require": "./dist/solid.cjs"
+ },
+ "./dist/*": "./dist/*",
+ "./types/*": "./types/*",
+ "./jsx-runtime": {
+ "types": "./types/jsx.d.ts",
+ "default": "./dist/solid.js"
+ },
+ "./jsx-dev-runtime": {
+ "types": "./types/jsx.d.ts",
+ "default": "./dist/solid.js"
+ },
+ "./store": {
+ "worker": {
+ "types": "./store/types/index.d.ts",
+ "import": "./store/dist/server.js",
+ "require": "./store/dist/server.cjs"
+ },
+ "browser": {
+ "development": {
+ "types": "./store/types/index.d.ts",
+ "import": "./store/dist/dev.js",
+ "require": "./store/dist/dev.cjs"
+ },
+ "types": "./store/types/index.d.ts",
+ "import": "./store/dist/store.js",
+ "require": "./store/dist/store.cjs"
+ },
+ "deno": {
+ "types": "./store/types/index.d.ts",
+ "import": "./store/dist/server.js",
+ "require": "./store/dist/server.cjs"
+ },
+ "node": {
+ "types": "./store/types/index.d.ts",
+ "import": "./store/dist/server.js",
+ "require": "./store/dist/server.cjs"
+ },
+ "development": {
+ "types": "./store/types/index.d.ts",
+ "import": "./store/dist/dev.js",
+ "require": "./store/dist/dev.cjs"
+ },
+ "types": "./store/types/index.d.ts",
+ "import": "./store/dist/store.js",
+ "require": "./store/dist/store.cjs"
+ },
+ "./store/dist/*": "./store/dist/*",
+ "./store/types/*": "./store/types/*",
+ "./web": {
+ "worker": {
+ "types": "./web/types/index.d.ts",
+ "import": "./web/dist/server.js",
+ "require": "./web/dist/server.cjs"
+ },
+ "browser": {
+ "development": {
+ "types": "./web/types/index.d.ts",
+ "import": "./web/dist/dev.js",
+ "require": "./web/dist/dev.cjs"
+ },
+ "types": "./web/types/index.d.ts",
+ "import": "./web/dist/web.js",
+ "require": "./web/dist/web.cjs"
+ },
+ "deno": {
+ "types": "./web/types/index.d.ts",
+ "import": "./web/dist/server.js",
+ "require": "./web/dist/server.cjs"
+ },
+ "node": {
+ "types": "./web/types/index.d.ts",
+ "import": "./web/dist/server.js",
+ "require": "./web/dist/server.cjs"
+ },
+ "development": {
+ "types": "./web/types/index.d.ts",
+ "import": "./web/dist/dev.js",
+ "require": "./web/dist/dev.cjs"
+ },
+ "types": "./web/types/index.d.ts",
+ "import": "./web/dist/web.js",
+ "require": "./web/dist/web.cjs"
+ },
+ "./web/storage": {
+ "types": "./web/storage/types/index.d.ts",
+ "import": "./web/storage/dist/storage.js",
+ "require": "./web/storage/dist/storage.cjs"
+ },
+ "./web/dist/*": "./web/dist/*",
+ "./web/types/*": "./web/types/*",
+ "./universal": {
+ "development": {
+ "types": "./universal/types/index.d.ts",
+ "import": "./universal/dist/dev.js",
+ "require": "./universal/dist/dev.cjs"
+ },
+ "types": "./universal/types/index.d.ts",
+ "import": "./universal/dist/universal.js",
+ "require": "./universal/dist/universal.cjs"
+ },
+ "./universal/dist/*": "./universal/dist/*",
+ "./universal/types/*": "./universal/types/*",
+ "./h": {
+ "types": "./h/types/index.d.ts",
+ "import": "./h/dist/h.js",
+ "require": "./h/dist/h.cjs"
+ },
+ "./h/jsx-runtime": {
+ "types": "./h/jsx-runtime/types/index.d.ts",
+ "import": "./h/jsx-runtime/dist/jsx.js",
+ "require": "./h/jsx-runtime/dist/jsx.cjs"
+ },
+ "./h/jsx-dev-runtime": {
+ "types": "./h/jsx-runtime/types/index.d.ts",
+ "import": "./h/jsx-runtime/dist/jsx.js",
+ "require": "./h/jsx-runtime/dist/jsx.cjs"
+ },
+ "./h/dist/*": "./h/dist/*",
+ "./h/types/*": "./h/types/*",
+ "./html": {
+ "types": "./html/types/index.d.ts",
+ "import": "./html/dist/html.js",
+ "require": "./html/dist/html.cjs"
+ },
+ "./html/dist/*": "./html/dist/*",
+ "./package.json": "./package.json"
+ },
+ "keywords": [
+ "solid",
+ "solidjs",
+ "ui",
+ "reactive",
+ "components",
+ "compiler",
+ "performance"
+ ],
+ "dependencies": {
+ "csstype": "^3.1.0",
+ "seroval": "^1.0.4",
+ "seroval-plugins": "^1.0.3"
+ },
+ "scripts": {
+ "build": "npm-run-all -nl build:*",
+ "build:clean": "rimraf dist/ coverage/ store/dist/ web/dist/ h/dist/ h/jsx-runtime/dist html/dist/",
+ "build:js": "rollup -c",
+ "types": "npm-run-all -nl types:*",
+ "types:clean": "rimraf types/ store/types/ web/types/ h/types/ h/jsx-runtime/types html/types/",
+ "types:copy": "ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./src/jsx.d.ts && ncp ../../node_modules/dom-expressions/src/jsx-h.d.ts ./h/jsx-runtime/src/jsx.d.ts",
+ "types:src": "tsc --project ./tsconfig.build.json && ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./types/jsx.d.ts",
+ "types:web": "tsc --project ./web/tsconfig.build.json",
+ "types:web-storage": "tsc --project ./web/storage/tsconfig.build.json",
+ "types:copy-web": "ncp ../../node_modules/dom-expressions/src/client.d.ts ./web/types/client.d.ts && ncp ../../node_modules/dom-expressions/src/server.d.ts ./web/types/server.d.ts",
+ "types:store": "tsc --project ./store/tsconfig.build.json",
+ "types:html": "tsc --project ./html/tsconfig.json && ncp ../../node_modules/lit-dom-expressions/types/index.d.ts ./html/types/lit.d.ts",
+ "types:h": "tsc --project ./h/tsconfig.json && ncp ../../node_modules/hyper-dom-expressions/types/index.d.ts ./h/types/hyperscript.d.ts",
+ "types:jsx": "rimraf ./h/jsx-runtime/types && tsc --project ./h/jsx-runtime/tsconfig.json && ncp ../../node_modules/dom-expressions/src/jsx-h.d.ts ./h/jsx-runtime/types/jsx.d.ts",
+ "types:universal": "tsc --project ./universal/tsconfig.json && ncp ../../node_modules/dom-expressions/src/universal.d.ts ./universal/types/universal.d.ts",
+ "bench": "node --allow-natives-syntax bench/bench.cjs",
+ "link": "symlink-dir . node_modules/solid-js",
+ "test": "vitest run",
+ "coverage": "vitest run --coverage",
+ "test-types": "tsc --project tsconfig.test.json"
+ }
+}`,"h/package.json":`{
+ "name": "solid-js/h",
+ "main": "./dist/h.cjs",
+ "module": "./dist/h.js",
+ "types": "./types/index.d.ts",
+ "type": "module",
+ "sideEffects": false
+}
+`,"html/package.json":`{
+ "name": "solid-js/html",
+ "main": "./dist/html.cjs",
+ "module": "./dist/html.js",
+ "types": "./types/index.d.ts",
+ "type": "module",
+ "sideEffects": false
+}
+`,"store/package.json":`{
+ "name": "solid-js/store",
+ "main": "./dist/server.cjs",
+ "module": "./dist/server.js",
+ "browser": {
+ "./dist/server.cjs": "./dist/store.cjs",
+ "./dist/server.js": "./dist/store.js"
+ },
+ "unpkg": "./dist/store.cjs",
+ "types": "./types/index.d.ts",
+ "type": "module",
+ "sideEffects": false,
+ "exports": {
+ ".": {
+ "worker": {
+ "types": "./types/index.d.ts",
+ "import": "./dist/server.js",
+ "require": "./dist/server.cjs"
+ },
+ "browser": {
+ "development": {
+ "types": "./types/index.d.ts",
+ "import": "./dist/dev.js",
+ "require": "./dist/dev.cjs"
+ },
+ "types": "./types/index.d.ts",
+ "import": "./dist/store.js",
+ "require": "./dist/store.cjs"
+ },
+ "deno": {
+ "types": "./types/index.d.ts",
+ "import": "./dist/server.js",
+ "require": "./dist/server.cjs"
+ },
+ "node": {
+ "types": "./types/index.d.ts",
+ "import": "./dist/server.js",
+ "require": "./dist/server.cjs"
+ },
+ "development": {
+ "types": "./types/index.d.ts",
+ "import": "./dist/dev.js",
+ "require": "./dist/dev.cjs"
+ },
+ "types": "./types/index.d.ts",
+ "import": "./dist/store.js",
+ "require": "./dist/store.cjs"
+ }
+ }
+}
+`,"types/index.d.ts":`export {
+ $DEVCOMP,
+ $PROXY,
+ $TRACK,
+ batch,
+ catchError,
+ children,
+ createComputed,
+ createContext,
+ createDeferred,
+ createEffect,
+ createMemo,
+ createReaction,
+ createRenderEffect,
+ createResource,
+ createRoot,
+ createSelector,
+ createSignal,
+ enableExternalSource,
+ enableScheduling,
+ equalFn,
+ getListener,
+ getOwner,
+ on,
+ onCleanup,
+ onError,
+ onMount,
+ runWithOwner,
+ startTransition,
+ untrack,
+ useContext,
+ useTransition
+} from "./reactive/signal.js";
+export type {
+ Accessor,
+ AccessorArray,
+ ChildrenReturn,
+ Context,
+ ContextProviderComponent,
+ EffectFunction,
+ EffectOptions,
+ InitializedResource,
+ InitializedResourceOptions,
+ InitializedResourceReturn,
+ MemoOptions,
+ NoInfer,
+ OnEffectFunction,
+ OnOptions,
+ Owner,
+ ResolvedChildren,
+ ResolvedJSXElement,
+ Resource,
+ ResourceActions,
+ ResourceFetcher,
+ ResourceFetcherInfo,
+ ResourceOptions,
+ ResourceReturn,
+ ResourceSource,
+ ReturnTypes,
+ Setter,
+ Signal,
+ SignalOptions
+} from "./reactive/signal.js";
+export * from "./reactive/observable.js";
+export * from "./reactive/scheduler.js";
+export * from "./reactive/array.js";
+export * from "./render/index.js";
+import type { JSX } from "./jsx.js";
+type JSXElement = JSX.Element;
+export type { JSXElement, JSX };
+import { registerGraph, writeSignal } from "./reactive/signal.js";
+export declare const DEV:
+ | {
+ readonly hooks: {
+ afterUpdate: (() => void) | null;
+ afterCreateOwner: ((owner: import("./reactive/signal.js").Owner) => void) | null;
+ afterCreateSignal:
+ | ((signal: import("./reactive/signal.js").SignalState) => void)
+ | null;
+ };
+ readonly writeSignal: typeof writeSignal;
+ readonly registerGraph: typeof registerGraph;
+ }
+ | undefined;
+declare global {
+ var Solid$$: boolean;
+}
+`,"types/jsx.d.ts":`import * as csstype from "csstype";
+
+/**
+ * Based on JSX types for Surplus and Inferno and adapted for \`dom-expressions\`.
+ *
+ * https://github.com/adamhaile/surplus/blob/master/index.d.ts
+ * https://github.com/infernojs/inferno/blob/master/packages/inferno/src/core/types.ts
+ */
+type DOMElement = Element;
+
+export namespace JSX {
+ type Element = Node | ArrayElement | (string & {}) | number | boolean | null | undefined;
+ interface ArrayElement extends Array {}
+ interface ElementClass {
+ // empty, libs can define requirements downstream
+ }
+ interface ElementAttributesProperty {
+ // empty, libs can define requirements downstream
+ }
+ interface ElementChildrenAttribute {
+ children: {};
+ }
+ interface EventHandler {
+ (
+ e: E & {
+ currentTarget: T;
+ target: DOMElement;
+ }
+ ): void;
+ }
+ interface BoundEventHandler {
+ 0: (
+ data: any,
+ e: E & {
+ currentTarget: T;
+ target: DOMElement;
+ }
+ ) => void;
+ 1: any;
+ }
+ type EventHandlerUnion = EventHandler | BoundEventHandler;
+
+ interface InputEventHandler {
+ (
+ e: E & {
+ currentTarget: T;
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
+ ? T
+ : DOMElement;
+ }
+ ): void;
+ }
+ interface BoundInputEventHandler {
+ 0: (
+ data: any,
+ e: E & {
+ currentTarget: T;
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
+ ? T
+ : DOMElement;
+ }
+ ) => void;
+ 1: any;
+ }
+ type InputEventHandlerUnion =
+ | InputEventHandler
+ | BoundInputEventHandler;
+
+ interface ChangeEventHandler {
+ (
+ e: E & {
+ currentTarget: T;
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
+ ? T
+ : DOMElement;
+ }
+ ): void;
+ }
+ interface BoundChangeEventHandler {
+ 0: (
+ data: any,
+ e: E & {
+ currentTarget: T;
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
+ ? T
+ : DOMElement;
+ }
+ ) => void;
+ 1: any;
+ }
+ type ChangeEventHandlerUnion =
+ | ChangeEventHandler
+ | BoundChangeEventHandler;
+
+ interface FocusEventHandler {
+ (
+ e: E & {
+ currentTarget: T;
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
+ ? T
+ : DOMElement;
+ }
+ ): void;
+ }
+ interface BoundFocusEventHandler {
+ 0: (
+ data: any,
+ e: E & {
+ currentTarget: T;
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
+ ? T
+ : DOMElement;
+ }
+ ) => void;
+ 1: any;
+ }
+ type FocusEventHandlerUnion =
+ | FocusEventHandler
+ | BoundFocusEventHandler;
+
+ const SERIALIZABLE: unique symbol;
+ interface SerializableAttributeValue {
+ toString(): string;
+ [SERIALIZABLE]: never;
+ }
+
+ interface IntrinsicAttributes {
+ ref?: unknown | ((e: unknown) => void);
+ }
+ interface CustomAttributes {
+ ref?: T | ((el: T) => void);
+ classList?: {
+ [k: string]: boolean | undefined;
+ };
+ $ServerOnly?: boolean;
+ }
+ type Accessor = () => T;
+ interface Directives {}
+ interface DirectiveFunctions {
+ [x: string]: (el: DOMElement, accessor: Accessor) => void;
+ }
+ interface ExplicitProperties {}
+ interface ExplicitAttributes {}
+ interface CustomEvents {}
+ interface CustomCaptureEvents {}
+ type DirectiveAttributes = {
+ [Key in keyof Directives as \`use:\${Key}\`]?: Directives[Key];
+ };
+ type DirectiveFunctionAttributes = {
+ [K in keyof DirectiveFunctions as string extends K
+ ? never
+ : \`use:\${K}\`]?: DirectiveFunctions[K] extends (
+ el: infer E, // will be unknown if not provided
+ ...rest: infer R // use rest so that we can check whether it's provided or not
+ ) => void
+ ? T extends E // everything extends unknown if E is unknown
+ ? R extends [infer A] // check if has accessor provided
+ ? A extends Accessor
+ ? V // it's an accessor
+ : never // it isn't, type error
+ : true // no accessor provided
+ : never // T is the wrong element
+ : never; // it isn't a function
+ };
+ type PropAttributes = {
+ [Key in keyof ExplicitProperties as \`prop:\${Key}\`]?: ExplicitProperties[Key];
+ };
+ type AttrAttributes = {
+ [Key in keyof ExplicitAttributes as \`attr:\${Key}\`]?: ExplicitAttributes[Key];
+ };
+ type OnAttributes = {
+ [Key in keyof CustomEvents as \`on:\${Key}\`]?: EventHandler;
+ };
+ type OnCaptureAttributes = {
+ [Key in keyof CustomCaptureEvents as \`oncapture:\${Key}\`]?: EventHandler<
+ T,
+ CustomCaptureEvents[Key]
+ >;
+ };
+ interface DOMAttributes
+ extends CustomAttributes,
+ DirectiveAttributes,
+ DirectiveFunctionAttributes,
+ PropAttributes,
+ AttrAttributes,
+ OnAttributes,
+ OnCaptureAttributes,
+ CustomEventHandlersCamelCase,
+ CustomEventHandlersLowerCase {
+ children?: Element;
+ innerHTML?: string;
+ innerText?: string | number;
+ textContent?: string | number;
+ // camel case events
+ onCopy?: EventHandlerUnion;
+ onCut?: EventHandlerUnion;
+ onPaste?: EventHandlerUnion;
+ onCompositionEnd?: EventHandlerUnion;
+ onCompositionStart?: EventHandlerUnion;
+ onCompositionUpdate?: EventHandlerUnion;
+ onFocusOut?: FocusEventHandlerUnion;
+ onFocusIn?: FocusEventHandlerUnion;
+ onEncrypted?: EventHandlerUnion;
+ onDragExit?: EventHandlerUnion;
+ // lower case events
+ oncopy?: EventHandlerUnion;
+ oncut?: EventHandlerUnion;
+ onpaste?: EventHandlerUnion;
+ oncompositionend?: EventHandlerUnion;
+ oncompositionstart?: EventHandlerUnion;
+ oncompositionupdate?: EventHandlerUnion;
+ onfocusout?: FocusEventHandlerUnion;
+ onfocusin?: FocusEventHandlerUnion;
+ onencrypted?: EventHandlerUnion;
+ ondragexit?: EventHandlerUnion;
+ }
+ interface CustomEventHandlersCamelCase {
+ onAbort?: EventHandlerUnion;
+ onAnimationEnd?: EventHandlerUnion;
+ onAnimationIteration?: EventHandlerUnion;
+ onAnimationStart?: EventHandlerUnion;
+ onAuxClick?: EventHandlerUnion;
+ onBeforeInput?: InputEventHandlerUnion;
+ onBeforeToggle?: EventHandlerUnion;
+ onBlur?: FocusEventHandlerUnion