| 381 | `),this.styleElement.textContent=i.join(` |
| 382 | `)}}const ive={listFocusBackground:"#7FB0D0",listActiveSelectionBackground:"#0E639C",listActiveSelectionForeground:"#FFFFFF",listActiveSelectionIconForeground:"#FFFFFF",listFocusAndSelectionOutline:"#90C2F9",listFocusAndSelectionBackground:"#094771",listFocusAndSelectionForeground:"#FFFFFF",listInactiveSelectionBackground:"#3F3F46",listInactiveSelectionIconForeground:"#FFFFFF",listHoverBackground:"#2A2D2E",listDropOverBackground:"#383B3D",listDropBetweenBackground:"#EEEEEE",treeIndentGuidesStroke:"#a9a9a9",treeInactiveIndentGuidesStroke:z.fromHex("#a9a9a9").transparent(.4).toString(),tableColumnsBorder:z.fromHex("#cccccc").transparent(.2).toString(),tableOddRowsBackgroundColor:z.fromHex("#cccccc").transparent(.04).toString(),listBackground:void 0,listFocusForeground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusForeground:void 0,listInactiveFocusBackground:void 0,listHoverForeground:void 0,listFocusOutline:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listHoverOutline:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0},nve={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}}};function sve(o,e){const t=o.indexOf(e);if(t===-1)return[];const i=[];let n=t-1;for(;n>=0&&o[n]===e-(t-n);)i.push(o[n--]);for(i.reverse(),n=t;n<o.length&&o[n]===e+(n-t);)i.push(o[n++]);return i}function wO(o,e){const t=[];let i=0,n=0;for(;i<o.length||n<e.length;)if(i>=o.length)t.push(e[n++]);else if(n>=e.length)t.push(o[i++]);else if(o[i]===e[n]){t.push(o[i]),i++,n++;continue}else o[i]<e[n]?t.push(o[i++]):t.push(e[n++]);return t}function ove(o,e){const t=[];let i=0,n=0;for(;i<o.length||n<e.length;)if(i>=o.length)t.push(e[n++]);else if(n>=e.length)t.push(o[i++]);else if(o[i]===e[n]){i++,n++;continue}else o[i]<e[n]?t.push(o[i++]):n++;return t}const Fq=(o,e)=>o-e;class rve{constructor(e,t){this._templateId=e,this.renderers=t}get templateId(){return this._templateId}renderTemplate(e){return this.renderers.map(t=>t.renderTemplate(e))}renderElement(e,t,i,n){let s=0;for(const r of this.renderers)r.renderElement(e,t,i[s++],n)}disposeElement(e,t,i,n){let s=0;for(const r of this.renderers)r.disposeElement?.(e,t,i[s],n),s+=1}disposeTemplate(e){let t=0;for(const i of this.renderers)i.disposeTemplate(e[t++])}}class ave{constructor(e){this.accessibilityProvider=e,this.templateId="a18n"}renderTemplate(e){return{container:e,disposables:new V}}renderElement(e,t,i){const n=this.accessibilityProvider.getAriaLabel(e),s=n&&typeof n!="string"?n:Et(n);i.disposables.add(Se(a=>{this.setAriaLabel(a.readObservable(s),i.container)}));const r=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(e);typeof r=="number"?i.container.setAttribute("aria-level",`${r}`):i.container.removeAttribute("aria-level")}setAriaLabel(e,t){e?t.setAttribute("aria-label",e):t.removeAttribute("aria-label")}disposeElement(e,t,i){i.disposables.clear()}disposeTemplate(e){e.disposables.dispose()}}class lve{constructor(e,t){this.list=e,this.dnd=t}getDragElements(e){const t=this.list.getSelectedElements();return t.indexOf(e)>-1?t:[e]}getDragURI(e){return this.dnd.getDragURI(e)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e,t)}onDragStart(e,t){this.dnd.onDragStart?.(e,t)}onDragOver(e,t,i,n,s){return this.dnd.onDragOver(e,t,i,n,s)}onDragLeave(e,t,i,n){this.dnd.onDragLeave?.(e,t,i,n)}onDragEnd(e){this.dnd.onDragEnd?.(e)}drop(e,t,i,n,s){this.dnd.drop(e,t,i,n,s)}dispose(){this.dnd.dispose()}}class Ko{get onDidChangeFocus(){return ie.map(this.eventBufferer.wrapEvent(this.focus.onChange),e=>this.toListEvent(e),this.disposables)}get onDidChangeSelection(){return ie.map(this.eventBufferer.wrapEvent(this.selection.onChange),e=>this.toListEvent(e),this.disposables)}get domId(){return this.view.domId}get onDidScroll(){return this.view.onDidScroll}get onMouseClick(){return this.view.onMouseClick}get onMouseDblClick(){return this.view.onMouseDblClick}get onMouseMiddleClick(){return this.view.onMouseMiddleClick}get onPointer(){return this.mouseController.onPointer}get onMouseDown(){return this.view.onMouseDown}get onMouseOver(){return this.view.onMouseOver}get onMouseOut(){return this.view.onMouseOut}get onTouchStart(){return this.view.onTouchStart}get onTap(){return this.view.onTap}get onContextMenu(){let e=!1;const t=ie.chain(this.disposables.add(new mt(this.view.domNode,"keydown")).event,s=>s.map(r=>new yt(r)).filter(r=>e=r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>st.stop(r,!0)).filter(()=>!1)),i=ie.chain(this.disposables.add(new mt(this.view.domNode,"keyup")).event,s=>s.forEach(()=>e=!1).map(r=>new yt(r)).filter(r=>r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>st.stop(r,!0)).map(({browserEvent:r})=>{const a=this.getFocus(),l=a.length?a[0]:void 0,c=typeof l<"u"?this.view.element(l):void 0,d=typeof l<"u"?this.view.domElement(l):this.view.domNode;return{index:l,element:c,anchor:d,browserEvent:r}})),n=ie.chain(this.view.onContextMenu,s=>s.filter(r=>!e).map(({element:r,index:a,browserEvent:l})=>({element:r,index:a,anchor:new yn(me(this.view.domNode),l),browserEvent:l})));return ie.any(t,i,n)}get onKeyDown(){return this.disposables.add(new mt(this.view.domNode,"keydown")).event}get onDidFocus(){return ie.signal(this.disposables.add(new mt(this.view.domNode,"focus",!0)).event)}get onDidBlur(){return ie.signal(this.disposables.add(new mt(this.view.domNode,"blur",!0)).event)}constructor(e,t,i,n,s=nve){this.user=e,this._options=s,this.focus=new ak("focused"),this.anchor=new ak("anchor"),this.eventBufferer=new hv,this._ariaLabel="",this.disposables=new V,this._onDidDispose=new A,this.onDidDispose=this._onDidDispose.event;const r=this._options.accessibilityProvider&&this._options.accessibilityProvider.getWidgetRole?this._options.accessibilityProvider?.getWidgetRole():"list";this.selection=new GCe(r!=="listbox");const a=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=s.accessibilityProvider,this.accessibilityProvider&&(a.push(new ave(this.accessibilityProvider)),this.accessibilityProvider.onDidChangeActiveDescendant?.(this.onDidChangeActiveDescendant,this,this.disposables)),n=n.map(c=>new rve(c.templateId,[...a,c]));const l={...s,dnd:s.dnd&&new lve(this,s.dnd)};if(this.view=this.createListView(t,i,n,l),this.view.domNode.setAttribute("role",r),s.styleController)this.styleController=s.styleController(this.view.domId);else{const c=Er(this.view.domNode);this.styleController=new tve(c,this.view.domId)}if(this.spliceable=new OCe([new vO(this.focus,this.view,s.identityProvider),new vO(this.selection,this.view,s.identityProvider),new vO(this.anchor,this.view,s.identityProvider),this.view]),this.disposables.add(this.focus),this.disposables.add(this.selection),this.disposables.add(this.anchor),this.disposables.add(this.view),this.disposables.add(this._onDidDispose),this.disposables.add(new JCe(this,this.view)),(typeof s.keyboardSupport!="boolean"||s.keyboardSupport)&&(this.keyboardController=new Rq(this,this.view,s),this.disposables.add(this.keyboardController)),s.keyboardNavigationLabelProvider){const c=s.keyboardNavigationDelegate||XCe;this.typeNavigationController=new QCe(this,this.view,s.keyboardNavigationLabelProvider,s.keyboardNavigationEventFilter??(()=>!0),c),this.disposables.add(this.typeNavigationController)}if(this.mouseController=this.createMouseController(s),this.disposables.add(this.mouseController),this.onDidChangeFocus(this._onFocusChange,this,this.disposables),this.onDidChangeSelection(this._onSelectionChange,this,this.disposables),this.accessibilityProvider){const c=this.accessibilityProvider.getWidgetAriaLabel(),d=c&&typeof c!="string"?c:Et(c);this.disposables.add(Se(h=>{this.ariaLabel=h.readObservable(d)}))}this._options.multipleSelectionSupport!==!1&&this.view.domNode.setAttribute("aria-multiselectable","true")}createListView(e,t,i,n){return new sa(e,t,i,n)}createMouseController(e){return new Oq(this)}updateOptions(e={}){this._options={...this._options,...e},this.typeNavigationController?.updateOptions(this._options),this._options.multipleSelectionController!==void 0&&(this._options.multipleSelectionSupport?this.view.domNode.setAttribute("aria-multiselectable","true"):this.view.domNode.removeAttribute("aria-multiselectable")),this.mouseController.updateOptions(e),this.keyboardController?.updateOptions(e),this.view.updateOptions(e)}get options(){return this._options}splice(e,t,i=[]){if(e<0||e>this.view.length)throw new pg(this.user,`Invalid start index: ${e}`);if(t<0)throw new pg(this.user,`Invalid delete count: ${t}`);t===0&&i.length===0||this.eventBufferer.bufferEvents(()=>this.spliceable.splice(e,t,i))}rerender(){this.view.rerender()}element(e){return this.view.element(e)}indexOf(e){return this.view.indexOf(e)}indexAt(e){return this.view.indexAt(e)}get length(){return this.view.length}get contentHeight(){return this.view.contentHeight}get onDidChangeContentHeight(){return this.view.onDidChangeContentHeight}get scrollTop(){return this.view.getScrollTop()}set scrollTop(e){this.view.setScrollTop(e)}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get firstVisibleIndex(){return this.view.firstVisibleIndex}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){this._ariaLabel=e,this.view.domNode.setAttribute("aria-label",e)}domFocus(){this.view.domNode.focus({preventScroll:!0})}layout(e,t){this.view.layout(e,t)}setSelection(e,t){for(const i of e)if(i<0||i>=this.length)throw new pg(this.user,`Invalid index ${i}`);this.selection.set(e,t)}getSelection(){return this.selection.get()}getSelectedElements(){return this.getSelection().map(e=>this.view.element(e))}setAnchor(e){if(typeof e>"u"){this.anchor.set([]);return}if(e<0||e>=this.length)throw new pg(this.user,`Invalid index ${e}`);this.anchor.set([e])}getAnchor(){return this.anchor.get().at(0)}getAnchorElement(){const e=this.getAnchor();return typeof e>"u"?void 0:this.element(e)}setFocus(e,t){for(const i of e)if(i<0||i>=this.length)throw new pg(this.user,`Invalid index ${i}`);this.focus.set(e,t)}focusNext(e=1,t=!1,i,n){if(this.length===0)return;const s=this.focus.get(),r=this.findNextIndex(s.length>0?s[0]+e:0,t,n);r>-1&&this.setFocus([r],i)}focusPrevious(e=1,t=!1,i,n){if(this.length===0)return;const s=this.focus.get(),r=this.findPreviousIndex(s.length>0?s[0]-e:0,t,n);r>-1&&this.setFocus([r],i)}async focusNextPage(e,t){let i=this.view.indexAt(this.view.getScrollTop()+this.view.renderHeight);i=i===0?0:i-1;const n=this.getFocus()[0];if(n!==i&&(n===void 0||i>n)){const s=this.findPreviousIndex(i,!1,t);s>-1&&n!==s?this.setFocus([s],e):this.setFocus([i],e)}else{const s=this.view.getScrollTop();let r=s+this.view.renderHeight;i>n&&(r-=this.view.elementHeight(i)),this.view.setScrollTop(r),this.view.getScrollTop()!==s&&(this.setFocus([]),await dl(0),await this.focusNextPage(e,t))}}async focusPreviousPage(e,t,i=()=>0){let n;const s=i(),r=this.view.getScrollTop()+s;r===0?n=this.view.indexAt(r):n=this.view.indexAfter(r-1);const a=this.getFocus()[0];if(a!==n&&(a===void 0||a>=n)){const l=this.findNextIndex(n,!1,t);l>-1&&a!==l?this.setFocus([l],e):this.setFocus([n],e)}else{const l=r;this.view.setScrollTop(r-this.view.renderHeight-s),this.view.getScrollTop()+i()!==l&&(this.setFocus([]),await dl(0),await this.focusPreviousPage(e,t,i))}}focusLast(e,t){if(this.length===0)return;const i=this.findPreviousIndex(this.length-1,!1,t);i>-1&&this.setFocus([i],e)}focusFirst(e,t){this.focusNth(0,e,t)}focusNth(e,t,i){if(this.length===0)return;const n=this.findNextIndex(e,!1,i);n>-1&&this.setFocus([n],t)}findNextIndex(e,t=!1,i){for(let n=0;n<this.length;n++){if(e>=this.length&&!t)return-1;if(e=e%this.length,!i||i(this.element(e)))return e;e++}return-1}findPreviousIndex(e,t=!1,i){for(let n=0;n<this.length;n++){if(e<0&&!t)return-1;if(e=(this.length+e%this.length)%this.length,!i||i(this.element(e)))return e;e--}return-1}getFocus(){return this.focus.get()}getFocusedElements(){return this.getFocus().map(e=>this.view.element(e))}reveal(e,t,i=0){if(e<0||e>=this.length)throw new pg(this.user,`Invalid index ${e}`);const n=this.view.getScrollTop(),s=this.view.elementTop(e),r=this.view.elementHeight(e);if(Cc(t)){const a=r-this.view.renderHeight+i;this.view.setScrollTop(a*Es(t,0,1)+s-i)}else{const a=s+r,l=n+this.view.renderHeight;s<n+i&&a>=l||(s<n+i||a>=l&&r>=this.view.renderHeight?this.view.setScrollTop(s-i):a>=l&&this.view.setScrollTop(a-this.view.renderHeight))}}getRelativeTop(e,t=0){if(e<0||e>=this.length)throw new pg(this.user,`Invalid index ${e}`);const i=this.view.getScrollTop(),n=this.view.elementTop(e),s=this.view.elementHeight(e);if(n<i+t||n+s>i+this.view.renderHeight)return null;const r=s-this.view.renderHeight+t;return Math.abs((i+t-n)/r)}getHTMLElement(){return this.view.domNode}getScrollableElement(){return this.view.scrollableElementDomNode}getElementID(e){return this.view.getElementDomId(e)}getElementTop(e){return this.view.elementTop(e)}style(e){this.styleController.style(e)}toListEvent({indexes:e,browserEvent:t}){return{indexes:e,elements:e.map(i=>this.view.element(i)),browserEvent:t}}_onFocusChange(){const e=this.focus.get();this.view.domNode.classList.toggle("element-focused",e.length>0),this.onDidChangeActiveDescendant()}onDidChangeActiveDescendant(){const e=this.focus.get();if(e.length>0){let t;this.accessibilityProvider?.getActiveDescendantId&&(t=this.accessibilityProvider.getActiveDescendantId(this.view.element(e[0]))),this.view.domNode.setAttribute("aria-activedescendant",t||this.view.getElementDomId(e[0]))}else this.view.domNode.removeAttribute("aria-activedescendant")}_onSelectionChange(){const e=this.selection.get();this.view.domNode.classList.toggle("selection-none",e.length===0),this.view.domNode.classList.toggle("selection-single",e.length===1),this.view.domNode.classList.toggle("selection-multiple",e.length>1)}dispose(){this._onDidDispose.fire(),this.disposables.dispose(),this._onDidDispose.dispose()}}$h([vi],Ko.prototype,"onDidChangeFocus",null),$h([vi],Ko.prototype,"onDidChangeSelection",null),$h([vi],Ko.prototype,"onContextMenu",null),$h([vi],Ko.prototype,"onKeyDown",null),$h([vi],Ko.prototype,"onDidFocus",null),$h([vi],Ko.prototype,"onDidBlur",null);const _g=ee,Wq="selectOption.entry.template";class cve{get templateId(){return Wq}renderTemplate(e){const t=Object.create(null);return t.root=e,t.text=Y(e,_g(".option-text")),t.detail=Y(e,_g(".option-detail")),t.decoratorRight=Y(e,_g(".option-decorator-right")),t}renderElement(e,t,i){const n=i,s=e.text,r=e.detail,a=e.decoratorRight,l=e.isDisabled;n.text.textContent=s,n.detail.textContent=r||"",n.decoratorRight.textContent=a||"",l?n.root.classList.add("option-disabled"):n.root.classList.remove("option-disabled")}disposeTemplate(e){}}const dc=class dc extends P{constructor(e,t,i,n,s){super(),this.options=[],this._currentSelection=0,this._hasDetails=!1,this._selectionDetailsDisposables=this._register(new V),this._skipLayout=!1,this._sticky=!1,this._isVisible=!1,this.styles=n,this.selectBoxOptions=s||Object.create(null),typeof this.selectBoxOptions.minBottomMargin!="number"?this.selectBoxOptions.minBottomMargin=dc.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN:this.selectBoxOptions.minBottomMargin<0&&(this.selectBoxOptions.minBottomMargin=0),this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box monaco-select-box-dropdown-padding",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=new A,this._register(this._onDidSelect),this.registerListeners(),this.constructSelectDropDown(i),this.selected=t||0,e&&this.setOptions(e,t),this.initStyleSheet()}setTitle(e){!this._hover&&e?this._hover=this._register(na().setupManagedHover(Tl("mouse"),this.selectElement,e)):this._hover&&this._hover.update(e)}getHeight(){return 22}getTemplateId(){return Wq}constructSelectDropDown(e){this.contextViewProvider=e,this.selectDropDownContainer=ee(".monaco-select-box-dropdown-container"),this.selectDropDownContainer.classList.add("monaco-select-box-dropdown-padding"),this.selectionDetailsPane=Y(this.selectDropDownContainer,_g(".select-box-details-pane"));const t=Y(this.selectDropDownContainer,_g(".select-box-dropdown-container-width-control")),i=Y(t,_g(".width-control-div"));this.widthControlElement=document.createElement("span"),this.widthControlElement.className="option-text-width-control",Y(i,this.widthControlElement),this._dropDownPosition=0,this.styleElement=Er(this.selectDropDownContainer),this.selectDropDownContainer.setAttribute("draggable","true"),this._register(W(this.selectDropDownContainer,te.DRAG_START,n=>{st.stop(n,!0)}))}registerListeners(){this._register(Si(this.selectElement,"change",t=>{this.selected=t.target.selectedIndex,this._onDidSelect.fire({index:t.target.selectedIndex,selected:t.target.value}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)})),this._register(W(this.selectElement,te.CLICK,t=>{st.stop(t),this._isVisible?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(W(this.selectElement,te.MOUSE_DOWN,t=>{st.stop(t)}));let e;this._register(W(this.selectElement,"touchstart",t=>{e=this._isVisible})),this._register(W(this.selectElement,"touchend",t=>{st.stop(t),e?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(W(this.selectElement,te.KEY_DOWN,t=>{const i=new yt(t);let n=!1;ze?(i.keyCode===18||i.keyCode===16||i.keyCode===10||i.keyCode===3)&&(n=!0):(i.keyCode===18&&i.altKey||i.keyCode===16&&i.altKey||i.keyCode===10||i.keyCode===3)&&(n=!0),n&&(this.showSelectDropDown(),st.stop(t,!0))}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){Ut(this.options,e)||(this.options=e,this.selectElement.options.length=0,this._hasDetails=!1,this._cachedMaxDetailsHeight=void 0,this.options.forEach((i,n)=>{this.selectElement.add(this.createOption(i.text,n,i.isDisabled)),typeof i.description=="string"&&(this._hasDetails=!0)})),t!==void 0&&(this.select(t),this._currentSelection=this.selected)}setOptionsList(){this.selectList?.splice(0,this.selectList.length,this.options)}select(e){e>=0&&e<this.options.length?this.selected=e:e>this.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)}focus(){this.selectElement&&(this.selectElement.tabIndex=0,this.selectElement.focus())}blur(){this.selectElement&&(this.selectElement.tabIndex=-1,this.selectElement.blur())}setFocusable(e){this.selectElement.tabIndex=e?0:-1}render(e){this.container=e,e.classList.add("select-container"),e.appendChild(this.selectElement),this.styleSelectElement()}initStyleSheet(){const e=[];this.styles.listFocusBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { background-color: ${this.styles.listFocusBackground} !important; }`),this.styles.listFocusForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { color: ${this.styles.listFocusForeground} !important; }`),this.styles.decoratorRightForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.focused) .option-decorator-right { color: ${this.styles.decoratorRightForeground}; }`),this.styles.selectBackground&&this.styles.selectBorder&&this.styles.selectBorder!==this.styles.selectBackground?(e.push(`.monaco-select-box-dropdown-container { border: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectBorder} } `)):this.styles.selectListBorder&&(e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectListBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectListBorder} } `)),this.styles.listHoverForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { color: ${this.styles.listHoverForeground} !important; }`),this.styles.listHoverBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { background-color: ${this.styles.listHoverBackground} !important; }`),this.styles.listFocusOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { outline: 1.6px dotted ${this.styles.listFocusOutline} !important; outline-offset: -1.6px !important; }`),this.styles.listHoverOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { outline: 1.6px dashed ${this.styles.listHoverOutline} !important; outline-offset: -1.6px !important; }`),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled.focused { background-color: transparent !important; color: inherit !important; outline: none !important; }"),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled:hover { background-color: transparent !important; color: inherit !important; outline: none !important; }"),this.styleElement.textContent=e.join(` |
| 383 | `)}styleSelectElement(){const e=this.styles.selectBackground??"",t=this.styles.selectForeground??"",i=this.styles.selectBorder??"";this.selectElement.style.backgroundColor=e,this.selectElement.style.color=t,this.selectElement.style.borderColor=i}styleList(){const e=this.styles.selectBackground??"",t=dd(this.styles.selectListBackground,e);this.selectDropDownListContainer.style.backgroundColor=t,this.selectionDetailsPane.style.backgroundColor=t;const i=this.styles.focusBorder??"";this.selectDropDownContainer.style.outlineColor=i,this.selectDropDownContainer.style.outlineOffset="-1px",this.selectList.style(this.styles)}createOption(e,t,i){const n=document.createElement("option");return n.value=e,n.text=e,n.disabled=!!i,n}showSelectDropDown(){this.selectionDetailsPane.textContent="",!(!this.contextViewProvider||this._isVisible)&&(this.createSelectList(this.selectDropDownContainer),this.setOptionsList(),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e,!0),layout:()=>{this.layoutSelectDropDown()},onHide:()=>{this.selectDropDownContainer.classList.remove("visible"),this.selectElement.classList.remove("synthetic-focus")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._isVisible=!0,this.hideSelectDropDown(!1),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e),layout:()=>this.layoutSelectDropDown(),onHide:()=>{this.selectDropDownContainer.classList.remove("visible"),this.selectElement.classList.remove("synthetic-focus")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._currentSelection=this.selected,this._isVisible=!0,this.selectElement.setAttribute("aria-expanded","true"))}hideSelectDropDown(e){!this.contextViewProvider||!this._isVisible||(this._isVisible=!1,this.selectElement.setAttribute("aria-expanded","false"),e&&this.selectElement.focus(),this.contextViewProvider.hideContextView())}renderSelectDropDown(e,t){return e.appendChild(this.selectDropDownContainer),this.layoutSelectDropDown(t),{dispose:()=>{this.selectDropDownContainer.remove()}}}measureMaxDetailsHeight(){let e=0;return this.options.forEach((t,i)=>{this.updateDetail(i),this.selectionDetailsPane.offsetHeight>e&&(e=this.selectionDetailsPane.offsetHeight)}),e}layoutSelectDropDown(e){if(this._skipLayout)return!1;if(this.selectList){this.selectDropDownContainer.classList.add("visible");const t=me(this.selectElement),i=ai(this.selectElement),n=me(this.selectElement).getComputedStyle(this.selectElement),s=parseFloat(n.getPropertyValue("--dropdown-padding-top"))+parseFloat(n.getPropertyValue("--dropdown-padding-bottom")),r=t.innerHeight-i.top-i.height-(this.selectBoxOptions.minBottomMargin||0),a=i.top-dc.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN,l=this.selectElement.offsetWidth,c=this.setWidthControlElement(this.widthControlElement),d=Math.max(c,Math.round(l)).toString()+"px";this.selectDropDownContainer.style.width=d,this.selectList.getHTMLElement().style.height="",this.selectList.layout();let h=this.selectList.contentHeight;this._hasDetails&&this._cachedMaxDetailsHeight===void 0&&(this._cachedMaxDetailsHeight=this.measureMaxDetailsHeight());const u=this._hasDetails?this._cachedMaxDetailsHeight:0,f=h+s+u,g=Math.floor((r-s-u)/this.getHeight()),p=Math.floor((a-s-u)/this.getHeight());if(e)return i.top+i.height>t.innerHeight-22||i.top<dc.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN||g<1&&p<1?!1:(g<dc.DEFAULT_MINIMUM_VISIBLE_OPTIONS&&p>g&&this.options.length>g?(this._dropDownPosition=1,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectionDetailsPane.classList.remove("border-top"),this.selectionDetailsPane.classList.add("border-bottom")):(this._dropDownPosition=0,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectionDetailsPane.classList.remove("border-bottom"),this.selectionDetailsPane.classList.add("border-top")),!0);if(i.top+i.height>t.innerHeight-22||i.top<dc.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN||this._dropDownPosition===0&&g<1||this._dropDownPosition===1&&p<1)return this.hideSelectDropDown(!0),!1;if(this._dropDownPosition===0){if(this._isVisible&&g+p<1)return this.hideSelectDropDown(!0),!1;f>r&&(h=g*this.getHeight())}else f>a&&(h=p*this.getHeight());return this.selectList.layout(h),this.selectList.domFocus(),this.selectList.length>0&&(this.selectList.setFocus([this.selected||0]),this.selectList.reveal(this.selectList.getFocus()[0]||0)),this._hasDetails?(this.selectList.getHTMLElement().style.height=h+s+"px",this.selectDropDownContainer.style.height=""):this.selectDropDownContainer.style.height=h+s+"px",this.updateDetail(this.selected),this.selectDropDownContainer.style.width=d,this.selectDropDownListContainer.setAttribute("tabindex","0"),this.selectElement.classList.add("synthetic-focus"),this.selectDropDownContainer.classList.add("synthetic-focus"),!0}else return!1}setWidthControlElement(e){let t=0;if(e){let i=0,n=0;this.options.forEach((s,r)=>{const a=s.detail?s.detail.length:0,l=s.decoratorRight?s.decoratorRight.length:0,c=s.text.length+a+l;c>n&&(i=r,n=c)}),e.textContent=this.options[i].text+(this.options[i].decoratorRight?this.options[i].decoratorRight+" ":""),t=fo(e)}return t}createSelectList(e){if(this.selectList)return;this.selectDropDownListContainer=Y(e,_g(".select-box-dropdown-list-container")),this.listRenderer=new cve,this.selectList=this._register(new Ko("SelectBoxCustom",this.selectDropDownListContainer,this,[this.listRenderer],{useShadows:!1,verticalScrollMode:3,keyboardSupport:!1,mouseSupport:!1,accessibilityProvider:{getAriaLabel:n=>{let s=n.text;return n.detail&&(s+=`. ${n.detail}`),n.decoratorRight&&(s+=`. ${n.decoratorRight}`),n.description&&(s+=`. ${n.description}`),s},getWidgetAriaLabel:()=>m(16,"Select Box"),getRole:()=>ze?"":"option",getWidgetRole:()=>"listbox"}})),this.selectBoxOptions.ariaLabel&&(this.selectList.ariaLabel=this.selectBoxOptions.ariaLabel);const t=this._register(new mt(this.selectDropDownListContainer,"keydown")),i=ie.chain(t.event,n=>n.filter(()=>this.selectList.length>0).map(s=>new yt(s)));this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===3))(this.onEnter,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===2))(this.onEnter,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===9))(this.onEscape,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===16))(this.onUpArrow,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===18))(this.onDownArrow,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===12))(this.onPageDown,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===11))(this.onPageUp,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===14))(this.onHome,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===13))(this.onEnd,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode>=21&&s.keyCode<=56||s.keyCode>=85&&s.keyCode<=113))(this.onCharacter,this)),this._register(W(this.selectList.getHTMLElement(),te.POINTER_UP,n=>this.onPointerUp(n))),this._register(this.selectList.onMouseOver(n=>typeof n.index<"u"&&this.selectList.setFocus([n.index]))),this._register(this.selectList.onDidChangeFocus(n=>this.onListFocus(n))),this._register(W(this.selectDropDownContainer,te.FOCUS_OUT,n=>{!this._isVisible||Qi(n.relatedTarget,this.selectDropDownContainer)||this.onListBlur()})),this.selectList.getHTMLElement().setAttribute("aria-label",this.selectBoxOptions.ariaLabel||""),this.selectList.getHTMLElement().setAttribute("aria-expanded","true"),this.styleList()}onPointerUp(e){if(!this.selectList.length)return;st.stop(e);const t=e.target;if(!t||t.classList.contains("slider"))return;const i=t.closest(".monaco-list-row");if(!i)return;const n=Number(i.getAttribute("data-index")),s=i.classList.contains("option-disabled");n>=0&&n<this.options.length&&!s&&(this.selected=n,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0]),this.selected!==this._currentSelection&&(this._currentSelection=this.selected,this._onDidSelect.fire({index:this.selectElement.selectedIndex,selected:this.options[this.selected].text}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)),this.hideSelectDropDown(!0))}onListBlur(){this._sticky||(this.selected!==this._currentSelection&&this.select(this._currentSelection),this.hideSelectDropDown(!1))}renderDescriptionMarkdown(e,t){const i=s=>{for(let r=0;r<s.childNodes.length;r++){const a=s.childNodes.item(r);(a.tagName&&a.tagName.toLowerCase())==="img"?a.remove():i(a)}},n=cw({value:e,supportThemeIcons:!0},{actionHandler:t});return n.element.classList.add("select-box-description-markdown"),i(n.element),n}onListFocus(e){!this._isVisible||!this._hasDetails||this.updateDetail(e.indexes[0])}updateDetail(e){this._selectionDetailsDisposables.clear(),this.selectionDetailsPane.textContent="";const t=this.options[e],i=t?.description??"",n=t?.descriptionIsMarkdown??!1;if(i){if(n){const s=t.descriptionMarkdownActionHandler,r=this._selectionDetailsDisposables.add(this.renderDescriptionMarkdown(i,s));this.selectionDetailsPane.appendChild(r.element)}else this.selectionDetailsPane.textContent=i;this.selectionDetailsPane.style.display="block"}else this.selectionDetailsPane.style.display="none";this._skipLayout=!0,this.contextViewProvider.layout(),this._skipLayout=!1}onEscape(e){st.stop(e),this.select(this._currentSelection),this.hideSelectDropDown(!0)}onEnter(e){st.stop(e),this.selected!==this._currentSelection&&(this._currentSelection=this.selected,this._onDidSelect.fire({index:this.selectElement.selectedIndex,selected:this.options[this.selected].text}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)),this.hideSelectDropDown(!0)}onDownArrow(e){if(this.selected<this.options.length-1){st.stop(e,!0);const t=this.options[this.selected+1].isDisabled;if(t&&this.options.length>this.selected+2)this.selected+=2;else{if(t)return;this.selected++}this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0])}}onUpArrow(e){this.selected>0&&(st.stop(e,!0),this.options[this.selected-1].isDisabled&&this.selected>1?this.selected-=2:this.selected--,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0]))}onPageUp(e){st.stop(e),this.selectList.focusPreviousPage(),setTimeout(()=>{this.selected=this.selectList.getFocus()[0],this.options[this.selected].isDisabled&&this.selected<this.options.length-1&&(this.selected++,this.selectList.setFocus([this.selected])),this.selectList.reveal(this.selected),this.select(this.selected)},1)}onPageDown(e){st.stop(e),this.selectList.focusNextPage(),setTimeout(()=>{this.selected=this.selectList.getFocus()[0],this.options[this.selected].isDisabled&&this.selected>0&&(this.selected--,this.selectList.setFocus([this.selected])),this.selectList.reveal(this.selected),this.select(this.selected)},1)}onHome(e){st.stop(e),!(this.options.length<2)&&(this.selected=0,this.options[this.selected].isDisabled&&this.selected>1&&this.selected++,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onEnd(e){st.stop(e),!(this.options.length<2)&&(this.selected=this.options.length-1,this.options[this.selected].isDisabled&&this.selected>1&&this.selected--,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onCharacter(e){const t=Sc.toString(e.keyCode);let i=-1;for(let n=0;n<this.options.length-1;n++)if(i=(n+this.selected+1)%this.options.length,this.options[i].text.charAt(0).toUpperCase()===t&&!this.options[i].isDisabled){this.select(i),this.selectList.setFocus([i]),this.selectList.reveal(this.selectList.getFocus()[0]),st.stop(e);break}}dispose(){this.hideSelectDropDown(!1),super.dispose()}};dc.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN=32,dc.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN=2,dc.DEFAULT_MINIMUM_VISIBLE_OPTIONS=3;let SO=dc;class dve extends P{constructor(e,t,i,n){super(),this.selected=0,this.selectBoxOptions=n||Object.create(null),this.options=[],this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=this._register(new A),this.styles=i,this.registerListeners(),this.setOptions(e,t)}registerListeners(){this._register(qn.addTarget(this.selectElement)),[At.Tap].forEach(e=>{this._register(W(this.selectElement,e,t=>{this.selectElement.focus()}))}),this._register(Si(this.selectElement,"click",e=>{st.stop(e,!0)})),this._register(Si(this.selectElement,"change",e=>{this.selectElement.title=e.target.value,this._onDidSelect.fire({index:e.target.selectedIndex,selected:e.target.value})})),this._register(Si(this.selectElement,"keydown",e=>{let t=!1;ze?(e.keyCode===18||e.keyCode===16||e.keyCode===10)&&(t=!0):(e.keyCode===18&&e.altKey||e.keyCode===10||e.keyCode===3)&&(t=!0),t&&e.stopPropagation()}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){(!this.options||!Ut(this.options,e))&&(this.options=e,this.selectElement.options.length=0,this.options.forEach((i,n)=>{this.selectElement.add(this.createOption(i.text,n,i.isDisabled))})),t!==void 0&&this.select(t)}select(e){this.options.length===0?this.selected=0:e>=0&&e<this.options.length?this.selected=e:e>this.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.selected<this.options.length&&typeof this.options[this.selected].text=="string"?this.selectElement.title=this.options[this.selected].text:this.selectElement.title=""}focus(){this.selectElement&&(this.selectElement.tabIndex=0,this.selectElement.focus())}blur(){this.selectElement&&(this.selectElement.tabIndex=-1,this.selectElement.blur())}setFocusable(e){this.selectElement.tabIndex=e?0:-1}render(e){e.classList.add("select-container"),e.appendChild(this.selectElement),this.setOptions(this.options,this.selected),this.applyStyles()}applyStyles(){this.selectElement&&(this.selectElement.style.backgroundColor=this.styles.selectBackground??"",this.selectElement.style.color=this.styles.selectForeground??"",this.selectElement.style.borderColor=this.styles.selectBorder??"")}createOption(e,t,i){const n=document.createElement("option");return n.value=e,n.text=e,n.disabled=!!i,n}}class hve extends mo{constructor(e,t,i,n,s){super(),ze&&!s?.useCustomDrawn?this.selectBoxDelegate=new dve(e,t,n,s):this.selectBoxDelegate=new SO(e,t,i,n,s),this._register(this.selectBoxDelegate)}get onDidSelect(){return this.selectBoxDelegate.onDidSelect}setOptions(e,t){this.selectBoxDelegate.setOptions(e,t)}select(e){this.selectBoxDelegate.select(e)}focus(){this.selectBoxDelegate.focus()}blur(){this.selectBoxDelegate.blur()}setFocusable(e){this.selectBoxDelegate.setFocusable(e)}render(e){this.selectBoxDelegate.render(e)}}class za extends P{get action(){return this._action}constructor(e,t,i={}){super(),this.options=i,this._context=e||this,this._action=t,t instanceof Po&&this._register(t.onDidChange(n=>{this.element&&this.handleActionChangeEvent(n)}))}handleActionChangeEvent(e){e.enabled!==void 0&&this.updateEnabled(),e.checked!==void 0&&this.updateChecked(),e.class!==void 0&&this.updateClass(),e.label!==void 0&&(this.updateLabel(),this.updateTooltip()),e.tooltip!==void 0&&this.updateTooltip()}get actionRunner(){return this._actionRunner||(this._actionRunner=this._register(new mf)),this._actionRunner}set actionRunner(e){this._actionRunner=e}isEnabled(){return this._action.enabled}setActionContext(e){this._context=e}render(e){const t=this.element=e;this._register(qn.addTarget(e));const i=this.options&&this.options.draggable;i&&(e.draggable=!0,Bs&&this._register(W(e,te.DRAG_START,n=>n.dataTransfer?.setData(lg.TEXT,this._action.label)))),this._register(W(t,At.Tap,n=>this.onClick(n,!0))),this._register(W(t,te.MOUSE_DOWN,n=>{i||st.stop(n,!0),this._action.enabled&&n.button===0&&t.classList.add("active")})),ze&&this._register(W(t,te.CONTEXT_MENU,n=>{n.button===0&&n.ctrlKey===!0&&this.onClick(n)})),this._register(W(t,te.CLICK,n=>{st.stop(n,!0),this.options&&this.options.isMenu||this.onClick(n)})),this._register(W(t,te.DBLCLICK,n=>{st.stop(n,!0)})),[te.MOUSE_UP,te.MOUSE_OUT].forEach(n=>{this._register(W(t,n,s=>{st.stop(s),t.classList.remove("active")}))})}onClick(e,t=!1){st.stop(e,!0);const i=fr(this._context)?this.options?.useEventAsContext?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._action,i)}focus(){this.element&&(this.element.tabIndex=0,this.element.focus(),this.element.classList.add("focused"))}blur(){this.element&&(this.element.blur(),this.element.tabIndex=-1,this.element.classList.remove("focused"))}setFocusable(e){this.element&&(this.element.tabIndex=e?0:-1)}get trapsArrowNavigation(){return!1}updateEnabled(){}updateLabel(){}getClass(){return this.action.class}getTooltip(){return this.action.tooltip}getHoverContents(){return this.getTooltip()}updateTooltip(){if(!this.element)return;const e=this.getHoverContents()??"";if(this.updateAriaLabel(),!this.customHover&&e!==""){const t=this.options.hoverDelegate??Tl("element");this.customHover=this._store.add(na().setupManagedHover(t,this.element,e))}else this.customHover&&this.customHover.update(e)}updateAriaLabel(){if(this.element){const e=this.getTooltip()??"";this.element.setAttribute("aria-label",e)}}updateClass(){}updateChecked(){}dispose(){this.element&&(this.element.remove(),this.element=void 0),this._context=void 0,super.dispose()}}class Z_ extends za{constructor(e,t,i){i={...i,icon:i.icon!==void 0?i.icon:!1,label:i.label!==void 0?i.label:!0},super(e,t,i),this.options=i,this.cssClass=""}render(e){super.render(e),Je(this.element);const t=document.createElement("a");if(t.classList.add("action-label"),t.setAttribute("role",this.getDefaultAriaRole()),this.label=t,this.element.appendChild(t),this.options.label&&this.options.keybinding&&!this.options.keybindingNotRenderedWithLabel){const i=document.createElement("span");i.classList.add("keybinding"),i.textContent=this.options.keybinding,this.element.appendChild(i)}this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked()}getDefaultAriaRole(){return this._action.id===Wi.ID?"presentation":this.options.isMenu?"menuitem":this.options.isTabList?"tab":"button"}focus(){this.label&&(this.label.tabIndex=0,this.label.focus())}blur(){this.label&&(this.label.tabIndex=-1)}setFocusable(e){this.label&&(this.label.tabIndex=e?0:-1)}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this.action.label)}getTooltip(){let e=null;return this.action.tooltip?e=this.action.tooltip:this.action.label&&(e=this.action.label,this.options.keybinding&&(e=m(0,"{0} ({1})",e,this.options.keybinding))),e??void 0}updateClass(){this.cssClass&&this.label&&this.label.classList.remove(...this.cssClass.split(" ")),this.options.icon?(this.cssClass=this.getClass(),this.label&&(this.label.classList.add("codicon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" "))),this.updateEnabled()):this.label?.classList.remove("codicon")}updateEnabled(){this.action.enabled?(this.label&&(this.label.removeAttribute("aria-disabled"),this.label.classList.remove("disabled")),this.element?.classList.remove("disabled")):(this.label&&(this.label.setAttribute("aria-disabled","true"),this.label.classList.add("disabled")),this.element?.classList.add("disabled"))}updateAriaLabel(){if(this.label){const e=this.getTooltip()??"";this.label.setAttribute("aria-label",e)}}updateChecked(){this.label&&(this.action.checked!==void 0?(this.label.classList.toggle("checked",this.action.checked),this.options.isTabList?this.label.setAttribute("aria-selected",this.action.checked?"true":"false"):(this.label.setAttribute("aria-checked",this.action.checked?"true":"false"),this.label.setAttribute("role","checkbox"))):(this.label.classList.remove("checked"),this.label.removeAttribute(this.options.isTabList?"aria-selected":"aria-checked"),this.label.setAttribute("role",this.getDefaultAriaRole())))}}class uve extends za{constructor(e,t,i,n,s,r,a){super(e,t),this.selectBox=new hve(i,n,s,r,a),this.selectBox.setFocusable(!1),this._register(this.selectBox),this.registerListeners()}select(e){this.selectBox.select(e)}registerListeners(){this._register(this.selectBox.onDidSelect(e=>this.runAction(e.selected,e.index)))}runAction(e,t){this.actionRunner.run(this._action,this.getActionContext(e,t))}getActionContext(e,t){return e}setFocusable(e){this.selectBox.setFocusable(e)}focus(){this.selectBox?.focus()}blur(){this.selectBox?.blur()}render(e){this.selectBox.render(e)}}class Qs extends P{get onDidBlur(){return this._onDidBlur.event}get onDidCancel(){return this._onDidCancel.event}get onDidRun(){return this._onDidRun.event}get onWillRun(){return this._onWillRun.event}constructor(e,t={}){super(),this._actionRunnerDisposables=this._register(new V),this.viewItemDisposables=this._register(new ly),this.triggerKeyDown=!1,this.focusable=!0,this._onDidBlur=this._register(new A),this._onDidCancel=this._register(new A({onWillAddFirstListener:()=>this.cancelHasListener=!0})),this.cancelHasListener=!1,this._onDidRun=this._register(new A),this._onWillRun=this._register(new A),this.options=t,this._context=t.context??null,this._orientation=this.options.orientation??0,this._triggerKeys={keyDown:this.options.triggerKeys?.keyDown??!1,keys:this.options.triggerKeys?.keys??[3,10]},this._hoverDelegate=t.hoverDelegate??this._register(wj()),this.options.actionRunner?this._actionRunner=this.options.actionRunner:(this._actionRunner=new mf,this._actionRunnerDisposables.add(this._actionRunner)),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(s=>this._onDidRun.fire(s))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(s=>this._onWillRun.fire(s))),this.viewItems=[],this.focusedItem=void 0,this.domNode=document.createElement("div"),this.domNode.className="monaco-action-bar";let i,n;switch(this._orientation){case 0:i=[15],n=[17];break;case 1:i=[16],n=[18],this.domNode.className+=" vertical";break}this._register(W(this.domNode,te.KEY_DOWN,s=>{const r=new yt(s);let a=!0;const l=typeof this.focusedItem=="number"?this.viewItems[this.focusedItem]:void 0;i&&(r.equals(i[0])||r.equals(i[1]))?a=this.focusPrevious():n&&(r.equals(n[0])||r.equals(n[1]))?a=this.focusNext():r.equals(9)&&this.cancelHasListener?this._onDidCancel.fire():r.equals(14)?a=this.focusFirst():r.equals(13)?a=this.focusLast():r.equals(2)&&l instanceof za&&l.trapsArrowNavigation?a=this.focusNext(void 0,!0):this.isTriggerKeyEvent(r)?this._triggerKeys.keyDown?this.doTrigger(r):this.triggerKeyDown=!0:a=!1,a&&(r.preventDefault(),r.stopPropagation())})),this._register(W(this.domNode,te.KEY_UP,s=>{const r=new yt(s);this.isTriggerKeyEvent(r)?(!this._triggerKeys.keyDown&&this.triggerKeyDown&&(this.triggerKeyDown=!1,this.doTrigger(r)),r.preventDefault(),r.stopPropagation()):(r.equals(2)||r.equals(1026)||r.equals(16)||r.equals(18)||r.equals(15)||r.equals(17))&&this.updateFocusedItem()})),this.focusTracker=this._register(vr(this.domNode)),this._register(this.focusTracker.onDidBlur(()=>{($i()===this.domNode||!Qi($i(),this.domNode))&&(this._onDidBlur.fire(),this.previouslyFocusedItem=this.focusedItem,this.focusedItem=void 0,this.triggerKeyDown=!1)})),this._register(this.focusTracker.onDidFocus(()=>this.updateFocusedItem())),this.actionsList=document.createElement("ul"),this.actionsList.className="actions-container",this.options.highlightToggledItems&&this.actionsList.classList.add("highlight-toggled"),this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"),this.options.ariaLabel&&this.actionsList.setAttribute("aria-label",this.options.ariaLabel),this.domNode.appendChild(this.actionsList),e.appendChild(this.domNode)}refreshRole(){this.length()>=1?this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"):this.actionsList.setAttribute("role","presentation")}setFocusable(e){if(this.focusable=e,this.focusable){const t=this.viewItems.find(i=>i instanceof za&&i.isEnabled());t instanceof za&&t.setFocusable(!0)}else this.viewItems.forEach(t=>{t instanceof za&&t.setFocusable(!1)})}isTriggerKeyEvent(e){let t=!1;return this._triggerKeys.keys.forEach(i=>{t=t||e.equals(i)}),t}updateFocusedItem(){for(let e=0;e<this.actionsList.children.length;e++){const t=this.actionsList.children[e];if(Qi($i(),t)){this.focusedItem=e,this.viewItems[this.focusedItem]?.showHover?.();break}}}get context(){return this._context}set context(e){this._context=e,this.viewItems.forEach(t=>t.setActionContext(e))}get actionRunner(){return this._actionRunner}set actionRunner(e){this._actionRunner=e,this._actionRunnerDisposables.clear(),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(t=>this._onDidRun.fire(t))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(t=>this._onWillRun.fire(t))),this.viewItems.forEach(t=>t.actionRunner=e)}getContainer(){return this.domNode}getAction(e){if(typeof e=="number")return this.viewItems[e]?.action;if(li(e)){for(;e.parentElement!==this.actionsList;){if(!e.parentElement)return;e=e.parentElement}for(let t=0;t<this.actionsList.childNodes.length;t++)if(this.actionsList.childNodes[t]===e)return this.viewItems[t].action}}push(e,t={}){const i=Array.isArray(e)?e:[e];let n=Cc(t.index)?t.index:null;if(i.forEach(s=>{const r=document.createElement("li");r.className="action-item",r.setAttribute("role","presentation");let a;const l={hoverDelegate:this._hoverDelegate,...t,isTabList:this.options.ariaRole==="tablist"};this.options.actionViewItemProvider&&(a=this.options.actionViewItemProvider(s,l)),a||(a=new Z_(this.context,s,l)),this.options.allowContextMenu||this.viewItemDisposables.set(a,W(r,te.CONTEXT_MENU,c=>{st.stop(c,!0)})),a.actionRunner=this._actionRunner,a.setActionContext(this.context),a.render(r),n===null||n<0||n>=this.actionsList.children.length?(this.actionsList.appendChild(r),this.viewItems.push(a)):(this.actionsList.insertBefore(r,this.actionsList.children[n]),this.viewItems.splice(n,0,a),n++)}),this.focusable){let s=!1;for(const r of this.viewItems){if(!(r instanceof za))continue;let a;s||r.action.id===Wi.ID||!r.isEnabled()&&this.options.focusOnlyEnabledItems?a=!1:a=!0,a?(r.setFocusable(!0),s=!0):r.setFocusable(!1)}}typeof this.focusedItem=="number"&&this.focus(this.focusedItem),this.refreshRole()}getWidth(e){if(e>=0&&e<this.actionsList.children.length){const t=this.actionsList.children.item(e);if(t)return t.clientWidth}return 0}pull(e){e>=0&&e<this.viewItems.length&&(this.actionsList.childNodes[e].remove(),this.viewItemDisposables.deleteAndDispose(this.viewItems[e]),ht(this.viewItems.splice(e,1)),this.refreshRole())}clear(){this.isEmpty()||(this.viewItems=ht(this.viewItems),this.viewItemDisposables.clearAndDisposeAll(),pn(this.actionsList),this.refreshRole())}length(){return this.viewItems.length}isEmpty(){return this.viewItems.length===0}focus(e){let t=!1,i;if(e===void 0?t=!0:typeof e=="number"?i=e:typeof e=="boolean"&&(t=e),t&&typeof this.focusedItem>"u"){const n=this.viewItems.findIndex(s=>s.isEnabled());this.focusedItem=n===-1?void 0:n,this.updateFocus(void 0,void 0,!0)}else i!==void 0&&(this.focusedItem=i),this.updateFocus(void 0,void 0,!0)}focusFirst(){return this.focusedItem=this.length()-1,this.focusNext(!0)}focusLast(){return this.focusedItem=0,this.focusPrevious(!0)}focusNext(e,t){if(typeof this.focusedItem>"u")this.focusedItem=this.viewItems.length-1;else if(this.viewItems.length<=1)return!1;const i=this.focusedItem;let n;do{if(!e&&this.options.preventLoopNavigation&&this.focusedItem+1>=this.viewItems.length)return this.focusedItem=i,!1;this.focusedItem=(this.focusedItem+1)%this.viewItems.length,n=this.viewItems[this.focusedItem]}while(this.focusedItem!==i&&(this.options.focusOnlyEnabledItems&&!n.isEnabled()||n.action.id===Wi.ID));return this.updateFocus(void 0,void 0,t),!0}focusPrevious(e){if(typeof this.focusedItem>"u")this.focusedItem=0;else if(this.viewItems.length<=1)return!1;const t=this.focusedItem;let i;do{if(this.focusedItem=this.focusedItem-1,this.focusedItem<0){if(!e&&this.options.preventLoopNavigation)return this.focusedItem=t,!1;this.focusedItem=this.viewItems.length-1}i=this.viewItems[this.focusedItem]}while(this.focusedItem!==t&&(this.options.focusOnlyEnabledItems&&!i.isEnabled()||i.action.id===Wi.ID));return this.updateFocus(!0),!0}updateFocus(e,t,i=!1){typeof this.focusedItem>"u"&&this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem!==void 0&&this.previouslyFocusedItem!==this.focusedItem&&this.viewItems[this.previouslyFocusedItem]?.blur();const n=this.focusedItem!==void 0?this.viewItems[this.focusedItem]:void 0;if(n){let s=!0;Qu(n.focus)||(s=!1),this.options.focusOnlyEnabledItems&&Qu(n.isEnabled)&&!n.isEnabled()&&(s=!1),n.action.id===Wi.ID&&(s=!1),s?(i||this.previouslyFocusedItem!==this.focusedItem)&&(n.focus(e),this.previouslyFocusedItem=this.focusedItem):(this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem=void 0),s&&n.showHover?.()}}doTrigger(e){if(typeof this.focusedItem>"u")return;const t=this.viewItems[this.focusedItem];if(t instanceof za){const i=t._context===null||t._context===void 0?e:t._context;this.run(t._action,i)}}async run(e,t){await this._actionRunner.run(e,t)}dispose(){this._context=void 0,this.viewItems=ht(this.viewItems),this.getContainer().remove(),super.dispose()}}function fve(o,e,t,i){if(o.length===0)return e;if(e.length===0)return o;const n=[];let s=0,r=0;for(;s<o.length&&r<e.length;){const a=o[s],l=e[r],c=t(a),d=t(l);c<d?(n.push(a),s++):c>d?(n.push(l),r++):(n.push(i(a,l)),s++,r++)}for(;s<o.length;)n.push(o[s]),s++;for(;r<e.length;)n.push(e[r]),r++;return n}function lk(o,e){const t=new V,i=o.createDecorationsCollection();return t.add(Ey({debugName:()=>`Apply decorations from ${e.debugName}`},n=>{const s=e.read(n);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function Y_(o,e){return o.appendChild(e),fe(()=>{e.remove()})}function gve(o,e){return o.prepend(e),fe(()=>{e.remove()})}class Bq extends P{get width(){return this._width}get height(){return this._height}get automaticLayout(){return this._automaticLayout}constructor(e,t){super(),this._automaticLayout=!1,this.elementSizeObserver=this._register(new jV(e,t)),this._width=xe(this,this.elementSizeObserver.getWidth()),this._height=xe(this,this.elementSizeObserver.getHeight()),this._register(this.elementSizeObserver.onDidChange(i=>Dt(n=>{this._width.set(this.elementSizeObserver.getWidth(),n),this._height.set(this.elementSizeObserver.getHeight(),n)})))}observe(e){this.elementSizeObserver.observe(e)}setAutomaticLayout(e){this._automaticLayout=e,e?this.elementSizeObserver.startObserving():this.elementSizeObserver.stopObserving()}}function Hq(o,e,t){let i=e.get(),n=i,s=i;const r=xe("animatedValue",i);let a=-1;const l=300;let c;t.add(zm({changeTracker:{createChangeSummary:()=>({animate:!1}),handleChange:(h,u)=>(h.didChange(e)&&(u.animate=u.animate||h.change),!0)}},(h,u)=>{c!==void 0&&(o.cancelAnimationFrame(c),c=void 0),n=s,i=e.read(h),a=Date.now()-(u.animate?0:l),d()}));function d(){const h=Date.now()-a;s=Math.floor(pve(h,n,i-n,l)),h<l?c=o.requestAnimationFrame(d):s=i,r.set(s,void 0)}return r}function pve(o,e,t,i){return o===i?e+t:t*(-Math.pow(2,-10*o/i)+1)+e}class yO extends P{constructor(e,t,i){super(),this._register(new LO(e,i)),this._register(jh(i,{height:t.actualHeight,top:t.actualTop}))}}class X_{get afterLineNumber(){return this._afterLineNumber.get()}constructor(e,t){this._afterLineNumber=e,this.heightInPx=t,this.domNode=document.createElement("div"),this._actualTop=xe(this,void 0),this._actualHeight=xe(this,void 0),this.actualTop=this._actualTop,this.actualHeight=this._actualHeight,this.showInHiddenAreas=!0,this.onChange=this._afterLineNumber,this.onDomNodeTop=i=>{this._actualTop.set(i,void 0)},this.onComputedHeight=i=>{this._actualHeight.set(i,void 0)}}}const ON=class ON{constructor(e,t){this._editor=e,this._domElement=t,this._overlayWidgetId=`managedOverlayWidget-${ON._counter++}`,this._overlayWidget={getId:()=>this._overlayWidgetId,getDomNode:()=>this._domElement,getPosition:()=>null},this._editor.addOverlayWidget(this._overlayWidget)}dispose(){this._editor.removeOverlayWidget(this._overlayWidget)}};ON._counter=0;let LO=ON;function jh(o,e){return Se(t=>{for(let[i,n]of Object.entries(e))n&&typeof n=="object"&&"read"in n&&(n=n.read(t)),typeof n=="number"&&(n=`${n}px`),i=i.replace(/[A-Z]/g,s=>"-"+s.toLowerCase()),o.style[i]=n})}function ck(o,e,t,i){const n=new V,s=[];return n.add(zn((r,a)=>{const l=e.read(r),c=new Map,d=new Map;t&&t(!0),o.changeViewZones(h=>{for(const u of s)h.removeZone(u),i?.delete(u);s.length=0;for(const u of l){const f=h.addZone(u);u.setZoneId&&u.setZoneId(f),s.push(f),i?.add(f),c.set(u,f)}}),t&&t(!1),a.add(zm({changeTracker:{createChangeSummary(){return{zoneIds:[]}},handleChange(h,u){const f=d.get(h.changedObservable);return f!==void 0&&u.zoneIds.push(f),!0}}},(h,u)=>{for(const f of l)f.onChange&&(d.set(f.onChange,c.get(f)),f.onChange.read(h));t&&t(!0),o.changeViewZones(f=>{for(const g of u.zoneIds)f.layoutZone(g)}),t&&t(!1)}))})),n.add({dispose(){t&&t(!0),o.changeViewZones(r=>{for(const a of s)r.removeZone(a)}),i?.clear(),t&&t(!1)}}),n}class mve extends zt{dispose(){super.dispose(!0)}}function Vq(o,e){const t=d1(e,n=>n.original.startLineNumber<=o.lineNumber);if(!t)return k.fromPositions(o);if(t.original.endLineNumberExclusive<=o.lineNumber){const n=o.lineNumber-t.original.endLineNumberExclusive+t.modified.endLineNumberExclusive;return k.fromPositions(new M(n,o.column))}if(!t.innerChanges)return k.fromPositions(new M(t.modified.startLineNumber,1));const i=d1(t.innerChanges,n=>n.originalRange.getStartPosition().isBeforeOrEqual(o));if(!i){const n=o.lineNumber-t.original.startLineNumber+t.modified.startLineNumber;return k.fromPositions(new M(n,o.column))}if(i.originalRange.containsPosition(o))return i.modifiedRange;{const n=_ve(i.originalRange.getEndPosition(),o);return k.fromPositions(n.addToPosition(i.modifiedRange.getEndPosition()))}}function _ve(o,e){return o.lineNumber===e.lineNumber?new Ki(0,e.column-o.column):new Ki(e.lineNumber-o.lineNumber,e.column-1)}function bve(o,e){let t;return o.filter(i=>{const n=e(i,t);return t=i,n})}class dk{static create(e,t=void 0){return new zq(e,e,t)}static createWithDisposable(e,t,i=void 0){const n=new V;return n.add(t),n.add(e),new zq(e,n,i)}}class zq extends dk{constructor(e,t,i){super(),this.object=e,this._disposable=t,this._debugOwner=i,this._refCount=1,this._isDisposed=!1,this._owners=[],i&&this._addOwner(i)}_addOwner(e){e&&this._owners.push(e)}createNewRef(e){return this._refCount++,e&&this._addOwner(e),new Cve(this,e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._decreaseRefCount(this._debugOwner))}_decreaseRefCount(e){if(this._refCount--,this._refCount===0&&this._disposable.dispose(),e){const t=this._owners.indexOf(e);t!==-1&&this._owners.splice(t,1)}}}class Cve extends dk{constructor(e,t){super(),this._base=e,this._debugOwner=t,this._isDisposed=!1}get object(){return this._base.object}createNewRef(e){return this._base.createNewRef(e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._base._decreaseRefCount(this._debugOwner))}}class us{static inverse(e,t,i){const n=[];let s=1,r=1;for(const l of e){const c=new us(new Ie(s,l.original.startLineNumber),new Ie(r,l.modified.startLineNumber));c.modified.isEmpty||n.push(c),s=l.original.endLineNumberExclusive,r=l.modified.endLineNumberExclusive}const a=new us(new Ie(s,t+1),new Ie(r,i+1));return a.modified.isEmpty||n.push(a),n}static clip(e,t,i){const n=[];for(const s of e){const r=s.original.intersect(t),a=s.modified.intersect(i);r&&!r.isEmpty&&a&&!a.isEmpty&&n.push(new us(r,a))}return n}constructor(e,t){this.original=e,this.modified=t}toString(){return`{${this.original.toString()}->${this.modified.toString()}}`}flip(){return new us(this.modified,this.original)}join(e){return new us(this.original.join(e.original),this.modified.join(e.modified))}toRangeMapping(){const e=this.original.toInclusiveRange(),t=this.modified.toInclusiveRange();if(e&&t)return new Ns(e,t);if(this.original.startLineNumber===1||this.modified.startLineNumber===1){if(!(this.modified.startLineNumber===1&&this.original.startLineNumber===1))throw new Ce("not a valid diff");return new Ns(new k(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new k(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1))}else return new Ns(new k(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),new k(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER))}toRangeMapping2(e,t){if(Uq(this.original.endLineNumberExclusive,e)&&Uq(this.modified.endLineNumberExclusive,t))return new Ns(new k(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new k(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1));if(!this.original.isEmpty&&!this.modified.isEmpty)return new Ns(k.fromPositions(new M(this.original.startLineNumber,1),Q_(new M(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)),k.fromPositions(new M(this.modified.startLineNumber,1),Q_(new M(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),t)));if(this.original.startLineNumber>1&&this.modified.startLineNumber>1)return new Ns(k.fromPositions(Q_(new M(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER),e),Q_(new M(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)),k.fromPositions(Q_(new M(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER),t),Q_(new M(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),t)));throw new Ce}}function Q_(o,e){if(o.lineNumber<1)return new M(1,1);if(o.lineNumber>e.length)return new M(e.length,e[e.length-1].length+1);const t=e[o.lineNumber-1];return o.column>t.length+1?new M(o.lineNumber,t.length+1):o}function Uq(o,e){return o>=1&&o<=e.length}class Go extends us{static fromRangeMappings(e){const t=Ie.join(e.map(n=>Ie.fromRangeInclusive(n.originalRange))),i=Ie.join(e.map(n=>Ie.fromRangeInclusive(n.modifiedRange)));return new Go(t,i,e)}constructor(e,t,i){super(e,t),this.innerChanges=i}flip(){return new Go(this.modified,this.original,this.innerChanges?.map(e=>e.flip()))}withInnerChangesFromLineRanges(){return new Go(this.original,this.modified,[this.toRangeMapping()])}}class Ns{static fromEdit(e){const t=e.getNewRanges();return e.replacements.map((n,s)=>new Ns(n.range,t[s]))}static assertSorted(e){for(let t=1;t<e.length;t++){const i=e[t-1],n=e[t];if(!(i.originalRange.getEndPosition().isBeforeOrEqual(n.originalRange.getStartPosition())&&i.modifiedRange.getEndPosition().isBeforeOrEqual(n.modifiedRange.getStartPosition())))throw new Ce("Range mappings must be sorted")}}constructor(e,t){this.originalRange=e,this.modifiedRange=t}toString(){return`{${this.originalRange.toString()}->${this.modifiedRange.toString()}}`}flip(){return new Ns(this.modifiedRange,this.originalRange)}toTextEdit(e){const t=e.getValueOfRange(this.modifiedRange);return new Ti(this.originalRange,t)}}function hk(o,e,t,i=!1){const n=[];for(const s of oM(o.map(r=>vve(r,e,t)),(r,a)=>r.original.intersectsOrTouches(a.original)||r.modified.intersectsOrTouches(a.modified))){const r=s[0],a=s[s.length-1];n.push(new Go(r.original.join(a.original),r.modified.join(a.modified),s.map(l=>l.innerChanges[0])))}return sh(()=>!i&&n.length>0&&(n[0].modified.startLineNumber!==n[0].original.startLineNumber||t.length.lineCount-n[n.length-1].modified.endLineNumberExclusive!==e.length.lineCount-n[n.length-1].original.endLineNumberExclusive)?!1:ov(n,(s,r)=>r.original.startLineNumber-s.original.endLineNumberExclusive===r.modified.startLineNumber-s.modified.endLineNumberExclusive&&s.original.endLineNumberExclusive<r.original.startLineNumber&&s.modified.endLineNumberExclusive<r.modified.startLineNumber)),n}function vve(o,e,t){let i=0,n=0;o.modifiedRange.endColumn===1&&o.originalRange.endColumn===1&&o.originalRange.startLineNumber+i<=o.originalRange.endLineNumber&&o.modifiedRange.startLineNumber+i<=o.modifiedRange.endLineNumber&&(n=-1),o.modifiedRange.startColumn-1>=t.getLineLength(o.modifiedRange.startLineNumber)&&o.originalRange.startColumn-1>=e.getLineLength(o.originalRange.startLineNumber)&&o.originalRange.startLineNumber<=o.originalRange.endLineNumber+n&&o.modifiedRange.startLineNumber<=o.modifiedRange.endLineNumber+n&&(i=1);const s=new Ie(o.originalRange.startLineNumber+i,o.originalRange.endLineNumber+1+n),r=new Ie(o.modifiedRange.startLineNumber+i,o.modifiedRange.endLineNumber+1+n);return new Go(s,r,[o])}const wve={IconContribution:"base.contributions.icons"};var $q;(function(o){function e(t,i){let n=t.defaults;for(;ve.isThemeIcon(n);){const s=bg.getIcon(n.id);if(!s)return;n=s.defaults}return n}o.getDefinition=e})($q||($q={}));var jq;(function(o){function e(i){return{weight:i.weight,style:i.style,src:i.src.map(n=>({format:n.format,location:n.location.toString()}))}}o.toJSONObject=e;function t(i){const n=s=>Zi(s)?s:void 0;if(i&&Array.isArray(i.src)&&i.src.every(s=>Zi(s.format)&&Zi(s.location)))return{weight:n(i.weight),style:n(i.style),src:i.src.map(s=>({format:s.format,location:be.parse(s.location)}))}}o.fromJSONObject=t})(jq||(jq={}));const Sve=/^([\w_-]+)$/,yve=m(2024,"The font ID must only contain letters, numbers, underscores and dashes.");class Lve extends P{constructor(){super(),this._onDidChange=this._register(new A),this.onDidChange=this._onDidChange.event,this.iconSchema={definitions:{icons:{type:"object",properties:{fontId:{type:"string",description:m(2025,"The id of the font to use. If not set, the font that is defined first is used."),pattern:Sve.source,patternErrorMessage:yve},fontCharacter:{type:"string",description:m(2026,"The font character associated with the icon definition.")}},additionalProperties:!1,defaultSnippets:[{body:{fontCharacter:"\\\\e030"}}]}},type:"object",properties:{}},this.iconReferenceSchema={type:"string",pattern:`^${ve.iconNameExpression}$`,enum:[],enumDescriptions:[]},this.iconsById={},this.iconFontsById={}}registerIcon(e,t,i,n){const s=this.iconsById[e];if(s){if(i&&!s.description){s.description=i,this.iconSchema.properties[e].markdownDescription=`${i} $(${e})`;const l=this.iconReferenceSchema.enum.indexOf(e);l!==-1&&(this.iconReferenceSchema.enumDescriptions[l]=i),this._onDidChange.fire()}return s}const r={id:e,description:i,defaults:t,deprecationMessage:n};this.iconsById[e]=r;const a={$ref:"#/definitions/icons"};return n&&(a.deprecationMessage=n),i&&(a.markdownDescription=`${i}: $(${e})`),this.iconSchema.properties[e]=a,this.iconReferenceSchema.enum.push(e),this.iconReferenceSchema.enumDescriptions.push(i||""),this._onDidChange.fire(),{id:e}}getIcons(){return Object.keys(this.iconsById).map(e=>this.iconsById[e])}getIcon(e){return this.iconsById[e]}getIconSchema(){return this.iconSchema}toString(){const e=(s,r)=>s.id.localeCompare(r.id),t=s=>{for(;ve.isThemeIcon(s.defaults);)s=this.iconsById[s.defaults.id];return`codicon codicon-${s?s.id:""}`},i=[];i.push("| preview | identifier | default codicon ID | description"),i.push("| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |");const n=Object.keys(this.iconsById).map(s=>this.iconsById[s]);for(const s of n.filter(r=>!!r.description).sort(e))i.push(`|<i class="${t(s)}"></i>|${s.id}|${ve.isThemeIcon(s.defaults)?s.defaults.id:s.id}|${s.description||""}|`);i.push("| preview | identifier "),i.push("| ----------- | --------------------------------- |");for(const s of n.filter(r=>!ve.isThemeIcon(r.defaults)).sort(e))i.push(`|<i class="${t(s)}"></i>|${s.id}|`);return i.join(` |
| 384 | `)}}const bg=new Lve;ei.add(wve.IconContribution,bg);function Bt(o,e,t,i){return bg.registerIcon(o,e,t,i)}function qq(){return bg}function xve(){const o=BH();for(const e in o){const t="\\"+o[e].toString(16);bg.registerIcon(e,{fontCharacter:t})}}xve();const Kq="vscode://schemas/icons",Gq=ei.as(uL.JSONContribution);Gq.registerSchema(Kq,bg.getIconSchema());const Zq=new vt(()=>Gq.notifySchemaChanged(Kq),200);bg.onDidChange(()=>{Zq.isScheduled()||Zq.schedule()});const Yq=Bt("widget-close",Z.close,m(2027,"Icon for the close action in widgets."));Bt("goto-previous-location",Z.arrowUp,m(2028,"Icon for goto previous editor location.")),Bt("goto-next-location",Z.arrowDown,m(2029,"Icon for goto next editor location.")),ve.modify(Z.sync,"spin"),ve.modify(Z.loading,"spin");var xO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kO=function(o,e){return function(t,i){e(t,i,o)}};const kve=Bt("diff-review-insert",Z.add,m(97,"Icon for 'Insert' in accessible diff viewer.")),Ive=Bt("diff-review-remove",Z.remove,m(98,"Icon for 'Remove' in accessible diff viewer.")),Dve=Bt("diff-review-close",Z.close,m(99,"Icon for 'Close' in accessible diff viewer."));let Cg=(TC=class extends P{constructor(e,t,i,n,s,r,a,l,c){super(),this._parentNode=e,this._visible=t,this._setVisible=i,this._canClose=n,this._width=s,this._height=r,this._diffs=a,this._models=l,this._instantiationService=c,this._state=$(this,d=>{const h=this._visible.read(d);if(this._parentNode.style.visibility=h?"visible":"hidden",!h)return null;const u=d.store.add(this._instantiationService.createInstance(IO,this._diffs,this._models,this._setVisible,this._canClose)),f=d.store.add(this._instantiationService.createInstance(DO,this._parentNode,u,this._width,this._height,this._models));return{model:u,view:f}}).recomputeInitiallyAndOnChange(this._store)}next(){Dt(e=>{const t=this._visible.get();this._setVisible(!0,e),t&&this._state.get().model.nextGroup(e)})}prev(){Dt(e=>{this._setVisible(!0,e),this._state.get().model.previousGroup(e)})}close(){Dt(e=>{this._setVisible(!1,e)})}},TC._ttPolicy=yl("diffReview",{createHTML:e=>e}),TC);Cg=xO([kO(8,pe)],Cg);let IO=class extends P{constructor(e,t,i,n,s){super(),this._diffs=e,this._models=t,this._setVisible=i,this.canClose=n,this._accessibilitySignalService=s,this._groups=xe(this,[]),this._currentGroupIdx=xe(this,0),this._currentElementIdx=xe(this,0),this.groups=this._groups,this.currentGroup=this._currentGroupIdx.map((r,a)=>this._groups.read(a)[r]),this.currentGroupIndex=this._currentGroupIdx,this.currentElement=this._currentElementIdx.map((r,a)=>this.currentGroup.read(a)?.lines[r]),this._register(Se(r=>{const a=this._diffs.read(r);if(!a){this._groups.set([],void 0);return}const l=Eve(a,this._models.getOriginalModel().getLineCount(),this._models.getModifiedModel().getLineCount());Dt(c=>{const d=this._models.getModifiedPosition();if(d){const h=l.findIndex(u=>d?.lineNumber<u.range.modified.endLineNumberExclusive);h!==-1&&this._currentGroupIdx.set(h,c)}this._groups.set(l,c)})})),this._register(Se(r=>{const a=this.currentElement.read(r);a?.type===Ts.Deleted?this._accessibilitySignalService.playSignal(Ds.diffLineDeleted,{source:"accessibleDiffViewer.currentElementChanged"}):a?.type===Ts.Added&&this._accessibilitySignalService.playSignal(Ds.diffLineInserted,{source:"accessibleDiffViewer.currentElementChanged"})})),this._register(Se(r=>{const a=this.currentElement.read(r);if(a&&a.type!==Ts.Header){const l=a.modifiedLineNumber??a.diff.modified.startLineNumber;this._models.modifiedSetSelection(k.fromPositions(new M(l,1)))}}))}_goToGroupDelta(e,t){const i=this.groups.get();!i||i.length<=1||Bm(t,n=>{this._currentGroupIdx.set(ge.ofLength(i.length).clipCyclic(this._currentGroupIdx.get()+e),n),this._currentElementIdx.set(0,n)})}nextGroup(e){this._goToGroupDelta(1,e)}previousGroup(e){this._goToGroupDelta(-1,e)}_goToLineDelta(e){const t=this.currentGroup.get();!t||t.lines.length<=1||Dt(i=>{this._currentElementIdx.set(ge.ofLength(t.lines.length).clip(this._currentElementIdx.get()+e),i)})}goToNextLine(){this._goToLineDelta(1)}goToPreviousLine(){this._goToLineDelta(-1)}goToLine(e){const t=this.currentGroup.get();if(!t)return;const i=t.lines.indexOf(e);i!==-1&&Dt(n=>{this._currentElementIdx.set(i,n)})}revealCurrentElementInEditor(){if(!this.canClose.get())return;this._setVisible(!1,void 0);const e=this.currentElement.get();e&&(e.type===Ts.Deleted?this._models.originalReveal(k.fromPositions(new M(e.originalLineNumber,1))):this._models.modifiedReveal(e.type!==Ts.Header?k.fromPositions(new M(e.modifiedLineNumber,1)):void 0))}close(){this.canClose.get()&&(this._setVisible(!1,void 0),this._models.modifiedFocus())}};IO=xO([kO(4,ld)],IO);const mw=3;function Eve(o,e,t){const i=[];for(const n of oM(o,(s,r)=>r.modified.startLineNumber-s.modified.endLineNumberExclusive<2*mw)){const s=[];s.push(new Tve);const r=new Ie(Math.max(1,n[0].original.startLineNumber-mw),Math.min(n[n.length-1].original.endLineNumberExclusive+mw,e+1)),a=new Ie(Math.max(1,n[0].modified.startLineNumber-mw),Math.min(n[n.length-1].modified.endLineNumberExclusive+mw,t+1));Y6(n,(d,h)=>{const u=new Ie(d?d.original.endLineNumberExclusive:r.startLineNumber,h?h.original.startLineNumber:r.endLineNumberExclusive),f=new Ie(d?d.modified.endLineNumberExclusive:a.startLineNumber,h?h.modified.startLineNumber:a.endLineNumberExclusive);u.forEach(g=>{s.push(new Ave(g,f.startLineNumber+(g-u.startLineNumber)))}),h&&(h.original.forEach(g=>{s.push(new Rve(h,g))}),h.modified.forEach(g=>{s.push(new Mve(h,g))}))});const l=n[0].modified.join(n[n.length-1].modified),c=n[0].original.join(n[n.length-1].original);i.push(new Nve(new us(l,c),s))}return i}var Ts;(function(o){o[o.Header=0]="Header",o[o.Unchanged=1]="Unchanged",o[o.Deleted=2]="Deleted",o[o.Added=3]="Added"})(Ts||(Ts={}));class Nve{constructor(e,t){this.range=e,this.lines=t}}class Tve{constructor(){this.type=Ts.Header}}class Rve{constructor(e,t){this.diff=e,this.originalLineNumber=t,this.type=Ts.Deleted,this.modifiedLineNumber=void 0}}class Mve{constructor(e,t){this.diff=e,this.modifiedLineNumber=t,this.type=Ts.Added,this.originalLineNumber=void 0}}class Ave{constructor(e,t){this.originalLineNumber=e,this.modifiedLineNumber=t,this.type=Ts.Unchanged}}let DO=class extends P{constructor(e,t,i,n,s,r){super(),this._element=e,this._model=t,this._width=i,this._height=n,this._models=s,this._languageService=r,this.domNode=this._element,this.domNode.className="monaco-component diff-review monaco-editor-background";const a=document.createElement("div");a.className="diff-review-actions",this._actionBar=this._register(new Qs(a)),this._register(Se(l=>{this._actionBar.clear(),this._model.canClose.read(l)&&this._actionBar.push(_f({id:"diffreview.close",label:m(100,"Close"),class:"close-diff-review "+ve.asClassName(Dve),enabled:!0,run:async()=>t.close()}),{label:!1,icon:!0})})),this._content=document.createElement("div"),this._content.className="diff-review-content",this._content.setAttribute("role","code"),this._scrollbar=this._register(new o1(this._content,{})),Ji(this.domNode,this._scrollbar.getDomNode(),a),this._register(Se(l=>{this._height.read(l),this._width.read(l),this._scrollbar.scanDomNode()})),this._register(fe(()=>{Ji(this.domNode)})),this._register(jh(this.domNode,{width:this._width,height:this._height})),this._register(jh(this._content,{width:this._width,height:this._height})),this._register(zn((l,c)=>{this._model.currentGroup.read(l),this._render(c)})),this._register(Si(this.domNode,"keydown",l=>{(l.equals(18)||l.equals(2066)||l.equals(530))&&(l.preventDefault(),this._model.goToNextLine()),(l.equals(16)||l.equals(2064)||l.equals(528))&&(l.preventDefault(),this._model.goToPreviousLine()),(l.equals(9)||l.equals(2057)||l.equals(521)||l.equals(1033))&&(l.preventDefault(),this._model.close()),(l.equals(10)||l.equals(3))&&(l.preventDefault(),this._model.revealCurrentElementInEditor())}))}_render(e){const t=this._models.getOriginalOptions(),i=this._models.getModifiedOptions(),n=document.createElement("div");n.className="diff-review-table",n.setAttribute("role","list"),n.setAttribute("aria-label",m(101,"Accessible Diff Viewer. Use arrow up and down to navigate.")),un(n,i.get(59)),Ji(this._content,n);const s=this._models.getOriginalModel(),r=this._models.getModifiedModel();if(!s||!r)return;const a=s.getOptions(),l=r.getOptions(),c=i.get(75),d=this._model.currentGroup.get();for(const h of d?.lines||[]){if(!d)break;let u;if(h.type===Ts.Header){const g=document.createElement("div");g.className="diff-review-row",g.setAttribute("role","listitem");const p=d.range,_=this._model.currentGroupIndex.get(),b=this._model.groups.get().length,C=L=>L===0?m(102,"no lines changed"):L===1?m(103,"1 line changed"):m(104,"{0} lines changed",L),w=C(p.original.length),v=C(p.modified.length);g.setAttribute("aria-label",m(105,"Difference {0} of {1}: original line {2}, {3}, modified line {4}, {5}",_+1,b,p.original.startLineNumber,w,p.modified.startLineNumber,v));const S=document.createElement("div");S.className="diff-review-cell diff-review-summary",S.appendChild(document.createTextNode(`${_+1}/${b}: @@ -${p.original.startLineNumber},${p.original.length} +${p.modified.startLineNumber},${p.modified.length} @@`)),g.appendChild(S),u=g}else u=this._createRow(h,c,this._width.get(),t,s,a,i,r,l);n.appendChild(u);const f=$(g=>this._model.currentElement.read(g)===h);e.add(Se(g=>{const p=f.read(g);u.tabIndex=p?0:-1,p&&u.focus()})),e.add(W(u,"focus",()=>{this._model.goToLine(h)}))}this._scrollbar.scanDomNode()}_createRow(e,t,i,n,s,r,a,l,c){const d=n.get(165),h=d.glyphMarginWidth+d.lineNumbersWidth,u=a.get(165),f=10+u.glyphMarginWidth+u.lineNumbersWidth;let g="diff-review-row",p="";const _="diff-review-spacer";let b=null;switch(e.type){case Ts.Added:g="diff-review-row line-insert",p=" char-insert",b=kve;break;case Ts.Deleted:g="diff-review-row line-delete",p=" char-delete",b=Ive;break}const C=document.createElement("div");C.style.minWidth=i+"px",C.className=g,C.setAttribute("role","listitem"),C.ariaLevel="";const w=document.createElement("div");w.className="diff-review-cell",w.style.height=`${t}px`,C.appendChild(w);const v=document.createElement("span");v.style.width=h+"px",v.style.minWidth=h+"px",v.className="diff-review-line-number"+p,e.originalLineNumber!==void 0?v.appendChild(document.createTextNode(String(e.originalLineNumber))):v.innerText=" ",w.appendChild(v);const S=document.createElement("span");S.style.width=f+"px",S.style.minWidth=f+"px",S.style.paddingRight="10px",S.className="diff-review-line-number"+p,e.modifiedLineNumber!==void 0?S.appendChild(document.createTextNode(String(e.modifiedLineNumber))):S.innerText=" ",w.appendChild(S);const L=document.createElement("span");if(L.className=_,b){const D=document.createElement("span");D.className=ve.asClassName(b),D.innerText=" ",L.appendChild(D)}else L.innerText=" ";w.appendChild(L);let x;if(e.modifiedLineNumber!==void 0){let D=this._getLineHtml(l,a,c.tabSize,e.modifiedLineNumber,this._languageService.languageIdCodec);Cg._ttPolicy&&(D=Cg._ttPolicy.createHTML(D)),w.insertAdjacentHTML("beforeend",D),x=l.getLineContent(e.modifiedLineNumber)}else{let D=this._getLineHtml(s,n,r.tabSize,e.originalLineNumber,this._languageService.languageIdCodec);Cg._ttPolicy&&(D=Cg._ttPolicy.createHTML(D)),w.insertAdjacentHTML("beforeend",D),x=s.getLineContent(e.originalLineNumber)}x.length===0&&(x=m(106,"blank"));let I="";switch(e.type){case Ts.Unchanged:e.originalLineNumber===e.modifiedLineNumber?I=m(107,"{0} unchanged line {1}",x,e.originalLineNumber):I=m(108,"{0} original line {1} modified line {2}",x,e.originalLineNumber,e.modifiedLineNumber);break;case Ts.Added:I=m(109,"+ {0} modified line {1}",x,e.modifiedLineNumber);break;case Ts.Deleted:I=m(110,"- {0} original line {1}",x,e.originalLineNumber);break}return C.setAttribute("aria-label",I),C}_getLineHtml(e,t,i,n,s){const r=e.getLineContent(n),a=t.get(59),l=t.get(117).verticalScrollbarSize,c=bi.createEmpty(r,s),d=Uo.isBasicASCII(r,e.mightContainNonBasicASCII()),h=Uo.containsRTL(r,d,e.mightContainRTL());return KL(new jc(a.isMonospace&&!t.get(40),a.canUseHalfwidthRightwardsArrow,r,!1,d,h,0,c,[],i,0,a.spaceWidth,a.middotWidth,a.wsmiddotWidth,t.get(133),t.get(113),t.get(108),t.get(60)!==Vc.OFF,null,null,l)).html}};DO=xO([kO(5,ci)],DO);class Pve{constructor(e){this.editors=e}getOriginalModel(){return this.editors.original.getModel()}getOriginalOptions(){return this.editors.original.getOptions()}originalReveal(e){this.editors.original.revealRange(e),this.editors.original.setSelection(e),this.editors.original.focus()}getModifiedModel(){return this.editors.modified.getModel()}getModifiedOptions(){return this.editors.modified.getOptions()}modifiedReveal(e){e&&(this.editors.modified.revealRange(e),this.editors.modified.setSelection(e)),this.editors.modified.focus()}modifiedSetSelection(e){this.editors.modified.setSelection(e)}modifiedFocus(){this.editors.modified.focus()}getModifiedPosition(){return this.editors.modified.getPosition()??void 0}}N("diffEditor.move.border","#8b8b8b9c",m(137,"The border color for text that got moved in the diff editor.")),N("diffEditor.moveActive.border","#FFA500",m(138,"The active border color for text that got moved in the diff editor.")),N("diffEditor.unchangedRegionShadow",{dark:"#000000",light:"#737373BF",hcDark:"#000000",hcLight:"#737373BF"},m(139,"The color of the shadow around unchanged region widgets."));const Ove=Bt("diff-insert",Z.add,m(140,"Line decoration for inserts in the diff editor.")),Xq=Bt("diff-remove",Z.remove,m(141,"Line decoration for removals in the diff editor.")),Qq=Te.register({className:"line-insert",description:"line-insert",isWholeLine:!0,linesDecorationsClassName:"insert-sign "+ve.asClassName(Ove),marginClassName:"gutter-insert"}),Jq=Te.register({className:"line-delete",description:"line-delete",isWholeLine:!0,linesDecorationsClassName:"delete-sign "+ve.asClassName(Xq),marginClassName:"gutter-delete"}),eK=Te.register({className:"line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),tK=Te.register({className:"line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),iK=Te.register({className:"char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),Fve=Te.register({className:"char-insert",description:"char-insert",isWholeLine:!0}),Wve=Te.register({className:"char-insert diff-range-empty",description:"char-insert diff-range-empty"}),EO=Te.register({className:"char-delete",description:"char-delete",shouldFillLineOnLineBreak:!0}),Bve=Te.register({className:"char-delete",description:"char-delete",isWholeLine:!0}),Hve=Te.register({className:"char-delete diff-range-empty",description:"char-delete diff-range-empty"}),Js=Fe("editorWorkerService");var nK=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},NO=function(o,e){return function(t,i){e(t,i,o)}},vg;const sK=Fe("diffProviderFactoryService");let TO=class{constructor(e){this.instantiationService=e}createDiffProvider(e){return this.instantiationService.createInstance(RO,e)}};TO=nK([NO(0,pe)],TO),je(sK,TO,1);let RO=(Np=class{constructor(e,t,i){this.editorWorkerService=t,this.telemetryService=i,this.onDidChangeEventEmitter=new A,this.onDidChange=this.onDidChangeEventEmitter.event,this.diffAlgorithm="advanced",this.diffAlgorithmOnDidChangeSubscription=void 0,this.setOptions(e)}dispose(){this.diffAlgorithmOnDidChangeSubscription?.dispose()}async computeDiff(e,t,i,n){if(typeof this.diffAlgorithm!="string")return this.diffAlgorithm.computeDiff(e,t,i,n);if(e.isDisposed()||t.isDisposed())return{changes:[],identical:!0,quitEarly:!1,moves:[]};if(e.getLineCount()===1&&e.getLineMaxColumn(1)===1)return t.getLineCount()===1&&t.getLineMaxColumn(1)===1?{changes:[],identical:!0,quitEarly:!1,moves:[]}:{changes:[new Go(new Ie(1,2),new Ie(1,t.getLineCount()+1),[new Ns(e.getFullModelRange(),t.getFullModelRange())])],identical:!1,quitEarly:!1,moves:[]};const s=JSON.stringify([e.uri.toString(),t.uri.toString()]),r=JSON.stringify([e.id,t.id,e.getAlternativeVersionId(),t.getAlternativeVersionId(),JSON.stringify(i)]),a=vg.diffCache.get(s);if(a&&a.context===r)return a.result;const l=Xi.create(),c=await this.editorWorkerService.computeDiff(e.uri,t.uri,i,this.diffAlgorithm),d=l.elapsed();if(this.telemetryService.publicLog2("diffEditor.computeDiff",{timeMs:d,timedOut:c?.quitEarly??!0,detectedMoves:i.computeMoves?c?.moves.length??0:-1}),n.isCancellationRequested)return{changes:[],identical:!1,quitEarly:!0,moves:[]};if(!c)throw new Error("no diff result available");return vg.diffCache.size>10&&vg.diffCache.delete(vg.diffCache.keys().next().value),vg.diffCache.set(s,{result:c,context:r}),c}setOptions(e){let t=!1;e.diffAlgorithm&&this.diffAlgorithm!==e.diffAlgorithm&&(this.diffAlgorithmOnDidChangeSubscription?.dispose(),this.diffAlgorithmOnDidChangeSubscription=void 0,this.diffAlgorithm=e.diffAlgorithm,typeof e.diffAlgorithm!="string"&&(this.diffAlgorithmOnDidChangeSubscription=e.diffAlgorithm.onDidChange(()=>this.onDidChangeEventEmitter.fire())),t=!0),t&&this.onDidChangeEventEmitter.fire()}},vg=Np,Np.diffCache=new Map,Np);RO=vg=nK([NO(1,Js),NO(2,$n)],RO);class uk{constructor(e,t,i){this.changes=e,this.moves=t,this.hitTimeout=i}}class oK{constructor(e,t){this.lineRangeMapping=e,this.changes=t}}class pd{static trivial(e,t){return new pd([new nn(ge.ofLength(e.length),ge.ofLength(t.length))],!1)}static trivialTimedOut(e,t){return new pd([new nn(ge.ofLength(e.length),ge.ofLength(t.length))],!0)}constructor(e,t){this.diffs=e,this.hitTimeout=t}}class nn{static invert(e,t){const i=[];return Y6(e,(n,s)=>{i.push(nn.fromOffsetPairs(n?n.getEndExclusives():md.zero,s?s.getStarts():new md(t,(n?n.seq2Range.endExclusive-n.seq1Range.endExclusive:0)+t)))}),i}static fromOffsetPairs(e,t){return new nn(new ge(e.offset1,t.offset1),new ge(e.offset2,t.offset2))}static assertSorted(e){let t;for(const i of e){if(t&&!(t.seq1Range.endExclusive<=i.seq1Range.start&&t.seq2Range.endExclusive<=i.seq2Range.start))throw new Ce("Sequence diffs must be sorted");t=i}}constructor(e,t){this.seq1Range=e,this.seq2Range=t}swap(){return new nn(this.seq2Range,this.seq1Range)}toString(){return`${this.seq1Range} <-> ${this.seq2Range}`}join(e){return new nn(this.seq1Range.join(e.seq1Range),this.seq2Range.join(e.seq2Range))}delta(e){return e===0?this:new nn(this.seq1Range.delta(e),this.seq2Range.delta(e))}deltaStart(e){return e===0?this:new nn(this.seq1Range.deltaStart(e),this.seq2Range.deltaStart(e))}deltaEnd(e){return e===0?this:new nn(this.seq1Range.deltaEnd(e),this.seq2Range.deltaEnd(e))}intersect(e){const t=this.seq1Range.intersect(e.seq1Range),i=this.seq2Range.intersect(e.seq2Range);if(!(!t||!i))return new nn(t,i)}getStarts(){return new md(this.seq1Range.start,this.seq2Range.start)}getEndExclusives(){return new md(this.seq1Range.endExclusive,this.seq2Range.endExclusive)}}const Tp=class Tp{constructor(e,t){this.offset1=e,this.offset2=t}toString(){return`${this.offset1} <-> ${this.offset2}`}delta(e){return e===0?this:new Tp(this.offset1+e,this.offset2+e)}equals(e){return this.offset1===e.offset1&&this.offset2===e.offset2}};Tp.zero=new Tp(0,0),Tp.max=new Tp(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);let md=Tp;const FN=class FN{isValid(){return!0}};FN.instance=new FN;let _w=FN;class Vve{constructor(e){if(this.timeout=e,this.startTime=Date.now(),this.valid=!0,e<=0)throw new Ce("timeout must be positive")}isValid(){return!(Date.now()-this.startTime<this.timeout)&&this.valid&&(this.valid=!1),this.valid}}class MO{constructor(e,t){this.width=e,this.height=t,this.array=[],this.array=new Array(e*t)}get(e,t){return this.array[e+t*this.width]}set(e,t,i){this.array[e+t*this.width]=i}}function AO(o){return o===32||o===9}const PS=class PS{static getKey(e){let t=this.chrKeys.get(e);return t===void 0&&(t=this.chrKeys.size,this.chrKeys.set(e,t)),t}constructor(e,t,i){this.range=e,this.lines=t,this.source=i,this.histogram=[];let n=0;for(let s=e.startLineNumber-1;s<e.endLineNumberExclusive-1;s++){const r=t[s];for(let l=0;l<r.length;l++){n++;const c=r[l],d=PS.getKey(c);this.histogram[d]=(this.histogram[d]||0)+1}n++;const a=PS.getKey(` |
| 385 | `);this.histogram[a]=(this.histogram[a]||0)+1}this.totalCount=n}computeSimilarity(e){let t=0;const i=Math.max(this.histogram.length,e.histogram.length);for(let n=0;n<i;n++)t+=Math.abs((this.histogram[n]??0)-(e.histogram[n]??0));return 1-t/(this.totalCount+e.totalCount)}};PS.chrKeys=new Map;let fk=PS;class zve{compute(e,t,i=_w.instance,n){if(e.length===0||t.length===0)return pd.trivial(e,t);const s=new MO(e.length,t.length),r=new MO(e.length,t.length),a=new MO(e.length,t.length);for(let g=0;g<e.length;g++)for(let p=0;p<t.length;p++){if(!i.isValid())return pd.trivialTimedOut(e,t);const _=g===0?0:s.get(g-1,p),b=p===0?0:s.get(g,p-1);let C;e.getElement(g)===t.getElement(p)?(g===0||p===0?C=0:C=s.get(g-1,p-1),g>0&&p>0&&r.get(g-1,p-1)===3&&(C+=a.get(g-1,p-1)),C+=n?n(g,p):1):C=-1;const w=Math.max(_,b,C);if(w===C){const v=g>0&&p>0?a.get(g-1,p-1):0;a.set(g,p,v+1),r.set(g,p,3)}else w===_?(a.set(g,p,0),r.set(g,p,1)):w===b&&(a.set(g,p,0),r.set(g,p,2));s.set(g,p,w)}const l=[];let c=e.length,d=t.length;function h(g,p){(g+1!==c||p+1!==d)&&l.push(new nn(new ge(g+1,c),new ge(p+1,d))),c=g,d=p}let u=e.length-1,f=t.length-1;for(;u>=0&&f>=0;)r.get(u,f)===3?(h(u,f),u--,f--):r.get(u,f)===1?u--:f--;return h(-1,-1),l.reverse(),new pd(l,!1)}}class rK{compute(e,t,i=_w.instance){if(e.length===0||t.length===0)return pd.trivial(e,t);const n=e,s=t;function r(p,_){for(;p<n.length&&_<s.length&&n.getElement(p)===s.getElement(_);)p++,_++;return p}let a=0;const l=new Uve;l.set(0,r(0,0));const c=new $ve;c.set(0,l.get(0)===0?null:new aK(null,0,0,l.get(0)));let d=0;e:for(;;){if(a++,!i.isValid())return pd.trivialTimedOut(n,s);const p=-Math.min(a,s.length+a%2),_=Math.min(a,n.length+a%2);for(d=p;d<=_;d+=2){const b=d===_?-1:l.get(d+1),C=d===p?-1:l.get(d-1)+1,w=Math.min(Math.max(b,C),n.length),v=w-d;if(w>n.length||v>s.length)continue;const S=r(w,v);l.set(d,S);const L=w===b?c.get(d+1):c.get(d-1);if(c.set(d,S!==w?new aK(L,w,v,S-w):L),l.get(d)===n.length&&l.get(d)-d===s.length)break e}}let h=c.get(d);const u=[];let f=n.length,g=s.length;for(;;){const p=h?h.x+h.length:0,_=h?h.y+h.length:0;if((p!==f||_!==g)&&u.push(new nn(new ge(p,f),new ge(_,g))),!h)break;f=h.x,g=h.y,h=h.prev}return u.reverse(),new pd(u,!1)}}class aK{constructor(e,t,i,n){this.prev=e,this.x=t,this.y=i,this.length=n}}class Uve{constructor(){this.positiveArr=new Int32Array(10),this.negativeArr=new Int32Array(10)}get(e){return e<0?(e=-e-1,this.negativeArr[e]):this.positiveArr[e]}set(e,t){if(e<0){if(e=-e-1,e>=this.negativeArr.length){const i=this.negativeArr;this.negativeArr=new Int32Array(i.length*2),this.negativeArr.set(i)}this.negativeArr[e]=t}else{if(e>=this.positiveArr.length){const i=this.positiveArr;this.positiveArr=new Int32Array(i.length*2),this.positiveArr.set(i)}this.positiveArr[e]=t}}}class $ve{constructor(){this.positiveArr=[],this.negativeArr=[]}get(e){return e<0?(e=-e-1,this.negativeArr[e]):this.positiveArr[e]}set(e,t){e<0?(e=-e-1,this.negativeArr[e]=t):this.positiveArr[e]=t}}class gk{constructor(e,t,i){this.lines=e,this.range=t,this.considerWhitespaceChanges=i,this.elements=[],this.firstElementOffsetByLineIdx=[],this.lineStartOffsets=[],this.trimmedWsLengthsByLineIdx=[],this.firstElementOffsetByLineIdx.push(0);for(let n=this.range.startLineNumber;n<=this.range.endLineNumber;n++){let s=e[n-1],r=0;n===this.range.startLineNumber&&this.range.startColumn>1&&(r=this.range.startColumn-1,s=s.substring(r)),this.lineStartOffsets.push(r);let a=0;if(!i){const c=s.trimStart();a=s.length-c.length,s=c.trimEnd()}this.trimmedWsLengthsByLineIdx.push(a);const l=n===this.range.endLineNumber?Math.min(this.range.endColumn-1-r-a,s.length):s.length;for(let c=0;c<l;c++)this.elements.push(s.charCodeAt(c));n<this.range.endLineNumber&&(this.elements.push(10),this.firstElementOffsetByLineIdx.push(this.elements.length))}}toString(){return`Slice: "${this.text}"`}get text(){return this.getText(new ge(0,this.length))}getText(e){return this.elements.slice(e.start,e.endExclusive).map(t=>String.fromCharCode(t)).join("")}getElement(e){return this.elements[e]}get length(){return this.elements.length}getBoundaryScore(e){const t=dK(e>0?this.elements[e-1]:-1),i=dK(e<this.elements.length?this.elements[e]:-1);if(t===7&&i===8)return 0;if(t===8)return 150;let n=0;return t!==i&&(n+=10,t===0&&i===1&&(n+=1)),n+=cK(t),n+=cK(i),n}translateOffset(e,t="right"){const i=I_(this.firstElementOffsetByLineIdx,s=>s<=e),n=e-this.firstElementOffsetByLineIdx[i];return new M(this.range.startLineNumber+i,1+this.lineStartOffsets[i]+n+(n===0&&t==="left"?0:this.trimmedWsLengthsByLineIdx[i]))}translateRange(e){const t=this.translateOffset(e.start,"right"),i=this.translateOffset(e.endExclusive,"left");return i.isBefore(t)?k.fromPositions(i,i):k.fromPositions(t,i)}findWordContaining(e){if(e<0||e>=this.elements.length||!J_(this.elements[e]))return;let t=e;for(;t>0&&J_(this.elements[t-1]);)t--;let i=e;for(;i<this.elements.length&&J_(this.elements[i]);)i++;return new ge(t,i)}findSubWordContaining(e){if(e<0||e>=this.elements.length||!J_(this.elements[e]))return;let t=e;for(;t>0&&J_(this.elements[t-1])&&!lK(this.elements[t]);)t--;let i=e;for(;i<this.elements.length&&J_(this.elements[i])&&!lK(this.elements[i]);)i++;return new ge(t,i)}countLinesIn(e){return this.translateOffset(e.endExclusive).lineNumber-this.translateOffset(e.start).lineNumber}isStronglyEqual(e,t){return this.elements[e]===this.elements[t]}extendToFullLines(e){const t=k_(this.firstElementOffsetByLineIdx,n=>n<=e.start)??0,i=Lue(this.firstElementOffsetByLineIdx,n=>e.endExclusive<=n)??this.elements.length;return new ge(t,i)}}function J_(o){return o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57}function lK(o){return o>=65&&o<=90}const jve={0:0,1:0,2:0,3:10,4:2,5:30,6:3,7:10,8:10};function cK(o){return jve[o]}function dK(o){return o===10?8:o===13?7:AO(o)?6:o>=97&&o<=122?0:o>=65&&o<=90?1:o>=48&&o<=57?2:o===-1?3:o===44||o===59?5:4}function qve(o,e,t,i,n,s){let{moves:r,excludedChanges:a}=Gve(o,e,t,s);if(!s.isValid())return[];const l=o.filter(d=>!a.has(d)),c=Zve(l,i,n,e,t,s);return aM(r,c),r=Yve(r),r=r.filter(d=>{const h=d.original.toOffsetRange().slice(e).map(f=>f.trim());return h.join(` |
| 386 | `).length>=15&&Kve(h,f=>f.length>=2)>=2}),r=Xve(o,r),r}function Kve(o,e){let t=0;for(const i of o)e(i)&&t++;return t}function Gve(o,e,t,i){const n=[],s=o.filter(l=>l.modified.isEmpty&&l.original.length>=3).map(l=>new fk(l.original,e,l)),r=new Set(o.filter(l=>l.original.isEmpty&&l.modified.length>=3).map(l=>new fk(l.modified,t,l))),a=new Set;for(const l of s){let c=-1,d;for(const h of r){const u=l.computeSimilarity(h);u>c&&(c=u,d=h)}if(c>.9&&d&&(r.delete(d),n.push(new us(l.range,d.range)),a.add(l.source),a.add(d.source)),!i.isValid())return{moves:n,excludedChanges:a}}return{moves:n,excludedChanges:a}}function Zve(o,e,t,i,n,s){const r=[],a=new ZH;for(const u of o)for(let f=u.original.startLineNumber;f<u.original.endLineNumberExclusive-2;f++){const g=`${e[f-1]}:${e[f+1-1]}:${e[f+2-1]}`;a.add(g,{range:new Ie(f,f+3)})}const l=[];o.sort(kn(u=>u.modified.startLineNumber,ho));for(const u of o){let f=[];for(let g=u.modified.startLineNumber;g<u.modified.endLineNumberExclusive-2;g++){const p=`${t[g-1]}:${t[g+1-1]}:${t[g+2-1]}`,_=new Ie(g,g+3),b=[];a.forEach(p,({range:C})=>{for(const v of f)if(v.originalLineRange.endLineNumberExclusive+1===C.endLineNumberExclusive&&v.modifiedLineRange.endLineNumberExclusive+1===_.endLineNumberExclusive){v.originalLineRange=new Ie(v.originalLineRange.startLineNumber,C.endLineNumberExclusive),v.modifiedLineRange=new Ie(v.modifiedLineRange.startLineNumber,_.endLineNumberExclusive),b.push(v);return}const w={modifiedLineRange:_,originalLineRange:C};l.push(w),b.push(w)}),f=b}if(!s.isValid())return[]}l.sort(tH(kn(u=>u.modifiedLineRange.length,ho)));const c=new Mr,d=new Mr;for(const u of l){const f=u.modifiedLineRange.startLineNumber-u.originalLineRange.startLineNumber,g=c.subtractFrom(u.modifiedLineRange),p=d.subtractFrom(u.originalLineRange).getWithDelta(f),_=g.getIntersection(p);for(const b of _.ranges){if(b.length<3)continue;const C=b,w=b.delta(-f);r.push(new us(w,C)),c.addRange(C),d.addRange(w)}}r.sort(kn(u=>u.original.startLineNumber,ho));const h=new tx(o);for(let u=0;u<r.length;u++){const f=r[u],g=h.findLastMonotonous(L=>L.original.startLineNumber<=f.original.startLineNumber),p=k_(o,L=>L.modified.startLineNumber<=f.modified.startLineNumber),_=Math.max(f.original.startLineNumber-g.original.startLineNumber,f.modified.startLineNumber-p.modified.startLineNumber),b=h.findLastMonotonous(L=>L.original.startLineNumber<f.original.endLineNumberExclusive),C=k_(o,L=>L.modified.startLineNumber<f.modified.endLineNumberExclusive),w=Math.max(b.original.endLineNumberExclusive-f.original.endLineNumberExclusive,C.modified.endLineNumberExclusive-f.modified.endLineNumberExclusive);let v;for(v=0;v<_;v++){const L=f.original.startLineNumber-v-1,x=f.modified.startLineNumber-v-1;if(L>i.length||x>n.length||c.contains(x)||d.contains(L)||!hK(i[L-1],n[x-1],s))break}v>0&&(d.addRange(new Ie(f.original.startLineNumber-v,f.original.startLineNumber)),c.addRange(new Ie(f.modified.startLineNumber-v,f.modified.startLineNumber)));let S;for(S=0;S<w;S++){const L=f.original.endLineNumberExclusive+S,x=f.modified.endLineNumberExclusive+S;if(L>i.length||x>n.length||c.contains(x)||d.contains(L)||!hK(i[L-1],n[x-1],s))break}S>0&&(d.addRange(new Ie(f.original.endLineNumberExclusive,f.original.endLineNumberExclusive+S)),c.addRange(new Ie(f.modified.endLineNumberExclusive,f.modified.endLineNumberExclusive+S))),(v>0||S>0)&&(r[u]=new us(new Ie(f.original.startLineNumber-v,f.original.endLineNumberExclusive+S),new Ie(f.modified.startLineNumber-v,f.modified.endLineNumberExclusive+S)))}return r}function hK(o,e,t){if(o.trim()===e.trim())return!0;if(o.length>300&&e.length>300)return!1;const n=new rK().compute(new gk([o],new k(1,1,1,o.length),!1),new gk([e],new k(1,1,1,e.length),!1),t);let s=0;const r=nn.invert(n.diffs,o.length);for(const d of r)d.seq1Range.forEach(h=>{AO(o.charCodeAt(h))||s++});function a(d){let h=0;for(let u=0;u<o.length;u++)AO(d.charCodeAt(u))||h++;return h}const l=a(o.length>e.length?o:e);return s/l>.6&&l>10}function Yve(o){if(o.length===0)return o;o.sort(kn(t=>t.original.startLineNumber,ho));const e=[o[0]];for(let t=1;t<o.length;t++){const i=e[e.length-1],n=o[t],s=n.original.startLineNumber-i.original.endLineNumberExclusive,r=n.modified.startLineNumber-i.modified.endLineNumberExclusive;if(s>=0&&r>=0&&s+r<=2){e[e.length-1]=i.join(n);continue}e.push(n)}return e}function Xve(o,e){const t=new tx(o);return e=e.filter(i=>{const n=t.findLastMonotonous(a=>a.original.startLineNumber<i.original.endLineNumberExclusive)||new us(new Ie(1,1),new Ie(1,1)),s=k_(o,a=>a.modified.startLineNumber<i.modified.endLineNumberExclusive);return n!==s}),e}function uK(o,e,t){let i=t;return i=fK(o,e,i),i=fK(o,e,i),i=Qve(o,e,i),i}function fK(o,e,t){if(t.length===0)return t;const i=[];i.push(t[0]);for(let s=1;s<t.length;s++){const r=i[i.length-1];let a=t[s];if(a.seq1Range.isEmpty||a.seq2Range.isEmpty){const l=a.seq1Range.start-r.seq1Range.endExclusive;let c;for(c=1;c<=l&&!(o.getElement(a.seq1Range.start-c)!==o.getElement(a.seq1Range.endExclusive-c)||e.getElement(a.seq2Range.start-c)!==e.getElement(a.seq2Range.endExclusive-c));c++);if(c--,c===l){i[i.length-1]=new nn(new ge(r.seq1Range.start,a.seq1Range.endExclusive-l),new ge(r.seq2Range.start,a.seq2Range.endExclusive-l));continue}a=a.delta(-c)}i.push(a)}const n=[];for(let s=0;s<i.length-1;s++){const r=i[s+1];let a=i[s];if(a.seq1Range.isEmpty||a.seq2Range.isEmpty){const l=r.seq1Range.start-a.seq1Range.endExclusive;let c;for(c=0;c<l&&!(!o.isStronglyEqual(a.seq1Range.start+c,a.seq1Range.endExclusive+c)||!e.isStronglyEqual(a.seq2Range.start+c,a.seq2Range.endExclusive+c));c++);if(c===l){i[s+1]=new nn(new ge(a.seq1Range.start+l,r.seq1Range.endExclusive),new ge(a.seq2Range.start+l,r.seq2Range.endExclusive));continue}c>0&&(a=a.delta(c))}n.push(a)}return i.length>0&&n.push(i[i.length-1]),n}function Qve(o,e,t){if(!o.getBoundaryScore||!e.getBoundaryScore)return t;for(let i=0;i<t.length;i++){const n=i>0?t[i-1]:void 0,s=t[i],r=i+1<t.length?t[i+1]:void 0,a=new ge(n?n.seq1Range.endExclusive+1:0,r?r.seq1Range.start-1:o.length),l=new ge(n?n.seq2Range.endExclusive+1:0,r?r.seq2Range.start-1:e.length);s.seq1Range.isEmpty?t[i]=gK(s,o,e,a,l):s.seq2Range.isEmpty&&(t[i]=gK(s.swap(),e,o,l,a).swap())}return t}function gK(o,e,t,i,n){let r=1;for(;o.seq1Range.start-r>=i.start&&o.seq2Range.start-r>=n.start&&t.isStronglyEqual(o.seq2Range.start-r,o.seq2Range.endExclusive-r)&&r<100;)r++;r--;let a=0;for(;o.seq1Range.start+a<i.endExclusive&&o.seq2Range.endExclusive+a<n.endExclusive&&t.isStronglyEqual(o.seq2Range.start+a,o.seq2Range.endExclusive+a)&&a<100;)a++;if(r===0&&a===0)return o;let l=0,c=-1;for(let d=-r;d<=a;d++){const h=o.seq2Range.start+d,u=o.seq2Range.endExclusive+d,f=o.seq1Range.start+d,g=e.getBoundaryScore(f)+t.getBoundaryScore(h)+t.getBoundaryScore(u);g>c&&(c=g,l=d)}return o.delta(l)}function Jve(o,e,t){const i=[];for(const n of t){const s=i[i.length-1];if(!s){i.push(n);continue}n.seq1Range.start-s.seq1Range.endExclusive<=2||n.seq2Range.start-s.seq2Range.endExclusive<=2?i[i.length-1]=new nn(s.seq1Range.join(n.seq1Range),s.seq2Range.join(n.seq2Range)):i.push(n)}return i}function pK(o,e,t,i,n=!1){const s=nn.invert(t,o.length),r=[];let a=new md(0,0);function l(d,h){if(d.offset1<a.offset1||d.offset2<a.offset2)return;const u=i(o,d.offset1),f=i(e,d.offset2);if(!u||!f)return;let g=new nn(u,f);const p=g.intersect(h);let _=p.seq1Range.length,b=p.seq2Range.length;for(;s.length>0;){const C=s[0];if(!(C.seq1Range.intersects(g.seq1Range)||C.seq2Range.intersects(g.seq2Range)))break;const v=i(o,C.seq1Range.start),S=i(e,C.seq2Range.start),L=new nn(v,S),x=L.intersect(C);if(_+=x.seq1Range.length,b+=x.seq2Range.length,g=g.join(L),g.seq1Range.endExclusive>=C.seq1Range.endExclusive)s.shift();else break}(n&&_+b<g.seq1Range.length+g.seq2Range.length||_+b<(g.seq1Range.length+g.seq2Range.length)*2/3)&&r.push(g),a=g.getEndExclusives()}for(;s.length>0;){const d=s.shift();d.seq1Range.isEmpty||(l(d.getStarts(),d),l(d.getEndExclusives().delta(-1),d))}return e1e(t,r)}function e1e(o,e){const t=[];for(;o.length>0||e.length>0;){const i=o[0],n=e[0];let s;i&&(!n||i.seq1Range.start<n.seq1Range.start)?s=o.shift():s=e.shift(),t.length>0&&t[t.length-1].seq1Range.endExclusive>=s.seq1Range.start?t[t.length-1]=t[t.length-1].join(s):t.push(s)}return t}function t1e(o,e,t){let i=t;if(i.length===0)return i;let n=0,s;do{s=!1;const r=[i[0]];for(let a=1;a<i.length;a++){let d=function(u,f){const g=new ge(c.seq1Range.endExclusive,l.seq1Range.start);return o.getText(g).replace(/\s/g,"").length<=4&&(u.seq1Range.length+u.seq2Range.length>5||f.seq1Range.length+f.seq2Range.length>5)};const l=i[a],c=r[r.length-1];d(c,l)?(s=!0,r[r.length-1]=r[r.length-1].join(l)):r.push(l)}i=r}while(n++<10&&s);return i}function i1e(o,e,t){let i=t;if(i.length===0)return i;let n=0,s;do{s=!1;const a=[i[0]];for(let l=1;l<i.length;l++){let h=function(f,g){const p=new ge(d.seq1Range.endExclusive,c.seq1Range.start);if(o.countLinesIn(p)>5||p.length>500)return!1;const b=o.getText(p).trim();if(b.length>20||b.split(/\r\n|\r|\n/).length>1)return!1;const C=o.countLinesIn(f.seq1Range),w=f.seq1Range.length,v=e.countLinesIn(f.seq2Range),S=f.seq2Range.length,L=o.countLinesIn(g.seq1Range),x=g.seq1Range.length,I=e.countLinesIn(g.seq2Range),D=g.seq2Range.length,R=130;function O(F){return Math.min(F,R)}return Math.pow(Math.pow(O(C*40+w),1.5)+Math.pow(O(v*40+S),1.5),1.5)+Math.pow(Math.pow(O(L*40+x),1.5)+Math.pow(O(I*40+D),1.5),1.5)>(R**1.5)**1.5*1.3};const c=i[l],d=a[a.length-1];h(d,c)?(s=!0,a[a.length-1]=a[a.length-1].join(c)):a.push(c)}i=a}while(n++<10&&s);const r=[];return dse(i,(a,l,c)=>{let d=l;function h(b){return b.length>0&&b.trim().length<=3&&l.seq1Range.length+l.seq2Range.length>100}const u=o.extendToFullLines(l.seq1Range),f=o.getText(new ge(u.start,l.seq1Range.start));h(f)&&(d=d.deltaStart(-f.length));const g=o.getText(new ge(l.seq1Range.endExclusive,u.endExclusive));h(g)&&(d=d.deltaEnd(g.length));const p=nn.fromOffsetPairs(a?a.getEndExclusives():md.zero,c?c.getStarts():md.max),_=d.intersect(p);r.length>0&&_.getStarts().equals(r[r.length-1].getEndExclusives())?r[r.length-1]=r[r.length-1].join(_):r.push(_)}),r}let mK=class{constructor(e,t){this.trimmedHash=e,this.lines=t}getElement(e){return this.trimmedHash[e]}get length(){return this.trimmedHash.length}getBoundaryScore(e){const t=e===0?0:_K(this.lines[e-1]),i=e===this.lines.length?0:_K(this.lines[e]);return 1e3-(t+i)}getText(e){return this.lines.slice(e.start,e.endExclusive).join(` |