@sourcegraph/code-host-integration 0.0.80 → 0.0.81
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.
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
alwaysNil
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
`,variables:{...e,source:Gn.CODEHOSTINTEGRATION,argument:e.argument&&JSON.stringify(e.argument),publicArgument:e.publicArgument&&JSON.stringify(e.publicArgument)},mightContainPrivateInfo:!1}).subscribe({error:e=>{}})})({name:e,userCookieID:await this.getAnonUserID(),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){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 Bp={allowErrorReporting:!1,sendTelemetry:!0,experimentalLinkPreviews:!1,experimentalTextFieldCompletion:!1,clickToGoToDefinition:!1},qp=({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:Bp[t]},async toggle(n){const r=await e(n);return await t(n,!r),!r}});const $p=qp({get:async function(e){const{featureFlags:t={}}=await Tt.sync.get();return t[e]},set:async function(e,t){const{featureFlags:n}=await Tt.sync.get("featureFlags");await Tt.sync.set({featureFlags:{...n,[e]:t}})}}),zp=qp({get:async e=>{const t=localStorage.getItem(e);return null===t?void 0:"true"===t},set:async(e,t)=>{localStorage.setItem(e,String(t))}}),Vp=Mt?zp:$p,Hp={sendTelemetry:!1,allowErrorReporting:!1,experimentalLinkPreviews:!1,experimentalTextFieldCompletion:!1,clickToGoToDefinition:!1},Gp=e=>({...Hp,...e}),Wp=()=>(Lt?At("sync","featureFlags"):Z(void 0)).pipe(J(Gp));function Qp(e){return Wp().pipe(J((t=>t[e])),Zo())}const Kp=e=>Ct(e).pipe(J((t=>!(xt()&&e)||!kt(t)))),Zp=e=>qo([Kp(e),Qp("sendTelemetry")]).pipe(J((([e,t])=>!!e||t)));function Yp(){const{host:e,pathname:t}=location,[n,r]=t.slice(1).split("/");if(!n||!r)throw new Qr(`Could not parse repoName from Bitbucket Cloud url: ${location.href}`);return`${e}/${n}/${r}`}const Jp={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){let e=parseInt(o.dataset.lineNum??"",10);if(!isNaN(e))return e;if(e=parseInt(o.textContent?.trim()??"",10),!isNaN(e))return e}throw new Error("Could not find line number")},getLineElementFromLineNumber:Xp,getCodeElementFromLineNumber:(e,t)=>{const n=Xp(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 Xp(e,t){let n=e.querySelector(`[data-line-num="${t}"]`);if(!n)for(const r of e.querySelectorAll(".line-number")){if(parseInt(r.textContent??"",10)===t){n=r;break}}if(!n)return console.error(`Could not find line number element for line #${t}`),null;const r=[...e.querySelectorAll(".line-number")].findIndex((e=>e===n)),o=e.querySelectorAll(".view-line")[r];return o||console.error(`Could not find line element for line #${t}`),o}function ed(e,t,n){const r=e.querySelector(`[aria-label="${"base"===n?"From":"To"} line ${t}"]`)?.closest(".line-wrapper")?.querySelector(".code-component");if(!r)throw new Error(`Could not locate line number element for line ${t}, part: ${String(n)}`);return r}const td={getCodeElementFromTarget:e=>e.closest(".code-diff"),getLineNumberFromCodeElement:e=>{const t=e.closest(".line-wrapper")?.querySelectorAll(".line-number-permalink");if(!t||0===t.length)throw new Error("Could not find line number permalink(s) for code element");const n=t[t.length-1],r=parseInt(n.textContent??"",10);if(!isNaN(r))return r;throw new Error("Could not find line number for code element")},getLineElementFromLineNumber:ed,getCodeElementFromLineNumber:(e,t,n)=>ed(e,t,n)?.querySelector(".code-diff"),getDiffCodePart:e=>{const t=e.closest(".code-component")?.querySelector(".line-type");if(t?.textContent?.includes("+"))return"head";if(t?.textContent?.includes("+"))return"base";if(!e.closest(".side-by-side"))return"head";const n=e.closest(".line-wrapper");if(n?.id)return n?.id.includes("oldline")?"base":"head";return 0===[...n?.parentElement?.childNodes||[]].findIndex((e=>e===n))?"base":"head"},isFirstCharacterDiffIndicator:()=>!1};function nd(e,t,n){const r=e.querySelector(`[data-${"base"===n?"f":"t"}num="${t}"]`)?.closest(".udiff-line");if(!r)throw new Error(`Could not locate line number element for line ${t}, part: ${String(n)}`);return r}const rd={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=n?.dataset.tnum;if(r){const e=parseInt(r,10);if(!isNaN(e))return e}const o=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:nd,getCodeElementFromLineNumber:(e,t,n)=>nd(e,t,n)?.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},od=e=>e.replace("//","/"),id=["modified","renamed","removed","added"];function sd(){const e=Yp(),t=location.pathname.match(/src\/(.*?)\/(.*)/);if(!t)throw new Error("Unable to determine revision or file path");const n=decodeURIComponent(t[1]);return{blob:{rawRepoName:e,revision:n,filePath:decodeURIComponent(t[2]),commitID: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}()??n}}}function ad(e){const t=Yp(),n=function(e){const t=[...e.querySelectorAll('[data-qa="bk-file__header"] span')];for(const e of t)for(const t of id)if(e.textContent?.toLowerCase().includes(t))return t;return"modified"}(e),{base:r,head:o}=function(e,t){const n=e.querySelector('[data-qa="bk-filepath"]')?.cloneNode(!0),r=n?.textContent;if(!(n instanceof HTMLElement&&r))throw new Error("Could not find breadcrumbs component for code view");if("added"===t)return{head:r};if("removed"===t)return{base:r};if("modified"===t)return{base:r,head:r};const o="<>SEPARATOR<>",i=n.querySelectorAll('[aria-label="arrow"]');for(const e of i)e.textContent=o;const[s,a,l]=n.textContent.split(/[{}]/),[c,u]=a.split(o);return{base:od(s+c+l),head:od(s+u+l)}}(e,n),{baseRevision:i,headRevision:s}=function(){const e=document.querySelector('[data-qa="pr-branches-and-state-styles"]');if(!e)throw new Error("Could not find branches element");const t=[...e.querySelectorAll('[aria-hidden="true"]')];if(2!==t.length)throw new Error("Expected source and destination branch elements");const n=t[0].textContent??"";return{baseRevision:t[1].textContent??"",headRevision:n}}();return"added"===n?{head:{rawRepoName:t,filePath:o,commitID:s,revision:s}}:"removed"===n?{base:{rawRepoName:t,filePath:r,commitID:i,revision:i}}:{head:{rawRepoName:t,filePath:o,commitID:s,revision:s},base:{rawRepoName:t,filePath:r,commitID:i,revision:i}}}function ld(e){const t=Yp(),n=function(e){const t=e.querySelector(".diff-entry-lozenge");for(const e of id)if(t?.textContent?.toLowerCase().includes(e))return e;return"modified"}(e),{head:r,base:o}=function(e,t){const n=e.querySelector(".filename")?.cloneNode(!0);if(!n)throw new Error("Could not find breadcrumbs component for code view");for(const e of n.childNodes)e instanceof HTMLSpanElement&&(e.textContent=null);const r=n.textContent.trim();if("added"===t)return{head:r};if("removed"===t)return{base:r};if("modified"===t)return{base:r,head:r};const[o,i,s]=r.split(/[{}]/).map((e=>e.trim())),[a,l]=i.split("\u2192").map((e=>e.trim()));return{base:od(o+a+s),head:od(o+l+s)}}(e,n),{baseCommitID:i,headCommitID:s}=function(){const e=document.querySelector('[title="Parent commit"]')?.href.match(/\/commits\/(.*)/);if(!e)throw new Error("Could not determine base commit ID");const t=e[1],n=window.location.href.match(/\/commits\/(.*)/);if(!n)throw new Error("Could not determine head commit ID");return{baseCommitID:t,headCommitID:n[1]}}();return"added"===n?{head:{rawRepoName:t,filePath:r,commitID:s}}:"removed"===n?{base:{rawRepoName:t,filePath:o,commitID:i}}:{head:{rawRepoName:t,filePath:r,commitID:s},base:{rawRepoName:t,filePath:o,commitID:i}}}const cd="codeHost-module__icon_3KtzB",ud="codeHost-module__commit-container_8Jft-";function fd(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 pd(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(ud);const r=document.createElement("div");return r.classList.add("sg-toolbar-mount"),n.prepend(r),r}const dd={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:fd,dom:td,resolveFileInfo:ad}:{element:e,getToolbarMount:fd,dom:Jp,resolveFileInfo:sd}},{selector:".bb-udiff",resolveView:e=>({element:e,getToolbarMount:pd,dom:rd,resolveFileInfo:ld})}],getContext:async function(){const e=Yp();return Promise.resolve({rawRepoName:e,revision:"",privateRepository:!1})},getViewContextOnSourcegraphMount:function(e){const t="open-on-sourcegraph",n=Ro(e,'[data-qa="page-header-wrapper"] > div > div');if(!n)return null;let r=n.querySelector("#open-on-sourcegraph");if(r)return r;r=document.createElement("span"),r.id=t;const o=n.childNodes[1]?.childNodes[1].firstChild;return o instanceof HTMLElement?o.append(r):n.append(r),r},check:function(){return"bitbucket.org"===location.hostname},viewOnSourcegraphButtonClassProps:{className:"codeHost-module__open-on-sourcegraph_10lR9",iconClassName:cd},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:cd},hoverOverlayClassProps:{className:"codeHost-module__hover-overlay_2e1lQ",closeButtonClassName:"codeHost-module__close_2lJ85",badgeClassName:"codeHost-module__badge_16Tsk",actionItemClassName:"codeHost-module__hover-overlay-action-item_39z-G",iconClassName:cd,contentClassName:"codeHost-module__content_eSBN7"},notificationClassNames:{1:"",2:"",3:"",4:"",5:""},codeViewsRequireTokenization:!0,observeLineSelection:Vo(window,"hashchange").pipe(ko(void 0),J((()=>(e=>{if(e.startsWith("#")&&(e=e.slice(1)),!/^lines-\d+(:\d+)?$/.test(e))return{};const t={},[n,r]=e.slice("lines-".length).split(":");return t.line=parseInt(n,10),r&&(t.endLine=parseInt(r,10)),t})(window.location.hash))))},hd=(e,t)=>n=>s()(e[n],t),md=/\/projects\/([^/]+)\/repos\/([^/]+)\//;const gd=(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},bd={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:gd,getCodeElementFromLineNumber:(e,t)=>gd(e,t).querySelector('.CodeMirror-line span[role="presentation"]')},yd=(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)}`)},vd={getCodeElementFromTarget:bd.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:yd,getCodeElementFromLineNumber:(e,t,n)=>yd(e,t,n).querySelector('.CodeMirror-line span[role="presentation"]'),getDiffCodePart:e=>{if(!document.querySelector(".side-by-side-diff"))return e.closest(".line").classList.contains("removed")?"base":"head";return e.closest(".diff-editor").previousElementSibling?.classList.contains("segment-connector-column")?"head":"base"},isFirstCharacterDiffIndicator:()=>!1},wd=(e,t,n)=>{for(const r of e.querySelectorAll(".diff-line-number")){const e=r.textContent?.trim().split(" ")[0];if(!e)continue;const o=parseInt(e,10);if(!isNaN(o)&&o===t){const e=r.closest("tr")?.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)}`)},Ed={getCodeElementFromTarget:e=>e.closest(".diff-line"),getLineNumberFromCodeElement:e=>{const t=e.closest("tr")?.querySelector(".diff-gutter .diff-line-number");if(t){const e=parseInt((t.textContent||"").trim(),10);if(!isNaN(e))return e}throw new Error("Could not find line number element for code element")},getDiffCodePart:e=>{const t=e.closest("tr")?.querySelectorAll(".diff-line");if(!t||0===t.length)throw new Error("Could not find diff lines for code element");if(1===t.length)return e.classList.contains("added-line")?"head":"base";const[n,r]=t;return e===n?"base":e===r?"head":e.classList.contains("removed-line")?"base":"head"},getLineElementFromLineNumber:wd,getCodeElementFromLineNumber:wd};var _d=o(11570),xd=o.n(_d);const Sd=(e,t,n)=>`${window.AJS?window.AJS.contextPath():window.location.origin}/rest/api/1.0/projects/${encodeURIComponent(e)}/repos/${t}${n}`,Cd=e=>Y(e,{selector:e=>Je(e).json()}),Od=We((({project:e,repoSlug:t,prID:n})=>Cd(Sd(e,t,`/pull-requests/${n}`)).pipe(J((({fromRef:e,toRef:t})=>({baseCommitID:t.latestCommit,headCommitID:e.latestCommit}))))),(({prID:e})=>e.toString())),Nd=We((({project:e,repoSlug:t,commitID:n})=>Cd(Sd(e,t,`/commits/${n}`)).pipe(J((({parents:e})=>xd()(e))),wt(hs),J((({id:e})=>e)))),(({project:e,repoSlug:t,commitID:n})=>`${e}:${t}:${n}`)),kd=["a.raw-view-link","a.source-view-link","a.mode-source"],Td=({repoSlug:e,project:t})=>[window.location.hostname,t,e].join("/"),Ad=e=>{const t=[];for(const n of kd)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[,s,a,l]=i,c=r.searchParams.get("at");if(!c)throw new Error(`href of link matching selector ${n} did not have 'at' search param: ${r.href}`);const u=c.match(/refs\/heads\/(.*?)$/),f=u?u[1]:c;return{rawRepoName:Td({repoSlug:a,project:s}),filePath:decodeURIComponent(l),revision:f,project:s,repoSlug:a}}catch(e){t.push(e);continue}throw nt(t)},Id=(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},Rd=e=>{const{rawRepoName:t,filePath:n,revision:r,project:o,repoSlug:i}=Ad(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}},Pd=({codeViewElement:e})=>e.querySelector(".change-type-lozenge"),Dd=({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-/,"")},Ld=({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 Sc.join(Sc.dirname(e),n[1])}}throw new Error(`Unexpected change type "${t}"`)}},Md=e=>{const t=e.querySelector(".breadcrumbs")??e.querySelector(".file-breadcrumbs");if(!t)throw new Error("Could not find diff code view breadcrumbs element through selector .breadcrumbs");const n=t.textContent;if(!n)throw new Error("Unexpected empty file path in breadcrumbs");const r=location.pathname.match(/\/projects\/(.*?)\/repos\/(.*?)\//);if(!r)throw new Error("Location did not match regexp");const[,o,i]=r,s=Td({project:o,repoSlug:i}),a=Pd({codeViewElement:e}),l=Dd({changeTypeElement:a});return{changeType:l,rawRepoName:s,filePath:n,baseFilePath:Ld({changeTypeElement:a,changeType:l,filePath:n})||n,project:o,repoSlug:i}};const jd=e=>{const t=Md(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 Od({...t,prID:i}).pipe(J((({headCommitID:e,baseCommitID:t})=>({head:{rawRepoName:n,filePath:r,commitID:e},base:{rawRepoName:n,filePath:o,commitID:t}}))))},Fd="codeHost-module__command-palette-button_1LPsz",Ud="codeHost-module__command-palette-popover_wqnFp",Bd="codeHost-module__no-results_3Di26",qd="codeHost-module__open-on-sourcegraph_i9J2G",$d="codeHost-module__sg-toolbar-mount_2Fbz5",zd="codeHost-module__code-view-toolbar_IVqgq",Vd="codeHost-module__action-nav-item_223JV",Hd="codeHost-module__action-nav-item-new-diff_23eTl",Gd="codeHost-module__action-item-new-diff_3Tuv4",Wd="codeHost-module__hover-action-item_9CC-W",Qd="codeHost-module__command-list-popover-button_3eptU",Kd=(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($d),r.prepend(o),o},Zd=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 s=t===rs.ActualToCodeView?-1:1;return Z({line:r.line,character:r.character+s*i})},Yd={getToolbarMount:Kd,dom:bd,resolveFileInfo:e=>({blob:Rd(e)}),getPositionAdjuster:()=>Zd(bd)},Jd={getToolbarMount:Kd,dom:vd,getPositionAdjuster:()=>Zd(vd),overrideTokenize:!0},Xd={...Jd,resolveFileInfo:e=>{const{changeType:t,rawRepoName:n,filePath:r,commitID:o,baseFilePath:i,revision:s,...a}=(e=>{const{rawRepoName:t,project:n,repoSlug:r,filePath:o}=Ad(e),i=Id(),s=Pd({codeViewElement:e}),a=Dd({changeTypeElement:s});return{changeType:a,rawRepoName:t,filePath:o,baseFilePath:Ld({changeTypeElement:s,changeType:a,filePath:o})||o,commitID:i,project:n,repoSlug:r}})(e);return"ADD"===t?Z({head:{rawRepoName:n,filePath:r,commitID:o}}):Nd({commitID:o,...a}).pipe(J((e=>"DELETE"===t?{base:{rawRepoName:n,filePath:i,commitID:e}}:{base:{rawRepoName:n,filePath:i,commitID:e},head:{rawRepoName:n,filePath:r,commitID:o}})))}},eh={...Jd,resolveFileInfo:jd},th={...Jd,resolveFileInfo:e=>{const{rawRepoName:t,filePath:n,baseFilePath:r}=Md(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}}}},nh={...Jd,resolveFileInfo:e=>(e=>{const t=Id(".commit-badge-oneline .commitid"),n=Id(".commit-parents .commitid"),{rawRepoName:r,filePath:o,baseFilePath:i}=Md(e);return{head:{rawRepoName:r,filePath:o,commitID:t},base:{rawRepoName:r,filePath:i,commitID:n}}})(e)},rh={selector:".change-view",resolveView:e=>({element:e,...oh})},oh={resolveFileInfo:jd,getToolbarMount:e=>Kd(e,".change-header .diff-actions"),toolbarButtonProps:{listItemClass:Hd,actionItemClass:Gd},dom:Ed};const ih="aui-icon",sh={[cu]:"aui-message aui-message-info",[uu]:"aui-message aui-message-success",[lu]:"aui-message aui-message-info",[au]:"aui-message aui-message-warning",[su]:"aui-message aui-message-error"},ah={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,...th};if((({pathname:e})=>/\/projects\/[^/]+\/repos\/[^/]+\/commits\/\w+$/.test(e))(window.location))return{element:e,...nh};if(e.querySelector(".mode-toggle")){return t.classList.contains("diff-view")?{element:e,...Xd}:{element:e,...Yd}}return(({pathname:e})=>/\/projects\/[^/]+\/repos\/[^/]+\/pull-requests\/\d+/.test(e))(window.location)?{element:e,...eh}:(console.error("Unknown code view",e),null)}},rh],getCommandPaletteMount:e=>{const t=Ro(e,".aui-header-primary .aui-nav");if(!t)return null;const n=["command-palette-button",Fd];return t.querySelector(n.map((e=>`.${e}`)).join(""))||(()=>{const e=document.createElement("li");return e.className=n.join(" "),t.append(e),e})()},notificationClassNames:sh,commandPaletteClassProps:{buttonClassName:s()(Qd,"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:s()(Ud,"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:Bd,iconClassName:ih},codeViewToolbarClassProps:{className:s()(zd,"aui-buttons"),actionItemClass:"aui-button",actionItemIconClass:"aui-icon",listItemClass:Vd},hoverOverlayClassProps:{className:"aui-dialog",actionItemClassName:s()("aui-button",Wd),getAlertClassName:hd(sh),iconClassName:ih},getViewContextOnSourcegraphMount:function(e){const t=Ro(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=qd,t.append(r),r},getContext:async function(){const e=function(e){const{hostname:t,pathname:n}=e,r=n.match(md);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(){const e=document.querySelector("#repository-layout-revision-selector .name[data-revision-ref]");if(!e)throw new Error("branchNameElement not found");const t=e.getAttribute("data-revision-ref");let n=null;if(t)try{n=JSON.parse(t)}catch{throw new Error(`Could not parse revisionRefStr: ${t}`)}if(n?.latestCommit)return{revision:n.latestCommit};throw new Error(`revisionRefInfo is empty or has no latestCommit (revisionRefStr: ${String(t)})`)}()}catch{}return Promise.resolve({...e,...t,privateRepository:"bitbucket.org"!==window.location.hostname})},viewOnSourcegraphButtonClassProps:{className:"aui-button",iconClassName:ih},codeViewsRequireTokenization:!1,observeLineSelection:Vo(window,"hashchange").pipe(ko(void 0),J((()=>(e=>{if(e.startsWith("#")&&(e=e.slice(1)),!/^\d+(-\d+)?$/.test(e))return{};const t={},[n,r]=e.split("-");return t.line=parseInt(n,10),r&&(t.endLine=parseInt(r,10)),t})(window.location.hash))))};var lh=o(65291),ch=o.n(lh),uh=o(92674),fh=o.n(uh),ph=o(26416),dh=o.n(ph);function hh(e){return new L((function(t){var n;try{n=e()}catch(e){return void t.error(e)}return(n?W(n):Ce()).subscribe(t)}))}function mh(e){return t=>hh((()=>{const n=new Map;return t.pipe(Ne(Bt),yt(),ze((({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))}})),ht((t=>W(t.addedNodes).pipe(wt(ds(HTMLElement)),ht((t=>W(e).pipe(ht((({selector:e,resolveView:n})=>[...gh(t,e)].map((e=>{const t=n(e);return t&&{...t,subscriptions:new N}})))),wt(hs),wt((e=>!n.has(e.element))),ze((e=>{n.set(e.element,e)})))))))))}))}function gh(e,t){if("string"==typeof t)return Io(e,t);return t(e)||[]}const bh=/patchset (\d+)/i;function yh(e,t){return`refs/changes/${e.slice(-2).padStart(2,"0")}/${e}/${t}`}function vh(e){return Th(document.body,e)?.textContent??void 0}function wh(e){const t=bh.exec(e);if(t?.[1])return t[1]}function Eh(){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],s=e.slice(n+3).join("/"),a=window.location.hostname+"/"+r,{basePatchsetId:l,headPatchsetId:c}=function(){const e=vh("#app >> #app-element >> gr-change-view >> #fileListHeader >> #rangeSelect >> #basePatchDropdown >> #triggerText")??vh("#app >> #app-element >> gr-diff-view >> #rangeSelect >> #basePatchDropdown >> #triggerText"),t=vh("#app >> #app-element >> gr-change-view >> #fileListHeader >> #rangeSelect >> #patchNumDropdown >> #triggerText")??vh("#app >> #app-element >> gr-diff-view >> #rangeSelect >> #patchNumDropdown >> #triggerText");return{basePatchsetId:e&&wh(e),headPatchsetId:t&&wh(t)}}();return{repoName:a,changeId:o,patchsetId:c||i,filePath:s,basePatchsetId:l}}const _h={selector(e){if(e.matches("#diffTable"))return[e];const t=Th(document,"#app >> #app-element >> gr-change-view >> #fileList")?.shadowRoot?.querySelectorAll(".file-row.expanded"),n=[...t||[]].map((e=>{const t=e.parentElement;if(t)return Th(t,"gr-diff-host >> gr-diff >> #diffTable")}));return dh()(n)},resolveView(e){const t=Ah(e,".stickyArea");if(!t)return null;const n=t.querySelector(".file-row")?.getAttribute("data-path");if(!n)return null;const r=Eh();if(!r.patchsetId)return console.error("Sourcegraph: Cannot get Gerrit patchset ID"),null;const o=yh(r.changeId,r.patchsetId);let i;return i=r.basePatchsetId?yh(r.changeId,r.basePatchsetId):function(){const e=Th(document.body,"#app >> #app-element >> gr-change-view >> #metadata >> gr-commit-info");if(!e)return null;return e?.shadowRoot?.querySelector(".container")?.textContent?.trim()}()||o+"^",Rh(e),{element:e,dom:Sh,resolveFileInfo(){const e={base:{filePath:n||"",rawRepoName:r.repoName,commitID:i},head:{filePath:n||"",rawRepoName:r.repoName,commitID:o}};return console.log("resolveFileListCodeView: fileInfo",e),e}}}},xh=(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){const n=[...e.parentElement?.childNodes||[]],r=n.slice(n.indexOf(e)+1);for(const e of r)if(e instanceof HTMLElement&&e.matches(t))return e;return null}(o,"td.content")?.querySelector(".contentText");return i},Sh={getLineElementFromLineNumber:xh,getCodeElementFromLineNumber:xh,getCodeElementFromTarget:e=>{const t=e.closest("td.content"),n=t?.closest("tr")?.querySelector("[data-line-number]");if(n){if("FILE"===n.getAttribute("data-line-number"))return null}return t},getLineNumberFromCodeElement:e=>{const t=kh(e);if(!t)throw console.error(e),new TypeError("Could not find line number (no side)");const n=e.closest("td")?.parentElement?.querySelector(`.lineNum.${t}`),r=n?.getAttribute("data-value");if(!r)throw new TypeError(`Could not find line number (${t})`);return parseInt(r,10)},getDiffCodePart:e=>{const t=kh(e);return"left"===t?"base":"right"===t?"head":(console.error("Cannot tell: base or head"),"base")}},Ch=[{selector(e){const t=Th(document.body,"#app >> #app-element >> gr-diff-view >> #diffHost >> #diff >> #diffTable");return t?[t]:[]},resolveView(e){const t=Eh();if(!t.patchsetId)return console.error("Sourcegraph: cannot find patchset ID"),null;const n=yh(t.changeId,t.patchsetId);let r=n+"^";return t.basePatchsetId&&(r=yh(t.changeId,t.basePatchsetId)),Rh(e),{element:e,dom:Sh,getToolbarMount(e){const t=function(e){const t=Ah(e,"gr-diff-view")?.shadowRoot?.querySelector("gr-fixed-panel .subHeader");return t}(e)?.querySelector(".patchRangeLeft");if(!t)throw new Error("Could not find subheader");const n=t.querySelector(".sourcegraph-toolbar-mount");if(n)return n;const r=document.createElement("div");return r.classList.add("sourcegraph-toolbar-mount"),t.append(r),t.append(Ih(Ph)),r},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}}}},_h],Oh={type:"gerrit",name:"Gerrit",codeViewResolvers:Ch,contentViewResolvers:[],nativeTooltipResolvers:[],codeViewsRequireTokenization:!0,observeMutations:(e,t,n)=>{let r=[];return lp(1500).pipe(J((()=>{const{filePath:e=""}=Eh(),t=[...Ch.map((e=>e.selector)),Nh].map((e=>[...gh(document.body,e)])).flat(),n=t.filter((t=>!fh()(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=>!fh()(o,e))),{addedNodes:n,removedNodes:o.map((e=>e.element))}})),wt((({addedNodes:e,removedNodes:t})=>!!e.length||!!t.length)),J((e=>[e])),qe(),Pe())},getContext:async()=>{const{repoName:e,changeId:t,patchsetId:n}=Eh();return Promise.resolve({privateRepository:!0,rawRepoName:e,revision:n&&yh(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=ch()(Nh(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(Ih(Ph)),r}},Nh=()=>{const e=Th(document.body,"#app >> #app-element >> gr-change-view >> #actions >> #secondaryActions");return e?[e]:null};function kh(e){if("unified"===function(e){return e.closest("tr")?.matches(".unified")?"unified":"side-by-side"}(e)){const t=e.closest("tr")?.querySelector("td.right")?.getAttribute("data-value");return t?"right":"left"}return e.closest("td")?.previousElementSibling?.matches(".right")?"right":"left"}function Th(e,t){"string"==typeof t&&(t=t.split(">>"));let n=e;const r=t.slice(0,-1),o=t[t.length-1];for(const e of r){if(!n)return null;n=n.querySelector(e)?.shadowRoot||null}return n?.querySelector(o)}function Ah(e,t){for(;;){const n=e.closest(t);if(n)return n;if(e=e.getRootNode()?.host,!e||e===document.getRootNode())return null}}function Ih(e){const t=document.createElement("style");return t.textContent=e,t}function Rh(e){if(!e.querySelector("style.sourcegraph-injected-style")){const t=Ih(Dh);t.classList.add("sourcegraph-injected-style"),e.append(t)}}const Ph="\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",Dh="\n.sourcegraph-document-highlight {\n background-color: var(--secondary);\n}\n.selection-highlight {\n background-color: var(--mark-bg);\n}\n";var Lh=o(36021),Mh=o.n(Lh);const jh=(e,t)=>({selector:e,resolveView:e=>({...t,element:e})}),Fh=(e,t,n)=>((e,t)=>{const{repoName:n,commitID:r}=e;return Jr({repoName:n,revision:r,requestGraphQL:t}).pipe(Xr())})(e,n).pipe(ae((()=>eo({repoName:e.repoName,filePath:e.filePath,commitID:e.commitID,requestGraphQL:n}))),J((t=>t?{...e,content:t.join("\n")}:{...e})),ue((n=>W(t(n)).pipe(ae((t=>{if(t)return Z(e);throw n}))))));function Uh(){return Qt(jr(window.location.hash))}function Bh(){return Vo(window,"hashchange").pipe(J(Uh),Zo(((e,t)=>Do()(e,t))))}function qh(e){const t=e.title.split(" \u2192 ");return t.length>1?{headFilePath:t[1],baseFilePath:t[0]}:{headFilePath:t[0],baseFilePath:t[0]}}function $h(e){const{pageType:t}=Wh();if(!Gh(t))return null;let n="",r="";if("pull"===t){const t=document.querySelector("details-menu[src*='sha1='][src*='sha2=']")?.getAttribute("src"),o=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(o){const t=function(e){const t=e.querySelector(`summary a[href^="${location.pathname}"`);if(!t)return null;const n=t.href.match(zh);if(!n)return null;const r=n[3],o=Vh(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?Vh(document.documentElement.innerHTML,"pull"===t):{baseCommitID:n,headCommitID:r}}const zh=/\/files\/((\w+)\.\.)?(\w+)#diff-\w+$/;function Vh(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 Hh(){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 Gh(e){switch(e){case"commit":case"pull":case"compare":return!0;default:return!1}}function Wh(e=window.location){const{host:t,pathname:n}=e,[r,o,i,...s]=n.slice(1).split("/");if(!r||!o)throw new Qr(`Could not parse repoName from GitHub url: ${e.href}`);const a=`${r}/${o}`,l=`${t}/${a}`;switch(i){case"blob":case"tree":return{pageType:i,rawRepoName:l,revisionAndFilePath:decodeURIComponent(s.join("/")),repoName:a};case"pull":case"commit":case"compare":return{pageType:i,rawRepoName:l,repoName:a};default:return{pageType:"other",rawRepoName:l,repoName:a}}}const Qh=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")},Kh=e=>{const t=e.closest("td.blob-code");return!t||t.parentElement?.classList.contains("js-expandable-line")?null:t},Zh=(e,t,n)=>{const r=rm(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 s;if(r)s=i.nextElementSibling;else{s=i.parentElement.lastElementChild}return s},Yh=e=>e.classList.contains("blob-code-inner")?e:e.querySelector(".blob-code-inner"),Jh={getCodeElementFromTarget:e=>{const t=Kh(e);return t&&Yh(t)},getLineElementFromLineNumber:Zh,getCodeElementFromLineNumber:(e,t,n)=>{const r=Zh(e,t,n);return r&&Yh(r)},getLineNumberFromCodeElement:Qh,getDiffCodePart:e=>{const t=e.closest("td");return t.classList.contains("blob-code-addition")?"head":t.classList.contains("blob-code-deletion")||rm(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")?.querySelector("td[data-code-marker]"),o=t?.hasAttribute("data-code-marker"),i=r||o,s=e.closest(".refined-github-diff-signs");return!n&&!i&&!s}},Xh=(e,t)=>{const n=e.querySelector(`td[data-line-number="${t}"]`);return n&&n.nextElementSibling},em={getCodeElementFromTarget:Kh,getCodeElementFromLineNumber:Xh,getLineElementFromLineNumber:Xh,getLineNumberFromCodeElement:Qh},tm=(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},nm={getCodeElementFromTarget:Kh,getCodeElementFromLineNumber:tm,getLineElementFromLineNumber:tm,getLineNumberFromCodeElement:e=>{const t=e.closest("td").previousElementSibling;return parseInt(t.firstElementChild.textContent,10)}};function rm(e){const{pageType:t}=Wh();if(!Gh(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 om=()=>{const e=Wh();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=Hh(),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:To({selector:".js-permalink-shortcut",hrefRegex:/^\/.*?\/.*?\/(?:blob|tree)\/([\da-f]{40})/})}}},im=/\/([\da-f]{40})$/i,sm=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(im);if(!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),s=Wh(i);if("blob"!==s.pageType)throw new Error(`Snippet URL does not match a blob url: ${i.href}`);const{revisionAndFilePath:a,rawRepoName:l}=s;if(!a.startsWith(r))throw new Error(`Could not parse filePath: revAndFilePath ${a} does not start with commitID ${r}`);return{blob:{rawRepoName:l,filePath:a.slice(r.length+1),commitID:r,revision:r}}},am=["tooltipped","tooltipped-n"];const lm="codeHost-module__command-palette-popover_xVrp2",cm="codeHost-module__command-palette-action-item_16BFG",um="codeHost-module__action-item_7QWb2",fm="codeHost-module__icon_3PdA7",pm="codeHost-module__code-view-toolbar_gOzAp",dm="codeHost-module__code-view-toolbar-item_2fTzz",hm="codeHost-module__hover-overlay-badge_3wpZt";function mm(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 gm={dom:Jh,getToolbarMount:mm,resolveFileInfo:e=>{const{rawRepoName:t}=Wh(),{headFilePath:n,baseFilePath:r}=function(e){const t=e.querySelector(".file-info");if(t){if("A"===t.tagName)return qh(t);const e=t.querySelector(".diffstat + a");if(e)return qh(e)}const n=e.querySelector(".file-header a");if(n)return qh(n);throw new Error("Could not determine diff file name")}(e);if(!n)throw new Error("cannot determine file path");const o=$h(e);if(!o)throw new Error("cannot determine delta info");const{headCommitID:i,baseCommitID:s}=o;return{head:{rawRepoName:t,filePath:n,commitID:i,revision:i},base:{rawRepoName:t,filePath:r||n,commitID:s,revision:s}}},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]}},bm={...gm,getToolbarMount:void 0},ym={dom:em,getToolbarMount:mm,resolveFileInfo:om,getSelections:Uh,observeSelections:Bh},vm=e=>({direction:t,codeView:n,position:r})=>eo({...r,requestGraphQL:e}).pipe(J((e=>{const o=em.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],s=o.textContent||"",a=i.length-Mh()(i).length,l=s.length-Mh()(s).length,c=t===rs.ActualToCodeView?-1:1,u=Math.abs(a-l)*c;return{line:r.line,character:r.character+u}}))),wm=jh(".code-list-item",{dom:nm,getPositionAdjuster:vm,resolveFileInfo:sm}),Em={dom:em,resolveFileInfo:sm,getPositionAdjuster:vm},_m=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")?.closest(".BtnGroup");if(!o?.parentNode)throw new Error("File actions not found");return o.parentNode.insertBefore(r,o),r},xm={selector:".js-file-line-container",resolveView:e=>{const t=e.closest(".blob-wrapper-embedded");if(t){return{element:t.parentElement,...Em}}const{pageType:n}=Wh();if("blob"!==n)return null;const r=e.closest("#repo-content-turbo-frame");if(!r)throw new Error("Could not find repository content element");return{element:r,...ym,getToolbarMount:_m}}},Sm={selector:e=>{const t=new Set;for(const n of Io(e,".file"))0===n.querySelectorAll(".js-diff-load-container").length&&t.add(n);for(const n of Io(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}=Wh();return"blob"===t&&1===document.querySelectorAll(".file").length&&0===document.querySelectorAll(".diff-view").length?{element:e,...ym}:e.closest(".discussion-item-body")||e.classList.contains("js-comment-container")?{element:e,...bm}:{element:e,...gm}}};function Cm(){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 Om="open-on-sourcegraph",Nm=s()(fm,"v-align-text-bottom"),km={[cu]:"flash",[uu]:"flash flash-success",[lu]:"flash",[au]:"flash flash-warn",[su]:"flash flash-error"},Tm={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})=>{const r="#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"))})(document.querySelector(r)??(()=>{const e=n.cloneNode(!0);e.id=r.replace("#",""),e.classList.remove("navigation-focus"),e.setAttribute("aria-selected","false");const t=document.createElement("img");t.src="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNTIgNTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTMwLjggNTEuOGMtMi44LjUtNS41LTEuMy02LTQuMUwxNy4yIDYuMmMtLjUtMi44IDEuMy01LjUgNC4xLTZzNS41IDEuMyA2IDQuMWw3LjYgNDEuNWMuNSAyLjgtMS40IDUuNS00LjEgNnoiIGZpbGw9IiNGRjU1NDMiLz48cGF0aCBkPSJNMTAuOSA0NC43QzkuMSA0NSA3LjMgNDQuNCA2IDQzYy0xLjgtMi4yLTEuNi01LjQuNi03LjJMMzguNyA4LjVjMi4yLTEuOCA1LjQtMS42IDcuMi42IDEuOCAyLjIgMS42IDUuNC0uNiA3LjJsLTMyIDI3LjNjLS43LjYtMS42IDEtMi40IDEuMXoiIGZpbGw9IiNBMTEyRkYiLz48cGF0aCBkPSJNNDYuOCAzOC4xYy0uOS4yLTEuOC4xLTIuNi0uMkw0LjQgMjMuOGMtMi43LTEtNC4xLTMuOS0zLjEtNi42IDEtMi43IDMuOS00LjEgNi42LTMuMWwzOS43IDE0LjFjMi43IDEgNC4xIDMuOSAzLjEgNi42LS42IDEuOC0yLjIgMy0zLjkgMy4zeiIgZmlsbD0iIzAwQ0JFQyIvPjwvc3ZnPgo=",t.setAttribute("style","width: 16px; height: 20px; float: left; margin-right: 2px;"),t.setAttribute("alt","Sourcegraph Logo Image");const o=e.querySelector(".js-jump-to-badge-search-text-global");return o.textContent="Sourcegraph",o.parentNode?.insertBefore(t,o),n.parentNode?.insertBefore(e,n.nextElementSibling),e})())}},Am=async(e,t=Jf.fetchCache,n="#repository-container-header h2 span.Label")=>{if("github.com"!==window.location.hostname)return Promise.resolve(!0);try{const{status:n}=await t({url:`https://github.com/${e}`,credentials:"omit",cacheMaxAge:36e5});return 200!==n}catch(e){return console.warn("Failed to fetch if the repository is private.",e),"public"!==document.querySelector(n)?.textContent?.toLowerCase().trim()}},Im=()=>"/search"===window.location.pathname,Rm=()=>"/search/advanced"===window.location.pathname,Pm=()=>!Im()&&window.location.pathname.endsWith("/search"),Dm=()=>Boolean(new URLSearchParams(window.location.search).get("q"))&&!Rm(),Lm=()=>{const e=new URLSearchParams(window.location.search).get("type");return e?e.toLowerCase():""},Mm=e=>{const t=e.filter(Boolean).map((e=>e.trim())),n=(()=>{switch(Lm()){case"repositories":return"repo";case"commits":return"commit";case"code":return"";default:return Im()||Rm()?"repo":""}})(),r=new URLSearchParams(window.location.search).get("l");if(n&&t.push(`type:${n}`),r&&t.push(`lang:${encodeURIComponent(r)}`),Pm()){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("+")},jm=(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 Fm={type:"github",name:Cm()?"GitHub Enterprise":"GitHub",searchEnhancement:Tm,enhanceSearchPage:function(e){if(!(Im()||Rm()||Pm()||Dm()))return;const t=({container:t,className:n="",getSearchQuery:r,utmCampaign:o})=>{const i=Zf(new URL("/search",e),{utm_source:Ot(),utm_campaign:o});(0,Mo.s)(t).render((0,u.jsx)(up,{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:s()("btn","m-auto",n),iconClassName:s()("mr-1","v-align-middle",fm),href:i.href,dataTestId:"search-on-sourcegraph",onClick:e=>{const t=Mm(r());e.target.href=`${i.href}${t?`&q=${t}`:""}`}}))};if(Dm()){const e=Lm();if(["repositories","commits","code"].includes(e)||""===e&&(Im()||Pm())){const e=document.querySelector(".application-main form.js-site-search-form"),n=e?.querySelector("input.form-control[name='q']"),r=e?.parentElement?.parentElement?.querySelector("button[type='submit']");if(n&&r){const e=jm("pageSearchFormSourcegraphButton","ml-2 d-none d-md-block");r.after(e),t({container:e,utmCampaign:"github-search-results-page",getSearchQuery:()=>n.value.split(" ")})}const o=document.querySelector("header form.js-site-search-form input.form-control[name='q']"),i=document.querySelector(".codesearch-results"),s=i?.querySelector(".blankslate"),a=i?.querySelector("div > div > h3");if(o&&(s||a)){const e=jm("headerSearchInputSourcegraphButton","ml-auto d-none d-lg-block");s?(e.classList.add("mt-2"),s.append(e)):a&&(e.classList.add("mr-2"),a.after(e)),t({container:e,className:s?"":"btn-sm",utmCampaign:"github-search-results-page",getSearchQuery:()=>o.value.split(" ")})}}return}const n=document.querySelector("#search_form"),r=n?.querySelector(".search-form-fluid"),o=n?.querySelector("input");if(r&&o){const e=jm("searchInputSourcegraphButton","ml-0 ml-md-2 mt-2 mt-md-0");r?.append(e),t({container:e,utmCampaign:`github-${Rm()?"advanced":"simple"}-search-page`,getSearchQuery:()=>o.value.split(" ")})}},codeViewResolvers:[Sm,xm,wm],contentViewResolvers:[{selector:".markdown-body",resolveView:e=>({element:e})}],nativeTooltipResolvers:[{selector:".js-tagsearch-popover",resolveView:e=>({element:e})}],routeChange:e=>e.pipe(J((()=>{const{pathname:e}=window.location,t=e.slice(1).split("/")[2];return"blob"===t||"tree"===t?e.endsWith(Hh())?e:void 0:Dm()?document.querySelector(".codesearch-results h3")?.textContent?.trim():e})),wt(Boolean),Zo()),getContext:async()=>{const{repoName:e,rawRepoName:t,pageType:n}=Wh();return{rawRepoName:t,revision:"blob"===n||"tree"===n?om().blob.revision:void 0,privateRepository:await Am(e)}},isLightTheme:hh((()=>{const e=document.documentElement.dataset.colorMode;return"auto"===e?((e=window)=>{const t=e.matchMedia("(prefers-color-scheme: dark)");return{observable:vt(Z(!t.matches),Vo(t,"change").pipe(J((e=>!e.matches)))),initialValue:!t.matches}})().observable:Z("dark"!==e)})),getViewContextOnSourcegraphMount:e=>{const t=Ro(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=Om,t.prepend(n),n)},viewOnSourcegraphButtonClassProps:{className:"btn btn-sm tooltipped tooltipped-s",iconClassName:Nm},check:()=>((e=window.location.href)=>/^https?:\/\/(www\.)?github\.com/.test(e))()||Cm(),getCommandPaletteMount:e=>{const t="command-palette-button",n=e.querySelector(`.Header .${t}`)||e.querySelector(`.Header-old .${t}`);if(n)return n;const r=Ro(e,".HeaderMenu > :last-child");if(r){const e=document.createElement("div");return e.classList.add(t),r.prepend(e),e}let o=Ro(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:km,commandPaletteClassProps:{buttonClassName:"Header-link d-flex flex-items-baseline",popoverClassName:s()("Box",lm),formClassName:"p-1",inputClassName:"form-control input-sm header-search-input jump-to-field-active",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:s()(cm,"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:Nm},codeViewToolbarClassProps:{className:pm,listItemClass:s()(dm,"BtnGroup"),actionItemClass:s()("btn btn-sm tooltipped tooltipped-s BtnGroup-item",um),actionItemPressedClass:"selected",actionItemIconClass:s()(fm,"v-align-text-bottom")},hoverOverlayClassProps:{className:"Box",actionItemClassName:"btn btn-sm btn-secondary",actionItemPressedClassName:"active",closeButtonClassName:"btn-octicon p-0 hover-overlay__close-button--github",badgeClassName:s()("label",hm),getAlertClassName:hd(km,"flash-full"),iconClassName:Nm},setElementTooltip:function(e,t){"string"==typeof t?(e.classList.add(...am),e.setAttribute("aria-label",t)):(e.classList.remove(...am),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 zr(e,t);if(!t.rawRepoName.startsWith(window.location.hostname))return zr(e,t);const r=t.revision||"HEAD",{rawRepoName:o}=Wh();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}`},observeLineSelection:Vo(window,"hashchange").pipe(ko(void 0),J((()=>(e=>{const t=e.match(/(L\d+)/g);if(!t||t.length>2)return{};const n={},[r,o]=t.map((e=>e.slice(1)));return n.line=parseInt(r,10),o&&(n.endLine=parseInt(o,10)),n})(window.location.hash)))),codeViewsRequireTokenization:!0};var Um=o(6314);function Bm(){var e=(0,Um.R)(),t=e.crypto||e.msCrypto;if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");var n=t&&t.getRandomValues?()=>t.getRandomValues(new Uint8Array(1))[0]:()=>16*Math.random();return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^(15&n())>>e/4).toString(16)))}var qm=o(91698),$m=(0,Um.R)(),zm=["debug","info","warn","error","log","assert","trace"];function Vm(e){var t=(0,Um.R)();if(!("console"in t))return e();var n=t.console,r={};zm.forEach((e=>{var o=n[e]&&n[e].__sentry_original__;e in t.console&&o&&(r[e]=n[e],n[e]=o)}));try{return e()}finally{Object.keys(r).forEach((e=>{n[e]=r[e]}))}}function Hm(){let e=!1;var t={enable:()=>{e=!0},disable:()=>{e=!1}};return"undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__?zm.forEach((n=>{t[n]=(...t)=>{e&&Vm((()=>{$m.console[n](`Sentry Logger [${n}]:`,...t)}))}})):zm.forEach((e=>{t[e]=()=>{}})),t}let Gm;Gm="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__?(0,Um.Y)("logger",Hm):Hm();var Wm,Qm=o(38241),Km=Object.prototype.toString;function Zm(e,t){return Km.call(e)===`[object ${t}]`}function Ym(e){return Zm(e,"Object")}function Jm(e){return Boolean(e&&e.then&&"function"==typeof e.then)}!function(e){e[e.PENDING=0]="PENDING";e[e.RESOLVED=1]="RESOLVED";e[e.REJECTED=2]="REJECTED"}(Wm||(Wm={}));class Xm{__init(){this._state=Wm.PENDING}__init2(){this._handlers=[]}constructor(e){Xm.prototype.__init.call(this),Xm.prototype.__init2.call(this),Xm.prototype.__init3.call(this),Xm.prototype.__init4.call(this),Xm.prototype.__init5.call(this),Xm.prototype.__init6.call(this);try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}then(e,t){return new Xm(((n,r)=>{this._handlers.push([!1,t=>{if(e)try{n(e(t))}catch(e){r(e)}else n(t)},e=>{if(t)try{n(t(e))}catch(e){r(e)}else r(e)}]),this._executeHandlers()}))}catch(e){return this.then((e=>e),e)}finally(e){return new Xm(((t,n)=>{let r,o;return this.then((t=>{o=!1,r=t,e&&e()}),(t=>{o=!0,r=t,e&&e()})).then((()=>{o?n(r):t(r)}))}))}__init3(){this._resolve=e=>{this._setResult(Wm.RESOLVED,e)}}__init4(){this._reject=e=>{this._setResult(Wm.REJECTED,e)}}__init5(){this._setResult=(e,t)=>{this._state===Wm.PENDING&&(Jm(t)?t.then(this._resolve,this._reject):(this._state=e,this._value=t,this._executeHandlers()))}}__init6(){this._executeHandlers=()=>{if(this._state!==Wm.PENDING){var e=this._handlers.slice();this._handlers=[],e.forEach((e=>{e[0]||(this._state===Wm.RESOLVED&&e[1](this._value),this._state===Wm.REJECTED&&e[2](this._value),e[0]=!0)}))}}}}function eg(e){return tg(e,new Map)}function tg(e,t){if(Ym(e)){if(void 0!==(o=t.get(e)))return o;var n={};for(var r of(t.set(e,n),Object.keys(e)))void 0!==e[r]&&(n[r]=tg(e[r],t));return n}if(Array.isArray(e)){var o;if(void 0!==(o=t.get(e)))return o;n=[];return t.set(e,n),e.forEach((e=>{n.push(tg(e,t))})),n}return e}function ng(e){var t=(0,qm.ph)(),n={sid:Bm(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return eg({sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}(n)};return e&&rg(n,e),n}function rg(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||(0,qm.ph)(),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Bm()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{var n=e.timestamp-e.started;e.duration=n>=0?n:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}class og{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={}}static clone(e){var t=new og;return e&&(t._breadcrumbs=[...e._breadcrumbs],t._tags={...e._tags},t._extra={...e._extra},t._contexts={...e._contexts},t._user=e._user,t._level=e._level,t._span=e._span,t._session=e._session,t._transactionName=e._transactionName,t._fingerprint=e._fingerprint,t._eventProcessors=[...e._eventProcessors],t._requestSession=e._requestSession,t._attachments=[...e._attachments]),t}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{},this._session&&rg(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts={...this._contexts,[e]:t},this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){var e=this.getSpan();return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;if("function"==typeof e){var t=e(this);return t instanceof og?t:this}return e instanceof og?(this._tags={...this._tags,...e._tags},this._extra={...this._extra,...e._extra},this._contexts={...this._contexts,...e._contexts},e._user&&Object.keys(e._user).length&&(this._user=e._user),e._level&&(this._level=e._level),e._fingerprint&&(this._fingerprint=e._fingerprint),e._requestSession&&(this._requestSession=e._requestSession)):Ym(e)&&(e=e,this._tags={...this._tags,...e.tags},this._extra={...this._extra,...e.extra},this._contexts={...this._contexts,...e.contexts},e.user&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint&&(this._fingerprint=e.fingerprint),e.requestSession&&(this._requestSession=e.requestSession)),this}clear(){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._attachments=[],this}addBreadcrumb(e,t){var n="number"==typeof t?Math.min(t,100):100;if(n<=0)return this;var r={timestamp:(0,qm.yW)(),...e};return this._breadcrumbs=[...this._breadcrumbs,r].slice(-n),this._notifyScopeListeners(),this}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this._attachments}clearAttachments(){return this._attachments=[],this}applyToEvent(e,t={}){if(this._extra&&Object.keys(this._extra).length&&(e.extra={...this._extra,...e.extra}),this._tags&&Object.keys(this._tags).length&&(e.tags={...this._tags,...e.tags}),this._user&&Object.keys(this._user).length&&(e.user={...this._user,...e.user}),this._contexts&&Object.keys(this._contexts).length&&(e.contexts={...this._contexts,...e.contexts}),this._level&&(e.level=this._level),this._transactionName&&(e.transaction=this._transactionName),this._span){e.contexts={trace:this._span.getTraceContext(),...e.contexts};var n=this._span.transaction&&this._span.transaction.name;n&&(e.tags={transaction:n,...e.tags})}return this._applyFingerprint(e),e.breadcrumbs=[...e.breadcrumbs||[],...this._breadcrumbs],e.breadcrumbs=e.breadcrumbs.length>0?e.breadcrumbs:void 0,e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...this._sdkProcessingMetadata},this._notifyEventProcessors([...ig(),...this._eventProcessors],e,t)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}_notifyEventProcessors(e,t,n,r=0){return new Xm(((o,i)=>{var s=e[r];if(null===t||"function"!=typeof s)o(t);else{var a=s({...t},n);("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&s.id&&null===a&&Gm.log(`Event processor "${s.id}" dropped event`),Jm(a)?a.then((t=>this._notifyEventProcessors(e,t,n,r+1).then(o))).then(null,i):this._notifyEventProcessors(e,a,n,r+1).then(o).then(null,i)}}))}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}_applyFingerprint(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}}function ig(){return(0,Um.Y)("globalEventProcessors",(()=>[]))}var sg=100;class ag{__init(){this._stack=[{}]}constructor(e,t=new og,n=4){this._version=n,ag.prototype.__init.call(this),this.getStackTop().scope=t,e&&this.bindClient(e)}isOlderThan(e){return this._version<e}bindClient(e){this.getStackTop().client=e,e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){var e=og.clone(this.getScope());return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}withScope(e){var t=this.pushScope();try{e(t)}finally{this.popScope()}}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,t){var n=this._lastEventId=t&&t.event_id?t.event_id:Bm(),r=new Error("Sentry syntheticException");return this._withClient(((o,i)=>{o.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},i)})),n}captureMessage(e,t,n){var r=this._lastEventId=n&&n.event_id?n.event_id:Bm(),o=new Error(e);return this._withClient(((i,s)=>{i.captureMessage(e,t,{originalException:e,syntheticException:o,...n,event_id:r},s)})),r}captureEvent(e,t){var n=t&&t.event_id?t.event_id:Bm();return"transaction"!==e.type&&(this._lastEventId=n),this._withClient(((r,o)=>{r.captureEvent(e,{...t,event_id:n},o)})),n}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){const{scope:n,client:r}=this.getStackTop();if(!n||!r)return;const{beforeBreadcrumb:o=null,maxBreadcrumbs:i=sg}=r.getOptions&&r.getOptions()||{};if(!(i<=0)){var s={timestamp:(0,qm.yW)(),...e},a=o?Vm((()=>o(s,t))):s;null!==a&&n.addBreadcrumb(a,i)}}setUser(e){var t=this.getScope();t&&t.setUser(e)}setTags(e){var t=this.getScope();t&&t.setTags(e)}setExtras(e){var t=this.getScope();t&&t.setExtras(e)}setTag(e,t){var n=this.getScope();n&&n.setTag(e,t)}setExtra(e,t){var n=this.getScope();n&&n.setExtra(e,t)}setContext(e,t){var n=this.getScope();n&&n.setContext(e,t)}configureScope(e){const{scope:t,client:n}=this.getStackTop();t&&n&&e(t)}run(e){var t=cg(this);try{e(this)}finally{cg(t)}}getIntegration(e){var t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch(t){return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&Gm.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){return this._callExtensionMethod("startTransaction",e,t)}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){var e=this.getStackTop(),t=e&&e.scope,n=t&&t.getSession();n&&function(e,t){let n={};t?n={status:t}:"ok"===e.status&&(n={status:"exited"}),rg(e,n)}(n),this._sendSessionUpdate(),t&&t.setSession()}startSession(e){const{scope:t,client:n}=this.getStackTop(),{release:r,environment:o}=n&&n.getOptions()||{};var i=(0,Um.R)();const{userAgent:s}=i.navigator||{};var a=ng({release:r,environment:o,...t&&{user:t.getUser()},...s&&{userAgent:s},...e});if(t){var l=t.getSession&&t.getSession();l&&"ok"===l.status&&rg(l,{status:"exited"}),this.endSession(),t.setSession(a)}return a}shouldSendDefaultPii(){var e=this.getClient(),t=e&&e.getOptions();return Boolean(t&&t.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:t}=this.getStackTop();if(e){var n=e.getSession();n&&t&&t.captureSession&&t.captureSession(n)}}_withClient(e){const{scope:t,client:n}=this.getStackTop();n&&e(n,t)}_callExtensionMethod(e,...t){var n=lg().__SENTRY__;if(n&&n.extensions&&"function"==typeof n.extensions[e])return n.extensions[e].apply(this,t);("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&Gm.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function lg(){var e=(0,Um.R)();return e.__SENTRY__=e.__SENTRY__||{extensions:{},hub:void 0},e}function cg(e){var t=lg(),n=pg(t);return dg(t,e),n}function ug(){var e=lg();return fg(e)&&!pg(e).isOlderThan(4)||dg(e,new ag),(0,Qm.KV)()?function(e){try{var t=lg().__SENTRY__,n=t&&t.extensions&&t.extensions.domain&&t.extensions.domain.active;if(!n)return pg(e);if(!fg(n)||pg(n).isOlderThan(4)){var r=pg(e).getStackTop();dg(n,new ag(r.client,og.clone(r.scope)))}return pg(n)}catch(t){return pg(e)}}(e):pg(e)}function fg(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function pg(e){return(0,Um.Y)("hub",(()=>new ag),e)}function dg(e,t){return!!e&&((e.__SENTRY__=e.__SENTRY__||{}).hub=t,!0)}const hg=(e,t,n)=>e.querySelector(`#LC${t}`),mg={getCodeElementFromTarget:e=>e.closest("span.line"),getLineNumberFromCodeElement:e=>{const t=e.id.replace(/^LC/,"");return parseInt(t,10)},getCodeElementFromLineNumber:hg,getLineElementFromLineNumber:hg},gg=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)},bg=(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)},yg={getCodeElementFromTarget:mg.getCodeElementFromTarget,getLineNumberFromCodeElement:e=>{const t=e.closest("[data-interop-line]");return t?parseInt(t.dataset.interopLine||"",10):(e=>{const t=gg(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:bg,getLineElementFromLineNumber:(e,t,n)=>{const r=bg(e,t,n);return r&&r.parentElement},getDiffCodePart:gg},vg="codeHost-module__command-list-popover_hwImg",wg="codeHost-module__command-palette-button_2FnHe",Eg="codeHost-module__hover-overlay_3Cize",_g=(e,t,n)=>`${window.location.origin}/api/v4/projects/${encodeURIComponent(e)}%2f${t}${n}`,xg=e=>Y(e,{selector:e=>Je(e).json()}),Sg=We((e=>xg(`${window.location.origin}/api/v4/projects/${e}`).pipe(J((({web_url:e})=>{const{hostname:t,pathname:n}=new URL(e);return`${t}${n}`})))),Gc()),Cg=We((({owner:e,projectName:t,mergeRequestID:n,diffID:r})=>r?xg(_g(e,t,`/merge_requests/${n}/versions/${r}`)).pipe(J((({base_commit_sha:e})=>e))):Z(void 0)),(({owner:e,projectName:t,mergeRequestID:n,diffID:r})=>`${e}:${t}:${n}:${String(r)}`)),Og=We((({owner:e,projectName:t,mergeRequestID:n,rawRepoName:r,diffID:o})=>pp(xg(_g(e,t,`/merge_requests/${n}`)),Cg({owner:e,projectName:t,mergeRequestID:n,diffID:o})).pipe(ae((([{diff_refs:e,source_project_id:t},n])=>Sg(t).pipe(J((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)}`)),Ng=We((({owner:e,projectName:t,commitID:n})=>xg(_g(e,t,`/repository/commits/${n}`)).pipe(J((({parent_ids:e})=>xd()(e))))),(({owner:e,projectName:t,commitID:n})=>`${e}:${t}:${n}`));var kg=o(68642),Tg=o.n(kg),Ag=o(90006),Ig=o.n(Ag);let Rg;!function(e){e[e.File=0]="File",e[e.Commit=1]="Commit",e[e.MergeRequest=2]="MergeRequest",e[e.Other=3]="Other"}(Rg||(Rg={}));function Pg(){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=Tg()(n,n.length-1).join("/"),o=Ig()(n),i=((e,t,n)=>{const r=n.match(new RegExp(`^/${e}/${t}(/-)?/(commit|merge_requests|blob)/`));if(!r)return Rg.Other;switch(r[2]){case"commit":return Rg.Commit;case"merge_requests":return Rg.MergeRequest;case"blob":return Rg.File;default:return Rg.Other}})(r,o,window.location.pathname);return{owner:r,projectName:o,rawRepoName:[Lt?window.location.hostname:new URL(gon.gitlab_url).hostname,r,o].join("/"),repoName:t,pageKind:i}}const Dg=()=>{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]},Lg=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 Mg(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=Lg(t.item(n?1:0));return{headFilePath:r,baseFilePath:n?Lg(t.item(0)):r}}function jg(){const{rawRepoName:e,owner:t,projectName:n}=Pg();return{rawRepoName:e,owner:t,projectName:n,commitID:Ig()(window.location.pathname.split("/"))}}const Fg=(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===Rg.Commit&&o.classList.add("gl-mr-3"),r.prepend(o),o},Ug={dom:mg,getToolbarMount:e=>Fg(e,Rg.File),resolveFileInfo:()=>{const{rawRepoName:e,filePath:t,revision:n}=function(){const{rawRepoName:e}=Pg(),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:To({selector:".js-data-file-blob-permalink-url",hrefRegex:new RegExp("^/.*?/.*?/blob/([0-9a-f]{40})/")}),revision:n}}},getSelections:Uh,observeSelections:Bh},Bg=e=>{const t=e.querySelector(".js-file-title");if(!t)throw new Error("Could not find .file-title element");return[t]},qg={dom:yg,getToolbarMount:e=>Fg(e,Rg.MergeRequest),resolveFileInfo:e=>W(Og({...Pg(),mergeRequestID:Dg(),diffID:new URLSearchParams(window.location.search).get("diff_id")??void 0})).pipe(J((t=>{const{rawRepoName:n,baseRawRepoName:r,commitID:o,baseCommitID:i}=t,{headFilePath:s,baseFilePath:a}=Mg(e);return{head:{rawRepoName:n,filePath:s,commitID:o},base:{rawRepoName:r,filePath:a,commitID:i}}}))),getScrollBoundaries:Bg},$g={dom:yg,getToolbarMount:e=>Fg(e,Rg.Commit),resolveFileInfo:e=>ms(jg).pipe(ae((({owner:e,projectName:t,commitID:n,rawRepoName:r})=>Ng({owner:e,projectName:t,commitID:n}).pipe(J((e=>({commitID:n,baseCommitID:e,rawRepoName:r})))))),J((({commitID:t,baseCommitID:n,rawRepoName:r})=>{const{headFilePath:o,baseFilePath:i}=Mg(e);return{head:{rawRepoName:r,filePath:o,commitID:t},base:{rawRepoName:r,filePath:i,commitID:n}}}))),getScrollBoundaries:Bg},zg={selector:".file-holder",resolveView:e=>{if(e.classList.contains("discussion-wrapper"))return null;const{pageKind:t}=Pg();return t===Rg.Other?null:t===Rg.File?{element:e,...Ug}:t===Rg.MergeRequest?e.querySelector(".file-actions")?{element:e,...qg}:null:{element:e,...$g}}},Vg={[cu]:"alert alert-secondary",[uu]:"alert alert-success",[lu]:"alert alert-info",[au]:"alert alert-warning",[su]:"alert alert-danger"},Hg=(e,t=Jf.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 n=e,ug().captureException(n,{captureContext:r}),e}var n,r;return e})).then((({status:e})=>200!==e)).catch((e=>(console.warn("Failed to fetch repository visibility info.",e),!0))):Promise.resolve(!0),Gg={type:"gitlab",name:"GitLab",check:function(){return!!document.head.querySelector('meta[content="GitLab"]')},codeViewResolvers:[zg],getCommandPaletteMount:e=>{const t=Ro(e,".navbar-collapse");if(!t)return null;const n="command-palette-button";return t.querySelector("."+n)||(()=>{const e=document.createElement("div");return e.classList.add(n,wg),t.prepend(e),e})()},getContext:async()=>{const{repoName:e,...t}=Pg();return{...t,privateRepository:await Hg(e)}},urlToFile:(e,t,n)=>{if(t.viewState||!t.rawRepoName.startsWith(window.location.hostname))return zr(e,t);if(Pg().rawRepoName===t.rawRepoName&&void 0!==n.part){const e=gh(document.body,zg.selector);for(const r of e){const{headFilePath:e,baseFilePath:o}=Mg(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]:"",s=r.querySelector(`${i} a[data-linenumber="${t.position.line}"]`);if(!s)break;return new URL(s.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:Vg,commandPaletteClassProps:{popoverClassName:s()("dropdown-menu",vg),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:s()("card",Eg),actionItemClassName:"btn btn-secondary",actionItemPressedClassName:"active",closeButtonClassName:"btn btn-transparent p-0 btn-icon--gitlab",iconClassName:"square s16",getAlertClassName:hd(Vg)},codeViewsRequireTokenization:!0,getHoverOverlayMountLocation:()=>{const{pageKind:e}=Pg();return e===Rg.MergeRequest?"div.tab-pane.diffs":null},observeLineSelection:Vo(document,"click").pipe(wt((e=>e.target.matches("a[data-line-number]"))),J((()=>(e=>{if(e.startsWith("#")&&(e=e.slice(1)),!/^L\d+(-\d+)?$/.test(e))return{};const t={},[n,r]=e.slice(1).split("-");return t.line=parseInt(n,10),r&&(t.endLine=parseInt(r,10)),t})(window.location.hash))))},Wg=e=>Boolean("TH"===e.tagName&&e.textContent||e.dataset.n),Qg=e=>parseInt(("TH"===e.tagName?e.textContent:e.dataset.n)||"",10),Kg=e=>{let t=e;for(;t;){if(Wg(t))return t;t=t.previousElementSibling}return null},Zg=(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(Qg(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")||Wg(r)||r.classList.contains("copy"));)r=r.nextElementSibling;return r},Yg={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:Kg(t)?t:null:null},getCodeElementFromLineNumber:Zg,getLineElementFromLineNumber:Zg,getLineNumberFromCodeElement:e=>{const t=Kg(e);if(!t)throw new Error("Could not find line number cell from code element");return Qg(t)},getDiffCodePart:e=>{if(e.classList.contains("old"))return"base";if(e.classList.contains("new"))return"head";const t=Kg(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=>!!e.firstElementChild?.classList.contains("aural-only")},Jg=(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")},Xg={getCodeElementFromTarget:e=>e.closest("td"),getCodeElementFromLineNumber:Jg,getLineElementFromLineNumber:Jg,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 eb=(e,t,n=go)=>ho(window.location,t,n).pipe(J((e=>{if(e.mode!==to.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}}}))),tb="codeHost-module__hover-overlay_3rw5s",nb="codeHost-module__icon_3HyWM",rb="codeHost-module__action-item_35MZg",ob="codeHost-module__hover-overlay-action-item_1yTXu",ib="codeHost-module__hover-overlay-action-item-icon_1oozE",sb=(e,t)=>({line:e.line,character:e.character+t}),ab=e=>({direction:t,codeView:n,position:r})=>eo({...r,requestGraphQL:e}).pipe(J((e=>{const o=Yg.getCodeElementFromLineNumber(n,r.line,r.part);if(!o)throw new Error("(adjustPosition) could not find code element for line provided");const i=(e=>{let t=e.textContent||"",n=0;if(e.firstElementChild?.classList.contains("aural-only")){const r=e.firstElementChild.textContent||"";n=r.replace(/^(\+|-)/,"").length,t=t.slice(r.length-n)}return 8203===t.charCodeAt(0)&&(t=t.slice(1),n++),{textContent:t,adjust:n}})(o),s=i.textContent,a=e[r.line-1],l=(u=s,!!(c=a)&&!!u&&c.startsWith("\t")&&!u.startsWith("\t"));var c,u;const f=t===rs.CodeViewToActual?-1:1;return sb(r,l?(function(e){let t=e,n=0;for(;t.length>=2&&t.startsWith(" ");)++n,t=t.slice(2);return n}(s)+i.adjust)*f:i.adjust*f)}))),lb={dom:Yg,resolveFileInfo:(e,t,n=go)=>ho(window.location,t,n).pipe(J((e=>{if(e.mode!==to.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:ab,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}},cb={dom:Yg,resolveFileInfo:(e,t,n=go)=>ho(window.location,t,n).pipe(ae((r=>{if(r.mode!==to.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 pp(No({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(J((({commitID:e,stagingRepoName:t})=>({commitID:e,rawRepoName:t||r.baseRawRepoName})))),No({repoName:r.headRawRepoName,revisionID:r.revisionID,diffID:r.diffID,baseDiffID:r.baseDiffID,useDiffForBase:!1,useBaseForDiff:!1,filePath:o,isBase:!1},t,n).pipe(J((({commitID:e,stagingRepoName:t})=>({commitID:e,rawRepoName:t||r.headRawRepoName}))))).pipe(J((([e,t])=>({base:{rawRepoName:e.rawRepoName,filePath:i||o,commitID:e.commitID},head:{rawRepoName:t.rawRepoName,filePath:o,commitID:t.commitID}}))))}))),getPositionAdjuster:ab,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},ub={selector:".differential-changeset",resolveView:e=>window.location.pathname.match(/^\/r/)?{element:e,...lb}:{element:e,...cb}},fb=jh(".diffusion-source",{dom:Xg,resolveFileInfo:eb,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}}),pb=jh(".phabricator-source-code-container",{dom:Xg,resolveFileInfo:eb}),db={[cu]:"phui-info-view phui-info-severity-plain",[uu]:"phui-info-view phui-info-severity-success",[lu]:"phui-info-view phui-info-severity-notice",[au]:"phui-info-view phui-info-severity-warning",[su]:"phui-info-view phui-info-severity-error"},hb={codeViewResolvers:[ub,fb,pb],type:"phabricator",name:"Phabricator",check:()=>!!document.querySelector(".phabricator-wordmark"),codeViewToolbarClassProps:{actionItemClass:s()("button grey",rb),actionItemIconClass:nb},notificationClassNames:db,hoverOverlayClassProps:{className:s()("aphront-dialog-view",tb),actionItemClassName:s()("button grey",ob),closeButtonClassName:"button grey btn-icon--phabricator",iconClassName:ib,getAlertClassName:hd(db)},codeViewsRequireTokenization:!0};var mb={leading:!0,trailing:!1};var gb=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 bb(e,this.duration,this.scheduler,this.leading,this.trailing))},e}(),bb=function(e){function t(t,n,r,o,i){var s=e.call(this,t)||this;return s.duration=n,s.scheduler=r,s.leading=o,s.trailing=i,s._hasTrailingValue=!1,s._trailingValue=null,s}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(yb,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}(A);function yb(e){e.subscriber.clearThrottle()}function vb({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),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:rf(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,wb(r)),i&&e(i,wb(r)))}function wb(e){if(!e)return null;const t=e.hover.map((({value:e})=>e)).filter((e=>!!e));return t.length>0?t.join(" "):null}function Eb(e,{extensionsController:t},{contentViewResolvers:n,linkPreviewContentClass:r,setElementTooltip:o}){const i=e.pipe(mh(n||[]),Ne(Bt)),s=new be,a=new Map;return i.pipe(ht((e=>li(Z(e).pipe(ze((()=>{console.log("Content view added",{contentViewEvent:e}),a.set(e.element,new N),e.subscriptions.add((()=>{console.log("Content view removed",{contentViewEvent:e});const t=a.get(e.element);if(!t)throw new Error("No linkPreview subscriptions");t.unsubscribe()}))}))),Ao(e.element,{childList:!0},s).pipe(Ne(Bt),J((()=>e.element.innerHTML)),Zo(),ze((()=>console.log("Content view updated",{contentViewEvent:e}))),te(e),function(e,t,n){return void 0===t&&(t=qt),void 0===n&&(n=mb),function(r){return r.lift(new gb(e,t,n.leading,n.trailing))}}(2e3,void 0,{leading:!0,trailing:!0}))))),ze((({element:e})=>{let n=a.get(e);if(!n)throw new Error("No linkPreview subscriptions");if(n.unsubscribe(),n=new N,a.set(e,n),null!==t)for(const i of e.querySelectorAll("a[href]"))n.add(W(t.extHostAPI).pipe(ae((e=>yl(e.getLinkPreviews(i.href))))).subscribe((e=>{try{s.next(!0),vb({setElementTooltip:o,linkPreviewContentClass:r},i,e)}finally{s.next(!1)}})))}))).subscribe()}var _b=o(32805),xb=o(51437),Sb=o(51491),Cb=o.n(Sb);const Ob="Label-module__label_OcXyA",Nb="Label-module__label--underline_1lWvO",kb="Label-module__label--uppercase_v90-E",Tb="Label-module__label--single-line_1WmWf",Ab=t.forwardRef(((e,t)=>{const{children:n,as:r="label",size:o,weight:i,alignment:a,mode:l,isUnderline:c,isUppercase:f,className:p,...d}=e;return(0,u.jsx)(r,{ref:t,className:s()(Ob,c&&Nb,f&&kb,"small"===o&&Tf.small,i&&If({weight:i}),a&&Af({alignment:a}),l&&Rf({mode:l}),"single-line"===l&&Tb,p),...d,children:n})})),Ib="LoaderInput-module__container_3Pq3e",Rb="LoaderInput-module__spinner_2E2IO",Pb=({loading:e,children:t,className:n})=>(0,u.jsxs)("div",{className:s()(Ib,n),children:[t,e&&(0,u.jsx)(Ga,{inline:!1,className:Rb})]}),Db="Input-module__input-loading_3mRNA",Lb="Input-module__loader-input_1ZDGl";let Mb;!function(e){e.initial="initial",e.error="error",e.loading="loading",e.valid="valid"}(Mb||(Mb={}));const jb=(0,t.forwardRef)((function(e,n){const{as:r="input",type:o="text",variant:i="regular",label:a,message:l,className:c,inputClassName:f,inputSymbol:p,disabled:d,status:h=Mb.initial,error:m,autoFocus:g,...b}=e,y=(0,t.useRef)(null),v=Qa([y,n]);(({autoFocus:e,reference:n})=>{(0,t.useEffect)((()=>{e&&requestAnimationFrame((()=>{n.current?.focus()}))}),[e])})({autoFocus:g,reference:y});const w="form-text font-weight-normal mt-2",E=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(Pb,{className:s()("loader-input",Lb,!a&&c),loading:h===Mb.loading,children:[(0,u.jsx)(r,{disabled:d,type:o,className:s()(f,h===Mb.loading&&Db,"form-control","with-invalid-icon",{"is-valid":h===Mb.valid,"is-invalid":m||h===Mb.error,"form-control-sm":"small"===i}),...b,ref:v,autoFocus:g}),p]}),m&&(0,u.jsx)("small",{role:"alert",className:s()("text-danger",w),children:m}),!m&&l&&(0,u.jsx)("small",{className:s()("text-muted",w),children:l})]});return a?(0,u.jsxs)(Ab,{className:s()("w-100",c),children:[a&&(0,u.jsx)("div",{className:"mb-2",children:"regular"===i?a:(0,u.jsx)("small",{children:a})}),E]}):E}));jb.displayName="Input";const Fb=We((e=>W(e).pipe(ae((e=>yl(e.haveInitialExtensionsLoaded()))))),(()=>"haveInitialExtensionsLoaded")),Ub=({text:e,pattern:t,className:n})=>(0,u.jsx)("span",{children:Bb(e.toLowerCase(),t.toLowerCase()).map(((t,r)=>t.match?(0,u.jsx)("strong",{className:n,children:e.slice(t.start,t.end)},r):e.slice(t.start,t.end)))});function Bb(e,t){const n=[];let r,o=0;for(let i=0;i<t.length;i++){const s=e.indexOf(t.charAt(i),o);if(-1===s)break;r?.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}return e&&o<e.length&&n.push({start:o,end:e.length,match:!1}),n}const qb="EmptyCommandListContainer-module__empty-command-list_NA_s5",$b=({className:e,children:t,...n})=>(0,u.jsx)("div",{className:s()(qb,e),...n,children:t}),zb="EmptyCommandList-module__title_Sbph5",Vb="EmptyCommandList-module__text_s1AXs",Hb="EmptyCommandList-module__illustration_3pj62",Gb=({settingsCascade:e,sourcegraphURL:t})=>{const n=!!e&&function(e){const t=iu(e,"User"),n=iu(e,"DefaultSettings");if(t&&n)for(const e of Object.keys(t))if(!(e in n))return!1;return!0}(e);return(0,u.jsxs)($b,{children:[(0,u.jsx)(Pf,{className:zb,children:n?"You don't have any extensions enabled":"You don't have any active actions"}),(0,u.jsx)(Pf,{className:Vb,children:n?"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."}),(0,u.jsx)(Ka,{to:t+"/extensions",variant:"primary",children:"Explore extensions"}),(0,u.jsx)(Wb,{className:Hb})]})},Wb=t.memo((({className:e})=>(0,u.jsxs)("svg",{width:"59",height:"64",viewBox:"0 0 59 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[(0,u.jsx)("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"}),(0,u.jsx)("rect",{y:"24.6855",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{y:"46.627",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{y:"52.1133",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{y:"19.1992",width:"11.0972",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"11.0977",y:"30.1699",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"11.0977",y:"41.1426",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"11.0977",y:"35.6562",width:"15.7211",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"13.8711",y:"24.6855",width:"9.24768",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"13.8711",y:"46.627",width:"9.24768",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"13.8711",y:"52.1133",width:"5.54861",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"12.0225",y:"19.1992",width:"5.54861",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"24.9688",y:"30.1699",width:"4.62384",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"24.9688",y:"41.1426",width:"9.24767",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"30.5176",y:"30.1699",width:"7.39814",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"35.1416",y:"41.1426",width:"4.62384",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"27.7432",y:"35.6562",width:"7.39814",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("defs",{children:(0,u.jsxs)("linearGradient",{id:"paint0_linear",x1:"33.5688",y1:"0",x2:"33.5688",y2:"64",gradientUnits:"userSpaceOnUse",children:[(0,u.jsx)("stop",{stopColor:"#95A5C6",stopOpacity:"0.6"}),(0,u.jsx)("stop",{offset:"1",stopColor:"#95A5C6"})]})})]}))),Qb="CommandList-module__command-list_10tyf",Kb="CommandList-module__popover-button_1ug-b",Zb=We((e=>W(e).pipe(ae((e=>yl(e.getContributions()))))),(()=>"getContributions"));class Yb extends t.PureComponent{static RECENT_ACTIONS_STORAGE_KEY="commandList.recentActions";static readRecentActions(){const e=localStorage.getItem(Yb.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 Yb.writeRecentActions(null),null}static writeRecentActions(e){try{if(null===e)localStorage.removeItem(Yb.RECENT_ACTIONS_STORAGE_KEY);else{const t=JSON.stringify(e);localStorage.setItem(Yb.RECENT_ACTIONS_STORAGE_KEY,t)}}catch(e){console.error("Error writing recent actions:",e)}}state={input:"",selectedIndex:0,recentActions:Yb.readRecentActions()};subscriptions=new N;selectedItem=null;setSelectedItem=e=>{this.selectedItem=e};componentDidMount(){this.subscriptions.add(Fb(this.props.extensionsController.extHostAPI).pipe(wt((e=>e)),ae((()=>Zb(this.props.extensionsController.extHostAPI)))).subscribe((e=>{this.setState({contributions:e})}))),this.subscriptions.add(this.props.platformContext.settings.subscribe((e=>this.setState({settingsCascade:e}))))}componentDidUpdate(e,t){this.state.recentActions!==t.recentActions&&Yb.writeRecentActions(this.state.recentActions)}componentWillUnmount(){this.subscriptions.unsubscribe()}render(){if(!this.state.contributions)return(0,u.jsx)($b,{className:Qb,children:(0,u.jsxs)("div",{className:"d-flex py-5 align-items-center justify-content-center",children:[(0,u.jsx)(Ga,{inline:!1}),(0,u.jsx)("span",{className:"mx-2",children:"Loading Sourcegraph extensions"}),(0,u.jsx)(Va,{"aria-hidden":!0,svgPath:"M20.5,11H19V7C19,5.89 18.1,5 17,5H13V3.5A2.5,2.5 0 0,0 10.5,1A2.5,2.5 0 0,0 8,3.5V5H4A2,2 0 0,0 2,7V10.8H3.5C5,10.8 6.2,12 6.2,13.5C6.2,15 5,16.2 3.5,16.2H2V20A2,2 0 0,0 4,22H7.8V20.5C7.8,19 9,17.8 10.5,17.8C12,17.8 13.2,19 13.2,20.5V22H17A2,2 0 0,0 19,20V16H20.5A2.5,2.5 0 0,0 23,13.5A2.5,2.5 0 0,0 20.5,11Z"})]})});const e=Fc(this.state.contributions,this.props.menu),t=this.state.input.trim(),n=function(e,t,n){if(!t)return null===n?e:Mc()(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]=Cb()(i,t,0)),o[n]>0})).map(((e,t)=>{const r=n?.indexOf(e.action.id);return{item:e,score:o[t],recentIndex:-1===r?null:r}}));return Mc()(i,"recentIndex","score",(({item:e})=>e.action.id)).map((({item:e})=>e))}(e,this.state.input,this.state.recentActions),r=(this.state.selectedIndex%n.length+n.length)%n.length;return(0,u.jsxs)("div",{className:Qb,children:[(0,u.jsx)("header",{children:(0,u.jsxs)("form",{className:this.props.formClassName,onSubmit:this.onSubmit,children:[(0,u.jsx)(Ab,{className:"sr-only",htmlFor:"command-list-input",children:"Command"}),(0,u.jsx)(jb,{id:"command-list-input",inputClassName:this.props.inputClassName,value:this.state.input,placeholder:"Run Sourcegraph action...",spellCheck:!1,autoFocus:!0,autoCorrect:"off",autoComplete:"off",onChange:this.onInputChange,onKeyDown:this.onInputKeyDown,onClick:this.onInputClick})]})}),(0,u.jsx)("div",{className:this.props.resultsContainerClassName,children:(0,u.jsx)("ul",{className:this.props.listClassName,children:n.length>0?n.map(((e,n)=>(0,u.jsx)("li",{className:s()(this.props.listItemClassName,n===r&&this.props.selectedListItemClassName),children:(0,u.jsx)(Jl,{...this.props,className:s()(this.props.actionItemClassName,n===r&&this.props.selectedActionItemClassName),...e,ref:n===r?this.setSelectedItem:void 0,title:(0,u.jsx)(Ub,{text:[e.action.category,e.action.title||e.action.command].filter(Boolean).join(": "),pattern:t}),onDidExecute:this.onActionDidExecute})},e.action.id))):t.length>0?(0,u.jsx)("li",{className:this.props.noResultsClassName,children:"No matching commands"}):(0,u.jsx)(Gb,{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 Ti.s.ArrowDown:e.preventDefault(),this.setSelectedIndex(1);break;case Ti.s.ArrowUp:e.preventDefault(),this.setSelectedIndex(-1);break;case Ti.s.Enter:this.selectedItem&&this.selectedItem.runAction(e)}};onInputClick=e=>{e.stopPropagation()};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:tn()([e,...n]).slice(0,10)}:{recentActions:[e]}})),this.props.onSelect&&this.props.onSelect()}}const Jb=({buttonClassName:e,buttonElement:n="span",buttonOpenClassName:r,showCaret:o=!0,popoverClassName:i,popoverInnerClassName:a,keyboardShortcutForShow:l,variant:c,...f})=>{const[p,d]=(0,t.useState)(!1),h=(0,t.useMemo)((()=>p&&document.activeElement instanceof HTMLElement?document.activeElement:null),[p]),m=(0,t.useCallback)((()=>{h?.focus(),d(!1)}),[h]),g=(0,t.useCallback)((()=>{p&&h?.focus(),d(!p)}),[p,h]),b=(0,t.useMemo)((()=>Kc()("command-list-popover-button-")),[]),y=()=>(0,u.jsx)(Va,{svgPath:p?"M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z":"M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z","aria-hidden":!0});return(0,u.jsxs)(qa,{as:n,role:"button",id:b,onClick:g,className:s()(Kb,e,p&&r),variant:c,"aria-label":"Command list",children:[(0,u.jsx)(Va,{size:"md","aria-hidden":!0,svgPath:"M20,19V7H4V19H20M20,3A2,2 0 0,1 22,5V19A2,2 0 0,1 20,21H4A2,2 0 0,1 2,19V5C2,3.89 2.9,3 4,3H20M13,17V15H18V17H13M9.58,13L5.57,9H8.4L11.7,12.3C12.09,12.69 12.09,13.33 11.7,13.72L8.42,17H5.59L9.58,13Z"}),o&&(0,u.jsx)(y,{}),(0,u.jsx)(xb.ZP,{isOpen:p,toggle:g,popperClassName:i,innerClassName:s()("popover-inner",a),placement:"bottom-end",target:b,trigger:"legacy",delay:0,fade:!1,hideArrow:!0,children:(0,u.jsx)(Yb,{...f,onSelect:m})}),l?.keybindings.map(((e,t)=>(0,u.jsx)(_b.z9,{...e,onMatch:g},t)))]})};var Xb=o(7263),ey=o.n(Xb);function ty(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,s=void 0===i?Number.POSITIVE_INFINITY:i,a=e.refCount,l=e.scheduler,c=0,u=!1,f=!1;return function(e){var r;c++,!t||u?(u=!1,t=new Ie(o,s,l),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()}}),f&&(n=void 0)):r=t.subscribe(this),this.add((function(){c--,r.unsubscribe(),r=void 0,n&&!f&&a&&0===c&&(n.unsubscribe(),n=void 0,t=void 0)}))}}(r))}}function ny(e){return(ny="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 ry="function"==typeof Symbol&&null!=Symbol.toStringTag?Symbol.toStringTag:"@@toStringTag";function oy(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 iy(e){return sy(e.source,oy(e.source,e.start))}function sy(e,t){var n=e.locationOffset.column-1,r=ly(n)+e.body,o=t.line-1,i=e.locationOffset.line-1,s=t.line+i,a=1===t.line?n:0,l=t.column+a,c="".concat(e.name,":").concat(s,":").concat(l,"\n"),u=r.split(/\r\n|[\n\r]/g),f=u[o];if(f.length>120){for(var p=Math.floor(l/80),d=l%80,h=[],m=0;m<f.length;m+=80)h.push(f.slice(m,m+80));return c+ay([["".concat(s),h[0]]].concat(h.slice(1,p+1).map((function(e){return["",e]})),[[" ",ly(d-1)+"^"],["",h[p+1]]]))}return c+ay([["".concat(s-1),u[o-1]],["".concat(s),f],["",ly(l-1)+"^"],["".concat(s+1),u[o+1]]])}function ay(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 ly(n-(t=r).length)+t+(o?" | "+o:" |")})).join("\n")}function ly(e){return Array(e+1).join(" ")}function cy(e){return(cy="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 uy(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 fy(e,t){return!t||"object"!==cy(t)&&"function"!=typeof t?py(e):t}function py(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dy(e){var t="function"==typeof Map?new Map:void 0;return(dy=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 hy(e,arguments,by(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),gy(r,e)})(e)}function hy(e,t,n){return(hy=my()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&gy(o,n.prototype),o}).apply(null,arguments)}function my(){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 gy(e,t){return(gy=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function by(e){return(by=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var yy=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&&gy(e,t)}(a,e);var t,n,r,o,i,s=(t=a,n=my(),function(){var e,r=by(t);if(n){var o=by(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return fy(this,e)});function a(e,t,n,r,o,i,l){var c,u,f,p,d;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),d=s.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 b,y=r;!y&&m&&(y=m.reduce((function(e,t){return t.loc&&e.push(t.loc.start),e}),[])),y&&0===y.length&&(y=void 0),r&&n?b=r.map((function(e){return oy(n,e)})):m&&(b=m.reduce((function(e,t){return t.loc&&e.push(oy(t.loc.source,t.loc.start)),e}),[]));var v,w=l;if(null==w&&null!=i){var E=i.extensions;"object"==ny(v=E)&&null!==v&&(w=E)}return Object.defineProperties(py(d),{name:{value:"GraphQLError"},message:{value:e,enumerable:!0,writable:!0},locations:{value:null!==(c=b)&&void 0!==c?c:void 0,enumerable:null!=b},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=y)&&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(py(d),"stack",{value:i.stack,writable:!0,configurable:!0}),fy(d)):(Error.captureStackTrace?Error.captureStackTrace(py(d),a):Object.defineProperty(py(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return r=a,(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"+iy(o.loc))}else if(e.source&&e.locations)for(var i=0,s=e.locations;i<s.length;i++){var a=s[i];t+="\n\n"+sy(e.source,a)}return t}(this)}},{key:ry,get:function(){return"Object"}}])&&uy(r.prototype,o),i&&uy(r,i),a}(dy(Error));function vy(e,t,n){return new yy("Syntax Error: ".concat(n),void 0,e,[t])}var wy=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 Ey="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function _y(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,Ey&&(e.prototype[Ey]=t)}var xy=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}();_y(xy);var Sy=function(){function e(e,t,n,r,o,i,s){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=o,this.value=s,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 Cy(e){return null!=e&&"string"==typeof e.kind}_y(Sy);var Oy=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 Ny(e){return(Ny="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 ky(e){return Ty(e,[])}function Ty(e,t){switch(Ny(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(Ey)];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:Ty(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(Ty(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+": "+Ty(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}function Ay(e,t){if(!Boolean(e))throw new Error(t)}const Iy=function(e,t){return e instanceof t};function Ry(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 Py=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||Ay(0,"Body must be a string. Received: ".concat(ky(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||Ay(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Ay(0,"column in locationOffset is 1-indexed and must be positive.")}var t,n,r;return t=e,(n=[{key:ry,get:function(){return"Source"}}])&&Ry(t.prototype,n),r&&Ry(t,r),e}();var Dy=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 Ly(e){var t=e.split(/\r\n|[\n\r]/g),n=function(e){for(var t,n=!0,r=!0,o=0,i=null,s=0;s<e.length;++s)switch(e.charCodeAt(s)){case 13:10===e.charCodeAt(s+1)&&++s;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&&My(t[o]);)++o;for(var i=t.length;i>o&&My(t[i-1]);)--i;return t.slice(o,i).join("\n")}function My(e){for(var t=0;t<e.length;++t)if(" "!==e[t]&&"\t"!==e[t])return!1;return!0}var jy=function(){function e(e){var t=new Sy(Oy.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!==Oy.EOF)do{var t;e=null!==(t=e.next)&&void 0!==t?t:e.next=Uy(this,e)}while(e.kind===Oy.COMMENT);return e},e}();function Fy(e){return isNaN(e)?Oy.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function Uy(e,t){for(var n=e.source,r=n.body,o=r.length,i=t.end;i<o;){var s=r.charCodeAt(i),a=e.line,l=1+i-e.lineStart;switch(s){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 Sy(Oy.BANG,i,i+1,a,l,t);case 35:return qy(n,i,a,l,t);case 36:return new Sy(Oy.DOLLAR,i,i+1,a,l,t);case 38:return new Sy(Oy.AMP,i,i+1,a,l,t);case 40:return new Sy(Oy.PAREN_L,i,i+1,a,l,t);case 41:return new Sy(Oy.PAREN_R,i,i+1,a,l,t);case 46:if(46===r.charCodeAt(i+1)&&46===r.charCodeAt(i+2))return new Sy(Oy.SPREAD,i,i+3,a,l,t);break;case 58:return new Sy(Oy.COLON,i,i+1,a,l,t);case 61:return new Sy(Oy.EQUALS,i,i+1,a,l,t);case 64:return new Sy(Oy.AT,i,i+1,a,l,t);case 91:return new Sy(Oy.BRACKET_L,i,i+1,a,l,t);case 93:return new Sy(Oy.BRACKET_R,i,i+1,a,l,t);case 123:return new Sy(Oy.BRACE_L,i,i+1,a,l,t);case 124:return new Sy(Oy.PIPE,i,i+1,a,l,t);case 125:return new Sy(Oy.BRACE_R,i,i+1,a,l,t);case 34:return 34===r.charCodeAt(i+1)&&34===r.charCodeAt(i+2)?Hy(n,i,a,l,t,e):Vy(n,i,a,l,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return $y(n,i,s,a,l,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 Qy(n,i,a,l,t)}throw vy(n,i,By(s))}var c=e.line,u=1+i-e.lineStart;return new Sy(Oy.EOF,o,o,c,u,t)}function By(e){return e<32&&9!==e&&10!==e&&13!==e?"Cannot contain the invalid character ".concat(Fy(e),"."):39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":"Cannot parse the unexpected character ".concat(Fy(e),".")}function qy(e,t,n,r,o){var i,s=e.body,a=t;do{i=s.charCodeAt(++a)}while(!isNaN(i)&&(i>31||9===i));return new Sy(Oy.COMMENT,t,a,n,r,o,s.slice(t+1,a))}function $y(e,t,n,r,o,i){var s=e.body,a=n,l=t,c=!1;if(45===a&&(a=s.charCodeAt(++l)),48===a){if((a=s.charCodeAt(++l))>=48&&a<=57)throw vy(e,l,"Invalid number, unexpected digit after 0: ".concat(Fy(a),"."))}else l=zy(e,l,a),a=s.charCodeAt(l);if(46===a&&(c=!0,a=s.charCodeAt(++l),l=zy(e,l,a),a=s.charCodeAt(l)),69!==a&&101!==a||(c=!0,43!==(a=s.charCodeAt(++l))&&45!==a||(a=s.charCodeAt(++l)),l=zy(e,l,a),a=s.charCodeAt(l)),46===a||function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122}(a))throw vy(e,l,"Invalid number, expected digit but got: ".concat(Fy(a),"."));return new Sy(c?Oy.FLOAT:Oy.INT,t,l,r,o,i,s.slice(t,l))}function zy(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 vy(e,o,"Invalid number, expected digit but got: ".concat(Fy(i),"."))}function Vy(e,t,n,r,o){for(var i=e.body,s=t+1,a=s,l=0,c="";s<i.length&&!isNaN(l=i.charCodeAt(s))&&10!==l&&13!==l;){if(34===l)return c+=i.slice(a,s),new Sy(Oy.STRING,t,s+1,n,r,o,c);if(l<32&&9!==l)throw vy(e,s,"Invalid character within String: ".concat(Fy(l),"."));if(++s,92===l){switch(c+=i.slice(a,s-1),l=i.charCodeAt(s)){case 34:c+='"';break;case 47:c+="/";break;case 92:c+="\\";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+="\n";break;case 114:c+="\r";break;case 116:c+="\t";break;case 117:var u=Gy(i.charCodeAt(s+1),i.charCodeAt(s+2),i.charCodeAt(s+3),i.charCodeAt(s+4));if(u<0){var f=i.slice(s+1,s+5);throw vy(e,s,"Invalid character escape sequence: \\u".concat(f,"."))}c+=String.fromCharCode(u),s+=4;break;default:throw vy(e,s,"Invalid character escape sequence: \\".concat(String.fromCharCode(l),"."))}a=++s}}throw vy(e,s,"Unterminated string.")}function Hy(e,t,n,r,o,i){for(var s=e.body,a=t+3,l=a,c=0,u="";a<s.length&&!isNaN(c=s.charCodeAt(a));){if(34===c&&34===s.charCodeAt(a+1)&&34===s.charCodeAt(a+2))return u+=s.slice(l,a),new Sy(Oy.BLOCK_STRING,t,a+3,n,r,o,Ly(u));if(c<32&&9!==c&&10!==c&&13!==c)throw vy(e,a,"Invalid character within String: ".concat(Fy(c),"."));10===c?(++a,++i.line,i.lineStart=a):13===c?(10===s.charCodeAt(a+1)?a+=2:++a,++i.line,i.lineStart=a):92===c&&34===s.charCodeAt(a+1)&&34===s.charCodeAt(a+2)&&34===s.charCodeAt(a+3)?(u+=s.slice(l,a)+'"""',l=a+=4):++a}throw vy(e,a,"Unterminated string.")}function Gy(e,t,n,r){return Wy(e)<<12|Wy(t)<<8|Wy(n)<<4|Wy(r)}function Wy(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Qy(e,t,n,r,o){for(var i=e.body,s=i.length,a=t+1,l=0;a!==s&&!isNaN(l=i.charCodeAt(a))&&(95===l||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122);)++a;return new Sy(Oy.NAME,t,a,n,r,o,i.slice(t,a))}var Ky=function(){function e(e,t){var n=function(e){return Iy(e,Py)}(e)?e:new Py(e);this._lexer=new jy(n),this._options=t}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(Oy.NAME);return{kind:wy.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:wy.DOCUMENT,definitions:this.many(Oy.SOF,this.parseDefinition,Oy.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(Oy.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(Oy.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(Oy.BRACE_L))return{kind:wy.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,n=this.parseOperationType();return this.peek(Oy.NAME)&&(t=this.parseName()),{kind:wy.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(Oy.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(Oy.PAREN_L,this.parseVariableDefinition,Oy.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:wy.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(Oy.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Oy.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(Oy.DOLLAR),{kind:wy.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:wy.SELECTION_SET,selections:this.many(Oy.BRACE_L,this.parseSelection,Oy.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(Oy.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,n=this._lexer.token,r=this.parseName();return this.expectOptionalToken(Oy.COLON)?(e=r,t=this.parseName()):t=r,{kind:wy.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Oy.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Oy.PAREN_L,t,Oy.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(Oy.COLON),{kind:wy.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:wy.ARGUMENT,name:this.parseName(),value:(this.expectToken(Oy.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(Oy.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(Oy.NAME)?{kind:wy.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:wy.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:wy.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:wy.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 Oy.BRACKET_L:return this.parseList(e);case Oy.BRACE_L:return this.parseObject(e);case Oy.INT:return this._lexer.advance(),{kind:wy.INT,value:t.value,loc:this.loc(t)};case Oy.FLOAT:return this._lexer.advance(),{kind:wy.FLOAT,value:t.value,loc:this.loc(t)};case Oy.STRING:case Oy.BLOCK_STRING:return this.parseStringLiteral();case Oy.NAME:switch(this._lexer.advance(),t.value){case"true":return{kind:wy.BOOLEAN,value:!0,loc:this.loc(t)};case"false":return{kind:wy.BOOLEAN,value:!1,loc:this.loc(t)};case"null":return{kind:wy.NULL,loc:this.loc(t)};default:return{kind:wy.ENUM,value:t.value,loc:this.loc(t)}}case Oy.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:wy.STRING,value:e.value,block:e.kind===Oy.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,n=this._lexer.token;return{kind:wy.LIST,values:this.any(Oy.BRACKET_L,(function(){return t.parseValueLiteral(e)}),Oy.BRACKET_R),loc:this.loc(n)}},t.parseObject=function(e){var t=this,n=this._lexer.token;return{kind:wy.OBJECT,fields:this.any(Oy.BRACE_L,(function(){return t.parseObjectField(e)}),Oy.BRACE_R),loc:this.loc(n)}},t.parseObjectField=function(e){var t=this._lexer.token,n=this.parseName();return this.expectToken(Oy.COLON),{kind:wy.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(Oy.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(Oy.AT),{kind:wy.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(Oy.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(Oy.BRACKET_R),e={kind:wy.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(Oy.BANG)?{kind:wy.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:wy.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===Oy.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(Oy.STRING)||this.peek(Oy.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(Oy.BRACE_L,this.parseOperationTypeDefinition,Oy.BRACE_R);return{kind:wy.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(Oy.COLON);var n=this.parseNamedType();return{kind:wy.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:wy.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:wy.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(Oy.AMP);do{t.push(this.parseNamedType())}while(this.expectOptionalToken(Oy.AMP)||this.peek(Oy.NAME));return t}return this.delimitedMany(Oy.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var e;return!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLEmptyFields)&&this.peek(Oy.BRACE_L)&&this._lexer.lookahead().kind===Oy.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(Oy.BRACE_L,this.parseFieldDefinition,Oy.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(Oy.COLON);var o=this.parseTypeReference(),i=this.parseDirectives(!0);return{kind:wy.FIELD_DEFINITION,description:t,name:n,arguments:r,type:o,directives:i,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(Oy.PAREN_L,this.parseInputValueDef,Oy.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(Oy.COLON);var r,o=this.parseTypeReference();this.expectOptionalToken(Oy.EQUALS)&&(r=this.parseValueLiteral(!0));var i=this.parseDirectives(!0);return{kind:wy.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:wy.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:wy.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:o,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(Oy.EQUALS)?this.delimitedMany(Oy.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:wy.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:o,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(Oy.BRACE_L,this.parseEnumValueDefinition,Oy.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseDirectives(!0);return{kind:wy.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:wy.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:o,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(Oy.BRACE_L,this.parseInputValueDef,Oy.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===Oy.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(Oy.BRACE_L,this.parseOperationTypeDefinition,Oy.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return{kind:wy.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:wy.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:wy.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:wy.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:wy.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:wy.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:wy.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(Oy.AT);var n=this.parseName(),r=this.parseArgumentDefs(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var i=this.parseDirectiveLocations();return{kind:wy.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:o,locations:i,loc:this.loc(e)}},t.parseDirectiveLocations=function(){return this.delimitedMany(Oy.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==Dy[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 xy(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 vy(this._lexer.source,t.start,"Expected ".concat(Yy(e),", found ").concat(Zy(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!==Oy.NAME||t.value!==e)throw vy(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(Zy(t),"."));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===Oy.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=null!=e?e:this._lexer.token;return vy(this._lexer.source,t.start,"Unexpected ".concat(Zy(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 Zy(e){var t=e.value;return Yy(e.kind)+(null!=t?' "'.concat(t,'"'):"")}function Yy(e){return function(e){return e===Oy.BANG||e===Oy.DOLLAR||e===Oy.AMP||e===Oy.PAREN_L||e===Oy.PAREN_R||e===Oy.SPREAD||e===Oy.COLON||e===Oy.EQUALS||e===Oy.AT||e===Oy.BRACKET_L||e===Oy.BRACKET_R||e===Oy.BRACE_L||e===Oy.PIPE||e===Oy.BRACE_R}(e)?'"'.concat(e,'"'):e}var Jy=new Map,Xy=new Map,ev=!0,tv=!1;function nv(e){return e.replace(/[\s,]+/g," ").trim()}function rv(e){var t=new Set,n=[];return e.definitions.forEach((function(e){if("FragmentDefinition"===e.kind){var r=e.name.value,o=nv((s=e.loc).source.body.substring(s.start,s.end)),i=Xy.get(r);i&&!i.has(o)?ev&&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||Xy.set(r,i=new Set),i.add(o),t.has(o)||(t.add(o),n.push(e))}else n.push(e);var s})),h(h({},e),{definitions:n})}function ov(e){var t=nv(e);if(!Jy.has(t)){var n=function(e,t){return new Ky(e,t).parseDocument()}(e,{experimentalFragmentVariables:tv});if(!n||"Document"!==n.kind)throw new Error("Not a valid GraphQL document.");Jy.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}(rv(n)))}return Jy.get(t)}function iv(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]})),ov(r)}var sv,av=iv,lv=function(){Jy.clear(),Xy.clear()},cv=function(){ev=!1},uv=function(){tv=!0},fv=function(){tv=!1};(sv=iv||(iv={})).gql=av,sv.resetCaches=lv,sv.disableFragmentWarnings=cv,sv.enableExperimentalFragmentVariables=uv,sv.disableExperimentalFragmentVariables=fv,iv.default=iv;const pv=e=>"string"==typeof e?iv(e):e;function dv(e){return new L((t=>{const n=e.then((e=>e.subscribe(t))).catch((()=>t.unsubscribe()));return function(){t.unsubscribe(),n.then((e=>e?.unsubscribe())).catch((e=>console.log(e)))}}))}const hv=rt`
|
|
160
|
+
`,variables:{...e,source:Gn.CODEHOSTINTEGRATION,argument:e.argument&&JSON.stringify(e.argument),publicArgument:e.publicArgument&&JSON.stringify(e.publicArgument)},mightContainPrivateInfo:!1}).subscribe({error:e=>{}})})({name:e,userCookieID:await this.getAnonUserID(),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){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 Bp={allowErrorReporting:!1,sendTelemetry:!0,experimentalLinkPreviews:!1,experimentalTextFieldCompletion:!1,clickToGoToDefinition:!1},qp=({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:Bp[t]},async toggle(n){const r=await e(n);return await t(n,!r),!r}});const $p=qp({get:async function(e){const{featureFlags:t={}}=await Tt.sync.get();return t[e]},set:async function(e,t){const{featureFlags:n}=await Tt.sync.get("featureFlags");await Tt.sync.set({featureFlags:{...n,[e]:t}})}}),zp=qp({get:async e=>{const t=localStorage.getItem(e);return null===t?void 0:"true"===t},set:async(e,t)=>{localStorage.setItem(e,String(t))}}),Vp=Mt?zp:$p,Hp={sendTelemetry:!1,allowErrorReporting:!1,experimentalLinkPreviews:!1,experimentalTextFieldCompletion:!1,clickToGoToDefinition:!1},Gp=e=>({...Hp,...e}),Wp=()=>(Lt?At("sync","featureFlags"):Z(void 0)).pipe(J(Gp));function Qp(e){return Wp().pipe(J((t=>t[e])),Zo())}const Kp=e=>Ct(e).pipe(J((t=>!(xt()&&e)||!kt(t)))),Zp=e=>qo([Kp(e),Qp("sendTelemetry")]).pipe(J((([e,t])=>!!e||t)));function Yp(){const{host:e,pathname:t}=location,[n,r]=t.slice(1).split("/");if(!n||!r)throw new Qr(`Could not parse repoName from Bitbucket Cloud url: ${location.href}`);return`${e}/${n}/${r}`}const Jp={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){let e=parseInt(o.dataset.lineNum??"",10);if(!isNaN(e))return e;if(e=parseInt(o.textContent?.trim()??"",10),!isNaN(e))return e}throw new Error("Could not find line number")},getLineElementFromLineNumber:Xp,getCodeElementFromLineNumber:(e,t)=>{const n=Xp(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 Xp(e,t){let n=e.querySelector(`[data-line-num="${t}"]`);if(!n)for(const r of e.querySelectorAll(".line-number")){if(parseInt(r.textContent??"",10)===t){n=r;break}}if(!n)return console.error(`Could not find line number element for line #${t}`),null;const r=[...e.querySelectorAll(".line-number")].findIndex((e=>e===n)),o=e.querySelectorAll(".view-line")[r];return o||console.error(`Could not find line element for line #${t}`),o}function ed(e,t,n){const r=e.querySelector(`[aria-label="${"base"===n?"From":"To"} line ${t}"]`)?.closest(".line-wrapper")?.querySelector(".code-component");if(!r)throw new Error(`Could not locate line number element for line ${t}, part: ${String(n)}`);return r}const td={getCodeElementFromTarget:e=>e.closest(".code-diff"),getLineNumberFromCodeElement:e=>{const t=e.closest(".line-wrapper")?.querySelectorAll(".line-number-permalink");if(!t||0===t.length)throw new Error("Could not find line number permalink(s) for code element");const n=t[t.length-1],r=parseInt(n.textContent??"",10);if(!isNaN(r))return r;throw new Error("Could not find line number for code element")},getLineElementFromLineNumber:ed,getCodeElementFromLineNumber:(e,t,n)=>ed(e,t,n)?.querySelector(".code-diff"),getDiffCodePart:e=>{const t=e.closest(".code-component")?.querySelector(".line-type");if(t?.textContent?.includes("+"))return"head";if(t?.textContent?.includes("+"))return"base";if(!e.closest(".side-by-side"))return"head";const n=e.closest(".line-wrapper");if(n?.id)return n?.id.includes("oldline")?"base":"head";return 0===[...n?.parentElement?.childNodes||[]].findIndex((e=>e===n))?"base":"head"},isFirstCharacterDiffIndicator:()=>!1};function nd(e,t,n){const r=e.querySelector(`[data-${"base"===n?"f":"t"}num="${t}"]`)?.closest(".udiff-line");if(!r)throw new Error(`Could not locate line number element for line ${t}, part: ${String(n)}`);return r}const rd={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=n?.dataset.tnum;if(r){const e=parseInt(r,10);if(!isNaN(e))return e}const o=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:nd,getCodeElementFromLineNumber:(e,t,n)=>nd(e,t,n)?.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},od=e=>e.replace("//","/"),id=["modified","renamed","removed","added"];function sd(){const e=Yp(),t=location.pathname.match(/src\/(.*?)\/(.*)/);if(!t)throw new Error("Unable to determine revision or file path");const n=decodeURIComponent(t[1]);return{blob:{rawRepoName:e,revision:n,filePath:decodeURIComponent(t[2]),commitID: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}()??n}}}function ad(e){const t=Yp(),n=function(e){const t=[...e.querySelectorAll('[data-qa="bk-file__header"] span')];for(const e of t)for(const t of id)if(e.textContent?.toLowerCase().includes(t))return t;return"modified"}(e),{base:r,head:o}=function(e,t){const n=e.querySelector('[data-qa="bk-filepath"]')?.cloneNode(!0),r=n?.textContent;if(!(n instanceof HTMLElement&&r))throw new Error("Could not find breadcrumbs component for code view");if("added"===t)return{head:r};if("removed"===t)return{base:r};if("modified"===t)return{base:r,head:r};const o="<>SEPARATOR<>",i=n.querySelectorAll('[aria-label="arrow"]');for(const e of i)e.textContent=o;const[s,a,l]=n.textContent.split(/[{}]/),[c,u]=a.split(o);return{base:od(s+c+l),head:od(s+u+l)}}(e,n),{baseRevision:i,headRevision:s}=function(){const e=document.querySelector('[data-qa="pr-branches-and-state-styles"]');if(!e)throw new Error("Could not find branches element");const t=[...e.querySelectorAll('[aria-hidden="true"]')];if(2!==t.length)throw new Error("Expected source and destination branch elements");const n=t[0].textContent??"";return{baseRevision:t[1].textContent??"",headRevision:n}}();return"added"===n?{head:{rawRepoName:t,filePath:o,commitID:s,revision:s}}:"removed"===n?{base:{rawRepoName:t,filePath:r,commitID:i,revision:i}}:{head:{rawRepoName:t,filePath:o,commitID:s,revision:s},base:{rawRepoName:t,filePath:r,commitID:i,revision:i}}}function ld(e){const t=Yp(),n=function(e){const t=e.querySelector(".diff-entry-lozenge");for(const e of id)if(t?.textContent?.toLowerCase().includes(e))return e;return"modified"}(e),{head:r,base:o}=function(e,t){const n=e.querySelector(".filename")?.cloneNode(!0);if(!n)throw new Error("Could not find breadcrumbs component for code view");for(const e of n.childNodes)e instanceof HTMLSpanElement&&(e.textContent=null);const r=n.textContent.trim();if("added"===t)return{head:r};if("removed"===t)return{base:r};if("modified"===t)return{base:r,head:r};const[o,i,s]=r.split(/[{}]/).map((e=>e.trim())),[a,l]=i.split("\u2192").map((e=>e.trim()));return{base:od(o+a+s),head:od(o+l+s)}}(e,n),{baseCommitID:i,headCommitID:s}=function(){const e=document.querySelector('[title="Parent commit"]')?.href.match(/\/commits\/(.*)/);if(!e)throw new Error("Could not determine base commit ID");const t=e[1],n=window.location.href.match(/\/commits\/(.*)/);if(!n)throw new Error("Could not determine head commit ID");return{baseCommitID:t,headCommitID:n[1]}}();return"added"===n?{head:{rawRepoName:t,filePath:r,commitID:s}}:"removed"===n?{base:{rawRepoName:t,filePath:o,commitID:i}}:{head:{rawRepoName:t,filePath:r,commitID:s},base:{rawRepoName:t,filePath:o,commitID:i}}}const cd="codeHost-module__icon_3KtzB",ud="codeHost-module__commit-container_8Jft-";function fd(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 pd(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(ud);const r=document.createElement("div");return r.classList.add("sg-toolbar-mount"),n.prepend(r),r}const dd={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:fd,dom:td,resolveFileInfo:ad}:{element:e,getToolbarMount:fd,dom:Jp,resolveFileInfo:sd}},{selector:".bb-udiff",resolveView:e=>({element:e,getToolbarMount:pd,dom:rd,resolveFileInfo:ld})}],getContext:async function(){const e=Yp();return Promise.resolve({rawRepoName:e,revision:"",privateRepository:!1})},getViewContextOnSourcegraphMount:function(e){const t="open-on-sourcegraph",n=Ro(e,'[data-qa="page-header-wrapper"] > div > div');if(!n)return null;let r=n.querySelector("#open-on-sourcegraph");if(r)return r;r=document.createElement("span"),r.id=t;const o=n.childNodes[1]?.childNodes[1].firstChild;return o instanceof HTMLElement?o.append(r):n.append(r),r},check:function(){return"bitbucket.org"===location.hostname},viewOnSourcegraphButtonClassProps:{className:"codeHost-module__open-on-sourcegraph_10lR9",iconClassName:cd},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:cd},hoverOverlayClassProps:{className:"codeHost-module__hover-overlay_2e1lQ",closeButtonClassName:"codeHost-module__close_2lJ85",badgeClassName:"codeHost-module__badge_16Tsk",actionItemClassName:"codeHost-module__hover-overlay-action-item_39z-G",iconClassName:cd,contentClassName:"codeHost-module__content_eSBN7"},notificationClassNames:{1:"",2:"",3:"",4:"",5:""},codeViewsRequireTokenization:!0,observeLineSelection:Vo(window,"hashchange").pipe(ko(void 0),J((()=>(e=>{if(e.startsWith("#")&&(e=e.slice(1)),!/^lines-\d+(:\d+)?$/.test(e))return{};const t={},[n,r]=e.slice("lines-".length).split(":");return t.line=parseInt(n,10),r&&(t.endLine=parseInt(r,10)),t})(window.location.hash))))},hd=(e,t)=>n=>s()(e[n],t),md=/\/projects\/([^/]+)\/repos\/([^/]+)\//;const gd=(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},bd={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:gd,getCodeElementFromLineNumber:(e,t)=>gd(e,t).querySelector('.CodeMirror-line span[role="presentation"]')},yd=(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)}`)},vd={getCodeElementFromTarget:bd.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:yd,getCodeElementFromLineNumber:(e,t,n)=>yd(e,t,n).querySelector('.CodeMirror-line span[role="presentation"]'),getDiffCodePart:e=>{if(!document.querySelector(".side-by-side-diff"))return e.closest(".line").classList.contains("removed")?"base":"head";return e.closest(".diff-editor").previousElementSibling?.classList.contains("segment-connector-column")?"head":"base"},isFirstCharacterDiffIndicator:()=>!1},wd=(e,t,n)=>{for(const r of e.querySelectorAll(".diff-line-number")){const e=r.textContent?.trim().split(" ")[0];if(!e)continue;const o=parseInt(e,10);if(!isNaN(o)&&o===t){const e=r.closest("tr")?.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)}`)},Ed={getCodeElementFromTarget:e=>e.closest(".diff-line"),getLineNumberFromCodeElement:e=>{const t=e.closest("tr")?.querySelector(".diff-gutter .diff-line-number");if(t){const e=parseInt((t.textContent||"").trim(),10);if(!isNaN(e))return e}throw new Error("Could not find line number element for code element")},getDiffCodePart:e=>{const t=e.closest("tr")?.querySelectorAll(".diff-line");if(!t||0===t.length)throw new Error("Could not find diff lines for code element");if(1===t.length)return e.classList.contains("added-line")?"head":"base";const[n,r]=t;return e===n?"base":e===r?"head":e.classList.contains("removed-line")?"base":"head"},getLineElementFromLineNumber:wd,getCodeElementFromLineNumber:wd};var _d=o(11570),xd=o.n(_d);const Sd=(e,t,n)=>`${window.AJS?window.AJS.contextPath():window.location.origin}/rest/api/1.0/projects/${encodeURIComponent(e)}/repos/${t}${n}`,Cd=e=>Y(e,{selector:e=>Je(e).json()}),Od=We((({project:e,repoSlug:t,prID:n})=>Cd(Sd(e,t,`/pull-requests/${n}`)).pipe(J((({fromRef:e,toRef:t})=>({baseCommitID:t.latestCommit,headCommitID:e.latestCommit}))))),(({prID:e})=>e.toString())),Nd=We((({project:e,repoSlug:t,commitID:n})=>Cd(Sd(e,t,`/commits/${n}`)).pipe(J((({parents:e})=>xd()(e))),wt(hs),J((({id:e})=>e)))),(({project:e,repoSlug:t,commitID:n})=>`${e}:${t}:${n}`)),kd=["a.raw-view-link","a.source-view-link","a.mode-source"],Td=({repoSlug:e,project:t})=>[window.location.hostname,t,e].join("/"),Ad=e=>{const t=[];for(const n of kd)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[,s,a,l]=i,c=r.searchParams.get("at");if(!c)throw new Error(`href of link matching selector ${n} did not have 'at' search param: ${r.href}`);const u=c.match(/refs\/heads\/(.*?)$/),f=u?u[1]:c;return{rawRepoName:Td({repoSlug:a,project:s}),filePath:decodeURIComponent(l),revision:f,project:s,repoSlug:a}}catch(e){t.push(e);continue}throw nt(t)},Id=(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},Rd=e=>{const{rawRepoName:t,filePath:n,revision:r,project:o,repoSlug:i}=Ad(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}},Pd=({codeViewElement:e})=>e.querySelector(".change-type-lozenge"),Dd=({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-/,"")},Ld=({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 Sc.join(Sc.dirname(e),n[1])}}throw new Error(`Unexpected change type "${t}"`)}},Md=e=>{const t=e.querySelector(".breadcrumbs")??e.querySelector(".file-breadcrumbs");if(!t)throw new Error("Could not find diff code view breadcrumbs element through selector .breadcrumbs");const n=t.textContent;if(!n)throw new Error("Unexpected empty file path in breadcrumbs");const r=location.pathname.match(/\/projects\/(.*?)\/repos\/(.*?)\//);if(!r)throw new Error("Location did not match regexp");const[,o,i]=r,s=Td({project:o,repoSlug:i}),a=Pd({codeViewElement:e}),l=Dd({changeTypeElement:a});return{changeType:l,rawRepoName:s,filePath:n,baseFilePath:Ld({changeTypeElement:a,changeType:l,filePath:n})||n,project:o,repoSlug:i}};const jd=e=>{const t=Md(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 Od({...t,prID:i}).pipe(J((({headCommitID:e,baseCommitID:t})=>({head:{rawRepoName:n,filePath:r,commitID:e},base:{rawRepoName:n,filePath:o,commitID:t}}))))},Fd="codeHost-module__command-palette-button_1LPsz",Ud="codeHost-module__command-palette-popover_wqnFp",Bd="codeHost-module__no-results_3Di26",qd="codeHost-module__open-on-sourcegraph_i9J2G",$d="codeHost-module__sg-toolbar-mount_2Fbz5",zd="codeHost-module__code-view-toolbar_IVqgq",Vd="codeHost-module__action-nav-item_223JV",Hd="codeHost-module__action-nav-item-new-diff_23eTl",Gd="codeHost-module__action-item-new-diff_3Tuv4",Wd="codeHost-module__hover-action-item_9CC-W",Qd="codeHost-module__command-list-popover-button_3eptU",Kd=(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($d),r.prepend(o),o},Zd=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 s=t===rs.ActualToCodeView?-1:1;return Z({line:r.line,character:r.character+s*i})},Yd={getToolbarMount:Kd,dom:bd,resolveFileInfo:e=>({blob:Rd(e)}),getPositionAdjuster:()=>Zd(bd)},Jd={getToolbarMount:Kd,dom:vd,getPositionAdjuster:()=>Zd(vd),overrideTokenize:!0},Xd={...Jd,resolveFileInfo:e=>{const{changeType:t,rawRepoName:n,filePath:r,commitID:o,baseFilePath:i,revision:s,...a}=(e=>{const{rawRepoName:t,project:n,repoSlug:r,filePath:o}=Ad(e),i=Id(),s=Pd({codeViewElement:e}),a=Dd({changeTypeElement:s});return{changeType:a,rawRepoName:t,filePath:o,baseFilePath:Ld({changeTypeElement:s,changeType:a,filePath:o})||o,commitID:i,project:n,repoSlug:r}})(e);return"ADD"===t?Z({head:{rawRepoName:n,filePath:r,commitID:o}}):Nd({commitID:o,...a}).pipe(J((e=>"DELETE"===t?{base:{rawRepoName:n,filePath:i,commitID:e}}:{base:{rawRepoName:n,filePath:i,commitID:e},head:{rawRepoName:n,filePath:r,commitID:o}})))}},eh={...Jd,resolveFileInfo:jd},th={...Jd,resolveFileInfo:e=>{const{rawRepoName:t,filePath:n,baseFilePath:r}=Md(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}}}},nh={...Jd,resolveFileInfo:e=>(e=>{const t=Id(".commit-badge-oneline .commitid"),n=Id(".commit-parents .commitid"),{rawRepoName:r,filePath:o,baseFilePath:i}=Md(e);return{head:{rawRepoName:r,filePath:o,commitID:t},base:{rawRepoName:r,filePath:i,commitID:n}}})(e)},rh={selector:".change-view",resolveView:e=>({element:e,...oh})},oh={resolveFileInfo:jd,getToolbarMount:e=>Kd(e,".change-header .diff-actions"),toolbarButtonProps:{listItemClass:Hd,actionItemClass:Gd},dom:Ed};const ih="aui-icon",sh={[cu]:"aui-message aui-message-info",[uu]:"aui-message aui-message-success",[lu]:"aui-message aui-message-info",[au]:"aui-message aui-message-warning",[su]:"aui-message aui-message-error"},ah={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,...th};if((({pathname:e})=>/\/projects\/[^/]+\/repos\/[^/]+\/commits\/\w+$/.test(e))(window.location))return{element:e,...nh};if(e.querySelector(".mode-toggle")){return t.classList.contains("diff-view")?{element:e,...Xd}:{element:e,...Yd}}return(({pathname:e})=>/\/projects\/[^/]+\/repos\/[^/]+\/pull-requests\/\d+/.test(e))(window.location)?{element:e,...eh}:(console.error("Unknown code view",e),null)}},rh],getCommandPaletteMount:e=>{const t=Ro(e,".aui-header-primary .aui-nav");if(!t)return null;const n=["command-palette-button",Fd];return t.querySelector(n.map((e=>`.${e}`)).join(""))||(()=>{const e=document.createElement("li");return e.className=n.join(" "),t.append(e),e})()},notificationClassNames:sh,commandPaletteClassProps:{buttonClassName:s()(Qd,"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:s()(Ud,"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:Bd,iconClassName:ih},codeViewToolbarClassProps:{className:s()(zd,"aui-buttons"),actionItemClass:"aui-button",actionItemIconClass:"aui-icon",listItemClass:Vd},hoverOverlayClassProps:{className:"aui-dialog",actionItemClassName:s()("aui-button",Wd),getAlertClassName:hd(sh),iconClassName:ih},getViewContextOnSourcegraphMount:function(e){const t=Ro(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=qd,t.append(r),r},getContext:async function(){const e=function(e){const{hostname:t,pathname:n}=e,r=n.match(md);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(){const e=document.querySelector("#repository-layout-revision-selector .name[data-revision-ref]");if(!e)throw new Error("branchNameElement not found");const t=e.getAttribute("data-revision-ref");let n=null;if(t)try{n=JSON.parse(t)}catch{throw new Error(`Could not parse revisionRefStr: ${t}`)}if(n?.latestCommit)return{revision:n.latestCommit};throw new Error(`revisionRefInfo is empty or has no latestCommit (revisionRefStr: ${String(t)})`)}()}catch{}return Promise.resolve({...e,...t,privateRepository:"bitbucket.org"!==window.location.hostname})},viewOnSourcegraphButtonClassProps:{className:"aui-button",iconClassName:ih},codeViewsRequireTokenization:!1,observeLineSelection:Vo(window,"hashchange").pipe(ko(void 0),J((()=>(e=>{if(e.startsWith("#")&&(e=e.slice(1)),!/^\d+(-\d+)?$/.test(e))return{};const t={},[n,r]=e.split("-");return t.line=parseInt(n,10),r&&(t.endLine=parseInt(r,10)),t})(window.location.hash))))};var lh=o(65291),ch=o.n(lh),uh=o(92674),fh=o.n(uh),ph=o(26416),dh=o.n(ph);function hh(e){return new L((function(t){var n;try{n=e()}catch(e){return void t.error(e)}return(n?W(n):Ce()).subscribe(t)}))}function mh(e){return t=>hh((()=>{const n=new Map;return t.pipe(Ne(Bt),yt(),ze((({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))}})),ht((t=>W(t.addedNodes).pipe(wt(ds(HTMLElement)),ht((t=>W(e).pipe(ht((({selector:e,resolveView:n})=>[...gh(t,e)].map((e=>{const t=n(e);return t&&{...t,subscriptions:new N}})))),wt(hs),wt((e=>!n.has(e.element))),ze((e=>{n.set(e.element,e)})))))))))}))}function gh(e,t){if("string"==typeof t)return Io(e,t);return t(e)||[]}const bh=/patchset (\d+)/i;function yh(e,t){return`refs/changes/${e.slice(-2).padStart(2,"0")}/${e}/${t}`}function vh(e){return Th(document.body,e)?.textContent??void 0}function wh(e){const t=bh.exec(e);if(t?.[1])return t[1]}function Eh(){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],s=e.slice(n+3).join("/"),a=window.location.hostname+"/"+r,{basePatchsetId:l,headPatchsetId:c}=function(){const e=vh("#app >> #app-element >> gr-change-view >> #fileListHeader >> #rangeSelect >> #basePatchDropdown >> #triggerText")??vh("#app >> #app-element >> gr-diff-view >> #rangeSelect >> #basePatchDropdown >> #triggerText"),t=vh("#app >> #app-element >> gr-change-view >> #fileListHeader >> #rangeSelect >> #patchNumDropdown >> #triggerText")??vh("#app >> #app-element >> gr-diff-view >> #rangeSelect >> #patchNumDropdown >> #triggerText");return{basePatchsetId:e&&wh(e),headPatchsetId:t&&wh(t)}}();return{repoName:a,changeId:o,patchsetId:c||i,filePath:s,basePatchsetId:l}}const _h={selector(e){if(e.matches("#diffTable"))return[e];const t=Th(document,"#app >> #app-element >> gr-change-view >> #fileList")?.shadowRoot?.querySelectorAll(".file-row.expanded"),n=[...t||[]].map((e=>{const t=e.parentElement;if(t)return Th(t,"gr-diff-host >> gr-diff >> #diffTable")}));return dh()(n)},resolveView(e){const t=Ah(e,".stickyArea");if(!t)return null;const n=t.querySelector(".file-row")?.getAttribute("data-path");if(!n)return null;const r=Eh();if(!r.patchsetId)return console.error("Sourcegraph: Cannot get Gerrit patchset ID"),null;const o=yh(r.changeId,r.patchsetId);let i;return i=r.basePatchsetId?yh(r.changeId,r.basePatchsetId):function(){const e=Th(document.body,"#app >> #app-element >> gr-change-view >> #metadata >> gr-commit-info");if(!e)return null;return e?.shadowRoot?.querySelector(".container")?.textContent?.trim()}()||o+"^",Rh(e),{element:e,dom:Sh,resolveFileInfo(){const e={base:{filePath:n||"",rawRepoName:r.repoName,commitID:i},head:{filePath:n||"",rawRepoName:r.repoName,commitID:o}};return console.log("resolveFileListCodeView: fileInfo",e),e}}}},xh=(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){const n=[...e.parentElement?.childNodes||[]],r=n.slice(n.indexOf(e)+1);for(const e of r)if(e instanceof HTMLElement&&e.matches(t))return e;return null}(o,"td.content")?.querySelector(".contentText");return i},Sh={getLineElementFromLineNumber:xh,getCodeElementFromLineNumber:xh,getCodeElementFromTarget:e=>{const t=e.closest("td.content"),n=t?.closest("tr")?.querySelector("[data-line-number]");if(n){if("FILE"===n.getAttribute("data-line-number"))return null}return t},getLineNumberFromCodeElement:e=>{const t=kh(e);if(!t)throw console.error(e),new TypeError("Could not find line number (no side)");const n=e.closest("td")?.parentElement?.querySelector(`.lineNum.${t}`),r=n?.getAttribute("data-value");if(!r)throw new TypeError(`Could not find line number (${t})`);return parseInt(r,10)},getDiffCodePart:e=>{const t=kh(e);return"left"===t?"base":"right"===t?"head":(console.error("Cannot tell: base or head"),"base")}},Ch=[{selector(e){const t=Th(document.body,"#app >> #app-element >> gr-diff-view >> #diffHost >> #diff >> #diffTable");return t?[t]:[]},resolveView(e){const t=Eh();if(!t.patchsetId)return console.error("Sourcegraph: cannot find patchset ID"),null;const n=yh(t.changeId,t.patchsetId);let r=n+"^";return t.basePatchsetId&&(r=yh(t.changeId,t.basePatchsetId)),Rh(e),{element:e,dom:Sh,getToolbarMount(e){const t=function(e){const t=Ah(e,"gr-diff-view")?.shadowRoot?.querySelector("gr-fixed-panel .subHeader");return t}(e)?.querySelector(".patchRangeLeft");if(!t)throw new Error("Could not find subheader");const n=t.querySelector(".sourcegraph-toolbar-mount");if(n)return n;const r=document.createElement("div");return r.classList.add("sourcegraph-toolbar-mount"),t.append(r),t.append(Ih(Ph)),r},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}}}},_h],Oh={type:"gerrit",name:"Gerrit",codeViewResolvers:Ch,contentViewResolvers:[],nativeTooltipResolvers:[],codeViewsRequireTokenization:!0,observeMutations:(e,t,n)=>{let r=[];return lp(1500).pipe(J((()=>{const{filePath:e=""}=Eh(),t=[...Ch.map((e=>e.selector)),Nh].map((e=>[...gh(document.body,e)])).flat(),n=t.filter((t=>!fh()(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=>!fh()(o,e))),{addedNodes:n,removedNodes:o.map((e=>e.element))}})),wt((({addedNodes:e,removedNodes:t})=>!!e.length||!!t.length)),J((e=>[e])),qe(),Pe())},getContext:async()=>{const{repoName:e,changeId:t,patchsetId:n}=Eh();return Promise.resolve({privateRepository:!0,rawRepoName:e,revision:n&&yh(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=ch()(Nh(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(Ih(Ph)),r}},Nh=()=>{const e=Th(document.body,"#app >> #app-element >> gr-change-view >> #actions >> #secondaryActions");return e?[e]:null};function kh(e){if("unified"===function(e){return e.closest("tr")?.matches(".unified")?"unified":"side-by-side"}(e)){const t=e.closest("tr")?.querySelector("td.right")?.getAttribute("data-value");return t?"right":"left"}return e.closest("td")?.previousElementSibling?.matches(".right")?"right":"left"}function Th(e,t){"string"==typeof t&&(t=t.split(">>"));let n=e;const r=t.slice(0,-1),o=t[t.length-1];for(const e of r){if(!n)return null;n=n.querySelector(e)?.shadowRoot||null}return n?.querySelector(o)}function Ah(e,t){for(;;){const n=e.closest(t);if(n)return n;if(e=e.getRootNode()?.host,!e||e===document.getRootNode())return null}}function Ih(e){const t=document.createElement("style");return t.textContent=e,t}function Rh(e){if(!e.querySelector("style.sourcegraph-injected-style")){const t=Ih(Dh);t.classList.add("sourcegraph-injected-style"),e.append(t)}}const Ph="\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",Dh="\n.sourcegraph-document-highlight {\n background-color: var(--secondary);\n}\n.selection-highlight {\n background-color: var(--mark-bg);\n}\n";var Lh=o(36021),Mh=o.n(Lh);const jh=(e,t)=>({selector:e,resolveView:e=>({...t,element:e})}),Fh=(e,t,n)=>((e,t)=>{const{repoName:n,commitID:r}=e;return Jr({repoName:n,revision:r,requestGraphQL:t}).pipe(Xr())})(e,n).pipe(ae((()=>eo({repoName:e.repoName,filePath:e.filePath,commitID:e.commitID,requestGraphQL:n}))),J((t=>t?{...e,content:t.join("\n")}:{...e})),ue((n=>W(t(n)).pipe(ae((t=>{if(t)return Z(e);throw n}))))));function Uh(){return Qt(jr(window.location.hash))}function Bh(){return Vo(window,"hashchange").pipe(J(Uh),Zo(((e,t)=>Do()(e,t))))}function qh(e){const t=e.title.split(" \u2192 ");return t.length>1?{headFilePath:t[1],baseFilePath:t[0]}:{headFilePath:t[0],baseFilePath:t[0]}}function $h(e){const{pageType:t}=Wh();if(!Gh(t))return null;let n="",r="";if("pull"===t){const t=document.querySelector("details-menu[src*='sha1='][src*='sha2=']")?.getAttribute("src"),o=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(o){const t=function(e){const t=e.querySelector(`summary a[href^="${location.pathname}"`);if(!t)return null;const n=t.href.match(zh);if(!n)return null;const r=n[3],o=Vh(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?Vh(document.documentElement.innerHTML,"pull"===t):{baseCommitID:n,headCommitID:r}}const zh=/\/files\/((\w+)\.\.)?(\w+)#diff-\w+$/;function Vh(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 Hh(){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 Gh(e){switch(e){case"commit":case"pull":case"compare":return!0;default:return!1}}function Wh(e=window.location){const{host:t,pathname:n}=e,[r,o,i,...s]=n.slice(1).split("/");if(!r||!o)throw new Qr(`Could not parse repoName from GitHub url: ${e.href}`);const a=`${r}/${o}`,l=`${t}/${a}`;switch(i){case"blob":case"tree":return{pageType:i,rawRepoName:l,revisionAndFilePath:decodeURIComponent(s.join("/")),repoName:a};case"pull":case"commit":case"compare":return{pageType:i,rawRepoName:l,repoName:a};default:return{pageType:"other",rawRepoName:l,repoName:a}}}const Qh=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")},Kh=e=>{const t=e.closest("td.blob-code");return!t||t.parentElement?.classList.contains("js-expandable-line")?null:t},Zh=(e,t,n)=>{const r=rm(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 s;if(r)s=i.nextElementSibling;else{s=i.parentElement.lastElementChild}return s},Yh=e=>e.classList.contains("blob-code-inner")?e:e.querySelector(".blob-code-inner"),Jh={getCodeElementFromTarget:e=>{const t=Kh(e);return t&&Yh(t)},getLineElementFromLineNumber:Zh,getCodeElementFromLineNumber:(e,t,n)=>{const r=Zh(e,t,n);return r&&Yh(r)},getLineNumberFromCodeElement:Qh,getDiffCodePart:e=>{const t=e.closest("td");return t.classList.contains("blob-code-addition")?"head":t.classList.contains("blob-code-deletion")||rm(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")?.querySelector("td[data-code-marker]"),o=t?.hasAttribute("data-code-marker"),i=r||o,s=e.closest(".refined-github-diff-signs");return!n&&!i&&!s}},Xh=(e,t)=>{const n=e.querySelector(`td[data-line-number="${t}"]`);return n&&n.nextElementSibling},em={getCodeElementFromTarget:Kh,getCodeElementFromLineNumber:Xh,getLineElementFromLineNumber:Xh,getLineNumberFromCodeElement:Qh},tm=(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},nm={getCodeElementFromTarget:Kh,getCodeElementFromLineNumber:tm,getLineElementFromLineNumber:tm,getLineNumberFromCodeElement:e=>{const t=e.closest("td").previousElementSibling;return parseInt(t.firstElementChild.textContent,10)}};function rm(e){const{pageType:t}=Wh();if(!Gh(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 om=()=>{const e=Wh();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=Hh(),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:To({selector:".js-permalink-shortcut",hrefRegex:/^\/.*?\/.*?\/(?:blob|tree)\/([\da-f]{40})/})}}},im=/\/([\da-f]{40})$/i,sm=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(im);if(!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),s=Wh(i);if("blob"!==s.pageType)throw new Error(`Snippet URL does not match a blob url: ${i.href}`);const{revisionAndFilePath:a,rawRepoName:l}=s;if(!a.startsWith(r))throw new Error(`Could not parse filePath: revAndFilePath ${a} does not start with commitID ${r}`);return{blob:{rawRepoName:l,filePath:a.slice(r.length+1),commitID:r,revision:r}}},am=["tooltipped","tooltipped-n"];const lm="codeHost-module__command-palette-popover_xVrp2",cm="codeHost-module__command-palette-action-item_16BFG",um="codeHost-module__action-item_7QWb2",fm="codeHost-module__icon_3PdA7",pm="codeHost-module__code-view-toolbar_gOzAp",dm="codeHost-module__code-view-toolbar-item_2fTzz",hm="codeHost-module__hover-overlay-badge_3wpZt";function mm(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 gm={dom:Jh,getToolbarMount:mm,resolveFileInfo:e=>{const{rawRepoName:t}=Wh(),{headFilePath:n,baseFilePath:r}=function(e){const t=e.querySelector(".file-info");if(t){if("A"===t.tagName)return qh(t);const e=t.querySelector(".diffstat + a");if(e)return qh(e)}const n=e.querySelector(".file-header a");if(n)return qh(n);throw new Error("Could not determine diff file name")}(e);if(!n)throw new Error("cannot determine file path");const o=$h(e);if(!o)throw new Error("cannot determine delta info");const{headCommitID:i,baseCommitID:s}=o;return{head:{rawRepoName:t,filePath:n,commitID:i,revision:i},base:{rawRepoName:t,filePath:r||n,commitID:s,revision:s}}},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]}},bm={...gm,getToolbarMount:void 0},ym={dom:em,getToolbarMount:mm,resolveFileInfo:om,getSelections:Uh,observeSelections:Bh},vm=e=>({direction:t,codeView:n,position:r})=>eo({...r,requestGraphQL:e}).pipe(J((e=>{const o=em.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],s=o.textContent||"",a=i.length-Mh()(i).length,l=s.length-Mh()(s).length,c=t===rs.ActualToCodeView?-1:1,u=Math.abs(a-l)*c;return{line:r.line,character:r.character+u}}))),wm=jh(".code-list-item",{dom:nm,getPositionAdjuster:vm,resolveFileInfo:sm}),Em={dom:em,resolveFileInfo:sm,getPositionAdjuster:vm},_m=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")?.closest(".BtnGroup");if(!o?.parentNode)throw new Error("File actions not found");return o.parentNode.insertBefore(r,o),r},xm={selector:".js-file-line-container",resolveView:e=>{const t=e.closest(".blob-wrapper-embedded");if(t){return{element:t.parentElement,...Em}}const{pageType:n}=Wh();if("blob"!==n)return null;const r=e.closest(".repository-content")||e.closest("#repo-content-turbo-frame");if(!r)throw new Error("Could not find repository content element");return{element:r,...ym,getToolbarMount:_m}}},Sm={selector:e=>{const t=new Set;for(const n of Io(e,".file"))0===n.querySelectorAll(".js-diff-load-container").length&&t.add(n);for(const n of Io(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}=Wh();return"blob"===t&&1===document.querySelectorAll(".file").length&&0===document.querySelectorAll(".diff-view").length?{element:e,...ym}:e.closest(".discussion-item-body")||e.classList.contains("js-comment-container")?{element:e,...bm}:{element:e,...gm}}};function Cm(){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 Om="open-on-sourcegraph",Nm=s()(fm,"v-align-text-bottom"),km={[cu]:"flash",[uu]:"flash flash-success",[lu]:"flash",[au]:"flash flash-warn",[su]:"flash flash-error"},Tm={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})=>{const r="#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"))})(document.querySelector(r)??(()=>{const e=n.cloneNode(!0);e.id=r.replace("#",""),e.classList.remove("navigation-focus"),e.setAttribute("aria-selected","false");const t=document.createElement("img");t.src="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNTIgNTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTMwLjggNTEuOGMtMi44LjUtNS41LTEuMy02LTQuMUwxNy4yIDYuMmMtLjUtMi44IDEuMy01LjUgNC4xLTZzNS41IDEuMyA2IDQuMWw3LjYgNDEuNWMuNSAyLjgtMS40IDUuNS00LjEgNnoiIGZpbGw9IiNGRjU1NDMiLz48cGF0aCBkPSJNMTAuOSA0NC43QzkuMSA0NSA3LjMgNDQuNCA2IDQzYy0xLjgtMi4yLTEuNi01LjQuNi03LjJMMzguNyA4LjVjMi4yLTEuOCA1LjQtMS42IDcuMi42IDEuOCAyLjIgMS42IDUuNC0uNiA3LjJsLTMyIDI3LjNjLS43LjYtMS42IDEtMi40IDEuMXoiIGZpbGw9IiNBMTEyRkYiLz48cGF0aCBkPSJNNDYuOCAzOC4xYy0uOS4yLTEuOC4xLTIuNi0uMkw0LjQgMjMuOGMtMi43LTEtNC4xLTMuOS0zLjEtNi42IDEtMi43IDMuOS00LjEgNi42LTMuMWwzOS43IDE0LjFjMi43IDEgNC4xIDMuOSAzLjEgNi42LS42IDEuOC0yLjIgMy0zLjkgMy4zeiIgZmlsbD0iIzAwQ0JFQyIvPjwvc3ZnPgo=",t.setAttribute("style","width: 16px; height: 20px; float: left; margin-right: 2px;"),t.setAttribute("alt","Sourcegraph Logo Image");const o=e.querySelector(".js-jump-to-badge-search-text-global");return o.textContent="Sourcegraph",o.parentNode?.insertBefore(t,o),n.parentNode?.insertBefore(e,n.nextElementSibling),e})())}},Am=async(e,t=Jf.fetchCache,n="#repository-container-header h2 span.Label")=>{if("github.com"!==window.location.hostname)return Promise.resolve(!0);try{const{status:n}=await t({url:`https://github.com/${e}`,credentials:"omit",cacheMaxAge:36e5});return 200!==n}catch(e){return console.warn("Failed to fetch if the repository is private.",e),"public"!==document.querySelector(n)?.textContent?.toLowerCase().trim()}},Im=()=>"/search"===window.location.pathname,Rm=()=>"/search/advanced"===window.location.pathname,Pm=()=>!Im()&&window.location.pathname.endsWith("/search"),Dm=()=>Boolean(new URLSearchParams(window.location.search).get("q"))&&!Rm(),Lm=()=>{const e=new URLSearchParams(window.location.search).get("type");return e?e.toLowerCase():""},Mm=e=>{const t=e.filter(Boolean).map((e=>e.trim())),n=(()=>{switch(Lm()){case"repositories":return"repo";case"commits":return"commit";case"code":return"";default:return Im()||Rm()?"repo":""}})(),r=new URLSearchParams(window.location.search).get("l");if(n&&t.push(`type:${n}`),r&&t.push(`lang:${encodeURIComponent(r)}`),Pm()){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("+")},jm=(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 Fm={type:"github",name:Cm()?"GitHub Enterprise":"GitHub",searchEnhancement:Tm,enhanceSearchPage:function(e){if(!(Im()||Rm()||Pm()||Dm()))return;const t=({container:t,className:n="",getSearchQuery:r,utmCampaign:o})=>{const i=Zf(new URL("/search",e),{utm_source:Ot(),utm_campaign:o});(0,Mo.s)(t).render((0,u.jsx)(up,{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:s()("btn","m-auto",n),iconClassName:s()("mr-1","v-align-middle",fm),href:i.href,dataTestId:"search-on-sourcegraph",onClick:e=>{const t=Mm(r());e.target.href=`${i.href}${t?`&q=${t}`:""}`}}))};if(Dm()){const e=Lm();if(["repositories","commits","code"].includes(e)||""===e&&(Im()||Pm())){const e=document.querySelector(".application-main form.js-site-search-form"),n=e?.querySelector("input.form-control[name='q']"),r=e?.parentElement?.parentElement?.querySelector("button[type='submit']");if(n&&r){const e=jm("pageSearchFormSourcegraphButton","ml-2 d-none d-md-block");r.after(e),t({container:e,utmCampaign:"github-search-results-page",getSearchQuery:()=>n.value.split(" ")})}const o=document.querySelector("header form.js-site-search-form input.form-control[name='q']"),i=document.querySelector(".codesearch-results"),s=i?.querySelector(".blankslate"),a=i?.querySelector("div > div > h3");if(o&&(s||a)){const e=jm("headerSearchInputSourcegraphButton","ml-auto d-none d-lg-block");s?(e.classList.add("mt-2"),s.append(e)):a&&(e.classList.add("mr-2"),a.after(e)),t({container:e,className:s?"":"btn-sm",utmCampaign:"github-search-results-page",getSearchQuery:()=>o.value.split(" ")})}}return}const n=document.querySelector("#search_form"),r=n?.querySelector(".search-form-fluid"),o=n?.querySelector("input");if(r&&o){const e=jm("searchInputSourcegraphButton","ml-0 ml-md-2 mt-2 mt-md-0");r?.append(e),t({container:e,utmCampaign:`github-${Rm()?"advanced":"simple"}-search-page`,getSearchQuery:()=>o.value.split(" ")})}},codeViewResolvers:[Sm,xm,wm],contentViewResolvers:[{selector:".markdown-body",resolveView:e=>({element:e})}],nativeTooltipResolvers:[{selector:".js-tagsearch-popover",resolveView:e=>({element:e})}],routeChange:e=>e.pipe(J((()=>{const{pathname:e}=window.location,t=e.slice(1).split("/")[2];return"blob"===t||"tree"===t?e.endsWith(Hh())?e:void 0:Dm()?document.querySelector(".codesearch-results h3")?.textContent?.trim():e})),wt(Boolean),Zo()),getContext:async()=>{const{repoName:e,rawRepoName:t,pageType:n}=Wh();return{rawRepoName:t,revision:"blob"===n||"tree"===n?om().blob.revision:void 0,privateRepository:await Am(e)}},isLightTheme:hh((()=>{const e=document.documentElement.dataset.colorMode;return"auto"===e?((e=window)=>{const t=e.matchMedia("(prefers-color-scheme: dark)");return{observable:vt(Z(!t.matches),Vo(t,"change").pipe(J((e=>!e.matches)))),initialValue:!t.matches}})().observable:Z("dark"!==e)})),getViewContextOnSourcegraphMount:e=>{const t=Ro(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=Om,t.prepend(n),n)},viewOnSourcegraphButtonClassProps:{className:"btn btn-sm tooltipped tooltipped-s",iconClassName:Nm},check:()=>((e=window.location.href)=>/^https?:\/\/(www\.)?github\.com/.test(e))()||Cm(),getCommandPaletteMount:e=>{const t="command-palette-button",n=e.querySelector(`.Header .${t}`)||e.querySelector(`.Header-old .${t}`);if(n)return n;const r=Ro(e,".HeaderMenu > :last-child");if(r){const e=document.createElement("div");return e.classList.add(t),r.prepend(e),e}let o=Ro(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:km,commandPaletteClassProps:{buttonClassName:"Header-link d-flex flex-items-baseline",popoverClassName:s()("Box",lm),formClassName:"p-1",inputClassName:"form-control input-sm header-search-input jump-to-field-active",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:s()(cm,"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:Nm},codeViewToolbarClassProps:{className:pm,listItemClass:s()(dm,"BtnGroup"),actionItemClass:s()("btn btn-sm tooltipped tooltipped-s BtnGroup-item",um),actionItemPressedClass:"selected",actionItemIconClass:s()(fm,"v-align-text-bottom")},hoverOverlayClassProps:{className:"Box",actionItemClassName:"btn btn-sm btn-secondary",actionItemPressedClassName:"active",closeButtonClassName:"btn-octicon p-0 hover-overlay__close-button--github",badgeClassName:s()("label",hm),getAlertClassName:hd(km,"flash-full"),iconClassName:Nm},setElementTooltip:function(e,t){"string"==typeof t?(e.classList.add(...am),e.setAttribute("aria-label",t)):(e.classList.remove(...am),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 zr(e,t);if(!t.rawRepoName.startsWith(window.location.hostname))return zr(e,t);const r=t.revision||"HEAD",{rawRepoName:o}=Wh();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}`},observeLineSelection:Vo(window,"hashchange").pipe(ko(void 0),J((()=>(e=>{const t=e.match(/(L\d+)/g);if(!t||t.length>2)return{};const n={},[r,o]=t.map((e=>e.slice(1)));return n.line=parseInt(r,10),o&&(n.endLine=parseInt(o,10)),n})(window.location.hash)))),codeViewsRequireTokenization:!0};var Um=o(6314);function Bm(){var e=(0,Um.R)(),t=e.crypto||e.msCrypto;if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");var n=t&&t.getRandomValues?()=>t.getRandomValues(new Uint8Array(1))[0]:()=>16*Math.random();return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^(15&n())>>e/4).toString(16)))}var qm=o(91698),$m=(0,Um.R)(),zm=["debug","info","warn","error","log","assert","trace"];function Vm(e){var t=(0,Um.R)();if(!("console"in t))return e();var n=t.console,r={};zm.forEach((e=>{var o=n[e]&&n[e].__sentry_original__;e in t.console&&o&&(r[e]=n[e],n[e]=o)}));try{return e()}finally{Object.keys(r).forEach((e=>{n[e]=r[e]}))}}function Hm(){let e=!1;var t={enable:()=>{e=!0},disable:()=>{e=!1}};return"undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__?zm.forEach((n=>{t[n]=(...t)=>{e&&Vm((()=>{$m.console[n](`Sentry Logger [${n}]:`,...t)}))}})):zm.forEach((e=>{t[e]=()=>{}})),t}let Gm;Gm="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__?(0,Um.Y)("logger",Hm):Hm();var Wm,Qm=o(38241),Km=Object.prototype.toString;function Zm(e,t){return Km.call(e)===`[object ${t}]`}function Ym(e){return Zm(e,"Object")}function Jm(e){return Boolean(e&&e.then&&"function"==typeof e.then)}!function(e){e[e.PENDING=0]="PENDING";e[e.RESOLVED=1]="RESOLVED";e[e.REJECTED=2]="REJECTED"}(Wm||(Wm={}));class Xm{__init(){this._state=Wm.PENDING}__init2(){this._handlers=[]}constructor(e){Xm.prototype.__init.call(this),Xm.prototype.__init2.call(this),Xm.prototype.__init3.call(this),Xm.prototype.__init4.call(this),Xm.prototype.__init5.call(this),Xm.prototype.__init6.call(this);try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}then(e,t){return new Xm(((n,r)=>{this._handlers.push([!1,t=>{if(e)try{n(e(t))}catch(e){r(e)}else n(t)},e=>{if(t)try{n(t(e))}catch(e){r(e)}else r(e)}]),this._executeHandlers()}))}catch(e){return this.then((e=>e),e)}finally(e){return new Xm(((t,n)=>{let r,o;return this.then((t=>{o=!1,r=t,e&&e()}),(t=>{o=!0,r=t,e&&e()})).then((()=>{o?n(r):t(r)}))}))}__init3(){this._resolve=e=>{this._setResult(Wm.RESOLVED,e)}}__init4(){this._reject=e=>{this._setResult(Wm.REJECTED,e)}}__init5(){this._setResult=(e,t)=>{this._state===Wm.PENDING&&(Jm(t)?t.then(this._resolve,this._reject):(this._state=e,this._value=t,this._executeHandlers()))}}__init6(){this._executeHandlers=()=>{if(this._state!==Wm.PENDING){var e=this._handlers.slice();this._handlers=[],e.forEach((e=>{e[0]||(this._state===Wm.RESOLVED&&e[1](this._value),this._state===Wm.REJECTED&&e[2](this._value),e[0]=!0)}))}}}}function eg(e){return tg(e,new Map)}function tg(e,t){if(Ym(e)){if(void 0!==(o=t.get(e)))return o;var n={};for(var r of(t.set(e,n),Object.keys(e)))void 0!==e[r]&&(n[r]=tg(e[r],t));return n}if(Array.isArray(e)){var o;if(void 0!==(o=t.get(e)))return o;n=[];return t.set(e,n),e.forEach((e=>{n.push(tg(e,t))})),n}return e}function ng(e){var t=(0,qm.ph)(),n={sid:Bm(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return eg({sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}(n)};return e&&rg(n,e),n}function rg(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||(0,qm.ph)(),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Bm()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{var n=e.timestamp-e.started;e.duration=n>=0?n:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}class og{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={}}static clone(e){var t=new og;return e&&(t._breadcrumbs=[...e._breadcrumbs],t._tags={...e._tags},t._extra={...e._extra},t._contexts={...e._contexts},t._user=e._user,t._level=e._level,t._span=e._span,t._session=e._session,t._transactionName=e._transactionName,t._fingerprint=e._fingerprint,t._eventProcessors=[...e._eventProcessors],t._requestSession=e._requestSession,t._attachments=[...e._attachments]),t}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{},this._session&&rg(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts={...this._contexts,[e]:t},this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){var e=this.getSpan();return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;if("function"==typeof e){var t=e(this);return t instanceof og?t:this}return e instanceof og?(this._tags={...this._tags,...e._tags},this._extra={...this._extra,...e._extra},this._contexts={...this._contexts,...e._contexts},e._user&&Object.keys(e._user).length&&(this._user=e._user),e._level&&(this._level=e._level),e._fingerprint&&(this._fingerprint=e._fingerprint),e._requestSession&&(this._requestSession=e._requestSession)):Ym(e)&&(e=e,this._tags={...this._tags,...e.tags},this._extra={...this._extra,...e.extra},this._contexts={...this._contexts,...e.contexts},e.user&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint&&(this._fingerprint=e.fingerprint),e.requestSession&&(this._requestSession=e.requestSession)),this}clear(){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._attachments=[],this}addBreadcrumb(e,t){var n="number"==typeof t?Math.min(t,100):100;if(n<=0)return this;var r={timestamp:(0,qm.yW)(),...e};return this._breadcrumbs=[...this._breadcrumbs,r].slice(-n),this._notifyScopeListeners(),this}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this._attachments}clearAttachments(){return this._attachments=[],this}applyToEvent(e,t={}){if(this._extra&&Object.keys(this._extra).length&&(e.extra={...this._extra,...e.extra}),this._tags&&Object.keys(this._tags).length&&(e.tags={...this._tags,...e.tags}),this._user&&Object.keys(this._user).length&&(e.user={...this._user,...e.user}),this._contexts&&Object.keys(this._contexts).length&&(e.contexts={...this._contexts,...e.contexts}),this._level&&(e.level=this._level),this._transactionName&&(e.transaction=this._transactionName),this._span){e.contexts={trace:this._span.getTraceContext(),...e.contexts};var n=this._span.transaction&&this._span.transaction.name;n&&(e.tags={transaction:n,...e.tags})}return this._applyFingerprint(e),e.breadcrumbs=[...e.breadcrumbs||[],...this._breadcrumbs],e.breadcrumbs=e.breadcrumbs.length>0?e.breadcrumbs:void 0,e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...this._sdkProcessingMetadata},this._notifyEventProcessors([...ig(),...this._eventProcessors],e,t)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}_notifyEventProcessors(e,t,n,r=0){return new Xm(((o,i)=>{var s=e[r];if(null===t||"function"!=typeof s)o(t);else{var a=s({...t},n);("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&s.id&&null===a&&Gm.log(`Event processor "${s.id}" dropped event`),Jm(a)?a.then((t=>this._notifyEventProcessors(e,t,n,r+1).then(o))).then(null,i):this._notifyEventProcessors(e,a,n,r+1).then(o).then(null,i)}}))}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}_applyFingerprint(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}}function ig(){return(0,Um.Y)("globalEventProcessors",(()=>[]))}var sg=100;class ag{__init(){this._stack=[{}]}constructor(e,t=new og,n=4){this._version=n,ag.prototype.__init.call(this),this.getStackTop().scope=t,e&&this.bindClient(e)}isOlderThan(e){return this._version<e}bindClient(e){this.getStackTop().client=e,e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){var e=og.clone(this.getScope());return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}withScope(e){var t=this.pushScope();try{e(t)}finally{this.popScope()}}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,t){var n=this._lastEventId=t&&t.event_id?t.event_id:Bm(),r=new Error("Sentry syntheticException");return this._withClient(((o,i)=>{o.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},i)})),n}captureMessage(e,t,n){var r=this._lastEventId=n&&n.event_id?n.event_id:Bm(),o=new Error(e);return this._withClient(((i,s)=>{i.captureMessage(e,t,{originalException:e,syntheticException:o,...n,event_id:r},s)})),r}captureEvent(e,t){var n=t&&t.event_id?t.event_id:Bm();return"transaction"!==e.type&&(this._lastEventId=n),this._withClient(((r,o)=>{r.captureEvent(e,{...t,event_id:n},o)})),n}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){const{scope:n,client:r}=this.getStackTop();if(!n||!r)return;const{beforeBreadcrumb:o=null,maxBreadcrumbs:i=sg}=r.getOptions&&r.getOptions()||{};if(!(i<=0)){var s={timestamp:(0,qm.yW)(),...e},a=o?Vm((()=>o(s,t))):s;null!==a&&n.addBreadcrumb(a,i)}}setUser(e){var t=this.getScope();t&&t.setUser(e)}setTags(e){var t=this.getScope();t&&t.setTags(e)}setExtras(e){var t=this.getScope();t&&t.setExtras(e)}setTag(e,t){var n=this.getScope();n&&n.setTag(e,t)}setExtra(e,t){var n=this.getScope();n&&n.setExtra(e,t)}setContext(e,t){var n=this.getScope();n&&n.setContext(e,t)}configureScope(e){const{scope:t,client:n}=this.getStackTop();t&&n&&e(t)}run(e){var t=cg(this);try{e(this)}finally{cg(t)}}getIntegration(e){var t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch(t){return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&Gm.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){return this._callExtensionMethod("startTransaction",e,t)}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){var e=this.getStackTop(),t=e&&e.scope,n=t&&t.getSession();n&&function(e,t){let n={};t?n={status:t}:"ok"===e.status&&(n={status:"exited"}),rg(e,n)}(n),this._sendSessionUpdate(),t&&t.setSession()}startSession(e){const{scope:t,client:n}=this.getStackTop(),{release:r,environment:o}=n&&n.getOptions()||{};var i=(0,Um.R)();const{userAgent:s}=i.navigator||{};var a=ng({release:r,environment:o,...t&&{user:t.getUser()},...s&&{userAgent:s},...e});if(t){var l=t.getSession&&t.getSession();l&&"ok"===l.status&&rg(l,{status:"exited"}),this.endSession(),t.setSession(a)}return a}shouldSendDefaultPii(){var e=this.getClient(),t=e&&e.getOptions();return Boolean(t&&t.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:t}=this.getStackTop();if(e){var n=e.getSession();n&&t&&t.captureSession&&t.captureSession(n)}}_withClient(e){const{scope:t,client:n}=this.getStackTop();n&&e(n,t)}_callExtensionMethod(e,...t){var n=lg().__SENTRY__;if(n&&n.extensions&&"function"==typeof n.extensions[e])return n.extensions[e].apply(this,t);("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&Gm.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function lg(){var e=(0,Um.R)();return e.__SENTRY__=e.__SENTRY__||{extensions:{},hub:void 0},e}function cg(e){var t=lg(),n=pg(t);return dg(t,e),n}function ug(){var e=lg();return fg(e)&&!pg(e).isOlderThan(4)||dg(e,new ag),(0,Qm.KV)()?function(e){try{var t=lg().__SENTRY__,n=t&&t.extensions&&t.extensions.domain&&t.extensions.domain.active;if(!n)return pg(e);if(!fg(n)||pg(n).isOlderThan(4)){var r=pg(e).getStackTop();dg(n,new ag(r.client,og.clone(r.scope)))}return pg(n)}catch(t){return pg(e)}}(e):pg(e)}function fg(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function pg(e){return(0,Um.Y)("hub",(()=>new ag),e)}function dg(e,t){return!!e&&((e.__SENTRY__=e.__SENTRY__||{}).hub=t,!0)}const hg=(e,t,n)=>e.querySelector(`#LC${t}`),mg={getCodeElementFromTarget:e=>e.closest("span.line"),getLineNumberFromCodeElement:e=>{const t=e.id.replace(/^LC/,"");return parseInt(t,10)},getCodeElementFromLineNumber:hg,getLineElementFromLineNumber:hg},gg=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)},bg=(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)},yg={getCodeElementFromTarget:mg.getCodeElementFromTarget,getLineNumberFromCodeElement:e=>{const t=e.closest("[data-interop-line]");return t?parseInt(t.dataset.interopLine||"",10):(e=>{const t=gg(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:bg,getLineElementFromLineNumber:(e,t,n)=>{const r=bg(e,t,n);return r&&r.parentElement},getDiffCodePart:gg},vg="codeHost-module__command-list-popover_hwImg",wg="codeHost-module__command-palette-button_2FnHe",Eg="codeHost-module__hover-overlay_3Cize",_g=(e,t,n)=>`${window.location.origin}/api/v4/projects/${encodeURIComponent(e)}%2f${t}${n}`,xg=e=>Y(e,{selector:e=>Je(e).json()}),Sg=We((e=>xg(`${window.location.origin}/api/v4/projects/${e}`).pipe(J((({web_url:e})=>{const{hostname:t,pathname:n}=new URL(e);return`${t}${n}`})))),Gc()),Cg=We((({owner:e,projectName:t,mergeRequestID:n,diffID:r})=>r?xg(_g(e,t,`/merge_requests/${n}/versions/${r}`)).pipe(J((({base_commit_sha:e})=>e))):Z(void 0)),(({owner:e,projectName:t,mergeRequestID:n,diffID:r})=>`${e}:${t}:${n}:${String(r)}`)),Og=We((({owner:e,projectName:t,mergeRequestID:n,rawRepoName:r,diffID:o})=>pp(xg(_g(e,t,`/merge_requests/${n}`)),Cg({owner:e,projectName:t,mergeRequestID:n,diffID:o})).pipe(ae((([{diff_refs:e,source_project_id:t},n])=>Sg(t).pipe(J((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)}`)),Ng=We((({owner:e,projectName:t,commitID:n})=>xg(_g(e,t,`/repository/commits/${n}`)).pipe(J((({parent_ids:e})=>xd()(e))))),(({owner:e,projectName:t,commitID:n})=>`${e}:${t}:${n}`));var kg=o(68642),Tg=o.n(kg),Ag=o(90006),Ig=o.n(Ag);let Rg;!function(e){e[e.File=0]="File",e[e.Commit=1]="Commit",e[e.MergeRequest=2]="MergeRequest",e[e.Other=3]="Other"}(Rg||(Rg={}));function Pg(){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=Tg()(n,n.length-1).join("/"),o=Ig()(n),i=((e,t,n)=>{const r=n.match(new RegExp(`^/${e}/${t}(/-)?/(commit|merge_requests|blob)/`));if(!r)return Rg.Other;switch(r[2]){case"commit":return Rg.Commit;case"merge_requests":return Rg.MergeRequest;case"blob":return Rg.File;default:return Rg.Other}})(r,o,window.location.pathname);return{owner:r,projectName:o,rawRepoName:[Lt?window.location.hostname:new URL(gon.gitlab_url).hostname,r,o].join("/"),repoName:t,pageKind:i}}const Dg=()=>{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]},Lg=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 Mg(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=Lg(t.item(n?1:0));return{headFilePath:r,baseFilePath:n?Lg(t.item(0)):r}}function jg(){const{rawRepoName:e,owner:t,projectName:n}=Pg();return{rawRepoName:e,owner:t,projectName:n,commitID:Ig()(window.location.pathname.split("/"))}}const Fg=(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===Rg.Commit&&o.classList.add("gl-mr-3"),r.prepend(o),o},Ug={dom:mg,getToolbarMount:e=>Fg(e,Rg.File),resolveFileInfo:()=>{const{rawRepoName:e,filePath:t,revision:n}=function(){const{rawRepoName:e}=Pg(),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:To({selector:".js-data-file-blob-permalink-url",hrefRegex:new RegExp("^/.*?/.*?/blob/([0-9a-f]{40})/")}),revision:n}}},getSelections:Uh,observeSelections:Bh},Bg=e=>{const t=e.querySelector(".js-file-title");if(!t)throw new Error("Could not find .file-title element");return[t]},qg={dom:yg,getToolbarMount:e=>Fg(e,Rg.MergeRequest),resolveFileInfo:e=>W(Og({...Pg(),mergeRequestID:Dg(),diffID:new URLSearchParams(window.location.search).get("diff_id")??void 0})).pipe(J((t=>{const{rawRepoName:n,baseRawRepoName:r,commitID:o,baseCommitID:i}=t,{headFilePath:s,baseFilePath:a}=Mg(e);return{head:{rawRepoName:n,filePath:s,commitID:o},base:{rawRepoName:r,filePath:a,commitID:i}}}))),getScrollBoundaries:Bg},$g={dom:yg,getToolbarMount:e=>Fg(e,Rg.Commit),resolveFileInfo:e=>ms(jg).pipe(ae((({owner:e,projectName:t,commitID:n,rawRepoName:r})=>Ng({owner:e,projectName:t,commitID:n}).pipe(J((e=>({commitID:n,baseCommitID:e,rawRepoName:r})))))),J((({commitID:t,baseCommitID:n,rawRepoName:r})=>{const{headFilePath:o,baseFilePath:i}=Mg(e);return{head:{rawRepoName:r,filePath:o,commitID:t},base:{rawRepoName:r,filePath:i,commitID:n}}}))),getScrollBoundaries:Bg},zg={selector:".file-holder",resolveView:e=>{if(e.classList.contains("discussion-wrapper"))return null;const{pageKind:t}=Pg();return t===Rg.Other?null:t===Rg.File?{element:e,...Ug}:t===Rg.MergeRequest?e.querySelector(".file-actions")?{element:e,...qg}:null:{element:e,...$g}}},Vg={[cu]:"alert alert-secondary",[uu]:"alert alert-success",[lu]:"alert alert-info",[au]:"alert alert-warning",[su]:"alert alert-danger"},Hg=(e,t=Jf.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 n=e,ug().captureException(n,{captureContext:r}),e}var n,r;return e})).then((({status:e})=>200!==e)).catch((e=>(console.warn("Failed to fetch repository visibility info.",e),!0))):Promise.resolve(!0),Gg={type:"gitlab",name:"GitLab",check:function(){return!!document.head.querySelector('meta[content="GitLab"]')},codeViewResolvers:[zg],getCommandPaletteMount:e=>{const t=Ro(e,".navbar-collapse");if(!t)return null;const n="command-palette-button";return t.querySelector("."+n)||(()=>{const e=document.createElement("div");return e.classList.add(n,wg),t.prepend(e),e})()},getContext:async()=>{const{repoName:e,...t}=Pg();return{...t,privateRepository:await Hg(e)}},urlToFile:(e,t,n)=>{if(t.viewState||!t.rawRepoName.startsWith(window.location.hostname))return zr(e,t);if(Pg().rawRepoName===t.rawRepoName&&void 0!==n.part){const e=gh(document.body,zg.selector);for(const r of e){const{headFilePath:e,baseFilePath:o}=Mg(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]:"",s=r.querySelector(`${i} a[data-linenumber="${t.position.line}"]`);if(!s)break;return new URL(s.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:Vg,commandPaletteClassProps:{popoverClassName:s()("dropdown-menu",vg),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:s()("card",Eg),actionItemClassName:"btn btn-secondary",actionItemPressedClassName:"active",closeButtonClassName:"btn btn-transparent p-0 btn-icon--gitlab",iconClassName:"square s16",getAlertClassName:hd(Vg)},codeViewsRequireTokenization:!0,getHoverOverlayMountLocation:()=>{const{pageKind:e}=Pg();return e===Rg.MergeRequest?"div.tab-pane.diffs":null},observeLineSelection:Vo(document,"click").pipe(wt((e=>e.target.matches("a[data-line-number]"))),J((()=>(e=>{if(e.startsWith("#")&&(e=e.slice(1)),!/^L\d+(-\d+)?$/.test(e))return{};const t={},[n,r]=e.slice(1).split("-");return t.line=parseInt(n,10),r&&(t.endLine=parseInt(r,10)),t})(window.location.hash))))},Wg=e=>Boolean("TH"===e.tagName&&e.textContent||e.dataset.n),Qg=e=>parseInt(("TH"===e.tagName?e.textContent:e.dataset.n)||"",10),Kg=e=>{let t=e;for(;t;){if(Wg(t))return t;t=t.previousElementSibling}return null},Zg=(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(Qg(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")||Wg(r)||r.classList.contains("copy"));)r=r.nextElementSibling;return r},Yg={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:Kg(t)?t:null:null},getCodeElementFromLineNumber:Zg,getLineElementFromLineNumber:Zg,getLineNumberFromCodeElement:e=>{const t=Kg(e);if(!t)throw new Error("Could not find line number cell from code element");return Qg(t)},getDiffCodePart:e=>{if(e.classList.contains("old"))return"base";if(e.classList.contains("new"))return"head";const t=Kg(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=>!!e.firstElementChild?.classList.contains("aural-only")},Jg=(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")},Xg={getCodeElementFromTarget:e=>e.closest("td"),getCodeElementFromLineNumber:Jg,getLineElementFromLineNumber:Jg,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 eb=(e,t,n=go)=>ho(window.location,t,n).pipe(J((e=>{if(e.mode!==to.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}}}))),tb="codeHost-module__hover-overlay_3rw5s",nb="codeHost-module__icon_3HyWM",rb="codeHost-module__action-item_35MZg",ob="codeHost-module__hover-overlay-action-item_1yTXu",ib="codeHost-module__hover-overlay-action-item-icon_1oozE",sb=(e,t)=>({line:e.line,character:e.character+t}),ab=e=>({direction:t,codeView:n,position:r})=>eo({...r,requestGraphQL:e}).pipe(J((e=>{const o=Yg.getCodeElementFromLineNumber(n,r.line,r.part);if(!o)throw new Error("(adjustPosition) could not find code element for line provided");const i=(e=>{let t=e.textContent||"",n=0;if(e.firstElementChild?.classList.contains("aural-only")){const r=e.firstElementChild.textContent||"";n=r.replace(/^(\+|-)/,"").length,t=t.slice(r.length-n)}return 8203===t.charCodeAt(0)&&(t=t.slice(1),n++),{textContent:t,adjust:n}})(o),s=i.textContent,a=e[r.line-1],l=(u=s,!!(c=a)&&!!u&&c.startsWith("\t")&&!u.startsWith("\t"));var c,u;const f=t===rs.CodeViewToActual?-1:1;return sb(r,l?(function(e){let t=e,n=0;for(;t.length>=2&&t.startsWith(" ");)++n,t=t.slice(2);return n}(s)+i.adjust)*f:i.adjust*f)}))),lb={dom:Yg,resolveFileInfo:(e,t,n=go)=>ho(window.location,t,n).pipe(J((e=>{if(e.mode!==to.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:ab,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}},cb={dom:Yg,resolveFileInfo:(e,t,n=go)=>ho(window.location,t,n).pipe(ae((r=>{if(r.mode!==to.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 pp(No({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(J((({commitID:e,stagingRepoName:t})=>({commitID:e,rawRepoName:t||r.baseRawRepoName})))),No({repoName:r.headRawRepoName,revisionID:r.revisionID,diffID:r.diffID,baseDiffID:r.baseDiffID,useDiffForBase:!1,useBaseForDiff:!1,filePath:o,isBase:!1},t,n).pipe(J((({commitID:e,stagingRepoName:t})=>({commitID:e,rawRepoName:t||r.headRawRepoName}))))).pipe(J((([e,t])=>({base:{rawRepoName:e.rawRepoName,filePath:i||o,commitID:e.commitID},head:{rawRepoName:t.rawRepoName,filePath:o,commitID:t.commitID}}))))}))),getPositionAdjuster:ab,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},ub={selector:".differential-changeset",resolveView:e=>window.location.pathname.match(/^\/r/)?{element:e,...lb}:{element:e,...cb}},fb=jh(".diffusion-source",{dom:Xg,resolveFileInfo:eb,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}}),pb=jh(".phabricator-source-code-container",{dom:Xg,resolveFileInfo:eb}),db={[cu]:"phui-info-view phui-info-severity-plain",[uu]:"phui-info-view phui-info-severity-success",[lu]:"phui-info-view phui-info-severity-notice",[au]:"phui-info-view phui-info-severity-warning",[su]:"phui-info-view phui-info-severity-error"},hb={codeViewResolvers:[ub,fb,pb],type:"phabricator",name:"Phabricator",check:()=>!!document.querySelector(".phabricator-wordmark"),codeViewToolbarClassProps:{actionItemClass:s()("button grey",rb),actionItemIconClass:nb},notificationClassNames:db,hoverOverlayClassProps:{className:s()("aphront-dialog-view",tb),actionItemClassName:s()("button grey",ob),closeButtonClassName:"button grey btn-icon--phabricator",iconClassName:ib,getAlertClassName:hd(db)},codeViewsRequireTokenization:!0};var mb={leading:!0,trailing:!1};var gb=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 bb(e,this.duration,this.scheduler,this.leading,this.trailing))},e}(),bb=function(e){function t(t,n,r,o,i){var s=e.call(this,t)||this;return s.duration=n,s.scheduler=r,s.leading=o,s.trailing=i,s._hasTrailingValue=!1,s._trailingValue=null,s}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(yb,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}(A);function yb(e){e.subscriber.clearThrottle()}function vb({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),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:rf(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,wb(r)),i&&e(i,wb(r)))}function wb(e){if(!e)return null;const t=e.hover.map((({value:e})=>e)).filter((e=>!!e));return t.length>0?t.join(" "):null}function Eb(e,{extensionsController:t},{contentViewResolvers:n,linkPreviewContentClass:r,setElementTooltip:o}){const i=e.pipe(mh(n||[]),Ne(Bt)),s=new be,a=new Map;return i.pipe(ht((e=>li(Z(e).pipe(ze((()=>{console.log("Content view added",{contentViewEvent:e}),a.set(e.element,new N),e.subscriptions.add((()=>{console.log("Content view removed",{contentViewEvent:e});const t=a.get(e.element);if(!t)throw new Error("No linkPreview subscriptions");t.unsubscribe()}))}))),Ao(e.element,{childList:!0},s).pipe(Ne(Bt),J((()=>e.element.innerHTML)),Zo(),ze((()=>console.log("Content view updated",{contentViewEvent:e}))),te(e),function(e,t,n){return void 0===t&&(t=qt),void 0===n&&(n=mb),function(r){return r.lift(new gb(e,t,n.leading,n.trailing))}}(2e3,void 0,{leading:!0,trailing:!0}))))),ze((({element:e})=>{let n=a.get(e);if(!n)throw new Error("No linkPreview subscriptions");if(n.unsubscribe(),n=new N,a.set(e,n),null!==t)for(const i of e.querySelectorAll("a[href]"))n.add(W(t.extHostAPI).pipe(ae((e=>yl(e.getLinkPreviews(i.href))))).subscribe((e=>{try{s.next(!0),vb({setElementTooltip:o,linkPreviewContentClass:r},i,e)}finally{s.next(!1)}})))}))).subscribe()}var _b=o(32805),xb=o(51437),Sb=o(51491),Cb=o.n(Sb);const Ob="Label-module__label_OcXyA",Nb="Label-module__label--underline_1lWvO",kb="Label-module__label--uppercase_v90-E",Tb="Label-module__label--single-line_1WmWf",Ab=t.forwardRef(((e,t)=>{const{children:n,as:r="label",size:o,weight:i,alignment:a,mode:l,isUnderline:c,isUppercase:f,className:p,...d}=e;return(0,u.jsx)(r,{ref:t,className:s()(Ob,c&&Nb,f&&kb,"small"===o&&Tf.small,i&&If({weight:i}),a&&Af({alignment:a}),l&&Rf({mode:l}),"single-line"===l&&Tb,p),...d,children:n})})),Ib="LoaderInput-module__container_3Pq3e",Rb="LoaderInput-module__spinner_2E2IO",Pb=({loading:e,children:t,className:n})=>(0,u.jsxs)("div",{className:s()(Ib,n),children:[t,e&&(0,u.jsx)(Ga,{inline:!1,className:Rb})]}),Db="Input-module__input-loading_3mRNA",Lb="Input-module__loader-input_1ZDGl";let Mb;!function(e){e.initial="initial",e.error="error",e.loading="loading",e.valid="valid"}(Mb||(Mb={}));const jb=(0,t.forwardRef)((function(e,n){const{as:r="input",type:o="text",variant:i="regular",label:a,message:l,className:c,inputClassName:f,inputSymbol:p,disabled:d,status:h=Mb.initial,error:m,autoFocus:g,...b}=e,y=(0,t.useRef)(null),v=Qa([y,n]);(({autoFocus:e,reference:n})=>{(0,t.useEffect)((()=>{e&&requestAnimationFrame((()=>{n.current?.focus()}))}),[e])})({autoFocus:g,reference:y});const w="form-text font-weight-normal mt-2",E=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(Pb,{className:s()("loader-input",Lb,!a&&c),loading:h===Mb.loading,children:[(0,u.jsx)(r,{disabled:d,type:o,className:s()(f,h===Mb.loading&&Db,"form-control","with-invalid-icon",{"is-valid":h===Mb.valid,"is-invalid":m||h===Mb.error,"form-control-sm":"small"===i}),...b,ref:v,autoFocus:g}),p]}),m&&(0,u.jsx)("small",{role:"alert",className:s()("text-danger",w),children:m}),!m&&l&&(0,u.jsx)("small",{className:s()("text-muted",w),children:l})]});return a?(0,u.jsxs)(Ab,{className:s()("w-100",c),children:[a&&(0,u.jsx)("div",{className:"mb-2",children:"regular"===i?a:(0,u.jsx)("small",{children:a})}),E]}):E}));jb.displayName="Input";const Fb=We((e=>W(e).pipe(ae((e=>yl(e.haveInitialExtensionsLoaded()))))),(()=>"haveInitialExtensionsLoaded")),Ub=({text:e,pattern:t,className:n})=>(0,u.jsx)("span",{children:Bb(e.toLowerCase(),t.toLowerCase()).map(((t,r)=>t.match?(0,u.jsx)("strong",{className:n,children:e.slice(t.start,t.end)},r):e.slice(t.start,t.end)))});function Bb(e,t){const n=[];let r,o=0;for(let i=0;i<t.length;i++){const s=e.indexOf(t.charAt(i),o);if(-1===s)break;r?.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}return e&&o<e.length&&n.push({start:o,end:e.length,match:!1}),n}const qb="EmptyCommandListContainer-module__empty-command-list_NA_s5",$b=({className:e,children:t,...n})=>(0,u.jsx)("div",{className:s()(qb,e),...n,children:t}),zb="EmptyCommandList-module__title_Sbph5",Vb="EmptyCommandList-module__text_s1AXs",Hb="EmptyCommandList-module__illustration_3pj62",Gb=({settingsCascade:e,sourcegraphURL:t})=>{const n=!!e&&function(e){const t=iu(e,"User"),n=iu(e,"DefaultSettings");if(t&&n)for(const e of Object.keys(t))if(!(e in n))return!1;return!0}(e);return(0,u.jsxs)($b,{children:[(0,u.jsx)(Pf,{className:zb,children:n?"You don't have any extensions enabled":"You don't have any active actions"}),(0,u.jsx)(Pf,{className:Vb,children:n?"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."}),(0,u.jsx)(Ka,{to:t+"/extensions",variant:"primary",children:"Explore extensions"}),(0,u.jsx)(Wb,{className:Hb})]})},Wb=t.memo((({className:e})=>(0,u.jsxs)("svg",{width:"59",height:"64",viewBox:"0 0 59 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[(0,u.jsx)("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"}),(0,u.jsx)("rect",{y:"24.6855",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{y:"46.627",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{y:"52.1133",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{y:"19.1992",width:"11.0972",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"11.0977",y:"30.1699",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"11.0977",y:"41.1426",width:"12.9467",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"11.0977",y:"35.6562",width:"15.7211",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"13.8711",y:"24.6855",width:"9.24768",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"13.8711",y:"46.627",width:"9.24768",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"13.8711",y:"52.1133",width:"5.54861",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"12.0225",y:"19.1992",width:"5.54861",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"24.9688",y:"30.1699",width:"4.62384",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"24.9688",y:"41.1426",width:"9.24767",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"30.5176",y:"30.1699",width:"7.39814",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"35.1416",y:"41.1426",width:"4.62384",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("rect",{x:"27.7432",y:"35.6562",width:"7.39814",height:"2.74286",rx:"1.37143",fill:"#ABC7EB",fillOpacity:"0.5"}),(0,u.jsx)("defs",{children:(0,u.jsxs)("linearGradient",{id:"paint0_linear",x1:"33.5688",y1:"0",x2:"33.5688",y2:"64",gradientUnits:"userSpaceOnUse",children:[(0,u.jsx)("stop",{stopColor:"#95A5C6",stopOpacity:"0.6"}),(0,u.jsx)("stop",{offset:"1",stopColor:"#95A5C6"})]})})]}))),Qb="CommandList-module__command-list_10tyf",Kb="CommandList-module__popover-button_1ug-b",Zb=We((e=>W(e).pipe(ae((e=>yl(e.getContributions()))))),(()=>"getContributions"));class Yb extends t.PureComponent{static RECENT_ACTIONS_STORAGE_KEY="commandList.recentActions";static readRecentActions(){const e=localStorage.getItem(Yb.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 Yb.writeRecentActions(null),null}static writeRecentActions(e){try{if(null===e)localStorage.removeItem(Yb.RECENT_ACTIONS_STORAGE_KEY);else{const t=JSON.stringify(e);localStorage.setItem(Yb.RECENT_ACTIONS_STORAGE_KEY,t)}}catch(e){console.error("Error writing recent actions:",e)}}state={input:"",selectedIndex:0,recentActions:Yb.readRecentActions()};subscriptions=new N;selectedItem=null;setSelectedItem=e=>{this.selectedItem=e};componentDidMount(){this.subscriptions.add(Fb(this.props.extensionsController.extHostAPI).pipe(wt((e=>e)),ae((()=>Zb(this.props.extensionsController.extHostAPI)))).subscribe((e=>{this.setState({contributions:e})}))),this.subscriptions.add(this.props.platformContext.settings.subscribe((e=>this.setState({settingsCascade:e}))))}componentDidUpdate(e,t){this.state.recentActions!==t.recentActions&&Yb.writeRecentActions(this.state.recentActions)}componentWillUnmount(){this.subscriptions.unsubscribe()}render(){if(!this.state.contributions)return(0,u.jsx)($b,{className:Qb,children:(0,u.jsxs)("div",{className:"d-flex py-5 align-items-center justify-content-center",children:[(0,u.jsx)(Ga,{inline:!1}),(0,u.jsx)("span",{className:"mx-2",children:"Loading Sourcegraph extensions"}),(0,u.jsx)(Va,{"aria-hidden":!0,svgPath:"M20.5,11H19V7C19,5.89 18.1,5 17,5H13V3.5A2.5,2.5 0 0,0 10.5,1A2.5,2.5 0 0,0 8,3.5V5H4A2,2 0 0,0 2,7V10.8H3.5C5,10.8 6.2,12 6.2,13.5C6.2,15 5,16.2 3.5,16.2H2V20A2,2 0 0,0 4,22H7.8V20.5C7.8,19 9,17.8 10.5,17.8C12,17.8 13.2,19 13.2,20.5V22H17A2,2 0 0,0 19,20V16H20.5A2.5,2.5 0 0,0 23,13.5A2.5,2.5 0 0,0 20.5,11Z"})]})});const e=Fc(this.state.contributions,this.props.menu),t=this.state.input.trim(),n=function(e,t,n){if(!t)return null===n?e:Mc()(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]=Cb()(i,t,0)),o[n]>0})).map(((e,t)=>{const r=n?.indexOf(e.action.id);return{item:e,score:o[t],recentIndex:-1===r?null:r}}));return Mc()(i,"recentIndex","score",(({item:e})=>e.action.id)).map((({item:e})=>e))}(e,this.state.input,this.state.recentActions),r=(this.state.selectedIndex%n.length+n.length)%n.length;return(0,u.jsxs)("div",{className:Qb,children:[(0,u.jsx)("header",{children:(0,u.jsxs)("form",{className:this.props.formClassName,onSubmit:this.onSubmit,children:[(0,u.jsx)(Ab,{className:"sr-only",htmlFor:"command-list-input",children:"Command"}),(0,u.jsx)(jb,{id:"command-list-input",inputClassName:this.props.inputClassName,value:this.state.input,placeholder:"Run Sourcegraph action...",spellCheck:!1,autoFocus:!0,autoCorrect:"off",autoComplete:"off",onChange:this.onInputChange,onKeyDown:this.onInputKeyDown,onClick:this.onInputClick})]})}),(0,u.jsx)("div",{className:this.props.resultsContainerClassName,children:(0,u.jsx)("ul",{className:this.props.listClassName,children:n.length>0?n.map(((e,n)=>(0,u.jsx)("li",{className:s()(this.props.listItemClassName,n===r&&this.props.selectedListItemClassName),children:(0,u.jsx)(Jl,{...this.props,className:s()(this.props.actionItemClassName,n===r&&this.props.selectedActionItemClassName),...e,ref:n===r?this.setSelectedItem:void 0,title:(0,u.jsx)(Ub,{text:[e.action.category,e.action.title||e.action.command].filter(Boolean).join(": "),pattern:t}),onDidExecute:this.onActionDidExecute})},e.action.id))):t.length>0?(0,u.jsx)("li",{className:this.props.noResultsClassName,children:"No matching commands"}):(0,u.jsx)(Gb,{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 Ti.s.ArrowDown:e.preventDefault(),this.setSelectedIndex(1);break;case Ti.s.ArrowUp:e.preventDefault(),this.setSelectedIndex(-1);break;case Ti.s.Enter:this.selectedItem&&this.selectedItem.runAction(e)}};onInputClick=e=>{e.stopPropagation()};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:tn()([e,...n]).slice(0,10)}:{recentActions:[e]}})),this.props.onSelect&&this.props.onSelect()}}const Jb=({buttonClassName:e,buttonElement:n="span",buttonOpenClassName:r,showCaret:o=!0,popoverClassName:i,popoverInnerClassName:a,keyboardShortcutForShow:l,variant:c,...f})=>{const[p,d]=(0,t.useState)(!1),h=(0,t.useMemo)((()=>p&&document.activeElement instanceof HTMLElement?document.activeElement:null),[p]),m=(0,t.useCallback)((()=>{h?.focus(),d(!1)}),[h]),g=(0,t.useCallback)((()=>{p&&h?.focus(),d(!p)}),[p,h]),b=(0,t.useMemo)((()=>Kc()("command-list-popover-button-")),[]),y=()=>(0,u.jsx)(Va,{svgPath:p?"M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z":"M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z","aria-hidden":!0});return(0,u.jsxs)(qa,{as:n,role:"button",id:b,onClick:g,className:s()(Kb,e,p&&r),variant:c,"aria-label":"Command list",children:[(0,u.jsx)(Va,{size:"md","aria-hidden":!0,svgPath:"M20,19V7H4V19H20M20,3A2,2 0 0,1 22,5V19A2,2 0 0,1 20,21H4A2,2 0 0,1 2,19V5C2,3.89 2.9,3 4,3H20M13,17V15H18V17H13M9.58,13L5.57,9H8.4L11.7,12.3C12.09,12.69 12.09,13.33 11.7,13.72L8.42,17H5.59L9.58,13Z"}),o&&(0,u.jsx)(y,{}),(0,u.jsx)(xb.ZP,{isOpen:p,toggle:g,popperClassName:i,innerClassName:s()("popover-inner",a),placement:"bottom-end",target:b,trigger:"legacy",delay:0,fade:!1,hideArrow:!0,children:(0,u.jsx)(Yb,{...f,onSelect:m})}),l?.keybindings.map(((e,t)=>(0,u.jsx)(_b.z9,{...e,onMatch:g},t)))]})};var Xb=o(7263),ey=o.n(Xb);function ty(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,s=void 0===i?Number.POSITIVE_INFINITY:i,a=e.refCount,l=e.scheduler,c=0,u=!1,f=!1;return function(e){var r;c++,!t||u?(u=!1,t=new Ie(o,s,l),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()}}),f&&(n=void 0)):r=t.subscribe(this),this.add((function(){c--,r.unsubscribe(),r=void 0,n&&!f&&a&&0===c&&(n.unsubscribe(),n=void 0,t=void 0)}))}}(r))}}function ny(e){return(ny="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 ry="function"==typeof Symbol&&null!=Symbol.toStringTag?Symbol.toStringTag:"@@toStringTag";function oy(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 iy(e){return sy(e.source,oy(e.source,e.start))}function sy(e,t){var n=e.locationOffset.column-1,r=ly(n)+e.body,o=t.line-1,i=e.locationOffset.line-1,s=t.line+i,a=1===t.line?n:0,l=t.column+a,c="".concat(e.name,":").concat(s,":").concat(l,"\n"),u=r.split(/\r\n|[\n\r]/g),f=u[o];if(f.length>120){for(var p=Math.floor(l/80),d=l%80,h=[],m=0;m<f.length;m+=80)h.push(f.slice(m,m+80));return c+ay([["".concat(s),h[0]]].concat(h.slice(1,p+1).map((function(e){return["",e]})),[[" ",ly(d-1)+"^"],["",h[p+1]]]))}return c+ay([["".concat(s-1),u[o-1]],["".concat(s),f],["",ly(l-1)+"^"],["".concat(s+1),u[o+1]]])}function ay(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 ly(n-(t=r).length)+t+(o?" | "+o:" |")})).join("\n")}function ly(e){return Array(e+1).join(" ")}function cy(e){return(cy="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 uy(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 fy(e,t){return!t||"object"!==cy(t)&&"function"!=typeof t?py(e):t}function py(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dy(e){var t="function"==typeof Map?new Map:void 0;return(dy=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 hy(e,arguments,by(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),gy(r,e)})(e)}function hy(e,t,n){return(hy=my()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&gy(o,n.prototype),o}).apply(null,arguments)}function my(){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 gy(e,t){return(gy=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function by(e){return(by=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var yy=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&&gy(e,t)}(a,e);var t,n,r,o,i,s=(t=a,n=my(),function(){var e,r=by(t);if(n){var o=by(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return fy(this,e)});function a(e,t,n,r,o,i,l){var c,u,f,p,d;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),d=s.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 b,y=r;!y&&m&&(y=m.reduce((function(e,t){return t.loc&&e.push(t.loc.start),e}),[])),y&&0===y.length&&(y=void 0),r&&n?b=r.map((function(e){return oy(n,e)})):m&&(b=m.reduce((function(e,t){return t.loc&&e.push(oy(t.loc.source,t.loc.start)),e}),[]));var v,w=l;if(null==w&&null!=i){var E=i.extensions;"object"==ny(v=E)&&null!==v&&(w=E)}return Object.defineProperties(py(d),{name:{value:"GraphQLError"},message:{value:e,enumerable:!0,writable:!0},locations:{value:null!==(c=b)&&void 0!==c?c:void 0,enumerable:null!=b},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=y)&&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(py(d),"stack",{value:i.stack,writable:!0,configurable:!0}),fy(d)):(Error.captureStackTrace?Error.captureStackTrace(py(d),a):Object.defineProperty(py(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return r=a,(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"+iy(o.loc))}else if(e.source&&e.locations)for(var i=0,s=e.locations;i<s.length;i++){var a=s[i];t+="\n\n"+sy(e.source,a)}return t}(this)}},{key:ry,get:function(){return"Object"}}])&&uy(r.prototype,o),i&&uy(r,i),a}(dy(Error));function vy(e,t,n){return new yy("Syntax Error: ".concat(n),void 0,e,[t])}var wy=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 Ey="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function _y(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,Ey&&(e.prototype[Ey]=t)}var xy=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}();_y(xy);var Sy=function(){function e(e,t,n,r,o,i,s){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=o,this.value=s,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 Cy(e){return null!=e&&"string"==typeof e.kind}_y(Sy);var Oy=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 Ny(e){return(Ny="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 ky(e){return Ty(e,[])}function Ty(e,t){switch(Ny(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(Ey)];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:Ty(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(Ty(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+": "+Ty(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}function Ay(e,t){if(!Boolean(e))throw new Error(t)}const Iy=function(e,t){return e instanceof t};function Ry(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 Py=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||Ay(0,"Body must be a string. Received: ".concat(ky(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||Ay(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Ay(0,"column in locationOffset is 1-indexed and must be positive.")}var t,n,r;return t=e,(n=[{key:ry,get:function(){return"Source"}}])&&Ry(t.prototype,n),r&&Ry(t,r),e}();var Dy=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 Ly(e){var t=e.split(/\r\n|[\n\r]/g),n=function(e){for(var t,n=!0,r=!0,o=0,i=null,s=0;s<e.length;++s)switch(e.charCodeAt(s)){case 13:10===e.charCodeAt(s+1)&&++s;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&&My(t[o]);)++o;for(var i=t.length;i>o&&My(t[i-1]);)--i;return t.slice(o,i).join("\n")}function My(e){for(var t=0;t<e.length;++t)if(" "!==e[t]&&"\t"!==e[t])return!1;return!0}var jy=function(){function e(e){var t=new Sy(Oy.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!==Oy.EOF)do{var t;e=null!==(t=e.next)&&void 0!==t?t:e.next=Uy(this,e)}while(e.kind===Oy.COMMENT);return e},e}();function Fy(e){return isNaN(e)?Oy.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function Uy(e,t){for(var n=e.source,r=n.body,o=r.length,i=t.end;i<o;){var s=r.charCodeAt(i),a=e.line,l=1+i-e.lineStart;switch(s){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 Sy(Oy.BANG,i,i+1,a,l,t);case 35:return qy(n,i,a,l,t);case 36:return new Sy(Oy.DOLLAR,i,i+1,a,l,t);case 38:return new Sy(Oy.AMP,i,i+1,a,l,t);case 40:return new Sy(Oy.PAREN_L,i,i+1,a,l,t);case 41:return new Sy(Oy.PAREN_R,i,i+1,a,l,t);case 46:if(46===r.charCodeAt(i+1)&&46===r.charCodeAt(i+2))return new Sy(Oy.SPREAD,i,i+3,a,l,t);break;case 58:return new Sy(Oy.COLON,i,i+1,a,l,t);case 61:return new Sy(Oy.EQUALS,i,i+1,a,l,t);case 64:return new Sy(Oy.AT,i,i+1,a,l,t);case 91:return new Sy(Oy.BRACKET_L,i,i+1,a,l,t);case 93:return new Sy(Oy.BRACKET_R,i,i+1,a,l,t);case 123:return new Sy(Oy.BRACE_L,i,i+1,a,l,t);case 124:return new Sy(Oy.PIPE,i,i+1,a,l,t);case 125:return new Sy(Oy.BRACE_R,i,i+1,a,l,t);case 34:return 34===r.charCodeAt(i+1)&&34===r.charCodeAt(i+2)?Hy(n,i,a,l,t,e):Vy(n,i,a,l,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return $y(n,i,s,a,l,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 Qy(n,i,a,l,t)}throw vy(n,i,By(s))}var c=e.line,u=1+i-e.lineStart;return new Sy(Oy.EOF,o,o,c,u,t)}function By(e){return e<32&&9!==e&&10!==e&&13!==e?"Cannot contain the invalid character ".concat(Fy(e),"."):39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":"Cannot parse the unexpected character ".concat(Fy(e),".")}function qy(e,t,n,r,o){var i,s=e.body,a=t;do{i=s.charCodeAt(++a)}while(!isNaN(i)&&(i>31||9===i));return new Sy(Oy.COMMENT,t,a,n,r,o,s.slice(t+1,a))}function $y(e,t,n,r,o,i){var s=e.body,a=n,l=t,c=!1;if(45===a&&(a=s.charCodeAt(++l)),48===a){if((a=s.charCodeAt(++l))>=48&&a<=57)throw vy(e,l,"Invalid number, unexpected digit after 0: ".concat(Fy(a),"."))}else l=zy(e,l,a),a=s.charCodeAt(l);if(46===a&&(c=!0,a=s.charCodeAt(++l),l=zy(e,l,a),a=s.charCodeAt(l)),69!==a&&101!==a||(c=!0,43!==(a=s.charCodeAt(++l))&&45!==a||(a=s.charCodeAt(++l)),l=zy(e,l,a),a=s.charCodeAt(l)),46===a||function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122}(a))throw vy(e,l,"Invalid number, expected digit but got: ".concat(Fy(a),"."));return new Sy(c?Oy.FLOAT:Oy.INT,t,l,r,o,i,s.slice(t,l))}function zy(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 vy(e,o,"Invalid number, expected digit but got: ".concat(Fy(i),"."))}function Vy(e,t,n,r,o){for(var i=e.body,s=t+1,a=s,l=0,c="";s<i.length&&!isNaN(l=i.charCodeAt(s))&&10!==l&&13!==l;){if(34===l)return c+=i.slice(a,s),new Sy(Oy.STRING,t,s+1,n,r,o,c);if(l<32&&9!==l)throw vy(e,s,"Invalid character within String: ".concat(Fy(l),"."));if(++s,92===l){switch(c+=i.slice(a,s-1),l=i.charCodeAt(s)){case 34:c+='"';break;case 47:c+="/";break;case 92:c+="\\";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+="\n";break;case 114:c+="\r";break;case 116:c+="\t";break;case 117:var u=Gy(i.charCodeAt(s+1),i.charCodeAt(s+2),i.charCodeAt(s+3),i.charCodeAt(s+4));if(u<0){var f=i.slice(s+1,s+5);throw vy(e,s,"Invalid character escape sequence: \\u".concat(f,"."))}c+=String.fromCharCode(u),s+=4;break;default:throw vy(e,s,"Invalid character escape sequence: \\".concat(String.fromCharCode(l),"."))}a=++s}}throw vy(e,s,"Unterminated string.")}function Hy(e,t,n,r,o,i){for(var s=e.body,a=t+3,l=a,c=0,u="";a<s.length&&!isNaN(c=s.charCodeAt(a));){if(34===c&&34===s.charCodeAt(a+1)&&34===s.charCodeAt(a+2))return u+=s.slice(l,a),new Sy(Oy.BLOCK_STRING,t,a+3,n,r,o,Ly(u));if(c<32&&9!==c&&10!==c&&13!==c)throw vy(e,a,"Invalid character within String: ".concat(Fy(c),"."));10===c?(++a,++i.line,i.lineStart=a):13===c?(10===s.charCodeAt(a+1)?a+=2:++a,++i.line,i.lineStart=a):92===c&&34===s.charCodeAt(a+1)&&34===s.charCodeAt(a+2)&&34===s.charCodeAt(a+3)?(u+=s.slice(l,a)+'"""',l=a+=4):++a}throw vy(e,a,"Unterminated string.")}function Gy(e,t,n,r){return Wy(e)<<12|Wy(t)<<8|Wy(n)<<4|Wy(r)}function Wy(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Qy(e,t,n,r,o){for(var i=e.body,s=i.length,a=t+1,l=0;a!==s&&!isNaN(l=i.charCodeAt(a))&&(95===l||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122);)++a;return new Sy(Oy.NAME,t,a,n,r,o,i.slice(t,a))}var Ky=function(){function e(e,t){var n=function(e){return Iy(e,Py)}(e)?e:new Py(e);this._lexer=new jy(n),this._options=t}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(Oy.NAME);return{kind:wy.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:wy.DOCUMENT,definitions:this.many(Oy.SOF,this.parseDefinition,Oy.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(Oy.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(Oy.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(Oy.BRACE_L))return{kind:wy.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,n=this.parseOperationType();return this.peek(Oy.NAME)&&(t=this.parseName()),{kind:wy.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(Oy.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(Oy.PAREN_L,this.parseVariableDefinition,Oy.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:wy.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(Oy.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Oy.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(Oy.DOLLAR),{kind:wy.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:wy.SELECTION_SET,selections:this.many(Oy.BRACE_L,this.parseSelection,Oy.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(Oy.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,n=this._lexer.token,r=this.parseName();return this.expectOptionalToken(Oy.COLON)?(e=r,t=this.parseName()):t=r,{kind:wy.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Oy.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Oy.PAREN_L,t,Oy.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(Oy.COLON),{kind:wy.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:wy.ARGUMENT,name:this.parseName(),value:(this.expectToken(Oy.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(Oy.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(Oy.NAME)?{kind:wy.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:wy.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:wy.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:wy.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 Oy.BRACKET_L:return this.parseList(e);case Oy.BRACE_L:return this.parseObject(e);case Oy.INT:return this._lexer.advance(),{kind:wy.INT,value:t.value,loc:this.loc(t)};case Oy.FLOAT:return this._lexer.advance(),{kind:wy.FLOAT,value:t.value,loc:this.loc(t)};case Oy.STRING:case Oy.BLOCK_STRING:return this.parseStringLiteral();case Oy.NAME:switch(this._lexer.advance(),t.value){case"true":return{kind:wy.BOOLEAN,value:!0,loc:this.loc(t)};case"false":return{kind:wy.BOOLEAN,value:!1,loc:this.loc(t)};case"null":return{kind:wy.NULL,loc:this.loc(t)};default:return{kind:wy.ENUM,value:t.value,loc:this.loc(t)}}case Oy.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:wy.STRING,value:e.value,block:e.kind===Oy.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,n=this._lexer.token;return{kind:wy.LIST,values:this.any(Oy.BRACKET_L,(function(){return t.parseValueLiteral(e)}),Oy.BRACKET_R),loc:this.loc(n)}},t.parseObject=function(e){var t=this,n=this._lexer.token;return{kind:wy.OBJECT,fields:this.any(Oy.BRACE_L,(function(){return t.parseObjectField(e)}),Oy.BRACE_R),loc:this.loc(n)}},t.parseObjectField=function(e){var t=this._lexer.token,n=this.parseName();return this.expectToken(Oy.COLON),{kind:wy.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(Oy.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(Oy.AT),{kind:wy.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(Oy.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(Oy.BRACKET_R),e={kind:wy.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(Oy.BANG)?{kind:wy.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:wy.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===Oy.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(Oy.STRING)||this.peek(Oy.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(Oy.BRACE_L,this.parseOperationTypeDefinition,Oy.BRACE_R);return{kind:wy.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(Oy.COLON);var n=this.parseNamedType();return{kind:wy.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:wy.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:wy.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(Oy.AMP);do{t.push(this.parseNamedType())}while(this.expectOptionalToken(Oy.AMP)||this.peek(Oy.NAME));return t}return this.delimitedMany(Oy.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var e;return!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLEmptyFields)&&this.peek(Oy.BRACE_L)&&this._lexer.lookahead().kind===Oy.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(Oy.BRACE_L,this.parseFieldDefinition,Oy.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(Oy.COLON);var o=this.parseTypeReference(),i=this.parseDirectives(!0);return{kind:wy.FIELD_DEFINITION,description:t,name:n,arguments:r,type:o,directives:i,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(Oy.PAREN_L,this.parseInputValueDef,Oy.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(Oy.COLON);var r,o=this.parseTypeReference();this.expectOptionalToken(Oy.EQUALS)&&(r=this.parseValueLiteral(!0));var i=this.parseDirectives(!0);return{kind:wy.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:wy.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:wy.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:o,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(Oy.EQUALS)?this.delimitedMany(Oy.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:wy.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:o,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(Oy.BRACE_L,this.parseEnumValueDefinition,Oy.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseDirectives(!0);return{kind:wy.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:wy.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:o,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(Oy.BRACE_L,this.parseInputValueDef,Oy.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===Oy.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(Oy.BRACE_L,this.parseOperationTypeDefinition,Oy.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return{kind:wy.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:wy.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:wy.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:wy.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:wy.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:wy.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:wy.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(Oy.AT);var n=this.parseName(),r=this.parseArgumentDefs(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var i=this.parseDirectiveLocations();return{kind:wy.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:o,locations:i,loc:this.loc(e)}},t.parseDirectiveLocations=function(){return this.delimitedMany(Oy.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==Dy[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 xy(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 vy(this._lexer.source,t.start,"Expected ".concat(Yy(e),", found ").concat(Zy(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!==Oy.NAME||t.value!==e)throw vy(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(Zy(t),"."));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===Oy.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=null!=e?e:this._lexer.token;return vy(this._lexer.source,t.start,"Unexpected ".concat(Zy(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 Zy(e){var t=e.value;return Yy(e.kind)+(null!=t?' "'.concat(t,'"'):"")}function Yy(e){return function(e){return e===Oy.BANG||e===Oy.DOLLAR||e===Oy.AMP||e===Oy.PAREN_L||e===Oy.PAREN_R||e===Oy.SPREAD||e===Oy.COLON||e===Oy.EQUALS||e===Oy.AT||e===Oy.BRACKET_L||e===Oy.BRACKET_R||e===Oy.BRACE_L||e===Oy.PIPE||e===Oy.BRACE_R}(e)?'"'.concat(e,'"'):e}var Jy=new Map,Xy=new Map,ev=!0,tv=!1;function nv(e){return e.replace(/[\s,]+/g," ").trim()}function rv(e){var t=new Set,n=[];return e.definitions.forEach((function(e){if("FragmentDefinition"===e.kind){var r=e.name.value,o=nv((s=e.loc).source.body.substring(s.start,s.end)),i=Xy.get(r);i&&!i.has(o)?ev&&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||Xy.set(r,i=new Set),i.add(o),t.has(o)||(t.add(o),n.push(e))}else n.push(e);var s})),h(h({},e),{definitions:n})}function ov(e){var t=nv(e);if(!Jy.has(t)){var n=function(e,t){return new Ky(e,t).parseDocument()}(e,{experimentalFragmentVariables:tv});if(!n||"Document"!==n.kind)throw new Error("Not a valid GraphQL document.");Jy.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}(rv(n)))}return Jy.get(t)}function iv(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]})),ov(r)}var sv,av=iv,lv=function(){Jy.clear(),Xy.clear()},cv=function(){ev=!1},uv=function(){tv=!0},fv=function(){tv=!1};(sv=iv||(iv={})).gql=av,sv.resetCaches=lv,sv.disableFragmentWarnings=cv,sv.enableExperimentalFragmentVariables=uv,sv.disableExperimentalFragmentVariables=fv,iv.default=iv;const pv=e=>"string"==typeof e?iv(e):e;function dv(e){return new L((t=>{const n=e.then((e=>e.subscribe(t))).catch((()=>t.unsubscribe()));return function(){t.unsubscribe(),n.then((e=>e?.unsubscribe())).catch((e=>console.log(e)))}}))}const hv=rt`
|
|
161
161
|
query Extensions($first: Int!, $extensionIDs: [String!]!, $extensionManifestFields: [String!]!) {
|
|
162
162
|
extensionRegistry {
|
|
163
163
|
extensions(first: $first, extensionIDs: $extensionIDs) {
|