(()=>{"use strict";var e={398:e=>{e.exports=require("vscode")},928:e=>{e.exports=require("path")}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i](o,o.exports,n),o.exports}var i={};(()=>{var e=i;Object.defineProperty(e,"__esModule",{value:!0}),e.activate=function(e){const n=t.window.createTextEditorDecorationType({opacity:"0.7"}),i=t.window.createTextEditorDecorationType({fontWeight:"bold"}),r=e=>{const t=h(e.document).filter(x),r=t.filter((e=>e.isContext)).map((e=>e.prefixRange)),o=t.filter((e=>!e.isContext)).map((e=>e.prefixRange));e.setDecorations(n,r),e.setDecorations(i,o)};t.window.activeTextEditor&&"search-result"===t.window.activeTextEditor.document.languageId&&r(t.window.activeTextEditor),e.subscriptions.push(t.languages.registerDocumentSymbolProvider(c,{provideDocumentSymbols:(e,n)=>h(e,n).filter(f).map((e=>new t.DocumentSymbol(e.path,"",t.SymbolKind.File,e.allLocations.map((({originSelectionRange:e})=>e)).reduce(((e,t)=>e.union(t)),e.location.originSelectionRange),e.location.originSelectionRange)))}),t.languages.registerCompletionItemProvider(c,{provideCompletionItems(e,t){const n=e.lineAt(t.line);if(t.line>3)return[];if(0===t.character||1===t.character&&"#"===n.text){const n=Array.from({length:l.length}).map(((t,n)=>e.lineAt(n).text));return l.filter((e=>n.every((t=>-1===t.indexOf(e))))).map((e=>({label:e,insertText:e.slice(t.character)+" "})))}return-1===n.text.indexOf("# Flags:")?[]:g.filter((e=>-1===n.text.indexOf(e))).map((e=>({label:e,insertText:e+" "})))}},"#"),t.languages.registerDefinitionProvider(c,{provideDefinition(e,n,i){const r=h(e,i)[n.line];if(!r)return[];if("file"===r.type)return r.allLocations.map((e=>({...e,originSelectionRange:r.location.originSelectionRange})));const o=r.locations.find((e=>e.originSelectionRange.contains(n)));if(!o)return[];const a=new t.Position(o.targetSelectionRange.start.line,o.targetSelectionRange.start.character+(n.character-o.originSelectionRange.start.character));return[{...o,targetSelectionRange:new t.Range(a,a)}]}}),t.languages.registerDocumentLinkProvider(c,{provideDocumentLinks:async(e,t)=>h(e,t).filter(f).map((({location:e})=>({range:e.originSelectionRange,target:e.targetUri})))}),t.window.onDidChangeActiveTextEditor((e=>{"search-result"===e?.document.languageId&&(u=void 0,d?.dispose(),d=t.workspace.onDidChangeTextDocument((t=>{t.document.uri===e.document.uri&&r(e)})),r(e))})),{dispose(){u=void 0,d?.dispose()}})};const t=n(398),r=n(928),o=/^(\S.*):$/,a=/^(\s+)(\d+)(: |  )(\s*)(.*)$/,s=/⟪ ([0-9]+) characters skipped ⟫/g,c={language:"search-result",exclusive:!0},l=["# Query:","# Flags:","# Including:","# Excluding:","# ContextLines:"],g=["RegExp","CaseSensitive","IgnoreExcludeSettings","WordMatch"];let u,d;function p(e,n){if(e.startsWith("(Settings) "))return t.Uri.file(e.slice(11)).with({scheme:"vscode-userdata"});if(r.isAbsolute(e))return/^[\\\/]Untitled-\d*$/.test(e)?t.Uri.file(e.slice(1)).with({scheme:"untitled",path:e.slice(1)}):t.Uri.file(e);if(0===e.indexOf("~/")){const n=process.env.HOME||process.env.HOMEPATH||"";return t.Uri.file(r.join(n,e.slice(2)))}const i=(e,n)=>t.Uri.joinPath(e.uri,n);if(t.workspace.workspaceFolders){const r=/^(.*) • (.*)$/.exec(e);if(r){const[,e,n]=r,o=t.workspace.workspaceFolders.filter((t=>t.name===e))[0];if(o)return i(o,n)}else{if(1===t.workspace.workspaceFolders.length)return i(t.workspace.workspaceFolders[0],e);if("untitled"!==n.scheme){const r=t.workspace.workspaceFolders.filter((e=>n.toString().startsWith(e.uri.toString())))[0];if(r)return i(r,e)}}}console.error(`Unable to resolve path ${e}`)}const f=e=>"file"===e.type,x=e=>"result"===e.type;function h(e,n){if(u&&u.uri===e.uri&&u.version===e.version)return u.parse;const i=e.getText().split(/\r?\n/),r=[];let c,l;for(let g=0;g<i.length;g++){if(n?.isCancellationRequested)return[];const u=i[g],d=o.exec(u);if(d){const[,n]=d;if(c=p(n,e.uri),!c)continue;l=[];const i={targetRange:new t.Range(0,0,0,1),targetUri:c,originSelectionRange:new t.Range(g,0,g,u.length)};r[g]={type:"file",location:i,allLocations:l,path:n}}if(!c)continue;const f=a.exec(u);if(f){const[,e,n,i]=f,o=+n-1,a=(e+n+i).length,d=new t.Range(Math.max(o-3,0),0,o+3,u.length),p=[];let x=a,h=0;s.lastIndex=a;for(let e;e=s.exec(u);)p.push({targetRange:d,targetSelectionRange:new t.Range(o,h,o,h),targetUri:c,originSelectionRange:new t.Range(g,x,g,s.lastIndex-e[0].length)}),h+=s.lastIndex-x-e[0].length+Number(e[1]),x=s.lastIndex;x<u.length&&p.push({targetRange:d,targetSelectionRange:new t.Range(o,h,o,h),targetUri:c,originSelectionRange:new t.Range(g,x,g,u.length)}),i.includes(":")&&l?.push(...p);const w={targetRange:d,targetSelectionRange:new t.Range(o,0,o,1),targetUri:c,originSelectionRange:new t.Range(g,0,g,a-1)};p.push(w),r[g]={type:"result",locations:p,isContext:" "===i,prefixRange:new t.Range(g,0,g,a)}}}return u={version:e.version,parse:r,uri:e.uri},r}})();var r=exports;for(var o in i)r[o]=i[o];i.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();
//# sourceMappingURL=https://main.vscode-cdn.net/sourcemaps/35642e2bdf7db457ef4b4d7fb485a9b9adda252f/extensions/search-result/dist/extension.js.map