@opensumi/cli-engine 3.7.1-next-1738980928.0 → 3.7.1-next-1739004986.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.
@@ -28347,7 +28347,7 @@ ${S.slice(1).join(`
28347
28347
  ${f.slice(1).join(`
28348
28348
  `)}`:""}`}}return c.text}findTypeIdentifier(c){let h=c;for(;h;){if(h.type==="type_identifier")return h.text;const u=h.child(1);if(!u)break;h=u}return""}async extractImportPaths(c){var h;const u=[],d=await this.parser.parse(c),v=d?.rootNode,f=[],a=[];if(v)for(let b=0;b<v?.childCount;b++){const y=v.child(b);if(y?.type==="import_statement")f.push(y);else if(y?.type==="type_annotation"){const S=y.child(1);S&&a.push(S.text)}else if(y?.type==="lexical_declaration"){const S=this.findTypeIdentifier(y);S&&a.push(S)}}for(const b of f)if(a.some(y=>b.text.includes(y))){let y=(h=b.child(3))===null||h===void 0?void 0:h.text;(y?.includes("'")||y?.includes('"'))&&(y=y.slice(1,-1)),y&&u.push(y)}return u}async extractInterfaceOrTypeCode(c){var h;const u=[];if(this.language==="typescript"){await this.parserLoaded.promise;const d=(h=this.parser)===null||h===void 0?void 0:h.parse(c),v=d?.rootNode;if(v)for(let f=0;f<v?.childCount;f++){const a=v.child(f);if(a?.type==="export_statement"){const b=a.child(1);(b?.type==="interface_declaration"||b?.type==="type_alias_declaration")&&u.push(b.text)}else(a?.type==="interface_declaration"||a?.type==="type_alias_declaration")&&u.push(a.text)}}return u}async findSyntaxErrorCount(c){var h;await this.parserLoaded.promise;const u=(h=this.parser)===null||h===void 0?void 0:h.parse(c),d=u?.rootNode;if(!d)return 0;let v=0;const f=a=>{(a.type==="function_declaration"||a.type==="class_declaration"||a.type==="variable_declarator"||a.type==="statement_block"||a.type==="expression_statement")&&(a.hasError||a.isMissing||a.type==="ERROR")&&v++;for(let y=0;y<a.childCount;y++){const S=a.child(y);S&&f(S)}};return f(d),v}async findNearestCodeBlockWithPosition(c,h){const u=await this.parser.parse(c);if(u){const{rootNode:d}=u,v=d.namedDescendantForIndex(h),f=this.findContainingCodeBlockWithPosition(v,h);if(!f)return null;let b=c.split(`
28349
28349
  `).slice(0,f.startPosition.row).reduce((y,S)=>y+S.length,0);return b+=f.startPosition.row,b+=f.startPosition.column,{codeBlock:f.text,range:{start:{line:f.startPosition.row,character:0},end:{line:f.endPosition.row,character:1/0}},offset:b,type:f.startPosition.row===f.endPosition.row?p.NearestCodeBlockType.Line:p.NearestCodeBlockType.Block}}return null}dispose(){this.parser.delete(),this.lruCache.clear()}};t.LanguageParser=s,n.__decorate([(0,o.Autowired)(_.WasmModuleManager),n.__metadata("design:type",_.WasmModuleManager)],s.prototype,"wasmModuleManager",void 0),n.__decorate([(0,o.Autowired)(m.TreeSitterLanguageFacts),n.__metadata("design:type",m.TreeSitterLanguageFacts)],s.prototype,"languageFacts",void 0),t.LanguageParser=s=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String])],s)},85679:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageParserService=void 0;const n=e(85608),r=e(76003),o=e(3073),l=e(22486);let p=class{constructor(){this.pool=new Map}createParser(m){const _=l.parserNameMap[m];if(_)return this.pool.has(_)||this.pool.set(_,this.injector.get(o.LanguageParser,[_])),this.pool.get(_)}dispose(){this.pool.forEach(m=>m.dispose()),this.pool.clear()}};t.LanguageParserService=p,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],p.prototype,"injector",void 0),t.LanguageParserService=p=n.__decorate([(0,r.Injectable)()],p)},53374:(L,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toMonacoRange=e;function e(n){return{startLineNumber:n.startPosition.row+1,startColumn:n.startPosition.column+1,endLineNumber:n.endPosition.row+1,endColumn:n.endPosition.column+1}}},19584:(L,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GolangLanguageFacts=void 0;const e=["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(e);class r{constructor(){this.name="go",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return n}isCodeBlock(l){return n.has(l)}}t.GolangLanguageFacts=r},22486:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TreeSitterLanguageFacts=t.knownLanguageFacts=void 0;const n=e(85608);n.__exportStar(e(17973),t);const r=e(76003),o=e(19584),l=e(44606),p=e(82381),E=e(41486),m=e(98588),_=e(96436),s=e(2349),g=e(78542),c=new Set;t.knownLanguageFacts=[o.GolangLanguageFacts,l.JavaLanguageFacts,p.JavaScriptLanguageFacts,E.JavaScriptReactLanguageFacts,m.PythonLanguageFacts,_.RustLanguageFacts,s.TypeScriptLanguageFacts,g.TypeScriptReactLanguageFacts];let h=class{constructor(){this.langs=new Map,t.knownLanguageFacts.forEach(d=>{const v=new d;this.langs.set(v.name,v)})}isCodeBlock(d,v){const f=this.langs.get(d);return f&&f.isCodeBlock?f.isCodeBlock(v):!1}isFunctionCodeBlock(d,v){const f=this.langs.get(d);return f&&f.isFunctionCodeBlocks?f.isFunctionCodeBlocks(v):!1}provideFunctionInfo(d,v){const f=this.langs.get(d);return f&&f.provideFunctionInfo?f.provideFunctionInfo(v):null}getCodeBlockTypes(d){const v=this.langs.get(d);return v?v.provideCodeBlocks():c}};t.TreeSitterLanguageFacts=h,t.TreeSitterLanguageFacts=h=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],h)},44606:(L,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaLanguageFacts=void 0;const e=["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"]),r=new Set(e);class o{constructor(){this.name="java",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(p){return r.has(p)}isFunctionCodeBlocks(p){return n.has(p)}}t.JavaLanguageFacts=o},82381:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaScriptLanguageFacts=t.functionBlockCodeTypes=t.javascriptBlockCodeTypes=void 0;const n=e(53374);t.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"],t.functionBlockCodeTypes=["function","function_declaration","function_expression","arrow_function","method_definition"];const r=new Set(t.functionBlockCodeTypes),o=new Set(t.javascriptBlockCodeTypes);class l{constructor(){this.name="javascript",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return o}isCodeBlock(E){return o.has(E)}isFunctionCodeBlocks(E){return r.has(E)}provideFunctionInfo(E){var m,_,s;switch(E.type){case"function_declaration":case"function_expression":return{infoCategory:"function",type:E.type,name:((m=E.firstNamedChild)===null||m===void 0?void 0:m.text)||"",signatures:E.children.filter(g=>g.type==="parameter").map(g=>{var c;return((c=g.firstChild)===null||c===void 0?void 0:c.text)||""}),range:(0,n.toMonacoRange)(E)};case"arrow_function":{const g=E.parent;return g&&g.type==="variable_declarator"&&g.parent&&(g.parent.type==="lexical_declaration"||g.parent.type==="export_statement"||g.parent.type==="variable_declaration")?{infoCategory:"function",type:E.type,name:((_=g.firstChild)===null||_===void 0?void 0:_.text)||"",signatures:E.children.filter(c=>c.type==="parameter").map(c=>{var h;return((h=c.firstChild)===null||h===void 0?void 0:h.text)||""}),range:(0,n.toMonacoRange)(g.parent)}:null}case"method_definition":return{infoCategory:"function",type:E.type,name:((s=E.firstNamedChild)===null||s===void 0?void 0:s.text)||"",signatures:E.children.filter(g=>g.type==="parameter").map(g=>{var c;return((c=g.firstChild)===null||c===void 0?void 0:c.text)||""}),range:(0,n.toMonacoRange)(E)}}return null}}t.JavaScriptLanguageFacts=l},41486:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaScriptReactLanguageFacts=t.javascriptreactBlockCodeTypes=void 0;const n=e(82381);t.javascriptreactBlockCodeTypes=[...n.javascriptBlockCodeTypes,"jsx_element","jsx_self_closing_element","jsx_expression","jsx_fragment"];const r=new Set(t.javascriptreactBlockCodeTypes);class o{constructor(){this.name="jsx",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(p){return r.has(p)}}t.JavaScriptReactLanguageFacts=o},98588:(L,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PythonLanguageFacts=t.pythonBlockCodeTypes=void 0,t.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 e=new Set(t.pythonBlockCodeTypes);class n{constructor(){this.name="python",this.listCommentStyle="# ",this.blockCommentStyle={start:"'''",end:"'''",linePrefix:""}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.PythonLanguageFacts=n},96436:(L,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RustLanguageFacts=t.rustBlockCodeTypes=void 0,t.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 e=new Set(t.rustBlockCodeTypes);class n{constructor(){this.name="rust",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.RustLanguageFacts=n},17973:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parserIdentifierMap=t.parserNameMap=void 0;const r=e(85608).__importDefault(e(19891)),o={typescript:"typescript",typescriptreact:"tsx",javascript:"javascript",javascriptreact:"jsx",rust:"rust",python:"python",java:"java",go:"go"};t.parserNameMap=o,t.parserIdentifierMap=(0,r.default)(t.parserNameMap)},2349:(L,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeScriptLanguageFacts=t.typescriptBlockTypes=void 0,t.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 e=new Set(t.typescriptBlockTypes);class n{constructor(){this.name="typescript",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return e}isCodeBlock(o){return e.has(o)}}t.TypeScriptLanguageFacts=n},78542:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeScriptReactLanguageFacts=t.typescriptreactBlockTypes=void 0;const n=e(2349);t.typescriptreactBlockTypes=[...n.typescriptBlockTypes,"jsx_element","jsx_self_closing_element","jsx_expression","jsx_fragment"];const r=new Set(t.typescriptreactBlockTypes);class o{constructor(){this.name="tsx",this.listCommentStyle="// ",this.blockCommentStyle={start:"/**",end:" */",linePrefix:" * "}}provideCodeBlocks(){return r}isCodeBlock(p){return r.has(p)}}t.TypeScriptReactLanguageFacts=o},67045:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WasmModuleManager=void 0;const n=e(85608),r=n.__importDefault(e(13833)),o=e(76003),l=e(6858),p=e(70392);let E=class{async resolveResourceUri(){const _=await this.rendererRuntime.provideResourceUri(l.EKnownResources.TreeSitterWasmDirectory);this.resolvedResourceUriDeferred.resolve(_)}constructor(){this.resolvedResourceUriDeferred=new p.Deferred,this.cachedRuntime=new Map,this.parserInitialized=!1,this.resolveResourceUri()}async initParser(){const _=await this.resolvedResourceUriDeferred.promise;let s;return _.endsWith("/")?s=`${_}tree-sitter.wasm`:s=`${_}/tree-sitter.wasm`,this.parserInitialized||(await r.default.init({locateFile:()=>s}),this.parserInitialized=!0),new r.default}async loadLanguage(_){if(!this.cachedRuntime.has(_)){const s=new p.Deferred;this.cachedRuntime.set(_,s);const g=await this.resolvedResourceUriDeferred.promise;let c;g.endsWith("/")?c=`${g}tree-sitter-${_}.wasm`:c=`${g}/tree-sitter-${_}.wasm`,fetch(c).then(h=>h.arrayBuffer()).then(h=>{s.resolve(h)})}return this.cachedRuntime.get(_).promise}};t.WasmModuleManager=E,n.__decorate([(0,o.Autowired)(l.RendererRuntime),n.__metadata("design:type",l.RendererRuntime)],E.prototype,"rendererRuntime",void 0),t.WasmModuleManager=E=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],E)},4972:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIRightTabRenderer=t.AILeftTabRenderer=t.AIChatTabRendererWithTab=t.AIChatTabRenderer=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(41869),p=e(89195),E=e(1149),m=e(43718),_=e(11090),s=e(63067),g=e(46245),c=e(66368),h=e(19951),u=e(752),d=e(19413),v=n.__importDefault(e(87708)),f=()=>{const{side:T}=o.default.useContext(h.TabbarConfig),w=(0,l.useInjectable)(u.TabbarServiceFactory)(T);return(0,o.useEffect)(()=>{w.setIsLatter(!0)},[w]),o.default.createElement("div",{style:{width:0}},o.default.createElement(g.TabbarViewBase,{tabSize:0,MoreTabView:g.IconElipses,TabView:g.IconTabView,barSize:0,panelBorderSize:1}))},a=({className:T,components:w})=>o.default.createElement(h.TabRendererBase,{side:d.AI_CHAT_VIEW_ID,direction:"left-to-right",id:v.default.ai_chat_panel,className:(0,r.default)(T,`${d.AI_CHAT_VIEW_ID}-slot`),components:w,TabbarView:()=>o.default.createElement(f,null),TabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:c.ContainerView,PanelViewProps:{className:v.default.ai_chat_view_container}})});t.AIChatTabRenderer=a;const b=({className:T,components:w})=>o.default.createElement(h.TabRendererBase,{side:d.AI_CHAT_VIEW_ID,direction:"right-to-left",id:v.default.ai_chat_panel,className:(0,r.default)(T,`${d.AI_CHAT_VIEW_ID}-slot`,"design_right_slot"),components:w,TabbarView:()=>o.default.createElement(g.ChatTabbarRenderer2,null),TabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:c.ContainerView,PanelViewProps:{className:v.default.ai_chat_view_container}})});t.AIChatTabRendererWithTab=b;const y=({className:T,components:w})=>o.default.createElement(_.DesignLeftTabRenderer,{className:T,components:w,tabbarView:S});t.AILeftTabRenderer=y;const S=()=>{const T=(0,l.useInjectable)(s.IMainLayoutService),w=(0,l.useInjectable)(u.TabbarServiceFactory)(l.SlotLocation.right),D=(0,l.useAutorun)(w.currentContainerId),I=o.default.useMemo(()=>T.getExtraMenu(),[T]),[O]=(0,l.useContextMenus)(I),P=(0,o.useCallback)(({renderContainers:R})=>{const M=w.visibleContainers.filter(k=>{var B;return!(!((B=k.options)===null||B===void 0)&&B.hideTab)});return o.default.createElement(o.default.Fragment,null,M.length>0&&o.default.createElement(p.HorizontalVertical,{margin:"8px auto 0px",width:"60%"}),M.map(k=>R(k,w,D)))},[D,w]);return o.default.createElement(g.LeftTabbarRenderer,{renderOtherVisibleContainers:P,isRenderExtraTopMenus:!1,renderExtraMenus:o.default.createElement("div",{className:v.default.extra_bottom_icon_container},O.length>=0?O.map(R=>o.default.createElement(p.EnhanceIconWithCtxMenu,{key:R.id,id:R.id,wrapperClassName:v.default.extra_bottom_icon,iconClass:R.icon,menuNodes:R.children,skew:{x:-8,y:-4}})):null)})},A=({className:T,components:w})=>{const D=(0,l.useInjectable)(u.TabbarServiceFactory)(l.SlotLocation.right),I=(0,l.useInjectable)(E.DesignLayoutConfig),O=(0,o.useCallback)(()=>{D.updateCurrentContainerId("")},[]),P=(0,o.useCallback)(M=>{const{component:k}=M,{options:B}=k;return o.default.createElement(c.ContainerView,{...M,renderContainerWrap:({children:x})=>o.default.createElement("div",{className:v.default.right_slot_container_wrap},o.default.createElement("div",{className:v.default.header},o.default.createElement("span",{className:v.default.title},B&&B.title),o.default.createElement("div",{className:v.default.side},o.default.createElement(p.EnhancePopover,{id:"ai_right_panel_header_close",title:(0,m.localize)("editor.title.context.close")},o.default.createElement(p.EnhanceIcon,{icon:"close",onClick:O})))),o.default.createElement("div",{className:v.default.container},x))})},[]),R=(0,o.useMemo)(()=>I.useMergeRightWithLeftPanel?v.default.right_tab_renderer:"",[I]);return o.default.createElement(_.DesignRightTabRenderer,{components:w,className:R,tabbarView:()=>o.default.createElement(g.RightTabbarRenderer,{barSize:0,style:{width:0}}),tabpanelView:()=>o.default.createElement(c.BaseTabPanelView,{PanelView:P})})};t.AIRightTabRenderer=A},82983:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIChatLogoAvatar=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(41869),l=e(89195),p=e(63067),E=e(19413),m=n.__importDefault(e(88473)),_=()=>{const s=(0,o.useInjectable)(p.IMainLayoutService),g=r.default.useCallback(()=>{s.toggleSlot(E.AI_CHAT_VIEW_ID)},[s]);return r.default.createElement("div",{className:m.default.ai_switch,onClick:g},r.default.createElement(l.AILogoAvatar,{iconClassName:m.default.avatar_icon_large}))};t.AIChatLogoAvatar=_},53617:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EnhanceDecorationsCollection=void 0;const n=e(85608),r=e(43718),o=e(20868),l=e(77714),p=n.__importDefault(e(4619));class E{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(s){this.metadata=s,this._hidden=!1;const{editorDecoration:g,deltaData:c,isHidden:h,group:u}=s;(0,r.isUndefined)(c.length)?this.length=g.range.endLineNumber-g.range.startLineNumber:this.length=c.length,this.range=g.range,this.options=g.options,this.resumeRange=this.range,this._hidden=!!h,this._hidden&&this.hide(),(0,r.isDefined)(u)&&this.setGroup(u)}setGroup(s){this._group=s}changeVisibility(s,g){if(!this.options.className)return;const c=this.options.className.split(l.space).filter(h=>h!==p.default.hidden&&h!==p.default.visible).filter(Boolean);c.push(s),this.options.className=c.join(l.space),this.codeEditor.changeDecorations(h=>{h.changeDecorationOptions(this.id,this.options),h.changeDecoration(this.id,g)})}setRange(s){this.range=s}getRange(){return this.range}dispose(){var s,g;(g=(s=this.deltaData).dispose)===null||g===void 0||g.call(s)}hide(){this.resumeRange=this.range,this._hidden=!0;const s={lineNumber:this.range.startLineNumber,column:1},g=o.Range.fromPositions(s);this.changeVisibility(p.default.hidden,g)}resume(){this._hidden=!1,this.changeVisibility(p.default.visible,o.Range.lift(this.resumeRange))}}class m extends r.Disposable{get model(){return this.codeEditor.getModel()}constructor(s){super(),this.codeEditor=s,this.deltaDecorations=[],this._onDidDecorationsChange=this.registerDispose(new r.Emitter),this.onDidDecorationsChange=this._onDidDecorationsChange.event,this.addDispose(this.codeEditor.onDidContentSizeChange(g=>{const{contentHeightChanged:c}=g;c&&this.flush()}))}flush(){this.deltaDecorations=this.deltaDecorations.map(s=>{const{id:g,editorDecoration:{range:c}}=s,h=this.model.getDecorationRange(g);return s.setRange(h??c),s}),this._onDidDecorationsChange.fire(this.deltaDecorations)}delete(s){this.codeEditor.changeDecorations(g=>{g.removeDecoration(s),this.deltaDecorations=this.deltaDecorations.filter(c=>c.id!==s)})}createDecorations(s){return new E(s)}set(s){this.clear(),this.codeEditor.changeDecorations(g=>{const c=[];for(const h of s){const u=g.addDecoration(h.range,h.options);c.push(this.createDecorations({id:u,editorDecoration:h,codeEditor:this.codeEditor,isHidden:h.isHidden,group:h.group,deltaData:{dispose:()=>this.delete(u),length:h.length}}))}this.deltaDecorations=c})}getDecorations(){return this.deltaDecorations}getDecorationByGroup(s){return this.deltaDecorations.find(g=>g.group===s)}getDecorationByLineNumber(s){return this.deltaDecorations.find(g=>g.getRange().startLineNumber===s)}clear(){this.codeEditor.changeDecorations(s=>{for(const g of this.deltaDecorations)s.removeDecoration(g.id);this.deltaDecorations=[]})}}t.EnhanceDecorationsCollection=m},44260:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MsgHistoryManager=void 0;const n=e(85608),r=e(76003),o=e(43718);let l=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(E){const m=(0,o.uuid)(6),_=this.messageMap.size,s={...E,id:m,order:_,type:E.type||"string"};return this.messageMap.set(m,s),this._onMessageChange.fire(this.getMessages()),m}getMessages(){return Array.from(this.messageMap.values()).sort((E,m)=>E.order-m.order)}addUserMessage(E){return this.doAddMessage({...E,role:1})}addAssistantMessage(E){return this.doAddMessage({...E,role:2})}updateAssistantMessage(E,m){if(!this.messageMap.has(E))return;const _=this.messageMap.get(E);this.messageMap.set(E,{..._,content:m.content})}};t.MsgHistoryManager=l,t.MsgHistoryManager=l=n.__decorate([(0,r.Injectable)({multiple:!1})],l)},3841:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativePreferencesContribution=void 0;const n=e(85608),r=e(41869),o=e(83854);let l=class{constructor(){this.schema=o.aiNativePreferenceSchema}};t.AINativePreferencesContribution=l,t.AINativePreferencesContribution=l=n.__decorate([(0,r.Domain)(r.PreferenceContribution)],l)},83854:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.aiNativePreferenceSchema=t.EInlineDiffPreviewMode=void 0;const n=e(41869),r=e(43718);var o;(function(l){l.inlineLive="inlineLive",l.sideBySide="sideBySide"})(o||(t.EInlineDiffPreviewMode=o={})),t.aiNativePreferenceSchema={properties:{[n.AINativeSettingSectionsId.InlineDiffPreviewMode]:{type:"string",enum:[o.inlineLive,o.sideBySide],enumDescriptions:[(0,r.localize)("preference.ai.native.inlineDiff.preview.mode.inlineLive"),(0,r.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},[n.AINativeSettingSectionsId.CodeEditsLintErrors]:{type:"boolean",default:!1},[n.AINativeSettingSectionsId.CodeEditsLineChange]:{type:"boolean",default:!1},[n.AINativeSettingSectionsId.CodeEditsTyping]:{type:"boolean",default:!1}}}},77633:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeCoreContribution=t.TerminalSuggestionReadableStream=t.ERunStrategy=void 0;const n=e(93062);var r;(function(l){l.EXECUTE="EXECUTE",l.PREVIEW="PREVIEW"})(r||(t.ERunStrategy=r={}));class o extends n.SumiReadableStream{static create(){return new o}}t.TerminalSuggestionReadableStream=o,t.AINativeCoreContribution=Symbol("AINativeCoreContribution")},24522:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ttPolicy=t.renderLines=void 0;const n=e(85608),r=e(55405),o=n.__importStar(e(98236)),l=e(27357),p=e(31324),E=e(33892),m=e(24315),_=(s,g,c,h)=>{const u=h.get(p.EditorOption.disableMonospaceOptimizations),d=h.get(p.EditorOption.stopRenderingLineAfter),v="none",f=h.get(p.EditorOption.renderControlCharacters),a=h.get(p.EditorOption.fontLigatures),b=h.get(p.EditorOption.fontInfo),y=h.get(p.EditorOption.lineHeight),S=new E.StringBuilder(1e4);S.appendString('<div class="suggest-preview-text">');for(let w=0,D=c.length;w<D;w++){const I=c[w],O=I.content;S.appendString('<div class="view-line'),S.appendString('" style="top:'),S.appendString(String(w*y)),S.appendString('px;width:1000000px;">');const P=o.isBasicASCII(O),R=o.containsRTL(O);(0,m.renderViewLine)(new m.RenderLineInput(b.isMonospace&&!u,b.canUseHalfwidthRightwardsArrow,O,!1,P,R,0,I.lineTokens,I.decorations,g,0,b.spaceWidth,b.middotWidth,b.wsmiddotWidth,d,v,f,a!==p.EditorFontLigatures.OFF,null),S),S.appendString("</div>")}S.appendString("</div>"),(0,l.applyFontInfo)(s,b);const A=S.build(),T=t.ttPolicy?t.ttPolicy.createHTML(A):A;s.innerHTML=T};t.renderLines=_,t.ttPolicy=(0,r.createTrustedTypesPolicy)("editorGhostText",{createHTML:s=>s})},90614:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineResultAction=void 0;const r=e(85608).__importStar(e(14041)),o=e(66205),l=e(89195),p=e(43718),E=e(31031),m=({onResultClick:_})=>{const s=(0,r.useMemo)(()=>[{icon:"check",text:(0,p.localize)("aiNative.inline.chat.operate.check.title"),btnType:"default",onClick:()=>_(E.EResultKind.ACCEPT)},{icon:"discard",text:(0,p.localize)("aiNative.operate.discard.title"),onClick:()=>_(E.EResultKind.DISCARD)},{icon:"afresh",text:(0,p.localize)("aiNative.operate.afresh.title"),onClick:()=>_(E.EResultKind.REGENERATE)}],[_]);return r.default.createElement(o.ContentWidgetContainerPanel,{style:{transform:"translateY(4px)"}},r.default.createElement(l.AIInlineResult,{iconItems:s}))};t.InlineResultAction=m},40111:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineChatController=void 0;const n=e(43718),r=e(93062),o=e(98864);class l{static is(E){return E instanceof l&&typeof E.mountReadable=="function"}constructor(E){this.options=E,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(E){var m;return!((m=this.options)===null||m===void 0)&&m.enableCodeblockRender?(0,o.extractCodeBlocks)(E):E}mountReadable(E){this._stream=E}get isListened(){return this._listened}listen(){if(this._listened)return;if(!this._stream)throw new Error("No Stream mounted");this._listened=!0;const E=new n.ReplyResponse("");let m="";(0,r.listenReadable)(this._stream,{onData:_=>{m+=_.content;const s=this.calculateCodeBlocks(m);E.updateMessage(s),this._onData.fire(E)},onEnd:()=>{this._onEnd.fire()},onError:_=>{n.AbortError.is(_)?this._onAbort.fire():this._onError.fire(new n.ErrorResponse(_))}})}}t.InlineChatController=l},51221:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineChatEditorController=void 0;const n=e(41869),r=e(43718),o=e(66482),l=e(54414),p=e(52902),E=e(77659),m=e(99906),_=e(89132),s=e(38890),g=e(40111),c=e(31031),h=e(26664);class u extends m.BaseAIMonacoEditorController{constructor(){super(...arguments),this.aiInlineChatDisposable=new r.Disposable,this.aiInlineChatOperationDisposable=new r.Disposable,this.inlineChatInUsing=!1}static get(v){return v.getContribution(u.ID)}get aiNativeConfigService(){return this.injector.get(n.AINativeConfigService)}get aiInlineChatService(){return this.injector.get(n.IAIInlineChatService)}get inlineChatFeatureRegistry(){return this.injector.get(r.InlineChatFeatureRegistryToken)}get preferenceService(){return this.injector.get(n.PreferenceService)}get aiReporter(){return this.injector.get(r.IAIReporter)}get workbenchEditorService(){return this.injector.get(l.WorkbenchEditorService)}get codeActionService(){return this.injector.get(_.CodeActionService)}get logger(){return this.injector.get(r.ILogger)}get contextKeyService(){return this.injector.get(n.IContextKeyService)}mount(){if(this.aiNativeContextKey=this.injector.get(E.AINativeContextKey,[this.monacoEditor.contextKeyService]),this.inlineDiffController=s.InlineDiffController.get(this.monacoEditor),!this.monacoEditor)return this.featureDisposable;this.featureDisposable.addDispose(this.aiInlineChatService.onInlineChatVisible(a=>{a?this.showInlineChat(this.monacoEditor):(this.cancelToken(),this.disposeAllWidget())})),this.featureDisposable.addDispose(this.codeActionService.onCodeActionRun(({id:a,range:b})=>{const y=this.workbenchEditorService.currentEditor;y?.getId()===this.monacoEditor.getId()&&(this.monacoEditor.setSelection(b),this.showInlineChat(this.monacoEditor),this.aiInlineContentWidget&&this.aiInlineContentWidget.clickActionId(a,"codeAction"))})),this.featureDisposable.addDispose(this.monacoEditor.onWillChangeModel(()=>{this.disposeAllWidget()}));let v=!1;this.featureDisposable.addDispose(this.monacoEditor.onMouseDown(a=>{const y=a.target.detail;v=!1,!(y&&typeof y=="string"&&y===r.AIInlineChatContentWidgetId)&&this.aiInlineContentWidget&&!this.aiInlineContentWidget.isPersisted&&this.disposeAllWidget()})),this.featureDisposable.addDispose(this.monacoEditor.onMouseUp(a=>{const y=a.target.detail;y&&typeof y=="string"&&y===r.AIInlineChatContentWidgetId?v=!1:v=!0}));let f=this.preferenceService.getValid(r.AINativeSettingSectionsId.InlineChatAutoVisible,!0);return this.featureDisposable.addDispose(this.preferenceService.onSpecificPreferenceChange(r.AINativeSettingSectionsId.InlineChatAutoVisible,({newValue:a})=>{f=a})),this.featureDisposable.addDispose(r.Event.debounce(r.Event.any(this.monacoEditor.onDidChangeCursorSelection,this.monacoEditor.onMouseUp),(a,b)=>b,r.FRAME_THREE)(()=>{!f||!v||this.aiInlineContentWidget&&this.aiInlineContentWidget.isPersisted||this.showInlineChat(this.monacoEditor)})),this.featureDisposable}disposeAllWidget(){[this.aiInlineContentWidget,this.aiInlineChatDisposable,this.aiInlineChatOperationDisposable].forEach(v=>{v?.dispose()}),this.inlineChatInUsing=!1,this.cancelToken()}showInlineContentWidget(v,f){this.aiInlineContentWidget&&this.aiInlineContentWidget.dispose(),this.aiInlineContentWidget=this.injector.get(h.AIInlineContentWidget,[v]),this.aiInlineContentWidget.show({selection:f})}async showInlineChat(v){if(this.contextKeyService.getContextValue(o.CONTEXT_IN_DEBUG_MODE_KEY)||this.aiNativeContextKey.inlineInputWidgetIsVisible.get()||this.aiNativeContextKey.inlineInputWidgetIsStreaming.get()||!this.aiNativeConfigService.capabilities.supportsInlineChat||this.inlineChatInUsing)return;this.inlineChatInUsing=!0,this.disposeAllWidget();const y=v.getSelection();!y||y.isEmpty()||(this.showInlineContentWidget(v,y),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.onActionClick(({actionId:S,source:A})=>{const T=this.inlineChatFeatureRegistry.getEditorHandler(S),w=this.inlineChatFeatureRegistry.getAction(S);if(!T||!w)return;const D=this.getCrossSelection(v);if(!D)return;const I=()=>{const O=T.providerDiffPreviewStrategy?T.providerDiffPreviewStrategy:T.providePreviewStrategy;if(O)return O.bind(this,v,this.token)};this.runAction({monacoEditor:v,crossSelection:D,reporterFn:()=>this.aiReporter.start(w.name,{message:w.name,type:r.AIServiceType.InlineChat,source:A,runByCodeAction:A==="codeAction",actionSource:A==="codeAction"?r.ActionSourceEnum.CodeAction:r.ActionSourceEnum.InlineChat,actionType:w.name}),execute:T.execute?T.execute.bind(this,v,this.token):void 0,providerPreview:I(),extraData:{actionSource:A==="codeAction"?r.ActionSourceEnum.CodeAction:r.ActionSourceEnum.InlineChat,actionType:w.name}})})))}getCrossSelection(v){const f=v.getSelection();if(!f){this.logger.error("No selection found, aborting inline chat action.");return}return f.setStartPosition(f.startLineNumber,1).setEndPosition(f.endLineNumber,v.getModel().getLineMaxColumn(f.endLineNumber))}convertInlineChatStatus(v,f){if(!this.aiInlineContentWidget)return;const{relationId:a,message:b,startTime:y,isRetry:S,isStop:A}=f;let T;v===c.EInlineChatStatus.DONE&&(T=this.inlineDiffController.getModifyContent()),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.launchChatStatus(v)),this.aiReporter.end(a,{message:b,success:v!==c.EInlineChatStatus.ERROR,replytime:Date.now()-y,isStop:A,isRetry:S,code:T,actionType:f?.actionType,actionSource:f?.actionSource})}visibleDiffWidget(v){const{monacoEditor:f,options:a,reportInfo:b}=v,{chatResponse:y}=a,{relationId:S,startTime:A,isRetry:T,actionType:w,actionSource:D}=b;if(g.InlineChatController.is(y))this.aiInlineChatOperationDisposable.addDispose([y.onError(O=>{this.convertInlineChatStatus(c.EInlineChatStatus.ERROR,{relationId:S,message:O.message||"",startTime:A,isRetry:T,actionSource:D,actionType:w})}),y.onAbort(()=>{this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:S,message:"abort",startTime:A,isRetry:T,isStop:!0,actionSource:D,actionType:w})}),y.onEnd(()=>{this.convertInlineChatStatus(c.EInlineChatStatus.DONE,{relationId:S,message:"",startTime:A,isRetry:T,actionSource:D,actionType:w})})]);else{if(this.aiInlineContentWidget&&this.aiInlineChatDisposable.disposed||r.CancelResponse.is(y)){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:S,message:y.message||"",startTime:A,isRetry:T,isStop:!0,actionSource:D,actionType:w});return}if(r.ErrorResponse.is(y)){this.convertInlineChatStatus(c.EInlineChatStatus.ERROR,{relationId:S,message:y.message||"",startTime:A,isRetry:T,actionSource:D,actionType:w});return}this.convertInlineChatStatus(c.EInlineChatStatus.DONE,{relationId:S,message:"",startTime:A,isRetry:T,actionSource:D,actionType:w})}this.inlineDiffController.showPreviewerByStream(f,a).mount(this.aiInlineContentWidget)}ensureInlineChatVisible(v,f){this.aiInlineContentWidget.disposed?this.showInlineContentWidget(v,f):this.aiInlineContentWidget.isHidden&&this.aiInlineContentWidget.resume()}async handleDiffPreviewStrategy(v){if(!this.aiInlineContentWidget)return;const{monacoEditor:f,strategy:a,crossSelection:b,relationId:y,isRetry:S,actionType:A,actionSource:T}=v,w=f.getModel();this.inlineDiffController.destroyPreviewer(w.uri.toString()),this.aiInlineChatOperationDisposable.dispose(),this.ensureInlineChatVisible(f,b),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.launchChatStatus(c.EInlineChatStatus.THINKING));const D=Date.now();if(this.token.isCancellationRequested){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:y,message:"abort",startTime:D,isRetry:S,isStop:!0,actionSource:T,actionType:A});return}const I=await a();if(r.CancelResponse.is(I)){this.convertInlineChatStatus(c.EInlineChatStatus.READY,{relationId:y,message:"abort",startTime:D,isRetry:S,isStop:!0,actionSource:T,actionType:A}),this.disposeAllWidget();return}this.visibleDiffWidget({monacoEditor:f,options:{crossSelection:b,chatResponse:I},reportInfo:{relationId:y,startTime:D,isRetry:S,actionType:A,actionSource:T}}),this.aiInlineChatOperationDisposable.addDispose([this.aiInlineContentWidget.onResultClick(O=>{const P=this.inlineDiffController.getModifyContent(),R=this.inlineDiffController.getOriginContent();this.inlineDiffController.handleAction(O),O===c.EResultKind.ACCEPT?(this.aiReporter.end(y,{message:"accept",success:!0,isReceive:!0,isDrop:!1,code:P,originCode:R,actionType:r.ActionTypeEnum.Accept}),(0,r.runWhenIdle)(()=>{this.disposeAllWidget()})):O===c.EResultKind.DISCARD?(this.aiReporter.end(y,{message:"discard",success:!0,isDrop:!0,isReceive:!1,code:P,originCode:R,actionType:r.ActionTypeEnum.Discard}),(0,r.runWhenIdle)(()=>{this.disposeAllWidget()})):O===c.EResultKind.REGENERATE&&(this.aiReporter.end(y,{message:"regenerate",success:!0,isDrop:!0,isReceive:!1,code:P,originCode:R,actionType:r.ActionTypeEnum.Regenerate}),this.handleDiffPreviewStrategy({monacoEditor:f,strategy:a,crossSelection:b,relationId:y,isRetry:!0,actionSource:T,actionType:A}))}),this.aiInlineChatService.onThumbs(O=>{this.aiReporter.end(y,{isLike:O})}),this.inlineDiffController.onMaxLineCount(O=>{requestAnimationFrame(()=>{if(b.endLineNumber===w.getLineCount()){const P=f.getOption(p.monacoApi.editor.EditorOption.lineHeight);this.aiInlineContentWidget.setOffsetTop(P*O+12)}})})])}async runAction(v){const{monacoEditor:f,crossSelection:a,reporterFn:b,execute:y,providerPreview:S,extraData:A}=v;if(y&&(await y(),this.disposeAllWidget()),S){const T=b();await this.handleDiffPreviewStrategy({monacoEditor:f,strategy:S,crossSelection:a,relationId:T,isRetry:!1,actionSource:A?.actionSource,actionType:A?.actionType})}}}t.InlineChatEditorController=u,u.ID="editor.contrib.ai.inline.chat"},2281:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineChatFeatureRegistry=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(57925),p=e(43718),E=e(89132),m=e(74353),_=e(86443);let s=class extends p.Disposable{constructor(){super(...arguments),this.actionsMap=new Map,this.editorHandlerMap=new Map,this.terminalHandlerMap=new Map}dispose(){super.dispose(),this.actionsMap.clear(),this.editorHandlerMap.clear(),this.terminalHandlerMap.clear()}collectActions(c){const{id:h}=c;return this.actionsMap.has(h)?(this.logger.warn(`InlineChatFeatureRegistry: id ${h} already exists`),!1):((0,p.isUndefined)(c.renderType)&&(c.renderType="button"),(0,p.isUndefined)(c.order)&&(c.order=0),this.actionsMap.set(h,c),!0)}removeCollectedActions(c){this.actionsMap.delete(c.id),this.codeActionService.deleteCodeActionById(c.id)}registerEditorInlineChat(c,h){return this.collectActions(c)&&(this.editorHandlerMap.set(c.id,h),this.codeActionService.registerCodeAction(c)),{dispose:()=>{this.removeCollectedActions(c)}}}unregisterEditorInlineChat(c){return this.removeCollectedActions(c)}registerTerminalInlineChat(c,h){return this.collectActions(c)&&((0,p.isUndefined)(h.triggerRules)&&(h.triggerRules="selection"),this.terminalHandlerMap.set(c.id,h)),{dispose:()=>{this.removeCollectedActions(c)}}}unregisterTerminalInlineChat(c){return this.removeCollectedActions(c)}registerInteractiveInput(c,h){const u=()=>{const d=String(this.inlineInputService.getSequenceKeyString());if(!d)return;const v={id:_.InteractiveInputModel.ID,name:(0,p.formatLocalize)("aiNative.inline.chat.operate.chat.title",d.toLocaleUpperCase()),renderType:"button",order:Number.MAX_SAFE_INTEGER};this.actionsMap.has(v.id)?this.actionsMap.set(v.id,v):this.collectActions(v)};return this.addDispose(p.Event.filter(this.keybindingRegistry.onKeybindingsChanged,({affectsCommands:d})=>d.includes(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id))(()=>u())),u(),this.inlineInputService.registerInlineInput(c,h)}getEditorActionButtons(){const c=Array.from(this.editorHandlerMap.keys()).filter(h=>{const u=this.actionsMap.get(h);return u&&u.renderType==="button"}).map(h=>this.actionsMap.get(h)).sort((h,u)=>h.order-u.order);return this.actionsMap.has(_.InteractiveInputModel.ID)&&c.push(this.actionsMap.get(_.InteractiveInputModel.ID)),c}getEditorActionMenus(){return Array.from(this.editorHandlerMap.keys()).filter(c=>{const h=this.actionsMap.get(c);return h&&h.renderType==="dropdown"}).map(c=>this.actionsMap.get(c))}getEditorHandler(c){return this.editorHandlerMap.get(c)}getTerminalHandler(c){return this.terminalHandlerMap.get(c)}getTerminalActions(){return Array.from(this.terminalHandlerMap.keys()).map(c=>this.actionsMap.get(c))}getAction(c){return this.actionsMap.get(c)}};t.InlineChatFeatureRegistry=s,n.__decorate([(0,r.Autowired)(o.Logger),n.__metadata("design:type",o.Logger)],s.prototype,"logger",void 0),n.__decorate([(0,r.Autowired)(E.CodeActionService),n.__metadata("design:type",E.CodeActionService)],s.prototype,"codeActionService",void 0),n.__decorate([(0,r.Autowired)(m.InlineInputService),n.__metadata("design:type",m.InlineInputService)],s.prototype,"inlineInputService",void 0),n.__decorate([(0,r.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],s.prototype,"keybindingRegistry",void 0),t.InlineChatFeatureRegistry=s=n.__decorate([(0,r.Injectable)()],s)},31031:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineChatService=t.EResultKind=t.EInlineChatStatus=void 0;const n=e(85608),r=e(76003),o=e(43718);var l=e(19413);Object.defineProperty(t,"EInlineChatStatus",{enumerable:!0,get:function(){return l.EInlineChatStatus}}),Object.defineProperty(t,"EResultKind",{enumerable:!0,get:function(){return l.EResultKind}});let p=class{constructor(){this._onInlineChatVisible=new o.Emitter,this.onInlineChatVisible=this._onInlineChatVisible.event,this._onThumbs=new o.Emitter,this.onThumbs=this._onThumbs.event}fireThumbsEvent(m){this._onThumbs.fire(m)}};t.InlineChatService=p,t.InlineChatService=p=n.__decorate([(0,r.Injectable)({multiple:!1})],p)},26664:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIInlineContentWidget=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(76003),l=e(41869),p=e(89195),E=e(64102),m=e(43718),_=n.__importStar(e(20868)),s=e(62663),g=e(52659),c=e(77659),h=e(90614),u=e(74353),d=e(86443),v=n.__importDefault(e(26899)),f=e(31031),a=y=>{const{onClickActions:S,onClose:A,onChatStatus:T,onResultClick:w}=y,D=(0,l.useInjectable)(l.IAIInlineChatService),I=(0,l.useInjectable)(m.InlineChatFeatureRegistryToken),[O,P]=(0,r.useState)(f.EInlineChatStatus.READY);(0,r.useEffect)(()=>{const U=new m.Disposable;return U.addDispose(T(G=>P(G))),()=>{U.dispose()}},[T,D]),(0,r.useEffect)(()=>{O===f.EInlineChatStatus.ERROR&&A?.()},[A]);const R=(0,r.useMemo)(()=>O===f.EInlineChatStatus.THINKING,[O]),M=(0,r.useMemo)(()=>O===f.EInlineChatStatus.DONE,[O]),k=(0,r.useMemo)(()=>O===f.EInlineChatStatus.ERROR,[O]),B=(0,r.useMemo)(()=>I.getEditorActionButtons(),[I]),x=(0,r.useCallback)(U=>{S?.(U)},[S]),N=(0,r.useCallback)(()=>{A?.()},[A]),j=(0,r.useMemo)(()=>I.getEditorActionMenus().map(U=>new E.MenuNode({id:`ai.menu.operation.${U.id}`,label:U.name,className:v.default.more_operation_menu_item,execute:()=>{x(U.id)}})),[I]),K=(0,r.useCallback)(()=>B.length===0&&j.length===0||k?null:M?r.default.createElement(h.InlineResultAction,{onResultClick:w}):r.default.createElement(p.AIAction,{operationList:B,moreOperation:j,onClickItem:x,onClose:N,loading:R}),[B,j,w,O]);return r.default.createElement("div",{className:v.default.inline_chat_controller_box},K())};let b=class extends g.ReactInlineContentWidget{get status(){return this._status}get isPersisted(){return!this.isHidden&&this.status!==f.EInlineChatStatus.READY&&this.status!==f.EInlineChatStatus.ERROR}constructor(S){super(S),this.editor=S,this.allowEditorOverflow=!0,this._onActionClickEmitter=new m.Emitter,this.onActionClick=this._onActionClickEmitter.event,this._onStatusChange=new m.Emitter,this.onStatusChange=this._onStatusChange.event,this._onResultClick=new m.Emitter,this.onResultClick=this._onResultClick.event,this._status=f.EInlineChatStatus.READY,this.aiNativeContextKey=this.injector.get(c.AINativeContextKey,[this.editor.contextKeyService])}launchChatStatus(S){return(0,m.runWhenIdle)(()=>{this._status=S,this._onStatusChange.fire(S)})}dispose(){this.launchChatStatus(f.EInlineChatStatus.READY),super.dispose()}clickActionId(S,A){var T;if(S===d.InteractiveInputModel.ID&&(!((T=this.options)===null||T===void 0)&&T.selection)){this.hide(),this.inlineInputService.visibleBySelection(this.options.selection);return}this._onActionClickEmitter.fire({actionId:S,source:A})}renderView(){return r.default.createElement(a,{onClickActions:S=>this.clickActionId(S,"widget"),onClose:()=>this.dispose(),onChatStatus:this.onStatusChange.bind(this),onResultClick:S=>{this._onResultClick.fire(S)}})}async show(S){super.show(S),this.aiNativeContextKey.inlineChatIsVisible.set(!0)}getDomNode(){const S=super.getDomNode();return requestAnimationFrame(()=>{S.style.zIndex=(l.StackingLevel.FindWidget-1).toString()}),S}async hide(){this.aiNativeContextKey.inlineChatIsVisible.set(!1),super.hide()}setOptions(S){this.options=S}setOffsetTop(S){this.domNode.style.transform=`translateY(${S}px)`}id(){return m.AIInlineChatContentWidgetId}getPosition(){const S=super.getPosition();if(S)return S;if(!this.options)return null;const{selection:A}=this.options;if(!A)return null;const T=this.computePosition(A);return T||null}safeGetLineLastNonWhitespaceColumn(S){const A=this.editor.getModel();S<1&&(S=1);const T=A.getLineCount();return S>T&&(S=T),A.getLineLastNonWhitespaceColumn(S)}toAbovePosition(S,A){return{position:new _.Position(S,A),preference:[s.monacoBrowser.editor.ContentWidgetPositionPreference.ABOVE,s.monacoBrowser.editor.ContentWidgetPositionPreference.BELOW]}}toBelowPosition(S,A){return{position:new _.Position(S,A),preference:[s.monacoBrowser.editor.ContentWidgetPositionPreference.BELOW,s.monacoBrowser.editor.ContentWidgetPositionPreference.ABOVE]}}recheckSelection(S){const A=S.getStartPosition(),T=S.getEndPosition(),D=this.editor.getModel().getLineCount(),I=Math.max(1,T.lineNumber-1),O=Math.min(D,T.lineNumber+1),P=A.with(I,1),R=T.with(O,this.safeGetLineLastNonWhitespaceColumn(O));if(D===1)return this.toBelowPosition(O,this.safeGetLineLastNonWhitespaceColumn(O));if(R.lineNumber===1&&T.lineNumber!==A.lineNumber)return this.computePosition(_.Selection.fromPositions(P,R));const M=this.safeGetLineLastNonWhitespaceColumn(I),k=this.safeGetLineLastNonWhitespaceColumn(O),B=this.safeGetLineLastNonWhitespaceColumn(T.lineNumber);return k>B&&k>M?this.computePosition(_.Selection.fromPositions(R,P)):this.computePosition(_.Selection.fromPositions(P,R))}isProtrudeAbove(S){const A=this.safeGetLineLastNonWhitespaceColumn(S);return A>=this.safeGetLineLastNonWhitespaceColumn(S-1)&&A>=this.safeGetLineLastNonWhitespaceColumn(S-2)}isProtrudeBelow(S){const A=this.safeGetLineLastNonWhitespaceColumn(S);return A>=this.safeGetLineLastNonWhitespaceColumn(S+1)&&A>=this.safeGetLineLastNonWhitespaceColumn(S+2)}computePosition(S){const A=S.getStartPosition(),T=S.getEndPosition();let w=S.getPosition();const I=this.editor.getModel().getLineCount();if(A.lineNumber===T.lineNumber)return this.recheckSelection(S);T.lineNumber-A.lineNumber===1&&(w=T);const O=this.safeGetLineLastNonWhitespaceColumn(w.lineNumber);let P=w.lineNumber,R="below";if(w.equals(A)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(w.lineNumber-1),this.safeGetLineLastNonWhitespaceColumn(w.lineNumber-2))<=O)return this.toAbovePosition(w.lineNumber,O);for(let B=A.lineNumber;B<=T.lineNumber;B++){if(this.isProtrudeAbove(B)){P=B,R="above";break}if(this.isProtrudeBelow(B)){P=B,R="below";break}}}else if(w.equals(T)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(w.lineNumber+1),this.safeGetLineLastNonWhitespaceColumn(w.lineNumber+2))<=O)return this.toBelowPosition(w.lineNumber,O);for(let B=Math.min(I,T.lineNumber+1);B>=A.lineNumber;B--){if(this.isProtrudeBelow(B)){P=B,R="below";break}if(this.isProtrudeAbove(B)){P=B,R="above";break}}}const M=this.safeGetLineLastNonWhitespaceColumn(P)+1;return R==="below"?this.toBelowPosition(P,M):this.toAbovePosition(P,M)}};t.AIInlineContentWidget=b,n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],b.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(u.InlineInputService),n.__metadata("design:type",u.InlineInputService)],b.prototype,"inlineInputService",void 0),t.AIInlineContentWidget=b=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],b)},15989:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(38890),t),n.__exportStar(e(49444),t),n.__exportStar(e(37679),t),n.__exportStar(e(51347),t)},49444:(L,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.LiveInlineDiffPreviewer=t.SideBySideInlineDiffWidget=t.BaseInlineDiffPreviewer=void 0;const r=e(85608),o=e(76003),l=e(43718),p=e(20868),E=e(90052),m=e(77714),_=e(52451),s=e(43255),g=e(74547),c=e(11827),h=e(9491),u=e(31031),d=e(33062),v=e(37679);let f=class extends l.Disposable{constructor(S){super(),this.monacoEditor=S,this.inlineContentWidget=null,this.model=this.monacoEditor.getModel(),this.addDispose(l.Disposable.create(()=>{this.inlineContentWidget&&this.inlineContentWidget.dispose(),this.attachNode(void 0)}))}formatIndentation(S){const A=this.selection.startLineNumber,T=(0,m.getLeadingWhitespace)(this.model.getLineContent(A));if(S===m.empty||T===m.empty)return S;const{tabSize:w,insertSpaces:D}=this.model.getOptions(),I=this.model.getEOL(),O=(0,h.getSpaceCnt)(T,w);let P=(0,h.generateIndent)(O,w,D);const R=S.split(I),M=R[0];let k=!1;if(M){const x=(0,m.getLeadingWhitespace)(M);P===x?P="":P.length>x.length?P=P.slice(x.length):(P=x.slice(P.length),k=!0)}return R.map(x=>{if(k){const N=(0,m.getLeadingWhitespace)(x);return x=P+x.substring(N.length),x}return P+x}).join(I)}getNode(){return this.node}createNodeSnapshot(){return this.node}mount(S){this.inlineContentWidget=S}layout(){var S,A;(S=this.inlineContentWidget)===null||S===void 0||S.setOptions({position:this.getPosition()}),(A=this.inlineContentWidget)===null||A===void 0||A.layoutContentWidget()}onReady(S){return S(),l.Disposable.NULL}create(S,A={disposeWhenEditorClosed:!0}){this.selection=S,this.node=this.createNode(),this.node.setPreviewerOptions(A)}attachNode(S){this.node=S}show(S,A){}onLineCount(S){return this}setValue(S){}getValue(){return""}getOriginValue(){return""}onError(S){}onAbort(){}onEnd(){}revealFirstDiff(){}isModel(S){return this.model.uri.toString()===S}};t.BaseInlineDiffPreviewer=f,r.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),r.__metadata("design:type",o.Injector)],f.prototype,"injector",void 0),t.BaseInlineDiffPreviewer=f=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__metadata("design:paramtypes",[Object])],f);let a=n=class extends f{createNode(){const S=this.injector.get(v.InlineDiffWidget,[n.AI_DIFF_WIDGET_ID,{editor:this.monacoEditor,selection:this.selection}]);return S.create(),this.addDispose(S),S}mount(S){super.mount(S),S.addDispose(this)}getPosition(){return p.Position.lift({lineNumber:this.selection.endLineNumber+1,column:1})}layout(){var S;(S=this.inlineContentWidget)===null||S===void 0||S.setPositionPreference([E.ContentWidgetPositionPreference.BELOW]),super.layout()}onReady(S){return this.node?this.node.onReady(S.bind(this)):l.Disposable.NULL}show(S,A){var T;(T=this.node)===null||T===void 0||T.showByLine(S,A)}setValue(S){var A;const T=(A=this.node)===null||A===void 0?void 0:A.getModifiedModel();T?.setValue(this.formatIndentation(S))}getValue(){var S;return((S=this.node)===null||S===void 0?void 0:S.getModifiedModel()).getValue()}getOriginValue(){var S;return((S=this.node)===null||S===void 0?void 0:S.getOriginModel()).getValue()||""}handleAction(S){if(S===u.EResultKind.ACCEPT){const A=this.getValue();this.model.pushEditOperations(null,[{range:this.selection,text:A}],()=>null),this.model.pushStackElement()}}onLineCount(S){var A;return(A=this.node)===null||A===void 0||A.onMaxLineCount(S.bind(this)),this}onData(S){var A,T;const{message:w}=S,D=this.formatIndentation(w),I=(A=this.node)===null||A===void 0?void 0:A.getModifiedModel(),O=I.getEOL()===`\r
28350
- `?s.DefaultEndOfLine.CRLF:s.DefaultEndOfLine.LF,{textBuffer:P,disposable:R}=(0,g.createTextBuffer)(D,O),M=c.ModelService._computeEdits(I,P);I.pushEditOperations([],M,()=>[]),R.dispose(),(T=this.node)===null||T===void 0||T.layout()}onError(S){var A;(A=this.node)===null||A===void 0||A.layout()}onAbort(){var S;(S=this.node)===null||S===void 0||S.layout()}onEnd(){var S;(S=this.node)===null||S===void 0||S.layout()}};t.SideBySideInlineDiffWidget=a,a.AI_DIFF_WIDGET_ID="AI-DIFF-WIDGET",t.SideBySideInlineDiffWidget=a=n=r.__decorate([(0,o.Injectable)({multiple:!0})],a);let b=class extends f{listenNode(S){S.addDispose(S.onDidEditChange(()=>this.layout())),S.addDispose(S.onPartialEditWidgetListChange(T=>{var w;T.every(D=>D.isHidden)&&(this.dispose(),(w=this.inlineContentWidget)===null||w===void 0||w.dispose())}));const A=S.onDispose(()=>{this.dispose(),A.dispose()});this.addDispose(S)}createNode(){const S=this.injector.get(d.InlineStreamDiffHandler,[this.monacoEditor]);return S.initialize(this.selection),this.listenNode(S),S}attachNode(S){var A;if((A=this.node)===null||A===void 0||A.dispose(),this.node=S,S){const T=S.currentSnapshotStore;T&&(this.node.restoreDecorationSnapshot(T.decorationSnapshotData),this.listenNode(S))}}createNodeSnapshot(){if(!this.node)return this.createNode();const S=this.node.createSnapshot(),A=this.injector.get(d.InlineStreamDiffHandler,[this.monacoEditor]);return A.restoreSnapshot(S),A}getPosition(){var S;const A=(S=this.node)===null||S===void 0?void 0:S.getZone();return A?p.Position.lift({lineNumber:A.startLineNumber,column:1}):p.Position.lift({lineNumber:1,column:1})}handleAction(S){var A,T;switch(S){case u.EResultKind.ACCEPT:(A=this.node)===null||A===void 0||A.acceptAll();break;case u.EResultKind.DISCARD:case u.EResultKind.REGENERATE:(T=this.node)===null||T===void 0||T.rejectAll();break;default:break}}onLineCount(){return l.Disposable.NULL}layout(){var S,A,T;(S=this.inlineContentWidget)===null||S===void 0||S.setPositionPreference([E.ContentWidgetPositionPreference.ABOVE,E.ContentWidgetPositionPreference.BELOW]),super.layout();const w=this.getPosition();if(w&&this.inlineContentWidget){const D=(A=this.node)===null||A===void 0?void 0:A.livePreviewDiffDecorationModel.getRemovedWidgets();if(D?.length){const I=w.lineNumber,O=D[0];if(O)if(((T=O.getLastPosition())===null||T===void 0?void 0:T.lineNumber)<=I){const R=this.inlineContentWidget.getLineHeight(),M=O.height+1;this.inlineContentWidget.setOffsetTop(-R*M-4)}else this.inlineContentWidget.setOffsetTop(0)}else this.inlineContentWidget.setOffsetTop(0)}}onData(S){var A;const{message:T}=S;(A=this.node)===null||A===void 0||A.addLinesToDiff(this.formatIndentation(T))}onAbort(){var S,A;const T=(S=this.node)===null||S===void 0?void 0:S.recompute(d.EComputerMode.default);T&&(T.activeLine=0,T.pendingRange=new _.LineRange(0,0),(A=this.node)===null||A===void 0||A.finallyRender(T))}onEnd(){var S,A;const T=(S=this.node)===null||S===void 0?void 0:S.recompute(d.EComputerMode.legacy);T&&((A=this.node)===null||A===void 0||A.pushRateFinallyDiffStack(T))}getValue(){var S;return((S=this.node)===null||S===void 0?void 0:S.getVirtualModelValue())||""}getOriginValue(){var S;return((S=this.node)===null||S===void 0?void 0:S.getOriginModelValue())||""}setValue(S){var A,T;const w=(A=this.node)===null||A===void 0?void 0:A.recompute(d.EComputerMode.legacy,this.formatIndentation(S));w&&((T=this.node)===null||T===void 0||T.finallyRender(w))}revealFirstDiff(){var S;(S=this.node)===null||S===void 0||S.revealFirstDiff()}};t.LiveInlineDiffPreviewer=b,t.LiveInlineDiffPreviewer=b=r.__decorate([(0,o.Injectable)({multiple:!0})],b)},37679:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffWidget=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(43144),l=n.__importDefault(e(25873)),p=e(76003),E=e(41869),m=n.__importStar(e(20868)),_=e(87822),s=e(34819),g=e(90626),c=n.__importDefault(e(69790)),h={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},u=r.default.memo(v=>{const{range:f,onMaxLineCount:a,editor:b,onReady:y}=v,S=(0,E.useInjectable)(E.MonacoService),A=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!f)return;const T=b.getModel();if(!T)return;const w=T.getValueInRange(f),D=S.createDiffEditor(A.current,{...h,lineDecorationsWidth:b.getLayoutInfo().decorationsWidth,lineNumbersMinChars:b.getOption(m.editor.EditorOption.lineNumbersMinChars)}),I=g.StandaloneServices.get(_.IModelService),O={languageId:T.getLanguageId(),onDidChange:E.Event.None},P=I.createModel(w,O,m.Uri.from({scheme:E.Schemes.inMemory,path:"inline-diff-widget/"+(0,E.randomString)(8)}),!0),R=I.createModel("",O,m.Uri.from({scheme:E.Schemes.inMemory,path:"inline-diff-widget/"+(0,E.randomString)(8)}),!0);D.setModel({original:P,modified:R}),D.revealLine(f.startLineNumber,m.editor.ScrollType.Immediate);const M=()=>{if(a){const k=P.getLineCount(),B=R.getLineCount();a(Math.max(k,B)+1)}};return y&&y({getModifiedModel:()=>R,getOriginModel:()=>P,layout:M}),M(),()=>{D&&D.dispose()}},[f,b]),r.default.createElement("div",{ref:A,className:c.default.diff_editor_widget})});let d=class extends s.ZoneWidget{setPreviewerOptions(f){this.previewerOptions=f}_fillContainer(f){this.setCssClass("inline-diff-widget"),this.root=l.default.createRoot(f);let a=null;if(this._resolveResultWidget)if(f.parentNode){const b=document.createElement("div");requestAnimationFrame(()=>{b.className=c.default.ai_diff_editor_resolve_result_widget;const y=this.editor.getLayoutInfo();b.style.width=`${y.contentWidth}px`,b.style.left=`${y.contentLeft}px`}),f.parentNode.appendChild(b),a=(0,o.createPortal)(this._resolveResultWidget,b),this.resultContainer=b}else throw new Error("[impossible path] container.parentNode is null");this.root.render(r.default.createElement(E.ConfigProvider,{value:this.configContext},r.default.createElement("div",{className:c.default.ai_diff_editor_container},r.default.createElement(u,{range:this.range,editor:this.editor,onMaxLineCount:b=>{b&&(this._relayout(b),this._onMaxLineCount.fire(b))},onReady:b=>{this.diffWidgetHandler=b,this._onReady.fire()}})),a))}computeResultWidgetWidth(){const f=this.editor.getLayoutInfo();return f.contentWidth+f.contentLeft}_onWidth(f){super._onWidth(f),requestAnimationFrame(()=>{this.resultContainer&&(this.resultContainer.style.width=`${this.computeResultWidgetWidth()}px`)})}getModifiedModel(){var f;return(f=this.diffWidgetHandler)===null||f===void 0?void 0:f.getModifiedModel()}getOriginModel(){var f;return(f=this.diffWidgetHandler)===null||f===void 0?void 0:f.getOriginModel()}layout(){var f;return(f=this.diffWidgetHandler)===null||f===void 0?void 0:f.layout()}constructor(f,a){super(a.editor,{showArrow:!1,showFrame:!1,arrowColor:void 0,frameColor:void 0,keepEditorSelection:!0,showInHiddenAreas:!0}),this.id=f,this._onMaxLineCount=new E.Emitter,this.onMaxLineCount=this._onMaxLineCount.event,this._onReady=new E.Emitter,this.onReady=this._onReady.event,this.diffWidgetHandler=null,this.resultContainer=null,this._resolveResultWidget=null;const{selection:b,hiddenArea:y,editor:S}=a;this.range=b,this.hiddenArea=y||b,S.setHiddenAreas([this.hiddenArea],this.id)}revealRange(f,a){}setContainerStyle(f){var a;const b=Object.keys(f);for(const y of b)Object.prototype.hasOwnProperty.call((a=this.container)===null||a===void 0?void 0:a.style,y)&&(this.container.style[y]=f[y])}addClassName(f){return this.setCssClass(f),this}dispose(){this.hide(),super.dispose()}hide(){this.editor.setHiddenAreas([],this.id),super.hide(),this.root&&this.root.unmount()}showByLine(f,a=20){this.editor._modelData.viewModel.coordinatesConverter.modelPositionIsVisible=()=>!0,super.show({startLineNumber:f,startColumn:1,endLineNumber:f,endColumn:Number.MAX_SAFE_INTEGER},a)}setResolveResultWidget(f){this._resolveResultWidget=f}};t.InlineDiffWidget=d,n.__decorate([(0,p.Autowired)(E.AppConfig),n.__metadata("design:type",Object)],d.prototype,"configContext",void 0),t.InlineDiffWidget=d=n.__decorate([(0,p.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String,Object])],d)},38890:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffController=void 0;const n=e(41869),r=e(43718),o=e(57517),l=e(99906),p=e(83854),E=e(40111),m=e(49444);class _ extends l.BaseAIMonacoEditorController{constructor(){super(...arguments),this._onMaxLineCount=new r.Emitter,this.onMaxLineCount=this._onMaxLineCount.event,this._previewerNodeStore=new Map}static get(g){return g.getContribution(_.ID)}get preferenceService(){return this.injector.get(n.PreferenceService)}get eventBus(){return this.injector.get(r.IEventBus)}mount(){return this.featureDisposable.addDispose(this.eventBus.on(o.EditorGroupCloseEvent,g=>{const c=g.payload.resource.uri.toString(),h=this.getStoredState(c);h&&h.previewerOptions.disposeWhenEditorClosed&&this.destroyPreviewer(c)})),this.registerInlineDiffFeature(this.monacoEditor),this.featureDisposable}storeState(g){if(!this.previewer)return;const c=this.previewer.createNodeSnapshot();c&&this._previewerNodeStore.set(g,c)}tryRestoreState(g,c){const h=this.getStoredState(c);if(h){if(h.disposed){this.destroyPreviewer(c);return}return this.restoreState(g,h)}}restoreState(g,c){var h;if((h=g.getModel())===null||h===void 0?void 0:h.uri){this.previewer=this.injector.get(m.LiveInlineDiffPreviewer,[g]),this.previewer.attachNode(c),this.listenPreviewer(this.previewer);const d=this.previewer.onDispose(()=>{this.destroyPreviewer(),d.dispose()})}}registerInlineDiffFeature(g){const c=g.getModel();this.featureDisposable.addDispose(g.onWillChangeModel(h=>{if(!h.oldModelUrl)return;const u=h.oldModelUrl.toString();this.storeState(u),this.destroyPreviewer()})),this.featureDisposable.addDispose(g.onDidChangeModel(h=>{h.newModelUrl&&this.tryRestoreState(g,h.newModelUrl.toString())})),c&&this.featureDisposable.addDispose(c.onWillDispose(()=>{const h=c.uri.toString();this.destroyPreviewer(h)}))}showPreviewerByStream(g,c){const{crossSelection:h,chatResponse:u}=c,d=new r.Disposable,v=this.createDiffPreviewer(g,h,c.previewerOptions),f=()=>{v.layout(),d.dispose()};return d.addDispose(v.onReady(()=>{if(E.InlineChatController.is(u)){const a=u;d.addDispose([a.onData(b=>{r.ReplyResponse.is(b)&&v.onData(b)}),a.onError(b=>{v.onError(b),f()}),a.onAbort(()=>{v.onAbort(),f()}),a.onEnd(()=>{v.onEnd(),f()})]),a.listen()}else v.setValue(u.message),f()})),v.layout(),v}createDiffPreviewer(g,c,h){const u=this.preferenceService.getValid(r.AINativeSettingSectionsId.InlineDiffPreviewMode,p.EInlineDiffPreviewMode.inlineLive);return this.destroyPreviewer(),u===p.EInlineDiffPreviewMode.sideBySide?this.previewer=this.injector.get(m.SideBySideInlineDiffWidget,[g]):this.previewer=this.injector.get(m.LiveInlineDiffPreviewer,[g]),this.previewer.create(c,h),this.previewer.show(c.startLineNumber-1,c.endLineNumber-c.startLineNumber+2),this.listenPreviewer(this.previewer),this.previewer}listenPreviewer(g){g&&g.addDispose(g.onLineCount(c=>this._onMaxLineCount.fire(c)))}getPreviewer(){return this.previewer}getStoredState(g){return this._previewerNodeStore.get(g)}handleAction(g){var c;(c=this.previewer)===null||c===void 0||c.handleAction(g)}getModifyContent(){var g;return(g=this.previewer)===null||g===void 0?void 0:g.getValue()}getOriginContent(){var g;return(g=this.previewer)===null||g===void 0?void 0:g.getOriginValue()}destroyPreviewer(g){var c;(c=this.previewer)===null||c===void 0||c.dispose(),this.previewer=void 0,g&&this._previewerNodeStore.delete(g)}revealFirstDiff(){var g;(g=this.previewer)===null||g===void 0||g.revealFirstDiff()}}t.InlineDiffController=_,_.ID="editor.contrib.ai.inline.diff"},51347:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffService=void 0;const n=e(85608),r=e(76003),o=e(70392);let l=class{constructor(){this._partialEventEmitter=new o.Emitter,this.onPartialEdit=this._partialEventEmitter.event}firePartialEdit(E){this._partialEventEmitter.fire(E)}};t.InlineDiffService=l,t.InlineDiffService=l=n.__decorate([(0,r.Injectable)()],l)},53182:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineHintLineDecoration=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(57925),p=e(43718),E=e(20868),m=e(60304),_=e(52416),s=e(75189),g="inline_hint_description",c="inline_hint_description_key";let h=class extends p.Disposable{constructor(d){super(),this.monacoEditor=d,this.colorRegister=(0,_.getColorRegistry)(),m.StandaloneServices.get(s.ICodeEditorService).registerDecorationType(g,c,{isWholeLine:!0}),this.addDispose(p.Disposable.create(()=>{this.monacoEditor.setDecorationsByType(g,c,[])}))}getSequenceKeyString(d="+"){var v;const a=(v=this.keybindingRegistry.getKeybindingsForCommand(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||v===void 0?void 0:v.resolved;return a?this.keybindingRegistry.acceleratorForSequence(a,d):""}async show(d){var v;const f=(0,p.formatLocalize)("aiNative.inline.hint.widget.placeholder",this.getSequenceKeyString("")),a=await this.themeService.getCurrentTheme(),b=this.colorRegister.resolveDefaultColor(_.inputPlaceholderForeground,a);this.monacoEditor.setDecorationsByType(g,c,[{range:E.Range.fromPositions(d),renderOptions:{after:{contentText:f,opacity:"0.5",color:(v=b?.toString())!==null&&v!==void 0?v:"",padding:"0 0 0 12px",width:"max-content",fontFamily:"-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,sans-serif"}}}])}};t.InlineHintLineDecoration=h,n.__decorate([(0,r.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],h.prototype,"keybindingRegistry",void 0),n.__decorate([(0,r.Autowired)(_.IThemeService),n.__metadata("design:type",Object)],h.prototype,"themeService",void 0),t.InlineHintLineDecoration=h=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],h)},77886:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineHintController=void 0;const n=e(85608),r=n.__importDefault(e(97331)),o=e(43718),l=n.__importStar(e(20868)),p=e(77659),E=e(99906),m=e(71863),_=e(19520),s=e(53182);class g extends E.BaseAIMonacoEditorController{static get(h){return h.getContribution(g.ID)}get inlineCompletionsService(){return this.injector.get(m.AICompletionsService)}mount(){return this.registerHintLineFeature(this.monacoEditor)}registerHintLineFeature(h){const u=new o.Disposable,d=this.injector.get(p.AINativeContextKey,[h.contextKeyService]),v=()=>{u.dispose()},f=b=>{var y;const S=h.getModel();if(!S||this.inlineCompletionsService.isVisibleCompletion)return;if(!S.getLineDecorations(b.lineNumber).some(w=>w.options.description===_.InlineInputPreviewDecorationID)){const w=this.injector.get(s.InlineHintLineDecoration,[h]),D=(y=h.getModel())===null||y===void 0?void 0:y.getLineContent(b.lineNumber);D?.trim()||w.show(b),d.inlineHintWidgetIsVisible.set(!0),u.addDispose(w.onDispose(()=>{d.inlineHintWidgetIsVisible.set(!1)})),u.addDispose(w)}},a=(0,r.default)(async b=>{v(),f(b)},100);return this.featureDisposable.addDispose(h.onDidChangeCursorPosition(b=>{a(b.position)})),this.featureDisposable.addDispose(h.onDidChangeModelContent(b=>{var y,S;a(new l.Position((y=b.changes[0])===null||y===void 0?void 0:y.range.endLineNumber,(S=b.changes[0])===null||S===void 0?void 0:S.range.endColumn))})),this.featureDisposable.addDispose(h.onDidFocusEditorWidget(()=>{const b=h.getPosition();b&&(v(),f(b))})),this.featureDisposable.addDispose(h.onDidBlurEditorWidget(()=>{v()})),this.featureDisposable.addDispose(this.inlineCompletionsService.onVisibleCompletion(b=>{b&&v()})),this.featureDisposable.addDispose(u),this.featureDisposable}}t.InlineHintController=g,g.ID="editor.contrib.ai.inline.hint"},32213:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputWidget=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(76003),l=e(41869),p=e(89195),E=e(43718),m=e(90052),_=e(90614),s=e(31031),g=e(26664),c=n.__importDefault(e(13185)),h=d=>{const{defaultValue:v,onClose:f,onInteractiveInputSend:a,onLayoutChange:b,onChatStatus:y,onResultClick:S,onValueChange:A}=d,[T,w]=(0,r.useState)(s.EInlineChatStatus.READY),D=(0,l.useInjectable)(l.AINativeConfigService);(0,r.useEffect)(()=>{const k=new E.Disposable;return k.addDispose(y(B=>w(B))),()=>{k.dispose()}},[y]);const I=(0,r.useMemo)(()=>T===s.EInlineChatStatus.THINKING,[T]),O=(0,r.useMemo)(()=>T===s.EInlineChatStatus.DONE,[T]),P=(0,r.useMemo)(()=>T===s.EInlineChatStatus.ERROR,[T]),R=(0,r.useCallback)(()=>{f?.()},[f]),M=(0,r.useCallback)(k=>{a?.(k)},[a]);return P?null:O?r.default.createElement(_.InlineResultAction,{onResultClick:S}):r.default.createElement(p.AIAction,{loadingShowOperation:!0,onClose:R,loading:I,customOperationRender:r.default.createElement(p.InteractiveInput,{autoFocus:!0,defaultValue:v,onValueChange:A,onHeightChange:k=>b(k),size:"small",placeholder:(0,E.localize)("aiNative.inline.chat.input.placeholder.default"),width:D.inlineChat.inputWidth,disabled:I,onSend:M})})};let u=class extends g.AIInlineContentWidget{constructor(v,f){super(v),this.editor=v,this.defaultValue=f,this.allowEditorOverflow=!0,this.positionPreference=[m.ContentWidgetPositionPreference.ABOVE],this._onSend=new E.Emitter,this.onSend=this._onSend.event,this._onClose=new E.Emitter,this.onClose=this._onClose.event,this._onValueChange=new E.Emitter,this.onValueChange=this._onValueChange.event}dispose(){super.dispose(),this.inlineInputService.hide()}id(){return E.AIInlineInputChatContentWidgetId}renderView(){return r.default.createElement("div",{className:c.default.input_wrapper},r.default.createElement(h,{defaultValue:this.defaultValue,onClose:()=>this._onClose.fire(),onChatStatus:this.onStatusChange.bind(this),onLayoutChange:()=>{this.editor.layoutContentWidget(this)},onValueChange:v=>{this._onValueChange.fire(v)},onInteractiveInputSend:v=>{this.launchChatStatus(s.EInlineChatStatus.THINKING),this._onSend.fire(v)},onResultClick:v=>{this._onResultClick.fire(v)}}))}};t.InlineInputWidget=u,t.InlineInputWidget=u=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object,String])],u)},89060:(L,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputController=void 0;const r=e(85608),o=e(76003),l=e(43718),p=e(57517),E=r.__importStar(e(20868)),m=e(28423),_=e(75124),s=e(2261),g=e(52451),c=e(74547),h=e(77659),u=e(99906),d=e(77633),v=e(40111),f=e(31031),a=e(15989),b=e(19520),y=e(32213),S=r.__importDefault(e(13185)),A=e(74353),T=e(86443);let w=n=class extends u.BaseAIMonacoEditorController{static get(I){return I.getContribution(n.ID)}get inlineInputService(){return this.injector.get(A.InlineInputService)}get aiReporter(){return this.injector.get(l.IAIReporter)}get eventBus(){return this.injector.get(l.IEventBus)}get messageService(){return this.injector.get(_.MessageService)}mount(){return this.inputDisposable=new l.Disposable,this.aiNativeContextKey=this.injector.get(h.AINativeContextKey,[this.monacoEditor.contextKeyService]),this.inlineDiffController=a.InlineDiffController.get(this.monacoEditor),this.inputValue=(0,m.observableValue)(this,""),this.modelChangeObs=(0,m.observableFromEvent)(this,this.monacoEditor.onDidChangeModel,()=>this.monacoEditor.getModel()),this.inlineInputWidgetStore=new Map,this.featureDisposable.addDispose(this.eventBus.on(p.EditorGroupCloseEvent,I=>{var O;if(!this.aiNativeContextKey.inlineInputWidgetIsStreaming.get())return;const R=I.payload.resource.uri.toString(),M=(O=this.monacoEditor.getModel())===null||O===void 0?void 0:O.uri.toString();if(M===R){this.inlineDiffController.destroyPreviewer(M),this.hideInput();const k=(0,l.localize)("aiNative.inline.chat.generating.canceled");k&&this.messageService.info(k)}})),this.featureDisposable.addDispose(this.inlineInputService.onHidden(()=>{this.hideInput()})),this.featureDisposable.addDispose(this.inlineInputService.onInteractiveInputVisibleInPosition(async I=>{I?this.showInputInEmptyLine(I,this.monacoEditor):setTimeout(()=>this.monacoEditor.focus(),0)})),this.featureDisposable.addDispose(this.inlineInputService.onInteractiveInputVisibleInSelection(I=>{I&&this.showInputInSelection(I,this.monacoEditor)})),this.featureDisposable.addDispose((0,m.autorun)(I=>{const O=this.modelChangeObs.read(I);if(!O)return;const P=this.inlineInputWidgetStore.get(O.id);if(!P){this.hideInput();return}P instanceof T.InlineInputWidgetStoreInEmptyLine?this.showInputInEmptyLine(P.getPosition(),this.monacoEditor,P.getValue()):P instanceof T.InlineInputWidgetStoreInSelection&&this.showInputInSelection(P.getSelection(),this.monacoEditor,P.getValue())})),this.featureDisposable.addDispose(this.inputDisposable),this.featureDisposable}cancelToken(){super.cancelToken(),this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1)}hideInput(){this.inlineInputWidgetStore.delete(this.monacoEditor.getModel().id),this.inputDisposable.dispose()}async showInputInEmptyLine(I,O,P){const R=O.getModel();if(!R)return;const M=O.getSelection();if(M&&!M.isEmpty())return;this.inputValue.set(P||"",void 0),this.inlineInputWidgetStore.set(R.id,new T.InlineInputWidgetStoreInEmptyLine(I,P)),this.inputDisposable&&(this.inputDisposable.dispose(),this.inputDisposable=new l.Disposable);const k=O.createDecorationsCollection(),B=this.injector.get(y.InlineInputWidget,[O,this.inputValue.get()]);k.append([{range:E.Range.fromPositions(I),options:c.ModelDecorationOptions.register({description:b.InlineInputPreviewDecorationID,isWholeLine:!0,className:S.default.input_decoration_readable_container,inlineClassName:S.default.inline_chat_inserted_range})}]);const x=k.getRange(0);let N;x&&(N=g.LineRange.fromRange(x),B.show({position:x.getStartPosition()}),this.aiNativeContextKey.inlineInputWidgetIsVisible.set(!0)),this.inputDisposable.addDispose(B.onDispose(()=>{this.cancelToken(),k.clear(),this.aiNativeContextKey.inlineInputWidgetIsVisible.set(!1)})),this.inputDisposable.addDispose(B.onValueChange(j=>{this.inputValue.set(j,void 0);const K=this.inlineInputWidgetStore.get(R.id);K instanceof T.InlineInputWidgetStoreInEmptyLine&&K.setValue(j)})),this.inputDisposable.addDispose(B.onResultClick(async j=>{const K=()=>{const U=k.getRange(0);R.pushStackElement(),R.pushEditOperations(null,[s.EditOperation.delete(U)],()=>null),R.pushStackElement()};switch(j){case f.EResultKind.ACCEPT:this.hideInput();break;case f.EResultKind.DISCARD:K(),this.hideInput();break;case f.EResultKind.REGENERATE:K(),requestAnimationFrame(()=>{const G=k.getRange(0).getStartPosition();this.showInputInEmptyLine(G,O,this.inputValue.get())});break;default:break}})),this.inputDisposable.addDispose(l.Event.debounce(k.onDidChange.bind(k),()=>{},l.FRAME_THREE)(()=>{if(!k.getRange(0))return;const j=k.getRange(0),K=g.LineRange.fromRange(j);N.equals(K)||(B.setOptions({position:j.getStartPosition()}),B.layoutContentWidget()),N=K})),this.inputDisposable.addDispose(B.onClose(()=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.get()?this.cancelToken():this.hideInput()})),this.inputDisposable.addDispose(B.onSend(async j=>{O.focus();const K=this.inlineInputService.getInteractiveInputHandler(),U=O.getModel();if(!K||!U)return;B.launchChatStatus(f.EInlineChatStatus.THINKING);const G=await this.inlineInputService.getInteractiveInputStrategyHandler()(O,j),z=E.Selection.fromPositions(I);if(G===d.ERunStrategy.EXECUTE&&K.execute){K.execute(O,z,j,this.token),B.launchChatStatus(f.EInlineChatStatus.DONE),this.hideInput();return}if(G===d.ERunStrategy.PREVIEW&&K.providePreviewStrategy){const $=await K.providePreviewStrategy(O,z,j,this.token);if(l.CancelResponse.is($)){B.launchChatStatus(f.EInlineChatStatus.READY),this.hideInput();return}if(v.InlineChatController.is($)){const Q=$;let Z;const X=this.registerDispose(new l.RunOnceScheduler(()=>{const V=k.getRange(0);V&&Z&&U.pushEditOperations(null,[s.EditOperation.replace(V,Z)],()=>null)},l.FRAME_FIVE));this.inputDisposable.addDispose([Q.onData(async V=>{l.ReplyResponse.is(V)&&(this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!0),Z=V.message,X.isScheduled()||X.schedule())}),Q.onError(V=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),B.launchChatStatus(f.EInlineChatStatus.READY)}),Q.onAbort(()=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),U.pushStackElement(),B.launchChatStatus(f.EInlineChatStatus.DONE)}),Q.onEnd(()=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),U.pushStackElement(),B.launchChatStatus(f.EInlineChatStatus.DONE)})]),Q.listen()}}})),this.inputDisposable.addDispose(B)}async showInputInSelection(I,O,P){var R;this.inputDisposable&&(this.inputDisposable.dispose(),this.inputDisposable=new l.Disposable);const M=O.getModel();if(!M)return;const k=O.createDecorationsCollection();k.set([{range:E.Range.fromPositions({lineNumber:I.startLineNumber,column:1},{lineNumber:I.endLineNumber,column:O.getModel().getLineMaxColumn(I.endLineNumber)}),options:c.ModelDecorationOptions.register({description:b.InlineInputPreviewDecorationID,isWholeLine:!0,className:S.default.input_decoration_pending_container})}]);const B=E.Selection.fromRange(k.getRange(0),I.getDirection());this.inputValue.set(P||"",void 0),this.inlineInputWidgetStore.set(M.id,new T.InlineInputWidgetStoreInSelection(B,P));const x=this.injector.get(y.InlineInputWidget,[O,this.inputValue.get()]);x.show({selection:B}),this.aiNativeContextKey.inlineInputWidgetIsVisible.set(!0),this.inlineDiffController.destroyPreviewer((R=O.getModel())===null||R===void 0?void 0:R.uri.toString()),this.inputDisposable.addDispose(x.onDispose(()=>{this.cancelToken(),k.clear(),this.aiNativeContextKey.inlineInputWidgetIsVisible.set(!1)})),this.inputDisposable.addDispose(x.onValueChange(N=>{this.inputValue.set(N,void 0);const j=this.inlineInputWidgetStore.get(M.id);j instanceof T.InlineInputWidgetStoreInSelection&&j.setValue(N)})),this.inputDisposable.addDispose(x.onClose(()=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.get()?this.cancelToken():this.hideInput()})),this.inputDisposable.addDispose(x.onSend(async N=>{O.focus();const j=this.inlineInputService.getInteractiveInputHandler();if(!j)return;if(x.launchChatStatus(f.EInlineChatStatus.THINKING),await this.inlineInputService.getInteractiveInputStrategyHandler()(O,N)===d.ERunStrategy.PREVIEW&&j.providePreviewStrategy){const U=await j.providePreviewStrategy(O,B,N,this.token);if(l.CancelResponse.is(U)){k.clear(),this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),x.launchChatStatus(f.EInlineChatStatus.DONE);return}if(v.InlineChatController.is(U)){const G=U;this.inputDisposable.addDispose([G.onData($=>{k.clear(),l.ReplyResponse.is($)&&this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!0)}),G.onError($=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),x.launchChatStatus(f.EInlineChatStatus.READY)}),G.onAbort(()=>{k.clear(),this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),x.launchChatStatus(f.EInlineChatStatus.DONE)}),G.onEnd(()=>{k.clear(),this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),x.launchChatStatus(f.EInlineChatStatus.DONE)})]),G.listen(),this.inlineDiffController.showPreviewerByStream(O,{crossSelection:B,chatResponse:G}).mount(x)}}else k.clear(),x.launchChatStatus(f.EInlineChatStatus.READY),this.hideInput()})),this.inputDisposable.addDispose(x.onResultClick(N=>{this.inlineDiffController.handleAction(N),this.hideInput(),N===f.EResultKind.REGENERATE&&requestAnimationFrame(()=>{this.showInputInSelection(B,O,this.inputValue.get())})})),this.inputDisposable.addDispose(x)}};t.InlineInputController=w,w.ID="editor.contrib.ai.inline.input",t.InlineInputController=w=n=r.__decorate([(0,o.Injectable)()],w)},74353:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputService=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(57925),p=e(43718),E=e(20868),m=e(85679),_=e(77633),s=e(86443);let g=class extends p.Disposable{constructor(){super(...arguments),this.interactiveInputModel=new s.InteractiveInputModel,this._onInteractiveInputVisibleInPosition=new p.Emitter,this.onInteractiveInputVisibleInPosition=this._onInteractiveInputVisibleInPosition.event,this._onInteractiveInputVisibleInSelection=new p.Emitter,this.onInteractiveInputVisibleInSelection=this._onInteractiveInputVisibleInSelection.event,this._onHidden=new p.Emitter,this.onHidden=this._onHidden.event}visibleByPosition(h){this._onInteractiveInputVisibleInPosition.fire(h)}visibleBySelection(h){this._onInteractiveInputVisibleInSelection.fire(h)}async visibleByNearestCodeBlock(h,u){const d=await this.findNearestCodeBlockWithPosition(h,u);d&&this.visibleBySelection(d)}hide(){this._onHidden.fire()}getInteractiveInputHandler(){return this.interactiveInputModel.handler()}getInteractiveInputStrategyHandler(){return this.interactiveInputModel.strategyHandler()}async findNearestCodeBlockWithPosition(h,u){const d=u.getModel(),v=d?.getOffsetAt(h),f=d?.getLanguageId(),a=this.languageParserService.createParser(f),b=await a?.findNearestCodeBlockWithPosition(d?.getValue()||"",v);if(b)return new E.Selection(b.range.start.line+1,b.range.start.character,b.range.end.line+1,b.range.end.character)}getSequenceKeyString(){var h;const d=(h=this.keybindingRegistry.getKeybindingsForCommand(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||h===void 0?void 0:h.resolved;return d?this.keybindingRegistry.acceleratorForSequence(d,"+"):""}registerInlineInput(h,u){return this.interactiveInputModel.setHandler(u),h.handleStrategy?this.interactiveInputModel.setStrategyHandler(h.handleStrategy):this.interactiveInputModel.setStrategyHandler(()=>h.strategy||_.ERunStrategy.EXECUTE),this.interactiveInputModel}};t.InlineInputService=g,n.__decorate([(0,r.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],g.prototype,"keybindingRegistry",void 0),n.__decorate([(0,r.Autowired)(m.LanguageParserService),n.__metadata("design:type",m.LanguageParserService)],g.prototype,"languageParserService",void 0),t.InlineInputService=g=n.__decorate([(0,r.Injectable)()],g)},86443:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputWidgetStoreInSelection=t.InlineInputWidgetStoreInEmptyLine=t.InteractiveInputModel=void 0;const n=e(89195),r=e(43718);class o{setHandler(m){this._handler=m}handler(){return this._handler}setStrategyHandler(m){this._strategyHandler=m}strategyHandler(){return this._strategyHandler}dispose(){this._handler=void 0}}t.InteractiveInputModel=o,o.ID=`${n.InteractiveInput.displayName}:${(0,r.uuid)(4)}`;class l{constructor(m,_){this.position=m,this.value=_}getPosition(){return this.position}setPosition(m){this.position=m}getValue(){return this.value}setValue(m){this.value=m}}t.InlineInputWidgetStoreInEmptyLine=l;class p{constructor(m,_){this.selection=m,this.value=_}getSelection(){return this.selection}setSelection(m){this.selection=m}getValue(){return this.value}setValue(m){this.value=m}}t.InlineInputWidgetStoreInSelection=p},76755:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineStreamDiffComputer=void 0;const n=e(9514),r=e(52451),o=e(37348),l=e(44781),p=e(68450),E=e(56702),m=e(89216),_=e(10438),s=e(30861),g=e(46739),c=(u,d,v=p.InfiniteTimeout.instance)=>{if(!u.length||!d.length)return p.DiffAlgorithmResult.trivial(u,d);const f=new _.Array2D(2*u.length+1,d.length+1),a=new _.Array2D(2*u.length+1,d.length+1);for(let D=0;D<=d.length;D++)f.set(0,D,D),a.set(0,D,D>0);for(let D=0;D<=2*u.length;D++)f.set(D,0,Math.floor((D+1)/2)),a.set(D,0,!1);for(let D=1;D<=d.length;D++)for(let I=1;I<=2*u.length;I++){if(!v.isValid())return p.DiffAlgorithmResult.trivialTimedOut(u,d);if(I%2===0){const O=f.get(I,D-1)+1,P=f.get(I-1,D),R=O<P;f.set(I,D,R?O:P),a.set(I,D,R)}else{const O=f.get(I-1,D)+.4,P=u.getElement(Math.floor(I/2))===d.getElement(D-1)?f.get(I-1,D-1):Number.MAX_VALUE,R=P<O;f.set(I,D,R?P:O),a.set(I,D,R)}}let b=Number.MAX_VALUE,y=-1;for(let D=0;D<=2*u.length;D++){const I=f.get(D,d.length);I<b&&(b=I,y=D)}const S=[];let A=y,T=d.length;A<=2*u.length-2&&S.push(new p.SequenceDiff(new o.OffsetRange(Math.floor((A+1)/2),u.length),new o.OffsetRange(T,T)));let w;for(;A>=0&&T>=0;)a.get(A,T)?(A%2===0?w===void 0&&(w={originalLineIndex:Math.floor(A/2),modifiedLineIndex:T}):(w!==void 0&&((w.originalLineIndex!==Math.floor(A/2)+1||w.modifiedLineIndex!==T)&&S.push(new p.SequenceDiff(new o.OffsetRange(Math.floor(A/2)+1,w.originalLineIndex),new o.OffsetRange(T,w.modifiedLineIndex))),w=void 0),A-=1),T-=1):(w=w||{originalLineIndex:Math.floor((A+1)/2),modifiedLineIndex:T},A-=1);return w!==void 0&&((w.originalLineIndex!==Math.floor(A/2)+1||w.modifiedLineIndex!==T)&&S.push(new p.SequenceDiff(new o.OffsetRange(Math.floor(A/2)+1,w.originalLineIndex),new o.OffsetRange(T,w.modifiedLineIndex))),w=void 0),S.reverse(),new p.DiffAlgorithmResult(S,!1)};class h extends E.DefaultLinesDiffComputer{computeDiff(d,v,f){if(d.length<=1&&(0,n.equals)(d,v,(M,k)=>M===k))return new s.LinesDiff([],[],!1);if(d.length===1&&d[0].length===0||v.length===1&&v[0].length===0)return new s.LinesDiff([new g.DetailedLineRangeMapping(new r.LineRange(1,d.length+1),new r.LineRange(1,v.length+1),[new g.RangeMapping(new l.Range(1,1,d.length,d[d.length-1].length+1),new l.Range(1,1,v.length,v[v.length-1].length+1))])],[],!1);const a=f.maxComputationTimeMs===0?p.InfiniteTimeout.instance:new p.DateTimeout(f.maxComputationTimeMs),b=new Map;function y(M){let k=b.get(M);return k===void 0&&(k=b.size,b.set(M,k)),k}const S=d.length*v.length<1e6&&f.onlyCareAboutPrefixOfOriginalLines,A=d.map(M=>y(S?M:M.trim())),T=v.map(M=>y(S?M:M.trim())),w=new m.LineSequence(A,d),D=new m.LineSequence(T,v),I=d.every(M=>M.trim().length===0);let O;S?I?O=p.DiffAlgorithmResult.trivial(w,D):O=c(w,D,a):w.length+D.length<1700?O=this.dynamicProgrammingDiffing.compute(w,D,a,(M,k)=>d[M]===v[k]?v[k].length===0?.1:1+Math.log(1+v[k].length):.99):O=this.myersDiffingAlgorithm.compute(w,D,a);const P=O.diffs,R=O.hitTimeout;if(S){const M=P.map(k=>new g.DetailedLineRangeMapping(new r.LineRange(k.seq1Range.start+1,k.seq1Range.endExclusive+1),new r.LineRange(k.seq2Range.start+1,k.seq2Range.endExclusive+1),[]));return new s.LinesDiff(M,[],R)}return super.computeDiff(d,v,f)}}t.InlineStreamDiffComputer=h},33062:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineStreamDiffHandler=t.EComputerMode=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(20868),p=e(60304),E=e(52451),m=e(84968),_=e(46739),s=e(87822),g=e(25539),c=e(76755),h=e(80715);var u;(function(f){f.legacy="legacy",f.default="default"})(u||(t.EComputerMode=u={}));const d=new c.InlineStreamDiffComputer;let v=class extends o.Disposable{constructor(a){super(),this.monacoEditor=a,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 g.UndoRedoGroup;const b=p.StandaloneServices.get(s.IModelService);this.virtualModel=b.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(h.LivePreviewDiffDecorationModel,[this.monacoEditor]),this.addDispose(this.livePreviewDiffDecorationModel),this.addDispose(this.virtualModel);const y=this.livePreviewDiffDecorationModel.onDispose(()=>{this.dispose(),y.dispose()})}setPreviewerOptions(a){this.previewerOptions=a,this.livePreviewDiffDecorationModel.setPreviewerOptions({partialEditWidgetOptions:{hideAcceptPartialEditWidget:a.hideAcceptPartialEditWidget},renderRemovedWidgetImmediately:a.renderRemovedWidgetImmediately})}initialize(a){const b=this.originalModel.getEOL(),y=a.getStartPosition(),S=a.getEndPosition();this.rawOriginalTextLines=this.originalModel.getValueInRange(l.Range.fromPositions(y,S)).split(b),this.rawOriginalTextLinesTokens=this.rawOriginalTextLines.map((T,w)=>{const D=y.lineNumber+w;return this.originalModel.tokenization.forceTokenization(D),this.originalModel.tokenization.getLineTokens(D)});const A=E.LineRange.fromRangeInclusive(l.Range.fromPositions({lineNumber:a.startLineNumber,column:1},{lineNumber:a.endLineNumber,column:Number.MAX_SAFE_INTEGER}));this.livePreviewDiffDecorationModel.initialize(A)}restoreSnapshot(a){this._snapshotStore=a;const{rawOriginalTextLines:b,rawOriginalTextLinesTokens:y,undoRedoGroup:S,decorationSnapshotData:A,previewerOptions:T}=a;this.setPreviewerOptions(T),this.rawOriginalTextLines=b,this.rawOriginalTextLinesTokens=y,this.undoRedoGroup=S,this.livePreviewDiffDecorationModel.initialize(A.zone)}get currentSnapshotStore(){return this._snapshotStore}restoreDecorationSnapshot(a){this.livePreviewDiffDecorationModel.restoreSnapshot(a)}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(`
28350
+ `?s.DefaultEndOfLine.CRLF:s.DefaultEndOfLine.LF,{textBuffer:P,disposable:R}=(0,g.createTextBuffer)(D,O),M=c.ModelService._computeEdits(I,P);I.pushEditOperations([],M,()=>[]),R.dispose(),(T=this.node)===null||T===void 0||T.layout()}onError(S){var A;(A=this.node)===null||A===void 0||A.layout()}onAbort(){var S;(S=this.node)===null||S===void 0||S.layout()}onEnd(){var S;(S=this.node)===null||S===void 0||S.layout()}};t.SideBySideInlineDiffWidget=a,a.AI_DIFF_WIDGET_ID="AI-DIFF-WIDGET",t.SideBySideInlineDiffWidget=a=n=r.__decorate([(0,o.Injectable)({multiple:!0})],a);let b=class extends f{listenNode(S){S.addDispose(S.onDidEditChange(()=>this.layout())),S.addDispose(S.onPartialEditWidgetListChange(T=>{var w;T.every(D=>D.isHidden)&&(this.dispose(),(w=this.inlineContentWidget)===null||w===void 0||w.dispose())}));const A=S.onDispose(()=>{this.dispose(),A.dispose()});this.addDispose(S)}createNode(){const S=this.injector.get(d.InlineStreamDiffHandler,[this.monacoEditor]);return S.initialize(this.selection),this.listenNode(S),S}attachNode(S){var A;if((A=this.node)===null||A===void 0||A.dispose(),this.node=S,S){const T=S.currentSnapshotStore;T&&(this.node.restoreDecorationSnapshot(T.decorationSnapshotData),this.listenNode(S))}}createNodeSnapshot(){if(!this.node)return this.createNode();const S=this.node.createSnapshot(),A=this.injector.get(d.InlineStreamDiffHandler,[this.monacoEditor]);return A.restoreSnapshot(S),A}getPosition(){var S;const A=(S=this.node)===null||S===void 0?void 0:S.getZone();return A?p.Position.lift({lineNumber:A.startLineNumber,column:1}):p.Position.lift({lineNumber:1,column:1})}handleAction(S){var A,T;switch(S){case u.EResultKind.ACCEPT:(A=this.node)===null||A===void 0||A.acceptAll();break;case u.EResultKind.DISCARD:case u.EResultKind.REGENERATE:(T=this.node)===null||T===void 0||T.rejectAll();break;default:break}}onLineCount(){return l.Disposable.NULL}layout(){var S,A,T;(S=this.inlineContentWidget)===null||S===void 0||S.setPositionPreference([E.ContentWidgetPositionPreference.ABOVE,E.ContentWidgetPositionPreference.BELOW]),super.layout();const w=this.getPosition();if(w&&this.inlineContentWidget){const D=(A=this.node)===null||A===void 0?void 0:A.livePreviewDiffDecorationModel.getRemovedWidgets();if(D?.length){const I=w.lineNumber,O=D[0];if(O)if(((T=O.getLastPosition())===null||T===void 0?void 0:T.lineNumber)<=I){const R=this.inlineContentWidget.getLineHeight(),M=O.height+1;this.inlineContentWidget.setOffsetTop(-R*M-4)}else this.inlineContentWidget.setOffsetTop(0)}else this.inlineContentWidget.setOffsetTop(0)}}onData(S){var A;const{message:T}=S;(A=this.node)===null||A===void 0||A.addLinesToDiff(this.formatIndentation(T))}onAbort(){var S,A;const T=(S=this.node)===null||S===void 0?void 0:S.recompute(d.EComputerMode.default);T&&(T.activeLine=0,T.pendingRange=new _.LineRange(0,0),(A=this.node)===null||A===void 0||A.finallyRender(T))}onEnd(){var S,A;const T=(S=this.node)===null||S===void 0?void 0:S.recompute(d.EComputerMode.legacy);T&&((A=this.node)===null||A===void 0||A.pushRateFinallyDiffStack(T))}getValue(){var S;return((S=this.node)===null||S===void 0?void 0:S.getVirtualModelValue())||""}getOriginValue(){var S;return((S=this.node)===null||S===void 0?void 0:S.getOriginModelValue())||""}setValue(S){var A,T;const w=(A=this.node)===null||A===void 0?void 0:A.recompute(d.EComputerMode.legacy,this.formatIndentation(S));w&&((T=this.node)===null||T===void 0||T.finallyRender(w))}revealFirstDiff(){var S;(S=this.node)===null||S===void 0||S.revealFirstDiff()}};t.LiveInlineDiffPreviewer=b,t.LiveInlineDiffPreviewer=b=r.__decorate([(0,o.Injectable)({multiple:!0})],b)},37679:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffWidget=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(43144),l=n.__importDefault(e(25873)),p=e(76003),E=e(41869),m=n.__importStar(e(20868)),_=e(87822),s=e(34819),g=e(90626),c=n.__importDefault(e(69790)),h={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},u=r.default.memo(v=>{const{range:f,onMaxLineCount:a,editor:b,onReady:y}=v,S=(0,E.useInjectable)(E.MonacoService),A=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!f)return;const T=b.getModel();if(!T)return;const w=T.getValueInRange(f),D=S.createDiffEditor(A.current,{...h,lineDecorationsWidth:b.getLayoutInfo().decorationsWidth,lineNumbersMinChars:b.getOption(m.editor.EditorOption.lineNumbersMinChars)}),I=g.StandaloneServices.get(_.IModelService),O={languageId:T.getLanguageId(),onDidChange:E.Event.None},P=I.createModel(w,O,m.Uri.from({scheme:E.Schemes.inMemory,path:"inline-diff-widget/"+(0,E.randomString)(8)}),!0),R=I.createModel("",O,m.Uri.from({scheme:E.Schemes.inMemory,path:"inline-diff-widget/"+(0,E.randomString)(8)}),!0);D.setModel({original:P,modified:R}),D.revealLine(f.startLineNumber,m.editor.ScrollType.Immediate);const M=()=>{if(a){const k=P.getLineCount(),B=R.getLineCount();a(Math.max(k,B)+1)}};return y&&y({getModifiedModel:()=>R,getOriginModel:()=>P,layout:M}),M(),()=>{D&&D.dispose()}},[f,b]),r.default.createElement("div",{ref:A,className:c.default.diff_editor_widget})});let d=class extends s.ZoneWidget{setPreviewerOptions(f){this.previewerOptions=f}_fillContainer(f){this.setCssClass("inline-diff-widget"),this.root=l.default.createRoot(f);let a=null;if(this._resolveResultWidget)if(f.parentNode){const b=document.createElement("div");requestAnimationFrame(()=>{b.className=c.default.ai_diff_editor_resolve_result_widget;const y=this.editor.getLayoutInfo();b.style.width=`${y.contentWidth}px`,b.style.left=`${y.contentLeft}px`}),f.parentNode.appendChild(b),a=(0,o.createPortal)(this._resolveResultWidget,b),this.resultContainer=b}else throw new Error("[impossible path] container.parentNode is null");this.root.render(r.default.createElement(E.ConfigProvider,{value:this.configContext},r.default.createElement("div",{className:c.default.ai_diff_editor_container},r.default.createElement(u,{range:this.range,editor:this.editor,onMaxLineCount:b=>{b&&(this._relayout(b),this._onMaxLineCount.fire(b))},onReady:b=>{this.diffWidgetHandler=b,this._onReady.fire()}})),a))}computeResultWidgetWidth(){const f=this.editor.getLayoutInfo();return f.contentWidth+f.contentLeft}_onWidth(f){super._onWidth(f),requestAnimationFrame(()=>{this.resultContainer&&(this.resultContainer.style.width=`${this.computeResultWidgetWidth()}px`)})}getModifiedModel(){var f;return(f=this.diffWidgetHandler)===null||f===void 0?void 0:f.getModifiedModel()}getOriginModel(){var f;return(f=this.diffWidgetHandler)===null||f===void 0?void 0:f.getOriginModel()}layout(){var f;return(f=this.diffWidgetHandler)===null||f===void 0?void 0:f.layout()}constructor(f,a){super(a.editor,{showArrow:!1,showFrame:!1,arrowColor:void 0,frameColor:void 0,keepEditorSelection:!0,showInHiddenAreas:!0}),this.id=f,this._onMaxLineCount=new E.Emitter,this.onMaxLineCount=this._onMaxLineCount.event,this._onReady=new E.Emitter,this.onReady=this._onReady.event,this.diffWidgetHandler=null,this.resultContainer=null,this._resolveResultWidget=null;const{selection:b,hiddenArea:y,editor:S}=a;this.range=b,this.hiddenArea=y||b,S.setHiddenAreas([this.hiddenArea],this.id)}revealRange(f,a){}setContainerStyle(f){var a;const b=Object.keys(f);for(const y of b)Object.prototype.hasOwnProperty.call((a=this.container)===null||a===void 0?void 0:a.style,y)&&(this.container.style[y]=f[y])}addClassName(f){return this.setCssClass(f),this}dispose(){this.hide(),super.dispose()}hide(){this.editor.setHiddenAreas([],this.id),super.hide(),this.root&&this.root.unmount()}showByLine(f,a=20){this.editor._modelData.viewModel.coordinatesConverter.modelPositionIsVisible=()=>!0,super.show({startLineNumber:f,startColumn:1,endLineNumber:f,endColumn:Number.MAX_SAFE_INTEGER},a)}setResolveResultWidget(f){this._resolveResultWidget=f}};t.InlineDiffWidget=d,n.__decorate([(0,p.Autowired)(E.AppConfig),n.__metadata("design:type",Object)],d.prototype,"configContext",void 0),t.InlineDiffWidget=d=n.__decorate([(0,p.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String,Object])],d)},38890:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffController=void 0;const n=e(41869),r=e(43718),o=e(57517),l=e(99906),p=e(83854),E=e(40111),m=e(49444);class _ extends l.BaseAIMonacoEditorController{constructor(){super(...arguments),this._onMaxLineCount=new r.Emitter,this.onMaxLineCount=this._onMaxLineCount.event,this._previewerNodeStore=new Map}static get(g){return g.getContribution(_.ID)}get preferenceService(){return this.injector.get(n.PreferenceService)}get eventBus(){return this.injector.get(r.IEventBus)}mount(){return this.featureDisposable.addDispose(this.eventBus.on(o.EditorGroupCloseEvent,g=>{const c=g.payload.resource.uri.toString(),h=this.getStoredState(c);h&&h.previewerOptions.disposeWhenEditorClosed&&this.destroyPreviewer(c)})),this.registerInlineDiffFeature(this.monacoEditor),this.featureDisposable}storeState(g){if(!this.previewer)return;const c=this.previewer.createNodeSnapshot();c&&this._previewerNodeStore.set(g,c)}tryRestoreState(g,c){const h=this.getStoredState(c);if(h){if(h.disposed){this.destroyPreviewer(c);return}return this.restoreState(g,h)}}restoreState(g,c){var h;if((h=g.getModel())===null||h===void 0?void 0:h.uri){this.previewer=this.injector.get(m.LiveInlineDiffPreviewer,[g]),this.previewer.attachNode(c),this.listenPreviewer(this.previewer);const d=this.previewer.onDispose(()=>{this.destroyPreviewer(),d.dispose()})}}registerInlineDiffFeature(g){const c=g.getModel();this.featureDisposable.addDispose(g.onWillChangeModel(h=>{if(!h.oldModelUrl)return;const u=h.oldModelUrl.toString();this.storeState(u),this.destroyPreviewer()})),this.featureDisposable.addDispose(g.onDidChangeModel(h=>{h.newModelUrl&&this.tryRestoreState(g,h.newModelUrl.toString())})),c&&this.featureDisposable.addDispose(c.onWillDispose(()=>{const h=c.uri.toString();this.destroyPreviewer(h)}))}showPreviewerByStream(g,c){const{crossSelection:h,chatResponse:u}=c,d=new r.Disposable,v=this.createDiffPreviewer(g,h,c.previewerOptions),f=()=>{v.layout(),d.dispose()};return d.addDispose(v.onReady(()=>{if(E.InlineChatController.is(u)){const a=u;d.addDispose([a.onData(b=>{r.ReplyResponse.is(b)&&v.onData(b)}),a.onError(b=>{v.onError(b),f()}),a.onAbort(()=>{v.onAbort(),f()}),a.onEnd(()=>{v.onEnd(),f()})]),a.listen()}else v.setValue(u.message),f()})),v.layout(),v}createDiffPreviewer(g,c,h){const u=this.preferenceService.getValid(r.AINativeSettingSectionsId.InlineDiffPreviewMode,p.EInlineDiffPreviewMode.inlineLive);return this.destroyPreviewer(),u===p.EInlineDiffPreviewMode.sideBySide?this.previewer=this.injector.get(m.SideBySideInlineDiffWidget,[g]):this.previewer=this.injector.get(m.LiveInlineDiffPreviewer,[g]),this.previewer.create(c,h),this.previewer.show(c.startLineNumber-1,c.endLineNumber-c.startLineNumber+2),this.listenPreviewer(this.previewer),this.previewer}listenPreviewer(g){g&&g.addDispose(g.onLineCount(c=>this._onMaxLineCount.fire(c)))}getPreviewer(){return this.previewer}getStoredState(g){return this._previewerNodeStore.get(g)}handleAction(g){var c;(c=this.previewer)===null||c===void 0||c.handleAction(g)}getModifyContent(){var g;return(g=this.previewer)===null||g===void 0?void 0:g.getValue()}getOriginContent(){var g;return(g=this.previewer)===null||g===void 0?void 0:g.getOriginValue()}destroyPreviewer(g){var c;(c=this.previewer)===null||c===void 0||c.dispose(),this.previewer=void 0,g&&this._previewerNodeStore.delete(g)}revealFirstDiff(){var g;(g=this.previewer)===null||g===void 0||g.revealFirstDiff()}}t.InlineDiffController=_,_.ID="editor.contrib.ai.inline.diff"},51347:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffService=void 0;const n=e(85608),r=e(76003),o=e(70392);let l=class{constructor(){this._partialEventEmitter=new o.Emitter,this.onPartialEdit=this._partialEventEmitter.event}firePartialEdit(E){this._partialEventEmitter.fire(E)}};t.InlineDiffService=l,t.InlineDiffService=l=n.__decorate([(0,r.Injectable)()],l)},53182:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineHintLineDecoration=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(57925),p=e(43718),E=e(20868),m=e(60304),_=e(52416),s=e(75189),g="inline_hint_description",c="inline_hint_description_key";let h=class extends p.Disposable{constructor(d){super(),this.monacoEditor=d,this.colorRegister=(0,_.getColorRegistry)(),m.StandaloneServices.get(s.ICodeEditorService).registerDecorationType(g,c,{isWholeLine:!0}),this.addDispose(p.Disposable.create(()=>{this.monacoEditor.setDecorationsByType(g,c,[])}))}getSequenceKeyString(d="+"){var v;const a=(v=this.keybindingRegistry.getKeybindingsForCommand(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||v===void 0?void 0:v.resolved;return a?this.keybindingRegistry.acceleratorForSequence(a,d):""}async show(d){var v;const f=(0,p.formatLocalize)("aiNative.inline.hint.widget.placeholder",this.getSequenceKeyString("")),a=await this.themeService.getCurrentTheme(),b=this.colorRegister.resolveDefaultColor(_.inputPlaceholderForeground,a);this.monacoEditor.setDecorationsByType(g,c,[{range:E.Range.fromPositions(d),renderOptions:{after:{contentText:f,opacity:"0.5",color:(v=b?.toString())!==null&&v!==void 0?v:"",padding:"0 0 0 12px",width:"max-content",fontFamily:"-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,sans-serif"}}}])}};t.InlineHintLineDecoration=h,n.__decorate([(0,r.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],h.prototype,"keybindingRegistry",void 0),n.__decorate([(0,r.Autowired)(_.IThemeService),n.__metadata("design:type",Object)],h.prototype,"themeService",void 0),t.InlineHintLineDecoration=h=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],h)},77886:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineHintController=void 0;const n=e(85608),r=n.__importDefault(e(97331)),o=e(43718),l=n.__importStar(e(20868)),p=e(77659),E=e(99906),m=e(71863),_=e(19520),s=e(53182);class g extends E.BaseAIMonacoEditorController{static get(h){return h.getContribution(g.ID)}get inlineCompletionsService(){return this.injector.get(m.AICompletionsService)}mount(){return this.registerHintLineFeature(this.monacoEditor)}registerHintLineFeature(h){const u=new o.Disposable,d=this.injector.get(p.AINativeContextKey,[h.contextKeyService]),v=()=>{u.dispose()},f=b=>{var y;const S=h.getModel();if(!S||this.inlineCompletionsService.isVisibleCompletion)return;if(!S.getLineDecorations(b.lineNumber).some(w=>w.options.description===_.InlineInputPreviewDecorationID)){const w=this.injector.get(s.InlineHintLineDecoration,[h]),D=(y=h.getModel())===null||y===void 0?void 0:y.getLineContent(b.lineNumber);D?.trim()||w.show(b),d.inlineHintWidgetIsVisible.set(!0),u.addDispose(w.onDispose(()=>{d.inlineHintWidgetIsVisible.set(!1)})),u.addDispose(w)}},a=(0,r.default)(async b=>{v(),f(b)},100);return this.featureDisposable.addDispose(h.onDidChangeCursorPosition(b=>{a(b.position)})),this.featureDisposable.addDispose(h.onDidChangeModelContent(b=>{var y,S;a(new l.Position((y=b.changes[0])===null||y===void 0?void 0:y.range.endLineNumber,(S=b.changes[0])===null||S===void 0?void 0:S.range.endColumn))})),this.featureDisposable.addDispose(h.onDidFocusEditorWidget(()=>{const b=h.getPosition();b&&(v(),f(b))})),this.featureDisposable.addDispose(h.onDidBlurEditorWidget(()=>{v()})),this.featureDisposable.addDispose(this.inlineCompletionsService.onVisibleCompletion(b=>{b&&v()})),this.featureDisposable.addDispose(u),this.featureDisposable}}t.InlineHintController=g,g.ID="editor.contrib.ai.inline.hint"},32213:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputWidget=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(76003),l=e(41869),p=e(89195),E=e(43718),m=e(90052),_=e(90614),s=e(31031),g=e(26664),c=n.__importDefault(e(13185)),h=d=>{const{defaultValue:v,onClose:f,onInteractiveInputSend:a,onLayoutChange:b,onChatStatus:y,onResultClick:S,onValueChange:A}=d,[T,w]=(0,r.useState)(s.EInlineChatStatus.READY),D=(0,l.useInjectable)(l.AINativeConfigService);(0,r.useEffect)(()=>{const k=new E.Disposable;return k.addDispose(y(B=>w(B))),()=>{k.dispose()}},[y]);const I=(0,r.useMemo)(()=>T===s.EInlineChatStatus.THINKING,[T]),O=(0,r.useMemo)(()=>T===s.EInlineChatStatus.DONE,[T]),P=(0,r.useMemo)(()=>T===s.EInlineChatStatus.ERROR,[T]),R=(0,r.useCallback)(()=>{f?.()},[f]),M=(0,r.useCallback)(k=>{a?.(k)},[a]);return P?null:O?r.default.createElement(_.InlineResultAction,{onResultClick:S}):r.default.createElement(p.AIAction,{loadingShowOperation:!0,onClose:R,loading:I,customOperationRender:r.default.createElement(p.InteractiveInput,{autoFocus:!0,defaultValue:v,onValueChange:A,onHeightChange:k=>b(k),size:"small",placeholder:(0,E.localize)("aiNative.inline.chat.input.placeholder.default"),width:D.inlineChat.inputWidth,disabled:I,onSend:M})})};let u=class extends g.AIInlineContentWidget{constructor(v,f){super(v),this.editor=v,this.defaultValue=f,this.allowEditorOverflow=!0,this.positionPreference=[m.ContentWidgetPositionPreference.ABOVE],this._onSend=new E.Emitter,this.onSend=this._onSend.event,this._onClose=new E.Emitter,this.onClose=this._onClose.event,this._onValueChange=new E.Emitter,this.onValueChange=this._onValueChange.event}dispose(){super.dispose(),this.inlineInputService.hide()}id(){return E.AIInlineInputChatContentWidgetId}renderView(){return r.default.createElement("div",{className:c.default.input_wrapper},r.default.createElement(h,{defaultValue:this.defaultValue,onClose:()=>this._onClose.fire(),onChatStatus:this.onStatusChange.bind(this),onLayoutChange:()=>{this.editor.layoutContentWidget(this)},onValueChange:v=>{this._onValueChange.fire(v)},onInteractiveInputSend:v=>{this.launchChatStatus(s.EInlineChatStatus.THINKING),this._onSend.fire(v)},onResultClick:v=>{this._onResultClick.fire(v)}}))}};t.InlineInputWidget=u,t.InlineInputWidget=u=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object,String])],u)},89060:(L,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputController=void 0;const r=e(85608),o=e(76003),l=e(43718),p=e(57517),E=r.__importStar(e(20868)),m=e(28423),_=e(75124),s=e(2261),g=e(52451),c=e(74547),h=e(77659),u=e(99906),d=e(77633),v=e(40111),f=e(31031),a=e(15989),b=e(19520),y=e(32213),S=r.__importDefault(e(13185)),A=e(74353),T=e(86443);let w=n=class extends u.BaseAIMonacoEditorController{static get(I){return I.getContribution(n.ID)}get inlineInputService(){return this.injector.get(A.InlineInputService)}get aiReporter(){return this.injector.get(l.IAIReporter)}get eventBus(){return this.injector.get(l.IEventBus)}get messageService(){return this.injector.get(_.MessageService)}mount(){return this.inputDisposable=new l.Disposable,this.aiNativeContextKey=this.injector.get(h.AINativeContextKey,[this.monacoEditor.contextKeyService]),this.inlineDiffController=a.InlineDiffController.get(this.monacoEditor),this.inputValue=(0,m.observableValue)(this,""),this.modelChangeObs=(0,m.observableFromEvent)(this,this.monacoEditor.onDidChangeModel,()=>this.monacoEditor.getModel()),this.inlineInputWidgetStore=new Map,this.featureDisposable.addDispose(this.eventBus.on(p.EditorGroupCloseEvent,I=>{var O;if(!this.aiNativeContextKey.inlineInputWidgetIsStreaming.get())return;const R=I.payload.resource.uri.toString(),M=(O=this.monacoEditor.getModel())===null||O===void 0?void 0:O.uri.toString();if(M===R){this.inlineDiffController.destroyPreviewer(M),this.hideInput();const k=(0,l.localize)("aiNative.inline.chat.generating.canceled");k&&this.messageService.info(k)}})),this.featureDisposable.addDispose(this.inlineInputService.onHidden(()=>{this.hideInput()})),this.featureDisposable.addDispose(this.inlineInputService.onInteractiveInputVisibleInPosition(async I=>{I?this.showInputInEmptyLine(I,this.monacoEditor):setTimeout(()=>this.monacoEditor.focus(),0)})),this.featureDisposable.addDispose(this.inlineInputService.onInteractiveInputVisibleInSelection(I=>{I&&this.showInputInSelection(I,this.monacoEditor)})),this.featureDisposable.addDispose((0,m.autorun)(I=>{const O=this.modelChangeObs.read(I);if(!O)return;const P=this.inlineInputWidgetStore.get(O.id);if(!P){this.hideInput();return}P instanceof T.InlineInputWidgetStoreInEmptyLine?this.showInputInEmptyLine(P.getPosition(),this.monacoEditor,P.getValue()):P instanceof T.InlineInputWidgetStoreInSelection&&this.showInputInSelection(P.getSelection(),this.monacoEditor,P.getValue())})),this.featureDisposable.addDispose(this.inputDisposable),this.featureDisposable}cancelToken(){super.cancelToken(),this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1)}hideInput(){this.inlineInputWidgetStore.delete(this.monacoEditor.getModel().id),this.inputDisposable.dispose()}async showInputInEmptyLine(I,O,P){const R=O.getModel();if(!R)return;const M=O.getSelection();if(M&&!M.isEmpty())return;this.inputValue.set(P||"",void 0),this.inlineInputWidgetStore.set(R.id,new T.InlineInputWidgetStoreInEmptyLine(I,P)),this.inputDisposable&&(this.inputDisposable.dispose(),this.inputDisposable=new l.Disposable);const k=O.createDecorationsCollection(),B=this.injector.get(y.InlineInputWidget,[O,this.inputValue.get()]);k.append([{range:E.Range.fromPositions(I),options:c.ModelDecorationOptions.register({description:b.InlineInputPreviewDecorationID,isWholeLine:!0,className:S.default.input_decoration_readable_container,inlineClassName:S.default.inline_chat_inserted_range})}]);const x=k.getRange(0);let N;x&&(N=g.LineRange.fromRange(x),B.show({position:x.getStartPosition()}),this.aiNativeContextKey.inlineInputWidgetIsVisible.set(!0)),this.inputDisposable.addDispose(B.onDispose(()=>{this.cancelToken(),k.clear(),this.aiNativeContextKey.inlineInputWidgetIsVisible.set(!1)})),this.inputDisposable.addDispose(B.onValueChange(j=>{this.inputValue.set(j,void 0);const K=this.inlineInputWidgetStore.get(R.id);K instanceof T.InlineInputWidgetStoreInEmptyLine&&K.setValue(j)})),this.inputDisposable.addDispose(B.onResultClick(async j=>{const K=()=>{const U=k.getRange(0);R.pushStackElement(),R.pushEditOperations(null,[s.EditOperation.delete(U)],()=>null),R.pushStackElement()};switch(j){case f.EResultKind.ACCEPT:this.hideInput();break;case f.EResultKind.DISCARD:K(),this.hideInput();break;case f.EResultKind.REGENERATE:K(),requestAnimationFrame(()=>{const G=k.getRange(0).getStartPosition();this.showInputInEmptyLine(G,O,this.inputValue.get())});break;default:break}})),this.inputDisposable.addDispose(l.Event.debounce(k.onDidChange.bind(k),()=>{},l.FRAME_THREE)(()=>{if(!k.getRange(0))return;const j=k.getRange(0),K=g.LineRange.fromRange(j);N.equals(K)||(B.setOptions({position:j.getStartPosition()}),B.layoutContentWidget()),N=K})),this.inputDisposable.addDispose(B.onClose(()=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.get()?this.cancelToken():this.hideInput()})),this.inputDisposable.addDispose(B.onSend(async j=>{O.focus();const K=this.inlineInputService.getInteractiveInputHandler(),U=O.getModel();if(!K||!U)return;B.launchChatStatus(f.EInlineChatStatus.THINKING);const G=await this.inlineInputService.getInteractiveInputStrategyHandler()(O,j),z=E.Selection.fromPositions(I);if(G===d.ERunStrategy.EXECUTE&&K.execute){K.execute(O,z,j,this.token),B.launchChatStatus(f.EInlineChatStatus.DONE),this.hideInput();return}if(G===d.ERunStrategy.PREVIEW&&K.providePreviewStrategy){const $=await K.providePreviewStrategy(O,z,j,this.token);if(l.CancelResponse.is($)){B.launchChatStatus(f.EInlineChatStatus.READY),this.hideInput();return}if(v.InlineChatController.is($)){const Q=$;let Z;const X=this.registerDispose(new l.RunOnceScheduler(()=>{const V=k.getRange(0);V&&Z&&U.pushEditOperations(null,[s.EditOperation.replace(V,Z)],()=>null)},l.FRAME_FIVE));this.inputDisposable.addDispose([Q.onData(async V=>{l.ReplyResponse.is(V)&&(this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!0),Z=V.message,X.isScheduled()||X.schedule())}),Q.onError(V=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),B.launchChatStatus(f.EInlineChatStatus.READY)}),Q.onAbort(()=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),U.pushStackElement(),B.launchChatStatus(f.EInlineChatStatus.DONE)}),Q.onEnd(()=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),U.pushStackElement(),B.launchChatStatus(f.EInlineChatStatus.DONE)})]),Q.listen()}}})),this.inputDisposable.addDispose(B)}async showInputInSelection(I,O,P){var R;this.inputDisposable&&(this.inputDisposable.dispose(),this.inputDisposable=new l.Disposable);const M=O.getModel();if(!M)return;const k=O.createDecorationsCollection();k.set([{range:E.Range.fromPositions({lineNumber:I.startLineNumber,column:1},{lineNumber:I.endLineNumber,column:O.getModel().getLineMaxColumn(I.endLineNumber)}),options:c.ModelDecorationOptions.register({description:b.InlineInputPreviewDecorationID,isWholeLine:!0,className:S.default.input_decoration_pending_container})}]);const B=E.Selection.fromRange(k.getRange(0),I.getDirection());this.inputValue.set(P||"",void 0),this.inlineInputWidgetStore.set(M.id,new T.InlineInputWidgetStoreInSelection(B,P));const x=this.injector.get(y.InlineInputWidget,[O,this.inputValue.get()]);x.show({selection:B}),this.aiNativeContextKey.inlineInputWidgetIsVisible.set(!0),this.inlineDiffController.destroyPreviewer((R=O.getModel())===null||R===void 0?void 0:R.uri.toString()),this.inputDisposable.addDispose(x.onDispose(()=>{this.cancelToken(),k.clear(),this.aiNativeContextKey.inlineInputWidgetIsVisible.set(!1)})),this.inputDisposable.addDispose(x.onValueChange(N=>{this.inputValue.set(N,void 0);const j=this.inlineInputWidgetStore.get(M.id);j instanceof T.InlineInputWidgetStoreInSelection&&j.setValue(N)})),this.inputDisposable.addDispose(x.onClose(()=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.get()?this.cancelToken():this.hideInput()})),this.inputDisposable.addDispose(x.onSend(async N=>{O.focus();const j=this.inlineInputService.getInteractiveInputHandler();if(!j)return;if(x.launchChatStatus(f.EInlineChatStatus.THINKING),await this.inlineInputService.getInteractiveInputStrategyHandler()(O,N)===d.ERunStrategy.PREVIEW&&j.providePreviewStrategy){const U=await j.providePreviewStrategy(O,B,N,this.token);if(l.CancelResponse.is(U)){k.clear(),this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),x.launchChatStatus(f.EInlineChatStatus.DONE);return}if(v.InlineChatController.is(U)){const G=U;this.inputDisposable.addDispose([G.onData($=>{k.clear(),l.ReplyResponse.is($)&&this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!0)}),G.onError($=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),x.launchChatStatus(f.EInlineChatStatus.READY)}),G.onAbort(()=>{k.clear(),this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),x.launchChatStatus(f.EInlineChatStatus.DONE)}),G.onEnd(()=>{k.clear(),this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),x.launchChatStatus(f.EInlineChatStatus.DONE)})]),this.inlineDiffController.showPreviewerByStream(O,{crossSelection:B,chatResponse:G}).mount(x),G.listen()}}else k.clear(),x.launchChatStatus(f.EInlineChatStatus.READY),this.hideInput()})),this.inputDisposable.addDispose(x.onResultClick(N=>{this.inlineDiffController.handleAction(N),this.hideInput(),N===f.EResultKind.REGENERATE&&requestAnimationFrame(()=>{this.showInputInSelection(B,O,this.inputValue.get())})})),this.inputDisposable.addDispose(x)}};t.InlineInputController=w,w.ID="editor.contrib.ai.inline.input",t.InlineInputController=w=n=r.__decorate([(0,o.Injectable)()],w)},74353:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputService=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(57925),p=e(43718),E=e(20868),m=e(85679),_=e(77633),s=e(86443);let g=class extends p.Disposable{constructor(){super(...arguments),this.interactiveInputModel=new s.InteractiveInputModel,this._onInteractiveInputVisibleInPosition=new p.Emitter,this.onInteractiveInputVisibleInPosition=this._onInteractiveInputVisibleInPosition.event,this._onInteractiveInputVisibleInSelection=new p.Emitter,this.onInteractiveInputVisibleInSelection=this._onInteractiveInputVisibleInSelection.event,this._onHidden=new p.Emitter,this.onHidden=this._onHidden.event}visibleByPosition(h){this._onInteractiveInputVisibleInPosition.fire(h)}visibleBySelection(h){this._onInteractiveInputVisibleInSelection.fire(h)}async visibleByNearestCodeBlock(h,u){const d=await this.findNearestCodeBlockWithPosition(h,u);d&&this.visibleBySelection(d)}hide(){this._onHidden.fire()}getInteractiveInputHandler(){return this.interactiveInputModel.handler()}getInteractiveInputStrategyHandler(){return this.interactiveInputModel.strategyHandler()}async findNearestCodeBlockWithPosition(h,u){const d=u.getModel(),v=d?.getOffsetAt(h),f=d?.getLanguageId(),a=this.languageParserService.createParser(f),b=await a?.findNearestCodeBlockWithPosition(d?.getValue()||"",v);if(b)return new E.Selection(b.range.start.line+1,b.range.start.character,b.range.end.line+1,b.range.end.character)}getSequenceKeyString(){var h;const d=(h=this.keybindingRegistry.getKeybindingsForCommand(l.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||h===void 0?void 0:h.resolved;return d?this.keybindingRegistry.acceleratorForSequence(d,"+"):""}registerInlineInput(h,u){return this.interactiveInputModel.setHandler(u),h.handleStrategy?this.interactiveInputModel.setStrategyHandler(h.handleStrategy):this.interactiveInputModel.setStrategyHandler(()=>h.strategy||_.ERunStrategy.EXECUTE),this.interactiveInputModel}};t.InlineInputService=g,n.__decorate([(0,r.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],g.prototype,"keybindingRegistry",void 0),n.__decorate([(0,r.Autowired)(m.LanguageParserService),n.__metadata("design:type",m.LanguageParserService)],g.prototype,"languageParserService",void 0),t.InlineInputService=g=n.__decorate([(0,r.Injectable)()],g)},86443:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputWidgetStoreInSelection=t.InlineInputWidgetStoreInEmptyLine=t.InteractiveInputModel=void 0;const n=e(89195),r=e(43718);class o{setHandler(m){this._handler=m}handler(){return this._handler}setStrategyHandler(m){this._strategyHandler=m}strategyHandler(){return this._strategyHandler}dispose(){this._handler=void 0}}t.InteractiveInputModel=o,o.ID=`${n.InteractiveInput.displayName}:${(0,r.uuid)(4)}`;class l{constructor(m,_){this.position=m,this.value=_}getPosition(){return this.position}setPosition(m){this.position=m}getValue(){return this.value}setValue(m){this.value=m}}t.InlineInputWidgetStoreInEmptyLine=l;class p{constructor(m,_){this.selection=m,this.value=_}getSelection(){return this.selection}setSelection(m){this.selection=m}getValue(){return this.value}setValue(m){this.value=m}}t.InlineInputWidgetStoreInSelection=p},76755:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineStreamDiffComputer=void 0;const n=e(9514),r=e(52451),o=e(37348),l=e(44781),p=e(68450),E=e(56702),m=e(89216),_=e(10438),s=e(30861),g=e(46739),c=(u,d,v=p.InfiniteTimeout.instance)=>{if(!u.length||!d.length)return p.DiffAlgorithmResult.trivial(u,d);const f=new _.Array2D(2*u.length+1,d.length+1),a=new _.Array2D(2*u.length+1,d.length+1);for(let D=0;D<=d.length;D++)f.set(0,D,D),a.set(0,D,D>0);for(let D=0;D<=2*u.length;D++)f.set(D,0,Math.floor((D+1)/2)),a.set(D,0,!1);for(let D=1;D<=d.length;D++)for(let I=1;I<=2*u.length;I++){if(!v.isValid())return p.DiffAlgorithmResult.trivialTimedOut(u,d);if(I%2===0){const O=f.get(I,D-1)+1,P=f.get(I-1,D),R=O<P;f.set(I,D,R?O:P),a.set(I,D,R)}else{const O=f.get(I-1,D)+.4,P=u.getElement(Math.floor(I/2))===d.getElement(D-1)?f.get(I-1,D-1):Number.MAX_VALUE,R=P<O;f.set(I,D,R?P:O),a.set(I,D,R)}}let b=Number.MAX_VALUE,y=-1;for(let D=0;D<=2*u.length;D++){const I=f.get(D,d.length);I<b&&(b=I,y=D)}const S=[];let A=y,T=d.length;A<=2*u.length-2&&S.push(new p.SequenceDiff(new o.OffsetRange(Math.floor((A+1)/2),u.length),new o.OffsetRange(T,T)));let w;for(;A>=0&&T>=0;)a.get(A,T)?(A%2===0?w===void 0&&(w={originalLineIndex:Math.floor(A/2),modifiedLineIndex:T}):(w!==void 0&&((w.originalLineIndex!==Math.floor(A/2)+1||w.modifiedLineIndex!==T)&&S.push(new p.SequenceDiff(new o.OffsetRange(Math.floor(A/2)+1,w.originalLineIndex),new o.OffsetRange(T,w.modifiedLineIndex))),w=void 0),A-=1),T-=1):(w=w||{originalLineIndex:Math.floor((A+1)/2),modifiedLineIndex:T},A-=1);return w!==void 0&&((w.originalLineIndex!==Math.floor(A/2)+1||w.modifiedLineIndex!==T)&&S.push(new p.SequenceDiff(new o.OffsetRange(Math.floor(A/2)+1,w.originalLineIndex),new o.OffsetRange(T,w.modifiedLineIndex))),w=void 0),S.reverse(),new p.DiffAlgorithmResult(S,!1)};class h extends E.DefaultLinesDiffComputer{computeDiff(d,v,f){if(d.length<=1&&(0,n.equals)(d,v,(M,k)=>M===k))return new s.LinesDiff([],[],!1);if(d.length===1&&d[0].length===0||v.length===1&&v[0].length===0)return new s.LinesDiff([new g.DetailedLineRangeMapping(new r.LineRange(1,d.length+1),new r.LineRange(1,v.length+1),[new g.RangeMapping(new l.Range(1,1,d.length,d[d.length-1].length+1),new l.Range(1,1,v.length,v[v.length-1].length+1))])],[],!1);const a=f.maxComputationTimeMs===0?p.InfiniteTimeout.instance:new p.DateTimeout(f.maxComputationTimeMs),b=new Map;function y(M){let k=b.get(M);return k===void 0&&(k=b.size,b.set(M,k)),k}const S=d.length*v.length<1e6&&f.onlyCareAboutPrefixOfOriginalLines,A=d.map(M=>y(S?M:M.trim())),T=v.map(M=>y(S?M:M.trim())),w=new m.LineSequence(A,d),D=new m.LineSequence(T,v),I=d.every(M=>M.trim().length===0);let O;S?I?O=p.DiffAlgorithmResult.trivial(w,D):O=c(w,D,a):w.length+D.length<1700?O=this.dynamicProgrammingDiffing.compute(w,D,a,(M,k)=>d[M]===v[k]?v[k].length===0?.1:1+Math.log(1+v[k].length):.99):O=this.myersDiffingAlgorithm.compute(w,D,a);const P=O.diffs,R=O.hitTimeout;if(S){const M=P.map(k=>new g.DetailedLineRangeMapping(new r.LineRange(k.seq1Range.start+1,k.seq1Range.endExclusive+1),new r.LineRange(k.seq2Range.start+1,k.seq2Range.endExclusive+1),[]));return new s.LinesDiff(M,[],R)}return super.computeDiff(d,v,f)}}t.InlineStreamDiffComputer=h},33062:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineStreamDiffHandler=t.EComputerMode=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(20868),p=e(60304),E=e(52451),m=e(84968),_=e(46739),s=e(87822),g=e(25539),c=e(76755),h=e(80715);var u;(function(f){f.legacy="legacy",f.default="default"})(u||(t.EComputerMode=u={}));const d=new c.InlineStreamDiffComputer;let v=class extends o.Disposable{constructor(a){super(),this.monacoEditor=a,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 g.UndoRedoGroup;const b=p.StandaloneServices.get(s.IModelService);this.virtualModel=b.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(h.LivePreviewDiffDecorationModel,[this.monacoEditor]),this.addDispose(this.livePreviewDiffDecorationModel),this.addDispose(this.virtualModel);const y=this.livePreviewDiffDecorationModel.onDispose(()=>{this.dispose(),y.dispose()})}setPreviewerOptions(a){this.previewerOptions=a,this.livePreviewDiffDecorationModel.setPreviewerOptions({partialEditWidgetOptions:{hideAcceptPartialEditWidget:a.hideAcceptPartialEditWidget},renderRemovedWidgetImmediately:a.renderRemovedWidgetImmediately})}initialize(a){const b=this.originalModel.getEOL(),y=a.getStartPosition(),S=a.getEndPosition();this.rawOriginalTextLines=this.originalModel.getValueInRange(l.Range.fromPositions(y,S)).split(b),this.rawOriginalTextLinesTokens=this.rawOriginalTextLines.map((T,w)=>{const D=y.lineNumber+w;return this.originalModel.tokenization.forceTokenization(D),this.originalModel.tokenization.getLineTokens(D)});const A=E.LineRange.fromRangeInclusive(l.Range.fromPositions({lineNumber:a.startLineNumber,column:1},{lineNumber:a.endLineNumber,column:Number.MAX_SAFE_INTEGER}));this.livePreviewDiffDecorationModel.initialize(A)}restoreSnapshot(a){this._snapshotStore=a;const{rawOriginalTextLines:b,rawOriginalTextLinesTokens:y,undoRedoGroup:S,decorationSnapshotData:A,previewerOptions:T}=a;this.setPreviewerOptions(T),this.rawOriginalTextLines=b,this.rawOriginalTextLinesTokens=y,this.undoRedoGroup=S,this.livePreviewDiffDecorationModel.initialize(A.zone)}get currentSnapshotStore(){return this._snapshotStore}restoreDecorationSnapshot(a){this.livePreviewDiffDecorationModel.restoreSnapshot(a)}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(`
28351
28351
  `)}get onPartialEditWidgetListChange(){return this.livePreviewDiffDecorationModel.onPartialEditWidgetListChange}computeDiff(a,b,y=u.default){const S=(y===u.default?d:m.linesDiffComputers.getLegacy()).computeDiff(a,b,{computeMoves:!1,maxComputationTimeMs:200,ignoreTrimWhitespace:!1,onlyCareAboutPrefixOfOriginalLines:!0});let A=S.changes;S.hitTimeout&&(A=[new _.DetailedLineRangeMapping(new E.LineRange(1,a.length+1),new E.LineRange(1,b.length+1),void 0)]);const T=[];let w=[];for(const P of A)if(P.modified.endLineNumberExclusive===b.length+1&&y===u.default){if(w=a.slice(P.original.startLineNumber-1,P.original.endLineNumberExclusive-1),P.modified.isEmpty)continue;T.push({removedTextLines:[],removedLinesOriginalRange:new E.LineRange(P.original.startLineNumber,P.original.startLineNumber),addedRange:P.modified,relativeInnerChanges:void 0})}else T.push({removedTextLines:a.slice(P.original.startLineNumber-1,P.original.endLineNumberExclusive-1),removedLinesOriginalRange:P.original,addedRange:P.modified,relativeInnerChanges:P.innerChanges?P.innerChanges.map(R=>({originalRange:R.originalRange.delta(-P.original.startLineNumber+1),modifiedRange:R.modifiedRange.delta(-P.modified.startLineNumber+1)})):void 0});const D=[...b,...w];let I=0,O=new E.LineRange(1,1);return w.length>0&&(I=b.length+1,O=new E.LineRange(b.length+1,b.length+1+w.length)),{changes:T,newFullRangeTextLines:D,activeLine:I,pendingRange:O}}calculateAddedDecorationCollectionState(a){const b=this.getZone();return a.changes.map(S=>{const A=S.addedRange,T={lineNumber:b.startLineNumber+A.startLineNumber-1,column:1},w={lineNumber:b.startLineNumber+A.endLineNumberExclusive-2,column:1};return{startPosition:T,endPosition:w,len:A.endLineNumberExclusive-A.startLineNumber}})}renderPartialEditWidgets(a){const b=this.calculateAddedDecorationCollectionState(a);this.livePreviewDiffDecorationModel.touchPartialEditWidgets(b.map(y=>y.startPosition.lineNumber))}renderAddedRangeDecoration(a){const b=this.calculateAddedDecorationCollectionState(a);this.livePreviewDiffDecorationModel.touchAddedRange(b)}renderRemovedRangeDecoration(a){const{changes:b}=a,y=this.getZone();let S=0;const A=[];for(const T of b){const{removedTextLines:w,removedLinesOriginalRange:D,addedRange:I}=T;w.length>0&&A.push({position:{column:1,lineNumber:y.startLineNumber+D.startLineNumber-2-S},textLines:w.map((O,P)=>({text:O,lineTokens:this.rawOriginalTextLinesTokens[D.startLineNumber-1+P]}))}),S+=D.length-I.length}this.livePreviewDiffDecorationModel.touchRemovedWidget(A,()=>{this._onDidEditChange.fire()})}pushStackElement(){const a=this.livePreviewDiffDecorationModel.createEditStackElement(this.undoRedoGroup);a.attachModel(this.livePreviewDiffDecorationModel),a.registerUndo(b=>{b.dispose()})}handleEdits(a){const{activeLine:b,newFullRangeTextLines:y,pendingRange:S}=a,A=this.originalModel.getEOL(),T=this.getZone(),w=T.startLineNumber<T.endLineNumberExclusive?new l.Range(T.startLineNumber,1,T.endLineNumberExclusive-1,this.originalModel.getLineMaxColumn(T.endLineNumberExclusive-1)):new l.Range(T.startLineNumber,1,T.startLineNumber,1),D=this.originalModel.getValueInRange(w).split(A),I=m.linesDiffComputers.getDefault().computeDiff(D,y,{computeMoves:!1,maxComputationTimeMs:200,ignoreTrimWhitespace:!1}),O=[];if(I.hitTimeout){let P=y.join(A);w.isEmpty()&&(P+=A);const R={range:w,text:P,forceMoveMarkers:!1};O.push(R)}else for(const P of I.changes){let R=y.slice(P.modified.startLineNumber-1,P.modified.endLineNumberExclusive-1).join(A),M;P.original.isEmpty?(M=new l.Range(w.startLineNumber+P.original.startLineNumber-1,1,w.startLineNumber+P.original.startLineNumber-1,1),R+=A):P.modified.isEmpty?(M=new l.Range(w.startLineNumber+P.original.startLineNumber-1,1,w.startLineNumber+P.original.endLineNumberExclusive-1,1),R=null):M=new l.Range(w.startLineNumber+P.original.startLineNumber-1,1,w.startLineNumber+P.original.endLineNumberExclusive-2,this.originalModel.getLineMaxColumn(w.startLineNumber+P.original.endLineNumberExclusive-2));const k={range:M,text:R,forceMoveMarkers:!1};O.push(k)}this.originalModel.pushEditOperations(null,O,()=>null,this.undoRedoGroup),this.livePreviewDiffDecorationModel.updateZone(new E.LineRange(T.startLineNumber,T.startLineNumber+y.length)),b>0?this.livePreviewDiffDecorationModel.touchActiveLine(b):this.livePreviewDiffDecorationModel.clearActiveLine(),this.renderAddedRangeDecoration(a),S.length>0?this.livePreviewDiffDecorationModel.touchPendingRange(S):this.livePreviewDiffDecorationModel.clearPendingLine(),this.renderRemovedRangeDecoration(a),this._onDidEditChange.fire()}recompute(a,b){b&&this.virtualModel.setValue(b);const y=this.virtualModel.getLinesContent();return this.computeDiff(this.rawOriginalTextLines,y,a)}async rateEditController(){if(this.isEditing===!1){for(this.isEditing=!0;this.currentEditLine<=this.virtualModel.getLinesContent().length;){if(this.disposed)return;const b=this.virtualModel.getLinesContent().slice(0,this.currentEditLine),y=this.computeDiff(this.rawOriginalTextLines,b);this.handleEdits(y),this.currentEditLine+=1,await(0,o.sleep)(o.FRAME_THREE)}this.finallyDiffModel&&this.finallyRender(this.finallyDiffModel),this.isEditing=!1}}addLinesToDiff(a,b=u.default){this.recompute(b,a),this.rateEditController()}pushRateFinallyDiffStack(a){this.finallyDiffModel=a,this.isEditing===!1&&this.finallyRender(this.finallyDiffModel)}finallyRender(a){this.renderPartialEditWidgets(a),this.handleEdits(a),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()}};t.InlineStreamDiffHandler=v,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],v.prototype,"injector",void 0),t.InlineStreamDiffHandler=v=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],v)},22169:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineStreamDiffService=void 0;const n=e(85608),r=e(76003),o=e(43718);let l=class{constructor(){this._onAcceptDiscardPartialEdit=new o.Emitter,this.onAcceptDiscardPartialEdit=this._onAcceptDiscardPartialEdit.event}launchAcceptDiscardPartialEdit(E){this._onAcceptDiscardPartialEdit.fire(E)}};t.InlineStreamDiffService=l,t.InlineStreamDiffService=l=n.__decorate([(0,r.Injectable)()],l)},54362:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LivePreviewUndoRedoStackElement=void 0;const n=e(25539);class r{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(l){this.model=l,this.confirmBeforeUndo=!1}attachModel(l){this.decorationModel=l}registerUndo(l){this._undo=l}undo(){var l;(l=this._undo)===null||l===void 0||l.call(this,this.decorationModel)}registerRedo(l){this._redo=l}redo(){var l;(l=this._redo)===null||l===void 0||l.call(this,this.decorationModel)}}t.LivePreviewUndoRedoStackElement=r},8106:(L,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.RemovedZoneWidget=t.AcceptPartialEditWidget=t.EPartialEdit=t.PendingRangeDecoration=t.AddedRangeDecoration=t.ActiveLineDecoration=void 0;const r=e(85608),o=r.__importDefault(e(53373)),l=r.__importStar(e(14041)),p=r.__importDefault(e(25873)),E=e(76003),m=e(41869),_=e(57925),s=e(43718),g=e(52659),c=e(90052),h=e(31324),u=e(34819),d=e(24522),v=r.__importDefault(e(71749));t.ActiveLineDecoration="activeLine-decoration",t.AddedRangeDecoration="added-range-decoration",t.PendingRangeDecoration="pending-range-decoration";var f;(function(A){A.accept="accept",A.discard="discard"})(f||(t.EPartialEdit=f={}));const a=A=>{const{keyStrings:T,onAccept:w,onDiscard:D,editor:I}=A,[O,P]=l.default.useState(0),R=(0,l.useCallback)(()=>{w?.()},[w]),M=(0,l.useCallback)(()=>{D?.()},[D]);return(0,m.useDisposable)(()=>I.onDidScrollChange(k=>{const{scrollLeftChanged:B,scrollLeft:x}=k;B&&P(x)}),[I]),l.default.createElement("div",{className:(0,o.default)("kt-inline-diff-accept-partial-widget-container",v.default.inline_diff_accept_partial_widget_container),style:{marginLeft:O}},l.default.createElement("div",{className:v.default.content},l.default.createElement("span",{className:(0,o.default)(v.default.accept_btn,v.default.btn),onClick:R},(0,s.localize)("aiNative.inline.diff.accept"),l.default.createElement("span",null,T.acceptSequence)),l.default.createElement("span",{className:(0,o.default)(v.default.discard_btn,v.default.btn),onClick:M},(0,s.localize)("aiNative.inline.diff.reject"),l.default.createElement("span",null,T.discardSequence))))};let b=n=class extends g.ReactInlineContentWidget{constructor(T,w){super(T),this.editor=T,this.editWidgetOptions=w,this._onAccept=this.registerDispose(new s.Emitter),this.onAccept=this._onAccept.event,this._onDiscard=this.registerDispose(new s.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 T=this.keybindingRegistry.getKeybindingsForCommand(_.AI_INLINE_DIFF_PARTIAL_EDIT.id);if(T=T.sort((w,D)=>D.args-w.args),!(!T||T.length!==2&&T.some(w=>(0,s.isUndefined)(w.resolved))))return{acceptSequence:this.keybindingRegistry.acceleratorForSequence(T[0].resolved,"")[0],discardSequence:this.keybindingRegistry.acceleratorForSequence(T[1].resolved,"")[0]}}renderView(){var T;if(!((T=this.editWidgetOptions)===null||T===void 0)&&T.hideAcceptPartialEditWidget)return;const w=this.getSequenceKeyStrings();if(w)return l.default.createElement(a,{keyStrings:w,onAccept:()=>this._onAccept.fire(),onDiscard:()=>this._onDiscard.fire(),editor:this.editor})}id(){return this._id||(this._id=`${n.ID}_${(0,s.uuid)(4)}`),this._id}getClassName(){return v.default.accept_partial_edit_widget_id}recordDecorationId(T){this._decorationId=T}getDecorationId(){return this._decorationId}resume(){this.status="pending",this.addedLinesCount=0,this.deletedLinesCount=0,super.resume()}setGroup(T){this._group=T}get isPending(){return this.status==="pending"}accept(T,w){this.status="accept",this.addedLinesCount=T,this.deletedLinesCount=w,super.hide()}get isAccepted(){return this.status==="accept"}discard(T,w){this.status="discard",this.addedLinesCount=T,this.deletedLinesCount=w,super.hide()}get isRejected(){return this.status==="discard"}};t.AcceptPartialEditWidget=b,b.ID="AcceptPartialEditWidgetID",r.__decorate([(0,E.Autowired)(m.KeybindingRegistry),r.__metadata("design:type",Object)],b.prototype,"keybindingRegistry",void 0),t.AcceptPartialEditWidget=b=n=r.__decorate([(0,E.Injectable)({multiple:!0}),r.__metadata("design:paramtypes",[Object,Object])],b);const y=({dom:A,editor:T})=>{const w=l.default.useRef(null),[D,I]=l.default.useState(0),[O,P]=l.default.useState(0);return(0,l.useEffect)(()=>{A&&w&&w.current&&w.current.appendChild(A)},[A,w]),(0,m.useDisposable)(()=>T.onDidScrollChange(R=>{const{scrollLeftChanged:M,scrollLeft:k}=R;M&&I(k)}),[T]),(0,m.useDisposable)(()=>(P(T.getOption(h.EditorOption.layoutInfo).contentLeft),T.onDidChangeConfiguration(R=>{R.hasChanged(h.EditorOption.layoutInfo)&&P(T.getOption(h.EditorOption.layoutInfo).contentLeft)})),[T]),l.default.createElement("div",{className:v.default.inline_diff_remove_zone_fixed_box,style:{marginLeft:O+"px"}},l.default.createElement("div",{className:v.default.inline_diff_remove_zone,ref:w,style:{marginLeft:-D+"px"}}))};class S extends u.ZoneWidget{get isHidden(){return this._hidden}get group(){return this._group}constructor(T,w,D){super(T,D),this.textLines=w,this._hidden=!1,(0,s.isDefined)(D.isHidden)&&(this._hidden=D.isHidden),(0,s.isDefined)(D.recordPosition)&&(this._recordPosition=D.recordPosition),(0,s.isDefined)(D.undoRedoGroup)&&(this._group=D.undoRedoGroup);const I=this._positionMarkerId;this._disposables.add(I.onDidChange(O=>{const P=I.getRange(0);P&&(this._recordPosition=P.getStartPosition())}))}setGroup(T){this._group=T}_fillContainer(T){T.classList.add(v.default.inline_diff_remove_zone_widget_container),this.root=p.default.createRoot(T)}getRemovedTextLines(){return this.textLines.map(T=>T.text)}get height(){return this.textLines.length}getLastPosition(){return this.position||this._recordPosition}hide(){this._hidden=!0,super.hide()}resume(){const T=this.getLastPosition();T&&this.show(T,this.height)}show(T,w){this._hidden=!1,super.show(T,w)}revealRange(){}create(){super.create(),this.mountRender()}mountRender(){const T=document.createElement("div");(0,d.renderLines)(T,this.editor.getOption(h.EditorOption.tabIndex),this.textLines.map(({text:w,lineTokens:D})=>({content:w,decorations:[],lineTokens:D})),this.editor.getOptions()),this.root.render(l.default.createElement(y,{dom:T,editor:this.editor}))}dispose(){this.root.unmount(),super.dispose()}}t.RemovedZoneWidget=S},80715:(L,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.LivePreviewDiffDecorationModel=void 0;const r=e(85608),o=e(76003),l=e(41869),p=e(43718),E=e(20868),m=e(60304),_=e(2261),s=e(74547),g=e(25539),c=e(77659),h=e(53617),u=e(15989),d=r.__importDefault(e(71749)),v=e(22169),f=e(54362),a=e(8106);let b=n=class extends p.Disposable{constructor(S){super(),this.monacoEditor=S,this._onPartialEditWidgetListChange=this.registerDispose(new p.Emitter),this.onPartialEditWidgetListChange=this._onPartialEditWidgetListChange.event,this.options={partialEditWidgetOptions:{}},this.partialEditWidgetList=[],this.removedZoneWidgets=[],this.model=this.monacoEditor.getModel(),this.undoRedoService=m.StandaloneServices.get(g.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(A=>{const T=this.monacoEditor.getPosition(),w=this.partialEditWidgetList.filter(D=>!D.isHidden).sort((D,I)=>{var O,P,R,M;const k=((P=(O=D.getPosition())===null||O===void 0?void 0:O.position)===null||P===void 0?void 0:P.lineNumber)||1,B=((M=(R=I.getPosition())===null||R===void 0?void 0:R.position)===null||M===void 0?void 0:M.lineNumber)||1,x=Math.abs(T.lineNumber-k),N=Math.abs(T.lineNumber-B);return x-N});w.length>0&&this.handlePartialEditAction(A?a.EPartialEdit.accept:a.EPartialEdit.discard,w[0])})),this.addedRangeDec=new h.EnhanceDecorationsCollection(this.monacoEditor),this.addDispose(this.addedRangeDec.onDidDecorationsChange(A=>{this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.get()&&this.partialEditWidgetList.forEach(w=>{const D=A.find(I=>w.getDecorationId()===I.id);if(D){const I=D.getRange();w.setOptions({position:{lineNumber:I.startLineNumber,column:1}}),w.layoutContentWidget()}})})),this.addDispose(p.Disposable.create(()=>{this.clear()}))}clear(){this.clearPendingLine(),this.clearActiveLine(),this.clearAddedLine(),this.clearRemovedWidgets(),this.clearPartialEditWidgetList()}initialize(S){this.updateZone(S)}getRemovedWidgets(){return this.removedZoneWidgets}restoreSnapshot(S){const{addedDecList:A,removedWidgetList:T,zone:w,editStackSnapshot:D,partialEditWidgetList:I}=S;this.updateZone(w),this.addedRangeDec.set(A),this.clearRemovedWidgets(),T.forEach(R=>{const M=R.getLastPosition();M&&this.showRemovedWidgetByLineNumber(M.lineNumber,R.textLines,{isHidden:R.isHidden,recordPosition:R.getLastPosition(),undoRedoGroup:R.group})}),this.clearPartialEditWidgetList(),I.forEach(R=>{var M,k;const B=(k=(M=R.getPosition())===null||M===void 0?void 0:M.position)===null||k===void 0?void 0:k.lineNumber;if(B){const x=this.createPartialEditWidget(B);R.status==="accept"?x.accept(R.addedLinesCount,R.deletedLinesCount):R.status==="discard"&&x.discard(R.addedLinesCount,R.deletedLinesCount),x.setGroup(R.group),this.partialEditWidgetList.push(x)}}),this.firePartialEditWidgetList(),this.recordPartialEditWidgetWithAddedDec();const O=this.model.uri;this.undoRedoService.restoreSnapshot(D);const P=this.undoRedoService.getElements(O);P.future.concat(P.past).forEach(R=>{R instanceof f.LivePreviewUndoRedoStackElement&&R.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(S,A,T){const w=new E.Position(S,1),D=A.length,I=new a.RemovedZoneWidget(this.monacoEditor,A,{...T,showInHiddenAreas:!0,showFrame:!1,showArrow:!1});I.create(),this.removedZoneWidgets.push(I),T.isHidden?I.hide():I.show(w,D)}updateZone(S){this.zone=S}getZone(){return this.zone}touchActiveLine(S){const A=this.getZone();this.activeLineDec.set([{range:E.Range.fromPositions({lineNumber:A.startLineNumber+S-1,column:0}),options:s.ModelDecorationOptions.register({description:a.ActiveLineDecoration,isWholeLine:!0,className:d.default.inline_diff_current,zIndex:l.StackingLevel.Workbench})}])}doDiscardPartialWidget(S,A,T){let w=null,D=0,I=0;if(A&&A.length>0){const O=A.getRange();w=_.EditOperation.delete(E.Range.lift({startLineNumber:O.startLineNumber,startColumn:O.startColumn,endLineNumber:O.endLineNumber+1,endColumn:1})),D=A.length,A.hide()}if(T){const O=T.getLastPosition(),P=this.model.getEOL(),R=T.getRemovedTextLines();I=R.length;const M=R.join(P)+P;w?w=_.EditOperation.replace(E.Range.lift(w.range),M):w=_.EditOperation.insert(O.delta(1),M),T.hide()}return S.discard(D,I),w}handlePartialEditAction(S,A,T=!0,w=!1){const D=A.getPosition().position,I=this.aiReporter.getRelationId(),O=this.model,P=this.removedZoneWidgets.find(X=>X.getLastPosition().lineNumber===Math.max(1,D.lineNumber-1)),R=this.addedRangeDec.getDecorationByLineNumber(D.lineNumber),M=R?.length||0,k=P?.height||0,B=new g.UndoRedoGroup;A.setGroup(B),P?.setGroup(B),R?.setGroup(B);const x=X=>X.partialEditWidgetList.find(V=>V.group===B),N=X=>X.removedZoneWidgets.find(V=>V.group===B),j=X=>X.addedRangeDec.getDecorationByGroup(B);let K;const U=P?.getRemovedTextLines().join(`
28352
28352
  `)||"",G=R?.getRange();G&&(K=O.getValueInRange({...G,endColumn:O.getLineMaxColumn(G.endLineNumber)}));const z=X=>{w&&this.aiReporter.end(I,{message:"discard",success:!0,isDrop:!0,code:K,originCode:U,actionSource:p.ActionSourceEnum.InlineChat,actionType:p.ActionTypeEnum.LineDiscard});const V=N(X);V?.hide();const Y=j(X);Y?.hide();const J=x(X);return this.doDiscardPartialWidget(J,Y,V)},$=X=>{w&&this.aiReporter.end(I,{message:"accept",success:!0,isReceive:!0,code:K,originCode:U,actionSource:p.ActionSourceEnum.InlineChat,actionType:p.ActionTypeEnum.lineAccept});const V=x(X);V?.accept(M,k);const Y=N(X);Y?.hide();const J=j(X);J?.hide()},Q=X=>{const V=x(X);V?.resume();const Y=N(X);Y?.resume();const J=j(X);J?.resume()};switch(S){case a.EPartialEdit.accept:if($(this),T){const X=this.createEditStackElement(B);X.attachModel(this),X.registerUndo(V=>{Q(V)}),X.registerRedo(V=>{$(V)})}break;case a.EPartialEdit.discard:{const X=z(this);if(X){if(T){const V=this.createEditStackElement(B);V.attachModel(this),V.registerUndo(Y=>{Q(Y)}),V.registerRedo(Y=>{z(Y)})}O.pushStackElement(),O.pushEditOperations(null,[X],()=>null,B),O.pushStackElement()}}break;default:break}const Z={uri:this.model.uri,totalPartialEditCount:this.partialEditWidgetList.length,resolvedPartialEditCount:this.partialEditWidgetList.filter(X=>X.isHidden).length,currentPartialEdit:{addedLinesCount:M,deletedLinesCount:k,type:S},...this.getTotalCodeInfo()};this.monacoEditor.focus(),this.inlineDiffService.firePartialEdit(Z),this.firePartialEditWidgetList()}firePartialEditWidgetList(){this._onPartialEditWidgetListChange.fire(this.partialEditWidgetList);const S=this.partialEditWidgetList.filter(A=>!A.isHidden);this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.set(S.length!==0)}createEditStackElement(S){const A=new f.LivePreviewUndoRedoStackElement(this.model);return this.undoRedoService.pushElement(A,S),A}static computeCodeInfo(S,A,T){const w=I(S),D={added:0,deleted:0,changed:0};return S.forEach((O,P)=>{if(O.status==="pending"){const R=A[P],M=T[P],k=R?.length||0,B=M?.height||0;D.added+=k,D.deleted+=B,D.changed+=Math.max(k,B)}}),{totalAddedLinesCount:w.added,totalDeletedLinesCount:w.deleted,totalChangedLinesCount:w.changed,unresolvedAddedLinesCount:D.added,unresolvedDeletedLinesCount:D.deleted,unresolvedChangedLinesCount:D.changed};function I(O){const P={added:0,deleted:0,changed:0};return O.forEach(R=>{const M=R.addedLinesCount,k=R.deletedLinesCount;P.added+=M,P.deleted+=k,P.changed+=Math.max(M,k)}),P}}getTotalCodeInfo(){const S=this.partialEditWidgetList,A=this.addedRangeDec.getDecorations(),T=this.removedZoneWidgets;return n.computeCodeInfo(S,A,T)}recordPartialEditWidgetWithAddedDec(){this.partialEditWidgetList.forEach(S=>{var A,T;const w=(T=(A=S.getPosition())===null||A===void 0?void 0:A.position)===null||T===void 0?void 0:T.lineNumber;if(w){const D=this.addedRangeDec.getDecorationByLineNumber(w);D&&S.recordDecorationId(D.id)}})}acceptUnProcessed(){this.partialEditWidgetList.filter(A=>!A.isHidden).forEach(A=>{this.handlePartialEditAction(a.EPartialEdit.accept,A,!1)})}discardUnProcessed(){this.partialEditWidgetList.filter(A=>!A.isHidden).forEach(A=>{this.handlePartialEditAction(a.EPartialEdit.discard,A,!1)})}createPartialEditWidget(S){const A=this.injector.get(a.AcceptPartialEditWidget,[this.monacoEditor,this.options.partialEditWidgetOptions]);A.show({position:{lineNumber:S,column:1}});const T=A.onDispose(()=>{const w=A.getId();this.partialEditWidgetList=this.partialEditWidgetList.filter(D=>D.getId()!==w),T.dispose()});return A.addDispose([A.onAccept(()=>{this.handlePartialEditAction(a.EPartialEdit.accept,A,!0,!0)}),A.onDiscard(()=>{this.handlePartialEditAction(a.EPartialEdit.discard,A,!0,!0)})]),A}touchPartialEditWidgets(S){this.clearPartialEditWidgetList(),this.partialEditWidgetList=S.map(A=>this.createPartialEditWidget(A)),this.firePartialEditWidgetList()}touchAddedRange(S){this.addedRangeDec.set(S.map(A=>{const T=A.startPosition,w=A.endPosition,D=A.len;let I=E.Range.fromPositions(T,w),O=d.default.inline_diff_added_range+" ";return D===0&&(I=E.Range.fromPositions(T),O+=d.default.hide),{length:D,range:I,isHidden:D===0,options:s.ModelDecorationOptions.register({description:a.AddedRangeDecoration,isWholeLine:!0,className:O})}})),this.recordPartialEditWidgetWithAddedDec()}touchRemovedWidget(S,A){const T=()=>{this.clearRemovedWidgets(),S.forEach(({textLines:w,position:D})=>{this.showRemovedWidgetByLineNumber(D.lineNumber,w,{})}),A?.()};this.options.renderRemovedWidgetImmediately?T():(0,p.runWhenIdle)(T)}touchPendingRange(S){const A=this.getZone();this.pendingRangeDec.set([{range:E.Range.fromPositions({lineNumber:A.startLineNumber+S.startLineNumber-1,column:0},{lineNumber:A.startLineNumber+S.endLineNumberExclusive-2,column:Number.MAX_SAFE_INTEGER}),options:s.ModelDecorationOptions.register({description:a.PendingRangeDecoration,isWholeLine:!0,className:d.default.inline_diff_pending_range})}])}clearPendingLine(){this.pendingRangeDec.clear()}clearActiveLine(){this.activeLineDec.clear()}clearAddedLine(){this.addedRangeDec.clear()}clearPartialEditWidgetList(){this.partialEditWidgetList.forEach(S=>{S.dispose()}),this.partialEditWidgetList=[],this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.set(!1)}clearRemovedWidgets(){this.removedZoneWidgets.forEach(S=>{S.dispose()}),this.removedZoneWidgets=[]}revealFirstDiff(){const S=this.removedZoneWidgets[0];if(S){const A=S.getLastPosition();A&&this.monacoEditor.revealLineInCenterIfOutsideViewport(A.lineNumber)}}setPreviewerOptions(S){this.options=S}};t.LivePreviewDiffDecorationModel=b,r.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),r.__metadata("design:type",o.Injector)],b.prototype,"injector",void 0),r.__decorate([(0,o.Autowired)(p.IAIReporter),r.__metadata("design:type",Object)],b.prototype,"aiReporter",void 0),r.__decorate([(0,o.Autowired)(v.InlineStreamDiffService),r.__metadata("design:type",v.InlineStreamDiffService)],b.prototype,"inlineStreamDiffService",void 0),r.__decorate([(0,o.Autowired)(u.InlineDiffService),r.__metadata("design:type",u.InlineDiffService)],b.prototype,"inlineDiffService",void 0),t.LivePreviewDiffDecorationModel=b=n=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__metadata("design:paramtypes",[Object])],b)},19520:(L,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputPreviewDecorationID=void 0,t.InlineInputPreviewDecorationID="InlineInputPreviewDecorationID"},90058:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SumiLightBulbWidget=void 0;const n=e(41869),r=e(3908),o=e(19202);class l extends o.LightBulbWidget{_updateLightBulbTitleAndIcon(){super._updateLightBulbTitleAndIcon();const E=super.state;if(E.type!==1)return;let m=super.icon;(E.actions.allAIFixes||E.actions.hasAutoFix&&E.actions.hasAIFix||E.actions.hasAIFix)&&(m=r.Sumicon.magicWand),m&&(this.getDomNode().classList.remove(...this._iconClasses),this.getDomNode().classList.add(...(0,n.asClassNameArrayWrapper)(m)))}}t.SumiLightBulbWidget=l},8191:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RewriteWidget=t.REWRITE_DECORATION_INLINE_ADD=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=n.__importDefault(e(25873)),p=e(76003),E=e(41869),m=n.__importStar(e(20868)),_=e(52659),s=e(90052),g=e(77714),c=e(2261),h=e(87822),u=e(90626),d=n.__importDefault(e(32518)),v={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}};t.REWRITE_DECORATION_INLINE_ADD="rewrite-decoration-inline-add";const f=o.default.memo(b=>{const{editor:y,onReady:S}=b,A=(0,E.useInjectable)(E.MonacoService),T=(0,o.useRef)(null),w=(0,o.useRef)(null),[D,I]=(0,o.useState)(null),[O,P]=(0,o.useState)(0),[R,M]=(0,o.useState)(null),k=(0,o.useCallback)((j,K,U)=>{const G=y.getModel().getEOL();let z=K.startLineNumber,$=K.startColumn;const Q=j.getModel();j.changeDecorations(ce=>{if(j){Q.getAllDecorations().map(ge=>ge.id).forEach(ge=>ce.removeDecoration(ge));for(const ge of U){if(ge.removed)continue;const Ae=ge.value.split(G);for(let te=0;te<Ae.length;te++){const Le=Ae[te];te!==0&&(z++,$=1),ge.added&&ce.addDecoration(new m.Range(z,$,z,$+Le.length),{description:t.REWRITE_DECORATION_INLINE_ADD,className:d.default.ghost_text_decoration_inline_add}),$+=Le.length}}}});const Z=j.getOption(m.editor.EditorOption.lineHeight);j?.setScrollTop(Math.max(K.startLineNumber-1,0)*Z);const X=z-K.startLineNumber,V=j.getOption(m.editor.EditorOption.fontInfo).spaceWidth,Y=j.getOption(m.editor.EditorOption.layoutInfo).contentLeft;let J=0;const re=Q.getOptions().tabSize;Array.from({length:X+1},(ce,ge)=>K.startLineNumber+ge).forEach(ce=>{const ge=Q.getLineContent(ce);let Ae=0;for(const te of ge)te===g.space?Ae+=re:Ae+=1,J=Math.max(J,Ae)}),I({width:J*V+Y*2,height:Z*(X+1)})},[D,y]);(0,o.useEffect)(()=>{if(y.getModel())return S&&S({getVirtualEditor:()=>R,renderVirtualEditor:(K,U,G)=>B(K,U,G),renderTextLineThrough:K=>x(K),layout:K=>N(K)}),()=>{R&&R.dispose(),w.current&&(0,E.runWhenIdle)(()=>{var K;(K=w.current)===null||K===void 0||K.unmount(),w.current=null})}},[y,S,R]);const B=(0,o.useCallback)((j,K,U)=>{if(!T.current)return;const G=y.getModel();if(!G)return;let z=R;if(!z){z=A.createCodeEditor(T.current,v);const $=u.StandaloneServices.get(h.IModelService),Q={languageId:G.getLanguageId(),onDidChange:E.Event.None},Z=$.createModel("",Q);z.setModel(Z),M(z)}z.setValue(j),k(z,K,U)},[T,R]),x=(0,o.useCallback)(j=>{if(!T.current)return;R&&(R.dispose(),M(null));const K=({changes:U})=>{const G=y.getOption(m.editor.EditorOption.lineHeight),z=y.getOption(m.editor.EditorOption.fontInfo).spaceWidth,$=(Z,X=d.default.ghost_text_decoration)=>o.default.createElement("span",{className:(0,r.default)(d.default.space_span,X),style:{width:`${z*Z}px`}},g.space.repeat(Z)),Q=(Z,X)=>o.default.createElement("span",{className:(0,r.default)(d.default.text_span,X)},Z);return o.default.createElement(o.default.Fragment,null,U.map((Z,X)=>{let V=!0,Y="",J=0;const re=[];for(const ce of Z){const{value:ge,added:Ae,removed:te}=ce;if(te)Y+=ge;else{V=!1,J+=ge.length;const Le=ge.length-ge.trimStart().length,Te=ge.length-ge.trimEnd().length,oe=ge.trim();re.push($(Le)),oe&&(re.push(Q(oe,Ae?d.default.ghost_text_decoration_inline_add:d.default.ghost_text_decoration)),re.push($(Te)))}}if(V){const ce=Y.length-Y.trimStart().length,ge=Y.length-Y.trimEnd().length,Ae=Y.trim();re.push($(ce,d.default.ghost_text_decoration_remove)),Ae&&(re.push(Q(Ae,d.default.ghost_text_decoration_inline_remove)),re.push($(ge,d.default.ghost_text_decoration_inline_remove)))}return o.default.createElement("div",{key:X,className:d.default.deletions_code_line,style:{height:`${G}px`}},re)}))};w.current&&(w.current.unmount(),w.current=null),w.current=l.default.createRoot(T.current),w.current.render(o.default.createElement(o.default.Fragment,null,j.map((U,G)=>o.default.createElement(K,{key:G,changes:U.changes}))))},[y,T,R,w]),N=(0,o.useCallback)(j=>{const K=y.getOption(m.editor.EditorOption.fontInfo).spaceWidth;let U=0;for(let G=j.startLineNumber;G<=j.endLineNumber;G++){const z=y.getModel().getLineMaxColumn(G);U=Math.max(U,z)}P(U*K+10)},[y]);return o.default.createElement("div",{className:d.default.rewrite_widget_container,style:{width:D?.width,height:D?.height,marginLeft:O}},o.default.createElement("div",{className:d.default.virtual_editor_container,ref:T}))});let a=class extends _.ReactInlineContentWidget{constructor(){super(...arguments),this.virtualEditorHandler=null,this.positionPreference=[s.ContentWidgetPositionPreference.EXACT],this.defered=new E.Deferred,this.updateFontStyle=()=>{const y=this.editor.getOption(m.editor.EditorOption.fontInfo);this.domNode.style.fontFamily=y.fontFamily,this.domNode.style.fontSize=y.fontSize+"px"}}renderView(){return this.updateFontStyle(),o.default.createElement(f,{editor:this.editor,onReady:y=>{this.defered.resolve(),this.virtualEditorHandler=y}})}id(){return"RewriteWidget"}show(y){const{position:S}=y;if(!S)return;const{lineNumber:A}=S;super.show({position:m.Position.lift({lineNumber:A,column:1})})}setInsertText(y){this.insertText=y}setEditArea(y){this.editArea=y}getEditArea(){return this.editArea}getVirtualEditor(){var y,S;return(S=(y=this.virtualEditorHandler)===null||y===void 0?void 0:y.getVirtualEditor())!==null&&S!==void 0?S:null}renderTextLineThrough(y){var S,A;(S=this.virtualEditorHandler)===null||S===void 0||S.renderTextLineThrough(y),(A=this.virtualEditorHandler)===null||A===void 0||A.layout(this.editArea)}renderVirtualEditor(y,S){this.virtualEditorHandler.renderVirtualEditor(y,this.editArea,S),this.virtualEditorHandler.layout(this.editArea)}accept(){(0,E.isUndefined)(this.insertText)||(this.editor.pushUndoStop(),this.editor.getModel().pushEditOperations(null,[c.EditOperation.replace(m.Range.lift(this.editArea),this.insertText)],()=>null))}};t.RewriteWidget=a,t.RewriteWidget=a=n.__decorate([(0,p.Injectable)({multiple:!0})],a)},19413:(L,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IAIInlineCompletionsProvider=t.EResultKind=t.EInlineChatStatus=t.ChatProxyServiceToken=t.IChatAgentService=t.IChatManagerService=t.IChatInternalService=t.ChatCompletionRequestMessageRoleEnum=t.AT_SIGN_SYMBOL=t.SLASH_SYMBOL=t.AI_MENUBAR_CONTAINER_VIEW_ID=t.AI_MENU_BAR_DEBUG_TOOLBAR=t.AI_CHAT_LOGO_AVATAR_ID=t.AI_CHAT_CONTAINER_ID=t.AI_CHAT_VIEW_ID=t.AIInlineChatContentWidget=t.IAINativeService=void 0;const n=e(43718),r=e(66338);t.IAINativeService=Symbol("IAINativeService"),t.AIInlineChatContentWidget=n.AIInlineChatContentWidgetId,t.AI_CHAT_VIEW_ID="AI-Chat",t.AI_CHAT_CONTAINER_ID="AI-Chat-Container",t.AI_CHAT_LOGO_AVATAR_ID="AI-Chat-Logo-Avatar",t.AI_MENU_BAR_DEBUG_TOOLBAR="AI_MENU_BAR_DEBUG_TOOLBAR",t.AI_MENUBAR_CONTAINER_VIEW_ID=r.DESIGN_MENUBAR_CONTAINER_VIEW_ID,t.SLASH_SYMBOL="/",t.AT_SIGN_SYMBOL="@";var o;(function(E){E.System="system",E.User="user",E.Assistant="assistant"})(o||(t.ChatCompletionRequestMessageRoleEnum=o={})),t.IChatInternalService=Symbol("IChatInternalService"),t.IChatManagerService=Symbol("IChatManagerService"),t.IChatAgentService=Symbol("IChatAgentService"),t.ChatProxyServiceToken=Symbol("ChatProxyServiceToken");var l;(function(E){E[E.READY=0]="READY",E[E.THINKING=1]="THINKING",E[E.DONE=2]="DONE",E[E.ERROR=3]="ERROR"})(l||(t.EInlineChatStatus=l={}));var p;(function(E){E.ACCEPT="ACCEPT",E.DISCARD="DISCARD",E.REGENERATE="REGENERATE"})(p||(t.EResultKind=p={})),t.IAIInlineCompletionsProvider=Symbol("IAIInlineCompletionsProvider")},69820:(L,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NearestCodeBlockType=void 0;var e;(function(n){n.Block="block",n.Line="line"})(e||(t.NearestCodeBlockType=e={}))},98864:(L,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractCodeBlocks=t.isDocumentValid=t.isDocumentTooShort=t.isDocumentTooLarge=void 0;const e="```",n=10,r=E=>{try{E.getText()}catch(m){if(m instanceof RangeError)return!0}return!1};t.isDocumentTooLarge=r;const o=E=>E.getText().length<n;t.isDocumentTooShort=o;const l=E=>!((0,t.isDocumentTooLarge)(E)||(0,t.isDocumentTooShort)(E));t.isDocumentValid=l;const p=E=>{const m=E.split(`
28353
28353
  `);let _=[],s=!1,g=0;return m.forEach((c,h)=>{if(!s&&c.startsWith(e))s=!0,g=h+1;else if(s&&c.startsWith(e)){s=!1;const u=h;_=m.slice(g,u)}s&&g!==h+1&&_.push(c)}),_.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/cli-engine",
3
- "version": "3.7.1-next-1738980928.0",
3
+ "version": "3.7.1-next-1739004986.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.7.1-next-1738980928.0",
30
- "@opensumi/ide-core-common": "3.7.1-next-1738980928.0",
31
- "@opensumi/ide-core-node": "3.7.1-next-1738980928.0",
32
- "@opensumi/ide-express-file-server": "3.7.1-next-1738980928.0",
33
- "@opensumi/ide-extension": "3.7.1-next-1738980928.0",
34
- "@opensumi/ide-i18n": "3.7.1-next-1738980928.0",
35
- "@opensumi/ide-main-layout": "3.7.1-next-1738980928.0",
36
- "@opensumi/ide-startup": "3.7.1-next-1738980928.0",
29
+ "@opensumi/ide-core-browser": "3.7.1-next-1739004986.0",
30
+ "@opensumi/ide-core-common": "3.7.1-next-1739004986.0",
31
+ "@opensumi/ide-core-node": "3.7.1-next-1739004986.0",
32
+ "@opensumi/ide-express-file-server": "3.7.1-next-1739004986.0",
33
+ "@opensumi/ide-extension": "3.7.1-next-1739004986.0",
34
+ "@opensumi/ide-i18n": "3.7.1-next-1739004986.0",
35
+ "@opensumi/ide-main-layout": "3.7.1-next-1739004986.0",
36
+ "@opensumi/ide-startup": "3.7.1-next-1739004986.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": "1409574fa0da2cd5c1fe2f7e4e294f742c310efe"
75
+ "gitHead": "6a9adb4d0b0e0198b063dcae9e40899a18d54159"
76
76
  }