@sourcegraph/code-host-integration 0.0.76 → 0.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
alwaysNil
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
`,variables:{...e,source:Un.CODEHOSTINTEGRATION,argument:e.argument&&JSON.stringify(e.argument),publicArgument:e.publicArgument&&JSON.stringify(e.publicArgument)},mightContainPrivateInfo:!1}).subscribe({error:e=>{}})})({name:e,userCookieID:o,url:this.sourcegraphURL,argument:{platform:this.platform,version:this.version,...t},publicArgument:{platform:this.platform,version:this.version,...n}},this.requestGraphQL)}async log(e,t,n){switch(e){case"findReferences":await this.logEvent(e,t,n,Xn.CODEINTELINTEGRATIONREFS);break;case"goToDefinition":case"goToDefinition.preloaded":case"hover":await this.logEvent(e,t,n,Xn.CODEINTELINTEGRATION);break;default:await this.logEvent(e,t,n)}}async logViewEvent(e,t){await this.logEvent(`View${e}`,t)}async logPageView(e,t,n){await this.logEvent(`${e}Viewed`,t,n)}}const du={allowErrorReporting:!1,sendTelemetry:!0,experimentalLinkPreviews:!1,experimentalTextFieldCompletion:!1,clickToGoToDefinition:!1},hu=({get:e,set:t})=>({set:t,enable:e=>t(e,!0),disable:e=>t(e,!1),async isEnabled(t){const n=await e(t);return"boolean"==typeof n?n:du[t]},async toggle(n){const r=await e(n);return await t(n,!r),!r}});const mu=hu({get:async function(e){const{featureFlags:t={}}=await It.sync.get();return t[e]},set:async function(e,t){const{featureFlags:n}=await It.sync.get("featureFlags");await It.sync.set({featureFlags:{...n,[e]:t}})}}),gu=hu({get:async e=>{const t=localStorage.getItem(e);return null===t?void 0:"true"===t},set:async(e,t)=>{localStorage.setItem(e,String(t))}}),vu=Ft?gu:mu,bu={sendTelemetry:!1,allowErrorReporting:!1,experimentalLinkPreviews:!1,experimentalTextFieldCompletion:!1,clickToGoToDefinition:!1},yu=e=>({...bu,...e}),wu=()=>(jt?Pt("sync","featureFlags"):X(void 0)).pipe(te(yu));function Eu(e){return wu().pipe(te((t=>t[e])),Ro())}const _u=e=>Tt(e).pipe(te((t=>!(Ot()&&e)||!At(t)))),xu=e=>So([_u(e),Eu("sendTelemetry")]).pipe(te((([e,t])=>!!e||t)));function Su(){const{host:e,pathname:t}=location,[n,r]=t.slice(1).split("/");if(!n||!r)throw new Dr(`Could not parse repoName from Bitbucket Cloud url: ${location.href}`);return`${e}/${n}/${r}`}const Ou={getCodeElementFromTarget:e=>e.closest(".view-line > span"),getLineNumberFromCodeElement:e=>{if(!document.querySelector(".line-number"))throw new Error("No line number elements found on the currently viewed page");const t=e.closest(".react-monaco-editor-container");if(!t)throw new Error("No editor found");const n=e.closest(".view-line"),r=[...t.querySelectorAll(".view-line")].findIndex((e=>e===n)),o=t.querySelectorAll(".line-number")[r];if(o){var i,a,s;let e=parseInt(null!==(i=o.dataset.lineNum)&&void 0!==i?i:"",10);if(!isNaN(e))return e;if(e=parseInt(null!==(a=null===(s=o.textContent)||void 0===s?void 0:s.trim())&&void 0!==a?a:"",10),!isNaN(e))return e}throw new Error("Could not find line number")},getLineElementFromLineNumber:Cu,getCodeElementFromLineNumber:(e,t)=>{const n=Cu(e,t);if(!n)return null;const r=n.querySelector(":scope > span");return r||console.error(`Could not find code element inside .view-line container for line #${t}`),r}};function Cu(e,t){let n=e.querySelector(`[data-line-num="${t}"]`);if(!n)for(const o of e.querySelectorAll(".line-number")){var r;if(parseInt(null!==(r=o.textContent)&&void 0!==r?r:"",10)===t){n=o;break}}if(!n)return console.error(`Could not find line number element for line #${t}`),null;const o=[...e.querySelectorAll(".line-number")].findIndex((e=>e===n)),i=e.querySelectorAll(".view-line")[o];return i||console.error(`Could not find line element for line #${t}`),i}function Tu(e,t,n){var r,o;const i=null===(r=e.querySelector(`[aria-label="${"base"===n?"From":"To"} line ${t}"]`))||void 0===r||null===(o=r.closest(".line-wrapper"))||void 0===o?void 0:o.querySelector(".code-component");if(!i)throw new Error(`Could not locate line number element for line ${t}, part: ${String(n)}`);return i}const ku={getCodeElementFromTarget:e=>e.closest(".code-diff"),getLineNumberFromCodeElement:e=>{var t;const n=e.closest(".line-wrapper"),r=null==n?void 0:n.querySelectorAll(".line-number-permalink");if(!r||0===r.length)throw new Error("Could not find line number permalink(s) for code element");const o=r[r.length-1],i=parseInt(null!==(t=o.textContent)&&void 0!==t?t:"",10);if(!isNaN(i))return i;throw new Error("Could not find line number for code element")},getLineElementFromLineNumber:Tu,getCodeElementFromLineNumber:(e,t,n)=>{var r;return null===(r=Tu(e,t,n))||void 0===r?void 0:r.querySelector(".code-diff")},getDiffCodePart:e=>{var t,n,r;const o=e.closest(".code-component"),i=null==o?void 0:o.querySelector(".line-type");if(null!=i&&null!==(t=i.textContent)&&void 0!==t&&t.includes("+"))return"head";if(null!=i&&null!==(n=i.textContent)&&void 0!==n&&n.includes("+"))return"base";if(!e.closest(".side-by-side"))return"head";const a=e.closest(".line-wrapper");if(null!=a&&a.id)return null!=a&&a.id.includes("oldline")?"base":"head";return 0===[...(null==a||null===(r=a.parentElement)||void 0===r?void 0:r.childNodes)||[]].findIndex((e=>e===a))?"base":"head"},isFirstCharacterDiffIndicator:()=>!1};function Nu(e,t,n){var r;const o=null===(r=e.querySelector(`[data-${"base"===n?"f":"t"}num="${t}"]`))||void 0===r?void 0:r.closest(".udiff-line");if(!o)throw new Error(`Could not locate line number element for line ${t}, part: ${String(n)}`);return o}const Au={getCodeElementFromTarget:e=>e.closest(".source"),getLineNumberFromCodeElement:e=>{const t=e.closest(".udiff-line");if(!t)throw new Error("Could not find line element");const n=t.querySelector(".line-numbers");if(!n)throw new Error("Could not find line numbers element");const r=null==n?void 0:n.dataset.tnum;if(r){const e=parseInt(r,10);if(!isNaN(e))return e}const o=null==n?void 0:n.dataset.fnum;if(o){const e=parseInt(o,10);if(!isNaN(e))return e}throw new Error("Could not find line number for code element")},getLineElementFromLineNumber:Nu,getCodeElementFromLineNumber:(e,t,n)=>{var r;return null===(r=Nu(e,t,n))||void 0===r?void 0:r.querySelector(".source")},getDiffCodePart:e=>{const t=e.closest(".udiff-line");if(!t)throw new Error("Could not find line element for code element");return t.classList.contains("deletion")?"base":"head"},isFirstCharacterDiffIndicator:()=>!0},Iu=e=>e.replace("//","/"),Pu=["modified","renamed","removed","added"];function Ru(){const e=Su(),t=location.pathname.match(/src\/(.*?)\/(.*)/);if(!t)throw new Error("Unable to determine revision or file path");const n=decodeURIComponent(t[1]),r=decodeURIComponent(t[2]),o=function(){const e=['a[type="button"]',"a"];for(const t of e){const e=document.querySelectorAll(t);for(const t of e){const e=t.href.match(/full-commit\/([\da-f]{40})\//);if(e)return e[1]}}return null}();return{blob:{rawRepoName:e,revision:n,filePath:r,commitID:null!=o?o:n}}}function Du(e){const t=Su(),n=function(e){const t=[...e.querySelectorAll('[data-qa="bk-file__header"] span')];for(const e of t)for(const t of Pu){var n;if(null!==(n=e.textContent)&&void 0!==n&&n.toLowerCase().includes(t))return t}return"modified"}(e),{base:r,head:o}=function(e,t){var n;const r=null===(n=e.querySelector('[data-qa="bk-filepath"]'))||void 0===n?void 0:n.cloneNode(!0),o=null==r?void 0:r.textContent;if(!(r instanceof HTMLElement&&o))throw new Error("Could not find breadcrumbs component for code view");if("added"===t)return{head:o};if("removed"===t)return{base:o};if("modified"===t)return{base:o,head:o};const i="<>SEPARATOR<>",a=r.querySelectorAll('[aria-label="arrow"]');for(const e of a)e.textContent=i;const[s,c,l]=r.textContent.split(/[{}]/),[u,f]=c.split(i);return{base:Iu(s+u+l),head:Iu(s+f+l)}}(e,n),{baseRevision:i,headRevision:a}=function(){var e,t;const n=document.querySelector('[data-qa="pr-branches-and-state-styles"]');if(!n)throw new Error("Could not find branches element");const r=[...n.querySelectorAll('[aria-hidden="true"]')];if(2!==r.length)throw new Error("Expected source and destination branch elements");const o=null!==(e=r[0].textContent)&&void 0!==e?e:"";return{baseRevision:null!==(t=r[1].textContent)&&void 0!==t?t:"",headRevision:o}}();return"added"===n?{head:{rawRepoName:t,filePath:o,commitID:a,revision:a}}:"removed"===n?{base:{rawRepoName:t,filePath:r,commitID:i,revision:i}}:{head:{rawRepoName:t,filePath:o,commitID:a,revision:a},base:{rawRepoName:t,filePath:r,commitID:i,revision:i}}}function Lu(e){const t=Su(),n=function(e){const t=e.querySelector(".diff-entry-lozenge");for(const e of Pu){var n;if(null!=t&&null!==(n=t.textContent)&&void 0!==n&&n.toLowerCase().includes(e))return e}return"modified"}(e),{head:r,base:o}=function(e,t){var n;const r=null===(n=e.querySelector(".filename"))||void 0===n?void 0:n.cloneNode(!0);if(!r)throw new Error("Could not find breadcrumbs component for code view");for(const e of r.childNodes)e instanceof HTMLSpanElement&&(e.textContent=null);const o=r.textContent.trim();if("added"===t)return{head:o};if("removed"===t)return{base:o};if("modified"===t)return{base:o,head:o};const[i,a,s]=o.split(/[{}]/).map((e=>e.trim())),[c,l]=a.split("\u2192").map((e=>e.trim()));return{base:Iu(i+c+s),head:Iu(i+l+s)}}(e,n),{baseCommitID:i,headCommitID:a}=function(){var e;const t=null===(e=document.querySelector('[title="Parent commit"]'))||void 0===e?void 0:e.href.match(/\/commits\/(.*)/);if(!t)throw new Error("Could not determine base commit ID");const n=t[1],r=window.location.href.match(/\/commits\/(.*)/);if(!r)throw new Error("Could not determine head commit ID");return{baseCommitID:n,headCommitID:r[1]}}();return"added"===n?{head:{rawRepoName:t,filePath:r,commitID:a}}:"removed"===n?{base:{rawRepoName:t,filePath:o,commitID:i}}:{head:{rawRepoName:t,filePath:r,commitID:a},base:{rawRepoName:t,filePath:o,commitID:i}}}const Mu="codeHost-module__icon_3KtzB",ju="codeHost-module__commit-container_8Jft-";function Fu(e){const t=e.querySelector(".sg-toolbar-mount");if(t)return t;const n=e.querySelector('[data-testid="file-actions"');if(!n)throw new Error("Unable to find mount location");const r=document.createElement("div");return r.classList.add("sg-toolbar-mount"),n.prepend(r),r}function Bu(e){const t=e.querySelector(".sg-toolbar-mount");if(t)return t;const n=e.querySelector(".diff-actions");if(!n)throw new Error("Unable to find mount location");n.classList.add(ju);const r=document.createElement("div");return r.classList.add("sg-toolbar-mount"),n.prepend(r),r}const Uu={type:"bitbucket-cloud",name:"Bitbucket Cloud",codeViewResolvers:[{selector:e=>{const t=e.querySelector('[data-qa="bk-file__header"]'),n=e.querySelector('[data-qa="bk-file__content"]');if(!t||!n)return null;let r=t;for(;!r.contains(n);){if(!r.parentElement)return null;r=r.parentElement}return[r]},resolveView:e=>function({pathname:e}){return/\/pull-requests\/\d+/.test(e)}(window.location)?{element:e,getToolbarMount:Fu,dom:ku,resolveFileInfo:Du}:{element:e,getToolbarMount:Fu,dom:Ou,resolveFileInfo:Ru}},{selector:".bb-udiff",resolveView:e=>({element:e,getToolbarMount:Bu,dom:Au,resolveFileInfo:Lu})}],getContext:async function(){const e=Su();return Promise.resolve({rawRepoName:e,revision:"",privateRepository:!1})},getViewContextOnSourcegraphMount:function(e){var t;const n="open-on-sourcegraph",r=bo(e,'[data-qa="page-header-wrapper"] > div > div');if(!r)return null;let o=r.querySelector("#open-on-sourcegraph");if(o)return o;o=document.createElement("span"),o.id=n;const i=null===(t=r.childNodes[1])||void 0===t?void 0:t.childNodes[1].firstChild;return i instanceof HTMLElement?i.append(o):r.append(o),o},check:function(){return"bitbucket.org"===location.hostname},viewOnSourcegraphButtonClassProps:{className:"codeHost-module__open-on-sourcegraph_10lR9",iconClassName:Mu},codeViewToolbarClassProps:{className:"codeHost-module__code-view-toolbar_N0wZ1",listItemClass:"codeHost-module__list-item_370zl",actionItemClass:"codeHost-module__code-view-toolbar-action-item_2p6Pr",actionItemPressedClass:"codeHost-module__pressed_1ksxF",actionItemIconClass:Mu},hoverOverlayClassProps:{className:"codeHost-module__hover-overlay_2e1lQ",badgeClassName:"codeHost-module__badge_16Tsk",actionItemClassName:"codeHost-module__hover-overlay-action-item_39z-G",iconClassName:Mu,contentClassName:"codeHost-module__content_eSBN7"},notificationClassNames:{1:"",2:"",3:"",4:"",5:""},codeViewsRequireTokenization:!0},qu=(e,t)=>n=>i()(e[n],t),Vu=/\/projects\/([^/]+)\/repos\/([^/]+)\//;const $u=(e,t)=>{const n=e.querySelector(`[data-line-number="${t}"]`);if(!n)throw new Error(`Line ${t} not found in code view`);const r=n.closest(".line");if(!r)throw new Error("Could not find line elem for line element");return r},zu={getCodeElementFromTarget:e=>{const t=e.closest(".CodeMirror-line");return t?t.querySelector('span[role="presentation"]'):null},getLineNumberFromCodeElement:e=>{const t=e.closest(".line");if(!t)throw new Error("Could not find line containing code element");const n=t.querySelector(".line-locator");if(!n)throw new Error("Could not find the line number in a line container");const r=parseInt(n.dataset.lineNumber||"",10);if(isNaN(r))throw new TypeError("data-line-number not set on line number element");return r},getLineElementFromLineNumber:$u,getCodeElementFromLineNumber:(e,t)=>$u(e,t).querySelector('.CodeMirror-line span[role="presentation"]')},Hu=(e,t,n)=>{for(const r of e.querySelectorAll(".line-number-"+("head"===n?"to":"from"))){const e=parseInt((r.textContent||"").trim(),10);if(!isNaN(e)&&e===t){const e=r.closest(".line");if(!e)throw new Error("Could not find lineElem from lineNumElem");return e}}throw new Error(`Could not locate line number element for line ${t}, part: ${String(n)}`)},Gu={getCodeElementFromTarget:zu.getCodeElementFromTarget,getLineNumberFromCodeElement:e=>{const t=e.closest(".line");if(!t)throw new Error("Could not find line containing code element");const n=t.querySelector(".line-number-to");if(n){const e=parseInt((n.textContent||"").trim(),10);if(!isNaN(e))return e}const r=t.querySelector(".line-number-from");if(r){const e=parseInt((r.textContent||"").trim(),10);if(!isNaN(e))return e}throw new Error("Could not find line number element for code element")},getLineElementFromLineNumber:Hu,getCodeElementFromLineNumber:(e,t,n)=>Hu(e,t,n).querySelector('.CodeMirror-line span[role="presentation"]'),getDiffCodePart:e=>{var t;if(!document.querySelector(".side-by-side-diff"))return e.closest(".line").classList.contains("removed")?"base":"head";return null!==(t=e.closest(".diff-editor").previousElementSibling)&&void 0!==t&&t.classList.contains("segment-connector-column")?"head":"base"},isFirstCharacterDiffIndicator:()=>!1},Qu=(e,t,n)=>{for(const i of e.querySelectorAll(".diff-line-number")){var r;const e=null===(r=i.textContent)||void 0===r?void 0:r.trim().split(" ")[0];if(!e)continue;const a=parseInt(e,10);if(!isNaN(a)&&a===t){var o;const e=null===(o=i.closest("tr"))||void 0===o?void 0:o.querySelector(`.diff-line[data-diff-line="${"head"===n?"TO":"FROM"}"]`);if(!e)throw new Error("Could not find lineElem from lineNumElem");return e}}throw new Error(`Could not locate line number element for line ${t}, part: ${String(n)}`)},Wu={getCodeElementFromTarget:e=>e.closest(".diff-line"),getLineNumberFromCodeElement:e=>{var t;const n=null===(t=e.closest("tr"))||void 0===t?void 0:t.querySelector(".diff-gutter .diff-line-number");if(n){const e=parseInt((n.textContent||"").trim(),10);if(!isNaN(e))return e}throw new Error("Could not find line number element for code element")},getDiffCodePart:e=>{var t;const n=null===(t=e.closest("tr"))||void 0===t?void 0:t.querySelectorAll(".diff-line");if(!n||0===n.length)throw new Error("Could not find diff lines for code element");if(1===n.length)return e.classList.contains("added-line")?"head":"base";const[r,o]=n;return e===r?"base":e===o?"head":e.classList.contains("removed-line")?"base":"head"},getLineElementFromLineNumber:Qu,getCodeElementFromLineNumber:Qu};var Ku=n(11570),Zu=n.n(Ku);const Yu=(e,t,n)=>`${window.AJS?window.AJS.contextPath():window.location.origin}/rest/api/1.0/projects/${encodeURIComponent(e)}/repos/${t}${n}`,Ju=e=>ee(e,{selector:e=>tt(e).json()}),Xu=Ze((({project:e,repoSlug:t,prID:n})=>Ju(Yu(e,t,`/pull-requests/${n}`)).pipe(te((({fromRef:e,toRef:t})=>({baseCommitID:t.latestCommit,headCommitID:e.latestCommit}))))),(({prID:e})=>e.toString())),ef=Ze((({project:e,repoSlug:t,commitID:n})=>Ju(Yu(e,t,`/commits/${n}`)).pipe(te((({parents:e})=>Zu()(e))),_t(Ji),te((({id:e})=>e)))),(({project:e,repoSlug:t,commitID:n})=>`${e}:${t}:${n}`)),tf=["a.raw-view-link","a.source-view-link","a.mode-source"],nf=({repoSlug:e,project:t})=>[window.location.hostname,t,e].join("/"),rf=e=>{const t=[];for(const n of tf)try{const t=e.querySelector(n);if(!t)throw new Error(`Could not find selector ${n} in code view`);const r=new URL(t.href),o=r.pathname,i=o.match(/\/projects\/(.*?)\/repos\/(.*?)\/(?:browse|raw)\/(.*)$/);if(!i)throw new Error(`Path of link matching selector ${n} did not match path regex: ${o}`);const[,a,s,c]=i,l=r.searchParams.get("at");if(!l)throw new Error(`href of link matching selector ${n} did not have 'at' search param: ${r.href}`);const u=l.match(/refs\/heads\/(.*?)$/),f=u?u[1]:l;return{rawRepoName:nf({repoSlug:s,project:a}),filePath:decodeURIComponent(c),revision:f,project:a,repoSlug:s}}catch(e){t.push(e);continue}throw it(t)},of=(e="a.commitid")=>{const t=document.querySelector(e);if(!t)throw new Error("No element found matching a.commitid");const n=t.dataset.commitid;if(!n)throw new Error("Element matching a.commitid has no data-commitid");return n},af=e=>{const{rawRepoName:t,filePath:n,revision:r,project:o,repoSlug:i}=rf(e);return{rawRepoName:t,filePath:n,revision:r,commitID:(()=>{const e=document.querySelector("span[data-revision-ref]");if(!e)throw new Error("Could not find span[data-revision-ref] element");try{const{latestCommit:t}=JSON.parse(e.dataset.revisionRef);return t}catch{throw new Error("Could not parse JSON from revision selector")}})(),project:o,repoSlug:i}},sf=({codeViewElement:e})=>e.querySelector(".change-type-lozenge"),cf=({changeTypeElement:e})=>{if(!e)return"MODIFY";const t=[...e.classList].find((e=>/^change-type-[A-Z]+/.test(e)));if(!t)throw new Error("Could not detect change type from change type element");return t.replace(/^change-type-/,"")},lf=({filePath:e,changeType:t,changeTypeElement:n})=>{if("ADD"!==t){if("MODIFY"===t||"DELETE"===t)return e;if("MOVE"===t||"RENAME"===t||"COPY"===t){if(!n)throw new Error(`Change type is ${t} but no change type indicator found`);const r=n.getAttribute("original-title");if(!r)throw new Error("Moved change type badge did not have original-title attribute");const o=document.createElement("span");o.innerHTML=r;const i=o.textContent;if("MOVE"===t||"COPY"===t){const e=i.split("\u2192")[0].trim();if(!e)throw new Error(`Unexpected move change type badge content "${i}"`);return e}if("RENAME"===t){const t=/Renamed from '(.+)'/,n=i.match(t);if(!n)throw new Error(`Rename change type badge content did not match ${t.toString()}: "${i}"`);return xs.join(xs.dirname(e),n[1])}}throw new Error(`Unexpected change type "${t}"`)}},uf=e=>{var t;const n=null!==(t=e.querySelector(".breadcrumbs"))&&void 0!==t?t:e.querySelector(".file-breadcrumbs");if(!n)throw new Error("Could not find diff code view breadcrumbs element through selector .breadcrumbs");const r=n.textContent;if(!r)throw new Error("Unexpected empty file path in breadcrumbs");const o=location.pathname.match(/\/projects\/(.*?)\/repos\/(.*?)\//);if(!o)throw new Error("Location did not match regexp");const[,i,a]=o,s=nf({project:i,repoSlug:a}),c=sf({codeViewElement:e}),l=cf({changeTypeElement:c});return{changeType:l,rawRepoName:s,filePath:r,baseFilePath:lf({changeTypeElement:c,changeType:l,filePath:r})||r,project:i,repoSlug:a}};const ff=e=>{const t=uf(e),{rawRepoName:n,filePath:r,baseFilePath:o}=t,i=function(){const e=window.location.pathname.match(/pull-requests\/(\d*?)\/(diff|overview|commits)/);if(!e)throw new Error(`Could not parse PR ID from pathname: ${window.location.pathname}`);return parseInt(e[1],10)}();return Xu({...t,prID:i}).pipe(te((({headCommitID:e,baseCommitID:t})=>({head:{rawRepoName:n,filePath:r,commitID:e},base:{rawRepoName:n,filePath:o,commitID:t}}))))},pf="codeHost-module__command-palette-button_1LPsz",df="codeHost-module__command-palette-popover_wqnFp",hf="codeHost-module__no-results_3Di26",mf="codeHost-module__open-on-sourcegraph_i9J2G",gf="codeHost-module__sg-toolbar-mount_2Fbz5",vf="codeHost-module__code-view-toolbar_IVqgq",bf="codeHost-module__action-nav-item_223JV",yf="codeHost-module__action-nav-item-new-diff_23eTl",wf="codeHost-module__action-item-new-diff_3Tuv4",Ef="codeHost-module__hover-action-item_9CC-W",_f="codeHost-module__command-list-popover-button_3eptU",xf=(e,t=".file-toolbar .secondary")=>{const n=e.querySelector(".sg-toolbar-mount");if(n)return n;const r=e.querySelector(t);if(!r)throw new Error("Unable to find mount location");const o=document.createElement("div");return o.classList.add("btn-group"),o.classList.add("sg-toolbar-mount"),o.classList.add(gf),r.prepend(o),o},Sf=e=>({direction:t,codeView:n,position:r})=>{const o=e.getCodeElementFromLineNumber(n,r.line,r.part);if(!o)throw new Error("(adjustPosition) could not find code element for line provided");let i=0;for(const e of o.querySelectorAll("[cm-text]")){const t=e.getAttribute("cm-text")||"",n=e.textContent||"";i+=t.length-n.length}const a=t===qi.ActualToCodeView?-1:1;return X({line:r.line,character:r.character+a*i})},Of={getToolbarMount:xf,dom:zu,resolveFileInfo:e=>({blob:af(e)}),getPositionAdjuster:()=>Sf(zu)},Cf={getToolbarMount:xf,dom:Gu,getPositionAdjuster:()=>Sf(Gu),overrideTokenize:!0},Tf={...Cf,resolveFileInfo:e=>{const{changeType:t,rawRepoName:n,filePath:r,commitID:o,baseFilePath:i,revision:a,...s}=(e=>{const{rawRepoName:t,project:n,repoSlug:r,filePath:o}=rf(e),i=of(),a=sf({codeViewElement:e}),s=cf({changeTypeElement:a});return{changeType:s,rawRepoName:t,filePath:o,baseFilePath:lf({changeTypeElement:a,changeType:s,filePath:o})||o,commitID:i,project:n,repoSlug:r}})(e);return"ADD"===t?X({head:{rawRepoName:n,filePath:r,commitID:o}}):ef({commitID:o,...s}).pipe(te((e=>"DELETE"===t?{base:{rawRepoName:n,filePath:i,commitID:e}}:{base:{rawRepoName:n,filePath:i,commitID:e},head:{rawRepoName:n,filePath:r,commitID:o}})))}},kf={...Cf,resolveFileInfo:ff},Nf={...Cf,resolveFileInfo:e=>{const{rawRepoName:t,filePath:n,baseFilePath:r}=uf(e),{baseCommitID:o,headCommitID:i}=function(){const e=document.querySelector("#branch-compare .source-selector a.commitid[data-commitid]"),t=document.querySelector("#branch-compare .target-selector a.commitid[data-commitid]");if(!e||!t)throw new Error("Could not resolve Bitbucket compare diff spec");return{headCommitID:e.getAttribute("data-commitid"),baseCommitID:t.getAttribute("data-commitid")}}();return{base:{rawRepoName:t,filePath:r,commitID:i},head:{rawRepoName:t,filePath:n,commitID:o}}}},Af={...Cf,resolveFileInfo:e=>(e=>{const t=of(".commit-badge-oneline .commitid"),n=of(".commit-parents .commitid"),{rawRepoName:r,filePath:o,baseFilePath:i}=uf(e);return{head:{rawRepoName:r,filePath:o,commitID:t},base:{rawRepoName:r,filePath:i,commitID:n}}})(e)},If={selector:".change-view",resolveView:e=>({element:e,...Pf})},Pf={resolveFileInfo:ff,getToolbarMount:e=>xf(e,".change-header .diff-actions"),toolbarButtonProps:{listItemClass:yf,actionItemClass:wf},dom:Wu};const Rf="aui-icon",Df={[Us]:"aui-message aui-message-info",[qs]:"aui-message aui-message-success",[Bs]:"aui-message aui-message-info",[Fs]:"aui-message aui-message-warning",[js]:"aui-message aui-message-error"},Lf={type:"bitbucket-server",name:"Bitbucket Server",check:()=>!!document.querySelector(".bitbucket-header-logo")||!!document.querySelector(".aui-header-logo.aui-header-logo-bitbucket"),codeViewResolvers:[{selector:".file-content",resolveView:e=>{const t=e.querySelector(".content-view");if(!t)return null;if(document.querySelector("#branch-compare"))return{element:e,...Nf};if((({pathname:e})=>/\/projects\/[^/]+\/repos\/[^/]+\/commits\/\w+$/.test(e))(window.location))return{element:e,...Af};if(e.querySelector(".mode-toggle")){return t.classList.contains("diff-view")?{element:e,...Tf}:{element:e,...Of}}return(({pathname:e})=>/\/projects\/[^/]+\/repos\/[^/]+\/pull-requests\/\d+/.test(e))(window.location)?{element:e,...kf}:(console.error("Unknown code view",e),null)}},If],getCommandPaletteMount:e=>{const t=bo(e,".aui-header-primary .aui-nav");if(!t)return null;const n=["command-palette-button",pf];return t.querySelector(n.map((e=>`.${e}`)).join(""))||(()=>{const e=document.createElement("li");return e.className=n.join(" "),t.append(e),e})()},notificationClassNames:Df,commandPaletteClassProps:{buttonClassName:i()(_f,"aui-alignment-target aui-alignment-abutted aui-alignment-abutted-left aui-alignment-element-attached-top aui-alignment-element-attached-left aui-alignment-target-attached-bottom aui-alignment-target-attached-left"),buttonElement:"a",buttonOpenClassName:"aui-dropdown2-active active aui-alignment-enabled",showCaret:!1,popoverClassName:i()(df,"aui-dropdown2 aui-style-default aui-layer aui-dropdown2-in-header aui-alignment-element aui-alignment-side-bottom aui-alignment-snap-left aui-alignment-enabled aui-alignment-abutted aui-alignment-abutted-left aui-alignment-element-attached-top aui-alignment-element-attached-left aui-alignment-target-attached-bottom aui-alignment-target-attached-left"),popoverInnerClassName:"aui-dropdown2-section",formClassName:"aui",inputClassName:"text",resultsContainerClassName:"results",listClassName:"results-list",listItemClassName:"result",selectedListItemClassName:"focused",noResultsClassName:hf,iconClassName:Rf},codeViewToolbarClassProps:{className:i()(vf,"aui-buttons"),actionItemClass:"aui-button",actionItemIconClass:"aui-icon",listItemClass:bf},hoverOverlayClassProps:{className:"aui-dialog",actionItemClassName:i()("aui-button",Ef),getAlertClassName:qu(Df),iconClassName:Rf},getViewContextOnSourcegraphMount:function(e){const t=bo(e,".branch-selector-toolbar .aui-buttons");if(!t)return null;const n=t.querySelector("#open-on-sourcegraph");if(n)return n;const r=document.createElement("span");return r.id="open-on-sourcegraph",r.className=mf,t.append(r),r},getContext:async function(){const e=function(e){const{hostname:t,pathname:n}=e,r=n.match(Vu);if(!r)throw new Error(`location pathname does not match path regex: ${n}`);const[,o,i]=r;return{rawRepoName:`${t}/${o}/${i}`}}(window.location);let t={};try{t=function(){var e;const t=document.querySelector("#repository-layout-revision-selector .name[data-revision-ref]");if(!t)throw new Error("branchNameElement not found");const n=t.getAttribute("data-revision-ref");let r=null;if(n)try{r=JSON.parse(n)}catch{throw new Error(`Could not parse revisionRefStr: ${n}`)}if(null!==(e=r)&&void 0!==e&&e.latestCommit)return{revision:r.latestCommit};throw new Error(`revisionRefInfo is empty or has no latestCommit (revisionRefStr: ${String(n)})`)}()}catch{}return Promise.resolve({...e,...t,privateRepository:"bitbucket.org"!==window.location.hostname})},viewOnSourcegraphButtonClassProps:{className:"aui-button",iconClassName:Rf},codeViewsRequireTokenization:!1};var Mf=n(65291),jf=n.n(Mf),Ff=n(92674),Bf=n.n(Ff),Uf=n(26416),qf=n.n(Uf);function Vf(e){return new F((function(t){var n;try{n=e()}catch(e){return void t.error(e)}return(n?Z(n):ke()).subscribe(t)}))}function $f(e){return t=>Vf((()=>{const n=new Map;return t.pipe(Ae(Vt),wt(),Ge((({removedNodes:e})=>{for(const t of e){if(!(t instanceof HTMLElement))continue;const e=n.get(t);if(e)e.subscriptions.unsubscribe(),n.delete(t);else for(const[e,r]of n.entries())t.contains(e)&&(r.subscriptions.unsubscribe(),n.delete(e))}})),gt((t=>Z(t.addedNodes).pipe(_t(Yi(HTMLElement)),gt((t=>Z(e).pipe(gt((({selector:e,resolveView:n})=>[...zf(t,e)].map((e=>{const t=n(e);return t&&{...t,subscriptions:new A}})))),_t(Ji),_t((e=>!n.has(e.element))),Ge((e=>{n.set(e.element,e)})))))))))}))}function zf(e,t){if("string"==typeof t)return vo(e,t);return t(e)||[]}const Hf=/patchset (\d+)/i;function Gf(e,t){return`refs/changes/${e.slice(-2).padStart(2,"0")}/${e}/${t}`}function Qf(e){var t,n;return null!==(t=null===(n=rp(document.body,e))||void 0===n?void 0:n.textContent)&&void 0!==t?t:void 0}function Wf(e){const t=Hf.exec(e);if(null!=t&&t[1])return t[1]}function Kf(){const e=new URL(window.location.href).pathname.split("/"),t=e.indexOf("c"),n=e.indexOf("+"),r=e.slice(t+1,n).join("/"),o=e[n+1],i=e[n+2],a=e.slice(n+3).join("/"),s=window.location.hostname+"/"+r,{basePatchsetId:c,headPatchsetId:l}=function(){var e,t;const n=null!==(e=Qf("#app >> #app-element >> gr-change-view >> #fileListHeader >> #rangeSelect >> #basePatchDropdown >> #triggerText"))&&void 0!==e?e:Qf("#app >> #app-element >> gr-diff-view >> #rangeSelect >> #basePatchDropdown >> #triggerText"),r=null!==(t=Qf("#app >> #app-element >> gr-change-view >> #fileListHeader >> #rangeSelect >> #patchNumDropdown >> #triggerText"))&&void 0!==t?t:Qf("#app >> #app-element >> gr-diff-view >> #rangeSelect >> #patchNumDropdown >> #triggerText");return{basePatchsetId:n&&Wf(n),headPatchsetId:r&&Wf(r)}}();return{repoName:s,changeId:o,patchsetId:l||i,filePath:a,basePatchsetId:c}}const Zf={selector(e){var t;if(e.matches("#diffTable"))return[e];const n=rp(document,"#app >> #app-element >> gr-change-view >> #fileList"),r=[...(null==n||null===(t=n.shadowRoot)||void 0===t?void 0:t.querySelectorAll(".file-row.expanded"))||[]].map((e=>{const t=e.parentElement;if(t)return rp(t,"gr-diff-host >> gr-diff >> #diffTable")}));return qf()(r)},resolveView(e){const t=op(e,".stickyArea");if(!t)return null;const n=t.querySelector(".file-row"),r=null==n?void 0:n.getAttribute("data-path");if(!r)return null;const o=Kf();if(!o.patchsetId)return console.error("Sourcegraph: Cannot get Gerrit patchset ID"),null;const i=Gf(o.changeId,o.patchsetId);let a;return a=o.basePatchsetId?Gf(o.changeId,o.basePatchsetId):function(){var e,t,n;const r=rp(document.body,"#app >> #app-element >> gr-change-view >> #metadata >> gr-commit-info");if(!r)return null;return null==r||null===(e=r.shadowRoot)||void 0===e||null===(t=e.querySelector(".container"))||void 0===t||null===(n=t.textContent)||void 0===n?void 0:n.trim()}()||i+"^",ap(e),{element:e,dom:Jf,resolveFileInfo(){const e={base:{filePath:r||"",rawRepoName:o.repoName,commitID:a},head:{filePath:r||"",rawRepoName:o.repoName,commitID:i}};return console.log("resolveFileListCodeView: fileInfo",e),e}}}},Yf=(e,t,n)=>{const r="head"===n?"right":"left",o=e.querySelector(`td.lineNum.${r}[data-value="${t}"]`);if(!o)return null;const i=function(e,t){var n;const r=[...(null===(n=e.parentElement)||void 0===n?void 0:n.childNodes)||[]],o=r.slice(r.indexOf(e)+1);for(const e of o)if(e instanceof HTMLElement&&e.matches(t))return e;return null}(o,"td.content");return null==i?void 0:i.querySelector(".contentText")},Jf={getLineElementFromLineNumber:Yf,getCodeElementFromLineNumber:Yf,getCodeElementFromTarget:e=>{var t;const n=e.closest("td.content"),r=null==n||null===(t=n.closest("tr"))||void 0===t?void 0:t.querySelector("[data-line-number]");if(r){if("FILE"===r.getAttribute("data-line-number"))return null}return n},getLineNumberFromCodeElement:e=>{var t;const n=np(e);if(!n)throw console.error(e),new TypeError("Could not find line number (no side)");const r=e.closest("td"),o=null==r||null===(t=r.parentElement)||void 0===t?void 0:t.querySelector(`.lineNum.${n}`),i=null==o?void 0:o.getAttribute("data-value");if(!i)throw new TypeError(`Could not find line number (${n})`);return parseInt(i,10)},getDiffCodePart:e=>{const t=np(e);return"left"===t?"base":"right"===t?"head":(console.error("Cannot tell: base or head"),"base")}},Xf=[{selector(e){const t=rp(document.body,"#app >> #app-element >> gr-diff-view >> #diffHost >> #diff >> #diffTable");return t?[t]:[]},resolveView(e){const t=Kf();if(!t.patchsetId)return console.error("Sourcegraph: cannot find patchset ID"),null;const n=Gf(t.changeId,t.patchsetId);let r=n+"^";return t.basePatchsetId&&(r=Gf(t.changeId,t.basePatchsetId)),ap(e),{element:e,dom:Jf,getToolbarMount(e){var t;const n=null===(t=function(e){var t;const n=op(e,"gr-diff-view");return null==n||null===(t=n.shadowRoot)||void 0===t?void 0:t.querySelector("gr-fixed-panel .subHeader")}(e))||void 0===t?void 0:t.querySelector(".patchRangeLeft");if(!n)throw new Error("Could not find subheader");const r=n.querySelector(".sourcegraph-toolbar-mount");if(r)return r;const o=document.createElement("div");return o.classList.add("sourcegraph-toolbar-mount"),n.append(o),n.append(ip(sp)),o},resolveFileInfo(){const e={base:{filePath:t.filePath||"",rawRepoName:t.repoName,commitID:r},head:{filePath:t.filePath||"",rawRepoName:t.repoName,commitID:n}};return console.log("resolveFilePageCodeView: fileInfo",e),e}}}},Zf],ep={type:"gerrit",name:"Gerrit",codeViewResolvers:Xf,contentViewResolvers:[],nativeTooltipResolvers:[],codeViewsRequireTokenization:!0,observeMutations:(e,t,n)=>{let r=[];return Pl(1500).pipe(te((()=>{const{filePath:e=""}=Kf(),t=[...Xf.map((e=>e.selector)),tp].map((e=>[...zf(document.body,e)])).flat(),n=t.filter((t=>!Bf()(r,{element:t,filePath:e}))),o=r.filter((n=>!(n.filePath===e&&t.find((e=>e===n.element)))));for(const t of n)r.push({element:t,filePath:e});return r=r.filter((e=>!Bf()(o,e))),{addedNodes:n,removedNodes:o.map((e=>e.element))}})),_t((({addedNodes:e,removedNodes:t})=>!!e.length||!!t.length)),te((e=>[e])),ze(),Me())},getContext:async()=>{const{repoName:e,changeId:t,patchsetId:n}=Kf();return Promise.resolve({privateRepository:!0,rawRepoName:e,revision:n&&Gf(t,n)})},check:function(){return!!document.querySelector("gr-app#app")},notificationClassNames:{1:"",2:"",3:"",4:"",5:""},hoverOverlayClassProps:{className:"codeHost-module__hover-overlay_1jwSd"},codeViewToolbarClassProps:{className:"code-view-toolbar--gerrit",actionItemIconClass:"icon--gerrit"},viewOnSourcegraphButtonClassProps:{className:"open-on-sourcegraph--gerrit",iconClassName:"open-on-sourcegraph-icon--gerrit"},getViewContextOnSourcegraphMount:e=>{const t=jf()(tp(e));if(!t)return null;const n=t.querySelector(".open-in-sourcegraph-mount");if(n)return n;const r=document.createElement("gr-button");return r.setAttribute("link","link"),r.classList.add("open-in-sourcegraph-mount"),t.prepend(r),t.append(ip(sp)),r}},tp=()=>{const e=rp(document.body,"#app >> #app-element >> gr-change-view >> #actions >> #secondaryActions");return e?[e]:null};function np(e){var t,n;if("unified"===function(e){const t=e.closest("tr");return null!=t&&t.matches(".unified")?"unified":"side-by-side"}(e)){var r,o;return(null===(r=e.closest("tr"))||void 0===r||null===(o=r.querySelector("td.right"))||void 0===o?void 0:o.getAttribute("data-value"))?"right":"left"}return null!==(t=e.closest("td"))&&void 0!==t&&null!==(n=t.previousElementSibling)&&void 0!==n&&n.matches(".right")?"right":"left"}function rp(e,t){var n;"string"==typeof t&&(t=t.split(">>"));let r=e;const o=t.slice(0,-1),i=t[t.length-1];for(const e of o){var a;if(!r)return null;r=(null===(a=r.querySelector(e))||void 0===a?void 0:a.shadowRoot)||null}return null===(n=r)||void 0===n?void 0:n.querySelector(i)}function op(e,t){for(;;){var n;const r=e.closest(t);if(r)return r;if(!(e=null===(n=e.getRootNode())||void 0===n?void 0:n.host)||e===document.getRootNode())return null}}function ip(e){const t=document.createElement("style");return t.textContent=e,t}function ap(e){if(!e.querySelector("style.sourcegraph-injected-style")){const t=ip(cp);t.classList.add("sourcegraph-injected-style"),e.append(t)}}const sp="\n.icon--gerrit {\n height: 1.3rem;\n width: 1.3rem;\n padding: 5px 4px;\n}\n.open-on-sourcegraph-icon--gerrit {\n height: 1rem;\n width: 1rem;\n}\n.open-on-sourcegraph--gerrit {\n text-decoration: none;\n}\n",cp="\n.sourcegraph-document-highlight {\n background-color: var(--secondary);\n}\n.selection-highlight {\n background-color: var(--mark-bg);\n}\n";var lp,up,fp=n(36021),pp=n.n(fp);!function(e){e.Ok="ok",e.Exited="exited",e.Crashed="crashed",e.Abnormal="abnormal"}(lp||(lp={})),function(e){e.Ok="ok",e.Errored="errored",e.Crashed="crashed"}(up||(up={}));var dp=n(97753),hp=n(91698),mp=(0,dp.Rf)(),gp="Sentry Logger ",vp=function(){function e(){this._enabled=!1}return e.prototype.disable=function(){this._enabled=!1},e.prototype.enable=function(){this._enabled=!0},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._enabled&&(0,dp.Cf)((function(){mp.console.log(gp+"[Log]: "+e.join(" "))}))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._enabled&&(0,dp.Cf)((function(){mp.console.warn(gp+"[Warn]: "+e.join(" "))}))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._enabled&&(0,dp.Cf)((function(){mp.console.error(gp+"[Error]: "+e.join(" "))}))},e}();mp.__SENTRY__=mp.__SENTRY__||{};var bp,yp=mp.__SENTRY__.logger||(mp.__SENTRY__.logger=new vp),wp=n(59212);function Ep(e){return"[object Object]"===Object.prototype.toString.call(e)}function _p(e){return Boolean(e&&e.then&&"function"==typeof e.then)}!function(e){e.PENDING="PENDING",e.RESOLVED="RESOLVED",e.REJECTED="REJECTED"}(bp||(bp={}));var xp=function(){function e(e){var t=this;this._state=bp.PENDING,this._handlers=[],this._resolve=function(e){t._setResult(bp.RESOLVED,e)},this._reject=function(e){t._setResult(bp.REJECTED,e)},this._setResult=function(e,n){t._state===bp.PENDING&&(_p(n)?n.then(t._resolve,t._reject):(t._state=e,t._value=n,t._executeHandlers()))},this._attachHandler=function(e){t._handlers=t._handlers.concat(e),t._executeHandlers()},this._executeHandlers=function(){if(t._state!==bp.PENDING){var e=t._handlers.slice();t._handlers=[],e.forEach((function(e){e.done||(t._state===bp.RESOLVED&&e.onfulfilled&&e.onfulfilled(t._value),t._state===bp.REJECTED&&e.onrejected&&e.onrejected(t._value),e.done=!0)}))}};try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}return e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,n){n(t)}))},e.all=function(t){return new e((function(n,r){if(Array.isArray(t))if(0!==t.length){var o=t.length,i=[];t.forEach((function(t,a){e.resolve(t).then((function(e){i[a]=e,0===(o-=1)&&n(i)})).then(null,r)}))}else n([]);else r(new TypeError("Promise.all requires an array as input."))}))},e.prototype.then=function(t,n){var r=this;return new e((function(e,o){r._attachHandler({done:!1,onfulfilled:function(n){if(t)try{return void e(t(n))}catch(e){return void o(e)}else e(n)},onrejected:function(t){if(n)try{return void e(n(t))}catch(e){return void o(e)}else o(t)}})}))},e.prototype.catch=function(e){return this.then((function(e){return e}),e)},e.prototype.finally=function(t){var n=this;return new e((function(e,r){var o,i;return n.then((function(e){i=!1,o=e,t&&t()}),(function(e){i=!0,o=e,t&&t()})).then((function(){i?r(o):e(o)}))}))},e.prototype.toString=function(){return"[object SyncPromise]"},e}(),Sp=function(){function e(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._user={},this._tags={},this._extra={},this._contexts={}}return e.clone=function(t){var n=new e;return t&&(n._breadcrumbs=w(t._breadcrumbs),n._tags=h({},t._tags),n._extra=h({},t._extra),n._contexts=h({},t._contexts),n._user=t._user,n._level=t._level,n._span=t._span,n._session=t._session,n._transactionName=t._transactionName,n._fingerprint=t._fingerprint,n._eventProcessors=w(t._eventProcessors),n._requestSession=t._requestSession),n},e.prototype.addScopeListener=function(e){this._scopeListeners.push(e)},e.prototype.addEventProcessor=function(e){return this._eventProcessors.push(e),this},e.prototype.setUser=function(e){return this._user=e||{},this._session&&this._session.update({user:e}),this._notifyScopeListeners(),this},e.prototype.getUser=function(){return this._user},e.prototype.getRequestSession=function(){return this._requestSession},e.prototype.setRequestSession=function(e){return this._requestSession=e,this},e.prototype.setTags=function(e){return this._tags=h(h({},this._tags),e),this._notifyScopeListeners(),this},e.prototype.setTag=function(e,t){var n;return this._tags=h(h({},this._tags),((n={})[e]=t,n)),this._notifyScopeListeners(),this},e.prototype.setExtras=function(e){return this._extra=h(h({},this._extra),e),this._notifyScopeListeners(),this},e.prototype.setExtra=function(e,t){var n;return this._extra=h(h({},this._extra),((n={})[e]=t,n)),this._notifyScopeListeners(),this},e.prototype.setFingerprint=function(e){return this._fingerprint=e,this._notifyScopeListeners(),this},e.prototype.setLevel=function(e){return this._level=e,this._notifyScopeListeners(),this},e.prototype.setTransactionName=function(e){return this._transactionName=e,this._notifyScopeListeners(),this},e.prototype.setTransaction=function(e){return this.setTransactionName(e)},e.prototype.setContext=function(e,t){var n;return null===t?delete this._contexts[e]:this._contexts=h(h({},this._contexts),((n={})[e]=t,n)),this._notifyScopeListeners(),this},e.prototype.setSpan=function(e){return this._span=e,this._notifyScopeListeners(),this},e.prototype.getSpan=function(){return this._span},e.prototype.getTransaction=function(){var e,t,n,r,o=this.getSpan();return(null===(e=o)||void 0===e?void 0:e.transaction)?null===(t=o)||void 0===t?void 0:t.transaction:(null===(r=null===(n=o)||void 0===n?void 0:n.spanRecorder)||void 0===r?void 0:r.spans[0])?o.spanRecorder.spans[0]:void 0},e.prototype.setSession=function(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this},e.prototype.getSession=function(){return this._session},e.prototype.update=function(t){if(!t)return this;if("function"==typeof t){var n=t(this);return n instanceof e?n:this}return t instanceof e?(this._tags=h(h({},this._tags),t._tags),this._extra=h(h({},this._extra),t._extra),this._contexts=h(h({},this._contexts),t._contexts),t._user&&Object.keys(t._user).length&&(this._user=t._user),t._level&&(this._level=t._level),t._fingerprint&&(this._fingerprint=t._fingerprint),t._requestSession&&(this._requestSession=t._requestSession)):Ep(t)&&(t=t,this._tags=h(h({},this._tags),t.tags),this._extra=h(h({},this._extra),t.extra),this._contexts=h(h({},this._contexts),t.contexts),t.user&&(this._user=t.user),t.level&&(this._level=t.level),t.fingerprint&&(this._fingerprint=t.fingerprint),t.requestSession&&(this._requestSession=t.requestSession)),this},e.prototype.clear=function(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this},e.prototype.addBreadcrumb=function(e,t){var n="number"==typeof t?Math.min(t,100):100;if(n<=0)return this;var r=h({timestamp:(0,hp.yW)()},e);return this._breadcrumbs=w(this._breadcrumbs,[r]).slice(-n),this._notifyScopeListeners(),this},e.prototype.clearBreadcrumbs=function(){return this._breadcrumbs=[],this._notifyScopeListeners(),this},e.prototype.applyToEvent=function(e,t){var n;if(this._extra&&Object.keys(this._extra).length&&(e.extra=h(h({},this._extra),e.extra)),this._tags&&Object.keys(this._tags).length&&(e.tags=h(h({},this._tags),e.tags)),this._user&&Object.keys(this._user).length&&(e.user=h(h({},this._user),e.user)),this._contexts&&Object.keys(this._contexts).length&&(e.contexts=h(h({},this._contexts),e.contexts)),this._level&&(e.level=this._level),this._transactionName&&(e.transaction=this._transactionName),this._span){e.contexts=h({trace:this._span.getTraceContext()},e.contexts);var r=null===(n=this._span.transaction)||void 0===n?void 0:n.name;r&&(e.tags=h({transaction:r},e.tags))}return this._applyFingerprint(e),e.breadcrumbs=w(e.breadcrumbs||[],this._breadcrumbs),e.breadcrumbs=e.breadcrumbs.length>0?e.breadcrumbs:void 0,this._notifyEventProcessors(w(Op(),this._eventProcessors),e,t)},e.prototype._notifyEventProcessors=function(e,t,n,r){var o=this;return void 0===r&&(r=0),new xp((function(i,a){var s=e[r];if(null===t||"function"!=typeof s)i(t);else{var c=s(h({},t),n);_p(c)?c.then((function(t){return o._notifyEventProcessors(e,t,n,r+1).then(i)})).then(null,a):o._notifyEventProcessors(e,c,n,r+1).then(i).then(null,a)}}))},e.prototype._notifyScopeListeners=function(){var e=this;this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((function(t){t(e)})),this._notifyingListeners=!1)},e.prototype._applyFingerprint=function(e){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],this._fingerprint&&(e.fingerprint=e.fingerprint.concat(this._fingerprint)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint},e}();function Op(){var e=(0,dp.Rf)();return e.__SENTRY__=e.__SENTRY__||{},e.__SENTRY__.globalEventProcessors=e.__SENTRY__.globalEventProcessors||[],e.__SENTRY__.globalEventProcessors}function Cp(e){var t,n;if(Ep(e)){var r=e,o={};try{for(var i=b(Object.keys(r)),a=i.next();!a.done;a=i.next()){var s=a.value;void 0!==r[s]&&(o[s]=Cp(r[s]))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}return Array.isArray(e)?e.map(Cp):e}var Tp=function(){function e(e){this.errors=0,this.sid=(0,dp.DM)(),this.duration=0,this.status=lp.Ok,this.init=!0,this.ignoreDuration=!1;var t=(0,hp.ph)();this.timestamp=t,this.started=t,e&&this.update(e)}return e.prototype.update=function(e){if(void 0===e&&(e={}),e.user&&(!this.ipAddress&&e.user.ip_address&&(this.ipAddress=e.user.ip_address),this.did||e.did||(this.did=e.user.id||e.user.email||e.user.username)),this.timestamp=e.timestamp||(0,hp.ph)(),e.ignoreDuration&&(this.ignoreDuration=e.ignoreDuration),e.sid&&(this.sid=32===e.sid.length?e.sid:(0,dp.DM)()),void 0!==e.init&&(this.init=e.init),!this.did&&e.did&&(this.did=""+e.did),"number"==typeof e.started&&(this.started=e.started),this.ignoreDuration)this.duration=void 0;else if("number"==typeof e.duration)this.duration=e.duration;else{var t=this.timestamp-this.started;this.duration=t>=0?t:0}e.release&&(this.release=e.release),e.environment&&(this.environment=e.environment),!this.ipAddress&&e.ipAddress&&(this.ipAddress=e.ipAddress),!this.userAgent&&e.userAgent&&(this.userAgent=e.userAgent),"number"==typeof e.errors&&(this.errors=e.errors),e.status&&(this.status=e.status)},e.prototype.close=function(e){e?this.update({status:e}):this.status===lp.Ok?this.update({status:lp.Exited}):this.update()},e.prototype.toJSON=function(){return Cp({sid:""+this.sid,init:this.init,started:new Date(1e3*this.started).toISOString(),timestamp:new Date(1e3*this.timestamp).toISOString(),status:this.status,errors:this.errors,did:"number"==typeof this.did||"string"==typeof this.did?""+this.did:void 0,duration:this.duration,attrs:Cp({release:this.release,environment:this.environment,ip_address:this.ipAddress,user_agent:this.userAgent})})},e}(),kp=function(){function e(e,t,n){void 0===t&&(t=new Sp),void 0===n&&(n=4),this._version=n,this._stack=[{}],this.getStackTop().scope=t,e&&this.bindClient(e)}return e.prototype.isOlderThan=function(e){return this._version<e},e.prototype.bindClient=function(e){this.getStackTop().client=e,e&&e.setupIntegrations&&e.setupIntegrations()},e.prototype.pushScope=function(){var e=Sp.clone(this.getScope());return this.getStack().push({client:this.getClient(),scope:e}),e},e.prototype.popScope=function(){return!(this.getStack().length<=1)&&!!this.getStack().pop()},e.prototype.withScope=function(e){var t=this.pushScope();try{e(t)}finally{this.popScope()}},e.prototype.getClient=function(){return this.getStackTop().client},e.prototype.getScope=function(){return this.getStackTop().scope},e.prototype.getStack=function(){return this._stack},e.prototype.getStackTop=function(){return this._stack[this._stack.length-1]},e.prototype.captureException=function(e,t){var n=this._lastEventId=(0,dp.DM)(),r=t;if(!t){var o=void 0;try{throw new Error("Sentry syntheticException")}catch(e){o=e}r={originalException:e,syntheticException:o}}return this._invokeClient("captureException",e,h(h({},r),{event_id:n})),n},e.prototype.captureMessage=function(e,t,n){var r=this._lastEventId=(0,dp.DM)(),o=n;if(!n){var i=void 0;try{throw new Error(e)}catch(e){i=e}o={originalException:e,syntheticException:i}}return this._invokeClient("captureMessage",e,t,h(h({},o),{event_id:r})),r},e.prototype.captureEvent=function(e,t){var n=(0,dp.DM)();return"transaction"!==e.type&&(this._lastEventId=n),this._invokeClient("captureEvent",e,h(h({},t),{event_id:n})),n},e.prototype.lastEventId=function(){return this._lastEventId},e.prototype.addBreadcrumb=function(e,t){var n=this.getStackTop(),r=n.scope,o=n.client;if(r&&o){var i=o.getOptions&&o.getOptions()||{},a=i.beforeBreadcrumb,s=void 0===a?null:a,c=i.maxBreadcrumbs,l=void 0===c?100:c;if(!(l<=0)){var u=(0,hp.yW)(),f=h({timestamp:u},e),p=s?(0,dp.Cf)((function(){return s(f,t)})):f;null!==p&&r.addBreadcrumb(p,l)}}},e.prototype.setUser=function(e){var t=this.getScope();t&&t.setUser(e)},e.prototype.setTags=function(e){var t=this.getScope();t&&t.setTags(e)},e.prototype.setExtras=function(e){var t=this.getScope();t&&t.setExtras(e)},e.prototype.setTag=function(e,t){var n=this.getScope();n&&n.setTag(e,t)},e.prototype.setExtra=function(e,t){var n=this.getScope();n&&n.setExtra(e,t)},e.prototype.setContext=function(e,t){var n=this.getScope();n&&n.setContext(e,t)},e.prototype.configureScope=function(e){var t=this.getStackTop(),n=t.scope,r=t.client;n&&r&&e(n)},e.prototype.run=function(e){var t=Ap(this);try{e(this)}finally{Ap(t)}},e.prototype.getIntegration=function(e){var t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch(t){return yp.warn("Cannot retrieve integration "+e.id+" from the current Hub"),null}},e.prototype.startSpan=function(e){return this._callExtensionMethod("startSpan",e)},e.prototype.startTransaction=function(e,t){return this._callExtensionMethod("startTransaction",e,t)},e.prototype.traceHeaders=function(){return this._callExtensionMethod("traceHeaders")},e.prototype.captureSession=function(e){if(void 0===e&&(e=!1),e)return this.endSession();this._sendSessionUpdate()},e.prototype.endSession=function(){var e,t,n,r,o;null===(n=null===(t=null===(e=this.getStackTop())||void 0===e?void 0:e.scope)||void 0===t?void 0:t.getSession())||void 0===n||n.close(),this._sendSessionUpdate(),null===(o=null===(r=this.getStackTop())||void 0===r?void 0:r.scope)||void 0===o||o.setSession()},e.prototype.startSession=function(e){var t=this.getStackTop(),n=t.scope,r=t.client,o=r&&r.getOptions()||{},i=o.release,a=o.environment,s=((0,dp.Rf)().navigator||{}).userAgent,c=new Tp(h(h(h({release:i,environment:a},n&&{user:n.getUser()}),s&&{userAgent:s}),e));if(n){var l=n.getSession&&n.getSession();l&&l.status===lp.Ok&&l.update({status:lp.Exited}),this.endSession(),n.setSession(c)}return c},e.prototype._sendSessionUpdate=function(){var e=this.getStackTop(),t=e.scope,n=e.client;if(t){var r=t.getSession&&t.getSession();r&&n&&n.captureSession&&n.captureSession(r)}},e.prototype._invokeClient=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=this.getStackTop(),i=o.scope,a=o.client;a&&a[e]&&(t=a)[e].apply(t,w(n,[i]))},e.prototype._callExtensionMethod=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Np(),o=r.__SENTRY__;if(o&&o.extensions&&"function"==typeof o.extensions[e])return o.extensions[e].apply(this,t);yp.warn("Extension method "+e+" couldn't be found, doing nothing.")},e}();function Np(){var e=(0,dp.Rf)();return e.__SENTRY__=e.__SENTRY__||{extensions:{},hub:void 0},e}function Ap(e){var t=Np(),n=Rp(t);return Dp(t,e),n}function Ip(){var e=Np();return Pp(e)&&!Rp(e).isOlderThan(4)||Dp(e,new kp),(0,wp.KV)()?function(e){var t,n,r;try{var o=null===(r=null===(n=null===(t=Np().__SENTRY__)||void 0===t?void 0:t.extensions)||void 0===n?void 0:n.domain)||void 0===r?void 0:r.active;if(!o)return Rp(e);if(!Pp(o)||Rp(o).isOlderThan(4)){var i=Rp(e).getStackTop();Dp(o,new kp(i.client,Sp.clone(i.scope)))}return Rp(o)}catch(t){return Rp(e)}}(e):Rp(e)}function Pp(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function Rp(e){return e&&e.__SENTRY__&&e.__SENTRY__.hub||(e.__SENTRY__=e.__SENTRY__||{},e.__SENTRY__.hub=new kp),e.__SENTRY__.hub}function Dp(e,t){return!!e&&(e.__SENTRY__=e.__SENTRY__||{},e.__SENTRY__.hub=t,!0)}function Lp(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Ip();if(r&&r[e])return r[e].apply(r,w(t));throw new Error("No hub defined or "+e+" was not found on the hub, please open a bug report.")}function Mp(e,t){var n;try{throw new Error("Sentry syntheticException")}catch(e){n=e}return Lp("captureException",e,{captureContext:t,originalException:e,syntheticException:n})}var jp=n(76727);const Fp=(e,t)=>({selector:e,resolveView:e=>({...t,element:e})}),Bp=(e,t,n)=>((e,t)=>{const{repoName:n,commitID:r}=e;return Fr({repoName:n,revision:r,requestGraphQL:t}).pipe(Br())})(e,n).pipe(ue((()=>Ur({repoName:e.repoName,filePath:e.filePath,commitID:e.commitID,requestGraphQL:n}))),te((t=>t?{...e,content:t.join("\n")}:{...e})),de((n=>Z(t(n)).pipe(ue((t=>{if(t)return X(e);throw n}))))));function Up(){return function(e){const t=function(e){if(void 0!==e.line)return{start:{line:e.line,character:e.character||0},end:{line:e.endLine||e.line,character:e.endCharacter||e.character||0}}}(e);if(void 0===t)return[];const n={line:t.start.line-1,character:Kt(t.start.character)},r={line:t.end.line-1,character:Kt(t.end.character)};return[{start:n,end:r,anchor:n,active:r,isReversed:!1}]}(xr(window.location.hash))}function qp(){return To(window,"hashchange").pipe(te(Up),Ro(((e,t)=>zo()(e,t))))}function Vp(e){const t=e.title.split(" \u2192 ");return t.length>1?{headFilePath:t[1],baseFilePath:t[0]}:{headFilePath:t[0],baseFilePath:t[0]}}function $p(e){const{pageType:t}=Wp();if(!Qp(t))return null;let n="",r="";if("pull"===t){var o;const t=null===(o=document.querySelector("details-menu[src*='sha1='][src*='sha2=']"))||void 0===o?void 0:o.getAttribute("src"),i=e.classList.contains("js-comment-container");if(t){const e=new URLSearchParams(t),n=e.get("sha1"),r=e.get("sha2");if(n&&r)return{baseCommitID:n,headCommitID:r}}else if(i){const t=function(e){const t=e.querySelector(`summary a[href^="${location.pathname}"`);if(!t)return null;const n=t.href.match(zp);if(!n)return null;const r=n[3],o=Hp(document.documentElement.innerHTML,!0);return r&&o?{...o,headCommitID:r}:null}(e);if(t)return t}else{const e=document.querySelector('input[name="comparison_start_oid"]');e&&(n=e.value);const t=document.querySelector('input[name="comparison_end_oid"]');t&&(r=t.value)}}else if("commit"===t){const e=document.querySelectorAll(".sha-block:not(.patch-diff-links)");if(e&&2===e.length){const t=e[0].querySelector("a");t&&(n=t.href.split("/").slice(-1)[0]);const o=e[1].querySelector("span.sha");o&&(r=o.innerHTML)}}else if("compare"===t){const e=function(){const[e,t]=document.querySelectorAll(".commitish-suggester .select-menu-button span");if(e&&t&&e.textContent&&t.textContent)return{baseCommitID:e.textContent,headCommitID:t.textContent};return}();if(e)return e}return""===n||""===r?Hp(document.documentElement.innerHTML,"pull"===t):{baseCommitID:n,headCommitID:r}}const zp=/\/files\/((\w+)\.\.)?(\w+)#diff-\w+$/;function Hp(e,t){if(!t)return null;const n="\x3c!-- base sha1: "",r=e.indexOf(n);if(-1===r)return null;const o="\x3c!-- head sha1: "",i=e.indexOf(o,r);if(-1===i)return null;return{baseCommitID:e.slice(r+n.length,40),headCommitID:e.slice(i+o.length,40)}}function Gp(){const e=document.querySelector("a.js-permalink-shortcut");if(!e)throw new Error("Unable to determine the file path because no a.js-permalink-shortcut element was found.");const t=new URL(e.href),[,,,n,,...r]=t.pathname.split("/");if("tree"!==n&&0===r.length)throw new Error(`Unable to determine the file path because the a.js-permalink-shortcut element's href's path was ${t.pathname} (it is expected to be of the form /<user>/<repo>/blob/<commitID>/<path/to/file>).`);return decodeURIComponent(r.join("/"))}function Qp(e){switch(e){case"commit":case"pull":case"compare":return!0;default:return!1}}function Wp(e=window.location){const{host:t,pathname:n}=e,[r,o,i,...a]=n.slice(1).split("/");if(!r||!o)throw new Dr(`Could not parse repoName from GitHub url: ${e.href}`);const s=`${r}/${o}`,c=`${t}/${s}`;switch(i){case"blob":case"tree":return{pageType:i,rawRepoName:c,revisionAndFilePath:decodeURIComponent(a.join("/")),repoName:s};case"pull":case"commit":case"compare":return{pageType:i,rawRepoName:c,repoName:s};default:return{pageType:"other",rawRepoName:c,repoName:s}}}const Kp=e=>{let t=e.closest("td").previousElementSibling;for(;t;){if(t.dataset.lineNumber)return parseInt(t.dataset.lineNumber,10);t=t.previousElementSibling}throw new Error("Could not find a line number in any cell")},Zp=e=>{var t;const n=e.closest("td.blob-code");return!n||null!==(t=n.parentElement)&&void 0!==t&&t.classList.contains("js-expandable-line")?null:n},Yp=(e,t,n)=>{const r=od(e),o=((e,t)=>"base"===e?0:t?2:1)(n,r)+1,i=e.querySelector(`td:nth-child(${o})[data-line-number="${t}"]`);if(!i)return null;if(!r&&"base"===n&&!i.classList.contains("blob-num-addition")&&!i.classList.contains("blob-num-deletion"))return null;let a;if(r)a=i.nextElementSibling;else{a=i.parentElement.lastElementChild}return a},Jp=e=>e.classList.contains("blob-code-inner")?e:e.querySelector(".blob-code-inner"),Xp={getCodeElementFromTarget:e=>{const t=Zp(e);return t&&Jp(t)},getLineElementFromLineNumber:Yp,getCodeElementFromLineNumber:(e,t,n)=>{const r=Yp(e,t,n);return r&&Jp(r)},getLineNumberFromCodeElement:Kp,getDiffCodePart:e=>{const t=e.closest("td");return t.classList.contains("blob-code-addition")?"head":t.classList.contains("blob-code-deletion")||od(e)&&t.nextElementSibling?"base":"head"},isFirstCharacterDiffIndicator:e=>{const t=e.closest(".blob-code-inner"),n=t&&["deletion","context","addition"].some((e=>t.classList.contains("blob-code-marker-"+e))),r=e.closest("tr"),o=null==r?void 0:r.querySelector("td[data-code-marker]"),i=null==t?void 0:t.hasAttribute("data-code-marker"),a=o||i,s=e.closest(".refined-github-diff-signs");return!n&&!a&&!s}},ed=(e,t)=>{const n=e.querySelector(`td[data-line-number="${t}"]`);return n&&n.nextElementSibling},td={getCodeElementFromTarget:Zp,getCodeElementFromLineNumber:ed,getLineElementFromLineNumber:ed,getLineNumberFromCodeElement:Kp},nd=(e,t)=>{const n=((e,t)=>{const n=e.querySelectorAll("td.blob-num");let r=null;for(const e of n)if(e.querySelector("a").href.endsWith(`#L${t}`)){r=e;break}return r})(e,t);return n&&n.nextElementSibling},rd={getCodeElementFromTarget:Zp,getCodeElementFromLineNumber:nd,getLineElementFromLineNumber:nd,getLineNumberFromCodeElement:e=>{const t=e.closest("td").previousElementSibling;return parseInt(t.firstElementChild.textContent,10)}};function od(e){const{pageType:t}=Wp();if(!Qp(t))return!1;const n=e.classList.contains("file")?e:e.closest(".file");if(!n)throw new Error("Could not resolve code view element");if(n.classList.contains("js-comment-container"))return!1;const r=n.querySelector("table");if(!r)throw new Error("Could not find code view table");return r.classList.contains("js-file-diff-split")||r.classList.contains("file-diff-split")}const id=()=>{const e=Wp();if("blob"!==e.pageType&&"tree"!==e.pageType)throw new Error(`Current URL does not match a blob or tree url: ${window.location.href}`);const{revisionAndFilePath:t,rawRepoName:n}=e,r=Gp(),o=r&&!r.startsWith("/")?`/${r}`:r,i=o?t.slice(0,-o.length):t;if(!t.endsWith(o))throw new Error(`The file path ${o} should always be a suffix of revAndFilePath ${t}, but isn't in this case.`);return{blob:{rawRepoName:n,filePath:r,revision:i,commitID:mo({selector:".js-permalink-shortcut",hrefRegex:/^\/.*?\/.*?\/(?:blob|tree)\/([\da-f]{40})/})}}},ad=/\/([\da-f]{40})$/i,sd=e=>{const t=e.querySelector("a.commit-tease-sha");if(!t)throw new Error("Could not find commit link in snippet code view");const n=t.href.match(ad);if(null==n||!n[1])throw new Error(`Could not parse commitID from snippet commit link href: ${t.href}`);const r=n[1],o=e.querySelectorAll("a:not(.commit-tease-sha)"),i=new URL(o[0].href),a=Wp(i);if("blob"!==a.pageType)throw new Error(`Snippet URL does not match a blob url: ${i.href}`);const{revisionAndFilePath:s,rawRepoName:c}=a;if(!s.startsWith(r))throw new Error(`Could not parse filePath: revAndFilePath ${s} does not start with commitID ${r}`);return{blob:{rawRepoName:c,filePath:s.slice(r.length+1),commitID:r,revision:r}}},cd=["tooltipped","tooltipped-n"];const ld="codeHost-module__command-palette-action-item_16BFG",ud="codeHost-module__action-item_7QWb2",fd="codeHost-module__icon_3PdA7",pd="codeHost-module__code-view-toolbar_gOzAp",dd="codeHost-module__code-view-toolbar-item_2fTzz",hd="codeHost-module__hover-overlay-badge_3wpZt";function md(e){const t="github-file-actions-toolbar-mount",n=e.querySelector("."+t);if(n)return n;const r=document.createElement("div");r.className=t;const o=e.querySelector(".file-actions");if(!o)throw new Error("Could not find GitHub file actions with selector .file-actions");o.classList.add("sg-github-file-actions");const i=e.querySelector(".show-file-notes");return i?i.after(r):o.prepend(r),r}const gd={dom:Xp,getToolbarMount:md,resolveFileInfo:e=>{const{rawRepoName:t}=Wp(),{headFilePath:n,baseFilePath:r}=function(e){const t=e.querySelector(".file-info");if(t){if("A"===t.tagName)return Vp(t);const e=t.querySelector(".diffstat + a");if(e)return Vp(e)}const n=e.querySelector(".file-header a");if(n)return Vp(n);throw new Error("Could not determine diff file name")}(e);if(!n)throw new Error("cannot determine file path");const o=$p(e);if(!o)throw new Error("cannot determine delta info");const{headCommitID:i,baseCommitID:a}=o;return{head:{rawRepoName:t,filePath:n,commitID:i,revision:i},base:{rawRepoName:t,filePath:r||n,commitID:a,revision:a}}},getScrollBoundaries:e=>{const t=e.querySelector(".file-header");if(!t)throw new Error("Could not find .file-header element in GitHub PR code view");return[t]}},vd={...gd,getToolbarMount:void 0},bd={dom:td,getToolbarMount:md,resolveFileInfo:id,getSelections:Up,observeSelections:qp},yd=e=>({direction:t,codeView:n,position:r})=>Ur({...r,requestGraphQL:e}).pipe(te((e=>{const o=td.getCodeElementFromLineNumber(n,r.line,r.part);if(!o)throw new Error("(adjustPosition) could not find code element for line provided");const i=e[r.line-1],a=o.textContent||"",s=i.length-pp()(i).length,c=a.length-pp()(a).length,l=t===qi.ActualToCodeView?-1:1,u=Math.abs(s-c)*l;return{line:r.line,character:r.character+u}}))),wd=Fp(".code-list-item",{dom:rd,getPositionAdjuster:yd,resolveFileInfo:sd}),Ed={dom:td,resolveFileInfo:sd,getPositionAdjuster:yd},_d=e=>{const t="sourcegraph-github-file-code-view-toolbar-mount",n=e.querySelector(`.${t}`);if(n)return n;const r=document.createElement("div");r.style.display="inline-flex",r.style.verticalAlign="middle",r.style.alignItems="center",r.className=t;const o=e.querySelector("#raw-url"),i=null==o?void 0:o.closest(".BtnGroup");if(null==i||!i.parentNode)throw new Error("File actions not found");return i.parentNode.insertBefore(r,i),r},xd={selector:".js-file-line-container",resolveView:e=>{const t=e.closest(".blob-wrapper-embedded");if(t){return{element:t.parentElement,...Ed}}const{pageType:n}=Wp();if("blob"!==n)return null;const r=e.closest(".repository-content");if(!r)throw new Error("Could not find repository content element");return{element:r,...bd,getToolbarMount:_d}}},Sd={selector:e=>{const t=new Set;for(const n of vo(e,".file"))0===n.querySelectorAll(".js-diff-load-container").length&&t.add(n);for(const n of vo(e,".js-blob-wrapper")){const e=n.closest(".file");e instanceof HTMLElement&&t.add(e)}return[...t]},resolveView:e=>{if(e.querySelector("article.markdown-body"))return null;if(e.closest(".js-suggested-changes-blob"))return null;const{pageType:t}=Wp();return"blob"===t&&1===document.querySelectorAll(".file").length&&0===document.querySelectorAll(".diff-view").length?{element:e,...bd}:e.closest(".discussion-item-body")||e.classList.contains("js-comment-container")?{element:e,...vd}:{element:e,...gd}}};function Od(){const e=document.head.querySelector('meta[property="og:site_name"]');return!!e&&("GitHub Enterprise"===e.content||"GitHub"===e.content)&&document.body.classList.contains("enterprise")}const Cd="open-on-sourcegraph",Td=i()(fd,"v-align-text-bottom"),kd={[Us]:"flash",[qs]:"flash flash-success",[Bs]:"flash",[Fs]:"flash flash-warn",[js]:"flash flash-error"},Nd={searchViewResolver:{selector:'.js-site-search-form input[type="text"][aria-controls="jump-to-results"]',resolveView:e=>({element:e})},resultViewResolver:{selector:"#jump-to-suggestion-search-global",resolveView:e=>({element:e})},onChange:({value:e,searchURL:t,resultElement:n})=>{var r;const o="#jump-to-sourcegraph-search-global";(n=>{const r=n.querySelector(".jump-to-suggestion-name");r.textContent=e,r.setAttribute("aria-label",e);const o=n.querySelector("a"),i=new URL(t);i.searchParams.append("q",e),o.setAttribute("href",i.href),o.setAttribute("target","_blank"),n.setAttribute("style","display: "+(e?"initial":"none !important"))})(null!==(r=document.querySelector(o))&&void 0!==r?r:(()=>{var e,t;const r=n.cloneNode(!0);r.id=o.replace("#",""),r.classList.remove("navigation-focus"),r.setAttribute("aria-selected","false");const i=document.createElement("img");i.src=jp,i.setAttribute("style","width: 16px; height: 20px; float: left; margin-right: 2px;"),i.setAttribute("alt","Sourcegraph Logo Image");const a=r.querySelector(".js-jump-to-badge-search-text-global");return a.textContent="Sourcegraph",null===(e=a.parentNode)||void 0===e||e.insertBefore(i,a),null===(t=n.parentNode)||void 0===t||t.insertBefore(r,n.nextElementSibling),r})())}},Ad=(e,t=El.fetchCache,n="#repository-container-header h1 span.Label")=>"github.com"!==window.location.hostname?Promise.resolve(!0):t({url:`https://api.github.com/repos/${e}`,credentials:"omit",cacheMaxAge:36e5}).then((e=>{const t=e.headers["x-ratelimit-remaining"];if(Number(t)<=0){const e=new Error("Github rate limit exceeded.");throw Mp(e),e}return e})).then((({data:e})=>"boolean"!=typeof e.private||e.private)).catch((e=>{var t,r;return console.warn("Failed to fetch if the repository is private.",e),"public"!==(null===(t=document.querySelector(n))||void 0===t||null===(r=t.textContent)||void 0===r?void 0:r.toLowerCase().trim())})),Id=()=>"/search"===window.location.pathname,Pd=()=>"/search/advanced"===window.location.pathname,Rd=()=>!Id()&&window.location.pathname.endsWith("/search"),Dd=()=>Boolean(new URLSearchParams(window.location.search).get("q"))&&!Pd(),Ld=()=>{const e=new URLSearchParams(window.location.search).get("type");return e?e.toLowerCase():""},Md=e=>{const t=e.filter(Boolean).map((e=>e.trim())),n=(()=>{switch(Ld()){case"repositories":return"repo";case"commits":return"commit";case"code":return"";default:return Id()||Pd()?"repo":""}})(),r=new URLSearchParams(window.location.search).get("l");if(n&&t.push(`type:${n}`),r&&t.push(`lang:${encodeURIComponent(r)}`),Rd()){const[e,n]=window.location.pathname.split("/").filter(Boolean);t.push(`repo:${e}/${n}$`)}for(const e of["org","user"]){const n=t.findIndex((t=>t.startsWith(`${e}:`)));if(n>=0){const r=t[n].replace(`${e}:`,"");r&&(t[n]=`repo:${r}/*`)}}return t.join("+")},jd=(e,t="")=>{let n=document.querySelector(`#${e}`);return n||(n=document.createElement("div"),n.setAttribute("id",e),n.classList.add(...t.split(/\s/gi)),n)};const Fd={type:"github",name:Od()?"GitHub Enterprise":"GitHub",searchEnhancement:Nd,enhanceSearchPage:function(e){if(!(Id()||Pd()||Rd()||Dd()))return;const n=({container:n,className:r="",getSearchQuery:o,utmCampaign:a})=>{const s=yl(new URL("/search",e),{utm_source:kt(),utm_campaign:a});(0,yo.render)(t.createElement(Dl,{label:"Search on Sourcegraph",title:"Search on Sourcegraph to get hover tooltips, go to definition and more",ariaLabel:"Search on Sourcegraph to get hover tooltips, go to definition and more",className:i()("btn","m-auto",r),iconClassName:i()("mr-1","v-align-middle",fd),href:s.href,dataTestId:"search-on-sourcegraph",onClick:e=>{const t=Md(o());e.target.href=`${s.href}${t?`&q=${t}`:""}`}}),n)};if(Dd()){const e=Ld();if(["repositories","commits","code"].includes(e)||""===e&&(Id()||Rd())){var r,o;const e=document.querySelector(".application-main form.js-site-search-form"),t=null==e?void 0:e.querySelector("input.form-control[name='q']"),i=null==e||null===(r=e.parentElement)||void 0===r||null===(o=r.parentElement)||void 0===o?void 0:o.querySelector("button[type='submit']");if(t&&i){const e=jd("pageSearchFormSourcegraphButton","ml-2 d-none d-md-block");i.after(e),n({container:e,utmCampaign:"github-search-results-page",getSearchQuery:()=>t.value.split(" ")})}const a=document.querySelector("header form.js-site-search-form input.form-control[name='q']"),s=document.querySelector(".codesearch-results"),c=null==s?void 0:s.querySelector(".blankslate"),l=null==s?void 0:s.querySelector("div > div > h3");if(a&&(c||l)){const e=jd("headerSearchInputSourcegraphButton","ml-auto d-none d-lg-block");c?(e.classList.add("mt-2"),c.append(e)):l&&(e.classList.add("mr-2"),l.after(e)),n({container:e,className:c?"":"btn-sm",utmCampaign:"github-search-results-page",getSearchQuery:()=>a.value.split(" ")})}}return}const a=document.querySelector("#search_form"),s=null==a?void 0:a.querySelector(".search-form-fluid"),c=null==a?void 0:a.querySelector("input");if(s&&c){const e=jd("searchInputSourcegraphButton","ml-0 ml-md-2 mt-2 mt-md-0");null==s||s.append(e),n({container:e,utmCampaign:`github-${Pd()?"advanced":"simple"}-search-page`,getSearchQuery:()=>c.value.split(" ")})}},codeViewResolvers:[Sd,xd,wd],contentViewResolvers:[{selector:".markdown-body",resolveView:e=>({element:e})}],nativeTooltipResolvers:[{selector:".js-tagsearch-popover",resolveView:e=>({element:e})}],routeChange:e=>e.pipe(te((()=>{const{pathname:e}=window.location,t=e.slice(1).split("/")[2];return"blob"===t||"tree"===t?e.endsWith(Gp())?e:void 0:Dd()?null===(n=document.querySelector(".codesearch-results h3"))||void 0===n||null===(r=n.textContent)||void 0===r?void 0:r.trim():e;var n,r})),_t(Boolean),Ro()),getContext:async()=>{const{repoName:e,rawRepoName:t,pageType:n}=Wp();return{rawRepoName:t,revision:"blob"===n||"tree"===n?id().blob.revision:void 0,privateRepository:await Ad(e)}},isLightTheme:Vf((()=>{const e=document.documentElement.dataset.colorMode;return"auto"===e?((e=window)=>{const t=e.matchMedia("(prefers-color-scheme: dark)");return{observable:Et(X(!t.matches),To(t,"change").pipe(te((e=>!e.matches)))),initialValue:!t.matches}})().observable:X("dark"!==e)})),getViewContextOnSourcegraphMount:e=>{const t=bo(e,".pagehead-actions");if(!t||0===t.children.length)return null;let n=t.querySelector("#open-on-sourcegraph");return n||(n=document.createElement("li"),n.id=Cd,t.prepend(n),n)},viewOnSourcegraphButtonClassProps:{className:"btn btn-sm tooltipped tooltipped-s",iconClassName:Td},check:()=>((e=window.location.href)=>/^https?:\/\/(www\.)?github\.com/.test(e))()||Od(),getCommandPaletteMount:e=>{const t="command-palette-button",n=e.querySelector(`.Header .${t}`);if(n)return n;const r=bo(e,".HeaderMenu > :last-child");if(r){const e=document.createElement("div");return e.classList.add(t),r.prepend(e),e}let o=bo(e,".Header-item:nth-last-child(2)");if(o){0!==o.previousElementSibling.children.length&&(o=o.previousElementSibling);const e=document.createElement("div");return e.classList.add("Header-item","mr-0","mr-lg-3",t),o.before(e),e}return null},notificationClassNames:kd,commandPaletteClassProps:{buttonClassName:"Header-link d-flex flex-items-baseline",popoverClassName:"Box",formClassName:"p-1",inputClassName:"form-control input-sm header-search-input jump-to-field",listClassName:"p-0 m-0 js-navigation-container jump-to-suggestions-results-container",selectedListItemClassName:"navigation-focus",listItemClassName:"d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-scoped-search",actionItemClassName:i()(ld,"no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path p-2"),noResultsClassName:"d-flex flex-auto flex-items-center jump-to-suggestions-path p-2",iconClassName:Td},codeViewToolbarClassProps:{className:pd,listItemClass:i()(dd,"BtnGroup"),actionItemClass:i()("btn btn-sm tooltipped tooltipped-s BtnGroup-item",ud),actionItemPressedClass:"selected",actionItemIconClass:i()(fd,"v-align-text-bottom")},hoverOverlayClassProps:{className:"Box",actionItemClassName:"btn btn-sm btn-secondary",actionItemPressedClassName:"active",badgeClassName:i()("label",hd),getAlertClassName:qu(kd,"flash-full"),iconClassName:Td},setElementTooltip:function(e,t){"string"==typeof t?(e.classList.add(...cd),e.setAttribute("aria-label",t)):(e.classList.remove(...cd),e.removeAttribute("aria-label"))},linkPreviewContentClass:"text-small text-gray p-1 mx-1 border rounded-1 bg-gray text-gray-dark",urlToFile:(e,t,n)=>{if(t.viewState)return Nr(e,t);if(!t.rawRepoName.startsWith(window.location.hostname))return Nr(e,t);const r=t.revision||"HEAD",{rawRepoName:o}=Wp();if(o===t.rawRepoName&&void 0!==n.part){const e=document.querySelectorAll(".file");for(const r of e){const e=r.querySelector(".file-header[data-path][data-anchor]");if(!e)continue;if(e.dataset.path===t.filePath){const r=e.dataset.anchor,o=new URL(window.location.href);if(o.hash=r,t.position&&(o.hash+=`${"base"===n.part?"L":"R"}${t.position.line}`),!document.querySelector(o.hash))break;return o.href}}}const i=t.position?`#L${t.position.line}${t.position.character?`:${t.position.character}`:""}`:"";return`https://${t.rawRepoName}/blob/${r}/${t.filePath}${i}`},codeViewsRequireTokenization:!0},Bd=(e,t,n)=>e.querySelector(`#LC${t}`),Ud={getCodeElementFromTarget:e=>e.closest("span.line"),getLineNumberFromCodeElement:e=>{const t=e.id.replace(/^LC/,"");return parseInt(t,10)},getCodeElementFromLineNumber:Bd,getLineElementFromLineNumber:Bd},qd=e=>{const t=e.closest("[data-interop-type]");return t?"old"===t.dataset.interopType?"base":"head":(e=>{let t="old";const n=e.closest(".diff-td,td");return n.classList.contains("parallel")&&(t="left-side"),n.classList.contains(t)?"base":"head"})(e)},Vd=(e,t,n)=>{const r="base"===n?"old":"new",o=e.querySelector(`[data-interop-${r}-line="${t}"]`);return o?o.querySelector("span.line"):((e,t,n)=>{const r=e.querySelector(`.${"base"===n?"old_line":"new_line"} [data-linenumber="${t}"]`);if(!r)return null;const o=r.closest(".diff-tr,tr");if(!o)return null;let i="span.line";return o.classList.contains("parallel")&&(i=`.${"base"===n?"left-side":"right-side"} ${i}`),o.querySelector(i)})(e,t,n)},$d={getCodeElementFromTarget:Ud.getCodeElementFromTarget,getLineNumberFromCodeElement:e=>{const t=e.closest("[data-interop-line]");return t?parseInt(t.dataset.interopLine||"",10):(e=>{const t=qd(e);let n=e.closest(".diff-td,td");for(;n&&(!n.matches(".diff-line-num."+("base"===t?"old_line":"new_line"))||!n.querySelector("a"))&&n.previousElementSibling;)n=n.previousElementSibling;if(n){const e=n.querySelector("a");return parseInt(e.dataset.linenumber||"",10)}throw new Error("Unable to determine line number for diff code element")})(e)},getCodeElementFromLineNumber:Vd,getLineElementFromLineNumber:(e,t,n)=>{const r=Vd(e,t,n);return r&&r.parentElement},getDiffCodePart:qd},zd=(e,t,n)=>`${window.location.origin}/api/v4/projects/${encodeURIComponent(e)}%2f${t}${n}`,Hd=e=>ee(e,{selector:e=>tt(e).json()}),Gd=Ze((e=>Hd(`${window.location.origin}/api/v4/projects/${e}`).pipe(te((({web_url:e})=>{const{hostname:t,pathname:n}=new URL(e);return`${t}${n}`})))),_s()),Qd=Ze((({owner:e,projectName:t,mergeRequestID:n,diffID:r})=>r?Hd(zd(e,t,`/merge_requests/${n}/versions/${r}`)).pipe(te((({base_commit_sha:e})=>e))):X(void 0)),(({owner:e,projectName:t,mergeRequestID:n,diffID:r})=>`${e}:${t}:${n}:${String(r)}`)),Wd=Ze((({owner:e,projectName:t,mergeRequestID:n,rawRepoName:r,diffID:o})=>Ml(Hd(zd(e,t,`/merge_requests/${n}`)),Qd({owner:e,projectName:t,mergeRequestID:n,diffID:o})).pipe(ue((([{diff_refs:e,source_project_id:t},n])=>Gd(t).pipe(te((t=>({baseCommitID:n||e.base_sha,commitID:e.head_sha,rawRepoName:r,baseRawRepoName:t})))))))),(({owner:e,projectName:t,mergeRequestID:n,rawRepoName:r,diffID:o})=>`${e}:${t}:${n}:${r}:${String(o)}`)),Kd=Ze((({owner:e,projectName:t,commitID:n})=>Hd(zd(e,t,`/repository/commits/${n}`)).pipe(te((({parent_ids:e})=>Zu()(e))))),(({owner:e,projectName:t,commitID:n})=>`${e}:${t}:${n}`));var Zd=n(68642),Yd=n.n(Zd),Jd=n(90006),Xd=n.n(Jd);let eh;!function(e){e[e.File=0]="File",e[e.Commit=1]="Commit",e[e.MergeRequest=2]="MergeRequest",e[e.Other=3]="Other"}(eh||(eh={}));function th(){const e=document.querySelector(".context-header a");if(!e)throw new Error("Unable to determine project name");const t=new URL(e.href).pathname.slice(1),n=t.split("/"),r=Yd()(n,n.length-1).join("/"),o=Xd()(n),i=((e,t,n)=>{const r=n.match(new RegExp(`^/${e}/${t}(/-)?/(commit|merge_requests|blob)/`));if(!r)return eh.Other;switch(r[2]){case"commit":return eh.Commit;case"merge_requests":return eh.MergeRequest;case"blob":return eh.File;default:return eh.Other}})(r,o,window.location.pathname);return{owner:r,projectName:o,rawRepoName:[jt?window.location.hostname:new URL(gon.gitlab_url).hostname,r,o].join("/"),repoName:t,pageKind:i}}const nh=()=>{let e=window.location.pathname.match(/merge_requests\/(.*?)\/diffs/);if(!e&&document.querySelector(".diffs-tab.active")&&(e=window.location.pathname.match(/merge_requests\/(.*?)((\/)|$)/)),!e)throw new Error("Unable to determine merge request ID");return e[1]},rh=e=>{const t=e.dataset.originalTitle||e.dataset.title||e.title;if(!t)throw new Error("Unable to get file paths from code view: no file title");return t.endsWith(" deleted")?t.slice(0,-8):t};function oh(e){const t=e.querySelectorAll(".file-title-name");if(0===t.length)throw new Error("Unable to get file paths from code view: no .file-title.name");const n=t.length>1,r=rh(t.item(n?1:0));return{headFilePath:r,baseFilePath:n?rh(t.item(0)):r}}function ih(){const{rawRepoName:e,owner:t,projectName:n}=th();return{rawRepoName:e,owner:t,projectName:n,commitID:Xd()(window.location.pathname.split("/"))}}const ah="codeHost-module__command-list-popover_hwImg",sh="codeHost-module__hover-overlay_3Cize";const ch=(e,t)=>{const n=e.querySelector(".sg-toolbar-mount-gitlab");if(n)return n;const r=e.querySelector(".file-actions");if(!r)throw new Error("Unable to find mount location");const o=document.createElement("div");return o.classList.add("sg-toolbar-mount","sg-toolbar-mount-gitlab"),t===eh.Commit&&o.classList.add("gl-mr-3"),r.prepend(o),o},lh={dom:Ud,getToolbarMount:e=>ch(e,eh.File),resolveFileInfo:()=>{const{rawRepoName:e,filePath:t,revision:n}=function(){const{rawRepoName:e}=th(),t=window.location.pathname.match(/\/blob\/(.*?)\/(.*)/);if(!t)throw new Error("Unable to determine revision or file path");const n=decodeURIComponent(t[1]);return{rawRepoName:e,filePath:decodeURIComponent(t[2]),revision:n}}();if(!t)throw new Error(`Unable to determine the file path of the current file because the current URL (window.location ${window.location.href}) does not have a file path.`);return{blob:{rawRepoName:e,filePath:t,commitID:mo({selector:".js-data-file-blob-permalink-url",hrefRegex:new RegExp("^/.*?/.*?/blob/([0-9a-f]{40})/")}),revision:n}}},getSelections:Up,observeSelections:qp},uh=e=>{const t=e.querySelector(".js-file-title");if(!t)throw new Error("Could not find .file-title element");return[t]},fh={dom:$d,getToolbarMount:e=>ch(e,eh.MergeRequest),resolveFileInfo:e=>{return Z(Wd({...th(),mergeRequestID:nh(),diffID:null!==(t=new URLSearchParams(window.location.search).get("diff_id"))&&void 0!==t?t:void 0})).pipe(te((t=>{const{rawRepoName:n,baseRawRepoName:r,commitID:o,baseCommitID:i}=t,{headFilePath:a,baseFilePath:s}=oh(e);return{head:{rawRepoName:n,filePath:a,commitID:o},base:{rawRepoName:r,filePath:s,commitID:i}}})));var t},getScrollBoundaries:uh},ph={dom:$d,getToolbarMount:e=>ch(e,eh.Commit),resolveFileInfo:e=>Xi(ih).pipe(ue((({owner:e,projectName:t,commitID:n,rawRepoName:r})=>Kd({owner:e,projectName:t,commitID:n}).pipe(te((e=>({commitID:n,baseCommitID:e,rawRepoName:r})))))),te((({commitID:t,baseCommitID:n,rawRepoName:r})=>{const{headFilePath:o,baseFilePath:i}=oh(e);return{head:{rawRepoName:r,filePath:o,commitID:t},base:{rawRepoName:r,filePath:i,commitID:n}}}))),getScrollBoundaries:uh},dh={selector:".file-holder",resolveView:e=>{if(e.classList.contains("discussion-wrapper"))return null;const{pageKind:t}=th();return t===eh.Other?null:t===eh.File?{element:e,...lh}:t===eh.MergeRequest?e.querySelector(".file-actions")?{element:e,...fh}:null:{element:e,...ph}}},hh={[Us]:"alert alert-secondary",[qs]:"alert alert-success",[Bs]:"alert alert-info",[Fs]:"alert alert-warning",[js]:"alert alert-danger"},mh=(e,t=El.fetchCache)=>"gitlab.com"===window.location.hostname&&e?t({url:`https://gitlab.com/api/v4/projects/${encodeURIComponent(e)}`,credentials:"omit",cacheMaxAge:36e5}).then((e=>{const t=e.headers["ratelimit-remaining"];if(Number(t)<=0){const e=new Error("Gitlab rate limit exceeded.");throw Mp(e),e}return e})).then((({status:e})=>200!==e)).catch((e=>(console.warn("Failed to fetch repository visibility info.",e),!0))):Promise.resolve(!0),gh={type:"gitlab",name:"GitLab",check:function(){return!!document.head.querySelector('meta[content="GitLab"]')},codeViewResolvers:[dh],adjustOverlayPosition:({top:e,left:t})=>{const n=document.querySelector("header");n&&(e+=n.getBoundingClientRect().height);const r=document.querySelector("#js-peek.development");return r&&(e+=r.getBoundingClientRect().height),{top:e,left:t}},getCommandPaletteMount:e=>{const t=bo(e,".navbar-collapse");if(!t)return null;const n="command-palette-button";return t.querySelector("."+n)||(()=>{const e=document.createElement("div");return e.className=n,t.prepend(e),e})()},getContext:async()=>{const{repoName:e,...t}=th();return{...t,privateRepository:await mh(e)}},urlToFile:(e,t,n)=>{if(t.viewState||!t.rawRepoName.startsWith(window.location.hostname))return Nr(e,t);if(th().rawRepoName===t.rawRepoName&&void 0!==n.part){const e=zf(document.body,dh.selector);for(const r of e){const{headFilePath:e,baseFilePath:o}=oh(r);if(e!==t.filePath&&o!==t.filePath)continue;if(!t.position){const e=new URL(window.location.href);return e.hash=r.id,e.href}const i=null!==n.part?{head:".new_line",base:".old_line"}[n.part]:"",a=r.querySelector(`${i} a[data-linenumber="${t.position.line}"]`);if(!a)break;return new URL(a.href).href}}const r=new URL(`https://${t.rawRepoName}/blob/${t.revision}/${t.filePath}`);if(t.position){const{line:e}=t.position;r.hash=`#L${e}`}return r.href},notificationClassNames:hh,commandPaletteClassProps:{popoverClassName:i()("dropdown-menu",ah),formClassName:"dropdown-input",inputClassName:"dropdown-input-field",resultsContainerClassName:"dropdown-content",selectedActionItemClassName:"is-focused",noResultsClassName:"px-3",iconClassName:"s16 align-bottom"},codeViewToolbarClassProps:{className:"pl-0",actionItemClass:"btn btn-md gl-button btn-icon",actionItemPressedClass:"active",actionItemIconClass:"gl-button-icon gl-icon s16"},hoverOverlayClassProps:{className:i()("card",sh),actionItemClassName:"btn btn-secondary",actionItemPressedClassName:"active",iconClassName:"square s16",getAlertClassName:qu(hh)},codeViewsRequireTokenization:!0,getHoverOverlayMountLocation:()=>{const{pageKind:e}=th();return e===eh.MergeRequest?"div.tab-pane.diffs":null}},vh=e=>Boolean("TH"===e.tagName&&e.textContent||e.dataset.n),bh=e=>parseInt(("TH"===e.tagName?e.textContent:e.dataset.n)||"",10),yh=e=>{let t=e;for(;t;){if(vh(t))return t;t=t.previousElementSibling}return null},wh=(e,t,n)=>{let r=((e,t,n)=>{const r=e.querySelector("td[data-n]")?"td[data-n]":`th:nth-of-type(${"base"===n?1:2})`;for(const o of e.querySelectorAll(r))if(bh(o)===t){if("head"===n&&null===o.previousElementSibling)continue;return o}return null})(e,t,n);for(;r&&("TD"!==r.tagName||r.classList.contains("n")||vh(r)||r.classList.contains("copy"));)r=r.nextElementSibling;return r},Eh={getCodeElementFromTarget:e=>{if("TH"===e.tagName||e.classList.contains("copy"))return null;const t=e.closest("td");return t?t.classList.contains("show-more")||t.classList.contains("show-context")?null:yh(t)?t:null:null},getCodeElementFromLineNumber:wh,getLineElementFromLineNumber:wh,getLineNumberFromCodeElement:e=>{const t=yh(e);if(!t)throw new Error("Could not find line number cell from code element");return bh(t)},getDiffCodePart:e=>{if(e.classList.contains("old"))return"base";if(e.classList.contains("new"))return"head";const t=yh(e);if(!t)throw new Error("Could not find line number cell from code element");return t.classList.contains("left")?"base":t.classList.contains("right")||t.previousElementSibling?"head":"base"},isFirstCharacterDiffIndicator:e=>{const t=e.firstElementChild;return!(null==t||!t.classList.contains("aural-only"))}},_h=(e,t,n)=>{const r=e.querySelector(`tr:nth-of-type(${t})`);if(!r)throw new Error(`unable to find row ${t} from code view`);return r.querySelector("td")},xh={getCodeElementFromTarget:e=>e.closest("td"),getCodeElementFromLineNumber:_h,getLineElementFromLineNumber:_h,getLineNumberFromCodeElement:e=>{let t=e;for(;null!==t&&"TH"!==t.tagName&&!t.classList.contains("phabricator-source-line");)t=t.previousElementSibling;if(!t)throw new Error("could not find line number cell from code element");const n=t.querySelector("a");if(!n)throw new Error("could not find line number anchor from code element");if(void 0!==n.dataset.n){const e=parseInt(n.dataset.n,10);if(isNaN(e))throw new TypeError(`Could not parse lineNumber from data-n attribute: ${n.dataset.n}`);return e}const r=parseInt(n.textContent||"",10);if(isNaN(r))throw new TypeError(`Could not parse lineNumber from lineAnchor.textContent: ${String(n.textContent)}`);return r},isFirstCharacterDiffIndicator:()=>!1};const Sh=(e,t,n=to)=>Xr(window.location,t,n).pipe(te((e=>{if(e.mode!==qr.Diffusion)throw new Error(`Unexpected PhabricatorState for resolveDiffusionFileInfo, PhabricatorMode: ${e.mode}`);const{filePath:t,commitID:n,rawRepoName:r}=e;return{blob:{filePath:t,commitID:n,rawRepoName:r}}}))),Oh="codeHost-module__hover-overlay_3rw5s",Ch="codeHost-module__icon_3HyWM",Th="codeHost-module__action-item_35MZg",kh="codeHost-module__hover-overlay-action-item_1yTXu",Nh="codeHost-module__hover-overlay-action-item-icon_1oozE",Ah=(e,t)=>({line:e.line,character:e.character+t}),Ih=e=>({direction:t,codeView:n,position:r})=>Ur({...r,requestGraphQL:e}).pipe(te((e=>{const o=Eh.getCodeElementFromLineNumber(n,r.line,r.part);if(!o)throw new Error("(adjustPosition) could not find code element for line provided");const i=(e=>{var t;let n=e.textContent||"",r=0;if(null!==(t=e.firstElementChild)&&void 0!==t&&t.classList.contains("aural-only")){const t=e.firstElementChild.textContent||"";r=t.replace(/^(\+|-)/,"").length,n=n.slice(t.length-r)}return 8203===n.charCodeAt(0)&&(n=n.slice(1),r++),{textContent:n,adjust:r}})(o),a=i.textContent,s=e[r.line-1],c=(u=a,!!(l=s)&&!!u&&l.startsWith("\t")&&!u.startsWith("\t"));var l,u;const f=t===qi.CodeViewToActual?-1:1;return Ah(r,c?(function(e){let t=e,n=0;for(;t.length>=2&&t.startsWith(" ");)++n,t=t.slice(2);return n}(a)+i.adjust)*f:i.adjust*f)}))),Ph={dom:Eh,resolveFileInfo:(e,t,n=to)=>Xr(window.location,t,n).pipe(te((e=>{if(e.mode!==qr.Revision)throw new Error(`Unexpected Phabricator state for resolveRevisionFileInfo, PhabricatorMode: ${e.mode}`);const{rawRepoName:t,headCommitID:n,baseCommitID:r}=e,o=function(e){const t=document.querySelector(".differential-file-icon-header");if(!t)throw new Error("Unable to find file path container for revision code view");if(!t.textContent)throw new Error("`textContent` is undefined for revision file path container");return t.textContent}();return{base:{rawRepoName:t,filePath:o,commitID:r},head:{rawRepoName:t,filePath:o,commitID:n}}}))),getPositionAdjuster:Ih,getToolbarMount:e=>{let t=e.querySelector(".sourcegraph-phabricator-code-view-toolbar-mount");if(t)return t;const n=e.querySelector(".differential-changeset-buttons");if(!n)throw new Error("Unable to find action links for revision");return t=document.createElement("div"),t.style.display="inline-block",t.classList.add("sourcegraph-phabricator-code-view-toolbar-mount"),n.prepend(t),t}},Rh={dom:Eh,resolveFileInfo:(e,t,n=to)=>Xr(window.location,t,n).pipe(ue((r=>{if(r.mode!==qr.Differential)throw new Error(`Unexpected PhabricatorState for resolveDiffFileInfo, PhabricatorMode: ${r.mode}`);const{filePath:o,baseFilePath:i}=function(e){const t=e.children[3].textContent,n=e.querySelectorAll(".differential-meta-notice");let r;const o="This file was moved from ";for(const e of n){let t=e.textContent;if(t.startsWith(o)){t=t.slice(0,-1),r=t.split(o)[1];break}}return{filePath:t,baseFilePath:r}}(e);return Ml(po({repoName:r.baseRawRepoName,revisionID:r.revisionID,diffID:r.baseDiffID||r.diffID,baseDiffID:r.baseDiffID,useDiffForBase:Boolean(r.baseDiffID),useBaseForDiff:!1,filePath:i||o,isBase:!0},t,n).pipe(te((({commitID:e,stagingRepoName:t})=>({commitID:e,rawRepoName:t||r.baseRawRepoName})))),po({repoName:r.headRawRepoName,revisionID:r.revisionID,diffID:r.diffID,baseDiffID:r.baseDiffID,useDiffForBase:!1,useBaseForDiff:!1,filePath:o,isBase:!1},t,n).pipe(te((({commitID:e,stagingRepoName:t})=>({commitID:e,rawRepoName:t||r.headRawRepoName}))))).pipe(te((([e,t])=>({base:{rawRepoName:e.rawRepoName,filePath:i||o,commitID:e.commitID},head:{rawRepoName:t.rawRepoName,filePath:o,commitID:t.commitID}}))))}))),getPositionAdjuster:Ih,getToolbarMount:e=>{const t="sourcegraph-phabricator-code-view-toolbar-mount",n=e.querySelector("."+t);if(n)return n;const r=e.querySelector(".differential-changeset-buttons");if(!r)throw new Error("Unable to find action links for changeset");const o=document.createElement("div");return o.style.display="inline-block",o.classList.add(t),r.prepend(o," "),o},isDiff:!0},Dh={selector:".differential-changeset",resolveView:e=>window.location.pathname.match(/^\/r/)?{element:e,...Ph}:{element:e,...Rh}},Lh=Fp(".diffusion-source",{dom:xh,resolveFileInfo:Sh,getToolbarMount:()=>{const e=document.querySelector(".phui-two-column-content .phui-header-action-links");if(!e)throw new Error("unable to find file actions");const t=document.createElement("div");return t.style.display="inline-block",t.classList.add("sourcegraph-phabricator-code-view-toolbar-mount"),e.prepend(t),t}}),Mh=Fp(".phabricator-source-code-container",{dom:xh,resolveFileInfo:Sh}),jh={[Us]:"phui-info-view phui-info-severity-plain",[qs]:"phui-info-view phui-info-severity-success",[Bs]:"phui-info-view phui-info-severity-notice",[Fs]:"phui-info-view phui-info-severity-warning",[js]:"phui-info-view phui-info-severity-error"},Fh={codeViewResolvers:[Dh,Lh,Mh],type:"phabricator",name:"Phabricator",check:()=>!!document.querySelector(".phabricator-wordmark"),codeViewToolbarClassProps:{actionItemClass:i()("button grey",Th),actionItemIconClass:Ch},notificationClassNames:jh,hoverOverlayClassProps:{className:i()("aphront-dialog-view",Oh),actionItemClassName:i()("button grey",kh),iconClassName:Nh,getAlertClassName:qu(jh)},codeViewsRequireTokenization:!0};var Bh={leading:!0,trailing:!1};var Uh=function(){function e(e,t,n,r){this.duration=e,this.scheduler=t,this.leading=n,this.trailing=r}return e.prototype.call=function(e,t){return t.subscribe(new qh(e,this.duration,this.scheduler,this.leading,this.trailing))},e}(),qh=function(e){function t(t,n,r,o,i){var a=e.call(this,t)||this;return a.duration=n,a.scheduler=r,a.leading=o,a.trailing=i,a._hasTrailingValue=!1,a._trailingValue=null,a}return d(t,e),t.prototype._next=function(e){this.throttled?this.trailing&&(this._trailingValue=e,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(Vh,this.duration,{subscriber:this})),this.leading?this.destination.next(e):this.trailing&&(this._trailingValue=e,this._hasTrailingValue=!0))},t.prototype._complete=function(){this._hasTrailingValue?(this.destination.next(this._trailingValue),this.destination.complete()):this.destination.complete()},t.prototype.clearThrottle=function(){var e=this.throttled;e&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),e.unsubscribe(),this.remove(e),this.throttled=null)},t}(R);function Vh(e){e.subscriber.clearThrottle()}function $h({setElementTooltip:e,linkPreviewContentClass:t},n,r){const o="sg-link-preview-content";let i;if(n.nextSibling instanceof HTMLElement&&n.nextSibling.classList.contains(o)&&(i=n.nextSibling),null!=r&&r.content&&r.content.length>0){i?i.innerHTML="":(i=document.createElement("span"),i.classList.add(o),t&&i.classList.add(...t.split(" ")),n.after(i));for(const e of r.content.map((({kind:e,value:t})=>void 0===e||"markdown"===e?{html:Rc(t).replace(/^<p>/,"").replace(/<\/p>\s*$/,"")}:t)))if("string"==typeof e)i.append(e);else{const t=document.createElement("span");for(t.innerHTML=e.html;t.hasChildNodes();)i.append(t.childNodes[0])}}else i&&(i.remove(),i=void 0);e&&(e(n,zh(r)),i&&e(i,zh(r)))}function zh(e){if(!e)return null;const t=e.hover.map((({value:e})=>e)).filter((e=>!!e));return t.length>0?t.join(" "):null}function Hh(e,{extensionsController:t},{contentViewResolvers:n,linkPreviewContentClass:r,setElementTooltip:o}){const i=e.pipe($f(n||[]),Ae(Vt)),a=new we,s=new Map;return i.pipe(gt((e=>Qo(X(e).pipe(Ge((()=>{console.log("Content view added",{contentViewEvent:e}),s.set(e.element,new A),e.subscriptions.add((()=>{console.log("Content view removed",{contentViewEvent:e});const t=s.get(e.element);if(!t)throw new Error("No linkPreview subscriptions");t.unsubscribe()}))}))),go(e.element,{childList:!0},a).pipe(Ae(Vt),te((()=>e.element.innerHTML)),Ro(),Ge((()=>console.log("Content view updated",{contentViewEvent:e}))),oe(e),function(e,t,n){return void 0===t&&(t=$t),void 0===n&&(n=Bh),function(r){return r.lift(new Uh(e,t,n.leading,n.trailing))}}(2e3,void 0,{leading:!0,trailing:!0}))))),Ge((({element:e})=>{let n=s.get(e);if(!n)throw new Error("No linkPreview subscriptions");n.unsubscribe(),n=new A,s.set(e,n);for(const i of e.querySelectorAll("a[href]"))n.add(Z(t.extHostAPI).pipe(ue((e=>Ba(e.getLinkPreviews(i.href))))).subscribe((e=>{try{a.next(!0),$h({setElementTooltip:o,linkPreviewContentClass:r},i,e)}finally{a.next(!1)}})))}))).subscribe()}var Gh=n(32805),Qh=n(42797),Wh=n.n(Qh),Kh=n(88514),Zh=n.n(Kh),Yh=n(37310),Jh=n.n(Yh),Xh=n(46950),em=n.n(Xh),tm=n(51437),nm=n(51491),rm=n.n(nm);const om=Ze((e=>Z(e).pipe(ue((e=>Ba(e.haveInitialExtensionsLoaded()))))),(()=>"haveInitialExtensionsLoaded")),im=({text:e,pattern:n,className:r})=>t.createElement("span",null,function(e,t){const n=[];let r,o=0;for(let a=0;a<t.length;a++){var i;const s=e.indexOf(t.charAt(a),o);if(-1===s)break;null!==(i=r)&&void 0!==i&&i.match&&s===o?r.end=s+1:(r&&!r.match||s>o)&&(n.push({start:o,end:s,match:!1}),r=void 0),r||(r={start:s,end:s+1,match:!0},n.push(r)),o=s+1}e&&o<e.length&&n.push({start:o,end:e.length,match:!1});return n}(e.toLowerCase(),n.toLowerCase()).map(((n,o)=>n.match?t.createElement("strong",{key:o,className:r},e.slice(n.start,n.end)):e.slice(n.start,n.end))));const am="EmptyCommandListContainer-module__empty-command-list_NA_s5";function sm(){return(sm=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const cm=({className:e,children:n,...r})=>t.createElement("div",sm({className:i()(am,e)},r),n),lm="EmptyCommandList-module__title_Sbph5",um="EmptyCommandList-module__text_s1AXs",fm="EmptyCommandList-module__illustration_3pj62",pm=({settingsCascade:e,sourcegraphURL:n})=>{const r=!!e&&function(e){const t=Ms(e,"User"),n=Ms(e,"DefaultSettings");if(t&&n)for(const e of Object.keys(t))if(!(e in n))return!1;return!0}(e);return t.createElement(cm,null,t.createElement("p",{className:lm},r?"You don't have any extensions enabled":"You don't have any active actions"),t.createElement("p",{className:um},r?"Enable Sourcegraph extensions to get additional functionality, integrations, and make special actions available from this menu.":"Commands from your installed extensions will be shown when you navigate to certain pages."),t.createElement(fa,{to:n+"/extensions",variant:"primary"},"Explore extensions"),t.createElement(dm,{className:fm}))},dm=t.memo((({className:e})=>t.createElement("svg",{width:"59",height:"64",viewBox:"0 0 59 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e},t.createElement("path",{d:"M51.5825 43.9313C55.4271 45.582 57.2515 40.6516 57.8679 40.6516C58.4844 40.6516 58.9775 41.1397 58.9775 41.7497V60.3841C58.9775 62.3806 57.3411 64 55.3237 64H37.9287C37.7942 63.9778 37.6934 63.9556 37.6373 63.9335C35.9449 63.1459 40.2322 61.0779 40.1928 58.8201C40.1396 55.7739 38.0632 54.658 33.5688 54.658C29.0744 54.658 26.6802 55.4072 27.9131 59.6776C28.3325 61.1303 31.0022 63.1903 29.1192 63.9335C29.052 63.9556 28.8838 63.9778 28.6597 64H11.7803C9.78528 64 8.17132 62.4139 8.1377 60.4395V43.225C8.16011 43.0697 8.18253 42.9588 8.21615 42.9033C9.01192 41.2284 11.7803 44.8776 13.3831 45.4322C17.6197 46.8853 21.5201 43.1362 21.5201 38.6884C21.5201 34.2406 18.9535 27.9515 14.7168 29.4156C13.1141 29.9702 9.00072 34.8363 8.24978 32.9729C8.21615 32.9063 8.19374 32.7178 8.17132 32.4626L8.1377 16.9373C8.1377 16.9373 8.18253 16.3605 8.23857 16.0832C8.5636 13.9979 10.7492 13.1328 12.6209 13.1328L14.7168 13.1771C14.7168 13.1771 19.8725 13.2991 24.0644 13.3102H25.8016C27.6509 13.3102 29.0632 13.2659 29.3097 13.166C31.1927 12.4229 27.3147 9.63882 26.7543 8.05269C25.286 3.85997 29.0856 0 33.5688 0C38.052 0 41.8516 3.85997 40.3945 8.04159C39.8341 9.62773 36.1467 12.3785 37.8391 13.1549C37.996 13.2326 38.4219 13.277 39.0496 13.3102H46.7047C49.7533 13.2437 52.4096 13.1549 52.4096 13.1549L54.5055 13.1106C55.2228 13.1106 55.9962 13.2659 56.7023 13.5653C56.7247 13.5764 56.7583 13.5875 56.7919 13.5986C56.8592 13.6319 56.9152 13.6652 56.9825 13.6984C57.1394 13.7872 57.3075 13.8759 57.4532 13.9757C57.5877 14.0756 57.7222 14.1865 57.8455 14.2974C57.8791 14.3307 57.9127 14.3529 57.9464 14.3861C58.4283 14.852 58.787 15.451 58.9215 16.1941C58.9775 16.427 58.9999 16.6711 58.9999 16.9262V29.4156C58.9887 30.0257 58.4218 32.5682 57.9403 32.9484C55.2912 35.0404 54.2316 27.1052 50.5229 30.8565C47.5946 33.8183 47.7379 42.2805 51.5825 43.9313Z",fill:"url(#paint0_linear)",fillOpacity:"0.32"}),t.createElement("rect",{y:"24.6855",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{y:"46.627",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{y:"52.1133",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{y:"19.1992",width:"11.0972",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"11.0977",y:"30.1699",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"11.0977",y:"41.1426",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"11.0977",y:"35.6562",width:"15.7211",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"13.8711",y:"24.6855",width:"9.24768",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"13.8711",y:"46.627",width:"9.24768",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"13.8711",y:"52.1133",width:"5.54861",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"12.0225",y:"19.1992",width:"5.54861",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"24.9688",y:"30.1699",width:"4.62384",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"24.9688",y:"41.1426",width:"9.24767",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"30.5176",y:"30.1699",width:"7.39814",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"35.1416",y:"41.1426",width:"4.62384",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"27.7432",y:"35.6562",width:"7.39814",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("defs",null,t.createElement("linearGradient",{id:"paint0_linear",x1:"33.5688",y1:"0",x2:"33.5688",y2:"64",gradientUnits:"userSpaceOnUse"},t.createElement("stop",{stopColor:"#95A5C6",stopOpacity:"0.6"}),t.createElement("stop",{offset:"1",stopColor:"#95A5C6"})))))),hm="CommandList-module__command-list_10tyf",mm="CommandList-module__popover-button_1ug-b";function gm(){return(gm=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const vm=Ze((e=>Z(e).pipe(ue((e=>Ba(e.getContributions()))))),(()=>"getContributions"));class bm extends t.PureComponent{static RECENT_ACTIONS_STORAGE_KEY="commandList.recentActions";static readRecentActions(){const e=localStorage.getItem(bm.RECENT_ACTIONS_STORAGE_KEY);if(null===e)return null;try{const t=JSON.parse(e);return Array.isArray(t)&&t.every((e=>"string"==typeof e))?t:null}catch(e){console.error("Error reading recent actions:",e)}return bm.writeRecentActions(null),null}static writeRecentActions(e){try{if(null===e)localStorage.removeItem(bm.RECENT_ACTIONS_STORAGE_KEY);else{const t=JSON.stringify(e);localStorage.setItem(bm.RECENT_ACTIONS_STORAGE_KEY,t)}}catch(e){console.error("Error writing recent actions:",e)}}state={input:"",selectedIndex:0,recentActions:bm.readRecentActions()};subscriptions=new A;selectedItem=null;setSelectedItem=e=>{this.selectedItem=e};componentDidMount(){this.subscriptions.add(om(this.props.extensionsController.extHostAPI).pipe(_t((e=>e)),ue((()=>vm(this.props.extensionsController.extHostAPI)))).subscribe((e=>{this.setState({contributions:e})}))),this.subscriptions.add(this.props.platformContext.settings.subscribe((e=>this.setState({settingsCascade:e})))),setTimeout((()=>{this.setState({autoFocus:!0})}))}componentDidUpdate(e,t){this.state.recentActions!==t.recentActions&&bm.writeRecentActions(this.state.recentActions)}componentWillUnmount(){this.subscriptions.unsubscribe()}render(){if(!this.state.contributions)return t.createElement(cm,{className:hm},t.createElement("div",{className:"d-flex py-5 align-items-center justify-content-center"},t.createElement(ba,{inline:!1}),t.createElement("span",{className:"mx-2"},"Loading Sourcegraph extensions"),t.createElement(ma,{as:em()})));const e=ds(this.state.contributions,this.props.menu),n=this.state.input.trim(),r=function(e,t,n){if(!t)return null===n?e:fs()(e,(e=>{const t=n.indexOf(e.action.id);return-1===t?null:t}),(({action:e})=>e.id));const r=new Array(e.length),o=new Array(e.length),i=e.filter(((e,n)=>{let i=r[n];return void 0===i&&(i=`${e.action.category?`${e.action.category}: `:""}${e.action.title||e.action.command||""}`,r[n]=i),void 0===o[n]&&(o[n]=rm()(i,t,0)),o[n]>0})).map(((e,t)=>{const r=null==n?void 0:n.indexOf(e.action.id);return{item:e,score:o[t],recentIndex:-1===r?null:r}}));return fs()(i,"recentIndex","score",(({item:e})=>e.action.id)).map((({item:e})=>e))}(e,this.state.input,this.state.recentActions),o=(this.state.selectedIndex%r.length+r.length)%r.length;return t.createElement("div",{className:hm},t.createElement("header",null,t.createElement("form",{className:this.props.formClassName,onSubmit:this.onSubmit},t.createElement("label",{className:"sr-only",htmlFor:"command-list-input"},"Command"),t.createElement("input",{id:"command-list-input",ref:e=>e&&this.state.autoFocus&&e.focus({preventScroll:!0}),type:"text",className:this.props.inputClassName,value:this.state.input,placeholder:"Run Sourcegraph action...",spellCheck:!1,autoCorrect:"off",autoComplete:"off",onChange:this.onInputChange,onKeyDown:this.onInputKeyDown}))),t.createElement("div",{className:this.props.resultsContainerClassName},t.createElement("ul",{className:this.props.listClassName},r.length>0?r.map(((e,r)=>t.createElement("li",{className:i()(this.props.listItemClassName,r===o&&this.props.selectedListItemClassName),key:e.action.id},t.createElement(os,gm({},this.props,{className:i()(this.props.actionItemClassName,r===o&&this.props.selectedActionItemClassName)},e,{ref:r===o?this.setSelectedItem:void 0,title:t.createElement(im,{text:[e.action.category,e.action.title||e.action.command].filter(Boolean).join(": "),pattern:n}),onDidExecute:this.onActionDidExecute}))))):n.length>0?t.createElement("li",{className:this.props.noResultsClassName},"No matching commands"):t.createElement(pm,{settingsCascade:this.state.settingsCascade,sourcegraphURL:this.props.platformContext.sourcegraphURL}))))}onInputChange=e=>{this.setState({input:e.currentTarget.value,selectedIndex:0})};onInputKeyDown=e=>{switch(e.key){case oa.s.ArrowDown:e.preventDefault(),this.setSelectedIndex(1);break;case oa.s.ArrowUp:e.preventDefault(),this.setSelectedIndex(-1);break;case oa.s.Enter:this.selectedItem&&this.selectedItem.runAction(e)}};onSubmit=e=>e.preventDefault();setSelectedIndex(e){this.setState((t=>({selectedIndex:t.selectedIndex+e})))}onActionDidExecute=e=>{this.setState((t=>{const{recentActions:n}=t;return n?{recentActions:nn()([e,...n]).slice(0,10)}:{recentActions:[e]}})),this.props.onSelect&&this.props.onSelect()}}const ym=({buttonClassName:e,buttonElement:n="span",buttonOpenClassName:r,showCaret:o=!0,popoverClassName:a,popoverInnerClassName:s,keyboardShortcutForShow:c,variant:l,...u})=>{const[f,p]=(0,t.useState)(!1),d=(0,t.useCallback)((()=>p(!1)),[]),h=(0,t.useCallback)((()=>p(!f)),[f]),m=(0,t.useMemo)((()=>Cs()("command-list-popover-button-")),[]),g=()=>f?t.createElement(ma,{as:Zh()}):t.createElement(ma,{as:Wh()});return t.createElement(la,{as:n,role:"button",id:m,onClick:h,className:i()(mm,e,f&&r),variant:l,"aria-label":"Command list"},t.createElement(ma,{as:Jh(),size:"md"}),o&&t.createElement(g,null),t.createElement(tm.ZP,{isOpen:f,toggle:h,popperClassName:a,innerClassName:i()("popover-inner",s),placement:"bottom-end",target:m,trigger:"legacy",delay:0,fade:!1,hideArrow:!0},t.createElement(bm,gm({},u,{onSelect:d}))),null==c?void 0:c.keybindings.map(((e,n)=>t.createElement(Gh.z9,gm({key:n},e,{onMatch:h})))))};var wm=n(7263),Em=n.n(wm);function _m(e,t,n){var r;return r=e&&"object"==typeof e?e:{bufferSize:e,windowTime:t,refCount:!1,scheduler:n},function(e){return e.lift(function(e){var t,n,r=e.bufferSize,o=void 0===r?Number.POSITIVE_INFINITY:r,i=e.windowTime,a=void 0===i?Number.POSITIVE_INFINITY:i,s=e.refCount,c=e.scheduler,l=0,u=!1,f=!1;return function(e){var r;l++,!t||u?(u=!1,t=new De(o,a,c),r=t.subscribe(this),n=e.subscribe({next:function(e){t.next(e)},error:function(e){u=!0,t.error(e)},complete:function(){f=!0,n=void 0,t.complete()}})):r=t.subscribe(this),this.add((function(){l--,r.unsubscribe(),n&&!f&&s&&0===l&&(n.unsubscribe(),n=void 0,t=void 0)}))}}(r))}}function xm(e){return(xm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}"function"==typeof Symbol&&null!=Symbol.iterator&&Symbol.iterator,"function"==typeof Symbol&&null!=Symbol.asyncIterator&&Symbol.asyncIterator;var Sm="function"==typeof Symbol&&null!=Symbol.toStringTag?Symbol.toStringTag:"@@toStringTag";function Om(e,t){for(var n,r=/\r\n|[\n\r]/g,o=1,i=t+1;(n=r.exec(e.body))&&n.index<t;)o+=1,i=t+1-(n.index+n[0].length);return{line:o,column:i}}function Cm(e){return Tm(e.source,Om(e.source,e.start))}function Tm(e,t){var n=e.locationOffset.column-1,r=Nm(n)+e.body,o=t.line-1,i=e.locationOffset.line-1,a=t.line+i,s=1===t.line?n:0,c=t.column+s,l="".concat(e.name,":").concat(a,":").concat(c,"\n"),u=r.split(/\r\n|[\n\r]/g),f=u[o];if(f.length>120){for(var p=Math.floor(c/80),d=c%80,h=[],m=0;m<f.length;m+=80)h.push(f.slice(m,m+80));return l+km([["".concat(a),h[0]]].concat(h.slice(1,p+1).map((function(e){return["",e]})),[[" ",Nm(d-1)+"^"],["",h[p+1]]]))}return l+km([["".concat(a-1),u[o-1]],["".concat(a),f],["",Nm(c-1)+"^"],["".concat(a+1),u[o+1]]])}function km(e){var t=e.filter((function(e){e[0];return void 0!==e[1]})),n=Math.max.apply(Math,t.map((function(e){return e[0].length})));return t.map((function(e){var t,r=e[0],o=e[1];return Nm(n-(t=r).length)+t+(o?" | "+o:" |")})).join("\n")}function Nm(e){return Array(e+1).join(" ")}function Am(e){return(Am="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Im(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Pm(e,t){return!t||"object"!==Am(t)&&"function"!=typeof t?Rm(e):t}function Rm(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Dm(e){var t="function"==typeof Map?new Map:void 0;return(Dm=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Lm(e,arguments,Fm(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),jm(r,e)})(e)}function Lm(e,t,n){return(Lm=Mm()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&jm(o,n.prototype),o}).apply(null,arguments)}function Mm(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function jm(e,t){return(jm=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Fm(e){return(Fm=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Bm=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&jm(e,t)}(s,e);var t,n,r,o,i,a=(t=s,n=Mm(),function(){var e,r=Fm(t);if(n){var o=Fm(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return Pm(this,e)});function s(e,t,n,r,o,i,c){var l,u,f,p,d;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),d=a.call(this,e);var h,m=Array.isArray(t)?0!==t.length?t:void 0:t?[t]:void 0,g=n;!g&&m&&(g=null===(h=m[0].loc)||void 0===h?void 0:h.source);var v,b=r;!b&&m&&(b=m.reduce((function(e,t){return t.loc&&e.push(t.loc.start),e}),[])),b&&0===b.length&&(b=void 0),r&&n?v=r.map((function(e){return Om(n,e)})):m&&(v=m.reduce((function(e,t){return t.loc&&e.push(Om(t.loc.source,t.loc.start)),e}),[]));var y,w=c;if(null==w&&null!=i){var E=i.extensions;"object"==xm(y=E)&&null!==y&&(w=E)}return Object.defineProperties(Rm(d),{name:{value:"GraphQLError"},message:{value:e,enumerable:!0,writable:!0},locations:{value:null!==(l=v)&&void 0!==l?l:void 0,enumerable:null!=v},path:{value:null!=o?o:void 0,enumerable:null!=o},nodes:{value:null!=m?m:void 0},source:{value:null!==(u=g)&&void 0!==u?u:void 0},positions:{value:null!==(f=b)&&void 0!==f?f:void 0},originalError:{value:i},extensions:{value:null!==(p=w)&&void 0!==p?p:void 0,enumerable:null!=w}}),(null==i?void 0:i.stack)?(Object.defineProperty(Rm(d),"stack",{value:i.stack,writable:!0,configurable:!0}),Pm(d)):(Error.captureStackTrace?Error.captureStackTrace(Rm(d),s):Object.defineProperty(Rm(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return r=s,(o=[{key:"toString",value:function(){return function(e){var t=e.message;if(e.nodes)for(var n=0,r=e.nodes;n<r.length;n++){var o=r[n];o.loc&&(t+="\n\n"+Cm(o.loc))}else if(e.source&&e.locations)for(var i=0,a=e.locations;i<a.length;i++){var s=a[i];t+="\n\n"+Tm(e.source,s)}return t}(this)}},{key:Sm,get:function(){return"Object"}}])&&Im(r.prototype,o),i&&Im(r,i),s}(Dm(Error));function Um(e,t,n){return new Bm("Syntax Error: ".concat(n),void 0,e,[t])}var qm=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});const Vm="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function $m(e){var t=e.prototype.toJSON;"function"==typeof t||function(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}(0),e.prototype.inspect=t,Vm&&(e.prototype[Vm]=t)}var zm=function(){function e(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}return e.prototype.toJSON=function(){return{start:this.start,end:this.end}},e}();$m(zm);var Hm=function(){function e(e,t,n,r,o,i,a){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=o,this.value=a,this.prev=i,this.next=null}return e.prototype.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},e}();function Gm(e){return null!=e&&"string"==typeof e.kind}$m(Hm);var Qm=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function Wm(e){return(Wm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Km(e){return Zm(e,[])}function Zm(e,t){switch(Wm(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,t){if(-1!==t.indexOf(e))return"[Circular]";var n=[].concat(t,[e]),r=function(e){var t=e[String(Vm)];if("function"==typeof t)return t;if("function"==typeof e.inspect)return e.inspect}(e);if(void 0!==r){var o=r.call(e);if(o!==e)return"string"==typeof o?o:Zm(o,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>2)return"[Array]";for(var n=Math.min(10,e.length),r=e.length-n,o=[],i=0;i<n;++i)o.push(Zm(e[i],t));1===r?o.push("... 1 more item"):r>1&&o.push("... ".concat(r," more items"));return"["+o.join(", ")+"]"}(e,n);return function(e,t){var n=Object.keys(e);if(0===n.length)return"{}";if(t.length>2)return"["+function(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){var n=e.constructor.name;if("string"==typeof n&&""!==n)return n}return t}(e)+"]";return"{ "+n.map((function(n){return n+": "+Zm(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}function Ym(e,t){if(!Boolean(e))throw new Error(t)}const Jm=function(e,t){return e instanceof t};function Xm(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var eg=function(){function e(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GraphQL request",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{line:1,column:1};"string"==typeof e||Ym(0,"Body must be a string. Received: ".concat(Km(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||Ym(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Ym(0,"column in locationOffset is 1-indexed and must be positive.")}var t,n,r;return t=e,(n=[{key:Sm,get:function(){return"Source"}}])&&Xm(t.prototype,n),r&&Xm(t,r),e}();var tg=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});function ng(e){var t=e.split(/\r\n|[\n\r]/g),n=function(e){for(var t,n=!0,r=!0,o=0,i=null,a=0;a<e.length;++a)switch(e.charCodeAt(a)){case 13:10===e.charCodeAt(a+1)&&++a;case 10:n=!1,r=!0,o=0;break;case 9:case 32:++o;break;default:r&&!n&&(null===i||o<i)&&(i=o),r=!1}return null!==(t=i)&&void 0!==t?t:0}(e);if(0!==n)for(var r=1;r<t.length;r++)t[r]=t[r].slice(n);for(var o=0;o<t.length&&rg(t[o]);)++o;for(var i=t.length;i>o&&rg(t[i-1]);)--i;return t.slice(o,i).join("\n")}function rg(e){for(var t=0;t<e.length;++t)if(" "!==e[t]&&"\t"!==e[t])return!1;return!0}var og=function(){function e(e){var t=new Hm(Qm.SOF,0,0,0,0,null);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}var t=e.prototype;return t.advance=function(){return this.lastToken=this.token,this.token=this.lookahead()},t.lookahead=function(){var e=this.token;if(e.kind!==Qm.EOF)do{var t;e=null!==(t=e.next)&&void 0!==t?t:e.next=ag(this,e)}while(e.kind===Qm.COMMENT);return e},e}();function ig(e){return isNaN(e)?Qm.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function ag(e,t){for(var n=e.source,r=n.body,o=r.length,i=t.end;i<o;){var a=r.charCodeAt(i),s=e.line,c=1+i-e.lineStart;switch(a){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:10===r.charCodeAt(i+1)?i+=2:++i,++e.line,e.lineStart=i;continue;case 33:return new Hm(Qm.BANG,i,i+1,s,c,t);case 35:return cg(n,i,s,c,t);case 36:return new Hm(Qm.DOLLAR,i,i+1,s,c,t);case 38:return new Hm(Qm.AMP,i,i+1,s,c,t);case 40:return new Hm(Qm.PAREN_L,i,i+1,s,c,t);case 41:return new Hm(Qm.PAREN_R,i,i+1,s,c,t);case 46:if(46===r.charCodeAt(i+1)&&46===r.charCodeAt(i+2))return new Hm(Qm.SPREAD,i,i+3,s,c,t);break;case 58:return new Hm(Qm.COLON,i,i+1,s,c,t);case 61:return new Hm(Qm.EQUALS,i,i+1,s,c,t);case 64:return new Hm(Qm.AT,i,i+1,s,c,t);case 91:return new Hm(Qm.BRACKET_L,i,i+1,s,c,t);case 93:return new Hm(Qm.BRACKET_R,i,i+1,s,c,t);case 123:return new Hm(Qm.BRACE_L,i,i+1,s,c,t);case 124:return new Hm(Qm.PIPE,i,i+1,s,c,t);case 125:return new Hm(Qm.BRACE_R,i,i+1,s,c,t);case 34:return 34===r.charCodeAt(i+1)&&34===r.charCodeAt(i+2)?pg(n,i,s,c,t,e):fg(n,i,s,c,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return lg(n,i,a,s,c,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return hg(n,i,s,c,t)}throw Um(n,i,sg(a))}var l=e.line,u=1+i-e.lineStart;return new Hm(Qm.EOF,o,o,l,u,t)}function sg(e){return e<32&&9!==e&&10!==e&&13!==e?"Cannot contain the invalid character ".concat(ig(e),"."):39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":"Cannot parse the unexpected character ".concat(ig(e),".")}function cg(e,t,n,r,o){var i,a=e.body,s=t;do{i=a.charCodeAt(++s)}while(!isNaN(i)&&(i>31||9===i));return new Hm(Qm.COMMENT,t,s,n,r,o,a.slice(t+1,s))}function lg(e,t,n,r,o,i){var a=e.body,s=n,c=t,l=!1;if(45===s&&(s=a.charCodeAt(++c)),48===s){if((s=a.charCodeAt(++c))>=48&&s<=57)throw Um(e,c,"Invalid number, unexpected digit after 0: ".concat(ig(s),"."))}else c=ug(e,c,s),s=a.charCodeAt(c);if(46===s&&(l=!0,s=a.charCodeAt(++c),c=ug(e,c,s),s=a.charCodeAt(c)),69!==s&&101!==s||(l=!0,43!==(s=a.charCodeAt(++c))&&45!==s||(s=a.charCodeAt(++c)),c=ug(e,c,s),s=a.charCodeAt(c)),46===s||function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122}(s))throw Um(e,c,"Invalid number, expected digit but got: ".concat(ig(s),"."));return new Hm(l?Qm.FLOAT:Qm.INT,t,c,r,o,i,a.slice(t,c))}function ug(e,t,n){var r=e.body,o=t,i=n;if(i>=48&&i<=57){do{i=r.charCodeAt(++o)}while(i>=48&&i<=57);return o}throw Um(e,o,"Invalid number, expected digit but got: ".concat(ig(i),"."))}function fg(e,t,n,r,o){for(var i,a,s,c,l=e.body,u=t+1,f=u,p=0,d="";u<l.length&&!isNaN(p=l.charCodeAt(u))&&10!==p&&13!==p;){if(34===p)return d+=l.slice(f,u),new Hm(Qm.STRING,t,u+1,n,r,o,d);if(p<32&&9!==p)throw Um(e,u,"Invalid character within String: ".concat(ig(p),"."));if(++u,92===p){switch(d+=l.slice(f,u-1),p=l.charCodeAt(u)){case 34:d+='"';break;case 47:d+="/";break;case 92:d+="\\";break;case 98:d+="\b";break;case 102:d+="\f";break;case 110:d+="\n";break;case 114:d+="\r";break;case 116:d+="\t";break;case 117:var h=(i=l.charCodeAt(u+1),a=l.charCodeAt(u+2),s=l.charCodeAt(u+3),c=l.charCodeAt(u+4),dg(i)<<12|dg(a)<<8|dg(s)<<4|dg(c));if(h<0){var m=l.slice(u+1,u+5);throw Um(e,u,"Invalid character escape sequence: \\u".concat(m,"."))}d+=String.fromCharCode(h),u+=4;break;default:throw Um(e,u,"Invalid character escape sequence: \\".concat(String.fromCharCode(p),"."))}f=++u}}throw Um(e,u,"Unterminated string.")}function pg(e,t,n,r,o,i){for(var a=e.body,s=t+3,c=s,l=0,u="";s<a.length&&!isNaN(l=a.charCodeAt(s));){if(34===l&&34===a.charCodeAt(s+1)&&34===a.charCodeAt(s+2))return u+=a.slice(c,s),new Hm(Qm.BLOCK_STRING,t,s+3,n,r,o,ng(u));if(l<32&&9!==l&&10!==l&&13!==l)throw Um(e,s,"Invalid character within String: ".concat(ig(l),"."));10===l?(++s,++i.line,i.lineStart=s):13===l?(10===a.charCodeAt(s+1)?s+=2:++s,++i.line,i.lineStart=s):92===l&&34===a.charCodeAt(s+1)&&34===a.charCodeAt(s+2)&&34===a.charCodeAt(s+3)?(u+=a.slice(c,s)+'"""',c=s+=4):++s}throw Um(e,s,"Unterminated string.")}function dg(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function hg(e,t,n,r,o){for(var i=e.body,a=i.length,s=t+1,c=0;s!==a&&!isNaN(c=i.charCodeAt(s))&&(95===c||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++s;return new Hm(Qm.NAME,t,s,n,r,o,i.slice(t,s))}var mg=function(){function e(e,t){var n=function(e){return Jm(e,eg)}(e)?e:new eg(e);this._lexer=new og(n),this._options=t}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(Qm.NAME);return{kind:qm.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:qm.DOCUMENT,definitions:this.many(Qm.SOF,this.parseDefinition,Qm.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(Qm.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(Qm.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},t.parseOperationDefinition=function(){var e=this._lexer.token;if(this.peek(Qm.BRACE_L))return{kind:qm.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,n=this.parseOperationType();return this.peek(Qm.NAME)&&(t=this.parseName()),{kind:qm.OPERATION_DEFINITION,operation:n,name:t,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseOperationType=function(){var e=this.expectToken(Qm.NAME);switch(e.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(e)},t.parseVariableDefinitions=function(){return this.optionalMany(Qm.PAREN_L,this.parseVariableDefinition,Qm.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:qm.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(Qm.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Qm.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(e)}},t.parseVariable=function(){var e=this._lexer.token;return this.expectToken(Qm.DOLLAR),{kind:qm.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:qm.SELECTION_SET,selections:this.many(Qm.BRACE_L,this.parseSelection,Qm.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(Qm.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,n=this._lexer.token,r=this.parseName();return this.expectOptionalToken(Qm.COLON)?(e=r,t=this.parseName()):t=r,{kind:qm.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Qm.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Qm.PAREN_L,t,Qm.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(Qm.COLON),{kind:qm.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:qm.ARGUMENT,name:this.parseName(),value:(this.expectToken(Qm.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(Qm.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(Qm.NAME)?{kind:qm.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:qm.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseFragmentDefinition=function(){var e,t=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(e=this._options)||void 0===e?void 0:e.experimentalFragmentVariables)?{kind:qm.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}:{kind:qm.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}},t.parseFragmentName=function(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()},t.parseValueLiteral=function(e){var t=this._lexer.token;switch(t.kind){case Qm.BRACKET_L:return this.parseList(e);case Qm.BRACE_L:return this.parseObject(e);case Qm.INT:return this._lexer.advance(),{kind:qm.INT,value:t.value,loc:this.loc(t)};case Qm.FLOAT:return this._lexer.advance(),{kind:qm.FLOAT,value:t.value,loc:this.loc(t)};case Qm.STRING:case Qm.BLOCK_STRING:return this.parseStringLiteral();case Qm.NAME:switch(this._lexer.advance(),t.value){case"true":return{kind:qm.BOOLEAN,value:!0,loc:this.loc(t)};case"false":return{kind:qm.BOOLEAN,value:!1,loc:this.loc(t)};case"null":return{kind:qm.NULL,loc:this.loc(t)};default:return{kind:qm.ENUM,value:t.value,loc:this.loc(t)}}case Qm.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:qm.STRING,value:e.value,block:e.kind===Qm.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,n=this._lexer.token;return{kind:qm.LIST,values:this.any(Qm.BRACKET_L,(function(){return t.parseValueLiteral(e)}),Qm.BRACKET_R),loc:this.loc(n)}},t.parseObject=function(e){var t=this,n=this._lexer.token;return{kind:qm.OBJECT,fields:this.any(Qm.BRACE_L,(function(){return t.parseObjectField(e)}),Qm.BRACE_R),loc:this.loc(n)}},t.parseObjectField=function(e){var t=this._lexer.token,n=this.parseName();return this.expectToken(Qm.COLON),{kind:qm.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(Qm.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(Qm.AT),{kind:qm.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(Qm.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(Qm.BRACKET_R),e={kind:qm.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(Qm.BANG)?{kind:qm.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:qm.NAMED_TYPE,name:this.parseName(),loc:this.loc(e)}},t.parseTypeSystemDefinition=function(){var e=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(e.kind===Qm.NAME)switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(e)},t.peekDescription=function(){return this.peek(Qm.STRING)||this.peek(Qm.BLOCK_STRING)},t.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},t.parseSchemaDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");var n=this.parseDirectives(!0),r=this.many(Qm.BRACE_L,this.parseOperationTypeDefinition,Qm.BRACE_R);return{kind:qm.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r,loc:this.loc(e)}},t.parseOperationTypeDefinition=function(){var e=this._lexer.token,t=this.parseOperationType();this.expectToken(Qm.COLON);var n=this.parseNamedType();return{kind:qm.OPERATION_TYPE_DEFINITION,operation:t,type:n,loc:this.loc(e)}},t.parseScalarTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");var n=this.parseName(),r=this.parseDirectives(!0);return{kind:qm.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");var n=this.parseName(),r=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),i=this.parseFieldsDefinition();return{kind:qm.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:o,fields:i,loc:this.loc(e)}},t.parseImplementsInterfaces=function(){var e;if(!this.expectOptionalKeyword("implements"))return[];if(!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLImplementsInterfaces)){var t=[];this.expectOptionalToken(Qm.AMP);do{t.push(this.parseNamedType())}while(this.expectOptionalToken(Qm.AMP)||this.peek(Qm.NAME));return t}return this.delimitedMany(Qm.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var e;return!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLEmptyFields)&&this.peek(Qm.BRACE_L)&&this._lexer.lookahead().kind===Qm.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(Qm.BRACE_L,this.parseFieldDefinition,Qm.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(Qm.COLON);var o=this.parseTypeReference(),i=this.parseDirectives(!0);return{kind:qm.FIELD_DEFINITION,description:t,name:n,arguments:r,type:o,directives:i,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(Qm.PAREN_L,this.parseInputValueDef,Qm.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(Qm.COLON);var r,o=this.parseTypeReference();this.expectOptionalToken(Qm.EQUALS)&&(r=this.parseValueLiteral(!0));var i=this.parseDirectives(!0);return{kind:qm.INPUT_VALUE_DEFINITION,description:t,name:n,type:o,defaultValue:r,directives:i,loc:this.loc(e)}},t.parseInterfaceTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");var n=this.parseName(),r=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),i=this.parseFieldsDefinition();return{kind:qm.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:o,fields:i,loc:this.loc(e)}},t.parseUnionTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");var n=this.parseName(),r=this.parseDirectives(!0),o=this.parseUnionMemberTypes();return{kind:qm.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:o,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(Qm.EQUALS)?this.delimitedMany(Qm.PIPE,this.parseNamedType):[]},t.parseEnumTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");var n=this.parseName(),r=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();return{kind:qm.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:o,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(Qm.BRACE_L,this.parseEnumValueDefinition,Qm.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseDirectives(!0);return{kind:qm.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseInputObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");var n=this.parseName(),r=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();return{kind:qm.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:o,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(Qm.BRACE_L,this.parseInputValueDef,Qm.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===Qm.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)},t.parseSchemaExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var t=this.parseDirectives(!0),n=this.optionalMany(Qm.BRACE_L,this.parseOperationTypeDefinition,Qm.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return{kind:qm.SCHEMA_EXTENSION,directives:t,operationTypes:n,loc:this.loc(e)}},t.parseScalarTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var t=this.parseName(),n=this.parseDirectives(!0);if(0===n.length)throw this.unexpected();return{kind:qm.SCALAR_TYPE_EXTENSION,name:t,directives:n,loc:this.loc(e)}},t.parseObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===o.length)throw this.unexpected();return{kind:qm.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:o,loc:this.loc(e)}},t.parseInterfaceTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===o.length)throw this.unexpected();return{kind:qm.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:o,loc:this.loc(e)}},t.parseUnionTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:qm.UNION_TYPE_EXTENSION,name:t,directives:n,types:r,loc:this.loc(e)}},t.parseEnumTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:qm.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r,loc:this.loc(e)}},t.parseInputObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:qm.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r,loc:this.loc(e)}},t.parseDirectiveDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(Qm.AT);var n=this.parseName(),r=this.parseArgumentDefs(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var i=this.parseDirectiveLocations();return{kind:qm.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:o,locations:i,loc:this.loc(e)}},t.parseDirectiveLocations=function(){return this.delimitedMany(Qm.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==tg[t.value])return t;throw this.unexpected(e)},t.loc=function(e){var t;if(!0!==(null===(t=this._options)||void 0===t?void 0:t.noLocation))return new zm(e,this._lexer.lastToken,this._lexer.source)},t.peek=function(e){return this._lexer.token.kind===e},t.expectToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw Um(this._lexer.source,t.start,"Expected ".concat(vg(e),", found ").concat(gg(t),"."))},t.expectOptionalToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t},t.expectKeyword=function(e){var t=this._lexer.token;if(t.kind!==Qm.NAME||t.value!==e)throw Um(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(gg(t),"."));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===Qm.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=null!=e?e:this._lexer.token;return Um(this._lexer.source,t.start,"Unexpected ".concat(gg(t),"."))},t.any=function(e,t,n){this.expectToken(e);for(var r=[];!this.expectOptionalToken(n);)r.push(t.call(this));return r},t.optionalMany=function(e,t,n){if(this.expectOptionalToken(e)){var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}return[]},t.many=function(e,t,n){this.expectToken(e);var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r},t.delimitedMany=function(e,t){this.expectOptionalToken(e);var n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n},e}();function gg(e){var t=e.value;return vg(e.kind)+(null!=t?' "'.concat(t,'"'):"")}function vg(e){return function(e){return e===Qm.BANG||e===Qm.DOLLAR||e===Qm.AMP||e===Qm.PAREN_L||e===Qm.PAREN_R||e===Qm.SPREAD||e===Qm.COLON||e===Qm.EQUALS||e===Qm.AT||e===Qm.BRACKET_L||e===Qm.BRACKET_R||e===Qm.BRACE_L||e===Qm.PIPE||e===Qm.BRACE_R}(e)?'"'.concat(e,'"'):e}var bg=new Map,yg=new Map,wg=!0,Eg=!1;function _g(e){return e.replace(/[\s,]+/g," ").trim()}function xg(e){var t=new Set,n=[];return e.definitions.forEach((function(e){if("FragmentDefinition"===e.kind){var r=e.name.value,o=_g((a=e.loc).source.body.substring(a.start,a.end)),i=yg.get(r);i&&!i.has(o)?wg&&console.warn("Warning: fragment with name "+r+" already exists.\ngraphql-tag enforces all fragment names across your application to be unique; read more about\nthis in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"):i||yg.set(r,i=new Set),i.add(o),t.has(o)||(t.add(o),n.push(e))}else n.push(e);var a})),h(h({},e),{definitions:n})}function Sg(e){var t=_g(e);if(!bg.has(t)){var n=function(e,t){return new mg(e,t).parseDocument()}(e,{experimentalFragmentVariables:Eg});if(!n||"Document"!==n.kind)throw new Error("Not a valid GraphQL document.");bg.set(t,function(e){var t=new Set(e.definitions);t.forEach((function(e){e.loc&&delete e.loc,Object.keys(e).forEach((function(n){var r=e[n];r&&"object"==typeof r&&t.add(r)}))}));var n=e.loc;return n&&(delete n.startToken,delete n.endToken),e}(xg(n)))}return bg.get(t)}function Og(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];"string"==typeof e&&(e=[e]);var r=e[0];return t.forEach((function(t,n){t&&"Document"===t.kind?r+=t.loc.source.body:r+=t,r+=e[n+1]})),Sg(r)}var Cg,Tg=Og,kg=function(){bg.clear(),yg.clear()},Ng=function(){wg=!1},Ag=function(){Eg=!0},Ig=function(){Eg=!1};(Cg=Og||(Og={})).gql=Tg,Cg.resetCaches=kg,Cg.disableFragmentWarnings=Ng,Cg.enableExperimentalFragmentVariables=Ag,Cg.disableExperimentalFragmentVariables=Ig,Og.default=Og;const Pg=e=>"string"==typeof e?Og(e):e;function Rg(e){return new F((t=>{const n=e.then((e=>e.subscribe(t))).catch((()=>t.unsubscribe()));return function(){t.unsubscribe(),n.then((e=>null==e?void 0:e.unsubscribe())).catch((e=>console.log(e)))}}))}const Dg=at`
|
|
132
|
+
`,variables:{...e,source:Un.CODEHOSTINTEGRATION,argument:e.argument&&JSON.stringify(e.argument),publicArgument:e.publicArgument&&JSON.stringify(e.publicArgument)},mightContainPrivateInfo:!1}).subscribe({error:e=>{}})})({name:e,userCookieID:o,url:this.sourcegraphURL,argument:{platform:this.platform,version:this.version,...t},publicArgument:{platform:this.platform,version:this.version,...n}},this.requestGraphQL)}async log(e,t,n){switch(e){case"findReferences":await this.logEvent(e,t,n,Xn.CODEINTELINTEGRATIONREFS);break;case"goToDefinition":case"goToDefinition.preloaded":case"hover":await this.logEvent(e,t,n,Xn.CODEINTELINTEGRATION);break;default:await this.logEvent(e,t,n)}}async logViewEvent(e,t){await this.logEvent(`View${e}`,t)}async logPageView(e,t,n){await this.logEvent(`${e}Viewed`,t,n)}}const du={allowErrorReporting:!1,sendTelemetry:!0,experimentalLinkPreviews:!1,experimentalTextFieldCompletion:!1,clickToGoToDefinition:!1},hu=({get:e,set:t})=>({set:t,enable:e=>t(e,!0),disable:e=>t(e,!1),async isEnabled(t){const n=await e(t);return"boolean"==typeof n?n:du[t]},async toggle(n){const r=await e(n);return await t(n,!r),!r}});const mu=hu({get:async function(e){const{featureFlags:t={}}=await It.sync.get();return t[e]},set:async function(e,t){const{featureFlags:n}=await It.sync.get("featureFlags");await It.sync.set({featureFlags:{...n,[e]:t}})}}),gu=hu({get:async e=>{const t=localStorage.getItem(e);return null===t?void 0:"true"===t},set:async(e,t)=>{localStorage.setItem(e,String(t))}}),vu=Ft?gu:mu,bu={sendTelemetry:!1,allowErrorReporting:!1,experimentalLinkPreviews:!1,experimentalTextFieldCompletion:!1,clickToGoToDefinition:!1},yu=e=>({...bu,...e}),wu=()=>(jt?Pt("sync","featureFlags"):X(void 0)).pipe(te(yu));function Eu(e){return wu().pipe(te((t=>t[e])),Ro())}const _u=e=>Tt(e).pipe(te((t=>!(Ot()&&e)||!At(t)))),xu=e=>So([_u(e),Eu("sendTelemetry")]).pipe(te((([e,t])=>!!e||t)));function Su(){const{host:e,pathname:t}=location,[n,r]=t.slice(1).split("/");if(!n||!r)throw new Dr(`Could not parse repoName from Bitbucket Cloud url: ${location.href}`);return`${e}/${n}/${r}`}const Ou={getCodeElementFromTarget:e=>e.closest(".view-line > span"),getLineNumberFromCodeElement:e=>{if(!document.querySelector(".line-number"))throw new Error("No line number elements found on the currently viewed page");const t=e.closest(".react-monaco-editor-container");if(!t)throw new Error("No editor found");const n=e.closest(".view-line"),r=[...t.querySelectorAll(".view-line")].findIndex((e=>e===n)),o=t.querySelectorAll(".line-number")[r];if(o){var i,a,s;let e=parseInt(null!==(i=o.dataset.lineNum)&&void 0!==i?i:"",10);if(!isNaN(e))return e;if(e=parseInt(null!==(a=null===(s=o.textContent)||void 0===s?void 0:s.trim())&&void 0!==a?a:"",10),!isNaN(e))return e}throw new Error("Could not find line number")},getLineElementFromLineNumber:Cu,getCodeElementFromLineNumber:(e,t)=>{const n=Cu(e,t);if(!n)return null;const r=n.querySelector(":scope > span");return r||console.error(`Could not find code element inside .view-line container for line #${t}`),r}};function Cu(e,t){let n=e.querySelector(`[data-line-num="${t}"]`);if(!n)for(const o of e.querySelectorAll(".line-number")){var r;if(parseInt(null!==(r=o.textContent)&&void 0!==r?r:"",10)===t){n=o;break}}if(!n)return console.error(`Could not find line number element for line #${t}`),null;const o=[...e.querySelectorAll(".line-number")].findIndex((e=>e===n)),i=e.querySelectorAll(".view-line")[o];return i||console.error(`Could not find line element for line #${t}`),i}function Tu(e,t,n){var r,o;const i=null===(r=e.querySelector(`[aria-label="${"base"===n?"From":"To"} line ${t}"]`))||void 0===r||null===(o=r.closest(".line-wrapper"))||void 0===o?void 0:o.querySelector(".code-component");if(!i)throw new Error(`Could not locate line number element for line ${t}, part: ${String(n)}`);return i}const ku={getCodeElementFromTarget:e=>e.closest(".code-diff"),getLineNumberFromCodeElement:e=>{var t;const n=e.closest(".line-wrapper"),r=null==n?void 0:n.querySelectorAll(".line-number-permalink");if(!r||0===r.length)throw new Error("Could not find line number permalink(s) for code element");const o=r[r.length-1],i=parseInt(null!==(t=o.textContent)&&void 0!==t?t:"",10);if(!isNaN(i))return i;throw new Error("Could not find line number for code element")},getLineElementFromLineNumber:Tu,getCodeElementFromLineNumber:(e,t,n)=>{var r;return null===(r=Tu(e,t,n))||void 0===r?void 0:r.querySelector(".code-diff")},getDiffCodePart:e=>{var t,n,r;const o=e.closest(".code-component"),i=null==o?void 0:o.querySelector(".line-type");if(null!=i&&null!==(t=i.textContent)&&void 0!==t&&t.includes("+"))return"head";if(null!=i&&null!==(n=i.textContent)&&void 0!==n&&n.includes("+"))return"base";if(!e.closest(".side-by-side"))return"head";const a=e.closest(".line-wrapper");if(null!=a&&a.id)return null!=a&&a.id.includes("oldline")?"base":"head";return 0===[...(null==a||null===(r=a.parentElement)||void 0===r?void 0:r.childNodes)||[]].findIndex((e=>e===a))?"base":"head"},isFirstCharacterDiffIndicator:()=>!1};function Nu(e,t,n){var r;const o=null===(r=e.querySelector(`[data-${"base"===n?"f":"t"}num="${t}"]`))||void 0===r?void 0:r.closest(".udiff-line");if(!o)throw new Error(`Could not locate line number element for line ${t}, part: ${String(n)}`);return o}const Au={getCodeElementFromTarget:e=>e.closest(".source"),getLineNumberFromCodeElement:e=>{const t=e.closest(".udiff-line");if(!t)throw new Error("Could not find line element");const n=t.querySelector(".line-numbers");if(!n)throw new Error("Could not find line numbers element");const r=null==n?void 0:n.dataset.tnum;if(r){const e=parseInt(r,10);if(!isNaN(e))return e}const o=null==n?void 0:n.dataset.fnum;if(o){const e=parseInt(o,10);if(!isNaN(e))return e}throw new Error("Could not find line number for code element")},getLineElementFromLineNumber:Nu,getCodeElementFromLineNumber:(e,t,n)=>{var r;return null===(r=Nu(e,t,n))||void 0===r?void 0:r.querySelector(".source")},getDiffCodePart:e=>{const t=e.closest(".udiff-line");if(!t)throw new Error("Could not find line element for code element");return t.classList.contains("deletion")?"base":"head"},isFirstCharacterDiffIndicator:()=>!0},Iu=e=>e.replace("//","/"),Pu=["modified","renamed","removed","added"];function Ru(){const e=Su(),t=location.pathname.match(/src\/(.*?)\/(.*)/);if(!t)throw new Error("Unable to determine revision or file path");const n=decodeURIComponent(t[1]),r=decodeURIComponent(t[2]),o=function(){const e=['a[type="button"]',"a"];for(const t of e){const e=document.querySelectorAll(t);for(const t of e){const e=t.href.match(/full-commit\/([\da-f]{40})\//);if(e)return e[1]}}return null}();return{blob:{rawRepoName:e,revision:n,filePath:r,commitID:null!=o?o:n}}}function Du(e){const t=Su(),n=function(e){const t=[...e.querySelectorAll('[data-qa="bk-file__header"] span')];for(const e of t)for(const t of Pu){var n;if(null!==(n=e.textContent)&&void 0!==n&&n.toLowerCase().includes(t))return t}return"modified"}(e),{base:r,head:o}=function(e,t){var n;const r=null===(n=e.querySelector('[data-qa="bk-filepath"]'))||void 0===n?void 0:n.cloneNode(!0),o=null==r?void 0:r.textContent;if(!(r instanceof HTMLElement&&o))throw new Error("Could not find breadcrumbs component for code view");if("added"===t)return{head:o};if("removed"===t)return{base:o};if("modified"===t)return{base:o,head:o};const i="<>SEPARATOR<>",a=r.querySelectorAll('[aria-label="arrow"]');for(const e of a)e.textContent=i;const[s,c,l]=r.textContent.split(/[{}]/),[u,f]=c.split(i);return{base:Iu(s+u+l),head:Iu(s+f+l)}}(e,n),{baseRevision:i,headRevision:a}=function(){var e,t;const n=document.querySelector('[data-qa="pr-branches-and-state-styles"]');if(!n)throw new Error("Could not find branches element");const r=[...n.querySelectorAll('[aria-hidden="true"]')];if(2!==r.length)throw new Error("Expected source and destination branch elements");const o=null!==(e=r[0].textContent)&&void 0!==e?e:"";return{baseRevision:null!==(t=r[1].textContent)&&void 0!==t?t:"",headRevision:o}}();return"added"===n?{head:{rawRepoName:t,filePath:o,commitID:a,revision:a}}:"removed"===n?{base:{rawRepoName:t,filePath:r,commitID:i,revision:i}}:{head:{rawRepoName:t,filePath:o,commitID:a,revision:a},base:{rawRepoName:t,filePath:r,commitID:i,revision:i}}}function Lu(e){const t=Su(),n=function(e){const t=e.querySelector(".diff-entry-lozenge");for(const e of Pu){var n;if(null!=t&&null!==(n=t.textContent)&&void 0!==n&&n.toLowerCase().includes(e))return e}return"modified"}(e),{head:r,base:o}=function(e,t){var n;const r=null===(n=e.querySelector(".filename"))||void 0===n?void 0:n.cloneNode(!0);if(!r)throw new Error("Could not find breadcrumbs component for code view");for(const e of r.childNodes)e instanceof HTMLSpanElement&&(e.textContent=null);const o=r.textContent.trim();if("added"===t)return{head:o};if("removed"===t)return{base:o};if("modified"===t)return{base:o,head:o};const[i,a,s]=o.split(/[{}]/).map((e=>e.trim())),[c,l]=a.split("\u2192").map((e=>e.trim()));return{base:Iu(i+c+s),head:Iu(i+l+s)}}(e,n),{baseCommitID:i,headCommitID:a}=function(){var e;const t=null===(e=document.querySelector('[title="Parent commit"]'))||void 0===e?void 0:e.href.match(/\/commits\/(.*)/);if(!t)throw new Error("Could not determine base commit ID");const n=t[1],r=window.location.href.match(/\/commits\/(.*)/);if(!r)throw new Error("Could not determine head commit ID");return{baseCommitID:n,headCommitID:r[1]}}();return"added"===n?{head:{rawRepoName:t,filePath:r,commitID:a}}:"removed"===n?{base:{rawRepoName:t,filePath:o,commitID:i}}:{head:{rawRepoName:t,filePath:r,commitID:a},base:{rawRepoName:t,filePath:o,commitID:i}}}const Mu="codeHost-module__icon_3KtzB",ju="codeHost-module__commit-container_8Jft-";function Fu(e){const t=e.querySelector(".sg-toolbar-mount");if(t)return t;const n=e.querySelector('[data-testid="file-actions"');if(!n)throw new Error("Unable to find mount location");const r=document.createElement("div");return r.classList.add("sg-toolbar-mount"),n.prepend(r),r}function Bu(e){const t=e.querySelector(".sg-toolbar-mount");if(t)return t;const n=e.querySelector(".diff-actions");if(!n)throw new Error("Unable to find mount location");n.classList.add(ju);const r=document.createElement("div");return r.classList.add("sg-toolbar-mount"),n.prepend(r),r}const Uu={type:"bitbucket-cloud",name:"Bitbucket Cloud",codeViewResolvers:[{selector:e=>{const t=e.querySelector('[data-qa="bk-file__header"]'),n=e.querySelector('[data-qa="bk-file__content"]');if(!t||!n)return null;let r=t;for(;!r.contains(n);){if(!r.parentElement)return null;r=r.parentElement}return[r]},resolveView:e=>function({pathname:e}){return/\/pull-requests\/\d+/.test(e)}(window.location)?{element:e,getToolbarMount:Fu,dom:ku,resolveFileInfo:Du}:{element:e,getToolbarMount:Fu,dom:Ou,resolveFileInfo:Ru}},{selector:".bb-udiff",resolveView:e=>({element:e,getToolbarMount:Bu,dom:Au,resolveFileInfo:Lu})}],getContext:async function(){const e=Su();return Promise.resolve({rawRepoName:e,revision:"",privateRepository:!1})},getViewContextOnSourcegraphMount:function(e){var t;const n="open-on-sourcegraph",r=bo(e,'[data-qa="page-header-wrapper"] > div > div');if(!r)return null;let o=r.querySelector("#open-on-sourcegraph");if(o)return o;o=document.createElement("span"),o.id=n;const i=null===(t=r.childNodes[1])||void 0===t?void 0:t.childNodes[1].firstChild;return i instanceof HTMLElement?i.append(o):r.append(o),o},check:function(){return"bitbucket.org"===location.hostname},viewOnSourcegraphButtonClassProps:{className:"codeHost-module__open-on-sourcegraph_10lR9",iconClassName:Mu},codeViewToolbarClassProps:{className:"codeHost-module__code-view-toolbar_N0wZ1",listItemClass:"codeHost-module__list-item_370zl",actionItemClass:"codeHost-module__code-view-toolbar-action-item_2p6Pr",actionItemPressedClass:"codeHost-module__pressed_1ksxF",actionItemIconClass:Mu},hoverOverlayClassProps:{className:"codeHost-module__hover-overlay_2e1lQ",badgeClassName:"codeHost-module__badge_16Tsk",actionItemClassName:"codeHost-module__hover-overlay-action-item_39z-G",iconClassName:Mu,contentClassName:"codeHost-module__content_eSBN7"},notificationClassNames:{1:"",2:"",3:"",4:"",5:""},codeViewsRequireTokenization:!0},qu=(e,t)=>n=>i()(e[n],t),Vu=/\/projects\/([^/]+)\/repos\/([^/]+)\//;const $u=(e,t)=>{const n=e.querySelector(`[data-line-number="${t}"]`);if(!n)throw new Error(`Line ${t} not found in code view`);const r=n.closest(".line");if(!r)throw new Error("Could not find line elem for line element");return r},zu={getCodeElementFromTarget:e=>{const t=e.closest(".CodeMirror-line");return t?t.querySelector('span[role="presentation"]'):null},getLineNumberFromCodeElement:e=>{const t=e.closest(".line");if(!t)throw new Error("Could not find line containing code element");const n=t.querySelector(".line-locator");if(!n)throw new Error("Could not find the line number in a line container");const r=parseInt(n.dataset.lineNumber||"",10);if(isNaN(r))throw new TypeError("data-line-number not set on line number element");return r},getLineElementFromLineNumber:$u,getCodeElementFromLineNumber:(e,t)=>$u(e,t).querySelector('.CodeMirror-line span[role="presentation"]')},Hu=(e,t,n)=>{for(const r of e.querySelectorAll(".line-number-"+("head"===n?"to":"from"))){const e=parseInt((r.textContent||"").trim(),10);if(!isNaN(e)&&e===t){const e=r.closest(".line");if(!e)throw new Error("Could not find lineElem from lineNumElem");return e}}throw new Error(`Could not locate line number element for line ${t}, part: ${String(n)}`)},Gu={getCodeElementFromTarget:zu.getCodeElementFromTarget,getLineNumberFromCodeElement:e=>{const t=e.closest(".line");if(!t)throw new Error("Could not find line containing code element");const n=t.querySelector(".line-number-to");if(n){const e=parseInt((n.textContent||"").trim(),10);if(!isNaN(e))return e}const r=t.querySelector(".line-number-from");if(r){const e=parseInt((r.textContent||"").trim(),10);if(!isNaN(e))return e}throw new Error("Could not find line number element for code element")},getLineElementFromLineNumber:Hu,getCodeElementFromLineNumber:(e,t,n)=>Hu(e,t,n).querySelector('.CodeMirror-line span[role="presentation"]'),getDiffCodePart:e=>{var t;if(!document.querySelector(".side-by-side-diff"))return e.closest(".line").classList.contains("removed")?"base":"head";return null!==(t=e.closest(".diff-editor").previousElementSibling)&&void 0!==t&&t.classList.contains("segment-connector-column")?"head":"base"},isFirstCharacterDiffIndicator:()=>!1},Qu=(e,t,n)=>{for(const i of e.querySelectorAll(".diff-line-number")){var r;const e=null===(r=i.textContent)||void 0===r?void 0:r.trim().split(" ")[0];if(!e)continue;const a=parseInt(e,10);if(!isNaN(a)&&a===t){var o;const e=null===(o=i.closest("tr"))||void 0===o?void 0:o.querySelector(`.diff-line[data-diff-line="${"head"===n?"TO":"FROM"}"]`);if(!e)throw new Error("Could not find lineElem from lineNumElem");return e}}throw new Error(`Could not locate line number element for line ${t}, part: ${String(n)}`)},Wu={getCodeElementFromTarget:e=>e.closest(".diff-line"),getLineNumberFromCodeElement:e=>{var t;const n=null===(t=e.closest("tr"))||void 0===t?void 0:t.querySelector(".diff-gutter .diff-line-number");if(n){const e=parseInt((n.textContent||"").trim(),10);if(!isNaN(e))return e}throw new Error("Could not find line number element for code element")},getDiffCodePart:e=>{var t;const n=null===(t=e.closest("tr"))||void 0===t?void 0:t.querySelectorAll(".diff-line");if(!n||0===n.length)throw new Error("Could not find diff lines for code element");if(1===n.length)return e.classList.contains("added-line")?"head":"base";const[r,o]=n;return e===r?"base":e===o?"head":e.classList.contains("removed-line")?"base":"head"},getLineElementFromLineNumber:Qu,getCodeElementFromLineNumber:Qu};var Ku=n(11570),Zu=n.n(Ku);const Yu=(e,t,n)=>`${window.AJS?window.AJS.contextPath():window.location.origin}/rest/api/1.0/projects/${encodeURIComponent(e)}/repos/${t}${n}`,Ju=e=>ee(e,{selector:e=>tt(e).json()}),Xu=Ze((({project:e,repoSlug:t,prID:n})=>Ju(Yu(e,t,`/pull-requests/${n}`)).pipe(te((({fromRef:e,toRef:t})=>({baseCommitID:t.latestCommit,headCommitID:e.latestCommit}))))),(({prID:e})=>e.toString())),ef=Ze((({project:e,repoSlug:t,commitID:n})=>Ju(Yu(e,t,`/commits/${n}`)).pipe(te((({parents:e})=>Zu()(e))),_t(Ji),te((({id:e})=>e)))),(({project:e,repoSlug:t,commitID:n})=>`${e}:${t}:${n}`)),tf=["a.raw-view-link","a.source-view-link","a.mode-source"],nf=({repoSlug:e,project:t})=>[window.location.hostname,t,e].join("/"),rf=e=>{const t=[];for(const n of tf)try{const t=e.querySelector(n);if(!t)throw new Error(`Could not find selector ${n} in code view`);const r=new URL(t.href),o=r.pathname,i=o.match(/\/projects\/(.*?)\/repos\/(.*?)\/(?:browse|raw)\/(.*)$/);if(!i)throw new Error(`Path of link matching selector ${n} did not match path regex: ${o}`);const[,a,s,c]=i,l=r.searchParams.get("at");if(!l)throw new Error(`href of link matching selector ${n} did not have 'at' search param: ${r.href}`);const u=l.match(/refs\/heads\/(.*?)$/),f=u?u[1]:l;return{rawRepoName:nf({repoSlug:s,project:a}),filePath:decodeURIComponent(c),revision:f,project:a,repoSlug:s}}catch(e){t.push(e);continue}throw it(t)},of=(e="a.commitid")=>{const t=document.querySelector(e);if(!t)throw new Error("No element found matching a.commitid");const n=t.dataset.commitid;if(!n)throw new Error("Element matching a.commitid has no data-commitid");return n},af=e=>{const{rawRepoName:t,filePath:n,revision:r,project:o,repoSlug:i}=rf(e);return{rawRepoName:t,filePath:n,revision:r,commitID:(()=>{const e=document.querySelector("span[data-revision-ref]");if(!e)throw new Error("Could not find span[data-revision-ref] element");try{const{latestCommit:t}=JSON.parse(e.dataset.revisionRef);return t}catch{throw new Error("Could not parse JSON from revision selector")}})(),project:o,repoSlug:i}},sf=({codeViewElement:e})=>e.querySelector(".change-type-lozenge"),cf=({changeTypeElement:e})=>{if(!e)return"MODIFY";const t=[...e.classList].find((e=>/^change-type-[A-Z]+/.test(e)));if(!t)throw new Error("Could not detect change type from change type element");return t.replace(/^change-type-/,"")},lf=({filePath:e,changeType:t,changeTypeElement:n})=>{if("ADD"!==t){if("MODIFY"===t||"DELETE"===t)return e;if("MOVE"===t||"RENAME"===t||"COPY"===t){if(!n)throw new Error(`Change type is ${t} but no change type indicator found`);const r=n.getAttribute("original-title");if(!r)throw new Error("Moved change type badge did not have original-title attribute");const o=document.createElement("span");o.innerHTML=r;const i=o.textContent;if("MOVE"===t||"COPY"===t){const e=i.split("\u2192")[0].trim();if(!e)throw new Error(`Unexpected move change type badge content "${i}"`);return e}if("RENAME"===t){const t=/Renamed from '(.+)'/,n=i.match(t);if(!n)throw new Error(`Rename change type badge content did not match ${t.toString()}: "${i}"`);return xs.join(xs.dirname(e),n[1])}}throw new Error(`Unexpected change type "${t}"`)}},uf=e=>{var t;const n=null!==(t=e.querySelector(".breadcrumbs"))&&void 0!==t?t:e.querySelector(".file-breadcrumbs");if(!n)throw new Error("Could not find diff code view breadcrumbs element through selector .breadcrumbs");const r=n.textContent;if(!r)throw new Error("Unexpected empty file path in breadcrumbs");const o=location.pathname.match(/\/projects\/(.*?)\/repos\/(.*?)\//);if(!o)throw new Error("Location did not match regexp");const[,i,a]=o,s=nf({project:i,repoSlug:a}),c=sf({codeViewElement:e}),l=cf({changeTypeElement:c});return{changeType:l,rawRepoName:s,filePath:r,baseFilePath:lf({changeTypeElement:c,changeType:l,filePath:r})||r,project:i,repoSlug:a}};const ff=e=>{const t=uf(e),{rawRepoName:n,filePath:r,baseFilePath:o}=t,i=function(){const e=window.location.pathname.match(/pull-requests\/(\d*?)\/(diff|overview|commits)/);if(!e)throw new Error(`Could not parse PR ID from pathname: ${window.location.pathname}`);return parseInt(e[1],10)}();return Xu({...t,prID:i}).pipe(te((({headCommitID:e,baseCommitID:t})=>({head:{rawRepoName:n,filePath:r,commitID:e},base:{rawRepoName:n,filePath:o,commitID:t}}))))},pf="codeHost-module__command-palette-button_1LPsz",df="codeHost-module__command-palette-popover_wqnFp",hf="codeHost-module__no-results_3Di26",mf="codeHost-module__open-on-sourcegraph_i9J2G",gf="codeHost-module__sg-toolbar-mount_2Fbz5",vf="codeHost-module__code-view-toolbar_IVqgq",bf="codeHost-module__action-nav-item_223JV",yf="codeHost-module__action-nav-item-new-diff_23eTl",wf="codeHost-module__action-item-new-diff_3Tuv4",Ef="codeHost-module__hover-action-item_9CC-W",_f="codeHost-module__command-list-popover-button_3eptU",xf=(e,t=".file-toolbar .secondary")=>{const n=e.querySelector(".sg-toolbar-mount");if(n)return n;const r=e.querySelector(t);if(!r)throw new Error("Unable to find mount location");const o=document.createElement("div");return o.classList.add("btn-group"),o.classList.add("sg-toolbar-mount"),o.classList.add(gf),r.prepend(o),o},Sf=e=>({direction:t,codeView:n,position:r})=>{const o=e.getCodeElementFromLineNumber(n,r.line,r.part);if(!o)throw new Error("(adjustPosition) could not find code element for line provided");let i=0;for(const e of o.querySelectorAll("[cm-text]")){const t=e.getAttribute("cm-text")||"",n=e.textContent||"";i+=t.length-n.length}const a=t===qi.ActualToCodeView?-1:1;return X({line:r.line,character:r.character+a*i})},Of={getToolbarMount:xf,dom:zu,resolveFileInfo:e=>({blob:af(e)}),getPositionAdjuster:()=>Sf(zu)},Cf={getToolbarMount:xf,dom:Gu,getPositionAdjuster:()=>Sf(Gu),overrideTokenize:!0},Tf={...Cf,resolveFileInfo:e=>{const{changeType:t,rawRepoName:n,filePath:r,commitID:o,baseFilePath:i,revision:a,...s}=(e=>{const{rawRepoName:t,project:n,repoSlug:r,filePath:o}=rf(e),i=of(),a=sf({codeViewElement:e}),s=cf({changeTypeElement:a});return{changeType:s,rawRepoName:t,filePath:o,baseFilePath:lf({changeTypeElement:a,changeType:s,filePath:o})||o,commitID:i,project:n,repoSlug:r}})(e);return"ADD"===t?X({head:{rawRepoName:n,filePath:r,commitID:o}}):ef({commitID:o,...s}).pipe(te((e=>"DELETE"===t?{base:{rawRepoName:n,filePath:i,commitID:e}}:{base:{rawRepoName:n,filePath:i,commitID:e},head:{rawRepoName:n,filePath:r,commitID:o}})))}},kf={...Cf,resolveFileInfo:ff},Nf={...Cf,resolveFileInfo:e=>{const{rawRepoName:t,filePath:n,baseFilePath:r}=uf(e),{baseCommitID:o,headCommitID:i}=function(){const e=document.querySelector("#branch-compare .source-selector a.commitid[data-commitid]"),t=document.querySelector("#branch-compare .target-selector a.commitid[data-commitid]");if(!e||!t)throw new Error("Could not resolve Bitbucket compare diff spec");return{headCommitID:e.getAttribute("data-commitid"),baseCommitID:t.getAttribute("data-commitid")}}();return{base:{rawRepoName:t,filePath:r,commitID:i},head:{rawRepoName:t,filePath:n,commitID:o}}}},Af={...Cf,resolveFileInfo:e=>(e=>{const t=of(".commit-badge-oneline .commitid"),n=of(".commit-parents .commitid"),{rawRepoName:r,filePath:o,baseFilePath:i}=uf(e);return{head:{rawRepoName:r,filePath:o,commitID:t},base:{rawRepoName:r,filePath:i,commitID:n}}})(e)},If={selector:".change-view",resolveView:e=>({element:e,...Pf})},Pf={resolveFileInfo:ff,getToolbarMount:e=>xf(e,".change-header .diff-actions"),toolbarButtonProps:{listItemClass:yf,actionItemClass:wf},dom:Wu};const Rf="aui-icon",Df={[Us]:"aui-message aui-message-info",[qs]:"aui-message aui-message-success",[Bs]:"aui-message aui-message-info",[Fs]:"aui-message aui-message-warning",[js]:"aui-message aui-message-error"},Lf={type:"bitbucket-server",name:"Bitbucket Server",check:()=>!!document.querySelector(".bitbucket-header-logo")||!!document.querySelector(".aui-header-logo.aui-header-logo-bitbucket"),codeViewResolvers:[{selector:".file-content",resolveView:e=>{const t=e.querySelector(".content-view");if(!t)return null;if(document.querySelector("#branch-compare"))return{element:e,...Nf};if((({pathname:e})=>/\/projects\/[^/]+\/repos\/[^/]+\/commits\/\w+$/.test(e))(window.location))return{element:e,...Af};if(e.querySelector(".mode-toggle")){return t.classList.contains("diff-view")?{element:e,...Tf}:{element:e,...Of}}return(({pathname:e})=>/\/projects\/[^/]+\/repos\/[^/]+\/pull-requests\/\d+/.test(e))(window.location)?{element:e,...kf}:(console.error("Unknown code view",e),null)}},If],getCommandPaletteMount:e=>{const t=bo(e,".aui-header-primary .aui-nav");if(!t)return null;const n=["command-palette-button",pf];return t.querySelector(n.map((e=>`.${e}`)).join(""))||(()=>{const e=document.createElement("li");return e.className=n.join(" "),t.append(e),e})()},notificationClassNames:Df,commandPaletteClassProps:{buttonClassName:i()(_f,"aui-alignment-target aui-alignment-abutted aui-alignment-abutted-left aui-alignment-element-attached-top aui-alignment-element-attached-left aui-alignment-target-attached-bottom aui-alignment-target-attached-left"),buttonElement:"a",buttonOpenClassName:"aui-dropdown2-active active aui-alignment-enabled",showCaret:!1,popoverClassName:i()(df,"aui-dropdown2 aui-style-default aui-layer aui-dropdown2-in-header aui-alignment-element aui-alignment-side-bottom aui-alignment-snap-left aui-alignment-enabled aui-alignment-abutted aui-alignment-abutted-left aui-alignment-element-attached-top aui-alignment-element-attached-left aui-alignment-target-attached-bottom aui-alignment-target-attached-left"),popoverInnerClassName:"aui-dropdown2-section",formClassName:"aui",inputClassName:"text",resultsContainerClassName:"results",listClassName:"results-list",listItemClassName:"result",selectedListItemClassName:"focused",noResultsClassName:hf,iconClassName:Rf},codeViewToolbarClassProps:{className:i()(vf,"aui-buttons"),actionItemClass:"aui-button",actionItemIconClass:"aui-icon",listItemClass:bf},hoverOverlayClassProps:{className:"aui-dialog",actionItemClassName:i()("aui-button",Ef),getAlertClassName:qu(Df),iconClassName:Rf},getViewContextOnSourcegraphMount:function(e){const t=bo(e,".branch-selector-toolbar .aui-buttons");if(!t)return null;const n=t.querySelector("#open-on-sourcegraph");if(n)return n;const r=document.createElement("span");return r.id="open-on-sourcegraph",r.className=mf,t.append(r),r},getContext:async function(){const e=function(e){const{hostname:t,pathname:n}=e,r=n.match(Vu);if(!r)throw new Error(`location pathname does not match path regex: ${n}`);const[,o,i]=r;return{rawRepoName:`${t}/${o}/${i}`}}(window.location);let t={};try{t=function(){var e;const t=document.querySelector("#repository-layout-revision-selector .name[data-revision-ref]");if(!t)throw new Error("branchNameElement not found");const n=t.getAttribute("data-revision-ref");let r=null;if(n)try{r=JSON.parse(n)}catch{throw new Error(`Could not parse revisionRefStr: ${n}`)}if(null!==(e=r)&&void 0!==e&&e.latestCommit)return{revision:r.latestCommit};throw new Error(`revisionRefInfo is empty or has no latestCommit (revisionRefStr: ${String(n)})`)}()}catch{}return Promise.resolve({...e,...t,privateRepository:"bitbucket.org"!==window.location.hostname})},viewOnSourcegraphButtonClassProps:{className:"aui-button",iconClassName:Rf},codeViewsRequireTokenization:!1};var Mf=n(65291),jf=n.n(Mf),Ff=n(92674),Bf=n.n(Ff),Uf=n(26416),qf=n.n(Uf);function Vf(e){return new F((function(t){var n;try{n=e()}catch(e){return void t.error(e)}return(n?Z(n):ke()).subscribe(t)}))}function $f(e){return t=>Vf((()=>{const n=new Map;return t.pipe(Ae(Vt),wt(),Ge((({removedNodes:e})=>{for(const t of e){if(!(t instanceof HTMLElement))continue;const e=n.get(t);if(e)e.subscriptions.unsubscribe(),n.delete(t);else for(const[e,r]of n.entries())t.contains(e)&&(r.subscriptions.unsubscribe(),n.delete(e))}})),gt((t=>Z(t.addedNodes).pipe(_t(Yi(HTMLElement)),gt((t=>Z(e).pipe(gt((({selector:e,resolveView:n})=>[...zf(t,e)].map((e=>{const t=n(e);return t&&{...t,subscriptions:new A}})))),_t(Ji),_t((e=>!n.has(e.element))),Ge((e=>{n.set(e.element,e)})))))))))}))}function zf(e,t){if("string"==typeof t)return vo(e,t);return t(e)||[]}const Hf=/patchset (\d+)/i;function Gf(e,t){return`refs/changes/${e.slice(-2).padStart(2,"0")}/${e}/${t}`}function Qf(e){var t,n;return null!==(t=null===(n=rp(document.body,e))||void 0===n?void 0:n.textContent)&&void 0!==t?t:void 0}function Wf(e){const t=Hf.exec(e);if(null!=t&&t[1])return t[1]}function Kf(){const e=new URL(window.location.href).pathname.split("/"),t=e.indexOf("c"),n=e.indexOf("+"),r=e.slice(t+1,n).join("/"),o=e[n+1],i=e[n+2],a=e.slice(n+3).join("/"),s=window.location.hostname+"/"+r,{basePatchsetId:c,headPatchsetId:l}=function(){var e,t;const n=null!==(e=Qf("#app >> #app-element >> gr-change-view >> #fileListHeader >> #rangeSelect >> #basePatchDropdown >> #triggerText"))&&void 0!==e?e:Qf("#app >> #app-element >> gr-diff-view >> #rangeSelect >> #basePatchDropdown >> #triggerText"),r=null!==(t=Qf("#app >> #app-element >> gr-change-view >> #fileListHeader >> #rangeSelect >> #patchNumDropdown >> #triggerText"))&&void 0!==t?t:Qf("#app >> #app-element >> gr-diff-view >> #rangeSelect >> #patchNumDropdown >> #triggerText");return{basePatchsetId:n&&Wf(n),headPatchsetId:r&&Wf(r)}}();return{repoName:s,changeId:o,patchsetId:l||i,filePath:a,basePatchsetId:c}}const Zf={selector(e){var t;if(e.matches("#diffTable"))return[e];const n=rp(document,"#app >> #app-element >> gr-change-view >> #fileList"),r=[...(null==n||null===(t=n.shadowRoot)||void 0===t?void 0:t.querySelectorAll(".file-row.expanded"))||[]].map((e=>{const t=e.parentElement;if(t)return rp(t,"gr-diff-host >> gr-diff >> #diffTable")}));return qf()(r)},resolveView(e){const t=op(e,".stickyArea");if(!t)return null;const n=t.querySelector(".file-row"),r=null==n?void 0:n.getAttribute("data-path");if(!r)return null;const o=Kf();if(!o.patchsetId)return console.error("Sourcegraph: Cannot get Gerrit patchset ID"),null;const i=Gf(o.changeId,o.patchsetId);let a;return a=o.basePatchsetId?Gf(o.changeId,o.basePatchsetId):function(){var e,t,n;const r=rp(document.body,"#app >> #app-element >> gr-change-view >> #metadata >> gr-commit-info");if(!r)return null;return null==r||null===(e=r.shadowRoot)||void 0===e||null===(t=e.querySelector(".container"))||void 0===t||null===(n=t.textContent)||void 0===n?void 0:n.trim()}()||i+"^",ap(e),{element:e,dom:Jf,resolveFileInfo(){const e={base:{filePath:r||"",rawRepoName:o.repoName,commitID:a},head:{filePath:r||"",rawRepoName:o.repoName,commitID:i}};return console.log("resolveFileListCodeView: fileInfo",e),e}}}},Yf=(e,t,n)=>{const r="head"===n?"right":"left",o=e.querySelector(`td.lineNum.${r}[data-value="${t}"]`);if(!o)return null;const i=function(e,t){var n;const r=[...(null===(n=e.parentElement)||void 0===n?void 0:n.childNodes)||[]],o=r.slice(r.indexOf(e)+1);for(const e of o)if(e instanceof HTMLElement&&e.matches(t))return e;return null}(o,"td.content");return null==i?void 0:i.querySelector(".contentText")},Jf={getLineElementFromLineNumber:Yf,getCodeElementFromLineNumber:Yf,getCodeElementFromTarget:e=>{var t;const n=e.closest("td.content"),r=null==n||null===(t=n.closest("tr"))||void 0===t?void 0:t.querySelector("[data-line-number]");if(r){if("FILE"===r.getAttribute("data-line-number"))return null}return n},getLineNumberFromCodeElement:e=>{var t;const n=np(e);if(!n)throw console.error(e),new TypeError("Could not find line number (no side)");const r=e.closest("td"),o=null==r||null===(t=r.parentElement)||void 0===t?void 0:t.querySelector(`.lineNum.${n}`),i=null==o?void 0:o.getAttribute("data-value");if(!i)throw new TypeError(`Could not find line number (${n})`);return parseInt(i,10)},getDiffCodePart:e=>{const t=np(e);return"left"===t?"base":"right"===t?"head":(console.error("Cannot tell: base or head"),"base")}},Xf=[{selector(e){const t=rp(document.body,"#app >> #app-element >> gr-diff-view >> #diffHost >> #diff >> #diffTable");return t?[t]:[]},resolveView(e){const t=Kf();if(!t.patchsetId)return console.error("Sourcegraph: cannot find patchset ID"),null;const n=Gf(t.changeId,t.patchsetId);let r=n+"^";return t.basePatchsetId&&(r=Gf(t.changeId,t.basePatchsetId)),ap(e),{element:e,dom:Jf,getToolbarMount(e){var t;const n=null===(t=function(e){var t;const n=op(e,"gr-diff-view");return null==n||null===(t=n.shadowRoot)||void 0===t?void 0:t.querySelector("gr-fixed-panel .subHeader")}(e))||void 0===t?void 0:t.querySelector(".patchRangeLeft");if(!n)throw new Error("Could not find subheader");const r=n.querySelector(".sourcegraph-toolbar-mount");if(r)return r;const o=document.createElement("div");return o.classList.add("sourcegraph-toolbar-mount"),n.append(o),n.append(ip(sp)),o},resolveFileInfo(){const e={base:{filePath:t.filePath||"",rawRepoName:t.repoName,commitID:r},head:{filePath:t.filePath||"",rawRepoName:t.repoName,commitID:n}};return console.log("resolveFilePageCodeView: fileInfo",e),e}}}},Zf],ep={type:"gerrit",name:"Gerrit",codeViewResolvers:Xf,contentViewResolvers:[],nativeTooltipResolvers:[],codeViewsRequireTokenization:!0,observeMutations:(e,t,n)=>{let r=[];return Pl(1500).pipe(te((()=>{const{filePath:e=""}=Kf(),t=[...Xf.map((e=>e.selector)),tp].map((e=>[...zf(document.body,e)])).flat(),n=t.filter((t=>!Bf()(r,{element:t,filePath:e}))),o=r.filter((n=>!(n.filePath===e&&t.find((e=>e===n.element)))));for(const t of n)r.push({element:t,filePath:e});return r=r.filter((e=>!Bf()(o,e))),{addedNodes:n,removedNodes:o.map((e=>e.element))}})),_t((({addedNodes:e,removedNodes:t})=>!!e.length||!!t.length)),te((e=>[e])),ze(),Me())},getContext:async()=>{const{repoName:e,changeId:t,patchsetId:n}=Kf();return Promise.resolve({privateRepository:!0,rawRepoName:e,revision:n&&Gf(t,n)})},check:function(){return!!document.querySelector("gr-app#app")},notificationClassNames:{1:"",2:"",3:"",4:"",5:""},hoverOverlayClassProps:{className:"codeHost-module__hover-overlay_1jwSd"},codeViewToolbarClassProps:{className:"code-view-toolbar--gerrit",actionItemIconClass:"icon--gerrit"},viewOnSourcegraphButtonClassProps:{className:"open-on-sourcegraph--gerrit",iconClassName:"open-on-sourcegraph-icon--gerrit"},getViewContextOnSourcegraphMount:e=>{const t=jf()(tp(e));if(!t)return null;const n=t.querySelector(".open-in-sourcegraph-mount");if(n)return n;const r=document.createElement("gr-button");return r.setAttribute("link","link"),r.classList.add("open-in-sourcegraph-mount"),t.prepend(r),t.append(ip(sp)),r}},tp=()=>{const e=rp(document.body,"#app >> #app-element >> gr-change-view >> #actions >> #secondaryActions");return e?[e]:null};function np(e){var t,n;if("unified"===function(e){const t=e.closest("tr");return null!=t&&t.matches(".unified")?"unified":"side-by-side"}(e)){var r,o;return(null===(r=e.closest("tr"))||void 0===r||null===(o=r.querySelector("td.right"))||void 0===o?void 0:o.getAttribute("data-value"))?"right":"left"}return null!==(t=e.closest("td"))&&void 0!==t&&null!==(n=t.previousElementSibling)&&void 0!==n&&n.matches(".right")?"right":"left"}function rp(e,t){var n;"string"==typeof t&&(t=t.split(">>"));let r=e;const o=t.slice(0,-1),i=t[t.length-1];for(const e of o){var a;if(!r)return null;r=(null===(a=r.querySelector(e))||void 0===a?void 0:a.shadowRoot)||null}return null===(n=r)||void 0===n?void 0:n.querySelector(i)}function op(e,t){for(;;){var n;const r=e.closest(t);if(r)return r;if(!(e=null===(n=e.getRootNode())||void 0===n?void 0:n.host)||e===document.getRootNode())return null}}function ip(e){const t=document.createElement("style");return t.textContent=e,t}function ap(e){if(!e.querySelector("style.sourcegraph-injected-style")){const t=ip(cp);t.classList.add("sourcegraph-injected-style"),e.append(t)}}const sp="\n.icon--gerrit {\n height: 1.3rem;\n width: 1.3rem;\n padding: 5px 4px;\n}\n.open-on-sourcegraph-icon--gerrit {\n height: 1rem;\n width: 1rem;\n}\n.open-on-sourcegraph--gerrit {\n text-decoration: none;\n}\n",cp="\n.sourcegraph-document-highlight {\n background-color: var(--secondary);\n}\n.selection-highlight {\n background-color: var(--mark-bg);\n}\n";var lp,up,fp=n(36021),pp=n.n(fp);!function(e){e.Ok="ok",e.Exited="exited",e.Crashed="crashed",e.Abnormal="abnormal"}(lp||(lp={})),function(e){e.Ok="ok",e.Errored="errored",e.Crashed="crashed"}(up||(up={}));var dp=n(97753),hp=n(91698),mp=(0,dp.Rf)(),gp="Sentry Logger ",vp=function(){function e(){this._enabled=!1}return e.prototype.disable=function(){this._enabled=!1},e.prototype.enable=function(){this._enabled=!0},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._enabled&&(0,dp.Cf)((function(){mp.console.log(gp+"[Log]: "+e.join(" "))}))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._enabled&&(0,dp.Cf)((function(){mp.console.warn(gp+"[Warn]: "+e.join(" "))}))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._enabled&&(0,dp.Cf)((function(){mp.console.error(gp+"[Error]: "+e.join(" "))}))},e}();mp.__SENTRY__=mp.__SENTRY__||{};var bp,yp=mp.__SENTRY__.logger||(mp.__SENTRY__.logger=new vp),wp=n(59212);function Ep(e){return"[object Object]"===Object.prototype.toString.call(e)}function _p(e){return Boolean(e&&e.then&&"function"==typeof e.then)}!function(e){e.PENDING="PENDING",e.RESOLVED="RESOLVED",e.REJECTED="REJECTED"}(bp||(bp={}));var xp=function(){function e(e){var t=this;this._state=bp.PENDING,this._handlers=[],this._resolve=function(e){t._setResult(bp.RESOLVED,e)},this._reject=function(e){t._setResult(bp.REJECTED,e)},this._setResult=function(e,n){t._state===bp.PENDING&&(_p(n)?n.then(t._resolve,t._reject):(t._state=e,t._value=n,t._executeHandlers()))},this._attachHandler=function(e){t._handlers=t._handlers.concat(e),t._executeHandlers()},this._executeHandlers=function(){if(t._state!==bp.PENDING){var e=t._handlers.slice();t._handlers=[],e.forEach((function(e){e.done||(t._state===bp.RESOLVED&&e.onfulfilled&&e.onfulfilled(t._value),t._state===bp.REJECTED&&e.onrejected&&e.onrejected(t._value),e.done=!0)}))}};try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}return e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,n){n(t)}))},e.all=function(t){return new e((function(n,r){if(Array.isArray(t))if(0!==t.length){var o=t.length,i=[];t.forEach((function(t,a){e.resolve(t).then((function(e){i[a]=e,0===(o-=1)&&n(i)})).then(null,r)}))}else n([]);else r(new TypeError("Promise.all requires an array as input."))}))},e.prototype.then=function(t,n){var r=this;return new e((function(e,o){r._attachHandler({done:!1,onfulfilled:function(n){if(t)try{return void e(t(n))}catch(e){return void o(e)}else e(n)},onrejected:function(t){if(n)try{return void e(n(t))}catch(e){return void o(e)}else o(t)}})}))},e.prototype.catch=function(e){return this.then((function(e){return e}),e)},e.prototype.finally=function(t){var n=this;return new e((function(e,r){var o,i;return n.then((function(e){i=!1,o=e,t&&t()}),(function(e){i=!0,o=e,t&&t()})).then((function(){i?r(o):e(o)}))}))},e.prototype.toString=function(){return"[object SyncPromise]"},e}(),Sp=function(){function e(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._user={},this._tags={},this._extra={},this._contexts={}}return e.clone=function(t){var n=new e;return t&&(n._breadcrumbs=w(t._breadcrumbs),n._tags=h({},t._tags),n._extra=h({},t._extra),n._contexts=h({},t._contexts),n._user=t._user,n._level=t._level,n._span=t._span,n._session=t._session,n._transactionName=t._transactionName,n._fingerprint=t._fingerprint,n._eventProcessors=w(t._eventProcessors),n._requestSession=t._requestSession),n},e.prototype.addScopeListener=function(e){this._scopeListeners.push(e)},e.prototype.addEventProcessor=function(e){return this._eventProcessors.push(e),this},e.prototype.setUser=function(e){return this._user=e||{},this._session&&this._session.update({user:e}),this._notifyScopeListeners(),this},e.prototype.getUser=function(){return this._user},e.prototype.getRequestSession=function(){return this._requestSession},e.prototype.setRequestSession=function(e){return this._requestSession=e,this},e.prototype.setTags=function(e){return this._tags=h(h({},this._tags),e),this._notifyScopeListeners(),this},e.prototype.setTag=function(e,t){var n;return this._tags=h(h({},this._tags),((n={})[e]=t,n)),this._notifyScopeListeners(),this},e.prototype.setExtras=function(e){return this._extra=h(h({},this._extra),e),this._notifyScopeListeners(),this},e.prototype.setExtra=function(e,t){var n;return this._extra=h(h({},this._extra),((n={})[e]=t,n)),this._notifyScopeListeners(),this},e.prototype.setFingerprint=function(e){return this._fingerprint=e,this._notifyScopeListeners(),this},e.prototype.setLevel=function(e){return this._level=e,this._notifyScopeListeners(),this},e.prototype.setTransactionName=function(e){return this._transactionName=e,this._notifyScopeListeners(),this},e.prototype.setTransaction=function(e){return this.setTransactionName(e)},e.prototype.setContext=function(e,t){var n;return null===t?delete this._contexts[e]:this._contexts=h(h({},this._contexts),((n={})[e]=t,n)),this._notifyScopeListeners(),this},e.prototype.setSpan=function(e){return this._span=e,this._notifyScopeListeners(),this},e.prototype.getSpan=function(){return this._span},e.prototype.getTransaction=function(){var e,t,n,r,o=this.getSpan();return(null===(e=o)||void 0===e?void 0:e.transaction)?null===(t=o)||void 0===t?void 0:t.transaction:(null===(r=null===(n=o)||void 0===n?void 0:n.spanRecorder)||void 0===r?void 0:r.spans[0])?o.spanRecorder.spans[0]:void 0},e.prototype.setSession=function(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this},e.prototype.getSession=function(){return this._session},e.prototype.update=function(t){if(!t)return this;if("function"==typeof t){var n=t(this);return n instanceof e?n:this}return t instanceof e?(this._tags=h(h({},this._tags),t._tags),this._extra=h(h({},this._extra),t._extra),this._contexts=h(h({},this._contexts),t._contexts),t._user&&Object.keys(t._user).length&&(this._user=t._user),t._level&&(this._level=t._level),t._fingerprint&&(this._fingerprint=t._fingerprint),t._requestSession&&(this._requestSession=t._requestSession)):Ep(t)&&(t=t,this._tags=h(h({},this._tags),t.tags),this._extra=h(h({},this._extra),t.extra),this._contexts=h(h({},this._contexts),t.contexts),t.user&&(this._user=t.user),t.level&&(this._level=t.level),t.fingerprint&&(this._fingerprint=t.fingerprint),t.requestSession&&(this._requestSession=t.requestSession)),this},e.prototype.clear=function(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this},e.prototype.addBreadcrumb=function(e,t){var n="number"==typeof t?Math.min(t,100):100;if(n<=0)return this;var r=h({timestamp:(0,hp.yW)()},e);return this._breadcrumbs=w(this._breadcrumbs,[r]).slice(-n),this._notifyScopeListeners(),this},e.prototype.clearBreadcrumbs=function(){return this._breadcrumbs=[],this._notifyScopeListeners(),this},e.prototype.applyToEvent=function(e,t){var n;if(this._extra&&Object.keys(this._extra).length&&(e.extra=h(h({},this._extra),e.extra)),this._tags&&Object.keys(this._tags).length&&(e.tags=h(h({},this._tags),e.tags)),this._user&&Object.keys(this._user).length&&(e.user=h(h({},this._user),e.user)),this._contexts&&Object.keys(this._contexts).length&&(e.contexts=h(h({},this._contexts),e.contexts)),this._level&&(e.level=this._level),this._transactionName&&(e.transaction=this._transactionName),this._span){e.contexts=h({trace:this._span.getTraceContext()},e.contexts);var r=null===(n=this._span.transaction)||void 0===n?void 0:n.name;r&&(e.tags=h({transaction:r},e.tags))}return this._applyFingerprint(e),e.breadcrumbs=w(e.breadcrumbs||[],this._breadcrumbs),e.breadcrumbs=e.breadcrumbs.length>0?e.breadcrumbs:void 0,this._notifyEventProcessors(w(Op(),this._eventProcessors),e,t)},e.prototype._notifyEventProcessors=function(e,t,n,r){var o=this;return void 0===r&&(r=0),new xp((function(i,a){var s=e[r];if(null===t||"function"!=typeof s)i(t);else{var c=s(h({},t),n);_p(c)?c.then((function(t){return o._notifyEventProcessors(e,t,n,r+1).then(i)})).then(null,a):o._notifyEventProcessors(e,c,n,r+1).then(i).then(null,a)}}))},e.prototype._notifyScopeListeners=function(){var e=this;this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((function(t){t(e)})),this._notifyingListeners=!1)},e.prototype._applyFingerprint=function(e){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],this._fingerprint&&(e.fingerprint=e.fingerprint.concat(this._fingerprint)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint},e}();function Op(){var e=(0,dp.Rf)();return e.__SENTRY__=e.__SENTRY__||{},e.__SENTRY__.globalEventProcessors=e.__SENTRY__.globalEventProcessors||[],e.__SENTRY__.globalEventProcessors}function Cp(e){var t,n;if(Ep(e)){var r=e,o={};try{for(var i=b(Object.keys(r)),a=i.next();!a.done;a=i.next()){var s=a.value;void 0!==r[s]&&(o[s]=Cp(r[s]))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}return Array.isArray(e)?e.map(Cp):e}var Tp=function(){function e(e){this.errors=0,this.sid=(0,dp.DM)(),this.duration=0,this.status=lp.Ok,this.init=!0,this.ignoreDuration=!1;var t=(0,hp.ph)();this.timestamp=t,this.started=t,e&&this.update(e)}return e.prototype.update=function(e){if(void 0===e&&(e={}),e.user&&(!this.ipAddress&&e.user.ip_address&&(this.ipAddress=e.user.ip_address),this.did||e.did||(this.did=e.user.id||e.user.email||e.user.username)),this.timestamp=e.timestamp||(0,hp.ph)(),e.ignoreDuration&&(this.ignoreDuration=e.ignoreDuration),e.sid&&(this.sid=32===e.sid.length?e.sid:(0,dp.DM)()),void 0!==e.init&&(this.init=e.init),!this.did&&e.did&&(this.did=""+e.did),"number"==typeof e.started&&(this.started=e.started),this.ignoreDuration)this.duration=void 0;else if("number"==typeof e.duration)this.duration=e.duration;else{var t=this.timestamp-this.started;this.duration=t>=0?t:0}e.release&&(this.release=e.release),e.environment&&(this.environment=e.environment),!this.ipAddress&&e.ipAddress&&(this.ipAddress=e.ipAddress),!this.userAgent&&e.userAgent&&(this.userAgent=e.userAgent),"number"==typeof e.errors&&(this.errors=e.errors),e.status&&(this.status=e.status)},e.prototype.close=function(e){e?this.update({status:e}):this.status===lp.Ok?this.update({status:lp.Exited}):this.update()},e.prototype.toJSON=function(){return Cp({sid:""+this.sid,init:this.init,started:new Date(1e3*this.started).toISOString(),timestamp:new Date(1e3*this.timestamp).toISOString(),status:this.status,errors:this.errors,did:"number"==typeof this.did||"string"==typeof this.did?""+this.did:void 0,duration:this.duration,attrs:Cp({release:this.release,environment:this.environment,ip_address:this.ipAddress,user_agent:this.userAgent})})},e}(),kp=function(){function e(e,t,n){void 0===t&&(t=new Sp),void 0===n&&(n=4),this._version=n,this._stack=[{}],this.getStackTop().scope=t,e&&this.bindClient(e)}return e.prototype.isOlderThan=function(e){return this._version<e},e.prototype.bindClient=function(e){this.getStackTop().client=e,e&&e.setupIntegrations&&e.setupIntegrations()},e.prototype.pushScope=function(){var e=Sp.clone(this.getScope());return this.getStack().push({client:this.getClient(),scope:e}),e},e.prototype.popScope=function(){return!(this.getStack().length<=1)&&!!this.getStack().pop()},e.prototype.withScope=function(e){var t=this.pushScope();try{e(t)}finally{this.popScope()}},e.prototype.getClient=function(){return this.getStackTop().client},e.prototype.getScope=function(){return this.getStackTop().scope},e.prototype.getStack=function(){return this._stack},e.prototype.getStackTop=function(){return this._stack[this._stack.length-1]},e.prototype.captureException=function(e,t){var n=this._lastEventId=(0,dp.DM)(),r=t;if(!t){var o=void 0;try{throw new Error("Sentry syntheticException")}catch(e){o=e}r={originalException:e,syntheticException:o}}return this._invokeClient("captureException",e,h(h({},r),{event_id:n})),n},e.prototype.captureMessage=function(e,t,n){var r=this._lastEventId=(0,dp.DM)(),o=n;if(!n){var i=void 0;try{throw new Error(e)}catch(e){i=e}o={originalException:e,syntheticException:i}}return this._invokeClient("captureMessage",e,t,h(h({},o),{event_id:r})),r},e.prototype.captureEvent=function(e,t){var n=(0,dp.DM)();return"transaction"!==e.type&&(this._lastEventId=n),this._invokeClient("captureEvent",e,h(h({},t),{event_id:n})),n},e.prototype.lastEventId=function(){return this._lastEventId},e.prototype.addBreadcrumb=function(e,t){var n=this.getStackTop(),r=n.scope,o=n.client;if(r&&o){var i=o.getOptions&&o.getOptions()||{},a=i.beforeBreadcrumb,s=void 0===a?null:a,c=i.maxBreadcrumbs,l=void 0===c?100:c;if(!(l<=0)){var u=(0,hp.yW)(),f=h({timestamp:u},e),p=s?(0,dp.Cf)((function(){return s(f,t)})):f;null!==p&&r.addBreadcrumb(p,l)}}},e.prototype.setUser=function(e){var t=this.getScope();t&&t.setUser(e)},e.prototype.setTags=function(e){var t=this.getScope();t&&t.setTags(e)},e.prototype.setExtras=function(e){var t=this.getScope();t&&t.setExtras(e)},e.prototype.setTag=function(e,t){var n=this.getScope();n&&n.setTag(e,t)},e.prototype.setExtra=function(e,t){var n=this.getScope();n&&n.setExtra(e,t)},e.prototype.setContext=function(e,t){var n=this.getScope();n&&n.setContext(e,t)},e.prototype.configureScope=function(e){var t=this.getStackTop(),n=t.scope,r=t.client;n&&r&&e(n)},e.prototype.run=function(e){var t=Ap(this);try{e(this)}finally{Ap(t)}},e.prototype.getIntegration=function(e){var t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch(t){return yp.warn("Cannot retrieve integration "+e.id+" from the current Hub"),null}},e.prototype.startSpan=function(e){return this._callExtensionMethod("startSpan",e)},e.prototype.startTransaction=function(e,t){return this._callExtensionMethod("startTransaction",e,t)},e.prototype.traceHeaders=function(){return this._callExtensionMethod("traceHeaders")},e.prototype.captureSession=function(e){if(void 0===e&&(e=!1),e)return this.endSession();this._sendSessionUpdate()},e.prototype.endSession=function(){var e,t,n,r,o;null===(n=null===(t=null===(e=this.getStackTop())||void 0===e?void 0:e.scope)||void 0===t?void 0:t.getSession())||void 0===n||n.close(),this._sendSessionUpdate(),null===(o=null===(r=this.getStackTop())||void 0===r?void 0:r.scope)||void 0===o||o.setSession()},e.prototype.startSession=function(e){var t=this.getStackTop(),n=t.scope,r=t.client,o=r&&r.getOptions()||{},i=o.release,a=o.environment,s=((0,dp.Rf)().navigator||{}).userAgent,c=new Tp(h(h(h({release:i,environment:a},n&&{user:n.getUser()}),s&&{userAgent:s}),e));if(n){var l=n.getSession&&n.getSession();l&&l.status===lp.Ok&&l.update({status:lp.Exited}),this.endSession(),n.setSession(c)}return c},e.prototype._sendSessionUpdate=function(){var e=this.getStackTop(),t=e.scope,n=e.client;if(t){var r=t.getSession&&t.getSession();r&&n&&n.captureSession&&n.captureSession(r)}},e.prototype._invokeClient=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=this.getStackTop(),i=o.scope,a=o.client;a&&a[e]&&(t=a)[e].apply(t,w(n,[i]))},e.prototype._callExtensionMethod=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Np(),o=r.__SENTRY__;if(o&&o.extensions&&"function"==typeof o.extensions[e])return o.extensions[e].apply(this,t);yp.warn("Extension method "+e+" couldn't be found, doing nothing.")},e}();function Np(){var e=(0,dp.Rf)();return e.__SENTRY__=e.__SENTRY__||{extensions:{},hub:void 0},e}function Ap(e){var t=Np(),n=Rp(t);return Dp(t,e),n}function Ip(){var e=Np();return Pp(e)&&!Rp(e).isOlderThan(4)||Dp(e,new kp),(0,wp.KV)()?function(e){var t,n,r;try{var o=null===(r=null===(n=null===(t=Np().__SENTRY__)||void 0===t?void 0:t.extensions)||void 0===n?void 0:n.domain)||void 0===r?void 0:r.active;if(!o)return Rp(e);if(!Pp(o)||Rp(o).isOlderThan(4)){var i=Rp(e).getStackTop();Dp(o,new kp(i.client,Sp.clone(i.scope)))}return Rp(o)}catch(t){return Rp(e)}}(e):Rp(e)}function Pp(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function Rp(e){return e&&e.__SENTRY__&&e.__SENTRY__.hub||(e.__SENTRY__=e.__SENTRY__||{},e.__SENTRY__.hub=new kp),e.__SENTRY__.hub}function Dp(e,t){return!!e&&(e.__SENTRY__=e.__SENTRY__||{},e.__SENTRY__.hub=t,!0)}function Lp(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Ip();if(r&&r[e])return r[e].apply(r,w(t));throw new Error("No hub defined or "+e+" was not found on the hub, please open a bug report.")}function Mp(e,t){var n;try{throw new Error("Sentry syntheticException")}catch(e){n=e}return Lp("captureException",e,{captureContext:t,originalException:e,syntheticException:n})}var jp=n(76727);const Fp=(e,t)=>({selector:e,resolveView:e=>({...t,element:e})}),Bp=(e,t,n)=>((e,t)=>{const{repoName:n,commitID:r}=e;return Fr({repoName:n,revision:r,requestGraphQL:t}).pipe(Br())})(e,n).pipe(ue((()=>Ur({repoName:e.repoName,filePath:e.filePath,commitID:e.commitID,requestGraphQL:n}))),te((t=>t?{...e,content:t.join("\n")}:{...e})),de((n=>Z(t(n)).pipe(ue((t=>{if(t)return X(e);throw n}))))));function Up(){return function(e){const t=function(e){if(void 0!==e.line)return{start:{line:e.line,character:e.character||0},end:{line:e.endLine||e.line,character:e.endCharacter||e.character||0}}}(e);if(void 0===t)return[];const n={line:t.start.line-1,character:Kt(t.start.character)},r={line:t.end.line-1,character:Kt(t.end.character)};return[{start:n,end:r,anchor:n,active:r,isReversed:!1}]}(xr(window.location.hash))}function qp(){return To(window,"hashchange").pipe(te(Up),Ro(((e,t)=>zo()(e,t))))}function Vp(e){const t=e.title.split(" \u2192 ");return t.length>1?{headFilePath:t[1],baseFilePath:t[0]}:{headFilePath:t[0],baseFilePath:t[0]}}function $p(e){const{pageType:t}=Wp();if(!Qp(t))return null;let n="",r="";if("pull"===t){var o;const t=null===(o=document.querySelector("details-menu[src*='sha1='][src*='sha2=']"))||void 0===o?void 0:o.getAttribute("src"),i=e.classList.contains("js-comment-container");if(t){const e=new URLSearchParams(t),n=e.get("sha1"),r=e.get("sha2");if(n&&r)return{baseCommitID:n,headCommitID:r}}else if(i){const t=function(e){const t=e.querySelector(`summary a[href^="${location.pathname}"`);if(!t)return null;const n=t.href.match(zp);if(!n)return null;const r=n[3],o=Hp(document.documentElement.innerHTML,!0);return r&&o?{...o,headCommitID:r}:null}(e);if(t)return t}else{const e=document.querySelector('input[name="comparison_start_oid"]');e&&(n=e.value);const t=document.querySelector('input[name="comparison_end_oid"]');t&&(r=t.value)}}else if("commit"===t){const e=document.querySelectorAll(".sha-block:not(.patch-diff-links)");if(e&&2===e.length){const t=e[0].querySelector("a");t&&(n=t.href.split("/").slice(-1)[0]);const o=e[1].querySelector("span.sha");o&&(r=o.innerHTML)}}else if("compare"===t){const e=function(){const[e,t]=document.querySelectorAll(".commitish-suggester .select-menu-button span");if(e&&t&&e.textContent&&t.textContent)return{baseCommitID:e.textContent,headCommitID:t.textContent};return}();if(e)return e}return""===n||""===r?Hp(document.documentElement.innerHTML,"pull"===t):{baseCommitID:n,headCommitID:r}}const zp=/\/files\/((\w+)\.\.)?(\w+)#diff-\w+$/;function Hp(e,t){if(!t)return null;const n="\x3c!-- base sha1: "",r=e.indexOf(n);if(-1===r)return null;const o="\x3c!-- head sha1: "",i=e.indexOf(o,r);if(-1===i)return null;return{baseCommitID:e.slice(r+n.length,40),headCommitID:e.slice(i+o.length,40)}}function Gp(){const e=document.querySelector("a.js-permalink-shortcut");if(!e)throw new Error("Unable to determine the file path because no a.js-permalink-shortcut element was found.");const t=new URL(e.href),[,,,n,,...r]=t.pathname.split("/");if("tree"!==n&&0===r.length)throw new Error(`Unable to determine the file path because the a.js-permalink-shortcut element's href's path was ${t.pathname} (it is expected to be of the form /<user>/<repo>/blob/<commitID>/<path/to/file>).`);return decodeURIComponent(r.join("/"))}function Qp(e){switch(e){case"commit":case"pull":case"compare":return!0;default:return!1}}function Wp(e=window.location){const{host:t,pathname:n}=e,[r,o,i,...a]=n.slice(1).split("/");if(!r||!o)throw new Dr(`Could not parse repoName from GitHub url: ${e.href}`);const s=`${r}/${o}`,c=`${t}/${s}`;switch(i){case"blob":case"tree":return{pageType:i,rawRepoName:c,revisionAndFilePath:decodeURIComponent(a.join("/")),repoName:s};case"pull":case"commit":case"compare":return{pageType:i,rawRepoName:c,repoName:s};default:return{pageType:"other",rawRepoName:c,repoName:s}}}const Kp=e=>{let t=e.closest("td").previousElementSibling;for(;t;){if(t.dataset.lineNumber)return parseInt(t.dataset.lineNumber,10);t=t.previousElementSibling}throw new Error("Could not find a line number in any cell")},Zp=e=>{var t;const n=e.closest("td.blob-code");return!n||null!==(t=n.parentElement)&&void 0!==t&&t.classList.contains("js-expandable-line")?null:n},Yp=(e,t,n)=>{const r=od(e),o=((e,t)=>"base"===e?0:t?2:1)(n,r)+1,i=e.querySelector(`td:nth-child(${o})[data-line-number="${t}"]`);if(!i)return null;if(!r&&"base"===n&&!i.classList.contains("blob-num-addition")&&!i.classList.contains("blob-num-deletion"))return null;let a;if(r)a=i.nextElementSibling;else{a=i.parentElement.lastElementChild}return a},Jp=e=>e.classList.contains("blob-code-inner")?e:e.querySelector(".blob-code-inner"),Xp={getCodeElementFromTarget:e=>{const t=Zp(e);return t&&Jp(t)},getLineElementFromLineNumber:Yp,getCodeElementFromLineNumber:(e,t,n)=>{const r=Yp(e,t,n);return r&&Jp(r)},getLineNumberFromCodeElement:Kp,getDiffCodePart:e=>{const t=e.closest("td");return t.classList.contains("blob-code-addition")?"head":t.classList.contains("blob-code-deletion")||od(e)&&t.nextElementSibling?"base":"head"},isFirstCharacterDiffIndicator:e=>{const t=e.closest(".blob-code-inner"),n=t&&["deletion","context","addition"].some((e=>t.classList.contains("blob-code-marker-"+e))),r=e.closest("tr"),o=null==r?void 0:r.querySelector("td[data-code-marker]"),i=null==t?void 0:t.hasAttribute("data-code-marker"),a=o||i,s=e.closest(".refined-github-diff-signs");return!n&&!a&&!s}},ed=(e,t)=>{const n=e.querySelector(`td[data-line-number="${t}"]`);return n&&n.nextElementSibling},td={getCodeElementFromTarget:Zp,getCodeElementFromLineNumber:ed,getLineElementFromLineNumber:ed,getLineNumberFromCodeElement:Kp},nd=(e,t)=>{const n=((e,t)=>{const n=e.querySelectorAll("td.blob-num");let r=null;for(const e of n)if(e.querySelector("a").href.endsWith(`#L${t}`)){r=e;break}return r})(e,t);return n&&n.nextElementSibling},rd={getCodeElementFromTarget:Zp,getCodeElementFromLineNumber:nd,getLineElementFromLineNumber:nd,getLineNumberFromCodeElement:e=>{const t=e.closest("td").previousElementSibling;return parseInt(t.firstElementChild.textContent,10)}};function od(e){const{pageType:t}=Wp();if(!Qp(t))return!1;const n=e.classList.contains("file")?e:e.closest(".file");if(!n)throw new Error("Could not resolve code view element");if(n.classList.contains("js-comment-container"))return!1;const r=n.querySelector("table");if(!r)throw new Error("Could not find code view table");return r.classList.contains("js-file-diff-split")||r.classList.contains("file-diff-split")}const id=()=>{const e=Wp();if("blob"!==e.pageType&&"tree"!==e.pageType)throw new Error(`Current URL does not match a blob or tree url: ${window.location.href}`);const{revisionAndFilePath:t,rawRepoName:n}=e,r=Gp(),o=r&&!r.startsWith("/")?`/${r}`:r,i=o?t.slice(0,-o.length):t;if(!t.endsWith(o))throw new Error(`The file path ${o} should always be a suffix of revAndFilePath ${t}, but isn't in this case.`);return{blob:{rawRepoName:n,filePath:r,revision:i,commitID:mo({selector:".js-permalink-shortcut",hrefRegex:/^\/.*?\/.*?\/(?:blob|tree)\/([\da-f]{40})/})}}},ad=/\/([\da-f]{40})$/i,sd=e=>{const t=e.querySelector("a.commit-tease-sha");if(!t)throw new Error("Could not find commit link in snippet code view");const n=t.href.match(ad);if(null==n||!n[1])throw new Error(`Could not parse commitID from snippet commit link href: ${t.href}`);const r=n[1],o=e.querySelectorAll("a:not(.commit-tease-sha)"),i=new URL(o[0].href),a=Wp(i);if("blob"!==a.pageType)throw new Error(`Snippet URL does not match a blob url: ${i.href}`);const{revisionAndFilePath:s,rawRepoName:c}=a;if(!s.startsWith(r))throw new Error(`Could not parse filePath: revAndFilePath ${s} does not start with commitID ${r}`);return{blob:{rawRepoName:c,filePath:s.slice(r.length+1),commitID:r,revision:r}}},cd=["tooltipped","tooltipped-n"];const ld="codeHost-module__command-palette-action-item_16BFG",ud="codeHost-module__action-item_7QWb2",fd="codeHost-module__icon_3PdA7",pd="codeHost-module__code-view-toolbar_gOzAp",dd="codeHost-module__code-view-toolbar-item_2fTzz",hd="codeHost-module__hover-overlay-badge_3wpZt";function md(e){const t="github-file-actions-toolbar-mount",n=e.querySelector("."+t);if(n)return n;const r=document.createElement("div");r.className=t;const o=e.querySelector(".file-actions");if(!o)throw new Error("Could not find GitHub file actions with selector .file-actions");o.classList.add("sg-github-file-actions");const i=e.querySelector(".show-file-notes");return i?i.after(r):o.prepend(r),r}const gd={dom:Xp,getToolbarMount:md,resolveFileInfo:e=>{const{rawRepoName:t}=Wp(),{headFilePath:n,baseFilePath:r}=function(e){const t=e.querySelector(".file-info");if(t){if("A"===t.tagName)return Vp(t);const e=t.querySelector(".diffstat + a");if(e)return Vp(e)}const n=e.querySelector(".file-header a");if(n)return Vp(n);throw new Error("Could not determine diff file name")}(e);if(!n)throw new Error("cannot determine file path");const o=$p(e);if(!o)throw new Error("cannot determine delta info");const{headCommitID:i,baseCommitID:a}=o;return{head:{rawRepoName:t,filePath:n,commitID:i,revision:i},base:{rawRepoName:t,filePath:r||n,commitID:a,revision:a}}},getScrollBoundaries:e=>{const t=e.querySelector(".file-header");if(!t)throw new Error("Could not find .file-header element in GitHub PR code view");return[t]}},vd={...gd,getToolbarMount:void 0},bd={dom:td,getToolbarMount:md,resolveFileInfo:id,getSelections:Up,observeSelections:qp},yd=e=>({direction:t,codeView:n,position:r})=>Ur({...r,requestGraphQL:e}).pipe(te((e=>{const o=td.getCodeElementFromLineNumber(n,r.line,r.part);if(!o)throw new Error("(adjustPosition) could not find code element for line provided");const i=e[r.line-1],a=o.textContent||"",s=i.length-pp()(i).length,c=a.length-pp()(a).length,l=t===qi.ActualToCodeView?-1:1,u=Math.abs(s-c)*l;return{line:r.line,character:r.character+u}}))),wd=Fp(".code-list-item",{dom:rd,getPositionAdjuster:yd,resolveFileInfo:sd}),Ed={dom:td,resolveFileInfo:sd,getPositionAdjuster:yd},_d=e=>{const t="sourcegraph-github-file-code-view-toolbar-mount",n=e.querySelector(`.${t}`);if(n)return n;const r=document.createElement("div");r.style.display="inline-flex",r.style.verticalAlign="middle",r.style.alignItems="center",r.className=t;const o=e.querySelector("#raw-url"),i=null==o?void 0:o.closest(".BtnGroup");if(null==i||!i.parentNode)throw new Error("File actions not found");return i.parentNode.insertBefore(r,i),r},xd={selector:".js-file-line-container",resolveView:e=>{const t=e.closest(".blob-wrapper-embedded");if(t){return{element:t.parentElement,...Ed}}const{pageType:n}=Wp();if("blob"!==n)return null;const r=e.closest(".repository-content");if(!r)throw new Error("Could not find repository content element");return{element:r,...bd,getToolbarMount:_d}}},Sd={selector:e=>{const t=new Set;for(const n of vo(e,".file"))0===n.querySelectorAll(".js-diff-load-container").length&&t.add(n);for(const n of vo(e,".js-blob-wrapper")){const e=n.closest(".file");e instanceof HTMLElement&&t.add(e)}return[...t]},resolveView:e=>{if(e.querySelector("article.markdown-body"))return null;if(e.closest(".js-suggested-changes-blob"))return null;const{pageType:t}=Wp();return"blob"===t&&1===document.querySelectorAll(".file").length&&0===document.querySelectorAll(".diff-view").length?{element:e,...bd}:e.closest(".discussion-item-body")||e.classList.contains("js-comment-container")?{element:e,...vd}:{element:e,...gd}}};function Od(){const e=document.head.querySelector('meta[property="og:site_name"]');return!!e&&("GitHub Enterprise"===e.content||"GitHub"===e.content)&&document.body.classList.contains("enterprise")}const Cd="open-on-sourcegraph",Td=i()(fd,"v-align-text-bottom"),kd={[Us]:"flash",[qs]:"flash flash-success",[Bs]:"flash",[Fs]:"flash flash-warn",[js]:"flash flash-error"},Nd={searchViewResolver:{selector:'.js-site-search-form input[type="text"][aria-controls="jump-to-results"]',resolveView:e=>({element:e})},resultViewResolver:{selector:"#jump-to-suggestion-search-global",resolveView:e=>({element:e})},onChange:({value:e,searchURL:t,resultElement:n})=>{var r;const o="#jump-to-sourcegraph-search-global";(n=>{const r=n.querySelector(".jump-to-suggestion-name");r.textContent=e,r.setAttribute("aria-label",e);const o=n.querySelector("a"),i=new URL(t);i.searchParams.append("q",e),o.setAttribute("href",i.href),o.setAttribute("target","_blank"),n.setAttribute("style","display: "+(e?"initial":"none !important"))})(null!==(r=document.querySelector(o))&&void 0!==r?r:(()=>{var e,t;const r=n.cloneNode(!0);r.id=o.replace("#",""),r.classList.remove("navigation-focus"),r.setAttribute("aria-selected","false");const i=document.createElement("img");i.src=jp,i.setAttribute("style","width: 16px; height: 20px; float: left; margin-right: 2px;"),i.setAttribute("alt","Sourcegraph Logo Image");const a=r.querySelector(".js-jump-to-badge-search-text-global");return a.textContent="Sourcegraph",null===(e=a.parentNode)||void 0===e||e.insertBefore(i,a),null===(t=n.parentNode)||void 0===t||t.insertBefore(r,n.nextElementSibling),r})())}},Ad=(e,t=El.fetchCache,n="#repository-container-header h1 span.Label")=>"github.com"!==window.location.hostname?Promise.resolve(!0):t({url:`https://api.github.com/repos/${e}`,credentials:"omit",cacheMaxAge:36e5}).then((e=>{const t=e.headers["x-ratelimit-remaining"];if(Number(t)<=0){const e=new Error("Github rate limit exceeded.");throw Mp(e),e}return e})).then((({data:e})=>"boolean"!=typeof e.private||e.private)).catch((e=>{var t,r;return console.warn("Failed to fetch if the repository is private.",e),"public"!==(null===(t=document.querySelector(n))||void 0===t||null===(r=t.textContent)||void 0===r?void 0:r.toLowerCase().trim())})),Id=()=>"/search"===window.location.pathname,Pd=()=>"/search/advanced"===window.location.pathname,Rd=()=>!Id()&&window.location.pathname.endsWith("/search"),Dd=()=>Boolean(new URLSearchParams(window.location.search).get("q"))&&!Pd(),Ld=()=>{const e=new URLSearchParams(window.location.search).get("type");return e?e.toLowerCase():""},Md=e=>{const t=e.filter(Boolean).map((e=>e.trim())),n=(()=>{switch(Ld()){case"repositories":return"repo";case"commits":return"commit";case"code":return"";default:return Id()||Pd()?"repo":""}})(),r=new URLSearchParams(window.location.search).get("l");if(n&&t.push(`type:${n}`),r&&t.push(`lang:${encodeURIComponent(r)}`),Rd()){const[e,n]=window.location.pathname.split("/").filter(Boolean);t.push(`repo:${e}/${n}$`)}for(const e of["org","user"]){const n=t.findIndex((t=>t.startsWith(`${e}:`)));if(n>=0){const r=t[n].replace(`${e}:`,"");r&&(t[n]=`repo:${r}/*`)}}return t.join("+")},jd=(e,t="")=>{let n=document.querySelector(`#${e}`);return n||(n=document.createElement("div"),n.setAttribute("id",e),n.classList.add(...t.split(/\s/gi)),n)};const Fd={type:"github",name:Od()?"GitHub Enterprise":"GitHub",searchEnhancement:Nd,enhanceSearchPage:function(e){if(!(Id()||Pd()||Rd()||Dd()))return;const n=({container:n,className:r="",getSearchQuery:o,utmCampaign:a})=>{const s=yl(new URL("/search",e),{utm_source:kt(),utm_campaign:a});(0,yo.render)(t.createElement(Dl,{label:"Search on Sourcegraph",title:"Search on Sourcegraph to get hover tooltips, go to definition and more",ariaLabel:"Search on Sourcegraph to get hover tooltips, go to definition and more",className:i()("btn","m-auto",r),iconClassName:i()("mr-1","v-align-middle",fd),href:s.href,dataTestId:"search-on-sourcegraph",onClick:e=>{const t=Md(o());e.target.href=`${s.href}${t?`&q=${t}`:""}`}}),n)};if(Dd()){const e=Ld();if(["repositories","commits","code"].includes(e)||""===e&&(Id()||Rd())){var r,o;const e=document.querySelector(".application-main form.js-site-search-form"),t=null==e?void 0:e.querySelector("input.form-control[name='q']"),i=null==e||null===(r=e.parentElement)||void 0===r||null===(o=r.parentElement)||void 0===o?void 0:o.querySelector("button[type='submit']");if(t&&i){const e=jd("pageSearchFormSourcegraphButton","ml-2 d-none d-md-block");i.after(e),n({container:e,utmCampaign:"github-search-results-page",getSearchQuery:()=>t.value.split(" ")})}const a=document.querySelector("header form.js-site-search-form input.form-control[name='q']"),s=document.querySelector(".codesearch-results"),c=null==s?void 0:s.querySelector(".blankslate"),l=null==s?void 0:s.querySelector("div > div > h3");if(a&&(c||l)){const e=jd("headerSearchInputSourcegraphButton","ml-auto d-none d-lg-block");c?(e.classList.add("mt-2"),c.append(e)):l&&(e.classList.add("mr-2"),l.after(e)),n({container:e,className:c?"":"btn-sm",utmCampaign:"github-search-results-page",getSearchQuery:()=>a.value.split(" ")})}}return}const a=document.querySelector("#search_form"),s=null==a?void 0:a.querySelector(".search-form-fluid"),c=null==a?void 0:a.querySelector("input");if(s&&c){const e=jd("searchInputSourcegraphButton","ml-0 ml-md-2 mt-2 mt-md-0");null==s||s.append(e),n({container:e,utmCampaign:`github-${Pd()?"advanced":"simple"}-search-page`,getSearchQuery:()=>c.value.split(" ")})}},codeViewResolvers:[Sd,xd,wd],contentViewResolvers:[{selector:".markdown-body",resolveView:e=>({element:e})}],nativeTooltipResolvers:[{selector:".js-tagsearch-popover",resolveView:e=>({element:e})}],routeChange:e=>e.pipe(te((()=>{const{pathname:e}=window.location,t=e.slice(1).split("/")[2];return"blob"===t||"tree"===t?e.endsWith(Gp())?e:void 0:Dd()?null===(n=document.querySelector(".codesearch-results h3"))||void 0===n||null===(r=n.textContent)||void 0===r?void 0:r.trim():e;var n,r})),_t(Boolean),Ro()),getContext:async()=>{const{repoName:e,rawRepoName:t,pageType:n}=Wp();return{rawRepoName:t,revision:"blob"===n||"tree"===n?id().blob.revision:void 0,privateRepository:await Ad(e)}},isLightTheme:Vf((()=>{const e=document.documentElement.dataset.colorMode;return"auto"===e?((e=window)=>{const t=e.matchMedia("(prefers-color-scheme: dark)");return{observable:Et(X(!t.matches),To(t,"change").pipe(te((e=>!e.matches)))),initialValue:!t.matches}})().observable:X("dark"!==e)})),getViewContextOnSourcegraphMount:e=>{const t=bo(e,".pagehead-actions");if(!t||0===t.children.length)return null;let n=t.querySelector("#open-on-sourcegraph");return n||(n=document.createElement("li"),n.id=Cd,t.prepend(n),n)},viewOnSourcegraphButtonClassProps:{className:"btn btn-sm tooltipped tooltipped-s",iconClassName:Td},check:()=>((e=window.location.href)=>/^https?:\/\/(www\.)?github\.com/.test(e))()||Od(),getCommandPaletteMount:e=>{const t="command-palette-button",n=e.querySelector(`.Header .${t}`)||e.querySelector(`.Header-old .${t}`);if(n)return n;const r=bo(e,".HeaderMenu > :last-child");if(r){const e=document.createElement("div");return e.classList.add(t),r.prepend(e),e}let o=bo(e,".Header-item:nth-last-child(2)");if(o){0!==o.previousElementSibling.children.length&&(o=o.previousElementSibling);const e=document.createElement("div");return e.classList.add("Header-item","mr-0","mr-lg-3",t),o.before(e),e}return null},notificationClassNames:kd,commandPaletteClassProps:{buttonClassName:"Header-link d-flex flex-items-baseline",popoverClassName:"Box",formClassName:"p-1",inputClassName:"form-control input-sm header-search-input jump-to-field",listClassName:"p-0 m-0 js-navigation-container jump-to-suggestions-results-container",selectedListItemClassName:"navigation-focus",listItemClassName:"d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-scoped-search",actionItemClassName:i()(ld,"no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path p-2"),noResultsClassName:"d-flex flex-auto flex-items-center jump-to-suggestions-path p-2",iconClassName:Td},codeViewToolbarClassProps:{className:pd,listItemClass:i()(dd,"BtnGroup"),actionItemClass:i()("btn btn-sm tooltipped tooltipped-s BtnGroup-item",ud),actionItemPressedClass:"selected",actionItemIconClass:i()(fd,"v-align-text-bottom")},hoverOverlayClassProps:{className:"Box",actionItemClassName:"btn btn-sm btn-secondary",actionItemPressedClassName:"active",badgeClassName:i()("label",hd),getAlertClassName:qu(kd,"flash-full"),iconClassName:Td},setElementTooltip:function(e,t){"string"==typeof t?(e.classList.add(...cd),e.setAttribute("aria-label",t)):(e.classList.remove(...cd),e.removeAttribute("aria-label"))},linkPreviewContentClass:"text-small text-gray p-1 mx-1 border rounded-1 bg-gray text-gray-dark",urlToFile:(e,t,n)=>{if(t.viewState)return Nr(e,t);if(!t.rawRepoName.startsWith(window.location.hostname))return Nr(e,t);const r=t.revision||"HEAD",{rawRepoName:o}=Wp();if(o===t.rawRepoName&&void 0!==n.part){const e=document.querySelectorAll(".file");for(const r of e){const e=r.querySelector(".file-header[data-path][data-anchor]");if(!e)continue;if(e.dataset.path===t.filePath){const r=e.dataset.anchor,o=new URL(window.location.href);if(o.hash=r,t.position&&(o.hash+=`${"base"===n.part?"L":"R"}${t.position.line}`),!document.querySelector(o.hash))break;return o.href}}}const i=t.position?`#L${t.position.line}${t.position.character?`:${t.position.character}`:""}`:"";return`https://${t.rawRepoName}/blob/${r}/${t.filePath}${i}`},codeViewsRequireTokenization:!0},Bd=(e,t,n)=>e.querySelector(`#LC${t}`),Ud={getCodeElementFromTarget:e=>e.closest("span.line"),getLineNumberFromCodeElement:e=>{const t=e.id.replace(/^LC/,"");return parseInt(t,10)},getCodeElementFromLineNumber:Bd,getLineElementFromLineNumber:Bd},qd=e=>{const t=e.closest("[data-interop-type]");return t?"old"===t.dataset.interopType?"base":"head":(e=>{let t="old";const n=e.closest(".diff-td,td");return n.classList.contains("parallel")&&(t="left-side"),n.classList.contains(t)?"base":"head"})(e)},Vd=(e,t,n)=>{const r="base"===n?"old":"new",o=e.querySelector(`[data-interop-${r}-line="${t}"]`);return o?o.querySelector("span.line"):((e,t,n)=>{const r=e.querySelector(`.${"base"===n?"old_line":"new_line"} [data-linenumber="${t}"]`);if(!r)return null;const o=r.closest(".diff-tr,tr");if(!o)return null;let i="span.line";return o.classList.contains("parallel")&&(i=`.${"base"===n?"left-side":"right-side"} ${i}`),o.querySelector(i)})(e,t,n)},$d={getCodeElementFromTarget:Ud.getCodeElementFromTarget,getLineNumberFromCodeElement:e=>{const t=e.closest("[data-interop-line]");return t?parseInt(t.dataset.interopLine||"",10):(e=>{const t=qd(e);let n=e.closest(".diff-td,td");for(;n&&(!n.matches(".diff-line-num."+("base"===t?"old_line":"new_line"))||!n.querySelector("a"))&&n.previousElementSibling;)n=n.previousElementSibling;if(n){const e=n.querySelector("a");return parseInt(e.dataset.linenumber||"",10)}throw new Error("Unable to determine line number for diff code element")})(e)},getCodeElementFromLineNumber:Vd,getLineElementFromLineNumber:(e,t,n)=>{const r=Vd(e,t,n);return r&&r.parentElement},getDiffCodePart:qd},zd=(e,t,n)=>`${window.location.origin}/api/v4/projects/${encodeURIComponent(e)}%2f${t}${n}`,Hd=e=>ee(e,{selector:e=>tt(e).json()}),Gd=Ze((e=>Hd(`${window.location.origin}/api/v4/projects/${e}`).pipe(te((({web_url:e})=>{const{hostname:t,pathname:n}=new URL(e);return`${t}${n}`})))),_s()),Qd=Ze((({owner:e,projectName:t,mergeRequestID:n,diffID:r})=>r?Hd(zd(e,t,`/merge_requests/${n}/versions/${r}`)).pipe(te((({base_commit_sha:e})=>e))):X(void 0)),(({owner:e,projectName:t,mergeRequestID:n,diffID:r})=>`${e}:${t}:${n}:${String(r)}`)),Wd=Ze((({owner:e,projectName:t,mergeRequestID:n,rawRepoName:r,diffID:o})=>Ml(Hd(zd(e,t,`/merge_requests/${n}`)),Qd({owner:e,projectName:t,mergeRequestID:n,diffID:o})).pipe(ue((([{diff_refs:e,source_project_id:t},n])=>Gd(t).pipe(te((t=>({baseCommitID:n||e.base_sha,commitID:e.head_sha,rawRepoName:r,baseRawRepoName:t})))))))),(({owner:e,projectName:t,mergeRequestID:n,rawRepoName:r,diffID:o})=>`${e}:${t}:${n}:${r}:${String(o)}`)),Kd=Ze((({owner:e,projectName:t,commitID:n})=>Hd(zd(e,t,`/repository/commits/${n}`)).pipe(te((({parent_ids:e})=>Zu()(e))))),(({owner:e,projectName:t,commitID:n})=>`${e}:${t}:${n}`));var Zd=n(68642),Yd=n.n(Zd),Jd=n(90006),Xd=n.n(Jd);let eh;!function(e){e[e.File=0]="File",e[e.Commit=1]="Commit",e[e.MergeRequest=2]="MergeRequest",e[e.Other=3]="Other"}(eh||(eh={}));function th(){const e=document.querySelector(".context-header a");if(!e)throw new Error("Unable to determine project name");const t=new URL(e.href).pathname.slice(1),n=t.split("/"),r=Yd()(n,n.length-1).join("/"),o=Xd()(n),i=((e,t,n)=>{const r=n.match(new RegExp(`^/${e}/${t}(/-)?/(commit|merge_requests|blob)/`));if(!r)return eh.Other;switch(r[2]){case"commit":return eh.Commit;case"merge_requests":return eh.MergeRequest;case"blob":return eh.File;default:return eh.Other}})(r,o,window.location.pathname);return{owner:r,projectName:o,rawRepoName:[jt?window.location.hostname:new URL(gon.gitlab_url).hostname,r,o].join("/"),repoName:t,pageKind:i}}const nh=()=>{let e=window.location.pathname.match(/merge_requests\/(.*?)\/diffs/);if(!e&&document.querySelector(".diffs-tab.active")&&(e=window.location.pathname.match(/merge_requests\/(.*?)((\/)|$)/)),!e)throw new Error("Unable to determine merge request ID");return e[1]},rh=e=>{const t=e.dataset.originalTitle||e.dataset.title||e.title;if(!t)throw new Error("Unable to get file paths from code view: no file title");return t.endsWith(" deleted")?t.slice(0,-8):t};function oh(e){const t=e.querySelectorAll(".file-title-name");if(0===t.length)throw new Error("Unable to get file paths from code view: no .file-title.name");const n=t.length>1,r=rh(t.item(n?1:0));return{headFilePath:r,baseFilePath:n?rh(t.item(0)):r}}function ih(){const{rawRepoName:e,owner:t,projectName:n}=th();return{rawRepoName:e,owner:t,projectName:n,commitID:Xd()(window.location.pathname.split("/"))}}const ah="codeHost-module__command-list-popover_hwImg",sh="codeHost-module__hover-overlay_3Cize";const ch=(e,t)=>{const n=e.querySelector(".sg-toolbar-mount-gitlab");if(n)return n;const r=e.querySelector(".file-actions");if(!r)throw new Error("Unable to find mount location");const o=document.createElement("div");return o.classList.add("sg-toolbar-mount","sg-toolbar-mount-gitlab"),t===eh.Commit&&o.classList.add("gl-mr-3"),r.prepend(o),o},lh={dom:Ud,getToolbarMount:e=>ch(e,eh.File),resolveFileInfo:()=>{const{rawRepoName:e,filePath:t,revision:n}=function(){const{rawRepoName:e}=th(),t=window.location.pathname.match(/\/blob\/(.*?)\/(.*)/);if(!t)throw new Error("Unable to determine revision or file path");const n=decodeURIComponent(t[1]);return{rawRepoName:e,filePath:decodeURIComponent(t[2]),revision:n}}();if(!t)throw new Error(`Unable to determine the file path of the current file because the current URL (window.location ${window.location.href}) does not have a file path.`);return{blob:{rawRepoName:e,filePath:t,commitID:mo({selector:".js-data-file-blob-permalink-url",hrefRegex:new RegExp("^/.*?/.*?/blob/([0-9a-f]{40})/")}),revision:n}}},getSelections:Up,observeSelections:qp},uh=e=>{const t=e.querySelector(".js-file-title");if(!t)throw new Error("Could not find .file-title element");return[t]},fh={dom:$d,getToolbarMount:e=>ch(e,eh.MergeRequest),resolveFileInfo:e=>{return Z(Wd({...th(),mergeRequestID:nh(),diffID:null!==(t=new URLSearchParams(window.location.search).get("diff_id"))&&void 0!==t?t:void 0})).pipe(te((t=>{const{rawRepoName:n,baseRawRepoName:r,commitID:o,baseCommitID:i}=t,{headFilePath:a,baseFilePath:s}=oh(e);return{head:{rawRepoName:n,filePath:a,commitID:o},base:{rawRepoName:r,filePath:s,commitID:i}}})));var t},getScrollBoundaries:uh},ph={dom:$d,getToolbarMount:e=>ch(e,eh.Commit),resolveFileInfo:e=>Xi(ih).pipe(ue((({owner:e,projectName:t,commitID:n,rawRepoName:r})=>Kd({owner:e,projectName:t,commitID:n}).pipe(te((e=>({commitID:n,baseCommitID:e,rawRepoName:r})))))),te((({commitID:t,baseCommitID:n,rawRepoName:r})=>{const{headFilePath:o,baseFilePath:i}=oh(e);return{head:{rawRepoName:r,filePath:o,commitID:t},base:{rawRepoName:r,filePath:i,commitID:n}}}))),getScrollBoundaries:uh},dh={selector:".file-holder",resolveView:e=>{if(e.classList.contains("discussion-wrapper"))return null;const{pageKind:t}=th();return t===eh.Other?null:t===eh.File?{element:e,...lh}:t===eh.MergeRequest?e.querySelector(".file-actions")?{element:e,...fh}:null:{element:e,...ph}}},hh={[Us]:"alert alert-secondary",[qs]:"alert alert-success",[Bs]:"alert alert-info",[Fs]:"alert alert-warning",[js]:"alert alert-danger"},mh=(e,t=El.fetchCache)=>"gitlab.com"===window.location.hostname&&e?t({url:`https://gitlab.com/api/v4/projects/${encodeURIComponent(e)}`,credentials:"omit",cacheMaxAge:36e5}).then((e=>{const t=e.headers["ratelimit-remaining"];if(Number(t)<=0){const e=new Error("Gitlab rate limit exceeded.");throw Mp(e),e}return e})).then((({status:e})=>200!==e)).catch((e=>(console.warn("Failed to fetch repository visibility info.",e),!0))):Promise.resolve(!0),gh={type:"gitlab",name:"GitLab",check:function(){return!!document.head.querySelector('meta[content="GitLab"]')},codeViewResolvers:[dh],adjustOverlayPosition:({top:e,left:t})=>{const n=document.querySelector("header");n&&(e+=n.getBoundingClientRect().height);const r=document.querySelector("#js-peek.development");return r&&(e+=r.getBoundingClientRect().height),{top:e,left:t}},getCommandPaletteMount:e=>{const t=bo(e,".navbar-collapse");if(!t)return null;const n="command-palette-button";return t.querySelector("."+n)||(()=>{const e=document.createElement("div");return e.className=n,t.prepend(e),e})()},getContext:async()=>{const{repoName:e,...t}=th();return{...t,privateRepository:await mh(e)}},urlToFile:(e,t,n)=>{if(t.viewState||!t.rawRepoName.startsWith(window.location.hostname))return Nr(e,t);if(th().rawRepoName===t.rawRepoName&&void 0!==n.part){const e=zf(document.body,dh.selector);for(const r of e){const{headFilePath:e,baseFilePath:o}=oh(r);if(e!==t.filePath&&o!==t.filePath)continue;if(!t.position){const e=new URL(window.location.href);return e.hash=r.id,e.href}const i=null!==n.part?{head:".new_line",base:".old_line"}[n.part]:"",a=r.querySelector(`${i} a[data-linenumber="${t.position.line}"]`);if(!a)break;return new URL(a.href).href}}const r=new URL(`https://${t.rawRepoName}/blob/${t.revision}/${t.filePath}`);if(t.position){const{line:e}=t.position;r.hash=`#L${e}`}return r.href},notificationClassNames:hh,commandPaletteClassProps:{popoverClassName:i()("dropdown-menu",ah),formClassName:"dropdown-input",inputClassName:"dropdown-input-field",resultsContainerClassName:"dropdown-content",selectedActionItemClassName:"is-focused",noResultsClassName:"px-3",iconClassName:"s16 align-bottom"},codeViewToolbarClassProps:{className:"pl-0",actionItemClass:"btn btn-md gl-button btn-icon",actionItemPressedClass:"active",actionItemIconClass:"gl-button-icon gl-icon s16"},hoverOverlayClassProps:{className:i()("card",sh),actionItemClassName:"btn btn-secondary",actionItemPressedClassName:"active",iconClassName:"square s16",getAlertClassName:qu(hh)},codeViewsRequireTokenization:!0,getHoverOverlayMountLocation:()=>{const{pageKind:e}=th();return e===eh.MergeRequest?"div.tab-pane.diffs":null}},vh=e=>Boolean("TH"===e.tagName&&e.textContent||e.dataset.n),bh=e=>parseInt(("TH"===e.tagName?e.textContent:e.dataset.n)||"",10),yh=e=>{let t=e;for(;t;){if(vh(t))return t;t=t.previousElementSibling}return null},wh=(e,t,n)=>{let r=((e,t,n)=>{const r=e.querySelector("td[data-n]")?"td[data-n]":`th:nth-of-type(${"base"===n?1:2})`;for(const o of e.querySelectorAll(r))if(bh(o)===t){if("head"===n&&null===o.previousElementSibling)continue;return o}return null})(e,t,n);for(;r&&("TD"!==r.tagName||r.classList.contains("n")||vh(r)||r.classList.contains("copy"));)r=r.nextElementSibling;return r},Eh={getCodeElementFromTarget:e=>{if("TH"===e.tagName||e.classList.contains("copy"))return null;const t=e.closest("td");return t?t.classList.contains("show-more")||t.classList.contains("show-context")?null:yh(t)?t:null:null},getCodeElementFromLineNumber:wh,getLineElementFromLineNumber:wh,getLineNumberFromCodeElement:e=>{const t=yh(e);if(!t)throw new Error("Could not find line number cell from code element");return bh(t)},getDiffCodePart:e=>{if(e.classList.contains("old"))return"base";if(e.classList.contains("new"))return"head";const t=yh(e);if(!t)throw new Error("Could not find line number cell from code element");return t.classList.contains("left")?"base":t.classList.contains("right")||t.previousElementSibling?"head":"base"},isFirstCharacterDiffIndicator:e=>{const t=e.firstElementChild;return!(null==t||!t.classList.contains("aural-only"))}},_h=(e,t,n)=>{const r=e.querySelector(`tr:nth-of-type(${t})`);if(!r)throw new Error(`unable to find row ${t} from code view`);return r.querySelector("td")},xh={getCodeElementFromTarget:e=>e.closest("td"),getCodeElementFromLineNumber:_h,getLineElementFromLineNumber:_h,getLineNumberFromCodeElement:e=>{let t=e;for(;null!==t&&"TH"!==t.tagName&&!t.classList.contains("phabricator-source-line");)t=t.previousElementSibling;if(!t)throw new Error("could not find line number cell from code element");const n=t.querySelector("a");if(!n)throw new Error("could not find line number anchor from code element");if(void 0!==n.dataset.n){const e=parseInt(n.dataset.n,10);if(isNaN(e))throw new TypeError(`Could not parse lineNumber from data-n attribute: ${n.dataset.n}`);return e}const r=parseInt(n.textContent||"",10);if(isNaN(r))throw new TypeError(`Could not parse lineNumber from lineAnchor.textContent: ${String(n.textContent)}`);return r},isFirstCharacterDiffIndicator:()=>!1};const Sh=(e,t,n=to)=>Xr(window.location,t,n).pipe(te((e=>{if(e.mode!==qr.Diffusion)throw new Error(`Unexpected PhabricatorState for resolveDiffusionFileInfo, PhabricatorMode: ${e.mode}`);const{filePath:t,commitID:n,rawRepoName:r}=e;return{blob:{filePath:t,commitID:n,rawRepoName:r}}}))),Oh="codeHost-module__hover-overlay_3rw5s",Ch="codeHost-module__icon_3HyWM",Th="codeHost-module__action-item_35MZg",kh="codeHost-module__hover-overlay-action-item_1yTXu",Nh="codeHost-module__hover-overlay-action-item-icon_1oozE",Ah=(e,t)=>({line:e.line,character:e.character+t}),Ih=e=>({direction:t,codeView:n,position:r})=>Ur({...r,requestGraphQL:e}).pipe(te((e=>{const o=Eh.getCodeElementFromLineNumber(n,r.line,r.part);if(!o)throw new Error("(adjustPosition) could not find code element for line provided");const i=(e=>{var t;let n=e.textContent||"",r=0;if(null!==(t=e.firstElementChild)&&void 0!==t&&t.classList.contains("aural-only")){const t=e.firstElementChild.textContent||"";r=t.replace(/^(\+|-)/,"").length,n=n.slice(t.length-r)}return 8203===n.charCodeAt(0)&&(n=n.slice(1),r++),{textContent:n,adjust:r}})(o),a=i.textContent,s=e[r.line-1],c=(u=a,!!(l=s)&&!!u&&l.startsWith("\t")&&!u.startsWith("\t"));var l,u;const f=t===qi.CodeViewToActual?-1:1;return Ah(r,c?(function(e){let t=e,n=0;for(;t.length>=2&&t.startsWith(" ");)++n,t=t.slice(2);return n}(a)+i.adjust)*f:i.adjust*f)}))),Ph={dom:Eh,resolveFileInfo:(e,t,n=to)=>Xr(window.location,t,n).pipe(te((e=>{if(e.mode!==qr.Revision)throw new Error(`Unexpected Phabricator state for resolveRevisionFileInfo, PhabricatorMode: ${e.mode}`);const{rawRepoName:t,headCommitID:n,baseCommitID:r}=e,o=function(e){const t=document.querySelector(".differential-file-icon-header");if(!t)throw new Error("Unable to find file path container for revision code view");if(!t.textContent)throw new Error("`textContent` is undefined for revision file path container");return t.textContent}();return{base:{rawRepoName:t,filePath:o,commitID:r},head:{rawRepoName:t,filePath:o,commitID:n}}}))),getPositionAdjuster:Ih,getToolbarMount:e=>{let t=e.querySelector(".sourcegraph-phabricator-code-view-toolbar-mount");if(t)return t;const n=e.querySelector(".differential-changeset-buttons");if(!n)throw new Error("Unable to find action links for revision");return t=document.createElement("div"),t.style.display="inline-block",t.classList.add("sourcegraph-phabricator-code-view-toolbar-mount"),n.prepend(t),t}},Rh={dom:Eh,resolveFileInfo:(e,t,n=to)=>Xr(window.location,t,n).pipe(ue((r=>{if(r.mode!==qr.Differential)throw new Error(`Unexpected PhabricatorState for resolveDiffFileInfo, PhabricatorMode: ${r.mode}`);const{filePath:o,baseFilePath:i}=function(e){const t=e.children[3].textContent,n=e.querySelectorAll(".differential-meta-notice");let r;const o="This file was moved from ";for(const e of n){let t=e.textContent;if(t.startsWith(o)){t=t.slice(0,-1),r=t.split(o)[1];break}}return{filePath:t,baseFilePath:r}}(e);return Ml(po({repoName:r.baseRawRepoName,revisionID:r.revisionID,diffID:r.baseDiffID||r.diffID,baseDiffID:r.baseDiffID,useDiffForBase:Boolean(r.baseDiffID),useBaseForDiff:!1,filePath:i||o,isBase:!0},t,n).pipe(te((({commitID:e,stagingRepoName:t})=>({commitID:e,rawRepoName:t||r.baseRawRepoName})))),po({repoName:r.headRawRepoName,revisionID:r.revisionID,diffID:r.diffID,baseDiffID:r.baseDiffID,useDiffForBase:!1,useBaseForDiff:!1,filePath:o,isBase:!1},t,n).pipe(te((({commitID:e,stagingRepoName:t})=>({commitID:e,rawRepoName:t||r.headRawRepoName}))))).pipe(te((([e,t])=>({base:{rawRepoName:e.rawRepoName,filePath:i||o,commitID:e.commitID},head:{rawRepoName:t.rawRepoName,filePath:o,commitID:t.commitID}}))))}))),getPositionAdjuster:Ih,getToolbarMount:e=>{const t="sourcegraph-phabricator-code-view-toolbar-mount",n=e.querySelector("."+t);if(n)return n;const r=e.querySelector(".differential-changeset-buttons");if(!r)throw new Error("Unable to find action links for changeset");const o=document.createElement("div");return o.style.display="inline-block",o.classList.add(t),r.prepend(o," "),o},isDiff:!0},Dh={selector:".differential-changeset",resolveView:e=>window.location.pathname.match(/^\/r/)?{element:e,...Ph}:{element:e,...Rh}},Lh=Fp(".diffusion-source",{dom:xh,resolveFileInfo:Sh,getToolbarMount:()=>{const e=document.querySelector(".phui-two-column-content .phui-header-action-links");if(!e)throw new Error("unable to find file actions");const t=document.createElement("div");return t.style.display="inline-block",t.classList.add("sourcegraph-phabricator-code-view-toolbar-mount"),e.prepend(t),t}}),Mh=Fp(".phabricator-source-code-container",{dom:xh,resolveFileInfo:Sh}),jh={[Us]:"phui-info-view phui-info-severity-plain",[qs]:"phui-info-view phui-info-severity-success",[Bs]:"phui-info-view phui-info-severity-notice",[Fs]:"phui-info-view phui-info-severity-warning",[js]:"phui-info-view phui-info-severity-error"},Fh={codeViewResolvers:[Dh,Lh,Mh],type:"phabricator",name:"Phabricator",check:()=>!!document.querySelector(".phabricator-wordmark"),codeViewToolbarClassProps:{actionItemClass:i()("button grey",Th),actionItemIconClass:Ch},notificationClassNames:jh,hoverOverlayClassProps:{className:i()("aphront-dialog-view",Oh),actionItemClassName:i()("button grey",kh),iconClassName:Nh,getAlertClassName:qu(jh)},codeViewsRequireTokenization:!0};var Bh={leading:!0,trailing:!1};var Uh=function(){function e(e,t,n,r){this.duration=e,this.scheduler=t,this.leading=n,this.trailing=r}return e.prototype.call=function(e,t){return t.subscribe(new qh(e,this.duration,this.scheduler,this.leading,this.trailing))},e}(),qh=function(e){function t(t,n,r,o,i){var a=e.call(this,t)||this;return a.duration=n,a.scheduler=r,a.leading=o,a.trailing=i,a._hasTrailingValue=!1,a._trailingValue=null,a}return d(t,e),t.prototype._next=function(e){this.throttled?this.trailing&&(this._trailingValue=e,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(Vh,this.duration,{subscriber:this})),this.leading?this.destination.next(e):this.trailing&&(this._trailingValue=e,this._hasTrailingValue=!0))},t.prototype._complete=function(){this._hasTrailingValue?(this.destination.next(this._trailingValue),this.destination.complete()):this.destination.complete()},t.prototype.clearThrottle=function(){var e=this.throttled;e&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),e.unsubscribe(),this.remove(e),this.throttled=null)},t}(R);function Vh(e){e.subscriber.clearThrottle()}function $h({setElementTooltip:e,linkPreviewContentClass:t},n,r){const o="sg-link-preview-content";let i;if(n.nextSibling instanceof HTMLElement&&n.nextSibling.classList.contains(o)&&(i=n.nextSibling),null!=r&&r.content&&r.content.length>0){i?i.innerHTML="":(i=document.createElement("span"),i.classList.add(o),t&&i.classList.add(...t.split(" ")),n.after(i));for(const e of r.content.map((({kind:e,value:t})=>void 0===e||"markdown"===e?{html:Rc(t).replace(/^<p>/,"").replace(/<\/p>\s*$/,"")}:t)))if("string"==typeof e)i.append(e);else{const t=document.createElement("span");for(t.innerHTML=e.html;t.hasChildNodes();)i.append(t.childNodes[0])}}else i&&(i.remove(),i=void 0);e&&(e(n,zh(r)),i&&e(i,zh(r)))}function zh(e){if(!e)return null;const t=e.hover.map((({value:e})=>e)).filter((e=>!!e));return t.length>0?t.join(" "):null}function Hh(e,{extensionsController:t},{contentViewResolvers:n,linkPreviewContentClass:r,setElementTooltip:o}){const i=e.pipe($f(n||[]),Ae(Vt)),a=new we,s=new Map;return i.pipe(gt((e=>Qo(X(e).pipe(Ge((()=>{console.log("Content view added",{contentViewEvent:e}),s.set(e.element,new A),e.subscriptions.add((()=>{console.log("Content view removed",{contentViewEvent:e});const t=s.get(e.element);if(!t)throw new Error("No linkPreview subscriptions");t.unsubscribe()}))}))),go(e.element,{childList:!0},a).pipe(Ae(Vt),te((()=>e.element.innerHTML)),Ro(),Ge((()=>console.log("Content view updated",{contentViewEvent:e}))),oe(e),function(e,t,n){return void 0===t&&(t=$t),void 0===n&&(n=Bh),function(r){return r.lift(new Uh(e,t,n.leading,n.trailing))}}(2e3,void 0,{leading:!0,trailing:!0}))))),Ge((({element:e})=>{let n=s.get(e);if(!n)throw new Error("No linkPreview subscriptions");n.unsubscribe(),n=new A,s.set(e,n);for(const i of e.querySelectorAll("a[href]"))n.add(Z(t.extHostAPI).pipe(ue((e=>Ba(e.getLinkPreviews(i.href))))).subscribe((e=>{try{a.next(!0),$h({setElementTooltip:o,linkPreviewContentClass:r},i,e)}finally{a.next(!1)}})))}))).subscribe()}var Gh=n(32805),Qh=n(42797),Wh=n.n(Qh),Kh=n(88514),Zh=n.n(Kh),Yh=n(37310),Jh=n.n(Yh),Xh=n(46950),em=n.n(Xh),tm=n(51437),nm=n(51491),rm=n.n(nm);const om=Ze((e=>Z(e).pipe(ue((e=>Ba(e.haveInitialExtensionsLoaded()))))),(()=>"haveInitialExtensionsLoaded")),im=({text:e,pattern:n,className:r})=>t.createElement("span",null,function(e,t){const n=[];let r,o=0;for(let a=0;a<t.length;a++){var i;const s=e.indexOf(t.charAt(a),o);if(-1===s)break;null!==(i=r)&&void 0!==i&&i.match&&s===o?r.end=s+1:(r&&!r.match||s>o)&&(n.push({start:o,end:s,match:!1}),r=void 0),r||(r={start:s,end:s+1,match:!0},n.push(r)),o=s+1}e&&o<e.length&&n.push({start:o,end:e.length,match:!1});return n}(e.toLowerCase(),n.toLowerCase()).map(((n,o)=>n.match?t.createElement("strong",{key:o,className:r},e.slice(n.start,n.end)):e.slice(n.start,n.end))));const am="EmptyCommandListContainer-module__empty-command-list_NA_s5";function sm(){return(sm=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const cm=({className:e,children:n,...r})=>t.createElement("div",sm({className:i()(am,e)},r),n),lm="EmptyCommandList-module__title_Sbph5",um="EmptyCommandList-module__text_s1AXs",fm="EmptyCommandList-module__illustration_3pj62",pm=({settingsCascade:e,sourcegraphURL:n})=>{const r=!!e&&function(e){const t=Ms(e,"User"),n=Ms(e,"DefaultSettings");if(t&&n)for(const e of Object.keys(t))if(!(e in n))return!1;return!0}(e);return t.createElement(cm,null,t.createElement("p",{className:lm},r?"You don't have any extensions enabled":"You don't have any active actions"),t.createElement("p",{className:um},r?"Enable Sourcegraph extensions to get additional functionality, integrations, and make special actions available from this menu.":"Commands from your installed extensions will be shown when you navigate to certain pages."),t.createElement(fa,{to:n+"/extensions",variant:"primary"},"Explore extensions"),t.createElement(dm,{className:fm}))},dm=t.memo((({className:e})=>t.createElement("svg",{width:"59",height:"64",viewBox:"0 0 59 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e},t.createElement("path",{d:"M51.5825 43.9313C55.4271 45.582 57.2515 40.6516 57.8679 40.6516C58.4844 40.6516 58.9775 41.1397 58.9775 41.7497V60.3841C58.9775 62.3806 57.3411 64 55.3237 64H37.9287C37.7942 63.9778 37.6934 63.9556 37.6373 63.9335C35.9449 63.1459 40.2322 61.0779 40.1928 58.8201C40.1396 55.7739 38.0632 54.658 33.5688 54.658C29.0744 54.658 26.6802 55.4072 27.9131 59.6776C28.3325 61.1303 31.0022 63.1903 29.1192 63.9335C29.052 63.9556 28.8838 63.9778 28.6597 64H11.7803C9.78528 64 8.17132 62.4139 8.1377 60.4395V43.225C8.16011 43.0697 8.18253 42.9588 8.21615 42.9033C9.01192 41.2284 11.7803 44.8776 13.3831 45.4322C17.6197 46.8853 21.5201 43.1362 21.5201 38.6884C21.5201 34.2406 18.9535 27.9515 14.7168 29.4156C13.1141 29.9702 9.00072 34.8363 8.24978 32.9729C8.21615 32.9063 8.19374 32.7178 8.17132 32.4626L8.1377 16.9373C8.1377 16.9373 8.18253 16.3605 8.23857 16.0832C8.5636 13.9979 10.7492 13.1328 12.6209 13.1328L14.7168 13.1771C14.7168 13.1771 19.8725 13.2991 24.0644 13.3102H25.8016C27.6509 13.3102 29.0632 13.2659 29.3097 13.166C31.1927 12.4229 27.3147 9.63882 26.7543 8.05269C25.286 3.85997 29.0856 0 33.5688 0C38.052 0 41.8516 3.85997 40.3945 8.04159C39.8341 9.62773 36.1467 12.3785 37.8391 13.1549C37.996 13.2326 38.4219 13.277 39.0496 13.3102H46.7047C49.7533 13.2437 52.4096 13.1549 52.4096 13.1549L54.5055 13.1106C55.2228 13.1106 55.9962 13.2659 56.7023 13.5653C56.7247 13.5764 56.7583 13.5875 56.7919 13.5986C56.8592 13.6319 56.9152 13.6652 56.9825 13.6984C57.1394 13.7872 57.3075 13.8759 57.4532 13.9757C57.5877 14.0756 57.7222 14.1865 57.8455 14.2974C57.8791 14.3307 57.9127 14.3529 57.9464 14.3861C58.4283 14.852 58.787 15.451 58.9215 16.1941C58.9775 16.427 58.9999 16.6711 58.9999 16.9262V29.4156C58.9887 30.0257 58.4218 32.5682 57.9403 32.9484C55.2912 35.0404 54.2316 27.1052 50.5229 30.8565C47.5946 33.8183 47.7379 42.2805 51.5825 43.9313Z",fill:"url(#paint0_linear)",fillOpacity:"0.32"}),t.createElement("rect",{y:"24.6855",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{y:"46.627",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{y:"52.1133",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{y:"19.1992",width:"11.0972",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"11.0977",y:"30.1699",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"11.0977",y:"41.1426",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"11.0977",y:"35.6562",width:"15.7211",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"13.8711",y:"24.6855",width:"9.24768",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"13.8711",y:"46.627",width:"9.24768",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"13.8711",y:"52.1133",width:"5.54861",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"12.0225",y:"19.1992",width:"5.54861",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"24.9688",y:"30.1699",width:"4.62384",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"24.9688",y:"41.1426",width:"9.24767",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"30.5176",y:"30.1699",width:"7.39814",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"35.1416",y:"41.1426",width:"4.62384",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("rect",{x:"27.7432",y:"35.6562",width:"7.39814",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),t.createElement("defs",null,t.createElement("linearGradient",{id:"paint0_linear",x1:"33.5688",y1:"0",x2:"33.5688",y2:"64",gradientUnits:"userSpaceOnUse"},t.createElement("stop",{stopColor:"#95A5C6",stopOpacity:"0.6"}),t.createElement("stop",{offset:"1",stopColor:"#95A5C6"})))))),hm="CommandList-module__command-list_10tyf",mm="CommandList-module__popover-button_1ug-b";function gm(){return(gm=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const vm=Ze((e=>Z(e).pipe(ue((e=>Ba(e.getContributions()))))),(()=>"getContributions"));class bm extends t.PureComponent{static RECENT_ACTIONS_STORAGE_KEY="commandList.recentActions";static readRecentActions(){const e=localStorage.getItem(bm.RECENT_ACTIONS_STORAGE_KEY);if(null===e)return null;try{const t=JSON.parse(e);return Array.isArray(t)&&t.every((e=>"string"==typeof e))?t:null}catch(e){console.error("Error reading recent actions:",e)}return bm.writeRecentActions(null),null}static writeRecentActions(e){try{if(null===e)localStorage.removeItem(bm.RECENT_ACTIONS_STORAGE_KEY);else{const t=JSON.stringify(e);localStorage.setItem(bm.RECENT_ACTIONS_STORAGE_KEY,t)}}catch(e){console.error("Error writing recent actions:",e)}}state={input:"",selectedIndex:0,recentActions:bm.readRecentActions()};subscriptions=new A;selectedItem=null;setSelectedItem=e=>{this.selectedItem=e};componentDidMount(){this.subscriptions.add(om(this.props.extensionsController.extHostAPI).pipe(_t((e=>e)),ue((()=>vm(this.props.extensionsController.extHostAPI)))).subscribe((e=>{this.setState({contributions:e})}))),this.subscriptions.add(this.props.platformContext.settings.subscribe((e=>this.setState({settingsCascade:e})))),setTimeout((()=>{this.setState({autoFocus:!0})}))}componentDidUpdate(e,t){this.state.recentActions!==t.recentActions&&bm.writeRecentActions(this.state.recentActions)}componentWillUnmount(){this.subscriptions.unsubscribe()}render(){if(!this.state.contributions)return t.createElement(cm,{className:hm},t.createElement("div",{className:"d-flex py-5 align-items-center justify-content-center"},t.createElement(ba,{inline:!1}),t.createElement("span",{className:"mx-2"},"Loading Sourcegraph extensions"),t.createElement(ma,{as:em()})));const e=ds(this.state.contributions,this.props.menu),n=this.state.input.trim(),r=function(e,t,n){if(!t)return null===n?e:fs()(e,(e=>{const t=n.indexOf(e.action.id);return-1===t?null:t}),(({action:e})=>e.id));const r=new Array(e.length),o=new Array(e.length),i=e.filter(((e,n)=>{let i=r[n];return void 0===i&&(i=`${e.action.category?`${e.action.category}: `:""}${e.action.title||e.action.command||""}`,r[n]=i),void 0===o[n]&&(o[n]=rm()(i,t,0)),o[n]>0})).map(((e,t)=>{const r=null==n?void 0:n.indexOf(e.action.id);return{item:e,score:o[t],recentIndex:-1===r?null:r}}));return fs()(i,"recentIndex","score",(({item:e})=>e.action.id)).map((({item:e})=>e))}(e,this.state.input,this.state.recentActions),o=(this.state.selectedIndex%r.length+r.length)%r.length;return t.createElement("div",{className:hm},t.createElement("header",null,t.createElement("form",{className:this.props.formClassName,onSubmit:this.onSubmit},t.createElement("label",{className:"sr-only",htmlFor:"command-list-input"},"Command"),t.createElement("input",{id:"command-list-input",ref:e=>e&&this.state.autoFocus&&e.focus({preventScroll:!0}),type:"text",className:this.props.inputClassName,value:this.state.input,placeholder:"Run Sourcegraph action...",spellCheck:!1,autoCorrect:"off",autoComplete:"off",onChange:this.onInputChange,onKeyDown:this.onInputKeyDown}))),t.createElement("div",{className:this.props.resultsContainerClassName},t.createElement("ul",{className:this.props.listClassName},r.length>0?r.map(((e,r)=>t.createElement("li",{className:i()(this.props.listItemClassName,r===o&&this.props.selectedListItemClassName),key:e.action.id},t.createElement(os,gm({},this.props,{className:i()(this.props.actionItemClassName,r===o&&this.props.selectedActionItemClassName)},e,{ref:r===o?this.setSelectedItem:void 0,title:t.createElement(im,{text:[e.action.category,e.action.title||e.action.command].filter(Boolean).join(": "),pattern:n}),onDidExecute:this.onActionDidExecute}))))):n.length>0?t.createElement("li",{className:this.props.noResultsClassName},"No matching commands"):t.createElement(pm,{settingsCascade:this.state.settingsCascade,sourcegraphURL:this.props.platformContext.sourcegraphURL}))))}onInputChange=e=>{this.setState({input:e.currentTarget.value,selectedIndex:0})};onInputKeyDown=e=>{switch(e.key){case oa.s.ArrowDown:e.preventDefault(),this.setSelectedIndex(1);break;case oa.s.ArrowUp:e.preventDefault(),this.setSelectedIndex(-1);break;case oa.s.Enter:this.selectedItem&&this.selectedItem.runAction(e)}};onSubmit=e=>e.preventDefault();setSelectedIndex(e){this.setState((t=>({selectedIndex:t.selectedIndex+e})))}onActionDidExecute=e=>{this.setState((t=>{const{recentActions:n}=t;return n?{recentActions:nn()([e,...n]).slice(0,10)}:{recentActions:[e]}})),this.props.onSelect&&this.props.onSelect()}}const ym=({buttonClassName:e,buttonElement:n="span",buttonOpenClassName:r,showCaret:o=!0,popoverClassName:a,popoverInnerClassName:s,keyboardShortcutForShow:c,variant:l,...u})=>{const[f,p]=(0,t.useState)(!1),d=(0,t.useCallback)((()=>p(!1)),[]),h=(0,t.useCallback)((()=>p(!f)),[f]),m=(0,t.useMemo)((()=>Cs()("command-list-popover-button-")),[]),g=()=>f?t.createElement(ma,{as:Zh()}):t.createElement(ma,{as:Wh()});return t.createElement(la,{as:n,role:"button",id:m,onClick:h,className:i()(mm,e,f&&r),variant:l,"aria-label":"Command list"},t.createElement(ma,{as:Jh(),size:"md"}),o&&t.createElement(g,null),t.createElement(tm.ZP,{isOpen:f,toggle:h,popperClassName:a,innerClassName:i()("popover-inner",s),placement:"bottom-end",target:m,trigger:"legacy",delay:0,fade:!1,hideArrow:!0},t.createElement(bm,gm({},u,{onSelect:d}))),null==c?void 0:c.keybindings.map(((e,n)=>t.createElement(Gh.z9,gm({key:n},e,{onMatch:h})))))};var wm=n(7263),Em=n.n(wm);function _m(e,t,n){var r;return r=e&&"object"==typeof e?e:{bufferSize:e,windowTime:t,refCount:!1,scheduler:n},function(e){return e.lift(function(e){var t,n,r=e.bufferSize,o=void 0===r?Number.POSITIVE_INFINITY:r,i=e.windowTime,a=void 0===i?Number.POSITIVE_INFINITY:i,s=e.refCount,c=e.scheduler,l=0,u=!1,f=!1;return function(e){var r;l++,!t||u?(u=!1,t=new De(o,a,c),r=t.subscribe(this),n=e.subscribe({next:function(e){t.next(e)},error:function(e){u=!0,t.error(e)},complete:function(){f=!0,n=void 0,t.complete()}})):r=t.subscribe(this),this.add((function(){l--,r.unsubscribe(),n&&!f&&s&&0===l&&(n.unsubscribe(),n=void 0,t=void 0)}))}}(r))}}function xm(e){return(xm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}"function"==typeof Symbol&&null!=Symbol.iterator&&Symbol.iterator,"function"==typeof Symbol&&null!=Symbol.asyncIterator&&Symbol.asyncIterator;var Sm="function"==typeof Symbol&&null!=Symbol.toStringTag?Symbol.toStringTag:"@@toStringTag";function Om(e,t){for(var n,r=/\r\n|[\n\r]/g,o=1,i=t+1;(n=r.exec(e.body))&&n.index<t;)o+=1,i=t+1-(n.index+n[0].length);return{line:o,column:i}}function Cm(e){return Tm(e.source,Om(e.source,e.start))}function Tm(e,t){var n=e.locationOffset.column-1,r=Nm(n)+e.body,o=t.line-1,i=e.locationOffset.line-1,a=t.line+i,s=1===t.line?n:0,c=t.column+s,l="".concat(e.name,":").concat(a,":").concat(c,"\n"),u=r.split(/\r\n|[\n\r]/g),f=u[o];if(f.length>120){for(var p=Math.floor(c/80),d=c%80,h=[],m=0;m<f.length;m+=80)h.push(f.slice(m,m+80));return l+km([["".concat(a),h[0]]].concat(h.slice(1,p+1).map((function(e){return["",e]})),[[" ",Nm(d-1)+"^"],["",h[p+1]]]))}return l+km([["".concat(a-1),u[o-1]],["".concat(a),f],["",Nm(c-1)+"^"],["".concat(a+1),u[o+1]]])}function km(e){var t=e.filter((function(e){e[0];return void 0!==e[1]})),n=Math.max.apply(Math,t.map((function(e){return e[0].length})));return t.map((function(e){var t,r=e[0],o=e[1];return Nm(n-(t=r).length)+t+(o?" | "+o:" |")})).join("\n")}function Nm(e){return Array(e+1).join(" ")}function Am(e){return(Am="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Im(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Pm(e,t){return!t||"object"!==Am(t)&&"function"!=typeof t?Rm(e):t}function Rm(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Dm(e){var t="function"==typeof Map?new Map:void 0;return(Dm=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Lm(e,arguments,Fm(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),jm(r,e)})(e)}function Lm(e,t,n){return(Lm=Mm()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&jm(o,n.prototype),o}).apply(null,arguments)}function Mm(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function jm(e,t){return(jm=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Fm(e){return(Fm=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Bm=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&jm(e,t)}(s,e);var t,n,r,o,i,a=(t=s,n=Mm(),function(){var e,r=Fm(t);if(n){var o=Fm(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return Pm(this,e)});function s(e,t,n,r,o,i,c){var l,u,f,p,d;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),d=a.call(this,e);var h,m=Array.isArray(t)?0!==t.length?t:void 0:t?[t]:void 0,g=n;!g&&m&&(g=null===(h=m[0].loc)||void 0===h?void 0:h.source);var v,b=r;!b&&m&&(b=m.reduce((function(e,t){return t.loc&&e.push(t.loc.start),e}),[])),b&&0===b.length&&(b=void 0),r&&n?v=r.map((function(e){return Om(n,e)})):m&&(v=m.reduce((function(e,t){return t.loc&&e.push(Om(t.loc.source,t.loc.start)),e}),[]));var y,w=c;if(null==w&&null!=i){var E=i.extensions;"object"==xm(y=E)&&null!==y&&(w=E)}return Object.defineProperties(Rm(d),{name:{value:"GraphQLError"},message:{value:e,enumerable:!0,writable:!0},locations:{value:null!==(l=v)&&void 0!==l?l:void 0,enumerable:null!=v},path:{value:null!=o?o:void 0,enumerable:null!=o},nodes:{value:null!=m?m:void 0},source:{value:null!==(u=g)&&void 0!==u?u:void 0},positions:{value:null!==(f=b)&&void 0!==f?f:void 0},originalError:{value:i},extensions:{value:null!==(p=w)&&void 0!==p?p:void 0,enumerable:null!=w}}),(null==i?void 0:i.stack)?(Object.defineProperty(Rm(d),"stack",{value:i.stack,writable:!0,configurable:!0}),Pm(d)):(Error.captureStackTrace?Error.captureStackTrace(Rm(d),s):Object.defineProperty(Rm(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return r=s,(o=[{key:"toString",value:function(){return function(e){var t=e.message;if(e.nodes)for(var n=0,r=e.nodes;n<r.length;n++){var o=r[n];o.loc&&(t+="\n\n"+Cm(o.loc))}else if(e.source&&e.locations)for(var i=0,a=e.locations;i<a.length;i++){var s=a[i];t+="\n\n"+Tm(e.source,s)}return t}(this)}},{key:Sm,get:function(){return"Object"}}])&&Im(r.prototype,o),i&&Im(r,i),s}(Dm(Error));function Um(e,t,n){return new Bm("Syntax Error: ".concat(n),void 0,e,[t])}var qm=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});const Vm="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function $m(e){var t=e.prototype.toJSON;"function"==typeof t||function(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}(0),e.prototype.inspect=t,Vm&&(e.prototype[Vm]=t)}var zm=function(){function e(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}return e.prototype.toJSON=function(){return{start:this.start,end:this.end}},e}();$m(zm);var Hm=function(){function e(e,t,n,r,o,i,a){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=o,this.value=a,this.prev=i,this.next=null}return e.prototype.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},e}();function Gm(e){return null!=e&&"string"==typeof e.kind}$m(Hm);var Qm=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function Wm(e){return(Wm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Km(e){return Zm(e,[])}function Zm(e,t){switch(Wm(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,t){if(-1!==t.indexOf(e))return"[Circular]";var n=[].concat(t,[e]),r=function(e){var t=e[String(Vm)];if("function"==typeof t)return t;if("function"==typeof e.inspect)return e.inspect}(e);if(void 0!==r){var o=r.call(e);if(o!==e)return"string"==typeof o?o:Zm(o,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>2)return"[Array]";for(var n=Math.min(10,e.length),r=e.length-n,o=[],i=0;i<n;++i)o.push(Zm(e[i],t));1===r?o.push("... 1 more item"):r>1&&o.push("... ".concat(r," more items"));return"["+o.join(", ")+"]"}(e,n);return function(e,t){var n=Object.keys(e);if(0===n.length)return"{}";if(t.length>2)return"["+function(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){var n=e.constructor.name;if("string"==typeof n&&""!==n)return n}return t}(e)+"]";return"{ "+n.map((function(n){return n+": "+Zm(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}function Ym(e,t){if(!Boolean(e))throw new Error(t)}const Jm=function(e,t){return e instanceof t};function Xm(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var eg=function(){function e(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GraphQL request",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{line:1,column:1};"string"==typeof e||Ym(0,"Body must be a string. Received: ".concat(Km(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||Ym(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Ym(0,"column in locationOffset is 1-indexed and must be positive.")}var t,n,r;return t=e,(n=[{key:Sm,get:function(){return"Source"}}])&&Xm(t.prototype,n),r&&Xm(t,r),e}();var tg=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});function ng(e){var t=e.split(/\r\n|[\n\r]/g),n=function(e){for(var t,n=!0,r=!0,o=0,i=null,a=0;a<e.length;++a)switch(e.charCodeAt(a)){case 13:10===e.charCodeAt(a+1)&&++a;case 10:n=!1,r=!0,o=0;break;case 9:case 32:++o;break;default:r&&!n&&(null===i||o<i)&&(i=o),r=!1}return null!==(t=i)&&void 0!==t?t:0}(e);if(0!==n)for(var r=1;r<t.length;r++)t[r]=t[r].slice(n);for(var o=0;o<t.length&&rg(t[o]);)++o;for(var i=t.length;i>o&&rg(t[i-1]);)--i;return t.slice(o,i).join("\n")}function rg(e){for(var t=0;t<e.length;++t)if(" "!==e[t]&&"\t"!==e[t])return!1;return!0}var og=function(){function e(e){var t=new Hm(Qm.SOF,0,0,0,0,null);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}var t=e.prototype;return t.advance=function(){return this.lastToken=this.token,this.token=this.lookahead()},t.lookahead=function(){var e=this.token;if(e.kind!==Qm.EOF)do{var t;e=null!==(t=e.next)&&void 0!==t?t:e.next=ag(this,e)}while(e.kind===Qm.COMMENT);return e},e}();function ig(e){return isNaN(e)?Qm.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function ag(e,t){for(var n=e.source,r=n.body,o=r.length,i=t.end;i<o;){var a=r.charCodeAt(i),s=e.line,c=1+i-e.lineStart;switch(a){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:10===r.charCodeAt(i+1)?i+=2:++i,++e.line,e.lineStart=i;continue;case 33:return new Hm(Qm.BANG,i,i+1,s,c,t);case 35:return cg(n,i,s,c,t);case 36:return new Hm(Qm.DOLLAR,i,i+1,s,c,t);case 38:return new Hm(Qm.AMP,i,i+1,s,c,t);case 40:return new Hm(Qm.PAREN_L,i,i+1,s,c,t);case 41:return new Hm(Qm.PAREN_R,i,i+1,s,c,t);case 46:if(46===r.charCodeAt(i+1)&&46===r.charCodeAt(i+2))return new Hm(Qm.SPREAD,i,i+3,s,c,t);break;case 58:return new Hm(Qm.COLON,i,i+1,s,c,t);case 61:return new Hm(Qm.EQUALS,i,i+1,s,c,t);case 64:return new Hm(Qm.AT,i,i+1,s,c,t);case 91:return new Hm(Qm.BRACKET_L,i,i+1,s,c,t);case 93:return new Hm(Qm.BRACKET_R,i,i+1,s,c,t);case 123:return new Hm(Qm.BRACE_L,i,i+1,s,c,t);case 124:return new Hm(Qm.PIPE,i,i+1,s,c,t);case 125:return new Hm(Qm.BRACE_R,i,i+1,s,c,t);case 34:return 34===r.charCodeAt(i+1)&&34===r.charCodeAt(i+2)?pg(n,i,s,c,t,e):fg(n,i,s,c,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return lg(n,i,a,s,c,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return hg(n,i,s,c,t)}throw Um(n,i,sg(a))}var l=e.line,u=1+i-e.lineStart;return new Hm(Qm.EOF,o,o,l,u,t)}function sg(e){return e<32&&9!==e&&10!==e&&13!==e?"Cannot contain the invalid character ".concat(ig(e),"."):39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":"Cannot parse the unexpected character ".concat(ig(e),".")}function cg(e,t,n,r,o){var i,a=e.body,s=t;do{i=a.charCodeAt(++s)}while(!isNaN(i)&&(i>31||9===i));return new Hm(Qm.COMMENT,t,s,n,r,o,a.slice(t+1,s))}function lg(e,t,n,r,o,i){var a=e.body,s=n,c=t,l=!1;if(45===s&&(s=a.charCodeAt(++c)),48===s){if((s=a.charCodeAt(++c))>=48&&s<=57)throw Um(e,c,"Invalid number, unexpected digit after 0: ".concat(ig(s),"."))}else c=ug(e,c,s),s=a.charCodeAt(c);if(46===s&&(l=!0,s=a.charCodeAt(++c),c=ug(e,c,s),s=a.charCodeAt(c)),69!==s&&101!==s||(l=!0,43!==(s=a.charCodeAt(++c))&&45!==s||(s=a.charCodeAt(++c)),c=ug(e,c,s),s=a.charCodeAt(c)),46===s||function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122}(s))throw Um(e,c,"Invalid number, expected digit but got: ".concat(ig(s),"."));return new Hm(l?Qm.FLOAT:Qm.INT,t,c,r,o,i,a.slice(t,c))}function ug(e,t,n){var r=e.body,o=t,i=n;if(i>=48&&i<=57){do{i=r.charCodeAt(++o)}while(i>=48&&i<=57);return o}throw Um(e,o,"Invalid number, expected digit but got: ".concat(ig(i),"."))}function fg(e,t,n,r,o){for(var i,a,s,c,l=e.body,u=t+1,f=u,p=0,d="";u<l.length&&!isNaN(p=l.charCodeAt(u))&&10!==p&&13!==p;){if(34===p)return d+=l.slice(f,u),new Hm(Qm.STRING,t,u+1,n,r,o,d);if(p<32&&9!==p)throw Um(e,u,"Invalid character within String: ".concat(ig(p),"."));if(++u,92===p){switch(d+=l.slice(f,u-1),p=l.charCodeAt(u)){case 34:d+='"';break;case 47:d+="/";break;case 92:d+="\\";break;case 98:d+="\b";break;case 102:d+="\f";break;case 110:d+="\n";break;case 114:d+="\r";break;case 116:d+="\t";break;case 117:var h=(i=l.charCodeAt(u+1),a=l.charCodeAt(u+2),s=l.charCodeAt(u+3),c=l.charCodeAt(u+4),dg(i)<<12|dg(a)<<8|dg(s)<<4|dg(c));if(h<0){var m=l.slice(u+1,u+5);throw Um(e,u,"Invalid character escape sequence: \\u".concat(m,"."))}d+=String.fromCharCode(h),u+=4;break;default:throw Um(e,u,"Invalid character escape sequence: \\".concat(String.fromCharCode(p),"."))}f=++u}}throw Um(e,u,"Unterminated string.")}function pg(e,t,n,r,o,i){for(var a=e.body,s=t+3,c=s,l=0,u="";s<a.length&&!isNaN(l=a.charCodeAt(s));){if(34===l&&34===a.charCodeAt(s+1)&&34===a.charCodeAt(s+2))return u+=a.slice(c,s),new Hm(Qm.BLOCK_STRING,t,s+3,n,r,o,ng(u));if(l<32&&9!==l&&10!==l&&13!==l)throw Um(e,s,"Invalid character within String: ".concat(ig(l),"."));10===l?(++s,++i.line,i.lineStart=s):13===l?(10===a.charCodeAt(s+1)?s+=2:++s,++i.line,i.lineStart=s):92===l&&34===a.charCodeAt(s+1)&&34===a.charCodeAt(s+2)&&34===a.charCodeAt(s+3)?(u+=a.slice(c,s)+'"""',c=s+=4):++s}throw Um(e,s,"Unterminated string.")}function dg(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function hg(e,t,n,r,o){for(var i=e.body,a=i.length,s=t+1,c=0;s!==a&&!isNaN(c=i.charCodeAt(s))&&(95===c||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++s;return new Hm(Qm.NAME,t,s,n,r,o,i.slice(t,s))}var mg=function(){function e(e,t){var n=function(e){return Jm(e,eg)}(e)?e:new eg(e);this._lexer=new og(n),this._options=t}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(Qm.NAME);return{kind:qm.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:qm.DOCUMENT,definitions:this.many(Qm.SOF,this.parseDefinition,Qm.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(Qm.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(Qm.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},t.parseOperationDefinition=function(){var e=this._lexer.token;if(this.peek(Qm.BRACE_L))return{kind:qm.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,n=this.parseOperationType();return this.peek(Qm.NAME)&&(t=this.parseName()),{kind:qm.OPERATION_DEFINITION,operation:n,name:t,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseOperationType=function(){var e=this.expectToken(Qm.NAME);switch(e.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(e)},t.parseVariableDefinitions=function(){return this.optionalMany(Qm.PAREN_L,this.parseVariableDefinition,Qm.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:qm.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(Qm.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Qm.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(e)}},t.parseVariable=function(){var e=this._lexer.token;return this.expectToken(Qm.DOLLAR),{kind:qm.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:qm.SELECTION_SET,selections:this.many(Qm.BRACE_L,this.parseSelection,Qm.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(Qm.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,n=this._lexer.token,r=this.parseName();return this.expectOptionalToken(Qm.COLON)?(e=r,t=this.parseName()):t=r,{kind:qm.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Qm.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Qm.PAREN_L,t,Qm.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(Qm.COLON),{kind:qm.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:qm.ARGUMENT,name:this.parseName(),value:(this.expectToken(Qm.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(Qm.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(Qm.NAME)?{kind:qm.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:qm.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseFragmentDefinition=function(){var e,t=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(e=this._options)||void 0===e?void 0:e.experimentalFragmentVariables)?{kind:qm.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}:{kind:qm.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}},t.parseFragmentName=function(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()},t.parseValueLiteral=function(e){var t=this._lexer.token;switch(t.kind){case Qm.BRACKET_L:return this.parseList(e);case Qm.BRACE_L:return this.parseObject(e);case Qm.INT:return this._lexer.advance(),{kind:qm.INT,value:t.value,loc:this.loc(t)};case Qm.FLOAT:return this._lexer.advance(),{kind:qm.FLOAT,value:t.value,loc:this.loc(t)};case Qm.STRING:case Qm.BLOCK_STRING:return this.parseStringLiteral();case Qm.NAME:switch(this._lexer.advance(),t.value){case"true":return{kind:qm.BOOLEAN,value:!0,loc:this.loc(t)};case"false":return{kind:qm.BOOLEAN,value:!1,loc:this.loc(t)};case"null":return{kind:qm.NULL,loc:this.loc(t)};default:return{kind:qm.ENUM,value:t.value,loc:this.loc(t)}}case Qm.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:qm.STRING,value:e.value,block:e.kind===Qm.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,n=this._lexer.token;return{kind:qm.LIST,values:this.any(Qm.BRACKET_L,(function(){return t.parseValueLiteral(e)}),Qm.BRACKET_R),loc:this.loc(n)}},t.parseObject=function(e){var t=this,n=this._lexer.token;return{kind:qm.OBJECT,fields:this.any(Qm.BRACE_L,(function(){return t.parseObjectField(e)}),Qm.BRACE_R),loc:this.loc(n)}},t.parseObjectField=function(e){var t=this._lexer.token,n=this.parseName();return this.expectToken(Qm.COLON),{kind:qm.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(Qm.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(Qm.AT),{kind:qm.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(Qm.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(Qm.BRACKET_R),e={kind:qm.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(Qm.BANG)?{kind:qm.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:qm.NAMED_TYPE,name:this.parseName(),loc:this.loc(e)}},t.parseTypeSystemDefinition=function(){var e=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(e.kind===Qm.NAME)switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(e)},t.peekDescription=function(){return this.peek(Qm.STRING)||this.peek(Qm.BLOCK_STRING)},t.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},t.parseSchemaDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");var n=this.parseDirectives(!0),r=this.many(Qm.BRACE_L,this.parseOperationTypeDefinition,Qm.BRACE_R);return{kind:qm.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r,loc:this.loc(e)}},t.parseOperationTypeDefinition=function(){var e=this._lexer.token,t=this.parseOperationType();this.expectToken(Qm.COLON);var n=this.parseNamedType();return{kind:qm.OPERATION_TYPE_DEFINITION,operation:t,type:n,loc:this.loc(e)}},t.parseScalarTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");var n=this.parseName(),r=this.parseDirectives(!0);return{kind:qm.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");var n=this.parseName(),r=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),i=this.parseFieldsDefinition();return{kind:qm.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:o,fields:i,loc:this.loc(e)}},t.parseImplementsInterfaces=function(){var e;if(!this.expectOptionalKeyword("implements"))return[];if(!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLImplementsInterfaces)){var t=[];this.expectOptionalToken(Qm.AMP);do{t.push(this.parseNamedType())}while(this.expectOptionalToken(Qm.AMP)||this.peek(Qm.NAME));return t}return this.delimitedMany(Qm.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var e;return!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLEmptyFields)&&this.peek(Qm.BRACE_L)&&this._lexer.lookahead().kind===Qm.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(Qm.BRACE_L,this.parseFieldDefinition,Qm.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(Qm.COLON);var o=this.parseTypeReference(),i=this.parseDirectives(!0);return{kind:qm.FIELD_DEFINITION,description:t,name:n,arguments:r,type:o,directives:i,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(Qm.PAREN_L,this.parseInputValueDef,Qm.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(Qm.COLON);var r,o=this.parseTypeReference();this.expectOptionalToken(Qm.EQUALS)&&(r=this.parseValueLiteral(!0));var i=this.parseDirectives(!0);return{kind:qm.INPUT_VALUE_DEFINITION,description:t,name:n,type:o,defaultValue:r,directives:i,loc:this.loc(e)}},t.parseInterfaceTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");var n=this.parseName(),r=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),i=this.parseFieldsDefinition();return{kind:qm.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:o,fields:i,loc:this.loc(e)}},t.parseUnionTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");var n=this.parseName(),r=this.parseDirectives(!0),o=this.parseUnionMemberTypes();return{kind:qm.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:o,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(Qm.EQUALS)?this.delimitedMany(Qm.PIPE,this.parseNamedType):[]},t.parseEnumTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");var n=this.parseName(),r=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();return{kind:qm.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:o,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(Qm.BRACE_L,this.parseEnumValueDefinition,Qm.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseDirectives(!0);return{kind:qm.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseInputObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");var n=this.parseName(),r=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();return{kind:qm.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:o,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(Qm.BRACE_L,this.parseInputValueDef,Qm.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===Qm.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)},t.parseSchemaExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var t=this.parseDirectives(!0),n=this.optionalMany(Qm.BRACE_L,this.parseOperationTypeDefinition,Qm.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return{kind:qm.SCHEMA_EXTENSION,directives:t,operationTypes:n,loc:this.loc(e)}},t.parseScalarTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var t=this.parseName(),n=this.parseDirectives(!0);if(0===n.length)throw this.unexpected();return{kind:qm.SCALAR_TYPE_EXTENSION,name:t,directives:n,loc:this.loc(e)}},t.parseObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===o.length)throw this.unexpected();return{kind:qm.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:o,loc:this.loc(e)}},t.parseInterfaceTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===o.length)throw this.unexpected();return{kind:qm.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:o,loc:this.loc(e)}},t.parseUnionTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:qm.UNION_TYPE_EXTENSION,name:t,directives:n,types:r,loc:this.loc(e)}},t.parseEnumTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:qm.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r,loc:this.loc(e)}},t.parseInputObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:qm.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r,loc:this.loc(e)}},t.parseDirectiveDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(Qm.AT);var n=this.parseName(),r=this.parseArgumentDefs(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var i=this.parseDirectiveLocations();return{kind:qm.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:o,locations:i,loc:this.loc(e)}},t.parseDirectiveLocations=function(){return this.delimitedMany(Qm.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==tg[t.value])return t;throw this.unexpected(e)},t.loc=function(e){var t;if(!0!==(null===(t=this._options)||void 0===t?void 0:t.noLocation))return new zm(e,this._lexer.lastToken,this._lexer.source)},t.peek=function(e){return this._lexer.token.kind===e},t.expectToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw Um(this._lexer.source,t.start,"Expected ".concat(vg(e),", found ").concat(gg(t),"."))},t.expectOptionalToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t},t.expectKeyword=function(e){var t=this._lexer.token;if(t.kind!==Qm.NAME||t.value!==e)throw Um(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(gg(t),"."));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===Qm.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=null!=e?e:this._lexer.token;return Um(this._lexer.source,t.start,"Unexpected ".concat(gg(t),"."))},t.any=function(e,t,n){this.expectToken(e);for(var r=[];!this.expectOptionalToken(n);)r.push(t.call(this));return r},t.optionalMany=function(e,t,n){if(this.expectOptionalToken(e)){var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}return[]},t.many=function(e,t,n){this.expectToken(e);var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r},t.delimitedMany=function(e,t){this.expectOptionalToken(e);var n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n},e}();function gg(e){var t=e.value;return vg(e.kind)+(null!=t?' "'.concat(t,'"'):"")}function vg(e){return function(e){return e===Qm.BANG||e===Qm.DOLLAR||e===Qm.AMP||e===Qm.PAREN_L||e===Qm.PAREN_R||e===Qm.SPREAD||e===Qm.COLON||e===Qm.EQUALS||e===Qm.AT||e===Qm.BRACKET_L||e===Qm.BRACKET_R||e===Qm.BRACE_L||e===Qm.PIPE||e===Qm.BRACE_R}(e)?'"'.concat(e,'"'):e}var bg=new Map,yg=new Map,wg=!0,Eg=!1;function _g(e){return e.replace(/[\s,]+/g," ").trim()}function xg(e){var t=new Set,n=[];return e.definitions.forEach((function(e){if("FragmentDefinition"===e.kind){var r=e.name.value,o=_g((a=e.loc).source.body.substring(a.start,a.end)),i=yg.get(r);i&&!i.has(o)?wg&&console.warn("Warning: fragment with name "+r+" already exists.\ngraphql-tag enforces all fragment names across your application to be unique; read more about\nthis in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"):i||yg.set(r,i=new Set),i.add(o),t.has(o)||(t.add(o),n.push(e))}else n.push(e);var a})),h(h({},e),{definitions:n})}function Sg(e){var t=_g(e);if(!bg.has(t)){var n=function(e,t){return new mg(e,t).parseDocument()}(e,{experimentalFragmentVariables:Eg});if(!n||"Document"!==n.kind)throw new Error("Not a valid GraphQL document.");bg.set(t,function(e){var t=new Set(e.definitions);t.forEach((function(e){e.loc&&delete e.loc,Object.keys(e).forEach((function(n){var r=e[n];r&&"object"==typeof r&&t.add(r)}))}));var n=e.loc;return n&&(delete n.startToken,delete n.endToken),e}(xg(n)))}return bg.get(t)}function Og(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];"string"==typeof e&&(e=[e]);var r=e[0];return t.forEach((function(t,n){t&&"Document"===t.kind?r+=t.loc.source.body:r+=t,r+=e[n+1]})),Sg(r)}var Cg,Tg=Og,kg=function(){bg.clear(),yg.clear()},Ng=function(){wg=!1},Ag=function(){Eg=!0},Ig=function(){Eg=!1};(Cg=Og||(Og={})).gql=Tg,Cg.resetCaches=kg,Cg.disableFragmentWarnings=Ng,Cg.enableExperimentalFragmentVariables=Ag,Cg.disableExperimentalFragmentVariables=Ig,Og.default=Og;const Pg=e=>"string"==typeof e?Og(e):e;function Rg(e){return new F((t=>{const n=e.then((e=>e.subscribe(t))).catch((()=>t.unsubscribe()));return function(){t.unsubscribe(),n.then((e=>null==e?void 0:e.unsubscribe())).catch((e=>console.log(e)))}}))}const Dg=at`
|
|
133
133
|
query Extensions($first: Int!, $extensionIDs: [String!]!, $extensionManifestFields: [String!]!) {
|
|
134
134
|
extensionRegistry {
|
|
135
135
|
extensions(first: $first, extensionIDs: $extensionIDs) {
|