@opensumi/cli-engine 3.4.4-next-1728716505.0 → 3.4.4-next-1728719159.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28059,7 +28059,7 @@ ${JSON.stringify(l,null,2)}`);const h=n[o]();return new Language(INTERNAL,h)})}}
28059
28059
  `);let m=0;d.forEach((G,p)=>{const{parts:N,currentStyle:W}=(0,v.ansiParser)(G,this.lastStyle);this.lastStyle=W,this.matchOutput(c,N,m||p);const Z=N.map(E=>E.content).join(""),y=Math.ceil(Z.length/r);m+=Math.max(1,y)})}}getMatcherRules(){const c=this.inlineChatFeatureRegistry.getTerminalActions(),s=[];return c.forEach(a=>{const r=this.inlineChatFeatureRegistry.getTerminalHandler(a.id);Array.isArray(r?.triggerRules)&&r.triggerRules.forEach(d=>{d instanceof g.BaseTerminalDetectionLineMatcher?s.push({matcher:d,action:a}):typeof d=="function"&&Object.getPrototypeOf(d)===g.BaseTerminalDetectionLineMatcher&&s.push({matcher:new d,action:a})})}),s}matchOutput(c,s,a){var r,d;if(this.currentActions)this.currentActions.matcher.match(s)?(r=this.outputRecordMap.get(c))===null||r===void 0||r.push({type:this.currentActions.matcher.type,text:s.map(m=>m.content).join("")}):this.matchedEnd(c,this.currentActions);else{const G=this.getMatcherRules().find(p=>p.matcher.match(s));G&&(this.registerMarker(c,a),(d=this.outputRecordMap.get(c))===null||d===void 0||d.push({type:G.matcher.type,text:s.map(p=>p.content).join("")}),G.matcher.isMultiLine?this.currentActions={action:G.action,matcher:G.matcher}:this.matchedEnd(c,G))}}matchedEnd(c,s){var a,r;const d=this.resolveDelControl((a=this.inputRecordMap.get(c))===null||a===void 0?void 0:a.map(G=>G.text).join(`
28060
28060
  `)),m=(r=this.outputRecordMap.get(c))===null||r===void 0?void 0:r.map(G=>G.text).join(`
28061
28061
  `);this.addDecoration(c,s,d,m),this.report(s.matcher.type,d,m),this.resetState(c)}addDecoration(c,s,a,r){const d=this.terminalController.clients.get(c),m=d?.term,G=this.clientCurrentMarker.get(c);if(m&&r&&G){const p=r?.split(`
28062
- `).length;this.terminalDecorations.addZoneDecoration(m,G,p,{operationList:[s.action],onClickItem:()=>{const N=this.inlineChatFeatureRegistry.getTerminalHandler(s.action.id);N&&N.execute(r,a||"",s.matcher)}})}}resolveDelControl(c=""){const s=c.split("");let a=0;for(;a<s.length;)if(s[a].charCodeAt(0)===127){const r=Math.max(a-1,0);s.splice(r,1),a=r}else a++;return s.join("")}report(c,s,a){}registerMarker(c,s){const a=this.terminalController.clients.get(c);if(a){const r=a.term.registerMarker(s);this.clientCurrentMarker.set(c,r),this.disposables.push(r)}}handleClientInput(c,s){const a=s.toString(),r=this.inputRecordMap.get(c);/[\r\n]/.test(a)?(this.isTyping=!1,r?.push({text:this.inputCache})):(this.inputCache+=a,this.isTyping=!0)}};n.__decorate([(0,l.Autowired)(h.ITerminalController),n.__metadata("design:type",Object)],I.prototype,"terminalController",void 0),n.__decorate([(0,l.Autowired)(b.AITerminalDecorationService),n.__metadata("design:type",b.AITerminalDecorationService)],I.prototype,"terminalDecorations",void 0),n.__decorate([(0,l.Autowired)(o.InlineChatFeatureRegistryToken),n.__metadata("design:type",f.InlineChatFeatureRegistry)],I.prototype,"inlineChatFeatureRegistry",void 0),I=n.__decorate([(0,l.Injectable)()],I),e.AITerminalService=I},32113:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AITerminalPrompt=e.KeyboardSelectableList=void 0;const n=t(85608),l=t(45250),o=n.__importStar(t(14041)),h=t(41869),f=t(81878),b=t(89195),g=n.__importDefault(t(58274)),v=u=>{const{items:c,handleSuggestionClick:s,noListen:a=!1,controller:r}=u,[d,m]=(0,o.useState)(-1),G=p=>{switch(p.key){case"ArrowUp":m(N=>Math.max(N-1,0));break;case"ArrowDown":m(N=>Math.min(N+1,c.length-1));break;case"Enter":c[d]&&s(c[d].command);break;default:break}};return(0,o.useEffect)(()=>{if(!a)return window.addEventListener("keydown",G),()=>{window.removeEventListener("keydown",G)}},[c,d]),(0,o.useEffect)(()=>{if(!r)return;const p=r.event(N=>{N==="ArrowUp"&&m(W=>Math.max(W-1,0)),(N==="ArrowDown"||N==="Tab")&&m(W=>Math.min(W+1,c.length-1)),N==="Enter"&&c[d]&&s(c[d].command)});return()=>{p.dispose()}},[r,d,c]),(0,o.useEffect)(()=>{m(0)},[c]),o.default.createElement("div",{className:g.default.suggestions},c.map((p,N)=>o.default.createElement("div",{key:N,className:g.default.suggestionItem,style:{backgroundColor:N===d?"var(--selection-background)":""},onClick:()=>s(p.command)},o.default.createElement("div",{className:g.default.suggestionItemContainer},o.default.createElement("div",{className:g.default.suggestionDesc},p.description),o.default.createElement("div",{className:g.default.suggestionCmd},p.command)))))};e.KeyboardSelectableList=v;const I=u=>{const{onEscTriggered:c,onSuggestionClick:s,getAICommandSuggestions:a,cancelAIRequst:r}=u,[d,m]=(0,o.useState)(""),[G,p]=(0,o.useState)([]),[N,W]=(0,o.useState)(!1),[Z,y]=(0,o.useState)((0,h.localize)("terminal.ai.escClose")),E=(0,o.useRef)(null),R=(0,o.useCallback)(async Y=>{W(!0),y((0,h.localize)("terminal.ai.requesting")),a(Y,()=>{W(!1),y((0,h.localize)("terminal.ai.selectHint"))},()=>{W(!0),y((0,h.localize)("terminal.ai.thinking"))},_=>{p([..._].reverse())})},[G]),A=(0,o.useCallback)((0,l.debounce)(Y=>{R(Y)},1e3),[]);(0,o.useEffect)(()=>{const Y=_=>{(_.key==="Escape"||_.keyCode===27)&&c()};return document.addEventListener("keydown",Y),()=>{document.removeEventListener("keydown",Y)}},[]),(0,o.useEffect)(()=>{const Y=_=>{E.current&&!E.current.contains(_.target)&&c()};return document.addEventListener("mousedown",Y),()=>{document.removeEventListener("mousedown",Y)}},[c]);const w=Y=>{const _=Y.target.value;m(_),_.length>0&&!_.includes("'")&&A(_),_.length===0&&(p([]),y((0,h.localize)("terminal.ai.escClose")),r&&r())},F=(0,o.useCallback)(()=>{R(d)},[d]),V=Y=>{s(Y)};return o.default.createElement("div",{className:g.default.container,ref:E},o.default.createElement("div",{className:g.default.header},o.default.createElement("div",{style:{flex:"1"}},(0,h.localize)("terminal.ai.headerHint")),o.default.createElement("div",null,o.default.createElement(b.EnhanceIcon,{className:(0,f.getIcon)("close1"),onClick:()=>{c()}}))),o.default.createElement("div",{style:{position:"relative",marginLeft:"-14px"}},G.length>0&&o.default.createElement(e.KeyboardSelectableList,{items:G,handleSuggestionClick:V})),o.default.createElement("div",{className:g.default.inputContainer},o.default.createElement(f.Input,{type:"text",value:d,onKeyDown:Y=>{(Y.key==="ArrowUp"||Y.key==="ArrowDown")&&Y.preventDefault()},onChange:w,onPressEnter:()=>F(),placeholder:(0,h.localize)("terminal.ai.inputHint"),className:g.default.input,autoFocus:!0}),N?o.default.createElement("div",{className:g.default.ai_loading},o.default.createElement("div",{className:g.default.loader}),o.default.createElement("div",{className:g.default.loader}),o.default.createElement("div",{className:g.default.loader})):o.default.createElement(b.EnhanceIcon,{wrapperClassName:g.default.send_icon,className:(0,f.getIcon)("send-solid"),onClick:()=>{A(d)}})),o.default.createElement("div",{className:g.default.statusContainer},Z))};e.AITerminalPrompt=I},39273:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TerminalInlineWidgetForDetection=e.TerminalInlineWidgetForSelection=void 0;const n=t(85608),l=n.__importStar(t(14041)),o=t(89195),h=n.__importDefault(t(57410)),f=({actions:g,onClickItem:v})=>l.default.createElement("div",{className:h.default.terminal_inline_chat},l.default.createElement(o.AIAction,{operationList:g,onClickItem:v}));e.TerminalInlineWidgetForSelection=f;const b=({actions:g,onClickItem:v})=>{const[I,u]=(0,l.useState)(!1);return l.default.createElement("div",{onMouseOver:c=>{u(!0),c.currentTarget.style.backgroundColor="rgba(255, 0, 0, 0.1)"},onMouseOut:c=>{u(!1),c.currentTarget.style.backgroundColor=""},style:{width:"100%",height:"100%"}},l.default.createElement("div",{className:h.default.terminal_inline_chat,style:{display:I?"block":"none"}},l.default.createElement(o.AIAction,{operationList:g,onClickItem:v})))};e.TerminalInlineWidgetForDetection=b},96415:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AITerminalDecorationService=void 0;const n=t(85608),l=n.__importDefault(t(14041)),o=t(25873),h=t(76003),f=t(43718),b=t(6487),g=t(2281),v=t(39273);let I=class extends f.Disposable{constructor(){super(...arguments),this.decorationList=[],this.decorationRootMap=new Map}active(){this.disposables.push(this.terminalController.onDidOpenTerminal(({id:c})=>this.doSelectionDecoration(c)))}addZoneDecoration(c,s,a,r){const d=c.registerDecoration({marker:s,width:c.cols,height:a});if(!d){console.error("Failed to create decoration for line",s);return}let m;d.onRender(G=>{m||(m=(0,o.createRoot)(G)),m.render(l.default.createElement(v.TerminalInlineWidgetForDetection,{actions:r.operationList,onClickItem:()=>{r.onClickItem()}}))}),d.onDispose(()=>{m&&m.unmount()})}doSelectionDecoration(c){const s=this.terminalController.clients.get(c),a=s?.term;a&&this.addDispose(a.onSelectionChange(()=>{const r=this.decorationList.pop();r&&(0,f.runWhenIdle)(()=>{r?.dispose()});const d=a.getSelectionPosition(),m=a.getSelection().trim();if(d&&m.length>0){const G=d.end.y,p=d.start.y,N=a.buffer.active.cursorY+a.buffer.active.baseY,W=p-N,Z=G-p+1,y=a.registerMarker(W);if(y){const E=a.registerDecoration({marker:y,width:a.cols,height:Z});if(E){let R;E.onRender(A=>{R||(R=(0,o.createRoot)(A));const F=this.inlineChatFeatureRegistry.getTerminalActions().filter(V=>{var Y;return((Y=this.inlineChatFeatureRegistry.getTerminalHandler(V.id))===null||Y===void 0?void 0:Y.triggerRules)==="selection"});R.render(l.default.createElement(v.TerminalInlineWidgetForSelection,{actions:F,onClickItem:V=>{const Y=this.inlineChatFeatureRegistry.getTerminalHandler(V);Y&&Y.execute(m,"")}}))}),E.onDispose(()=>{R&&R.unmount()}),this.decorationList.push(E)}}}}))}};n.__decorate([(0,h.Autowired)(b.ITerminalController),n.__metadata("design:type",Object)],I.prototype,"terminalController",void 0),n.__decorate([(0,h.Autowired)(f.InlineChatFeatureRegistryToken),n.__metadata("design:type",g.InlineChatFeatureRegistry)],I.prototype,"inlineChatFeatureRegistry",void 0),I=n.__decorate([(0,h.Injectable)()],I),e.AITerminalDecorationService=I},4397:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BaseTerminalDetectionLineMatcher=e.MatcherType=void 0;var t;(function(l){l[l.base=0]="base",l[l.npm=1]="npm",l[l.typescript=2]="typescript",l[l.node=3]="node",l[l.shell=4]="shell",l[l.java=5]="java"})(t=e.MatcherType||(e.MatcherType={}));class n{constructor(){this.type=t.base,this.isMultiLine=!1,this.isMatched=!1,this.maxSpaceLine=0,this.currentSpaceLine=0}match(o){return this.doMatch(o)?(this.isMatched=!0,this.currentSpaceLine=0,!0):this.isMultiLine&&this.isMatched&&this.currentSpaceLine<this.maxSpaceLine?(this.currentSpaceLine++,!0):(this.isMatched=!1,!1)}}e.BaseTerminalDetectionLineMatcher=n},28358:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JavaMatcher=e.ShellMatcher=e.NPMMatcher=e.TSCMatcher=e.NodeMatcher=void 0,t(85608).__exportStar(t(4397),e);var l=t(12636);Object.defineProperty(e,"NodeMatcher",{enumerable:!0,get:function(){return l.NodeMatcher}});var o=t(41084);Object.defineProperty(e,"TSCMatcher",{enumerable:!0,get:function(){return o.TSCMatcher}});var h=t(97323);Object.defineProperty(e,"NPMMatcher",{enumerable:!0,get:function(){return h.NPMMatcher}});var f=t(29640);Object.defineProperty(e,"ShellMatcher",{enumerable:!0,get:function(){return f.ShellMatcher}});var b=t(82036);Object.defineProperty(e,"JavaMatcher",{enumerable:!0,get:function(){return b.JavaMatcher}})},82036:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JavaMatcher=void 0;const n=t(4397);class l extends n.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=n.MatcherType.java,this.isMultiLine=!0}doMatch(h){return this.isErrorStack(h)||this.isCasuseByError(h)||this.isExceptionError(h)}isErrorStack(h){return this.isMatched&&!!h.find(f=>/^\s+at\s/i.test(f.content))}isCasuseByError(h){return!!h.find(f=>/caused\sby:/i.test(f.content))}isExceptionError(h){return!!h.find(f=>/\w+Exception:/i.test(f.content))}}e.JavaMatcher=l},12636:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NodeMatcher=void 0;const n=t(60772),l=t(4397);class o extends l.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=l.MatcherType.node,this.isMultiLine=!0,this.maxSpaceLine=1}doMatch(f){return this.isSingleLineError(f)||this.isMultiPartError(f)}isSingleLineError(f){return f.length===1&&(0,n.isRedColor)(f[0])&&(this.isMatched||!this.isExcludeContent(f[0].content))}isMultiPartError(f){return f.length>1&&!f.some(b=>!(0,n.isRedColor)(b))}isExcludeContent(f){return f.length<20||/mfsu/i.test(f)||/\s-\s/.test(f)}}e.NodeMatcher=o},97323:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NPMMatcher=void 0;const n=t(60772),l=t(4397);class o extends l.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=l.MatcherType.npm,this.isMultiLine=!0,this.maxSpaceLine=1}doMatch(f){return!!f.find(b=>/ERR/.test(b.content)&&(0,n.isRedColor)(b))}}e.NPMMatcher=o},29640:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ShellMatcher=void 0;const n=t(4397);class l extends n.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=n.MatcherType.shell,this.isMultiLine=!1}doMatch(h){return!!h.find(f=>/command\snot\sfound/.test(f.content))}}e.ShellMatcher=l},41084:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TSCMatcher=void 0;const n=t(60772),l=t(4397);class o extends l.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=l.MatcherType.typescript,this.isMultiLine=!0}doMatch(f){let b=!1,g=!1,v=!1;return f.forEach(I=>{/error/i.test(I.content)&&(0,n.isRedColor)(I)&&(b=!0),/TS\d+/.test(I.content)&&(g=!0),/Error:/i.test(I.content)&&(v=!0)}),b||g||v||this.isErrorStack(f)}isErrorStack(f){return this.isMatched&&!!f.find(b=>/^\s+at\s/i.test(b.content))}}e.TSCMatcher=o},14717:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PS1TerminalService=void 0;const n=t(85608),l=n.__importDefault(t(124)),o=n.__importDefault(t(14041)),h=t(25873),f=t(76003),b=t(41869),g=t(43718),v=t(6487),I=t(93062),u=t(32113),c=t(95121);var s;(function(r){r.PromptStarted="PS",r.PromptEnded="PE",r.CurrentWorkingDirectory="CWD"})(s||(s={}));let a=class extends g.Disposable{constructor(){super(...arguments),this.cancelToken=new g.CancellationTokenSource}active(){this.initContainer(),this.disposables.push(this.terminalController.onDidOpenTerminal(({id:d})=>this.listenTerminalEvent(d)))}listenTerminalEvent(d){const m=this.terminalController.clients.get(d);m&&setTimeout(()=>{this.listenPromptState(m.term)},0)}initContainer(){this.popupContainer=document.createElement("div"),document.body.appendChild(this.popupContainer)}listenPromptState(d){d.parser.registerOscHandler(6973,m=>{const G=m.indexOf(";");switch(G===-1?m:m.substring(0,G)){case s.PromptEnded:this.handlePromptEnd(d);break;default:return!1}return!1})}handlePromptEnd(d){this.promptEndMarker&&this.promptEndMarker.dispose(),this.promptEndDecoration&&this.promptEndDecoration.dispose(),this.promptEndMarker=d.registerMarker(0);const m=d.buffer.active.cursorX;this.onDataDisposable&&this.onDataDisposable.dispose();const G=d.registerDecoration({marker:this.promptEndMarker,width:d.cols,height:1,x:m+2,layer:"top"});G?.onRender(p=>{p.innerText=(0,b.localize)("terminal.ai.inputSharpToGetHint"),p.style.opacity="0.3"}),this.onDataDisposable=d.onData(p=>{var N;const W=d.buffer.active,Z=W.cursorX,y=W.cursorY;G?.dispose(),p==="#"&&y+W.baseY===((N=this.promptEndMarker)===null||N===void 0?void 0:N.line)&&(Z===m||Z===m+1)&&this.showAICommandPopup(d,m)})}showAICommandPopup(d,m){var G,p,N;if(!this.promptEndMarker)return;this.promptEndDecoration=d.registerDecoration({marker:this.promptEndMarker,width:1,height:1,backgroundColor:"#2472C8",x:m,layer:"top"});const W=d._addonManager._addons.find(y=>{var E;return!!(!((E=y?.instance)===null||E===void 0)&&E.connection)}),Z=(G=W?.instance)===null||G===void 0?void 0:G.connection;if(!Z){console.error((0,b.localize)("terminal.ai.cannotGetTerminalConnection"));return}(p=this.promptEndDecoration)===null||p===void 0||p.onRender(y=>{const E=y.clientWidth;this.promptEndReactRoot&&this.promptEndReactRoot.unmount(),this.promptEndReactRoot=(0,h.createRoot)(this.popupContainer),this.promptEndReactRoot.render(o.default.createElement(u.AITerminalPrompt,{onEscTriggered:()=>{setTimeout(()=>{var R;Z.sendData("\b"),(R=this.promptEndDecoration)===null||R===void 0||R.dispose()},0)},onSuggestionClick:R=>{setTimeout(()=>{var A;Z.sendData("\b"),Z.sendData(R),(A=this.promptEndDecoration)===null||A===void 0||A.dispose()},0)},getAICommandSuggestions:this.getAICommandSuggestions.bind(this),cancelAIRequst:this.stopAIStreamRequest.bind(this)})),(0,l.default)(this.popupContainer,y,{points:["bl","bl"],offset:[-E-6,0],targetOffset:[0,0],overflow:{adjustX:!1,adjustY:!1}})}),(N=this.promptEndDecoration)===null||N===void 0||N.onDispose(()=>{this.stopAIStreamRequest(),this.promptEndReactRoot&&this.promptEndReactRoot.unmount(),d.focus()})}async stopAIStreamRequest(){this.cancelToken.cancel(),this.cancelToken=new g.CancellationTokenSource}async getAICommandSuggestions(d,m,G,p){await this.stopAIStreamRequest();const N=this.aiReporter.start(g.AISerivceType.TerminalAICommand,{message:d}),W=await this.terminalFeatureRegistry.readableCommandSuggestions(d,this.cancelToken.token),Z=[];(0,I.listenReadable)(W,{onData:y=>{Z.push(y),p(Z)},onEnd:()=>{m(),this.aiReporter.end(N,{message:d,success:!0,actionSource:g.ActionSourceEnum.Terminal})}})}};n.__decorate([(0,f.Autowired)(v.ITerminalController),n.__metadata("design:type",Object)],a.prototype,"terminalController",void 0),n.__decorate([(0,f.Autowired)(g.TerminalRegistryToken),n.__metadata("design:type",c.TerminalFeatureRegistry)],a.prototype,"terminalFeatureRegistry",void 0),n.__decorate([(0,f.Autowired)(g.IAIReporter),n.__metadata("design:type",Object)],a.prototype,"aiReporter",void 0),a=n.__decorate([(0,f.Injectable)()],a),e.PS1TerminalService=a},28505:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TerminalAIContribution=void 0;const n=t(85608),l=t(76003),o=t(41869),h=t(43718),f=t(63439),b=t(96415),g=t(14717),v=t(95121);let I=class{onDidStart(){this.aiNativeConfigService.capabilities.supportsTerminalDetection&&(this.aiTerminalService.active(),this.aiTerminalDecorationService.active()),this.aiNativeConfigService.capabilities.supportsTerminalCommandSuggest&&this.terminalFeatureRegistry.hasProvider()&&this.ps1TerminalService.active()}};n.__decorate([(0,l.Autowired)(f.AITerminalService),n.__metadata("design:type",f.AITerminalService)],I.prototype,"aiTerminalService",void 0),n.__decorate([(0,l.Autowired)(b.AITerminalDecorationService),n.__metadata("design:type",b.AITerminalDecorationService)],I.prototype,"aiTerminalDecorationService",void 0),n.__decorate([(0,l.Autowired)(g.PS1TerminalService),n.__metadata("design:type",g.PS1TerminalService)],I.prototype,"ps1TerminalService",void 0),n.__decorate([(0,l.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],I.prototype,"aiNativeConfigService",void 0),n.__decorate([(0,l.Autowired)(h.TerminalRegistryToken),n.__metadata("design:type",v.TerminalFeatureRegistry)],I.prototype,"terminalFeatureRegistry",void 0),I=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],I),e.TerminalAIContribution=I},95121:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TerminalFeatureRegistry=void 0;const n=t(85608),l=t(76003),o=t(43718),h=t(93062),f=t(77633);let b=class extends o.Disposable{constructor(){super(...arguments),this.providerMap=new Set}hasProvider(){return this.providerMap.size>0}registerCommandSuggestionsProvider(v){this.providerMap.add(v)}async readableCommandSuggestions(v,I){var u,c,s,a;const r=Array.from(this.providerMap),d=[],m=[];try{for(var G=!0,p=n.__asyncValues(r),N;N=await p.next(),u=N.done,!u;){a=N.value,G=!1;try{const y=await a(v,I);if((0,h.isReadableStream)(y)){d.push(y);continue}m.push(...y)}finally{G=!0}}}catch(Z){c={error:Z}}finally{try{!G&&!u&&(s=p.return)&&await s.call(p)}finally{if(c)throw c.error}}const W=f.TerminalSuggestionReadableStream.create();return m.forEach(W.emitData.bind(W)),d.length===0?queueMicrotask(()=>{W.end()}):(0,h.listenGroupReadable)(d,{onData:W.emitData.bind(W),onEnd:W.end.bind(W)}),W}};b=n.__decorate([(0,l.Injectable)()],b),e.TerminalFeatureRegistry=b},60772:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isRedColor=e.ansiParser=e.ColorCode=e.StyleCode=void 0;const l=t(85608).__importDefault(t(91371)),o={color:0,isSpecialColor:!1,isRgbColor:!1,is256Color:!1,bgColor:0,isSpecialBg:!1,isRgbBg:!1,is256Bg:!1,bold:!1,underline:!1};var h;(function(I){I[I.RESET=0]="RESET",I[I.BOLD=1]="BOLD",I[I.UNDERLINE=4]="UNDERLINE",I[I.RESET_BOLD=22]="RESET_BOLD",I[I.RESET_UNDERLINE=24]="RESET_UNDERLINE"})(h=e.StyleCode||(e.StyleCode={}));var f;(function(I){I[I.MODE_RGB=2]="MODE_RGB",I[I.MODE_256=5]="MODE_256",I[I.BLACK=30]="BLACK",I[I.RED=31]="RED",I[I.GREEN=32]="GREEN",I[I.YELLOW=33]="YELLOW",I[I.BLUE=34]="BLUE",I[I.MAGENTA=35]="MAGENTA",I[I.CYAN=36]="CYAN",I[I.WHITE=37]="WHITE",I[I.SPECIAL_COLOR_MODE=38]="SPECIAL_COLOR_MODE",I[I.RESET_COLOR=39]="RESET_COLOR",I[I.BLACK_BG=40]="BLACK_BG",I[I.RED_BG=41]="RED_BG",I[I.GREEN_BG=42]="GREEN_BG",I[I.YELLOW_BG=43]="YELLOW_BG",I[I.BLUE_BG=44]="BLUE_BG",I[I.MAGENTA_BG=45]="MAGENTA_BG",I[I.CYAN_BG=46]="CYAN_BG",I[I.WHITE_BG=47]="WHITE_BG",I[I.SPECIAL_BG_MODE=48]="SPECIAL_BG_MODE",I[I.RESET_BG=49]="RESET_BG",I[I.BLACK_BRIGHT=90]="BLACK_BRIGHT",I[I.RED_BRIGHT=91]="RED_BRIGHT",I[I.GREEN_BRIGHT=92]="GREEN_BRIGHT",I[I.YELLOW_BRIGHT=93]="YELLOW_BRIGHT",I[I.BLUE_BRIGHT=94]="BLUE_BRIGHT",I[I.MAGENTA_BRIGHT=95]="MAGENTA_BRIGHT",I[I.CYAN_BRIGHT=96]="CYAN_BRIGHT",I[I.WHITE_BRIGHT=97]="WHITE_BRIGHT",I[I.BLACK_HIGH_INTENSITY=100]="BLACK_HIGH_INTENSITY",I[I.RED_HIGH_INTENSITY=101]="RED_HIGH_INTENSITY",I[I.GREEN_HIGH_INTENSITY=102]="GREEN_HIGH_INTENSITY",I[I.BLUE_HIGH_INTENSITY=104]="BLUE_HIGH_INTENSITY",I[I.MAGENTA_HIGH_INTENSITY=105]="MAGENTA_HIGH_INTENSITY",I[I.CYAN_HIGH_INTENSITY=106]="CYAN_HIGH_INTENSITY",I[I.WHITE_HIGH_INTENSITY=107]="WHITE_HIGH_INTENSITY"})(f=e.ColorCode||(e.ColorCode={}));function b(I,u,c){u.isSpecialColor||u.isSpecialBg?c===f.SPECIAL_COLOR_MODE?u.color=I:u.bgColor=I:I>=30&&I<=37||I>=90&&I<=97?u.color=I:(I>=40&&I<=47||I>=100&&I<=107)&&(u.bgColor=I)}function g(I,u){const c=(0,l.default)(),s=[];let a,r=0;const d=Object.assign({},u||o);for(;a=c.exec(I);){const G=I.slice(r,a.index);G&&s.push(Object.assign({content:G},d));const p=a[0].slice(2,-1).split(";").map(Number);if(p.length)for(let N=0;N<p.length;N++){const W=p[N],Z=p[N-1];switch(W){case h.RESET:Object.assign(d,o);break;case h.BOLD:d.bold=!0;break;case h.UNDERLINE:d.underline=!0;break;case h.RESET_BOLD:d.bold=!1;break;case h.RESET_UNDERLINE:d.underline=!1;break;case f.RESET_COLOR:d.color=0;break;case f.RESET_BG:d.bgColor=0;break;case f.SPECIAL_COLOR_MODE:d.isSpecialColor=!0;break;case f.SPECIAL_BG_MODE:d.isSpecialBg=!0;break;case f.MODE_RGB:Z===f.SPECIAL_COLOR_MODE?d.isRgbColor=!0:d.isRgbBg=!0;break;case f.MODE_256:Z===f.SPECIAL_COLOR_MODE?d.is256Color=!0:d.is256Bg=!0;break;default:b(W,d,p[N-2])}}r=a.index+a[0].length}const m=I.slice(r);return m&&s.push(Object.assign({content:m},d)),{parts:s,currentStyle:d}}e.ansiParser=g;function v(I){const{color:u,isSpecialColor:c,is256Color:s}=I;return c?s?u===1||u===9||u>=160&&u<=196:u===255:u===f.RED||u===f.RED_BRIGHT}e.isRedColor=v},32004:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AINativeModule=void 0;const n=t(85608),l=t(76003),o=t(41869),h=t(43718),f=t(19413),b=t(19413),g=t(32016),v=t(74055),I=t(84543),u=t(61282),c=t(51081),s=t(29770),a=t(11735),r=t(59347),d=t(70394),m=t(72713),G=t(57232),p=t(99301),N=t(74292),W=t(35363),Z=t(44298),y=t(33588),E=t(2204),R=t(2994),A=t(28505),w=t(95121),F=t(85679),V=t(3841),Y=t(77633),_=t(2281),H=t(31031);let X=class extends o.BrowserModule{constructor(){super(),this.contributionProvider=Y.AINativeCoreContribution,this.providers=[g.AINativeBrowserContribution,W.InterfaceNavigationContribution,A.TerminalAIContribution,Z.MergeConflictContribution,m.AICodeActionContribution,V.AINativePreferencesContribution,p.IntelligentCompletionsContribution,{token:o.InlineChatFeatureRegistryToken,useClass:_.InlineChatFeatureRegistry},{token:o.ChatFeatureRegistryToken,useClass:a.ChatFeatureRegistry},{token:o.ChatRenderRegistryToken,useClass:d.ChatRenderRegistry},{token:o.ResolveConflictRegistryToken,useClass:y.ResolveConflictRegistry},{token:h.IntelligentCompletionsRegistryToken,useClass:N.IntelligentCompletionsRegistry},{token:o.IAIInlineChatService,useClass:H.AIInlineChatService},{token:f.IChatManagerService,useClass:u.ChatManagerService},{token:f.IChatAgentService,useClass:v.ChatAgentService},{token:o.ChatAgentViewServiceToken,useClass:I.ChatAgentViewService},{token:f.IChatInternalService,useClass:r.ChatInternalService},{token:f.ChatProxyServiceToken,useClass:c.ChatProxyService},{token:o.ChatServiceToken,useClass:s.ChatService},{token:o.RenameCandidatesProviderRegistryToken,useClass:R.RenameCandidatesProviderRegistry},{token:h.ProblemFixRegistryToken,useClass:E.ProblemFixProviderRegistry},{token:h.TerminalRegistryToken,useClass:w.TerminalFeatureRegistry},{token:F.LanguageParserService,useClass:F.LanguageParserService},{token:b.IAIInlineCompletionsProvider,useClass:G.AIInlineCompletionsProvider}],this.backServices=[{servicePath:o.AIBackSerivcePath,token:o.AIBackSerivceToken,clientToken:f.ChatProxyServiceToken}],this.aiNativeConfig.setAINativeModuleLoaded(!0)}};n.__decorate([(0,l.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],X.prototype,"aiNativeConfig",void 0),X=n.__decorate([(0,l.Injectable)(),n.__metadata("design:paramtypes",[])],X),e.AINativeModule=X},3073:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LanguageParser=e.DEFAULT_MIN_BLOCK_COUNT=void 0;const n=t(85608),l=n.__importDefault(t(13833)),o=t(76003),h=t(70392),f=t(53374),b=t(22486),g=t(67045);e.DEFAULT_MIN_BLOCK_COUNT=20;let v=class{constructor(u){this.language=u,this.parserLoaded=new h.Deferred,this.lruCache=new h.LRUCache(500),this.initializeParser()}ready(){return this.parserLoaded.promise}getParser(){return this.parser}async initializeParser(){this.parser=await this.wasmModuleManager.initParser();const u=await this.wasmModuleManager.loadLanguage(this.language),c=await l.default.Language.load(new Uint8Array(u));this.parser.setLanguage(c),this.parserLoaded.resolve()}findContainingCodeBlockWithPosition(u,c){return u.startIndex<=c&&u.endIndex>=c&&this.languageFacts.isCodeBlock(this.language,u.type)?u:u.parent?this.findContainingCodeBlockWithPosition(u.parent,c):null}findFunctionCodeBlock(u,c){return u.startIndex<=c&&u.endIndex>=c&&this.languageFacts.isFunctionCodeBlock(this.language,u.type)?u:u.parent?this.findFunctionCodeBlock(u.parent,c):null}async parseAST(u){const c=`${u.id}@${u.getVersionId()}`,s=this.lruCache.get(c);if(s)return s;await this.parserLoaded.promise;const a=u.getValue(),r=this.parser.parse(a);if(r){const d=r.rootNode;return this.lruCache.set(c,d),d}}async getSyntaxNodeAsPosition(u,c){const s=await this.parseAST(u);return s?s.namedDescendantForIndex(c):null}async findCodeBlockWithSyntaxError(u,c){await this.parserLoaded.promise;const s=this.parser.parse(u);if(s){const a=s.rootNode,r={row:c.startLineNumber-1,column:c.startColumn},d=a.namedDescendantForPosition(r);let m=d.parent;if(!m)return{range:(0,f.toMonacoRange)(d),type:d.type,infoCategory:"other"};for(;m&&!m.hasError;)m=m.parent;return m?{range:(0,f.toMonacoRange)(m),type:m.type,infoCategory:"other"}:{range:c,type:d.type,infoCategory:"other"}}return null}async provideCodeBlockInfo(u,c){const s=u.getOffsetAt(c),a=await this.getSyntaxNodeAsPosition(u,s);if(!a)return null;const r=this.findFunctionCodeBlock(a,s);if(r)return this.languageFacts.provideFunctionInfo(this.language,r);const d=this.findContainingCodeBlockWithPosition(a,s);return d?{infoCategory:"other",range:{startLineNumber:d.startPosition.row+1,startColumn:0,endLineNumber:d.endPosition.row+1,endColumn:1/0},type:d.type}:null}async provideCodeBlockInfoInRange(u,c){const s=await this.parseAST(u);if(s){const a={row:c.startLineNumber-1,column:c.startColumn-1},r={row:c.endLineNumber,column:c.endColumn},d=this.languageFacts.getCodeBlockTypes(this.language);if(!d||d.size===0)return null;const m=s.descendantsOfType(Array.from(d),a,r);if(m&&m.length>0){const G=m[0];return{infoCategory:"other",range:(0,f.toMonacoRange)(G),type:G.type}}}return null}async trimSuffixSyntaxErrors(u,c=e.DEFAULT_MIN_BLOCK_COUNT){var s;await this.parserLoaded.promise;const a=(s=this.parser)===null||s===void 0?void 0:s.parse(u),r=a?.rootNode;if(!r)return u;const{namedChildren:d}=r;if(!r.hasError||d.length<=c)return this.trimToLastCompleteBlock(r,!0);let m=null,G=null;for(let y=d.length-1;y>=c;y--){const E=d[y];if(E.hasError&&y!==0)m=E;else if(m){G=E;break}}G||(G=d[c-1]);const N=u.split(`
28062
+ `).length;this.terminalDecorations.addZoneDecoration(m,G,p,{operationList:[s.action],onClickItem:()=>{const N=this.inlineChatFeatureRegistry.getTerminalHandler(s.action.id);N&&N.execute(r,a||"",s.matcher)}})}}resolveDelControl(c=""){const s=c.split("");let a=0;for(;a<s.length;)if(s[a].charCodeAt(0)===127){const r=Math.max(a-1,0);s.splice(r,1),a=r}else a++;return s.join("")}report(c,s,a){}registerMarker(c,s){const a=this.terminalController.clients.get(c);if(a){const r=a.term.registerMarker(s);this.clientCurrentMarker.set(c,r),this.disposables.push(r)}}handleClientInput(c,s){const a=s.toString(),r=this.inputRecordMap.get(c);/[\r\n]/.test(a)?(this.isTyping=!1,r?.push({text:this.inputCache})):(this.inputCache+=a,this.isTyping=!0)}};n.__decorate([(0,l.Autowired)(h.ITerminalController),n.__metadata("design:type",Object)],I.prototype,"terminalController",void 0),n.__decorate([(0,l.Autowired)(b.AITerminalDecorationService),n.__metadata("design:type",b.AITerminalDecorationService)],I.prototype,"terminalDecorations",void 0),n.__decorate([(0,l.Autowired)(o.InlineChatFeatureRegistryToken),n.__metadata("design:type",f.InlineChatFeatureRegistry)],I.prototype,"inlineChatFeatureRegistry",void 0),I=n.__decorate([(0,l.Injectable)()],I),e.AITerminalService=I},32113:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AITerminalPrompt=e.KeyboardSelectableList=void 0;const n=t(85608),l=t(45250),o=n.__importStar(t(14041)),h=t(41869),f=t(81878),b=t(89195),g=n.__importDefault(t(58274)),v=u=>{const{items:c,handleSuggestionClick:s,noListen:a=!1,controller:r}=u,[d,m]=(0,o.useState)(-1),G=p=>{switch(p.key){case"ArrowUp":m(N=>Math.max(N-1,0));break;case"ArrowDown":m(N=>Math.min(N+1,c.length-1));break;case"Enter":c[d]&&s(c[d].command);break;default:break}};return(0,o.useEffect)(()=>{if(!a)return window.addEventListener("keydown",G),()=>{window.removeEventListener("keydown",G)}},[c,d]),(0,o.useEffect)(()=>{if(!r)return;const p=r.event(N=>{N==="ArrowUp"&&m(W=>Math.max(W-1,0)),(N==="ArrowDown"||N==="Tab")&&m(W=>Math.min(W+1,c.length-1)),N==="Enter"&&c[d]&&s(c[d].command)});return()=>{p.dispose()}},[r,d,c]),(0,o.useEffect)(()=>{m(0)},[c]),o.default.createElement("div",{className:g.default.suggestions},c.map((p,N)=>o.default.createElement("div",{key:N,className:g.default.suggestionItem,style:{backgroundColor:N===d?"var(--selection-background)":""},onClick:()=>s(p.command)},o.default.createElement("div",{className:g.default.suggestionItemContainer},o.default.createElement("div",{className:g.default.suggestionDesc},p.description),o.default.createElement("div",{className:g.default.suggestionCmd},p.command)))))};e.KeyboardSelectableList=v;const I=u=>{const{onEscTriggered:c,onSuggestionClick:s,getAICommandSuggestions:a,cancelAIRequst:r}=u,[d,m]=(0,o.useState)(""),[G,p]=(0,o.useState)([]),[N,W]=(0,o.useState)(!1),[Z,y]=(0,o.useState)((0,h.localize)("terminal.ai.escClose")),E=(0,o.useRef)(null),R=(0,o.useCallback)(async Y=>{W(!0),y((0,h.localize)("terminal.ai.requesting")),a(Y,()=>{W(!1),y((0,h.localize)("terminal.ai.selectHint"))},()=>{W(!0),y((0,h.localize)("terminal.ai.thinking"))},_=>{p([..._].reverse())})},[G]),A=(0,o.useCallback)((0,l.debounce)(Y=>{R(Y)},1e3),[]);(0,o.useEffect)(()=>{const Y=_=>{(_.key==="Escape"||_.keyCode===27)&&c()};return document.addEventListener("keydown",Y),()=>{document.removeEventListener("keydown",Y)}},[]),(0,o.useEffect)(()=>{const Y=_=>{E.current&&!E.current.contains(_.target)&&c()};return document.addEventListener("mousedown",Y),()=>{document.removeEventListener("mousedown",Y)}},[c]);const w=Y=>{const _=Y.target.value;m(_),_.length>0&&!_.includes("'")&&A(_),_.length===0&&(p([]),y((0,h.localize)("terminal.ai.escClose")),r&&r())},F=(0,o.useCallback)(()=>{R(d)},[d]),V=Y=>{s(Y)};return o.default.createElement("div",{className:g.default.container,ref:E},o.default.createElement("div",{className:g.default.header},o.default.createElement("div",{style:{flex:"1"}},(0,h.localize)("terminal.ai.headerHint")),o.default.createElement("div",null,o.default.createElement(b.EnhanceIcon,{className:(0,f.getIcon)("close1"),onClick:()=>{c()}}))),o.default.createElement("div",{style:{position:"relative",marginLeft:"-14px"}},G.length>0&&o.default.createElement(e.KeyboardSelectableList,{items:G,handleSuggestionClick:V})),o.default.createElement("div",{className:g.default.inputContainer},o.default.createElement(f.Input,{type:"text",value:d,onKeyDown:Y=>{(Y.key==="ArrowUp"||Y.key==="ArrowDown")&&Y.preventDefault()},onChange:w,onPressEnter:()=>F(),placeholder:(0,h.localize)("terminal.ai.inputHint"),className:g.default.input,autoFocus:!0}),N?o.default.createElement("div",{className:g.default.ai_loading},o.default.createElement("div",{className:g.default.loader}),o.default.createElement("div",{className:g.default.loader}),o.default.createElement("div",{className:g.default.loader})):o.default.createElement(b.EnhanceIcon,{wrapperClassName:g.default.send_icon,className:(0,f.getIcon)("send-solid"),onClick:()=>{A(d)}})),o.default.createElement("div",{className:g.default.statusContainer},Z))};e.AITerminalPrompt=I},39273:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TerminalInlineWidgetForDetection=e.TerminalInlineWidgetForSelection=void 0;const n=t(85608),l=n.__importStar(t(14041)),o=t(89195),h=n.__importDefault(t(57410)),f=({actions:g,onClickItem:v})=>l.default.createElement("div",{className:h.default.terminal_inline_chat},l.default.createElement(o.AIAction,{operationList:g,onClickItem:v}));e.TerminalInlineWidgetForSelection=f;const b=({actions:g,onClickItem:v})=>{const[I,u]=(0,l.useState)(!1);return l.default.createElement("div",{onMouseOver:c=>{u(!0),c.currentTarget.style.backgroundColor="rgba(255, 0, 0, 0.1)"},onMouseOut:c=>{u(!1),c.currentTarget.style.backgroundColor=""},style:{width:"100%",height:"100%"}},l.default.createElement("div",{className:h.default.terminal_inline_chat,style:{display:I?"block":"none"}},l.default.createElement(o.AIAction,{operationList:g,onClickItem:v})))};e.TerminalInlineWidgetForDetection=b},96415:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AITerminalDecorationService=void 0;const n=t(85608),l=n.__importDefault(t(14041)),o=t(25873),h=t(76003),f=t(43718),b=t(6487),g=t(2281),v=t(39273);let I=class extends f.Disposable{constructor(){super(...arguments),this.decorationList=[],this.decorationRootMap=new Map}active(){this.disposables.push(this.terminalController.onDidOpenTerminal(({id:c})=>this.doSelectionDecoration(c)))}addZoneDecoration(c,s,a,r){const d=c.registerDecoration({marker:s,width:c.cols,height:a});if(!d){console.error("Failed to create decoration for line",s);return}let m;d.onRender(G=>{m||(m=(0,o.createRoot)(G)),m.render(l.default.createElement(v.TerminalInlineWidgetForDetection,{actions:r.operationList,onClickItem:()=>{r.onClickItem()}}))}),d.onDispose(()=>{m&&m.unmount()})}doSelectionDecoration(c){const s=this.terminalController.clients.get(c),a=s?.term;a&&this.addDispose(a.onSelectionChange(()=>{const r=this.decorationList.pop();r&&(0,f.runWhenIdle)(()=>{r?.dispose()});const d=a.getSelectionPosition(),m=a.getSelection().trim();if(d&&m.length>0){const G=d.end.y,p=d.start.y,N=a.buffer.active.cursorY+a.buffer.active.baseY,W=p-N,Z=G-p+1,y=a.registerMarker(W);if(y){const E=a.registerDecoration({marker:y,width:a.cols,height:Z});if(E){let R;E.onRender(A=>{R||(R=(0,o.createRoot)(A));const F=this.inlineChatFeatureRegistry.getTerminalActions().filter(V=>{var Y;return((Y=this.inlineChatFeatureRegistry.getTerminalHandler(V.id))===null||Y===void 0?void 0:Y.triggerRules)==="selection"});R.render(l.default.createElement(v.TerminalInlineWidgetForSelection,{actions:F,onClickItem:V=>{const Y=this.inlineChatFeatureRegistry.getTerminalHandler(V);Y&&Y.execute(m,"")}}))}),E.onDispose(()=>{R&&R.unmount()}),this.decorationList.push(E)}}}}))}};n.__decorate([(0,h.Autowired)(b.ITerminalController),n.__metadata("design:type",Object)],I.prototype,"terminalController",void 0),n.__decorate([(0,h.Autowired)(f.InlineChatFeatureRegistryToken),n.__metadata("design:type",g.InlineChatFeatureRegistry)],I.prototype,"inlineChatFeatureRegistry",void 0),I=n.__decorate([(0,h.Injectable)()],I),e.AITerminalDecorationService=I},4397:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BaseTerminalDetectionLineMatcher=e.MatcherType=void 0;var t;(function(l){l[l.base=0]="base",l[l.npm=1]="npm",l[l.typescript=2]="typescript",l[l.node=3]="node",l[l.shell=4]="shell",l[l.java=5]="java"})(t=e.MatcherType||(e.MatcherType={}));class n{constructor(){this.type=t.base,this.isMultiLine=!1,this.isMatched=!1,this.maxSpaceLine=0,this.currentSpaceLine=0}match(o){return this.doMatch(o)?(this.isMatched=!0,this.currentSpaceLine=0,!0):this.isMultiLine&&this.isMatched&&this.currentSpaceLine<this.maxSpaceLine?(this.currentSpaceLine++,!0):(this.isMatched=!1,!1)}}e.BaseTerminalDetectionLineMatcher=n},28358:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JavaMatcher=e.ShellMatcher=e.NPMMatcher=e.TSCMatcher=e.NodeMatcher=void 0,t(85608).__exportStar(t(4397),e);var l=t(12636);Object.defineProperty(e,"NodeMatcher",{enumerable:!0,get:function(){return l.NodeMatcher}});var o=t(41084);Object.defineProperty(e,"TSCMatcher",{enumerable:!0,get:function(){return o.TSCMatcher}});var h=t(97323);Object.defineProperty(e,"NPMMatcher",{enumerable:!0,get:function(){return h.NPMMatcher}});var f=t(29640);Object.defineProperty(e,"ShellMatcher",{enumerable:!0,get:function(){return f.ShellMatcher}});var b=t(82036);Object.defineProperty(e,"JavaMatcher",{enumerable:!0,get:function(){return b.JavaMatcher}})},82036:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JavaMatcher=void 0;const n=t(4397);class l extends n.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=n.MatcherType.java,this.isMultiLine=!0}doMatch(h){return this.isErrorStack(h)||this.isCasuseByError(h)||this.isExceptionError(h)}isErrorStack(h){return this.isMatched&&!!h.find(f=>/^\s+at\s/i.test(f.content))}isCasuseByError(h){return!!h.find(f=>/caused\sby:/i.test(f.content))}isExceptionError(h){return!!h.find(f=>/\w+Exception:/i.test(f.content))}}e.JavaMatcher=l},12636:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NodeMatcher=void 0;const n=t(60772),l=t(4397);class o extends l.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=l.MatcherType.node,this.isMultiLine=!0,this.maxSpaceLine=1}doMatch(f){return this.isSingleLineError(f)||this.isMultiPartError(f)}isSingleLineError(f){return f.length===1&&(0,n.isRedColor)(f[0])&&(this.isMatched||!this.isExcludeContent(f[0].content))}isMultiPartError(f){return f.length>1&&!f.some(b=>!(0,n.isRedColor)(b))}isExcludeContent(f){return f.length<20||/mfsu/i.test(f)||/\s-\s/.test(f)}}e.NodeMatcher=o},97323:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NPMMatcher=void 0;const n=t(60772),l=t(4397);class o extends l.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=l.MatcherType.npm,this.isMultiLine=!0,this.maxSpaceLine=1}doMatch(f){return!!f.find(b=>/ERR/.test(b.content)&&(0,n.isRedColor)(b))}}e.NPMMatcher=o},29640:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ShellMatcher=void 0;const n=t(4397);class l extends n.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=n.MatcherType.shell,this.isMultiLine=!1}doMatch(h){return!!h.find(f=>/command\snot\sfound/.test(f.content))}}e.ShellMatcher=l},41084:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TSCMatcher=void 0;const n=t(60772),l=t(4397);class o extends l.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=l.MatcherType.typescript,this.isMultiLine=!0}doMatch(f){let b=!1,g=!1,v=!1;return f.forEach(I=>{/error/i.test(I.content)&&(0,n.isRedColor)(I)&&(b=!0),/TS\d+/.test(I.content)&&(g=!0),/Error:/i.test(I.content)&&(v=!0)}),b||g||v||this.isErrorStack(f)}isErrorStack(f){return this.isMatched&&!!f.find(b=>/^\s+at\s/i.test(b.content))}}e.TSCMatcher=o},14717:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PS1TerminalService=void 0;const n=t(85608),l=n.__importDefault(t(124)),o=n.__importDefault(t(14041)),h=t(25873),f=t(76003),b=t(41869),g=t(43718),v=t(6487),I=t(93062),u=t(32113),c=t(95121);var s;(function(r){r.PromptStarted="PS",r.PromptEnded="PE",r.CurrentWorkingDirectory="CWD"})(s||(s={}));let a=class extends g.Disposable{constructor(){super(...arguments),this.cancelToken=new g.CancellationTokenSource}active(){this.initContainer(),this.disposables.push(this.terminalController.onDidOpenTerminal(({id:d})=>this.listenTerminalEvent(d)))}listenTerminalEvent(d){const m=this.terminalController.clients.get(d);m&&setTimeout(()=>{this.listenPromptState(m.term)},0)}initContainer(){this.popupContainer=document.createElement("div"),document.body.appendChild(this.popupContainer)}listenPromptState(d){d.parser.registerOscHandler(6973,m=>{const G=m.indexOf(";");switch(G===-1?m:m.substring(0,G)){case s.PromptEnded:this.handlePromptEnd(d);break;default:return!1}return!1})}handlePromptEnd(d){this.promptEndMarker&&this.promptEndMarker.dispose(),this.promptEndDecoration&&this.promptEndDecoration.dispose(),this.promptEndMarker=d.registerMarker(0);const m=d.buffer.active.cursorX;this.onDataDisposable&&this.onDataDisposable.dispose();const G=d.registerDecoration({marker:this.promptEndMarker,width:d.cols,height:1,x:m+2,layer:"top"});G?.onRender(p=>{p.innerText=(0,b.localize)("terminal.ai.inputSharpToGetHint"),p.style.opacity="0.3"}),this.onDataDisposable=d.onData(p=>{var N;const W=d.buffer.active,Z=W.cursorX,y=W.cursorY;G?.dispose(),p==="#"&&y+W.baseY===((N=this.promptEndMarker)===null||N===void 0?void 0:N.line)&&(Z===m||Z===m+1)&&this.showAICommandPopup(d,m)})}showAICommandPopup(d,m){var G,p,N;if(!this.promptEndMarker)return;this.promptEndDecoration=d.registerDecoration({marker:this.promptEndMarker,width:1,height:1,backgroundColor:"#2472C8",x:m,layer:"top"});const W=d._addonManager._addons.find(y=>{var E;return!!(!((E=y?.instance)===null||E===void 0)&&E.connection)}),Z=(G=W?.instance)===null||G===void 0?void 0:G.connection;if(!Z){console.error((0,b.localize)("terminal.ai.cannotGetTerminalConnection"));return}(p=this.promptEndDecoration)===null||p===void 0||p.onRender(y=>{const E=y.clientWidth;this.promptEndReactRoot&&this.promptEndReactRoot.unmount(),this.promptEndReactRoot=(0,h.createRoot)(this.popupContainer),this.promptEndReactRoot.render(o.default.createElement(u.AITerminalPrompt,{onEscTriggered:()=>{setTimeout(()=>{var R;Z.sendData("\b"),(R=this.promptEndDecoration)===null||R===void 0||R.dispose()},0)},onSuggestionClick:R=>{setTimeout(()=>{var A;Z.sendData("\b"),Z.sendData(R),(A=this.promptEndDecoration)===null||A===void 0||A.dispose()},0)},getAICommandSuggestions:this.getAICommandSuggestions.bind(this),cancelAIRequst:this.stopAIStreamRequest.bind(this)})),(0,l.default)(this.popupContainer,y,{points:["bl","bl"],offset:[-E-6,0],targetOffset:[0,0],overflow:{adjustX:!1,adjustY:!1}})}),(N=this.promptEndDecoration)===null||N===void 0||N.onDispose(()=>{this.stopAIStreamRequest(),this.promptEndReactRoot&&this.promptEndReactRoot.unmount(),d.focus()})}async stopAIStreamRequest(){this.cancelToken.cancel(),this.cancelToken=new g.CancellationTokenSource}async getAICommandSuggestions(d,m,G,p){await this.stopAIStreamRequest();const N=this.aiReporter.start(g.AISerivceType.TerminalAICommand,{message:d}),W=await this.terminalFeatureRegistry.readableCommandSuggestions(d,this.cancelToken.token),Z=[];(0,I.listenReadable)(W,{onData:y=>{Z.push(y),p(Z)},onEnd:()=>{m(),this.aiReporter.end(N,{message:d,success:!0,actionSource:g.ActionSourceEnum.Terminal})}})}};n.__decorate([(0,f.Autowired)(v.ITerminalController),n.__metadata("design:type",Object)],a.prototype,"terminalController",void 0),n.__decorate([(0,f.Autowired)(g.TerminalRegistryToken),n.__metadata("design:type",c.TerminalFeatureRegistry)],a.prototype,"terminalFeatureRegistry",void 0),n.__decorate([(0,f.Autowired)(g.IAIReporter),n.__metadata("design:type",Object)],a.prototype,"aiReporter",void 0),a=n.__decorate([(0,f.Injectable)()],a),e.PS1TerminalService=a},28505:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TerminalAIContribution=void 0;const n=t(85608),l=t(76003),o=t(41869),h=t(43718),f=t(63439),b=t(96415),g=t(14717),v=t(95121);let I=class{onDidStart(){this.aiNativeConfigService.capabilities.supportsTerminalDetection&&(this.aiTerminalService.active(),this.aiTerminalDecorationService.active()),this.aiNativeConfigService.capabilities.supportsTerminalCommandSuggest&&this.terminalFeatureRegistry.hasProvider()&&this.ps1TerminalService.active()}};n.__decorate([(0,l.Autowired)(f.AITerminalService),n.__metadata("design:type",f.AITerminalService)],I.prototype,"aiTerminalService",void 0),n.__decorate([(0,l.Autowired)(b.AITerminalDecorationService),n.__metadata("design:type",b.AITerminalDecorationService)],I.prototype,"aiTerminalDecorationService",void 0),n.__decorate([(0,l.Autowired)(g.PS1TerminalService),n.__metadata("design:type",g.PS1TerminalService)],I.prototype,"ps1TerminalService",void 0),n.__decorate([(0,l.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],I.prototype,"aiNativeConfigService",void 0),n.__decorate([(0,l.Autowired)(h.TerminalRegistryToken),n.__metadata("design:type",v.TerminalFeatureRegistry)],I.prototype,"terminalFeatureRegistry",void 0),I=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],I),e.TerminalAIContribution=I},95121:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TerminalFeatureRegistry=void 0;const n=t(85608),l=t(76003),o=t(43718),h=t(93062),f=t(77633);let b=class extends o.Disposable{constructor(){super(...arguments),this.providerMap=new Set}hasProvider(){return this.providerMap.size>0}registerCommandSuggestionsProvider(v){this.providerMap.add(v)}async readableCommandSuggestions(v,I){var u,c,s,a;const r=Array.from(this.providerMap),d=[],m=[];try{for(var G=!0,p=n.__asyncValues(r),N;N=await p.next(),u=N.done,!u;){a=N.value,G=!1;try{const y=await a(v,I);if((0,h.isReadableStream)(y)){d.push(y);continue}m.push(...y)}finally{G=!0}}}catch(Z){c={error:Z}}finally{try{!G&&!u&&(s=p.return)&&await s.call(p)}finally{if(c)throw c.error}}const W=f.TerminalSuggestionReadableStream.create();return m.forEach(W.emitData.bind(W)),d.length===0?queueMicrotask(()=>{W.end()}):(0,h.listenGroupReadable)(d,{onData:W.emitData.bind(W),onEnd:W.end.bind(W)}),W}};b=n.__decorate([(0,l.Injectable)()],b),e.TerminalFeatureRegistry=b},60772:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isRedColor=e.ansiParser=e.ColorCode=e.StyleCode=void 0;const l=t(85608).__importDefault(t(91371)),o={color:0,isSpecialColor:!1,isRgbColor:!1,is256Color:!1,bgColor:0,isSpecialBg:!1,isRgbBg:!1,is256Bg:!1,bold:!1,underline:!1};var h;(function(I){I[I.RESET=0]="RESET",I[I.BOLD=1]="BOLD",I[I.UNDERLINE=4]="UNDERLINE",I[I.RESET_BOLD=22]="RESET_BOLD",I[I.RESET_UNDERLINE=24]="RESET_UNDERLINE"})(h=e.StyleCode||(e.StyleCode={}));var f;(function(I){I[I.MODE_RGB=2]="MODE_RGB",I[I.MODE_256=5]="MODE_256",I[I.BLACK=30]="BLACK",I[I.RED=31]="RED",I[I.GREEN=32]="GREEN",I[I.YELLOW=33]="YELLOW",I[I.BLUE=34]="BLUE",I[I.MAGENTA=35]="MAGENTA",I[I.CYAN=36]="CYAN",I[I.WHITE=37]="WHITE",I[I.SPECIAL_COLOR_MODE=38]="SPECIAL_COLOR_MODE",I[I.RESET_COLOR=39]="RESET_COLOR",I[I.BLACK_BG=40]="BLACK_BG",I[I.RED_BG=41]="RED_BG",I[I.GREEN_BG=42]="GREEN_BG",I[I.YELLOW_BG=43]="YELLOW_BG",I[I.BLUE_BG=44]="BLUE_BG",I[I.MAGENTA_BG=45]="MAGENTA_BG",I[I.CYAN_BG=46]="CYAN_BG",I[I.WHITE_BG=47]="WHITE_BG",I[I.SPECIAL_BG_MODE=48]="SPECIAL_BG_MODE",I[I.RESET_BG=49]="RESET_BG",I[I.BLACK_BRIGHT=90]="BLACK_BRIGHT",I[I.RED_BRIGHT=91]="RED_BRIGHT",I[I.GREEN_BRIGHT=92]="GREEN_BRIGHT",I[I.YELLOW_BRIGHT=93]="YELLOW_BRIGHT",I[I.BLUE_BRIGHT=94]="BLUE_BRIGHT",I[I.MAGENTA_BRIGHT=95]="MAGENTA_BRIGHT",I[I.CYAN_BRIGHT=96]="CYAN_BRIGHT",I[I.WHITE_BRIGHT=97]="WHITE_BRIGHT",I[I.BLACK_HIGH_INTENSITY=100]="BLACK_HIGH_INTENSITY",I[I.RED_HIGH_INTENSITY=101]="RED_HIGH_INTENSITY",I[I.GREEN_HIGH_INTENSITY=102]="GREEN_HIGH_INTENSITY",I[I.BLUE_HIGH_INTENSITY=104]="BLUE_HIGH_INTENSITY",I[I.MAGENTA_HIGH_INTENSITY=105]="MAGENTA_HIGH_INTENSITY",I[I.CYAN_HIGH_INTENSITY=106]="CYAN_HIGH_INTENSITY",I[I.WHITE_HIGH_INTENSITY=107]="WHITE_HIGH_INTENSITY"})(f=e.ColorCode||(e.ColorCode={}));function b(I,u,c){u.isSpecialColor||u.isSpecialBg?c===f.SPECIAL_COLOR_MODE?u.color=I:u.bgColor=I:I>=30&&I<=37||I>=90&&I<=97?u.color=I:(I>=40&&I<=47||I>=100&&I<=107)&&(u.bgColor=I)}function g(I,u){const c=(0,l.default)(),s=[];let a,r=0;const d=Object.assign({},u||o);for(;a=c.exec(I);){const G=I.slice(r,a.index);G&&s.push(Object.assign({content:G},d));const p=a[0].slice(2,-1).split(";").map(Number);if(p.length)for(let N=0;N<p.length;N++){const W=p[N],Z=p[N-1];switch(W){case h.RESET:Object.assign(d,o);break;case h.BOLD:d.bold=!0;break;case h.UNDERLINE:d.underline=!0;break;case h.RESET_BOLD:d.bold=!1;break;case h.RESET_UNDERLINE:d.underline=!1;break;case f.RESET_COLOR:d.color=0;break;case f.RESET_BG:d.bgColor=0;break;case f.SPECIAL_COLOR_MODE:d.isSpecialColor=!0;break;case f.SPECIAL_BG_MODE:d.isSpecialBg=!0;break;case f.MODE_RGB:Z===f.SPECIAL_COLOR_MODE?d.isRgbColor=!0:d.isRgbBg=!0;break;case f.MODE_256:Z===f.SPECIAL_COLOR_MODE?d.is256Color=!0:d.is256Bg=!0;break;default:b(W,d,p[N-2])}}r=a.index+a[0].length}const m=I.slice(r);return m&&s.push(Object.assign({content:m},d)),{parts:s,currentStyle:d}}e.ansiParser=g;function v(I){const{color:u,isSpecialColor:c,is256Color:s}=I;return c?s?u===1||u===9||u>=160&&u<=196:u===255:u===f.RED||u===f.RED_BRIGHT}e.isRedColor=v},32004:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AINativeModule=void 0;const n=t(85608),l=t(76003),o=t(41869),h=t(43718),f=t(19413),b=t(19413),g=t(32016),v=t(74055),I=t(84543),u=t(61282),c=t(51081),s=t(29770),a=t(11735),r=t(59347),d=t(70394),m=t(72713),G=t(57232),p=t(99301),N=t(74292),W=t(35363),Z=t(44298),y=t(33588),E=t(2204),R=t(2994),A=t(28505),w=t(95121),F=t(85679),V=t(3841),Y=t(77633),_=t(2281),H=t(31031),X=t(15989);let S=class extends o.BrowserModule{constructor(){super(),this.contributionProvider=Y.AINativeCoreContribution,this.providers=[g.AINativeBrowserContribution,W.InterfaceNavigationContribution,A.TerminalAIContribution,Z.MergeConflictContribution,m.AICodeActionContribution,V.AINativePreferencesContribution,p.IntelligentCompletionsContribution,{token:o.InlineChatFeatureRegistryToken,useClass:_.InlineChatFeatureRegistry},{token:o.ChatFeatureRegistryToken,useClass:a.ChatFeatureRegistry},{token:o.ChatRenderRegistryToken,useClass:d.ChatRenderRegistry},{token:o.ResolveConflictRegistryToken,useClass:y.ResolveConflictRegistry},{token:h.IntelligentCompletionsRegistryToken,useClass:N.IntelligentCompletionsRegistry},{token:o.IAIInlineChatService,useClass:H.AIInlineChatService},{token:f.IChatManagerService,useClass:u.ChatManagerService},{token:f.IChatAgentService,useClass:v.ChatAgentService},{token:o.ChatAgentViewServiceToken,useClass:I.ChatAgentViewService},{token:f.IChatInternalService,useClass:r.ChatInternalService},{token:f.ChatProxyServiceToken,useClass:c.ChatProxyService},{token:o.ChatServiceToken,useClass:s.ChatService},{token:o.RenameCandidatesProviderRegistryToken,useClass:R.RenameCandidatesProviderRegistry},{token:h.ProblemFixRegistryToken,useClass:E.ProblemFixProviderRegistry},{token:h.TerminalRegistryToken,useClass:w.TerminalFeatureRegistry},{token:F.LanguageParserService,useClass:F.LanguageParserService},{token:b.IAIInlineCompletionsProvider,useClass:G.AIInlineCompletionsProvider},{token:X.PartialEventEmitter,useValue:new h.Emitter}],this.backServices=[{servicePath:o.AIBackSerivcePath,token:o.AIBackSerivceToken,clientToken:f.ChatProxyServiceToken}],this.aiNativeConfig.setAINativeModuleLoaded(!0)}};n.__decorate([(0,l.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],S.prototype,"aiNativeConfig",void 0),S=n.__decorate([(0,l.Injectable)(),n.__metadata("design:paramtypes",[])],S),e.AINativeModule=S},3073:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LanguageParser=e.DEFAULT_MIN_BLOCK_COUNT=void 0;const n=t(85608),l=n.__importDefault(t(13833)),o=t(76003),h=t(70392),f=t(53374),b=t(22486),g=t(67045);e.DEFAULT_MIN_BLOCK_COUNT=20;let v=class{constructor(u){this.language=u,this.parserLoaded=new h.Deferred,this.lruCache=new h.LRUCache(500),this.initializeParser()}ready(){return this.parserLoaded.promise}getParser(){return this.parser}async initializeParser(){this.parser=await this.wasmModuleManager.initParser();const u=await this.wasmModuleManager.loadLanguage(this.language),c=await l.default.Language.load(new Uint8Array(u));this.parser.setLanguage(c),this.parserLoaded.resolve()}findContainingCodeBlockWithPosition(u,c){return u.startIndex<=c&&u.endIndex>=c&&this.languageFacts.isCodeBlock(this.language,u.type)?u:u.parent?this.findContainingCodeBlockWithPosition(u.parent,c):null}findFunctionCodeBlock(u,c){return u.startIndex<=c&&u.endIndex>=c&&this.languageFacts.isFunctionCodeBlock(this.language,u.type)?u:u.parent?this.findFunctionCodeBlock(u.parent,c):null}async parseAST(u){const c=`${u.id}@${u.getVersionId()}`,s=this.lruCache.get(c);if(s)return s;await this.parserLoaded.promise;const a=u.getValue(),r=this.parser.parse(a);if(r){const d=r.rootNode;return this.lruCache.set(c,d),d}}async getSyntaxNodeAsPosition(u,c){const s=await this.parseAST(u);return s?s.namedDescendantForIndex(c):null}async findCodeBlockWithSyntaxError(u,c){await this.parserLoaded.promise;const s=this.parser.parse(u);if(s){const a=s.rootNode,r={row:c.startLineNumber-1,column:c.startColumn},d=a.namedDescendantForPosition(r);let m=d.parent;if(!m)return{range:(0,f.toMonacoRange)(d),type:d.type,infoCategory:"other"};for(;m&&!m.hasError;)m=m.parent;return m?{range:(0,f.toMonacoRange)(m),type:m.type,infoCategory:"other"}:{range:c,type:d.type,infoCategory:"other"}}return null}async provideCodeBlockInfo(u,c){const s=u.getOffsetAt(c),a=await this.getSyntaxNodeAsPosition(u,s);if(!a)return null;const r=this.findFunctionCodeBlock(a,s);if(r)return this.languageFacts.provideFunctionInfo(this.language,r);const d=this.findContainingCodeBlockWithPosition(a,s);return d?{infoCategory:"other",range:{startLineNumber:d.startPosition.row+1,startColumn:0,endLineNumber:d.endPosition.row+1,endColumn:1/0},type:d.type}:null}async provideCodeBlockInfoInRange(u,c){const s=await this.parseAST(u);if(s){const a={row:c.startLineNumber-1,column:c.startColumn-1},r={row:c.endLineNumber,column:c.endColumn},d=this.languageFacts.getCodeBlockTypes(this.language);if(!d||d.size===0)return null;const m=s.descendantsOfType(Array.from(d),a,r);if(m&&m.length>0){const G=m[0];return{infoCategory:"other",range:(0,f.toMonacoRange)(G),type:G.type}}}return null}async trimSuffixSyntaxErrors(u,c=e.DEFAULT_MIN_BLOCK_COUNT){var s;await this.parserLoaded.promise;const a=(s=this.parser)===null||s===void 0?void 0:s.parse(u),r=a?.rootNode;if(!r)return u;const{namedChildren:d}=r;if(!r.hasError||d.length<=c)return this.trimToLastCompleteBlock(r,!0);let m=null,G=null;for(let y=d.length-1;y>=c;y--){const E=d[y];if(E.hasError&&y!==0)m=E;else if(m){G=E;break}}G||(G=d[c-1]);const N=u.split(`
28063
28063
  `).slice(0,G.endPosition.row+1),W=N[N.length-1].slice(0,G.endPosition.column);return`${N.length>1?`${N.slice(0,-1).join(`
28064
28064
  `)}
28065
28065
  `:""}${W}`}async trimPrefixSyntaxErrors(u,c=e.DEFAULT_MIN_BLOCK_COUNT){var s;await this.parserLoaded.promise;const a=(s=this.parser)===null||s===void 0?void 0:s.parse(u),r=a?.rootNode;if(!r)return u;const{namedChildren:d}=r;if(!r.hasError||d.length<=c)return this.trimToLastCompleteBlock(r);let m=null,G=null;for(let y=0;y<d.length-c;y++){const E=d[y];if(E.hasError&&y!==d.length-1)m=E;else if(m){G=E;break}}G||(G=d[d.length-c]);const N=u.split(`
@@ -28073,10 +28073,10 @@ ${N.slice(1).join(`
28073
28073
  ${d.slice(1).join(`
28074
28074
  `)}`:""}`}}return u.text}async extractImportPaths(u){var c,s;const a=[];if(this.language==="typescript"){await this.parserLoaded.promise;const r=(c=this.parser)===null||c===void 0?void 0:c.parse(u),d=r?.rootNode;if(d)for(let m=0;m<d?.childCount;m++){const G=d.child(m);if(G?.type==="import_statement"){let p=(s=G.child(3))===null||s===void 0?void 0:s.text;(p?.includes("'")||p?.includes('"'))&&(p=p.slice(1,-1)),p&&a.push(p)}}}return a}async extractInterfaceOrTypeCode(u){var c;const s=[];if(this.language==="typescript"){await this.parserLoaded.promise;const a=(c=this.parser)===null||c===void 0?void 0:c.parse(u),r=a?.rootNode;if(r)for(let d=0;d<r?.childCount;d++){const m=r.child(d);if(m?.type==="export_statement"){const G=m.child(1);(G?.type==="interface_declaration"||G?.type==="type_alias_declaration")&&s.push(G.text)}else(m?.type==="interface_declaration"||m?.type==="type_alias_declaration")&&s.push(m.text)}}return s}dispose(){this.parser.delete(),this.lruCache.clear()}};n.__decorate([(0,o.Autowired)(g.WasmModuleManager),n.__metadata("design:type",g.WasmModuleManager)],v.prototype,"wasmModuleManager",void 0),n.__decorate([(0,o.Autowired)(b.TreeSitterLanguageFacts),n.__metadata("design:type",b.TreeSitterLanguageFacts)],v.prototype,"languageFacts",void 0),v=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String])],v),e.LanguageParser=v},85679:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LanguageParserService=void 0;const n=t(85608),l=t(76003),o=t(3073),h=t(22486);let f=class{constructor(){this.pool=new Map}createParser(g){const v=h.parserNameMap[g];if(v)return this.pool.has(v)||this.pool.set(v,this.injector.get(o.LanguageParser,[v])),this.pool.get(v)}dispose(){this.pool.forEach(g=>g.dispose()),this.pool.clear()}};n.__decorate([(0,l.Autowired)(l.INJECTOR_TOKEN),n.__metadata("design:type",l.Injector)],f.prototype,"injector",void 0),f=n.__decorate([(0,l.Injectable)()],f),e.LanguageParserService=f},53374:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.toMonacoRange=void 0;function t(n){return{startLineNumber:n.startPosition.row+1,startColumn:n.startPosition.column+1,endLineNumber:n.endPosition.row+1,endColumn:n.endPosition.column+1}}e.toMonacoRange=t},19584:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GolangLanguageFacts=void 0;const t=["function_declaration","method_declaration","block","if_statement","else_statement","switch_statement","case_clause","for_statement","range_clause","type_switch_statement","type_case_clause","comm_clause","select_statement","go_statement","defer_statement"],n=new Set(t);class l{constructor(){this.name="go",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return n}isCodeBlock(h){return n.has(h)}}e.GolangLanguageFacts=l},22486:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TreeSitterLanguageFacts=e.knownLanguageFacts=void 0;const n=t(85608);n.__exportStar(t(17973),e);const l=t(76003),o=t(19584),h=t(44606),f=t(82381),b=t(41486),g=t(98588),v=t(96436),I=t(2349),u=t(78542),c=new Set;e.knownLanguageFacts=[o.GolangLanguageFacts,h.JavaLanguageFacts,f.JavaScriptLanguageFacts,b.JavaScriptReactLanguageFacts,g.PythonLanguageFacts,v.RustLanguageFacts,I.TypeScriptLanguageFacts,u.TypeScriptReactLanguageFacts];let s=class{constructor(){this.langs=new Map,e.knownLanguageFacts.forEach(r=>{const d=new r;this.langs.set(d.name,d)})}isCodeBlock(r,d){const m=this.langs.get(r);return m&&m.isCodeBlock?m.isCodeBlock(d):!1}isFunctionCodeBlock(r,d){const m=this.langs.get(r);return m&&m.isFunctionCodeBlocks?m.isFunctionCodeBlocks(d):!1}provideFunctionInfo(r,d){const m=this.langs.get(r);return m&&m.provideFunctionInfo?m.provideFunctionInfo(d):null}getCodeBlockTypes(r){const d=this.langs.get(r);return d?d.provideCodeBlocks():c}};s=n.__decorate([(0,l.Injectable)(),n.__metadata("design:paramtypes",[])],s),e.TreeSitterLanguageFacts=s},44606:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JavaLanguageFacts=void 0;const t=["compilation_unit","class_declaration","interface_declaration","enum_declaration","method_declaration","constructor_declaration","block","static_initializer","instance_initializer","if_statement","switch_statement","while_statement","do_statement","for_statement","enhanced_for_statement","try_statement","catch_clause","finally_clause"],n=new Set(["method_declaration","constructor_declaration"]),l=new Set(t);class o{constructor(){this.name="java",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return l}isCodeBlock(f){return l.has(f)}isFunctionCodeBlocks(f){return n.has(f)}}e.JavaLanguageFacts=o},82381:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JavaScriptLanguageFacts=e.functionBlockCodeTypes=e.javascriptBlockCodeTypes=void 0;const n=t(53374);e.javascriptBlockCodeTypes=["function","function_declaration","function_expression","arrow_function","class_declaration","method_definition","if_statement","switch_case","while_statement","do_statement","for_statement","for_in_statement","try_statement","catch_clause","block","export_statement","lexical_declaration"],e.functionBlockCodeTypes=["function","function_declaration","function_expression","arrow_function","method_definition"];const l=new Set(e.functionBlockCodeTypes),o=new Set(e.javascriptBlockCodeTypes);class h{constructor(){this.name="javascript",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return o}isCodeBlock(b){return o.has(b)}isFunctionCodeBlocks(b){return l.has(b)}provideFunctionInfo(b){var g,v,I;switch(b.type){case"function_declaration":case"function_expression":return{infoCategory:"function",type:b.type,name:((g=b.firstNamedChild)===null||g===void 0?void 0:g.text)||"",signatures:b.children.filter(u=>u.type==="parameter").map(u=>{var c;return((c=u.firstChild)===null||c===void 0?void 0:c.text)||""}),range:(0,n.toMonacoRange)(b)};case"arrow_function":{const u=b.parent;return u&&u.type==="variable_declarator"&&u.parent&&(u.parent.type==="lexical_declaration"||u.parent.type==="export_statement"||u.parent.type==="variable_declaration")?{infoCategory:"function",type:b.type,name:((v=u.firstChild)===null||v===void 0?void 0:v.text)||"",signatures:b.children.filter(c=>c.type==="parameter").map(c=>{var s;return((s=c.firstChild)===null||s===void 0?void 0:s.text)||""}),range:(0,n.toMonacoRange)(u.parent)}:null}case"method_definition":return{infoCategory:"function",type:b.type,name:((I=b.firstNamedChild)===null||I===void 0?void 0:I.text)||"",signatures:b.children.filter(u=>u.type==="parameter").map(u=>{var c;return((c=u.firstChild)===null||c===void 0?void 0:c.text)||""}),range:(0,n.toMonacoRange)(b)}}return null}}e.JavaScriptLanguageFacts=h},41486:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JavaScriptReactLanguageFacts=e.javascriptreactBlockCodeTypes=void 0;const n=t(82381);e.javascriptreactBlockCodeTypes=[...n.javascriptBlockCodeTypes,"jsx_element","jsx_self_closing_element","jsx_expression","jsx_fragment"];const l=new Set(e.javascriptreactBlockCodeTypes);class o{constructor(){this.name="jsx",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return l}isCodeBlock(f){return l.has(f)}}e.JavaScriptReactLanguageFacts=o},98588:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PythonLanguageFacts=e.pythonBlockCodeTypes=void 0,e.pythonBlockCodeTypes=["function_definition","class_definition","compound_statement","if_statement","elif_clause","else_clause","for_statement","while_statement","try_statement","except_clause","with_statement","decorated_definition"];const t=new Set(e.pythonBlockCodeTypes);class n{constructor(){this.name="python",this.listCommentStyle="# ",this.blockCommentStyle={start:"'''",end:"'''",linePrefix:""}}provideCodeBlocks(){return t}isCodeBlock(o){return t.has(o)}}e.PythonLanguageFacts=n},96436:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RustLanguageFacts=e.rustBlockCodeTypes=void 0,e.rustBlockCodeTypes=["function_item","impl_item","trait_item","block","if_expression","match_expression","while_expression","loop_expression","for_expression","closure_expression","struct_item","enum_item","union_item","mod_item"];const t=new Set(e.rustBlockCodeTypes);class n{constructor(){this.name="rust",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return t}isCodeBlock(o){return t.has(o)}}e.RustLanguageFacts=n},17973:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parserIdentifierMap=e.parserNameMap=void 0;const l=t(85608).__importDefault(t(19891)),o={typescript:"typescript",typescriptreact:"tsx",javascript:"javascript",javascriptreact:"jsx",rust:"rust",python:"python",java:"java",go:"go"};e.parserNameMap=o,e.parserIdentifierMap=(0,l.default)(e.parserNameMap)},2349:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeScriptLanguageFacts=e.typescriptBlockTypes=void 0,e.typescriptBlockTypes=["function","function_declaration","function_expression","arrow_function","class_declaration","interface_declaration","method_definition","method_signature","enum_declaration","type_alias_declaration","lexical_declaration","if_statement","switch_case","while_statement","do_statement","for_statement","for_in_statement","for_of_statement","try_statement","catch_clause","block","module","public_field_definition","private_field_definition","export_statement"];const t=new Set(e.typescriptBlockTypes);class n{constructor(){this.name="typescript",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return t}isCodeBlock(o){return t.has(o)}}e.TypeScriptLanguageFacts=n},78542:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeScriptReactLanguageFacts=e.typescriptreactBlockTypes=void 0;const n=t(2349);e.typescriptreactBlockTypes=[...n.typescriptBlockTypes,"jsx_element","jsx_self_closing_element","jsx_expression","jsx_fragment"];const l=new Set(e.typescriptreactBlockTypes);class o{constructor(){this.name="tsx",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return l}isCodeBlock(f){return l.has(f)}}e.TypeScriptReactLanguageFacts=o},67045:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WasmModuleManager=void 0;const n=t(85608),l=n.__importDefault(t(13833)),o=t(76003),h=t(6858),f=t(70392);let b=class{async resolveResourceUri(){const v=await this.rendererRuntime.provideResourceUri(h.EKnownResources.TreeSitterWasmDirectory);this.resolvedResourceUriDeferred.resolve(v)}constructor(){this.resolvedResourceUriDeferred=new f.Deferred,this.cachedRuntime=new Map,this.parserInitialized=!1,this.resolveResourceUri()}async initParser(){const I=`${await this.resolvedResourceUriDeferred.promise}/tree-sitter.wasm`;return this.parserInitialized||(await l.default.init({locateFile:()=>I}),this.parserInitialized=!0),new l.default}async loadLanguage(v){if(!this.cachedRuntime.has(v)){const I=new f.Deferred;this.cachedRuntime.set(v,I);const c=`${await this.resolvedResourceUriDeferred.promise}/tree-sitter-${v}.wasm`;fetch(c).then(s=>s.arrayBuffer()).then(s=>{I.resolve(s)})}return this.cachedRuntime.get(v).promise}};n.__decorate([(0,o.Autowired)(h.RendererRuntime),n.__metadata("design:type",h.RendererRuntime)],b.prototype,"rendererRuntime",void 0),b=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],b),e.WasmModuleManager=b},4972:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AIRightTabRenderer=e.AILeftTabRenderer=e.AIChatTabRendererWithTab=e.AIChatTabRenderer=void 0;const n=t(85608),l=n.__importDefault(t(53373)),o=n.__importStar(t(14041)),h=t(41869),f=t(89195),b=t(1149),g=t(43718),v=t(11090),I=t(63067),u=t(46245),c=t(66368),s=t(19951),a=t(752),r=t(19413),d=n.__importDefault(t(87708)),m=()=>{const{side:y}=o.default.useContext(s.TabbarConfig),E=(0,h.useInjectable)(a.TabbarServiceFactory)(y);return(0,o.useEffect)(()=>{E.setIsLatter(!0)},[E]),o.default.createElement("div",{style:{width:0}},o.default.createElement(u.TabbarViewBase,{tabSize:0,MoreTabView:u.IconElipses,TabView:u.IconTabView,barSize:0,panelBorderSize:1}))},G=({className:y,components:E})=>o.default.createElement(s.TabRendererBase,{side:r.AI_CHAT_VIEW_ID,direction:"left-to-right",id:d.default.ai_chat_panel,className:(0,l.default)(y,`${r.AI_CHAT_VIEW_ID}-slot`),components:E,TabbarView:()=>o.default.createElement(m,null),TabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:c.ContainerView,PanelViewProps:{className:d.default.ai_chat_view_container}})});e.AIChatTabRenderer=G;const p=({className:y,components:E})=>o.default.createElement(s.TabRendererBase,{side:r.AI_CHAT_VIEW_ID,direction:"right-to-left",id:d.default.ai_chat_panel,className:(0,l.default)(y,`${r.AI_CHAT_VIEW_ID}-slot`,"design_right_slot"),components:E,TabbarView:()=>o.default.createElement(u.ChatTabbarRenderer2,null),TabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:c.ContainerView,PanelViewProps:{className:d.default.ai_chat_view_container}})});e.AIChatTabRendererWithTab=p;const N=({className:y,components:E})=>o.default.createElement(v.DesignLeftTabRenderer,{className:y,components:E,tabbarView:W});e.AILeftTabRenderer=N;const W=()=>{const y=(0,h.useInjectable)(a.TabbarServiceFactory)(h.SlotLocation.right),E=(0,h.useInjectable)(I.IMainLayoutService),R=o.default.useMemo(()=>E.getExtraMenu(),[E]),[A]=(0,h.useContextMenus)(R),w=(0,o.useCallback)(({renderContainers:F})=>{const{currentContainerId:V,handleTabClick:Y}=y,_=y.visibleContainers.filter(H=>{var X;return!(!((X=H.options)===null||X===void 0)&&X.hideTab)});return o.default.createElement(o.default.Fragment,null,_.length>0&&o.default.createElement(f.HorizontalVertical,{margin:"8px auto 0px",width:"60%"}),_.map(H=>F(H,Y,V)))},[y]);return o.default.createElement(u.LeftTabbarRenderer,{renderOtherVisibleContainers:w,isRenderExtraTopMenus:!1,renderExtraMenus:o.default.createElement("div",{className:d.default.extra_bottom_icon_container},A.length>=0?A.map(F=>o.default.createElement(f.EnhanceIconWithCtxMenu,{key:F.id,id:F.id,wrapperClassName:d.default.extra_bottom_icon,iconClass:F.icon,menuNodes:F.children,skew:{x:-8,y:-4}})):null)})},Z=({className:y,components:E})=>{const R=(0,h.useInjectable)(a.TabbarServiceFactory)(h.SlotLocation.right),A=(0,h.useInjectable)(b.DesignLayoutConfig),w=(0,o.useCallback)(()=>{R.updateCurrentContainerId("")},[]),F=(0,o.useCallback)(Y=>{const{component:_}=Y,{options:H}=_;return o.default.createElement(c.ContainerView,Object.assign({},Y,{renderContainerWrap:({children:X})=>o.default.createElement("div",{className:d.default.right_slot_container_wrap},o.default.createElement("div",{className:d.default.header},o.default.createElement("span",{className:d.default.title},H&&H.title),o.default.createElement("div",{className:d.default.side},o.default.createElement(f.EnhancePopover,{id:"ai_right_panel_header_close",title:(0,g.localize)("editor.title.context.close")},o.default.createElement(f.EnhanceIcon,{icon:"close",onClick:w})))),o.default.createElement("div",{className:d.default.container},X))}))},[]),V=(0,o.useMemo)(()=>A.useMergeRightWithLeftPanel?d.default.right_tab_renderer:"",[A]);return o.default.createElement(v.DesignRightTabRenderer,{components:E,className:V,tabbarView:()=>o.default.createElement(u.RightTabbarRenderer,{barSize:0,style:{width:0}}),tabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:F})})};e.AIRightTabRenderer=Z},82983:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AIChatLogoAvatar=void 0;const n=t(85608),l=n.__importDefault(t(14041)),o=t(41869),h=t(89195),f=t(63067),b=t(19413),g=n.__importDefault(t(88473)),v=()=>{const I=(0,o.useInjectable)(f.IMainLayoutService),u=l.default.useCallback(()=>{I.toggleSlot(b.AI_CHAT_VIEW_ID)},[I]);return l.default.createElement("div",{className:g.default.ai_switch,onClick:u},l.default.createElement(h.AILogoAvatar,{iconClassName:g.default.avatar_icon_large}))};e.AIChatLogoAvatar=v},53617:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EnhanceDecorationsCollection=void 0;const n=t(85608),l=t(43718),o=t(20868),h=t(77714),f=n.__importDefault(t(4619));class b{get isHidden(){return this._hidden}get codeEditor(){return this.metadata.codeEditor}get deltaData(){return this.metadata.deltaData}get id(){return this.metadata.id}get editorDecoration(){return this.metadata.editorDecoration}get group(){return this._group}constructor(I){this.metadata=I,this._hidden=!1;const{editorDecoration:u,deltaData:c,isHidden:s,group:a}=I;(0,l.isUndefined)(c.length)?this.length=u.range.endLineNumber-u.range.startLineNumber:this.length=c.length,this.range=u.range,this.options=u.options,this.resumeRange=this.range,this._hidden=!!s,this._hidden&&this.hide(),(0,l.isDefined)(a)&&this.setGroup(a)}setGroup(I){this._group=I}changeVisibility(I,u){if(!this.options.className)return;const c=this.options.className.split(h.space).filter(s=>s!==f.default.hidden&&s!==f.default.visible).filter(Boolean);c.push(I),this.options.className=c.join(h.space),this.codeEditor.changeDecorations(s=>{s.changeDecorationOptions(this.id,this.options),s.changeDecoration(this.id,u)})}setRange(I){this.range=I}getRange(){return this.range}dispose(){var I,u;(u=(I=this.deltaData).dispose)===null||u===void 0||u.call(I)}hide(){this.resumeRange=this.range,this._hidden=!0;const I={lineNumber:this.range.startLineNumber,column:1},u=o.Range.fromPositions(I);this.changeVisibility(f.default.hidden,u)}resume(){this._hidden=!1,this.changeVisibility(f.default.visible,o.Range.lift(this.resumeRange))}}class g extends l.Disposable{get model(){return this.codeEditor.getModel()}constructor(I){super(),this.codeEditor=I,this.deltaDecorations=[],this._onDidDecorationsChange=this.registerDispose(new l.Emitter),this.onDidDecorationsChange=this._onDidDecorationsChange.event,this.addDispose(this.codeEditor.onDidContentSizeChange(u=>{const{contentHeightChanged:c}=u;c&&this.flush()}))}flush(){this.deltaDecorations=this.deltaDecorations.map(I=>{const{id:u,editorDecoration:{range:c}}=I,s=this.model.getDecorationRange(u);return I.setRange(s??c),I}),this._onDidDecorationsChange.fire(this.deltaDecorations)}delete(I){this.codeEditor.changeDecorations(u=>{u.removeDecoration(I),this.deltaDecorations=this.deltaDecorations.filter(c=>c.id!==I)})}createDecorations(I){return new b(I)}set(I){this.clear(),this.codeEditor.changeDecorations(u=>{const c=[];for(const s of I){const a=u.addDecoration(s.range,s.options);c.push(this.createDecorations({id:a,editorDecoration:s,codeEditor:this.codeEditor,isHidden:s.isHidden,group:s.group,deltaData:{dispose:()=>this.delete(a),length:s.length}}))}this.deltaDecorations=c})}getDecorations(){return this.deltaDecorations}getDecorationByGroup(I){return this.deltaDecorations.find(u=>u.group===I)}getDecorationByLineNumber(I){return this.deltaDecorations.find(u=>u.getRange().startLineNumber===I)}clear(){this.codeEditor.changeDecorations(I=>{for(const u of this.deltaDecorations)I.removeDecoration(u.id);this.deltaDecorations=[]})}}e.EnhanceDecorationsCollection=g},44260:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MsgHistoryManager=void 0;const n=t(85608),l=t(76003),o=t(43718);let h=class extends o.Disposable{constructor(){super(...arguments),this.messageMap=new Map,this._onMessageChange=new o.Emitter,this.onMessageChange=this._onMessageChange.event}dispose(){this.clearMessages(),super.dispose()}clearMessages(){this.messageMap.clear()}doAddMessage(b){const g=(0,o.uuid)(6),v=this.messageMap.size,I=Object.assign(Object.assign({},b),{id:g,order:v,type:b.type||"string"});return this.messageMap.set(g,I),this._onMessageChange.fire(this.getMessages()),g}getMessages(){return Array.from(this.messageMap.values()).sort((b,g)=>b.order-g.order)}addUserMessage(b){return this.doAddMessage(Object.assign(Object.assign({},b),{role:1}))}addAssistantMessage(b){return this.doAddMessage(Object.assign(Object.assign({},b),{role:2}))}updateAssistantMessage(b,g){if(!this.messageMap.has(b))return;const v=this.messageMap.get(b);this.messageMap.set(b,Object.assign(Object.assign({},v),{content:g.content}))}};h=n.__decorate([(0,l.Injectable)({multiple:!1})],h),e.MsgHistoryManager=h},3841:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AINativePreferencesContribution=void 0;const n=t(85608),l=t(41869),o=t(83854);let h=class{constructor(){this.schema=o.aiNativePreferenceSchema}};h=n.__decorate([(0,l.Domain)(l.PreferenceContribution)],h),e.AINativePreferencesContribution=h},83854:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.aiNativePreferenceSchema=e.EInlineDiffPreviewMode=void 0;const n=t(41869),l=t(43718);var o;(function(h){h.inlineLive="inlineLive",h.sideBySide="sideBySide"})(o=e.EInlineDiffPreviewMode||(e.EInlineDiffPreviewMode={})),e.aiNativePreferenceSchema={properties:{[n.AINativeSettingSectionsId.InlineDiffPreviewMode]:{type:"string",enum:[o.inlineLive,o.sideBySide],enumDescriptions:[(0,l.localize)("preference.ai.native.inlineDiff.preview.mode.inlineLive"),(0,l.localize)("preference.ai.native.inlineDiff.preview.mode.sideBySide")],default:o.inlineLive},[n.AINativeSettingSectionsId.InlineChatAutoVisible]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.InlineChatCodeActionEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.InterfaceQuickNavigationEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.ChatVisibleType]:{type:"string",enum:["never","always","default"],default:"default"},[n.AINativeSettingSectionsId.IntelligentCompletionsPromptEngineeringEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.IntelligentCompletionsDebounceTime]:{type:"number",default:150},[n.AINativeSettingSectionsId.IntelligentCompletionsCacheEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.IntelligentCompletionsAlwaysVisible]:{type:"boolean",default:!1}}}},77633:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AINativeCoreContribution=e.TerminalSuggestionReadableStream=e.ERunStrategy=void 0;const n=t(93062);var l;(function(h){h.EXECUTE="EXECUTE",h.PREVIEW="PREVIEW"})(l=e.ERunStrategy||(e.ERunStrategy={}));class o extends n.SumiReadableStream{static create(){return new o}}e.TerminalSuggestionReadableStream=o,e.AINativeCoreContribution=Symbol("AINativeCoreContribution")},24522:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ttPolicy=e.renderLines=void 0;const n=t(85608),l=t(55405),o=n.__importStar(t(98236)),h=t(27357),f=t(31324),b=t(33892),g=t(69226),v=(I,u,c,s)=>{const a=s.get(f.EditorOption.disableMonospaceOptimizations),r=s.get(f.EditorOption.stopRenderingLineAfter),d="none",m=s.get(f.EditorOption.renderControlCharacters),G=s.get(f.EditorOption.fontLigatures),p=s.get(f.EditorOption.fontInfo),N=s.get(f.EditorOption.lineHeight),W=new b.StringBuilder(1e4);W.appendString('<div class="suggest-preview-text">');for(let E=0,R=c.length;E<R;E++){const A=c[E],w=A.content;W.appendString('<div class="view-line'),W.appendString('" style="top:'),W.appendString(String(E*N)),W.appendString('px;width:1000000px;">');const F=o.isBasicASCII(w),V=o.containsRTL(w);(0,g.renderViewLine)(new g.RenderLineInput(p.isMonospace&&!a,p.canUseHalfwidthRightwardsArrow,w,!1,F,V,0,A.lineTokens,A.decorations,u,0,p.spaceWidth,p.middotWidth,p.wsmiddotWidth,r,d,m,G!==f.EditorFontLigatures.OFF,null),W),W.appendString("</div>")}W.appendString("</div>"),(0,h.applyFontInfo)(I,p);const Z=W.build(),y=e.ttPolicy?e.ttPolicy.createHTML(Z):Z;I.innerHTML=y};e.renderLines=v,e.ttPolicy=(0,l.createTrustedTypesPolicy)("editorGhostText",{createHTML:I=>I})},90614:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineResultAction=void 0;const l=t(85608).__importStar(t(14041)),o=t(66205),h=t(89195),f=t(43718),b=t(31031),g=({onResultClick:v})=>{const I=(0,l.useMemo)(()=>[{icon:"check",text:(0,f.localize)("aiNative.inline.chat.operate.check.title"),btnType:"default",onClick:()=>v(b.EResultKind.ACCEPT)},{icon:"discard",text:(0,f.localize)("aiNative.operate.discard.title"),onClick:()=>v(b.EResultKind.DISCARD)},{icon:"afresh",text:(0,f.localize)("aiNative.operate.afresh.title"),onClick:()=>v(b.EResultKind.REGENERATE)}],[v]);return l.default.createElement(o.ContentWidgetContainerPanel,{style:{transform:"translateY(4px)"}},l.default.createElement(h.AIInlineResult,{iconItems:I}))};e.InlineResultAction=g},40111:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineChatController=void 0;const n=t(43718),l=t(93062),o=t(19413);class h{static is(b){return b instanceof h&&typeof b.mountReadable=="function"}constructor(b){this.options=b,this._onData=new n.Emitter,this.onData=this._onData.event,this._onEnd=new n.Emitter,this.onEnd=this._onEnd.event,this._onAbort=new n.Emitter,this.onAbort=this._onAbort.event,this._onError=new n.Emitter,this.onError=this._onError.event,this._stream=null,this._listened=!1}calculateCodeBlocks(b){var g;if(!(!((g=this.options)===null||g===void 0)&&g.enableCodeblockRender))return b;const v=b.split(`
28075
28075
  `);let I=[],u=!1,c=0;return v.forEach((s,a)=>{if(!u&&s.startsWith(o.BACK_QUOTE_3_SYMBOL))u=!0,c=a+1;else if(u&&s.startsWith(o.BACK_QUOTE_3_SYMBOL)){u=!1;const r=a;I=v.slice(c,r)}u&&c!==a+1&&I.push(s)}),I.join(`
28076
- `)}mountReadable(b){this._stream=b}get isListened(){return this._listened}listen(){if(this._listened)return;if(!this._stream)throw new Error("No Stream mounted");this._listened=!0;const b=new n.ReplyResponse("");let g="";(0,l.listenReadable)(this._stream,{onData:v=>{g+=v.content;const I=this.calculateCodeBlocks(g);b.updateMessage(I),this._onData.fire(b)},onEnd:()=>{this._onEnd.fire()},onError:v=>{n.AbortError.is(v)?this._onAbort.fire():this._onError.fire(new n.ErrorResponse(v))}})}}e.InlineChatController=h},51221:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineChatEditorController=void 0;const n=t(41869),l=t(43718),o=t(43718),h=t(54414),f=t(52902),b=t(99906),g=t(89132),v=t(77633),I=t(38890),u=t(40111),c=t(31031),s=t(26664);class a extends b.BaseAIMonacoEditorController{constructor(){super(...arguments),this.aiInlineChatDisposable=new l.Disposable,this.aiInlineChatOperationDisposable=new l.Disposable,this.inlineChatInUsing=!1}static get(d){return d.getContribution(a.ID)}get aiNativeConfigService(){return this.injector.get(n.AINativeConfigService)}get aiInlineChatService(){return this.injector.get(n.IAIInlineChatService)}get inlineChatFeatureRegistry(){return this.injector.get(o.InlineChatFeatureRegistryToken)}get preferenceService(){return this.injector.get(n.PreferenceService)}get aiReporter(){return this.injector.get(o.IAIReporter)}get workbenchEditorService(){return this.injector.get(h.WorkbenchEditorService)}get codeActionService(){return this.injector.get(g.CodeActionService)}get logger(){return this.injector.get(o.ILogger)}mount(){return this.inlineDiffController=I.InlineDiffController.get(this.monacoEditor),this.doContribute(),this}disposeAllWidget(){[this.aiInlineContentWidget,this.aiInlineChatDisposable,this.aiInlineChatOperationDisposable].forEach(d=>{d?.dispose()}),this.inlineChatInUsing=!1,this.cancelToken()}doContribute(){if(!this.monacoEditor)return this;const d=this.monacoEditor;this.disposables.push(this.aiInlineChatService.onInlineChatVisible(p=>{p?this.showInlineChat(d):(this.cancelToken(),this.disposeAllWidget())}),this.codeActionService.onCodeActionRun(({id:p,range:N})=>{const W=this.workbenchEditorService.currentEditor;W?.getId()===d.getId()&&(d.setSelection(N),this.showInlineChat(d),this.aiInlineContentWidget&&this.aiInlineContentWidget.clickActionId(p,"codeAction"))}),d.onWillChangeModel(()=>{this.disposeAllWidget()}));let m=!1;this.disposables.push(d.onMouseDown(p=>{const W=p.target.detail;m=!1,!(W&&typeof W=="string"&&W===o.AIInlineChatContentWidgetId)&&this.aiInlineContentWidget&&!this.aiInlineContentWidget.isPersisted&&this.disposeAllWidget()}),d.onMouseUp(p=>{const W=p.target.detail;W&&typeof W=="string"&&W===o.AIInlineChatContentWidgetId?m=!1:m=!0}));let G=this.preferenceService.getValid(o.AINativeSettingSectionsId.InlineChatAutoVisible,!0);return this.disposables.push(this.preferenceService.onSpecificPreferenceChange(o.AINativeSettingSectionsId.InlineChatAutoVisible,({newValue:p})=>{G=p})),this.disposables.push(o.Event.debounce(o.Event.any(d.onDidChangeCursorSelection,d.onMouseUp),(p,N)=>N,100)(()=>{!G||!m||this.aiInlineContentWidget&&this.aiInlineContentWidget.isPersisted||this.showInlineChat(d)})),this}showInlineContentWidget(d,m){this.aiInlineContentWidget&&this.aiInlineContentWidget.dispose(),this.aiInlineContentWidget=this.injector.get(s.AIInlineContentWidget,[d]),this.aiInlineContentWidget.show({selection:m})}async showInlineChat(d){if(!this.aiNativeConfigService.capabilities.supportsInlineChat||this.inlineChatInUsing)return;this.inlineChatInUsing=!0,this.disposeAllWidget();const m=d.getSelection();!m||m.isEmpty()||(this.showInlineContentWidget(d,m),this.aiInlineChatDisposable.addDispose(this.inlineChatFeatureRegistry.onChatClick(()=>{this.aiInlineChatService.launchInputVisible(!0)})),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.onActionClick(({actionId:G,source:p})=>{const N=this.inlineChatFeatureRegistry.getEditorHandler(G),W=this.inlineChatFeatureRegistry.getAction(G);if(!N||!W)return;const Z=this.getCrossSelection(d);if(!Z)return;const y=()=>{const E=N.providerDiffPreviewStrategy?N.providerDiffPreviewStrategy:N.providePreviewStrategy;if(E)return E.bind(this,d,this.token)};this.runAction({monacoEditor:d,crossSelection:Z,reporterFn:()=>this.aiReporter.start(W.name,{message:W.name,type:o.AISerivceType.InlineChat,source:p,runByCodeAction:p==="codeAction",actionSource:p==="codeAction"?o.ActionSourceEnum.CodeAction:o.ActionSourceEnum.InlineChat,actionType:W.name}),execute:N.execute?N.execute.bind(this,d,this.token):void 0,providerPreview:y(),extraData:{actionSource:p==="codeAction"?o.ActionSourceEnum.CodeAction:o.ActionSourceEnum.InlineChat,actionType:W.name}})})),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.onInteractiveInputValue(async G=>{const p=this.inlineChatFeatureRegistry.getInteractiveInputHandler();if(!p)return;const N=await this.inlineChatFeatureRegistry.getInteractiveInputStrategyHandler()(d,G),W=this.getCrossSelection(d);W&&this.runAction({monacoEditor:d,crossSelection:W,reporterFn:()=>this.aiReporter.start(o.AISerivceType.InlineChatInput,{message:G,type:o.AISerivceType.InlineChatInput,source:"input",actionSource:o.ActionSourceEnum.InlineChatInput}),execute:p.execute&&N===v.ERunStrategy.EXECUTE?p.execute.bind(this,d,G,this.token):void 0,providerPreview:p.providePreviewStrategy&&N===v.ERunStrategy.PREVIEW?p.providePreviewStrategy.bind(this,d,G,this.token):void 0,extraData:{actionSource:o.ActionSourceEnum.InlineChatInput,actionType:N}})})))}getCrossSelection(d){const m=d.getSelection();if(!m){this.logger.error("No selection found, aborting inline chat action.");return}return m.setStartPosition(m.startLineNumber,1).setEndPosition(m.endLineNumber,d.getModel().getLineMaxColumn(m.endLineNumber))}convertInlineChatStatus(d,m){if(!this.aiInlineContentWidget)return;const{relationId:G,message:p,startTime:N,isRetry:W,isStop:Z}=m;let y;d===c.EInlineChatStatus.DONE&&(y=this.inlineDiffController.getModifyContent()),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.launchChatStatus(d)),this.aiReporter.end(G,{message:p,success:d!==c.EInlineChatStatus.ERROR,replytime:Date.now()-N,isStop:Z,isRetry:W,code:y,actionType:m?.actionType,actionSource:m?.actionSource})}visibleDiffWidget(d){const{monacoEditor:m,options:G,reportInfo:p}=d,{chatResponse:N}=G,{relationId:W,startTime:Z,isRetry:y,actionType:E,actionSource:R}=p;if(u.InlineChatController.is(N))this.aiInlineChatOperationDisposable.addDispose([N.onError(w=>{this.convertInlineChatStatus(c.EInlineChatStatus.ERROR,{relationId:W,message:w.message||"",startTime:Z,isRetry:y,actionSource:R,actionType:E})}),N.onAbort(()=>{this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:W,message:"abort",startTime:Z,isRetry:y,isStop:!0,actionSource:R,actionType:E})}),N.onEnd(()=>{this.convertInlineChatStatus(c.EInlineChatStatus.DONE,{relationId:W,message:"",startTime:Z,isRetry:y,actionSource:R,actionType:E})})]);else{if(this.aiInlineContentWidget&&this.aiInlineChatDisposable.disposed||o.CancelResponse.is(N)){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:W,message:N.message||"",startTime:Z,isRetry:y,isStop:!0,actionSource:R,actionType:E});return}if(o.ErrorResponse.is(N)){this.convertInlineChatStatus(c.EInlineChatStatus.ERROR,{relationId:W,message:N.message||"",startTime:Z,isRetry:y,actionSource:R,actionType:E});return}this.convertInlineChatStatus(c.EInlineChatStatus.DONE,{relationId:W,message:"",startTime:Z,isRetry:y,actionSource:R,actionType:E})}this.inlineDiffController.showPreviewerByStream(m,G).mount(this.aiInlineContentWidget)}ensureInlineChatVisible(d,m){this.aiInlineContentWidget.disposed?this.showInlineContentWidget(d,m):this.aiInlineContentWidget.isHidden&&this.aiInlineContentWidget.resume()}async handleDiffPreviewStrategy(d){if(!this.aiInlineContentWidget)return;const{monacoEditor:m,strategy:G,crossSelection:p,relationId:N,isRetry:W,actionType:Z,actionSource:y}=d,E=m.getModel();this.inlineDiffController.destroyPreviewer(E.uri.toString()),this.aiInlineChatOperationDisposable.dispose(),this.ensureInlineChatVisible(m,p),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.launchChatStatus(c.EInlineChatStatus.THINKING));const R=Date.now();if(this.token.isCancellationRequested){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:N,message:"abort",startTime:R,isRetry:W,isStop:!0,actionSource:y,actionType:Z});return}const A=await G();if(o.CancelResponse.is(A)){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:N,message:"abort",startTime:R,isRetry:W,isStop:!0,actionSource:y,actionType:Z}),this.disposeAllWidget();return}this.visibleDiffWidget({monacoEditor:m,options:{crossSelection:p,chatResponse:A},reportInfo:{relationId:N,startTime:R,isRetry:W,actionType:Z,actionSource:y}}),this.aiInlineChatOperationDisposable.addDispose([this.aiInlineContentWidget.onResultClick(w=>{const F=this.inlineDiffController.getModifyContent(),V=this.inlineDiffController.getOriginContent();this.inlineDiffController.handleAction(w),w===c.EResultKind.ACCEPT?(this.aiReporter.end(N,{message:"accept",success:!0,isReceive:!0,isDrop:!1,code:F,originCode:V,actionType:o.ActionTypeEnum.Accept}),(0,o.runWhenIdle)(()=>{this.disposeAllWidget()})):w===c.EResultKind.DISCARD?(this.aiReporter.end(N,{message:"discard",success:!0,isDrop:!0,isReceive:!1,code:F,originCode:V,actionType:o.ActionTypeEnum.Discard}),(0,o.runWhenIdle)(()=>{this.disposeAllWidget()})):w===c.EResultKind.REGENERATE&&(this.aiReporter.end(N,{message:"regenerate",success:!0,isDrop:!0,isReceive:!1,code:F,originCode:V,actionType:o.ActionTypeEnum.Regenerate}),this.handleDiffPreviewStrategy({monacoEditor:m,strategy:G,crossSelection:p,relationId:N,isRetry:!0,actionSource:y,actionType:Z}))}),this.aiInlineChatService.onThumbs(w=>{this.aiReporter.end(N,{isLike:w})}),this.inlineDiffController.onMaxLineCount(w=>{requestAnimationFrame(()=>{if(p.endLineNumber===E.getLineCount()){const F=m.getOption(f.monacoApi.editor.EditorOption.lineHeight);this.aiInlineContentWidget.setOffsetTop(F*w+12)}})})])}async runAction(d){const{monacoEditor:m,crossSelection:G,reporterFn:p,execute:N,providerPreview:W,extraData:Z}=d;if(N&&(await N(),this.disposeAllWidget()),W){const y=p();await this.handleDiffPreviewStrategy({monacoEditor:m,strategy:W,crossSelection:G,relationId:y,isRetry:!1,actionSource:Z?.actionSource,actionType:Z?.actionType})}}}e.InlineChatEditorController=a,a.ID="editor.contrib.ai.inline.chat"},2281:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineChatFeatureRegistry=void 0;const n=t(85608),l=t(76003),o=t(41869),h=t(57925),f=t(83913),b=t(43718),g=t(89132),v=t(77633);class I{setHandler(s){this._handler=s}handler(){return this._handler}setStrategyHandler(s){this._strategyHandler=s}strategyHandler(){return this._strategyHandler}dispose(){this._handler=void 0}}I.ID=`${f.InteractiveInput.displayName}:${(0,b.uuid)(4)}`;let u=class extends b.Disposable{constructor(){super(...arguments),this.actionsMap=new Map,this.editorHandlerMap=new Map,this.terminalHandlerMap=new Map,this.interactiveInputModel=new I,this._onChatClick=new b.Emitter,this.onChatClick=this._onChatClick.event}dispose(){super.dispose(),this.actionsMap.clear(),this.editorHandlerMap.clear(),this.terminalHandlerMap.clear()}updateActions(s,a){this.actionsMap.set(s,a)}collectActions(s){const{id:a}=s;return this.actionsMap.has(a)?(this.logger.warn(`InlineChatFeatureRegistry: id ${a} already exists`),!1):((0,b.isUndefined)(s.renderType)&&(s.renderType="button"),(0,b.isUndefined)(s.order)&&(s.order=0),this.actionsMap.set(a,s),!0)}removeCollectedActions(s){this.actionsMap.delete(s.id),this.codeActionService.deleteCodeActionById(s.id)}getInteractiveInputId(){return I.ID}registerEditorInlineChat(s,a){return this.collectActions(s)&&(this.editorHandlerMap.set(s.id,a),this.codeActionService.registerCodeAction(s)),{dispose:()=>{this.removeCollectedActions(s)}}}unregisterEditorInlineChat(s){return this.removeCollectedActions(s)}registerTerminalInlineChat(s,a){return this.collectActions(s)&&((0,b.isUndefined)(a.triggerRules)&&(a.triggerRules="selection"),this.terminalHandlerMap.set(s.id,a)),{dispose:()=>{this.removeCollectedActions(s)}}}unregisterTerminalInlineChat(s){return this.removeCollectedActions(s)}registerInteractiveInput(s,a){this.interactiveInputModel.setHandler(a),s.handleStrategy?this.interactiveInputModel.setStrategyHandler(s.handleStrategy):this.interactiveInputModel.setStrategyHandler(()=>s.strategy||v.ERunStrategy.EXECUTE);const r=()=>{const d=String(this.getSequenceKeyString());if(d){const m={id:I.ID,name:`Chat(${d.toLocaleUpperCase()})`,renderType:"button",order:Number.MAX_SAFE_INTEGER};this.actionsMap.has(m.id)?this.updateActions(m.id,m):this.collectActions(m)}};return this.addDispose(b.Event.filter(this.keybindingRegistry.onKeybindingsChanged,({affectsCommands:d})=>d.includes(h.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id))(()=>r())),r(),{dispose:()=>{this.interactiveInputModel.dispose()}}}getSequenceKeyString(){var s;const r=(s=this.keybindingRegistry.getKeybindingsForCommand(h.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||s===void 0?void 0:s.resolved;return r?this.keybindingRegistry.acceleratorForSequence(r,"+"):""}getInteractiveInputHandler(){return this.interactiveInputModel.handler()}getInteractiveInputStrategyHandler(){return this.interactiveInputModel.strategyHandler()}getEditorActionButtons(){const s=Array.from(this.editorHandlerMap.keys()).filter(a=>{const r=this.actionsMap.get(a);return r&&r.renderType==="button"}).map(a=>this.actionsMap.get(a)).sort((a,r)=>a.order-r.order);return this.actionsMap.has(I.ID)&&s.push(this.actionsMap.get(I.ID)),s}getEditorActionMenus(){return Array.from(this.editorHandlerMap.keys()).filter(s=>{const a=this.actionsMap.get(s);return a&&a.renderType==="dropdown"}).map(s=>this.actionsMap.get(s))}getEditorHandler(s){return this.editorHandlerMap.get(s)}getTerminalHandler(s){return this.terminalHandlerMap.get(s)}getTerminalActions(){return Array.from(this.terminalHandlerMap.keys()).map(s=>this.actionsMap.get(s))}getAction(s){return this.actionsMap.get(s)}};n.__decorate([(0,l.Autowired)(o.Logger),n.__metadata("design:type",o.Logger)],u.prototype,"logger",void 0),n.__decorate([(0,l.Autowired)(g.CodeActionService),n.__metadata("design:type",g.CodeActionService)],u.prototype,"codeActionService",void 0),n.__decorate([(0,l.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],u.prototype,"keybindingRegistry",void 0),u=n.__decorate([(0,l.Injectable)()],u),e.InlineChatFeatureRegistry=u},31031:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AIInlineChatService=e.EResultKind=e.EInlineChatStatus=void 0;const n=t(85608),l=t(76003),o=t(43718);var h=t(19413);Object.defineProperty(e,"EInlineChatStatus",{enumerable:!0,get:function(){return h.EInlineChatStatus}}),Object.defineProperty(e,"EResultKind",{enumerable:!0,get:function(){return h.EResultKind}});let f=class{constructor(){this._interactiveInputVisible=!1,this._onInteractiveInputVisible=new o.Emitter,this.onInteractiveInputVisible=this._onInteractiveInputVisible.event,this._onInlineChatVisible=new o.Emitter,this.onInlineChatVisible=this._onInlineChatVisible.event,this._onThumbs=new o.Emitter,this.onThumbs=this._onThumbs.event}get interactiveInputVisible(){return this._interactiveInputVisible}fireThumbsEvent(g){this._onThumbs.fire(g)}launchInputVisible(g){return(0,o.runWhenIdle)(()=>{this._interactiveInputVisible=g,this._onInteractiveInputVisible.fire(g)})}};f=n.__decorate([(0,l.Injectable)({multiple:!1})],f),e.AIInlineChatService=f},26664:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AIInlineContentWidget=void 0;const n=t(85608),l=n.__importStar(t(14041)),o=t(76003),h=t(41869),f=t(89195),b=t(83913),g=t(64102),v=t(43718),I=n.__importStar(t(20868)),u=t(62663),c=t(52659),s=t(23028),a=t(90614),r=t(2281),d=n.__importDefault(t(26899)),m=t(31031),G=N=>{const{onClickActions:W,onClose:Z,onInteractiveInputSend:y,onLayoutChange:E,onChatStatus:R,onResultClick:A}=N,w=(0,h.useInjectable)(h.IAIInlineChatService),F=(0,h.useInjectable)(v.InlineChatFeatureRegistryToken),[V,Y]=(0,l.useState)(m.EInlineChatStatus.READY),[_,H]=(0,l.useState)(""),[X,S]=(0,l.useState)(!1);(0,l.useEffect)(()=>{const P=new v.Disposable;return P.addDispose(R(te=>Y(te))),P.addDispose(w.onInteractiveInputVisible(te=>{S(te)})),()=>{P.dispose()}},[R,w]),(0,l.useEffect)(()=>{V===m.EInlineChatStatus.ERROR&&Z?.()},[Z]);const Q=(0,l.useMemo)(()=>V===m.EInlineChatStatus.THINKING,[V]),k=(0,l.useMemo)(()=>V===m.EInlineChatStatus.DONE,[V]),M=(0,l.useMemo)(()=>V===m.EInlineChatStatus.ERROR,[V]),D=(0,l.useMemo)(()=>F.getEditorActionButtons(),[F]),J=(0,l.useCallback)(P=>{W?.(P)},[W]),T=(0,l.useCallback)(()=>{Z?.()},[Z]),x=(0,l.useCallback)(P=>{y?.(P)},[y]),B=(0,l.useMemo)(()=>F.getEditorActionMenus().map(P=>new g.MenuNode({id:`ai.menu.operation.${P.id}`,label:P.name,className:d.default.more_operation_menu_item,execute:()=>{J(P.id)}})),[F]),O=(0,l.useCallback)(P=>{H(P)},[]),z=(0,l.useMemo)(()=>X?l.default.createElement(b.InteractiveInput,{autoFocus:!0,onHeightChange:P=>E(P),size:"small",placeholder:(0,v.localize)("aiNative.inline.chat.input.placeholder.default"),width:320,disabled:Q,value:_,onValueChange:O,onSend:x}):null,[Q,X,_]),U=(0,l.useCallback)(()=>D.length===0&&B.length===0||M?null:k?l.default.createElement(a.InlineResultAction,{onResultClick:A}):l.default.createElement(f.AIAction,{operationList:D,moreOperation:B,onClickItem:J,onClose:T,loading:Q,loadingShowOperation:X,customOperationRender:z}),[D,B,z,A,V,X]);return l.default.createElement("div",{className:d.default.inline_chat_controller_box},U())};let p=class extends c.ReactInlineContentWidget{get interactiveInputValue(){return this._interactiveInputValue}get status(){return this._status}get isPersisted(){return!this.isHidden&&this.status!==m.EInlineChatStatus.READY&&this.status!==m.EInlineChatStatus.ERROR}constructor(W){super(W),this.editor=W,this.allowEditorOverflow=!0,this._onActionClickEmitter=new v.Emitter,this.onActionClick=this._onActionClickEmitter.event,this._onInteractiveInputValue=new v.Emitter,this.onInteractiveInputValue=this._onInteractiveInputValue.event,this._onStatusChange=new v.Emitter,this.onStatusChange=this._onStatusChange.event,this._onResultClick=new v.Emitter,this.onResultClick=this._onResultClick.event,this._status=m.EInlineChatStatus.READY,this.aiNativeContextKey=this.injector.get(s.AINativeContextKey,[this.editor.contextKeyService]),this.addDispose(this.editor.onDidLayoutChange(()=>{this.isOutOfArea()&&this.dispose()}))}launchChatStatus(W){return(0,v.runWhenIdle)(()=>{this._status=W,this._onStatusChange.fire(W)})}dispose(){this.launchChatStatus(m.EInlineChatStatus.READY),super.dispose()}clickActionId(W,Z){if(W===this.inlineChatFeatureRegistry.getInteractiveInputId()){this.inlineChatFeatureRegistry._onChatClick.fire();return}this._onActionClickEmitter.fire({actionId:W,source:Z})}renderView(){return l.default.createElement(G,{onClickActions:W=>this.clickActionId(W,"widget"),onClose:()=>this.dispose(),onChatStatus:this.onStatusChange.bind(this),onLayoutChange:()=>{this.editor.layoutContentWidget(this)},onInteractiveInputSend:W=>{this.launchChatStatus(m.EInlineChatStatus.THINKING),this._interactiveInputValue=W,this._onInteractiveInputValue.fire(W)},onResultClick:W=>{this._onResultClick.fire(W)}})}async show(W){super.show(W),this.aiNativeContextKey.inlineChatIsVisible.set(!0)}getDomNode(){const W=super.getDomNode();return requestAnimationFrame(()=>{W.style.zIndex=h.StackingLevelStr.OverlayTop}),W}async hide(){this.aiNativeContextKey.inlineChatIsVisible.set(!1),super.hide()}setOptions(W){this.options=W}setOffsetTop(W){this.domNode.style.transform=`translateY(${W}px)`}id(){return v.AIInlineChatContentWidgetId}getPosition(){const W=super.getPosition();if(W)return W;if(!this.options)return null;const{selection:Z}=this.options;if(!Z)return null;const y=this.computePosition(Z);return y||null}safeGetLineLastNonWhitespaceColumn(W){const Z=this.editor.getModel();W<1&&(W=1);const y=Z.getLineCount();return W>y&&(W=y),Z.getLineLastNonWhitespaceColumn(W)}toAbovePosition(W,Z){return{position:new I.Position(W,Z),preference:[u.monacoBrowser.editor.ContentWidgetPositionPreference.ABOVE,u.monacoBrowser.editor.ContentWidgetPositionPreference.BELOW]}}toBelowPosition(W,Z){return{position:new I.Position(W,Z),preference:[u.monacoBrowser.editor.ContentWidgetPositionPreference.BELOW,u.monacoBrowser.editor.ContentWidgetPositionPreference.ABOVE]}}recheckSelection(W){const Z=W.getStartPosition(),y=W.getEndPosition(),R=this.editor.getModel().getLineCount(),A=Math.max(1,y.lineNumber-1),w=Math.min(R,y.lineNumber+1),F=Z.with(A,1),V=y.with(w,this.safeGetLineLastNonWhitespaceColumn(w));if(R===1)return this.toBelowPosition(w,this.safeGetLineLastNonWhitespaceColumn(w));if(V.lineNumber===1&&y.lineNumber!==Z.lineNumber)return this.computePosition(I.Selection.fromPositions(F,V));const Y=this.safeGetLineLastNonWhitespaceColumn(A),_=this.safeGetLineLastNonWhitespaceColumn(w),H=this.safeGetLineLastNonWhitespaceColumn(y.lineNumber);return _>H&&_>Y?this.computePosition(I.Selection.fromPositions(V,F)):this.computePosition(I.Selection.fromPositions(F,V))}isProtrudeAbove(W){const Z=this.safeGetLineLastNonWhitespaceColumn(W);return Z>=this.safeGetLineLastNonWhitespaceColumn(W-1)&&Z>=this.safeGetLineLastNonWhitespaceColumn(W-2)}isProtrudeBelow(W){const Z=this.safeGetLineLastNonWhitespaceColumn(W);return Z>=this.safeGetLineLastNonWhitespaceColumn(W+1)&&Z>=this.safeGetLineLastNonWhitespaceColumn(W+2)}computePosition(W){let Z=W.getStartPosition(),y=W.getEndPosition(),E=W.getPosition();const A=this.editor.getModel().getLineCount();if(Z.lineNumber===y.lineNumber)return this.recheckSelection(W);y.lineNumber-Z.lineNumber===1&&(E=y);const w=this.safeGetLineLastNonWhitespaceColumn(E.lineNumber);let F=E.lineNumber,V="below";if(E.equals(Z)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(E.lineNumber-1),this.safeGetLineLastNonWhitespaceColumn(E.lineNumber-2))<=w)return this.toAbovePosition(E.lineNumber,w);for(let H=Z.lineNumber;H<=y.lineNumber;H++){if(this.isProtrudeAbove(H)){F=H,V="above";break}if(this.isProtrudeBelow(H)){F=H,V="below";break}}}else if(E.equals(y)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(E.lineNumber+1),this.safeGetLineLastNonWhitespaceColumn(E.lineNumber+2))<=w)return this.toBelowPosition(E.lineNumber,w);for(let H=Math.min(A,y.lineNumber+1);H>=Z.lineNumber;H--){if(this.isProtrudeBelow(H)){F=H,V="below";break}if(this.isProtrudeAbove(H)){F=H,V="above";break}}}const Y=this.safeGetLineLastNonWhitespaceColumn(F)+1;return V==="below"?this.toBelowPosition(F,Y):this.toAbovePosition(F,Y)}};n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],p.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(v.InlineChatFeatureRegistryToken),n.__metadata("design:type",r.InlineChatFeatureRegistry)],p.prototype,"inlineChatFeatureRegistry",void 0),p=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],p),e.AIInlineContentWidget=p},49444:(L,e,t)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.LiveInlineDiffPreviewer=e.SideBySideInlineDiffWidget=e.BaseInlineDiffPreviewer=void 0;const l=t(85608),o=t(76003),h=t(43718),f=t(20868),b=t(90052),g=t(77714),v=t(43255),I=t(88104),u=t(11827),c=t(96084),s=t(31031),a=t(33062),r=t(37679);let d=class extends h.Disposable{constructor(N){super(),this.monacoEditor=N,this.inlineContentWidget=null,this.model=this.monacoEditor.getModel(),this.addDispose(h.Disposable.create(()=>{this.inlineContentWidget&&this.inlineContentWidget.dispose(),this.attachNode(void 0)}))}formatIndentation(N){const W=this.selection.startLineNumber,Z=(0,g.getLeadingWhitespace)(this.model.getLineContent(W));if(N===g.empty||Z===g.empty)return N;const{tabSize:y,insertSpaces:E}=this.model.getOptions(),R=this.model.getEOL(),A=(0,c.getSpaceCnt)(Z,y);let w=(0,c.generateIndent)(A,y,E);const F=N.split(R),V=F[0];let Y=!1;if(V){const H=(0,g.getLeadingWhitespace)(V);w===H?w="":w.length>H.length?w=w.slice(H.length):(w=H.slice(w.length),Y=!0)}return F.map(H=>{if(Y){const X=(0,g.getLeadingWhitespace)(H);return H=w+H.substring(X.length),H}return w+H}).join(R)}getNode(){return this.node}createNodeSnapshot(){return this.node}mount(N){this.inlineContentWidget=N}layout(){var N,W;(N=this.inlineContentWidget)===null||N===void 0||N.setOptions({position:this.getPosition()}),(W=this.inlineContentWidget)===null||W===void 0||W.layoutContentWidget()}onReady(N){return N(),h.Disposable.NULL}create(N,W={disposeWhenEditorClosed:!0}){this.selection=N,this.node=this.createNode(),this.node.setPreviewerOptions(W)}attachNode(N){this.node=N}show(N,W){}onLineCount(N){return this}setValue(N){}getValue(){return""}getOriginValue(){return""}onError(N){}onAbort(){}onEnd(){}revealFirstDiff(){}isModel(N){return this.model.uri.toString()===N}};l.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),l.__metadata("design:type",o.Injector)],d.prototype,"injector",void 0),d=l.__decorate([(0,o.Injectable)({multiple:!0}),l.__metadata("design:paramtypes",[Object])],d),e.BaseInlineDiffPreviewer=d;let m=n=class extends d{createNode(){const N=this.injector.get(r.InlineDiffWidget,[n.AI_DIFF_WIDGET_ID,{editor:this.monacoEditor,selection:this.selection}]);return N.create(),this.addDispose(N),N}mount(N){super.mount(N),N.addDispose(this)}getPosition(){return f.Position.lift({lineNumber:this.selection.endLineNumber+1,column:1})}layout(){var N;(N=this.inlineContentWidget)===null||N===void 0||N.setPositionPreference([b.ContentWidgetPositionPreference.BELOW]),super.layout()}onReady(N){return this.node?this.node.onReady(N.bind(this)):h.Disposable.NULL}show(N,W){var Z;(Z=this.node)===null||Z===void 0||Z.showByLine(N,W)}setValue(N){var W;const Z=(W=this.node)===null||W===void 0?void 0:W.getModifiedModel();Z?.setValue(this.formatIndentation(N))}getValue(){var N;return((N=this.node)===null||N===void 0?void 0:N.getModifiedModel()).getValue()}getOriginValue(){var N;return((N=this.node)===null||N===void 0?void 0:N.getOriginModel()).getValue()||""}handleAction(N){if(N===s.EResultKind.ACCEPT){const W=this.getValue();this.model.pushEditOperations(null,[{range:this.selection,text:W}],()=>null),this.model.pushStackElement()}}onLineCount(N){var W;return(W=this.node)===null||W===void 0||W.onMaxLineCount(N.bind(this)),this}onData(N){var W,Z;const{message:y}=N,E=this.formatIndentation(y),R=(W=this.node)===null||W===void 0?void 0:W.getModifiedModel(),A=R.getEOL()===`\r
28077
- `?v.DefaultEndOfLine.CRLF:v.DefaultEndOfLine.LF,{textBuffer:w,disposable:F}=(0,I.createTextBuffer)(E,A),V=u.ModelService._computeEdits(R,w);R.pushEditOperations([],V,()=>[]),F.dispose(),(Z=this.node)===null||Z===void 0||Z.layout()}onError(N){var W;(W=this.node)===null||W===void 0||W.layout()}onAbort(){var N;(N=this.node)===null||N===void 0||N.layout()}onEnd(){var N;(N=this.node)===null||N===void 0||N.layout()}};m.AI_DIFF_WIDGET_ID="AI-DIFF-WIDGET",m=n=l.__decorate([(0,o.Injectable)({multiple:!0})],m),e.SideBySideInlineDiffWidget=m;let G=class extends d{listenNode(N){N.addDispose(N.onDidEditChange(()=>this.layout())),N.addDispose(N.onPartialEditWidgetListChange(Z=>{var y;Z.every(E=>E.isHidden)&&(this.dispose(),(y=this.inlineContentWidget)===null||y===void 0||y.dispose())}));const W=N.onDispose(()=>{this.dispose(),W.dispose()});this.addDispose(N)}createNode(){const N=this.injector.get(a.InlineStreamDiffHandler,[this.monacoEditor]);return N.initialize(this.selection),this.listenNode(N),N}attachNode(N){var W;if((W=this.node)===null||W===void 0||W.dispose(),this.node=N,N){const Z=N.currentSnapshotStore;Z&&(this.node.restoreDecorationSnapshot(Z.decorationSnapshotData),this.listenNode(N))}}createNodeSnapshot(){if(!this.node)return this.createNode();const N=this.node.createSnapshot(),W=this.injector.get(a.InlineStreamDiffHandler,[this.monacoEditor]);return W.restoreSnapshot(N),W}getPosition(){var N;const W=(N=this.node)===null||N===void 0?void 0:N.getZone();return W?f.Position.lift({lineNumber:W.startLineNumber,column:1}):f.Position.lift({lineNumber:1,column:1})}handleAction(N){var W,Z;switch(N){case s.EResultKind.ACCEPT:(W=this.node)===null||W===void 0||W.acceptAll();break;case s.EResultKind.DISCARD:case s.EResultKind.REGENERATE:(Z=this.node)===null||Z===void 0||Z.rejectAll();break;default:break}}onLineCount(){return h.Disposable.NULL}layout(){var N,W,Z;(N=this.inlineContentWidget)===null||N===void 0||N.setPositionPreference([b.ContentWidgetPositionPreference.ABOVE,b.ContentWidgetPositionPreference.BELOW]),super.layout();const y=this.getPosition();if(y&&this.inlineContentWidget){const E=(W=this.node)===null||W===void 0?void 0:W.livePreviewDiffDecorationModel.getRemovedWidgets();if(E?.length){const R=y.lineNumber,A=E[0];if(A&&((Z=A.getLastPosition())===null||Z===void 0?void 0:Z.lineNumber)<=R){const F=this.inlineContentWidget.getLineHeight(),V=A.height;this.inlineContentWidget.setOffsetTop(-F*V-4)}}}}onData(N){var W;const{message:Z}=N;(W=this.node)===null||W===void 0||W.addLinesToDiff(this.formatIndentation(Z))}onEnd(){var N,W;const Z=(N=this.node)===null||N===void 0?void 0:N.recompute(a.EComputerMode.legacy);Z&&((W=this.node)===null||W===void 0||W.pushRateFinallyDiffStack(Z))}getValue(){var N;return((N=this.node)===null||N===void 0?void 0:N.getVirtualModelValue())||""}getOriginValue(){var N;return((N=this.node)===null||N===void 0?void 0:N.getOriginModelValue())||""}setValue(N){var W,Z;const y=(W=this.node)===null||W===void 0?void 0:W.recompute(a.EComputerMode.legacy,this.formatIndentation(N));y&&((Z=this.node)===null||Z===void 0||Z.finallyRender(y))}get onPartialEditEvent(){var N;return(N=this.node)===null||N===void 0?void 0:N.onPartialEditEvent}revealFirstDiff(){var N;(N=this.node)===null||N===void 0||N.revealFirstDiff()}};G=l.__decorate([(0,o.Injectable)({multiple:!0})],G),e.LiveInlineDiffPreviewer=G},37679:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineDiffWidget=void 0;const n=t(85608),l=n.__importStar(t(14041)),o=t(43144),h=n.__importDefault(t(25873)),f=t(76003),b=t(41869),g=n.__importStar(t(20868)),v=t(87822),I=t(34819),u=t(83e3),c=n.__importDefault(t(69790)),s={fixedOverflowWidgets:!0,readOnly:!1,enableSplitViewResizing:!0,ignoreTrimWhitespace:!0,renderSideBySide:!0,lineNumbers:"on",glyphMargin:!0,scrollbar:{useShadows:!1,alwaysConsumeMouseWheel:!1,vertical:"hidden"},scrollBeyondLastLine:!1,renderMarginRevertIcon:!1,renderOverviewRuler:!1,rulers:void 0,overviewRulerBorder:void 0,overviewRulerLanes:0,padding:{top:0,bottom:0},folding:!1,diffCodeLens:!1,stickyScroll:{enabled:!1},minimap:{enabled:!1},automaticLayout:!0,renderIndicators:!1,inDiffEditor:!0},a=l.default.memo(d=>{const{range:m,onMaxLineCount:G,editor:p,onReady:N}=d,W=(0,b.useInjectable)(b.MonacoService),Z=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!m)return;const y=p.getModel();if(!y)return;const E=y.getValueInRange(m),R=W.createDiffEditor(Z.current,Object.assign(Object.assign({},s),{lineDecorationsWidth:p.getLayoutInfo().decorationsWidth,lineNumbersMinChars:p.getOption(g.editor.EditorOption.lineNumbersMinChars)})),A=u.StandaloneServices.get(v.IModelService),w={languageId:y.getLanguageId(),onDidChange:b.Event.None},F=A.createModel(E,w,g.Uri.from({scheme:b.Schemes.inMemory,path:"inline-diff-widget/"+(0,b.randomString)(8)}),!0),V=A.createModel("",w,g.Uri.from({scheme:b.Schemes.inMemory,path:"inline-diff-widget/"+(0,b.randomString)(8)}),!0);R.setModel({original:F,modified:V}),R.revealLine(m.startLineNumber,g.editor.ScrollType.Immediate);const Y=()=>{if(G){const _=F.getLineCount(),H=V.getLineCount();G(Math.max(_,H)+1)}};return N&&N({getModifiedModel:()=>V,getOriginModel:()=>F,layout:Y}),Y(),()=>{R&&R.dispose()}},[m,p]),l.default.createElement("div",{ref:Z,className:c.default.diff_editor_widget})});let r=class extends I.ZoneWidget{setPreviewerOptions(m){this.previewerOptions=m}_fillContainer(m){this.setCssClass("inline-diff-widget"),this.root=h.default.createRoot(m);let G=null;if(this._resolveResultWidget)if(m.parentNode){const p=document.createElement("div");requestAnimationFrame(()=>{p.className=c.default.ai_diff_editor_resolve_result_widget;const N=this.editor.getLayoutInfo();p.style.width=`${N.contentWidth}px`,p.style.left=`${N.contentLeft}px`}),m.parentNode.appendChild(p),G=(0,o.createPortal)(this._resolveResultWidget,p),this.resultContainer=p}else throw new Error("[impossible path] container.parentNode is null");this.root.render(l.default.createElement(b.ConfigProvider,{value:this.configContext},l.default.createElement("div",{className:c.default.ai_diff_editor_container},l.default.createElement(a,{range:this.range,editor:this.editor,onMaxLineCount:p=>{p&&(this._relayout(p),this._onMaxLineCount.fire(p))},onReady:p=>{this.diffWidgetHandler=p,this._onReady.fire()}})),G))}computeResultWidgetWidth(){const m=this.editor.getLayoutInfo();return m.contentWidth+m.contentLeft}_onWidth(m){super._onWidth(m),requestAnimationFrame(()=>{this.resultContainer&&(this.resultContainer.style.width=`${this.computeResultWidgetWidth()}px`)})}getModifiedModel(){var m;return(m=this.diffWidgetHandler)===null||m===void 0?void 0:m.getModifiedModel()}getOriginModel(){var m;return(m=this.diffWidgetHandler)===null||m===void 0?void 0:m.getOriginModel()}layout(){var m;return(m=this.diffWidgetHandler)===null||m===void 0?void 0:m.layout()}constructor(m,G){super(G.editor,{showArrow:!1,showFrame:!1,arrowColor:void 0,frameColor:void 0,keepEditorSelection:!0,showInHiddenAreas:!0}),this.id=m,this._onMaxLineCount=new b.Emitter,this.onMaxLineCount=this._onMaxLineCount.event,this._onReady=new b.Emitter,this.onReady=this._onReady.event,this.diffWidgetHandler=null,this.resultContainer=null,this._resolveResultWidget=null;const{selection:p,hiddenArea:N,editor:W}=G;this.range=p,this.hiddenArea=N||p,W.setHiddenAreas([this.hiddenArea],this.id)}revealRange(m,G){}setContainerStyle(m){var G;const p=Object.keys(m);for(const N of p)Object.prototype.hasOwnProperty.call((G=this.container)===null||G===void 0?void 0:G.style,N)&&(this.container.style[N]=m[N])}addClassName(m){return this.setCssClass(m),this}dispose(){this.hide(),super.dispose()}hide(){this.editor.setHiddenAreas([],this.id),super.hide(),this.root&&this.root.unmount()}showByLine(m,G=20){this.editor._modelData.viewModel.coordinatesConverter.modelPositionIsVisible=()=>!0,super.show({startLineNumber:m,startColumn:1,endLineNumber:m,endColumn:Number.MAX_SAFE_INTEGER},G)}setResolveResultWidget(m){this._resolveResultWidget=m}};n.__decorate([(0,f.Autowired)(b.AppConfig),n.__metadata("design:type",Object)],r.prototype,"configContext",void 0),r=n.__decorate([(0,f.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String,Object])],r),e.InlineDiffWidget=r},38890:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineDiffController=void 0;const n=t(41869),l=t(43718),o=t(57517),h=t(99906),f=t(83854),b=t(40111),g=t(49444);class v extends h.BaseAIMonacoEditorController{constructor(){super(...arguments),this._onPartialEditEvent=this.registerDispose(new l.Emitter),this.onPartialEditEvent=this._onPartialEditEvent.event,this._onMaxLineCount=new l.Emitter,this.onMaxLineCount=this._onMaxLineCount.event,this._previewerNodeStore=new Map}static get(u){return u.getContribution(v.ID)}get preferenceService(){return this.injector.get(n.PreferenceService)}get eventBus(){return this.injector.get(l.IEventBus)}mount(){return this.registerDispose(this.eventBus.on(o.EditorGroupCloseEvent,u=>{const c=u.payload.resource.uri.toString(),s=this.getStoredState(c);s&&s.previewerOptions.disposeWhenEditorClosed&&this.destroyPreviewer(c)})),this.registerInlineDiffFeature(this.monacoEditor),this}storeState(u){if(!this.previewer)return;const c=this.previewer.createNodeSnapshot();c&&this._previewerNodeStore.set(u,c)}tryRestoreState(u,c){const s=this.getStoredState(c);if(s){if(s.disposed){this.destroyPreviewer(c);return}return this.restoreState(u,s)}}restoreState(u,c){var s;if((s=u.getModel())===null||s===void 0?void 0:s.uri){this.previewer=this.injector.get(g.LiveInlineDiffPreviewer,[u]),this.previewer.attachNode(c),this.listenPreviewer(this.previewer);const r=this.previewer.onDispose(()=>{this.destroyPreviewer(),r.dispose()})}}registerInlineDiffFeature(u){const c=new l.Disposable,s=u.getModel();return c.addDispose(u.onWillChangeModel(a=>{if(!a.oldModelUrl)return;const r=a.oldModelUrl.toString();this.storeState(r),this.destroyPreviewer()})),c.addDispose(u.onDidChangeModel(a=>{a.newModelUrl&&this.tryRestoreState(u,a.newModelUrl.toString())})),s&&c.addDispose(s.onWillDispose(()=>{const a=s.uri.toString();this.destroyPreviewer(a)})),c}showPreviewerByStream(u,c){const{crossSelection:s,chatResponse:a}=c,r=new l.Disposable,d=this.createDiffPreviewer(u,s,c.previewerOptions),m=()=>{d.layout(),r.dispose()};return r.addDispose(d.onReady(()=>{if(b.InlineChatController.is(a)){const G=a;r.addDispose([G.onData(p=>{l.ReplyResponse.is(p)&&d.onData(p)}),G.onError(p=>{d.onError(p),m()}),G.onAbort(()=>{d.onAbort(),m()}),G.onEnd(()=>{d.onEnd(),m()})]),G.listen()}else d.setValue(a.message),m()})),d.layout(),d}createDiffPreviewer(u,c,s){const a=this.preferenceService.getValid(l.AINativeSettingSectionsId.InlineDiffPreviewMode,f.EInlineDiffPreviewMode.inlineLive);return this.destroyPreviewer(),a===f.EInlineDiffPreviewMode.sideBySide?this.previewer=this.injector.get(g.SideBySideInlineDiffWidget,[u]):this.previewer=this.injector.get(g.LiveInlineDiffPreviewer,[u]),this.previewer.create(c,s),this.previewer.show(c.startLineNumber-1,c.endLineNumber-c.startLineNumber+2),this.listenPreviewer(this.previewer),this.previewer}listenPreviewer(u){u&&(u instanceof g.LiveInlineDiffPreviewer&&u.addDispose(u.onPartialEditEvent(c=>{this._onPartialEditEvent.fire(c)})),u.addDispose(u.onLineCount(c=>this._onMaxLineCount.fire(c))))}getPreviewer(){return this.previewer}getStoredState(u){return this._previewerNodeStore.get(u)}handleAction(u){var c;(c=this.previewer)===null||c===void 0||c.handleAction(u)}getModifyContent(){var u;return(u=this.previewer)===null||u===void 0?void 0:u.getValue()}getOriginContent(){var u;return(u=this.previewer)===null||u===void 0?void 0:u.getOriginValue()}destroyPreviewer(u){var c;(c=this.previewer)===null||c===void 0||c.dispose(),this.previewer=void 0,u&&this._previewerNodeStore.delete(u)}revealFirstDiff(){var u;(u=this.previewer)===null||u===void 0||u.revealFirstDiff()}}e.InlineDiffController=v,v.ID="editor.contrib.ai.inline.diff"},53182:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineHintLineDecoration=void 0;const n=t(85608),l=t(76003),o=t(41869),h=t(57925),f=t(43718),b=t(20868),g=t(60304),v=t(52416),I=t(75189),u="inline_hint_description",c="inline_hint_description_key";let s=class extends f.Disposable{constructor(r){super(),this.monacoEditor=r,this.colorRegister=(0,v.getColorRegistry)(),g.StandaloneServices.get(I.ICodeEditorService).registerDecorationType(u,c,{isWholeLine:!0}),this.addDispose(f.Disposable.create(()=>{this.monacoEditor.setDecorationsByType(u,c,[])}))}getSequenceKeyString(){var r;const m=(r=this.keybindingRegistry.getKeybindingsForCommand(h.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||r===void 0?void 0:r.resolved;return m?this.keybindingRegistry.acceleratorForSequence(m,"+"):""}async show(r){var d;const m=(0,f.formatLocalize)("aiNative.inline.hint.widget.placeholder",this.getSequenceKeyString()),G=await this.themeService.getCurrentTheme(),p=this.colorRegister.resolveDefaultColor(v.inputPlaceholderForeground,G);this.monacoEditor.setDecorationsByType(u,c,[{range:b.Range.fromPositions(r),renderOptions:{after:{contentText:m,opacity:"0.5",color:(d=p?.toString())!==null&&d!==void 0?d:"",padding:"0 0 0 12px",width:"max-content"}}}])}};n.__decorate([(0,l.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],s.prototype,"keybindingRegistry",void 0),n.__decorate([(0,l.Autowired)(v.IThemeService),n.__metadata("design:type",Object)],s.prototype,"themeService",void 0),s=n.__decorate([(0,l.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],s),e.InlineHintLineDecoration=s},77886:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineHintController=void 0;const n=t(43718),l=t(77714),o=t(23028),h=t(99906),f=t(71863),b=t(74353),g=t(97139),v=t(53182);class I extends h.BaseAIMonacoEditorController{static get(c){return c.getContribution(I.ID)}get inlineCompletionsService(){return this.injector.get(f.AICompletionsService)}get inlineInputChatService(){return this.injector.get(b.InlineInputChatService)}mount(){return this.registerHintLineFeature(this.monacoEditor)}registerHintLineFeature(c){const s=new n.Disposable,a=this.injector.get(o.AINativeContextKey,[c.contextKeyService]),r=()=>{s.dispose()},d=m=>{var G;const p=c.getModel();if(!p||this.inlineCompletionsService.isVisibleCompletion)return;const N=p.getLineContent(m.lineNumber),W=p.getLineDecorations(m.lineNumber),Z=N?.trim()===l.empty,y=(G=c.getSelection())===null||G===void 0?void 0:G.isEmpty(),E=W.some(R=>R.options.description===g.InlineInputPreviewDecorationID);if(Z&&y&&!E){const R=this.injector.get(v.InlineHintLineDecoration,[c]);R.show(m),this.inlineInputChatService.setCurrentVisiblePosition(m),a.inlineHintWidgetIsVisible.set(!0),s.addDispose(R.onDispose(()=>{this.inlineInputChatService.setCurrentVisiblePosition(void 0),a.inlineHintWidgetIsVisible.set(!1)})),s.addDispose(R)}};return this.addDispose(c.onDidChangeCursorPosition(m=>{r(),d(m.position)})),this.addDispose(c.onDidFocusEditorWidget(()=>{const m=c.getPosition();m&&(r(),d(m))})),this.addDispose(c.onDidBlurEditorWidget(()=>{r()})),this.addDispose(this.inlineCompletionsService.onVisibleCompletion(m=>{m&&r()})),this.addDispose(s),this}}e.InlineHintController=I,I.ID="editor.contrib.ai.inline.hint"},32213:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineInputChatWidget=void 0;const n=t(85608),l=n.__importStar(t(14041)),o=t(76003),h=t(89195),f=t(43718),b=t(90052),g=t(90614),v=t(31031),I=t(26664),u=n.__importDefault(t(13185)),c=t(74353),s=r=>{const{onClose:d,onInteractiveInputSend:m,onLayoutChange:G,onChatStatus:p,onResultClick:N}=r,[W,Z]=(0,l.useState)(v.EInlineChatStatus.READY),[y,E]=(0,l.useState)("");(0,l.useEffect)(()=>{const _=new f.Disposable;return _.addDispose(p(H=>Z(H))),()=>{_.dispose()}},[p]);const R=(0,l.useMemo)(()=>W===v.EInlineChatStatus.THINKING,[W]),A=(0,l.useMemo)(()=>W===v.EInlineChatStatus.DONE,[W]),w=(0,l.useMemo)(()=>W===v.EInlineChatStatus.ERROR,[W]),F=(0,l.useCallback)(()=>{d?.()},[d]),V=(0,l.useCallback)(_=>{m?.(_)},[m]),Y=(0,l.useCallback)(_=>{E(_)},[]);return w?null:A?l.default.createElement(g.InlineResultAction,{onResultClick:N}):l.default.createElement(h.AIAction,{loadingShowOperation:!0,onClose:F,loading:R,customOperationRender:l.default.createElement(h.InteractiveInput,{autoFocus:!0,onHeightChange:_=>G(_),size:"small",placeholder:(0,f.localize)("aiNative.inline.chat.input.placeholder.default"),width:320,value:y,onValueChange:Y,disabled:R,onSend:V})})};let a=class extends I.AIInlineContentWidget{constructor(){super(...arguments),this.allowEditorOverflow=!0,this.positionPreference=[b.ContentWidgetPositionPreference.ABOVE]}dispose(){super.dispose(),this.inlineInputChatService.hide()}id(){return f.AIInlineInputChatContentWidgetId}renderView(){return l.default.createElement("div",{className:u.default.input_wrapper},l.default.createElement(s,{onClose:()=>this.dispose(),onChatStatus:this.onStatusChange.bind(this),onLayoutChange:()=>{this.editor.layoutContentWidget(this)},onInteractiveInputSend:d=>{this.launchChatStatus(v.EInlineChatStatus.THINKING),this._onInteractiveInputValue.fire(d)},onResultClick:d=>{this._onResultClick.fire(d)}}))}};n.__decorate([(0,o.Autowired)(c.InlineInputChatService),n.__metadata("design:type",c.InlineInputChatService)],a.prototype,"inlineInputChatService",void 0),a=n.__decorate([(0,o.Injectable)({multiple:!0})],a),e.InlineInputChatWidget=a},89060:(L,e,t)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.InlineInputController=void 0;const l=t(85608),o=t(76003),h=t(43718),f=l.__importStar(t(20868)),b=t(2261),g=t(52451),v=t(88104),I=t(23028),u=t(99906),c=t(77633),s=t(40111),a=t(31031),r=t(97139),d=t(32213),m=l.__importDefault(t(13185)),G=t(74353);let p=n=class extends u.BaseAIMonacoEditorController{static get(W){return W.getContribution(n.ID)}get inlineInputChatService(){return this.injector.get(G.InlineInputChatService)}get inlineChatFeatureRegistry(){return this.injector.get(h.InlineChatFeatureRegistryToken)}mount(){return this.registerInlineInputFeature(this.monacoEditor)}async doRequestReadable(W,Z,y,E,R,A){const w=this.inlineChatFeatureRegistry.getInteractiveInputHandler(),F=y.getModel();if(!w||!F)return;Z.launchChatStatus(a.EInlineChatStatus.THINKING);const V=await this.inlineChatFeatureRegistry.getInteractiveInputStrategyHandler()(y,W);if(V===c.ERunStrategy.EXECUTE&&w.execute){w.execute(y,W,this.token),Z.launchChatStatus(a.EInlineChatStatus.DONE),A();return}if(V===c.ERunStrategy.PREVIEW&&w.providePreviewStrategy){const Y=await w.providePreviewStrategy(y,W,this.token);if(h.CancelResponse.is(Y)){Z.launchChatStatus(a.EInlineChatStatus.READY),A();return}if(s.InlineChatController.is(Y)){const _=Y;let H;const X=this.registerDispose(new h.RunOnceScheduler(()=>{const S=R.getRange(0);S&&H&&F.pushEditOperations(null,[b.EditOperation.replace(S,H)],()=>null)},16*12.5));E.addDispose([_.onData(async S=>{h.ReplyResponse.is(S)&&(H=S.message,X.isScheduled()||X.schedule())}),_.onError(S=>{Z.launchChatStatus(a.EInlineChatStatus.ERROR)}),_.onAbort(()=>{Z.launchChatStatus(a.EInlineChatStatus.READY)}),_.onEnd(()=>{F.pushStackElement(),Z.launchChatStatus(a.EInlineChatStatus.DONE)})]),_.listen()}}}registerInlineInputFeature(W){const Z=new h.Disposable,y=this.injector.get(I.AINativeContextKey,[W.contextKeyService]),E=()=>{Z.dispose()};this.addDispose(this.inlineInputChatService.onInteractiveInputVisibleInPosition(A=>{E(),A&&R(A,W)}));const R=(A,w)=>{this.addDispose(w.onWillChangeModel(()=>{E()}));const F=w.getModel();if(!F||!w.hasTextFocus())return;const Y=this.injector.get(d.InlineInputChatWidget,[w]),_=w.createDecorationsCollection();_.append([{range:f.Range.fromPositions(A),options:v.ModelDecorationOptions.register({description:r.InlineInputPreviewDecorationID,isWholeLine:!0,className:m.default.input_decoration_readable_container,inlineClassName:m.default.inline_chat_inserted_range})}]);const H=_.getRange(0);let X=g.LineRange.fromRange(H);Y.show({position:H.getStartPosition()}),y.inlineInputWidgetIsVisible.set(!0),Z.addDispose(Y.onDispose(()=>{this.cancelToken(),_.clear(),y.inlineInputWidgetIsVisible.set(!1)})),Z.addDispose(Y.onResultClick(async S=>{const Q=()=>{const k=_.getRange(0);F.pushStackElement(),F.pushEditOperations(null,[b.EditOperation.delete(k)],()=>null),F.pushStackElement()};switch(S){case a.EResultKind.ACCEPT:E();break;case a.EResultKind.DISCARD:Q(),E();break;case a.EResultKind.REGENERATE:Q(),await this.doRequestReadable(Y.interactiveInputValue,Y,w,Z,_,E);break;default:break}})),Z.addDispose(h.Event.debounce(_.onDidChange.bind(_),()=>{},h.FRAME_THREE)(()=>{if(!_.getRange(0))return;const S=_.getRange(0),Q=g.LineRange.fromRange(S);X.equals(Q)||(Y.setOptions({position:S.getStartPosition()}),Y.layoutContentWidget()),X=Q})),Z.addDispose(Y.onInteractiveInputValue(async S=>{await this.doRequestReadable(S,Y,w,Z,_,E)})),Z.addDispose(Y)};return this.addDispose(Z),this}};p.ID="editor.contrib.ai.inline.input",p=n=l.__decorate([(0,o.Injectable)()],p),e.InlineInputController=p},74353:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineInputChatService=void 0;const n=t(85608),l=t(76003),o=t(43718);let h=class{constructor(){this._onInteractiveInputVisibleInPosition=new o.Emitter,this.onInteractiveInputVisibleInPosition=this._onInteractiveInputVisibleInPosition.event}get currentVisiblePosition(){return this._currentVisiblePosition}setCurrentVisiblePosition(b){this._currentVisiblePosition=b}visible(){this._onInteractiveInputVisibleInPosition.fire(this._currentVisiblePosition)}hide(){this._onInteractiveInputVisibleInPosition.fire(void 0)}};h=n.__decorate([(0,l.Injectable)()],h),e.InlineInputChatService=h},76755:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineStreamDiffComputer=void 0;const n=t(9514),l=t(52451),o=t(37348),h=t(44781),f=t(68450),b=t(95821),g=t(89216),v=t(10438),I=t(30861),u=t(46739),c=(a,r,d=f.InfiniteTimeout.instance)=>{if(!a.length||!r.length)return f.DiffAlgorithmResult.trivial(a,r);const m=new v.Array2D(2*a.length+1,r.length+1),G=new v.Array2D(2*a.length+1,r.length+1);for(let R=0;R<=r.length;R++)m.set(0,R,R),G.set(0,R,R>0);for(let R=0;R<=2*a.length;R++)m.set(R,0,Math.floor((R+1)/2)),G.set(R,0,!1);for(let R=1;R<=r.length;R++)for(let A=1;A<=2*a.length;A++){if(!d.isValid())return f.DiffAlgorithmResult.trivialTimedOut(a,r);if(A%2===0){const w=m.get(A,R-1)+1,F=m.get(A-1,R),V=w<F;m.set(A,R,V?w:F),G.set(A,R,V)}else{const w=m.get(A-1,R)+.4,F=a.getElement(Math.floor(A/2))===r.getElement(R-1)?m.get(A-1,R-1):Number.MAX_VALUE,V=F<w;m.set(A,R,V?F:w),G.set(A,R,V)}}let p=Number.MAX_VALUE,N=-1;for(let R=0;R<=2*a.length;R++){const A=m.get(R,r.length);A<p&&(p=A,N=R)}const W=[];let Z=N,y=r.length;Z<=2*a.length-2&&W.push(new f.SequenceDiff(new o.OffsetRange(Math.floor((Z+1)/2),a.length),new o.OffsetRange(y,y)));let E;for(;Z>=0&&y>=0;)G.get(Z,y)?(Z%2===0?E===void 0&&(E={originalLineIndex:Math.floor(Z/2),modifiedLineIndex:y}):(E!==void 0&&((E.originalLineIndex!==Math.floor(Z/2)+1||E.modifiedLineIndex!==y)&&W.push(new f.SequenceDiff(new o.OffsetRange(Math.floor(Z/2)+1,E.originalLineIndex),new o.OffsetRange(y,E.modifiedLineIndex))),E=void 0),Z-=1),y-=1):(E=E||{originalLineIndex:Math.floor((Z+1)/2),modifiedLineIndex:y},Z-=1);return E!==void 0&&((E.originalLineIndex!==Math.floor(Z/2)+1||E.modifiedLineIndex!==y)&&W.push(new f.SequenceDiff(new o.OffsetRange(Math.floor(Z/2)+1,E.originalLineIndex),new o.OffsetRange(y,E.modifiedLineIndex))),E=void 0),W.reverse(),new f.DiffAlgorithmResult(W,!1)};class s extends b.DefaultLinesDiffComputer{computeDiff(r,d,m){if(r.length<=1&&(0,n.equals)(r,d,(Y,_)=>Y===_))return new I.LinesDiff([],[],!1);if(r.length===1&&r[0].length===0||d.length===1&&d[0].length===0)return new I.LinesDiff([new u.DetailedLineRangeMapping(new l.LineRange(1,r.length+1),new l.LineRange(1,d.length+1),[new u.RangeMapping(new h.Range(1,1,r.length,r[r.length-1].length+1),new h.Range(1,1,d.length,d[d.length-1].length+1))])],[],!1);const G=m.maxComputationTimeMs===0?f.InfiniteTimeout.instance:new f.DateTimeout(m.maxComputationTimeMs),p=new Map;function N(Y){let _=p.get(Y);return _===void 0&&(_=p.size,p.set(Y,_)),_}const W=r.length*d.length<1e6&&m.onlyCareAboutPrefixOfOriginalLines,Z=r.map(Y=>N(W?Y:Y.trim())),y=d.map(Y=>N(W?Y:Y.trim())),E=new g.LineSequence(Z,r),R=new g.LineSequence(y,d),A=r.every(Y=>Y.trim().length===0);let w;W?A?w=f.DiffAlgorithmResult.trivial(E,R):w=c(E,R,G):E.length+R.length<1700?w=this.dynamicProgrammingDiffing.compute(E,R,G,(Y,_)=>r[Y]===d[_]?d[_].length===0?.1:1+Math.log(1+d[_].length):.99):w=this.myersDiffingAlgorithm.compute(E,R,G);const F=w.diffs,V=w.hitTimeout;if(W){const Y=F.map(_=>new u.DetailedLineRangeMapping(new l.LineRange(_.seq1Range.start+1,_.seq1Range.endExclusive+1),new l.LineRange(_.seq2Range.start+1,_.seq2Range.endExclusive+1),[]));return new I.LinesDiff(Y,[],V)}return super.computeDiff(r,d,m)}}e.InlineStreamDiffComputer=s},33062:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineStreamDiffHandler=e.EComputerMode=void 0;const n=t(85608),l=t(76003),o=t(41869),h=t(20868),f=t(60304),b=t(52451),g=t(84968),v=t(46739),I=t(87822),u=t(25539),c=t(76755),s=t(80715);var a;(function(m){m.legacy="legacy",m.default="default"})(a=e.EComputerMode||(e.EComputerMode={}));const r=new c.InlineStreamDiffComputer;let d=class extends o.Disposable{constructor(G){super(),this.monacoEditor=G,this._onDidEditChange=this.registerDispose(new o.Emitter),this.onDidEditChange=this._onDidEditChange.event,this.rawOriginalTextLinesTokens=[],this.currentEditLine=0,this.finallyDiffModel=null,this.isEditing=!1,this.undoRedoGroup=new u.UndoRedoGroup;const p=f.StandaloneServices.get(I.IModelService);this.virtualModel=p.createModel("",null,o.Uri.from({scheme:o.Schemes.inMemory,path:"inline-stream-diff/"+(0,o.randomString)(8)}),!0),this.originalModel=this.monacoEditor.getModel(),this.livePreviewDiffDecorationModel=this.injector.get(s.LivePreviewDiffDecorationModel,[this.monacoEditor]),this.addDispose(this.livePreviewDiffDecorationModel),this.addDispose(this.virtualModel);const N=this.livePreviewDiffDecorationModel.onDispose(()=>{this.dispose(),N.dispose()})}setPreviewerOptions(G){this.previewerOptions=G,this.livePreviewDiffDecorationModel.setPreviewerOptions({partialEditWidgetOptions:{hideAcceptPartialEditWidget:G.hideAcceptPartialEditWidget}})}initialize(G){const p=this.originalModel.getEOL(),N=G.getStartPosition(),W=G.getEndPosition();this.rawOriginalTextLines=this.originalModel.getValueInRange(h.Range.fromPositions(N,W)).split(p),this.rawOriginalTextLinesTokens=this.rawOriginalTextLines.map((y,E)=>{const R=N.lineNumber+E;return this.originalModel.tokenization.forceTokenization(R),this.originalModel.tokenization.getLineTokens(R)});const Z=b.LineRange.fromRangeInclusive(h.Range.fromPositions({lineNumber:G.startLineNumber,column:1},{lineNumber:G.endLineNumber,column:Number.MAX_SAFE_INTEGER}));this.livePreviewDiffDecorationModel.initialize(Z)}restoreSnapshot(G){this._snapshotStore=G;const{rawOriginalTextLines:p,rawOriginalTextLinesTokens:N,undoRedoGroup:W,decorationSnapshotData:Z,previewerOptions:y}=G;this.setPreviewerOptions(y),this.rawOriginalTextLines=p,this.rawOriginalTextLinesTokens=N,this.undoRedoGroup=W,this.livePreviewDiffDecorationModel.initialize(Z.zone)}get currentSnapshotStore(){return this._snapshotStore}restoreDecorationSnapshot(G){this.livePreviewDiffDecorationModel.restoreSnapshot(G)}createSnapshot(){return{rawOriginalTextLines:this.rawOriginalTextLines,rawOriginalTextLinesTokens:this.rawOriginalTextLinesTokens,undoRedoGroup:this.undoRedoGroup,decorationSnapshotData:this.livePreviewDiffDecorationModel.createSnapshot(),previewerOptions:this.previewerOptions}}getVirtualModelValue(){return this.virtualModel.getValue()}getOriginModelValue(){return this.rawOriginalTextLines.join(`
28078
- `)}get onPartialEditWidgetListChange(){return this.livePreviewDiffDecorationModel.onPartialEditWidgetListChange}computeDiff(G,p,N=a.default){const W=(N===a.default?r:g.linesDiffComputers.getLegacy()).computeDiff(G,p,{computeMoves:!1,maxComputationTimeMs:200,ignoreTrimWhitespace:!1,onlyCareAboutPrefixOfOriginalLines:!0});let Z=W.changes;W.hitTimeout&&(Z=[new v.DetailedLineRangeMapping(new b.LineRange(1,G.length+1),new b.LineRange(1,p.length+1),void 0)]);const y=[];let E=[];for(const F of Z)if(F.modified.endLineNumberExclusive===p.length+1&&N===a.default){if(E=G.slice(F.original.startLineNumber-1,F.original.endLineNumberExclusive-1),F.modified.isEmpty)continue;y.push({removedTextLines:[],removedLinesOriginalRange:new b.LineRange(F.original.startLineNumber,F.original.startLineNumber),addedRange:F.modified,relativeInnerChanges:void 0})}else y.push({removedTextLines:G.slice(F.original.startLineNumber-1,F.original.endLineNumberExclusive-1),removedLinesOriginalRange:F.original,addedRange:F.modified,relativeInnerChanges:F.innerChanges?F.innerChanges.map(V=>({originalRange:V.originalRange.delta(-F.original.startLineNumber+1),modifiedRange:V.modifiedRange.delta(-F.modified.startLineNumber+1)})):void 0});const R=[...p,...E];let A=0,w=new b.LineRange(1,1);return E.length>0&&(A=p.length+1,w=new b.LineRange(p.length+1,p.length+1+E.length)),{changes:y,newFullRangeTextLines:R,activeLine:A,pendingRange:w}}calculateAddedDecorationCollectionState(G){const p=this.getZone();return G.changes.map(W=>{const Z=W.addedRange,y={lineNumber:p.startLineNumber+Z.startLineNumber-1,column:1},E={lineNumber:p.startLineNumber+Z.endLineNumberExclusive-2,column:1};return{startPosition:y,endPosition:E,len:Z.endLineNumberExclusive-Z.startLineNumber}})}renderPartialEditWidgets(G){const p=this.calculateAddedDecorationCollectionState(G);this.livePreviewDiffDecorationModel.touchPartialEditWidgets(p.map(N=>N.startPosition.lineNumber))}renderAddedRangeDecoration(G){const p=this.calculateAddedDecorationCollectionState(G);this.livePreviewDiffDecorationModel.touchAddedRange(p)}renderRemovedRangeDecoration(G){const{changes:p}=G,N=this.getZone();let W=0;const Z=[];for(const y of p){const{removedTextLines:E,removedLinesOriginalRange:R,addedRange:A}=y;E.length>0&&Z.push({position:{column:1,lineNumber:N.startLineNumber+R.startLineNumber-2-W},textLines:E.map((w,F)=>({text:w,lineTokens:this.rawOriginalTextLinesTokens[R.startLineNumber-1+F]}))}),W+=R.length-A.length}this.livePreviewDiffDecorationModel.touchRemovedWidget(Z)}pushStackElement(){const G=this.livePreviewDiffDecorationModel.createEditStackElement(this.undoRedoGroup);G.attachModel(this.livePreviewDiffDecorationModel),G.registerUndo(p=>{p.dispose()})}handleEdits(G){const{activeLine:p,newFullRangeTextLines:N,pendingRange:W}=G,Z=this.originalModel.getEOL(),y=this.getZone(),E=y.startLineNumber<y.endLineNumberExclusive?new h.Range(y.startLineNumber,1,y.endLineNumberExclusive-1,this.originalModel.getLineMaxColumn(y.endLineNumberExclusive-1)):new h.Range(y.startLineNumber,1,y.startLineNumber,1),R=this.originalModel.getValueInRange(E).split(Z),A=g.linesDiffComputers.getDefault().computeDiff(R,N,{computeMoves:!1,maxComputationTimeMs:200,ignoreTrimWhitespace:!1}),w=[];if(A.hitTimeout){let F=N.join(Z);E.isEmpty()&&(F+=Z);const V={range:E,text:F,forceMoveMarkers:!1};w.push(V)}else for(const F of A.changes){let V=N.slice(F.modified.startLineNumber-1,F.modified.endLineNumberExclusive-1).join(Z),Y;F.original.isEmpty?(Y=new h.Range(E.startLineNumber+F.original.startLineNumber-1,1,E.startLineNumber+F.original.startLineNumber-1,1),V+=Z):F.modified.isEmpty?(Y=new h.Range(E.startLineNumber+F.original.startLineNumber-1,1,E.startLineNumber+F.original.endLineNumberExclusive-1,1),V=null):Y=new h.Range(E.startLineNumber+F.original.startLineNumber-1,1,E.startLineNumber+F.original.endLineNumberExclusive-2,this.originalModel.getLineMaxColumn(E.startLineNumber+F.original.endLineNumberExclusive-2));const _={range:Y,text:V,forceMoveMarkers:!1};w.push(_)}this.originalModel.pushEditOperations(null,w,()=>null,this.undoRedoGroup),this.livePreviewDiffDecorationModel.updateZone(new b.LineRange(y.startLineNumber,y.startLineNumber+N.length)),p>0?this.livePreviewDiffDecorationModel.touchActiveLine(p):this.livePreviewDiffDecorationModel.clearActiveLine(),this.renderAddedRangeDecoration(G),W.length>0?this.livePreviewDiffDecorationModel.touchPendingRange(W):this.livePreviewDiffDecorationModel.clearPendingLine(),this.renderRemovedRangeDecoration(G),this._onDidEditChange.fire()}recompute(G,p){p&&this.virtualModel.setValue(p);const N=this.virtualModel.getLinesContent();return this.computeDiff(this.rawOriginalTextLines,N,G)}async rateEditController(){if(this.isEditing===!1){for(this.isEditing=!0;this.currentEditLine<=this.virtualModel.getLinesContent().length;){if(this.disposed)return;const p=this.virtualModel.getLinesContent().slice(0,this.currentEditLine),N=this.computeDiff(this.rawOriginalTextLines,p);this.handleEdits(N),this.currentEditLine+=1,await(0,o.sleep)(o.FRAME_THREE)}this.finallyDiffModel&&this.finallyRender(this.finallyDiffModel),this.isEditing=!1}}addLinesToDiff(G,p=a.default){this.recompute(p,G),this.rateEditController()}pushRateFinallyDiffStack(G){this.finallyDiffModel=G,this.isEditing===!1&&this.finallyRender(this.finallyDiffModel)}finallyRender(G){this.renderPartialEditWidgets(G),this.handleEdits(G),this.pushStackElement(),this.monacoEditor.focus()}get onPartialEditEvent(){return this.livePreviewDiffDecorationModel.onPartialEditEvent}acceptAll(){this.livePreviewDiffDecorationModel.acceptUnProcessed(),this.dispose()}rejectAll(){this.livePreviewDiffDecorationModel.discardUnProcessed(),this.dispose()}revealFirstDiff(){this.livePreviewDiffDecorationModel.revealFirstDiff()}getZone(){return this.livePreviewDiffDecorationModel.getZone()}getTotalCodeInfo(){return this.livePreviewDiffDecorationModel.getTotalCodeInfo()}};n.__decorate([(0,l.Autowired)(l.INJECTOR_TOKEN),n.__metadata("design:type",l.Injector)],d.prototype,"injector",void 0),d=n.__decorate([(0,l.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],d),e.InlineStreamDiffHandler=d},22169:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineStreamDiffService=void 0;const n=t(85608),l=t(76003),o=t(43718);let h=class{constructor(){this._onAcceptDiscardPartialEdit=new o.Emitter,this.onAcceptDiscardPartialEdit=this._onAcceptDiscardPartialEdit.event}launchAcceptDiscardPartialEdit(b){this._onAcceptDiscardPartialEdit.fire(b)}};h=n.__decorate([(0,l.Injectable)()],h),e.InlineStreamDiffService=h},54362:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LivePreviewUndoRedoStackElement=void 0;const n=t(25539);class l{get type(){return n.UndoRedoElementType.Resource}get label(){return"Live.Preview.UndoRedo"}get code(){return"Live.Preview.UndoRedo"}get resource(){return this.model.uri}constructor(h){this.model=h,this.confirmBeforeUndo=!1}attachModel(h){this.decorationModel=h}registerUndo(h){this._undo=h}undo(){var h;(h=this._undo)===null||h===void 0||h.call(this,this.decorationModel)}registerRedo(h){this._redo=h}redo(){var h;(h=this._redo)===null||h===void 0||h.call(this,this.decorationModel)}}e.LivePreviewUndoRedoStackElement=l},8106:(L,e,t)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.RemovedZoneWidget=e.AcceptPartialEditWidget=e.EPartialEdit=e.PendingRangeDecoration=e.AddedRangeDecoration=e.ActiveLineDecoration=void 0;const l=t(85608),o=l.__importDefault(t(53373)),h=l.__importStar(t(14041)),f=l.__importDefault(t(25873)),b=t(76003),g=t(41869),v=t(57925),I=t(43718),u=t(52659),c=t(90052),s=t(31324),a=t(34819),r=t(24522),d=l.__importDefault(t(71749));e.ActiveLineDecoration="activeLine-decoration",e.AddedRangeDecoration="added-range-decoration",e.PendingRangeDecoration="pending-range-decoration";var m;(function(Z){Z.accept="accept",Z.discard="discard"})(m=e.EPartialEdit||(e.EPartialEdit={}));const G=Z=>{const{keyStrings:y,onAccept:E,onDiscard:R,editor:A}=Z,[w,F]=h.default.useState(0),V=(0,h.useCallback)(()=>{E?.()},[E]),Y=(0,h.useCallback)(()=>{R?.()},[R]);return(0,g.useDisposable)(()=>A.onDidScrollChange(_=>{const{scrollLeftChanged:H,scrollLeft:X}=_;H&&F(X)}),[A]),h.default.createElement("div",{className:(0,o.default)("kt-inline-diff-accept-partial-widget-container",d.default.inline_diff_accept_partial_widget_container),style:{marginLeft:w}},h.default.createElement("div",{className:d.default.content},h.default.createElement("span",{className:(0,o.default)(d.default.accept_btn,d.default.btn),onClick:V},y.acceptSequence),h.default.createElement("span",{className:(0,o.default)(d.default.discard_btn,d.default.btn),onClick:Y},y.discardSequence)))};let p=n=class extends u.ReactInlineContentWidget{constructor(y,E){super(y),this.editor=y,this.editWidgetOptions=E,this._onAccept=this.registerDispose(new I.Emitter),this.onAccept=this._onAccept.event,this._onDiscard=this.registerDispose(new I.Emitter),this.onDiscard=this._onDiscard.event,this.positionPreference=[c.ContentWidgetPositionPreference.EXACT],this.addedLinesCount=0,this.deletedLinesCount=0,this.status="pending"}get group(){return this._group}getSequenceKeyStrings(){let y=this.keybindingRegistry.getKeybindingsForCommand(v.AI_INLINE_DIFF_PARTIAL_EDIT.id);if(y=y.sort((E,R)=>R.args-E.args),!(!y||y.length!==2&&y.some(E=>(0,I.isUndefined)(E.resolved))))return{acceptSequence:this.keybindingRegistry.acceleratorForSequence(y[0].resolved,"")[0],discardSequence:this.keybindingRegistry.acceleratorForSequence(y[1].resolved,"")[0]}}renderView(){var y;if(!((y=this.editWidgetOptions)===null||y===void 0)&&y.hideAcceptPartialEditWidget)return;const E=this.getSequenceKeyStrings();if(E)return h.default.createElement(G,{keyStrings:E,onAccept:()=>this._onAccept.fire(),onDiscard:()=>this._onDiscard.fire(),editor:this.editor})}id(){return this._id||(this._id=`${n.ID}_${(0,I.uuid)(4)}`),this._id}getClassName(){return d.default.accept_partial_edit_widget_id}recordDecorationId(y){this._decorationId=y}getDecorationId(){return this._decorationId}resume(){this.status="pending",this.addedLinesCount=0,this.deletedLinesCount=0,super.resume()}setGroup(y){this._group=y}get isPending(){return this.status==="pending"}accept(y,E){this.status="accept",this.addedLinesCount=y,this.deletedLinesCount=E,super.hide()}get isAccepted(){return this.status==="accept"}discard(y,E){this.status="discard",this.addedLinesCount=y,this.deletedLinesCount=E,super.hide()}get isRejected(){return this.status==="discard"}};p.ID="AcceptPartialEditWidgetID",l.__decorate([(0,b.Autowired)(g.KeybindingRegistry),l.__metadata("design:type",Object)],p.prototype,"keybindingRegistry",void 0),p=n=l.__decorate([(0,b.Injectable)({multiple:!0}),l.__metadata("design:paramtypes",[Object,Object])],p),e.AcceptPartialEditWidget=p;const N=({dom:Z,editor:y})=>{const E=h.default.useRef(null),[R,A]=h.default.useState(0),[w,F]=h.default.useState(0);return(0,h.useEffect)(()=>{Z&&E&&E.current&&E.current.appendChild(Z)},[Z,E]),(0,g.useDisposable)(()=>y.onDidScrollChange(V=>{const{scrollLeftChanged:Y,scrollLeft:_}=V;Y&&A(_)}),[y]),(0,g.useDisposable)(()=>(F(y.getOption(s.EditorOption.layoutInfo).contentLeft),y.onDidChangeConfiguration(V=>{V.hasChanged(s.EditorOption.layoutInfo)&&F(y.getOption(s.EditorOption.layoutInfo).contentLeft)})),[y]),h.default.createElement("div",{className:d.default.inline_diff_remove_zone_fixed_box,style:{marginLeft:w+"px"}},h.default.createElement("div",{className:d.default.inline_diff_remove_zone,ref:E,style:{marginLeft:-R+"px"}}))};class W extends a.ZoneWidget{get isHidden(){return this._hidden}get group(){return this._group}constructor(y,E,R){super(y,R),this.textLines=E,this._hidden=!1,(0,I.isDefined)(R.isHidden)&&(this._hidden=R.isHidden),(0,I.isDefined)(R.recordPosition)&&(this._recordPosition=R.recordPosition),(0,I.isDefined)(R.undoRedoGroup)&&(this._group=R.undoRedoGroup);const A=this._positionMarkerId;this._disposables.add(A.onDidChange(w=>{const F=A.getRange(0);F&&(this._recordPosition=F.getStartPosition())}))}setGroup(y){this._group=y}_fillContainer(y){y.classList.add(d.default.inline_diff_remove_zone_widget_container),this.root=f.default.createRoot(y)}getRemovedTextLines(){return this.textLines.map(y=>y.text)}get height(){return this.textLines.length}getLastPosition(){return this.position||this._recordPosition}hide(){this._hidden=!0,super.hide()}resume(){const y=this.getLastPosition();y&&this.show(y,this.height)}show(y,E){this._hidden=!1,super.show(y,E)}revealRange(){}create(){super.create(),this.mountRender()}mountRender(){const y=document.createElement("div");(0,r.renderLines)(y,this.editor.getOption(s.EditorOption.tabIndex),this.textLines.map(({text:E,lineTokens:R})=>({content:E,decorations:[],lineTokens:R})),this.editor.getOptions()),this.root.render(h.default.createElement(N,{dom:y,editor:this.editor}))}dispose(){this.root.unmount(),super.dispose()}}e.RemovedZoneWidget=W},80715:(L,e,t)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.LivePreviewDiffDecorationModel=void 0;const l=t(85608),o=t(76003),h=t(41869),f=t(43718),b=t(20868),g=t(60304),v=t(2261),I=t(88104),u=t(25539),c=t(23028),s=t(53617),a=l.__importDefault(t(71749)),r=t(22169),d=t(54362),m=t(8106);let G=n=class extends f.Disposable{constructor(N){super(),this.monacoEditor=N,this._onPartialEditEvent=this.registerDispose(new f.Emitter),this.onPartialEditEvent=this._onPartialEditEvent.event,this._onPartialEditWidgetListChange=this.registerDispose(new f.Emitter),this.onPartialEditWidgetListChange=this._onPartialEditWidgetListChange.event,this.options={partialEditWidgetOptions:{}},this.partialEditWidgetList=[],this.removedZoneWidgets=[],this.model=this.monacoEditor.getModel(),this.undoRedoService=g.StandaloneServices.get(u.IUndoRedoService),this.activeLineDec=this.monacoEditor.createDecorationsCollection(),this.pendingRangeDec=this.monacoEditor.createDecorationsCollection(),this.aiNativeContextKey=this.injector.get(c.AINativeContextKey,[this.monacoEditor.contextKeyService]),this.addDispose(this.inlineStreamDiffService.onAcceptDiscardPartialEdit(W=>{const Z=this.monacoEditor.getPosition(),y=this.partialEditWidgetList.filter(E=>!E.isHidden).sort((E,R)=>{var A,w,F,V;const Y=((w=(A=E.getPosition())===null||A===void 0?void 0:A.position)===null||w===void 0?void 0:w.lineNumber)||1,_=((V=(F=R.getPosition())===null||F===void 0?void 0:F.position)===null||V===void 0?void 0:V.lineNumber)||1,H=Math.abs(Z.lineNumber-Y),X=Math.abs(Z.lineNumber-_);return H-X});y.length>0&&this.handlePartialEditAction(W?m.EPartialEdit.accept:m.EPartialEdit.discard,y[0])})),this.addedRangeDec=new s.EnhanceDecorationsCollection(this.monacoEditor),this.addDispose(this.addedRangeDec.onDidDecorationsChange(W=>{this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.get()&&this.partialEditWidgetList.forEach(y=>{const E=W.find(R=>y.getDecorationId()===R.id);if(E){const R=E.getRange();y.setOptions({position:{lineNumber:R.startLineNumber,column:1}}),y.layoutContentWidget()}})})),this.addDispose(f.Disposable.create(()=>{this.clear()}))}clear(){this.clearPendingLine(),this.clearActiveLine(),this.clearAddedLine(),this.clearRemovedWidgets(),this.clearPartialEditWidgetList()}initialize(N){this.updateZone(N)}getRemovedWidgets(){return this.removedZoneWidgets}restoreSnapshot(N){const{addedDecList:W,removedWidgetList:Z,zone:y,editStackSnapshot:E,partialEditWidgetList:R}=N;this.updateZone(y),this.addedRangeDec.set(W),this.clearRemovedWidgets(),Z.forEach(F=>{const V=F.getLastPosition();V&&this.showRemovedWidgetByLineNumber(V.lineNumber,F.textLines,{isHidden:F.isHidden,recordPosition:F.getLastPosition(),undoRedoGroup:F.group})}),this.clearPartialEditWidgetList(),R.forEach(F=>{var V,Y;const _=(Y=(V=F.getPosition())===null||V===void 0?void 0:V.position)===null||Y===void 0?void 0:Y.lineNumber;if(_){const H=this.createPartialEditWidget(_);F.status==="accept"?H.accept(F.addedLinesCount,F.deletedLinesCount):F.status==="discard"&&H.discard(F.addedLinesCount,F.deletedLinesCount),H.setGroup(F.group),this.partialEditWidgetList.push(H)}}),this.firePartialEditWidgetList(),this.recordPartialEditWidgetWithAddedDec();const A=this.model.uri;this.undoRedoService.restoreSnapshot(E);const w=this.undoRedoService.getElements(A);w.future.concat(w.past).forEach(F=>{F instanceof d.LivePreviewUndoRedoStackElement&&F.attachModel(this)})}createSnapshot(){return{addedDecList:this.addedRangeDec.getDecorations(),partialEditWidgetList:this.partialEditWidgetList,removedWidgetList:this.removedZoneWidgets,editStackSnapshot:this.undoRedoService.createSnapshot(this.model.uri),zone:this.zone}}showRemovedWidgetByLineNumber(N,W,Z){const y=new b.Position(N,1),E=W.length,R=new m.RemovedZoneWidget(this.monacoEditor,W,Object.assign(Object.assign({},Z),{showInHiddenAreas:!0,showFrame:!1,showArrow:!1}));R.create(),this.removedZoneWidgets.push(R),Z.isHidden?R.hide():R.show(y,E)}updateZone(N){this.zone=N}getZone(){return this.zone}touchActiveLine(N){const W=this.getZone();this.activeLineDec.set([{range:b.Range.fromPositions({lineNumber:W.startLineNumber+N-1,column:0}),options:I.ModelDecorationOptions.register({description:m.ActiveLineDecoration,isWholeLine:!0,className:a.default.inline_diff_current,zIndex:h.StackingLevel.Workbench})}])}doDiscardPartialWidget(N,W,Z){let y=null,E=0,R=0;if(W&&W.length>0){const A=W.getRange();y=v.EditOperation.delete(b.Range.lift({startLineNumber:A.startLineNumber,startColumn:A.startColumn,endLineNumber:A.endLineNumber+1,endColumn:1})),E=W.length,W.hide()}if(Z){const A=Z.getLastPosition(),w=this.model.getEOL(),F=Z.getRemovedTextLines();R=F.length;const V=F.join(w)+w;y?y=v.EditOperation.replace(b.Range.lift(y.range),V):y=v.EditOperation.insert(A.delta(1),V),Z.hide()}return N.discard(E,R),y}handlePartialEditAction(N,W,Z=!0,y=!1){const E=W.getPosition().position,R=this.aiReporter.getRelationId(),A=this.model,w=this.removedZoneWidgets.find(B=>B.getLastPosition().lineNumber===Math.max(1,E.lineNumber-1)),F=this.addedRangeDec.getDecorationByLineNumber(E.lineNumber),V=F?.length||0,Y=w?.height||0,_=new u.UndoRedoGroup;W.setGroup(_),w?.setGroup(_),F?.setGroup(_);const H=B=>B.partialEditWidgetList.find(O=>O.group===_),X=B=>B.removedZoneWidgets.find(O=>O.group===_),S=B=>B.addedRangeDec.getDecorationByGroup(_);let Q;const k=w?.getRemovedTextLines().join(`
28079
- `)||"",M=F?.getRange();M&&(Q=A.getValueInRange(Object.assign(Object.assign({},M),{endColumn:A.getLineMaxColumn(M.endLineNumber)})));const D=B=>{y&&this.aiReporter.end(R,{message:"discard",success:!0,isDrop:!0,code:Q,originCode:k,actionSource:f.ActionSourceEnum.InlineChat,actionType:f.ActionTypeEnum.LineDiscard});const O=X(B);O?.hide();const z=S(B);z?.hide();const U=H(B);return this.doDiscardPartialWidget(U,z,O)},J=B=>{y&&this.aiReporter.end(R,{message:"accept",success:!0,isReceive:!0,code:Q,originCode:k,actionSource:f.ActionSourceEnum.InlineChat,actionType:f.ActionTypeEnum.lineAccept});const O=H(B);O?.accept(V,Y);const z=X(B);z?.hide();const U=S(B);U?.hide()},T=B=>{const O=H(B);O?.resume();const z=X(B);z?.resume();const U=S(B);U?.resume()};switch(N){case m.EPartialEdit.accept:if(J(this),Z){const B=this.createEditStackElement(_);B.attachModel(this),B.registerUndo(O=>{T(O)}),B.registerRedo(O=>{J(O)})}break;case m.EPartialEdit.discard:{const B=D(this);if(B){if(Z){const O=this.createEditStackElement(_);O.attachModel(this),O.registerUndo(z=>{T(z)}),O.registerRedo(z=>{D(z)})}A.pushStackElement(),A.pushEditOperations(null,[B],()=>null,_),A.pushStackElement()}}break;default:break}const x=Object.assign({uri:this.model.uri,totalPartialEditCount:this.partialEditWidgetList.length,resolvedPartialEditCount:this.partialEditWidgetList.filter(B=>B.isHidden).length,currentPartialEdit:{addedLinesCount:V,deletedLinesCount:Y,type:N}},this.getTotalCodeInfo());this.monacoEditor.focus(),this._onPartialEditEvent.fire(x),this.firePartialEditWidgetList()}firePartialEditWidgetList(){this._onPartialEditWidgetListChange.fire(this.partialEditWidgetList);const N=this.partialEditWidgetList.filter(W=>!W.isHidden);this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.set(N.length!==0)}createEditStackElement(N){const W=new d.LivePreviewUndoRedoStackElement(this.model);return this.undoRedoService.pushElement(W,N),W}static computeCodeInfo(N,W,Z){const y=R(N),E={added:0,deleted:0,changed:0};return N.forEach((A,w)=>{if(A.status==="pending"){const F=W[w],V=Z[w],Y=F?.length||0,_=V?.height||0;E.added+=Y,E.deleted+=_,E.changed+=Math.max(Y,_)}}),{totalAddedLinesCount:y.added,totalDeletedLinesCount:y.deleted,totalChangedLinesCount:y.changed,unresolvedAddedLinesCount:E.added,unresolvedDeletedLinesCount:E.deleted,unresolvedChangedLinesCount:E.changed};function R(A){const w={added:0,deleted:0,changed:0};return A.forEach(F=>{const V=F.addedLinesCount,Y=F.deletedLinesCount;w.added+=V,w.deleted+=Y,w.changed+=Math.max(V,Y)}),w}}getTotalCodeInfo(){const N=this.partialEditWidgetList,W=this.addedRangeDec.getDecorations(),Z=this.removedZoneWidgets;return n.computeCodeInfo(N,W,Z)}recordPartialEditWidgetWithAddedDec(){this.partialEditWidgetList.forEach(N=>{var W,Z;const y=(Z=(W=N.getPosition())===null||W===void 0?void 0:W.position)===null||Z===void 0?void 0:Z.lineNumber;if(y){const E=this.addedRangeDec.getDecorationByLineNumber(y);E&&N.recordDecorationId(E.id)}})}acceptUnProcessed(){this.partialEditWidgetList.filter(W=>!W.isHidden).forEach(W=>{this.handlePartialEditAction(m.EPartialEdit.accept,W,!1)})}discardUnProcessed(){this.partialEditWidgetList.filter(W=>!W.isHidden).forEach(W=>{this.handlePartialEditAction(m.EPartialEdit.discard,W,!1)})}createPartialEditWidget(N){const W=this.injector.get(m.AcceptPartialEditWidget,[this.monacoEditor,this.options.partialEditWidgetOptions]);W.show({position:{lineNumber:N,column:1}});const Z=W.onDispose(()=>{const y=W.getId();this.partialEditWidgetList=this.partialEditWidgetList.filter(E=>E.getId()!==y),Z.dispose()});return W.addDispose([W.onAccept(()=>{this.handlePartialEditAction(m.EPartialEdit.accept,W,!0,!0)}),W.onDiscard(()=>{this.handlePartialEditAction(m.EPartialEdit.discard,W,!0,!0)})]),W}touchPartialEditWidgets(N){this.clearPartialEditWidgetList(),this.partialEditWidgetList=N.map(W=>this.createPartialEditWidget(W)),this.firePartialEditWidgetList()}touchAddedRange(N){this.addedRangeDec.set(N.map(W=>{const Z=W.startPosition,y=W.endPosition,E=W.len;let R=b.Range.fromPositions(Z,y),A=a.default.inline_diff_added_range+" ";return E===0&&(R=b.Range.fromPositions(Z),A+=a.default.hide),{length:E,range:R,isHidden:E===0,options:I.ModelDecorationOptions.register({description:m.AddedRangeDecoration,isWholeLine:!0,className:A})}})),this.recordPartialEditWidgetWithAddedDec()}touchRemovedWidget(N){this.clearRemovedWidgets(),N.forEach(({textLines:W,position:Z})=>{this.showRemovedWidgetByLineNumber(Z.lineNumber,W,{})})}touchPendingRange(N){const W=this.getZone();this.pendingRangeDec.set([{range:b.Range.fromPositions({lineNumber:W.startLineNumber+N.startLineNumber-1,column:0},{lineNumber:W.startLineNumber+N.endLineNumberExclusive-2,column:Number.MAX_SAFE_INTEGER}),options:I.ModelDecorationOptions.register({description:m.PendingRangeDecoration,isWholeLine:!0,className:a.default.inline_diff_pending_range})}])}clearPendingLine(){this.pendingRangeDec.clear()}clearActiveLine(){this.activeLineDec.clear()}clearAddedLine(){this.addedRangeDec.clear()}clearPartialEditWidgetList(){this.partialEditWidgetList.forEach(N=>{N.dispose()}),this.partialEditWidgetList=[],this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.set(!1)}clearRemovedWidgets(){this.removedZoneWidgets.forEach(N=>{N.dispose()}),this.removedZoneWidgets=[]}revealFirstDiff(){const N=this.removedZoneWidgets[0];if(N){const W=N.getLastPosition();W&&this.monacoEditor.revealLineInCenterIfOutsideViewport(W.lineNumber)}}setPreviewerOptions(N){this.options=N}};l.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),l.__metadata("design:type",o.Injector)],G.prototype,"injector",void 0),l.__decorate([(0,o.Autowired)(f.IAIReporter),l.__metadata("design:type",Object)],G.prototype,"aiReporter",void 0),l.__decorate([(0,o.Autowired)(r.InlineStreamDiffService),l.__metadata("design:type",r.InlineStreamDiffService)],G.prototype,"inlineStreamDiffService",void 0),G=n=l.__decorate([(0,o.Injectable)({multiple:!0}),l.__metadata("design:paramtypes",[Object])],G),e.LivePreviewDiffDecorationModel=G},97139:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineInputPreviewDecorationID=void 0,e.InlineInputPreviewDecorationID="InlineInputPreviewDecorationID"},90058:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SumiLightBulbWidget=void 0;const n=t(41869),l=t(3908),o=t(19202);class h extends o.LightBulbWidget{_updateLightBulbTitleAndIcon(){if(this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],this.state.type!==o.LightBulbState.Type.Showing)return;let b,g=!1;this.state.actions.allAIFixes?(b=l.Sumicon.magicWand,this.state.actions.validActions.length===1&&(g=!0)):this.state.actions.hasAutoFix?this.state.actions.hasAIFix?b=l.Sumicon.magicWand:b=l.Codicon.lightbulbAutofix:this.state.actions.hasAIFix?b=l.Sumicon.magicWand:b=l.Codicon.lightBulb,this._updateLightbulbTitle(this.state.actions.hasAutoFix,g),this._iconClasses=(0,n.asClassNameArrayWrapper)(b),this._domNode.classList.add(...this._iconClasses)}}e.SumiLightBulbWidget=h},8191:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RewriteWidget=e.REWRITE_DECORATION_INLINE_ADD=void 0;const n=t(85608),l=n.__importDefault(t(53373)),o=n.__importStar(t(14041)),h=n.__importDefault(t(25873)),f=t(76003),b=t(41869),g=n.__importStar(t(20868)),v=t(52659),I=t(90052),u=t(77714),c=t(2261),s=t(87822),a=t(83e3),r=n.__importDefault(t(32518)),d={fixedOverflowWidgets:!0,readOnly:!0,domReadOnly:!0,lineNumbers:"off",glyphMargin:!1,scrollBeyondLastLine:!1,rulers:void 0,overviewRulerBorder:void 0,overviewRulerLanes:0,padding:{top:0,bottom:0},folding:!1,stickyScroll:{enabled:!1},minimap:{enabled:!1},automaticLayout:!0,scrollbar:{horizontal:"hidden",vertical:"hidden",horizontalScrollbarSize:0,verticalScrollbarSize:0,arrowSize:0,verticalSliderSize:0,horizontalSliderSize:0,ignoreHorizontalScrollbarInContentHeight:!0},hover:{enabled:!1},guides:{indentation:!1}};e.REWRITE_DECORATION_INLINE_ADD="rewrite-decoration-inline-add";const m=o.default.memo(p=>{const{editor:N,onReady:W}=p,Z=(0,b.useInjectable)(b.MonacoService),y=(0,o.useRef)(null),E=(0,o.useRef)(null),[R,A]=(0,o.useState)(null),[w,F]=(0,o.useState)(0),[V,Y]=(0,o.useState)(null),_=(0,o.useCallback)((Q,k,M)=>{const D=N.getModel().getEOL();let J=k.startLineNumber,T=k.startColumn;const x=Q.getModel();Q.changeDecorations(te=>{if(Q){x.getAllDecorations().map(re=>re.id).forEach(re=>te.removeDecoration(re));for(const re of M){if(re.removed)continue;const ae=re.value.split(D);for(let ue=0;ue<ae.length;ue++){const ee=ae[ue];ue!==0&&(J++,T=1),re.added&&te.addDecoration(new g.Range(J,T,J,T+ee.length),{description:e.REWRITE_DECORATION_INLINE_ADD,className:r.default.ghost_text_decoration_inline_add}),T+=ee.length}}}});const B=Q.getOption(g.editor.EditorOption.lineHeight);Q?.setScrollTop(Math.max(k.startLineNumber-1,0)*B);const O=J-k.startLineNumber,z=Q.getOption(g.editor.EditorOption.fontInfo).spaceWidth;let U=0;const P=x.getOptions().tabSize;Array.from({length:O+1},(te,re)=>k.startLineNumber+re).forEach(te=>{const re=x.getLineContent(te);let ae=0;for(const ue of re)ue===u.space?ae+=P:ae+=1,U=Math.max(U,ae)}),A({width:U*z,height:B*(O+1)})},[R,N]);(0,o.useEffect)(()=>{if(N.getModel())return W&&W({getVirtualEditor:()=>V,renderVirtualEditor:(k,M,D)=>H(k,M,D),renderTextLineThrough:k=>X(k),layout:k=>S(k)}),()=>{V&&V.dispose(),E.current&&(0,b.runWhenIdle)(()=>{var k;(k=E.current)===null||k===void 0||k.unmount(),E.current=null})}},[N,W,V]);const H=(0,o.useCallback)((Q,k,M)=>{if(!y.current)return;const D=N.getModel();if(!D)return;let J=V;if(!J){J=Z.createCodeEditor(y.current,d);const T=a.StandaloneServices.get(s.IModelService),x={languageId:D.getLanguageId(),onDidChange:b.Event.None},B=T.createModel("",x);J.setModel(B),Y(J)}J.setValue(Q),_(J,k,M)},[y,V]),X=(0,o.useCallback)(Q=>{if(!y.current)return;V&&(V.dispose(),Y(null));const k=({changes:M})=>{const D=N.getOption(g.editor.EditorOption.lineHeight),J=N.getOption(g.editor.EditorOption.fontInfo).spaceWidth,T=(B,O=r.default.ghost_text_decoration)=>o.default.createElement("span",{className:(0,l.default)(r.default.space_span,O),style:{width:`${J*B}px`}},u.space.repeat(B)),x=(B,O)=>o.default.createElement("span",{className:(0,l.default)(r.default.text_span,O)},B);return o.default.createElement(o.default.Fragment,null,M.map((B,O)=>{let z=!0,U="",P=0;const te=[];for(const re of B){const{value:ae,added:ue,removed:ee}=re;if(ee)U+=ae;else{z=!1,P+=ae.length;const pe=ae.length-ae.trimStart().length,ge=ae.length-ae.trimEnd().length,q=ae.trim();te.push(T(pe)),q&&(te.push(x(q,ue?r.default.ghost_text_decoration_inline_add:r.default.ghost_text_decoration)),te.push(T(ge)))}}if(z){const re=U.length-U.trimStart().length,ae=U.length-U.trimEnd().length,ue=U.trim();te.push(T(re,r.default.ghost_text_decoration_remove)),ue&&(te.push(x(ue,r.default.ghost_text_decoration_inline_remove)),te.push(T(ae,r.default.ghost_text_decoration_inline_remove)))}return o.default.createElement("div",{key:O,className:r.default.deletions_code_line,style:{height:`${D}px`}},te)}))};E.current&&(E.current.unmount(),E.current=null),E.current=h.default.createRoot(y.current),E.current.render(o.default.createElement(o.default.Fragment,null,Q.map((M,D)=>o.default.createElement(k,{key:D,changes:M.changes}))))},[N,y,V,E]),S=(0,o.useCallback)(Q=>{const k=N.getOption(g.editor.EditorOption.fontInfo).spaceWidth;let M=0;for(let D=Q.startLineNumber;D<=Q.endLineNumber;D++){const J=N.getModel().getLineMaxColumn(D);M=Math.max(M,J)}F(M*k+10)},[N]);return o.default.createElement("div",{className:r.default.rewrite_widget_container,style:{width:R?.width,height:R?.height,marginLeft:w}},o.default.createElement("div",{className:r.default.virtual_editor_container,ref:y}))});let G=class extends v.ReactInlineContentWidget{constructor(){super(...arguments),this.virtualEditorHandler=null,this.positionPreference=[I.ContentWidgetPositionPreference.EXACT],this.defered=new b.Deferred,this.updateFontStyle=()=>{const N=this.editor.getOption(g.editor.EditorOption.fontInfo);this.domNode.style.fontFamily=N.fontFamily,this.domNode.style.fontSize=N.fontSize+"px"}}renderView(){return this.updateFontStyle(),o.default.createElement(m,{editor:this.editor,onReady:N=>{this.defered.resolve(),this.virtualEditorHandler=N}})}id(){return"RewriteWidget"}show(N){const{position:W}=N;if(!W)return;const{lineNumber:Z}=W;super.show({position:g.Position.lift({lineNumber:Z,column:1})})}setInsertText(N){this.insertText=N}setEditArea(N){this.editArea=N}getEditArea(){return this.editArea}getVirtualEditor(){var N,W;return(W=(N=this.virtualEditorHandler)===null||N===void 0?void 0:N.getVirtualEditor())!==null&&W!==void 0?W:null}renderTextLineThrough(N){var W,Z;(W=this.virtualEditorHandler)===null||W===void 0||W.renderTextLineThrough(N),(Z=this.virtualEditorHandler)===null||Z===void 0||Z.layout(this.editArea)}renderVirtualEditor(N,W){this.virtualEditorHandler.renderVirtualEditor(N,this.editArea,W),this.virtualEditorHandler.layout(this.editArea)}accept(){(0,b.isUndefined)(this.insertText)||(this.editor.pushUndoStop(),this.editor.getModel().pushEditOperations(null,[c.EditOperation.replace(g.Range.lift(this.editArea),this.insertText)],()=>null))}};G=n.__decorate([(0,f.Injectable)({multiple:!0})],G),e.RewriteWidget=G},19413:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IAIInlineCompletionsProvider=e.EResultKind=e.EInlineChatStatus=e.ChatProxyServiceToken=e.IChatAgentService=e.IChatManagerService=e.IChatInternalService=e.ChatCompletionRequestMessageRoleEnum=e.BACK_QUOTE_3_SYMBOL=e.AT_SIGN_SYMBOL=e.SLASH_SYMBOL=e.AI_MENUBAR_CONTAINER_VIEW_ID=e.AI_MENU_BAR_DEBUG_TOOLBAR=e.AI_CHAT_LOGO_AVATAR_ID=e.AI_CHAT_CONTAINER_ID=e.AI_CHAT_VIEW_ID=e.AIInlineChatContentWidget=e.IAINativeService=void 0;const n=t(43718),l=t(66338);e.IAINativeService=Symbol("IAINativeService"),e.AIInlineChatContentWidget=n.AIInlineChatContentWidgetId,e.AI_CHAT_VIEW_ID="AI-Chat",e.AI_CHAT_CONTAINER_ID="AI-Chat-Container",e.AI_CHAT_LOGO_AVATAR_ID="AI-Chat-Logo-Avatar",e.AI_MENU_BAR_DEBUG_TOOLBAR="AI_MENU_BAR_DEBUG_TOOLBAR",e.AI_MENUBAR_CONTAINER_VIEW_ID=l.DESIGN_MENUBAR_CONTAINER_VIEW_ID,e.SLASH_SYMBOL="/",e.AT_SIGN_SYMBOL="@",e.BACK_QUOTE_3_SYMBOL="```";var o;(function(b){b.System="system",b.User="user",b.Assistant="assistant"})(o=e.ChatCompletionRequestMessageRoleEnum||(e.ChatCompletionRequestMessageRoleEnum={})),e.IChatInternalService=Symbol("IChatInternalService"),e.IChatManagerService=Symbol("IChatManagerService"),e.IChatAgentService=Symbol("IChatAgentService"),e.ChatProxyServiceToken=Symbol("ChatProxyServiceToken");var h;(function(b){b[b.READY=0]="READY",b[b.THINKING=1]="THINKING",b[b.DONE=2]="DONE",b[b.ERROR=3]="ERROR"})(h=e.EInlineChatStatus||(e.EInlineChatStatus={}));var f;(function(b){b.ACCEPT="ACCEPT",b.DISCARD="DISCARD",b.REGENERATE="REGENERATE"})(f=e.EResultKind||(e.EResultKind={})),e.IAIInlineCompletionsProvider=Symbol("IAIInlineCompletionsProvider")},98864:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isDocumentValid=e.isDocumentTooShort=e.isDocumentTooLarge=void 0;const t=h=>{try{h.getText()}catch(f){if(f instanceof RangeError)return!0}return!1};e.isDocumentTooLarge=t;const n=10,l=h=>h.getText().length<n;e.isDocumentTooShort=l;const o=h=>!((0,e.isDocumentTooLarge)(h)||(0,e.isDocumentTooShort)(h));e.isDocumentValid=o},26471:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),t(85608).__exportStar(t(19413),e)},15504:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentReactions=e.CommentReactionSwitcher=void 0;const n=t(85608),l=t(25150),o=n.__importDefault(t(14041)),h=t(41869),f=t(81878),b=t(25918),g=t(93899),v=t(52416),I=t(69635),u=n.__importDefault(t(38877));e.CommentReactionSwitcher=(0,l.observer)(({thread:c,comment:s,className:a})=>{const r=`${c.providerId}_${c.id}_${s.id}`,d=`${g.MenuId.CommentReactionSwitcherMenu}_${r}`,m=(0,h.useInjectable)(g.IMenuRegistry),G=(0,h.useInjectable)(g.AbstractMenuService);o.default.useEffect(()=>{const N=new h.Disposable,W=`${g.MenuId.CommentReactionSwitcherSubmenu}_${r}`;return N.addDispose(m.registerMenuItem(d,{submenu:W,label:W,iconClass:(0,h.getExternalIcon)("reactions"),group:"navigation"})),N.addDispose(m.registerMenuItems(W,s.reactions.map(Z=>({command:{id:I.SwitchCommandReaction,label:Z.label},extraTailArgs:[{thread:c,comment:s,reaction:Z}]})))),()=>N.dispose()},[]);const p=o.default.useMemo(()=>G.createMenu(d),[]);return o.default.createElement(b.InlineActionBar,{className:a,menus:p,regroup:N=>[N,[]],type:"icon"})}),e.CommentReactions=(0,l.observer)(({thread:c,comment:s})=>{var a;const r=(0,h.useInjectable)(h.IEventBus),d=(0,h.useInjectable)(v.IIconService),m=o.default.useCallback(G=>{r.fire(new I.CommentReactionClick({thread:c,comment:s,reaction:G}))},[]);return o.default.createElement("div",{className:u.default.comment_reactions},(a=s.reactions)===null||a===void 0?void 0:a.filter(G=>G.count!==0).map(G=>o.default.createElement(f.Button,{key:G.label,onClick:()=>m(G),type:"secondary",size:"small",title:G.label,className:u.default.comment_reaction,iconClass:d.fromIcon("",G.iconPath.toString(),v.IconType.Background)},"\xA0",G.count)))})},54143:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsBody=void 0;const n=t(85608),l=n.__importDefault(t(14041)),o=n.__importDefault(t(43144)),h=t(84605),f=n.__importDefault(t(38877)),b=t(70154),g=({root:v,children:I})=>o.default.createPortal(I,v);e.CommentsBody=l.default.memo(({body:v})=>{const I=l.default.useRef(null),[u,c]=l.default.useState(null),s=l.default.useMemo(()=>{const a=(0,h.createMarkedRenderer)();return a.link=(r,d,m)=>`<a target="_blank" rel="noopener" href="${r}" title="${d}">${m}</a>`,a},[]);return l.default.useEffect(()=>{if(I.current){const a=I.current.attachShadow({mode:"open"});u||c(a)}},[]),l.default.createElement("div",{ref:I,className:f.default.comment_shadow_box},u&&l.default.createElement(g,{root:u},l.default.createElement("style",null,b.markdownCss),l.default.createElement("div",{dangerouslySetInnerHTML:{__html:(0,h.toMarkdownHtml)(typeof v=="string"?v:v.value,{gfm:!0,breaks:!1,pedantic:!1,smartLists:!0,smartypants:!1,renderer:s})}})))})},66480:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsFeatureRegistry=void 0;const n=t(85608),l=t(76003);let o=class{constructor(){this.config={},this.options={},this.panelTreeNodeHandlers=[],this.mentionsOptions={},this.providerFeature=new Map}registerConfig(f){this.config=Object.assign(Object.assign({},this.config),f)}registerPanelTreeNodeHandler(f){this.panelTreeNodeHandlers.push(f)}registerPanelOptions(f){this.options=Object.assign(Object.assign({},this.options),f)}registerFileUploadHandler(f){this.fileUploadHandler=f}registerMentionsOptions(f){this.mentionsOptions=f}registerZoneWidgetRender(f){this.zoneWidgetRender=f}getConfig(){return this.config}getCommentsPanelOptions(){return this.options}getCommentsPanelTreeNodeHandlers(){return this.panelTreeNodeHandlers}getFileUploadHandler(){return this.fileUploadHandler}getMentionsOptions(){return this.mentionsOptions}getZoneWidgetRender(){return this.zoneWidgetRender}registerProviderFeature(f,b){this.providerFeature.set(f,b)}getProviderFeature(f){return this.providerFeature.get(f)}};o=n.__decorate([(0,l.Injectable)()],o),e.CommentsFeatureRegistry=o},37357:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentItem=void 0;const n=t(85608),l=t(25150),o=n.__importDefault(t(14041)),h=t(97267),f=t(41869),b=t(25918),g=t(93899),v=t(69635),I=t(15504),u=t(54143),c=t(42018),s=n.__importDefault(t(38877)),a=({timestamp:m})=>{const G=o.default.useMemo(()=>{const p=new Date(m);return(0,f.toLocalString)(p)},[m]);return o.default.createElement("span",{className:s.default.comment_item_timestamp},G)},r=(m,G)=>{const p=(0,f.useInjectable)(g.AbstractMenuService),{body:N,contextValue:W}=G,[Z,y]=o.default.useState(""),E=(0,f.useInjectable)(v.ICommentsFeatureRegistry),R=o.default.useMemo(()=>E.getFileUploadHandler(),[]);o.default.useEffect(()=>{y(N)},[N]);const A=o.default.useMemo(()=>m.createScoped(),[]),w=o.default.useMemo(()=>A.createKey("commentIsEmpty",!G.body),[]),F=o.default.useMemo(()=>p.createMenu(g.MenuId.CommentsCommentContext,A),[]),V=o.default.useMemo(()=>p.createMenu(g.MenuId.CommentsCommentTitle,A),[]),Y=o.default.useRef(A.createKey("comment",W));o.default.useEffect(()=>{Y.current.set(W)},[W]);const _=o.default.useCallback(X=>{w.set(!X.target.value),y(X.target.value)},[]),H=o.default.useCallback(async X=>{if(R){const S=await R(Z,X);y(Q=>{const k=Q+S;return w.set(!k),k})}},[Z]);return[Z,y,_,F,V,H]},d=(0,l.observer)(({reply:m,thread:G})=>{var p;const{contextKeyService:N}=G,{author:W,label:Z,body:y,mode:E,timestamp:R}=m,A=(p=W.iconPath)===null||p===void 0?void 0:p.toString(),[w,F,V,Y,_,H]=r(N,m),X=o.default.useMemo(()=>{const S=(0,f.toMarkdownHtml)(typeof y=="string"?y:y.value);return/^\<p\>[^<>]+\<\/p\>\n$/.test(S)},[y]);return o.default.createElement("div",{className:s.default.reply_item},(0,f.isUndefined)(E)||E===v.CommentMode.Preview?o.default.createElement("div",null,X?o.default.createElement(o.default.Fragment,null,A&&o.default.createElement("img",{className:s.default.reply_item_icon,src:A,alt:W.name}),o.default.createElement("span",{className:s.default.comment_item_author_name},W.name),R&&o.default.createElement(a,{timestamp:R}),typeof Z=="string"?o.default.createElement("span",{className:s.default.comment_item_label},Z):Z," : ",o.default.createElement("span",{className:s.default.comment_item_body},typeof y=="string"?y:y.value),m.reactions&&m.reactions.length>0&&o.default.createElement(I.CommentReactionSwitcher,{className:s.default.reply_item_title,thread:G,comment:m}),o.default.createElement(b.InlineActionBar,{separator:"inline",className:s.default.reply_item_title,menus:_,context:[{thread:G,comment:m,menuId:g.MenuId.CommentsCommentTitle}],type:"icon"})):o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:s.default.comment_item_markdown_header},o.default.createElement("div",null,A&&o.default.createElement("img",{className:s.default.reply_item_icon,src:A,alt:W.name}),o.default.createElement("span",{className:s.default.comment_item_author_name},W.name),R&&o.default.createElement(a,{timestamp:R}),typeof Z=="string"?o.default.createElement("span",{className:s.default.comment_item_label},Z):Z," : "),o.default.createElement(b.InlineActionBar,{separator:"inline",className:s.default.reply_item_title,menus:_,context:[{thread:G,comment:m,menuId:g.MenuId.CommentsCommentTitle}],type:"icon"})),o.default.createElement(u.CommentsBody,{body:y}))):o.default.createElement("div",null,o.default.createElement(c.CommentsTextArea,{value:typeof w=="string"?w:w.value,autoFocus:!0,onChange:V,dragFiles:H}),o.default.createElement(b.InlineActionBar,{className:s.default.comment_item_reply,menus:Y,context:[{thread:G,comment:m,body:w,menuId:g.MenuId.CommentsCommentContext}],type:"button",separator:"inline",afterClick:()=>{F(y)}})),m.reactions&&m.reactions.length>0&&o.default.createElement(I.CommentReactions,{thread:G,comment:m}))});e.CommentItem=(0,l.observer)(({thread:m,commentThreadContext:G,widget:p})=>{var N,W;const{readOnly:Z,contextKeyService:y}=m,[E,R]=o.default.useState(!1),[A,w]=o.default.useState(""),[F,...V]=m.comments,{author:Y,label:_,body:H,mode:X,timestamp:S}=F,Q=(0,f.isString)(Y.iconPath)?Y.iconPath:!((N=Y.iconPath)===null||N===void 0)&&N.authority?(W=Y.iconPath)===null||W===void 0?void 0:W.toString():"",[k,M,D,J,T,x]=r(y,F),B=(0,f.useInjectable)(v.ICommentsFeatureRegistry),O=o.default.useMemo(()=>B.getFileUploadHandler(),[]),z=o.default.useMemo(()=>y.createKey("commentIsEmpty",!0),[]);function U(te){z.set(!te.target.value),w(te.target.value)}const P=o.default.useCallback(async te=>{if(O){const re=await O(k,te);w(ae=>{const ue=ae+re;return z.set(!ue),ue})}},[A]);return o.default.createElement("div",{className:s.default.comment_item},Q&&o.default.createElement("img",{className:s.default.comment_item_icon,src:Q,alt:Y.name}),o.default.createElement("div",{className:s.default.comment_item_content},o.default.createElement("div",{className:s.default.comment_item_head},o.default.createElement("div",{className:s.default.comment_item_name},o.default.createElement("span",{className:s.default.comment_item_author_name},Y.name),S&&o.default.createElement(a,{timestamp:S}),typeof _=="string"?o.default.createElement("span",{className:s.default.comment_item_label},_):_),o.default.createElement("div",{className:s.default.comment_item_actions},F.reactions&&F.reactions.length>0&&o.default.createElement(I.CommentReactionSwitcher,{thread:m,comment:F}),!Z&&o.default.createElement(h.Button,{className:s.default.comment_item_reply_button,size:"small",type:"secondary",onClick:()=>R(!0)},(0,f.localize)("comments.thread.action.reply")),o.default.createElement(b.InlineActionBar,{menus:T,context:[{thread:m,comment:F,menuId:g.MenuId.CommentsCommentTitle}],type:"button"}))),(0,f.isUndefined)(X)||X===v.CommentMode.Preview?o.default.createElement(u.CommentsBody,{body:H}):o.default.createElement("div",null,o.default.createElement(c.CommentsTextArea,{value:typeof k=="string"?k:k.value,autoFocus:!0,onChange:D,dragFiles:x}),o.default.createElement(b.InlineActionBar,{className:s.default.comment_item_context,menus:J,context:[{thread:m,comment:F,body:k,menuId:g.MenuId.CommentsCommentContext}],separator:"inline",type:"button",afterClick:()=>{M(H)}})),F.reactions&&F.reactions.length>0&&o.default.createElement(I.CommentReactions,{thread:m,comment:F}),(V.length>0||E)&&o.default.createElement("div",{className:s.default.comment_item_reply_wrap},V.map(te=>o.default.createElement(d,{key:te.id,thread:m,reply:te})),E&&o.default.createElement("div",null,o.default.createElement(c.CommentsTextArea,{autoFocus:!0,value:A,onChange:U,placeholder:`${(0,f.localize)("comments.reply.placeholder")}...`,dragFiles:P}),o.default.createElement(b.InlineActionBar,{className:s.default.comment_item_reply,menus:G,context:[{thread:m,text:A,widget:p,menuId:g.MenuId.CommentsCommentThreadContext}],separator:"inline",type:"button",afterClick:()=>{w(""),R(!1)}})))))})},53878:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsPanel=void 0;const n=t(85608),l=n.__importStar(t(14041)),o=t(97267),h=t(41869),f=t(69635),b=n.__importDefault(t(38877)),g=t(5167),v=t(47842),I=({viewState:u})=>{const c=(0,h.useInjectable)(v.CommentModelService),[s,a]=(0,l.useState)(),r=(0,l.useRef)(null),d=(0,h.useInjectable)(f.ICommentsFeatureRegistry),{handleTreeBlur:m}=c;(0,l.useEffect)(()=>{a(c.treeModel);const E=c.onDidUpdateTreeModel(R=>{a(R)});return()=>{E.dispose()}},[]);const G=(0,l.useCallback)(E=>{c.handleTreeHandler(E)},[c]),p=(0,l.useCallback)(E=>l.default.createElement(g.CommentNodeRendered,{item:E.item,itemType:E.itemType,decorations:c.decorations.getDecorations(E.item),defaultLeftPadding:8,onTwistierClick:c.handleTwistierClick,onClick:c.handleItemClick,leftPadding:8}),[s]),N=(0,l.useMemo)(()=>d.getCommentsPanelOptions(),[]),W=(0,l.useMemo)(()=>N.header,[N]),Z=(0,l.useMemo)(()=>l.default.createElement("div",{className:b.default.panel_placeholder},N.defaultPlaceholder||(0,h.localize)("comments.panel.placeholder")),[N]),y=(0,l.useCallback)(()=>s?l.default.createElement(o.RecycleTree,{height:u.height-(W?.height||0),itemHeight:g.COMMENT_TREE_NODE_HEIGHT,onReady:G,model:s,placeholder:()=>Z},p):Z,[s,W,u.height]);return l.default.createElement("div",{className:b.default.comment_panel,tabIndex:-1,onBlur:m,ref:r},W?.component,y())};e.CommentsPanel=I},42018:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsTextArea=void 0;const n=t(85608),l=n.__importDefault(t(14041)),o=t(34801),h=t(97267),f=t(41869),b=t(69635),g=t(54143),v=n.__importDefault(t(38877)),I=t(73136),u="@",c="@[__display__](__id__)",s=(a,r)=>`@${r}`;e.CommentsTextArea=l.default.forwardRef((a,r)=>{const{focusDelay:d=0,autoFocus:m=!1,placeholder:G="",onFocus:p,onBlur:N,onChange:W,maxRows:Z=10,minRows:y=2,value:E,initialHeight:R,dragFiles:A}=a,[w,F]=l.default.useState(0),V=(0,f.useInjectable)(b.ICommentsFeatureRegistry),Y=l.default.useRef(null),_=l.default.useRef(null),H=l.default.useRef(null);l.default.useImperativeHandle(r,()=>Y.current);const X=l.default.useCallback(async J=>{var T;J.stopPropagation(),J.preventDefault();const x=(T=J.dataTransfer)===null||T===void 0?void 0:T.files;x&&A&&await A(x),Y.current&&(Y.current.focus(),Q(Y.current.value))},[A]),S=l.default.useCallback(J=>{J.stopPropagation(),J.preventDefault(),J.dataTransfer.dropEffect="copy"},[]),Q=l.default.useCallback(J=>{const T=Y.current;if(T){const x=J.toString().length;T.setSelectionRange(x,x)}},[]);l.default.useEffect(()=>{var J;const T=Y.current;if(!T)return;R&&T.style&&(T.style.height=R),d&&setTimeout(()=>{T.focus({preventScroll:!0})},d),Q(E);function x(B){var O,z,U;const P=B.target;P&&(P.nodeName.toUpperCase()==="TEXTAREA"&&P.scrollHeight>P.clientHeight||P.nodeName.toUpperCase()==="UL"||((O=P.parentElement)===null||O===void 0?void 0:O.nodeName.toUpperCase())==="UL"||((U=(z=P.parentElement)===null||z===void 0?void 0:z.parentElement)===null||U===void 0?void 0:U.nodeName.toUpperCase())==="UL")&&B.stopPropagation()}return(J=_.current)===null||J===void 0||J.addEventListener("mousewheel",x,!0),()=>{var B;(B=_.current)===null||B===void 0||B.removeEventListener("mousewheel",x,!0)}},[]),l.default.useEffect(()=>{w===0&&(setTimeout(()=>{var J;(J=Y.current)===null||J===void 0||J.focus({preventScroll:!0})},d),Q(E))},[w]);const k=l.default.useMemo(()=>(0,I.getMentionBoxStyle)({minRows:y,maxRows:Z}),[y,Z]),M=l.default.useMemo(()=>V.getMentionsOptions(),[V]),D=l.default.useCallback(async(J,T)=>{if(M.providerData){const x=await M.providerData(J);T(x)}else T([])},[M]);return l.default.createElement("div",{className:v.default.textarea_container},l.default.createElement(h.Tabs,{mini:!0,value:w,onChange:J=>F(J),tabs:[(0,f.localize)("comments.thread.textarea.write"),(0,f.localize)("comments.thread.textarea.preview")]}),l.default.createElement("div",null,w===0?l.default.createElement("div",{ref:_},l.default.createElement(o.MentionsInput,{autoFocus:m,onDragOver:S,onDrop:X,inputRef:Y,ref:H,value:E,placeholder:G,onChange:W,onFocus:p,onBlur:N,style:k},l.default.createElement(o.Mention,{markup:M.markup||c,renderSuggestion:M.renderSuggestion,trigger:u,data:D,displayTransform:M.displayTransform||s}))):l.default.createElement("div",{className:v.default.textarea_preview},l.default.createElement(g.CommentsBody,{body:E}))))})},49867:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsThread=void 0;const n=t(85608),l=t(83794),o=t(76003),h=t(41869),f=t(91830),b=t(54414),g=t(69635),v=t(90366);let I=class extends h.Disposable{set contextValue(c){this._contextKeyService.createKey("thread",c)}get contextValue(){return this._contextKeyService.getContextValue("thread")}get onDidChangeCollapsibleState(){return this.onDidChangeCollapsibleStateEmitter.event}get onDidChange(){return this.onDidChangeEmitter.event}constructor(c,s,a,r){super(),this.uri=c,this.range=s,this.providerId=a,this.options=r,this.comments=[],this._readOnly=!1,this.onDidChangeCollapsibleStateEmitter=new h.Emitter,this.widgets=new Map,this._id=`thread_${(0,h.uuid)()}`,this.onDidChangeEmitter=new h.Emitter,this.toggle=N=>{if(this.comments.length>0){const W=this.widgets.get(N);W&&W.toggle()}else this.dispose()},(0,l.makeObservable)(this),this.updateComments(r.comments?r.comments.map(N=>Object.assign(Object.assign({},N),{id:(0,h.uuid)()})):[]),this.data=this.options.data,this._contextKeyService=this.registerDispose(this.globalContextKeyService.createScoped()),new f.ResourceContextKey(this._contextKeyService).set(c),this._contextKeyService.createKey("thread",r.contextValue),this.readOnly=!!r.readOnly,this.label=r.label,this.isCollapsed=!!this.options.isCollapsed;const m=this._contextKeyService.createKey("threadsLength",this.commentsService.getThreadsByUri(c).length),G=this._contextKeyService.createKey("commentsLength",this.comments.length),p=this._contextKeyService.createKey("commentThreadIsEmpty",!this.comments.length);this._contextKeyService.createKey("commentController",a),(0,l.autorun)(()=>{G.set(this.comments.length),p.set(!this.comments.length)}),(0,l.autorun)(()=>{this.isCollapsed?this.hideAll():this.showAll()}),this.addDispose(this.commentsService.onThreadsChanged(N=>{N.uri.isEqual(c)&&m.set(this.commentsService.getThreadsByUri(c).length)})),this.addDispose({dispose:()=>{this.updateComments([])}}),this.onDidChangeEmitter.fire()}updateComments(c){this.comments=c}getWidgetByEditor(c){return this.widgets.get(c)}get id(){return this._id}get contextKeyService(){return this._contextKeyService}get readOnly(){return this._readOnly}set readOnly(c){(0,l.runInAction)(()=>this._readOnly=c),this._contextKeyService.createKey("readOnly",this._readOnly)}get threadHeaderTitle(){if(this.label)return this.label;if(this.comments.length){const c=new Set(this.comments.map(s=>`@${s.author.name}`));return`${(0,h.localize)("comments.participants")}: `+[...c].join(" ")}else return(0,h.localize)("comments.zone.title")}getEditorsByUri(c){return this.editorCollectionService.listEditors().filter(s=>{var a;return(a=s.currentUri)===null||a===void 0?void 0:a.isEqual(c)})}addWidgetByEditor(c){const s=this.injector.get(v.CommentsZoneWidget,[c,this,{arrowColor:"var(--peekView-border)"}]);return this.addDispose(s.onChangeZoneWidget(()=>{const a=this.commentsService.commentsThreads.filter(m=>this.isEqual(m)),r=a.findIndex(m=>m===this),d=a.slice(r+1);for(const m of d)if(m.isShowWidget(c)){const G=m.getWidgetByEditor(c);G?.resize()}})),this.addDispose(s),this.widgets.set(c,s),c.onDispose(()=>{s.dispose(),this.widgets.delete(c)}),s}show(c){if(c){let s=this.widgets.get(c);s||(s=this.addWidgetByEditor(c)),s.show()}else this.getEditorsByUri(this.uri).forEach(a=>{var r;let d=this.widgets.get(a);d||(d=this.addWidgetByEditor(a)),!((r=a.currentUri)===null||r===void 0)&&r.isEqual(this.uri)&&d.show()})}showWidgetsIfShowed(){var c;for(const s of this.getEditorsByUri(this.uri)){let a=this.widgets.get(s);a||(a=this.addWidgetByEditor(s)),!((c=s.currentUri)===null||c===void 0)&&c.isEqual(this.uri)&&a.isShow&&a.show()}}hideWidgetsByDispose(){var c;for(const[s,a]of this.widgets)!(!((c=s.currentUri)===null||c===void 0)&&c.isEqual(this.uri))&&a.dispose()}isShowWidget(c){if(c){const s=this.widgets.get(c);return s?s.isShow:!1}else{for(const[,s]of this.widgets)return s.isShow;return!1}}hide(c){if(c){const s=this.widgets.get(c);s?.hide()}else this.hideAll()}showAll(){this.isCollapsed=!1;for(const[,c]of this.widgets)c.show();this.onDidChangeCollapsibleStateEmitter.fire(g.CommentThreadCollapsibleState.Expanded)}hideAll(c){var s;this.isCollapsed=!0;for(const[a,r]of this.widgets)c?!(!((s=a.currentUri)===null||s===void 0)&&s.isEqual(this.uri))&&r.dispose():r.hide();this.onDidChangeCollapsibleStateEmitter.fire(g.CommentThreadCollapsibleState.Collapsed)}addComment(...c){this.comments.push(...c.map(s=>Object.assign(Object.assign({},s),{id:(0,h.uuid)()}))),this.onDidChangeEmitter.fire()}removeComment(c){const s=this.comments.findIndex(a=>a===c);s!==-1&&this.comments.splice(s,1),this.onDidChangeEmitter.fire()}isEqual(c){return c.uri.isEqual(this.uri)&&c.range.startLineNumber===this.range.startLineNumber&&c.range.endLineNumber===this.range.endLineNumber}};n.__decorate([(0,o.Autowired)(g.ICommentsService),n.__metadata("design:type",Object)],I.prototype,"commentsService",void 0),n.__decorate([(0,o.Autowired)(h.IContextKeyService),n.__metadata("design:type",Object)],I.prototype,"globalContextKeyService",void 0),n.__decorate([(0,o.Autowired)(b.EditorCollectionService),n.__metadata("design:type",b.EditorCollectionService)],I.prototype,"editorCollectionService",void 0),n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],I.prototype,"injector",void 0),n.__decorate([l.observable.shallow,n.__metadata("design:type",Array)],I.prototype,"comments",void 0),n.__decorate([l.observable,n.__metadata("design:type",Object)],I.prototype,"label",void 0),n.__decorate([l.observable,n.__metadata("design:type",Object)],I.prototype,"_readOnly",void 0),n.__decorate([l.observable,n.__metadata("design:type",Boolean)],I.prototype,"isCollapsed",void 0),n.__decorate([l.action,n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[Array]),n.__metadata("design:returntype",void 0)],I.prototype,"updateComments",null),n.__decorate([l.computed,n.__metadata("design:type",Boolean),n.__metadata("design:paramtypes",[Boolean])],I.prototype,"readOnly",null),n.__decorate([l.computed,n.__metadata("design:type",Object),n.__metadata("design:paramtypes",[])],I.prototype,"threadHeaderTitle",null),n.__decorate([l.action,n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",void 0)],I.prototype,"showAll",null),n.__decorate([l.action,n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[Boolean]),n.__metadata("design:returntype",void 0)],I.prototype,"hideAll",null),n.__decorate([l.action,n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[Object]),n.__metadata("design:returntype",void 0)],I.prototype,"addComment",null),n.__decorate([l.action,n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[Object]),n.__metadata("design:returntype",void 0)],I.prototype,"removeComment",null),I=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[h.URI,Object,String,Object])],I),e.CommentsThread=I},73804:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsZoneService=void 0;const n=t(85608),l=t(76003),o=t(93899),h=t(43718),f=t(69635),b=t(49867);let g=class extends h.Disposable{constructor(I){super(),this.thread=I}setCurrentCommentThread(I){this.commentService.setCurrentCommentThread(I)}get commentThreadTitle(){return this.registerDispose(this.menuService.createMenu(o.MenuId.CommentsCommentThreadTitle,this.thread.contextKeyService))}get commentThreadContext(){return this.registerDispose(this.menuService.createMenu(o.MenuId.CommentsCommentThreadContext,this.thread.contextKeyService))}};n.__decorate([(0,l.Autowired)(o.AbstractMenuService),n.__metadata("design:type",o.AbstractMenuService)],g.prototype,"menuService",void 0),n.__decorate([(0,l.Autowired)(f.ICommentsService),n.__metadata("design:type",Object)],g.prototype,"commentService",void 0),n.__decorate([h.memoize,n.__metadata("design:type",Object),n.__metadata("design:paramtypes",[])],g.prototype,"commentThreadTitle",null),n.__decorate([h.memoize,n.__metadata("design:type",Object),n.__metadata("design:paramtypes",[])],g.prototype,"commentThreadContext",null),g=n.__decorate([(0,l.Injectable)({multiple:!0}),n.__param(0,(0,l.Optional)()),n.__metadata("design:paramtypes",[b.CommentsThread])],g),e.CommentsZoneService=g},90366:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsZoneWidget=void 0;const n=t(85608),l=n.__importDefault(t(53373)),o=t(25150),h=n.__importDefault(t(14041)),f=n.__importDefault(t(25873)),b=t(76003),g=t(41869),v=t(25918),I=t(93899),u=t(20303),c=t(69635),s=t(37357),a=t(42018),r=t(73804),d=n.__importDefault(t(38877)),m=(0,o.observer)(({thread:p,widget:N})=>{const{comments:W,threadHeaderTitle:Z,contextKeyService:y}=p,R=(0,g.useInjectable)(b.INJECTOR_TOKEN).get(r.CommentsZoneService,[p]),A=(0,g.useInjectable)(c.ICommentsFeatureRegistry),w=h.default.useMemo(()=>A.getFileUploadHandler(),[]),[F,V]=h.default.useState(""),Y=h.default.useMemo(()=>y.createKey("commentIsEmpty",!F),[]),_=R.commentThreadTitle,H=R.commentThreadContext,X=h.default.useCallback(T=>{const{value:x}=T.target;V(x),Y.set(!x)},[]),S=h.default.useMemo(()=>{var T;return((T=A.getProviderFeature(p.providerId))===null||T===void 0?void 0:T.placeholder)||`${(0,g.localize)("comments.reply.placeholder")}...`},[]),Q=h.default.useCallback(async T=>{if(w){const x=await w(F,T);V(B=>{const O=B+x;return Y.set(!O),O})}},[F]);h.default.useEffect(()=>{const T=N.onFirstDisplay(()=>{setTimeout(()=>{N.coreEditor.monacoEditor.revealLine(p.range.endLineNumber+1)},0)});return()=>{T.dispose()}},[]);const k=h.default.useCallback(()=>{R.setCurrentCommentThread(R.thread)},[]),M=h.default.useCallback(()=>{R.setCurrentCommentThread(void 0)},[]),D=h.default.useCallback(()=>{R.setCurrentCommentThread(R.thread)},[]),J=h.default.useCallback(()=>{R.setCurrentCommentThread(void 0)},[]);return h.default.createElement("div",{tabIndex:-1,onMouseOver:k,onMouseOut:M,onFocus:D,onBlur:J,className:(0,l.default)(p.options.threadClassName,d.default.comment_container)},h.default.createElement("div",{className:(0,l.default)(p.options.threadHeadClassName,d.default.head)},h.default.createElement("div",{className:d.default.review_title},Z),h.default.createElement(v.InlineActionBar,{menus:_,context:[{thread:p,widget:N,menuId:I.MenuId.CommentsCommentThreadTitle}],separator:"inline",type:"icon"})),h.default.createElement("div",{className:d.default.comment_body},W.length>0?h.default.createElement(s.CommentItem,{widget:N,commentThreadContext:H,thread:p}):h.default.createElement("div",null,h.default.createElement(a.CommentsTextArea,{focusDelay:100,initialHeight:"auto",value:F,onChange:X,placeholder:S,dragFiles:Q}),h.default.createElement("div",{className:d.default.comment_bottom_actions},h.default.createElement(v.InlineActionBar,{className:d.default.comment_reply_actions,separator:"inline",type:"button",context:[{text:F,widget:N,thread:p,menuId:I.MenuId.CommentsCommentThreadContext}],menus:H})))))});let G=class extends u.ResizeZoneWidget{_fillContainer(){}constructor(N,W,Z){super(N.monacoEditor,W.range,Object.assign(Object.assign({},Z),{showInHiddenAreas:!0})),this._onShow=new g.Emitter,this.onShow=this._onShow.event,this._onHide=new g.Emitter,this.onHide=this._onHide.event,this._editor=N,this._wrapper=document.createElement("div"),this._isShow=!W.isCollapsed,this._container.appendChild(this._wrapper),this.observeContainer(this._wrapper);const y=this.commentsFeatureRegistry.getZoneWidgetRender();f.default.createRoot(this._wrapper).render(h.default.createElement(g.ConfigProvider,{value:this.appConfig},y?y(W,this):h.default.createElement(m,{thread:W,widget:this})))}get coreEditor(){return this._editor}get isShow(){return this._isShow}show(){super.show(),this._isShow=!0,this._onShow.fire()}hide(){super.dispose(),this._isShow=!1,this._onHide.fire()}toggle(){this._isShow?this.hide():this.show()}applyClass(){}applyStyle(){}};n.__decorate([(0,b.Autowired)(g.AppConfig),n.__metadata("design:type",Object)],G.prototype,"appConfig",void 0),n.__decorate([(0,b.Autowired)(c.ICommentsFeatureRegistry),n.__metadata("design:type",Object)],G.prototype,"commentsFeatureRegistry",void 0),G=n.__decorate([(0,b.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object,Object,Object])],G),e.CommentsZoneWidget=G},62604:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsBrowserContribution=void 0;const n=t(85608),l=t(76003),o=t(41869),h=t(93899),f=t(57517),b=t(63067),g=t(69635),v=t(47842);let I=class extends o.Disposable{onStart(){this.registerCommentsFeature(),this.listenToCreateCommentsPanel(),this.commentsService.init()}get panelBadge(){const c=this.commentsService.commentsThreads.length;return c?c+"":""}registerCommands(c){c.registerCommand({id:g.CollapseId,label:"%comments.panel.action.collapse%",iconClass:(0,o.getIcon)("collapse-all")},{execute:()=>{this.commentModelService.collapsedAll()}}),c.registerCommand({id:g.CloseThreadId,label:"%comments.thread.action.close%",iconClass:(0,o.getIcon)("up")},{execute:s=>{const{thread:a,widget:r}=s;a.comments.length?r.isShow&&r.toggle():a.dispose()}}),c.registerCommand({id:g.SwitchCommandReaction},{execute:s=>{this.eventBus.fire(new g.CommentReactionClick(s))}})}registerMenus(c){c.registerMenuItem(h.MenuId.CommentsCommentThreadTitle,{command:g.CloseThreadId,group:"inline",order:Number.MAX_SAFE_INTEGER})}registerToolbarItems(c){c.registerItem({id:g.CollapseId,viewId:g.CommentPanelId,command:g.CollapseId,tooltip:(0,o.localize)("comments.panel.action.collapse")})}registerCommentsFeature(){this.contributions.getContributions().forEach((c,s)=>{this.addDispose(this.commentsService.registerCommentRangeProvider(`contribution_${s}`,{getCommentingRanges:a=>c.provideCommentingRanges(a)})),c.registerCommentsFeature&&c.registerCommentsFeature(this.commentsFeatureRegistry)})}listenToCreateCommentsPanel(){this.commentsFeatureRegistry.getCommentsPanelOptions().defaultShow?this.commentsService.registerCommentPanel():o.Event.once(this.commentsService.onThreadsCreated)(()=>{this.commentsService.registerCommentPanel()}),this.addDispose(o.Event.debounce(this.commentsService.onThreadsChanged,()=>{},100)(()=>{const c=this.layoutService.getTabbarHandler(g.CommentPanelId);c?.setBadge(this.panelBadge)},this))}registerEditorFeature(c){c.registerEditorFeatureContribution({contribute:s=>this.commentsService.handleOnCreateEditor(s),provideEditorOptionsForUri:async s=>(await this.commentsService.getContributionRanges(s)).length?{lineDecorationsWidth:25,lineNumbersMinChars:5}:{}})}};n.__decorate([(0,l.Autowired)(g.ICommentsService),n.__metadata("design:type",Object)],I.prototype,"commentsService",void 0),n.__decorate([(0,l.Autowired)(b.IMainLayoutService),n.__metadata("design:type",Object)],I.prototype,"layoutService",void 0),n.__decorate([(0,l.Autowired)(g.ICommentsFeatureRegistry),n.__metadata("design:type",Object)],I.prototype,"commentsFeatureRegistry",void 0),n.__decorate([(0,l.Autowired)(g.CommentsContribution),n.__metadata("design:type",Object)],I.prototype,"contributions",void 0),n.__decorate([(0,l.Autowired)(o.IEventBus),n.__metadata("design:type",Object)],I.prototype,"eventBus",void 0),n.__decorate([(0,l.Autowired)(v.CommentModelService),n.__metadata("design:type",v.CommentModelService)],I.prototype,"commentModelService",void 0),I=n.__decorate([(0,o.Domain)(o.ClientAppContribution,f.BrowserEditorContribution,o.CommandContribution,o.TabBarToolbarContribution,h.MenuContribution)],I),e.CommentsBrowserContribution=I},55011:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsService=void 0;const n=t(85608),l=n.__importDefault(t(53435)),o=n.__importDefault(t(87809)),h=t(76003),f=t(41869),b=t(57517),g=t(63067),v=t(20868),I=n.__importStar(t(20868)),u=t(62663),c=t(52416),s=n.__importStar(t(88104)),a=t(69635),r=t(53878),d=t(49867),m=t(53711);let G=class extends f.Disposable{constructor(){super(...arguments),this.decorationChangeEmitter=new f.Emitter,this.threads=new Map,this.threadsChangeEmitter=new f.Emitter,this.threadsCommentChangeEmitter=new f.Emitter,this.commentRangeProviderChangeEmitter=new f.Emitter,this.onDidChangeCurrentCommentThreadEmitter=new f.Emitter,this.threadsCreatedEmitter=new f.Emitter,this.rangeProviderMap=new Map,this.rangeOwner=new Map,this.providerDecorationCache=new f.LRUCache(1e4),this.commentRangeDecorationMap=new Map,this.shouldShowCommentsSchemes=new Set(["file","git","diff"]),this.decorationProviderDisposer=f.Disposable.NULL,this.activeThreadDecorationIds=[],this.allEditors=[],this.editorCommentingRangeSpaceReservedMap=new Map,this.editorLineDecorationsWidthMap=new Map}get commentsThreads(){return[...this.threads.values()]}get isMultiCommentsForSingleLine(){var N;return!!(!((N=this.commentsFeatureRegistry.getConfig())===null||N===void 0)&&N.isMultiCommentsForSingleLine)}get currentAuthorAvatar(){var N,W;return(W=(N=this.commentsFeatureRegistry.getConfig())===null||N===void 0?void 0:N.author)===null||W===void 0?void 0:W.avatar}get filterThreadDecoration(){var N;return(N=this.commentsFeatureRegistry.getConfig())===null||N===void 0?void 0:N.filterThreadDecoration}get onThreadsChanged(){return this.threadsChangeEmitter.event}get onThreadsCommentChange(){return this.threadsCommentChangeEmitter.event}get onThreadsCreated(){return this.threadsCreatedEmitter.event}get onCommentRangeProviderChange(){return this.commentRangeProviderChangeEmitter.event}get onDidChangeCurrentCommentThread(){return this.onDidChangeCurrentCommentThreadEmitter.event}setCurrentCommentThread(N){this.onDidChangeCurrentCommentThreadEmitter.fire(N)}createThreadDecoration(N){var W;const Z=N.comments.length===0?this.currentAuthorAvatar:(W=N.comments[0].author.iconPath)===null||W===void 0?void 0:W.toString(),y=Z?`${this.iconService.fromIcon("",Z,c.IconType.Background)} avatar-icon`:this.iconService.fromString("$(comment)"),E={description:"comments-thread-decoration",glyphMarginClassName:Z?["comment-thread",y].join(" "):["comment-range","comment-thread",y].join(" ")};return s.ModelDecorationOptions.createDynamic(E)}updateActiveThreadDecoration(N){var W;const Z=this.getCurrentEditor(N?.uri);if(!Z)return;(W=this.currentThreadCollapseStateListener)===null||W===void 0||W.dispose();const y=[];if(N){const E=N.range;N.isCollapsed||(this.currentThreadCollapseStateListener=N.onDidChangeCollapsibleState(R=>{R===a.CommentThreadCollapsibleState.Collapsed&&this.updateActiveThreadDecoration(void 0)}),y.push({range:E,options:this.createThreadRangeActiveDecoration()}))}this.activeThreadDecorationIds=Z.monacoEditor.deltaDecorations(this.activeThreadDecorationIds,y)}createDottedRangeDecoration(){const N={description:"comments-multiline-hover-decoration",linesDecorationsClassName:["comment-range","multiline-add"].join(" ")};return s.ModelDecorationOptions.createDynamic(N)}createHoverDecoration(){const N={description:"comments-hover-decoration",linesDecorationsClassName:["comment-range","line-hover","comment-add"].join(" ")};return s.ModelDecorationOptions.createDynamic(N)}createThreadRangeActiveDecoration(){const N={description:"comments-thread-range-active-decoration",isWholeLine:!1,zIndex:20,className:"comment-thread-range-current",shouldFillLineOnLineBreak:!0};return s.ModelDecorationOptions.createDynamic(N)}createThreadRangeDecoration(){const N={description:"comments-thread-range-decoration",isWholeLine:!1,zIndex:20,className:"comment-thread-range",shouldFillLineOnLineBreak:!0};return s.ModelDecorationOptions.createDynamic(N)}createCommentRangeDecoration(){const N={description:"comments-range-decoration",linesDecorationsClassName:["comment-range","comment-diff-added"].join(" ")};return s.ModelDecorationOptions.createDynamic(N)}init(){const N=this.resourceService.getSupportedSchemes();for(const W of N)this.shouldShowCommentsSchemes.add(W);this.addDispose(this.resourceService.onRegisterResourceProvider(W=>{W.scheme&&(this.shouldShowCommentsSchemes.add(W.scheme),this.registerDecorationProvider())})),this.addDispose(this.resourceService.onUnregisterResourceProvider(W=>{W.scheme&&(this.shouldShowCommentsSchemes.delete(W.scheme),this.registerDecorationProvider())})),this.registerDecorationProvider()}getCurrentEditor(N){var W;if(N){for(const Z of this.allEditors)if(!((W=Z.currentUri)===null||W===void 0)&&W.isEqual(N))return this.editor=Z,Z}return this.editor}handleOnCreateEditor(N){this.allEditors.push(N),this.editor=N;const W=new f.Disposable;let Z=[],y=!1;return W.addDispose(N.monacoEditor.onMouseDown(E=>{if(E.target.type===u.monacoBrowser.editor.MouseTargetType.GUTTER_LINE_DECORATIONS&&E.target.element&&E.target.element.className.indexOf("comment-add")>-1){const{target:R}=E;if(R&&R.range){const{range:A}=R;this.startCommentRange=A,E.event.stopPropagation()}}else if(E.target.type===u.monacoBrowser.editor.MouseTargetType.GUTTER_GLYPH_MARGIN&&E.target.element&&E.target.element.className.indexOf("comment-thread")>-1){const{target:R}=E;if(R&&R.range){const{range:A}=R,w=this.commentsThreads.filter(F=>N.currentUri&&F.uri.isEqual(N.currentUri)&&F.range.endLineNumber===A.endLineNumber);w.length&&(w.some(V=>V.isShowWidget(N))?w.forEach(V=>V.hide(N)):w.forEach(V=>V.show(N)))}E.event.stopPropagation()}})),W.addDispose(N.monacoEditor.onMouseUp(async E=>{if(this.startCommentRange){if(y){this.renderCommentRange(N),y=!1,this.startCommentRange=null,this.endCommentRange=null;return}let R=this.startCommentRange;this.endCommentRange&&(this.endCommentRange.startLineNumber<this.startCommentRange.startLineNumber?(R.startColumn=this.endCommentRange.startColumn,R.startLineNumber=this.endCommentRange.startLineNumber):(R.endColumn=this.endCommentRange.endColumn,R.endLineNumber=this.endCommentRange.endLineNumber)),N.currentUri&&(R=await this.getValidRange(R,N.currentUri)),R&&(this.commentsThreads.some(A=>A.comments.length===0&&N.currentUri&&A.uri.isEqual(N.currentUri)&&A.range.startLineNumber===R.startLineNumber&&A.range.endLineNumber===R.endLineNumber)||this.createThread(N.currentUri,R).show(N),E.event.stopPropagation())}else if(E.target.type===u.monacoBrowser.editor.MouseTargetType.GUTTER_LINE_DECORATIONS&&E.target.element&&E.target.element.className.indexOf("comment-range")>-1&&E.target.element.className.indexOf("comment-thread")<0){const{target:R}=E,A=R.range;A&&(this.commentsThreads.some(w=>w.comments.length===0&&N.currentUri&&w.uri.isEqual(N.currentUri)&&w.range.startLineNumber===A.startLineNumber&&w.range.endLineNumber===A.endLineNumber)||this.createThread(N.currentUri,A).show(N),E.event.stopPropagation())}this.startCommentRange=null,this.endCommentRange=null})),W.addDispose(N.monacoEditor.onMouseMove(async E=>{var R,A,w;const F=N.currentUri,V=E.target.range;if(this.startCommentRange){if(!((R=E.target.element)===null||R===void 0)&&R.className||!((w=(A=E.target.element)===null||A===void 0?void 0:A.offsetParent)===null||w===void 0)&&w.className.includes("diff-hidden-lines")&&(y=!0),F&&V){let Y={startLineNumber:this.startCommentRange.startLineNumber,endLineNumber:V.endLineNumber,startColumn:this.startCommentRange.startColumn,endColumn:V.endColumn};this.startCommentRange.startLineNumber>V.startLineNumber&&(Y={startLineNumber:V.startLineNumber,endLineNumber:this.startCommentRange.endLineNumber,startColumn:V.startColumn,endColumn:this.startCommentRange.endColumn}),this.renderCommentRange(N,Y),this.endCommentRange=V}}else if(F&&V&&await this.shouldShowHoverDecoration(F,V)){const Y=[{range:(0,v.positionToRange)(V.startLineNumber),options:this.createHoverDecoration()}];Z=N.monacoEditor.deltaDecorations(Z,Y)}})),W.addDispose(N.monacoEditor.onMouseLeave(async E=>{var R;const A=(R=E.target)===null||R===void 0?void 0:R.range,w=[];!this.startCommentRange&&A&&w.push({range:(0,v.positionToRange)(A.startLineNumber),options:this.createCommentRangeDecoration()}),Z=N.monacoEditor.deltaDecorations(Z,w)})),W.addDispose(this.onCommentRangeProviderChange(()=>{this.renderCommentRange(N)})),W.addDispose(f.Event.any(this.onThreadsChanged,this.onThreadsCommentChange,this.onThreadsCreated)(E=>{const R=this.getCurrentEditor(E.uri);R&&this.renderCommentRange(R),this.updateActiveThreadDecoration(void 0)})),W.addDispose(this.onDidChangeCurrentCommentThread(E=>{this.updateActiveThreadDecoration(E)})),this.tryUpdateReservedSpace(N),W.addDispose(N.monacoEditor.onDidChangeModel(()=>{this.renderCommentRange(N),this.tryUpdateReservedSpace(N)})),W}async getValidRange(N,W){if(!W)return N;const Z=await this.getContributionRanges(W);if(Z.length===0)return N;const y=Z.find(E=>{if(N.startLineNumber>=E.startLineNumber&&N.startLineNumber<=E.endLineNumber)return!0});return y&&y.endLineNumber<N.endLineNumber?{startLineNumber:N.startLineNumber,startColumn:N.startColumn,endLineNumber:y.endLineNumber,endColumn:y.endColumn}:N}ensureCommentingRangeReservedAmount(N){const W=this.getExistingCommentEditorOptions(N),Z=this.editorLineDecorationsWidthMap.get(N.getId());W.lineDecorationsWidth!==Z&&N.updateOptions({lineDecorationsWidth:this.getWithCommentsLineDecorationWidth(N,W.lineDecorationsWidth)})}async tryUpdateReservedSpace(N){if(!N)return;let W=this.editorCommentingRangeSpaceReservedMap.get(N.getId())||!1;const Z=N.currentUri?this.shouldShowCommentsSchemes.has(N.currentUri.scheme):!1,y=this.commentsThreads.some(R=>N.currentUri&&R.uri.isEqual(N.currentUri)&&R.comments.length>0),E=Z||y;if(E)if(W)this.ensureCommentingRangeReservedAmount(N);else{W=!0;const{lineDecorationsWidth:R,extraEditorClassName:A}=this.getExistingCommentEditorOptions(N),w=this.getWithCommentsEditorOptions(N,A,R);this.updateEditorLayoutOptions(N,w.extraEditorClassName,w.lineDecorationsWidth)}else if(!E&&W){W=!1;const{lineDecorationsWidth:R,extraEditorClassName:A}=this.getExistingCommentEditorOptions(N),w=this.getWithoutCommentsEditorOptions(N,A,R);this.updateEditorLayoutOptions(N,w.extraEditorClassName,w.lineDecorationsWidth)}this.editorCommentingRangeSpaceReservedMap.set(N.getId(),W)}getExistingCommentEditorOptions(N){const W=N.monacoEditor.getOption(I.EditorOption.lineDecorationsWidth);let Z=[];const y=N.monacoEditor.getRawOptions().extraEditorClassName;return y&&(Z=y.split(" ")),{lineDecorationsWidth:W,extraEditorClassName:Z}}getWithoutCommentsEditorOptions(N,W,Z){let y=Z;const E=W.findIndex(A=>A==="inline-comment");E>=0&&W.splice(E,1);const R=N.monacoEditor.getOptions();return R.get(I.EditorOption.folding)&&R.get(I.EditorOption.showFoldingControls)!=="never"&&(y+=11),y-=24,{extraEditorClassName:W,lineDecorationsWidth:y}}updateEditorLayoutOptions(N,W,Z){N.updateOptions({extraEditorClassName:W.join(" "),lineDecorationsWidth:Z})}getWithCommentsEditorOptions(N,W,Z){return W.push("inline-comment"),{lineDecorationsWidth:this.getWithCommentsLineDecorationWidth(N,Z),extraEditorClassName:W}}getWithCommentsLineDecorationWidth(N,W){let Z=W;const y=N.monacoEditor.getOptions();return y.get(I.EditorOption.folding)&&y.get(I.EditorOption.showFoldingControls)!=="never"&&(Z-=11),Z+=24,this.editorLineDecorationsWidthMap.set(N.getId(),Z),Z}async renderCommentRange(N,W={startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:0}){if(!N.currentUri)return;const Z=await this.getContributionRanges(N.currentUri);if(Z.length>0){const y=[];Z.map(R=>{if(W.startLineNumber===0&&W.endLineNumber===0)y.push({range:R,options:this.createCommentRangeDecoration()});else if(W.startLineNumber<=R.startLineNumber&&W.endLineNumber>=R.endLineNumber)y.push({range:R,options:this.createDottedRangeDecoration()},{range:R,options:this.createThreadRangeDecoration()});else if(W.endLineNumber>=R.endLineNumber)if(W.startLineNumber<=R.endLineNumber){const A={startLineNumber:W.startLineNumber,endLineNumber:R.endLineNumber,startColumn:W.startColumn,endColumn:R.endColumn},w={startLineNumber:R.startLineNumber,endLineNumber:A.startLineNumber-1,startColumn:R.startColumn,endColumn:A.endColumn};y.push({range:w,options:this.createCommentRangeDecoration()},{range:A,options:this.createDottedRangeDecoration()},{range:A,options:this.createThreadRangeDecoration()})}else y.push({range:R,options:this.createCommentRangeDecoration()});else if(W.endLineNumber<R.endLineNumber)if(W.endLineNumber>=R.startLineNumber)if(W.startLineNumber>=R.startLineNumber){const A={startLineNumber:R.startLineNumber,startColumn:R.startColumn,endLineNumber:W.startLineNumber-1,endColumn:W.startColumn},w={startLineNumber:W.endLineNumber+1,startColumn:W.endColumn,endLineNumber:R.endLineNumber,endColumn:R.endColumn},F=W.startLineNumber!==R.startLineNumber?[{range:A,options:this.createCommentRangeDecoration()}]:[];F.push({range:W,options:this.createDottedRangeDecoration()}),F.push({range:W,options:this.createThreadRangeDecoration()}),F.push({range:w,options:this.createCommentRangeDecoration()}),y.push(...F)}else{const A={startLineNumber:R.startLineNumber,startColumn:R.startColumn,endLineNumber:W.endLineNumber,endColumn:W.endColumn},w={startLineNumber:A.endLineNumber+1,startColumn:A.endColumn,endLineNumber:R.endLineNumber,endColumn:R.endColumn};y.push({range:A,options:this.createDottedRangeDecoration()},{range:A,options:this.createThreadRangeDecoration()},{range:w,options:this.createCommentRangeDecoration()})}else y.push({range:R,options:this.createCommentRangeDecoration()})});const E=this.commentRangeDecorationMap.get(N.currentUri.toString())||[];this.commentRangeDecorationMap.set(N.currentUri.toString(),N.monacoEditor.deltaDecorations(E,y))}else this.commentRangeDecorationMap.set(N.currentUri.toString(),[])}async shouldShowHoverDecoration(N,W){return this.shouldShowCommentsSchemes.has(N.scheme)?(await this.getContributionRanges(N)).some(E=>W.startLineNumber<=E.endLineNumber):!1}createThread(N,W,Z={comments:[],readOnly:!1}){const y=this.getProviderIdsByLine(W.endLineNumber)[0],E=this.injector.get(d.CommentsThread,[N,W,y,Z]);return E.onDispose(()=>{this.threads.delete(E.id),this.threadsChangeEmitter.fire(E),this.decorationChangeEmitter.fire(N)}),E.onDidChange(()=>{this.threadsChangeEmitter.fire(E)}),this.threads.set(E.id,E),this.addDispose(E),this.threadsChangeEmitter.fire(E),this.threadsCreatedEmitter.fire(E),this.decorationChangeEmitter.fire(N),E}getThreadsByUri(N){return this.commentsThreads.filter(W=>W.uri.isEqual(N)).sort((W,Z)=>W.range.startLineNumber-Z.range.startLineNumber)}handleCommentFileNode(N){const W=[],Z=[...this.threads.values()].filter(E=>E.comments.length),y=(0,o.default)(Z,E=>E.uri);return Object.keys(y).map(E=>{var R;const A=y[E];if(A.length===0)return;const w=new f.URI(this.appConfig.workspaceDir),F=new f.URI(E),V=(R=w.relative(F))===null||R===void 0?void 0:R.toString();W.push(new m.CommentFileNode(this,A,V,F.codeUri.fsPath,this.labelService.getIcon(F),F,N))}),W}handleCommentContentNode(N){var W;const Z=[];for(const y of N.threads){const[E]=y.comments,R=typeof E.body=="string"?E.body:E.body.value;let A=`[Ln ${y.range.startLineNumber}]`;y.range.startLineNumber!==y.range.endLineNumber&&(A=`[Ln ${y.range.startLineNumber}-${y.range.endLineNumber}]`),Z.push(new m.CommentContentNode(this,y,R,A,E.author.iconPath&&(!((W=E.author.iconPath)===null||W===void 0)&&W.authority)?this.iconService.fromIcon("",E.author.iconPath.toString(),c.IconType.Background):(0,f.getIcon)("message"),E.author,N.resource,N))}return Z}handleCommentReplyNode(N){const W=[],Z=N.thread,[y,...E]=Z.comments,R=E[E.length-1].author.name;return W.push(new m.CommentReplyNode(this,Z,(0,f.formatLocalize)("comment.reply.count",E?.length||0),(0,f.formatLocalize)("comment.reply.lastReply",R),"",N.resource,N)),W}async resolveChildren(N){let W=[];if(N?m.CommentRoot.isRoot(N)?W=this.handleCommentFileNode(N):m.CommentFileNode.is(N)?W=this.handleCommentContentNode(N):m.CommentContentNode.is(N)&&(W=this.handleCommentReplyNode(N)):W.push(new m.CommentRoot(this)),W.length===1&&m.CommentRoot.isRoot(W[0]))return W;const Z=this.commentsFeatureRegistry.getCommentsPanelTreeNodeHandlers();if(Z.length>0)for(const y of Z)W=y(W);return W}async getContributionRanges(N){const W=this.providerDecorationCache.get(N.toString());if(W)return await W.promise;const Z=this.documentService.getModelReference(N,"Get Comment Range"),y=[];for(const w of this.rangeProviderMap){const[F,V]=w;y.push((async()=>{if(!Z?.instance)return;const Y=await V.getCommentingRanges(Z.instance);return Y&&Y.length&&this.rangeOwner.set(F,Y),Y})())}const E=new f.Deferred;this.providerDecorationCache.set(N.toString(),E);const R=(await Promise.all(y)).filter(Boolean);Z?.dispose();const A=(0,l.default)(R).filter(Boolean);return E.resolve(A),A}fireThreadCommentChange(N){this.threadsCommentChangeEmitter.fire(N)}registerDecorationProvider(){this.decorationProviderDisposer.dispose(),this.decorationProviderDisposer=this.editorDecorationCollectionService.registerDecorationProvider({schemes:[...this.shouldShowCommentsSchemes.values()],key:"comments",onDidDecorationChange:this.decorationChangeEmitter.event,provideEditorDecoration:N=>this.commentsThreads.map(W=>(W.uri.isEqual(N)?W.comments.length&&W.showWidgetsIfShowed():W.hideWidgetsByDispose(),W)).filter(W=>{const Z=W.uri.isEqual(N);return this.filterThreadDecoration?Z&&this.filterThreadDecoration(W):Z}).map(W=>({range:{startLineNumber:W.range.endLineNumber,endLineNumber:W.range.endLineNumber,startColumn:W.range.endColumn,endColumn:W.range.endColumn},options:this.createThreadDecoration(W)}))}),this.addDispose(this.decorationProviderDisposer)}registerCommentPanel(){this.layoutService.getTabbarHandler(a.CommentPanelId)||this.layoutService.collectTabbarComponent([{id:a.CommentPanelId,component:r.CommentsPanel}],Object.assign({badge:this.panelBadge,containerId:a.CommentPanelId,title:(0,f.localize)("comments").toUpperCase(),hidden:!1,activateKeyBinding:"ctrlcmd+shift+c"},this.commentsFeatureRegistry.getCommentsPanelOptions()),"bottom")}get panelBadge(){const N=this.commentsThreads.length;return N?N+"":""}registerCommentRangeProvider(N,W){return this.rangeProviderMap.set(N,W),this.providerDecorationCache.clear(),this.commentRangeProviderChangeEmitter.fire(),f.Disposable.create(()=>{this.rangeProviderMap.delete(N),this.rangeOwner.delete(N),this.providerDecorationCache.clear()})}forceUpdateDecoration(){var N,W,Z;const y=(N=this.workbenchEditorService.currentEditor)===null||N===void 0?void 0:N.currentUri;y&&this.decorationChangeEmitter.fire(y);const E=(Z=(W=this.workbenchEditorService.currentEditorGroup)===null||W===void 0?void 0:W.diffEditor)===null||Z===void 0?void 0:Z.originalEditor.currentUri;E&&this.decorationChangeEmitter.fire(E)}getProviderIdsByLine(N){const W=[];if(this.rangeOwner.size===1)return[this.rangeOwner.keys().next().value];for(const Z of this.rangeOwner){const[y,E]=Z;E&&E.some(R=>R.startLineNumber<=N&&N<=R.endLineNumber)&&W.push(y)}return W}};n.__decorate([(0,h.Autowired)(h.INJECTOR_TOKEN),n.__metadata("design:type",h.Injector)],G.prototype,"injector",void 0),n.__decorate([(0,h.Autowired)(f.AppConfig),n.__metadata("design:type",Object)],G.prototype,"appConfig",void 0),n.__decorate([(0,h.Autowired)(b.IEditorDecorationCollectionService),n.__metadata("design:type",Object)],G.prototype,"editorDecorationCollectionService",void 0),n.__decorate([(0,h.Autowired)(c.IIconService),n.__metadata("design:type",Object)],G.prototype,"iconService",void 0),n.__decorate([(0,h.Autowired)(f.LabelService),n.__metadata("design:type",f.LabelService)],G.prototype,"labelService",void 0),n.__decorate([(0,h.Autowired)(a.ICommentsFeatureRegistry),n.__metadata("design:type",Object)],G.prototype,"commentsFeatureRegistry",void 0),n.__decorate([(0,h.Autowired)(b.IEditorDocumentModelService),n.__metadata("design:type",Object)],G.prototype,"documentService",void 0),n.__decorate([(0,h.Autowired)(g.IMainLayoutService),n.__metadata("design:type",Object)],G.prototype,"layoutService",void 0),n.__decorate([(0,h.Autowired)(b.WorkbenchEditorService),n.__metadata("design:type",b.WorkbenchEditorService)],G.prototype,"workbenchEditorService",void 0),n.__decorate([(0,h.Autowired)(b.ResourceService),n.__metadata("design:type",b.ResourceService)],G.prototype,"resourceService",void 0),n.__decorate([f.memoize,n.__metadata("design:type",Object),n.__metadata("design:paramtypes",[])],G.prototype,"isMultiCommentsForSingleLine",null),n.__decorate([f.memoize,n.__metadata("design:type",Object),n.__metadata("design:paramtypes",[])],G.prototype,"currentAuthorAvatar",null),n.__decorate([f.memoize,n.__metadata("design:type",Object),n.__metadata("design:paramtypes",[])],G.prototype,"filterThreadDecoration",null),G=n.__decorate([(0,h.Injectable)()],G),e.CommentsService=G},54230:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsModule=void 0;const n=t(85608),l=t(76003),o=t(41869),h=t(69635),f=t(66480),b=t(62604),g=t(55011),v=t(47842);let I=class extends o.BrowserModule{constructor(){super(...arguments),this.contributionProvider=h.CommentsContribution,this.providers=[{token:h.ICommentsService,useClass:g.CommentsService},{token:v.CommentModelService,useClass:v.CommentModelService},{token:h.ICommentsFeatureRegistry,useClass:f.CommentsFeatureRegistry},b.CommentsBrowserContribution]}};I=n.__decorate([(0,l.Injectable)()],I),e.CommentsModule=I},70154:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.markdownCss=void 0,e.markdownCss=`
28076
+ `)}mountReadable(b){this._stream=b}get isListened(){return this._listened}listen(){if(this._listened)return;if(!this._stream)throw new Error("No Stream mounted");this._listened=!0;const b=new n.ReplyResponse("");let g="";(0,l.listenReadable)(this._stream,{onData:v=>{g+=v.content;const I=this.calculateCodeBlocks(g);b.updateMessage(I),this._onData.fire(b)},onEnd:()=>{this._onEnd.fire()},onError:v=>{n.AbortError.is(v)?this._onAbort.fire():this._onError.fire(new n.ErrorResponse(v))}})}}e.InlineChatController=h},51221:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineChatEditorController=void 0;const n=t(41869),l=t(43718),o=t(43718),h=t(54414),f=t(52902),b=t(99906),g=t(89132),v=t(77633),I=t(38890),u=t(40111),c=t(31031),s=t(26664);class a extends b.BaseAIMonacoEditorController{constructor(){super(...arguments),this.aiInlineChatDisposable=new l.Disposable,this.aiInlineChatOperationDisposable=new l.Disposable,this.inlineChatInUsing=!1}static get(d){return d.getContribution(a.ID)}get aiNativeConfigService(){return this.injector.get(n.AINativeConfigService)}get aiInlineChatService(){return this.injector.get(n.IAIInlineChatService)}get inlineChatFeatureRegistry(){return this.injector.get(o.InlineChatFeatureRegistryToken)}get preferenceService(){return this.injector.get(n.PreferenceService)}get aiReporter(){return this.injector.get(o.IAIReporter)}get workbenchEditorService(){return this.injector.get(h.WorkbenchEditorService)}get codeActionService(){return this.injector.get(g.CodeActionService)}get logger(){return this.injector.get(o.ILogger)}mount(){return this.inlineDiffController=I.InlineDiffController.get(this.monacoEditor),this.doContribute(),this}disposeAllWidget(){[this.aiInlineContentWidget,this.aiInlineChatDisposable,this.aiInlineChatOperationDisposable].forEach(d=>{d?.dispose()}),this.inlineChatInUsing=!1,this.cancelToken()}doContribute(){if(!this.monacoEditor)return this;const d=this.monacoEditor;this.disposables.push(this.aiInlineChatService.onInlineChatVisible(p=>{p?this.showInlineChat(d):(this.cancelToken(),this.disposeAllWidget())}),this.codeActionService.onCodeActionRun(({id:p,range:N})=>{const W=this.workbenchEditorService.currentEditor;W?.getId()===d.getId()&&(d.setSelection(N),this.showInlineChat(d),this.aiInlineContentWidget&&this.aiInlineContentWidget.clickActionId(p,"codeAction"))}),d.onWillChangeModel(()=>{this.disposeAllWidget()}));let m=!1;this.disposables.push(d.onMouseDown(p=>{const W=p.target.detail;m=!1,!(W&&typeof W=="string"&&W===o.AIInlineChatContentWidgetId)&&this.aiInlineContentWidget&&!this.aiInlineContentWidget.isPersisted&&this.disposeAllWidget()}),d.onMouseUp(p=>{const W=p.target.detail;W&&typeof W=="string"&&W===o.AIInlineChatContentWidgetId?m=!1:m=!0}));let G=this.preferenceService.getValid(o.AINativeSettingSectionsId.InlineChatAutoVisible,!0);return this.disposables.push(this.preferenceService.onSpecificPreferenceChange(o.AINativeSettingSectionsId.InlineChatAutoVisible,({newValue:p})=>{G=p})),this.disposables.push(o.Event.debounce(o.Event.any(d.onDidChangeCursorSelection,d.onMouseUp),(p,N)=>N,100)(()=>{!G||!m||this.aiInlineContentWidget&&this.aiInlineContentWidget.isPersisted||this.showInlineChat(d)})),this}showInlineContentWidget(d,m){this.aiInlineContentWidget&&this.aiInlineContentWidget.dispose(),this.aiInlineContentWidget=this.injector.get(s.AIInlineContentWidget,[d]),this.aiInlineContentWidget.show({selection:m})}async showInlineChat(d){if(!this.aiNativeConfigService.capabilities.supportsInlineChat||this.inlineChatInUsing)return;this.inlineChatInUsing=!0,this.disposeAllWidget();const m=d.getSelection();!m||m.isEmpty()||(this.showInlineContentWidget(d,m),this.aiInlineChatDisposable.addDispose(this.inlineChatFeatureRegistry.onChatClick(()=>{this.aiInlineChatService.launchInputVisible(!0)})),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.onActionClick(({actionId:G,source:p})=>{const N=this.inlineChatFeatureRegistry.getEditorHandler(G),W=this.inlineChatFeatureRegistry.getAction(G);if(!N||!W)return;const Z=this.getCrossSelection(d);if(!Z)return;const y=()=>{const E=N.providerDiffPreviewStrategy?N.providerDiffPreviewStrategy:N.providePreviewStrategy;if(E)return E.bind(this,d,this.token)};this.runAction({monacoEditor:d,crossSelection:Z,reporterFn:()=>this.aiReporter.start(W.name,{message:W.name,type:o.AISerivceType.InlineChat,source:p,runByCodeAction:p==="codeAction",actionSource:p==="codeAction"?o.ActionSourceEnum.CodeAction:o.ActionSourceEnum.InlineChat,actionType:W.name}),execute:N.execute?N.execute.bind(this,d,this.token):void 0,providerPreview:y(),extraData:{actionSource:p==="codeAction"?o.ActionSourceEnum.CodeAction:o.ActionSourceEnum.InlineChat,actionType:W.name}})})),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.onInteractiveInputValue(async G=>{const p=this.inlineChatFeatureRegistry.getInteractiveInputHandler();if(!p)return;const N=await this.inlineChatFeatureRegistry.getInteractiveInputStrategyHandler()(d,G),W=this.getCrossSelection(d);W&&this.runAction({monacoEditor:d,crossSelection:W,reporterFn:()=>this.aiReporter.start(o.AISerivceType.InlineChatInput,{message:G,type:o.AISerivceType.InlineChatInput,source:"input",actionSource:o.ActionSourceEnum.InlineChatInput}),execute:p.execute&&N===v.ERunStrategy.EXECUTE?p.execute.bind(this,d,G,this.token):void 0,providerPreview:p.providePreviewStrategy&&N===v.ERunStrategy.PREVIEW?p.providePreviewStrategy.bind(this,d,G,this.token):void 0,extraData:{actionSource:o.ActionSourceEnum.InlineChatInput,actionType:N}})})))}getCrossSelection(d){const m=d.getSelection();if(!m){this.logger.error("No selection found, aborting inline chat action.");return}return m.setStartPosition(m.startLineNumber,1).setEndPosition(m.endLineNumber,d.getModel().getLineMaxColumn(m.endLineNumber))}convertInlineChatStatus(d,m){if(!this.aiInlineContentWidget)return;const{relationId:G,message:p,startTime:N,isRetry:W,isStop:Z}=m;let y;d===c.EInlineChatStatus.DONE&&(y=this.inlineDiffController.getModifyContent()),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.launchChatStatus(d)),this.aiReporter.end(G,{message:p,success:d!==c.EInlineChatStatus.ERROR,replytime:Date.now()-N,isStop:Z,isRetry:W,code:y,actionType:m?.actionType,actionSource:m?.actionSource})}visibleDiffWidget(d){const{monacoEditor:m,options:G,reportInfo:p}=d,{chatResponse:N}=G,{relationId:W,startTime:Z,isRetry:y,actionType:E,actionSource:R}=p;if(u.InlineChatController.is(N))this.aiInlineChatOperationDisposable.addDispose([N.onError(w=>{this.convertInlineChatStatus(c.EInlineChatStatus.ERROR,{relationId:W,message:w.message||"",startTime:Z,isRetry:y,actionSource:R,actionType:E})}),N.onAbort(()=>{this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:W,message:"abort",startTime:Z,isRetry:y,isStop:!0,actionSource:R,actionType:E})}),N.onEnd(()=>{this.convertInlineChatStatus(c.EInlineChatStatus.DONE,{relationId:W,message:"",startTime:Z,isRetry:y,actionSource:R,actionType:E})})]);else{if(this.aiInlineContentWidget&&this.aiInlineChatDisposable.disposed||o.CancelResponse.is(N)){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:W,message:N.message||"",startTime:Z,isRetry:y,isStop:!0,actionSource:R,actionType:E});return}if(o.ErrorResponse.is(N)){this.convertInlineChatStatus(c.EInlineChatStatus.ERROR,{relationId:W,message:N.message||"",startTime:Z,isRetry:y,actionSource:R,actionType:E});return}this.convertInlineChatStatus(c.EInlineChatStatus.DONE,{relationId:W,message:"",startTime:Z,isRetry:y,actionSource:R,actionType:E})}this.inlineDiffController.showPreviewerByStream(m,G).mount(this.aiInlineContentWidget)}ensureInlineChatVisible(d,m){this.aiInlineContentWidget.disposed?this.showInlineContentWidget(d,m):this.aiInlineContentWidget.isHidden&&this.aiInlineContentWidget.resume()}async handleDiffPreviewStrategy(d){if(!this.aiInlineContentWidget)return;const{monacoEditor:m,strategy:G,crossSelection:p,relationId:N,isRetry:W,actionType:Z,actionSource:y}=d,E=m.getModel();this.inlineDiffController.destroyPreviewer(E.uri.toString()),this.aiInlineChatOperationDisposable.dispose(),this.ensureInlineChatVisible(m,p),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.launchChatStatus(c.EInlineChatStatus.THINKING));const R=Date.now();if(this.token.isCancellationRequested){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:N,message:"abort",startTime:R,isRetry:W,isStop:!0,actionSource:y,actionType:Z});return}const A=await G();if(o.CancelResponse.is(A)){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:N,message:"abort",startTime:R,isRetry:W,isStop:!0,actionSource:y,actionType:Z}),this.disposeAllWidget();return}this.visibleDiffWidget({monacoEditor:m,options:{crossSelection:p,chatResponse:A},reportInfo:{relationId:N,startTime:R,isRetry:W,actionType:Z,actionSource:y}}),this.aiInlineChatOperationDisposable.addDispose([this.aiInlineContentWidget.onResultClick(w=>{const F=this.inlineDiffController.getModifyContent(),V=this.inlineDiffController.getOriginContent();this.inlineDiffController.handleAction(w),w===c.EResultKind.ACCEPT?(this.aiReporter.end(N,{message:"accept",success:!0,isReceive:!0,isDrop:!1,code:F,originCode:V,actionType:o.ActionTypeEnum.Accept}),(0,o.runWhenIdle)(()=>{this.disposeAllWidget()})):w===c.EResultKind.DISCARD?(this.aiReporter.end(N,{message:"discard",success:!0,isDrop:!0,isReceive:!1,code:F,originCode:V,actionType:o.ActionTypeEnum.Discard}),(0,o.runWhenIdle)(()=>{this.disposeAllWidget()})):w===c.EResultKind.REGENERATE&&(this.aiReporter.end(N,{message:"regenerate",success:!0,isDrop:!0,isReceive:!1,code:F,originCode:V,actionType:o.ActionTypeEnum.Regenerate}),this.handleDiffPreviewStrategy({monacoEditor:m,strategy:G,crossSelection:p,relationId:N,isRetry:!0,actionSource:y,actionType:Z}))}),this.aiInlineChatService.onThumbs(w=>{this.aiReporter.end(N,{isLike:w})}),this.inlineDiffController.onMaxLineCount(w=>{requestAnimationFrame(()=>{if(p.endLineNumber===E.getLineCount()){const F=m.getOption(f.monacoApi.editor.EditorOption.lineHeight);this.aiInlineContentWidget.setOffsetTop(F*w+12)}})})])}async runAction(d){const{monacoEditor:m,crossSelection:G,reporterFn:p,execute:N,providerPreview:W,extraData:Z}=d;if(N&&(await N(),this.disposeAllWidget()),W){const y=p();await this.handleDiffPreviewStrategy({monacoEditor:m,strategy:W,crossSelection:G,relationId:y,isRetry:!1,actionSource:Z?.actionSource,actionType:Z?.actionType})}}}e.InlineChatEditorController=a,a.ID="editor.contrib.ai.inline.chat"},2281:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineChatFeatureRegistry=void 0;const n=t(85608),l=t(76003),o=t(41869),h=t(57925),f=t(83913),b=t(43718),g=t(89132),v=t(77633);class I{setHandler(s){this._handler=s}handler(){return this._handler}setStrategyHandler(s){this._strategyHandler=s}strategyHandler(){return this._strategyHandler}dispose(){this._handler=void 0}}I.ID=`${f.InteractiveInput.displayName}:${(0,b.uuid)(4)}`;let u=class extends b.Disposable{constructor(){super(...arguments),this.actionsMap=new Map,this.editorHandlerMap=new Map,this.terminalHandlerMap=new Map,this.interactiveInputModel=new I,this._onChatClick=new b.Emitter,this.onChatClick=this._onChatClick.event}dispose(){super.dispose(),this.actionsMap.clear(),this.editorHandlerMap.clear(),this.terminalHandlerMap.clear()}updateActions(s,a){this.actionsMap.set(s,a)}collectActions(s){const{id:a}=s;return this.actionsMap.has(a)?(this.logger.warn(`InlineChatFeatureRegistry: id ${a} already exists`),!1):((0,b.isUndefined)(s.renderType)&&(s.renderType="button"),(0,b.isUndefined)(s.order)&&(s.order=0),this.actionsMap.set(a,s),!0)}removeCollectedActions(s){this.actionsMap.delete(s.id),this.codeActionService.deleteCodeActionById(s.id)}getInteractiveInputId(){return I.ID}registerEditorInlineChat(s,a){return this.collectActions(s)&&(this.editorHandlerMap.set(s.id,a),this.codeActionService.registerCodeAction(s)),{dispose:()=>{this.removeCollectedActions(s)}}}unregisterEditorInlineChat(s){return this.removeCollectedActions(s)}registerTerminalInlineChat(s,a){return this.collectActions(s)&&((0,b.isUndefined)(a.triggerRules)&&(a.triggerRules="selection"),this.terminalHandlerMap.set(s.id,a)),{dispose:()=>{this.removeCollectedActions(s)}}}unregisterTerminalInlineChat(s){return this.removeCollectedActions(s)}registerInteractiveInput(s,a){this.interactiveInputModel.setHandler(a),s.handleStrategy?this.interactiveInputModel.setStrategyHandler(s.handleStrategy):this.interactiveInputModel.setStrategyHandler(()=>s.strategy||v.ERunStrategy.EXECUTE);const r=()=>{const d=String(this.getSequenceKeyString());if(d){const m={id:I.ID,name:`Chat(${d.toLocaleUpperCase()})`,renderType:"button",order:Number.MAX_SAFE_INTEGER};this.actionsMap.has(m.id)?this.updateActions(m.id,m):this.collectActions(m)}};return this.addDispose(b.Event.filter(this.keybindingRegistry.onKeybindingsChanged,({affectsCommands:d})=>d.includes(h.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id))(()=>r())),r(),{dispose:()=>{this.interactiveInputModel.dispose()}}}getSequenceKeyString(){var s;const r=(s=this.keybindingRegistry.getKeybindingsForCommand(h.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||s===void 0?void 0:s.resolved;return r?this.keybindingRegistry.acceleratorForSequence(r,"+"):""}getInteractiveInputHandler(){return this.interactiveInputModel.handler()}getInteractiveInputStrategyHandler(){return this.interactiveInputModel.strategyHandler()}getEditorActionButtons(){const s=Array.from(this.editorHandlerMap.keys()).filter(a=>{const r=this.actionsMap.get(a);return r&&r.renderType==="button"}).map(a=>this.actionsMap.get(a)).sort((a,r)=>a.order-r.order);return this.actionsMap.has(I.ID)&&s.push(this.actionsMap.get(I.ID)),s}getEditorActionMenus(){return Array.from(this.editorHandlerMap.keys()).filter(s=>{const a=this.actionsMap.get(s);return a&&a.renderType==="dropdown"}).map(s=>this.actionsMap.get(s))}getEditorHandler(s){return this.editorHandlerMap.get(s)}getTerminalHandler(s){return this.terminalHandlerMap.get(s)}getTerminalActions(){return Array.from(this.terminalHandlerMap.keys()).map(s=>this.actionsMap.get(s))}getAction(s){return this.actionsMap.get(s)}};n.__decorate([(0,l.Autowired)(o.Logger),n.__metadata("design:type",o.Logger)],u.prototype,"logger",void 0),n.__decorate([(0,l.Autowired)(g.CodeActionService),n.__metadata("design:type",g.CodeActionService)],u.prototype,"codeActionService",void 0),n.__decorate([(0,l.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],u.prototype,"keybindingRegistry",void 0),u=n.__decorate([(0,l.Injectable)()],u),e.InlineChatFeatureRegistry=u},31031:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AIInlineChatService=e.EResultKind=e.EInlineChatStatus=void 0;const n=t(85608),l=t(76003),o=t(43718);var h=t(19413);Object.defineProperty(e,"EInlineChatStatus",{enumerable:!0,get:function(){return h.EInlineChatStatus}}),Object.defineProperty(e,"EResultKind",{enumerable:!0,get:function(){return h.EResultKind}});let f=class{constructor(){this._interactiveInputVisible=!1,this._onInteractiveInputVisible=new o.Emitter,this.onInteractiveInputVisible=this._onInteractiveInputVisible.event,this._onInlineChatVisible=new o.Emitter,this.onInlineChatVisible=this._onInlineChatVisible.event,this._onThumbs=new o.Emitter,this.onThumbs=this._onThumbs.event}get interactiveInputVisible(){return this._interactiveInputVisible}fireThumbsEvent(g){this._onThumbs.fire(g)}launchInputVisible(g){return(0,o.runWhenIdle)(()=>{this._interactiveInputVisible=g,this._onInteractiveInputVisible.fire(g)})}};f=n.__decorate([(0,l.Injectable)({multiple:!1})],f),e.AIInlineChatService=f},26664:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AIInlineContentWidget=void 0;const n=t(85608),l=n.__importStar(t(14041)),o=t(76003),h=t(41869),f=t(89195),b=t(83913),g=t(64102),v=t(43718),I=n.__importStar(t(20868)),u=t(62663),c=t(52659),s=t(23028),a=t(90614),r=t(2281),d=n.__importDefault(t(26899)),m=t(31031),G=N=>{const{onClickActions:W,onClose:Z,onInteractiveInputSend:y,onLayoutChange:E,onChatStatus:R,onResultClick:A}=N,w=(0,h.useInjectable)(h.IAIInlineChatService),F=(0,h.useInjectable)(v.InlineChatFeatureRegistryToken),[V,Y]=(0,l.useState)(m.EInlineChatStatus.READY),[_,H]=(0,l.useState)(""),[X,S]=(0,l.useState)(!1);(0,l.useEffect)(()=>{const P=new v.Disposable;return P.addDispose(R(te=>Y(te))),P.addDispose(w.onInteractiveInputVisible(te=>{S(te)})),()=>{P.dispose()}},[R,w]),(0,l.useEffect)(()=>{V===m.EInlineChatStatus.ERROR&&Z?.()},[Z]);const Q=(0,l.useMemo)(()=>V===m.EInlineChatStatus.THINKING,[V]),k=(0,l.useMemo)(()=>V===m.EInlineChatStatus.DONE,[V]),M=(0,l.useMemo)(()=>V===m.EInlineChatStatus.ERROR,[V]),D=(0,l.useMemo)(()=>F.getEditorActionButtons(),[F]),J=(0,l.useCallback)(P=>{W?.(P)},[W]),T=(0,l.useCallback)(()=>{Z?.()},[Z]),x=(0,l.useCallback)(P=>{y?.(P)},[y]),B=(0,l.useMemo)(()=>F.getEditorActionMenus().map(P=>new g.MenuNode({id:`ai.menu.operation.${P.id}`,label:P.name,className:d.default.more_operation_menu_item,execute:()=>{J(P.id)}})),[F]),O=(0,l.useCallback)(P=>{H(P)},[]),z=(0,l.useMemo)(()=>X?l.default.createElement(b.InteractiveInput,{autoFocus:!0,onHeightChange:P=>E(P),size:"small",placeholder:(0,v.localize)("aiNative.inline.chat.input.placeholder.default"),width:320,disabled:Q,value:_,onValueChange:O,onSend:x}):null,[Q,X,_]),U=(0,l.useCallback)(()=>D.length===0&&B.length===0||M?null:k?l.default.createElement(a.InlineResultAction,{onResultClick:A}):l.default.createElement(f.AIAction,{operationList:D,moreOperation:B,onClickItem:J,onClose:T,loading:Q,loadingShowOperation:X,customOperationRender:z}),[D,B,z,A,V,X]);return l.default.createElement("div",{className:d.default.inline_chat_controller_box},U())};let p=class extends c.ReactInlineContentWidget{get interactiveInputValue(){return this._interactiveInputValue}get status(){return this._status}get isPersisted(){return!this.isHidden&&this.status!==m.EInlineChatStatus.READY&&this.status!==m.EInlineChatStatus.ERROR}constructor(W){super(W),this.editor=W,this.allowEditorOverflow=!0,this._onActionClickEmitter=new v.Emitter,this.onActionClick=this._onActionClickEmitter.event,this._onInteractiveInputValue=new v.Emitter,this.onInteractiveInputValue=this._onInteractiveInputValue.event,this._onStatusChange=new v.Emitter,this.onStatusChange=this._onStatusChange.event,this._onResultClick=new v.Emitter,this.onResultClick=this._onResultClick.event,this._status=m.EInlineChatStatus.READY,this.aiNativeContextKey=this.injector.get(s.AINativeContextKey,[this.editor.contextKeyService]),this.addDispose(this.editor.onDidLayoutChange(()=>{this.isOutOfArea()&&this.dispose()}))}launchChatStatus(W){return(0,v.runWhenIdle)(()=>{this._status=W,this._onStatusChange.fire(W)})}dispose(){this.launchChatStatus(m.EInlineChatStatus.READY),super.dispose()}clickActionId(W,Z){if(W===this.inlineChatFeatureRegistry.getInteractiveInputId()){this.inlineChatFeatureRegistry._onChatClick.fire();return}this._onActionClickEmitter.fire({actionId:W,source:Z})}renderView(){return l.default.createElement(G,{onClickActions:W=>this.clickActionId(W,"widget"),onClose:()=>this.dispose(),onChatStatus:this.onStatusChange.bind(this),onLayoutChange:()=>{this.editor.layoutContentWidget(this)},onInteractiveInputSend:W=>{this.launchChatStatus(m.EInlineChatStatus.THINKING),this._interactiveInputValue=W,this._onInteractiveInputValue.fire(W)},onResultClick:W=>{this._onResultClick.fire(W)}})}async show(W){super.show(W),this.aiNativeContextKey.inlineChatIsVisible.set(!0)}getDomNode(){const W=super.getDomNode();return requestAnimationFrame(()=>{W.style.zIndex=h.StackingLevelStr.OverlayTop}),W}async hide(){this.aiNativeContextKey.inlineChatIsVisible.set(!1),super.hide()}setOptions(W){this.options=W}setOffsetTop(W){this.domNode.style.transform=`translateY(${W}px)`}id(){return v.AIInlineChatContentWidgetId}getPosition(){const W=super.getPosition();if(W)return W;if(!this.options)return null;const{selection:Z}=this.options;if(!Z)return null;const y=this.computePosition(Z);return y||null}safeGetLineLastNonWhitespaceColumn(W){const Z=this.editor.getModel();W<1&&(W=1);const y=Z.getLineCount();return W>y&&(W=y),Z.getLineLastNonWhitespaceColumn(W)}toAbovePosition(W,Z){return{position:new I.Position(W,Z),preference:[u.monacoBrowser.editor.ContentWidgetPositionPreference.ABOVE,u.monacoBrowser.editor.ContentWidgetPositionPreference.BELOW]}}toBelowPosition(W,Z){return{position:new I.Position(W,Z),preference:[u.monacoBrowser.editor.ContentWidgetPositionPreference.BELOW,u.monacoBrowser.editor.ContentWidgetPositionPreference.ABOVE]}}recheckSelection(W){const Z=W.getStartPosition(),y=W.getEndPosition(),R=this.editor.getModel().getLineCount(),A=Math.max(1,y.lineNumber-1),w=Math.min(R,y.lineNumber+1),F=Z.with(A,1),V=y.with(w,this.safeGetLineLastNonWhitespaceColumn(w));if(R===1)return this.toBelowPosition(w,this.safeGetLineLastNonWhitespaceColumn(w));if(V.lineNumber===1&&y.lineNumber!==Z.lineNumber)return this.computePosition(I.Selection.fromPositions(F,V));const Y=this.safeGetLineLastNonWhitespaceColumn(A),_=this.safeGetLineLastNonWhitespaceColumn(w),H=this.safeGetLineLastNonWhitespaceColumn(y.lineNumber);return _>H&&_>Y?this.computePosition(I.Selection.fromPositions(V,F)):this.computePosition(I.Selection.fromPositions(F,V))}isProtrudeAbove(W){const Z=this.safeGetLineLastNonWhitespaceColumn(W);return Z>=this.safeGetLineLastNonWhitespaceColumn(W-1)&&Z>=this.safeGetLineLastNonWhitespaceColumn(W-2)}isProtrudeBelow(W){const Z=this.safeGetLineLastNonWhitespaceColumn(W);return Z>=this.safeGetLineLastNonWhitespaceColumn(W+1)&&Z>=this.safeGetLineLastNonWhitespaceColumn(W+2)}computePosition(W){let Z=W.getStartPosition(),y=W.getEndPosition(),E=W.getPosition();const A=this.editor.getModel().getLineCount();if(Z.lineNumber===y.lineNumber)return this.recheckSelection(W);y.lineNumber-Z.lineNumber===1&&(E=y);const w=this.safeGetLineLastNonWhitespaceColumn(E.lineNumber);let F=E.lineNumber,V="below";if(E.equals(Z)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(E.lineNumber-1),this.safeGetLineLastNonWhitespaceColumn(E.lineNumber-2))<=w)return this.toAbovePosition(E.lineNumber,w);for(let H=Z.lineNumber;H<=y.lineNumber;H++){if(this.isProtrudeAbove(H)){F=H,V="above";break}if(this.isProtrudeBelow(H)){F=H,V="below";break}}}else if(E.equals(y)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(E.lineNumber+1),this.safeGetLineLastNonWhitespaceColumn(E.lineNumber+2))<=w)return this.toBelowPosition(E.lineNumber,w);for(let H=Math.min(A,y.lineNumber+1);H>=Z.lineNumber;H--){if(this.isProtrudeBelow(H)){F=H,V="below";break}if(this.isProtrudeAbove(H)){F=H,V="above";break}}}const Y=this.safeGetLineLastNonWhitespaceColumn(F)+1;return V==="below"?this.toBelowPosition(F,Y):this.toAbovePosition(F,Y)}};n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],p.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(v.InlineChatFeatureRegistryToken),n.__metadata("design:type",r.InlineChatFeatureRegistry)],p.prototype,"inlineChatFeatureRegistry",void 0),p=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],p),e.AIInlineContentWidget=p},15989:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=t(85608);n.__exportStar(t(38890),e),n.__exportStar(t(49444),e),n.__exportStar(t(37679),e),n.__exportStar(t(7046),e)},49444:(L,e,t)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.LiveInlineDiffPreviewer=e.SideBySideInlineDiffWidget=e.BaseInlineDiffPreviewer=void 0;const l=t(85608),o=t(76003),h=t(43718),f=t(20868),b=t(90052),g=t(77714),v=t(43255),I=t(88104),u=t(11827),c=t(96084),s=t(31031),a=t(33062),r=t(37679);let d=class extends h.Disposable{constructor(N){super(),this.monacoEditor=N,this.inlineContentWidget=null,this.model=this.monacoEditor.getModel(),this.addDispose(h.Disposable.create(()=>{this.inlineContentWidget&&this.inlineContentWidget.dispose(),this.attachNode(void 0)}))}formatIndentation(N){const W=this.selection.startLineNumber,Z=(0,g.getLeadingWhitespace)(this.model.getLineContent(W));if(N===g.empty||Z===g.empty)return N;const{tabSize:y,insertSpaces:E}=this.model.getOptions(),R=this.model.getEOL(),A=(0,c.getSpaceCnt)(Z,y);let w=(0,c.generateIndent)(A,y,E);const F=N.split(R),V=F[0];let Y=!1;if(V){const H=(0,g.getLeadingWhitespace)(V);w===H?w="":w.length>H.length?w=w.slice(H.length):(w=H.slice(w.length),Y=!0)}return F.map(H=>{if(Y){const X=(0,g.getLeadingWhitespace)(H);return H=w+H.substring(X.length),H}return w+H}).join(R)}getNode(){return this.node}createNodeSnapshot(){return this.node}mount(N){this.inlineContentWidget=N}layout(){var N,W;(N=this.inlineContentWidget)===null||N===void 0||N.setOptions({position:this.getPosition()}),(W=this.inlineContentWidget)===null||W===void 0||W.layoutContentWidget()}onReady(N){return N(),h.Disposable.NULL}create(N,W={disposeWhenEditorClosed:!0}){this.selection=N,this.node=this.createNode(),this.node.setPreviewerOptions(W)}attachNode(N){this.node=N}show(N,W){}onLineCount(N){return this}setValue(N){}getValue(){return""}getOriginValue(){return""}onError(N){}onAbort(){}onEnd(){}revealFirstDiff(){}isModel(N){return this.model.uri.toString()===N}};l.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),l.__metadata("design:type",o.Injector)],d.prototype,"injector",void 0),d=l.__decorate([(0,o.Injectable)({multiple:!0}),l.__metadata("design:paramtypes",[Object])],d),e.BaseInlineDiffPreviewer=d;let m=n=class extends d{createNode(){const N=this.injector.get(r.InlineDiffWidget,[n.AI_DIFF_WIDGET_ID,{editor:this.monacoEditor,selection:this.selection}]);return N.create(),this.addDispose(N),N}mount(N){super.mount(N),N.addDispose(this)}getPosition(){return f.Position.lift({lineNumber:this.selection.endLineNumber+1,column:1})}layout(){var N;(N=this.inlineContentWidget)===null||N===void 0||N.setPositionPreference([b.ContentWidgetPositionPreference.BELOW]),super.layout()}onReady(N){return this.node?this.node.onReady(N.bind(this)):h.Disposable.NULL}show(N,W){var Z;(Z=this.node)===null||Z===void 0||Z.showByLine(N,W)}setValue(N){var W;const Z=(W=this.node)===null||W===void 0?void 0:W.getModifiedModel();Z?.setValue(this.formatIndentation(N))}getValue(){var N;return((N=this.node)===null||N===void 0?void 0:N.getModifiedModel()).getValue()}getOriginValue(){var N;return((N=this.node)===null||N===void 0?void 0:N.getOriginModel()).getValue()||""}handleAction(N){if(N===s.EResultKind.ACCEPT){const W=this.getValue();this.model.pushEditOperations(null,[{range:this.selection,text:W}],()=>null),this.model.pushStackElement()}}onLineCount(N){var W;return(W=this.node)===null||W===void 0||W.onMaxLineCount(N.bind(this)),this}onData(N){var W,Z;const{message:y}=N,E=this.formatIndentation(y),R=(W=this.node)===null||W===void 0?void 0:W.getModifiedModel(),A=R.getEOL()===`\r
28077
+ `?v.DefaultEndOfLine.CRLF:v.DefaultEndOfLine.LF,{textBuffer:w,disposable:F}=(0,I.createTextBuffer)(E,A),V=u.ModelService._computeEdits(R,w);R.pushEditOperations([],V,()=>[]),F.dispose(),(Z=this.node)===null||Z===void 0||Z.layout()}onError(N){var W;(W=this.node)===null||W===void 0||W.layout()}onAbort(){var N;(N=this.node)===null||N===void 0||N.layout()}onEnd(){var N;(N=this.node)===null||N===void 0||N.layout()}};m.AI_DIFF_WIDGET_ID="AI-DIFF-WIDGET",m=n=l.__decorate([(0,o.Injectable)({multiple:!0})],m),e.SideBySideInlineDiffWidget=m;let G=class extends d{listenNode(N){N.addDispose(N.onDidEditChange(()=>this.layout())),N.addDispose(N.onPartialEditWidgetListChange(Z=>{var y;Z.every(E=>E.isHidden)&&(this.dispose(),(y=this.inlineContentWidget)===null||y===void 0||y.dispose())}));const W=N.onDispose(()=>{this.dispose(),W.dispose()});this.addDispose(N)}createNode(){const N=this.injector.get(a.InlineStreamDiffHandler,[this.monacoEditor]);return N.initialize(this.selection),this.listenNode(N),N}attachNode(N){var W;if((W=this.node)===null||W===void 0||W.dispose(),this.node=N,N){const Z=N.currentSnapshotStore;Z&&(this.node.restoreDecorationSnapshot(Z.decorationSnapshotData),this.listenNode(N))}}createNodeSnapshot(){if(!this.node)return this.createNode();const N=this.node.createSnapshot(),W=this.injector.get(a.InlineStreamDiffHandler,[this.monacoEditor]);return W.restoreSnapshot(N),W}getPosition(){var N;const W=(N=this.node)===null||N===void 0?void 0:N.getZone();return W?f.Position.lift({lineNumber:W.startLineNumber,column:1}):f.Position.lift({lineNumber:1,column:1})}handleAction(N){var W,Z;switch(N){case s.EResultKind.ACCEPT:(W=this.node)===null||W===void 0||W.acceptAll();break;case s.EResultKind.DISCARD:case s.EResultKind.REGENERATE:(Z=this.node)===null||Z===void 0||Z.rejectAll();break;default:break}}onLineCount(){return h.Disposable.NULL}layout(){var N,W,Z;(N=this.inlineContentWidget)===null||N===void 0||N.setPositionPreference([b.ContentWidgetPositionPreference.ABOVE,b.ContentWidgetPositionPreference.BELOW]),super.layout();const y=this.getPosition();if(y&&this.inlineContentWidget){const E=(W=this.node)===null||W===void 0?void 0:W.livePreviewDiffDecorationModel.getRemovedWidgets();if(E?.length){const R=y.lineNumber,A=E[0];if(A&&((Z=A.getLastPosition())===null||Z===void 0?void 0:Z.lineNumber)<=R){const F=this.inlineContentWidget.getLineHeight(),V=A.height;this.inlineContentWidget.setOffsetTop(-F*V-4)}}}}onData(N){var W;const{message:Z}=N;(W=this.node)===null||W===void 0||W.addLinesToDiff(this.formatIndentation(Z))}onEnd(){var N,W;const Z=(N=this.node)===null||N===void 0?void 0:N.recompute(a.EComputerMode.legacy);Z&&((W=this.node)===null||W===void 0||W.pushRateFinallyDiffStack(Z))}getValue(){var N;return((N=this.node)===null||N===void 0?void 0:N.getVirtualModelValue())||""}getOriginValue(){var N;return((N=this.node)===null||N===void 0?void 0:N.getOriginModelValue())||""}setValue(N){var W,Z;const y=(W=this.node)===null||W===void 0?void 0:W.recompute(a.EComputerMode.legacy,this.formatIndentation(N));y&&((Z=this.node)===null||Z===void 0||Z.finallyRender(y))}revealFirstDiff(){var N;(N=this.node)===null||N===void 0||N.revealFirstDiff()}};G=l.__decorate([(0,o.Injectable)({multiple:!0})],G),e.LiveInlineDiffPreviewer=G},37679:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineDiffWidget=void 0;const n=t(85608),l=n.__importStar(t(14041)),o=t(43144),h=n.__importDefault(t(25873)),f=t(76003),b=t(41869),g=n.__importStar(t(20868)),v=t(87822),I=t(34819),u=t(83e3),c=n.__importDefault(t(69790)),s={fixedOverflowWidgets:!0,readOnly:!1,enableSplitViewResizing:!0,ignoreTrimWhitespace:!0,renderSideBySide:!0,lineNumbers:"on",glyphMargin:!0,scrollbar:{useShadows:!1,alwaysConsumeMouseWheel:!1,vertical:"hidden"},scrollBeyondLastLine:!1,renderMarginRevertIcon:!1,renderOverviewRuler:!1,rulers:void 0,overviewRulerBorder:void 0,overviewRulerLanes:0,padding:{top:0,bottom:0},folding:!1,diffCodeLens:!1,stickyScroll:{enabled:!1},minimap:{enabled:!1},automaticLayout:!0,renderIndicators:!1,inDiffEditor:!0},a=l.default.memo(d=>{const{range:m,onMaxLineCount:G,editor:p,onReady:N}=d,W=(0,b.useInjectable)(b.MonacoService),Z=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!m)return;const y=p.getModel();if(!y)return;const E=y.getValueInRange(m),R=W.createDiffEditor(Z.current,Object.assign(Object.assign({},s),{lineDecorationsWidth:p.getLayoutInfo().decorationsWidth,lineNumbersMinChars:p.getOption(g.editor.EditorOption.lineNumbersMinChars)})),A=u.StandaloneServices.get(v.IModelService),w={languageId:y.getLanguageId(),onDidChange:b.Event.None},F=A.createModel(E,w,g.Uri.from({scheme:b.Schemes.inMemory,path:"inline-diff-widget/"+(0,b.randomString)(8)}),!0),V=A.createModel("",w,g.Uri.from({scheme:b.Schemes.inMemory,path:"inline-diff-widget/"+(0,b.randomString)(8)}),!0);R.setModel({original:F,modified:V}),R.revealLine(m.startLineNumber,g.editor.ScrollType.Immediate);const Y=()=>{if(G){const _=F.getLineCount(),H=V.getLineCount();G(Math.max(_,H)+1)}};return N&&N({getModifiedModel:()=>V,getOriginModel:()=>F,layout:Y}),Y(),()=>{R&&R.dispose()}},[m,p]),l.default.createElement("div",{ref:Z,className:c.default.diff_editor_widget})});let r=class extends I.ZoneWidget{setPreviewerOptions(m){this.previewerOptions=m}_fillContainer(m){this.setCssClass("inline-diff-widget"),this.root=h.default.createRoot(m);let G=null;if(this._resolveResultWidget)if(m.parentNode){const p=document.createElement("div");requestAnimationFrame(()=>{p.className=c.default.ai_diff_editor_resolve_result_widget;const N=this.editor.getLayoutInfo();p.style.width=`${N.contentWidth}px`,p.style.left=`${N.contentLeft}px`}),m.parentNode.appendChild(p),G=(0,o.createPortal)(this._resolveResultWidget,p),this.resultContainer=p}else throw new Error("[impossible path] container.parentNode is null");this.root.render(l.default.createElement(b.ConfigProvider,{value:this.configContext},l.default.createElement("div",{className:c.default.ai_diff_editor_container},l.default.createElement(a,{range:this.range,editor:this.editor,onMaxLineCount:p=>{p&&(this._relayout(p),this._onMaxLineCount.fire(p))},onReady:p=>{this.diffWidgetHandler=p,this._onReady.fire()}})),G))}computeResultWidgetWidth(){const m=this.editor.getLayoutInfo();return m.contentWidth+m.contentLeft}_onWidth(m){super._onWidth(m),requestAnimationFrame(()=>{this.resultContainer&&(this.resultContainer.style.width=`${this.computeResultWidgetWidth()}px`)})}getModifiedModel(){var m;return(m=this.diffWidgetHandler)===null||m===void 0?void 0:m.getModifiedModel()}getOriginModel(){var m;return(m=this.diffWidgetHandler)===null||m===void 0?void 0:m.getOriginModel()}layout(){var m;return(m=this.diffWidgetHandler)===null||m===void 0?void 0:m.layout()}constructor(m,G){super(G.editor,{showArrow:!1,showFrame:!1,arrowColor:void 0,frameColor:void 0,keepEditorSelection:!0,showInHiddenAreas:!0}),this.id=m,this._onMaxLineCount=new b.Emitter,this.onMaxLineCount=this._onMaxLineCount.event,this._onReady=new b.Emitter,this.onReady=this._onReady.event,this.diffWidgetHandler=null,this.resultContainer=null,this._resolveResultWidget=null;const{selection:p,hiddenArea:N,editor:W}=G;this.range=p,this.hiddenArea=N||p,W.setHiddenAreas([this.hiddenArea],this.id)}revealRange(m,G){}setContainerStyle(m){var G;const p=Object.keys(m);for(const N of p)Object.prototype.hasOwnProperty.call((G=this.container)===null||G===void 0?void 0:G.style,N)&&(this.container.style[N]=m[N])}addClassName(m){return this.setCssClass(m),this}dispose(){this.hide(),super.dispose()}hide(){this.editor.setHiddenAreas([],this.id),super.hide(),this.root&&this.root.unmount()}showByLine(m,G=20){this.editor._modelData.viewModel.coordinatesConverter.modelPositionIsVisible=()=>!0,super.show({startLineNumber:m,startColumn:1,endLineNumber:m,endColumn:Number.MAX_SAFE_INTEGER},G)}setResolveResultWidget(m){this._resolveResultWidget=m}};n.__decorate([(0,f.Autowired)(b.AppConfig),n.__metadata("design:type",Object)],r.prototype,"configContext",void 0),r=n.__decorate([(0,f.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String,Object])],r),e.InlineDiffWidget=r},38890:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineDiffController=void 0;const n=t(41869),l=t(43718),o=t(57517),h=t(99906),f=t(83854),b=t(40111),g=t(49444);class v extends h.BaseAIMonacoEditorController{constructor(){super(...arguments),this._onMaxLineCount=new l.Emitter,this.onMaxLineCount=this._onMaxLineCount.event,this._previewerNodeStore=new Map}static get(u){return u.getContribution(v.ID)}get preferenceService(){return this.injector.get(n.PreferenceService)}get eventBus(){return this.injector.get(l.IEventBus)}mount(){return this.registerDispose(this.eventBus.on(o.EditorGroupCloseEvent,u=>{const c=u.payload.resource.uri.toString(),s=this.getStoredState(c);s&&s.previewerOptions.disposeWhenEditorClosed&&this.destroyPreviewer(c)})),this.registerInlineDiffFeature(this.monacoEditor),this}storeState(u){if(!this.previewer)return;const c=this.previewer.createNodeSnapshot();c&&this._previewerNodeStore.set(u,c)}tryRestoreState(u,c){const s=this.getStoredState(c);if(s){if(s.disposed){this.destroyPreviewer(c);return}return this.restoreState(u,s)}}restoreState(u,c){var s;if((s=u.getModel())===null||s===void 0?void 0:s.uri){this.previewer=this.injector.get(g.LiveInlineDiffPreviewer,[u]),this.previewer.attachNode(c),this.listenPreviewer(this.previewer);const r=this.previewer.onDispose(()=>{this.destroyPreviewer(),r.dispose()})}}registerInlineDiffFeature(u){const c=new l.Disposable,s=u.getModel();return c.addDispose(u.onWillChangeModel(a=>{if(!a.oldModelUrl)return;const r=a.oldModelUrl.toString();this.storeState(r),this.destroyPreviewer()})),c.addDispose(u.onDidChangeModel(a=>{a.newModelUrl&&this.tryRestoreState(u,a.newModelUrl.toString())})),s&&c.addDispose(s.onWillDispose(()=>{const a=s.uri.toString();this.destroyPreviewer(a)})),c}showPreviewerByStream(u,c){const{crossSelection:s,chatResponse:a}=c,r=new l.Disposable,d=this.createDiffPreviewer(u,s,c.previewerOptions),m=()=>{d.layout(),r.dispose()};return r.addDispose(d.onReady(()=>{if(b.InlineChatController.is(a)){const G=a;r.addDispose([G.onData(p=>{l.ReplyResponse.is(p)&&d.onData(p)}),G.onError(p=>{d.onError(p),m()}),G.onAbort(()=>{d.onAbort(),m()}),G.onEnd(()=>{d.onEnd(),m()})]),G.listen()}else d.setValue(a.message),m()})),d.layout(),d}createDiffPreviewer(u,c,s){const a=this.preferenceService.getValid(l.AINativeSettingSectionsId.InlineDiffPreviewMode,f.EInlineDiffPreviewMode.inlineLive);return this.destroyPreviewer(),a===f.EInlineDiffPreviewMode.sideBySide?this.previewer=this.injector.get(g.SideBySideInlineDiffWidget,[u]):this.previewer=this.injector.get(g.LiveInlineDiffPreviewer,[u]),this.previewer.create(c,s),this.previewer.show(c.startLineNumber-1,c.endLineNumber-c.startLineNumber+2),this.listenPreviewer(this.previewer),this.previewer}listenPreviewer(u){u&&u.addDispose(u.onLineCount(c=>this._onMaxLineCount.fire(c)))}getPreviewer(){return this.previewer}getStoredState(u){return this._previewerNodeStore.get(u)}handleAction(u){var c;(c=this.previewer)===null||c===void 0||c.handleAction(u)}getModifyContent(){var u;return(u=this.previewer)===null||u===void 0?void 0:u.getValue()}getOriginContent(){var u;return(u=this.previewer)===null||u===void 0?void 0:u.getOriginValue()}destroyPreviewer(u){var c;(c=this.previewer)===null||c===void 0||c.dispose(),this.previewer=void 0,u&&this._previewerNodeStore.delete(u)}revealFirstDiff(){var u;(u=this.previewer)===null||u===void 0||u.revealFirstDiff()}}e.InlineDiffController=v,v.ID="editor.contrib.ai.inline.diff"},7046:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PartialEventEmitter=void 0,e.PartialEventEmitter=Symbol("PartialEventEmitter")},53182:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineHintLineDecoration=void 0;const n=t(85608),l=t(76003),o=t(41869),h=t(57925),f=t(43718),b=t(20868),g=t(60304),v=t(52416),I=t(75189),u="inline_hint_description",c="inline_hint_description_key";let s=class extends f.Disposable{constructor(r){super(),this.monacoEditor=r,this.colorRegister=(0,v.getColorRegistry)(),g.StandaloneServices.get(I.ICodeEditorService).registerDecorationType(u,c,{isWholeLine:!0}),this.addDispose(f.Disposable.create(()=>{this.monacoEditor.setDecorationsByType(u,c,[])}))}getSequenceKeyString(){var r;const m=(r=this.keybindingRegistry.getKeybindingsForCommand(h.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||r===void 0?void 0:r.resolved;return m?this.keybindingRegistry.acceleratorForSequence(m,"+"):""}async show(r){var d;const m=(0,f.formatLocalize)("aiNative.inline.hint.widget.placeholder",this.getSequenceKeyString()),G=await this.themeService.getCurrentTheme(),p=this.colorRegister.resolveDefaultColor(v.inputPlaceholderForeground,G);this.monacoEditor.setDecorationsByType(u,c,[{range:b.Range.fromPositions(r),renderOptions:{after:{contentText:m,opacity:"0.5",color:(d=p?.toString())!==null&&d!==void 0?d:"",padding:"0 0 0 12px",width:"max-content"}}}])}};n.__decorate([(0,l.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],s.prototype,"keybindingRegistry",void 0),n.__decorate([(0,l.Autowired)(v.IThemeService),n.__metadata("design:type",Object)],s.prototype,"themeService",void 0),s=n.__decorate([(0,l.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],s),e.InlineHintLineDecoration=s},77886:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineHintController=void 0;const n=t(43718),l=t(77714),o=t(23028),h=t(99906),f=t(71863),b=t(74353),g=t(97139),v=t(53182);class I extends h.BaseAIMonacoEditorController{static get(c){return c.getContribution(I.ID)}get inlineCompletionsService(){return this.injector.get(f.AICompletionsService)}get inlineInputChatService(){return this.injector.get(b.InlineInputChatService)}mount(){return this.registerHintLineFeature(this.monacoEditor)}registerHintLineFeature(c){const s=new n.Disposable,a=this.injector.get(o.AINativeContextKey,[c.contextKeyService]),r=()=>{s.dispose()},d=m=>{var G;const p=c.getModel();if(!p||this.inlineCompletionsService.isVisibleCompletion)return;const N=p.getLineContent(m.lineNumber),W=p.getLineDecorations(m.lineNumber),Z=N?.trim()===l.empty,y=(G=c.getSelection())===null||G===void 0?void 0:G.isEmpty(),E=W.some(R=>R.options.description===g.InlineInputPreviewDecorationID);if(Z&&y&&!E){const R=this.injector.get(v.InlineHintLineDecoration,[c]);R.show(m),this.inlineInputChatService.setCurrentVisiblePosition(m),a.inlineHintWidgetIsVisible.set(!0),s.addDispose(R.onDispose(()=>{this.inlineInputChatService.setCurrentVisiblePosition(void 0),a.inlineHintWidgetIsVisible.set(!1)})),s.addDispose(R)}};return this.addDispose(c.onDidChangeCursorPosition(m=>{r(),d(m.position)})),this.addDispose(c.onDidFocusEditorWidget(()=>{const m=c.getPosition();m&&(r(),d(m))})),this.addDispose(c.onDidBlurEditorWidget(()=>{r()})),this.addDispose(this.inlineCompletionsService.onVisibleCompletion(m=>{m&&r()})),this.addDispose(s),this}}e.InlineHintController=I,I.ID="editor.contrib.ai.inline.hint"},32213:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineInputChatWidget=void 0;const n=t(85608),l=n.__importStar(t(14041)),o=t(76003),h=t(89195),f=t(43718),b=t(90052),g=t(90614),v=t(31031),I=t(26664),u=n.__importDefault(t(13185)),c=t(74353),s=r=>{const{onClose:d,onInteractiveInputSend:m,onLayoutChange:G,onChatStatus:p,onResultClick:N}=r,[W,Z]=(0,l.useState)(v.EInlineChatStatus.READY),[y,E]=(0,l.useState)("");(0,l.useEffect)(()=>{const _=new f.Disposable;return _.addDispose(p(H=>Z(H))),()=>{_.dispose()}},[p]);const R=(0,l.useMemo)(()=>W===v.EInlineChatStatus.THINKING,[W]),A=(0,l.useMemo)(()=>W===v.EInlineChatStatus.DONE,[W]),w=(0,l.useMemo)(()=>W===v.EInlineChatStatus.ERROR,[W]),F=(0,l.useCallback)(()=>{d?.()},[d]),V=(0,l.useCallback)(_=>{m?.(_)},[m]),Y=(0,l.useCallback)(_=>{E(_)},[]);return w?null:A?l.default.createElement(g.InlineResultAction,{onResultClick:N}):l.default.createElement(h.AIAction,{loadingShowOperation:!0,onClose:F,loading:R,customOperationRender:l.default.createElement(h.InteractiveInput,{autoFocus:!0,onHeightChange:_=>G(_),size:"small",placeholder:(0,f.localize)("aiNative.inline.chat.input.placeholder.default"),width:320,value:y,onValueChange:Y,disabled:R,onSend:V})})};let a=class extends I.AIInlineContentWidget{constructor(){super(...arguments),this.allowEditorOverflow=!0,this.positionPreference=[b.ContentWidgetPositionPreference.ABOVE]}dispose(){super.dispose(),this.inlineInputChatService.hide()}id(){return f.AIInlineInputChatContentWidgetId}renderView(){return l.default.createElement("div",{className:u.default.input_wrapper},l.default.createElement(s,{onClose:()=>this.dispose(),onChatStatus:this.onStatusChange.bind(this),onLayoutChange:()=>{this.editor.layoutContentWidget(this)},onInteractiveInputSend:d=>{this.launchChatStatus(v.EInlineChatStatus.THINKING),this._onInteractiveInputValue.fire(d)},onResultClick:d=>{this._onResultClick.fire(d)}}))}};n.__decorate([(0,o.Autowired)(c.InlineInputChatService),n.__metadata("design:type",c.InlineInputChatService)],a.prototype,"inlineInputChatService",void 0),a=n.__decorate([(0,o.Injectable)({multiple:!0})],a),e.InlineInputChatWidget=a},89060:(L,e,t)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.InlineInputController=void 0;const l=t(85608),o=t(76003),h=t(43718),f=l.__importStar(t(20868)),b=t(2261),g=t(52451),v=t(88104),I=t(23028),u=t(99906),c=t(77633),s=t(40111),a=t(31031),r=t(97139),d=t(32213),m=l.__importDefault(t(13185)),G=t(74353);let p=n=class extends u.BaseAIMonacoEditorController{static get(W){return W.getContribution(n.ID)}get inlineInputChatService(){return this.injector.get(G.InlineInputChatService)}get inlineChatFeatureRegistry(){return this.injector.get(h.InlineChatFeatureRegistryToken)}mount(){return this.registerInlineInputFeature(this.monacoEditor)}async doRequestReadable(W,Z,y,E,R,A){const w=this.inlineChatFeatureRegistry.getInteractiveInputHandler(),F=y.getModel();if(!w||!F)return;Z.launchChatStatus(a.EInlineChatStatus.THINKING);const V=await this.inlineChatFeatureRegistry.getInteractiveInputStrategyHandler()(y,W);if(V===c.ERunStrategy.EXECUTE&&w.execute){w.execute(y,W,this.token),Z.launchChatStatus(a.EInlineChatStatus.DONE),A();return}if(V===c.ERunStrategy.PREVIEW&&w.providePreviewStrategy){const Y=await w.providePreviewStrategy(y,W,this.token);if(h.CancelResponse.is(Y)){Z.launchChatStatus(a.EInlineChatStatus.READY),A();return}if(s.InlineChatController.is(Y)){const _=Y;let H;const X=this.registerDispose(new h.RunOnceScheduler(()=>{const S=R.getRange(0);S&&H&&F.pushEditOperations(null,[b.EditOperation.replace(S,H)],()=>null)},16*12.5));E.addDispose([_.onData(async S=>{h.ReplyResponse.is(S)&&(H=S.message,X.isScheduled()||X.schedule())}),_.onError(S=>{Z.launchChatStatus(a.EInlineChatStatus.ERROR)}),_.onAbort(()=>{Z.launchChatStatus(a.EInlineChatStatus.READY)}),_.onEnd(()=>{F.pushStackElement(),Z.launchChatStatus(a.EInlineChatStatus.DONE)})]),_.listen()}}}registerInlineInputFeature(W){const Z=new h.Disposable,y=this.injector.get(I.AINativeContextKey,[W.contextKeyService]),E=()=>{Z.dispose()};this.addDispose(this.inlineInputChatService.onInteractiveInputVisibleInPosition(A=>{E(),A&&R(A,W)}));const R=(A,w)=>{this.addDispose(w.onWillChangeModel(()=>{E()}));const F=w.getModel();if(!F||!w.hasTextFocus())return;const Y=this.injector.get(d.InlineInputChatWidget,[w]),_=w.createDecorationsCollection();_.append([{range:f.Range.fromPositions(A),options:v.ModelDecorationOptions.register({description:r.InlineInputPreviewDecorationID,isWholeLine:!0,className:m.default.input_decoration_readable_container,inlineClassName:m.default.inline_chat_inserted_range})}]);const H=_.getRange(0);let X=g.LineRange.fromRange(H);Y.show({position:H.getStartPosition()}),y.inlineInputWidgetIsVisible.set(!0),Z.addDispose(Y.onDispose(()=>{this.cancelToken(),_.clear(),y.inlineInputWidgetIsVisible.set(!1)})),Z.addDispose(Y.onResultClick(async S=>{const Q=()=>{const k=_.getRange(0);F.pushStackElement(),F.pushEditOperations(null,[b.EditOperation.delete(k)],()=>null),F.pushStackElement()};switch(S){case a.EResultKind.ACCEPT:E();break;case a.EResultKind.DISCARD:Q(),E();break;case a.EResultKind.REGENERATE:Q(),await this.doRequestReadable(Y.interactiveInputValue,Y,w,Z,_,E);break;default:break}})),Z.addDispose(h.Event.debounce(_.onDidChange.bind(_),()=>{},h.FRAME_THREE)(()=>{if(!_.getRange(0))return;const S=_.getRange(0),Q=g.LineRange.fromRange(S);X.equals(Q)||(Y.setOptions({position:S.getStartPosition()}),Y.layoutContentWidget()),X=Q})),Z.addDispose(Y.onInteractiveInputValue(async S=>{await this.doRequestReadable(S,Y,w,Z,_,E)})),Z.addDispose(Y)};return this.addDispose(Z),this}};p.ID="editor.contrib.ai.inline.input",p=n=l.__decorate([(0,o.Injectable)()],p),e.InlineInputController=p},74353:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineInputChatService=void 0;const n=t(85608),l=t(76003),o=t(43718);let h=class{constructor(){this._onInteractiveInputVisibleInPosition=new o.Emitter,this.onInteractiveInputVisibleInPosition=this._onInteractiveInputVisibleInPosition.event}get currentVisiblePosition(){return this._currentVisiblePosition}setCurrentVisiblePosition(b){this._currentVisiblePosition=b}visible(){this._onInteractiveInputVisibleInPosition.fire(this._currentVisiblePosition)}hide(){this._onInteractiveInputVisibleInPosition.fire(void 0)}};h=n.__decorate([(0,l.Injectable)()],h),e.InlineInputChatService=h},76755:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineStreamDiffComputer=void 0;const n=t(9514),l=t(52451),o=t(37348),h=t(44781),f=t(68450),b=t(95821),g=t(89216),v=t(10438),I=t(30861),u=t(46739),c=(a,r,d=f.InfiniteTimeout.instance)=>{if(!a.length||!r.length)return f.DiffAlgorithmResult.trivial(a,r);const m=new v.Array2D(2*a.length+1,r.length+1),G=new v.Array2D(2*a.length+1,r.length+1);for(let R=0;R<=r.length;R++)m.set(0,R,R),G.set(0,R,R>0);for(let R=0;R<=2*a.length;R++)m.set(R,0,Math.floor((R+1)/2)),G.set(R,0,!1);for(let R=1;R<=r.length;R++)for(let A=1;A<=2*a.length;A++){if(!d.isValid())return f.DiffAlgorithmResult.trivialTimedOut(a,r);if(A%2===0){const w=m.get(A,R-1)+1,F=m.get(A-1,R),V=w<F;m.set(A,R,V?w:F),G.set(A,R,V)}else{const w=m.get(A-1,R)+.4,F=a.getElement(Math.floor(A/2))===r.getElement(R-1)?m.get(A-1,R-1):Number.MAX_VALUE,V=F<w;m.set(A,R,V?F:w),G.set(A,R,V)}}let p=Number.MAX_VALUE,N=-1;for(let R=0;R<=2*a.length;R++){const A=m.get(R,r.length);A<p&&(p=A,N=R)}const W=[];let Z=N,y=r.length;Z<=2*a.length-2&&W.push(new f.SequenceDiff(new o.OffsetRange(Math.floor((Z+1)/2),a.length),new o.OffsetRange(y,y)));let E;for(;Z>=0&&y>=0;)G.get(Z,y)?(Z%2===0?E===void 0&&(E={originalLineIndex:Math.floor(Z/2),modifiedLineIndex:y}):(E!==void 0&&((E.originalLineIndex!==Math.floor(Z/2)+1||E.modifiedLineIndex!==y)&&W.push(new f.SequenceDiff(new o.OffsetRange(Math.floor(Z/2)+1,E.originalLineIndex),new o.OffsetRange(y,E.modifiedLineIndex))),E=void 0),Z-=1),y-=1):(E=E||{originalLineIndex:Math.floor((Z+1)/2),modifiedLineIndex:y},Z-=1);return E!==void 0&&((E.originalLineIndex!==Math.floor(Z/2)+1||E.modifiedLineIndex!==y)&&W.push(new f.SequenceDiff(new o.OffsetRange(Math.floor(Z/2)+1,E.originalLineIndex),new o.OffsetRange(y,E.modifiedLineIndex))),E=void 0),W.reverse(),new f.DiffAlgorithmResult(W,!1)};class s extends b.DefaultLinesDiffComputer{computeDiff(r,d,m){if(r.length<=1&&(0,n.equals)(r,d,(Y,_)=>Y===_))return new I.LinesDiff([],[],!1);if(r.length===1&&r[0].length===0||d.length===1&&d[0].length===0)return new I.LinesDiff([new u.DetailedLineRangeMapping(new l.LineRange(1,r.length+1),new l.LineRange(1,d.length+1),[new u.RangeMapping(new h.Range(1,1,r.length,r[r.length-1].length+1),new h.Range(1,1,d.length,d[d.length-1].length+1))])],[],!1);const G=m.maxComputationTimeMs===0?f.InfiniteTimeout.instance:new f.DateTimeout(m.maxComputationTimeMs),p=new Map;function N(Y){let _=p.get(Y);return _===void 0&&(_=p.size,p.set(Y,_)),_}const W=r.length*d.length<1e6&&m.onlyCareAboutPrefixOfOriginalLines,Z=r.map(Y=>N(W?Y:Y.trim())),y=d.map(Y=>N(W?Y:Y.trim())),E=new g.LineSequence(Z,r),R=new g.LineSequence(y,d),A=r.every(Y=>Y.trim().length===0);let w;W?A?w=f.DiffAlgorithmResult.trivial(E,R):w=c(E,R,G):E.length+R.length<1700?w=this.dynamicProgrammingDiffing.compute(E,R,G,(Y,_)=>r[Y]===d[_]?d[_].length===0?.1:1+Math.log(1+d[_].length):.99):w=this.myersDiffingAlgorithm.compute(E,R,G);const F=w.diffs,V=w.hitTimeout;if(W){const Y=F.map(_=>new u.DetailedLineRangeMapping(new l.LineRange(_.seq1Range.start+1,_.seq1Range.endExclusive+1),new l.LineRange(_.seq2Range.start+1,_.seq2Range.endExclusive+1),[]));return new I.LinesDiff(Y,[],V)}return super.computeDiff(r,d,m)}}e.InlineStreamDiffComputer=s},33062:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineStreamDiffHandler=e.EComputerMode=void 0;const n=t(85608),l=t(76003),o=t(41869),h=t(20868),f=t(60304),b=t(52451),g=t(84968),v=t(46739),I=t(87822),u=t(25539),c=t(76755),s=t(80715);var a;(function(m){m.legacy="legacy",m.default="default"})(a=e.EComputerMode||(e.EComputerMode={}));const r=new c.InlineStreamDiffComputer;let d=class extends o.Disposable{constructor(G){super(),this.monacoEditor=G,this._onDidEditChange=this.registerDispose(new o.Emitter),this.onDidEditChange=this._onDidEditChange.event,this.rawOriginalTextLinesTokens=[],this.currentEditLine=0,this.finallyDiffModel=null,this.isEditing=!1,this.undoRedoGroup=new u.UndoRedoGroup;const p=f.StandaloneServices.get(I.IModelService);this.virtualModel=p.createModel("",null,o.Uri.from({scheme:o.Schemes.inMemory,path:"inline-stream-diff/"+(0,o.randomString)(8)}),!0),this.originalModel=this.monacoEditor.getModel(),this.livePreviewDiffDecorationModel=this.injector.get(s.LivePreviewDiffDecorationModel,[this.monacoEditor]),this.addDispose(this.livePreviewDiffDecorationModel),this.addDispose(this.virtualModel);const N=this.livePreviewDiffDecorationModel.onDispose(()=>{this.dispose(),N.dispose()})}setPreviewerOptions(G){this.previewerOptions=G,this.livePreviewDiffDecorationModel.setPreviewerOptions({partialEditWidgetOptions:{hideAcceptPartialEditWidget:G.hideAcceptPartialEditWidget}})}initialize(G){const p=this.originalModel.getEOL(),N=G.getStartPosition(),W=G.getEndPosition();this.rawOriginalTextLines=this.originalModel.getValueInRange(h.Range.fromPositions(N,W)).split(p),this.rawOriginalTextLinesTokens=this.rawOriginalTextLines.map((y,E)=>{const R=N.lineNumber+E;return this.originalModel.tokenization.forceTokenization(R),this.originalModel.tokenization.getLineTokens(R)});const Z=b.LineRange.fromRangeInclusive(h.Range.fromPositions({lineNumber:G.startLineNumber,column:1},{lineNumber:G.endLineNumber,column:Number.MAX_SAFE_INTEGER}));this.livePreviewDiffDecorationModel.initialize(Z)}restoreSnapshot(G){this._snapshotStore=G;const{rawOriginalTextLines:p,rawOriginalTextLinesTokens:N,undoRedoGroup:W,decorationSnapshotData:Z,previewerOptions:y}=G;this.setPreviewerOptions(y),this.rawOriginalTextLines=p,this.rawOriginalTextLinesTokens=N,this.undoRedoGroup=W,this.livePreviewDiffDecorationModel.initialize(Z.zone)}get currentSnapshotStore(){return this._snapshotStore}restoreDecorationSnapshot(G){this.livePreviewDiffDecorationModel.restoreSnapshot(G)}createSnapshot(){return{rawOriginalTextLines:this.rawOriginalTextLines,rawOriginalTextLinesTokens:this.rawOriginalTextLinesTokens,undoRedoGroup:this.undoRedoGroup,decorationSnapshotData:this.livePreviewDiffDecorationModel.createSnapshot(),previewerOptions:this.previewerOptions}}getVirtualModelValue(){return this.virtualModel.getValue()}getOriginModelValue(){return this.rawOriginalTextLines.join(`
28078
+ `)}get onPartialEditWidgetListChange(){return this.livePreviewDiffDecorationModel.onPartialEditWidgetListChange}computeDiff(G,p,N=a.default){const W=(N===a.default?r:g.linesDiffComputers.getLegacy()).computeDiff(G,p,{computeMoves:!1,maxComputationTimeMs:200,ignoreTrimWhitespace:!1,onlyCareAboutPrefixOfOriginalLines:!0});let Z=W.changes;W.hitTimeout&&(Z=[new v.DetailedLineRangeMapping(new b.LineRange(1,G.length+1),new b.LineRange(1,p.length+1),void 0)]);const y=[];let E=[];for(const F of Z)if(F.modified.endLineNumberExclusive===p.length+1&&N===a.default){if(E=G.slice(F.original.startLineNumber-1,F.original.endLineNumberExclusive-1),F.modified.isEmpty)continue;y.push({removedTextLines:[],removedLinesOriginalRange:new b.LineRange(F.original.startLineNumber,F.original.startLineNumber),addedRange:F.modified,relativeInnerChanges:void 0})}else y.push({removedTextLines:G.slice(F.original.startLineNumber-1,F.original.endLineNumberExclusive-1),removedLinesOriginalRange:F.original,addedRange:F.modified,relativeInnerChanges:F.innerChanges?F.innerChanges.map(V=>({originalRange:V.originalRange.delta(-F.original.startLineNumber+1),modifiedRange:V.modifiedRange.delta(-F.modified.startLineNumber+1)})):void 0});const R=[...p,...E];let A=0,w=new b.LineRange(1,1);return E.length>0&&(A=p.length+1,w=new b.LineRange(p.length+1,p.length+1+E.length)),{changes:y,newFullRangeTextLines:R,activeLine:A,pendingRange:w}}calculateAddedDecorationCollectionState(G){const p=this.getZone();return G.changes.map(W=>{const Z=W.addedRange,y={lineNumber:p.startLineNumber+Z.startLineNumber-1,column:1},E={lineNumber:p.startLineNumber+Z.endLineNumberExclusive-2,column:1};return{startPosition:y,endPosition:E,len:Z.endLineNumberExclusive-Z.startLineNumber}})}renderPartialEditWidgets(G){const p=this.calculateAddedDecorationCollectionState(G);this.livePreviewDiffDecorationModel.touchPartialEditWidgets(p.map(N=>N.startPosition.lineNumber))}renderAddedRangeDecoration(G){const p=this.calculateAddedDecorationCollectionState(G);this.livePreviewDiffDecorationModel.touchAddedRange(p)}renderRemovedRangeDecoration(G){const{changes:p}=G,N=this.getZone();let W=0;const Z=[];for(const y of p){const{removedTextLines:E,removedLinesOriginalRange:R,addedRange:A}=y;E.length>0&&Z.push({position:{column:1,lineNumber:N.startLineNumber+R.startLineNumber-2-W},textLines:E.map((w,F)=>({text:w,lineTokens:this.rawOriginalTextLinesTokens[R.startLineNumber-1+F]}))}),W+=R.length-A.length}this.livePreviewDiffDecorationModel.touchRemovedWidget(Z)}pushStackElement(){const G=this.livePreviewDiffDecorationModel.createEditStackElement(this.undoRedoGroup);G.attachModel(this.livePreviewDiffDecorationModel),G.registerUndo(p=>{p.dispose()})}handleEdits(G){const{activeLine:p,newFullRangeTextLines:N,pendingRange:W}=G,Z=this.originalModel.getEOL(),y=this.getZone(),E=y.startLineNumber<y.endLineNumberExclusive?new h.Range(y.startLineNumber,1,y.endLineNumberExclusive-1,this.originalModel.getLineMaxColumn(y.endLineNumberExclusive-1)):new h.Range(y.startLineNumber,1,y.startLineNumber,1),R=this.originalModel.getValueInRange(E).split(Z),A=g.linesDiffComputers.getDefault().computeDiff(R,N,{computeMoves:!1,maxComputationTimeMs:200,ignoreTrimWhitespace:!1}),w=[];if(A.hitTimeout){let F=N.join(Z);E.isEmpty()&&(F+=Z);const V={range:E,text:F,forceMoveMarkers:!1};w.push(V)}else for(const F of A.changes){let V=N.slice(F.modified.startLineNumber-1,F.modified.endLineNumberExclusive-1).join(Z),Y;F.original.isEmpty?(Y=new h.Range(E.startLineNumber+F.original.startLineNumber-1,1,E.startLineNumber+F.original.startLineNumber-1,1),V+=Z):F.modified.isEmpty?(Y=new h.Range(E.startLineNumber+F.original.startLineNumber-1,1,E.startLineNumber+F.original.endLineNumberExclusive-1,1),V=null):Y=new h.Range(E.startLineNumber+F.original.startLineNumber-1,1,E.startLineNumber+F.original.endLineNumberExclusive-2,this.originalModel.getLineMaxColumn(E.startLineNumber+F.original.endLineNumberExclusive-2));const _={range:Y,text:V,forceMoveMarkers:!1};w.push(_)}this.originalModel.pushEditOperations(null,w,()=>null,this.undoRedoGroup),this.livePreviewDiffDecorationModel.updateZone(new b.LineRange(y.startLineNumber,y.startLineNumber+N.length)),p>0?this.livePreviewDiffDecorationModel.touchActiveLine(p):this.livePreviewDiffDecorationModel.clearActiveLine(),this.renderAddedRangeDecoration(G),W.length>0?this.livePreviewDiffDecorationModel.touchPendingRange(W):this.livePreviewDiffDecorationModel.clearPendingLine(),this.renderRemovedRangeDecoration(G),this._onDidEditChange.fire()}recompute(G,p){p&&this.virtualModel.setValue(p);const N=this.virtualModel.getLinesContent();return this.computeDiff(this.rawOriginalTextLines,N,G)}async rateEditController(){if(this.isEditing===!1){for(this.isEditing=!0;this.currentEditLine<=this.virtualModel.getLinesContent().length;){if(this.disposed)return;const p=this.virtualModel.getLinesContent().slice(0,this.currentEditLine),N=this.computeDiff(this.rawOriginalTextLines,p);this.handleEdits(N),this.currentEditLine+=1,await(0,o.sleep)(o.FRAME_THREE)}this.finallyDiffModel&&this.finallyRender(this.finallyDiffModel),this.isEditing=!1}}addLinesToDiff(G,p=a.default){this.recompute(p,G),this.rateEditController()}pushRateFinallyDiffStack(G){this.finallyDiffModel=G,this.isEditing===!1&&this.finallyRender(this.finallyDiffModel)}finallyRender(G){this.renderPartialEditWidgets(G),this.handleEdits(G),this.pushStackElement(),this.monacoEditor.focus()}acceptAll(){this.livePreviewDiffDecorationModel.acceptUnProcessed(),this.dispose()}rejectAll(){this.livePreviewDiffDecorationModel.discardUnProcessed(),this.dispose()}revealFirstDiff(){this.livePreviewDiffDecorationModel.revealFirstDiff()}getZone(){return this.livePreviewDiffDecorationModel.getZone()}getTotalCodeInfo(){return this.livePreviewDiffDecorationModel.getTotalCodeInfo()}};n.__decorate([(0,l.Autowired)(l.INJECTOR_TOKEN),n.__metadata("design:type",l.Injector)],d.prototype,"injector",void 0),d=n.__decorate([(0,l.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],d),e.InlineStreamDiffHandler=d},22169:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineStreamDiffService=void 0;const n=t(85608),l=t(76003),o=t(43718);let h=class{constructor(){this._onAcceptDiscardPartialEdit=new o.Emitter,this.onAcceptDiscardPartialEdit=this._onAcceptDiscardPartialEdit.event}launchAcceptDiscardPartialEdit(b){this._onAcceptDiscardPartialEdit.fire(b)}};h=n.__decorate([(0,l.Injectable)()],h),e.InlineStreamDiffService=h},54362:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LivePreviewUndoRedoStackElement=void 0;const n=t(25539);class l{get type(){return n.UndoRedoElementType.Resource}get label(){return"Live.Preview.UndoRedo"}get code(){return"Live.Preview.UndoRedo"}get resource(){return this.model.uri}constructor(h){this.model=h,this.confirmBeforeUndo=!1}attachModel(h){this.decorationModel=h}registerUndo(h){this._undo=h}undo(){var h;(h=this._undo)===null||h===void 0||h.call(this,this.decorationModel)}registerRedo(h){this._redo=h}redo(){var h;(h=this._redo)===null||h===void 0||h.call(this,this.decorationModel)}}e.LivePreviewUndoRedoStackElement=l},8106:(L,e,t)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.RemovedZoneWidget=e.AcceptPartialEditWidget=e.EPartialEdit=e.PendingRangeDecoration=e.AddedRangeDecoration=e.ActiveLineDecoration=void 0;const l=t(85608),o=l.__importDefault(t(53373)),h=l.__importStar(t(14041)),f=l.__importDefault(t(25873)),b=t(76003),g=t(41869),v=t(57925),I=t(43718),u=t(52659),c=t(90052),s=t(31324),a=t(34819),r=t(24522),d=l.__importDefault(t(71749));e.ActiveLineDecoration="activeLine-decoration",e.AddedRangeDecoration="added-range-decoration",e.PendingRangeDecoration="pending-range-decoration";var m;(function(Z){Z.accept="accept",Z.discard="discard"})(m=e.EPartialEdit||(e.EPartialEdit={}));const G=Z=>{const{keyStrings:y,onAccept:E,onDiscard:R,editor:A}=Z,[w,F]=h.default.useState(0),V=(0,h.useCallback)(()=>{E?.()},[E]),Y=(0,h.useCallback)(()=>{R?.()},[R]);return(0,g.useDisposable)(()=>A.onDidScrollChange(_=>{const{scrollLeftChanged:H,scrollLeft:X}=_;H&&F(X)}),[A]),h.default.createElement("div",{className:(0,o.default)("kt-inline-diff-accept-partial-widget-container",d.default.inline_diff_accept_partial_widget_container),style:{marginLeft:w}},h.default.createElement("div",{className:d.default.content},h.default.createElement("span",{className:(0,o.default)(d.default.accept_btn,d.default.btn),onClick:V},y.acceptSequence),h.default.createElement("span",{className:(0,o.default)(d.default.discard_btn,d.default.btn),onClick:Y},y.discardSequence)))};let p=n=class extends u.ReactInlineContentWidget{constructor(y,E){super(y),this.editor=y,this.editWidgetOptions=E,this._onAccept=this.registerDispose(new I.Emitter),this.onAccept=this._onAccept.event,this._onDiscard=this.registerDispose(new I.Emitter),this.onDiscard=this._onDiscard.event,this.positionPreference=[c.ContentWidgetPositionPreference.EXACT],this.addedLinesCount=0,this.deletedLinesCount=0,this.status="pending"}get group(){return this._group}getSequenceKeyStrings(){let y=this.keybindingRegistry.getKeybindingsForCommand(v.AI_INLINE_DIFF_PARTIAL_EDIT.id);if(y=y.sort((E,R)=>R.args-E.args),!(!y||y.length!==2&&y.some(E=>(0,I.isUndefined)(E.resolved))))return{acceptSequence:this.keybindingRegistry.acceleratorForSequence(y[0].resolved,"")[0],discardSequence:this.keybindingRegistry.acceleratorForSequence(y[1].resolved,"")[0]}}renderView(){var y;if(!((y=this.editWidgetOptions)===null||y===void 0)&&y.hideAcceptPartialEditWidget)return;const E=this.getSequenceKeyStrings();if(E)return h.default.createElement(G,{keyStrings:E,onAccept:()=>this._onAccept.fire(),onDiscard:()=>this._onDiscard.fire(),editor:this.editor})}id(){return this._id||(this._id=`${n.ID}_${(0,I.uuid)(4)}`),this._id}getClassName(){return d.default.accept_partial_edit_widget_id}recordDecorationId(y){this._decorationId=y}getDecorationId(){return this._decorationId}resume(){this.status="pending",this.addedLinesCount=0,this.deletedLinesCount=0,super.resume()}setGroup(y){this._group=y}get isPending(){return this.status==="pending"}accept(y,E){this.status="accept",this.addedLinesCount=y,this.deletedLinesCount=E,super.hide()}get isAccepted(){return this.status==="accept"}discard(y,E){this.status="discard",this.addedLinesCount=y,this.deletedLinesCount=E,super.hide()}get isRejected(){return this.status==="discard"}};p.ID="AcceptPartialEditWidgetID",l.__decorate([(0,b.Autowired)(g.KeybindingRegistry),l.__metadata("design:type",Object)],p.prototype,"keybindingRegistry",void 0),p=n=l.__decorate([(0,b.Injectable)({multiple:!0}),l.__metadata("design:paramtypes",[Object,Object])],p),e.AcceptPartialEditWidget=p;const N=({dom:Z,editor:y})=>{const E=h.default.useRef(null),[R,A]=h.default.useState(0),[w,F]=h.default.useState(0);return(0,h.useEffect)(()=>{Z&&E&&E.current&&E.current.appendChild(Z)},[Z,E]),(0,g.useDisposable)(()=>y.onDidScrollChange(V=>{const{scrollLeftChanged:Y,scrollLeft:_}=V;Y&&A(_)}),[y]),(0,g.useDisposable)(()=>(F(y.getOption(s.EditorOption.layoutInfo).contentLeft),y.onDidChangeConfiguration(V=>{V.hasChanged(s.EditorOption.layoutInfo)&&F(y.getOption(s.EditorOption.layoutInfo).contentLeft)})),[y]),h.default.createElement("div",{className:d.default.inline_diff_remove_zone_fixed_box,style:{marginLeft:w+"px"}},h.default.createElement("div",{className:d.default.inline_diff_remove_zone,ref:E,style:{marginLeft:-R+"px"}}))};class W extends a.ZoneWidget{get isHidden(){return this._hidden}get group(){return this._group}constructor(y,E,R){super(y,R),this.textLines=E,this._hidden=!1,(0,I.isDefined)(R.isHidden)&&(this._hidden=R.isHidden),(0,I.isDefined)(R.recordPosition)&&(this._recordPosition=R.recordPosition),(0,I.isDefined)(R.undoRedoGroup)&&(this._group=R.undoRedoGroup);const A=this._positionMarkerId;this._disposables.add(A.onDidChange(w=>{const F=A.getRange(0);F&&(this._recordPosition=F.getStartPosition())}))}setGroup(y){this._group=y}_fillContainer(y){y.classList.add(d.default.inline_diff_remove_zone_widget_container),this.root=f.default.createRoot(y)}getRemovedTextLines(){return this.textLines.map(y=>y.text)}get height(){return this.textLines.length}getLastPosition(){return this.position||this._recordPosition}hide(){this._hidden=!0,super.hide()}resume(){const y=this.getLastPosition();y&&this.show(y,this.height)}show(y,E){this._hidden=!1,super.show(y,E)}revealRange(){}create(){super.create(),this.mountRender()}mountRender(){const y=document.createElement("div");(0,r.renderLines)(y,this.editor.getOption(s.EditorOption.tabIndex),this.textLines.map(({text:E,lineTokens:R})=>({content:E,decorations:[],lineTokens:R})),this.editor.getOptions()),this.root.render(h.default.createElement(N,{dom:y,editor:this.editor}))}dispose(){this.root.unmount(),super.dispose()}}e.RemovedZoneWidget=W},80715:(L,e,t)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.LivePreviewDiffDecorationModel=void 0;const l=t(85608),o=t(76003),h=t(41869),f=t(43718),b=t(20868),g=t(60304),v=t(2261),I=t(88104),u=t(25539),c=t(23028),s=t(53617),a=t(15989),r=l.__importDefault(t(71749)),d=t(22169),m=t(54362),G=t(8106);let p=n=class extends f.Disposable{constructor(W){super(),this.monacoEditor=W,this._onPartialEditWidgetListChange=this.registerDispose(new f.Emitter),this.onPartialEditWidgetListChange=this._onPartialEditWidgetListChange.event,this.options={partialEditWidgetOptions:{}},this.partialEditWidgetList=[],this.removedZoneWidgets=[],this.model=this.monacoEditor.getModel(),this.undoRedoService=g.StandaloneServices.get(u.IUndoRedoService),this.activeLineDec=this.monacoEditor.createDecorationsCollection(),this.pendingRangeDec=this.monacoEditor.createDecorationsCollection(),this.aiNativeContextKey=this.injector.get(c.AINativeContextKey,[this.monacoEditor.contextKeyService]),this.addDispose(this.inlineStreamDiffService.onAcceptDiscardPartialEdit(Z=>{const y=this.monacoEditor.getPosition(),E=this.partialEditWidgetList.filter(R=>!R.isHidden).sort((R,A)=>{var w,F,V,Y;const _=((F=(w=R.getPosition())===null||w===void 0?void 0:w.position)===null||F===void 0?void 0:F.lineNumber)||1,H=((Y=(V=A.getPosition())===null||V===void 0?void 0:V.position)===null||Y===void 0?void 0:Y.lineNumber)||1,X=Math.abs(y.lineNumber-_),S=Math.abs(y.lineNumber-H);return X-S});E.length>0&&this.handlePartialEditAction(Z?G.EPartialEdit.accept:G.EPartialEdit.discard,E[0])})),this.addedRangeDec=new s.EnhanceDecorationsCollection(this.monacoEditor),this.addDispose(this.addedRangeDec.onDidDecorationsChange(Z=>{this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.get()&&this.partialEditWidgetList.forEach(E=>{const R=Z.find(A=>E.getDecorationId()===A.id);if(R){const A=R.getRange();E.setOptions({position:{lineNumber:A.startLineNumber,column:1}}),E.layoutContentWidget()}})})),this.addDispose(f.Disposable.create(()=>{this.clear()}))}clear(){this.clearPendingLine(),this.clearActiveLine(),this.clearAddedLine(),this.clearRemovedWidgets(),this.clearPartialEditWidgetList()}initialize(W){this.updateZone(W)}getRemovedWidgets(){return this.removedZoneWidgets}restoreSnapshot(W){const{addedDecList:Z,removedWidgetList:y,zone:E,editStackSnapshot:R,partialEditWidgetList:A}=W;this.updateZone(E),this.addedRangeDec.set(Z),this.clearRemovedWidgets(),y.forEach(V=>{const Y=V.getLastPosition();Y&&this.showRemovedWidgetByLineNumber(Y.lineNumber,V.textLines,{isHidden:V.isHidden,recordPosition:V.getLastPosition(),undoRedoGroup:V.group})}),this.clearPartialEditWidgetList(),A.forEach(V=>{var Y,_;const H=(_=(Y=V.getPosition())===null||Y===void 0?void 0:Y.position)===null||_===void 0?void 0:_.lineNumber;if(H){const X=this.createPartialEditWidget(H);V.status==="accept"?X.accept(V.addedLinesCount,V.deletedLinesCount):V.status==="discard"&&X.discard(V.addedLinesCount,V.deletedLinesCount),X.setGroup(V.group),this.partialEditWidgetList.push(X)}}),this.firePartialEditWidgetList(),this.recordPartialEditWidgetWithAddedDec();const w=this.model.uri;this.undoRedoService.restoreSnapshot(R);const F=this.undoRedoService.getElements(w);F.future.concat(F.past).forEach(V=>{V instanceof m.LivePreviewUndoRedoStackElement&&V.attachModel(this)})}createSnapshot(){return{addedDecList:this.addedRangeDec.getDecorations(),partialEditWidgetList:this.partialEditWidgetList,removedWidgetList:this.removedZoneWidgets,editStackSnapshot:this.undoRedoService.createSnapshot(this.model.uri),zone:this.zone}}showRemovedWidgetByLineNumber(W,Z,y){const E=new b.Position(W,1),R=Z.length,A=new G.RemovedZoneWidget(this.monacoEditor,Z,Object.assign(Object.assign({},y),{showInHiddenAreas:!0,showFrame:!1,showArrow:!1}));A.create(),this.removedZoneWidgets.push(A),y.isHidden?A.hide():A.show(E,R)}updateZone(W){this.zone=W}getZone(){return this.zone}touchActiveLine(W){const Z=this.getZone();this.activeLineDec.set([{range:b.Range.fromPositions({lineNumber:Z.startLineNumber+W-1,column:0}),options:I.ModelDecorationOptions.register({description:G.ActiveLineDecoration,isWholeLine:!0,className:r.default.inline_diff_current,zIndex:h.StackingLevel.Workbench})}])}doDiscardPartialWidget(W,Z,y){let E=null,R=0,A=0;if(Z&&Z.length>0){const w=Z.getRange();E=v.EditOperation.delete(b.Range.lift({startLineNumber:w.startLineNumber,startColumn:w.startColumn,endLineNumber:w.endLineNumber+1,endColumn:1})),R=Z.length,Z.hide()}if(y){const w=y.getLastPosition(),F=this.model.getEOL(),V=y.getRemovedTextLines();A=V.length;const Y=V.join(F)+F;E?E=v.EditOperation.replace(b.Range.lift(E.range),Y):E=v.EditOperation.insert(w.delta(1),Y),y.hide()}return W.discard(R,A),E}handlePartialEditAction(W,Z,y=!0,E=!1){const R=Z.getPosition().position,A=this.aiReporter.getRelationId(),w=this.model,F=this.removedZoneWidgets.find(O=>O.getLastPosition().lineNumber===Math.max(1,R.lineNumber-1)),V=this.addedRangeDec.getDecorationByLineNumber(R.lineNumber),Y=V?.length||0,_=F?.height||0,H=new u.UndoRedoGroup;Z.setGroup(H),F?.setGroup(H),V?.setGroup(H);const X=O=>O.partialEditWidgetList.find(z=>z.group===H),S=O=>O.removedZoneWidgets.find(z=>z.group===H),Q=O=>O.addedRangeDec.getDecorationByGroup(H);let k;const M=F?.getRemovedTextLines().join(`
28079
+ `)||"",D=V?.getRange();D&&(k=w.getValueInRange(Object.assign(Object.assign({},D),{endColumn:w.getLineMaxColumn(D.endLineNumber)})));const J=O=>{E&&this.aiReporter.end(A,{message:"discard",success:!0,isDrop:!0,code:k,originCode:M,actionSource:f.ActionSourceEnum.InlineChat,actionType:f.ActionTypeEnum.LineDiscard});const z=S(O);z?.hide();const U=Q(O);U?.hide();const P=X(O);return this.doDiscardPartialWidget(P,U,z)},T=O=>{E&&this.aiReporter.end(A,{message:"accept",success:!0,isReceive:!0,code:k,originCode:M,actionSource:f.ActionSourceEnum.InlineChat,actionType:f.ActionTypeEnum.lineAccept});const z=X(O);z?.accept(Y,_);const U=S(O);U?.hide();const P=Q(O);P?.hide()},x=O=>{const z=X(O);z?.resume();const U=S(O);U?.resume();const P=Q(O);P?.resume()};switch(W){case G.EPartialEdit.accept:if(T(this),y){const O=this.createEditStackElement(H);O.attachModel(this),O.registerUndo(z=>{x(z)}),O.registerRedo(z=>{T(z)})}break;case G.EPartialEdit.discard:{const O=J(this);if(O){if(y){const z=this.createEditStackElement(H);z.attachModel(this),z.registerUndo(U=>{x(U)}),z.registerRedo(U=>{J(U)})}w.pushStackElement(),w.pushEditOperations(null,[O],()=>null,H),w.pushStackElement()}}break;default:break}const B=Object.assign({uri:this.model.uri,totalPartialEditCount:this.partialEditWidgetList.length,resolvedPartialEditCount:this.partialEditWidgetList.filter(O=>O.isHidden).length,currentPartialEdit:{addedLinesCount:Y,deletedLinesCount:_,type:W}},this.getTotalCodeInfo());this.monacoEditor.focus(),this._onPartialEditEvent.fire(B),this.firePartialEditWidgetList()}firePartialEditWidgetList(){this._onPartialEditWidgetListChange.fire(this.partialEditWidgetList);const W=this.partialEditWidgetList.filter(Z=>!Z.isHidden);this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.set(W.length!==0)}createEditStackElement(W){const Z=new m.LivePreviewUndoRedoStackElement(this.model);return this.undoRedoService.pushElement(Z,W),Z}static computeCodeInfo(W,Z,y){const E=A(W),R={added:0,deleted:0,changed:0};return W.forEach((w,F)=>{if(w.status==="pending"){const V=Z[F],Y=y[F],_=V?.length||0,H=Y?.height||0;R.added+=_,R.deleted+=H,R.changed+=Math.max(_,H)}}),{totalAddedLinesCount:E.added,totalDeletedLinesCount:E.deleted,totalChangedLinesCount:E.changed,unresolvedAddedLinesCount:R.added,unresolvedDeletedLinesCount:R.deleted,unresolvedChangedLinesCount:R.changed};function A(w){const F={added:0,deleted:0,changed:0};return w.forEach(V=>{const Y=V.addedLinesCount,_=V.deletedLinesCount;F.added+=Y,F.deleted+=_,F.changed+=Math.max(Y,_)}),F}}getTotalCodeInfo(){const W=this.partialEditWidgetList,Z=this.addedRangeDec.getDecorations(),y=this.removedZoneWidgets;return n.computeCodeInfo(W,Z,y)}recordPartialEditWidgetWithAddedDec(){this.partialEditWidgetList.forEach(W=>{var Z,y;const E=(y=(Z=W.getPosition())===null||Z===void 0?void 0:Z.position)===null||y===void 0?void 0:y.lineNumber;if(E){const R=this.addedRangeDec.getDecorationByLineNumber(E);R&&W.recordDecorationId(R.id)}})}acceptUnProcessed(){this.partialEditWidgetList.filter(Z=>!Z.isHidden).forEach(Z=>{this.handlePartialEditAction(G.EPartialEdit.accept,Z,!1)})}discardUnProcessed(){this.partialEditWidgetList.filter(Z=>!Z.isHidden).forEach(Z=>{this.handlePartialEditAction(G.EPartialEdit.discard,Z,!1)})}createPartialEditWidget(W){const Z=this.injector.get(G.AcceptPartialEditWidget,[this.monacoEditor,this.options.partialEditWidgetOptions]);Z.show({position:{lineNumber:W,column:1}});const y=Z.onDispose(()=>{const E=Z.getId();this.partialEditWidgetList=this.partialEditWidgetList.filter(R=>R.getId()!==E),y.dispose()});return Z.addDispose([Z.onAccept(()=>{this.handlePartialEditAction(G.EPartialEdit.accept,Z,!0,!0)}),Z.onDiscard(()=>{this.handlePartialEditAction(G.EPartialEdit.discard,Z,!0,!0)})]),Z}touchPartialEditWidgets(W){this.clearPartialEditWidgetList(),this.partialEditWidgetList=W.map(Z=>this.createPartialEditWidget(Z)),this.firePartialEditWidgetList()}touchAddedRange(W){this.addedRangeDec.set(W.map(Z=>{const y=Z.startPosition,E=Z.endPosition,R=Z.len;let A=b.Range.fromPositions(y,E),w=r.default.inline_diff_added_range+" ";return R===0&&(A=b.Range.fromPositions(y),w+=r.default.hide),{length:R,range:A,isHidden:R===0,options:I.ModelDecorationOptions.register({description:G.AddedRangeDecoration,isWholeLine:!0,className:w})}})),this.recordPartialEditWidgetWithAddedDec()}touchRemovedWidget(W){this.clearRemovedWidgets(),W.forEach(({textLines:Z,position:y})=>{this.showRemovedWidgetByLineNumber(y.lineNumber,Z,{})})}touchPendingRange(W){const Z=this.getZone();this.pendingRangeDec.set([{range:b.Range.fromPositions({lineNumber:Z.startLineNumber+W.startLineNumber-1,column:0},{lineNumber:Z.startLineNumber+W.endLineNumberExclusive-2,column:Number.MAX_SAFE_INTEGER}),options:I.ModelDecorationOptions.register({description:G.PendingRangeDecoration,isWholeLine:!0,className:r.default.inline_diff_pending_range})}])}clearPendingLine(){this.pendingRangeDec.clear()}clearActiveLine(){this.activeLineDec.clear()}clearAddedLine(){this.addedRangeDec.clear()}clearPartialEditWidgetList(){this.partialEditWidgetList.forEach(W=>{W.dispose()}),this.partialEditWidgetList=[],this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.set(!1)}clearRemovedWidgets(){this.removedZoneWidgets.forEach(W=>{W.dispose()}),this.removedZoneWidgets=[]}revealFirstDiff(){const W=this.removedZoneWidgets[0];if(W){const Z=W.getLastPosition();Z&&this.monacoEditor.revealLineInCenterIfOutsideViewport(Z.lineNumber)}}setPreviewerOptions(W){this.options=W}};l.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),l.__metadata("design:type",o.Injector)],p.prototype,"injector",void 0),l.__decorate([(0,o.Autowired)(f.IAIReporter),l.__metadata("design:type",Object)],p.prototype,"aiReporter",void 0),l.__decorate([(0,o.Autowired)(d.InlineStreamDiffService),l.__metadata("design:type",d.InlineStreamDiffService)],p.prototype,"inlineStreamDiffService",void 0),l.__decorate([(0,o.Autowired)(a.PartialEventEmitter),l.__metadata("design:type",Object)],p.prototype,"_onPartialEditEvent",void 0),p=n=l.__decorate([(0,o.Injectable)({multiple:!0}),l.__metadata("design:paramtypes",[Object])],p),e.LivePreviewDiffDecorationModel=p},97139:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineInputPreviewDecorationID=void 0,e.InlineInputPreviewDecorationID="InlineInputPreviewDecorationID"},90058:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SumiLightBulbWidget=void 0;const n=t(41869),l=t(3908),o=t(19202);class h extends o.LightBulbWidget{_updateLightBulbTitleAndIcon(){if(this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],this.state.type!==o.LightBulbState.Type.Showing)return;let b,g=!1;this.state.actions.allAIFixes?(b=l.Sumicon.magicWand,this.state.actions.validActions.length===1&&(g=!0)):this.state.actions.hasAutoFix?this.state.actions.hasAIFix?b=l.Sumicon.magicWand:b=l.Codicon.lightbulbAutofix:this.state.actions.hasAIFix?b=l.Sumicon.magicWand:b=l.Codicon.lightBulb,this._updateLightbulbTitle(this.state.actions.hasAutoFix,g),this._iconClasses=(0,n.asClassNameArrayWrapper)(b),this._domNode.classList.add(...this._iconClasses)}}e.SumiLightBulbWidget=h},8191:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RewriteWidget=e.REWRITE_DECORATION_INLINE_ADD=void 0;const n=t(85608),l=n.__importDefault(t(53373)),o=n.__importStar(t(14041)),h=n.__importDefault(t(25873)),f=t(76003),b=t(41869),g=n.__importStar(t(20868)),v=t(52659),I=t(90052),u=t(77714),c=t(2261),s=t(87822),a=t(83e3),r=n.__importDefault(t(32518)),d={fixedOverflowWidgets:!0,readOnly:!0,domReadOnly:!0,lineNumbers:"off",glyphMargin:!1,scrollBeyondLastLine:!1,rulers:void 0,overviewRulerBorder:void 0,overviewRulerLanes:0,padding:{top:0,bottom:0},folding:!1,stickyScroll:{enabled:!1},minimap:{enabled:!1},automaticLayout:!0,scrollbar:{horizontal:"hidden",vertical:"hidden",horizontalScrollbarSize:0,verticalScrollbarSize:0,arrowSize:0,verticalSliderSize:0,horizontalSliderSize:0,ignoreHorizontalScrollbarInContentHeight:!0},hover:{enabled:!1},guides:{indentation:!1}};e.REWRITE_DECORATION_INLINE_ADD="rewrite-decoration-inline-add";const m=o.default.memo(p=>{const{editor:N,onReady:W}=p,Z=(0,b.useInjectable)(b.MonacoService),y=(0,o.useRef)(null),E=(0,o.useRef)(null),[R,A]=(0,o.useState)(null),[w,F]=(0,o.useState)(0),[V,Y]=(0,o.useState)(null),_=(0,o.useCallback)((Q,k,M)=>{const D=N.getModel().getEOL();let J=k.startLineNumber,T=k.startColumn;const x=Q.getModel();Q.changeDecorations(te=>{if(Q){x.getAllDecorations().map(re=>re.id).forEach(re=>te.removeDecoration(re));for(const re of M){if(re.removed)continue;const ae=re.value.split(D);for(let ue=0;ue<ae.length;ue++){const ee=ae[ue];ue!==0&&(J++,T=1),re.added&&te.addDecoration(new g.Range(J,T,J,T+ee.length),{description:e.REWRITE_DECORATION_INLINE_ADD,className:r.default.ghost_text_decoration_inline_add}),T+=ee.length}}}});const B=Q.getOption(g.editor.EditorOption.lineHeight);Q?.setScrollTop(Math.max(k.startLineNumber-1,0)*B);const O=J-k.startLineNumber,z=Q.getOption(g.editor.EditorOption.fontInfo).spaceWidth;let U=0;const P=x.getOptions().tabSize;Array.from({length:O+1},(te,re)=>k.startLineNumber+re).forEach(te=>{const re=x.getLineContent(te);let ae=0;for(const ue of re)ue===u.space?ae+=P:ae+=1,U=Math.max(U,ae)}),A({width:U*z,height:B*(O+1)})},[R,N]);(0,o.useEffect)(()=>{if(N.getModel())return W&&W({getVirtualEditor:()=>V,renderVirtualEditor:(k,M,D)=>H(k,M,D),renderTextLineThrough:k=>X(k),layout:k=>S(k)}),()=>{V&&V.dispose(),E.current&&(0,b.runWhenIdle)(()=>{var k;(k=E.current)===null||k===void 0||k.unmount(),E.current=null})}},[N,W,V]);const H=(0,o.useCallback)((Q,k,M)=>{if(!y.current)return;const D=N.getModel();if(!D)return;let J=V;if(!J){J=Z.createCodeEditor(y.current,d);const T=a.StandaloneServices.get(s.IModelService),x={languageId:D.getLanguageId(),onDidChange:b.Event.None},B=T.createModel("",x);J.setModel(B),Y(J)}J.setValue(Q),_(J,k,M)},[y,V]),X=(0,o.useCallback)(Q=>{if(!y.current)return;V&&(V.dispose(),Y(null));const k=({changes:M})=>{const D=N.getOption(g.editor.EditorOption.lineHeight),J=N.getOption(g.editor.EditorOption.fontInfo).spaceWidth,T=(B,O=r.default.ghost_text_decoration)=>o.default.createElement("span",{className:(0,l.default)(r.default.space_span,O),style:{width:`${J*B}px`}},u.space.repeat(B)),x=(B,O)=>o.default.createElement("span",{className:(0,l.default)(r.default.text_span,O)},B);return o.default.createElement(o.default.Fragment,null,M.map((B,O)=>{let z=!0,U="",P=0;const te=[];for(const re of B){const{value:ae,added:ue,removed:ee}=re;if(ee)U+=ae;else{z=!1,P+=ae.length;const pe=ae.length-ae.trimStart().length,ge=ae.length-ae.trimEnd().length,q=ae.trim();te.push(T(pe)),q&&(te.push(x(q,ue?r.default.ghost_text_decoration_inline_add:r.default.ghost_text_decoration)),te.push(T(ge)))}}if(z){const re=U.length-U.trimStart().length,ae=U.length-U.trimEnd().length,ue=U.trim();te.push(T(re,r.default.ghost_text_decoration_remove)),ue&&(te.push(x(ue,r.default.ghost_text_decoration_inline_remove)),te.push(T(ae,r.default.ghost_text_decoration_inline_remove)))}return o.default.createElement("div",{key:O,className:r.default.deletions_code_line,style:{height:`${D}px`}},te)}))};E.current&&(E.current.unmount(),E.current=null),E.current=h.default.createRoot(y.current),E.current.render(o.default.createElement(o.default.Fragment,null,Q.map((M,D)=>o.default.createElement(k,{key:D,changes:M.changes}))))},[N,y,V,E]),S=(0,o.useCallback)(Q=>{const k=N.getOption(g.editor.EditorOption.fontInfo).spaceWidth;let M=0;for(let D=Q.startLineNumber;D<=Q.endLineNumber;D++){const J=N.getModel().getLineMaxColumn(D);M=Math.max(M,J)}F(M*k+10)},[N]);return o.default.createElement("div",{className:r.default.rewrite_widget_container,style:{width:R?.width,height:R?.height,marginLeft:w}},o.default.createElement("div",{className:r.default.virtual_editor_container,ref:y}))});let G=class extends v.ReactInlineContentWidget{constructor(){super(...arguments),this.virtualEditorHandler=null,this.positionPreference=[I.ContentWidgetPositionPreference.EXACT],this.defered=new b.Deferred,this.updateFontStyle=()=>{const N=this.editor.getOption(g.editor.EditorOption.fontInfo);this.domNode.style.fontFamily=N.fontFamily,this.domNode.style.fontSize=N.fontSize+"px"}}renderView(){return this.updateFontStyle(),o.default.createElement(m,{editor:this.editor,onReady:N=>{this.defered.resolve(),this.virtualEditorHandler=N}})}id(){return"RewriteWidget"}show(N){const{position:W}=N;if(!W)return;const{lineNumber:Z}=W;super.show({position:g.Position.lift({lineNumber:Z,column:1})})}setInsertText(N){this.insertText=N}setEditArea(N){this.editArea=N}getEditArea(){return this.editArea}getVirtualEditor(){var N,W;return(W=(N=this.virtualEditorHandler)===null||N===void 0?void 0:N.getVirtualEditor())!==null&&W!==void 0?W:null}renderTextLineThrough(N){var W,Z;(W=this.virtualEditorHandler)===null||W===void 0||W.renderTextLineThrough(N),(Z=this.virtualEditorHandler)===null||Z===void 0||Z.layout(this.editArea)}renderVirtualEditor(N,W){this.virtualEditorHandler.renderVirtualEditor(N,this.editArea,W),this.virtualEditorHandler.layout(this.editArea)}accept(){(0,b.isUndefined)(this.insertText)||(this.editor.pushUndoStop(),this.editor.getModel().pushEditOperations(null,[c.EditOperation.replace(g.Range.lift(this.editArea),this.insertText)],()=>null))}};G=n.__decorate([(0,f.Injectable)({multiple:!0})],G),e.RewriteWidget=G},19413:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IAIInlineCompletionsProvider=e.EResultKind=e.EInlineChatStatus=e.ChatProxyServiceToken=e.IChatAgentService=e.IChatManagerService=e.IChatInternalService=e.ChatCompletionRequestMessageRoleEnum=e.BACK_QUOTE_3_SYMBOL=e.AT_SIGN_SYMBOL=e.SLASH_SYMBOL=e.AI_MENUBAR_CONTAINER_VIEW_ID=e.AI_MENU_BAR_DEBUG_TOOLBAR=e.AI_CHAT_LOGO_AVATAR_ID=e.AI_CHAT_CONTAINER_ID=e.AI_CHAT_VIEW_ID=e.AIInlineChatContentWidget=e.IAINativeService=void 0;const n=t(43718),l=t(66338);e.IAINativeService=Symbol("IAINativeService"),e.AIInlineChatContentWidget=n.AIInlineChatContentWidgetId,e.AI_CHAT_VIEW_ID="AI-Chat",e.AI_CHAT_CONTAINER_ID="AI-Chat-Container",e.AI_CHAT_LOGO_AVATAR_ID="AI-Chat-Logo-Avatar",e.AI_MENU_BAR_DEBUG_TOOLBAR="AI_MENU_BAR_DEBUG_TOOLBAR",e.AI_MENUBAR_CONTAINER_VIEW_ID=l.DESIGN_MENUBAR_CONTAINER_VIEW_ID,e.SLASH_SYMBOL="/",e.AT_SIGN_SYMBOL="@",e.BACK_QUOTE_3_SYMBOL="```";var o;(function(b){b.System="system",b.User="user",b.Assistant="assistant"})(o=e.ChatCompletionRequestMessageRoleEnum||(e.ChatCompletionRequestMessageRoleEnum={})),e.IChatInternalService=Symbol("IChatInternalService"),e.IChatManagerService=Symbol("IChatManagerService"),e.IChatAgentService=Symbol("IChatAgentService"),e.ChatProxyServiceToken=Symbol("ChatProxyServiceToken");var h;(function(b){b[b.READY=0]="READY",b[b.THINKING=1]="THINKING",b[b.DONE=2]="DONE",b[b.ERROR=3]="ERROR"})(h=e.EInlineChatStatus||(e.EInlineChatStatus={}));var f;(function(b){b.ACCEPT="ACCEPT",b.DISCARD="DISCARD",b.REGENERATE="REGENERATE"})(f=e.EResultKind||(e.EResultKind={})),e.IAIInlineCompletionsProvider=Symbol("IAIInlineCompletionsProvider")},98864:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isDocumentValid=e.isDocumentTooShort=e.isDocumentTooLarge=void 0;const t=h=>{try{h.getText()}catch(f){if(f instanceof RangeError)return!0}return!1};e.isDocumentTooLarge=t;const n=10,l=h=>h.getText().length<n;e.isDocumentTooShort=l;const o=h=>!((0,e.isDocumentTooLarge)(h)||(0,e.isDocumentTooShort)(h));e.isDocumentValid=o},26471:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),t(85608).__exportStar(t(19413),e)},15504:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentReactions=e.CommentReactionSwitcher=void 0;const n=t(85608),l=t(25150),o=n.__importDefault(t(14041)),h=t(41869),f=t(81878),b=t(25918),g=t(93899),v=t(52416),I=t(69635),u=n.__importDefault(t(38877));e.CommentReactionSwitcher=(0,l.observer)(({thread:c,comment:s,className:a})=>{const r=`${c.providerId}_${c.id}_${s.id}`,d=`${g.MenuId.CommentReactionSwitcherMenu}_${r}`,m=(0,h.useInjectable)(g.IMenuRegistry),G=(0,h.useInjectable)(g.AbstractMenuService);o.default.useEffect(()=>{const N=new h.Disposable,W=`${g.MenuId.CommentReactionSwitcherSubmenu}_${r}`;return N.addDispose(m.registerMenuItem(d,{submenu:W,label:W,iconClass:(0,h.getExternalIcon)("reactions"),group:"navigation"})),N.addDispose(m.registerMenuItems(W,s.reactions.map(Z=>({command:{id:I.SwitchCommandReaction,label:Z.label},extraTailArgs:[{thread:c,comment:s,reaction:Z}]})))),()=>N.dispose()},[]);const p=o.default.useMemo(()=>G.createMenu(d),[]);return o.default.createElement(b.InlineActionBar,{className:a,menus:p,regroup:N=>[N,[]],type:"icon"})}),e.CommentReactions=(0,l.observer)(({thread:c,comment:s})=>{var a;const r=(0,h.useInjectable)(h.IEventBus),d=(0,h.useInjectable)(v.IIconService),m=o.default.useCallback(G=>{r.fire(new I.CommentReactionClick({thread:c,comment:s,reaction:G}))},[]);return o.default.createElement("div",{className:u.default.comment_reactions},(a=s.reactions)===null||a===void 0?void 0:a.filter(G=>G.count!==0).map(G=>o.default.createElement(f.Button,{key:G.label,onClick:()=>m(G),type:"secondary",size:"small",title:G.label,className:u.default.comment_reaction,iconClass:d.fromIcon("",G.iconPath.toString(),v.IconType.Background)},"\xA0",G.count)))})},54143:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsBody=void 0;const n=t(85608),l=n.__importDefault(t(14041)),o=n.__importDefault(t(43144)),h=t(84605),f=n.__importDefault(t(38877)),b=t(70154),g=({root:v,children:I})=>o.default.createPortal(I,v);e.CommentsBody=l.default.memo(({body:v})=>{const I=l.default.useRef(null),[u,c]=l.default.useState(null),s=l.default.useMemo(()=>{const a=(0,h.createMarkedRenderer)();return a.link=(r,d,m)=>`<a target="_blank" rel="noopener" href="${r}" title="${d}">${m}</a>`,a},[]);return l.default.useEffect(()=>{if(I.current){const a=I.current.attachShadow({mode:"open"});u||c(a)}},[]),l.default.createElement("div",{ref:I,className:f.default.comment_shadow_box},u&&l.default.createElement(g,{root:u},l.default.createElement("style",null,b.markdownCss),l.default.createElement("div",{dangerouslySetInnerHTML:{__html:(0,h.toMarkdownHtml)(typeof v=="string"?v:v.value,{gfm:!0,breaks:!1,pedantic:!1,smartLists:!0,smartypants:!1,renderer:s})}})))})},66480:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsFeatureRegistry=void 0;const n=t(85608),l=t(76003);let o=class{constructor(){this.config={},this.options={},this.panelTreeNodeHandlers=[],this.mentionsOptions={},this.providerFeature=new Map}registerConfig(f){this.config=Object.assign(Object.assign({},this.config),f)}registerPanelTreeNodeHandler(f){this.panelTreeNodeHandlers.push(f)}registerPanelOptions(f){this.options=Object.assign(Object.assign({},this.options),f)}registerFileUploadHandler(f){this.fileUploadHandler=f}registerMentionsOptions(f){this.mentionsOptions=f}registerZoneWidgetRender(f){this.zoneWidgetRender=f}getConfig(){return this.config}getCommentsPanelOptions(){return this.options}getCommentsPanelTreeNodeHandlers(){return this.panelTreeNodeHandlers}getFileUploadHandler(){return this.fileUploadHandler}getMentionsOptions(){return this.mentionsOptions}getZoneWidgetRender(){return this.zoneWidgetRender}registerProviderFeature(f,b){this.providerFeature.set(f,b)}getProviderFeature(f){return this.providerFeature.get(f)}};o=n.__decorate([(0,l.Injectable)()],o),e.CommentsFeatureRegistry=o},37357:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentItem=void 0;const n=t(85608),l=t(25150),o=n.__importDefault(t(14041)),h=t(97267),f=t(41869),b=t(25918),g=t(93899),v=t(69635),I=t(15504),u=t(54143),c=t(42018),s=n.__importDefault(t(38877)),a=({timestamp:m})=>{const G=o.default.useMemo(()=>{const p=new Date(m);return(0,f.toLocalString)(p)},[m]);return o.default.createElement("span",{className:s.default.comment_item_timestamp},G)},r=(m,G)=>{const p=(0,f.useInjectable)(g.AbstractMenuService),{body:N,contextValue:W}=G,[Z,y]=o.default.useState(""),E=(0,f.useInjectable)(v.ICommentsFeatureRegistry),R=o.default.useMemo(()=>E.getFileUploadHandler(),[]);o.default.useEffect(()=>{y(N)},[N]);const A=o.default.useMemo(()=>m.createScoped(),[]),w=o.default.useMemo(()=>A.createKey("commentIsEmpty",!G.body),[]),F=o.default.useMemo(()=>p.createMenu(g.MenuId.CommentsCommentContext,A),[]),V=o.default.useMemo(()=>p.createMenu(g.MenuId.CommentsCommentTitle,A),[]),Y=o.default.useRef(A.createKey("comment",W));o.default.useEffect(()=>{Y.current.set(W)},[W]);const _=o.default.useCallback(X=>{w.set(!X.target.value),y(X.target.value)},[]),H=o.default.useCallback(async X=>{if(R){const S=await R(Z,X);y(Q=>{const k=Q+S;return w.set(!k),k})}},[Z]);return[Z,y,_,F,V,H]},d=(0,l.observer)(({reply:m,thread:G})=>{var p;const{contextKeyService:N}=G,{author:W,label:Z,body:y,mode:E,timestamp:R}=m,A=(p=W.iconPath)===null||p===void 0?void 0:p.toString(),[w,F,V,Y,_,H]=r(N,m),X=o.default.useMemo(()=>{const S=(0,f.toMarkdownHtml)(typeof y=="string"?y:y.value);return/^\<p\>[^<>]+\<\/p\>\n$/.test(S)},[y]);return o.default.createElement("div",{className:s.default.reply_item},(0,f.isUndefined)(E)||E===v.CommentMode.Preview?o.default.createElement("div",null,X?o.default.createElement(o.default.Fragment,null,A&&o.default.createElement("img",{className:s.default.reply_item_icon,src:A,alt:W.name}),o.default.createElement("span",{className:s.default.comment_item_author_name},W.name),R&&o.default.createElement(a,{timestamp:R}),typeof Z=="string"?o.default.createElement("span",{className:s.default.comment_item_label},Z):Z," : ",o.default.createElement("span",{className:s.default.comment_item_body},typeof y=="string"?y:y.value),m.reactions&&m.reactions.length>0&&o.default.createElement(I.CommentReactionSwitcher,{className:s.default.reply_item_title,thread:G,comment:m}),o.default.createElement(b.InlineActionBar,{separator:"inline",className:s.default.reply_item_title,menus:_,context:[{thread:G,comment:m,menuId:g.MenuId.CommentsCommentTitle}],type:"icon"})):o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:s.default.comment_item_markdown_header},o.default.createElement("div",null,A&&o.default.createElement("img",{className:s.default.reply_item_icon,src:A,alt:W.name}),o.default.createElement("span",{className:s.default.comment_item_author_name},W.name),R&&o.default.createElement(a,{timestamp:R}),typeof Z=="string"?o.default.createElement("span",{className:s.default.comment_item_label},Z):Z," : "),o.default.createElement(b.InlineActionBar,{separator:"inline",className:s.default.reply_item_title,menus:_,context:[{thread:G,comment:m,menuId:g.MenuId.CommentsCommentTitle}],type:"icon"})),o.default.createElement(u.CommentsBody,{body:y}))):o.default.createElement("div",null,o.default.createElement(c.CommentsTextArea,{value:typeof w=="string"?w:w.value,autoFocus:!0,onChange:V,dragFiles:H}),o.default.createElement(b.InlineActionBar,{className:s.default.comment_item_reply,menus:Y,context:[{thread:G,comment:m,body:w,menuId:g.MenuId.CommentsCommentContext}],type:"button",separator:"inline",afterClick:()=>{F(y)}})),m.reactions&&m.reactions.length>0&&o.default.createElement(I.CommentReactions,{thread:G,comment:m}))});e.CommentItem=(0,l.observer)(({thread:m,commentThreadContext:G,widget:p})=>{var N,W;const{readOnly:Z,contextKeyService:y}=m,[E,R]=o.default.useState(!1),[A,w]=o.default.useState(""),[F,...V]=m.comments,{author:Y,label:_,body:H,mode:X,timestamp:S}=F,Q=(0,f.isString)(Y.iconPath)?Y.iconPath:!((N=Y.iconPath)===null||N===void 0)&&N.authority?(W=Y.iconPath)===null||W===void 0?void 0:W.toString():"",[k,M,D,J,T,x]=r(y,F),B=(0,f.useInjectable)(v.ICommentsFeatureRegistry),O=o.default.useMemo(()=>B.getFileUploadHandler(),[]),z=o.default.useMemo(()=>y.createKey("commentIsEmpty",!0),[]);function U(te){z.set(!te.target.value),w(te.target.value)}const P=o.default.useCallback(async te=>{if(O){const re=await O(k,te);w(ae=>{const ue=ae+re;return z.set(!ue),ue})}},[A]);return o.default.createElement("div",{className:s.default.comment_item},Q&&o.default.createElement("img",{className:s.default.comment_item_icon,src:Q,alt:Y.name}),o.default.createElement("div",{className:s.default.comment_item_content},o.default.createElement("div",{className:s.default.comment_item_head},o.default.createElement("div",{className:s.default.comment_item_name},o.default.createElement("span",{className:s.default.comment_item_author_name},Y.name),S&&o.default.createElement(a,{timestamp:S}),typeof _=="string"?o.default.createElement("span",{className:s.default.comment_item_label},_):_),o.default.createElement("div",{className:s.default.comment_item_actions},F.reactions&&F.reactions.length>0&&o.default.createElement(I.CommentReactionSwitcher,{thread:m,comment:F}),!Z&&o.default.createElement(h.Button,{className:s.default.comment_item_reply_button,size:"small",type:"secondary",onClick:()=>R(!0)},(0,f.localize)("comments.thread.action.reply")),o.default.createElement(b.InlineActionBar,{menus:T,context:[{thread:m,comment:F,menuId:g.MenuId.CommentsCommentTitle}],type:"button"}))),(0,f.isUndefined)(X)||X===v.CommentMode.Preview?o.default.createElement(u.CommentsBody,{body:H}):o.default.createElement("div",null,o.default.createElement(c.CommentsTextArea,{value:typeof k=="string"?k:k.value,autoFocus:!0,onChange:D,dragFiles:x}),o.default.createElement(b.InlineActionBar,{className:s.default.comment_item_context,menus:J,context:[{thread:m,comment:F,body:k,menuId:g.MenuId.CommentsCommentContext}],separator:"inline",type:"button",afterClick:()=>{M(H)}})),F.reactions&&F.reactions.length>0&&o.default.createElement(I.CommentReactions,{thread:m,comment:F}),(V.length>0||E)&&o.default.createElement("div",{className:s.default.comment_item_reply_wrap},V.map(te=>o.default.createElement(d,{key:te.id,thread:m,reply:te})),E&&o.default.createElement("div",null,o.default.createElement(c.CommentsTextArea,{autoFocus:!0,value:A,onChange:U,placeholder:`${(0,f.localize)("comments.reply.placeholder")}...`,dragFiles:P}),o.default.createElement(b.InlineActionBar,{className:s.default.comment_item_reply,menus:G,context:[{thread:m,text:A,widget:p,menuId:g.MenuId.CommentsCommentThreadContext}],separator:"inline",type:"button",afterClick:()=>{w(""),R(!1)}})))))})},53878:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsPanel=void 0;const n=t(85608),l=n.__importStar(t(14041)),o=t(97267),h=t(41869),f=t(69635),b=n.__importDefault(t(38877)),g=t(5167),v=t(47842),I=({viewState:u})=>{const c=(0,h.useInjectable)(v.CommentModelService),[s,a]=(0,l.useState)(),r=(0,l.useRef)(null),d=(0,h.useInjectable)(f.ICommentsFeatureRegistry),{handleTreeBlur:m}=c;(0,l.useEffect)(()=>{a(c.treeModel);const E=c.onDidUpdateTreeModel(R=>{a(R)});return()=>{E.dispose()}},[]);const G=(0,l.useCallback)(E=>{c.handleTreeHandler(E)},[c]),p=(0,l.useCallback)(E=>l.default.createElement(g.CommentNodeRendered,{item:E.item,itemType:E.itemType,decorations:c.decorations.getDecorations(E.item),defaultLeftPadding:8,onTwistierClick:c.handleTwistierClick,onClick:c.handleItemClick,leftPadding:8}),[s]),N=(0,l.useMemo)(()=>d.getCommentsPanelOptions(),[]),W=(0,l.useMemo)(()=>N.header,[N]),Z=(0,l.useMemo)(()=>l.default.createElement("div",{className:b.default.panel_placeholder},N.defaultPlaceholder||(0,h.localize)("comments.panel.placeholder")),[N]),y=(0,l.useCallback)(()=>s?l.default.createElement(o.RecycleTree,{height:u.height-(W?.height||0),itemHeight:g.COMMENT_TREE_NODE_HEIGHT,onReady:G,model:s,placeholder:()=>Z},p):Z,[s,W,u.height]);return l.default.createElement("div",{className:b.default.comment_panel,tabIndex:-1,onBlur:m,ref:r},W?.component,y())};e.CommentsPanel=I},42018:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsTextArea=void 0;const n=t(85608),l=n.__importDefault(t(14041)),o=t(34801),h=t(97267),f=t(41869),b=t(69635),g=t(54143),v=n.__importDefault(t(38877)),I=t(73136),u="@",c="@[__display__](__id__)",s=(a,r)=>`@${r}`;e.CommentsTextArea=l.default.forwardRef((a,r)=>{const{focusDelay:d=0,autoFocus:m=!1,placeholder:G="",onFocus:p,onBlur:N,onChange:W,maxRows:Z=10,minRows:y=2,value:E,initialHeight:R,dragFiles:A}=a,[w,F]=l.default.useState(0),V=(0,f.useInjectable)(b.ICommentsFeatureRegistry),Y=l.default.useRef(null),_=l.default.useRef(null),H=l.default.useRef(null);l.default.useImperativeHandle(r,()=>Y.current);const X=l.default.useCallback(async J=>{var T;J.stopPropagation(),J.preventDefault();const x=(T=J.dataTransfer)===null||T===void 0?void 0:T.files;x&&A&&await A(x),Y.current&&(Y.current.focus(),Q(Y.current.value))},[A]),S=l.default.useCallback(J=>{J.stopPropagation(),J.preventDefault(),J.dataTransfer.dropEffect="copy"},[]),Q=l.default.useCallback(J=>{const T=Y.current;if(T){const x=J.toString().length;T.setSelectionRange(x,x)}},[]);l.default.useEffect(()=>{var J;const T=Y.current;if(!T)return;R&&T.style&&(T.style.height=R),d&&setTimeout(()=>{T.focus({preventScroll:!0})},d),Q(E);function x(B){var O,z,U;const P=B.target;P&&(P.nodeName.toUpperCase()==="TEXTAREA"&&P.scrollHeight>P.clientHeight||P.nodeName.toUpperCase()==="UL"||((O=P.parentElement)===null||O===void 0?void 0:O.nodeName.toUpperCase())==="UL"||((U=(z=P.parentElement)===null||z===void 0?void 0:z.parentElement)===null||U===void 0?void 0:U.nodeName.toUpperCase())==="UL")&&B.stopPropagation()}return(J=_.current)===null||J===void 0||J.addEventListener("mousewheel",x,!0),()=>{var B;(B=_.current)===null||B===void 0||B.removeEventListener("mousewheel",x,!0)}},[]),l.default.useEffect(()=>{w===0&&(setTimeout(()=>{var J;(J=Y.current)===null||J===void 0||J.focus({preventScroll:!0})},d),Q(E))},[w]);const k=l.default.useMemo(()=>(0,I.getMentionBoxStyle)({minRows:y,maxRows:Z}),[y,Z]),M=l.default.useMemo(()=>V.getMentionsOptions(),[V]),D=l.default.useCallback(async(J,T)=>{if(M.providerData){const x=await M.providerData(J);T(x)}else T([])},[M]);return l.default.createElement("div",{className:v.default.textarea_container},l.default.createElement(h.Tabs,{mini:!0,value:w,onChange:J=>F(J),tabs:[(0,f.localize)("comments.thread.textarea.write"),(0,f.localize)("comments.thread.textarea.preview")]}),l.default.createElement("div",null,w===0?l.default.createElement("div",{ref:_},l.default.createElement(o.MentionsInput,{autoFocus:m,onDragOver:S,onDrop:X,inputRef:Y,ref:H,value:E,placeholder:G,onChange:W,onFocus:p,onBlur:N,style:k},l.default.createElement(o.Mention,{markup:M.markup||c,renderSuggestion:M.renderSuggestion,trigger:u,data:D,displayTransform:M.displayTransform||s}))):l.default.createElement("div",{className:v.default.textarea_preview},l.default.createElement(g.CommentsBody,{body:E}))))})},49867:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsThread=void 0;const n=t(85608),l=t(83794),o=t(76003),h=t(41869),f=t(91830),b=t(54414),g=t(69635),v=t(90366);let I=class extends h.Disposable{set contextValue(c){this._contextKeyService.createKey("thread",c)}get contextValue(){return this._contextKeyService.getContextValue("thread")}get onDidChangeCollapsibleState(){return this.onDidChangeCollapsibleStateEmitter.event}get onDidChange(){return this.onDidChangeEmitter.event}constructor(c,s,a,r){super(),this.uri=c,this.range=s,this.providerId=a,this.options=r,this.comments=[],this._readOnly=!1,this.onDidChangeCollapsibleStateEmitter=new h.Emitter,this.widgets=new Map,this._id=`thread_${(0,h.uuid)()}`,this.onDidChangeEmitter=new h.Emitter,this.toggle=N=>{if(this.comments.length>0){const W=this.widgets.get(N);W&&W.toggle()}else this.dispose()},(0,l.makeObservable)(this),this.updateComments(r.comments?r.comments.map(N=>Object.assign(Object.assign({},N),{id:(0,h.uuid)()})):[]),this.data=this.options.data,this._contextKeyService=this.registerDispose(this.globalContextKeyService.createScoped()),new f.ResourceContextKey(this._contextKeyService).set(c),this._contextKeyService.createKey("thread",r.contextValue),this.readOnly=!!r.readOnly,this.label=r.label,this.isCollapsed=!!this.options.isCollapsed;const m=this._contextKeyService.createKey("threadsLength",this.commentsService.getThreadsByUri(c).length),G=this._contextKeyService.createKey("commentsLength",this.comments.length),p=this._contextKeyService.createKey("commentThreadIsEmpty",!this.comments.length);this._contextKeyService.createKey("commentController",a),(0,l.autorun)(()=>{G.set(this.comments.length),p.set(!this.comments.length)}),(0,l.autorun)(()=>{this.isCollapsed?this.hideAll():this.showAll()}),this.addDispose(this.commentsService.onThreadsChanged(N=>{N.uri.isEqual(c)&&m.set(this.commentsService.getThreadsByUri(c).length)})),this.addDispose({dispose:()=>{this.updateComments([])}}),this.onDidChangeEmitter.fire()}updateComments(c){this.comments=c}getWidgetByEditor(c){return this.widgets.get(c)}get id(){return this._id}get contextKeyService(){return this._contextKeyService}get readOnly(){return this._readOnly}set readOnly(c){(0,l.runInAction)(()=>this._readOnly=c),this._contextKeyService.createKey("readOnly",this._readOnly)}get threadHeaderTitle(){if(this.label)return this.label;if(this.comments.length){const c=new Set(this.comments.map(s=>`@${s.author.name}`));return`${(0,h.localize)("comments.participants")}: `+[...c].join(" ")}else return(0,h.localize)("comments.zone.title")}getEditorsByUri(c){return this.editorCollectionService.listEditors().filter(s=>{var a;return(a=s.currentUri)===null||a===void 0?void 0:a.isEqual(c)})}addWidgetByEditor(c){const s=this.injector.get(v.CommentsZoneWidget,[c,this,{arrowColor:"var(--peekView-border)"}]);return this.addDispose(s.onChangeZoneWidget(()=>{const a=this.commentsService.commentsThreads.filter(m=>this.isEqual(m)),r=a.findIndex(m=>m===this),d=a.slice(r+1);for(const m of d)if(m.isShowWidget(c)){const G=m.getWidgetByEditor(c);G?.resize()}})),this.addDispose(s),this.widgets.set(c,s),c.onDispose(()=>{s.dispose(),this.widgets.delete(c)}),s}show(c){if(c){let s=this.widgets.get(c);s||(s=this.addWidgetByEditor(c)),s.show()}else this.getEditorsByUri(this.uri).forEach(a=>{var r;let d=this.widgets.get(a);d||(d=this.addWidgetByEditor(a)),!((r=a.currentUri)===null||r===void 0)&&r.isEqual(this.uri)&&d.show()})}showWidgetsIfShowed(){var c;for(const s of this.getEditorsByUri(this.uri)){let a=this.widgets.get(s);a||(a=this.addWidgetByEditor(s)),!((c=s.currentUri)===null||c===void 0)&&c.isEqual(this.uri)&&a.isShow&&a.show()}}hideWidgetsByDispose(){var c;for(const[s,a]of this.widgets)!(!((c=s.currentUri)===null||c===void 0)&&c.isEqual(this.uri))&&a.dispose()}isShowWidget(c){if(c){const s=this.widgets.get(c);return s?s.isShow:!1}else{for(const[,s]of this.widgets)return s.isShow;return!1}}hide(c){if(c){const s=this.widgets.get(c);s?.hide()}else this.hideAll()}showAll(){this.isCollapsed=!1;for(const[,c]of this.widgets)c.show();this.onDidChangeCollapsibleStateEmitter.fire(g.CommentThreadCollapsibleState.Expanded)}hideAll(c){var s;this.isCollapsed=!0;for(const[a,r]of this.widgets)c?!(!((s=a.currentUri)===null||s===void 0)&&s.isEqual(this.uri))&&r.dispose():r.hide();this.onDidChangeCollapsibleStateEmitter.fire(g.CommentThreadCollapsibleState.Collapsed)}addComment(...c){this.comments.push(...c.map(s=>Object.assign(Object.assign({},s),{id:(0,h.uuid)()}))),this.onDidChangeEmitter.fire()}removeComment(c){const s=this.comments.findIndex(a=>a===c);s!==-1&&this.comments.splice(s,1),this.onDidChangeEmitter.fire()}isEqual(c){return c.uri.isEqual(this.uri)&&c.range.startLineNumber===this.range.startLineNumber&&c.range.endLineNumber===this.range.endLineNumber}};n.__decorate([(0,o.Autowired)(g.ICommentsService),n.__metadata("design:type",Object)],I.prototype,"commentsService",void 0),n.__decorate([(0,o.Autowired)(h.IContextKeyService),n.__metadata("design:type",Object)],I.prototype,"globalContextKeyService",void 0),n.__decorate([(0,o.Autowired)(b.EditorCollectionService),n.__metadata("design:type",b.EditorCollectionService)],I.prototype,"editorCollectionService",void 0),n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],I.prototype,"injector",void 0),n.__decorate([l.observable.shallow,n.__metadata("design:type",Array)],I.prototype,"comments",void 0),n.__decorate([l.observable,n.__metadata("design:type",Object)],I.prototype,"label",void 0),n.__decorate([l.observable,n.__metadata("design:type",Object)],I.prototype,"_readOnly",void 0),n.__decorate([l.observable,n.__metadata("design:type",Boolean)],I.prototype,"isCollapsed",void 0),n.__decorate([l.action,n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[Array]),n.__metadata("design:returntype",void 0)],I.prototype,"updateComments",null),n.__decorate([l.computed,n.__metadata("design:type",Boolean),n.__metadata("design:paramtypes",[Boolean])],I.prototype,"readOnly",null),n.__decorate([l.computed,n.__metadata("design:type",Object),n.__metadata("design:paramtypes",[])],I.prototype,"threadHeaderTitle",null),n.__decorate([l.action,n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",void 0)],I.prototype,"showAll",null),n.__decorate([l.action,n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[Boolean]),n.__metadata("design:returntype",void 0)],I.prototype,"hideAll",null),n.__decorate([l.action,n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[Object]),n.__metadata("design:returntype",void 0)],I.prototype,"addComment",null),n.__decorate([l.action,n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[Object]),n.__metadata("design:returntype",void 0)],I.prototype,"removeComment",null),I=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[h.URI,Object,String,Object])],I),e.CommentsThread=I},73804:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsZoneService=void 0;const n=t(85608),l=t(76003),o=t(93899),h=t(43718),f=t(69635),b=t(49867);let g=class extends h.Disposable{constructor(I){super(),this.thread=I}setCurrentCommentThread(I){this.commentService.setCurrentCommentThread(I)}get commentThreadTitle(){return this.registerDispose(this.menuService.createMenu(o.MenuId.CommentsCommentThreadTitle,this.thread.contextKeyService))}get commentThreadContext(){return this.registerDispose(this.menuService.createMenu(o.MenuId.CommentsCommentThreadContext,this.thread.contextKeyService))}};n.__decorate([(0,l.Autowired)(o.AbstractMenuService),n.__metadata("design:type",o.AbstractMenuService)],g.prototype,"menuService",void 0),n.__decorate([(0,l.Autowired)(f.ICommentsService),n.__metadata("design:type",Object)],g.prototype,"commentService",void 0),n.__decorate([h.memoize,n.__metadata("design:type",Object),n.__metadata("design:paramtypes",[])],g.prototype,"commentThreadTitle",null),n.__decorate([h.memoize,n.__metadata("design:type",Object),n.__metadata("design:paramtypes",[])],g.prototype,"commentThreadContext",null),g=n.__decorate([(0,l.Injectable)({multiple:!0}),n.__param(0,(0,l.Optional)()),n.__metadata("design:paramtypes",[b.CommentsThread])],g),e.CommentsZoneService=g},90366:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsZoneWidget=void 0;const n=t(85608),l=n.__importDefault(t(53373)),o=t(25150),h=n.__importDefault(t(14041)),f=n.__importDefault(t(25873)),b=t(76003),g=t(41869),v=t(25918),I=t(93899),u=t(20303),c=t(69635),s=t(37357),a=t(42018),r=t(73804),d=n.__importDefault(t(38877)),m=(0,o.observer)(({thread:p,widget:N})=>{const{comments:W,threadHeaderTitle:Z,contextKeyService:y}=p,R=(0,g.useInjectable)(b.INJECTOR_TOKEN).get(r.CommentsZoneService,[p]),A=(0,g.useInjectable)(c.ICommentsFeatureRegistry),w=h.default.useMemo(()=>A.getFileUploadHandler(),[]),[F,V]=h.default.useState(""),Y=h.default.useMemo(()=>y.createKey("commentIsEmpty",!F),[]),_=R.commentThreadTitle,H=R.commentThreadContext,X=h.default.useCallback(T=>{const{value:x}=T.target;V(x),Y.set(!x)},[]),S=h.default.useMemo(()=>{var T;return((T=A.getProviderFeature(p.providerId))===null||T===void 0?void 0:T.placeholder)||`${(0,g.localize)("comments.reply.placeholder")}...`},[]),Q=h.default.useCallback(async T=>{if(w){const x=await w(F,T);V(B=>{const O=B+x;return Y.set(!O),O})}},[F]);h.default.useEffect(()=>{const T=N.onFirstDisplay(()=>{setTimeout(()=>{N.coreEditor.monacoEditor.revealLine(p.range.endLineNumber+1)},0)});return()=>{T.dispose()}},[]);const k=h.default.useCallback(()=>{R.setCurrentCommentThread(R.thread)},[]),M=h.default.useCallback(()=>{R.setCurrentCommentThread(void 0)},[]),D=h.default.useCallback(()=>{R.setCurrentCommentThread(R.thread)},[]),J=h.default.useCallback(()=>{R.setCurrentCommentThread(void 0)},[]);return h.default.createElement("div",{tabIndex:-1,onMouseOver:k,onMouseOut:M,onFocus:D,onBlur:J,className:(0,l.default)(p.options.threadClassName,d.default.comment_container)},h.default.createElement("div",{className:(0,l.default)(p.options.threadHeadClassName,d.default.head)},h.default.createElement("div",{className:d.default.review_title},Z),h.default.createElement(v.InlineActionBar,{menus:_,context:[{thread:p,widget:N,menuId:I.MenuId.CommentsCommentThreadTitle}],separator:"inline",type:"icon"})),h.default.createElement("div",{className:d.default.comment_body},W.length>0?h.default.createElement(s.CommentItem,{widget:N,commentThreadContext:H,thread:p}):h.default.createElement("div",null,h.default.createElement(a.CommentsTextArea,{focusDelay:100,initialHeight:"auto",value:F,onChange:X,placeholder:S,dragFiles:Q}),h.default.createElement("div",{className:d.default.comment_bottom_actions},h.default.createElement(v.InlineActionBar,{className:d.default.comment_reply_actions,separator:"inline",type:"button",context:[{text:F,widget:N,thread:p,menuId:I.MenuId.CommentsCommentThreadContext}],menus:H})))))});let G=class extends u.ResizeZoneWidget{_fillContainer(){}constructor(N,W,Z){super(N.monacoEditor,W.range,Object.assign(Object.assign({},Z),{showInHiddenAreas:!0})),this._onShow=new g.Emitter,this.onShow=this._onShow.event,this._onHide=new g.Emitter,this.onHide=this._onHide.event,this._editor=N,this._wrapper=document.createElement("div"),this._isShow=!W.isCollapsed,this._container.appendChild(this._wrapper),this.observeContainer(this._wrapper);const y=this.commentsFeatureRegistry.getZoneWidgetRender();f.default.createRoot(this._wrapper).render(h.default.createElement(g.ConfigProvider,{value:this.appConfig},y?y(W,this):h.default.createElement(m,{thread:W,widget:this})))}get coreEditor(){return this._editor}get isShow(){return this._isShow}show(){super.show(),this._isShow=!0,this._onShow.fire()}hide(){super.dispose(),this._isShow=!1,this._onHide.fire()}toggle(){this._isShow?this.hide():this.show()}applyClass(){}applyStyle(){}};n.__decorate([(0,b.Autowired)(g.AppConfig),n.__metadata("design:type",Object)],G.prototype,"appConfig",void 0),n.__decorate([(0,b.Autowired)(c.ICommentsFeatureRegistry),n.__metadata("design:type",Object)],G.prototype,"commentsFeatureRegistry",void 0),G=n.__decorate([(0,b.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object,Object,Object])],G),e.CommentsZoneWidget=G},62604:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsBrowserContribution=void 0;const n=t(85608),l=t(76003),o=t(41869),h=t(93899),f=t(57517),b=t(63067),g=t(69635),v=t(47842);let I=class extends o.Disposable{onStart(){this.registerCommentsFeature(),this.listenToCreateCommentsPanel(),this.commentsService.init()}get panelBadge(){const c=this.commentsService.commentsThreads.length;return c?c+"":""}registerCommands(c){c.registerCommand({id:g.CollapseId,label:"%comments.panel.action.collapse%",iconClass:(0,o.getIcon)("collapse-all")},{execute:()=>{this.commentModelService.collapsedAll()}}),c.registerCommand({id:g.CloseThreadId,label:"%comments.thread.action.close%",iconClass:(0,o.getIcon)("up")},{execute:s=>{const{thread:a,widget:r}=s;a.comments.length?r.isShow&&r.toggle():a.dispose()}}),c.registerCommand({id:g.SwitchCommandReaction},{execute:s=>{this.eventBus.fire(new g.CommentReactionClick(s))}})}registerMenus(c){c.registerMenuItem(h.MenuId.CommentsCommentThreadTitle,{command:g.CloseThreadId,group:"inline",order:Number.MAX_SAFE_INTEGER})}registerToolbarItems(c){c.registerItem({id:g.CollapseId,viewId:g.CommentPanelId,command:g.CollapseId,tooltip:(0,o.localize)("comments.panel.action.collapse")})}registerCommentsFeature(){this.contributions.getContributions().forEach((c,s)=>{this.addDispose(this.commentsService.registerCommentRangeProvider(`contribution_${s}`,{getCommentingRanges:a=>c.provideCommentingRanges(a)})),c.registerCommentsFeature&&c.registerCommentsFeature(this.commentsFeatureRegistry)})}listenToCreateCommentsPanel(){this.commentsFeatureRegistry.getCommentsPanelOptions().defaultShow?this.commentsService.registerCommentPanel():o.Event.once(this.commentsService.onThreadsCreated)(()=>{this.commentsService.registerCommentPanel()}),this.addDispose(o.Event.debounce(this.commentsService.onThreadsChanged,()=>{},100)(()=>{const c=this.layoutService.getTabbarHandler(g.CommentPanelId);c?.setBadge(this.panelBadge)},this))}registerEditorFeature(c){c.registerEditorFeatureContribution({contribute:s=>this.commentsService.handleOnCreateEditor(s),provideEditorOptionsForUri:async s=>(await this.commentsService.getContributionRanges(s)).length?{lineDecorationsWidth:25,lineNumbersMinChars:5}:{}})}};n.__decorate([(0,l.Autowired)(g.ICommentsService),n.__metadata("design:type",Object)],I.prototype,"commentsService",void 0),n.__decorate([(0,l.Autowired)(b.IMainLayoutService),n.__metadata("design:type",Object)],I.prototype,"layoutService",void 0),n.__decorate([(0,l.Autowired)(g.ICommentsFeatureRegistry),n.__metadata("design:type",Object)],I.prototype,"commentsFeatureRegistry",void 0),n.__decorate([(0,l.Autowired)(g.CommentsContribution),n.__metadata("design:type",Object)],I.prototype,"contributions",void 0),n.__decorate([(0,l.Autowired)(o.IEventBus),n.__metadata("design:type",Object)],I.prototype,"eventBus",void 0),n.__decorate([(0,l.Autowired)(v.CommentModelService),n.__metadata("design:type",v.CommentModelService)],I.prototype,"commentModelService",void 0),I=n.__decorate([(0,o.Domain)(o.ClientAppContribution,f.BrowserEditorContribution,o.CommandContribution,o.TabBarToolbarContribution,h.MenuContribution)],I),e.CommentsBrowserContribution=I},55011:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsService=void 0;const n=t(85608),l=n.__importDefault(t(53435)),o=n.__importDefault(t(87809)),h=t(76003),f=t(41869),b=t(57517),g=t(63067),v=t(20868),I=n.__importStar(t(20868)),u=t(62663),c=t(52416),s=n.__importStar(t(88104)),a=t(69635),r=t(53878),d=t(49867),m=t(53711);let G=class extends f.Disposable{constructor(){super(...arguments),this.decorationChangeEmitter=new f.Emitter,this.threads=new Map,this.threadsChangeEmitter=new f.Emitter,this.threadsCommentChangeEmitter=new f.Emitter,this.commentRangeProviderChangeEmitter=new f.Emitter,this.onDidChangeCurrentCommentThreadEmitter=new f.Emitter,this.threadsCreatedEmitter=new f.Emitter,this.rangeProviderMap=new Map,this.rangeOwner=new Map,this.providerDecorationCache=new f.LRUCache(1e4),this.commentRangeDecorationMap=new Map,this.shouldShowCommentsSchemes=new Set(["file","git","diff"]),this.decorationProviderDisposer=f.Disposable.NULL,this.activeThreadDecorationIds=[],this.allEditors=[],this.editorCommentingRangeSpaceReservedMap=new Map,this.editorLineDecorationsWidthMap=new Map}get commentsThreads(){return[...this.threads.values()]}get isMultiCommentsForSingleLine(){var N;return!!(!((N=this.commentsFeatureRegistry.getConfig())===null||N===void 0)&&N.isMultiCommentsForSingleLine)}get currentAuthorAvatar(){var N,W;return(W=(N=this.commentsFeatureRegistry.getConfig())===null||N===void 0?void 0:N.author)===null||W===void 0?void 0:W.avatar}get filterThreadDecoration(){var N;return(N=this.commentsFeatureRegistry.getConfig())===null||N===void 0?void 0:N.filterThreadDecoration}get onThreadsChanged(){return this.threadsChangeEmitter.event}get onThreadsCommentChange(){return this.threadsCommentChangeEmitter.event}get onThreadsCreated(){return this.threadsCreatedEmitter.event}get onCommentRangeProviderChange(){return this.commentRangeProviderChangeEmitter.event}get onDidChangeCurrentCommentThread(){return this.onDidChangeCurrentCommentThreadEmitter.event}setCurrentCommentThread(N){this.onDidChangeCurrentCommentThreadEmitter.fire(N)}createThreadDecoration(N){var W;const Z=N.comments.length===0?this.currentAuthorAvatar:(W=N.comments[0].author.iconPath)===null||W===void 0?void 0:W.toString(),y=Z?`${this.iconService.fromIcon("",Z,c.IconType.Background)} avatar-icon`:this.iconService.fromString("$(comment)"),E={description:"comments-thread-decoration",glyphMarginClassName:Z?["comment-thread",y].join(" "):["comment-range","comment-thread",y].join(" ")};return s.ModelDecorationOptions.createDynamic(E)}updateActiveThreadDecoration(N){var W;const Z=this.getCurrentEditor(N?.uri);if(!Z)return;(W=this.currentThreadCollapseStateListener)===null||W===void 0||W.dispose();const y=[];if(N){const E=N.range;N.isCollapsed||(this.currentThreadCollapseStateListener=N.onDidChangeCollapsibleState(R=>{R===a.CommentThreadCollapsibleState.Collapsed&&this.updateActiveThreadDecoration(void 0)}),y.push({range:E,options:this.createThreadRangeActiveDecoration()}))}this.activeThreadDecorationIds=Z.monacoEditor.deltaDecorations(this.activeThreadDecorationIds,y)}createDottedRangeDecoration(){const N={description:"comments-multiline-hover-decoration",linesDecorationsClassName:["comment-range","multiline-add"].join(" ")};return s.ModelDecorationOptions.createDynamic(N)}createHoverDecoration(){const N={description:"comments-hover-decoration",linesDecorationsClassName:["comment-range","line-hover","comment-add"].join(" ")};return s.ModelDecorationOptions.createDynamic(N)}createThreadRangeActiveDecoration(){const N={description:"comments-thread-range-active-decoration",isWholeLine:!1,zIndex:20,className:"comment-thread-range-current",shouldFillLineOnLineBreak:!0};return s.ModelDecorationOptions.createDynamic(N)}createThreadRangeDecoration(){const N={description:"comments-thread-range-decoration",isWholeLine:!1,zIndex:20,className:"comment-thread-range",shouldFillLineOnLineBreak:!0};return s.ModelDecorationOptions.createDynamic(N)}createCommentRangeDecoration(){const N={description:"comments-range-decoration",linesDecorationsClassName:["comment-range","comment-diff-added"].join(" ")};return s.ModelDecorationOptions.createDynamic(N)}init(){const N=this.resourceService.getSupportedSchemes();for(const W of N)this.shouldShowCommentsSchemes.add(W);this.addDispose(this.resourceService.onRegisterResourceProvider(W=>{W.scheme&&(this.shouldShowCommentsSchemes.add(W.scheme),this.registerDecorationProvider())})),this.addDispose(this.resourceService.onUnregisterResourceProvider(W=>{W.scheme&&(this.shouldShowCommentsSchemes.delete(W.scheme),this.registerDecorationProvider())})),this.registerDecorationProvider()}getCurrentEditor(N){var W;if(N){for(const Z of this.allEditors)if(!((W=Z.currentUri)===null||W===void 0)&&W.isEqual(N))return this.editor=Z,Z}return this.editor}handleOnCreateEditor(N){this.allEditors.push(N),this.editor=N;const W=new f.Disposable;let Z=[],y=!1;return W.addDispose(N.monacoEditor.onMouseDown(E=>{if(E.target.type===u.monacoBrowser.editor.MouseTargetType.GUTTER_LINE_DECORATIONS&&E.target.element&&E.target.element.className.indexOf("comment-add")>-1){const{target:R}=E;if(R&&R.range){const{range:A}=R;this.startCommentRange=A,E.event.stopPropagation()}}else if(E.target.type===u.monacoBrowser.editor.MouseTargetType.GUTTER_GLYPH_MARGIN&&E.target.element&&E.target.element.className.indexOf("comment-thread")>-1){const{target:R}=E;if(R&&R.range){const{range:A}=R,w=this.commentsThreads.filter(F=>N.currentUri&&F.uri.isEqual(N.currentUri)&&F.range.endLineNumber===A.endLineNumber);w.length&&(w.some(V=>V.isShowWidget(N))?w.forEach(V=>V.hide(N)):w.forEach(V=>V.show(N)))}E.event.stopPropagation()}})),W.addDispose(N.monacoEditor.onMouseUp(async E=>{if(this.startCommentRange){if(y){this.renderCommentRange(N),y=!1,this.startCommentRange=null,this.endCommentRange=null;return}let R=this.startCommentRange;this.endCommentRange&&(this.endCommentRange.startLineNumber<this.startCommentRange.startLineNumber?(R.startColumn=this.endCommentRange.startColumn,R.startLineNumber=this.endCommentRange.startLineNumber):(R.endColumn=this.endCommentRange.endColumn,R.endLineNumber=this.endCommentRange.endLineNumber)),N.currentUri&&(R=await this.getValidRange(R,N.currentUri)),R&&(this.commentsThreads.some(A=>A.comments.length===0&&N.currentUri&&A.uri.isEqual(N.currentUri)&&A.range.startLineNumber===R.startLineNumber&&A.range.endLineNumber===R.endLineNumber)||this.createThread(N.currentUri,R).show(N),E.event.stopPropagation())}else if(E.target.type===u.monacoBrowser.editor.MouseTargetType.GUTTER_LINE_DECORATIONS&&E.target.element&&E.target.element.className.indexOf("comment-range")>-1&&E.target.element.className.indexOf("comment-thread")<0){const{target:R}=E,A=R.range;A&&(this.commentsThreads.some(w=>w.comments.length===0&&N.currentUri&&w.uri.isEqual(N.currentUri)&&w.range.startLineNumber===A.startLineNumber&&w.range.endLineNumber===A.endLineNumber)||this.createThread(N.currentUri,A).show(N),E.event.stopPropagation())}this.startCommentRange=null,this.endCommentRange=null})),W.addDispose(N.monacoEditor.onMouseMove(async E=>{var R,A,w;const F=N.currentUri,V=E.target.range;if(this.startCommentRange){if(!((R=E.target.element)===null||R===void 0)&&R.className||!((w=(A=E.target.element)===null||A===void 0?void 0:A.offsetParent)===null||w===void 0)&&w.className.includes("diff-hidden-lines")&&(y=!0),F&&V){let Y={startLineNumber:this.startCommentRange.startLineNumber,endLineNumber:V.endLineNumber,startColumn:this.startCommentRange.startColumn,endColumn:V.endColumn};this.startCommentRange.startLineNumber>V.startLineNumber&&(Y={startLineNumber:V.startLineNumber,endLineNumber:this.startCommentRange.endLineNumber,startColumn:V.startColumn,endColumn:this.startCommentRange.endColumn}),this.renderCommentRange(N,Y),this.endCommentRange=V}}else if(F&&V&&await this.shouldShowHoverDecoration(F,V)){const Y=[{range:(0,v.positionToRange)(V.startLineNumber),options:this.createHoverDecoration()}];Z=N.monacoEditor.deltaDecorations(Z,Y)}})),W.addDispose(N.monacoEditor.onMouseLeave(async E=>{var R;const A=(R=E.target)===null||R===void 0?void 0:R.range,w=[];!this.startCommentRange&&A&&w.push({range:(0,v.positionToRange)(A.startLineNumber),options:this.createCommentRangeDecoration()}),Z=N.monacoEditor.deltaDecorations(Z,w)})),W.addDispose(this.onCommentRangeProviderChange(()=>{this.renderCommentRange(N)})),W.addDispose(f.Event.any(this.onThreadsChanged,this.onThreadsCommentChange,this.onThreadsCreated)(E=>{const R=this.getCurrentEditor(E.uri);R&&this.renderCommentRange(R),this.updateActiveThreadDecoration(void 0)})),W.addDispose(this.onDidChangeCurrentCommentThread(E=>{this.updateActiveThreadDecoration(E)})),this.tryUpdateReservedSpace(N),W.addDispose(N.monacoEditor.onDidChangeModel(()=>{this.renderCommentRange(N),this.tryUpdateReservedSpace(N)})),W}async getValidRange(N,W){if(!W)return N;const Z=await this.getContributionRanges(W);if(Z.length===0)return N;const y=Z.find(E=>{if(N.startLineNumber>=E.startLineNumber&&N.startLineNumber<=E.endLineNumber)return!0});return y&&y.endLineNumber<N.endLineNumber?{startLineNumber:N.startLineNumber,startColumn:N.startColumn,endLineNumber:y.endLineNumber,endColumn:y.endColumn}:N}ensureCommentingRangeReservedAmount(N){const W=this.getExistingCommentEditorOptions(N),Z=this.editorLineDecorationsWidthMap.get(N.getId());W.lineDecorationsWidth!==Z&&N.updateOptions({lineDecorationsWidth:this.getWithCommentsLineDecorationWidth(N,W.lineDecorationsWidth)})}async tryUpdateReservedSpace(N){if(!N)return;let W=this.editorCommentingRangeSpaceReservedMap.get(N.getId())||!1;const Z=N.currentUri?this.shouldShowCommentsSchemes.has(N.currentUri.scheme):!1,y=this.commentsThreads.some(R=>N.currentUri&&R.uri.isEqual(N.currentUri)&&R.comments.length>0),E=Z||y;if(E)if(W)this.ensureCommentingRangeReservedAmount(N);else{W=!0;const{lineDecorationsWidth:R,extraEditorClassName:A}=this.getExistingCommentEditorOptions(N),w=this.getWithCommentsEditorOptions(N,A,R);this.updateEditorLayoutOptions(N,w.extraEditorClassName,w.lineDecorationsWidth)}else if(!E&&W){W=!1;const{lineDecorationsWidth:R,extraEditorClassName:A}=this.getExistingCommentEditorOptions(N),w=this.getWithoutCommentsEditorOptions(N,A,R);this.updateEditorLayoutOptions(N,w.extraEditorClassName,w.lineDecorationsWidth)}this.editorCommentingRangeSpaceReservedMap.set(N.getId(),W)}getExistingCommentEditorOptions(N){const W=N.monacoEditor.getOption(I.EditorOption.lineDecorationsWidth);let Z=[];const y=N.monacoEditor.getRawOptions().extraEditorClassName;return y&&(Z=y.split(" ")),{lineDecorationsWidth:W,extraEditorClassName:Z}}getWithoutCommentsEditorOptions(N,W,Z){let y=Z;const E=W.findIndex(A=>A==="inline-comment");E>=0&&W.splice(E,1);const R=N.monacoEditor.getOptions();return R.get(I.EditorOption.folding)&&R.get(I.EditorOption.showFoldingControls)!=="never"&&(y+=11),y-=24,{extraEditorClassName:W,lineDecorationsWidth:y}}updateEditorLayoutOptions(N,W,Z){N.updateOptions({extraEditorClassName:W.join(" "),lineDecorationsWidth:Z})}getWithCommentsEditorOptions(N,W,Z){return W.push("inline-comment"),{lineDecorationsWidth:this.getWithCommentsLineDecorationWidth(N,Z),extraEditorClassName:W}}getWithCommentsLineDecorationWidth(N,W){let Z=W;const y=N.monacoEditor.getOptions();return y.get(I.EditorOption.folding)&&y.get(I.EditorOption.showFoldingControls)!=="never"&&(Z-=11),Z+=24,this.editorLineDecorationsWidthMap.set(N.getId(),Z),Z}async renderCommentRange(N,W={startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:0}){if(!N.currentUri)return;const Z=await this.getContributionRanges(N.currentUri);if(Z.length>0){const y=[];Z.map(R=>{if(W.startLineNumber===0&&W.endLineNumber===0)y.push({range:R,options:this.createCommentRangeDecoration()});else if(W.startLineNumber<=R.startLineNumber&&W.endLineNumber>=R.endLineNumber)y.push({range:R,options:this.createDottedRangeDecoration()},{range:R,options:this.createThreadRangeDecoration()});else if(W.endLineNumber>=R.endLineNumber)if(W.startLineNumber<=R.endLineNumber){const A={startLineNumber:W.startLineNumber,endLineNumber:R.endLineNumber,startColumn:W.startColumn,endColumn:R.endColumn},w={startLineNumber:R.startLineNumber,endLineNumber:A.startLineNumber-1,startColumn:R.startColumn,endColumn:A.endColumn};y.push({range:w,options:this.createCommentRangeDecoration()},{range:A,options:this.createDottedRangeDecoration()},{range:A,options:this.createThreadRangeDecoration()})}else y.push({range:R,options:this.createCommentRangeDecoration()});else if(W.endLineNumber<R.endLineNumber)if(W.endLineNumber>=R.startLineNumber)if(W.startLineNumber>=R.startLineNumber){const A={startLineNumber:R.startLineNumber,startColumn:R.startColumn,endLineNumber:W.startLineNumber-1,endColumn:W.startColumn},w={startLineNumber:W.endLineNumber+1,startColumn:W.endColumn,endLineNumber:R.endLineNumber,endColumn:R.endColumn},F=W.startLineNumber!==R.startLineNumber?[{range:A,options:this.createCommentRangeDecoration()}]:[];F.push({range:W,options:this.createDottedRangeDecoration()}),F.push({range:W,options:this.createThreadRangeDecoration()}),F.push({range:w,options:this.createCommentRangeDecoration()}),y.push(...F)}else{const A={startLineNumber:R.startLineNumber,startColumn:R.startColumn,endLineNumber:W.endLineNumber,endColumn:W.endColumn},w={startLineNumber:A.endLineNumber+1,startColumn:A.endColumn,endLineNumber:R.endLineNumber,endColumn:R.endColumn};y.push({range:A,options:this.createDottedRangeDecoration()},{range:A,options:this.createThreadRangeDecoration()},{range:w,options:this.createCommentRangeDecoration()})}else y.push({range:R,options:this.createCommentRangeDecoration()})});const E=this.commentRangeDecorationMap.get(N.currentUri.toString())||[];this.commentRangeDecorationMap.set(N.currentUri.toString(),N.monacoEditor.deltaDecorations(E,y))}else this.commentRangeDecorationMap.set(N.currentUri.toString(),[])}async shouldShowHoverDecoration(N,W){return this.shouldShowCommentsSchemes.has(N.scheme)?(await this.getContributionRanges(N)).some(E=>W.startLineNumber<=E.endLineNumber):!1}createThread(N,W,Z={comments:[],readOnly:!1}){const y=this.getProviderIdsByLine(W.endLineNumber)[0],E=this.injector.get(d.CommentsThread,[N,W,y,Z]);return E.onDispose(()=>{this.threads.delete(E.id),this.threadsChangeEmitter.fire(E),this.decorationChangeEmitter.fire(N)}),E.onDidChange(()=>{this.threadsChangeEmitter.fire(E)}),this.threads.set(E.id,E),this.addDispose(E),this.threadsChangeEmitter.fire(E),this.threadsCreatedEmitter.fire(E),this.decorationChangeEmitter.fire(N),E}getThreadsByUri(N){return this.commentsThreads.filter(W=>W.uri.isEqual(N)).sort((W,Z)=>W.range.startLineNumber-Z.range.startLineNumber)}handleCommentFileNode(N){const W=[],Z=[...this.threads.values()].filter(E=>E.comments.length),y=(0,o.default)(Z,E=>E.uri);return Object.keys(y).map(E=>{var R;const A=y[E];if(A.length===0)return;const w=new f.URI(this.appConfig.workspaceDir),F=new f.URI(E),V=(R=w.relative(F))===null||R===void 0?void 0:R.toString();W.push(new m.CommentFileNode(this,A,V,F.codeUri.fsPath,this.labelService.getIcon(F),F,N))}),W}handleCommentContentNode(N){var W;const Z=[];for(const y of N.threads){const[E]=y.comments,R=typeof E.body=="string"?E.body:E.body.value;let A=`[Ln ${y.range.startLineNumber}]`;y.range.startLineNumber!==y.range.endLineNumber&&(A=`[Ln ${y.range.startLineNumber}-${y.range.endLineNumber}]`),Z.push(new m.CommentContentNode(this,y,R,A,E.author.iconPath&&(!((W=E.author.iconPath)===null||W===void 0)&&W.authority)?this.iconService.fromIcon("",E.author.iconPath.toString(),c.IconType.Background):(0,f.getIcon)("message"),E.author,N.resource,N))}return Z}handleCommentReplyNode(N){const W=[],Z=N.thread,[y,...E]=Z.comments,R=E[E.length-1].author.name;return W.push(new m.CommentReplyNode(this,Z,(0,f.formatLocalize)("comment.reply.count",E?.length||0),(0,f.formatLocalize)("comment.reply.lastReply",R),"",N.resource,N)),W}async resolveChildren(N){let W=[];if(N?m.CommentRoot.isRoot(N)?W=this.handleCommentFileNode(N):m.CommentFileNode.is(N)?W=this.handleCommentContentNode(N):m.CommentContentNode.is(N)&&(W=this.handleCommentReplyNode(N)):W.push(new m.CommentRoot(this)),W.length===1&&m.CommentRoot.isRoot(W[0]))return W;const Z=this.commentsFeatureRegistry.getCommentsPanelTreeNodeHandlers();if(Z.length>0)for(const y of Z)W=y(W);return W}async getContributionRanges(N){const W=this.providerDecorationCache.get(N.toString());if(W)return await W.promise;const Z=this.documentService.getModelReference(N,"Get Comment Range"),y=[];for(const w of this.rangeProviderMap){const[F,V]=w;y.push((async()=>{if(!Z?.instance)return;const Y=await V.getCommentingRanges(Z.instance);return Y&&Y.length&&this.rangeOwner.set(F,Y),Y})())}const E=new f.Deferred;this.providerDecorationCache.set(N.toString(),E);const R=(await Promise.all(y)).filter(Boolean);Z?.dispose();const A=(0,l.default)(R).filter(Boolean);return E.resolve(A),A}fireThreadCommentChange(N){this.threadsCommentChangeEmitter.fire(N)}registerDecorationProvider(){this.decorationProviderDisposer.dispose(),this.decorationProviderDisposer=this.editorDecorationCollectionService.registerDecorationProvider({schemes:[...this.shouldShowCommentsSchemes.values()],key:"comments",onDidDecorationChange:this.decorationChangeEmitter.event,provideEditorDecoration:N=>this.commentsThreads.map(W=>(W.uri.isEqual(N)?W.comments.length&&W.showWidgetsIfShowed():W.hideWidgetsByDispose(),W)).filter(W=>{const Z=W.uri.isEqual(N);return this.filterThreadDecoration?Z&&this.filterThreadDecoration(W):Z}).map(W=>({range:{startLineNumber:W.range.endLineNumber,endLineNumber:W.range.endLineNumber,startColumn:W.range.endColumn,endColumn:W.range.endColumn},options:this.createThreadDecoration(W)}))}),this.addDispose(this.decorationProviderDisposer)}registerCommentPanel(){this.layoutService.getTabbarHandler(a.CommentPanelId)||this.layoutService.collectTabbarComponent([{id:a.CommentPanelId,component:r.CommentsPanel}],Object.assign({badge:this.panelBadge,containerId:a.CommentPanelId,title:(0,f.localize)("comments").toUpperCase(),hidden:!1,activateKeyBinding:"ctrlcmd+shift+c"},this.commentsFeatureRegistry.getCommentsPanelOptions()),"bottom")}get panelBadge(){const N=this.commentsThreads.length;return N?N+"":""}registerCommentRangeProvider(N,W){return this.rangeProviderMap.set(N,W),this.providerDecorationCache.clear(),this.commentRangeProviderChangeEmitter.fire(),f.Disposable.create(()=>{this.rangeProviderMap.delete(N),this.rangeOwner.delete(N),this.providerDecorationCache.clear()})}forceUpdateDecoration(){var N,W,Z;const y=(N=this.workbenchEditorService.currentEditor)===null||N===void 0?void 0:N.currentUri;y&&this.decorationChangeEmitter.fire(y);const E=(Z=(W=this.workbenchEditorService.currentEditorGroup)===null||W===void 0?void 0:W.diffEditor)===null||Z===void 0?void 0:Z.originalEditor.currentUri;E&&this.decorationChangeEmitter.fire(E)}getProviderIdsByLine(N){const W=[];if(this.rangeOwner.size===1)return[this.rangeOwner.keys().next().value];for(const Z of this.rangeOwner){const[y,E]=Z;E&&E.some(R=>R.startLineNumber<=N&&N<=R.endLineNumber)&&W.push(y)}return W}};n.__decorate([(0,h.Autowired)(h.INJECTOR_TOKEN),n.__metadata("design:type",h.Injector)],G.prototype,"injector",void 0),n.__decorate([(0,h.Autowired)(f.AppConfig),n.__metadata("design:type",Object)],G.prototype,"appConfig",void 0),n.__decorate([(0,h.Autowired)(b.IEditorDecorationCollectionService),n.__metadata("design:type",Object)],G.prototype,"editorDecorationCollectionService",void 0),n.__decorate([(0,h.Autowired)(c.IIconService),n.__metadata("design:type",Object)],G.prototype,"iconService",void 0),n.__decorate([(0,h.Autowired)(f.LabelService),n.__metadata("design:type",f.LabelService)],G.prototype,"labelService",void 0),n.__decorate([(0,h.Autowired)(a.ICommentsFeatureRegistry),n.__metadata("design:type",Object)],G.prototype,"commentsFeatureRegistry",void 0),n.__decorate([(0,h.Autowired)(b.IEditorDocumentModelService),n.__metadata("design:type",Object)],G.prototype,"documentService",void 0),n.__decorate([(0,h.Autowired)(g.IMainLayoutService),n.__metadata("design:type",Object)],G.prototype,"layoutService",void 0),n.__decorate([(0,h.Autowired)(b.WorkbenchEditorService),n.__metadata("design:type",b.WorkbenchEditorService)],G.prototype,"workbenchEditorService",void 0),n.__decorate([(0,h.Autowired)(b.ResourceService),n.__metadata("design:type",b.ResourceService)],G.prototype,"resourceService",void 0),n.__decorate([f.memoize,n.__metadata("design:type",Object),n.__metadata("design:paramtypes",[])],G.prototype,"isMultiCommentsForSingleLine",null),n.__decorate([f.memoize,n.__metadata("design:type",Object),n.__metadata("design:paramtypes",[])],G.prototype,"currentAuthorAvatar",null),n.__decorate([f.memoize,n.__metadata("design:type",Object),n.__metadata("design:paramtypes",[])],G.prototype,"filterThreadDecoration",null),G=n.__decorate([(0,h.Injectable)()],G),e.CommentsService=G},54230:(L,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CommentsModule=void 0;const n=t(85608),l=t(76003),o=t(41869),h=t(69635),f=t(66480),b=t(62604),g=t(55011),v=t(47842);let I=class extends o.BrowserModule{constructor(){super(...arguments),this.contributionProvider=h.CommentsContribution,this.providers=[{token:h.ICommentsService,useClass:g.CommentsService},{token:v.CommentModelService,useClass:v.CommentModelService},{token:h.ICommentsFeatureRegistry,useClass:f.CommentsFeatureRegistry},b.CommentsBrowserContribution]}};I=n.__decorate([(0,l.Injectable)()],I),e.CommentsModule=I},70154:(L,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.markdownCss=void 0,e.markdownCss=`
28080
28080
  h1, h2, h3, h4, h5, h6, p {
28081
28081
  color: var(--foreground);
28082
28082
  word-break: break-all;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/cli-engine",
3
- "version": "3.4.4-next-1728716505.0",
3
+ "version": "3.4.4-next-1728719159.0",
4
4
  "description": "Integration engine runtime for opensumi-cli and opensumi extension",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -26,14 +26,14 @@
26
26
  "dependencies": {
27
27
  "@koa/cors": "^5.0.0",
28
28
  "@opensumi/di": "^1.8.0",
29
- "@opensumi/ide-core-browser": "3.4.4-next-1728716505.0",
30
- "@opensumi/ide-core-common": "3.4.4-next-1728716505.0",
31
- "@opensumi/ide-core-node": "3.4.4-next-1728716505.0",
32
- "@opensumi/ide-express-file-server": "3.4.4-next-1728716505.0",
33
- "@opensumi/ide-extension": "3.4.4-next-1728716505.0",
34
- "@opensumi/ide-i18n": "3.4.4-next-1728716505.0",
35
- "@opensumi/ide-main-layout": "3.4.4-next-1728716505.0",
36
- "@opensumi/ide-startup": "3.4.4-next-1728716505.0",
29
+ "@opensumi/ide-core-browser": "3.4.4-next-1728719159.0",
30
+ "@opensumi/ide-core-common": "3.4.4-next-1728719159.0",
31
+ "@opensumi/ide-core-node": "3.4.4-next-1728719159.0",
32
+ "@opensumi/ide-express-file-server": "3.4.4-next-1728719159.0",
33
+ "@opensumi/ide-extension": "3.4.4-next-1728719159.0",
34
+ "@opensumi/ide-i18n": "3.4.4-next-1728719159.0",
35
+ "@opensumi/ide-main-layout": "3.4.4-next-1728719159.0",
36
+ "@opensumi/ide-startup": "3.4.4-next-1728719159.0",
37
37
  "chalk": "^4.1.2",
38
38
  "ejs": "^3.1.7",
39
39
  "ip": "^1.1.8",
@@ -72,5 +72,5 @@
72
72
  "webpack": "^5.90.0",
73
73
  "webpack-cli": "^5.1.4"
74
74
  },
75
- "gitHead": "e7b2f9b1e7fd83ba15f5a11ca3f5e0bf89b15184"
75
+ "gitHead": "7828cc655085e029bfcd1f20e584391b5e56618a"
76
76
  }