performance.mark("js-parse-end:96306-1f603f3f74fb4d72.js"); "use strict";(globalThis.webpackChunk_github_ui_github_ui=globalThis.webpackChunk_github_ui_github_ui||[]).push([["96306"],{87253(e,t,n){n.d(t,{_S:()=>l,cB:()=>o,cW:()=>i});var a=n(56341),r=n(26316);let l=()=>{let e=(0,a.JV)().appId;return e&&"rails"!==e?e:crypto.randomUUID()},i=e=>{(0,a.C3)({appId:e})},o=()=>{let e=document.querySelector("react-app")||document.querySelector("projects-v2");return e?.uuid||"rails"};r.cg?.addEventListener("hashchange",()=>{(0,a.C3)({appId:o()})},!0)},25445(e,t,n){n.d(t,{Z:()=>a});function a({appendQuery:e,retainScrollPosition:t,returnTarget:n}){window.dispatchEvent(new CustomEvent("blackbird_monolith_append_and_focus_input",{detail:{appendQuery:e,retainScrollPosition:t,returnTarget:n}}))}},18660(e,t,n){n.d(t,{_:()=>l});var a=n(74848),r=n(16522);function l(e){let t,n,l,i=(0,r.c)(12),{buttonFocusId:o,buttonHotkey:s,onButtonClick:c,buttonTestLabel:d,onlyAddHotkeyScopeButton:u}=e,m=d||"";return i[0]!==o||i[1]!==s||i[2]!==c||i[3]!==m?(t=(0,a.jsx)("button",{hidden:!0,"data-testid":m,"data-hotkey":s,onClick:c,"data-hotkey-scope":o}),i[0]=o,i[1]=s,i[2]=c,i[3]=m,i[4]=t):t=i[4],i[5]!==s||i[6]!==c||i[7]!==u?(n=!u&&(0,a.jsx)("button",{hidden:!0,"data-hotkey":s,onClick:c}),i[5]=s,i[6]=c,i[7]=u,i[8]=n):n=i[8],i[9]!==t||i[10]!==n?(l=(0,a.jsxs)(a.Fragment,{children:[t,n]}),i[9]=t,i[10]=n,i[11]=l):l=i[11],l}l.displayName="DuplicateOnKeydownButton"},20790(e,t,n){n.d(t,{Ak:()=>h,RF:()=>g,Wl:()=>p,aT:()=>x,cD:()=>f,fN:()=>m});var a=n(74848),r=n(16522),l=n(97810),i=n(36594),o=n(35205),s=n(31854),c=n(96540),d=n(53035);let u=(0,o.A)("localStorage"),m=(0,c.createContext)(void 0);m.displayName="OpenPanelStateContext";let p=(0,c.createContext)(()=>void 0);function f(e){let t,n,o,f,h,g,x,y,_=(0,r.c)(18),{children:w,payload:v,openPanelRef:F,action:R}=e,b=(0,d.E)(),T="blame"in v;_[0]!==v?(t=(0,l.H)(v),_[0]=v,_[1]=t):t=_[1];let I=t,C=b?"blame"===R:T,j=b?"tree"===R:I,k=(0,c.useRef)(C),N=(0,c.useRef)(j);_[2]!==C||_[3]!==j?(n=()=>{k.current=C,N.current=j},_[2]=C,_[3]=j,_[4]=n):n=_[4],(0,c.useLayoutEffect)(n);let S=(0,i.i)(),E=(0,c.useRef)(void 0);_[5]!==S||_[6]!==v?(o=()=>{let e=u.getItem("codeNavOpen");if(!S&&""!==e&&null!==e||S&&v.symbolsExpanded)return"codeNav"},_[5]=S,_[6]=v,_[7]=o):o=_[7];let[P,O]=(0,c.useState)(o),$=(C||j)&&"codeNav"===P?void 0:P;_[8]!==$||_[9]!==F?(f=()=>{F.current=$},h=[$,F],_[8]=$,_[9]=F,_[10]=f,_[11]=h):(f=_[10],h=_[11]),c.useEffect(f,h),_[12]===Symbol.for("react.memo_cache_sentinel")?(g=(e,t)=>{O(n=>(n&&E.current&&E.current.focus(),E.current=t,k.current||N.current&&"codeNav"===e?void 0:e))},_[12]=g):g=_[12];let B=g;return function(e){let t,n,a=(0,r.c)(4),{screenSize:l}=(0,s.lm)(),i=(0,c.useRef)(l);a[0]!==l||a[1]!==e?(t=()=>{let t=i.current>=s.Gy.large,n=i.current===l;lvoid 0}).displayName="OpenPanelContext",f.displayName="OpenPanelProvider"},17005(e,t,n){function a(e){return r(e)[0]}function r(e){let t=[];for(let n of function(){try{return document.cookie.split(";")}catch{return[]}}()){let[a,r]=n.trim().split("=");e===a&&void 0!==r&&t.push({key:a,value:r})}return t}function l(e,t,n=null,a=!1,r="lax"){let i=document.domain;if(null==i)throw Error("Unable to get document domain");i.endsWith(".github.com")&&(i="github.com");let o="https:"===location.protocol?"; secure":"",s=n?`; expires=${n}`:"";!1===a&&(i=`.${i}`);try{document.cookie=`${e}=${t}; path=/; domain=${i}${s}${o}; samesite=${r}`}catch{}}function i(e,t=!1){let n=document.domain;if(null==n)throw Error("Unable to get document domain");n.endsWith(".github.com")&&(n="github.com");let a=new Date(Date.now()-1).toUTCString(),r="https:"===location.protocol?"; secure":"",l=`; expires=${a}`;!1===t&&(n=`.${n}`);try{document.cookie=`${e}=''; path=/; domain=${n}${l}${r}`}catch{}}n.d(t,{OR:()=>r,Ri:()=>a,TV:()=>l,Yj:()=>i})},26440(e,t,n){n.d(t,{L:()=>s});var a=n(74848),r=n(16522),l=n(38621),i=n(26108),o=n(34164);n(96540);let s=e=>{let t,n,s,c=(0,r.c)(17),{ref:d,expanded:u,testid:m,ariaLabel:p,ariaControls:f,onToggleExpanded:h,alignment:g,dataHotkey:x,className:y,size:_,tooltipDirection:w,variant:v}=e,F=u?`collapse-${m}`:`expand-${m}`,R=u?"left"===g?l.SidebarExpandIcon:l.SidebarCollapseIcon:"left"===g?l.SidebarCollapseIcon:l.SidebarExpandIcon;c[0]!==h?(t=e=>{h(e)},c[0]=h,c[1]=t):t=c[1];let b=v??"invisible";return c[2]!==y?(n=(0,o.$)(y,"fgColor-muted"),c[2]=y,c[3]=n):n=c[3],c[4]!==f||c[5]!==p||c[6]!==x||c[7]!==u||c[8]!==d||c[9]!==_||c[10]!==F||c[11]!==R||c[12]!==t||c[13]!==b||c[14]!==n||c[15]!==w?(s=(0,a.jsx)(i.K,{"aria-label":p,tooltipDirection:w,ref:d,"data-testid":F,"aria-expanded":u,"aria-controls":f,icon:R,"data-hotkey":x,onClick:t,variant:b,size:_,className:n}),c[4]=f,c[5]=p,c[6]=x,c[7]=u,c[8]=d,c[9]=_,c[10]=F,c[11]=R,c[12]=t,c[13]=b,c[14]=n,c[15]=w,c[16]=s):s=c[16],s};s.displayName="ExpandButton",s.displayName="ExpandButton"},60854(e,t,n){n.d(t,{f:()=>r});var a=n(78597);async function r(e){let t=await (0,a.lS)(`${e}?noancestors=1`);if(!t.ok)throw Error(`Failed to fetch tree data: ${t.status} ${t.statusText}`);let n=await t.json();return"codeViewTreeRoute"in n.payload?{tree:{items:n.payload.codeViewTreeRoute.tree.items,totalCount:n.payload.codeViewTreeRoute.tree.totalCount}}:{tree:{items:n.payload.tree.items,totalCount:n.payload.tree.totalCount}}}},70760(e,t,n){n.d(t,{Uy:()=>Z,H:()=>h,qn:()=>e_,c2:()=>eu,Nq:()=>H});var a=n(74848),r=n(16522),l=n(18660),i=n(23082),o=n(26440),s=n(19519),c=n(38621),d=n(21373),u=n(34164),m=n(96540);let p=e=>{let t,n,m,p,f,h,g=(0,r.c)(32),{ref:x,expanded:y,onToggleExpanded:_,className:w,ariaControls:v,textAreaId:F,useFilesButtonBreakpoint:R,variant:b,getTooltipDirection:T}=e,I=void 0===R||R,{toggleTreeShortcut:C}=(0,i.wk)(),{isServer:j}=(0,s.V)();g[0]!==y||g[1]!==T?(t=T?.(y)??"se",g[0]=y,g[1]=T,g[2]=t):t=g[2];let k=t;g[3]!==y||g[4]!==j||g[5]!==_||g[6]!==x||g[7]!==C.hotkey||g[8]!==I||g[9]!==b?(n=I&&(!y||j)&&(0,a.jsx)(d.Q,{"aria-label":"Expand file tree",leadingVisual:c.ArrowLeftIcon,"data-hotkey":C.hotkey,"data-testid":"expand-file-tree-button-mobile",ref:x,onClick:_,variant:b??"invisible",className:"ExpandFileTreeButton-module__Button_1__Svs95",children:"Files"}),g[3]=y,g[4]=j,g[5]=_,g[6]=x,g[7]=C.hotkey,g[8]=I,g[9]=b,g[10]=n):n=g[10];let N=C.hotkey,S=I&&(!y||j);g[11]!==w||g[12]!==S?(m=(0,u.$)(w,"position-relative","ExpandFileTreeButton-module__expandButton__hDOcv",{"ExpandFileTreeButton-module__filesButtonBreakpoint__zEvz3":S}),g[11]=w,g[12]=S,g[13]=m):m=g[13];let E=y?"Collapse file tree":"Expand file tree";return g[14]!==v||g[15]!==y||g[16]!==_||g[17]!==x||g[18]!==m||g[19]!==E||g[20]!==C.hotkey||g[21]!==k||g[22]!==b?(p=(0,a.jsx)(o.L,{dataHotkey:N,className:m,expanded:y,alignment:"left",ariaLabel:E,tooltipDirection:k,testid:"file-tree-button",ariaControls:v,ref:x,variant:b,onToggleExpanded:_}),g[14]=v,g[15]=y,g[16]=_,g[17]=x,g[18]=m,g[19]=E,g[20]=C.hotkey,g[21]=k,g[22]=b,g[23]=p):p=g[23],g[24]!==_||g[25]!==F||g[26]!==C.hotkey?(f=(0,a.jsx)(l._,{buttonFocusId:F,buttonHotkey:C.hotkey,onButtonClick:_,onlyAddHotkeyScopeButton:!0}),g[24]=_,g[25]=F,g[26]=C.hotkey,g[27]=f):f=g[27],g[28]!==n||g[29]!==p||g[30]!==f?(h=(0,a.jsxs)(a.Fragment,{children:[n,p,f]}),g[28]=n,g[29]=p,g[30]=f,g[31]=h):h=g[31],h};p.displayName="ExpandFileTreeButton",p.displayName="ExpandFileTreeButton";var f=n(7231);function h(e){let t,n,o=(0,r.c)(8),{inputRef:s,onFindFilesShortcut:c,textAreaId:d}=e,{sendRepoKeyDownEvent:u}=(0,f.T)(),{findFilesShortcut:m}=(0,i.wk)();return o[0]!==s||o[1]!==c||o[2]!==u?(t=()=>{c?.(),s?.current?.focus(),u("GO_TO_FILE")},o[0]=s,o[1]=c,o[2]=u,o[3]=t):t=o[3],o[4]!==m.hotkey||o[5]!==t||o[6]!==d?(n=(0,a.jsx)(l._,{buttonFocusId:d,buttonHotkey:m.hotkey,onButtonClick:t}),o[4]=m.hotkey,o[5]=t,o[6]=d,o[7]=n):n=o[7],n}h.displayName="FindFilesShortcut";var g=n(82175),x=n(98779),y=n(56792),_=n(48337),w=n(20790),v=n(12191),F=n(54242),R=n(66743),b=n(23666),T=n(77236),I=n(31854),C=n(88134),j=n(29941),k=n(47819),N=n(26108),S=n(87555),E=n(72889),P=n(10095),O=n(27104);let $=(0,m.createContext)({knownFolders:new Map,dispatchKnownFolders:()=>{}});$.displayName="FileTreeContext";var B=n(60854);let V="ReposFileTreePane-module__HideTree__AYZnm",D="ReposFileTreePane-module__PaneContentsHiddenOnNarrow__KY_EL";var A=n(31595),G=n(76331),M=n(53035),L=n(60057),U=n(88015),W=n(4625),K=n(7478);let z=(0,m.createContext)({});function H(e){let t,n,l,i,o,s=(0,r.c)(6),{children:c}=e,d=(0,m.useRef)(!1),u=(0,m.useRef)(!1),p=(0,m.useRef)(!0);s[0]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{d.current=e},s[0]=t):t=s[0];let f=t;s[1]===Symbol.for("react.memo_cache_sentinel")?(n=e=>{u.current=e},s[1]=n):n=s[1];let h=n;s[2]===Symbol.for("react.memo_cache_sentinel")?(l=e=>{p.current=e},s[2]=l):l=s[2];let g=l;s[3]===Symbol.for("react.memo_cache_sentinel")?(i={expandAllFolders:d,refreshTree:u,shouldFetchFolders:p,setExpandAllFolders:f,setRefreshTree:h,setShouldFetchFolders:g},s[3]=i):i=s[3];let x=i;return s[4]!==c?(o=(0,a.jsx)(z,{value:x,children:c}),s[4]=c,s[5]=o):o=s[5],o}function Z(){return(0,m.use)(z)}z.displayName="FileTreeControlContext",H.displayName="FileTreeControlProvider";var q=n(52870);function J(e,t,n){let a=[];for(let r of t)if(r.startsWith(e)){let t=r.slice(e.length+1),l=t.indexOf("/"),i=l>0?t.slice(0,l):t,o=`${e}/${i}`;if(n&&n.some(e=>e.path===o))continue;let s={items:[],data:{contentType:o===r?"file":"directory",name:i,path:o,isClientOnly:!0}};a.push(s)}return a}function Y(e,t,n){e.data.name=e.data.name.slice(e.data.name.lastIndexOf("/")+1,e.data.name.length);let a=t.name.slice(0,t.name.lastIndexOf("/")),r=a.indexOf("/")>-1,l={path:t.path.slice(0,t.path.lastIndexOf("/")),contentType:t.contentType,name:a,hasSimplifiedPath:r},i={items:[e],data:l};return(n.set(l.path,i),r)?Y(i,{...l},n):i}function Q(e,t,n,a,r=!1){if(!e)return{newRootItems:n,rootItemsUpdated:!1,itemsAdded:!1};let l=!!e[""]&&X("",t,n,e[""].items);a?.(n);let i=l;for(let l of Object.keys(e).sort())if(l){let o=t.get(l);if(o){let s=o.items.length;if(X(l,t,o.items,e[l].items,a),o.data.totalCount=e[l].totalCount,o.items.length>s&&(i=!0),r&&o.items.length>s){let e={...o,items:[...o.items]};t.set(l,e),function(e,t,n,a){let r=n.lastIndexOf("/");if(-1===r){let e=t.findIndex(e=>e.data.path===n);-1!==e&&(t[e]=a)}else{let t=n.substring(0,r),l=e.get(t);if(l){let e=l.items.findIndex(e=>e.data.path===n);-1!==e&&(l.items[e]=a)}}}(t,n,l,e)}}}return{newRootItems:n,rootItemsUpdated:l,itemsAdded:i}}function X(e,t,n,a,r){let l=!1;for(let i of a){let a=e?`${e}/${i.name}`:i.name;if(!t.get(a)){let e={items:[],data:{...i}};if(t.set(a,e),i.hasSimplifiedPath){let a=Y(e,i,t),o=n.findIndex(e=>e.data.path===a.data.path);-1!==o?a.items.length>n[o].items.length&&(n[o]=a,l=!0):(n.push(a),r?.(n))}else n.push(e),r?.(n)}}return l}function ee(e){let t,n,l,i,o,s,d,u,p,h,g,x,y=(0,r.c)(43),{isActive:_,file:w,onItemSelected:v,getItemUrl:F,selectedItemRef:R,navigate:b,onRenderRow:T,getFileTrailingVisual:I,getFileIcon:C}=e,{sendRepoClickEvent:j}=(0,f.T)(),k=m.useRef(null);y[0]===Symbol.for("react.memo_cache_sentinel")?(t={focusRowRef:k,mouseRowRef:k},y[0]=t):t=y[0];let N=(0,L.Z)(t),S="submodule"===w.data.contentType;y[1]!==w.data||y[2]!==I?(n=I?.(w.data),y[1]=w.data,y[2]=I,y[3]=n):n=y[3];let E=n;y[4]!==w.data||y[5]!==F||y[6]!==_||y[7]!==S||y[8]!==b||y[9]!==v||y[10]!==j?(l=e=>{S?(e.preventDefault(),w.data.submoduleUrl&&(window.location.href=w.data.submoduleUrl)):e.metaKey||e.ctrlKey||1===e.button?(window.open(F(w.data),"_blank"),e.preventDefault()):_?e.preventDefault():(v?.(),j("FILES_TREE.ITEM",{item_path:w.data.path}),b(F(w.data)),e.stopPropagation())},y[4]=w.data,y[5]=F,y[6]=_,y[7]=S,y[8]=b,y[9]=v,y[10]=j,y[11]=l):l=y[11];let P=l;T?.();let O=`${w.data.path}-item`,$=_?void 0:"auto 2rem";y[12]!==w.data||y[13]!==C||y[14]!==S?(i=C?C(w.data):S?(0,a.jsx)(c.FileSubmoduleIcon,{}):(0,a.jsx)(c.FileIcon,{}),y[12]=w.data,y[13]=C,y[14]=S,y[15]=i):i=y[15],y[16]!==i?(o=(0,a.jsx)(W.G.LeadingVisual,{children:i}),y[16]=i,y[17]=o):o=y[17];let B=S?"var(--fgColor-accent, var(--color-accent-fg))":void 0;return y[18]!==B?(s={color:B},y[18]=B,y[19]=s):s=y[19],y[20]!==w.data.name||y[21]!==R||y[22]!==s?(d=(0,a.jsx)("span",{ref:R,style:s,children:w.data.name}),y[20]=w.data.name,y[21]=R,y[22]=s,y[23]=d):d=y[23],y[24]!==w.data.name||y[25]!==N?(u=N&&(0,a.jsx)(G.m,{"data-testid":`${w.data.name}-item-tooltip`,id:`${w.data.name}-item-tooltip`,contentRef:k,"aria-label":w.data.name,open:!0,direction:"ne"}),y[24]=w.data.name,y[25]=N,y[26]=u):u=y[26],y[27]!==d||y[28]!==u?(p=(0,a.jsxs)(a.Fragment,{children:[d,u]}),y[27]=d,y[28]=u,y[29]=p):p=y[29],y[30]!==E?(h=!!E?.screenReaderText&&(0,a.jsx)("span",{className:"sr-only",children:E.screenReaderText}),y[30]=E,y[31]=h):h=y[31],y[32]!==E?(g=!!E?.trailingVisual&&(0,a.jsx)(W.G.TrailingVisual,{children:E.trailingVisual}),y[32]=E,y[33]=g):g=y[33],y[34]!==_||y[35]!==P||y[36]!==p||y[37]!==h||y[38]!==g||y[39]!==O||y[40]!==$||y[41]!==o?(x=(0,a.jsxs)(W.G.Item,{ref:k,onSelect:P,current:_,id:O,containIntrinsicSize:$,children:[o,p,h,g]}),y[34]=_,y[35]=P,y[36]=p,y[37]=h,y[38]=g,y[39]=O,y[40]=$,y[41]=o,y[42]=x):x=y[42],x}ee.displayName="WrappedFileTreeRow";let et=m.memo(ee);function en({clientOnlyFilePaths:e,directory:t,isActive:n,isAncestorOfActive:r,leadingPath:l="",onItemSelected:i,dispatchKnownFolders:o,getItemUrl:s,getFetchUrl:c,selectedItemRef:d,navigate:u,onRenderRow:p,getFileTrailingVisual:h,getFileIcon:g,navigateOnClick:x=!0,treeName:y}){let{expandAllFolders:_,shouldFetchFolders:w}=Z(),[v,F]=(0,m.useState)(_?.current||r),{sendRepoClickEvent:R}=(0,f.T)(),b=m.useRef(null),T=m.useRef(null),I=(0,L.Z)({focusRowRef:T,mouseRowRef:b}),[C,j,k,N,S,E,P]=function(e,t,n){let[a,r]=m.useState(e.items),[l,i]=m.useState(e.data.totalCount||0),[o,s]=m.useState(!1),[c,d]=m.useState(!1),{safeSetTimeout:u}=(0,q.A)();m.useEffect(()=>{r(e.items)},[e.items]),m.useEffect(()=>{void 0!==e.data.totalCount&&i(e.data.totalCount)},[e.data.totalCount]);let p=m.useCallback(()=>{d(!1)},[]),f=m.useCallback((e,t)=>{let n=e||[...a];r(n.slice(0,100)),u(()=>{r(n),void 0!==t&&i(t)},1)},[a,u]);return[m.useCallback(async a=>{let l=new Map;if(e.data.isClientOnly){if(a){let n=J(e.data.path,a);for(let e of n)l.set(e.data.path,e);t({type:"add",folders:l,processingTime:0}),n.length>100?f(n,n.length):(r(n),i(n.length))}}else{let o=n(e.data);d(!1),s(!0);let c=Date.now();try{let n=await (0,B.f)(o),s=n.tree.items.map(e=>{let t={items:[],data:{...e},autoExpand:"directory"===e.contentType&&1===n.tree.items.length};return(l.set(e.path,t),e.hasSimplifiedPath)?Y(t,e,l):t});if(a){let t=e.data.path,r=J(t,a,n.tree.items);for(let e of(s.push(...r),r))l.set(e.data.path,e)}t({type:"add",folders:l,processingTime:Date.now()-c}),e.items=s,e.data.totalCount=n.tree.totalCount,s.length>100?f(s,n.tree.totalCount):(r(s),i(n.tree.totalCount))}catch{d(!0)}}s(!1)},[n,e,t,f]),f,a,o,c,p,l]}(t,o,c),O=P-k.length,$=l?`${l}/`:"";(0,m.useEffect)(()=>{_?.current&&!v&&F(!0)},[t,_,v]);let V=m.useCallback(a=>{_?.current&&(_.current=!1),a&&!v&&!N&&!S&&(t.items.length>100?j():0!==t.items.length||n||r||w?.current===!1||C(e)),a!==v&&F(a)},[_,v,N,S,t.items.length,n,r,w,j,C,e]),D=m.useCallback(e=>{e.metaKey||e.ctrlKey||1===e.button&&x?(window.open(s(t.data),"_blank"),e.preventDefault()):n?e.preventDefault():(i?.(),R("FILES_TREE.ITEM",{item_path:t.data.path}),x?u(s(t.data)):V?.(!v),e.stopPropagation())},[t.data,s,n,v,u,x,i,V,R]);m.useEffect(()=>{r&&!v&&V?.(!0)},[r]),m.useEffect(()=>{0===t.items.length&&v?V?.(!1):!v&&t.autoExpand&&V?.(!0)},[t.items.length]);let A=m.useCallback(e=>{d&&n&&d(e),b.current=e},[d,n]);return 1===t.items.length&&"directory"===t.items[0].data.contentType?(0,a.jsx)(el,{clientOnlyFilePaths:e,directoryItems:t.items,leadingPath:$+t.data.name,inheritsActive:n,dispatchKnownFolders:o,onItemSelected:i,selectedItemRef:d,getItemUrl:s,directoryNavigateOnClick:x,getFileTrailingVisual:h,getFileIcon:g,treeName:y}):(p?.(),(0,a.jsxs)(W.G.Item,{ref:T,expanded:v,onExpandedChange:V,current:n,onSelect:D,id:`${t.data.path}-item`,containIntrinsicSize:n?void 0:"auto 2rem",children:[(0,a.jsx)(W.G.LeadingVisual,{children:(0,a.jsx)(W.G.DirectoryIcon,{})}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("span",{ref:A,children:[$,t.data.name]}),I&&(0,a.jsx)(G.m,{"data-testid":`${t.data.name}-directory-item-tooltip`,id:`${t.data.name}-directory-item-tooltip`,contentRef:T,"aria-label":`${$}${t.data.name}`,open:!0,direction:"ne"})]}),(0,a.jsx)(W.G.SubTree,{state:N?"loading":S?"error":"done",children:S?(0,a.jsx)(W.G.ErrorDialog,{onRetry:C,onDismiss:E,children:"There was an error loading the folder contents."}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(el,{clientOnlyFilePaths:e,directoryItems:k,dispatchKnownFolders:o,onItemSelected:i,selectedItemRef:d,getItemUrl:s,directoryNavigateOnClick:x,getFileTrailingVisual:h,getFileIcon:g,treeName:y}),O>0&&(0,a.jsx)(eo,{message:`${O} entries not shown`})]})})]}))}et.displayName="FileTreeRow",en.displayName="WrappedDirectoryTreeRow";let ea=m.memo(en);function er({clientOnlyFilePaths:e,directoryItems:t,leadingPath:n,inheritsActive:r,onItemSelected:l,dispatchKnownFolders:i,selectedItemRef:o,onRenderRow:s,getItemUrl:c,getFileTrailingVisual:d,getFileIcon:u,directoryNavigateOnClick:p=!0,treeName:f}){let h=(0,A.l)(),g=(0,v.Z)(),x=(0,U.Zp)(),y=m.useRef(x);return(0,a.jsx)(a.Fragment,{children:t.map(t=>{let m=h===t.data.path,x=m||h.startsWith(`${t.data.path}/`);return"directory"===t.data.contentType?(0,a.jsx)(ea,{clientOnlyFilePaths:e,isActive:r||m,isAncestorOfActive:x,onItemSelected:l,leadingPath:n,directory:t,dispatchKnownFolders:i,getItemUrl:c,getFetchUrl:g.getItemUrl,selectedItemRef:x?o:void 0,navigate:y.current,onRenderRow:s,navigateOnClick:p,getFileTrailingVisual:d,getFileIcon:u,itemCount:t.items.length,treeName:f},t.data.name):(0,a.jsx)(et,{onItemSelected:l,file:t,isActive:m,getItemUrl:c,selectedItemRef:m?o:void 0,navigate:y.current,onRenderRow:s,getFileTrailingVisual:d,getFileIcon:u,treeName:f},t.data.name)})})}ea.displayName="DirectoryTreeRow",er.displayName="WrappedDirectoryContents";let el=m.memo(er);function ei(e){let{clientOnlyFilePaths:t,data:n,rootItems:r,setRootItems:l,fetchError:i,incompleteFileTree:o,processingTime:s,loading:c,onRenderRow:d,getItemUrl:p,getFileTrailingVisual:f,getFileIcon:h,sortDirectoryItems:g,treeName:x}=e,{knownFolders:y,dispatchKnownFolders:_}=(0,m.use)($),{refreshTree:w}=Z(),v=(0,M.E)();m.useEffect(()=>{if(c)return;let e=new Map,t=[];w?.current||(e=new Map(y),t=r.slice());let{newRootItems:a,rootItemsUpdated:i,itemsAdded:o}=Q(n,e,t,g,v),d=v&&o;(a.length>r.length||i||d||w?.current)&&l(a),(e.size>y.size||d||w?.current)&&_({type:"set",folders:e,processingTime:s}),w?.current&&(w.current=!1)},[n,c]);let F=m.useCallback(e=>{1===e.button&&e.preventDefault()},[]);return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{onMouseDown:F,className:(0,u.$)(e.className,"ReposFileTreeView-module__Box__vkb5W"),"data-testid":"repos-file-tree-container",children:c?(0,a.jsx)("div",{className:"ReposFileTreeView-module__Box_1__97JKJ",children:(0,a.jsx)(K.A,{"aria-label":"Loading file tree"})}):(0,a.jsx)("nav",{"aria-label":"File Tree Navigation",children:(0,a.jsxs)(W.G,{"aria-label":"Files",children:[i&&(0,a.jsx)(eo,{message:"Some files could not be loaded."}),o&&(0,a.jsx)(eo,{message:"Sign in to see the full file tree."}),(0,a.jsx)(el,{clientOnlyFilePaths:t,directoryItems:r,onItemSelected:e.onItemSelected,dispatchKnownFolders:_,selectedItemRef:e.selectedItemRef,onRenderRow:d,directoryNavigateOnClick:e.directoryNavigateOnClick,getItemUrl:p,getFileTrailingVisual:f,getFileIcon:h,treeName:x})]})})})})}function eo(e){let t,n,l=(0,r.c)(3),{message:i}=e,o=i||"Couldn't load.";return l[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,a.jsx)(W.G.LeadingVisual,{children:(0,a.jsx)(P.A,{icon:c.AlertFillIcon,className:"ReposFileTreeView-module__Octicon__GMgHV"})}),l[0]=t):t=l[0],l[1]!==o?(n=(0,a.jsxs)(W.G.Item,{id:"error-tree-row",children:[t,(0,a.jsx)("div",{className:"ReposFileTreeView-module__Box_2__y5uWW",children:o})]}),l[1]=o,l[2]=n):n=l[2],n}el.displayName="DirectoryContents",ei.displayName="ReposFileTreeView",eo.displayName="ErrorTreeRow";var es=n(25445);function ec(e){let t,n,o,s,d,m,p=(0,r.c)(18),{className:f,onClick:h,textAreaId:g}=e,{searchShortcut:x}=(0,i.wk)(),y=x.hotkey;return p[0]!==h?(t=e=>{h?.(),(0,es.Z)({retainScrollPosition:!0,returnTarget:e.target.closest("button")})},p[0]=h,p[1]=t):t=p[1],p[2]!==f?(n=(0,u.$)("SearchButton-module__IconButton__SBlqu",f),p[2]=f,p[3]=n):n=p[3],p[4]!==x.hotkey||p[5]!==t||p[6]!==n?(o=(0,a.jsx)(N.K,{"aria-label":"Search this repository",tooltipDirection:"nw",icon:c.SearchIcon,"data-hotkey":y,size:"medium",onClick:t,className:n}),p[4]=x.hotkey,p[5]=t,p[6]=n,p[7]=o):o=p[7],p[8]!==h||p[9]!==g?(s=()=>{let e=document.getElementById(g);h?.(),(0,es.Z)({retainScrollPosition:!0,returnTarget:e??void 0})},p[8]=h,p[9]=g,p[10]=s):s=p[10],p[11]!==x.hotkey||p[12]!==s||p[13]!==g?(d=(0,a.jsx)(l._,{buttonFocusId:g,buttonHotkey:x.hotkey,onButtonClick:s,onlyAddHotkeyScopeButton:!0}),p[11]=x.hotkey,p[12]=s,p[13]=g,p[14]=d):d=p[14],p[15]!==o||p[16]!==d?(m=(0,a.jsxs)(a.Fragment,{children:[o,d]}),p[15]=o,p[16]=d,p[17]=m):m=p[17],m}ec.displayName="SearchButton";let ed=I.Gy.xxxlarge;function eu({clientOnlyFilePaths:e,collapseTree:t,showTree:n,fileTree:r,treeToggleElement:l,treeToggleRef:i,onItemSelected:o,processingTime:d,searchBoxRef:p,repo:f,path:R,refInfo:A,isFilePath:G,foldersToFetch:M,incompleteFileTree:L,id:U,onFindFilesShortcut:W,textAreaId:K,getItemUrlOverride:z,headerClassName:H,paneClassName:Z,paneContentsClassName:q,treeContainerClassName:J,findFileWorkerPath:Y,headerContent:X,getFileTrailingVisual:ee,getFileIcon:et,sortDirectoryItems:en,showFindFile:ea=!0,directoryNavigateOnClick:er=!0,showRefSelectorRow:el=!0,paneResizable:eo=!0}){if(ea&&void 0===Y)throw Error("findFileWorkerPath must be provided when showFindFile is true");let es=(0,w.RF)(),{canEdit:ef,fileExistsOnDefault:eh}=(0,y.M)(),[eg,ex]=m.useState(M.length>0),[ey,e_]=m.useState(!1),ew=m.useRef([]),ev=m.useRef(0),eF=m.useRef(null),eR=m.useRef(null),eb=m.useRef(!1),eT=m.useRef(null),{query:eI}=(0,_.JS)(),eC=m.useRef(eI);eC.current=eI;let{codeCenterOption:ej}=(0,C.ud)(),ek=m.useRef(es),{isServer:eN}=(0,s.V)(),{defaultBranch:eS}=(0,F.t)(),{getItemUrl:eE}=(0,v.Z)(),eP=z||eE,eO=[],e$=new Map,eB=m.useRef(eg);!eB.current&&r&&(eO=Q(r,e$,[],en).newRootItems),eB.current=!0;let[eV,eD]=m.useReducer(em,e$),[eA,eG]=m.useState(eO);m.useEffect(()=>{n&&(!eI||window.matchMedia(`(min-width: ${I.Gy.large}px)`).matches)||(eT.current=null)},[n,eI]),m.useEffect(()=>{es&&ek.current!==es&&window.matchMedia(`(max-width: ${ed-1}px)`).matches&&t({setPreference:!1}),ek.current=es},[t,es]);let eM=m.useCallback(async e=>{let t=eE({contentType:"directory",path:e,name:e});try{let n=await (0,B.f)(t),a={items:n.tree.items,totalCount:n.tree.totalCount};r[e]=a}catch{e_(!0)}ew.current.push(e),ev.current-=1,0===ev.current&&ex(!1)},[r,eE]);m.useEffect(()=>{if(L)return void ex(!1);if(!M||0===M.length)return;let e=M.filter(e=>!ew.current.includes(e));if(e.length>0)for(let t of(ev.current+=e.length,ex(!0),e))eM(t)},[eM,M,L]);let eL=m.useCallback(e=>{if(n&&(!eC.current||window.matchMedia(`(min-width: ${I.Gy.large}px)`).matches)&&eF.current&&e){let t=eF.current.clientHeight;(0,j.Rt)(e,eF.current,{endMargin:t/2,startMargin:t/2,behavior:"auto"})}},[n]),eU=m.useCallback(e=>{e&&eb.current?eb.current=!1:eT.current!==e&&eL(e),eT.current=e},[eL]),eW=m.useCallback(e=>{eF.current=e,window.matchMedia(`(min-width: ${ed}px)`).matches&&eL(eT.current)},[eL]),eK=m.useCallback(e=>{e&&eL(eT.current)},[eL]),{screenSize:ez}=(0,I.lm)(),eH=!eN&&(es&&ez=I.Gy.large,eZ=m.useCallback(()=>{eH||o(),eb.current=!0},[o,eH]),eq=G?R.substring(0,R.lastIndexOf("/")):R,eJ=(0,m.useMemo)(()=>({knownFolders:eV,dispatchKnownFolders:eD}),[eV]),eY=m.useMemo(()=>eN?null:(0,O.KF)(),[eN]),eQ=m.useCallback(()=>{window.matchMedia(`(min-width: ${I.Gy.large+1}px) and (max-width: ${I.Gy.xxxxlarge-1}px)`).matches&&t({setPreference:!1})},[t]),eX=A.name===eS,e0=(0,a.jsxs)("div",{id:U,className:(0,u.$)("ReposFileTreePane-module__PaneContents__SJjfF",eN&&D,q),children:[(0,a.jsxs)("div",{className:(0,u.$)(H,"ReposFileTreePane-module__Box_1__PpIop"),children:[X,el&&(0,a.jsxs)("div",{className:"ReposFileTreePane-module__Box_2__g74WI",children:[(0,a.jsx)("div",{className:"ReposFileTreePane-module__Box_3__D6cTp",children:eX||void 0===eh?(0,a.jsx)(x.R,{buttonClassName:"react-repos-tree-pane-ref-selector width-full ref-selector-class",allowResizing:!0}):(0,a.jsxs)(k.A,{className:"ReposFileTreePane-module__FullWidthButtonGroup__tyEfq",children:[eh?(0,a.jsx)(N.K,{icon:c.ChevronLeftIcon,"aria-label":"View file on default branch",as:T.N,to:(0,b.IO9)({repo:f,commitish:eS,action:"blob",path:R})}):(0,a.jsx)(N.K,{icon:c.ChevronLeftIcon,"aria-label":"View file on default branch",description:"File does not exist on default branch","aria-disabled":!0,inactive:!0}),(0,a.jsx)(x.R,{buttonClassName:"react-repos-tree-pane-ref-selector width-full ref-selector-class",allowResizing:!0})]})}),(0,a.jsxs)("div",{className:"ReposFileTreePane-module__Box_4__DG4pa",children:[ef&&(0,a.jsx)(N.K,{"aria-label":"Add file",tooltipDirection:"n",as:T.N,icon:c.PlusIcon,to:(0,b.IO9)({repo:f,path:eq,commitish:A.name,action:"new"}),onClick:eZ,className:"ReposFileTreePane-module__IconButton__rGggU"}),(0,a.jsx)(ec,{className:ef?"ReposFileTreePane-module__SearchButtonWithLeftBorder__TBrDc":void 0,onClick:eQ,textAreaId:K})]})]})]}),A.currentOid&&ea&&Y&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.default,{commitOid:A.currentOid,findFileWorkerPath:Y,onItemSelected:o,searchBoxRef:p,className:(0,u.$)("ReposFileTreePane-module__FileResultsList__zmSnM",eN&&D)}),(0,a.jsx)(h,{inputRef:p,onFindFilesShortcut:W,textAreaId:K})]}),(0,a.jsx)(ep,{scrollingRef:eF,sentinelRef:eR}),(0,a.jsxs)("div",{ref:eW,className:(0,u.$)("ReposFileTreePane-module__Box_5__Zy_o6",eN&&D),children:[(0,a.jsx)("div",{ref:eR,style:{height:1,marginTop:-1,width:"100%",flexShrink:0}}),eN?A.currentOid&&(0,a.jsx)("div",{className:eI?"react-tree-show-tree-items-on-large-screen":"react-tree-show-tree-items",children:(0,a.jsx)(ei,{clientOnlyFilePaths:e,data:r,rootItems:eA,selectedItemRef:eU,setRootItems:eG,onItemSelected:eZ,processingTime:d,loading:eg,fetchError:ey,incompleteFileTree:L,directoryNavigateOnClick:er,getItemUrl:eP,className:J,getFileTrailingVisual:ee,getFileIcon:et,sortDirectoryItems:en,treeName:A.name})}):eY&&(0,a.jsx)(O.bL,{node:eY}),!A.currentOid&&!f.isEmpty&&(0,a.jsxs)("div",{className:"ReposFileTreePane-module__Box_6__KnilA",children:[(0,a.jsx)(P.A,{icon:c.AlertFillIcon}),"\xa0Ref is invalid"]})]})]});return(0,a.jsxs)($,{value:eJ,children:[eY&&(0,a.jsx)(O.oj,{node:eY,children:A.currentOid&&(0,a.jsx)("div",{className:eI?"react-tree-show-tree-items-on-large-screen":"react-tree-show-tree-items",children:(0,a.jsx)(ei,{clientOnlyFilePaths:e,data:r,directoryNavigateOnClick:er,rootItems:eA,selectedItemRef:eU,setRootItems:eG,onItemSelected:eZ,processingTime:d,loading:eg,fetchError:ey,incompleteFileTree:L,getItemUrl:eP,className:J,getFileTrailingVisual:ee,getFileIcon:et,sortDirectoryItems:en,treeName:A.name})})}),!n&&ej.enabled&&l&&(0,a.jsx)("div",{className:"ReposFileTreePane-module__Box_7__T2yBS",children:l}),(0,a.jsx)(S.O7.Pane,{position:"start",sticky:!0,padding:"none",width:"large",resizable:!!eo,widthStorageKey:"codeView.tree-pane-width",divider:{regular:"none",narrow:"none"},className:(0,u.$)("ReposFileTreePane-module__Pane__rBZpI",!n&&V,eH||es?"ReposFileTreePane-module__HidePaneWithTreeOverlay__mFFGX":"ReposFileTreePane-module__HidePane__VHAVt",Z),children:n&&!eH&&(0,a.jsx)("div",{className:eN?es?"react-tree-pane-contents-3-panel":"react-tree-pane-contents":void 0,children:e0})}),n&&eH&&ek.current===es&&(0,a.jsx)(E.Ay,{className:(0,u.$)(eN?es?"react-tree-pane-overlay-3-panel":"react-tree-pane-overlay":void 0,"ReposFileTreePane-module__Overlay__Lgnte",!n&&V),ref:eK,returnFocusRef:i,onClickOutside:eQ,onEscape:eQ,top:0,position:"fixed",children:(0,a.jsx)(a.Fragment,{children:e0})})]})}function em(e,t){switch(t.type){case"set":{let n=e?.size>0;return(0,R.BI)("file-tree",{"fetch-count":n?t.folders.size-e.size:t.folders.size,"file-count":t.folders.size,"nav-type":n?"soft":"hard","processing-time":t.processingTime}),t.folders}case"add":{let n=new Map([...e,...t.folders]);return(0,R.BI)("file-tree",{"fetch-count":t.folders.size,"file-count":n.size,"nav-type":"fetch","processing-time":t.processingTime}),n}default:throw Error(`Unknown action type: ${t.type}`)}}function ep(e){let t,n,l,i=(0,r.c)(6),{scrollingRef:o,sentinelRef:s}=e,[c,d]=m.useState(!1);return i[0]!==o||i[1]!==s?(t=()=>{let e=s.current;if(!e||!o.current)return;let t=new IntersectionObserver(e=>{let[t]=e;d(!t.isIntersecting)},{root:o.current,threshold:0});return t.observe(e),()=>t.disconnect()},n=[o,s],i[0]=o,i[1]=s,i[2]=t,i[3]=n):(t=i[2],n=i[3]),m.useEffect(t,n),i[4]!==c?(l=c?(0,a.jsx)("div",{className:"ReposFileTreePane-module__Box_8__TLAjy"}):null,i[4]=c,i[5]=l):l=i[5],l}eu.displayName="ReposFileTreePane",ep.displayName="TreeBorder";var ef=n(58164),eh=n(17005),eg=n(36594),ex=n(26316),ey=n(46249);function e_(e,t,n,r,l,i="fileTreeExpanded",o){let{sendRepoClickEvent:s}=(0,f.T)(),c=(0,eg.i)(),d=i?(0,eh.Ri)(i):void 0,u=void 0===ex.XC,h=!c&&d&&"false"!==d.value||c&&n;void 0===h&&(h=!1);let g=(0,m.useRef)(null),x=(0,m.useRef)(null),{screenSize:y}=(0,I.lm)(),[_,w]=(0,m.useState)(h),v=(0,m.useRef)(h),F=(0,m.useRef)(!1),R=(0,m.useRef)(!1),b=(0,m.useCallback)(()=>!(t.current&&window.matchMedia(`(min-width: ${ed}px)`).matches||!t.current&&window.matchMedia(`(min-width: ${I.Gy.xlarge}px)`).matches),[t]);(0,m.useLayoutEffect)(()=>{let e=b();e||(F.current=!1),w((0,ef.q)()&&y{T.current=_}),(0,m.useLayoutEffect)(()=>{let e=t.current?ed:I.Gy.xlarge,n=y=e;n&&v.current&&!(0,ef.q)()&&T.current&&w(!1),a&&v.current&&!T.current&&w(!0)},[t,y]);let C=(0,m.useCallback)(e=>{if(w(!0),b()&&(F.current=!0),e?.setPreference&&(l?.(!0),v.current=!0,i)){let e=new Date(Date.now()+2592e6).toUTCString();(0,eh.TV)(i,"true",e)}e?.focus==="toggleButton"?requestAnimationFrame(()=>g.current?.focus()):e?.focus==="search"&&requestAnimationFrame(()=>x.current?.focus())},[i,2592e6,b,l]),j=(0,m.useCallback)(e=>{if(w(!1),F.current=!1,R.current=!0,e?.setPreference&&(l?.(!1),v.current=!1,i)){let e=new Date(Date.now()+2592e6).toUTCString();(0,eh.TV)(i,"false",e)}e?.focus==="toggleButton"&&requestAnimationFrame(()=>g.current?.focus())},[i,2592e6,l]),k=(0,m.useCallback)(e=>e&&window.matchMedia(`(min-width: ${ed}px)`).matches||!t.current&&window.matchMedia(`(min-width: ${I.Gy.xlarge}px)`).matches,[t]),N=(0,m.useCallback)(()=>{s(T.current?"FILES_TREE.HIDE":"FILES_TREE.SHOW"),T.current?j({focus:"toggleButton",setPreference:k(t.current)}):C({focus:"toggleButton",setPreference:k(t.current)})},[s,j,k,t,C]),S=void 0!==d||_||u?void 0:"react-tree-toggle-button-with-indicator",E=(0,m.useMemo)(()=>(0,a.jsx)(ey.A,{as:"h2",className:"use-tree-pane-module__Heading__s4QbZ",children:(0,a.jsx)(p,{expanded:_,ariaControls:e,onToggleExpanded:N,className:S,ref:g,textAreaId:r,...o})}),[_,e,N,S,r,o]);return{isTreeExpanded:_,expandTree:C,collapseTree:j,treeToggleElement:E,treeToggleRef:g,searchBoxRef:x}}},33542(e,t,n){n.d(t,{G:()=>a});let a=e=>({})},88134(e,t,n){n.d(t,{T2:()=>c,cp:()=>f,ud:()=>g});var a=n(74848),r=n(16522),l=n(35205),i=n(96540);let o=(0,l.A)("localStorage"),s="codeView.codeFolding",c="codeView.codeWrapping",d="codeView.centerView",u="codeView.openSymbolsOnClick",m=new Map([[s,"Show code folding buttons"],[c,"Wrap lines"],[d,"Center content"],[u,"Open symbols on click"]]),p=(0,i.createContext)({codeFoldingOption:{},codeWrappingOption:{},codeCenterOption:{},openSymbolsOption:{}});p.displayName="CodeViewOptionsContext";let f=e=>{let t,n,l=(0,r.c)(8),{children:i}=e,o=h(s,!0),m=h(c,!1),f=h(d,!1),g=h(u,!0);l[0]!==f||l[1]!==o||l[2]!==m||l[3]!==g?(t={codeFoldingOption:o,codeWrappingOption:m,codeCenterOption:f,openSymbolsOption:g},l[0]=f,l[1]=o,l[2]=m,l[3]=g,l[4]=t):t=l[4];let x=t;return l[5]!==i||l[6]!==x?(n=(0,a.jsx)(p,{value:x,children:i}),l[5]=i,l[6]=x,l[7]=n):n=l[7],n};function h(e,t){let n,a,l,s,c=(0,r.c)(11);c[0]!==e?(n=o.getItem(e),c[0]=e,c[1]=n):n=c[1];let d=n;c[2]!==t||c[3]!==d?(a=()=>d?"true"===d:t,c[2]=t,c[3]=d,c[4]=a):a=c[4];let[u,p]=(0,i.useState)(a);c[5]!==e?(l=m.get(e)||"",c[5]=e,c[6]=l):l=c[6];let f=l;return c[7]!==u||c[8]!==f||c[9]!==e?(s={name:e,enabled:u,setEnabled:p,label:f},c[7]=u,c[8]=f,c[9]=e,c[10]=s):s=c[10],s}function g(){return(0,i.use)(p)}f.displayName="CodeViewOptionsProvider"}}]); //# sourceMappingURL=96306-1f603f3f74fb4d72-b00006003a4db088.js.map