export default class SearchResultsPane extends UI.VBox{constructor(searchConfig){super(true);this._searchConfig=searchConfig;this._searchResults=[];this._treeOutline=new UI.TreeOutlineInShadow();this._treeOutline.hideOverflow();this._treeOutline.registerRequiredCSS('search/searchResultsPane.css');this.contentElement.appendChild(this._treeOutline.element);this._matchesExpandedCount=0;} addSearchResult(searchResult){this._searchResults.push(searchResult);this._addTreeElement(searchResult);} _addTreeElement(searchResult){const treeElement=new Search.SearchResultsPane.SearchResultsTreeElement(this._searchConfig,searchResult);this._treeOutline.appendChild(treeElement);if(!this._treeOutline.selectedTreeElement){treeElement.select(true,true);} if(this._matchesExpandedCount{if(isEnterKey(event)){event.consume(true);Common.Revealer.reveal(searchResult.matchRevealable(i));}});searchMatchElement.tooltip=lineContent;}} _appendShowMoreMatchesElement(startMatchIndex){const matchesLeftCount=this._searchResult.matchesCount()-startMatchIndex;const showMoreMatchesText=Common.UIString('Show %d more',matchesLeftCount);const showMoreMatchesTreeElement=new UI.TreeElement(showMoreMatchesText);this.appendChild(showMoreMatchesTreeElement);showMoreMatchesTreeElement.listItemElement.classList.add('show-more-matches');showMoreMatchesTreeElement.onselect=this._showMoreMatchesElementSelected.bind(this,showMoreMatchesTreeElement,startMatchIndex);} _createContentSpan(lineContent,matchRanges){let trimBy=0;if(matchRanges.length>0&&matchRanges[0].offset>20){trimBy=15;} lineContent=lineContent.substring(trimBy,1000+trimBy);if(trimBy){matchRanges=matchRanges.map(range=>new TextUtils.SourceRange(range.offset-trimBy+1,range.length));lineContent='\u2026'+lineContent;} const contentSpan=createElement('span');contentSpan.className='search-match-content';contentSpan.textContent=lineContent;UI.ARIAUtils.setAccessibleName(contentSpan,`${lineContent} line`);UI.highlightRangesWithStyleClass(contentSpan,matchRanges,'highlighted-match');return contentSpan;} _regexMatchRanges(lineContent,regex){regex.lastIndex=0;let match;const matchRanges=[];while((regex.lastIndex