@dylanpiercey/work 0.0.163 → 0.0.165

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.
Files changed (78) hide show
  1. package/dist/index.mjs +2042 -1811
  2. package/dist/public/assets/{_C7fpvxku.js → _BUlKyuxt.js} +1 -1
  3. package/dist/public/assets/_BUlKyuxt.js.br +0 -0
  4. package/dist/public/assets/_BjOuTwMp.js +1 -0
  5. package/dist/public/assets/_C-Aos447.js +1 -0
  6. package/dist/public/assets/_C0EKsmGU.js +1 -0
  7. package/dist/public/assets/_CJJNsoe7.js +1 -0
  8. package/dist/public/assets/_CaGqY8U4.js +1 -0
  9. package/dist/public/assets/_CdYFSV57.js +1 -0
  10. package/dist/public/assets/_CiZiDcHV.js +1 -0
  11. package/dist/public/assets/_Cjxw67io.js +1 -0
  12. package/dist/public/assets/_Cl9s1Wsk.js +1 -0
  13. package/dist/public/assets/_ClEzzUem.js +1 -0
  14. package/dist/public/assets/_DG3z02w-.js +1 -0
  15. package/dist/public/assets/_DHoAKK9Z.js +1 -0
  16. package/dist/public/assets/{_B9aynZpd.js → _DQATIMc0.js} +7 -7
  17. package/dist/public/assets/_DQATIMc0.js.br +0 -0
  18. package/dist/public/assets/_DkqmqYrh.js +1 -0
  19. package/dist/public/assets/_FNz0O8Sh.js +1 -0
  20. package/dist/public/assets/_FwW2QpLj.js +1 -0
  21. package/dist/public/assets/_P3hy6f6C.js +1 -0
  22. package/dist/public/assets/_U1CJwjMn.js +1 -0
  23. package/dist/public/assets/_XTKo7hRQ.js +1 -0
  24. package/dist/public/assets/_eNoxkhhO.js +83 -0
  25. package/dist/public/assets/_eNoxkhhO.js.br +0 -0
  26. package/dist/public/assets/_hh-H0D1j.js +1 -0
  27. package/dist/public/assets/_yQ26k3g-.js +1 -0
  28. package/dist/public/assets/_zMthiUAN.js +1 -0
  29. package/dist/public/assets/app-page-D7EjmXP_.css +1 -0
  30. package/dist/public/assets/app-page-D7EjmXP_.css.br +0 -0
  31. package/dist/public/assets/icon-arrow-down-BeSGn2E6.css +1 -0
  32. package/dist/public/assets/icon-arrow-down-BeSGn2E6.css.br +0 -0
  33. package/dist/public/assets/new-Du7xBoU1.js +1 -0
  34. package/dist/public/assets/review-view-CTNpiYqc.css +1 -0
  35. package/dist/public/assets/review-view-CTNpiYqc.css.br +0 -0
  36. package/dist/public/assets/review-view-Do3J8OqE.js +2 -0
  37. package/dist/public/assets/settings-Du7xBoU1.js +1 -0
  38. package/dist/public/assets/w-Du7xBoU1.js +1 -0
  39. package/dist/public/assets/w._-CtIaIHF1.js +1 -0
  40. package/dist/public/assets/w._-Du7xBoU1.js +1 -0
  41. package/package.json +1 -1
  42. package/dist/public/assets/_ADBv0JHa.js +0 -1
  43. package/dist/public/assets/_B9aynZpd.js.br +0 -0
  44. package/dist/public/assets/_BD5g78lR.js +0 -1
  45. package/dist/public/assets/_BLp3ocpo.js +0 -1
  46. package/dist/public/assets/_By8Q0kjO.js +0 -1
  47. package/dist/public/assets/_C0IUHC2J.js +0 -1
  48. package/dist/public/assets/_C1uHTxE9.js +0 -1
  49. package/dist/public/assets/_C2EvCPWi.js +0 -1
  50. package/dist/public/assets/_C7fpvxku.js.br +0 -0
  51. package/dist/public/assets/_CHlzsEhp.js +0 -1
  52. package/dist/public/assets/_CJ7IP1Av.js +0 -1
  53. package/dist/public/assets/_CZFZcbX6.js +0 -1
  54. package/dist/public/assets/_Clds-jNF.js +0 -1
  55. package/dist/public/assets/_CmPjzYBq.js +0 -1
  56. package/dist/public/assets/_Cn4yj8mF.js +0 -1
  57. package/dist/public/assets/_CnY7WKoH.js +0 -1
  58. package/dist/public/assets/_CsbAROu4.js +0 -1
  59. package/dist/public/assets/_CwLvxT1I.js +0 -1
  60. package/dist/public/assets/_D1nQRxbq.js +0 -1
  61. package/dist/public/assets/_DO-1wrdg.js +0 -83
  62. package/dist/public/assets/_DO-1wrdg.js.br +0 -0
  63. package/dist/public/assets/_DqZ5bGsL.js +0 -1
  64. package/dist/public/assets/_KBJPVXi5.js +0 -1
  65. package/dist/public/assets/_Z_b2LTfZ.js +0 -1
  66. package/dist/public/assets/_oBeKiYJw.js +0 -1
  67. package/dist/public/assets/app-page-Dl6GaaKR.css +0 -1
  68. package/dist/public/assets/app-page-Dl6GaaKR.css.br +0 -0
  69. package/dist/public/assets/icon-arrow-down-BG7XlCPT.css +0 -1
  70. package/dist/public/assets/icon-arrow-down-BG7XlCPT.css.br +0 -0
  71. package/dist/public/assets/new-DqdzV-MH.js +0 -1
  72. package/dist/public/assets/review-view-Buxhdl15.css +0 -1
  73. package/dist/public/assets/review-view-Buxhdl15.css.br +0 -0
  74. package/dist/public/assets/review-view-o3qf1i3k.js +0 -2
  75. package/dist/public/assets/settings-DqdzV-MH.js +0 -1
  76. package/dist/public/assets/w-DqdzV-MH.js +0 -1
  77. package/dist/public/assets/w._-DWpX54fh.js +0 -1
  78. package/dist/public/assets/w._-DqdzV-MH.js +0 -1
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_CENbzEJT.js","assets/_hePW80VL.js","assets/_uvCtJ6zz.js","assets/_CWH6qxYM.js","assets/_CQTDE9K4.js","assets/_CZEx699l.js","assets/_CMC6b9HF.js","assets/_zy6yt2JI.js","assets/_cXHJ5Aqj.js","assets/_DW3nSckX.js","assets/_C3EMIoXk.js","assets/_B2LkwyUu.js","assets/_mQm0jPVv.js","assets/_BXeXVLqQ.js","assets/_ClmBPtsj.js","assets/_BV5QcD1t.js","assets/_BNeDY6c6.js","assets/_D0OygaZT.js","assets/_YkIvmgMd.js","assets/_bTVj8UrX.js","assets/_DinKA_hx.js","assets/_BAfg1_wL.js","assets/_gzcpVVnB.js","assets/_rMYAdrnY.js","assets/_CmFrqHJw.js","assets/_CNTJHRw3.js","assets/_5AJ_AKid.js","assets/_C7Qx5vsK.js","assets/_BMLL4cWB.js","assets/_C3vzIjs1.js","assets/_hfRJcieK.js","assets/_BhpLuC-Z.js","assets/_eEx3xZw1.js","assets/_B7sBnSVB.js","assets/_CwSTGRiH.js","assets/_DPs98hXw.js","assets/_fT1Q2AHj.js","assets/_DWc1bOg5.js","assets/_CfwcpHky.js","assets/_BWxWv3Q4.js","assets/_D9Uq_kAm.js","assets/_BaHq4SXp.js","assets/_BYOwaDjH.js","assets/_CQJs3lWb.js","assets/_CYNrtFtB.js","assets/_DmIc4jLQ.js","assets/_DbYA3moe.js","assets/_CBce3t8t.js","assets/_DYvRD3hg.js","assets/_Dl-2e7rI.js","assets/_woXpYk--.js","assets/_CVzjJEu4.js","assets/_BE-5_Vob.js","assets/_BkmuJnv4.js","assets/_CQtYx0Hw.js","assets/_EnzWFNCd.js","assets/_CptijnhY.js","assets/_DK7gU5UW.js","assets/_Dx-8-gkx.js","assets/_DekxQCZG.js","assets/_C8oCnwJJ.js","assets/_BLsa44WM.js","assets/_owCQ3_5m.js","assets/_IvbGWrWX.js","assets/_BfqywnWV.js","assets/_5cJqJSYA.js","assets/_CRzKmxW8.js","assets/_BZiRiFuW.js","assets/_DendWUyw.js","assets/_0gdzfuwb.js","assets/_D0ODP8pF.js","assets/_DVTAwKKz.js","assets/_DSC0z2WY.js","assets/_DWQbgPoS.js","assets/_DJMQeKeT.js","assets/_Ceg68iFQ.js","assets/_BY9Zpo-y.js","assets/_K81ipFoO.js","assets/_DqKBuwfJ.js","assets/_oqKa8noW.js","assets/_CnvKMtbv.js","assets/_IyjqRm3v.js","assets/_rLFTqkRN.js","assets/_CacY0gHj.js","assets/_B5eOa1yu.js","assets/_Dixweg8N.js","assets/_D1A_Heim.js","assets/_O90oeIOV.js","assets/_DxPa6R8r.js","assets/_DOwzaHZ0.js","assets/_B3gFvitq.js","assets/_Cfkwpbl8.js","assets/_BiFt_7mu.js","assets/_CMLA9XwU.js","assets/_BI6nDtQe.js","assets/_CaR0Cm4R.js","assets/_BCq3eWBs.js","assets/_C2c05-aV.js","assets/_D0TvPGyZ.js","assets/_Bj61d0ZC.js","assets/_I6bkQ0U8.js","assets/_DB-OQ-9y.js","assets/_Cvrh5tZx.js","assets/_BIPSG49u.js","assets/_CAjFT4sV.js","assets/_L8AbGenz.js","assets/_ByJddavk.js","assets/_B7sulDMZ.js","assets/_BKkKlZgz.js","assets/_Dtdv7oY4.js","assets/_BPanIK56.js","assets/_BmhN3Nyl.js","assets/_BE-cBzrM.js","assets/_C8OhMxob.js","assets/_qdxAdBWQ.js","assets/_Ci_nEsc7.js","assets/_CYpm1nAK.js","assets/_BNLmms1o.js","assets/_CCSX75yM.js","assets/_CyEgAFGc.js","assets/_Dh5ihWbf.js","assets/_B2gwz-sJ.js","assets/_C6F_DycA.js","assets/_Un2ZJKHi.js","assets/_COoyuGi7.js","assets/_B6D30XZt.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t,t as n}from"./_hePW80VL.js";import{B as r,E as i,F as a,I as o,L as s,M as c,N as l,P as u,R as d,T as f,U as p,V as m,W as h,_ as g,a as _,b as v,c as y,d as b,f as x,i as S,j as C,k as w,l as T,n as E,r as D,t as O,u as k,v as A,y as j,z as M}from"./_tmN7XIcz.js";import{$ as ee,A as N,B as te,Bt as ne,C as re,Ct as ie,D as ae,E as oe,Et as se,F as ce,H as le,Ht as ue,I as de,J as fe,Jt as pe,L as me,M as he,N as ge,Nt as _e,O as ve,P as ye,Pt as be,Q as xe,R as Se,Rt as Ce,S as we,T as Te,Tt as Ee,U as De,Ut as P,V as Oe,Vt as ke,X as Ae,Xt as je,Yt as Me,Z as Ne,Zt as Pe,_ as Fe,a as Ie,at as Le,b as Re,c as ze,cn as Be,ct as Ve,dt as He,et as Ue,ft as We,g as Ge,gt as Ke,h as qe,ht as Je,i as Ye,it as Xe,j as Ze,jt as Qe,k as $e,lt as et,m as tt,mt as nt,n as rt,nt as it,o as at,ot,p as st,pt as ct,q as lt,qt as F,r as I,rt as ut,s as dt,st as ft,t as pt,tt as mt,u as ht,un as gt,ut as _t,v as vt,w as yt,x as bt,y as xt,yt as St,z as Ct,zt as wt}from"./_C7fpvxku.js";var Tt=`diffs-container`,Et=(()=>{try{return!1}catch{return!1}})(),Dt=/(?=^From [a-f0-9]+ .+$)/m,Ot=/(?=^diff --git)/gm,kt=/(?<=\n)/,At=/^(---|\+\+\+)\s+([^\t\r\n]+)/,jt=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Mt=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Nt=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Pt=`header-prefix`,Ft=`header-filename-suffix`,It=`header-metadata`,Lt=`header-custom`,L={dark:`pierre-dark`,light:`pierre-light`},Rt=`data-theme-css`,zt=`data-unsafe-css`,Bt=`data-diffs-scrollbar-measure`,Vt=`data-diffs-code-view-header`,Ht=`data-diffs-code-view-footer`,Ut=`--diffs-scrollbar-gutter-measured`,Wt=1e5,Gt={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Kt={...Gt,hunkLineCount:1},qt={paddingTop:8,paddingBottom:8,gap:8},Jt={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},Yt=Object.freeze({fromStart:0,fromEnd:0}),Xt={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Zt={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Qt=new Set,$t=null;function en(e){Qt.add(e),$t??=requestAnimationFrame(nn)}function tn(e){Qt.delete(e)&&Qt.size===0&&$t!=null&&(cancelAnimationFrame($t),$t=null)}function nn(e){let t=new Set(Qt);Qt.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}$t=Qt.size>0?requestAnimationFrame(nn):null}function rn(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function an(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function on(e,t){let n=e?.theme??L,r=t?.theme??L,i=sn(e),a=sn(t);return an(n,r)&&rn(e,t,[`theme`,`parseDiffOptions`])&&rn(i,a)}function sn(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function cn(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function ln({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:a}){let o=n+a*2,s=r?n+i*2:o;if(t=Math.max(t,s),o>=t||r){let n=Math.max(e-i,0),r=Math.min(e+s,t);return{top:n,bottom:Math.max(r,n)}}let c=e+n/2-o/2,l=c+o;return c<0&&(c=0),l>t&&(l=t),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(l,t),c))}}function un(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function dn(e){return{type:`text`,value:e}}function R({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function fn({name:e,width:t=16,height:n=16,properties:r}){return R({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[R({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function pn(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function mn(e){return R({tagName:`div`,properties:{"data-gutter":``},children:e})}function hn(e,t,n,r={}){return R({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[R({tagName:`span`,properties:{"data-line-number-content":``},children:[dn(`${t}`)]})]})}function gn(e,t,n){return R({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function _n(){return R({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[fn({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function vn(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function yn(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var bn=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],xn=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};xn.prototype.normal={},xn.prototype.property={},xn.prototype.space=void 0;function Sn(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new xn(n,r,t)}function Cn(e){return e.toLowerCase()}var wn=class{constructor(e,t){this.attribute=t,this.property=e}};wn.prototype.attribute=``,wn.prototype.booleanish=!1,wn.prototype.boolean=!1,wn.prototype.commaOrSpaceSeparated=!1,wn.prototype.commaSeparated=!1,wn.prototype.defined=!1,wn.prototype.mustUseProperty=!1,wn.prototype.number=!1,wn.prototype.overloadedBoolean=!1,wn.prototype.property=``,wn.prototype.spaceSeparated=!1,wn.prototype.space=void 0;var Tn=e({boolean:()=>z,booleanish:()=>Dn,commaOrSpaceSeparated:()=>An,commaSeparated:()=>kn,number:()=>B,overloadedBoolean:()=>On,spaceSeparated:()=>V}),En=0,z=jn(),Dn=jn(),On=jn(),B=jn(),V=jn(),kn=jn(),An=jn();function jn(){return 2**++En}var Mn=Object.keys(Tn),Nn=class extends wn{constructor(e,t,n,r){let i=-1;if(super(e,t),Pn(this,`space`,r),typeof n==`number`)for(;++i<Mn.length;){let e=Mn[i];Pn(this,Mn[i],(n&Tn[e])===Tn[e])}}};Nn.prototype.defined=!0;function Pn(e,t,n){n&&(e[t]=n)}function Fn(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Nn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Cn(r)]=r,n[Cn(a.attribute)]=r}return new xn(t,n,e.space)}var In=Fn({properties:{ariaActiveDescendant:null,ariaAtomic:Dn,ariaAutoComplete:null,ariaBusy:Dn,ariaChecked:Dn,ariaColCount:B,ariaColIndex:B,ariaColSpan:B,ariaControls:V,ariaCurrent:null,ariaDescribedBy:V,ariaDetails:null,ariaDisabled:Dn,ariaDropEffect:V,ariaErrorMessage:null,ariaExpanded:Dn,ariaFlowTo:V,ariaGrabbed:Dn,ariaHasPopup:null,ariaHidden:Dn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:V,ariaLevel:B,ariaLive:null,ariaModal:Dn,ariaMultiLine:Dn,ariaMultiSelectable:Dn,ariaOrientation:null,ariaOwns:V,ariaPlaceholder:null,ariaPosInSet:B,ariaPressed:Dn,ariaReadOnly:Dn,ariaRelevant:null,ariaRequired:Dn,ariaRoleDescription:V,ariaRowCount:B,ariaRowIndex:B,ariaRowSpan:B,ariaSelected:Dn,ariaSetSize:B,ariaSort:null,ariaValueMax:B,ariaValueMin:B,ariaValueNow:B,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Ln(e,t){return t in e?e[t]:t}function Rn(e,t){return Ln(e,t.toLowerCase())}var zn=Fn({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:kn,acceptCharset:V,accessKey:V,action:null,allow:null,allowFullScreen:z,allowPaymentRequest:z,allowUserMedia:z,alpha:z,alt:null,as:null,async:z,autoCapitalize:null,autoComplete:V,autoFocus:z,autoPlay:z,blocking:V,capture:null,charSet:null,checked:z,cite:null,className:V,closedBy:null,colorSpace:null,cols:B,colSpan:B,command:null,commandFor:null,content:null,contentEditable:Dn,controls:z,controlsList:V,coords:B|kn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:z,defer:z,dir:null,dirName:null,disabled:z,download:On,draggable:Dn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:z,formTarget:null,headers:V,height:B,hidden:On,high:B,href:null,hrefLang:null,htmlFor:V,httpEquiv:V,id:null,imageSizes:null,imageSrcSet:null,inert:z,inputMode:null,integrity:null,is:null,isMap:z,itemId:null,itemProp:V,itemRef:V,itemScope:z,itemType:V,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:z,low:B,manifest:null,max:null,maxLength:B,media:null,method:null,min:null,minLength:B,multiple:z,muted:z,name:null,nonce:null,noModule:z,noValidate:z,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:z,optimum:B,pattern:null,ping:V,placeholder:null,playsInline:z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:z,referrerPolicy:null,rel:V,required:z,reversed:z,rows:B,rowSpan:B,sandbox:V,scope:null,scoped:z,seamless:z,selected:z,shadowRootClonable:z,shadowRootCustomElementRegistry:z,shadowRootDelegatesFocus:z,shadowRootMode:null,shadowRootSerializable:z,shape:null,size:B,sizes:null,slot:null,span:B,spellCheck:Dn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:B,step:null,style:null,tabIndex:B,target:null,title:null,translate:null,type:null,typeMustMatch:z,useMap:null,value:Dn,width:B,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:V,axis:null,background:null,bgColor:null,border:B,borderColor:null,bottomMargin:B,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:z,declare:z,event:null,face:null,frame:null,frameBorder:null,hSpace:B,leftMargin:B,link:null,longDesc:null,lowSrc:null,marginHeight:B,marginWidth:B,noResize:z,noHref:z,noShade:z,noWrap:z,object:null,profile:null,prompt:null,rev:null,rightMargin:B,rules:null,scheme:null,scrolling:Dn,standby:null,summary:null,text:null,topMargin:B,valueType:null,version:null,vAlign:null,vLink:null,vSpace:B,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:z,disablePictureInPicture:z,disableRemotePlayback:z,exportParts:kn,part:V,prefix:null,property:null,results:B,security:null,unselectable:null},space:`html`,transform:Rn}),Bn=Fn({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:An,accentHeight:B,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:B,amplitude:B,arabicForm:null,ascent:B,attributeName:null,attributeType:null,azimuth:B,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:B,by:null,calcMode:null,capHeight:B,className:V,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:B,diffuseConstant:B,direction:null,display:null,dur:null,divisor:B,dominantBaseline:null,download:z,dx:null,dy:null,edgeMode:null,editable:null,elevation:B,enableBackground:null,end:null,event:null,exponent:B,externalResourcesRequired:null,fill:null,fillOpacity:B,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:kn,g2:kn,glyphName:kn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:B,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:B,horizOriginX:B,horizOriginY:B,id:null,ideographic:B,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:B,k:B,k1:B,k2:B,k3:B,k4:B,kernelMatrix:An,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:B,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:B,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:B,overlineThickness:B,paintOrder:null,panose1:null,path:null,pathLength:B,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:V,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:B,pointsAtY:B,pointsAtZ:B,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:An,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:An,rev:An,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:An,requiredFeatures:An,requiredFonts:An,requiredFormats:An,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:B,specularExponent:B,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:B,strikethroughThickness:B,string:null,stroke:null,strokeDashArray:An,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:B,strokeOpacity:B,strokeWidth:null,style:null,surfaceScale:B,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:An,tabIndex:B,tableValues:null,target:null,targetX:B,targetY:B,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:An,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:B,underlineThickness:B,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:B,values:null,vAlphabetic:B,vMathematical:B,vectorEffect:null,vHanging:B,vIdeographic:B,version:null,vertAdvY:B,vertOriginX:B,vertOriginY:B,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:B,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Ln}),Vn=Fn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Hn=Fn({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Rn}),Un=Fn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Wn=/[A-Z]/g,Gn=/-[a-z]/g,Kn=/^data[-\w.:]+$/i;function qn(e,t){let n=Cn(t),r=t,i=wn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Kn.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Gn,Yn);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Gn.test(e)){let n=e.replace(Wn,Jn);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Nn}return new i(r,t)}function Jn(e){return`-`+e.toLowerCase()}function Yn(e){return e.charAt(1).toUpperCase()}var Xn=Sn([In,zn,Vn,Hn,Un],`html`),Zn=Sn([In,Bn,Vn,Hn,Un],`svg`),Qn={}.hasOwnProperty;function $n(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&Qn.call(t,e)){let n=String(t[e]);i=Qn.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var er=/["&'<>`]/g,tr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,nr=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,rr=/[|\\{}()[\]^$+*?.]/g,ir=new WeakMap;function ar(e,t){if(e=e.replace(t.subset?or(t.subset):er,r),t.subset||t.escapeOnly)return e;return e.replace(tr,n).replace(nr,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function or(e){let t=ir.get(e);return t||(t=sr(e),ir.set(e,t)),t}function sr(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(rr,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var cr=/[\dA-Fa-f]/;function lr(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!cr.test(String.fromCharCode(t))?r:r+`;`}var ur=/\d/;function dr(e,t,n){let r=`&#`+String(e);return n&&t&&!ur.test(String.fromCharCode(t))?r:r+`;`}var fr=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),pr={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},mr=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],hr={}.hasOwnProperty,gr={},_r;for(_r in pr)hr.call(pr,_r)&&(gr[pr[_r]]=_r);var vr=/[^\dA-Za-z]/;function yr(e,t,n,r){let i=String.fromCharCode(e);if(hr.call(gr,i)){let e=gr[i],a=`&`+e;return n&&fr.includes(e)&&!mr.includes(e)&&(!r||t&&t!==61&&vr.test(String.fromCharCode(t)))?a:a+`;`}return``}function br(e,t,n){let r=lr(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=yr(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=dr(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function xr(e,t){return ar(e,Object.assign({format:br},t))}var Sr=/^>|^->|<!--|-->|--!>|<!-$/g,Cr=[`>`],wr=[`<`,`>`];function Tr(e,t,n,r){return r.settings.bogusComments?`<?`+xr(e.value,Object.assign({},r.settings.characterReferences,{subset:Cr}))+`>`:`<!--`+e.value.replace(Sr,i)+`-->`;function i(e){return xr(e,Object.assign({},r.settings.characterReferences,{subset:wr}))}}function Er(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function Dr(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Or(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function kr(e){return e.join(` `).trim()}var Ar=/[ \t\n\f\r]/g;function jr(e){return typeof e==`object`?e.type===`text`&&Mr(e.value):Mr(e)}function Mr(e){return e.replace(Ar,``)===``}var Nr=Ir(1),Pr=Ir(-1),Fr=[];function Ir(e){return t;function t(t,n,r){let i=t?t.children:Fr,a=(n||0)+e,o=i[a];if(!r)for(;o&&jr(o);)a+=e,o=i[a];return o}}var Lr={}.hasOwnProperty;function Rr(e){return t;function t(t,n,r){return Lr.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var zr=Rr({body:Hr,caption:Br,colgroup:Br,dd:Kr,dt:Gr,head:Br,html:Vr,li:Wr,optgroup:Jr,option:Yr,p:Ur,rp:qr,rt:qr,tbody:Zr,td:ei,tfoot:Qr,th:ei,thead:Xr,tr:$r});function Br(e,t,n){let r=Nr(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&jr(r.value.charAt(0)))}function Vr(e,t,n){let r=Nr(n,t);return!r||r.type!==`comment`}function Hr(e,t,n){let r=Nr(n,t);return!r||r.type!==`comment`}function Ur(e,t,n){let r=Nr(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function Wr(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&r.tagName===`li`}function Gr(e,t,n){let r=Nr(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function Kr(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function qr(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Jr(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function Yr(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function Xr(e,t,n){let r=Nr(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function Zr(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Qr(e,t,n){return!Nr(n,t)}function $r(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function ei(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var ti=Rr({body:ii,colgroup:ai,head:ri,html:ni,tbody:oi});function ni(e){let t=Nr(e,-1);return!t||t.type!==`comment`}function ri(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function ii(e){let t=Nr(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&jr(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function ai(e,t,n){let r=Pr(n,t),i=Nr(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&zr(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function oi(e,t,n){let r=Pr(n,t),i=Nr(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&zr(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var si={name:[[`
2
+ import{n as e,r as t,t as n}from"./_hePW80VL.js";import{B as r,E as i,F as a,I as o,L as s,M as c,N as l,P as u,R as d,T as f,U as p,V as m,W as h,_ as g,a as _,b as v,c as y,d as b,f as x,i as S,j as C,k as w,l as T,n as E,r as D,t as O,u as k,v as A,y as j,z as M}from"./_tmN7XIcz.js";import{$ as ee,A as N,B as te,Bt as ne,C as re,Ct as ie,D as ae,E as oe,Et as se,F as ce,H as le,Ht as ue,I as de,J as fe,Jt as pe,L as me,M as he,N as ge,Nt as _e,O as ve,P as ye,Pt as be,Q as xe,R as Se,Rt as Ce,S as we,T as Te,Tt as Ee,U as De,Ut as P,V as Oe,Vt as ke,X as Ae,Xt as je,Yt as Me,Z as Ne,Zt as Pe,_ as Fe,a as Ie,at as Le,b as Re,c as ze,cn as Be,ct as Ve,dt as He,et as Ue,ft as We,g as Ge,gt as Ke,h as qe,ht as Je,i as Ye,it as Xe,j as Ze,jt as Qe,k as $e,lt as et,m as tt,mt as nt,n as rt,nt as it,o as at,ot,p as st,pt as ct,q as lt,qt as F,r as I,rt as ut,s as dt,st as ft,t as pt,tt as mt,u as ht,un as gt,ut as _t,v as vt,w as yt,x as bt,y as xt,yt as St,z as Ct,zt as wt}from"./_BUlKyuxt.js";var Tt=`diffs-container`,Et=(()=>{try{return!1}catch{return!1}})(),Dt=/(?=^From [a-f0-9]+ .+$)/m,Ot=/(?=^diff --git)/gm,kt=/(?<=\n)/,At=/^(---|\+\+\+)\s+([^\t\r\n]+)/,jt=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Mt=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Nt=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Pt=`header-prefix`,Ft=`header-filename-suffix`,It=`header-metadata`,Lt=`header-custom`,L={dark:`pierre-dark`,light:`pierre-light`},Rt=`data-theme-css`,zt=`data-unsafe-css`,Bt=`data-diffs-scrollbar-measure`,Vt=`data-diffs-code-view-header`,Ht=`data-diffs-code-view-footer`,Ut=`--diffs-scrollbar-gutter-measured`,Wt=1e5,Gt={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Kt={...Gt,hunkLineCount:1},qt={paddingTop:8,paddingBottom:8,gap:8},Jt={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},Yt=Object.freeze({fromStart:0,fromEnd:0}),Xt={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Zt={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Qt=new Set,$t=null;function en(e){Qt.add(e),$t??=requestAnimationFrame(nn)}function tn(e){Qt.delete(e)&&Qt.size===0&&$t!=null&&(cancelAnimationFrame($t),$t=null)}function nn(e){let t=new Set(Qt);Qt.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}$t=Qt.size>0?requestAnimationFrame(nn):null}function rn(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function an(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function on(e,t){let n=e?.theme??L,r=t?.theme??L,i=sn(e),a=sn(t);return an(n,r)&&rn(e,t,[`theme`,`parseDiffOptions`])&&rn(i,a)}function sn(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function cn(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function ln({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:a}){let o=n+a*2,s=r?n+i*2:o;if(t=Math.max(t,s),o>=t||r){let n=Math.max(e-i,0),r=Math.min(e+s,t);return{top:n,bottom:Math.max(r,n)}}let c=e+n/2-o/2,l=c+o;return c<0&&(c=0),l>t&&(l=t),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(l,t),c))}}function un(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function dn(e){return{type:`text`,value:e}}function R({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function fn({name:e,width:t=16,height:n=16,properties:r}){return R({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[R({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function pn(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function mn(e){return R({tagName:`div`,properties:{"data-gutter":``},children:e})}function hn(e,t,n,r={}){return R({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[R({tagName:`span`,properties:{"data-line-number-content":``},children:[dn(`${t}`)]})]})}function gn(e,t,n){return R({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function _n(){return R({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[fn({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function vn(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function yn(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var bn=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],xn=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};xn.prototype.normal={},xn.prototype.property={},xn.prototype.space=void 0;function Sn(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new xn(n,r,t)}function Cn(e){return e.toLowerCase()}var wn=class{constructor(e,t){this.attribute=t,this.property=e}};wn.prototype.attribute=``,wn.prototype.booleanish=!1,wn.prototype.boolean=!1,wn.prototype.commaOrSpaceSeparated=!1,wn.prototype.commaSeparated=!1,wn.prototype.defined=!1,wn.prototype.mustUseProperty=!1,wn.prototype.number=!1,wn.prototype.overloadedBoolean=!1,wn.prototype.property=``,wn.prototype.spaceSeparated=!1,wn.prototype.space=void 0;var Tn=e({boolean:()=>z,booleanish:()=>Dn,commaOrSpaceSeparated:()=>An,commaSeparated:()=>kn,number:()=>B,overloadedBoolean:()=>On,spaceSeparated:()=>V}),En=0,z=jn(),Dn=jn(),On=jn(),B=jn(),V=jn(),kn=jn(),An=jn();function jn(){return 2**++En}var Mn=Object.keys(Tn),Nn=class extends wn{constructor(e,t,n,r){let i=-1;if(super(e,t),Pn(this,`space`,r),typeof n==`number`)for(;++i<Mn.length;){let e=Mn[i];Pn(this,Mn[i],(n&Tn[e])===Tn[e])}}};Nn.prototype.defined=!0;function Pn(e,t,n){n&&(e[t]=n)}function Fn(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Nn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Cn(r)]=r,n[Cn(a.attribute)]=r}return new xn(t,n,e.space)}var In=Fn({properties:{ariaActiveDescendant:null,ariaAtomic:Dn,ariaAutoComplete:null,ariaBusy:Dn,ariaChecked:Dn,ariaColCount:B,ariaColIndex:B,ariaColSpan:B,ariaControls:V,ariaCurrent:null,ariaDescribedBy:V,ariaDetails:null,ariaDisabled:Dn,ariaDropEffect:V,ariaErrorMessage:null,ariaExpanded:Dn,ariaFlowTo:V,ariaGrabbed:Dn,ariaHasPopup:null,ariaHidden:Dn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:V,ariaLevel:B,ariaLive:null,ariaModal:Dn,ariaMultiLine:Dn,ariaMultiSelectable:Dn,ariaOrientation:null,ariaOwns:V,ariaPlaceholder:null,ariaPosInSet:B,ariaPressed:Dn,ariaReadOnly:Dn,ariaRelevant:null,ariaRequired:Dn,ariaRoleDescription:V,ariaRowCount:B,ariaRowIndex:B,ariaRowSpan:B,ariaSelected:Dn,ariaSetSize:B,ariaSort:null,ariaValueMax:B,ariaValueMin:B,ariaValueNow:B,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Ln(e,t){return t in e?e[t]:t}function Rn(e,t){return Ln(e,t.toLowerCase())}var zn=Fn({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:kn,acceptCharset:V,accessKey:V,action:null,allow:null,allowFullScreen:z,allowPaymentRequest:z,allowUserMedia:z,alpha:z,alt:null,as:null,async:z,autoCapitalize:null,autoComplete:V,autoFocus:z,autoPlay:z,blocking:V,capture:null,charSet:null,checked:z,cite:null,className:V,closedBy:null,colorSpace:null,cols:B,colSpan:B,command:null,commandFor:null,content:null,contentEditable:Dn,controls:z,controlsList:V,coords:B|kn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:z,defer:z,dir:null,dirName:null,disabled:z,download:On,draggable:Dn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:z,formTarget:null,headers:V,height:B,hidden:On,high:B,href:null,hrefLang:null,htmlFor:V,httpEquiv:V,id:null,imageSizes:null,imageSrcSet:null,inert:z,inputMode:null,integrity:null,is:null,isMap:z,itemId:null,itemProp:V,itemRef:V,itemScope:z,itemType:V,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:z,low:B,manifest:null,max:null,maxLength:B,media:null,method:null,min:null,minLength:B,multiple:z,muted:z,name:null,nonce:null,noModule:z,noValidate:z,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:z,optimum:B,pattern:null,ping:V,placeholder:null,playsInline:z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:z,referrerPolicy:null,rel:V,required:z,reversed:z,rows:B,rowSpan:B,sandbox:V,scope:null,scoped:z,seamless:z,selected:z,shadowRootClonable:z,shadowRootCustomElementRegistry:z,shadowRootDelegatesFocus:z,shadowRootMode:null,shadowRootSerializable:z,shape:null,size:B,sizes:null,slot:null,span:B,spellCheck:Dn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:B,step:null,style:null,tabIndex:B,target:null,title:null,translate:null,type:null,typeMustMatch:z,useMap:null,value:Dn,width:B,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:V,axis:null,background:null,bgColor:null,border:B,borderColor:null,bottomMargin:B,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:z,declare:z,event:null,face:null,frame:null,frameBorder:null,hSpace:B,leftMargin:B,link:null,longDesc:null,lowSrc:null,marginHeight:B,marginWidth:B,noResize:z,noHref:z,noShade:z,noWrap:z,object:null,profile:null,prompt:null,rev:null,rightMargin:B,rules:null,scheme:null,scrolling:Dn,standby:null,summary:null,text:null,topMargin:B,valueType:null,version:null,vAlign:null,vLink:null,vSpace:B,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:z,disablePictureInPicture:z,disableRemotePlayback:z,exportParts:kn,part:V,prefix:null,property:null,results:B,security:null,unselectable:null},space:`html`,transform:Rn}),Bn=Fn({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:An,accentHeight:B,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:B,amplitude:B,arabicForm:null,ascent:B,attributeName:null,attributeType:null,azimuth:B,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:B,by:null,calcMode:null,capHeight:B,className:V,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:B,diffuseConstant:B,direction:null,display:null,dur:null,divisor:B,dominantBaseline:null,download:z,dx:null,dy:null,edgeMode:null,editable:null,elevation:B,enableBackground:null,end:null,event:null,exponent:B,externalResourcesRequired:null,fill:null,fillOpacity:B,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:kn,g2:kn,glyphName:kn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:B,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:B,horizOriginX:B,horizOriginY:B,id:null,ideographic:B,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:B,k:B,k1:B,k2:B,k3:B,k4:B,kernelMatrix:An,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:B,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:B,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:B,overlineThickness:B,paintOrder:null,panose1:null,path:null,pathLength:B,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:V,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:B,pointsAtY:B,pointsAtZ:B,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:An,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:An,rev:An,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:An,requiredFeatures:An,requiredFonts:An,requiredFormats:An,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:B,specularExponent:B,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:B,strikethroughThickness:B,string:null,stroke:null,strokeDashArray:An,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:B,strokeOpacity:B,strokeWidth:null,style:null,surfaceScale:B,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:An,tabIndex:B,tableValues:null,target:null,targetX:B,targetY:B,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:An,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:B,underlineThickness:B,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:B,values:null,vAlphabetic:B,vMathematical:B,vectorEffect:null,vHanging:B,vIdeographic:B,version:null,vertAdvY:B,vertOriginX:B,vertOriginY:B,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:B,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Ln}),Vn=Fn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Hn=Fn({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Rn}),Un=Fn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Wn=/[A-Z]/g,Gn=/-[a-z]/g,Kn=/^data[-\w.:]+$/i;function qn(e,t){let n=Cn(t),r=t,i=wn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Kn.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Gn,Yn);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Gn.test(e)){let n=e.replace(Wn,Jn);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Nn}return new i(r,t)}function Jn(e){return`-`+e.toLowerCase()}function Yn(e){return e.charAt(1).toUpperCase()}var Xn=Sn([In,zn,Vn,Hn,Un],`html`),Zn=Sn([In,Bn,Vn,Hn,Un],`svg`),Qn={}.hasOwnProperty;function $n(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&Qn.call(t,e)){let n=String(t[e]);i=Qn.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var er=/["&'<>`]/g,tr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,nr=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,rr=/[|\\{}()[\]^$+*?.]/g,ir=new WeakMap;function ar(e,t){if(e=e.replace(t.subset?or(t.subset):er,r),t.subset||t.escapeOnly)return e;return e.replace(tr,n).replace(nr,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function or(e){let t=ir.get(e);return t||(t=sr(e),ir.set(e,t)),t}function sr(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(rr,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var cr=/[\dA-Fa-f]/;function lr(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!cr.test(String.fromCharCode(t))?r:r+`;`}var ur=/\d/;function dr(e,t,n){let r=`&#`+String(e);return n&&t&&!ur.test(String.fromCharCode(t))?r:r+`;`}var fr=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),pr={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},mr=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],hr={}.hasOwnProperty,gr={},_r;for(_r in pr)hr.call(pr,_r)&&(gr[pr[_r]]=_r);var vr=/[^\dA-Za-z]/;function yr(e,t,n,r){let i=String.fromCharCode(e);if(hr.call(gr,i)){let e=gr[i],a=`&`+e;return n&&fr.includes(e)&&!mr.includes(e)&&(!r||t&&t!==61&&vr.test(String.fromCharCode(t)))?a:a+`;`}return``}function br(e,t,n){let r=lr(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=yr(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=dr(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function xr(e,t){return ar(e,Object.assign({format:br},t))}var Sr=/^>|^->|<!--|-->|--!>|<!-$/g,Cr=[`>`],wr=[`<`,`>`];function Tr(e,t,n,r){return r.settings.bogusComments?`<?`+xr(e.value,Object.assign({},r.settings.characterReferences,{subset:Cr}))+`>`:`<!--`+e.value.replace(Sr,i)+`-->`;function i(e){return xr(e,Object.assign({},r.settings.characterReferences,{subset:wr}))}}function Er(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function Dr(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Or(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function kr(e){return e.join(` `).trim()}var Ar=/[ \t\n\f\r]/g;function jr(e){return typeof e==`object`?e.type===`text`&&Mr(e.value):Mr(e)}function Mr(e){return e.replace(Ar,``)===``}var Nr=Ir(1),Pr=Ir(-1),Fr=[];function Ir(e){return t;function t(t,n,r){let i=t?t.children:Fr,a=(n||0)+e,o=i[a];if(!r)for(;o&&jr(o);)a+=e,o=i[a];return o}}var Lr={}.hasOwnProperty;function Rr(e){return t;function t(t,n,r){return Lr.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var zr=Rr({body:Hr,caption:Br,colgroup:Br,dd:Kr,dt:Gr,head:Br,html:Vr,li:Wr,optgroup:Jr,option:Yr,p:Ur,rp:qr,rt:qr,tbody:Zr,td:ei,tfoot:Qr,th:ei,thead:Xr,tr:$r});function Br(e,t,n){let r=Nr(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&jr(r.value.charAt(0)))}function Vr(e,t,n){let r=Nr(n,t);return!r||r.type!==`comment`}function Hr(e,t,n){let r=Nr(n,t);return!r||r.type!==`comment`}function Ur(e,t,n){let r=Nr(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function Wr(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&r.tagName===`li`}function Gr(e,t,n){let r=Nr(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function Kr(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function qr(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Jr(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function Yr(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function Xr(e,t,n){let r=Nr(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function Zr(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Qr(e,t,n){return!Nr(n,t)}function $r(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function ei(e,t,n){let r=Nr(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var ti=Rr({body:ii,colgroup:ai,head:ri,html:ni,tbody:oi});function ni(e){let t=Nr(e,-1);return!t||t.type!==`comment`}function ri(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function ii(e){let t=Nr(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&jr(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function ai(e,t,n){let r=Pr(n,t),i=Nr(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&zr(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function oi(e,t,n){let r=Pr(n,t),i=Nr(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&zr(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var si={name:[[`
3
3
  \f\r &/=>`.split(``),`
4
4
  \f\r "&'/=>\``.split(``)],[`\0
5
5
  \f\r "&'/<=>`.split(``),`\0
@@ -1525,10 +1525,10 @@ diff --git`)}function Qg(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
1525
1525
  `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var P_=`/dev/null`;function F_(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??I_(),a=t??I_(),o=Pg(M_(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey,r=t?.cacheKey;return n!=null&&r!=null?og(`diff`,n,r):void 0})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function I_(){return{name:P_,contents:``}}var L_=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener(`scroll`,this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function R_(e,t){return an(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function z_(e){return R({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function B_(e){return R({tagName:`div`,children:[R({tagName:`span`,children:[dn(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function V_(e){return R({tagName:`div`,children:[fn({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function H_({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(R({tagName:`div`,children:[dn(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(V_(`up`)),s++),o||(e.push(V_(`down`)),s++)):(e.push(V_(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(R({tagName:`div`,children:[R({tagName:`span`,children:[dn(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(R({tagName:`div`,children:[dn(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(R({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(R({tagName:`slot`,properties:{name:i}})),R({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function U_(e,t){return`hunk-separator-${e}-${t}`}function W_(e){let t=e.at(-1);return t==null?0:Math.max(ig(t.additionStart,t.additionCount),ig(t.deletionStart,t.deletionCount))}function G_({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function K_({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}function q_(e){return[rg(e.additionStart,e.additionCount)+1,ig(e.additionStart,e.additionCount)+1]}function J_({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function Y_(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-ig(t.additionStart,t.additionCount),r=e.deletionLines.length-ig(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function X_({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-ig(n.additionStart,n.additionCount),i=e.deletionLines.length-ig(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function Z_({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=X_({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function Q_({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=q_(a);if(t<o){let s=J_({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=Z_({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=q_(a);return t<o+i.fromStart||t>=o+i.rangeSize}function $_({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=q_(n),l=J_({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=Z_({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function ev({type:e,metrics:t}){return t.hunkSeparatorHeight??qh(e)}function tv({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function nv({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function rv(e){return e!==`simple`&&e!==`metadata`}function iv({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!nv({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=ev({type:e,metrics:t}),a=tv({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function av({type:e,metrics:t}){if(!rv(e))return;let n=ev({type:e,metrics:t}),r=tv({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function ov({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=sv({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=rg(r.deletionStart,r.deletionCount),s=rg(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=J_({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?Z_({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(uv(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,uv(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(uv(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=dv(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(fv({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(uv(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function sv({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=cv({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function cv({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=J_({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?Z_({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function lv(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function uv(e,t,n,r,i,a){let[o,s]=lv(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function dv(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function fv({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}var pv={forcePlainText:!1};function mv(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=pv){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=Am({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??gv();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}ov({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&hv({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=_v({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else zm(f.deletionLines,s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else zm(f.additionLines,c)}return{code:f,themeStyles:u,baseThemeType:l}}function hv({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=_g(e),t=_g(t),e.length>s||t.length>s))return;let c=o===`char`?o_(e,t):C_(e,t),l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(K_({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),K_({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?K_({item:e,arr:l,enableJoin:d,isLastItem:t}):K_({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(G_({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(G_({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function gv(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function _v({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c,...l}}){let u=s??$p(e.name),d=s??$p(t.name),{state:f,transformers:p}=mm(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:_m(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:_m(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,Mm(i.codeToHast(_g(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,Mm(i.codeToHast(_g(t.contents),m)))}}function vv(e,t){let n=F_({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function yv(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function bv(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function xv(e,t){return t.length>0&&t.length<e.deletionLines.length&&bv(t)}function Sv(e,t,n){let r=e.deletionLines.join(``),i=yv(t.length,r),a=F_({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function Cv(e,t){return Sv(e,[``],t)}function wv(e,t){if(e.additionLines.length===0)return Cv(e,t);if(xv(e,e.additionLines))return Sv(e,e.additionLines,t);let n=e.additionLines,r=vv(e,t);return Ev(r,n),r}function Tv(e){return e.length>1&&e.at(-1)===``}function Ev(e,t){if(!Tv(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&ig(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,Iv(e);return}}}function Dv(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return Ov(e,vv(e,n));let r=Array.from(t);if(r.length===0)return Ov(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||_g(r)===_g(i))return Ov(e,vv(e,n))}let i=kv(e,r);if(i.size===0)return Ov(e,vv(e,n));for(let t of i)if(!jv(e,t,n))return Ov(e,vv(e,n));return Iv(e),Y_(e)?Ov(e,vv(e,n)):Ov(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function Ov(e,t){return Object.assign(e,t),t}function kv(e,t){let n=new Set;for(let r of t){let t=Av(e,r);if(t==null)return new Set;n.add(t)}return n}function Av(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function jv(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=F_({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(Nv(r,s),Mv(e,t),!0)}function Mv(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
1526
1526
  `),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
1527
1527
  `)}function Nv(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>Pv(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,Fv(e)}function Pv(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function Fv(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function Iv(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(rg(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,Fv(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=ig(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-ig(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var Lv=new WeakMap;function Rv(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function zv(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function Bv(e,t){let n=e.hunks,r=e.additionLines,i=Rv(r),a=i===r?e:{...e,additionLines:i},o=Xv(n,Yv(a,t),e.deletionLines.length),s=$v(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,ly(e),Ev(e,r),ny(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function Vv(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<ay(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:ay(r);if(i==null||t<i||o!=null&&o!==s)return Bv(e,n);o=s}if(o!=null){if(Hv(e,i,o,r,n)){e.editSessionDirty=!0;return}return Bv(e,n)}}function Hv(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=Uv(e),o=e.hunks[n];if(o.hunkContent.some(Wv))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function Uv(e){let t=Lv.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return Lv.set(e,{lines:e.deletionLines,set:n}),n}function Wv(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function Gv(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function Kv(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=J_({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=oy(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=Z_({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=oy(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function qv(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=oy(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,oy(i)+i.deletionCount,e.deletionLines.length),n}function Jv(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?vv(e,t):wv(e,t)),!0)}function Yv(e,t){if(zv(e.deletionLines,e.additionLines)==null)return[];let n=F_({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=Pv(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function Xv(e,t,n){let r=e.map((e,t)=>{let n=oy(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&Zv(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=Qv(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function Zv(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function Qv(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function $v(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);ty(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);ty(s,c,i,r),r+=c,i+=c,n.push(ey(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function ey(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:sy(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:cy(t.additionStart,r),deletionStart:sy(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:cy(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${sy(t.deletionStart,i)},${i} +${sy(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return Fv(s),s}function ty(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function ny(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(oy(r)!==oy(i)||r.deletionCount!==i.deletionCount||ay(r)!==ay(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!ry(r,i))return!0}return!1}function ry(e,t){let n=iy(e),r=iy(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*iy(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function ay(e){return rg(e.additionStart,e.additionCount)}function oy(e){return rg(e.deletionStart,e.deletionCount)}function sy(e,t){return t===0?e:e+1}function cy(e,t){return t===0?e-1:e}function ly(e){Iv(e);for(let t=0;t<e.hunks.length;t++)Mv(e,t)}function uy(e){let t=e.lang??$p(e.name),n=e.lang??(e.prevName==null?`text`:$p(e.prevName));return t===`text`&&n===`text`}var dy=-1,fy=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++dy}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:L},t=rm,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=zp(e.theme??L)?Ip():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),e!=null&&(this.diff=e);let i=e??this.diffCache;if(i!=null&&!i.isPartial&&i.additionLines.length===0){Object.assign(i,Cv(i,this.options.parseDiffOptions)),this.markEditSessionPass(i),this.clearRenderCache();return}if(e==null||r==null||n&&r.diff===e)return;let{options:a}=this.getRenderOptions(e),o=r.diff===e,s=t!=null&&W(r.diff,t),{result:c}=r;if(!r.highlighted||c==null||!R_(r.options,a)||!o&&!s){this.clearRenderCache();return}o||(this.renderCache={diff:e,options:a,highlighted:!0,result:{...c,code:{...c.code,additionLines:[...c.code.additionLines]}},renderRange:r.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{diff:e,renderCache:t,workerManager:n}=this;return e==null||t==null||!W(t.diff,e)||uy(e)||wy(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&n?.isWorkingPool()===!0&&e.cacheKey!=null?(n.evictDiffFromCache(e.cacheKey),n.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,n.getDiffResultCache(e))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(e).then(t=>this.applyRefreshedResult(e,t)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){let{diff:n,renderCache:r}=this;if(t==null||n==null||r==null||!W(n,e)||!W(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);R_(i,t.options)&&(this.pendingHighlightResult={diff:n,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??Yt}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return!1;let{result:i,diff:a}=r;if(i==null)return!1;if(a.isPartial)throw Error(`Could not update render cache for partial diff`);let o=i.code.additionLines,s=this.pendingStructuralRows=n?new Map:void 0,c=[],l=new Map;for(let[t,n]of e){let e=o[t]?.properties??{},r=n.map(e=>e[2]).join(``),i=t<a.additionLines.length,u=i?a.additionLines[t]??``:``,d=_g(u);s==null&&i&&(a.additionLines[t]=Ym(u,r),d!==r&&(c.push(t),l.set(t,u)));let f={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};s==null?o[t]=f:s.set(t,f)}let u=!1;if(c.length>0){if(this.editSessionActive){if(a.additionLines.length<=1&&a.additionLines.join(``)===``)this.applyRecomputePreservingSessionType(a,Cv(a,this.options.parseDiffOptions)),u=!0;else if(xv(a,a.additionLines))this.applyRecomputePreservingSessionType(a,Sv(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=Vv(a,c,this.options.parseDiffOptions,l);this.applyExpansionRemap(e),u=e!=null}}else Object.assign(a,Dv(a,c,this.options.parseDiffOptions))}return i.baseThemeType=t,r.isDirty=!0,u}applyExpansionRemap(e){e!=null&&(this.expandedHunks=Gv(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{diff:r,result:i}=n;if(i==null)return;if(r.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:a}=r;if(r.additionLines=Cy(e),i.code.additionLines=xy(a,r.additionLines,i.code.additionLines,e),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,Cv(r,this.options.parseDiffOptions)),i.code.additionLines[0]=Sy(0,e.getLineText(0))):this.editSessionActive?this.applySessionDocumentChange(r):Object.assign(r,wv(r,this.options.parseDiffOptions)),t!=null)for(let[e,n]of t)e<i.code.additionLines.length&&(i.code.additionLines[e]=n);n.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(xv(e,n)){this.applyRecomputePreservingSessionType(e,Sv(e,n,t));return}this.applyExpansionRemap(Bv(e,t))}applyRecomputePreservingSessionType(e,t){let n=this.editSessionActive?e.type:void 0;Object.assign(e,t),n!=null&&(e.type=n),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>Up(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=L,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=Wt,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await Fp(nm(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=wy(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!R_(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!uy(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??$p(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??L}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!W(e,n.diff)||!R_(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(W(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||uy(e)||wy(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||W(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&zp(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&zp(t.theme)}renderDiff(e=this.diff,t=Xt){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getReadyRenderResult(e,i);this.pendingHighlightResult=void 0,o!=null&&(this.renderCache={...o,diff:e,renderRange:void 0},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||uy(e)||wy(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!W(e,this.renderCache.diff),d=!Hp(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&im(t);l&&!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(u||d))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||u||d||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,im(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??$p(e.name);let t=this.highlighter!=null&&zp(i.theme),n=this.highlighter!=null&&ra(this.computedLang),r=!c&&n;if(l&&this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=Xt){this.diff=e;let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return Jp({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=wy(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??$p(e.name);let n=this.highlighter!=null&&zp(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&ra(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=mv(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(ov({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=Sy(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{diff:i,renderCache:a}=this;i==null||a==null||!W(i,e)||!R_(n,this.getRenderOptions(i).options)||(a.result==null||!a.highlighted||!R_(a.options,n)||!W(a.diff,i))&&(this.pendingHighlightResult={diff:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.())}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!R_(t,n.options)))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&W(n.diff,e)&&R_(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&W(e,n.diff)&&R_(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1,f=a===`unified`,p=Ty(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:mn(),deletionsGutterAST:mn(),additionsGutterAST:mn(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=X_({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,gn(void 0,`buffer`,this.size)),h?.push(z_(this.size))):(x.pushToGutter(`deletions`,gn(void 0,`buffer`,this.size)),g?.push(z_(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,hn(t,n,r,i))};function T(e){C.flush(),a===`unified`?vy(`unified`,e,x):(vy(`deletions`,e,x),vy(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),ov({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&hy(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=yy(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=yy(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),_y({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&hy(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&gy(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=yy(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=yy(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}_y({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&gy(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,D=_?n.noEOFCRAdditions:!1,O=(s?.noEOFCR??!1)||E,k=(o?.noEOFCR??!1)||D;if(k||O){if(a===`split`&&C.flush(),O){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(B_(e)),x.pushToGutter(`unified`,gn(e,`metadata`,1))):(x.deletionsContentAST.push(B_(e)),x.pushToGutter(`deletions`,gn(e,`metadata`,1)),k||(x.pushToGutter(`additions`,gn(void 0,`buffer`,1)),x.additionsContentAST.push(z_(1))))}if(k){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(B_(e)),x.pushToGutter(`unified`,gn(e,`metadata`,1))):(x.additionsContentAST.push(B_(e)),x.pushToGutter(`additions`,gn(e,`metadata`,1)),O||(x.pushToGutter(`deletions`,gn(void 0,`buffer`,1)),x.deletionsContentAST.push(z_(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max(W_(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),D=t.bufferBefore>0||t.bufferAfter>0,O=!f&&e.type!==`deleted`,k=!f&&e.type!==`new`,A=x.rowCount>0||D;h=O&&A?h:void 0,g=k&&A?g:void 0,_=f&&A?_:void 0;let j=this.createPreElement(g!=null&&h!=null,E);return{fileDiff:e,unifiedGutterAST:f&&A?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:k&&A?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:O&&A?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:j,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(e),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=mn(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,Xm(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(R({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(R({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(R({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return xi(this.renderFullAST(e,t))}renderPartialHTML(e,t){return xi(t==null?e:R({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!Jm(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(qm(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(qm(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){_y({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}_y({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(this.annotationSlotName(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(this.annotationSlotName(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}getAnnotationNames(e){return e?.map(e=>this.annotationSlotName(e))??[]}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return Gp({fileOrDiff:e,mode:t,stickyHeader:n})}},py=new Intl.PluralRules(`en-US`);function my(e){return`${e} unmodified line${py.select(e)===`one`?``:`s`}`}function hy(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function gy(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function _y({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,gn(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,gn(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,gn(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function vy(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,H_({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(H_({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,H_({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(H_({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=U_(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?my(n):`More unchanged context may be available`;c.pushToGutter(e,H_({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(H_({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function yy(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function by(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function xy(e,t,n,r){let i=by(e),a=by(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let e=s;e<t.length;e++)l[e]??=Sy(e,r.getLineText(e));return l}function Sy(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function Cy(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function wy(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Ty(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Ey(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Dy(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function Oy(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function ky({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function Ay(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:kh(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function jy(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function My(e){let t={...e};return delete t.cacheKey,t}function Ny(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??$p(e.name),r=t.lang??$p(t.name),i=e.type!==`new`,a=t.type!==`new`;return e.name!==t.name||n!==r||i!==a||e.deletionLines.length!==t.deletionLines.length||e.deletionLines.some((e,n)=>e!==t.deletionLines[n])}function Py(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Fy(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&Py(n.lines,t.deletionLines)}var Iy=-1,Ly=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++Iy}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;editSessionDiff;editSessionAnnotations;outgoingSessionDiff;renderedDiff;renderRange;pendingFiles;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0};lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:L},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Gi,this.scrollSyncManager=new L_,this.interactionManager=new wi(`diff`,Ti(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return Ay(e)}createHunksRenderer(e){return new fy(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,n){if(e==null)return;let r=e.hunks.at(-1),i,a;hunkIterator:for(let o of e.hunks){let e=n===`deletions`?o.deletionStart:o.additionStart,s=n===`deletions`?o.deletionCount:o.additionCount,c=rg(e,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(t<c){let e=c-t;i=Math.max(u-e,0),a=Math.max(l-e,0);break hunkIterator}if(t>=c+s){if(o===r){let e=t-(c+s);i=u+o.unifiedLineCount+e,a=l+o.splitLineCount+e;break hunkIterator}continue}for(let e of o.hunkContent)if(e.type===`context`){if(t<c+e.lines){let e=t-c;a=l+e,i=u+e;break hunkIterator}c+=e.lines,l+=e.lines,u+=e.lines}else{let r=n===`deletions`?e.deletions:e.additions;if(t<c+r){let r=t-c;i=u+(n===`additions`?e.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(e.deletions,e.additions),u+=e.deletions+e.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]}setOptions(e){e!=null&&(this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Ti(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!an(this.appliedThemeCSS.theme,this.options.theme??L)}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>Oh(this.editSessionAnnotations,e,rm);getLatestAnnotations(){return this.editSessionAnnotations?.current??this.lineAnnotations}isNewAnnotations(e){let{editSessionAnnotations:t,lineAnnotations:n}=this;return e===n?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let{editSessionAnnotations:t}=this;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,Dh(t,e,rm))}syncEditSessionAnnotationsFromEditor(e){let{editSessionAnnotations:t}=this;return t==null||e===t.current?!1:(t.current=e,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){let{editor:t}=this;tn(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,e||(this.pendingFiles=void 0),this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSessionDiff=void 0,this.editSessionAnnotations=void 0,this.outgoingSessionDiff=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=ky(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||Hy(this.pre,By({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||Uy(this.headerElement,Vy({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,forceRender:l||a.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Ch(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?F_(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||t==null||!jy(e)||this.pendingFiles?.fileDiff===e)return;let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}}async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(cg(`merge`,e,t),this.setHydratedState(t),this.startHydratedEditSession(e)){this.rerender();return}await Oy(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender()}}startHydratedEditSession(e){if(e.isPartial)throw Error(`FileDiff.startHydratedEditSession: diffs cannot be partial for editing`);if(this.fileDiff!==e)return!1;let{editor:t}=this;return this.outgoingSessionDiff==null?t==null||this.editSessionDiff!=null?!1:(this.installEditSession(e,t.__getDocumentContents(Ry(e)),t.__getDocumentSessionState()),!0):(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(W(this.fileDiff,e))return!1;let n=this.outgoingSessionDiff??this.editSessionDiff;return this.fileDiff=e,this.outgoingSessionDiff=void 0,n==null?this.editor!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e,this.editor.__getDocumentContents(Ry(e)),this.editor.__getDocumentSessionState())):(this.outgoingSessionDiff=n,e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e)),this.editSessionAnnotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSessionAnnotations=Eh(t,rm,this.editSessionAnnotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:sg(t.contents),a=n!=null&&Fy(n,e);if(n!=null&&!a)throw Error(`FileDiff: retained session cannot resume against a different old file`);if(t!=null&&t.contents!==r&&!a)throw Error(`FileDiff: retained edits are missing their diff session state`);let o=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===r,s=My(e);t!=null&&i!=null&&!o&&(s.name=t.name,s.lang=t.lang),a&&n!=null&&i!=null&&(s.additionLines=i,s.type=n.type,s.hunks=n.hunks,s.editSessionDirty=!0,Iv(s)),this.editSessionDiff=s,this.hunksRenderer.beginEditSession(s,o&&!a?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let l=ky(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!zy(u,this.deletionFile)||!zy(d,this.additionFile)),y=e!=null&&!W(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&Hp(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&!y||e==null&&!v))return this.applyCachedThemeState(p);let x;e==null&&_&&(v||this.fileDiff==null)&&(x=F_(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&y?this.updateExternalDiff(e,i):x!=null&&(y=!0,this.updateExternalDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i);let C=this.getLatestDiff();if(C==null)return!1;C.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(Jv(C,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:w=!1,disableFileHeader:T=!1}=this.options;if(T&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(C,Zt);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,e.fileDiff),this.renderSeparators([]),this.renderedDiff=e?.fileDiff??C,this.injectUnsafeCSS()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g||!W(this.renderedDiff,C))&&this.applyPartialRender({fileDiff:C,previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(C,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a,t.fileDiff),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData),this.renderedDiff=t.fileDiff}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}getLatestDiff(e=this.fileDiff){return this.editSessionDiff??e}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){let{editor:e,fileContainer:t}=this,n=this.getLatestAnnotations(),r=this.computeEditorRenderRange(this.renderRange),i=this.getLatestDiff();e==null||t==null||i==null||i.isPartial||this.hunksRenderer.initializeHighlighter().then(a=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestDiff()!==i)return;let{outgoingSessionDiff:o,fileDiff:s}=this,c=o!=null&&s!=null&&o!==i,l=c?Ny(o,s):!1;c&&(this.outgoingSessionDiff=void 0),e.__syncRenderView({highlighter:a,fileContainer:t,fileDiff:i,lineAnnotations:n,renderRange:r,externalDocument:c,resetHistory:l})})}computeEditorRenderRange(e){let t=this.getLatestDiff();if(e==null||t==null||im(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return ov({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}emitEditChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t);let{onEditChange:n}=this.options;n?.(e)}__captureDocumentSessionState(e=!0){let{outgoingSessionDiff:t,fileDiff:n,editSessionDiff:r}=this;if(t!=null&&n!=null){if(!n.isPartial&&Ny(t,n))return;r=t}if(!(r==null||r.isPartial))return{diffSession:{oldFile:r.type===`new`?null:{name:r.prevName??r.name,lines:e?[...r.deletionLines]:r.deletionLines},type:r.type,hunks:e?tg(r.hunks):r.hunks},hasChanges:r.editSessionDirty===!0}}__attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error(`FileDiff.__attachEditor: an editor is already attached`);let t=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`FileDiff.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){this.editSessionAnnotations??=Eh(this.lineAnnotations,rm);let{fileDiff:t,outgoingSessionDiff:n}=this;n!=null&&t!=null&&!t.isPartial&&this.editSessionDiff===n&&this.installEditSession(t);let r=this.editSessionDiff==null&&t!=null&&!t.isPartial?t:void 0;if(r==null?this.hunksRenderer.beginEditSession(this.editSessionDiff):this.installEditSession(r,e.__getDocumentContents(Ry(r)),e.__getDocumentSessionState()),this.editor=e,this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary(),this.hunksRenderer.editorRenderReady()){let{editSessionDiff:e}=this;e!=null&&this.hunksRenderer.diffCache===e&&(this.renderedDiff=e),this.syncRenderViewToEditor()}else this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSessionDiff:n,editSessionAnnotations:r,fileDiff:i,lineAnnotations:a}=this;if(n==null||i==null)return;if(this.editor!=null)throw Error(`FileDiff.__completeEditSession: detach the editor before completing the session`);this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let o=r?.current,s,c=null,l=null,u=!1,d;if(t==null)throw Error(`FileDiff.__completeEditSession: editor is required for completion`);let f=ng(n),p={name:f.name,contents:f.additionLines.join(``)};f.lang!=null&&(p.lang=f.lang);let m={fileDiff:f,editor:t,originalFileDiff:i,oldFile:f.type===`new`?null:{name:f.prevName??f.name,contents:f.deletionLines.join(``)},newFile:p,lineAnnotations:o,originalLineAnnotations:a};Object.freeze(m);try{if(t.__emitEditComplete(m),this.options.onEditComplete?.(m)===`accept`){if(f.cacheKey!=null&&f.cacheKey===i.cacheKey)throw Error(`FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey`);s=f,c=m.oldFile,l=m.newFile}}catch(e){u=!0,d=e}if(e&&s!=null&&(this.fileDiff=s,this.additionFile!=null&&(this.deletionFile=c,this.additionFile=l),o!=null&&(this.lineAnnotations=o)),this.editSessionDiff=void 0,this.editSessionAnnotations=void 0,this.outgoingSessionDiff=void 0,e&&this.fileContainer!=null&&this.rerender(),u)throw d}finalizeEditSessionHunks(){let e=this.getLatestDiff();if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=Kv(e,this.hunksRenderer.getExpandedHunksMap(),t);return Jv(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(qv(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){let{editSessionDiff:n}=this;if(n==null)throw Error(`FileDiff.applyDocumentChange: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(n),this.hunksRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let{editSessionDiff:r}=this;if(r==null)throw Error(`FileDiff.updateRenderCache: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(r);let{shouldRefreshDiffsView:i,lineCountChangeInFlight:a}=n;if(this.hunksRenderer.updateRenderCache(e,t,a)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}i===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){let{editSessionDiff:e,fileDiff:t}=this;e!=null&&(e.additionLines===t?.additionLines||e.additionLines===e.deletionLines)&&(e.additionLines=[...e.additionLines])}isLineRenderable(e){let t=this.getRenderedDiff();if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return Q_({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.getRenderedDiff();if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return $_({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.getRenderedDiff(),{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=q_(o);if(e<s){let c=J_({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=Z_({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=q_(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){en(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||uy(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!Dy(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!Ey(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:sh(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=ch();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:Th(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Th(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=nh;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:r,html:i,lastRenderedHTML:a},editSessionDiff:o}=this,s=(n!==o&&W(r,n)?i:void 0)??xi(e);if(this.headerCache.html=s,this.headerCache.fileDiff=n,s!==a){let e=document.createElement(`div`);e.innerHTML=s;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.headerCache.lastRenderedHTML=s}if(this.isContainerManaged)return;let{renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderFilenameSuffix:u,renderHeaderMetadata:d}=this.options;if(c!=null){let e=c(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Lt,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let f=l?.(n)??void 0,p=u?.(n)??void 0,m=d?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Pt,f),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Ft,p),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,It,m),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=lh(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=gh(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??L,s=typeof o==`string`?o:{...o},c=fh(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Mh({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:_h(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=vh(this.themeCSSStyle.textContent??``,fh(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Fh()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?jh(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=Wy(t[0]),a=Wy(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=xi(i),r.content.innerHTML=xi(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Sh({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Sh({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=Sh({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({fileDiff:e,previousRenderRange:t,renderRange:n}){let{pre:r,codeUnified:i,codeAdditions:a,codeDeletions:o,options:{diffStyle:s=`split`}}=this;if(r==null||t==null||n==null||!Number.isFinite(t.totalLines)||!Number.isFinite(n.totalLines)||this.lastRowCount==null)return!1;let c=this.getCodeColumns(s,i,o,a);if(c==null)return!1;let l=t.startingLine,u=n.startingLine,d=l+t.totalLines,f=u+n.totalLines,p=Math.max(l,u),m=Math.min(d,f);if(m<=p)return!1;let h=Math.max(0,p-l),g=Math.max(0,d-m),_=this.trimColumns({columns:c,trimStart:h,trimEnd:g,previousStart:l,overlapStart:p,overlapEnd:m,diffStyle:s});if(_<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<_)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let v=this.lastRowCount-_,y=(t,n)=>{if(!(n<=0))return this.hunksRenderer.renderDiff(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},b=y(u,Math.max(p-u,0));if(b==null&&u<p)return!1;let x=y(m,Math.max(f-m,0));if(x==null&&f>m)return!1;let S=(e,t)=>{if(e!=null){if(s===`unified`&&!Array.isArray(c))this.insertPartialHTML(s,c,e,t);else if(s===`split`&&Array.isArray(c))this.insertPartialHTML(s,c,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);v+=e.rowCount,this.renderedDiff=e.fileDiff}};return this.cleanupErrorWrapper(),S(b,`afterbegin`),S(x,`beforeend`),this.lastRowCount!==v&&(this.applyRowSpan(s,c,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`split`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(n))return;let r=(e,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(e,t),i=Wy(r?.[0]),a=Wy(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};r(`deletions`,n[0]),r(`additions`,n[1]),this.renderedDiff=t.fileDiff}refreshUnifiedDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`unified`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(n==null||Array.isArray(n))return;let r=this.hunksRenderer.renderCodeAST(`unified`,t),i=Wy(r?.[0]),a=Wy(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=xi(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?jh(this.pre,o):o(),this.renderSeparators(t.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=Wy(t[0]),i=Wy(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};ih(u,this.appliedPreAttributes)||(wh(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Ry(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function zy(e,t){return e==null||t==null?e==null&&t==null:eg(e,t)}function By({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Vy({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Hy(e,t,n=!1){return!n&&e==null&&t}function Uy(e,t,n=!1){return e==null&&t&&!n}function Wy(e){if(e!=null&&e.type===`element`)return e.children??[]}function Gy({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=Wh(t,n),l=c,u=i?!0:a,d=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=J_({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:u,hunkIndex:n,collapsedContextThreshold:o}),f=(a.fromStart+a.fromEnd)*t.lineHeight;if(c+=f,l+=f,a.collapsedLines>0){let e=iv({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;c+=e,l+=e}c+=i.splitLineCount*t.lineHeight,l+=i.unifiedLineCount*t.lineHeight;let p=Ky(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?Z_({fileDiff:e,hunkIndex:n,expandedHunks:u,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(m!=null){let e=(m.fromStart+m.fromEnd)*t.lineHeight;if(c+=e,l+=e,m.collapsedLines>0){let e=av({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=av({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=Kh(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function Ky(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return qy(e,t)}function qy(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}var Jy=3e3,Yy=new Map,Xy=-1,Zy=class extends Ly{__id=`little-virtualized-file-diff:${++Xy}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:Yy,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=Uh(n)}setMetrics(e,t=!1){let n=Uh(e);!t&&rn(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.resetLayoutCache({includeEstimatedHeights:!1}),!0):!1}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e){let t=this.getLatestAnnotations();return Km(t)?t.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1):!1}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!on(t,e),r=n&&ab(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:ob(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=Yy,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}applyGhostTextRows(e,t){let{cache:{heightDeltas:n,ghostTextRows:r,ghostTextRowsByIndex:i},metrics:{lineHeight:a}}=this;if(r===t)return!1;let o=this.getDiffStyle(),s=new Map;for(let[n,r]of t){let t=this.getLineIndexForDiff(e,n+1,`additions`);t!=null&&s.set(o===`split`?t[1]:t[0],r)}let c=!1;for(let e of new Set([...i.keys(),...s.keys()])){let t=((s.get(e)??0)-(i.get(e)??0))*a;if(t===0)continue;let r=(n.get(e)??0)+t;r===0?n.delete(e):n.set(e,r),this.cache.measuredHeightDeltaTotal+=t,c=!0}return this.cache.ghostTextRows=t,this.cache.ghostTextRowsByIndex=s,c}reconcileHeights(){let e=!1,{options:{overflow:t=`scroll`},cache:{ghostTextRowsByIndex:n},metrics:{lineHeight:r}}=this,i=this.getRenderedDiff();if(this.fileContainer==null||i==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(i,this.editor?.__getGhostTextRows()??Yy);let a=this.getLatestAnnotations();if(t===`scroll`&&a.length===0&&!this.isResizeDebuggingEnabled())return e&&this.computeApproximateSize(!0),e;let o=this.getDiffStyle(),s=o===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],c=this.hasFileAnnotations(i);if(this.renderRange!=null&&c&&Jm(this.renderRange)){let t=Qy(s)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!c&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of s){if(t==null)continue;let i=t.children[1];if(!(i instanceof HTMLElement))continue;let a=o===`split`&&t===this.codeDeletions;for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let s=ub(i,o),c=n.get(s)??0;if(a&&c>0)continue;let l=t.getBoundingClientRect().height+c*r,u=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(u=!0),l+=t.nextElementSibling.getBoundingClientRect().height);let d=this.getEstimatedLineHeight(u),f=this.cache.heightDeltas.get(s)??0,p=l-d;p!==f&&(e=!0,this.cache.measuredHeightDeltaTotal+=p-f,p===0?this.cache.heightDeltas.delete(s):this.cache.heightDeltas.set(s,p))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(e,t,n,r){let i=!1,a=!1,{pendingExpansions:o,pendingHydratedDiff:s,options:{collapsed:c=!1}}=this;if(s!=null&&(this.pendingHydratedDiff=void 0,s.expectedDiff===e&&(Object.assign(e,s.nextDiff),this.setHydratedState(s.files),this.startHydratedEditSession(e),this.forceRenderOverride=!0,i=!0,a=!0)),o!=null){this.pendingExpansions=void 0;for(let{hunkIndex:e,direction:t,expansionLineCountOverride:n}of o)this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,a=!0}let l=this.updateExternalDiff(e,r),{pendingRenderDiff:u,layoutDiffChanged:d,renderedDiffChanged:f,annotationsChanged:p}=this.updatePendingRender(e,r);return!this.forceRenderOverride&&(l||f||p)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||d||p)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=Uh(n.metrics),i=!0,a=!0),this.currentCollapsed!==c&&(this.currentCollapsed=c,i=!0),i?this.resetLayoutCache({includeEstimatedHeights:a}):a&&this.invalidateDerivedLayoutCache(!0),this.top=t,this.computeApproximateSize(!1,u),this.height}getLinePosition(e,t=`additions`){let n=this.getLayoutDiff();if(n==null||e<1)return;let r=this.getLineIndexForDiff(n,e,t);if(r==null)return;let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,c=this.getDiffStyle(),l=this.getHunkSeparatorType(),u=c===`split`?r[1]:r[0];this.approximateLayoutCheckpoints(n);let d=Wh(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return ov({diff:n,diffStyle:c,startingLine:f?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=c===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=iv({type:l,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(p+=r.gapBefore,u>=o-n&&u<o)return m={top:p,height:r.height},!0;p+=r.height+r.gapAfter}}let s=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===u)return m={top:p,height:s},!0;if(p+=s,r>0){let e=av({type:l,metrics:this.metrics});if(e!=null){if(u>o&&u<=o+r)return m={top:p+e.gapBefore,height:e.height},!0;p+=e.totalHeight}}return!1}}),m}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutDiff();if(t==null)return;let{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:i=!1,collapsedContextThreshold:a=1}=this.options;if(i)return;let o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(t);let c=this.getLayoutCheckpointBeforeTop(e),l=c?.top??Wh(this.metrics,n)+this.cache.fileAnnotationHeight,u;return ov({diff:t,diffStyle:o,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:a,additionLine:c})=>{let d=o===`split`?c?.splitLineIndex??a?.splitLineIndex:c?.unifiedLineIndex??a?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=iv({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(l+=e.totalHeight)}if(l>=e&&(a==null?c!=null&&(u={lineNumber:c.lineNumber,side:`additions`,top:l}):u={lineNumber:a.lineNumber,side:`deletions`,top:l},u!=null))return!0;let f=this.getLineHeight(d,(c?.noEOFCR??!1)||(a?.noEOFCR??!1));if(l+=f,i>0){let e=av({type:s,metrics:this.metrics});e!=null&&(l+=e.totalHeight)}return!1}}),u}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutDiff();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!W(this.getRenderedDiff(),this.getLatestDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(this.isAdvancedMode()){let n=cg(`clone`,e,t);if(await Oy(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(cg(`merge`,e,t),this.setHydratedState(t),!this.startHydratedEditSession(e)&&(await Oy(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.getRenderedDiff();if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return Q_({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.fileDiff==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getLatestDiff(),t=e==null?void 0:this.hunksRenderer.getDiffForNextRender(e);this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!W(this.getRenderedDiff(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});let i=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutDiff()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(t,this.editor?.__getGhostTextRows()??Yy);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=Wh(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(e=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.getLayoutDiff()){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=Gy({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:sb(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.getLayoutDiff()){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=ky(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!lb(s,this.deletionFile)||!lb(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=F_(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!W(this.fileDiff,u),m=p||l;if(e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;p&&this.updateExternalDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&W(this.pendingRender.latestDiff,this.getLatestDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:!1}:this.updatePendingRender(u,r);if((v||g)&&this.resetLayoutCache({includeEstimatedHeights:g}),f)this.top??=this.getVirtualizedTop(),g&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,h));else{this.computeApproximateSize(!1,h);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!m||!f))return a!=null&&(this.deletionFile=s,this.additionFile=c),p&&this.clearReusableHeader(),this.pendingRender=void 0,this.renderPlaceholder(this.height);let y=this.virtualizer.getWindowSpecs(),b=this.top??0,x=this.computeRenderRangeFromWindow(h,b,y),S=super.render({fileDiff:u,fileContainer:e,renderRange:x,lineAnnotations:r,forceRender:(d??n)||v||_||p,...a,...i});if(S){if(this.getRenderedDiff()!==h)throw Error(`VirtualizedFileDiff.render: rendered a different diff than its prepared layout`);this.pendingRender=void 0}return this.isSimpleMode()&&S&&this.getSimpleVirtualizer()?.requestHeightReconcile(this),S}updatePendingRender(e,t){let n=this.getLatestDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={latestDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!W(a,o),renderedDiffChanged:!W(r,o)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return cb(this.options.hunkSeparators)}approximateLayoutCheckpoints(e){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=sb(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=$y(this.cache.heightDeltas),u=Wh(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=nb(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+rb(i,e)*this.metrics.lineHeight+eb(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=Jy}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+eb(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=J_({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?iv({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?Z_({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?av({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:ib({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=J_({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=Z_({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=sb(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=Wh(this.metrics,i),h=e.hunks.length>0?Kh(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=(n+r)/2,O=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),k=t+(O?.top??_),A=O?.renderedLineIndex??0,j,M,ee;if(ov({diff:e,diffStyle:l,startingLine:O?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?iv({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;k+=y;let b=A%s===0,x=Math.floor(A/s);if(b&&(E[x]=k-(t+_+y),ee!=null)){if(ee<=0)return!0;ee--}let S=this.getLineHeight(l===`split`?m:h,g);if(k>n-S&&k<r&&(j??=x),M==null&&k+S>D&&(M=x),ee==null&&k>=r&&b&&(ee=T),A++,k+=S,c>0||v&&d){let e=av({type:u,metrics:this.metrics});e!=null&&(k<r&&k+e.totalHeight>n&&(j??=x),M==null&&k+e.totalHeight>D&&(M=x),k+=e.totalHeight)}return!1}}),j==null){if(x)j=0,M=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}M??=j;let N=Math.round(M-w/2),te=Math.max(0,Math.ceil(p/s)-w),ne=Math.max(0,Math.min(N,te)),re=ne*s,ie=N<0?C+N*s:C,ae=E[ne]??0,oe=re===0?0:g+ae,se=ne+ie/s,ce=se<E.length?v-E[se]:v-(k-t-_);return{startingLine:re,totalLines:ie,bufferBefore:oe,bufferAfter:Math.max(0,ce)}}};function Qy(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===Gm&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function $y(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function eb({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=tb(e,n);return(t[tb(e,r)]??0)-(t[i]??0)}function tb(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function nb(e){return Math.ceil(e/Jy)*Jy}function rb(e,t){let n=0;for(let r of e)r<t&&n++;return n}function ib({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function ab(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function ob(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function sb(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function cb(e){return typeof e==`function`?`custom`:e??`line-info`}function lb(e,t){return e==null||t==null?e==null&&t==null:eg(e,t)}function ub(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function db(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:fb(e.items,t.items)}function fb(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.instance!==i.instance||r.version!==i.version)return!1}return!0}function pb(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(Vt,``),t.before(r)):(r.setAttribute(Ht,``),t.after(r)),n?.observe(r),r}function mb(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var hb=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.loadDiffFiles.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),gb=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],_b=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],vb=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],yb=Symbol(`CodeView.itemOptionsState`);function bb(e,t){Object.defineProperty(e,yb,{configurable:!1,enumerable:!1,value:t})}function xb(e){return e[yb]}function Sb(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var Cb=120,wb=1,Tb=`--diffs-overflow-override`,Eb=12e6,Db=1e6,Ob=2e6,kb=1e7,Ab=11e6;function jb(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var Mb=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),Nb=class e{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=Kt;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;isContainerManaged;constructor(e={theme:L},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??qt}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??Kt.hunkLineCount,lineHeight:e?.lineHeight??Kt.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??Kt.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??Kt.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??Jt}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return Et&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||e.element==null)return;let t=e.instance.getAdvancedStickySpecs();if(t==null)return;let n=t.height,r=e.element.getBoundingClientRect().height;n!==r&&console.error(`CodeView: reconciled item height does not match DOM height`,{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:r,delta:r-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:e,lastIndex:t,stickyHeight:n,stickyTop:r,stickyBottom:i}=this.renderState;if(e===-1||t===-1)return;let a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-n)<wb||console.error(`CodeView: sticky container height does not match computed layout`,{computedStickyHeight:n,actualStickyHeight:a,delta:a-n,stickyTop:r,stickyBottom:i,firstIndex:e,lastIndex:t,firstStickySpecs:this.items[e]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),Mb&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Tb,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,Cb)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(Tb,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}reconcileHeaderFooterHosts(){let e=this.reconcileHost(`header`),t=this.reconcileHost(`footer`);return e||t}reconcileHost(e){let{root:t,container:n}=this;if(t==null||n==null)return!1;let r=e===`header`?this.header:this.footer,i=e===`header`?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(i==null)return r.element!=null&&(this.resizeObserver?.unobserve(r.element),r.element.remove(),r.element=void 0,r.render=void 0,this.setHostHeight(r,0),!1);if(r.element!=null&&i===r.render)return!1;let a=r.element??pb(e,n,this.resizeObserver);r.element=a;let o=i();return o==null?!this.isContainerManaged&&a.children.length>0&&(a.textContent=``):a.replaceChildren(o),r.render=i,!0}setHostHeight(e,t){e.height!==t&&(e.height=t,this.scrollDirty=!0)}measureMountedHosts(){this.header.element!=null&&this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height),this.footer.element!=null&&this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(t){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,this.scrollTo({type:`position`,position:e.__lastScrollPosition,behavior:`instant`})):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)}}reset(){tn(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let e=[...this.itemEditors.values()].map(e=>{let t=this.idToItem.get(e.state.id);return t!=null&&(e.state.removedItem=t.item),{record:e,instance:t?.instance}});this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear();let t=!1,n;for(let{record:r,instance:i}of e)try{r.editor.cleanUp(`discard`),i?.cleanUp()}catch(e){t||(t=!0,n=e)}if(this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator(),t)throw n}cleanUp(){let e=!1,t;try{this.reset()}catch(n){e=!0,t=n}if(this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0,e)throw t}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(Tt),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),this.attachedEditors.delete(e.item.id),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))Rb(e)||e.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return un()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){if(this.root==null)return;let t=this.normalizeScrollTarget(e);if(t==null)return;let n=this.resolveScrollTargetTop(t);n!=null&&(this.primeScrollTarget(t),this.resolveEffectiveScrollBehavior(t,n)===`smooth`?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){return this.idToItem.get(e)?.item}getEditor(e){return this.itemEditors.get(e)?.editor}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);if(n==null)return console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1;if(this.idToItem.has(t))return console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1;this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines));let r=this.itemEditors.get(e);return r!=null&&(this.itemEditors.delete(e),this.itemEditors.set(t,r),this.attachedEditors.delete(e)&&this.attachedEditors.add(t)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),!0}addItem(e){this.addItems([e])}addItems(e){this.appendItemsInternal(e),this.syncItemEditors(),this.syncSelection()}removeItem(e){let t=this.idToItem.get(e);if(t==null)return console.error(`CodeView.removeItem: unknown item id "${e}"`),!1;let n=[];for(let e of this.items)e!==t&&n.push(e.item);return this.setItems(n),!0}setItems(e){let t;this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||(t=this.reconcileItems(e)),this.syncItemEditors(t),this.syncSelection()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=Pb(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this;Fb(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!rn(r,i),o=!rn(n,this.getLayout());o&&this.syncLayout();let s=a||Ib(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||Lb(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),on(t,e)||this.renderOptionsRevision++,this.syncItemEditors();let c=t.renderCodeViewHeader!==e.renderCodeViewHeader||t.renderCodeViewFooter!==e.renderCodeViewFooter;!this.isContainerManaged&&(this.items.length>0||c)&&this.render()}capturePendingLayoutAnchor(e=this.idToItem){this.root!=null&&this.items.length!==0&&this.pendingScrollTarget==null&&(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),e))}render(t=!1){e.__STOP||(t?(tn(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):en(this.computeRenderRangeAndEmit))}isReady(){let{workerManager:e}=this;return e==null||e.isInitialized()||e.getStats().workersFailed?(this.clearReadySubscription(),!0):(this.isReadySubscription??=e.subscribeToStatChanges(e=>{e.managerState!==`initialized`&&!e.workersFailed||(this.clearReadySubscription(),this.render(!0))}),e.getStats().managerState===`waiting`&&e.initialize().catch(()=>{}),!1)}clearReadySubscription(){this.isReadySubscription!=null&&(this.isReadySubscription(),this.isReadySubscription=void 0)}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e!==this.slotCoordinator&&(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return this.buildSlotSnapshot(e)}buildSlotSnapshot(e){let t=Wb(this.getRenderedItems(),e),{element:n}=this.header,{element:r}=this.footer;if(t!=null||n!=null||r!=null)return{items:t,header:n,footer:r}}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getItemTopOffset()}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new Zy(this.createDiffOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new Qh(this.createFileOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&cn(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);if(e==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(e){return e.item.edit===!0&&e.item.collapsed!==!0}attachItemEditor(e){let{id:t}=e.item,{createEditor:n}=this.options;if(e.element==null||this.attachedEditors.has(t)||!this.isItemInEditMode(e))return;let r=this.itemEditors.get(t),i;try{if(r==null){jb(n);let r=xb(e.instance.options);if(r==null)throw Error(`CodeView.attachItemEditor: instance options are missing their state`);let a=e=>{let t=this.idToItem.get(r.id);t!=null&&this.options.onItemEditChange?.(e,t.item)},o=this.options.getEditStateKey?.(e.item);if(e.type===`diff`){let s=n(`file-diff`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}else{let s=n(`file`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}}else r.dispose=(e.type,r.editor.edit(e.instance));this.attachedEditors.add(t)}catch(t){throw i?.cleanUp(),this.releaseRenderedItem(e),t}}syncItemEditors(e){if(this.itemEditors.size===0)return;let t=[];for(let[n,r]of this.itemEditors){let i=this.idToItem.get(n),a=e?.get(n);if(a==null&&i!=null){let{edit:e=!1,collapsed:t=!1}=i.item;if(e){t&&this.attachedEditors.delete(n)&&r.editor.cleanUp(`recycle`);continue}}else a!=null&&(r.state.removedItem=a.item);this.itemEditors.delete(n),this.attachedEditors.delete(n),t.push(r)}if(t.length===0)return;let n=!1,r;for(let e of t){try{e.dispose()}catch(e){n||(n=!0,r=e)}let t=this.idToItem.get(e.state.id);t!=null&&this.markItemLayoutDirty(t)}if(this.render(),n)throw r}requireItemFromState(e){let t=this.idToItem.get(e.id)?.item??e.removedItem;if(t==null)throw Error(`CodeView.onItemEditComplete: unknown item "${e.id}"`);return t}completeFileItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`file`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a file item`);let r={...n,file:t.file,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}completeDiffItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`diff`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a diff item`);let r={...n,fileDiff:t.fileDiff,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n!=null&&n.type!==`position`&&n.id===e&&(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of gb)Sb(e,t,()=>this.options[t]);Sb(e,`stickyHeader`,()=>this.options.stickyHeaders),Sb(e,`collapsed`,e=>{let t=xb(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),Sb(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=xb(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of _b)this.defineItemSharedCallback(e,`file`,t);for(let t of vb)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of hb)Sb(e,t,()=>this.options[t]);Sb(e,`stickyHeader`,()=>this.options.stickyHeaders),Sb(e,`hunkSeparators`,()=>this.options.hunkSeparators),Sb(e,`collapsed`,e=>{let t=xb(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),Sb(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=xb(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of _b)this.defineItemSharedCallback(e,`diff`,t);for(let t of vb)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return bb(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return bb(t,{id:e}),t}updateItemOptionsId(e,t){let n=xb(e);if(n==null)throw Error(`CodeView.updateItemOptionsId: No valid state`);n.id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(n!=null&&n.type===t)return n}defineItemSharedCallback(e,t,n){Sb(e,n,e=>{if(this.options[n]==null)return;let r=xb(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=this.options[n];return a?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){Sb(e,n,e=>{let r=xb(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=(e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a);let o=this.options[n];return o?.(e,i)}),i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s=new Map,c;for(let s=0;s<e.length;s++){let l=e[s];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,s,0);d.index=s,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(c=Math.min(c??s,s))):c=Math.min(c??s,s),t[s]!==d&&(c=Math.min(c??s,s)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}if(c==null){if(r.size===0)return;c=Math.max(i.length-1,0)}this.capturePendingLayoutAnchor(a);for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;s.set(n.item.id,n),this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);c=Math.min(c??a,a)}return this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(c),this.scrollDirty=!0,this.render(),s.size>0?s:void 0}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);return e.version!==t.version&&(e.item=t,e.version=t.version,e.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+this.header.height+e+this.footer.height+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>Ab}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),Eb):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=mb(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=mb(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let t=this.clampScrollPageOffset(this.scrollPageOffset),n=e-t,r=this.getMaxPagedScrollTop(),i=this.getMaxScrollPageOffset(),a=n>Ab&&t<i,o=n<Db&&t>0;return n<0||n>r||a||o?this.resolveScrollPageWindow(e,o?Math.min(kb,r):Ob):{pagedScrollTop:mb(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){let t=mb(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${zb(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getItemTopOffset()+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight();if(!(r-n<=o&&i+n>=s)){if(r-n<o)return{...e,align:`start`};if(i+n>s)return{...e,align:`end`}}}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${zb(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getItemTopOffset();let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(e.__STOP||this.container==null||!this.isReady())return;let n=this.getHeight(),r=this.getScrollTop(),i=r,a=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(i);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,a=!0),a&&o!=null){let e=this.resolveAnchoredScrollTop(o);if(e!=null){let t=e-i;i=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}a&&(i=this.clampScrollTop(i),this.syncContainerHeight());let s=this.computeTargetScrollTopForFrame(i,t),c=!a&&(this.renderState.scrollTop===-1||Math.abs(s-this.renderState.scrollTop)>n+this.config.overscrollSize*2);c&&(o=void 0),this.windowSpecs=ln({scrollTop:s-this.header.height,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:c,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=r;(this.pendingScrollTarget!=null&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);let{top:u,bottom:d}=this.windowSpecs,{firstIndex:f,lastIndex:p}=this.renderState;if(f>=0)for(let e=f;e<=p;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>u-t.height&&t.top<=d||this.releaseRenderedItem(t)}let m=this.reconcileHeaderFooterHosts(),h,g=new Set,_=this.findFirstVisibleIndex(u),v=this.findLastVisibleIndex(d);for(let e=_;e<=v;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),Hb(this.stickyContainer,t.element,h),n.virtualizedSetup(),Vb(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(Hb(this.stickyContainer,t.element,h),Vb(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element),t.item.edit===!0&&this.attachItemEditor(t)}this.renderState.firstIndex=_<=v?_:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.flushManagers(g),m&&this.measureMountedHosts(),this.reconcileRenderedItems(g),this.syncContainerHeight(),this.updateStickyPositioning();let y=o==null?void 0:this.resolveAnchoredScrollTop(o);o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let b=y==null?0:y-i,x=s,S=!1;if(this.pendingScrollTarget!=null){let e=this.advanceScrollAnimation(t,b);e==null?x=i:(x=e,S=!0)}else x=y??s;x!==l&&(this.applyScrollFix(x,l,this.windowSpecs),l=x),S&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=mb(l),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),(c||this.scrollAnimation!=null)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container!=null&&this.containerHeight!==e&&(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(r!=null&&i!=null)return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight>>0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);if(t==null){this.stickyOffset.style.height=`${this.getPagedLayoutTop(e.top)}px`;return}this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return;let r=-1,i=!1;for(let a=t;a<this.items.length&&!(!i&&a>n);a++){let t=this.items[a];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?a<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),a<this.items.length-1&&(r+=this.getLayout().gap)}i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null){this.renderState.firstIndex===-1&&(this.stickyOffset.style.height=``);return}let{stickyTop:t,stickyBottom:n}=e;(n-t!==this.renderState.stickyHeight||t!==this.renderState.stickyTop||n!==this.renderState.stickyBottom)&&this.applyStickyPositioning(e)}handleScroll=()=>{e.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=e=>{let t=!1;for(let n of e)if(n.target===this.stickyContainer){let e=n.borderBoxSize[0].blockSize;if(Math.abs(e-this.renderState.stickyHeight)>=wb){let e=this.getScrollTop(),n=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let r=n==null?void 0:this.resolveAnchoredScrollTop(n);if(r!=null){let t=r-e;this.applyScrollFix(r,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else if(n.target===this.header.element||n.target===this.footer.element){let e=n.target===this.header.element?this.header:this.footer,r=n.borderBoxSize[0].blockSize;if(r!==e.height){let n=this.getScrollTop(),i=this.getScrollAnchor(n);this.setHostHeight(e,r);let a=i==null?void 0:this.resolveAnchoredScrollTop(i);if(a!=null){let e=a-n;this.applyScrollFix(a,n,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=e)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else this.scrollDirty=!0,this.heightDirty=!0,t=!0;t&&this.render(!0)};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e,t=this.idToItem){let n,{pendingLayoutAnchor:r}=this;if(r!=null){let e=this.idToItem.get(r.id);if(e!=null&&t.get(r.id)===e)return r;e!=null&&(n=e)}if(e<=0)return;let{firstIndex:i,lastIndex:a,stickyTop:o,stickyBottom:s}=this.renderState;if(i===-1||a===-1)return;let c=this.getHeight();if(o!==-1&&s!==-1){for(let r=i;r<=a;r++){let i=this.items[r];if(i==null)continue;let a=this.getItemTopOffset()+i.top;if(a+i.height<=e)continue;if(a>=e+c)break;if(t.get(i.item.id)!==i){n??=i;continue}if(a>=e)return{type:`item`,id:i.item.id,viewportOffset:a-e};let o=this.getScrollAnchorViewportTop(a,e)-a,s=i.instance.getNumericScrollAnchor(o);if(s!=null){let t=a+s.top;return{type:`line`,id:i.item.id,lineNumber:s.lineNumber,side:s.side,viewportOffset:t-e}}}if(n!=null)for(let e=n.index+1;e<this.items.length;e++){let n=this.items[e];if(n!=null&&t.get(n.item.id)===n)return{type:`item`,id:n.item.id,viewportOffset:0}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let n=this.getItemTopOffset();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}applyScrollFix(e,t,n){if(this.root==null)return;let r=mb(this.clampScrollTop(e)),i=mb(t),{scrollPageOffset:a}=this,o=mb(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;r===this.renderState.scrollTop&&r===i&&l===o&&!u||(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null||mb(this.getScrollTop())===mb(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let e=this.buildSlotSnapshot(this.slotCoordinator);db(this.slotSnapshot,e)||(this.slotSnapshot=e,this.slotCoordinator.onSnapshotChange(e))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);e.top=r,e.height=e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,r,t,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,r,t,e.item.annotations??[]),r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function Pb(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,e.top,void 0,e.item.annotations??[])}function Fb(e,t){return!an(e.theme??L,t.theme??L)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function Ib(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Lb(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Rb(e){return e instanceof SVGElement||Th(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function zb(e){let t=Bb(e.start,e.side),n=Bb(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function Bb(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function Vb(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function Hb(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function Ub(e){return(e.annotations?.length??0)>0}function Wb(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)Ub(t.item)&&i.push(t);return i.length>0?i:void 0}function Gb(e){let t=[];for(let n of e){let e=$i.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function Kb(e){for(let t of Array.isArray(e)?e:[e])if(!$i.has(t))return!1;return!0}async function qb(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=Xf(r)??Yf(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function Jb(e){return cp.getResolvedThemes(e)}async function Yb(e){for(let t of e)Ap(t);let t=await cp.resolveThemes(e);for(let n=0;n<e.length;n++)jp(e[n],t[n]);return t}function Xb(e){return e.map(e=>{let t=e.pr?String(e.pr.number):`-`,n=e.pr&&(e.pr.headRefOid||e.head)||``,r=e.localHead||e.head||``;return`${e.worktree}#${t}:${n}:L${r}`}).sort().join(`\0`)}function Zb(e){return e.repos.flatMap(e=>{let t=e.localHead||``,n=e.prs.filter(e=>e.state===`OPEN`||e.state===void 0);return n.length?n.map(n=>`${e.worktree}#${n.number}:${n.headRefOid||``}:L${t}`):[`${e.worktree}#-::L${t}`]}).sort().join(`\0`)}var Qb=new WeakMap;function $b(e,t){if(Qb.has(e))return Qb.get(e);let n=null;if(e.patch)try{n=Ig(e.patch,t)[0]?.files[0]??null}catch{n=null}return Qb.set(e,n),n}var ex=new WeakMap;function tx(e,t){let n=ex.get(e);if(!n){n={additions:new Map,deletions:new Map};for(let t of e.hunks){let r=t.additionStart,i=t.deletionStart,a=t.additionLineIndex,o=t.deletionLineIndex;for(let s of t.hunkContent)if(s.type===`context`)for(let t=0;t<s.lines;t++)n.additions.set(r++,e.additionLines[a++]??``),n.deletions.set(i++,e.deletionLines[o++]??``);else{for(let t=0;t<s.deletions;t++)n.deletions.set(i++,e.deletionLines[o++]??``);for(let t=0;t<s.additions;t++)n.additions.set(r++,e.additionLines[a++]??``)}}ex.set(e,n)}return n[t]}var nx=3;function rx(e,t,n,r){let i=tx(e,t),a=t===`deletions`?`-`:`+`,o=[];for(let e=Math.max(1,n-nx);e<=r+nx;e++){let t=i.get(e);if(t==null)continue;let s=e>=n&&e<=r?a:` `;o.push(`${s}${String(e).padStart(4)} | ${t}`)}return o.join(`
1528
- `)}var ix=t(n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):r((n||=self).lru_map=n.lru_map||{})})(e,function(e){let t=Symbol(`newer`),n=Symbol(`older`);class r{constructor(e,t){typeof e!=`number`&&(t=e,e=0),this.size=0,this.limit=e,this.oldest=this.newest=void 0,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[t]&&(e===this.oldest&&(this.oldest=e[t]),e[t][n]=e[n]),e[n]&&(e[n][t]=e[t]),e[t]=void 0,e[n]=this.newest,this.newest&&(this.newest[t]=e),this.newest=e)}assign(e){let r,a=this.limit||Number.MAX_VALUE;this._keymap.clear();let o=e[Symbol.iterator]();for(let e=o.next();!e.done;e=o.next()){let o=new i(e.value[0],e.value[1]);if(this._keymap.set(o.key,o),r?(r[t]=o,o[n]=r):this.oldest=o,r=o,a--==0)throw Error(`overflow`)}this.newest=r,this.size=this._keymap.size}get(e){var t=this._keymap.get(e);return t?(this._markEntryAsUsed(t),t.value):void 0}set(e,r){var a=this._keymap.get(e);return a?(a.value=r,this._markEntryAsUsed(a),this):(this._keymap.set(e,a=new i(e,r)),this.newest?(this.newest[t]=a,a[n]=this.newest):this.oldest=a,this.newest=a,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var e=this.oldest;if(e)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[n]=void 0):(this.oldest=void 0,this.newest=void 0),e[t]=e[n]=void 0,this._keymap.delete(e.key),--this.size,[e.key,e.value]}find(e){let t=this._keymap.get(e);return t?t.value:void 0}has(e){return this._keymap.has(e)}delete(e){var r=this._keymap.get(e);return r?(this._keymap.delete(r.key),r[t]&&r[n]?(r[n][t]=r[t],r[t][n]=r[n]):r[t]?(r[t][n]=void 0,this.oldest=r[t]):r[n]?(r[n][t]=void 0,this.newest=r[n]):this.oldest=this.newest=void 0,this.size--,r.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new o(this.oldest)}values(){return new s(this.oldest)}entries(){return this}[Symbol.iterator](){return new a(this.oldest)}forEach(e,n){typeof n!=`object`&&(n=this);let r=this.oldest;for(;r;)e.call(n,r.value,r.key,this),r=r[t]}toJSON(){for(var e=Array(this.size),n=0,r=this.oldest;r;)e[n++]={key:r.key,value:r.value},r=r[t];return e}toString(){for(var e=``,n=this.oldest;n;)e+=String(n.key)+`:`+n.value,n=n[t],n&&(e+=` < `);return e}}e.LRUMap=r;function i(e,r){this.key=e,this.value=r,this[t]=void 0,this[n]=void 0}function a(e){this.entry=e}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}};function o(e){this.entry=e}o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.key}):{done:!0,value:void 0}};function s(e){this.entry=e}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.value}):{done:!0,value:void 0}}})}))(),1),ax=Symbol(`IGNORE_RESPONSE`),ox=1e4,sx=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},cx=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`)}},lx=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=L,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s=`shiki-js`}){this.options=e,this.preferredHighlighter=s,this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new ix.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new ix.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed}getFileResultCache(e){return e.cacheKey==null?void 0:this.fileCache.get(e.cacheKey)}getDiffResultCache(e){return e.cacheKey==null?void 0:this.diffCache.get(e.cacheKey)}inspectCaches(){let{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??L,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:n=this.renderOptions.lineDiffType??`word-alt`,maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){let{lifecycleGeneration:a}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(a)&&this.renderOptionsRequestVersion===o;try{let a={theme:e,useTokenTransformer:t,lineDiffType:n,maxLineDiffLength:r,tokenizeMaxLineLength:i};if(this.isInitialized()||await this.initialize(),!s()||R_(a,this.renderOptions))return;let o=Rp(e),c=[];if(an(a.theme,this.renderOptions.theme)||(c=Bp(o)?Jb(o):await Yb(o)),!s())return;if(this.highlighter!=null)lp(c,this.highlighter);else{let e=await Fp({themes:o,langs:[`text`],preferredHighlighter:this.preferredHighlighter});if(!s())return;this.highlighter=e}let l=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let e of this.themeSubscribers)e.onThemeChange();await l}catch(e){if(e instanceof sx||!s())return;throw e}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:n}=this.renderOptions;return{theme:t,useTokenTransformer:n,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();let n=[];for(let r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),Error(`setRenderOptionsOnWorkers: Somehow we have an uninitialized worker`);n.push(new Promise((n,i)=>{let a=this.generateRequestId(),o={type:`set-render-options`,id:a,request:{type:`set-render-options`,id:a,renderOptions:e,resolvedThemes:t},resolve:n,reject:i,requestStart:Date.now()};this.activeTaskById.set(a,o),r.pendingSetupRequestId=a,r.worker.postMessage(o.request)}))}await Promise.all(n)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast??=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);let e=this.getStats();for(let t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);let t=this.activeRequestByInstance.get(e);if(t!=null){let n=this.activeTaskById.get(t);fx(n)?(this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeActiveTask(n)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized!==!0){if(this.initialized===!1){let{lifecycleGeneration:t}=this;this.initialized=new Promise((n,r)=>{(async()=>{try{let r=Rp(this.renderOptions.theme),i=[];if(i=Bp(r)?Jb(r):await Yb(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=Kb(e)?Gb(e):await qb(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([Fp({themes:r,langs:[`text`,...e],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(i,a)]);if(!this.isCurrentLifecycle(t)){this.terminateWorkers(),n();return}this.highlighter=o,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),n()}catch(e){if(e instanceof sx||!this.isCurrentLifecycle(t)){n();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,mx(e));this.queueBroadcastStateChanges(),r(e)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=em(),i=r>0?tm():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){let a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set([`text`,...t.map(({name:e})=>e)]),customExtensionsVersion:0};a.addEventListener(`message`,e=>{this.handleWorkerMessage(o,e.data)}),a.addEventListener(`error`,e=>this.handleWorkerError(o,e)),this.workers.push(o),n.push(new Promise((n,a)=>{let s=this.generateRequestId(),c={type:`initialize`,id:s,request:{type:`initialize`,id:s,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:i==null?void 0:r,customExtensionMap:i},resolve(){o.initialized=!0,n()},reject:a,requestStart:Date.now()};o.pendingSetupRequestId=s,this.activeTaskById.set(s,c),this.executeTask(o,c)}))}let a=this.options.workerInitializationTimeout??ox,o;try{await Promise.race([Promise.all(n),new Promise((e,t)=>{o=setTimeout(()=>{t(Error(`WorkerPoolManager: worker initialization timed out after ${a}ms`))},a)})])}finally{o!=null&&clearTimeout(o)}}handleWorkerError(e,t){console.error(`Worker error:`,t,e);let{pendingSetupRequestId:n}=e;if(n==null)return;let r=this.activeTaskById.get(n);r?.type===`initialize`&&(r.reject(mx(t)),this.cleanWorkerAndTask(e,r))}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized===!0&&this.queuedTasks.length!==0){for(let e=0;e<this.queuedTasks.length;){let t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}let n=dx(t),r=this.getAvailableWorker(n);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,n)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){let n=this.getFileResultCache(t);Zm(t)||n!=null&&Vp(n.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:`file`,file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeFileHighlightCache: worker pool is not working`));let t=this.getOrCreateFileHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateFileHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`);return}let t=this.getFileResultCache(e),n=this.getFileHighlightKey(e);if(n==null||Zm(e)||t!=null&&Vp(t.options,this.getFileRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`file`?r:void 0;{let t=this.submitCacheTask({type:`file`,file:e},n);return t.type===`file`?t:void 0}}getPlainFileAST(e,t,n,r){if(this.highlighter==null){this.queueInitialization();return}return Vm(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);uy(t)||n!=null&&R_(n.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:`diff`,diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeDiffHighlightCache: worker pool is not working`));let t=this.getOrCreateDiffHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateDiffHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`);return}let t=this.getDiffResultCache(e),n=this.getDiffHighlightKey(e);if(n==null||uy(e)||t!=null&&R_(t.options,this.getDiffRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`diff`?r:void 0;{let t=this.submitCacheTask({type:`diff`,diff:e},n);return t.type===`diff`?t:void 0}}getPlainDiffAST(e,t,n,r,i){return this.highlighter==null?void 0:mv(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let e=new sx;for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(e=>{console.error(e)})}cancelActiveWorkerTasks(){let e=new sx;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):fx(t)&&this.rejectRenderTaskCallbacks(t,e)}terminateWorkers(){for(let e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?`waiting`:this.initialized===!0?`initialized`:`initializing`,totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.getHighlightKeyForRequest(t),r=n==null?void 0:this.getTaskByHighlightKey(n);if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);let i=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(t.type){case`file`:return{type:`file`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a};case`diff`:return{type:`diff`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a}}})();this.enqueueRenderTask(s,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:i}=this,a=(()=>{switch(e.type){case`file`:return{type:`file`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r};case`diff`:return{type:`diff`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r}}})();return this.enqueueRenderTask(a),a}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,n){try{let r=n.filter(t=>!e.langs.has(t));if(r.length>0&&(Kb(r)?t.request.resolvedLanguages=Gb(r):t.request.resolvedLanguages=await qb(r)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch(n){this.rejectRenderTaskCallbacks(t,mx(n)),this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){let n=this.activeTaskById.get(t.id);try{if(n==null)throw ax;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(fx(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}switch(t.requestType){case`initialize`:if(n.type!==`initialize`)throw Error(`handleWorkerMessage: task/response dont match`);this.syncCustomExtensionVersion(e,n.request),n.resolve();break;case`set-render-options`:if(n.type!==`set-render-options`)throw Error(`handleWorkerMessage: task/response dont match`);n.resolve();break;case`file`:{if(n.type!==`file`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!Vp(i,this.getFileRenderOptions()))throw ax;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.fileCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyFileInstances(n,r,i);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!R_(i,this.getDiffRenderOptions()))throw ax;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.diffCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyDiffInstances(n,r,i);break}}}catch(e){e!==ax&&console.error(e,n,t)}this.cleanWorkerAndTask(e,n,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain??(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,fx(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,n=t?.id){e.requestId===n&&(e.requestId=void 0),e.pendingSetupRequestId===n&&(e.pendingSetupRequestId=void 0),t!=null&&(fx(t)&&(this.rejectRenderTaskCallbacks(t,new cx),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){ux(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);for(let n of dx(t))e.langs.add(n);try{t.type===`file`?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type===`diff`&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(n){console.error(`Failed to post message to worker:`,n),fx(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,mx(n))):`reject`in t&&t.reject(n),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;let n=em();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=tm())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(let n of this.workers){if(n.requestId!=null||n.pendingSetupRequestId!=null||!n.initialized)continue;if(t=n,e.length===0)break;let r=!0;for(let t of e)if(!n.langs.has(t)){r=!1;break}if(r)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case`file`:return this.getFileHighlightKey(e.file);case`diff`:return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(let t of px(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){let n=this.queuedTaskByInstance.get(e);n!=null&&n!==t&&(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeQueuedTask(n))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){let t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.rejectRenderTaskCallbacks(e,new cx),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new cx),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,n)=>{e.callbacks.add({resolve:t,reject:n})})}resolveRenderTaskCallbacks(e){for(let t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(let n of e.callbacks)n.reject(t);e.callbacks.clear()}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){let t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(let e of Array.from(this.activeTaskById.values()))fx(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of px(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(let t of px(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of px(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,n)}notifyDiffInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,n)}notifyHighlightError(e,t){for(let n of px(e))this.activeRequestByInstance.get(n)===e.id&&n.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`file`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&eg(t,n.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`diff`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&W(n.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){let t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let e of this.queuedTasks)yield e;for(let e of this.activeTaskById.values())fx(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function ux(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function dx(e){let t=new Set;if(e.type===`initialize`||e.type===`set-render-options`)return[];switch(e.type){case`file`:t.add(e.request.file.lang??$p(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??$p(e.request.diff.name)),t.add(e.request.diff.lang??$p(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function fx(e){return e?.type===`file`||e?.type===`diff`}function px(e){return e.instances}function mx(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){if(`error`in e&&e.error instanceof Error)return e.error;if(`message`in e&&typeof e.message==`string`)return Error(e.message)}return Error(String(e))}var hx;function gx({poolOptions:e,highlighterOptions:t}){return hx??=new lx(e,t),hx}var _x=`/assets/worker-C0KwUb8K.js`,vx;function yx(){return vx??=gx({poolOptions:{workerFactory:()=>new Worker(_x,{type:`module`}),poolSize:Math.min(2,navigator.hardwareConcurrency||2)},highlighterOptions:{theme:{dark:`pierre-dark`,light:`pierre-light`}}})}function bx(e){let t=[],n=[];for(let r of e.trim().split(/\s+/).filter(Boolean)){let e=r.startsWith(`!`),i=e?r.slice(1):r;i&&(e?n:t).push(xx(i))}return e=>!n.some(t=>t(e))&&t.every(t=>t(e))}function xx(e){if(!/[*?]/.test(e))return t=>ht(e,t);let t=``;for(let n=0;n<e.length;n++){let r=e[n];r===`*`?e[n+1]===`*`?(t+=`.*`,n++):t+=`[^/]*`:t+=r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/,`\\$&`)}try{let e=new RegExp(t,`i`);return t=>e.test(t)}catch{return t=>ht(e,t)}}function Sx(e,t){let n=null,r=()=>{if(!n||t.aborted)return;let i=e().closest(`[data-diff-main]`);if(i){let t=i.getBoundingClientRect(),r=0;if(n.y>=t.bottom-110?r=Math.max(4,Math.min(20,(n.y-(t.bottom-110))/3)):n.y<=t.top+110&&(r=-Math.max(4,Math.min(20,(t.top+110-n.y)/3))),r){i.scrollTop+=r;let a=e().getBoundingClientRect(),o=Math.max(t.top+12,a.top+48),s=Math.min(t.bottom-12,a.bottom-48),c=Math.max(o,Math.min(n.y,s));document.dispatchEvent(new PointerEvent(`pointermove`,{clientX:n.x,clientY:c,pointerId:n.pointerId,pointerType:`touch`,bubbles:!0,composed:!0}))}}requestAnimationFrame(r)};e().addEventListener(`pointerdown`,e=>{e.pointerType!==`mouse`&&e.composedPath().some(e=>e instanceof HTMLElement&&e.hasAttribute?.(`data-column-number`))&&(n={pointerId:e.pointerId,x:e.clientX,y:e.clientY},requestAnimationFrame(r))},{capture:!0,signal:t}),document.addEventListener(`pointermove`,e=>{n&&e.pointerId===n.pointerId&&e.isTrusted&&(n.x=e.clientX,n.y=e.clientY)},{capture:!0,passive:!0,signal:t});for(let e of[`pointerup`,`pointercancel`])document.addEventListener(e,e=>{n&&e.pointerId===n.pointerId&&(n=null)},{capture:!0,signal:t})}function Cx(e){if(e.length<=1)return null;let t=document.createElement(`select`);t.setAttribute(`aria-label`,`Send to session`),t.className=`_hO`;for(let n of e){let e=document.createElement(`option`);e.value=n.id,e.textContent=n.title||n.agent,t.append(e)}return t}var wx=(e,t)=>e?.value||t[0]?.id||null;function Tx(e,t,n){for(let r of e)r.disabled=t,n&&r.dataset.role===`send`&&(r.textContent=t?`Sending…`:n)}function Ex(e,t){let n=document.createElement(`button`);return n.type=`button`,n.textContent=e,n.className=t,n}function Dx(e,t,n,r){if(!t){e.className=`_q ${r?ie:``} _r`,e.textContent=`Send`;let t=n[0];return t&&(e.title=`Send to ${t.title||t.agent}`),e}let i=document.createElement(`span`);return i.className=`_hM ${r?`_io`:``}`,e.className=`_r _hN`,e.textContent=`Send to`,i.append(e,t),i}function Ox(e,t,n){e.onkeydown=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t()),e.key===`Escape`&&(e.preventDefault(),n())}}function kx(e,t,n){let r=document.createElement(`div`);r.className=`_ik`;let i=document.createElement(`div`),a=document.createElement(`div`);a.className=`_in`;let o=()=>{i.replaceChildren(),a.replaceChildren();let r=document.createElement(`p`);r.className=`_il`,r.textContent=e.text;let o=Ex(`Remove`,`_q ${ie}`);o.onclick=()=>n.onDelete(e.id);let c=Ex(`Edit`,`_q ${ie}`);c.hidden=!n.onEdit,c.onclick=()=>s();let l=t.sessions(),u=l.length>0&&!!n.onSend,d=Ex(`Send`,``);d.dataset.role=`send`,d.hidden=!u;let f=u?Cx(l):null,p=f?`Send to`:`Send`;if(d.onclick=()=>{(async()=>{let t=wx(f,l);if(!(!t||d.disabled)){Tx([o,c,d],!0,p);try{await n.onSend?.(e.id,t)}finally{Tx([o,c,d],!1,p)}}})()},a.append(c,o),u&&a.append(Dx(d,f,l,!0)),n.drifted){let e=document.createElement(`span`);e.className=`_N ${Qe.warn} _ip`,e.textContent=`changed since`,e.title=`The file changed here after this comment was written; the agent gets the lines as they were.`,a.append(e)}i.append(r)},s=()=>{i.replaceChildren(),a.replaceChildren();let t=document.createElement(`textarea`);t.value=e.text,t.rows=3,t.className=`_Z _im`;let r=Ex(`Save`,`_q _r`),s=Ex(`Cancel`,`_q`),c=()=>{let i=t.value.trim();if(!i||i===e.text){o();return}(async()=>{Tx([r,s],!0);try{await n.onEdit?.(e.id,i),e.text=i,o()}catch{Tx([r,s],!1)}})()};r.onclick=c,s.onclick=()=>o(),Ox(t,c,o),a.append(r,s),i.append(t),setTimeout(()=>{t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length)},0)};return o(),r.append(i,a),r}function Ax(e,t){let n=document.createElement(`div`);n.className=`_ik`;let r=document.createElement(`textarea`);r.placeholder=`Add a comment…`,r.rows=3,r.className=`_Z _im`;let i=Ex(`Add`,`_q`),a=Ex(`Send`,``);a.dataset.role=`send`;let o=Ex(`Cancel`,`_q`),s=e.sessions(),c=s.length>0&&!!t.onSend;a.hidden=!c;let l=c?Cx(s):null,u=c?Dx(a,l,s,!1):a,d=a.textContent,f=()=>{r.value.trim()&&t.onSave(r.value)},p=()=>{(async()=>{let e=r.value.trim(),n=wx(l,s);if(!(!e||!n||a.disabled)){Tx([i,a,o],!0,d);try{await t.onSend?.(e,n)}finally{Tx([i,a,o],!1,d)}}})()};i.onclick=f,a.onclick=p,o.onclick=()=>t.onCancel(),Ox(r,c?p:f,()=>t.onCancel());let m=document.createElement(`div`);m.className=`_in`,m.append(i),c&&m.append(u),m.append(o),n.append(r,m),r.addEventListener(`focus`,()=>{let t=window.visualViewport;if(!t)return;let i=()=>e.reveal(n,!0);t.addEventListener(`resize`,i),r.addEventListener(`blur`,()=>t.removeEventListener(`resize`,i),{once:!0})});let h=(e=0)=>{if(!r.isConnected||!r.getClientRects().length){e<120&&requestAnimationFrame(()=>h(e+1));return}r.focus({preventScroll:!0})};return setTimeout(h,0),n}function jx(e,t){let n=new Map;for(let t of e)n.set(t.worktree,[...n.get(t.worktree)||[],t]);let r=[`Review feedback:`],i=0;for(let[e,a]of n){let n=(t||[]).find(t=>t.worktree===e);r.push(``),r.push(Mx(e,n,a));for(let e of a){i++;let t=e.side===`deletions`?`Old`:`New`,n=e.line_start===e.line_end?`line ${e.line_start}`:`lines ${e.line_start}-${e.line_end}`;r.push(``),r.push(`${i}. **${e.path}** (${t} ${n})`);let a=e.snippet;if(a!=null){let e=Px(a);r.push(``),r.push(Fx(`${e}diff\n${a}\n${e}`))}r.push(``),r.push(Fx(e.text))}}return r.join(`
1528
+ `)}var ix=t(n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):r((n||=self).lru_map=n.lru_map||{})})(e,function(e){let t=Symbol(`newer`),n=Symbol(`older`);class r{constructor(e,t){typeof e!=`number`&&(t=e,e=0),this.size=0,this.limit=e,this.oldest=this.newest=void 0,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[t]&&(e===this.oldest&&(this.oldest=e[t]),e[t][n]=e[n]),e[n]&&(e[n][t]=e[t]),e[t]=void 0,e[n]=this.newest,this.newest&&(this.newest[t]=e),this.newest=e)}assign(e){let r,a=this.limit||Number.MAX_VALUE;this._keymap.clear();let o=e[Symbol.iterator]();for(let e=o.next();!e.done;e=o.next()){let o=new i(e.value[0],e.value[1]);if(this._keymap.set(o.key,o),r?(r[t]=o,o[n]=r):this.oldest=o,r=o,a--==0)throw Error(`overflow`)}this.newest=r,this.size=this._keymap.size}get(e){var t=this._keymap.get(e);return t?(this._markEntryAsUsed(t),t.value):void 0}set(e,r){var a=this._keymap.get(e);return a?(a.value=r,this._markEntryAsUsed(a),this):(this._keymap.set(e,a=new i(e,r)),this.newest?(this.newest[t]=a,a[n]=this.newest):this.oldest=a,this.newest=a,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var e=this.oldest;if(e)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[n]=void 0):(this.oldest=void 0,this.newest=void 0),e[t]=e[n]=void 0,this._keymap.delete(e.key),--this.size,[e.key,e.value]}find(e){let t=this._keymap.get(e);return t?t.value:void 0}has(e){return this._keymap.has(e)}delete(e){var r=this._keymap.get(e);return r?(this._keymap.delete(r.key),r[t]&&r[n]?(r[n][t]=r[t],r[t][n]=r[n]):r[t]?(r[t][n]=void 0,this.oldest=r[t]):r[n]?(r[n][t]=void 0,this.newest=r[n]):this.oldest=this.newest=void 0,this.size--,r.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new o(this.oldest)}values(){return new s(this.oldest)}entries(){return this}[Symbol.iterator](){return new a(this.oldest)}forEach(e,n){typeof n!=`object`&&(n=this);let r=this.oldest;for(;r;)e.call(n,r.value,r.key,this),r=r[t]}toJSON(){for(var e=Array(this.size),n=0,r=this.oldest;r;)e[n++]={key:r.key,value:r.value},r=r[t];return e}toString(){for(var e=``,n=this.oldest;n;)e+=String(n.key)+`:`+n.value,n=n[t],n&&(e+=` < `);return e}}e.LRUMap=r;function i(e,r){this.key=e,this.value=r,this[t]=void 0,this[n]=void 0}function a(e){this.entry=e}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}};function o(e){this.entry=e}o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.key}):{done:!0,value:void 0}};function s(e){this.entry=e}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.value}):{done:!0,value:void 0}}})}))(),1),ax=Symbol(`IGNORE_RESPONSE`),ox=1e4,sx=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},cx=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`)}},lx=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=L,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s=`shiki-js`}){this.options=e,this.preferredHighlighter=s,this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new ix.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new ix.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed}getFileResultCache(e){return e.cacheKey==null?void 0:this.fileCache.get(e.cacheKey)}getDiffResultCache(e){return e.cacheKey==null?void 0:this.diffCache.get(e.cacheKey)}inspectCaches(){let{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??L,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:n=this.renderOptions.lineDiffType??`word-alt`,maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){let{lifecycleGeneration:a}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(a)&&this.renderOptionsRequestVersion===o;try{let a={theme:e,useTokenTransformer:t,lineDiffType:n,maxLineDiffLength:r,tokenizeMaxLineLength:i};if(this.isInitialized()||await this.initialize(),!s()||R_(a,this.renderOptions))return;let o=Rp(e),c=[];if(an(a.theme,this.renderOptions.theme)||(c=Bp(o)?Jb(o):await Yb(o)),!s())return;if(this.highlighter!=null)lp(c,this.highlighter);else{let e=await Fp({themes:o,langs:[`text`],preferredHighlighter:this.preferredHighlighter});if(!s())return;this.highlighter=e}let l=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let e of this.themeSubscribers)e.onThemeChange();await l}catch(e){if(e instanceof sx||!s())return;throw e}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:n}=this.renderOptions;return{theme:t,useTokenTransformer:n,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();let n=[];for(let r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),Error(`setRenderOptionsOnWorkers: Somehow we have an uninitialized worker`);n.push(new Promise((n,i)=>{let a=this.generateRequestId(),o={type:`set-render-options`,id:a,request:{type:`set-render-options`,id:a,renderOptions:e,resolvedThemes:t},resolve:n,reject:i,requestStart:Date.now()};this.activeTaskById.set(a,o),r.pendingSetupRequestId=a,r.worker.postMessage(o.request)}))}await Promise.all(n)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast??=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);let e=this.getStats();for(let t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);let t=this.activeRequestByInstance.get(e);if(t!=null){let n=this.activeTaskById.get(t);fx(n)?(this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeActiveTask(n)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized!==!0){if(this.initialized===!1){let{lifecycleGeneration:t}=this;this.initialized=new Promise((n,r)=>{(async()=>{try{let r=Rp(this.renderOptions.theme),i=[];if(i=Bp(r)?Jb(r):await Yb(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=Kb(e)?Gb(e):await qb(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([Fp({themes:r,langs:[`text`,...e],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(i,a)]);if(!this.isCurrentLifecycle(t)){this.terminateWorkers(),n();return}this.highlighter=o,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),n()}catch(e){if(e instanceof sx||!this.isCurrentLifecycle(t)){n();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,mx(e));this.queueBroadcastStateChanges(),r(e)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=em(),i=r>0?tm():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){let a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set([`text`,...t.map(({name:e})=>e)]),customExtensionsVersion:0};a.addEventListener(`message`,e=>{this.handleWorkerMessage(o,e.data)}),a.addEventListener(`error`,e=>this.handleWorkerError(o,e)),this.workers.push(o),n.push(new Promise((n,a)=>{let s=this.generateRequestId(),c={type:`initialize`,id:s,request:{type:`initialize`,id:s,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:i==null?void 0:r,customExtensionMap:i},resolve(){o.initialized=!0,n()},reject:a,requestStart:Date.now()};o.pendingSetupRequestId=s,this.activeTaskById.set(s,c),this.executeTask(o,c)}))}let a=this.options.workerInitializationTimeout??ox,o;try{await Promise.race([Promise.all(n),new Promise((e,t)=>{o=setTimeout(()=>{t(Error(`WorkerPoolManager: worker initialization timed out after ${a}ms`))},a)})])}finally{o!=null&&clearTimeout(o)}}handleWorkerError(e,t){console.error(`Worker error:`,t,e);let{pendingSetupRequestId:n}=e;if(n==null)return;let r=this.activeTaskById.get(n);r?.type===`initialize`&&(r.reject(mx(t)),this.cleanWorkerAndTask(e,r))}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized===!0&&this.queuedTasks.length!==0){for(let e=0;e<this.queuedTasks.length;){let t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}let n=dx(t),r=this.getAvailableWorker(n);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,n)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){let n=this.getFileResultCache(t);Zm(t)||n!=null&&Vp(n.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:`file`,file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeFileHighlightCache: worker pool is not working`));let t=this.getOrCreateFileHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateFileHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`);return}let t=this.getFileResultCache(e),n=this.getFileHighlightKey(e);if(n==null||Zm(e)||t!=null&&Vp(t.options,this.getFileRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`file`?r:void 0;{let t=this.submitCacheTask({type:`file`,file:e},n);return t.type===`file`?t:void 0}}getPlainFileAST(e,t,n,r){if(this.highlighter==null){this.queueInitialization();return}return Vm(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);uy(t)||n!=null&&R_(n.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:`diff`,diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeDiffHighlightCache: worker pool is not working`));let t=this.getOrCreateDiffHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateDiffHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`);return}let t=this.getDiffResultCache(e),n=this.getDiffHighlightKey(e);if(n==null||uy(e)||t!=null&&R_(t.options,this.getDiffRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`diff`?r:void 0;{let t=this.submitCacheTask({type:`diff`,diff:e},n);return t.type===`diff`?t:void 0}}getPlainDiffAST(e,t,n,r,i){return this.highlighter==null?void 0:mv(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let e=new sx;for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(e=>{console.error(e)})}cancelActiveWorkerTasks(){let e=new sx;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):fx(t)&&this.rejectRenderTaskCallbacks(t,e)}terminateWorkers(){for(let e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?`waiting`:this.initialized===!0?`initialized`:`initializing`,totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.getHighlightKeyForRequest(t),r=n==null?void 0:this.getTaskByHighlightKey(n);if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);let i=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(t.type){case`file`:return{type:`file`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a};case`diff`:return{type:`diff`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a}}})();this.enqueueRenderTask(s,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:i}=this,a=(()=>{switch(e.type){case`file`:return{type:`file`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r};case`diff`:return{type:`diff`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r}}})();return this.enqueueRenderTask(a),a}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,n){try{let r=n.filter(t=>!e.langs.has(t));if(r.length>0&&(Kb(r)?t.request.resolvedLanguages=Gb(r):t.request.resolvedLanguages=await qb(r)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch(n){this.rejectRenderTaskCallbacks(t,mx(n)),this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){let n=this.activeTaskById.get(t.id);try{if(n==null)throw ax;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(fx(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}switch(t.requestType){case`initialize`:if(n.type!==`initialize`)throw Error(`handleWorkerMessage: task/response dont match`);this.syncCustomExtensionVersion(e,n.request),n.resolve();break;case`set-render-options`:if(n.type!==`set-render-options`)throw Error(`handleWorkerMessage: task/response dont match`);n.resolve();break;case`file`:{if(n.type!==`file`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!Vp(i,this.getFileRenderOptions()))throw ax;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.fileCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyFileInstances(n,r,i);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!R_(i,this.getDiffRenderOptions()))throw ax;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.diffCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyDiffInstances(n,r,i);break}}}catch(e){e!==ax&&console.error(e,n,t)}this.cleanWorkerAndTask(e,n,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain??(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,fx(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,n=t?.id){e.requestId===n&&(e.requestId=void 0),e.pendingSetupRequestId===n&&(e.pendingSetupRequestId=void 0),t!=null&&(fx(t)&&(this.rejectRenderTaskCallbacks(t,new cx),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){ux(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);for(let n of dx(t))e.langs.add(n);try{t.type===`file`?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type===`diff`&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(n){console.error(`Failed to post message to worker:`,n),fx(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,mx(n))):`reject`in t&&t.reject(n),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;let n=em();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=tm())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(let n of this.workers){if(n.requestId!=null||n.pendingSetupRequestId!=null||!n.initialized)continue;if(t=n,e.length===0)break;let r=!0;for(let t of e)if(!n.langs.has(t)){r=!1;break}if(r)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case`file`:return this.getFileHighlightKey(e.file);case`diff`:return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(let t of px(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){let n=this.queuedTaskByInstance.get(e);n!=null&&n!==t&&(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeQueuedTask(n))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){let t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.rejectRenderTaskCallbacks(e,new cx),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new cx),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,n)=>{e.callbacks.add({resolve:t,reject:n})})}resolveRenderTaskCallbacks(e){for(let t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(let n of e.callbacks)n.reject(t);e.callbacks.clear()}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){let t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(let e of Array.from(this.activeTaskById.values()))fx(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of px(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(let t of px(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of px(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,n)}notifyDiffInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,n)}notifyHighlightError(e,t){for(let n of px(e))this.activeRequestByInstance.get(n)===e.id&&n.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`file`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&eg(t,n.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`diff`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&W(n.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){let t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let e of this.queuedTasks)yield e;for(let e of this.activeTaskById.values())fx(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function ux(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function dx(e){let t=new Set;if(e.type===`initialize`||e.type===`set-render-options`)return[];switch(e.type){case`file`:t.add(e.request.file.lang??$p(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??$p(e.request.diff.name)),t.add(e.request.diff.lang??$p(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function fx(e){return e?.type===`file`||e?.type===`diff`}function px(e){return e.instances}function mx(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){if(`error`in e&&e.error instanceof Error)return e.error;if(`message`in e&&typeof e.message==`string`)return Error(e.message)}return Error(String(e))}var hx;function gx({poolOptions:e,highlighterOptions:t}){return hx??=new lx(e,t),hx}var _x=`/assets/worker-C0KwUb8K.js`,vx;function yx(){return vx??=gx({poolOptions:{workerFactory:()=>new Worker(_x,{type:`module`}),poolSize:Math.min(2,navigator.hardwareConcurrency||2)},highlighterOptions:{theme:{dark:`pierre-dark`,light:`pierre-light`}}})}function bx(e){let t=[],n=[];for(let r of e.trim().split(/\s+/).filter(Boolean)){let e=r.startsWith(`!`),i=e?r.slice(1):r;i&&(e?n:t).push(xx(i))}return e=>!n.some(t=>t(e))&&t.every(t=>t(e))}function xx(e){if(!/[*?]/.test(e))return t=>ht(e,t);let t=``;for(let n=0;n<e.length;n++){let r=e[n];r===`*`?e[n+1]===`*`?(t+=`.*`,n++):t+=`[^/]*`:t+=r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/,`\\$&`)}try{let e=new RegExp(t,`i`);return t=>e.test(t)}catch{return t=>ht(e,t)}}function Sx(e,t){let n=null,r=()=>{if(!n||t.aborted)return;let i=e().closest(`[data-diff-main]`);if(i){let t=i.getBoundingClientRect(),r=0;if(n.y>=t.bottom-110?r=Math.max(4,Math.min(20,(n.y-(t.bottom-110))/3)):n.y<=t.top+110&&(r=-Math.max(4,Math.min(20,(t.top+110-n.y)/3))),r){i.scrollTop+=r;let a=e().getBoundingClientRect(),o=Math.max(t.top+12,a.top+48),s=Math.min(t.bottom-12,a.bottom-48),c=Math.max(o,Math.min(n.y,s));document.dispatchEvent(new PointerEvent(`pointermove`,{clientX:n.x,clientY:c,pointerId:n.pointerId,pointerType:`touch`,bubbles:!0,composed:!0}))}}requestAnimationFrame(r)};e().addEventListener(`pointerdown`,e=>{e.pointerType!==`mouse`&&e.composedPath().some(e=>e instanceof HTMLElement&&e.hasAttribute?.(`data-column-number`))&&(n={pointerId:e.pointerId,x:e.clientX,y:e.clientY},requestAnimationFrame(r))},{capture:!0,signal:t}),document.addEventListener(`pointermove`,e=>{n&&e.pointerId===n.pointerId&&e.isTrusted&&(n.x=e.clientX,n.y=e.clientY)},{capture:!0,passive:!0,signal:t});for(let e of[`pointerup`,`pointercancel`])document.addEventListener(e,e=>{n&&e.pointerId===n.pointerId&&(n=null)},{capture:!0,signal:t})}function Cx(e){if(e.length<=1)return null;let t=document.createElement(`select`);t.setAttribute(`aria-label`,`Send to session`),t.className=`_h8`;for(let n of e){let e=document.createElement(`option`);e.value=n.id,e.textContent=n.title||n.agent,t.append(e)}return t}var wx=(e,t)=>e?.value||t[0]?.id||null;function Tx(e,t,n){for(let r of e)r.disabled=t,n&&r.dataset.role===`send`&&(r.textContent=t?`Sending…`:n)}function Ex(e,t){let n=document.createElement(`button`);return n.type=`button`,n.textContent=e,n.className=t,n}function Dx(e,t,n,r){if(!t){e.className=`_q ${r?ie:``} _r`,e.textContent=`Send`;let t=n[0];return t&&(e.title=`Send to ${t.title||t.agent}`),e}let i=document.createElement(`span`);return i.className=`_h6 ${r?`_iI`:``}`,e.className=`_r _h7`,e.textContent=`Send to`,i.append(e,t),i}function Ox(e,t,n){e.onkeydown=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t()),e.key===`Escape`&&(e.preventDefault(),n())}}function kx(e,t,n){let r=document.createElement(`div`);r.className=`_iE`;let i=document.createElement(`div`),a=document.createElement(`div`);a.className=`_iH`;let o=()=>{i.replaceChildren(),a.replaceChildren();let r=document.createElement(`p`);r.className=`_iF`,r.textContent=e.text;let o=Ex(`Remove`,`_q ${ie}`);o.onclick=()=>n.onDelete(e.id);let c=Ex(`Edit`,`_q ${ie}`);c.hidden=!n.onEdit,c.onclick=()=>s();let l=t.sessions(),u=l.length>0&&!!n.onSend,d=Ex(`Send`,``);d.dataset.role=`send`,d.hidden=!u;let f=u?Cx(l):null,p=f?`Send to`:`Send`;if(d.onclick=()=>{(async()=>{let t=wx(f,l);if(!(!t||d.disabled)){Tx([o,c,d],!0,p);try{await n.onSend?.(e.id,t)}finally{Tx([o,c,d],!1,p)}}})()},a.append(c,o),u&&a.append(Dx(d,f,l,!0)),n.drifted){let e=document.createElement(`span`);e.className=`_N ${Qe.warn} _iJ`,e.textContent=`changed since`,e.title=`The file changed here after this comment was written; the agent gets the lines as they were.`,a.append(e)}i.append(r)},s=()=>{i.replaceChildren(),a.replaceChildren();let t=document.createElement(`textarea`);t.value=e.text,t.rows=3,t.className=`_Z _iG`;let r=Ex(`Save`,`_q _r`),s=Ex(`Cancel`,`_q`),c=()=>{let i=t.value.trim();if(!i||i===e.text){o();return}(async()=>{Tx([r,s],!0);try{await n.onEdit?.(e.id,i),e.text=i,o()}catch{Tx([r,s],!1)}})()};r.onclick=c,s.onclick=()=>o(),Ox(t,c,o),a.append(r,s),i.append(t),setTimeout(()=>{t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length)},0)};return o(),r.append(i,a),r}function Ax(e,t){let n=document.createElement(`div`);n.className=`_iE`;let r=document.createElement(`textarea`);r.placeholder=`Add a comment…`,r.rows=3,r.className=`_Z _iG`;let i=Ex(`Add`,`_q`),a=Ex(`Send`,``);a.dataset.role=`send`;let o=Ex(`Cancel`,`_q`),s=e.sessions(),c=s.length>0&&!!t.onSend;a.hidden=!c;let l=c?Cx(s):null,u=c?Dx(a,l,s,!1):a,d=a.textContent,f=()=>{r.value.trim()&&t.onSave(r.value)},p=()=>{(async()=>{let e=r.value.trim(),n=wx(l,s);if(!(!e||!n||a.disabled)){Tx([i,a,o],!0,d);try{await t.onSend?.(e,n)}finally{Tx([i,a,o],!1,d)}}})()};i.onclick=f,a.onclick=p,o.onclick=()=>t.onCancel(),Ox(r,c?p:f,()=>t.onCancel());let m=document.createElement(`div`);m.className=`_iH`,m.append(i),c&&m.append(u),m.append(o),n.append(r,m),r.addEventListener(`focus`,()=>{let t=window.visualViewport;if(!t)return;let i=()=>e.reveal(n,!0);t.addEventListener(`resize`,i),r.addEventListener(`blur`,()=>t.removeEventListener(`resize`,i),{once:!0})});let h=(e=0)=>{if(!r.isConnected||!r.getClientRects().length){e<120&&requestAnimationFrame(()=>h(e+1));return}r.focus({preventScroll:!0})};return setTimeout(h,0),n}function jx(e,t){let n=new Map;for(let t of e)n.set(t.worktree,[...n.get(t.worktree)||[],t]);let r=[`Review feedback:`],i=0;for(let[e,a]of n){let n=(t||[]).find(t=>t.worktree===e);r.push(``),r.push(Mx(e,n,a));for(let e of a){i++;let t=e.side===`deletions`?`Old`:`New`,n=e.line_start===e.line_end?`line ${e.line_start}`:`lines ${e.line_start}-${e.line_end}`;r.push(``),r.push(`${i}. **${e.path}** (${t} ${n})`);let a=e.snippet;if(a!=null){let e=Px(a);r.push(``),r.push(Fx(`${e}diff\n${a}\n${e}`))}r.push(``),r.push(Fx(e.text))}}return r.join(`
1529
1529
  `)}function Mx(e,t,n){if(t?.head){let n=Nx(t.head),r=t.baseSha?Nx(t.baseSha):``,i=t.pr?.headRefName||t.branch||`HEAD`;return`${e}/${t.pr?` #${t.pr.number}`:``}: \`${i}\` ${n}${t.base?` vs \`${t.base}\` ${r}`:``}`}let r=[...new Set(n.map(e=>e.head).filter(Boolean))];return r.length?`${e}/: ${r.map(e=>Nx(e)).join(`, `)}`:`${e}/`}function Nx(e,t=12){return e.slice(0,t)}function Px(e){let t=3,n=/`+/g,r;for(;r=n.exec(e);)t=Math.max(t,r[0].length+1);return"`".repeat(t)}function Fx(e){return e.split(`
1530
1530
  `).map(e=>e&&` ${e}`).join(`
1531
- `)}var Ix=`search-mark`,Lx=`mark.${Ix}`,Rx=`mark.${Ix}{display:inline;background:#ffd24a;color:#1a1408;-webkit-text-fill-color:#1a1408;border-radius:3px;padding:0 2px}mark.${Ix} *,mark.${Ix} *::before,mark.${Ix} *::after{color:inherit!important;-webkit-text-fill-color:inherit!important;background:transparent!important}mark.${Ix}.active{background:#ffb000;box-shadow:0 0 0 1px #c98400}`,zx={query:``,hit:null,keys:null},Bx=new Map,Vx=new WeakMap,Hx=(e,t)=>t?`${e}\n${t.line}\n${t.side||``}`:e;function Ux(e,t,n){zx.query=e,zx.hit=t,zx.keys=n?new Set(n):null;for(let[e,t]of Bx)Jx(e,t,!1);t&&Wx(t)}function Wx(e,t=0){requestAnimationFrame(()=>{requestAnimationFrame(()=>{let n=!1;for(let[r,i]of Bx)if(i===e.key&&(n=!0,qx(r,e)||t>=40))return;t>=40||(!n||t<12)&&setTimeout(()=>Wx(e,t+1),n?32:48)})})}function Gx(e,t,n){let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();if(i.height===0&&i.width===0)return!1;if(n===`y`){let t=i.top-r.top+e.scrollTop-(r.height/2-i.height/2);return e.scrollTo({top:Math.max(0,t)}),!0}if(e.scrollWidth<=e.clientWidth+1)return!0;let a=Math.min(24,r.width/8);if(i.left>=r.left+a&&i.right<=r.right-a)return!0;let o=i.left-r.left+e.scrollLeft-(r.width/2-i.width/2),s=Math.max(0,e.scrollWidth-e.clientWidth);return e.scrollTo({left:Math.max(0,Math.min(o,s))}),!0}function Kx(e,t){let n=t.parentElement,r=e;for(;r&&r!==n;){if(r instanceof HTMLElement&&r.scrollWidth>r.clientWidth+1){let e=getComputedStyle(r).overflowX;if(e===`auto`||e===`scroll`)return r}let e=r.getRootNode(),t=r.parentElement??(e instanceof ShadowRoot?e.host:null);if(t===r)break;r=t}return null}function qx(e,t){let n=e.querySelector(`diffs-container`)?.shadowRoot;if(!n)return!1;let r=n.querySelector(`mark.search-mark.active`)??(()=>{if(t.line<1)return null;let e=[...n.querySelectorAll(`[data-line="${t.line}"]`)],r=t.side||`additions`;return e.find(e=>Qx(e)===r)??e[0]??null})();if(!r)return!1;let i=e.closest(`[data-diff-main]`);if(i){if(!Gx(i,r,`y`))return!1}else r.scrollIntoView({block:`center`,inline:`nearest`});let a=Kx(r,e);return a&&Gx(a,r,`x`),!0}function Jx(e,t,n=!0){let r=t&&zx.hit?.key===t?zx.hit:null,i=zx.query.trim(),a=!!i&&!!zx.keys&&!!t&&!zx.keys.has(t),o=a?``:Hx(i,r);!n&&Vx.get(e)===o||(Vx.set(e,o),rS(e,a?``:i,r),r&&Wx(r))}function Yx(e,t){return Bx.set(e,t),Jx(e,t),()=>{Bx.delete(e),Vx.delete(e)}}function Xx(e){Jx(e,Bx.get(e))}function Zx(e){let t=e.querySelectorAll(Lx);if(!t.length)return;let n=new Set;for(let e of[...t])e.parentElement&&n.add(e.parentElement),e.replaceWith(...e.childNodes);for(let e of n)e.normalize()}function Qx(e){let t=e.closest(`[data-code]`);return t?.hasAttribute(`data-deletions`)?`deletions`:t?.hasAttribute(`data-additions`)?`additions`:(e.getAttribute(`data-line-type`)||``).includes(`deletion`)?`deletions`:`additions`}function $x(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let e=t.nextNode();e;e=t.nextNode())e.parentElement?.closest(Lx)||n.push(e);return n}function eS(e,t,n){let r=0;for(let i=0;i<e.length;i++){let a=t[i].length;if(n<=r+a)return{node:e[i],offset:Math.min(a,Math.max(0,n-r))};r+=a}let i=e.at(-1);return i?{node:i,offset:t.at(-1)?.length??0}:null}function tS(e,t,n,r,i){let a=eS(e,t,n),o=eS(e,t,r);if(!a||!o)return;let s=document.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset);let c=document.createElement(`mark`);c.className=i;try{c.append(s.extractContents()),s.insertNode(c)}catch{}}function nS(e,t,n,r){let i=$x(e);if(!i.length)return;let a=i.map(e=>e.textContent??``),o=a.join(``),s=n?o:o.toLowerCase(),c=[];for(let e=s.indexOf(t);e!==-1;e=s.indexOf(t,e+t.length))c.push([e,e+t.length]);if(!c.length)return;let l=Qx(e),u=Number(e.getAttribute(`data-line`)),d=r&&r.line===u&&(r.side||`additions`)===l?`${Ix} active`:Ix;for(let e=c.length-1;e>=0;e--)tS(i,a,c[e][0],c[e][1],d)}function rS(e,t,n){let r=[e],i=e.shadowRoot??e.querySelector(`diffs-container`)?.shadowRoot;i&&r.push(i);let a=t.trim(),o=/[A-Z]/.test(a),s=a&&!o?a.toLowerCase():a;for(let e of r)if(Zx(e),s)for(let t of e.querySelectorAll(`[data-code] [data-line]`)){let e=t.textContent||``;(o?e:e.toLowerCase()).includes(s)&&nS(t,s,o,n)}}var iS=`_go _5 _l`,aS=`_gv _ed`,oS=`<span><button type=button title="Copy comments as markdown"> </button><!></span>`,sS=` D D l%l`,cS=(e,t)=>S(e.a,`value`,t),lS=s(7,e=>m(e.b,e.f||e.g)),uS=j(5,lS),dS=j(6,lS),fS=(e,t)=>{cS(e,t[0]?.id),uS(e,t[0]?.title),dS(e,t[0]?.agent)},pS=c(3,1,e=>{S(e.b,`disabled`,e._.k),m(e.c,e._.k?`Sending…`:`Send to`),S(e.d,`disabled`,e._.k)}),mS=r(`i2`,e=>{o(e.b,`click`,function(){(async()=>{if(!(!e._.s||e._.k)){ES(e._,!0);try{await e._.i(e._.s)}finally{ES(e._,!1)}}})()}),b(e,`d`)}),hS=e=>{pS._(e),gS._(e),vS._(e),_(e.a,`_hM`),_(e.b,[`_r`,`_hN`]),_(e.d,`_hO`),mS(e)},gS=c(3,1,e=>k(e,`d`,e._.l,BS(e))),_S=i(3,`<option> </option>`,` D `,0,fS),vS=c(3,1,e=>_S(e,[e._.m,`id`])),yS=s(2,e=>m(e.b,e._.k?`Sending…`:`Send to ${e._.q||e._.r}`),2),bS=c(3,0,e=>{S(e.a,`disabled`,e._.k),yS(e)}),xS=r(`i1`,e=>o(e.a,`click`,function(){(async()=>{if(!(!e._.s||e._.k)){ES(e._,!0);try{await e._.i(e._.s)}finally{ES(e._,!1)}}})()})),SS=e=>{bS._(e),CS._(e),wS._(e),_(e.a,[`_q`,`_r`]),xS(e)},CS=c(3,0,yS),wS=c(3,0,yS),TS=l(9,e=>m(e.c,e.j?`Copied`:`Copy`)),ES=l(10,e=>{bS(e),pS(e)}),DS=j(18),OS=s(13,e=>DS(e,e.m.some(t=>t.id===e.l)?e.l:e.m[0]?.id??null)),kS=l(11,e=>{OS(e),gS(e)}),AS=r(`i3`,e=>o(e.b,`click`,function(){(async()=>{await e.h()&&(TS(e,!0),setTimeout(()=>{TS(e,!1)},1500))})()}));function jS(e){_(e.a,`_hL`),_(e.b,`_q`),TS(e,!1),ES(e,!1),kS(e,null),AS(e)}var MS=j(12,e=>{NS(e,e.m[0]?.title),PS(e,e.m[0]?.agent),IS(e,e.m.length),OS(e),vS(e)}),NS=j(16,CS),PS=j(17,wS),FS=C(3,`<button type=button> </button>`,` D `,SS,`<span><button type=button> </button><select aria-label="Send comments to session"></select></span>`,` D D l `,hS),IS=(e,t)=>FS(e,t===1?0:t?1:2),LS=(e,t)=>MS(e,t||[]),RS=j(7),zS=j(8),BS=e=>t=>{kS(e._,t)};d(`i0`,BS);var VS=40,HS;function US(e){return e.length>=200?null:[...new Set(e.map(e=>e.key))]}function WS(e,t){let n=t.trim();if(!n)return[];if(HS&&HS.files===e&&HS.query===n)return HS.hits;let r=qS(e,n);return HS={files:e,query:n,hits:r},r}var GS=new WeakMap;function KS(e){let t=GS.get(e);if(!t){let n={additions:new Set,deletions:new Set};if(e.fileDiff){let n=tx(e.fileDiff,`additions`),r=tx(e.fileDiff,`deletions`),i=e=>{let t=[];for(let[n,r]of e)t[n-1]=r;return t};t={visible:{additions:new Set(n.keys()),deletions:new Set(r.keys())},newLines:i(n),oldLines:i(r)}}else t={visible:n,newLines:null,oldLines:null};GS.set(e,t)}return t}function qS(e,t){let n=/[A-Z]/.test(t),r=n?t:t.toLowerCase(),i=!/[^\x00-\x7f]/.test(r),a=[];for(let t of e){if(a.length>=200)break;let e=a.length;if(i&&!(n?t.patch??``:(t.patch??``).toLowerCase()).includes(r)){JS(t.path,r,n)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path});continue}let{visible:o,newLines:s,oldLines:c}=KS(t),l=new Set;YS(t,s,`additions`,r,n,l,a,o.additions),YS(t,c,`deletions`,r,n,l,a,o.deletions),a.length===e&&JS(t.path,r,n)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path})}return a}function JS(e,t,n){let r=n?e:e.toLowerCase();if(!r.includes(t))return!1;let i=e.lastIndexOf(`/`),a=i>=0?e.slice(i+1):e,o=a.lastIndexOf(`.`);if(o<=0)return!0;let s=a.slice(o+1);if(!(n?s:s.toLowerCase()).includes(t))return!0;let c=e.length-s.length;for(let e=r.indexOf(t);e!==-1;e=r.indexOf(t,e+1))if(e<c)return!0;return!1}function YS(e,t,n,r,i,a,o,s){if(!t||o.length>=200||!s.size)return;let c=0;for(let l=0;l<t.length;l++){if(o.length>=200||c>=VS)return;let u=l+1;if(!s.has(u))continue;let d=t[l];if(d==null)continue;let f=(i?d:d.toLowerCase()).indexOf(r);f<0||n===`deletions`&&a.has(d)||(n===`additions`&&a.add(d),c++,o.push({key:e.key,path:e.path,repo:e.repo,line:u,side:n,preview:XS(d,f,r.length)}))}}function XS(e,t,n){let r=Math.max(0,t-36),i=Math.min(e.length,t+n+36);return(r>0?`…`:``)+e.slice(r,i)+(i<e.length?`…`:``)}var ZS=((e,t,n,r)=>`<div><span aria-hidden=true>${e}</span><input type=search enterkeyhint=search autocomplete=off placeholder="Find in review" aria-label="Find in review"><span> </span><button type=button title="Previous match">${t}</button><button type=button title="Next match">${n}</button><button type=button title="Close find">${r}</button></div>`)(ae,we,Ye,_t),QS=((e,t,n,r)=>` D D/${e}&l b D l D/${t}&l D/${n}&l D/${r}&m`)(ve,re,Ie,He),$S=r(`h8`,e=>e.ah=!!e.a1),eC=s(44,$S),tC=r(`h7`,e=>a(e,{onMount:function(){let t=new AbortController;return document.addEventListener(`keydown`,t=>{if(!e.ah)return;if(t.key===`Escape`){if(document.querySelector(`dialog[open]`)||t.target instanceof HTMLTextAreaElement)return;if(e.y){(e.a4||``).trim()&&(t.preventDefault(),e.as(``));return}t.preventDefault(),e.av();return}let n=t.metaKey||t.ctrlKey;(t.key===`F3`||n&&t.key.toLowerCase()===`g`)&&(t.preventDefault(),e.au(t.shiftKey?-1:1))},{signal:t.signal}),e.an=e.z,e.ao=!!e.a1,e.a1&&!e.y&&e.aw(),{abort:t}},onUpdate:function(){e.z!==e.an&&(e.an=e.z,e.a1&&e.aw()),e.a1&&!e.ao?(e.ao=!0,e.y||e.aw()):!e.a1&&e.ao&&(e.ao=!1,e.al&&=(clearTimeout(e.al),0),Ux(``,null),yC(e,{query:``,hit:null,keys:[]}))},onDestroy:function(){e.al&&clearTimeout(e.al),this.abort.abort(),Ux(``,null),yC(e,{query:``,hit:null,keys:[]})}})),nC=s(59,tC,11),rC=s(29,e=>_(e.a,[`_ei`,e.a0&&`_er`,!e.a1&&`_eh`])),iC=s(41,e=>m(e.f,e.a1&&(e.a4||``).trim()?e.ab?`${e.ae+1}/${e.ab}`:`0/0`:``),3),aC=s(38,e=>{S(e.g,`disabled`,!e.ab||!e.a1),S(e.i,`disabled`,!e.ab||!e.a1)}),oC=u(27,e=>{S(e.a,`aria-hidden`,e.a1?`false`:`true`),S(e.d,`tabindex`,e.a1?0:-1),S(e.g,`tabindex`,e.a1?0:-1),S(e.i,`tabindex`,e.a1?0:-1),S(e.k,`tabindex`,e.a1?0:-1),eC(e),nC(e),rC(e),iC(e),aC(e)}),sC=s(16,e=>oC(e,e.o,e.p)),cC=j(14,sC),lC=j(15,sC),uC=(e,t)=>FC(e,t?.length),dC=s(32,e=>uC(e,WS(e.x,e.a4||``))),fC=j(56,nC),pC=s(53,e=>fC(e,KC(e)),4),mC=s(55,e=>y(e,`d`,e.a4||``,qC(e))),hC=u(30,e=>{dC(e),pC(e),nC(e),mC(e),iC(e)}),gC=s(19,e=>hC(e,e.r,e.s)),_C=j(17,gC),vC=j(18,gC),yC=u(33),bC=s(22,e=>yC(e,e.u,e.v)),xC=j(20,bC),SC=j(21,bC),CC=j(40,e=>{pC(e),iC(e)}),wC=s(39,e=>CC(e,e.ab?Math.min(e.a9,e.ab-1):-1)),TC=j(54,e=>{nC(e),mC(e)}),EC=s(52,e=>TC(e,JC(e)),3),DC=j(51,e=>{EC(e),pC(e)}),OC=s(45,e=>DC(e,YC(e)),2),kC=l(35,e=>{wC(e),OC(e)}),AC=(e,t)=>zC(e,t.open),jC=(e,t)=>{BC(e,t.timer),VC(e,t.tick),HC(e,t.wasOpen)},MC=j(58,e=>{M(e,e.aw),nC(e)}),NC=r(`h6`,e=>{T(e,`d`),o(e.d,`keydown`,function(t){if(e.a1){if(t.key===`Escape`){t.preventDefault(),e.y?e.as(``):e.av();return}t.key===`Enter`&&(t.preventDefault(),e.au(t.shiftKey?-1:1))}}),o(e.g,`mousedown`,function(e){e.preventDefault()}),o(e.g,`click`,function(){e.au(-1)}),o(e.i,`mousedown`,function(e){e.preventDefault()}),o(e.i,`click`,function(){e.au(1)}),o(e.k,`mousedown`,function(e){e.preventDefault()}),o(e.k,`click`,function(){e.av()})});function PC(e){_(e.b,`_ej`),oe(e.c),Te(e.c,13),yt(e.c),_(e.e,`_em`),bt(e.h),Re(e.h,14),xt(e.h),I(e.j),rt(e.j,14),pt(e.j),et(e.l),Ve(e.l,14),ft(e.l),kC(e,0),AC(e,{open:!1}),jC(e,{timer:0,tick:0,wasOpen:!1}),MC(e,XC(e)),NC(e)}var FC=j(37,e=>{wC(e),iC(e),aC(e)}),IC=j(23,e=>{dC(e),OC(e),EC(e)}),LC=j(57,nC),RC=s(48,e=>LC(e,ZC(e))),zC=j(43,e=>{OC(e),EC(e),pC(e),RC(e),eC(e),nC(e)}),BC=j(47,e=>{EC(e),pC(e),RC(e),nC(e)}),VC=j(49,nC),HC=j(50,nC),UC=j(24,e=>{S(e.k,`hidden`,e.y),nC(e)}),WC=j(25,nC),GC=j(26,e=>{_(e.d,[dt,e.a0&&`_et`]),_(e.g,[at,e.a0&&`_eu`]),_(e.i,[at,e.a0&&`_eu`]),_(e.k,[at,e.a0&&`_eu`]),rC(e)}),KC=e=>t=>{e.ah&&(e.al&&=(clearTimeout(e.al),0),e.ap(e.a4||``,(e.ae<0?0:e.ae)+t))},qC=e=>function(t){e.as(t)},JC=e=>t=>{if(!e.ah)return;hC(e,t),kC(e,0);let n=WS(e.x,t);Ux(t,n[0]??null,US(n)??void 0),e.al&&clearTimeout(e.al),e.al=setTimeout(()=>{e.al=0,e.ap(t,0)},80)},YC=e=>(t,n)=>{if(!e.ah)return;let r=WS(e.x,t),i=[...new Set(r.map(e=>e.key))];if(!r.length){kC(e,0),Ux(t,null,i),yC(e,{query:t,hit:null,keys:i});return}kC(e,(n%r.length+r.length)%r.length);let a=r[e.a9];Ux(t,a,US(r)??void 0),yC(e,{query:t,hit:a,keys:i})},XC=e=>()=>{let t=e.d;t&&(t.focus(),t.select(),document.activeElement!==t&&setTimeout(()=>{t.focus(),t.select()},0))},ZC=e=>()=>{oC(e,!1),e.ah=!1,e.al&&=(clearTimeout(e.al),0),Ux(``,null),yC(e,{query:``,hit:null,keys:[]})};d(`h4`,KC),d(`h1`,qC),d(`h3`,JC),d(`h2`,YC),d(`h0`,XC),d(`h5`,ZC);function QC(e){let t=e.replace(/^origin\//,``);return $C(t.includes(`/`)?t.slice(t.lastIndexOf(`/`)+1):t)}function $C(e){return e.replace(/-[a-z0-9]{1,6}$/i,``)||e}function ew(e,t){if(!t)return``;let n=e.replace(/^origin\//,``),r=t.replace(/^origin\//,``);return n.startsWith(`${r}-`)?n.slice(r.length+1):``}function tw(e){let t=$C(e);if(t.length<=20)return t;let n=t.split(`-`);return n.length>1?n[n.length-1]:t}function nw(e,t,n=``,r=``){let i=(e||`base`).replace(/^origin\//,``),a=(t||`HEAD`).replace(/^origin\//,``),o=(n||``).replace(/^origin\//,``),s=!!o&&(a===o||a.startsWith(`${o}-`));return{base:i,head:s?r||QC(o):tw(a),topic:s?ew(a,o):``,title:a===i?i:`${a} vs ${i}`}}function rw(e,t=``,n=``){let r=e.replace(/^origin\//,``);if(!r||r===`HEAD`)return r||`HEAD`;let i=t.replace(/^origin\//,``);if(i&&(r===i||r.startsWith(`${i}-`))){let e=n||QC(i),t=ew(r,i);return t?`${e} [${t}]`:e}return tw(r)}var iw=`_iV _y`,aw=`_i1 _x`,ow=`<div><button type=button title="Scroll to this section"><span> </span></button><!><span><span> </span><span aria-hidden=true>vs</span><span> </span><!></span><!><!><!><!><span><span><!> file<!></span><!><!><!></span></div>`,sw=` D D D m%b D D l b D l%l%b%b%b%b E%c%l%b%b%m`,cw=c(11,0,e=>m(e.b,e._.b4)),lw=e=>{cw._(e),_(e.a,[`_N`,Qe.accent,`_i7`])},uw=s(2,e=>S(e.a,`title`,`${e._.ag?`#${e._.ag.number}`:e._.ak} is already in ${e._.ai}; showing the working tree only`),2),dw=c(14,0,uw),fw=e=>{dw._(e),pw._(e),mw._(e),_(e.a,[`_N`,`_i8`])},pw=c(14,0,e=>{m(e.b,e._.ai),uw(e)}),mw=c(14,0,uw),hw=c(12,0,e=>m(e.b,Nx(e._.at,7))),gw=e=>{hw._(e),_(e.a,[`_N`,`_i8`])},_w=c(4,1,e=>m(e.b,St(e._.as))),vw=e=>{_w._(e),_(e.a,[aw,`_i2`])},yw=s(4,e=>S(e.a,`title`,`${e._.ap}: ${e._.aj} ${e._.aq} vs ${e._.ai} ${e._.ar}`),4),bw=c(4,0,yw),xw=e=>{bw._(e),Sw._(e),Cw._(e),ww._(e),Tw._(e),Ew._(e),Dw._(e),_(e.a,[`_u`,`_v`]),_(e.c,aw)},Sw=c(4,0,yw),Cw=c(4,0,e=>m(e.b,e._.an)),ww=c(4,0,e=>S(e.a,`href`,`${e._.ao}/files`)),Tw=c(4,0,e=>{m(e.d,e._.ap),yw(e)}),Ew=c(4,0,yw),Dw=c(4,0,yw),Ow=c(21,0,e=>m(e.b,e._.ab)),kw=r(`t2`,e=>o(e.a,`click`,function(){e._.ae()})),Aw=e=>{Ow._(e),jw._(e),kw(e)},jw=c(21,0,e=>{_(e.a,[`_i0`,{_iZ:e._.ac}]),S(e.a,`aria-pressed`,e._.ac?`true`:`false`),S(e.a,`title`,e._.ac?`Show every file`:`Show only files changed since your last visit`)}),Mw=c(20,0,e=>m(e.b,e._.a9)),Nw=r(`t1`,e=>o(e.a,`click`,function(){e._.aa()})),Pw=e=>{Mw._(e),_(e.a,`_i0`),Nw(e)},Fw=c(19,0,e=>m(e.b,e._.a6)),Iw=e=>{Fw._(e),Lw._(e),_(e.a,`_iX`),_(e.c,`_iY`)},Lw=c(19,0,e=>m(e.d,e._.a7)),Rw=s(3,e=>m(e.b,rw(e._.ak,e._.z,e._.a0)),2),zw=c(15,0,Rw),Bw=e=>{zw._(e),Vw._(e),Uw._(e),Ww._(e),Gw._(e),Kw._(e),_(e.a,[`_N`,`_i8`])},Vw=c(15,0,Rw),Hw=s(4,e=>S(e.a,`title`,`This view is ${Nx(e._.aq)} (${e._.aj}); checked out is ${Nx(e._.ay)} (${e._.ak})`),3),Uw=c(15,0,Hw),Ww=c(15,0,e=>{Hw(e),Rw(e)}),Gw=c(15,0,Hw),Kw=c(15,0,e=>{m(e.c,Nx(e._.ay,7)),Hw(e)}),qw=c(13,0,e=>S(e.a,`disabled`,e._.a2)),Jw=r(`t0`,e=>o(e.a,`click`,function(){e._.a3()})),Yw=e=>{qw._(e),Zw._(e),Qw._(e),$w._(e),_(e.a,[`_N`,Qe.warn,`_i8`]),Jw(e)},Xw=s(3,e=>S(e.a,`title`,`origin/${e._.aj} ${e._.aq} · GitHub ${e._.av}. Reload to re-ask GitHub`),2),Zw=c(13,0,Xw),Qw=c(13,0,e=>{m(e.b,Nx(e._.aq,7)),Xw(e)}),$w=c(13,0,e=>{m(e.c,Nx(e._.av,7)),Xw(e)}),eT=(e,t)=>{nT(e,t?.pr),dT(e,t?.base),fT(e,t?.branch),pT(e,t?.worktree),hT(e,t?.head),gT(e,t?.baseSha),_T(e,t?.full_name),yT(e,t?.rev),xT(e,t?.githubDrift),wT(e,t?.contained),TT(e,t?.localHead)},tT=C(4,`<a target=_blank rel=noopener>#<!></a><span> </span>`,` Db%l D `,xw,`<span> </span>`,` D `,vw),nT=j(42,e=>{aT(e,e.ag?.baseRefName),oT(e,e.ag?.headRefName),sT(e,e.ag?.number),cT(e,e.ag?.url),lT(e,e.ag?.title),uT(e,e.ag?.headRefOid),tT(e,+!e.ag),dw(e)}),rT=(e,t)=>{OT(e,t?.title),kT(e,t?.base),AT(e,t?.head),MT(e,t?.topic)},iT=s(47,e=>rT(e,nw(e.ah||e.ai,e.aj||e.ak,e.z,e.a0)),5),aT=j(43,iT),oT=j(45,e=>{iT(e),Zw(e),Uw(e),Sw(e)}),sT=j(49,Cw),cT=j(50,ww),lT=j(51,Tw),uT=j(57,$w),dT=j(44,e=>{iT(e),bw(e),pw(e)}),fT=j(46,e=>{iT(e),Ww(e),mw(e)}),pT=j(48,e=>m(e.d,e.am)),mT=s(63,e=>S(e.f,`title`,`${e.b0} · ${e.aq.slice(0,7)}…${e.ar.slice(0,7)}`),2),hT=j(52,e=>{mT(e),Qw(e),Gw(e),Ew(e)}),gT=j(53,e=>{mT(e),Dw(e)}),_T=j(54,_w),vT=C(12,`<span title="One commit against its parent">commit <!></span>`,` Db%`,gw),yT=j(55,e=>{vT(e,+!e.at),hw(e)}),bT=C(13,`<button type=button>behind GitHub <!> → <!></button>`,` Db%c%`,Yw),xT=(e,t)=>bT(e,+!t),ST=C(14,`<span>already in <!></span>`,` Db%`,fw),CT=s(59,e=>ST(e,e.aw&&e.a4?0:1)),wT=j(58,CT),TT=j(60,Kw),ET=e=>{S(e.a,`data-pr`,e.ag?`${e.am}/${e.ag.number}`:void 0)},DT=j(24,e=>{eT(e,e.y),ET(e)}),OT=j(62,mT),kT=(e,t)=>m(e.h,t),AT=(e,t)=>m(e.k,t),jT=C(11,`<span> </span>`,` D `,lw),MT=j(66,e=>{jT(e,+!e.b4),cw(e)}),NT=j(25,e=>{iT(e),zw(e)}),PT=j(26,e=>{iT(e),Vw(e)}),FT=r(`t3`,e=>o(e.b,`click`,function(){e.a1()}));function IT(e){_(e.a,`_iS`),_(e.b,`_iU`),_(e.c,iw),_(e.f,`_i3`),_(e.g,[`_N`,`_i4`]),_(e.i,[`_P`,`_i6`]),_(e.j,[`_N`,`_i5`]),_(e.q,`_iW`),FT(e)}var LT=j(30,e=>{m(e.r,e.a4),m(e.s,e.a4===1?``:`s`),CT(e)}),RT=C(15,`<span>local <!><!></span>`,` Db%b%`,Bw),zT=(e,t)=>RT(e,+!t),BT=C(19,`<span>+<!></span><span>−<!></span>`,` Db%l Db%`,Iw),VT=s(34,e=>BT(e,e.a6||e.a7?0:1)),HT=j(32,e=>{VT(e),Fw(e)}),UT=j(33,e=>{VT(e),Lw(e)}),WT=C(20,`<button type=button title="Filtered out of the list — show every file"><!> hidden</button>`,` D%`,Pw),GT=j(35,e=>{WT(e,+!e.a9),Mw(e)}),KT=C(21,`<button type=button><!> new</button>`,` D%`,Aw),qT=s(39,e=>KT(e,e.ab||e.ac?0:1)),JT=j(37,e=>{qT(e),Ow(e)}),YT=j(38,e=>{qT(e),jw(e)}),XT=j(27),ZT=j(28,qw),QT=j(29),$T=j(36),eE=j(40),tE=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1531
+ `)}var Ix=`search-mark`,Lx=`mark.${Ix}`,Rx=`mark.${Ix}{display:inline;background:#ffd24a;color:#1a1408;-webkit-text-fill-color:#1a1408;border-radius:3px;padding:0 2px}mark.${Ix} *,mark.${Ix} *::before,mark.${Ix} *::after{color:inherit!important;-webkit-text-fill-color:inherit!important;background:transparent!important}mark.${Ix}.active{background:#ffb000;box-shadow:0 0 0 1px #c98400}`,zx={query:``,hit:null,keys:null},Bx=new Map,Vx=new WeakMap,Hx=(e,t)=>t?`${e}\n${t.line}\n${t.side||``}`:e;function Ux(e,t,n){zx.query=e,zx.hit=t,zx.keys=n?new Set(n):null;for(let[e,t]of Bx)Jx(e,t,!1);t&&Wx(t)}function Wx(e,t=0){requestAnimationFrame(()=>{requestAnimationFrame(()=>{let n=!1;for(let[r,i]of Bx)if(i===e.key&&(n=!0,qx(r,e)||t>=40))return;t>=40||(!n||t<12)&&setTimeout(()=>Wx(e,t+1),n?32:48)})})}function Gx(e,t,n){let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();if(i.height===0&&i.width===0)return!1;if(n===`y`){let t=i.top-r.top+e.scrollTop-(r.height/2-i.height/2);return e.scrollTo({top:Math.max(0,t)}),!0}if(e.scrollWidth<=e.clientWidth+1)return!0;let a=Math.min(24,r.width/8);if(i.left>=r.left+a&&i.right<=r.right-a)return!0;let o=i.left-r.left+e.scrollLeft-(r.width/2-i.width/2),s=Math.max(0,e.scrollWidth-e.clientWidth);return e.scrollTo({left:Math.max(0,Math.min(o,s))}),!0}function Kx(e,t){let n=t.parentElement,r=e;for(;r&&r!==n;){if(r instanceof HTMLElement&&r.scrollWidth>r.clientWidth+1){let e=getComputedStyle(r).overflowX;if(e===`auto`||e===`scroll`)return r}let e=r.getRootNode(),t=r.parentElement??(e instanceof ShadowRoot?e.host:null);if(t===r)break;r=t}return null}function qx(e,t){let n=e.querySelector(`diffs-container`)?.shadowRoot;if(!n)return!1;let r=n.querySelector(`mark.search-mark.active`)??(()=>{if(t.line<1)return null;let e=[...n.querySelectorAll(`[data-line="${t.line}"]`)],r=t.side||`additions`;return e.find(e=>Qx(e)===r)??e[0]??null})();if(!r)return!1;let i=e.closest(`[data-diff-main]`);if(i){if(!Gx(i,r,`y`))return!1}else r.scrollIntoView({block:`center`,inline:`nearest`});let a=Kx(r,e);return a&&Gx(a,r,`x`),!0}function Jx(e,t,n=!0){let r=t&&zx.hit?.key===t?zx.hit:null,i=zx.query.trim(),a=!!i&&!!zx.keys&&!!t&&!zx.keys.has(t),o=a?``:Hx(i,r);!n&&Vx.get(e)===o||(Vx.set(e,o),rS(e,a?``:i,r),r&&Wx(r))}function Yx(e,t){return Bx.set(e,t),Jx(e,t),()=>{Bx.delete(e),Vx.delete(e)}}function Xx(e){Jx(e,Bx.get(e))}function Zx(e){let t=e.querySelectorAll(Lx);if(!t.length)return;let n=new Set;for(let e of[...t])e.parentElement&&n.add(e.parentElement),e.replaceWith(...e.childNodes);for(let e of n)e.normalize()}function Qx(e){let t=e.closest(`[data-code]`);return t?.hasAttribute(`data-deletions`)?`deletions`:t?.hasAttribute(`data-additions`)?`additions`:(e.getAttribute(`data-line-type`)||``).includes(`deletion`)?`deletions`:`additions`}function $x(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let e=t.nextNode();e;e=t.nextNode())e.parentElement?.closest(Lx)||n.push(e);return n}function eS(e,t,n){let r=0;for(let i=0;i<e.length;i++){let a=t[i].length;if(n<=r+a)return{node:e[i],offset:Math.min(a,Math.max(0,n-r))};r+=a}let i=e.at(-1);return i?{node:i,offset:t.at(-1)?.length??0}:null}function tS(e,t,n,r,i){let a=eS(e,t,n),o=eS(e,t,r);if(!a||!o)return;let s=document.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset);let c=document.createElement(`mark`);c.className=i;try{c.append(s.extractContents()),s.insertNode(c)}catch{}}function nS(e,t,n,r){let i=$x(e);if(!i.length)return;let a=i.map(e=>e.textContent??``),o=a.join(``),s=n?o:o.toLowerCase(),c=[];for(let e=s.indexOf(t);e!==-1;e=s.indexOf(t,e+t.length))c.push([e,e+t.length]);if(!c.length)return;let l=Qx(e),u=Number(e.getAttribute(`data-line`)),d=r&&r.line===u&&(r.side||`additions`)===l?`${Ix} active`:Ix;for(let e=c.length-1;e>=0;e--)tS(i,a,c[e][0],c[e][1],d)}function rS(e,t,n){let r=[e],i=e.shadowRoot??e.querySelector(`diffs-container`)?.shadowRoot;i&&r.push(i);let a=t.trim(),o=/[A-Z]/.test(a),s=a&&!o?a.toLowerCase():a;for(let e of r)if(Zx(e),s)for(let t of e.querySelectorAll(`[data-code] [data-line]`)){let e=t.textContent||``;(o?e:e.toLowerCase()).includes(s)&&nS(t,s,o,n)}}var iS=`_gC _5 _l`,aS=`_gJ _eb`,oS=`<span><button type=button title="Copy comments as markdown"> </button><!></span>`,sS=` D D l%l`,cS=(e,t)=>S(e.a,`value`,t),lS=s(7,e=>m(e.b,e.f||e.g)),uS=j(5,lS),dS=j(6,lS),fS=(e,t)=>{cS(e,t[0]?.id),uS(e,t[0]?.title),dS(e,t[0]?.agent)},pS=c(3,1,e=>{S(e.b,`disabled`,e._.k),m(e.c,e._.k?`Sending…`:`Send to`),S(e.d,`disabled`,e._.k)}),mS=r(`i2`,e=>{o(e.b,`click`,function(){(async()=>{if(!(!e._.s||e._.k)){ES(e._,!0);try{await e._.i(e._.s)}finally{ES(e._,!1)}}})()}),b(e,`d`)}),hS=e=>{pS._(e),gS._(e),vS._(e),_(e.a,`_h6`),_(e.b,[`_r`,`_h7`]),_(e.d,`_h8`),mS(e)},gS=c(3,1,e=>k(e,`d`,e._.l,BS(e))),_S=i(3,`<option> </option>`,` D `,0,fS),vS=c(3,1,e=>_S(e,[e._.m,`id`])),yS=s(2,e=>m(e.b,e._.k?`Sending…`:`Send to ${e._.q||e._.r}`),2),bS=c(3,0,e=>{S(e.a,`disabled`,e._.k),yS(e)}),xS=r(`i1`,e=>o(e.a,`click`,function(){(async()=>{if(!(!e._.s||e._.k)){ES(e._,!0);try{await e._.i(e._.s)}finally{ES(e._,!1)}}})()})),SS=e=>{bS._(e),CS._(e),wS._(e),_(e.a,[`_q`,`_r`]),xS(e)},CS=c(3,0,yS),wS=c(3,0,yS),TS=l(9,e=>m(e.c,e.j?`Copied`:`Copy`)),ES=l(10,e=>{bS(e),pS(e)}),DS=j(18),OS=s(13,e=>DS(e,e.m.some(t=>t.id===e.l)?e.l:e.m[0]?.id??null)),kS=l(11,e=>{OS(e),gS(e)}),AS=r(`i3`,e=>o(e.b,`click`,function(){(async()=>{await e.h()&&(TS(e,!0),setTimeout(()=>{TS(e,!1)},1500))})()}));function jS(e){_(e.a,`_h5`),_(e.b,`_q`),TS(e,!1),ES(e,!1),kS(e,null),AS(e)}var MS=j(12,e=>{NS(e,e.m[0]?.title),PS(e,e.m[0]?.agent),IS(e,e.m.length),OS(e),vS(e)}),NS=j(16,CS),PS=j(17,wS),FS=C(3,`<button type=button> </button>`,` D `,SS,`<span><button type=button> </button><select aria-label="Send comments to session"></select></span>`,` D D l `,hS),IS=(e,t)=>FS(e,t===1?0:t?1:2),LS=(e,t)=>MS(e,t||[]),RS=j(7),zS=j(8),BS=e=>t=>{kS(e._,t)};d(`i0`,BS);var VS=40,HS;function US(e){return e.length>=200?null:[...new Set(e.map(e=>e.key))]}function WS(e,t){let n=t.trim();if(!n)return[];if(HS&&HS.files===e&&HS.query===n)return HS.hits;let r=qS(e,n);return HS={files:e,query:n,hits:r},r}var GS=new WeakMap;function KS(e){let t=GS.get(e);if(!t){let n={additions:new Set,deletions:new Set};if(e.fileDiff){let n=tx(e.fileDiff,`additions`),r=tx(e.fileDiff,`deletions`),i=e=>{let t=[];for(let[n,r]of e)t[n-1]=r;return t};t={visible:{additions:new Set(n.keys()),deletions:new Set(r.keys())},newLines:i(n),oldLines:i(r)}}else t={visible:n,newLines:null,oldLines:null};GS.set(e,t)}return t}function qS(e,t){let n=/[A-Z]/.test(t),r=n?t:t.toLowerCase(),i=!/[^\x00-\x7f]/.test(r),a=[];for(let t of e){if(a.length>=200)break;let e=a.length;if(i&&!(n?t.patch??``:(t.patch??``).toLowerCase()).includes(r)){JS(t.path,r,n)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path});continue}let{visible:o,newLines:s,oldLines:c}=KS(t),l=new Set;YS(t,s,`additions`,r,n,l,a,o.additions),YS(t,c,`deletions`,r,n,l,a,o.deletions),a.length===e&&JS(t.path,r,n)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path})}return a}function JS(e,t,n){let r=n?e:e.toLowerCase();if(!r.includes(t))return!1;let i=e.lastIndexOf(`/`),a=i>=0?e.slice(i+1):e,o=a.lastIndexOf(`.`);if(o<=0)return!0;let s=a.slice(o+1);if(!(n?s:s.toLowerCase()).includes(t))return!0;let c=e.length-s.length;for(let e=r.indexOf(t);e!==-1;e=r.indexOf(t,e+1))if(e<c)return!0;return!1}function YS(e,t,n,r,i,a,o,s){if(!t||o.length>=200||!s.size)return;let c=0;for(let l=0;l<t.length;l++){if(o.length>=200||c>=VS)return;let u=l+1;if(!s.has(u))continue;let d=t[l];if(d==null)continue;let f=(i?d:d.toLowerCase()).indexOf(r);f<0||n===`deletions`&&a.has(d)||(n===`additions`&&a.add(d),c++,o.push({key:e.key,path:e.path,repo:e.repo,line:u,side:n,preview:XS(d,f,r.length)}))}}function XS(e,t,n){let r=Math.max(0,t-36),i=Math.min(e.length,t+n+36);return(r>0?`…`:``)+e.slice(r,i)+(i<e.length?`…`:``)}var ZS=((e,t,n,r)=>`<div><span aria-hidden=true>${e}</span><input type=search enterkeyhint=search autocomplete=off placeholder="Find in review" aria-label="Find in review"><span> </span><button type=button title="Previous match">${t}</button><button type=button title="Next match">${n}</button><button type=button title="Close find">${r}</button></div>`)(ae,we,Ye,_t),QS=((e,t,n,r)=>` D D/${e}&l b D l D/${t}&l D/${n}&l D/${r}&m`)(ve,re,Ie,He),$S=r(`h8`,e=>e.ah=!!e.a1),eC=s(44,$S),tC=r(`h7`,e=>a(e,{onMount:function(){let t=new AbortController;return document.addEventListener(`keydown`,t=>{if(!e.ah)return;if(t.key===`Escape`){if(document.querySelector(`dialog[open]`)||t.target instanceof HTMLTextAreaElement)return;if(e.y){(e.a4||``).trim()&&(t.preventDefault(),e.as(``));return}t.preventDefault(),e.av();return}let n=t.metaKey||t.ctrlKey;(t.key===`F3`||n&&t.key.toLowerCase()===`g`)&&(t.preventDefault(),e.au(t.shiftKey?-1:1))},{signal:t.signal}),e.an=e.z,e.ao=!!e.a1,e.a1&&!e.y&&e.aw(),{abort:t}},onUpdate:function(){e.z!==e.an&&(e.an=e.z,e.a1&&e.aw()),e.a1&&!e.ao?(e.ao=!0,e.y||e.aw()):!e.a1&&e.ao&&(e.ao=!1,e.al&&=(clearTimeout(e.al),0),Ux(``,null),yC(e,{query:``,hit:null,keys:[]}))},onDestroy:function(){e.al&&clearTimeout(e.al),this.abort.abort(),Ux(``,null),yC(e,{query:``,hit:null,keys:[]})}})),nC=s(59,tC,11),rC=s(29,e=>_(e.a,[`_eg`,e.a0&&`_ep`,!e.a1&&`_ef`])),iC=s(41,e=>m(e.f,e.a1&&(e.a4||``).trim()?e.ab?`${e.ae+1}/${e.ab}`:`0/0`:``),3),aC=s(38,e=>{S(e.g,`disabled`,!e.ab||!e.a1),S(e.i,`disabled`,!e.ab||!e.a1)}),oC=u(27,e=>{S(e.a,`aria-hidden`,e.a1?`false`:`true`),S(e.d,`tabindex`,e.a1?0:-1),S(e.g,`tabindex`,e.a1?0:-1),S(e.i,`tabindex`,e.a1?0:-1),S(e.k,`tabindex`,e.a1?0:-1),eC(e),nC(e),rC(e),iC(e),aC(e)}),sC=s(16,e=>oC(e,e.o,e.p)),cC=j(14,sC),lC=j(15,sC),uC=(e,t)=>FC(e,t?.length),dC=s(32,e=>uC(e,WS(e.x,e.a4||``))),fC=j(56,nC),pC=s(53,e=>fC(e,KC(e)),4),mC=s(55,e=>y(e,`d`,e.a4||``,qC(e))),hC=u(30,e=>{dC(e),pC(e),nC(e),mC(e),iC(e)}),gC=s(19,e=>hC(e,e.r,e.s)),_C=j(17,gC),vC=j(18,gC),yC=u(33),bC=s(22,e=>yC(e,e.u,e.v)),xC=j(20,bC),SC=j(21,bC),CC=j(40,e=>{pC(e),iC(e)}),wC=s(39,e=>CC(e,e.ab?Math.min(e.a9,e.ab-1):-1)),TC=j(54,e=>{nC(e),mC(e)}),EC=s(52,e=>TC(e,JC(e)),3),DC=j(51,e=>{EC(e),pC(e)}),OC=s(45,e=>DC(e,YC(e)),2),kC=l(35,e=>{wC(e),OC(e)}),AC=(e,t)=>zC(e,t.open),jC=(e,t)=>{BC(e,t.timer),VC(e,t.tick),HC(e,t.wasOpen)},MC=j(58,e=>{M(e,e.aw),nC(e)}),NC=r(`h6`,e=>{T(e,`d`),o(e.d,`keydown`,function(t){if(e.a1){if(t.key===`Escape`){t.preventDefault(),e.y?e.as(``):e.av();return}t.key===`Enter`&&(t.preventDefault(),e.au(t.shiftKey?-1:1))}}),o(e.g,`mousedown`,function(e){e.preventDefault()}),o(e.g,`click`,function(){e.au(-1)}),o(e.i,`mousedown`,function(e){e.preventDefault()}),o(e.i,`click`,function(){e.au(1)}),o(e.k,`mousedown`,function(e){e.preventDefault()}),o(e.k,`click`,function(){e.av()})});function PC(e){_(e.b,`_eh`),oe(e.c),Te(e.c,13),yt(e.c),_(e.e,`_ek`),bt(e.h),Re(e.h,14),xt(e.h),I(e.j),rt(e.j,14),pt(e.j),et(e.l),Ve(e.l,14),ft(e.l),kC(e,0),AC(e,{open:!1}),jC(e,{timer:0,tick:0,wasOpen:!1}),MC(e,XC(e)),NC(e)}var FC=j(37,e=>{wC(e),iC(e),aC(e)}),IC=j(23,e=>{dC(e),OC(e),EC(e)}),LC=j(57,nC),RC=s(48,e=>LC(e,ZC(e))),zC=j(43,e=>{OC(e),EC(e),pC(e),RC(e),eC(e),nC(e)}),BC=j(47,e=>{EC(e),pC(e),RC(e),nC(e)}),VC=j(49,nC),HC=j(50,nC),UC=j(24,e=>{S(e.k,`hidden`,e.y),nC(e)}),WC=j(25,nC),GC=j(26,e=>{_(e.d,[dt,e.a0&&`_er`]),_(e.g,[at,e.a0&&`_es`]),_(e.i,[at,e.a0&&`_es`]),_(e.k,[at,e.a0&&`_es`]),rC(e)}),KC=e=>t=>{e.ah&&(e.al&&=(clearTimeout(e.al),0),e.ap(e.a4||``,(e.ae<0?0:e.ae)+t))},qC=e=>function(t){e.as(t)},JC=e=>t=>{if(!e.ah)return;hC(e,t),kC(e,0);let n=WS(e.x,t);Ux(t,n[0]??null,US(n)??void 0),e.al&&clearTimeout(e.al),e.al=setTimeout(()=>{e.al=0,e.ap(t,0)},80)},YC=e=>(t,n)=>{if(!e.ah)return;let r=WS(e.x,t),i=[...new Set(r.map(e=>e.key))];if(!r.length){kC(e,0),Ux(t,null,i),yC(e,{query:t,hit:null,keys:i});return}kC(e,(n%r.length+r.length)%r.length);let a=r[e.a9];Ux(t,a,US(r)??void 0),yC(e,{query:t,hit:a,keys:i})},XC=e=>()=>{let t=e.d;t&&(t.focus(),t.select(),document.activeElement!==t&&setTimeout(()=>{t.focus(),t.select()},0))},ZC=e=>()=>{oC(e,!1),e.ah=!1,e.al&&=(clearTimeout(e.al),0),Ux(``,null),yC(e,{query:``,hit:null,keys:[]})};d(`h4`,KC),d(`h1`,qC),d(`h3`,JC),d(`h2`,YC),d(`h0`,XC),d(`h5`,ZC);function QC(e){let t=e.replace(/^origin\//,``);return $C(t.includes(`/`)?t.slice(t.lastIndexOf(`/`)+1):t)}function $C(e){return e.replace(/-[a-z0-9]{1,6}$/i,``)||e}function ew(e,t){if(!t)return``;let n=e.replace(/^origin\//,``),r=t.replace(/^origin\//,``);return n.startsWith(`${r}-`)?n.slice(r.length+1):``}function tw(e){let t=$C(e);if(t.length<=20)return t;let n=t.split(`-`);return n.length>1?n[n.length-1]:t}function nw(e,t,n=``,r=``){let i=(e||`base`).replace(/^origin\//,``),a=(t||`HEAD`).replace(/^origin\//,``),o=(n||``).replace(/^origin\//,``),s=!!o&&(a===o||a.startsWith(`${o}-`));return{base:i,head:s?r||QC(o):tw(a),topic:s?ew(a,o):``,title:a===i?i:`${a} vs ${i}`}}function rw(e,t=``,n=``){let r=e.replace(/^origin\//,``);if(!r||r===`HEAD`)return r||`HEAD`;let i=t.replace(/^origin\//,``);if(i&&(r===i||r.startsWith(`${i}-`))){let e=n||QC(i),t=ew(r,i);return t?`${e} [${t}]`:e}return tw(r)}var iw=`_jv _y`,aw=`_jB _x`,ow=`<div><button type=button title="Scroll to this section"><span> </span></button><!><span><span> </span><span aria-hidden=true>vs</span><span> </span><!></span><!><!><!><!><span><span><!> file<!></span><!><!><!></span></div>`,sw=` D D D m%b D D l b D l%l%b%b%b%b E%c%l%b%b%m`,cw=c(11,0,e=>m(e.b,e._.b4)),lw=e=>{cw._(e),_(e.a,[`_N`,Qe.accent,`_jH`])},uw=s(2,e=>S(e.a,`title`,`${e._.ag?`#${e._.ag.number}`:e._.ak} is already in ${e._.ai}; showing the working tree only`),2),dw=c(14,0,uw),fw=e=>{dw._(e),pw._(e),mw._(e),_(e.a,[`_N`,`_jI`])},pw=c(14,0,e=>{m(e.b,e._.ai),uw(e)}),mw=c(14,0,uw),hw=c(12,0,e=>m(e.b,Nx(e._.at,7))),gw=e=>{hw._(e),_(e.a,[`_N`,`_jI`])},_w=c(4,1,e=>m(e.b,St(e._.as))),vw=e=>{_w._(e),_(e.a,[aw,`_jC`])},yw=s(4,e=>S(e.a,`title`,`${e._.ap}: ${e._.aj} ${e._.aq} vs ${e._.ai} ${e._.ar}`),4),bw=c(4,0,yw),xw=e=>{bw._(e),Sw._(e),Cw._(e),ww._(e),Tw._(e),Ew._(e),Dw._(e),_(e.a,[`_u`,`_v`]),_(e.c,aw)},Sw=c(4,0,yw),Cw=c(4,0,e=>m(e.b,e._.an)),ww=c(4,0,e=>S(e.a,`href`,`${e._.ao}/files`)),Tw=c(4,0,e=>{m(e.d,e._.ap),yw(e)}),Ew=c(4,0,yw),Dw=c(4,0,yw),Ow=c(21,0,e=>m(e.b,e._.ab)),kw=r(`u2`,e=>o(e.a,`click`,function(){e._.ae()})),Aw=e=>{Ow._(e),jw._(e),kw(e)},jw=c(21,0,e=>{_(e.a,[`_jA`,{_jz:e._.ac}]),S(e.a,`aria-pressed`,e._.ac?`true`:`false`),S(e.a,`title`,e._.ac?`Show every file`:`Show only files changed since your last visit`)}),Mw=c(20,0,e=>m(e.b,e._.a9)),Nw=r(`u1`,e=>o(e.a,`click`,function(){e._.aa()})),Pw=e=>{Mw._(e),_(e.a,`_jA`),Nw(e)},Fw=c(19,0,e=>m(e.b,e._.a6)),Iw=e=>{Fw._(e),Lw._(e),_(e.a,`_jx`),_(e.c,`_jy`)},Lw=c(19,0,e=>m(e.d,e._.a7)),Rw=s(3,e=>m(e.b,rw(e._.ak,e._.z,e._.a0)),2),zw=c(15,0,Rw),Bw=e=>{zw._(e),Vw._(e),Uw._(e),Ww._(e),Gw._(e),Kw._(e),_(e.a,[`_N`,`_jI`])},Vw=c(15,0,Rw),Hw=s(4,e=>S(e.a,`title`,`This view is ${Nx(e._.aq)} (${e._.aj}); checked out is ${Nx(e._.ay)} (${e._.ak})`),3),Uw=c(15,0,Hw),Ww=c(15,0,e=>{Hw(e),Rw(e)}),Gw=c(15,0,Hw),Kw=c(15,0,e=>{m(e.c,Nx(e._.ay,7)),Hw(e)}),qw=c(13,0,e=>S(e.a,`disabled`,e._.a2)),Jw=r(`u0`,e=>o(e.a,`click`,function(){e._.a3()})),Yw=e=>{qw._(e),Zw._(e),Qw._(e),$w._(e),_(e.a,[`_N`,Qe.warn,`_jI`]),Jw(e)},Xw=s(3,e=>S(e.a,`title`,`origin/${e._.aj} ${e._.aq} · GitHub ${e._.av}. Reload to re-ask GitHub`),2),Zw=c(13,0,Xw),Qw=c(13,0,e=>{m(e.b,Nx(e._.aq,7)),Xw(e)}),$w=c(13,0,e=>{m(e.c,Nx(e._.av,7)),Xw(e)}),eT=(e,t)=>{nT(e,t?.pr),dT(e,t?.base),fT(e,t?.branch),pT(e,t?.worktree),hT(e,t?.head),gT(e,t?.baseSha),_T(e,t?.full_name),yT(e,t?.rev),xT(e,t?.githubDrift),wT(e,t?.contained),TT(e,t?.localHead)},tT=C(4,`<a target=_blank rel=noopener>#<!></a><span> </span>`,` Db%l D `,xw,`<span> </span>`,` D `,vw),nT=j(42,e=>{aT(e,e.ag?.baseRefName),oT(e,e.ag?.headRefName),sT(e,e.ag?.number),cT(e,e.ag?.url),lT(e,e.ag?.title),uT(e,e.ag?.headRefOid),tT(e,+!e.ag),dw(e)}),rT=(e,t)=>{OT(e,t?.title),kT(e,t?.base),AT(e,t?.head),MT(e,t?.topic)},iT=s(47,e=>rT(e,nw(e.ah||e.ai,e.aj||e.ak,e.z,e.a0)),5),aT=j(43,iT),oT=j(45,e=>{iT(e),Zw(e),Uw(e),Sw(e)}),sT=j(49,Cw),cT=j(50,ww),lT=j(51,Tw),uT=j(57,$w),dT=j(44,e=>{iT(e),bw(e),pw(e)}),fT=j(46,e=>{iT(e),Ww(e),mw(e)}),pT=j(48,e=>m(e.d,e.am)),mT=s(63,e=>S(e.f,`title`,`${e.b0} · ${e.aq.slice(0,7)}…${e.ar.slice(0,7)}`),2),hT=j(52,e=>{mT(e),Qw(e),Gw(e),Ew(e)}),gT=j(53,e=>{mT(e),Dw(e)}),_T=j(54,_w),vT=C(12,`<span title="One commit against its parent">commit <!></span>`,` Db%`,gw),yT=j(55,e=>{vT(e,+!e.at),hw(e)}),bT=C(13,`<button type=button>behind GitHub <!> → <!></button>`,` Db%c%`,Yw),xT=(e,t)=>bT(e,+!t),ST=C(14,`<span>already in <!></span>`,` Db%`,fw),CT=s(59,e=>ST(e,e.aw&&e.a4?0:1)),wT=j(58,CT),TT=j(60,Kw),ET=e=>{S(e.a,`data-pr`,e.ag?`${e.am}/${e.ag.number}`:void 0)},DT=j(24,e=>{eT(e,e.y),ET(e)}),OT=j(62,mT),kT=(e,t)=>m(e.h,t),AT=(e,t)=>m(e.k,t),jT=C(11,`<span> </span>`,` D `,lw),MT=j(66,e=>{jT(e,+!e.b4),cw(e)}),NT=j(25,e=>{iT(e),zw(e)}),PT=j(26,e=>{iT(e),Vw(e)}),FT=r(`u3`,e=>o(e.b,`click`,function(){e.a1()}));function IT(e){_(e.a,`_js`),_(e.b,`_ju`),_(e.c,iw),_(e.f,`_jD`),_(e.g,[`_N`,`_jE`]),_(e.i,[`_P`,`_jG`]),_(e.j,[`_N`,`_jF`]),_(e.q,`_jw`),FT(e)}var LT=j(30,e=>{m(e.r,e.a4),m(e.s,e.a4===1?``:`s`),CT(e)}),RT=C(15,`<span>local <!><!></span>`,` Db%b%`,Bw),zT=(e,t)=>RT(e,+!t),BT=C(19,`<span>+<!></span><span>−<!></span>`,` Db%l Db%`,Iw),VT=s(34,e=>BT(e,e.a6||e.a7?0:1)),HT=j(32,e=>{VT(e),Fw(e)}),UT=j(33,e=>{VT(e),Lw(e)}),WT=C(20,`<button type=button title="Filtered out of the list — show every file"><!> hidden</button>`,` D%`,Pw),GT=j(35,e=>{WT(e,+!e.a9),Mw(e)}),KT=C(21,`<button type=button><!> new</button>`,` D%`,Aw),qT=s(39,e=>KT(e,e.ab||e.ac?0:1)),JT=j(37,e=>{qT(e),Ow(e)}),YT=j(38,e=>{qT(e),jw(e)}),XT=j(27),ZT=j(28,qw),QT=j(29),$T=j(36),eE=j(40),tE=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1532
1532
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
1533
1533
  <path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
1534
1534
  </symbol>
@@ -2793,8 +2793,8 @@ diff --git`)}function Qg(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
2793
2793
  }`}function mj(e){return`${fj}
2794
2794
  @layer unsafe {
2795
2795
  ${e}
2796
- }`}var hj=new WeakMap;function gj(e){let t=hj.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(_D,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),hj.set(e,i),i}function _j(e,t){if(!e.isConnected)return;let n=gj(t);if(n==null)return;let r=t.querySelector(`style[${vD}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(vD,``),t.appendChild(i)),i.textContent=`:host { ${yD}: ${n}px; }`}var vj;function yj(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){vj??(vj=new CSSStyleSheet,vj.replaceSync(pj(dj)));let t=!1;try{e.adoptedStyleSheets=[vj],t=!0}catch{}if(t){e.querySelector(`style[${hD}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(hD,``),t.textContent=pj(dj),e.prepend(t)}}function bj(e,t){xj(e,t),yj(t),_j(e,t)}function xj(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});bj(this,e)}}if(customElements.define(mD,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(mD)))e instanceof HTMLElement&&bj(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Sj=e=>e.startsWith(`f::`)?e.slice(3):e;function Cj(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function wj(e,t){return e===``?t:`${e}/${t}`}function Tj({files:e,path:t,isFolder:n,nextBasename:r}){let i=Sj(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=Cj(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=wj(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function Ej(e){return e.endsWith(`/`)}function Dj(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function Oj(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function kj(e,t){return t.includes(e)?Oj(t):[e]}function Aj(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function jj(e,t){return{draggedPaths:e,target:t}}function Mj(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Ej(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function Nj(e,t){return t.kind===`root`||t.directoryPath==null?Dj(e):t.directoryPath}function Pj(e,t){let n=e.map(e=>{let n=Nj(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function Fj(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Ij(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!Fj(oj.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function Lj(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function Rj(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function zj(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Bj(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return zj(e,t.path)?n?e:null:e;case`move`:return Rj(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Bj(r,e,n),r==null)return null;return r}}}function Vj(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Hj(e){switch(e.operation){case`add`:return{...Vj(e),operation:`add`,path:e.path};case`remove`:return{...Vj(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...Vj(e),from:e.from,operation:`move`,to:e.to}}}function Uj(e){return{...Vj(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>Hj(e)),operation:`batch`}}function Wj(e){switch(e.operation){case`add`:case`remove`:case`move`:return Hj(e);case`batch`:return Uj(e);default:return null}}function Gj(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function Kj(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function qj(e){return Kj(e).at(-1)??null}function Jj(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function Yj(e){return e.endsWith(`/`)}var Xj=e=>e.toLowerCase();function Zj(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function Qj(e){return e.endsWith(`/`)?e.slice(0,-1):e}function $j(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var eM=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},tM=Symbol(`FILE_TREE_RENAME_VIEW`),nM=512,rM=512;function iM(e){return e===`top`||e===`center`?e:`nearest`}function aM(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=Kj(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function oM(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:aM(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var sM=class e{static{Object.defineProperty(e.prototype,tM,{configurable:!0,value(){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}},writable:!0})}#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=Ij({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=qj(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:iM(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=rM){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=kj(t,n);return this.#r.canDrag?.(r)!==!1&&(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=jj(t.draggedPaths,n);(Mj(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Aj(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=jj(e.draggedPaths,t);if(Mj(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=Pj(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=Yj(r),a=Qj(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of Kj(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=Zj(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,Yj(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,Yj(e)?{recursive:!0}:void 0);return}let t=Yj(e),n=Tj({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:Qj(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move($j(n.sourcePath,t),$j(n.destinationPath,t))}#Y(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#De())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#H.list().length,o=this.#G,s=Ij({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#le(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#z;this.#K?.(),this.#H=c,this.#d.clear(),this.#he();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!Gj(this.#B,p);this.#B=new Set(p),m&&(this.#V+=1),this.#z=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(l,l!=null||p.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#G-o})}#X(e){this.#Ie();let t=qj(e),n=Jj(e,t),r=null,i=null;for(let e of this.#be()){if(qj(e)!==t)continue;let a=Jj(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=Kj(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!Gj(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new oj({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of Kj(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(Xj),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(Xj),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of Kj(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:eM(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of Kj(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of Kj(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=oM(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,nM)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s!==e||this.#c!==n)&&(this.#s=e,this.#c=n,t&&this.#De())}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=Bj(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Bj(this.#c,e,!0),r=[...this.#B].map(t=>Bj(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Bj(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return Gj(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&Lj(e)&&(this.#i=null);let t=Lj(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=Wj(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},cM=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function lM(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(e[t]!==`/`&&t!==e.length){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function uM(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function dM(e,t){return t?`${e}/`:e}function fM(e,t=null){let n=cM(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set,o=new Map;for(let t of e??[]){let e=mM(t);e!=null&&_M({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function pM(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=hM(e);t!=null&&(c=gM({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=mM(e);t!=null&&(c=_M({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:bM(i),statusByPath:i}:e}function mM(e){return hM(e.path)}function hM(e){let t=lM(e);if(t!=null)return{canonicalPath:dM(t.path,t.isDirectory),isDirectory:t.isDirectory}}function gM({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),yM(t,n,e),!0)}function _M({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??vM(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function vM(e,t,n){for(let r of uM(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function yM(e,t,n){for(let r of uM(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function bM(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var X,xM,SM,CM,wM,TM,EM,DM,OM,kM,AM={},jM=[],MM=Array.isArray,NM=jM.slice,PM=Object.assign;function FM(e){e&&e.parentNode&&e.remove()}function IM(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?NM.call(arguments,2):n),LM(e,o,r,i,null)}function LM(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++xM,__i:-1,__u:0};return i==null&&X.vnode!=null&&X.vnode(a),a}function RM(e){return e.children}function zM(e,t){this.props=e,this.context=t,this.__g=0}function BM(e,t){if(t==null)return e.__?BM(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?BM(e):null}function VM(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return VM(e)}}function HM(e){(8&e.__g||!(e.__g|=8)||!SM.push(e)||wM++)&&CM==X.debounceRendering||((CM=X.debounceRendering)||queueMicrotask)(UM)}function UM(){for(var e,t,n,r,i,a,o,s,c=1;SM.length;)SM.length>c&&SM.sort(TM),e=SM.shift(),c=SM.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=PM({},r)).__v=r.__v+1,X.vnode&&X.vnode(n),ZM(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??BM(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,$M(a,n,o),n.__e!=i&&VM(n)));wM=0}function WM(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||jM,b=t.length;for(c=GM(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?AM:y[m.__i]||AM,m.__i=f,_=ZM(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&nN(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=KM(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function GM(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?LM(null,o,null,null,null):MM(o)?LM(RM,{children:o},null,null,null):o.constructor==null&&o.__b>0?LM(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=qM(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=BM(s)),rN(s,s));return r}function KM(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=KM(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=BM(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function qM(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function JM(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function YM(e,t,n,r,i){var a;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||JM(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||JM(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(EM,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=DM,e.addEventListener(t,a?kM:OM,a)):e.removeEventListener(t,a?kM:OM,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function XM(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=DM++;else if(t.u<n.l)return;return n(X.event?X.event(t):t)}}}function ZM(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=X.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new M(v,x):(t.__c=f=new zM(v,x),f.constructor=M,f.render=iN),b&&b.sub(f),f.props=v,f.state||(f.state={}),f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=PM({},f.__s)),PM(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=X.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=PM({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===RM&&d.key==null&&(E=eN(d.props.children)),s=WM(e,MM(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null){if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)FM(a[j]);QM(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||QM(t);X.__e(e,t,n)}else s=t.__e=tN(n.__e,t,n,r,i,a,o,c,l,u);return(d=X.diffed)&&d(t),128&t.__u?void 0:s}function QM(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(QM)}function $M(e,t,n){for(var r=0;r<n.length;r++)nN(n[r],n[++r],n[++r]);X.__c&&X.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){X.__e(e,t.__v)}})}function eN(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:MM(e)?e.map(eN):PM({},e)}function tN(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(X.__m&&X.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=NM.call(e.childNodes),v=n.props||AM,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;YM(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||YM(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),WM(b==`template`?e.content:e,MM(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&BM(n,0),s,c,l),a!=null)for(u=a.length;u--;)FM(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||YM(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&YM(e,u,g,v[u],i))}return e}function nN(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){X.__e(e,n)}}function rN(e,t,n){var r,i;if(X.unmount&&X.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||nN(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){X.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&rN(r[i],t,n||typeof e.type!=`function`);n||FM(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function iN(e,t,n){return this.constructor(e,n)}function aN(e,t){var n,r,i,a;t==document&&(t=document.documentElement),X.__&&X.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=IM(RM,null,[e]),i=[],a=[],ZM(t,e,r||AM,AM,t.namespaceURI,r?null:t.firstChild?NM.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),$M(i,e,a)}function oN(e,t){e.__u|=32,aN(e,t)}X={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw wM=0,e}},xM=0,zM.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=PM({},this.state);typeof e==`function`&&(e=e(PM({},n),this.props)),e&&PM(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),HM(this))},zM.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),HM(this))},zM.prototype.render=RM,SM=[],wM=0,TM=function(e,t){return e.__v.__b-t.__v.__b},EM=/(PointerCapture)$|Capture$/i,DM=0,OM=XM(!1),kM=XM(!0);var sN=0;Array.isArray;function Z(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--sN,__i:-1,__u:0,__source:i,__self:a};return X.vnode&&X.vnode(l),l}var cN=16,lN=16,uN={};function dN({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=uN[e]??{width:cN,height:lN},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Z(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Z(`use`,{href:c})})}var fN=e=>e!==void 0&&/\s/.test(e),pN=(e,t)=>{let n=t=>fN(e[t-1])||fN(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},mN=e=>pN(e,Math.ceil(e.length/2)),hN=e=>{if(e.length<2)return[e,``];let t=mN(e);return[e.slice(0,t),e.slice(t)]},gN=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:mN(e);return[e.slice(0,r),e.slice(r)]},_N=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},vN=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},yN=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},bN=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function xN({children:e,marker:t,variant:n=`default`}){"use no memo";return Z(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Z(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Z(`span`,{"data-truncate-fade":!0}):t})})}function SN(e){"use no memo";let{mode:t,children:n}=e;return Z(`div`,{children:[Z(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Z(`span`,{children:n}):n}),Z(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Z(`span`,{children:n}):n})]})}function CN({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Z(SN,{mode:t,children:e},`content`),o=Z(xN,{marker:n,mode:t,variant:r},`marker`),s=Z(`div`,{"data-truncate-fill":!0},`fill`);return Z(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Z(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function wN({children:e,...t}){"use no memo";return Z(CN,{mode:`truncate`,...t,children:e})}function TN({children:e,...t}){"use no memo";return Z(CN,{mode:`fruncate`,...t,children:e})}function EN({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Z(wN,{...s,children:t[0]}),l=Z(TN,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Z(`div`,{className:a,style:o});if(e.length<i)return Z(n===`end`?TN:wN,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=hN:r===`extension`?t=gN:r===`leaf-path`&&(t=_N);else if(typeof r==`number`)t=vN,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=yN:e===`first`&&(t=bN)}else typeof r==`function`&&(t=r);t??=hN;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Z(wN,{...s,..._,children:f}),l=Z(TN,{...s,...v,children:p})}return Z(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Z(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Z(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var DN={endIndex:-1,startIndex:-1};function ON(e,t,n){return Math.min(Math.max(e,t),n)}function kN(e,t){return e<0||t<e?DN:{endIndex:t,startIndex:e}}function AN(e){return e.startIndex<0||e.endIndex<e.startIndex}function jN(e,t){return AN(e)?0:(e.endIndex-e.startIndex+1)*t}function MN(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function NN(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function PN(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function FN(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function IN(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function LN(e,t,n){if(e.length===0||t<=0)return[];let r=IN(e),i=PN(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=FN(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function RN(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=ON(t.scrollTop,0,o),c=t.stickyRows??LN(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=MN(s,n,t.itemHeight),m=MN(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?DN:kN(m,NN(u+d,n,t.itemHeight)),y=g+1,b=AN(v)?DN:kN(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=jN(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:AN(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var zN={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},BN={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},VN=`Contains git status items`;function HN(e){return e.current?!0:(e.current=!0,!1)}function UN(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function WN(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return UN({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function GN(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function KN(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function qN(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function JN(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function YN(e,t){return e!=null&&e>0?e:t}function XN(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function ZN(e,t,n,r,i=0){let a=UN({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function QN(e,t,n,r,i,a,o=0){let s=WN({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function $N(e,t,n,r,i,a){let o=GN({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function eP(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function tP(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function nP({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Z(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function rP(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function iP(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var aP,oP,sP,cP,lP=Object.is,uP=0,dP=[],fP=X,pP=fP.__b,mP=fP.__r,hP=fP.diffed,gP=fP.__c,_P=fP.unmount,vP=fP.__;function yP(e,t){fP.__h&&fP.__h(oP,e,uP||t),uP=0;var n=oP.__H||(oP.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function bP(e){return uP=1,xP(MP,e)}function xP(e,t,n){var r=yP(aP++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):MP(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);lP(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=oP,!oP.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,lP(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};oP.__f=!0;var a=oP.shouldComponentUpdate,o=oP.componentWillUpdate;oP.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},oP.shouldComponentUpdate=i}return r.__N||r.__}function SP(e,t){var n=yP(aP++,3);!fP.__s&&jP(n.__H,t)&&(n.__=e,n.u=t,oP.__H.__h.push(n))}function CP(e,t){var n=yP(aP++,4);!fP.__s&&jP(n.__H,t)&&(n.__=e,n.u=t,oP.__h.push(n))}function Q(e){return uP=5,wP(function(){return{current:e}},[])}function wP(e,t){var n=yP(aP++,7);return jP(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function TP(e,t){return uP=8,wP(function(){return e},t)}function EP(){for(var e;e=dP.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(kP),e.__H.__h.forEach(AP),e.__H.__h=[]}catch(t){e.__H.__h=[],fP.__e(t,e.__v)}}fP.__b=function(e){oP=null,pP&&pP(e)},fP.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),vP&&vP(e,t)},fP.__r=function(e){mP&&mP(e),aP=0;var t=(oP=e.__c).__H;t&&(sP===oP?(t.__h=[],oP.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(kP),t.__h.forEach(AP),t.__h=[],aP=0)),sP=oP},fP.diffed=function(e){hP&&hP(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(dP.push(t)!==1&&cP===fP.requestAnimationFrame||((cP=fP.requestAnimationFrame)||OP)(EP)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),sP=oP=null},fP.__c=function(e,t){t.some(function(e){try{e.__h.forEach(kP),e.__h=e.__h.filter(function(e){return!e.__||AP(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],fP.__e(n,e.__v)}}),gP&&gP(e,t)},fP.unmount=function(e){_P&&_P(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{kP(e)}catch(e){t=e}}),n.__H=void 0,t&&fP.__e(t,n.__v))};var DP=typeof requestAnimationFrame==`function`;function OP(e){var t,n=function(){clearTimeout(r),DP&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);DP&&(t=requestAnimationFrame(n))}function kP(e){var t=oP,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),oP=t}function AP(e){var t=oP;e.__c=e.__(),oP=t}function jP(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!lP(t,e[n])})}function MP(e,t){return typeof t==`function`?t(e):t}function NP(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Z(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Z(RM,{children:[Z(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Z(wN,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function PP(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function FP(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function IP(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function LP({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=RN(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:IP(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?IP(u,1,t,o):i&&r<=0&&c.length>0?LN(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var RP=400,zP=40,BP=18;function VP(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?HP(e,t,n):a instanceof HTMLElement?a:null}function HP(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function UP(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function WP(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function GP(){return navigator.vendor!==`Apple Computer, Inc.`}function KP(e,t){let n=e-t.top;if(n<zP)return-Math.ceil((zP-Math.max(0,n))/zP*BP);let r=t.bottom-e;return r<zP?Math.ceil((zP-Math.max(0,r))/zP*BP):0}function qP(e,t){if(e!=null){let t=zN[e];return t==null?null:{text:t,title:BN[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:VN}:null}function JP(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function YP(e){return e!=null&&`toggle`in e}function XP(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function ZP(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function QP(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function $P(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function eF(e,t){return t&&$P(e)||(e.ctrlKey||e.metaKey)&&XP(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var tF=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function nF(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function rF(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function iF(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function aF(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function oF(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function sF(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function cF(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function lF(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function uF(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=lF(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function dF(e,t){return{kind:e.kind,name:FP(e),path:t}}function fF(e){return e==null?void 0:`${e}__tree`}function pF(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function mF(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function hF(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Z(`span`,{title:e.title,children:e.text}):Z(`span`,{title:e.title,children:e.parts.map((e,t)=>Z(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?mF(e.icon)?t(e.icon):{name:e.icon}:mF(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Z(`span`,{title:e.title,children:Z(dN,{...n})})}function gF(e){e!=null&&KN(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function _F(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=PP(e);return Z(RM,{children:[e.depth>0?Z(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Z(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Z(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Z(dN,{...t(`file-tree-icon-chevron`)}):Z(dN,{...t(`file-tree-icon-file`,u)})}),Z(`div`,{"data-item-section":`content`,children:e.isFlattened?NP(e,c,a):c??Z(EN,{minimumLength:5,split:`extension`,children:e.name})}),i?Z(`div`,{"data-item-section":`decoration`,children:r==null?null:hF(r,t)}):null,s?Z(`div`,{"data-item-section":`git`,children:hF(o,t)}):null,n?Z(`div`,{"data-item-section":`action`,children:l?Z(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Z(dN,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function vF(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:ee}=e,N=PP(t),{isParked:te=!1,mode:ne=`flow`,style:re}=r,ie=ne===`sticky`,ae=_?.get(N)??null??JP(t.ancestorPaths,v,y),oe=t.kind===`directory`&&(b?.has(N)??!1),se=A(t,N),ce=qP(ae,oe),le=S&&w,ue=se!=null||x||le,de=le&&T===`always`,fe=a.getPath()===N,pe=fe?a.getValue():``,me=ie||!fe?null:Z(nP,{ref:D,ariaLabel:`Rename ${FP(t)}`,isFlattened:t.isFlattened,value:pe,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),he=_F(t,k,{actionLaneEnabled:le,customDecoration:se,decorationLaneEnabled:ue,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:ce,gitLaneActive:x,renameInput:me,showDecorativeActionAffordance:de}),ge={...rP({ariaLabel:FP(t),domId:t.isFocused?pF(h,N,te):void 0,extraStyle:re,features:{actionLaneEnabled:le,contextMenuButtonVisibility:le?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:te,itemHeight:g,mode:ne,row:t,state:{containsGitChange:oe,effectiveGitStatus:ae,isContextHovered:s===N,isDragTarget:l?.kind===`directory`&&l.directoryPath===N,isDragging:c?.has(N)===!0,isFocusRinged:t.isFocused&&o===N},targetPath:N}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(N),j(t,N,{anchorRect:iF(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:ie?void 0:()=>{i.focusMountedPathFromInput(N)},onKeyDown:ie?void 0:ee,ref:e=>{O(N,e)}};return!ie&&fe?Z(`div`,{...ge,children:he}):Z(`button`,{...ge,type:`button`,draggable:u&&!te,onDragEnd:u&&!te?p:void 0,onDragStart:u&&!te?e=>{f(e,t,N)}:void 0,onMouseDown:e=>{if(ie){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!te?e=>{m(e,t,N)}:void 0,onClick:e=>{M(e,t,N,ne)},children:he})}function yF(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(PP(e))).map((n,r)=>vF(e,n,t.start+r))}function bF({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=uj,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=Q(null),v=Q(null),y=Q(!1),b=Q(null),x=Q(null),S=Q(null),C=Q(null),w=Q(null),T=Q(new Map),E=Q(new Map),D=Q(()=>{}),O=Q(null),k=Q(0),A=Q(!1),j=Q(null);j.current!==t&&(A.current=!1,j.current=t);let M=Q(!1),ee=Q(null),N=Q(null),te=Q(!1),ne=Q(null),re=Q(null),ie=Q(null),ae=Q(null),oe=Q(null),se=Q(null),ce=Q(null),le=Q(null),ue=Q(!1),de=Q(null),fe=Q(null),pe=Q(null),me=Q(null),he=wP(()=>new Map,[]),[,ge]=bP(0),_e=Q(!1),[ve,ye]=bP(null),[be,xe]=bP(null),[Se,Ce]=bP(null),[we,Te]=bP(null),[Ee,De]=bP(0),[P,Oe]=bP(null),ke=Q(P);ke.current=P;let Ae=Q(null),je=Q(null),Me=Q(null),Ne=Q(null),Pe=Q(null),Fe=Q(!1),Ie=()=>{je.current=null,Me.current=null,Ne.current=null},Le=(e,t)=>{je.current=e,Me.current=null,Ne.current=t==null?null:{path:e,scrollTop:t}},Re=(e,t)=>{je.current=null,Me.current={path:e,viewportOffset:t},Ne.current=null},ze=Q(d===`retain`&&t.isSearchOpen()),[Be,Ve]=bP(p);SP(()=>{p||Ve(!1)},[p]);let He=Q(!1),Ue=TP(()=>{He.current=!0,Ve(e=>e&&!1)},[]),[We,Ge]=bP(()=>LP({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ke,qe]=bP(!1);SP(()=>{qe(!0)},[]);let Je=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ye=e?.contextMenu?.triggerMode??(Je?`right-click`:`both`),Xe=Ye===`both`||Ye===`button`,Ze=e?.contextMenu?.buttonVisibility??`when-needed`,Qe=Ye===`both`||Ye===`right-click`;CP(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Pe.current=t,xe(t),Te(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Fe.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let $e=TP((e,t)=>{oF(T.current,e,t)},[]),et=TP((e,t)=>{oF(E.current,e,t)},[]),tt=TP(e=>{x.current=e},[]),nt=TP(e=>sF(e,E.current,T.current),[]),rt=n!=null||r!=null||i!=null,{resolveIcon:it}=wP(()=>kD(a),[a]),at=t[tM](),ot=at.getPath(),st=ot!=null,ct=t.isSearchOpen(),lt=t.getSearchValue(),F=t.getFocusedPath(),I=t.getFocusedIndex(),ut=t.getScrollRequest(),dt=t.isDragAndDropEnabled(),ft=t.getDragSession(),pt=wP(()=>ft==null?null:new Set(ft.draggedPaths),[ft]),mt=ft?.target??null,ht=ft?.primaryPath??null,gt=fF(o),{overlayHeight:_t,overlayRows:vt,snapshot:yt,visibleRows:bt}=We,xt=yt.physical.viewportHeight,St=wP(()=>({end:yt.window.endIndex,start:yt.window.startIndex}),[yt.window.endIndex,yt.window.startIndex]),Ct=vt,wt=yt.sticky.rows,Tt=yt.physical.totalHeight,Et=yt.sticky.height,Dt=wP(()=>new Set(wt.map(e=>PP(e.row))),[wt]),Ot=I>=0&&I>=St.start&&I<=St.end,kt=TP((e,t)=>u?.({item:dF(e,t),row:e})??null,[u]),At=TP(e=>KN(e==null?null:T.current.get(e)??null)?!0:KN(S.current),[]),jt=TP(e=>{At(t.focusNearestPath(e))},[t,At]),Mt=Q(jt);Mt.current=jt;let Nt=Q(!0),Pt=Q(()=>{}),Ft=TP((t=!0)=>{let n=ke.current;n!=null&&(Nt.current=Nt.current&&t,Oe(null),e?.contextMenu?.onClose?.(),Nt.current&&jt(n.path))},[e?.contextMenu,jt]);Pt.current=Ft;let It=TP(e=>{let t=e==null?null:aF(S.current,e);Ce(e=>e===t?e:t)},[]),Lt=TP((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=nt(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Le(n,e?.scrollTop??null),M.current=!0,ye(e=>e===n?e:n)}i.focus(),It(a),Nt.current=!0,Oe({anchorRect:r?.anchorRect??null,item:dF(e,n),path:n,source:r?.source??`keyboard`})},[t,nt,It]),L=TP(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=JN(e,xt);ne.current=I<0||e==null?null:Math.max(0,Math.min(I*s-e.scrollTop,Math.max(0,t-s))),te.current=!0}t.startRenaming(e)!==!1&&(Te(`focus`),ge(e=>e+1))}},[t,I,s,l,xt]),Rt=TP((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=JN(i,xt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:LP({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,$N(i,a,s,l,u,d),D.current(),Ae.current=n?e:null,!0},[t,s,c,xt,h]),zt=()=>y.current===!0||me.current!=null||ue.current===!0,Bt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Vt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Ht=()=>{ae.current!=null&&(clearTimeout(ae.current),ae.current=null),ie.current=null},Ut=()=>{se.current?.remove(),se.current=null},Wt=()=>{Vt(re.current),re.current=null,oe.current=null},Gt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Kt=()=>{le.current?.(),le.current=null,me.current!=null&&(clearTimeout(me.current),me.current=null),ue.current=!1,de.current=null,pe.current=null,fe.current!=null&&(fe.current.setAttribute(`draggable`,`true`),fe.current.style.removeProperty(`touch-action`),fe.current=null),Ut(),Ht(),Wt(),ce.current=null},qt=(e,n)=>{let r=S.current?.getRootNode(),i=UP(VP(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Jt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Ht();return}let r=t.getItem(e.directoryPath),i=YP(r)?r:null;if(i==null||i.isExpanded()){Ht();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;ie.current!==a&&(Ht(),ie.current=a,ae.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Yt=()=>{re.current=null;let e=oe.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=KP(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Jt(qt(e.clientX,e.clientY)),re.current=Bt(Yt)},Xt=(e,t)=>{oe.current={clientX:e,clientY:t},re.current??=Bt(Yt)},Zt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Kt(),Ut(),Ht(),Wt(),t.startDrag(r)===!1){e.preventDefault();return}if(ce.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),GP())){let t=WP(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Gt(t),se.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Qt=()=>{Ut(),Ht(),Wt(),ce.current=null,t.cancelDrag()},$t=(e,n,r)=>{if(me.current!=null||ue.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;pe.current={clientX:i.clientX,clientY:i.clientY},fe.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!ue.current;me.current!=null&&(clearTimeout(me.current),me.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),le.current===o&&(le.current=null),t&&(a.setAttribute(`draggable`,`true`),fe.current===a&&(fe.current=null),pe.current=null)},s=e=>{let t=e.touches[0],n=pe.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),le.current=o,me.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),fe.current===a&&(fe.current=null),pe.current=null;return}ue.current=!0,fe.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),ce.current=n;let e=a.getBoundingClientRect(),s=WP(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Gt(s),se.current=s,de.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=de.current;n!=null&&se.current!=null&&(se.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Jt(qt(t.clientX,t.clientY)),Xt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&qt(n.clientX,n.clientY),t.completeDrag(),Kt()},u=()=>{t.cancelDrag(),Kt()};le.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},RP)},en=e=>{if(P!=null){if(e.key===`Escape`){Ft(),e.preventDefault(),e.stopPropagation();return}tF.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(at.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)at.cancel();else if(e.key===`Enter`)at.commit();else return;Te(`focus`),ge(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){L(F??void 0),e.preventDefault(),e.stopPropagation();return}if(ct){if(e.key===`Escape`)te.current=!1,ne.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=JN(n,xt);ne.current=I<0||n==null?null:Math.max(0,Math.min(I*s-n.scrollTop,Math.max(0,r-s))),te.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;Te(`focus`),ge(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&ZP(e)){t.openSearch(e.key),ge(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Je&&$P(e),r=eF(e,Je),i=r&&S.current!=null?qN(S.current):null,a=r?new Set(cF(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==F&&a.has(o)){let e=C.current;Le(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=YP(p)?p:null,h=u!=null&&(Dt.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=sF(u,E.current,T.current);e==null||n==null?y=!1:Lt(e,u)}else if((e.ctrlKey||e.metaKey)&&XP(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;Te(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Dt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Le(b,v?.scrollTop??null),M.current=!0,ye(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Re(b,uF(S.current,v,i,u,s,Et,xt)),M.current=!0,ye(e=>e===b?e:b)):Ie()}ge(e=>e+1),e.preventDefault(),e.stopPropagation()};CP(()=>{if(!(!f||!ct)){if(ze.current){ze.current=!1;return}KN(w.current)}},[ct,f]),CP(()=>{let e=x.current;switch(tP({hasRenderedInput:e!=null,previousRenamingPath:N.current,renamingPath:ot})){case`reset`:N.current=null;return;case`reveal-canonical`:ot!=null&&Rt(ot,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Ae.current=null,N.current=ot,KN(e),e.select());return}},[St.end,St.start,ot,Rt,Dt]),CP(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=qN(e)?.dataset.itemPath??null;ye(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,qN(e)!=null){r();return}M.current=!1,ye(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,ye(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;ye(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),CP(()=>{let e=S.current;e!=null&&(yt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[yt.physical.scrollTop]),CP(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=JN(n,g);let a=()=>{let e=t.getVisibleCount(),r=YN(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ge(LP({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=YN(O.current,g),i=t.getVisibleRows(e,e)[0]??null;ZN(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=t.subscribe(()=>{HN(_e)&&ge(e=>e+1),a()}),l=()=>{Fe.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,De(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&Fe.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),ke.current!=null&&y.current&&Pt.current(),Fe.current===!0){y.current=!1;return}xe(e=>e==null?e:null),l()},m=()=>{l(),f()},_=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{_.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let x=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:XN(e[0]))??JN(n,g),a()}):null;return x?.observe(n),()=>{D.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,x?.disconnect()}},[t,g,s,c,h]),CP(()=>{Je||P==null||Ft(!1)},[Ft,Je,P]);let tn=wP(()=>P==null?null:`${P.path}::${P.source}`,[P]);CP(()=>{if(tn==null){m?.clearSlotContent(xD);return}let t=ke.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??rF(n.getBoundingClientRect()),close:e=>{Pt.current(e?.restoreFocus??!0)},restoreFocus:()=>{Nt.current&&Mt.current(ke.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(xD,i),e?.contextMenu?.onOpen?.(t.item,r),gF(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&gF(i)}),()=>{m?.clearSlotContent(xD)}},[tn,e?.contextMenu,m]),CP(()=>{P!=null&&t.getItem(P.path)==null&&Ft()},[Ft,P,t]),CP(()=>{if(P==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(nF(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Ft())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Ft())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Ft,P]),CP(()=>{let e=C.current,n=S.current;if(e==null||n==null){ee.current=F;return}let r=F==null?null:T.current.get(F)??null,i=qN(n),a=i?.dataset.itemPath??null,o=st&&x.current===i,c=f&&w.current===i,l=te.current&&!ct,u=ne.current??0,d=Ae.current,p=je.current,m=Me.current,g=Ne.current,_=i!=null,v=M.current||_,y=ee.current!==F,b=p!=null&&p===F&&F!=null,E=!1,O=!1;if(ut!=null&&ut.id!==k.current){k.current=ut.id;let n=ut.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,xt-s))):Et;E=!0,O=QN(e,n,s,xt,Tt,ut.offset,t)}t.clearScrollRequest(ut.id)}let A=!E&&l&&$N(e,I,s,xt,Tt,u),j=!E&&d!=null&&d===F&&$N(e,I,s,xt,Tt,Et),N=!E&&m!=null&&m.path===F&&$N(e,I,s,xt,Tt,m.viewportOffset),re=!E&&g!=null&&g.path===F&&e.scrollTop!==g.scrollTop;if(re&&(e.scrollTop=g.scrollTop),(re||O||j||N||A||v&&y&&d!==F&&!b&&ZN(e,I,s,xt,Et))&&D.current(),E){ee.current=F;return}if(!v){ee.current=F;return}if(o){ee.current=F;return}if(c&&!l){ee.current=F;return}if(r==null){l&&I>=0&&($N(e,I,s,xt,Tt,u),D.current()),ee.current=F;return}(y||l||d===F||p===F||m?.path===F||g?.path===F||a==null||a!==F)&&(KN(r),d===F&&(Ae.current=null),p===F&&(je.current=null),m?.path===F&&(Me.current=null),g?.path===F&&(Ne.current=null),te.current=!1,ne.current=null),ee.current=F},[t,I,F,Ot,s,st,ct,St,xt,f,ut,h,Et,Tt,bt]);let nn=I>=0&&I>=yt.visible.startIndex&&I<=yt.visible.endIndex,rn=F!=null&&Ct.some(e=>PP(e.row)===F),an=nn||rn,on=Xe&&M.current===!0&&an?F:null,sn=we===`pointer`?be:null,cn=P?.path??Pe.current??sn??on??be,ln=P?.source===`right-click`;CP(()=>{y.current&&P==null||It(nt(cn))},[P,nt,St,xt,Ee,Ct,cn,It,bt]);let un=TP(e=>{if(y.current||nF(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&Te(e=>e===`pointer`?e:`pointer`),xe(e=>e===i?e:i)},[]),dn=TP(()=>{xe(null)},[]);CP(()=>{if(!dt)return;let e=()=>{Kt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Kt(),t.cancelDrag()}},[t,dt]);let R=e=>{if(!dt||t.getDragSession()==null||ue.current)return;let n=UP(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Jt(t.getDragSession()?.target??null),Xt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},fn=e=>{if(!dt||t.getDragSession()==null||ue.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Ht(),Wt(),t.setDragTarget(null))},pn=e=>{!dt||t.getDragSession()==null||ue.current||(e.preventDefault(),qt(e.clientX,e.clientY),t.completeDrag(),Ut(),Ht(),Wt(),ce.current=null)},mn=yt.window.height,hn=yt.window.offsetTop,gn=Math.min(0,xt-mn),_n=Math.min(0,xt-mn-Et),vn=ve===F||te.current,yn=F!=null&&vn&&!Ot&&I>=0?bt[I]??t.getVisibleRows(I,I)[0]??null:null,bn=yn==null?null:eP(I,s,St,mn),xn=ce.current,Sn=ht!=null&&xn!=null&&xn.path===ht&&xn.index>=St.start&&xn.index<=St.end,Cn=ht!=null&&xn!=null&&xn.path===ht&&!Sn&&xn.path!==yn?.path?xn:null,wn=Cn==null?null:eP(Cn.index,s,St,mn),Tn=QP((I>=0?bt[I]??t.getVisibleRows(I,I)[0]??null:null)?.ancestorPaths.at(-1)??null),En=ct&&F!=null?pF(o,F,!Ot):void 0,z=P?.path??(ct?F:ve),Dn=P?.path??be,On=nt(cn),B=Je&&Xe&&!ln&&!st&&On!=null&&Se!=null&&cn!=null,V=Je&&(B||P!=null),kn=P?.anchorRect,An=kn==null&&On!=null&&Se!=null&&(P!=null||B)?Se:null,jn=kn==null?An==null?void 0:{top:`${An}px`}:{left:`${kn.left}px`,position:`fixed`,right:`auto`,top:`${kn.top}px`},Mn=ln?{opacity:`0`}:void 0,Nn=TP((e,n,r,i)=>{let a=iP({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:ct,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=yt.visible.startIndex&&n.index<=yt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,ye(e=>e===c?e:c),Te(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Rt(c,{targetOffset:`sticky-parents`})},[t,ct,yt.visible.endIndex,yt.visible.startIndex,Rt]),Pn=()=>{if(y.current||!Xe||cn==null||On==null)return;let e=t.getItem(cn);e!=null&&(It(On),Nt.current=!0,Oe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:On.getAttribute(`aria-label`)??cn,path:e.getPath()},path:e.getPath(),source:`button`}))},Fn={contextHoverPath:Dn,contextMenuButtonTriggerEnabled:Xe,contextMenuButtonVisibility:Ze,contextMenuEnabled:Je,contextMenuRightClickEnabled:Qe,contextMenuTriggerMode:Ye,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:dt,draggedPathSet:pt,dragTarget:mt,gitLaneActive:rt,gitStatusByPath:n,handleRowDragEnd:Qt,handleRowDragStart:Zt,handleRowTouchStart:$t,ignoredGitDirectories:r,ignoredInheritanceCache:he,instanceId:o,itemHeight:s,onKeyDown:en,onRowClick:Nn,openContextMenuForRow:Lt,registerButton:$e,registerRenameInput:tt,renameView:at,renderDecorationForRow:kt,resolveIcon:it,shouldSuppressContextMenu:zt,visualFocusPath:z},In={...Fn,registerButton:et};return Z(`div`,{ref:S,id:gt,"data-file-tree-context-menu-button-visibility":Je&&Xe?Ze:void 0,"data-file-tree-context-menu-trigger-mode":Je?Ye:void 0,"data-file-tree-has-context-menu-action-lane":Je&&Xe?`true`:void 0,"data-file-tree-has-git-lane":rt?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:dt?fn:void 0,onDragOver:dt?R:void 0,onDrop:dt?pn:void 0,onKeyDown:en,onPointerLeave:Je?dn:void 0,onPointerOver:Je?un:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Z(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:Tn}}),Z(`slot`,{name:bD,"data-type":`header-slot`}),f?Z(`div`,{"data-file-tree-search-container":!0,"data-open":ct?`true`:`false`,children:Z(`input`,{ref:w,"aria-activedescendant":En,"aria-controls":gt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Be?`true`:void 0,value:lt,onBlur:()=>{d===`retain`&&!He.current||t.closeSearch()},onFocus:Ue,onPointerDown:Ue,onInput:e=>{Ue();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Z(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ke&&Ct.length>0?Z(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Z(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${_t}px`},children:Ct.map((e,t)=>vF(In,e.row,`sticky:${PP(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${Ct.length-t}`}}))})}):null,Z(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${Tt}px`},children:[Z(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${hn}px`}}),Z(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${mn}px`,top:`${gn}px`,bottom:`${_n}px`},children:[yF(Fn,St,Dt),yn!=null&&bn!=null?vF(Fn,yn,`parked:${yn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:ht===yn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${bn}px`}}):null,Cn!=null&&wn!=null?vF(Fn,Cn,`parked-drag:${Cn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${wn}px`}}):null]})]})]}),Je?Z(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":V?`true`:`false`,style:jn,children:[Z(`button`,{ref:v,type:`button`,"data-type":SD,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":P==null?`false`:`true`,"data-visible":B?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),P!=null){Ft();return}Pn()},tabIndex:-1,style:Mn,children:Z(dN,{...it(`file-tree-icon-ellipsis`)})}),P==null?null:Z(`slot`,{name:xD})]}):null,P==null?null:Z(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Ft()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Ft()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var xF={hydrateRoot:(e,t)=>{oN(IM(bF,t),e)},renderRoot:(e,t)=>{aN(IM(bF,t),e)},unmountRoot:e=>{aN(null,e)}};function SF(e,t){xF.renderRoot(e,t)}function CF(e,t){xF.hydrateRoot(e,t)}function wF(e){xF.unmountRoot(e)}var TF=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}};function EF(e,t,n){if(!e.s){if(n instanceof DF){if(!n.s)return void(n.o=EF.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(EF.bind(null,e,t),EF.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var DF=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{EF(r,1,a(this.v))}catch(e){EF(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?EF(r,1,t?t(i):i):n?EF(r,1,n(i)):EF(r,2,i)}catch(e){EF(r,2,e)}},r},e}();Array.isArray;var OF=0;function kF(e){return e!=null&&e.length>0?e:(OF+=1,`pst_ft_${OF}`)}function AF({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??uj)}function jF(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function MF(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function NF(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var PF=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new TF;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=kF(a),this.#p=fM(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=lj(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new sM({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(wF(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=pM(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&SF(n.wrapper,this.#w())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),SF(t.wrapper,this.#w()))}setGitStatus(e){let t=fM(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&SF(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),SF(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),CF(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),SF(r,this.#w())}#C(){return{initialViewportHeight:AF({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(bD,e());return}this.#l.setSlotHtml(bD,this.#e?.header?.html??null)}#k(e){let t=NF(e).find(e=>MF(e)),n=jF(uD(wD(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=NF(e),n=t.find(e=>MF(e)),r=t.filter(e=>e!==n),i=wD(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=jF(i);if(a==null){for(let e of r)e.remove();return}if(r.length!==1||r[0].outerHTML!==a.outerHTML){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=wD(this.#m);t.colored&&fD(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${gD}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}(this.#g?.parentNode!==e||this.#_!==this.#h)&&(this.#g??=document.createElement(`style`),this.#g.setAttribute(gD,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=mj(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return bj(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},FF=`_jq _n`,IF=`<div><input type=search placeholder="Filter files…" aria-label="Filter files"></div>`,LF=` D l`,RF=s(18,e=>y(e,`b`,e.l,eI(e))),zF=j(11,RF),BF=s(10,e=>zF(e,(e.j??e.h)||``)),VF=j(17,RF),HF=s(16,e=>VF(e,tI(e))),UF=j(15,HF),WF=s(14,e=>UF(e,nI(e)),2),GF=u(7,e=>{BF(e),WF(e)}),KF=s(6,e=>GF(e,e.e,e.f)),qF=j(4,KF),JF=j(5,KF),YF=l(9,e=>{BF(e),WF(e)}),XF=(e,t)=>$F(e,t.timer),ZF=r(`j3`,e=>{T(e,`b`),o(e.b,`keydown`,function(t){t.key===`Enter`&&e.p(),t.key===`Escape`&&e.l&&(t.preventDefault(),e.r(``))})});function QF(e){_(e.a,`_jp`),_(e.b,FF),YF(e,null),XF(e,{timer:0}),ZF(e)}var $F=j(13,e=>{WF(e),HF(e)}),eI=e=>function(t){e.r(t)},tI=e=>t=>{if(e.n&&clearTimeout(e.n),!t){e.n=0,YF(e,null),GF(e,``);return}YF(e,t),e.n=setTimeout(e.p,150)},nI=e=>()=>{e.n&&=(clearTimeout(e.n),0);let t=e.j===null?e.h||``:e.j;YF(e,null),GF(e,t)};d(`j0`,eI),d(`j2`,tI),d(`j1`,nI);var rI=(e=>`<div><div title="Drag to resize"></div><div>${e}</div><div></div></div>`)(IF),iI=(e=>` D b D/${e}&l l`)(LF),aI={A:`added`,D:`deleted`,M:`modified`,R:`renamed`},oI=s(7,e=>{S(e.a,`aria-expanded`,e._._.t.has(e._.f)?`false`:`true`),_(e.b,[`_ix`,{_iy:!e._._.t.has(e._.f)}])}),sI=A(29,oI,e=>e._._),cI=r(`u4`,e=>o(e.a,`click`,function(){let t=new Set(e._._.t);t.delete(e._.f)||t.add(e._.f),kI(e._._,t)})),lI=e=>{sI(e),uI._(e),dI._(e),fI._(e),_(e.a,`_iw`),Ze(e.c),N(e.c,12),$e(e.c),_(e.d,`_iz`),_(e.f,`_iA`),cI(e)},uI=c(1,0,oI),dI=c(1,0,e=>{S(e.a,`title`,e._.h),m(e.e,e._.h)}),fI=c(1,0,e=>m(e.g,e._.j)),pI=C(1,(e=>`<button type=button><span aria-hidden=true>${e}</span><span> </span><span> </span></button>`)(he),(e=>` D D/${e}&l D l D m`)(ge),lI),mI=f(4,e=>{_(e.a,[`_iv`,{_iu:e._.m===1}]),_(e.c,[`_iC`,{_iB:e._.m===1}]),pI(e,e._.m>1?0:1)}),hI=e=>{mI._(e),_I._(e)},gI=s(6,e=>S(e.c,`hidden`,e._.t.has(e.f))),_I=f(4,gI),vI=j(5,e=>{S(e.a,`data-section`,e.f),S(e.c,`data-tree`,e.f),gI(e),uI(e)}),yI=(e,t)=>{vI(e,t[0]?.id),bI(e,t[0]?.label),xI(e,t[0]?.files?.length)},bI=j(7,dI),xI=j(9,fI),SI=r(`u5`,e=>a(e,{filter:e.q,sections:e.l,commentCounts:e.n,newKeys:e.o,onMount:function(){let t=(e,t)=>`${e.worktree}/${t}`,n=e=>e.files.map(e=>({path:e.path,status:aI[e.status]??`modified`})),r=e=>e.files.map(e=>`${e.path}:${e.status}`).join(`
2797
- `),i=(e,t)=>[...e].map(([e,t])=>`${e}=${t}`).sort().join(`,`)+`|`+[...t].sort().join(`,`),a=new Map,o=t=>e.a.querySelector(`[data-tree="${CSS.escape(t)}"]`),s=i=>{let s=o(i.id);if(!s)return;let c=new PF({paths:i.files.map(e=>e.path),gitStatus:n(i),initialExpansion:`open`,flattenEmptyDirectories:!0,search:!1,fileTreeSearchMode:`hide-non-matches`,initialSearchQuery:e.q||null,onSelectionChange(n){if(n.length===1){let r=t(i,n[0]);queueMicrotask(()=>e.p(r))}},renderRowDecoration({row:n}){if(n.kind!==`file`)return null;let r=t(i,n.path),a=e.n.has(r),o=e.o.has(r);if(!a&&!o)return null;let s=[];return o&&s.push({text:`●`,color:`var(--accent)`}),a&&s.push({text:`${o?` `:``}✎ ${e.n.get(r)??``}`.trimEnd(),color:`var(--dim)`}),{text:s.map(e=>e.text).join(``),parts:s,title:[o&&`Changed since your last visit`,a&&`Has review comments`].filter(Boolean).join(` · `)}}});c.render({containerWrapper:s});let l=()=>{if(e.l.length===1){s.style.flexBasis=``;return}let t=c.getVisibleCount()*c.getItemHeight();s.style.flexBasis=`${t}px`};l();let u=c.subscribe(l);a.set(i.id,{tree:c,sig:r(i),unsub:u})};for(let t of e.l)s(t);return{trees:a,build:s,sig:r,gitStatus:n,marks:i,shownMarks:i(e.n,e.o),shownFilter:e.q||``}},onUpdate:function(){let e=(this.filter||``)!==this.shownFilter;this.shownFilter=this.filter||``;let t=this.marks(this.commentCounts,this.newKeys),n=t!==this.shownMarks;this.shownMarks=t;let r=new Set(this.sections.map(e=>e.id));for(let[e,t]of this.trees)r.has(e)||(t.unsub(),t.tree.cleanUp(),this.trees.delete(e));for(let t of this.sections){let r=this.trees.get(t.id);if(!r){this.build(t);continue}e&&r.tree.setSearch(this.shownFilter||null);let i=this.sig(t);i===r.sig?n&&r.tree.setGitStatus(this.gitStatus(t)):(r.sig=i,r.tree.resetPaths(t.files.map(e=>e.path)),r.tree.setGitStatus(this.gitStatus(t)))}},onDestroy:function(){for(let e of this.trees.values())e.unsub(),e.tree.cleanUp()}})),CI=s(18,SI,4),wI=u(16,e=>{qF(e.d,e.q),CI(e)}),TI=s(9,e=>wI(e,e.h,e.i)),EI=j(7,TI),DI=j(8,TI),OI=g(sI),kI=l(19,e=>{_I(e),OI(e)}),AI=j(27),jI=s(24,e=>AI(e,qI(e))),MI=l(20,e=>{x(e.a,e.u==null?void 0:`--tree-w:${e.u}px`),jI(e)}),NI=l(21,e=>_(e.b,[`_iE`,{_iD:e.v}])),PI=(e,t)=>zI(e,t.id),FI=r(`u6`,e=>{o(e.b,`pointerdown`,function(t){e.z(t)}),o(e.b,`pointermove`,function(t){e.a0(t)}),o(e.b,`pointerup`,function(t){e.a1(t)}),o(e.b,`pointercancel`,function(t){e.a1(t)})});function II(e){_(e.c,`_is`),QF(e.d),JF(e.d,JI(e)),_(e.e,`_it`),kI(e,new Set),MI(e,P()),NI(e,!1),PI(e,{id:-1}),FI(e)}var LI=j(25),RI=j(26),zI=j(23,e=>{LI(e,YI(e)),RI(e,XI(e)),jI(e)}),BI=(e,t)=>_(e.a,[`_ir`,{_iq:t===!1}]),VI=i(4,`<div><!><div></div></div>`,` D%b `,hI,yI),HI=j(11,e=>{KI(e,e.l?.length),VI(e,[e.l,`id`]),CI(e)}),UI=j(13,CI),WI=j(14,CI),GI=j(15,CI),KI=j(12,mI),qI=e=>t=>{t.pointerId===e.x&&(e.x=-1,NI(e,!1),e.u!=null&&Pe(e.u))},JI=e=>t=>{wI(e,t)},YI=e=>t=>{(t.pointerType!==`mouse`||t.button===0)&&(t.preventDefault(),e.x=t.pointerId,NI(e,!0),e.b.setPointerCapture(t.pointerId))},XI=e=>t=>{if(t.pointerId!==e.x)return;let n=window.innerWidth-t.clientX;MI(e,Math.min(640,Math.max(200,n)))};d(`u2`,qI),d(`u3`,JI),d(`u0`,YI),d(`u1`,XI);var ZI=`_jj _bb`,QI=Je,$I=(e=>`/${e}&`)(Ke);function eL(e){ct(e.a,`M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 13.8214 2.48697 15.5291 3.33782 17L2.5 21.5L7 20.6622C8.47087 21.513 10.1786 22 12 22Z`)}var tL=(e,t)=>nt(e.a,t),nL=(e,t)=>We(e.a,t),rL=`<!><!><!>`,iL=e=>_(e.a,`_jm`),aL=e=>{eL(e.a),tL(e.a,12),nL(e.a,`_jo`)},oL=e=>_(e.a,[`_A`,`_jn`]),sL=c(1,0,e=>{S(e.a,`title`,e._.f),m(e.b,e._.f)}),cL=e=>{sL._(e),_(e.a,ZI)},lL=C(6,QI,(e=>`/${e}&`)($I),aL),uL=s(11,e=>lL(e,+!e._._._._.w.has(e.k))),dL=A(29,uL,e=>e._._._._),fL=r(`g2`,e=>o(e.a,`click`,function(){WL(e._._._._,!1)})),pL=e=>{dL(e),gL(e),vL(e),_(e.a,[`_ji`,`_y`]),_(e.b,`_ba`),_(e.d,`_jk`),fL(e)},mL=C(5,`<span title="Changed since your last visit"></span>`,` `,oL),hL=s(12,e=>mL(e,+!e._._._._.x.has(e.k))),gL=A(30,hL,e=>e._._._._),_L=s(13,e=>S(e.a,`href`,e._._._._.z(e.k))),vL=A(32,_L,e=>e._._._._),yL=j(10,e=>{_L(e),hL(e),uL(e)}),bL=(e,t)=>{S(e.b,`data-status`,t),m(e.c,t)},xL=(e,t)=>m(e.e,t),SL=(e,t)=>{yL(e,(t?.[0]).file?.key),bL(e,(t?.[0]).file?.status),xL(e,(t?.[0]).name)},CL=e=>_(e.a,`_jh`),wL=C(1,`<div><bdi><!>/</bdi></div>`,` E%`,cL),TL=j(5,e=>{wL(e,+!e.f),sL(e)}),EL=i(2,`<a><span> </span><span><bdi> </bdi></span><!><!></a>`,` D D l E m%b%`,pL,SL),DL=(e,t)=>EL(e,[t,e=>e.file.key]),OL=(e,t)=>{TL(e,(t?.[0]).dir),DL(e,(t?.[0]).files)},kL=e=>{_(e.a,`_jf`),_(e.b,`_jg`)},AL=(e,t)=>m(e.c,t),jL=i(3,`<div><!><!></div>`,` D%b%`,CL,OL),ML=(e,t)=>jL(e,[t,`dir`]),NL=(e,t)=>{AL(e,t[0]?.repo),ML(e,t[0]?.dirs)},PL=C(13,`<p>No files match.</p>`,` `,iL),FL=s(14,e=>m(e.g,e._.n===e._.y?``:` / ${e._.y}`)),IL=c(0,0,e=>{m(e.f,e._.n),PL(e,+!!e._.n),FL(e)}),LL=r(`g3`,e=>{o(e.a,`click`,function(){WL(e._,!1)}),o(e.h,`click`,function(){WL(e._,!1)})}),RL=e=>{IL._(e),zL._(e),BL._(e),HL._(e),_(e.a,`_ja`),_(e.b,`_jb`),_(e.c,`_jc`),_(e.d,`_i_`),_(e.e,`_jd`),_(e.h,[Ee,`_i9`]),et(e.i),Ve(e.i,16),ft(e.i),_(e.j,`_jl`),QF(e.k),JF(e.k,fR(e)),_(e.l,`_je`),LL(e)},zL=c(0,0,e=>qF(e.k,e._.u)),BL=c(0,0,FL),VL=i(12,`<div><div> </div><!></div>`,` D D l%`,kL,NL),HL=c(0,0,e=>VL(e,[e._.a0,`repo`])),UL=C(0,((e,t)=>`<div></div><div role=dialog aria-label="Jump to file"><div><strong>Files</strong><span><!><!></span><button type=button title=Close aria-label=Close>${e}</button></div><div>${t}</div><div><!><!></div></div>`)(_t,IF),((e,t)=>` b D D b D%b%l D/${e}&m D/${t}&l D%b%m`)(He,LF),RL),WL=u(18,e=>UL(e,+!e.s)),GL=s(5,e=>WL(e,e.d,e.e)),KL=j(3,GL),qL=j(4,GL),JL=u(20,zL),YL=s(8,e=>JL(e,e.g,e.h)),XL=j(6,YL),ZL=j(7,YL),QL=j(22,g(dL)),$L=(e,t)=>QL(e,t||new Set),eR=j(23,g(gL)),tR=(e,t)=>eR(e,t||new Set),nR=j(24,BL),rR=s(14,e=>nR(e,e.l??e.n)),iR=j(11,rR),aR=j(13,e=>{rR(e),IL(e)}),oR=j(25,g(vL)),sR=s(17,e=>oR(e,pR(e))),cR=j(15,sR),lR=j(16,sR),uR=j(26,HL),dR=(e,t)=>{aR(e,t?.length),uR(e,(()=>{let e=[],n=new Map;for(let r of t){let t=r.key.indexOf(`/`),i=r.key.slice(0,t),a=r.key.slice(t+1),o=a.lastIndexOf(`/`),s=o<0?``:a.slice(0,o),c=o<0?a:a.slice(o+1),l=n.get(i);l||(n.set(i,l=new Map),e.push({repo:i,dirs:[]}));let u=l.get(s);u||(l.set(s,u={dir:s,files:[]}),e[e.length-1].dirs.push(u)),u.files.push({file:r,name:c})}return e})())},fR=e=>t=>{JL(e._,t)},pR=e=>t=>Ce({workspaceId:e.p,view:`diff`,scope:e.q??null,file:t});d(`g1`,fR),d(`g0`,pR);var mR=((e,t,n,r)=>`<div><div><div><div><div><!><h1>Review</h1><!></div><div><!><button title="Refresh diff">${e}</button><!><span><select aria-label=Compare><option value=committed>Committed</option><option value=working>Working tree</option><option value=dirty>Uncommitted</option><!></select></span> <div>${t}</div><!></div></div><div><!><!><!><!></div><!></div><div data-diff-main></div></div>${n}${r}</div>`)(le,ZS,rI,rL),hR=((e,t,n,r)=>` D D D D D%b b%l D%b D/${e}&l%b D Dd%mb D0${t}&l%m D%b%b%b%l%l l/${n}&/${r}&l`)(De,QS,iI,`b%c`);function gR(e){return e.split(`
2796
+ }`}var hj=new WeakMap;function gj(e){let t=hj.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(_D,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),hj.set(e,i),i}function _j(e,t){if(!e.isConnected)return;let n=gj(t);if(n==null)return;let r=t.querySelector(`style[${vD}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(vD,``),t.appendChild(i)),i.textContent=`:host { ${yD}: ${n}px; }`}var vj;function yj(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){vj??(vj=new CSSStyleSheet,vj.replaceSync(pj(dj)));let t=!1;try{e.adoptedStyleSheets=[vj],t=!0}catch{}if(t){e.querySelector(`style[${hD}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(hD,``),t.textContent=pj(dj),e.prepend(t)}}function bj(e,t){xj(e,t),yj(t),_j(e,t)}function xj(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});bj(this,e)}}if(customElements.define(mD,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(mD)))e instanceof HTMLElement&&bj(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Sj=e=>e.startsWith(`f::`)?e.slice(3):e;function Cj(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function wj(e,t){return e===``?t:`${e}/${t}`}function Tj({files:e,path:t,isFolder:n,nextBasename:r}){let i=Sj(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=Cj(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=wj(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function Ej(e){return e.endsWith(`/`)}function Dj(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function Oj(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function kj(e,t){return t.includes(e)?Oj(t):[e]}function Aj(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function jj(e,t){return{draggedPaths:e,target:t}}function Mj(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Ej(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function Nj(e,t){return t.kind===`root`||t.directoryPath==null?Dj(e):t.directoryPath}function Pj(e,t){let n=e.map(e=>{let n=Nj(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function Fj(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Ij(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!Fj(oj.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function Lj(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function Rj(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function zj(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Bj(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return zj(e,t.path)?n?e:null:e;case`move`:return Rj(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Bj(r,e,n),r==null)return null;return r}}}function Vj(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Hj(e){switch(e.operation){case`add`:return{...Vj(e),operation:`add`,path:e.path};case`remove`:return{...Vj(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...Vj(e),from:e.from,operation:`move`,to:e.to}}}function Uj(e){return{...Vj(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>Hj(e)),operation:`batch`}}function Wj(e){switch(e.operation){case`add`:case`remove`:case`move`:return Hj(e);case`batch`:return Uj(e);default:return null}}function Gj(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function Kj(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function qj(e){return Kj(e).at(-1)??null}function Jj(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function Yj(e){return e.endsWith(`/`)}var Xj=e=>e.toLowerCase();function Zj(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function Qj(e){return e.endsWith(`/`)?e.slice(0,-1):e}function $j(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var eM=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},tM=Symbol(`FILE_TREE_RENAME_VIEW`),nM=512,rM=512;function iM(e){return e===`top`||e===`center`?e:`nearest`}function aM(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=Kj(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function oM(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:aM(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var sM=class e{static{Object.defineProperty(e.prototype,tM,{configurable:!0,value(){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}},writable:!0})}#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=Ij({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=qj(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:iM(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=rM){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=kj(t,n);return this.#r.canDrag?.(r)!==!1&&(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=jj(t.draggedPaths,n);(Mj(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Aj(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=jj(e.draggedPaths,t);if(Mj(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=Pj(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=Yj(r),a=Qj(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of Kj(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=Zj(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,Yj(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,Yj(e)?{recursive:!0}:void 0);return}let t=Yj(e),n=Tj({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:Qj(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move($j(n.sourcePath,t),$j(n.destinationPath,t))}#Y(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#De())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#H.list().length,o=this.#G,s=Ij({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#le(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#z;this.#K?.(),this.#H=c,this.#d.clear(),this.#he();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!Gj(this.#B,p);this.#B=new Set(p),m&&(this.#V+=1),this.#z=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(l,l!=null||p.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#G-o})}#X(e){this.#Ie();let t=qj(e),n=Jj(e,t),r=null,i=null;for(let e of this.#be()){if(qj(e)!==t)continue;let a=Jj(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=Kj(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!Gj(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new oj({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of Kj(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(Xj),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(Xj),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of Kj(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:eM(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of Kj(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of Kj(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=oM(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,nM)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s!==e||this.#c!==n)&&(this.#s=e,this.#c=n,t&&this.#De())}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=Bj(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Bj(this.#c,e,!0),r=[...this.#B].map(t=>Bj(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Bj(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return Gj(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&Lj(e)&&(this.#i=null);let t=Lj(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=Wj(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},cM=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function lM(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(e[t]!==`/`&&t!==e.length){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function uM(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function dM(e,t){return t?`${e}/`:e}function fM(e,t=null){let n=cM(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set,o=new Map;for(let t of e??[]){let e=mM(t);e!=null&&_M({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function pM(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=hM(e);t!=null&&(c=gM({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=mM(e);t!=null&&(c=_M({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:bM(i),statusByPath:i}:e}function mM(e){return hM(e.path)}function hM(e){let t=lM(e);if(t!=null)return{canonicalPath:dM(t.path,t.isDirectory),isDirectory:t.isDirectory}}function gM({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),yM(t,n,e),!0)}function _M({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??vM(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function vM(e,t,n){for(let r of uM(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function yM(e,t,n){for(let r of uM(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function bM(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var X,xM,SM,CM,wM,TM,EM,DM,OM,kM,AM={},jM=[],MM=Array.isArray,NM=jM.slice,PM=Object.assign;function FM(e){e&&e.parentNode&&e.remove()}function IM(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?NM.call(arguments,2):n),LM(e,o,r,i,null)}function LM(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++xM,__i:-1,__u:0};return i==null&&X.vnode!=null&&X.vnode(a),a}function RM(e){return e.children}function zM(e,t){this.props=e,this.context=t,this.__g=0}function BM(e,t){if(t==null)return e.__?BM(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?BM(e):null}function VM(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return VM(e)}}function HM(e){(8&e.__g||!(e.__g|=8)||!SM.push(e)||wM++)&&CM==X.debounceRendering||((CM=X.debounceRendering)||queueMicrotask)(UM)}function UM(){for(var e,t,n,r,i,a,o,s,c=1;SM.length;)SM.length>c&&SM.sort(TM),e=SM.shift(),c=SM.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=PM({},r)).__v=r.__v+1,X.vnode&&X.vnode(n),ZM(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??BM(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,$M(a,n,o),n.__e!=i&&VM(n)));wM=0}function WM(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||jM,b=t.length;for(c=GM(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?AM:y[m.__i]||AM,m.__i=f,_=ZM(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&nN(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=KM(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function GM(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?LM(null,o,null,null,null):MM(o)?LM(RM,{children:o},null,null,null):o.constructor==null&&o.__b>0?LM(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=qM(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=BM(s)),rN(s,s));return r}function KM(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=KM(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=BM(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function qM(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function JM(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function YM(e,t,n,r,i){var a;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||JM(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||JM(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(EM,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=DM,e.addEventListener(t,a?kM:OM,a)):e.removeEventListener(t,a?kM:OM,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function XM(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=DM++;else if(t.u<n.l)return;return n(X.event?X.event(t):t)}}}function ZM(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=X.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new M(v,x):(t.__c=f=new zM(v,x),f.constructor=M,f.render=iN),b&&b.sub(f),f.props=v,f.state||(f.state={}),f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=PM({},f.__s)),PM(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=X.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=PM({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===RM&&d.key==null&&(E=eN(d.props.children)),s=WM(e,MM(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null){if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)FM(a[j]);QM(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||QM(t);X.__e(e,t,n)}else s=t.__e=tN(n.__e,t,n,r,i,a,o,c,l,u);return(d=X.diffed)&&d(t),128&t.__u?void 0:s}function QM(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(QM)}function $M(e,t,n){for(var r=0;r<n.length;r++)nN(n[r],n[++r],n[++r]);X.__c&&X.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){X.__e(e,t.__v)}})}function eN(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:MM(e)?e.map(eN):PM({},e)}function tN(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(X.__m&&X.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=NM.call(e.childNodes),v=n.props||AM,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;YM(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||YM(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),WM(b==`template`?e.content:e,MM(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&BM(n,0),s,c,l),a!=null)for(u=a.length;u--;)FM(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||YM(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&YM(e,u,g,v[u],i))}return e}function nN(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){X.__e(e,n)}}function rN(e,t,n){var r,i;if(X.unmount&&X.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||nN(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){X.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&rN(r[i],t,n||typeof e.type!=`function`);n||FM(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function iN(e,t,n){return this.constructor(e,n)}function aN(e,t){var n,r,i,a;t==document&&(t=document.documentElement),X.__&&X.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=IM(RM,null,[e]),i=[],a=[],ZM(t,e,r||AM,AM,t.namespaceURI,r?null:t.firstChild?NM.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),$M(i,e,a)}function oN(e,t){e.__u|=32,aN(e,t)}X={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw wM=0,e}},xM=0,zM.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=PM({},this.state);typeof e==`function`&&(e=e(PM({},n),this.props)),e&&PM(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),HM(this))},zM.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),HM(this))},zM.prototype.render=RM,SM=[],wM=0,TM=function(e,t){return e.__v.__b-t.__v.__b},EM=/(PointerCapture)$|Capture$/i,DM=0,OM=XM(!1),kM=XM(!0);var sN=0;Array.isArray;function Z(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--sN,__i:-1,__u:0,__source:i,__self:a};return X.vnode&&X.vnode(l),l}var cN=16,lN=16,uN={};function dN({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=uN[e]??{width:cN,height:lN},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Z(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Z(`use`,{href:c})})}var fN=e=>e!==void 0&&/\s/.test(e),pN=(e,t)=>{let n=t=>fN(e[t-1])||fN(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},mN=e=>pN(e,Math.ceil(e.length/2)),hN=e=>{if(e.length<2)return[e,``];let t=mN(e);return[e.slice(0,t),e.slice(t)]},gN=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:mN(e);return[e.slice(0,r),e.slice(r)]},_N=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},vN=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},yN=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},bN=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function xN({children:e,marker:t,variant:n=`default`}){"use no memo";return Z(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Z(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Z(`span`,{"data-truncate-fade":!0}):t})})}function SN(e){"use no memo";let{mode:t,children:n}=e;return Z(`div`,{children:[Z(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Z(`span`,{children:n}):n}),Z(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Z(`span`,{children:n}):n})]})}function CN({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Z(SN,{mode:t,children:e},`content`),o=Z(xN,{marker:n,mode:t,variant:r},`marker`),s=Z(`div`,{"data-truncate-fill":!0},`fill`);return Z(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Z(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function wN({children:e,...t}){"use no memo";return Z(CN,{mode:`truncate`,...t,children:e})}function TN({children:e,...t}){"use no memo";return Z(CN,{mode:`fruncate`,...t,children:e})}function EN({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Z(wN,{...s,children:t[0]}),l=Z(TN,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Z(`div`,{className:a,style:o});if(e.length<i)return Z(n===`end`?TN:wN,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=hN:r===`extension`?t=gN:r===`leaf-path`&&(t=_N);else if(typeof r==`number`)t=vN,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=yN:e===`first`&&(t=bN)}else typeof r==`function`&&(t=r);t??=hN;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Z(wN,{...s,..._,children:f}),l=Z(TN,{...s,...v,children:p})}return Z(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Z(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Z(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var DN={endIndex:-1,startIndex:-1};function ON(e,t,n){return Math.min(Math.max(e,t),n)}function kN(e,t){return e<0||t<e?DN:{endIndex:t,startIndex:e}}function AN(e){return e.startIndex<0||e.endIndex<e.startIndex}function jN(e,t){return AN(e)?0:(e.endIndex-e.startIndex+1)*t}function MN(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function NN(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function PN(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function FN(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function IN(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function LN(e,t,n){if(e.length===0||t<=0)return[];let r=IN(e),i=PN(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=FN(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function RN(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=ON(t.scrollTop,0,o),c=t.stickyRows??LN(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=MN(s,n,t.itemHeight),m=MN(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?DN:kN(m,NN(u+d,n,t.itemHeight)),y=g+1,b=AN(v)?DN:kN(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=jN(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:AN(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var zN={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},BN={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},VN=`Contains git status items`;function HN(e){return e.current?!0:(e.current=!0,!1)}function UN(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function WN(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return UN({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function GN(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function KN(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function qN(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function JN(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function YN(e,t){return e!=null&&e>0?e:t}function XN(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function ZN(e,t,n,r,i=0){let a=UN({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function QN(e,t,n,r,i,a,o=0){let s=WN({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function $N(e,t,n,r,i,a){let o=GN({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function eP(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function tP(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function nP({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Z(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function rP(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function iP(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var aP,oP,sP,cP,lP=Object.is,uP=0,dP=[],fP=X,pP=fP.__b,mP=fP.__r,hP=fP.diffed,gP=fP.__c,_P=fP.unmount,vP=fP.__;function yP(e,t){fP.__h&&fP.__h(oP,e,uP||t),uP=0;var n=oP.__H||(oP.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function bP(e){return uP=1,xP(MP,e)}function xP(e,t,n){var r=yP(aP++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):MP(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);lP(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=oP,!oP.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,lP(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};oP.__f=!0;var a=oP.shouldComponentUpdate,o=oP.componentWillUpdate;oP.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},oP.shouldComponentUpdate=i}return r.__N||r.__}function SP(e,t){var n=yP(aP++,3);!fP.__s&&jP(n.__H,t)&&(n.__=e,n.u=t,oP.__H.__h.push(n))}function CP(e,t){var n=yP(aP++,4);!fP.__s&&jP(n.__H,t)&&(n.__=e,n.u=t,oP.__h.push(n))}function Q(e){return uP=5,wP(function(){return{current:e}},[])}function wP(e,t){var n=yP(aP++,7);return jP(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function TP(e,t){return uP=8,wP(function(){return e},t)}function EP(){for(var e;e=dP.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(kP),e.__H.__h.forEach(AP),e.__H.__h=[]}catch(t){e.__H.__h=[],fP.__e(t,e.__v)}}fP.__b=function(e){oP=null,pP&&pP(e)},fP.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),vP&&vP(e,t)},fP.__r=function(e){mP&&mP(e),aP=0;var t=(oP=e.__c).__H;t&&(sP===oP?(t.__h=[],oP.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(kP),t.__h.forEach(AP),t.__h=[],aP=0)),sP=oP},fP.diffed=function(e){hP&&hP(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(dP.push(t)!==1&&cP===fP.requestAnimationFrame||((cP=fP.requestAnimationFrame)||OP)(EP)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),sP=oP=null},fP.__c=function(e,t){t.some(function(e){try{e.__h.forEach(kP),e.__h=e.__h.filter(function(e){return!e.__||AP(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],fP.__e(n,e.__v)}}),gP&&gP(e,t)},fP.unmount=function(e){_P&&_P(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{kP(e)}catch(e){t=e}}),n.__H=void 0,t&&fP.__e(t,n.__v))};var DP=typeof requestAnimationFrame==`function`;function OP(e){var t,n=function(){clearTimeout(r),DP&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);DP&&(t=requestAnimationFrame(n))}function kP(e){var t=oP,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),oP=t}function AP(e){var t=oP;e.__c=e.__(),oP=t}function jP(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!lP(t,e[n])})}function MP(e,t){return typeof t==`function`?t(e):t}function NP(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Z(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Z(RM,{children:[Z(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Z(wN,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function PP(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function FP(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function IP(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function LP({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=RN(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:IP(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?IP(u,1,t,o):i&&r<=0&&c.length>0?LN(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var RP=400,zP=40,BP=18;function VP(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?HP(e,t,n):a instanceof HTMLElement?a:null}function HP(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function UP(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function WP(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function GP(){return navigator.vendor!==`Apple Computer, Inc.`}function KP(e,t){let n=e-t.top;if(n<zP)return-Math.ceil((zP-Math.max(0,n))/zP*BP);let r=t.bottom-e;return r<zP?Math.ceil((zP-Math.max(0,r))/zP*BP):0}function qP(e,t){if(e!=null){let t=zN[e];return t==null?null:{text:t,title:BN[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:VN}:null}function JP(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function YP(e){return e!=null&&`toggle`in e}function XP(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function ZP(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function QP(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function $P(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function eF(e,t){return t&&$P(e)||(e.ctrlKey||e.metaKey)&&XP(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var tF=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function nF(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function rF(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function iF(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function aF(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function oF(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function sF(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function cF(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function lF(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function uF(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=lF(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function dF(e,t){return{kind:e.kind,name:FP(e),path:t}}function fF(e){return e==null?void 0:`${e}__tree`}function pF(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function mF(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function hF(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Z(`span`,{title:e.title,children:e.text}):Z(`span`,{title:e.title,children:e.parts.map((e,t)=>Z(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?mF(e.icon)?t(e.icon):{name:e.icon}:mF(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Z(`span`,{title:e.title,children:Z(dN,{...n})})}function gF(e){e!=null&&KN(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function _F(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=PP(e);return Z(RM,{children:[e.depth>0?Z(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Z(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Z(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Z(dN,{...t(`file-tree-icon-chevron`)}):Z(dN,{...t(`file-tree-icon-file`,u)})}),Z(`div`,{"data-item-section":`content`,children:e.isFlattened?NP(e,c,a):c??Z(EN,{minimumLength:5,split:`extension`,children:e.name})}),i?Z(`div`,{"data-item-section":`decoration`,children:r==null?null:hF(r,t)}):null,s?Z(`div`,{"data-item-section":`git`,children:hF(o,t)}):null,n?Z(`div`,{"data-item-section":`action`,children:l?Z(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Z(dN,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function vF(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:ee}=e,N=PP(t),{isParked:te=!1,mode:ne=`flow`,style:re}=r,ie=ne===`sticky`,ae=_?.get(N)??null??JP(t.ancestorPaths,v,y),oe=t.kind===`directory`&&(b?.has(N)??!1),se=A(t,N),ce=qP(ae,oe),le=S&&w,ue=se!=null||x||le,de=le&&T===`always`,fe=a.getPath()===N,pe=fe?a.getValue():``,me=ie||!fe?null:Z(nP,{ref:D,ariaLabel:`Rename ${FP(t)}`,isFlattened:t.isFlattened,value:pe,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),he=_F(t,k,{actionLaneEnabled:le,customDecoration:se,decorationLaneEnabled:ue,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:ce,gitLaneActive:x,renameInput:me,showDecorativeActionAffordance:de}),ge={...rP({ariaLabel:FP(t),domId:t.isFocused?pF(h,N,te):void 0,extraStyle:re,features:{actionLaneEnabled:le,contextMenuButtonVisibility:le?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:te,itemHeight:g,mode:ne,row:t,state:{containsGitChange:oe,effectiveGitStatus:ae,isContextHovered:s===N,isDragTarget:l?.kind===`directory`&&l.directoryPath===N,isDragging:c?.has(N)===!0,isFocusRinged:t.isFocused&&o===N},targetPath:N}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(N),j(t,N,{anchorRect:iF(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:ie?void 0:()=>{i.focusMountedPathFromInput(N)},onKeyDown:ie?void 0:ee,ref:e=>{O(N,e)}};return!ie&&fe?Z(`div`,{...ge,children:he}):Z(`button`,{...ge,type:`button`,draggable:u&&!te,onDragEnd:u&&!te?p:void 0,onDragStart:u&&!te?e=>{f(e,t,N)}:void 0,onMouseDown:e=>{if(ie){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!te?e=>{m(e,t,N)}:void 0,onClick:e=>{M(e,t,N,ne)},children:he})}function yF(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(PP(e))).map((n,r)=>vF(e,n,t.start+r))}function bF({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=uj,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=Q(null),v=Q(null),y=Q(!1),b=Q(null),x=Q(null),S=Q(null),C=Q(null),w=Q(null),T=Q(new Map),E=Q(new Map),D=Q(()=>{}),O=Q(null),k=Q(0),A=Q(!1),j=Q(null);j.current!==t&&(A.current=!1,j.current=t);let M=Q(!1),ee=Q(null),N=Q(null),te=Q(!1),ne=Q(null),re=Q(null),ie=Q(null),ae=Q(null),oe=Q(null),se=Q(null),ce=Q(null),le=Q(null),ue=Q(!1),de=Q(null),fe=Q(null),pe=Q(null),me=Q(null),he=wP(()=>new Map,[]),[,ge]=bP(0),_e=Q(!1),[ve,ye]=bP(null),[be,xe]=bP(null),[Se,Ce]=bP(null),[we,Te]=bP(null),[Ee,De]=bP(0),[P,Oe]=bP(null),ke=Q(P);ke.current=P;let Ae=Q(null),je=Q(null),Me=Q(null),Ne=Q(null),Pe=Q(null),Fe=Q(!1),Ie=()=>{je.current=null,Me.current=null,Ne.current=null},Le=(e,t)=>{je.current=e,Me.current=null,Ne.current=t==null?null:{path:e,scrollTop:t}},Re=(e,t)=>{je.current=null,Me.current={path:e,viewportOffset:t},Ne.current=null},ze=Q(d===`retain`&&t.isSearchOpen()),[Be,Ve]=bP(p);SP(()=>{p||Ve(!1)},[p]);let He=Q(!1),Ue=TP(()=>{He.current=!0,Ve(e=>e&&!1)},[]),[We,Ge]=bP(()=>LP({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ke,qe]=bP(!1);SP(()=>{qe(!0)},[]);let Je=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ye=e?.contextMenu?.triggerMode??(Je?`right-click`:`both`),Xe=Ye===`both`||Ye===`button`,Ze=e?.contextMenu?.buttonVisibility??`when-needed`,Qe=Ye===`both`||Ye===`right-click`;CP(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Pe.current=t,xe(t),Te(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Fe.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let $e=TP((e,t)=>{oF(T.current,e,t)},[]),et=TP((e,t)=>{oF(E.current,e,t)},[]),tt=TP(e=>{x.current=e},[]),nt=TP(e=>sF(e,E.current,T.current),[]),rt=n!=null||r!=null||i!=null,{resolveIcon:it}=wP(()=>kD(a),[a]),at=t[tM](),ot=at.getPath(),st=ot!=null,ct=t.isSearchOpen(),lt=t.getSearchValue(),F=t.getFocusedPath(),I=t.getFocusedIndex(),ut=t.getScrollRequest(),dt=t.isDragAndDropEnabled(),ft=t.getDragSession(),pt=wP(()=>ft==null?null:new Set(ft.draggedPaths),[ft]),mt=ft?.target??null,ht=ft?.primaryPath??null,gt=fF(o),{overlayHeight:_t,overlayRows:vt,snapshot:yt,visibleRows:bt}=We,xt=yt.physical.viewportHeight,St=wP(()=>({end:yt.window.endIndex,start:yt.window.startIndex}),[yt.window.endIndex,yt.window.startIndex]),Ct=vt,wt=yt.sticky.rows,Tt=yt.physical.totalHeight,Et=yt.sticky.height,Dt=wP(()=>new Set(wt.map(e=>PP(e.row))),[wt]),Ot=I>=0&&I>=St.start&&I<=St.end,kt=TP((e,t)=>u?.({item:dF(e,t),row:e})??null,[u]),At=TP(e=>KN(e==null?null:T.current.get(e)??null)?!0:KN(S.current),[]),jt=TP(e=>{At(t.focusNearestPath(e))},[t,At]),Mt=Q(jt);Mt.current=jt;let Nt=Q(!0),Pt=Q(()=>{}),Ft=TP((t=!0)=>{let n=ke.current;n!=null&&(Nt.current=Nt.current&&t,Oe(null),e?.contextMenu?.onClose?.(),Nt.current&&jt(n.path))},[e?.contextMenu,jt]);Pt.current=Ft;let It=TP(e=>{let t=e==null?null:aF(S.current,e);Ce(e=>e===t?e:t)},[]),Lt=TP((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=nt(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Le(n,e?.scrollTop??null),M.current=!0,ye(e=>e===n?e:n)}i.focus(),It(a),Nt.current=!0,Oe({anchorRect:r?.anchorRect??null,item:dF(e,n),path:n,source:r?.source??`keyboard`})},[t,nt,It]),L=TP(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=JN(e,xt);ne.current=I<0||e==null?null:Math.max(0,Math.min(I*s-e.scrollTop,Math.max(0,t-s))),te.current=!0}t.startRenaming(e)!==!1&&(Te(`focus`),ge(e=>e+1))}},[t,I,s,l,xt]),Rt=TP((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=JN(i,xt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:LP({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,$N(i,a,s,l,u,d),D.current(),Ae.current=n?e:null,!0},[t,s,c,xt,h]),zt=()=>y.current===!0||me.current!=null||ue.current===!0,Bt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Vt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Ht=()=>{ae.current!=null&&(clearTimeout(ae.current),ae.current=null),ie.current=null},Ut=()=>{se.current?.remove(),se.current=null},Wt=()=>{Vt(re.current),re.current=null,oe.current=null},Gt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Kt=()=>{le.current?.(),le.current=null,me.current!=null&&(clearTimeout(me.current),me.current=null),ue.current=!1,de.current=null,pe.current=null,fe.current!=null&&(fe.current.setAttribute(`draggable`,`true`),fe.current.style.removeProperty(`touch-action`),fe.current=null),Ut(),Ht(),Wt(),ce.current=null},qt=(e,n)=>{let r=S.current?.getRootNode(),i=UP(VP(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Jt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Ht();return}let r=t.getItem(e.directoryPath),i=YP(r)?r:null;if(i==null||i.isExpanded()){Ht();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;ie.current!==a&&(Ht(),ie.current=a,ae.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Yt=()=>{re.current=null;let e=oe.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=KP(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Jt(qt(e.clientX,e.clientY)),re.current=Bt(Yt)},Xt=(e,t)=>{oe.current={clientX:e,clientY:t},re.current??=Bt(Yt)},Zt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Kt(),Ut(),Ht(),Wt(),t.startDrag(r)===!1){e.preventDefault();return}if(ce.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),GP())){let t=WP(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Gt(t),se.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Qt=()=>{Ut(),Ht(),Wt(),ce.current=null,t.cancelDrag()},$t=(e,n,r)=>{if(me.current!=null||ue.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;pe.current={clientX:i.clientX,clientY:i.clientY},fe.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!ue.current;me.current!=null&&(clearTimeout(me.current),me.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),le.current===o&&(le.current=null),t&&(a.setAttribute(`draggable`,`true`),fe.current===a&&(fe.current=null),pe.current=null)},s=e=>{let t=e.touches[0],n=pe.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),le.current=o,me.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),fe.current===a&&(fe.current=null),pe.current=null;return}ue.current=!0,fe.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),ce.current=n;let e=a.getBoundingClientRect(),s=WP(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Gt(s),se.current=s,de.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=de.current;n!=null&&se.current!=null&&(se.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Jt(qt(t.clientX,t.clientY)),Xt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&qt(n.clientX,n.clientY),t.completeDrag(),Kt()},u=()=>{t.cancelDrag(),Kt()};le.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},RP)},en=e=>{if(P!=null){if(e.key===`Escape`){Ft(),e.preventDefault(),e.stopPropagation();return}tF.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(at.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)at.cancel();else if(e.key===`Enter`)at.commit();else return;Te(`focus`),ge(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){L(F??void 0),e.preventDefault(),e.stopPropagation();return}if(ct){if(e.key===`Escape`)te.current=!1,ne.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=JN(n,xt);ne.current=I<0||n==null?null:Math.max(0,Math.min(I*s-n.scrollTop,Math.max(0,r-s))),te.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;Te(`focus`),ge(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&ZP(e)){t.openSearch(e.key),ge(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Je&&$P(e),r=eF(e,Je),i=r&&S.current!=null?qN(S.current):null,a=r?new Set(cF(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==F&&a.has(o)){let e=C.current;Le(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=YP(p)?p:null,h=u!=null&&(Dt.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=sF(u,E.current,T.current);e==null||n==null?y=!1:Lt(e,u)}else if((e.ctrlKey||e.metaKey)&&XP(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;Te(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Dt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Le(b,v?.scrollTop??null),M.current=!0,ye(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Re(b,uF(S.current,v,i,u,s,Et,xt)),M.current=!0,ye(e=>e===b?e:b)):Ie()}ge(e=>e+1),e.preventDefault(),e.stopPropagation()};CP(()=>{if(!(!f||!ct)){if(ze.current){ze.current=!1;return}KN(w.current)}},[ct,f]),CP(()=>{let e=x.current;switch(tP({hasRenderedInput:e!=null,previousRenamingPath:N.current,renamingPath:ot})){case`reset`:N.current=null;return;case`reveal-canonical`:ot!=null&&Rt(ot,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Ae.current=null,N.current=ot,KN(e),e.select());return}},[St.end,St.start,ot,Rt,Dt]),CP(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=qN(e)?.dataset.itemPath??null;ye(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,qN(e)!=null){r();return}M.current=!1,ye(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,ye(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;ye(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),CP(()=>{let e=S.current;e!=null&&(yt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[yt.physical.scrollTop]),CP(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=JN(n,g);let a=()=>{let e=t.getVisibleCount(),r=YN(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ge(LP({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=YN(O.current,g),i=t.getVisibleRows(e,e)[0]??null;ZN(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=t.subscribe(()=>{HN(_e)&&ge(e=>e+1),a()}),l=()=>{Fe.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,De(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&Fe.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),ke.current!=null&&y.current&&Pt.current(),Fe.current===!0){y.current=!1;return}xe(e=>e==null?e:null),l()},m=()=>{l(),f()},_=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{_.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let x=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:XN(e[0]))??JN(n,g),a()}):null;return x?.observe(n),()=>{D.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,x?.disconnect()}},[t,g,s,c,h]),CP(()=>{Je||P==null||Ft(!1)},[Ft,Je,P]);let tn=wP(()=>P==null?null:`${P.path}::${P.source}`,[P]);CP(()=>{if(tn==null){m?.clearSlotContent(xD);return}let t=ke.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??rF(n.getBoundingClientRect()),close:e=>{Pt.current(e?.restoreFocus??!0)},restoreFocus:()=>{Nt.current&&Mt.current(ke.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(xD,i),e?.contextMenu?.onOpen?.(t.item,r),gF(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&gF(i)}),()=>{m?.clearSlotContent(xD)}},[tn,e?.contextMenu,m]),CP(()=>{P!=null&&t.getItem(P.path)==null&&Ft()},[Ft,P,t]),CP(()=>{if(P==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(nF(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Ft())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Ft())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Ft,P]),CP(()=>{let e=C.current,n=S.current;if(e==null||n==null){ee.current=F;return}let r=F==null?null:T.current.get(F)??null,i=qN(n),a=i?.dataset.itemPath??null,o=st&&x.current===i,c=f&&w.current===i,l=te.current&&!ct,u=ne.current??0,d=Ae.current,p=je.current,m=Me.current,g=Ne.current,_=i!=null,v=M.current||_,y=ee.current!==F,b=p!=null&&p===F&&F!=null,E=!1,O=!1;if(ut!=null&&ut.id!==k.current){k.current=ut.id;let n=ut.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,xt-s))):Et;E=!0,O=QN(e,n,s,xt,Tt,ut.offset,t)}t.clearScrollRequest(ut.id)}let A=!E&&l&&$N(e,I,s,xt,Tt,u),j=!E&&d!=null&&d===F&&$N(e,I,s,xt,Tt,Et),N=!E&&m!=null&&m.path===F&&$N(e,I,s,xt,Tt,m.viewportOffset),re=!E&&g!=null&&g.path===F&&e.scrollTop!==g.scrollTop;if(re&&(e.scrollTop=g.scrollTop),(re||O||j||N||A||v&&y&&d!==F&&!b&&ZN(e,I,s,xt,Et))&&D.current(),E){ee.current=F;return}if(!v){ee.current=F;return}if(o){ee.current=F;return}if(c&&!l){ee.current=F;return}if(r==null){l&&I>=0&&($N(e,I,s,xt,Tt,u),D.current()),ee.current=F;return}(y||l||d===F||p===F||m?.path===F||g?.path===F||a==null||a!==F)&&(KN(r),d===F&&(Ae.current=null),p===F&&(je.current=null),m?.path===F&&(Me.current=null),g?.path===F&&(Ne.current=null),te.current=!1,ne.current=null),ee.current=F},[t,I,F,Ot,s,st,ct,St,xt,f,ut,h,Et,Tt,bt]);let nn=I>=0&&I>=yt.visible.startIndex&&I<=yt.visible.endIndex,rn=F!=null&&Ct.some(e=>PP(e.row)===F),an=nn||rn,on=Xe&&M.current===!0&&an?F:null,sn=we===`pointer`?be:null,cn=P?.path??Pe.current??sn??on??be,ln=P?.source===`right-click`;CP(()=>{y.current&&P==null||It(nt(cn))},[P,nt,St,xt,Ee,Ct,cn,It,bt]);let un=TP(e=>{if(y.current||nF(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&Te(e=>e===`pointer`?e:`pointer`),xe(e=>e===i?e:i)},[]),dn=TP(()=>{xe(null)},[]);CP(()=>{if(!dt)return;let e=()=>{Kt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Kt(),t.cancelDrag()}},[t,dt]);let R=e=>{if(!dt||t.getDragSession()==null||ue.current)return;let n=UP(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Jt(t.getDragSession()?.target??null),Xt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},fn=e=>{if(!dt||t.getDragSession()==null||ue.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Ht(),Wt(),t.setDragTarget(null))},pn=e=>{!dt||t.getDragSession()==null||ue.current||(e.preventDefault(),qt(e.clientX,e.clientY),t.completeDrag(),Ut(),Ht(),Wt(),ce.current=null)},mn=yt.window.height,hn=yt.window.offsetTop,gn=Math.min(0,xt-mn),_n=Math.min(0,xt-mn-Et),vn=ve===F||te.current,yn=F!=null&&vn&&!Ot&&I>=0?bt[I]??t.getVisibleRows(I,I)[0]??null:null,bn=yn==null?null:eP(I,s,St,mn),xn=ce.current,Sn=ht!=null&&xn!=null&&xn.path===ht&&xn.index>=St.start&&xn.index<=St.end,Cn=ht!=null&&xn!=null&&xn.path===ht&&!Sn&&xn.path!==yn?.path?xn:null,wn=Cn==null?null:eP(Cn.index,s,St,mn),Tn=QP((I>=0?bt[I]??t.getVisibleRows(I,I)[0]??null:null)?.ancestorPaths.at(-1)??null),En=ct&&F!=null?pF(o,F,!Ot):void 0,z=P?.path??(ct?F:ve),Dn=P?.path??be,On=nt(cn),B=Je&&Xe&&!ln&&!st&&On!=null&&Se!=null&&cn!=null,V=Je&&(B||P!=null),kn=P?.anchorRect,An=kn==null&&On!=null&&Se!=null&&(P!=null||B)?Se:null,jn=kn==null?An==null?void 0:{top:`${An}px`}:{left:`${kn.left}px`,position:`fixed`,right:`auto`,top:`${kn.top}px`},Mn=ln?{opacity:`0`}:void 0,Nn=TP((e,n,r,i)=>{let a=iP({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:ct,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=yt.visible.startIndex&&n.index<=yt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,ye(e=>e===c?e:c),Te(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Rt(c,{targetOffset:`sticky-parents`})},[t,ct,yt.visible.endIndex,yt.visible.startIndex,Rt]),Pn=()=>{if(y.current||!Xe||cn==null||On==null)return;let e=t.getItem(cn);e!=null&&(It(On),Nt.current=!0,Oe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:On.getAttribute(`aria-label`)??cn,path:e.getPath()},path:e.getPath(),source:`button`}))},Fn={contextHoverPath:Dn,contextMenuButtonTriggerEnabled:Xe,contextMenuButtonVisibility:Ze,contextMenuEnabled:Je,contextMenuRightClickEnabled:Qe,contextMenuTriggerMode:Ye,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:dt,draggedPathSet:pt,dragTarget:mt,gitLaneActive:rt,gitStatusByPath:n,handleRowDragEnd:Qt,handleRowDragStart:Zt,handleRowTouchStart:$t,ignoredGitDirectories:r,ignoredInheritanceCache:he,instanceId:o,itemHeight:s,onKeyDown:en,onRowClick:Nn,openContextMenuForRow:Lt,registerButton:$e,registerRenameInput:tt,renameView:at,renderDecorationForRow:kt,resolveIcon:it,shouldSuppressContextMenu:zt,visualFocusPath:z},In={...Fn,registerButton:et};return Z(`div`,{ref:S,id:gt,"data-file-tree-context-menu-button-visibility":Je&&Xe?Ze:void 0,"data-file-tree-context-menu-trigger-mode":Je?Ye:void 0,"data-file-tree-has-context-menu-action-lane":Je&&Xe?`true`:void 0,"data-file-tree-has-git-lane":rt?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:dt?fn:void 0,onDragOver:dt?R:void 0,onDrop:dt?pn:void 0,onKeyDown:en,onPointerLeave:Je?dn:void 0,onPointerOver:Je?un:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Z(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:Tn}}),Z(`slot`,{name:bD,"data-type":`header-slot`}),f?Z(`div`,{"data-file-tree-search-container":!0,"data-open":ct?`true`:`false`,children:Z(`input`,{ref:w,"aria-activedescendant":En,"aria-controls":gt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Be?`true`:void 0,value:lt,onBlur:()=>{d===`retain`&&!He.current||t.closeSearch()},onFocus:Ue,onPointerDown:Ue,onInput:e=>{Ue();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Z(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ke&&Ct.length>0?Z(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Z(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${_t}px`},children:Ct.map((e,t)=>vF(In,e.row,`sticky:${PP(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${Ct.length-t}`}}))})}):null,Z(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${Tt}px`},children:[Z(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${hn}px`}}),Z(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${mn}px`,top:`${gn}px`,bottom:`${_n}px`},children:[yF(Fn,St,Dt),yn!=null&&bn!=null?vF(Fn,yn,`parked:${yn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:ht===yn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${bn}px`}}):null,Cn!=null&&wn!=null?vF(Fn,Cn,`parked-drag:${Cn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${wn}px`}}):null]})]})]}),Je?Z(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":V?`true`:`false`,style:jn,children:[Z(`button`,{ref:v,type:`button`,"data-type":SD,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":P==null?`false`:`true`,"data-visible":B?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),P!=null){Ft();return}Pn()},tabIndex:-1,style:Mn,children:Z(dN,{...it(`file-tree-icon-ellipsis`)})}),P==null?null:Z(`slot`,{name:xD})]}):null,P==null?null:Z(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Ft()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Ft()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var xF={hydrateRoot:(e,t)=>{oN(IM(bF,t),e)},renderRoot:(e,t)=>{aN(IM(bF,t),e)},unmountRoot:e=>{aN(null,e)}};function SF(e,t){xF.renderRoot(e,t)}function CF(e,t){xF.hydrateRoot(e,t)}function wF(e){xF.unmountRoot(e)}var TF=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}};function EF(e,t,n){if(!e.s){if(n instanceof DF){if(!n.s)return void(n.o=EF.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(EF.bind(null,e,t),EF.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var DF=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{EF(r,1,a(this.v))}catch(e){EF(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?EF(r,1,t?t(i):i):n?EF(r,1,n(i)):EF(r,2,i)}catch(e){EF(r,2,e)}},r},e}();Array.isArray;var OF=0;function kF(e){return e!=null&&e.length>0?e:(OF+=1,`pst_ft_${OF}`)}function AF({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??uj)}function jF(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function MF(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function NF(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var PF=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new TF;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=kF(a),this.#p=fM(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=lj(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new sM({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(wF(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=pM(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&SF(n.wrapper,this.#w())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),SF(t.wrapper,this.#w()))}setGitStatus(e){let t=fM(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&SF(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),SF(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),CF(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),SF(r,this.#w())}#C(){return{initialViewportHeight:AF({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(bD,e());return}this.#l.setSlotHtml(bD,this.#e?.header?.html??null)}#k(e){let t=NF(e).find(e=>MF(e)),n=jF(uD(wD(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=NF(e),n=t.find(e=>MF(e)),r=t.filter(e=>e!==n),i=wD(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=jF(i);if(a==null){for(let e of r)e.remove();return}if(r.length!==1||r[0].outerHTML!==a.outerHTML){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=wD(this.#m);t.colored&&fD(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${gD}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}(this.#g?.parentNode!==e||this.#_!==this.#h)&&(this.#g??=document.createElement(`style`),this.#g.setAttribute(gD,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=mj(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return bj(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},FF=`_jK _n`,IF=`<div><input type=search placeholder="Filter files…" aria-label="Filter files"></div>`,LF=` D l`,RF=s(18,e=>y(e,`b`,e.l,eI(e))),zF=j(11,RF),BF=s(10,e=>zF(e,(e.j??e.h)||``)),VF=j(17,RF),HF=s(16,e=>VF(e,tI(e))),UF=j(15,HF),WF=s(14,e=>UF(e,nI(e)),2),GF=u(7,e=>{BF(e),WF(e)}),KF=s(6,e=>GF(e,e.e,e.f)),qF=j(4,KF),JF=j(5,KF),YF=l(9,e=>{BF(e),WF(e)}),XF=(e,t)=>$F(e,t.timer),ZF=r(`j3`,e=>{T(e,`b`),o(e.b,`keydown`,function(t){t.key===`Enter`&&e.p(),t.key===`Escape`&&e.l&&(t.preventDefault(),e.r(``))})});function QF(e){_(e.a,`_jJ`),_(e.b,FF),YF(e,null),XF(e,{timer:0}),ZF(e)}var $F=j(13,e=>{WF(e),HF(e)}),eI=e=>function(t){e.r(t)},tI=e=>t=>{if(e.n&&clearTimeout(e.n),!t){e.n=0,YF(e,null),GF(e,``);return}YF(e,t),e.n=setTimeout(e.p,150)},nI=e=>()=>{e.n&&=(clearTimeout(e.n),0);let t=e.j===null?e.h||``:e.j;YF(e,null),GF(e,t)};d(`j0`,eI),d(`j2`,tI),d(`j1`,nI);var rI=(e=>`<div><div title="Drag to resize"></div><div>${e}</div><div></div></div>`)(IF),iI=(e=>` D b D/${e}&l l`)(LF),aI={A:`added`,D:`deleted`,M:`modified`,R:`renamed`},oI=s(7,e=>{S(e.a,`aria-expanded`,e._._.t.has(e._.f)?`false`:`true`),_(e.b,[`_jk`,{_jl:!e._._.t.has(e._.f)}])}),sI=A(29,oI,e=>e._._),cI=r(`v4`,e=>o(e.a,`click`,function(){let t=new Set(e._._.t);t.delete(e._.f)||t.add(e._.f),kI(e._._,t)})),lI=e=>{sI(e),uI._(e),dI._(e),fI._(e),_(e.a,`_jj`),Ze(e.c),N(e.c,12),$e(e.c),_(e.d,`_jm`),_(e.f,`_jn`),cI(e)},uI=c(1,0,oI),dI=c(1,0,e=>{S(e.a,`title`,e._.h),m(e.e,e._.h)}),fI=c(1,0,e=>m(e.g,e._.j)),pI=C(1,(e=>`<button type=button><span aria-hidden=true>${e}</span><span> </span><span> </span></button>`)(he),(e=>` D D/${e}&l D l D m`)(ge),lI),mI=f(4,e=>{_(e.a,[`_ji`,{_jh:e._.m===1}]),_(e.c,[`_jp`,{_jo:e._.m===1}]),pI(e,e._.m>1?0:1)}),hI=e=>{mI._(e),_I._(e)},gI=s(6,e=>S(e.c,`hidden`,e._.t.has(e.f))),_I=f(4,gI),vI=j(5,e=>{S(e.a,`data-section`,e.f),S(e.c,`data-tree`,e.f),gI(e),uI(e)}),yI=(e,t)=>{vI(e,t[0]?.id),bI(e,t[0]?.label),xI(e,t[0]?.files?.length)},bI=j(7,dI),xI=j(9,fI),SI=r(`v5`,e=>a(e,{filter:e.q,sections:e.l,commentCounts:e.n,newKeys:e.o,onMount:function(){let t=(e,t)=>`${e.worktree}/${t}`,n=e=>e.files.map(e=>({path:e.path,status:aI[e.status]??`modified`})),r=e=>e.files.map(e=>`${e.path}:${e.status}`).join(`
2797
+ `),i=(e,t)=>[...e].map(([e,t])=>`${e}=${t}`).sort().join(`,`)+`|`+[...t].sort().join(`,`),a=new Map,o=t=>e.a.querySelector(`[data-tree="${CSS.escape(t)}"]`),s=i=>{let s=o(i.id);if(!s)return;let c=new PF({paths:i.files.map(e=>e.path),gitStatus:n(i),initialExpansion:`open`,flattenEmptyDirectories:!0,search:!1,fileTreeSearchMode:`hide-non-matches`,initialSearchQuery:e.q||null,onSelectionChange(n){if(n.length===1){let r=t(i,n[0]);queueMicrotask(()=>e.p(r))}},renderRowDecoration({row:n}){if(n.kind!==`file`)return null;let r=t(i,n.path),a=e.n.has(r),o=e.o.has(r);if(!a&&!o)return null;let s=[];return o&&s.push({text:`●`,color:`var(--accent)`}),a&&s.push({text:`${o?` `:``}✎ ${e.n.get(r)??``}`.trimEnd(),color:`var(--dim)`}),{text:s.map(e=>e.text).join(``),parts:s,title:[o&&`Changed since your last visit`,a&&`Has review comments`].filter(Boolean).join(` · `)}}});c.render({containerWrapper:s});let l=()=>{if(e.l.length===1){s.style.flexBasis=``;return}let t=c.getVisibleCount()*c.getItemHeight();s.style.flexBasis=`${t}px`};l();let u=c.subscribe(l);a.set(i.id,{tree:c,sig:r(i),unsub:u})};for(let t of e.l)s(t);return{trees:a,build:s,sig:r,gitStatus:n,marks:i,shownMarks:i(e.n,e.o),shownFilter:e.q||``}},onUpdate:function(){let e=(this.filter||``)!==this.shownFilter;this.shownFilter=this.filter||``;let t=this.marks(this.commentCounts,this.newKeys),n=t!==this.shownMarks;this.shownMarks=t;let r=new Set(this.sections.map(e=>e.id));for(let[e,t]of this.trees)r.has(e)||(t.unsub(),t.tree.cleanUp(),this.trees.delete(e));for(let t of this.sections){let r=this.trees.get(t.id);if(!r){this.build(t);continue}e&&r.tree.setSearch(this.shownFilter||null);let i=this.sig(t);i===r.sig?n&&r.tree.setGitStatus(this.gitStatus(t)):(r.sig=i,r.tree.resetPaths(t.files.map(e=>e.path)),r.tree.setGitStatus(this.gitStatus(t)))}},onDestroy:function(){for(let e of this.trees.values())e.unsub(),e.tree.cleanUp()}})),CI=s(18,SI,4),wI=u(16,e=>{qF(e.d,e.q),CI(e)}),TI=s(9,e=>wI(e,e.h,e.i)),EI=j(7,TI),DI=j(8,TI),OI=g(sI),kI=l(19,e=>{_I(e),OI(e)}),AI=j(27),jI=s(24,e=>AI(e,qI(e))),MI=l(20,e=>{x(e.a,e.u==null?void 0:`--tree-w:${e.u}px`),jI(e)}),NI=l(21,e=>_(e.b,[`_jr`,{_jq:e.v}])),PI=(e,t)=>zI(e,t.id),FI=r(`v6`,e=>{o(e.b,`pointerdown`,function(t){e.z(t)}),o(e.b,`pointermove`,function(t){e.a0(t)}),o(e.b,`pointerup`,function(t){e.a1(t)}),o(e.b,`pointercancel`,function(t){e.a1(t)})});function II(e){_(e.c,`_jf`),QF(e.d),JF(e.d,JI(e)),_(e.e,`_jg`),kI(e,new Set),MI(e,P()),NI(e,!1),PI(e,{id:-1}),FI(e)}var LI=j(25),RI=j(26),zI=j(23,e=>{LI(e,YI(e)),RI(e,XI(e)),jI(e)}),BI=(e,t)=>_(e.a,[`_je`,{_jd:t===!1}]),VI=i(4,`<div><!><div></div></div>`,` D%b `,hI,yI),HI=j(11,e=>{KI(e,e.l?.length),VI(e,[e.l,`id`]),CI(e)}),UI=j(13,CI),WI=j(14,CI),GI=j(15,CI),KI=j(12,mI),qI=e=>t=>{t.pointerId===e.x&&(e.x=-1,NI(e,!1),e.u!=null&&Pe(e.u))},JI=e=>t=>{wI(e,t)},YI=e=>t=>{(t.pointerType!==`mouse`||t.button===0)&&(t.preventDefault(),e.x=t.pointerId,NI(e,!0),e.b.setPointerCapture(t.pointerId))},XI=e=>t=>{if(t.pointerId!==e.x)return;let n=window.innerWidth-t.clientX;MI(e,Math.min(640,Math.max(200,n)))};d(`v2`,qI),d(`v3`,JI),d(`v0`,YI),d(`v1`,XI);var ZI=`_i8 _bb`,QI=Je,$I=(e=>`/${e}&`)(Ke);function eL(e){ct(e.a,`M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 13.8214 2.48697 15.5291 3.33782 17L2.5 21.5L7 20.6622C8.47087 21.513 10.1786 22 12 22Z`)}var tL=(e,t)=>nt(e.a,t),nL=(e,t)=>We(e.a,t),rL=`<!><!><!>`,iL=e=>_(e.a,`_ja`),aL=e=>{eL(e.a),tL(e.a,12),nL(e.a,`_jc`)},oL=e=>_(e.a,[`_A`,`_jb`]),sL=c(1,0,e=>{S(e.a,`title`,e._.f),m(e.b,e._.f)}),cL=e=>{sL._(e),_(e.a,ZI)},lL=C(6,QI,(e=>`/${e}&`)($I),aL),uL=s(11,e=>lL(e,+!e._._._._.w.has(e.k))),dL=A(29,uL,e=>e._._._._),fL=r(`g2`,e=>o(e.a,`click`,function(){WL(e._._._._,!1)})),pL=e=>{dL(e),gL(e),vL(e),_(e.a,[`_i7`,`_y`]),_(e.b,`_ba`),_(e.d,`_i9`),fL(e)},mL=C(5,`<span title="Changed since your last visit"></span>`,` `,oL),hL=s(12,e=>mL(e,+!e._._._._.x.has(e.k))),gL=A(30,hL,e=>e._._._._),_L=s(13,e=>S(e.a,`href`,e._._._._.z(e.k))),vL=A(32,_L,e=>e._._._._),yL=j(10,e=>{_L(e),hL(e),uL(e)}),bL=(e,t)=>{S(e.b,`data-status`,t),m(e.c,t)},xL=(e,t)=>m(e.e,t),SL=(e,t)=>{yL(e,(t?.[0]).file?.key),bL(e,(t?.[0]).file?.status),xL(e,(t?.[0]).name)},CL=e=>_(e.a,`_i6`),wL=C(1,`<div><bdi><!>/</bdi></div>`,` E%`,cL),TL=j(5,e=>{wL(e,+!e.f),sL(e)}),EL=i(2,`<a><span> </span><span><bdi> </bdi></span><!><!></a>`,` D D l E m%b%`,pL,SL),DL=(e,t)=>EL(e,[t,e=>e.file.key]),OL=(e,t)=>{TL(e,(t?.[0]).dir),DL(e,(t?.[0]).files)},kL=e=>{_(e.a,`_i4`),_(e.b,`_i5`)},AL=(e,t)=>m(e.c,t),jL=i(3,`<div><!><!></div>`,` D%b%`,CL,OL),ML=(e,t)=>jL(e,[t,`dir`]),NL=(e,t)=>{AL(e,t[0]?.repo),ML(e,t[0]?.dirs)},PL=C(13,`<p>No files match.</p>`,` `,iL),FL=s(14,e=>m(e.g,e._.n===e._.y?``:` / ${e._.y}`)),IL=c(0,0,e=>{m(e.f,e._.n),PL(e,+!!e._.n),FL(e)}),LL=r(`g3`,e=>{o(e.a,`click`,function(){WL(e._,!1)}),o(e.h,`click`,function(){WL(e._,!1)})}),RL=e=>{IL._(e),zL._(e),BL._(e),HL._(e),_(e.a,`_iZ`),_(e.b,`_i0`),_(e.c,`_i1`),_(e.d,`_iY`),_(e.e,`_i2`),_(e.h,[Ee,`_iX`]),et(e.i),Ve(e.i,16),ft(e.i),_(e.j,`_i_`),QF(e.k),JF(e.k,fR(e)),_(e.l,`_i3`),LL(e)},zL=c(0,0,e=>qF(e.k,e._.u)),BL=c(0,0,FL),VL=i(12,`<div><div> </div><!></div>`,` D D l%`,kL,NL),HL=c(0,0,e=>VL(e,[e._.a0,`repo`])),UL=C(0,((e,t)=>`<div></div><div role=dialog aria-label="Jump to file"><div><strong>Files</strong><span><!><!></span><button type=button title=Close aria-label=Close>${e}</button></div><div>${t}</div><div><!><!></div></div>`)(_t,IF),((e,t)=>` b D D b D%b%l D/${e}&m D/${t}&l D%b%m`)(He,LF),RL),WL=u(18,e=>UL(e,+!e.s)),GL=s(5,e=>WL(e,e.d,e.e)),KL=j(3,GL),qL=j(4,GL),JL=u(20,zL),YL=s(8,e=>JL(e,e.g,e.h)),XL=j(6,YL),ZL=j(7,YL),QL=j(22,g(dL)),$L=(e,t)=>QL(e,t||new Set),eR=j(23,g(gL)),tR=(e,t)=>eR(e,t||new Set),nR=j(24,BL),rR=s(14,e=>nR(e,e.l??e.n)),iR=j(11,rR),aR=j(13,e=>{rR(e),IL(e)}),oR=j(25,g(vL)),sR=s(17,e=>oR(e,pR(e))),cR=j(15,sR),lR=j(16,sR),uR=j(26,HL),dR=(e,t)=>{aR(e,t?.length),uR(e,(()=>{let e=[],n=new Map;for(let r of t){let t=r.key.indexOf(`/`),i=r.key.slice(0,t),a=r.key.slice(t+1),o=a.lastIndexOf(`/`),s=o<0?``:a.slice(0,o),c=o<0?a:a.slice(o+1),l=n.get(i);l||(n.set(i,l=new Map),e.push({repo:i,dirs:[]}));let u=l.get(s);u||(l.set(s,u={dir:s,files:[]}),e[e.length-1].dirs.push(u)),u.files.push({file:r,name:c})}return e})())},fR=e=>t=>{JL(e._,t)},pR=e=>t=>Ce({workspaceId:e.p,view:`diff`,scope:e.q??null,file:t});d(`g1`,fR),d(`g0`,pR);var mR=((e,t,n,r)=>`<div><div><div><div><div><!><h1>Review</h1><!></div><div><!><button title="Refresh diff">${e}</button><!><span><select aria-label=Compare><option value=committed>Committed</option><option value=working>Working tree</option><option value=dirty>Uncommitted</option><!></select></span> <div>${t}</div><!></div></div><div><!><!><!><!></div><!></div><div data-diff-main></div></div>${n}${r}</div>`)(le,ZS,rI,rL),hR=((e,t,n,r)=>` D D D D D%b b%l D%b D/${e}&l%b D Dd%mb D0${t}&l%m D%b%b%b%l%l l/${n}&/${r}&l`)(De,QS,iI,`b%c`);function gR(e){return e.split(`
2798
2798
  `).filter(e=>e[0]===`+`||e[0]===`-`).join(`
2799
- `)}var _R=e=>{_(e.a,`_gF`),_(e.b,[`_gG`,`_gH`]),_(e.c,[`_gG`,`_gI`]),_(e.d,[`_gG`,`_gJ`])},vR=(e,t)=>S(e.a,`value`,`rev:${t}`),yR=(e,t)=>m(e.b,t),bR=i(0,`<option> </option>`,` D `,0,(e,t)=>{vR(e,t[0]?.sha),yR(e,t[0]?.label)}),xR=c(15,0,e=>bR(e,[e._.d5,`sha`])),SR=xR,CR=c(19,0,e=>S(e.a,`hidden`,e._.b8)),wR=r(`v42`,e=>o(e.a,`click`,function(){e._.ds()})),TR=e=>{CR._(e),_(e.a,[se,`_gw`,`_gn`]),oe(e.b),Te(e.b,14),yt(e.b),wR(e)},ER=c(12,0,e=>m(e.b,e._.cv)),DR=r(`v40`,e=>o(e.a,`click`,function(){dV(e._,!0)})),OR=e=>{ER._(e),_(e.a,[`_q`,`_gK`]),DR(e)},kR=c(9,0,e=>{_(e.a,[iS,`_gn`,{_gm:e._.b6}]),S(e.a,`title`,e._.b6?`Hide file tree`:`Show file tree`)}),AR=r(`v39`,e=>o(e.a,`click`,function(){uV(e._,!e._.b6),je(e._.b6)})),jR=e=>{kR._(e),Ge(e.b),qe(e.b,14),tt(e.b),AR(e)},MR=s(2,e=>m(e.b,e._.b5?`This commit is not in any of these repos.`:e._.ci.some(e=>e.unborn)?`No commits yet.`:e._.b4===`dirty`?`Nothing uncommitted.`:e._.ci.some(e=>e.pr)?`No file changes on these PRs.`:`No changes vs base.`),2),NR=c(24,0,MR),PR=e=>{NR._(e),FR._(e),IR._(e),_(e.a,`_cm`)},FR=c(24,0,MR),IR=c(24,0,MR),LR=A(181,e=>m(e.b,e._._.b4===`committed`?``:`, showing uncommitted changes only`),e=>e._._),RR=e=>{LR(e),zR(e)},zR=A(5,e=>m(e.a,e._.e)),BR=v(`v44`,`<!><!>.`,`%b%`,RR),VR=e=>{ut(e.a),Ne(e.a,BR(e)),Ue(e.a,`warn`),mt(e.a,`inline`),Ae(e.a),ee(e.a),it(e.a),xe(e.a,{})},HR=(e,t)=>Le(e.a,`${t}: base not found`),UR=(e,t)=>{HR(e,t[0]?.worktree),WR(e,t[0]?.base)},WR=j(4,g(zR)),GR=s(2,e=>m(e.b,e._.bf.trim()?`No matches in review.`:e._.b3&&!e._.b0?`Nothing changed since your last visit.`:`No files match "${e._.b0}".`),2),KR=c(24,1,GR),qR=e=>{KR._(e),JR._(e),YR._(e),_(e.a,`_cm`)},JR=c(24,1,GR),YR=c(24,1,GR),XR=A(177,e=>m(e.a,e._._.ax),e=>e._._),ZR=v(`v43`,` `,` `,XR),QR=e=>{ut(e.a),Ne(e.a,ZR(e)),it(e.a,BH(e)),Ae(e.a),ee(e.a),Ue(e.a),mt(e.a),Le(e.a),xe(e.a,{})},$R=A(174,e=>NT(e.a,e._._._.an||``),e=>e._._._),ez=e=>{$R(e),tz(e),nz(e),rz(e),iz(e),oz(e),sz._(e),lz._(e),uz._(e),dz._(e),fz._(e),pz._(e),mz._(e),IT(e.a),eE(e.a,UH(e)),$T(e.a,HH(e)),XT(e.a,VH(e))},tz=A(175,e=>PT(e.a,e._._._.ao||``),e=>e._._._),nz=A(178,e=>ZT(e.a,e._._._.ay),e=>e._._._),rz=A(180,e=>YT(e.a,e._._._.b3),e=>e._._._),iz=A(186,e=>QT(e.a,e._._._.c9),e=>e._._._),az=s(1,e=>zT(e.a,e._._._.d2.has(e._.i))),oz=A(190,az,e=>e._._._),sz=c(0,0,e=>DT(e.a,e._.c)),cz=s(2,e=>{LT(e.a,e._.k||e._.f),GT(e.a,e._.f-e._.k)}),lz=c(0,0,cz),uz=c(0,0,az),dz=c(0,0,cz),fz=c(0,0,e=>HT(e.a,e._.l)),pz=c(0,0,e=>UT(e.a,e._.m)),mz=c(0,0,e=>JT(e.a,e._.n)),hz=(e,t)=>{yz(e,t?.files),bz(e,t?.additions),xz(e,t?.deletions),Sz(e,t?.fresh)},gz=s(3,e=>hz(e,e._._.d8(e.c))),_z=A(192,gz,e=>e._._),vz=_z,yz=j(10,dz),bz=j(11,fz),xz=j(12,pz),Sz=j(13,mz),Cz=j(2,e=>{Ez(e,e.c?.files?.length),Dz(e,e.c?.pr),kz(e,e.c?.id),gz(e),sz(e)}),wz=C(0,ow,(e=>`/${e}&`)(sw),ez),Tz=s(7,e=>wz(e,e.f||e.g?0:1)),Ez=j(5,e=>{Tz(e),lz(e)}),Dz=j(6,Tz),Oz=(e,t)=>Cz(e,t[0]),kz=j(8,uz),Az=i(0,`<!><!><!>`,`b%`,vz,Oz),jz=c(25,0,e=>Az(e,[e._.ck,`id`])),Mz=e=>{jz._(e),_(e.a,`_gL`)},Nz=c(7,0,e=>LS(e.e,e._.am)),Pz=e=>{Nz._(e),Fz._(e),Iz._(e),Lz._(e),_(e.a,`_gu`),_(e.d,`_gt`),jS(e.e)},Fz=c(7,0,e=>{m(e.b,e._.av),m(e.c,e._.av===1?``:`s`)}),Iz=c(7,0,e=>RS(e.e,e._.do)),Lz=c(7,0,e=>zS(e.e,e._.dp)),Rz=c(5,0,e=>S(e.a,`href`,`/w/${e._.a5}`)),zz=e=>{Rz._(e),_(e.a,[se,`_gs`]),de(e.b),ce(e.b,14),ye(e.b)},Bz=w(`v38`,165),Vz=j(136,g(oz)),Hz=r(`v45`,e=>a(e,{active:e.ah,load:e.c4,findOpen:e.b8,shownFiles:e.ct,commentsByFile:e.cy,draft:e.aw,sessions:e.am,collapsedFiles:e.bj,repos:e.ar,onMount:function(){let t=new AbortController,n=()=>e.am||[],r=(t,n=!0)=>{let r=e.a0,i=t.getBoundingClientRect();if(!i.height)return;let a=r.getBoundingClientRect(),o=getComputedStyle(t),s=i.top-(parseFloat(o.scrollMarginTop)||0),c=i.bottom+(parseFloat(o.scrollMarginBottom)||0),l=0;s<a.top?l=s-a.top:c>a.bottom&&(l=c-a.bottom),l&&r.scrollTo({top:Math.max(0,r.scrollTop+l),behavior:n?`smooth`:`auto`})},i=new WeakMap,a=async(t,n,r)=>{if(!r)return``;let i=new URLSearchParams({worktree:t,path:n,rev:r});return(await gt(`/api/workspaces/${e.a5}/diff/contents?${i}`)).contents??``},o={viewer:null},s={key:null,top:null},c=new Map,l,u={draft:!0},d,f=(e,t,n)=>{let r=[];for(let e of t){let t=c.get(e.id);(!t||t.comment.text!==e.text)&&(t={comment:e}),c.set(e.id,t),r.push({side:e.side,lineNumber:e.line_end,metadata:t})}return n&&n.key===e&&(l!==n&&(l=n,u={draft:!0},d=void 0),r.push({side:n.side===`deletions`?`deletions`:`additions`,lineNumber:n.end,metadata:u})),r},p=(e,t,n)=>e.map(e=>`${e.id}:${e.text.length}`).join(`,`)+(t&&t.key===n?`|d${t.side}${t.start}-${t.end}`:``),m=(t,n)=>{if(!t)return;let r=t.endSide!=null&&t.endSide!==t.side;tV(e,{key:n,side:t.side||`additions`,start:Math.min(t.start,r?t.start:t.end),end:Math.max(t.start,r?t.start:t.end)})},h={theme:{dark:`pierre-dark`,light:`pierre-light`},themeType:lt(),diffStyle:_e()?`unified`:`split`,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:44},..._e()&&{renderCodeViewHeader:()=>e.c},enableLineSelection:!0,layout:{paddingTop:0,paddingBottom:24,gap:12},unsafeCSS:` @media (pointer: coarse) { pre[data-diff] { touch-action: pan-x pan-y; } [data-column-number], [data-gutter-utility-slot] { touch-action: none !important; } }`+Rx,async loadDiffFiles(t){let n=i.get(t),r=(e.ar||[]).find(e=>e.id===n?.repo);if(!n||!r)throw Error(`unknown file`);let[o,s]=await Promise.all([t.type===`new`?Promise.resolve(``):a(n.worktree,t.prevName||n.path,r.oldRev),t.type===`deleted`?Promise.resolve(``):a(n.worktree,n.path,r.newRev)]);return{oldFile:{name:t.prevName||t.name,contents:o},newFile:{name:t.name,contents:s}}},renderCustomHeader(t,n){let r=n.item,i=e.db(r.id),a=document.createElement(`div`);a.className=`_gO${r.collapsed?` _gP`:``}`,a.title=r.id;let c=document.createElement(`span`);c.className=`_gQ`,c.textContent=`▾`;let l=document.createElement(`span`);l.className=`_ba`;let u=i?.status||(r.type===`diff`?r.fileDiff.type[0].toUpperCase():`M`);l.dataset.status=u,l.textContent=u;let d=document.createElement(`span`);d.className=`_gR`;let f=document.createElement(`bdi`);if(f.textContent=r.id,d.append(f),a.append(c,l,d),i?.changedSince){let e=document.createElement(`span`);e.className=`_A _gV`,e.title=`Changed since your last visit`,a.append(e)}let p=e.cy.get(r.id)?.length||0;if(p){let e=document.createElement(`span`);e.className=`_u`,e.textContent=`✎ ${p}`,a.append(e)}if(i&&(i.additions||i.deletions)){let e=document.createElement(`span`);e.className=`_gS`;let t=document.createElement(`span`);t.className=`_gT`,t.textContent=`+${i.additions||0}`;let n=document.createElement(`span`);n.className=`_gU`,n.textContent=`−${i.deletions||0}`,e.append(t,n),a.append(e)}return a.onclick=()=>{s.key=r.id,s.top=o.viewer?.getTopForItem(r.id)??null;let t=new Set(e.bj);t.delete(r.id)||t.add(r.id),vV(e,t)},a},renderAnnotation(t,i){let a=t.metadata||{},o=i.item.id;if(a.draft)return d??=Ax({sessions:n,reveal:r},{onSave:t=>e.dd(o,t),onSend:(t,n)=>e.dr(o,t,n),onCancel:()=>{tV(e,null)}});let s=a.comment;if(!s)return;let c=i.item.type===`diff`?i.item.fileDiff:null,l=s.snippet!=null&&!!c&&gR(rx(c,s.side,s.line_start,s.line_end))!==gR(s.snippet);return kx(s,{sessions:n,reveal:r},{onDelete:t=>e.dg(t),onEdit:(t,n)=>e.dh(t,n),onSend:(t,n)=>e.dq(t,n),drifted:l})},onLineSelectionEnd(e,t){m(e,t.item.id)},onPostRender(e,t,n,r){let i=e;if(n===`unmount`){g.get(i)?.(),g.delete(i);return}g.has(i)?Xx(i):g.set(i,Yx(i,r.item.id))}},g=new Map,_=new Nb(h,yx());o.viewer=_,_.setup(e.a0);let v=fe(e=>{h.themeType=e,_.setOptions({...h})});be()&&Sx(()=>e.a0,t.signal),e.bp.scrollToItem=t=>{y.recs.has(t)&&(e.bx=null,_.scrollTo({type:`item`,id:t,align:`start`,behavior:`instant`}))},e.bp.scrollToLine=(e,t,n)=>_.scrollTo({type:`line`,id:e,lineNumber:t,side:n||`additions`,align:`center`,behavior:`instant`}),e.bp.clearSelection=()=>_.clearSelectedLines();let y={abort:t,viewer:_,unregTheme:v,unsubScroll:_.subscribeToScroll(t=>{e.bt||=requestAnimationFrame(()=>{e.bt=0;let n=null;for(let r of _.getRenderedItems()){let i=_.getTopForItem(r.id);i==null||i>t+1||(!n||i>(_.getTopForItem(n.key)??-1))&&(n={scope:e.b4,key:r.id,off:Math.round(t-i)})}t>0&&(e.br=n)})}),hostUnregs:g,loaded:!1,wasActive:!1,lastNonce:e.ap||0,lastFileNonce:e.aq||0,recs:new Map,order:``,revealedDraft:null,dockedOpen:!1,start:()=>{this.active&&!y.loaded&&(y.loaded=!0,this.load())},pin:t=>{let n=e.a0,r=Date.now(),i=!1,a=()=>{i=!0};for(let e of[`wheel`,`touchstart`,`keydown`])n.addEventListener(e,a,{once:!0,passive:!0});let o=()=>{if(i||!y.recs.has(t.key))return;let e=y.viewer.getTopForItem(t.key);if(e!=null){let n=e+t.off;Math.abs(y.viewer.getScrollTop()-n)>1&&y.viewer.scrollTo({type:`position`,position:n,behavior:`instant`})}Date.now()-r<1500&&requestAnimationFrame(o)};o()},sync:()=>{let t=[],n=new Set,r=!1;for(let e of this.shownFiles){n.add(e.key);let a=y.recs.get(e.key),o=a&&a.patch===e.patch&&a.status===e.status?a.fileDiff:$b(e,e.key),s=this.commentsByFile.get(e.key)||[],c=p(s,this.draft,e.key),l=this.collapsedFiles.has(e.key);o&&i.set(o,{worktree:e.key.slice(0,e.key.indexOf(`/`)),path:e.path,repo:e.repo});let u={name:e.path,contents:e.binary?`(binary file)`:e.tooLarge?`(file too large to display)`:`(file could not be read)`},d=a;!d||d.item.type===`diff`!=!!o?(d={item:o?{id:e.key,type:`diff`,fileDiff:o,annotations:f(e.key,s,this.draft),collapsed:l,version:(d?.item.version??0)+1}:{id:e.key,type:`file`,file:u,collapsed:l,version:(d?.item.version??0)+1},fileDiff:o,annSig:c,collapsed:l,patch:e.patch,status:e.status},y.recs.set(e.key,d),r=!0):(d.fileDiff!==o||d.annSig!==c||d.collapsed!==l)&&(d.item.type===`diff`&&o?(d.item.fileDiff=o,d.item.annotations=f(e.key,s,this.draft)):d.item.type===`file`&&(d.item.file=u),d.item.collapsed=l,d.item.version=(d.item.version??0)+1,d.fileDiff=o,d.annSig=c,d.collapsed=l,d.patch=e.patch,d.status=e.status,r||y.viewer.updateItem(d.item)),t.push(d.item)}for(let e of[...y.recs.keys()])n.has(e)||y.recs.delete(e);let a=t.map(e=>e.id).join(`
2800
- `);if((r||a!==y.order)&&(y.order=a,y.viewer.setItems(t)),s.key){let{key:e,top:t}=s;s.key=null,t!=null&&t<y.viewer.getScrollTop()&&y.viewer.scrollTo({type:`item`,id:e,align:`start`,behavior:`instant`})}let o=this.draft;o&&o!==y.revealedDraft&&y.recs.has(o.key)&&(y.revealedDraft=o,y.viewer.scrollTo({type:`line`,id:o.key,lineNumber:o.end,side:o.side===`deletions`?`deletions`:`additions`,align:`nearest`,offset:180,behavior:`smooth-auto`}));let c=e.bv;c&&y.recs.has(c.key)&&(e.bv=null,y.pin(c)),e.bx&&y.recs.has(e.bx)&&e.bp.scrollToItem(e.bx)}};return y.wasActive=!!this.active,this.findOpen&&(y.dockedOpen=!0,e.e0(!0)),Be().addEventListener(`review.changed`,t=>{y.loaded&&t.data?.workspaceId===e.a5&&e.cb()},{signal:t.signal}),Be().addEventListener(`status.changed`,t=>{if(!this.active||!y.loaded||e.ay)return;let n=t.data,r=n&&n[e.a5];if(!r)return;let i=Zb(r);!i||!e.bl||i===e.bl||e.ca()},{signal:t.signal}),window.addEventListener(`pagehide`,()=>{this.active&&y.loaded&&(e.ch(),e.c0())},{signal:t.signal}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&this.active&&y.loaded&&e.c0()},{signal:t.signal}),y.start(),y},onUpdate:function(){this.start(),this.active&&this.loaded&&!this.wasActive&&e.c9(),!this.active&&this.loaded&&this.wasActive&&(e.ch(),e.c0()),this.wasActive=!!this.active,!!this.findOpen!==this.dockedOpen&&(this.dockedOpen=!!this.findOpen,e.e0(this.dockedOpen));let t=e.ap||0;this.loaded&&e.af&&t!==this.lastNonce&&e.c2(e.af),this.lastNonce=t;let n=e.aq||0;this.loaded&&e.ag&&n!==this.lastFileNonce?(e.c1(e.ag),this.lastFileNonce=n):this.loaded&&(this.lastFileNonce=n),e.a6&&e.a6!==e.b4&&e.cc(e.a6,!1),e.a7!==void 0&&(e.a7??null)!==e.b5&&e.cd(e.a7??null),this.draft||this.viewer.clearSelectedLines(),this.sync()},onDestroy:function(){e.bm&&clearTimeout(e.bm),this.loaded&&(e.ch(),e.c0()),this.abort.abort(),this.unsubScroll(),this.unregTheme();for(let e of this.hostUnregs.values())e();this.viewer.cleanUp()}})),$=s(171,Hz,41),Uz=j(147,$),Wz=s(146,e=>Uz(e,WH(e)),5),Gz=j(161,$),Kz=s(157,e=>Gz(e,GH(e)),5),qz=j(144,e=>{Wz(e),Kz(e)}),Jz=i(22,Xe,(e=>`/${e}&`)(ot),VR,UR),Yz=(e,t)=>{WI(e.a1,t),tR(e.a2,t)},Xz=j(145,e=>{Wz(e),Kz(e),$(e)}),Zz=(e,t)=>IC(e.r,t),Qz=j(142,g(_z)),$z=(e,t)=>HI(e.a1,t),eB=s(128,e=>$z(e,e.ck.map(t=>({id:t.id,label:t.pr?`${t.worktree} #${t.pr.number}`:t.worktree,worktree:t.worktree,files:e.ct.filter(e=>e.repo===t.id)})).filter(e=>e.files.length))),tB=j(127,e=>{dR(e.a2,e.ct),CH(e,e.ct?.length),Qz(e,JH(e)),eB(e),$(e)}),nB=s(126,e=>tB(e,e.cr?e.cq.filter(t=>e.cr.has(t.key)||t.key===e.bi):e.cq),2),rB=j(124,e=>{Zz(e,e.cq.map(e=>({...e,fileDiff:$b(e,e.key)}))),nB(e)}),iB=s(121,e=>rB(e,(()=>{let t=bx(e.b0);return e.cm.filter(n=>t(n.key)&&(!e.b3||n.changedSince))})()),2),aB=j(120,e=>{SH(e,e.cm?.length),Yz(e,new Set(e.cm.filter(e=>e.changedSince).map(e=>e.key))),Xz(e,qH(e)),iB(e)}),oB=j(118,e=>{xH(e,e.ck?.length),aB(e,e.ck.flatMap(e=>e.files.map(t=>({...t,repo:e.id,key:`${e.worktree}/${t.path}`})))),eB(e),jz(e)}),sB=j(139,e=>{TH(e,e.d5?.length),xR(e)}),cB=s(117,e=>{oB(e,e.b5?e.ci.filter(e=>e.rev):e.ci),sB(e,(()=>{let t=new Set,n=[];for(let r of e.ci)for(let e of r.commits||[])t.has(e.sha)||(t.add(e.sha),n.push({sha:e.sha,label:`${r.worktree}#${Nx(e.sha,7)} ${e.subject}`}));return e.b5&&!t.has(e.b5)&&n.unshift({sha:e.b5,label:Nx(e.b5,7)}),n})())}),lB=j(116,e=>{Vz(e,new Set(e.ci.filter(e=>!!e.pr&&!!e.localHead&&(e.localHead!==e.head||e.branch!==e.pr.headRefName)).map(e=>e.id))),qz(e,KH(e)),Jz(e,[e.ci.filter(e=>e.baseMissing),`id`]),cB(e),IR(e)}),uB=j(98,$),dB=s(90,e=>uB(e,YH(e)),2),fB=g(iz),pB=j(107,e=>{$(e),fB(e)}),mB=s(103,e=>pB(e,XH(e))),hB=j(108,$),gB=s(106,e=>hB(e,ZH(e)),4),_B=s(114,e=>k(e,`o`,e.b5?`rev:${e.b5}`:e.b4,QH(e)),2),vB=j(113,_B),yB=s(112,e=>vB(e,t=>{if(t.startsWith(`rev:`)){e.cd(t.slice(4));return}let n=t;if(e.b5&&(UV(e,null),e.aj?.(null),n===e.b4)){e.c4(e.b4);return}e.cc(n)}),5),bB=j(110,e=>{yB(e),$(e)}),xB=s(104,e=>bB(e,$H(e)),2),SB=j(111,e=>{yB(e),$(e)}),CB=s(105,e=>SB(e,eU(e)),3),wB=j(102,e=>{mB(e),gB(e),xB(e),CB(e),yB(e),$(e)}),TB=s(101,e=>wB(e,tU(e)),10),EB=j(100,e=>{TB(e),$(e)}),DB=s(94,e=>EB(e,nU(e)),2),OB=j(115,$),kB=s(54,e=>OB(e,rU(e))),AB=C(9,(e=>`<button>${e}</button>`)(Fe),(e=>` D/${e}&l`)(vt),jR),jB=C(12,`<button title="Jump to file">Files (<!>)</button>`,` Db%`,OR),MB=C(19,(e=>`<button title="Find in review (⌘/Ctrl+F)" aria-label="Find in review">${e}</button>`)(ae),(e=>` D/${e}&l`)(ve),TR),NB=s(138,e=>MB(e,e.d3&&!e.ba?0:1)),PB=j(137,e=>{AB(e,+!e.d3),jB(e,+!e.d3),NB(e)}),FB=s(123,e=>PB(e,!e.ar||e.co>0)),IB=j(158,Iz),LB=j(159,Lz),RB=j(160,$),zB=s(156,e=>{IB(e,iU(e)),LB(e,aU(e)),RB(e,oU(e))}),BB=j(155,e=>{zB(e),Kz(e)}),VB=s(154,e=>BB(e,sU(e)),4),HB=C(23,`<div aria-hidden=true><div></div><div></div><div></div></div>`,` D b b `,_R),UB=s(61,e=>HB(e,!e.ar&&e.ay?0:1)),WB=C(24,`<p> </p>`,` D `,PR,`<p> </p>`,` D `,qR),GB=s(130,e=>WB(e,e.ar&&!e.co?0:e.ar&&!e.cv&&!e.bh?1:2),3),KB=l(53,e=>{lB(e,e.ar||[]),dB(e),DB(e),kB(e),FB(e),VB(e),UB(e),GB(e),$(e)}),qB=(e,t)=>$L(e.a2,t),JB=(e,t)=>UI(e.a1,t),YB=j(132,e=>{qB(e,new Set(e.cy.keys())),JB(e,new Map([...e.cy].map(([e,t])=>[e,t.length]))),$(e)}),XB=j(150,$),ZB=s(149,e=>XB(e,cU(e))),QB=j(151,$),$B=s(56,e=>QB(e,lU(e))),eV=l(55,e=>{NV(e,e.at?.length),YB(e,(()=>{let t=new Map;for(let n of e.at){let e=`${n.worktree}/${n.path}`;t.set(e,[...t.get(e)||[],n])}return t})()),Wz(e),ZB(e),$B(e),VB(e),zB(e)}),tV=l(58,e=>{Wz(e),Kz(e),$(e)}),nV=C(21,Xe,(e=>`/${e}&`)(ot),QR),rV=g(XR),iV=l(59,e=>{nV(e,+!e.ax),rV(e)}),aV=g(nz),oV=l(60,e=>{S(e.k,`disabled`,e.ay),Ct(e.l,e.ay&&`_F`),S(e.o,`disabled`,e.ay),gB(e),UB(e),$(e),aV(e)}),sV=(e,t)=>{DI(e.a1,t),ZL(e.a2,t)},cV=g(rz),lV=l(65,e=>{TB(e),iB(e),cV(e),JR(e)}),uV=l(68,e=>{BI(e.a1,e.b6),kR(e)}),dV=l(69,e=>KL(e.a2,e.b7)),fV=r(`v49`,e=>{e.ba&&!e.b8&&GV(e,!0)}),pV=s(73,fV),mV=j(72,e=>{UC(e.r,e.ba),GC(e.r,!e.ba),pV(e),NB(e)}),hV=j(125,nB),gV=e=>{hV(e,e.bf.trim()?new Set(e.bg):null)},_V=l(76,e=>{nH(e,e.be?.query),rH(e,e.be?.keys),iH(e,e.be?.hit),gV(e)}),vV=l(81,$),yV=(e,t)=>{oH(e,t.sig),sH(e,t.timer)},bV=(e,t)=>cH(e,t.seq),xV=(e,t)=>SC(e.r,function(e){t(e)}),SV=j(99,e=>{GI(e.a1,dU(e)),TB(e),$(e)}),CV=s(96,e=>SV(e,fU(e)),3),wV=j(87,e=>{xV(e,t=>{if(_V(e,t),!t.hit)return;let n=t.hit;setTimeout(()=>{n.line<1?e.bp.scrollToItem(n.key):e.bp.scrollToLine(n.key,n.line,n.side)},0)}),CV(e),DB(e),$(e)}),TV=(e,t)=>{lH(e,t.anchor),uH(e,t.raf)},EV=(e,t)=>{fH(e,t.pos),pH(e,t.jump)},DV=j(143,e=>{Wz(e),Kz(e)}),OV=(e,t)=>EH(e,t.busy),kV=(e,t)=>{NH(e,t.home),PH(e,t.raf)},AV=r(`v47`,e=>{o(e.k,`click`,function(){e.c9()}),b(e,`o`)});function jV(e){p(e,17,AH),_(e.a,`_gl`),_(e.b,`_gq`),_(e.c,`_gZ`),_(e.d,`_gr`),_(e.g,aS),_(e.i,[`_gp`,`_gW`]),_(e.k,[se,`_gn`]),Oe(e.l),te(e.l,14),_(e.n,[`_o`,`_gC`,`_gX`]),_(e.o,[`_p`,`_gD`,`_gY`]),PC(e.r),lC(e.r,vU(e)),_C(e.r),vC(e.r),xC(e.r),_(e.u,`_gM`),_(e.a0,`_gN`),II(e.a1),e.a2,qL(e.a2,_U(e)),M(e,Bz(e)),KB(e,null),eV(e,[]),tV(e,null),iV(e,null),oV(e,!1),sV(e,uU(e)),lV(e,!1),uV(e,ue()),dV(e,!1),mV(e,!_e()),_V(e,{query:``,hit:null,keys:[]}),vV(e,new Set),yV(e,{sig:``,timer:0}),bV(e,{seq:0}),wV(e,{scrollToItem:hU,scrollToLine:mU,clearSelection:pU}),TV(e,{anchor:null,raf:0}),EV(e,{pos:null,jump:null}),DV(e,gU),OV(e,{busy:0}),kV(e,{home:null,raf:0}),AV(e)}var MV=C(7,(e=>`<span><!> comment<!></span><span>${e}</span>`)(oS),(e=>` D%c%l D/${e}&l`)(sS),Pz),NV=j(57,e=>{_(e.e,[`_gB`,{_gA:!e.av}]),MV(e,+!e.av),Fz(e)}),PV=r(`v46`,e=>{e.b0!==wt(e.a5)&&F(e.a5,e.b0)}),FV=s(63,PV),IV=l(62,e=>{EI(e.a1,e.b0),XL(e.a2,e.b0),iB(e),FV(e),KR(e)}),LV=j(109,$),RV=j(148,e=>{ZB(e),VB(e)}),zV=j(31,e=>{cR(e.a2,e.a5),IV(e,wt(e.a5)),LV(e,yU(e)),RV(e,bU(e)),dB(e),TB(e),kB(e),Wz(e),$B(e),Kz(e),FV(e),$(e),Rz(e)}),BV=g(LR),VV=l(66,e=>{lR(e.a2,e.b4),TB(e),mB(e),gB(e),xB(e),CB(e),yB(e),_B(e),$(e),BV(e),NR(e)}),HV=j(32,e=>{VV(e,e.a6??ke()),$(e)}),UV=l(67,e=>{TB(e),CB(e),yB(e),cB(e),_B(e),$(e),FR(e)}),WV=j(33,e=>{UV(e,e.a7??null),$(e)}),GV=u(70,e=>{_(e.q,[`_gy`,{_gx:!e.b8}]),cC(e.r,e.b8),pV(e),$(e),CR(e)}),KV=s(36,e=>GV(e,e.a8,e.a9)),qV=j(34,KV),JV=j(35,KV),YV=r(`v48`,e=>{e.ah&&window.addEventListener(`keydown`,t=>{!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()===`f`&&(t.target instanceof HTMLTextAreaElement||(t.preventDefault(),e.ds()))},{capture:!0,signal:E(e,0)})}),XV=s(163,e=>{D(e,0),YV(e)}),ZV=j(162,XV),QV=u(74,e=>{WC(e.r,e.bc),ZV(e,xU(e))}),$V=s(39,e=>QV(e,e.ab,e.ac)),eH=j(37,$V),tH=j(38,$V),nH=j(77,YR),rH=j(78),iH=j(79,e=>{aH(e,e.bh?.key),GB(e)}),aH=j(80,nB),oH=j(83,e=>{TB(e),$(e)}),sH=j(84,e=>{gB(e),$(e)}),cH=j(86,TB),lH=j(89,e=>{dB(e),$(e)}),uH=j(91,$),dH=j(97,TB),fH=j(93,e=>{dH(e,SU(e)),CV(e),DB(e),$(e)}),pH=j(95,e=>{CV(e),$(e)}),mH=j(40,CV),hH=j(41,e=>{TB(e),$(e)}),gH=j(42,e=>{TB(e),$(e)}),_H=j(43,e=>{gB(e),XV(e),$(e)}),vH=j(44,xB),yH=j(45,e=>{CB(e),yB(e)}),bH=C(25,`<div></div>`,` `,Mz),xH=(e,t)=>bH(e,+!t),SH=j(122,e=>{iR(e.a2,e.co),FB(e),GB(e)}),CH=j(129,e=>{GB(e),ER(e)}),wH=C(15,`<optgroup label=Commits></optgroup>`,` `,SR),TH=(e,t)=>wH(e,+!t),EH=j(153,VB),DH=j(46,VB),OH=C(5,(e=>`<a title="Back to terminal (⌘/Ctrl+Shift+D)">${e}</a>`)(me),(e=>` D/${e}&l`)(Se),zz),kH=(e,t)=>OH(e,+!t),AH=h(`v41`,j(165)),jH=j(170,$),MH=s(169,e=>jH(e,CU(e))),NH=j(167,MH),PH=j(168,MH),FH=j(48,e=>{$(e),Nz(e)}),IH=j(51,$),LH=j(52,$),RH=j(49,g($R)),zH=j(50,g(tz)),BH=e=>function(){iV(e._,null)},VH=e=>function(){let t=e._._._.ct.find(t=>t.repo===e._.i);t&&e._._._.c1(t.key)},HH=e=>function(){IV(e._._._,``),lV(e._._._,!1),_V(e._._._,{query:``,hit:null,keys:[]})},UH=e=>function(){lV(e._._._,!e._._._.b3)},WH=e=>async(t,n)=>{let r=e.aw,i=e.db(t);if(tV(e,null),!(!r||!i))try{let t=await gt(`/api/workspaces/${e.a5}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`comment`,worktree:e.d9(i.repo),path:i.path,side:r.side,line_start:r.start,line_end:r.end,text:n.trim(),...e.da(i,r)})});eV(e,e.at.concat(t))}catch(t){iV(e,String(t.message||t))}},GH=e=>(t,n,r)=>{let i=e.aw,a=e.db(t),o=n.trim();if(!i||!a||!o)return Promise.resolve(!1);let s={id:-1,workspace_id:e.a5,worktree:e.d9(a.repo),path:a.path,side:i.side===`deletions`?`deletions`:`additions`,line_start:i.start,line_end:i.end,text:o,created_at:``,...e.da(a,i)};return e.dl([s],{session:r},[])},KH=e=>(t,n)=>{let r=e.ci.find(e=>e.id===t.repo),i=$b(t,t.key),a=n.side===`deletions`?`deletions`:`additions`;return{head:r?.head,snippet:i?rx(i,a,n.start,n.end):void 0}},qH=e=>t=>e.cm.find(e=>e.key===t),JH=e=>t=>{let n=0,r=0,i=0,a=0;for(let a of e.ct)a.repo===t.id&&(i++,n+=a.additions||0,r+=a.deletions||0);for(let e of t.files)e.changedSince&&a++;return{additions:n,deletions:r,files:i,fresh:a}},YH=e=>()=>{e.ar&&pe(e.a5,e.br)},XH=e=>()=>e.c4(e.b4,!0),ZH=e=>()=>{e.bm&&clearTimeout(e.bm),e.bm=setTimeout(()=>{e.bm=0,e.ah&&!e.ay&&e.c4(e.b4,!0)},400)},QH=e=>function(t){e.cf(t)},$H=e=>(t,n=!0)=>{t!==e.b4&&(VV(e,t),n&&Me(t),e.ai?.(t),e.c4(t))},eU=e=>t=>{t!==e.b5&&(UV(e,t),e.aj?.(t),e.c4(e.b4))},tU=e=>async(t=e.b4,n=!1)=>{let r=++e.bo;oV(e,!0),iV(e,null);try{let i=new URLSearchParams;t!==`committed`&&i.set(`scope`,t),n&&i.set(`refresh`,`1`),e.b5&&i.set(`rev`,e.b5);let a=await gt(`/api/workspaces/${e.a5}/diff?${i}`);if(r!==e.bo)return;let o=a.sections,s=a;if(KB(e,o),e.b3&&!o.some(e=>e.files.some(e=>e.changedSince))&&lV(e,!1),eV(e,s.comments||[]),e.bl=Xb(o),e.af&&e.c2(e.af),e.ag)e.c1(e.ag);else if(!e.af&&!n&&e.bo===1){let n=ne(e.a5);n&&n.scope===t&&e.bz(n)}}catch(t){if(r!==e.bo)return;iV(e,String(t.message||t))}finally{r===e.bo&&oV(e,!1)}},nU=e=>t=>{let n=(e.ar||[]).find(e=>e.pr&&`${e.worktree}/${e.pr.number}`===t),r=n?.files[0];n&&r&&(e.bv=null,e.bp.scrollToItem(`${n.worktree}/${r.path}`))},rU=e=>()=>{if(!e.ar)return;let t={},n={};for(let r of e.ar){t[r.id]=r.head;for(let e of r.files)e.hash&&(n[`${r.worktree}/${e.path}`]=e.hash)}fetch(`/api/workspaces/${e.a5}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`seen`,heads:t,dirty:n}),keepalive:!0}).catch(()=>{})},iU=e=>()=>e.dl(e.at,{clipboard:!0},`all`),aU=e=>t=>e.dl(e.at,{session:t},`all`),oU=e=>(t,n)=>{let r=e.at.find(e=>e.id===t);return r?e.dl([r],{session:n},[t]):Promise.resolve(!1)},sU=e=>async(t,n,r)=>{if(!t.length)return!0;e.dj++;try{let i=jx(t,e.ar);if(`clipboard`in n){if(!await st(i))return iV(e,`Copy failed: the clipboard needs HTTPS in this browser.`),!1}else await gt(`/api/sessions/${n.session}/send`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({text:`Please address this review feedback, then summarize what you changed.\n\n${i}`,...ze()||{}})}),e.ak?.(n.session);if(tV(e,null),r===`all`)eV(e,[]);else{let t=new Set(r);eV(e,e.at.filter(e=>!t.has(e.id)))}return(r===`all`||r.length)&&await e.de(r).catch(()=>{}),!0}catch(t){return iV(e,String(t.message||t)),!1}finally{e.dj--}},cU=e=>async t=>{eV(e,e.at.filter(e=>e.id!==t)),await e.de([t]).catch(()=>{})},lU=e=>async(t,n)=>{let r=e.at.find(e=>e.id===t);if(!r)return;let i=n.trim();if(!(!i||i===r.text)){eV(e,e.at.map(e=>e.id===t?{...e,text:i}:e));try{await gt(`/api/workspaces/${e.a5}/review/${t}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({text:i})})}catch(n){throw eV(e,e.at.map(e=>e.id===t?r:e)),iV(e,String(n.message||n)),n}}},uU=e=>t=>{IV(e,t)},dU=e=>function(t){e.c1(t)},fU=e=>t=>{e.bv=null,e.bx=t,e.ae?.(t),e.bp.scrollToItem(t)};function pU(){}function mU(e,t,n){}function hU(e){}function gU(e){return e.includes(`#`)?e.split(`#`)[0]:e}var _U=e=>t=>{dV(e,t)},vU=e=>t=>{GV(e,t)},yU=e=>async()=>{try{eV(e,(await gt(`/api/workspaces/${e.a5}/review`)).comments||[])}catch{}},bU=e=>t=>t===`all`?fetch(`/api/workspaces/${e.a5}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`clear`})}):Promise.all(t.map(t=>fetch(`/api/workspaces/${e.a5}/review/${t}`,{method:`DELETE`}))),xU=e=>()=>{GV(e,!0),QV(e,+e.bc+1),Bz(e)()},SU=e=>t=>{e.bv=t},CU=e=>t=>{if(!_e())return;let n=e.q;if(e.dx??=n.parentElement,cancelAnimationFrame(e.dy),!t){e.dx&&n.parentElement!==e.dx&&e.dx.append(n);return}let r=0,i=()=>{let t=document.getElementById(`review-find-host`);t?n.parentElement!==t&&(t.append(n),requestAnimationFrame(()=>setTimeout(Bz(e),0))):r++<20&&(e.dy=requestAnimationFrame(i))};i()};d(`v31`,BH),d(`v34`,VH),d(`v33`,HH),d(`v32`,UH),d(`v20`,WH),d(`v28`,GH),d(`v18`,KH),d(`v19`,qH),d(`v16`,JH),d(`v6`,YH),d(`v10`,XH),d(`v11`,ZH),d(`v0`,QH),d(`v13`,$H),d(`v14`,eU),d(`v9`,tU),d(`v8`,nU),d(`v15`,rU),d(`v25`,iU),d(`v26`,aU),d(`v27`,oU),d(`v24`,sU),d(`v22`,cU),d(`v23`,lU),d(`v1`,uU),d(`v35`,dU),d(`v7`,fU),d(`v4`,pU),d(`v3`,mU),d(`v2`,hU),d(`v17`,gU),d(`v36`,_U),d(`v30`,vU),d(`v12`,yU),d(`v21`,bU),d(`v29`,xU),d(`v5`,SU),d(`v37`,CU);export{_H as $input_active,qV as $input_findOpen,JV as $input_findOpenChange,eH as $input_findTick,tH as $input_findTickChange,gH as $input_focusFile,LH as $input_focusFileNonce,IH as $input_focusNonce,hH as $input_focusPr,kH as $input_onExit,mH as $input_onFileChange,yH as $input_onRevChange,vH as $input_onScopeChange,DH as $input_onSent,WV as $input_rev,HV as $input_scope,FH as $input_sessions,RH as $input_workspaceBranch,zV as $input_workspaceId,zH as $input_workspaceName,jV as $setup,mR as $template,hR as $walks};
2799
+ `)}var _R=e=>{_(e.a,`_gT`),_(e.b,[`_gU`,`_gV`]),_(e.c,[`_gU`,`_gW`]),_(e.d,[`_gU`,`_gX`])},vR=(e,t)=>S(e.a,`value`,`rev:${t}`),yR=(e,t)=>m(e.b,t),bR=i(0,`<option> </option>`,` D `,0,(e,t)=>{vR(e,t[0]?.sha),yR(e,t[0]?.label)}),xR=c(15,0,e=>bR(e,[e._.d5,`sha`])),SR=xR,CR=c(19,0,e=>S(e.a,`hidden`,e._.b8)),wR=r(`w42`,e=>o(e.a,`click`,function(){e._.ds()})),TR=e=>{CR._(e),_(e.a,[se,`_gK`,`_gB`]),oe(e.b),Te(e.b,14),yt(e.b),wR(e)},ER=c(12,0,e=>m(e.b,e._.cv)),DR=r(`w40`,e=>o(e.a,`click`,function(){dV(e._,!0)})),OR=e=>{ER._(e),_(e.a,[`_q`,`_gY`]),DR(e)},kR=c(9,0,e=>{_(e.a,[iS,`_gB`,{_gA:e._.b6}]),S(e.a,`title`,e._.b6?`Hide file tree`:`Show file tree`)}),AR=r(`w39`,e=>o(e.a,`click`,function(){uV(e._,!e._.b6),je(e._.b6)})),jR=e=>{kR._(e),Ge(e.b),qe(e.b,14),tt(e.b),AR(e)},MR=s(2,e=>m(e.b,e._.b5?`This commit is not in any of these repos.`:e._.ci.some(e=>e.unborn)?`No commits yet.`:e._.b4===`dirty`?`Nothing uncommitted.`:e._.ci.some(e=>e.pr)?`No file changes on these PRs.`:`No changes vs base.`),2),NR=c(24,0,MR),PR=e=>{NR._(e),FR._(e),IR._(e),_(e.a,`_cq`)},FR=c(24,0,MR),IR=c(24,0,MR),LR=A(181,e=>m(e.b,e._._.b4===`committed`?``:`, showing uncommitted changes only`),e=>e._._),RR=e=>{LR(e),zR(e)},zR=A(5,e=>m(e.a,e._.e)),BR=v(`w44`,`<!><!>.`,`%b%`,RR),VR=e=>{ut(e.a),Ne(e.a,BR(e)),Ue(e.a,`warn`),mt(e.a,`inline`),Ae(e.a),ee(e.a),it(e.a),xe(e.a,{})},HR=(e,t)=>Le(e.a,`${t}: base not found`),UR=(e,t)=>{HR(e,t[0]?.worktree),WR(e,t[0]?.base)},WR=j(4,g(zR)),GR=s(2,e=>m(e.b,e._.bf.trim()?`No matches in review.`:e._.b3&&!e._.b0?`Nothing changed since your last visit.`:`No files match "${e._.b0}".`),2),KR=c(24,1,GR),qR=e=>{KR._(e),JR._(e),YR._(e),_(e.a,`_cq`)},JR=c(24,1,GR),YR=c(24,1,GR),XR=A(177,e=>m(e.a,e._._.ax),e=>e._._),ZR=v(`w43`,` `,` `,XR),QR=e=>{ut(e.a),Ne(e.a,ZR(e)),it(e.a,BH(e)),Ae(e.a),ee(e.a),Ue(e.a),mt(e.a),Le(e.a),xe(e.a,{})},$R=A(174,e=>NT(e.a,e._._._.an||``),e=>e._._._),ez=e=>{$R(e),tz(e),nz(e),rz(e),iz(e),oz(e),sz._(e),lz._(e),uz._(e),dz._(e),fz._(e),pz._(e),mz._(e),IT(e.a),eE(e.a,UH(e)),$T(e.a,HH(e)),XT(e.a,VH(e))},tz=A(175,e=>PT(e.a,e._._._.ao||``),e=>e._._._),nz=A(178,e=>ZT(e.a,e._._._.ay),e=>e._._._),rz=A(180,e=>YT(e.a,e._._._.b3),e=>e._._._),iz=A(186,e=>QT(e.a,e._._._.c9),e=>e._._._),az=s(1,e=>zT(e.a,e._._._.d2.has(e._.i))),oz=A(190,az,e=>e._._._),sz=c(0,0,e=>DT(e.a,e._.c)),cz=s(2,e=>{LT(e.a,e._.k||e._.f),GT(e.a,e._.f-e._.k)}),lz=c(0,0,cz),uz=c(0,0,az),dz=c(0,0,cz),fz=c(0,0,e=>HT(e.a,e._.l)),pz=c(0,0,e=>UT(e.a,e._.m)),mz=c(0,0,e=>JT(e.a,e._.n)),hz=(e,t)=>{yz(e,t?.files),bz(e,t?.additions),xz(e,t?.deletions),Sz(e,t?.fresh)},gz=s(3,e=>hz(e,e._._.d8(e.c))),_z=A(192,gz,e=>e._._),vz=_z,yz=j(10,dz),bz=j(11,fz),xz=j(12,pz),Sz=j(13,mz),Cz=j(2,e=>{Ez(e,e.c?.files?.length),Dz(e,e.c?.pr),kz(e,e.c?.id),gz(e),sz(e)}),wz=C(0,ow,(e=>`/${e}&`)(sw),ez),Tz=s(7,e=>wz(e,e.f||e.g?0:1)),Ez=j(5,e=>{Tz(e),lz(e)}),Dz=j(6,Tz),Oz=(e,t)=>Cz(e,t[0]),kz=j(8,uz),Az=i(0,`<!><!><!>`,`b%`,vz,Oz),jz=c(25,0,e=>Az(e,[e._.ck,`id`])),Mz=e=>{jz._(e),_(e.a,`_gZ`)},Nz=c(7,0,e=>LS(e.e,e._.am)),Pz=e=>{Nz._(e),Fz._(e),Iz._(e),Lz._(e),_(e.a,`_gI`),_(e.d,`_gH`),jS(e.e)},Fz=c(7,0,e=>{m(e.b,e._.av),m(e.c,e._.av===1?``:`s`)}),Iz=c(7,0,e=>RS(e.e,e._.do)),Lz=c(7,0,e=>zS(e.e,e._.dp)),Rz=c(5,0,e=>S(e.a,`href`,`/w/${e._.a5}`)),zz=e=>{Rz._(e),_(e.a,[se,`_gG`]),de(e.b),ce(e.b,14),ye(e.b)},Bz=w(`w38`,165),Vz=j(136,g(oz)),Hz=r(`w45`,e=>a(e,{active:e.ah,load:e.c4,findOpen:e.b8,shownFiles:e.ct,commentsByFile:e.cy,draft:e.aw,sessions:e.am,collapsedFiles:e.bj,repos:e.ar,onMount:function(){let t=new AbortController,n=()=>e.am||[],r=(t,n=!0)=>{let r=e.a0,i=t.getBoundingClientRect();if(!i.height)return;let a=r.getBoundingClientRect(),o=getComputedStyle(t),s=i.top-(parseFloat(o.scrollMarginTop)||0),c=i.bottom+(parseFloat(o.scrollMarginBottom)||0),l=0;s<a.top?l=s-a.top:c>a.bottom&&(l=c-a.bottom),l&&r.scrollTo({top:Math.max(0,r.scrollTop+l),behavior:n?`smooth`:`auto`})},i=new WeakMap,a=async(t,n,r)=>{if(!r)return``;let i=new URLSearchParams({worktree:t,path:n,rev:r});return(await gt(`/api/workspaces/${e.a5}/diff/contents?${i}`)).contents??``},o={viewer:null},s={key:null,top:null},c=new Map,l,u={draft:!0},d,f=(e,t,n)=>{let r=[];for(let e of t){let t=c.get(e.id);(!t||t.comment.text!==e.text)&&(t={comment:e}),c.set(e.id,t),r.push({side:e.side,lineNumber:e.line_end,metadata:t})}return n&&n.key===e&&(l!==n&&(l=n,u={draft:!0},d=void 0),r.push({side:n.side===`deletions`?`deletions`:`additions`,lineNumber:n.end,metadata:u})),r},p=(e,t,n)=>e.map(e=>`${e.id}:${e.text.length}`).join(`,`)+(t&&t.key===n?`|d${t.side}${t.start}-${t.end}`:``),m=(t,n)=>{if(!t)return;let r=t.endSide!=null&&t.endSide!==t.side;tV(e,{key:n,side:t.side||`additions`,start:Math.min(t.start,r?t.start:t.end),end:Math.max(t.start,r?t.start:t.end)})},h={theme:{dark:`pierre-dark`,light:`pierre-light`},themeType:lt(),diffStyle:_e()?`unified`:`split`,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:44},..._e()&&{renderCodeViewHeader:()=>e.c},enableLineSelection:!0,layout:{paddingTop:0,paddingBottom:24,gap:12},unsafeCSS:` @media (pointer: coarse) { pre[data-diff] { touch-action: pan-x pan-y; } [data-column-number], [data-gutter-utility-slot] { touch-action: none !important; } }`+Rx,async loadDiffFiles(t){let n=i.get(t),r=(e.ar||[]).find(e=>e.id===n?.repo);if(!n||!r)throw Error(`unknown file`);let[o,s]=await Promise.all([t.type===`new`?Promise.resolve(``):a(n.worktree,t.prevName||n.path,r.oldRev),t.type===`deleted`?Promise.resolve(``):a(n.worktree,n.path,r.newRev)]);return{oldFile:{name:t.prevName||t.name,contents:o},newFile:{name:t.name,contents:s}}},renderCustomHeader(t,n){let r=n.item,i=e.db(r.id),a=document.createElement(`div`);a.className=`_g2${r.collapsed?` _g3`:``}`,a.title=r.id;let c=document.createElement(`span`);c.className=`_g4`,c.textContent=`▾`;let l=document.createElement(`span`);l.className=`_ba`;let u=i?.status||(r.type===`diff`?r.fileDiff.type[0].toUpperCase():`M`);l.dataset.status=u,l.textContent=u;let d=document.createElement(`span`);d.className=`_g5`;let f=document.createElement(`bdi`);if(f.textContent=r.id,d.append(f),a.append(c,l,d),i?.changedSince){let e=document.createElement(`span`);e.className=`_A _g9`,e.title=`Changed since your last visit`,a.append(e)}let p=e.cy.get(r.id)?.length||0;if(p){let e=document.createElement(`span`);e.className=`_u`,e.textContent=`✎ ${p}`,a.append(e)}if(i&&(i.additions||i.deletions)){let e=document.createElement(`span`);e.className=`_g6`;let t=document.createElement(`span`);t.className=`_g7`,t.textContent=`+${i.additions||0}`;let n=document.createElement(`span`);n.className=`_g8`,n.textContent=`−${i.deletions||0}`,e.append(t,n),a.append(e)}return a.onclick=()=>{s.key=r.id,s.top=o.viewer?.getTopForItem(r.id)??null;let t=new Set(e.bj);t.delete(r.id)||t.add(r.id),vV(e,t)},a},renderAnnotation(t,i){let a=t.metadata||{},o=i.item.id;if(a.draft)return d??=Ax({sessions:n,reveal:r},{onSave:t=>e.dd(o,t),onSend:(t,n)=>e.dr(o,t,n),onCancel:()=>{tV(e,null)}});let s=a.comment;if(!s)return;let c=i.item.type===`diff`?i.item.fileDiff:null,l=s.snippet!=null&&!!c&&gR(rx(c,s.side,s.line_start,s.line_end))!==gR(s.snippet);return kx(s,{sessions:n,reveal:r},{onDelete:t=>e.dg(t),onEdit:(t,n)=>e.dh(t,n),onSend:(t,n)=>e.dq(t,n),drifted:l})},onLineSelectionEnd(e,t){m(e,t.item.id)},onPostRender(e,t,n,r){let i=e;if(n===`unmount`){g.get(i)?.(),g.delete(i);return}g.has(i)?Xx(i):g.set(i,Yx(i,r.item.id))}},g=new Map,_=new Nb(h,yx());o.viewer=_,_.setup(e.a0);let v=fe(e=>{h.themeType=e,_.setOptions({...h})});be()&&Sx(()=>e.a0,t.signal),e.bp.scrollToItem=t=>{y.recs.has(t)&&(e.bx=null,_.scrollTo({type:`item`,id:t,align:`start`,behavior:`instant`}))},e.bp.scrollToLine=(e,t,n)=>_.scrollTo({type:`line`,id:e,lineNumber:t,side:n||`additions`,align:`center`,behavior:`instant`}),e.bp.clearSelection=()=>_.clearSelectedLines();let y={abort:t,viewer:_,unregTheme:v,unsubScroll:_.subscribeToScroll(t=>{e.bt||=requestAnimationFrame(()=>{e.bt=0;let n=null;for(let r of _.getRenderedItems()){let i=_.getTopForItem(r.id);i==null||i>t+1||(!n||i>(_.getTopForItem(n.key)??-1))&&(n={scope:e.b4,key:r.id,off:Math.round(t-i)})}t>0&&(e.br=n)})}),hostUnregs:g,loaded:!1,wasActive:!1,lastNonce:e.ap||0,lastFileNonce:e.aq||0,recs:new Map,order:``,revealedDraft:null,dockedOpen:!1,start:()=>{this.active&&!y.loaded&&(y.loaded=!0,this.load())},pin:t=>{let n=e.a0,r=Date.now(),i=!1,a=()=>{i=!0};for(let e of[`wheel`,`touchstart`,`keydown`])n.addEventListener(e,a,{once:!0,passive:!0});let o=()=>{if(i||!y.recs.has(t.key))return;let e=y.viewer.getTopForItem(t.key);if(e!=null){let n=e+t.off;Math.abs(y.viewer.getScrollTop()-n)>1&&y.viewer.scrollTo({type:`position`,position:n,behavior:`instant`})}Date.now()-r<1500&&requestAnimationFrame(o)};o()},sync:()=>{let t=[],n=new Set,r=!1;for(let e of this.shownFiles){n.add(e.key);let a=y.recs.get(e.key),o=a&&a.patch===e.patch&&a.status===e.status?a.fileDiff:$b(e,e.key),s=this.commentsByFile.get(e.key)||[],c=p(s,this.draft,e.key),l=this.collapsedFiles.has(e.key);o&&i.set(o,{worktree:e.key.slice(0,e.key.indexOf(`/`)),path:e.path,repo:e.repo});let u={name:e.path,contents:e.binary?`(binary file)`:e.tooLarge?`(file too large to display)`:`(file could not be read)`},d=a;!d||d.item.type===`diff`!=!!o?(d={item:o?{id:e.key,type:`diff`,fileDiff:o,annotations:f(e.key,s,this.draft),collapsed:l,version:(d?.item.version??0)+1}:{id:e.key,type:`file`,file:u,collapsed:l,version:(d?.item.version??0)+1},fileDiff:o,annSig:c,collapsed:l,patch:e.patch,status:e.status},y.recs.set(e.key,d),r=!0):(d.fileDiff!==o||d.annSig!==c||d.collapsed!==l)&&(d.item.type===`diff`&&o?(d.item.fileDiff=o,d.item.annotations=f(e.key,s,this.draft)):d.item.type===`file`&&(d.item.file=u),d.item.collapsed=l,d.item.version=(d.item.version??0)+1,d.fileDiff=o,d.annSig=c,d.collapsed=l,d.patch=e.patch,d.status=e.status,r||y.viewer.updateItem(d.item)),t.push(d.item)}for(let e of[...y.recs.keys()])n.has(e)||y.recs.delete(e);let a=t.map(e=>e.id).join(`
2800
+ `);if((r||a!==y.order)&&(y.order=a,y.viewer.setItems(t)),s.key){let{key:e,top:t}=s;s.key=null,t!=null&&t<y.viewer.getScrollTop()&&y.viewer.scrollTo({type:`item`,id:e,align:`start`,behavior:`instant`})}let o=this.draft;o&&o!==y.revealedDraft&&y.recs.has(o.key)&&(y.revealedDraft=o,y.viewer.scrollTo({type:`line`,id:o.key,lineNumber:o.end,side:o.side===`deletions`?`deletions`:`additions`,align:`nearest`,offset:180,behavior:`smooth-auto`}));let c=e.bv;c&&y.recs.has(c.key)&&(e.bv=null,y.pin(c)),e.bx&&y.recs.has(e.bx)&&e.bp.scrollToItem(e.bx)}};return y.wasActive=!!this.active,this.findOpen&&(y.dockedOpen=!0,e.e0(!0)),Be().addEventListener(`review.changed`,t=>{y.loaded&&t.data?.workspaceId===e.a5&&e.cb()},{signal:t.signal}),Be().addEventListener(`status.changed`,t=>{if(!this.active||!y.loaded||e.ay)return;let n=t.data,r=n&&n[e.a5];if(!r)return;let i=Zb(r);!i||!e.bl||i===e.bl||e.ca()},{signal:t.signal}),window.addEventListener(`pagehide`,()=>{this.active&&y.loaded&&(e.ch(),e.c0())},{signal:t.signal}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&this.active&&y.loaded&&e.c0()},{signal:t.signal}),y.start(),y},onUpdate:function(){this.start(),this.active&&this.loaded&&!this.wasActive&&e.c9(),!this.active&&this.loaded&&this.wasActive&&(e.ch(),e.c0()),this.wasActive=!!this.active,!!this.findOpen!==this.dockedOpen&&(this.dockedOpen=!!this.findOpen,e.e0(this.dockedOpen));let t=e.ap||0;this.loaded&&e.af&&t!==this.lastNonce&&e.c2(e.af),this.lastNonce=t;let n=e.aq||0;this.loaded&&e.ag&&n!==this.lastFileNonce?(e.c1(e.ag),this.lastFileNonce=n):this.loaded&&(this.lastFileNonce=n),e.a6&&e.a6!==e.b4&&e.cc(e.a6,!1),e.a7!==void 0&&(e.a7??null)!==e.b5&&e.cd(e.a7??null),this.draft||this.viewer.clearSelectedLines(),this.sync()},onDestroy:function(){e.bm&&clearTimeout(e.bm),this.loaded&&(e.ch(),e.c0()),this.abort.abort(),this.unsubScroll(),this.unregTheme();for(let e of this.hostUnregs.values())e();this.viewer.cleanUp()}})),$=s(171,Hz,41),Uz=j(147,$),Wz=s(146,e=>Uz(e,WH(e)),5),Gz=j(161,$),Kz=s(157,e=>Gz(e,GH(e)),5),qz=j(144,e=>{Wz(e),Kz(e)}),Jz=i(22,Xe,(e=>`/${e}&`)(ot),VR,UR),Yz=(e,t)=>{WI(e.a1,t),tR(e.a2,t)},Xz=j(145,e=>{Wz(e),Kz(e),$(e)}),Zz=(e,t)=>IC(e.r,t),Qz=j(142,g(_z)),$z=(e,t)=>HI(e.a1,t),eB=s(128,e=>$z(e,e.ck.map(t=>({id:t.id,label:t.worktree,worktree:t.worktree,files:e.ct.filter(e=>e.repo===t.id)})).filter(e=>e.files.length))),tB=j(127,e=>{dR(e.a2,e.ct),CH(e,e.ct?.length),Qz(e,JH(e)),eB(e),$(e)}),nB=s(126,e=>tB(e,e.cr?e.cq.filter(t=>e.cr.has(t.key)||t.key===e.bi):e.cq),2),rB=j(124,e=>{Zz(e,e.cq.map(e=>({...e,fileDiff:$b(e,e.key)}))),nB(e)}),iB=s(121,e=>rB(e,(()=>{let t=bx(e.b0);return e.cm.filter(n=>t(n.key)&&(!e.b3||n.changedSince))})()),2),aB=j(120,e=>{SH(e,e.cm?.length),Yz(e,new Set(e.cm.filter(e=>e.changedSince).map(e=>e.key))),Xz(e,qH(e)),iB(e)}),oB=j(118,e=>{xH(e,e.ck?.length),aB(e,e.ck.flatMap(e=>e.files.map(t=>({...t,repo:e.id,key:`${e.worktree}/${t.path}`})))),eB(e),jz(e)}),sB=j(139,e=>{TH(e,e.d5?.length),xR(e)}),cB=s(117,e=>{oB(e,e.b5?e.ci.filter(e=>e.rev):e.ci),sB(e,(()=>{let t=new Set,n=[];for(let r of e.ci)for(let e of r.commits||[])t.has(e.sha)||(t.add(e.sha),n.push({sha:e.sha,label:`${r.worktree}#${Nx(e.sha,7)} ${e.subject}`}));return e.b5&&!t.has(e.b5)&&n.unshift({sha:e.b5,label:Nx(e.b5,7)}),n})())}),lB=j(116,e=>{Vz(e,new Set(e.ci.filter(e=>!!e.pr&&!!e.localHead&&(e.localHead!==e.head||e.branch!==e.pr.headRefName)).map(e=>e.id))),qz(e,KH(e)),Jz(e,[e.ci.filter(e=>e.baseMissing),`id`]),cB(e),IR(e)}),uB=j(98,$),dB=s(90,e=>uB(e,YH(e)),2),fB=g(iz),pB=j(107,e=>{$(e),fB(e)}),mB=s(103,e=>pB(e,XH(e))),hB=j(108,$),gB=s(106,e=>hB(e,ZH(e)),4),_B=s(114,e=>k(e,`o`,e.b5?`rev:${e.b5}`:e.b4,QH(e)),2),vB=j(113,_B),yB=s(112,e=>vB(e,t=>{if(t.startsWith(`rev:`)){e.cd(t.slice(4));return}let n=t;if(e.b5&&(UV(e,null),e.aj?.(null),n===e.b4)){e.c4(e.b4);return}e.cc(n)}),5),bB=j(110,e=>{yB(e),$(e)}),xB=s(104,e=>bB(e,$H(e)),2),SB=j(111,e=>{yB(e),$(e)}),CB=s(105,e=>SB(e,eU(e)),3),wB=j(102,e=>{mB(e),gB(e),xB(e),CB(e),yB(e),$(e)}),TB=s(101,e=>wB(e,tU(e)),10),EB=j(100,e=>{TB(e),$(e)}),DB=s(94,e=>EB(e,nU(e)),2),OB=j(115,$),kB=s(54,e=>OB(e,rU(e))),AB=C(9,(e=>`<button>${e}</button>`)(Fe),(e=>` D/${e}&l`)(vt),jR),jB=C(12,`<button title="Jump to file">Files (<!>)</button>`,` Db%`,OR),MB=C(19,(e=>`<button title="Find in review (⌘/Ctrl+F)" aria-label="Find in review">${e}</button>`)(ae),(e=>` D/${e}&l`)(ve),TR),NB=s(138,e=>MB(e,e.d3&&!e.ba?0:1)),PB=j(137,e=>{AB(e,+!e.d3),jB(e,+!e.d3),NB(e)}),FB=s(123,e=>PB(e,!e.ar||e.co>0)),IB=j(158,Iz),LB=j(159,Lz),RB=j(160,$),zB=s(156,e=>{IB(e,iU(e)),LB(e,aU(e)),RB(e,oU(e))}),BB=j(155,e=>{zB(e),Kz(e)}),VB=s(154,e=>BB(e,sU(e)),4),HB=C(23,`<div aria-hidden=true><div></div><div></div><div></div></div>`,` D b b `,_R),UB=s(61,e=>HB(e,!e.ar&&e.ay?0:1)),WB=C(24,`<p> </p>`,` D `,PR,`<p> </p>`,` D `,qR),GB=s(130,e=>WB(e,e.ar&&!e.co?0:e.ar&&!e.cv&&!e.bh?1:2),3),KB=l(53,e=>{lB(e,e.ar||[]),dB(e),DB(e),kB(e),FB(e),VB(e),UB(e),GB(e),$(e)}),qB=(e,t)=>$L(e.a2,t),JB=(e,t)=>UI(e.a1,t),YB=j(132,e=>{qB(e,new Set(e.cy.keys())),JB(e,new Map([...e.cy].map(([e,t])=>[e,t.length]))),$(e)}),XB=j(150,$),ZB=s(149,e=>XB(e,cU(e))),QB=j(151,$),$B=s(56,e=>QB(e,lU(e))),eV=l(55,e=>{NV(e,e.at?.length),YB(e,(()=>{let t=new Map;for(let n of e.at){let e=`${n.worktree}/${n.path}`;t.set(e,[...t.get(e)||[],n])}return t})()),Wz(e),ZB(e),$B(e),VB(e),zB(e)}),tV=l(58,e=>{Wz(e),Kz(e),$(e)}),nV=C(21,Xe,(e=>`/${e}&`)(ot),QR),rV=g(XR),iV=l(59,e=>{nV(e,+!e.ax),rV(e)}),aV=g(nz),oV=l(60,e=>{S(e.k,`disabled`,e.ay),Ct(e.l,e.ay&&`_F`),S(e.o,`disabled`,e.ay),gB(e),UB(e),$(e),aV(e)}),sV=(e,t)=>{DI(e.a1,t),ZL(e.a2,t)},cV=g(rz),lV=l(65,e=>{TB(e),iB(e),cV(e),JR(e)}),uV=l(68,e=>{BI(e.a1,e.b6),kR(e)}),dV=l(69,e=>KL(e.a2,e.b7)),fV=r(`w49`,e=>{e.ba&&!e.b8&&GV(e,!0)}),pV=s(73,fV),mV=j(72,e=>{UC(e.r,e.ba),GC(e.r,!e.ba),pV(e),NB(e)}),hV=j(125,nB),gV=e=>{hV(e,e.bf.trim()?new Set(e.bg):null)},_V=l(76,e=>{nH(e,e.be?.query),rH(e,e.be?.keys),iH(e,e.be?.hit),gV(e)}),vV=l(81,$),yV=(e,t)=>{oH(e,t.sig),sH(e,t.timer)},bV=(e,t)=>cH(e,t.seq),xV=(e,t)=>SC(e.r,function(e){t(e)}),SV=j(99,e=>{GI(e.a1,dU(e)),TB(e),$(e)}),CV=s(96,e=>SV(e,fU(e)),3),wV=j(87,e=>{xV(e,t=>{if(_V(e,t),!t.hit)return;let n=t.hit;setTimeout(()=>{n.line<1?e.bp.scrollToItem(n.key):e.bp.scrollToLine(n.key,n.line,n.side)},0)}),CV(e),DB(e),$(e)}),TV=(e,t)=>{lH(e,t.anchor),uH(e,t.raf)},EV=(e,t)=>{fH(e,t.pos),pH(e,t.jump)},DV=j(143,e=>{Wz(e),Kz(e)}),OV=(e,t)=>EH(e,t.busy),kV=(e,t)=>{NH(e,t.home),PH(e,t.raf)},AV=r(`w47`,e=>{o(e.k,`click`,function(){e.c9()}),b(e,`o`)});function jV(e){p(e,17,AH),_(e.a,`_gz`),_(e.b,`_gE`),_(e.c,`_hc`),_(e.d,`_gF`),_(e.g,aS),_(e.i,[`_gD`,`_g_`]),_(e.k,[se,`_gB`]),Oe(e.l),te(e.l,14),_(e.n,[`_o`,`_gQ`,`_ha`]),_(e.o,[`_p`,`_gR`,`_hb`]),PC(e.r),lC(e.r,vU(e)),_C(e.r),vC(e.r),xC(e.r),_(e.u,`_g0`),_(e.a0,`_g1`),II(e.a1),e.a2,qL(e.a2,_U(e)),M(e,Bz(e)),KB(e,null),eV(e,[]),tV(e,null),iV(e,null),oV(e,!1),sV(e,uU(e)),lV(e,!1),uV(e,ue()),dV(e,!1),mV(e,!_e()),_V(e,{query:``,hit:null,keys:[]}),vV(e,new Set),yV(e,{sig:``,timer:0}),bV(e,{seq:0}),wV(e,{scrollToItem:hU,scrollToLine:mU,clearSelection:pU}),TV(e,{anchor:null,raf:0}),EV(e,{pos:null,jump:null}),DV(e,gU),OV(e,{busy:0}),kV(e,{home:null,raf:0}),AV(e)}var MV=C(7,(e=>`<span><!> comment<!></span><span>${e}</span>`)(oS),(e=>` D%c%l D/${e}&l`)(sS),Pz),NV=j(57,e=>{_(e.e,[`_gP`,{_gO:!e.av}]),MV(e,+!e.av),Fz(e)}),PV=r(`w46`,e=>{e.b0!==wt(e.a5)&&F(e.a5,e.b0)}),FV=s(63,PV),IV=l(62,e=>{EI(e.a1,e.b0),XL(e.a2,e.b0),iB(e),FV(e),KR(e)}),LV=j(109,$),RV=j(148,e=>{ZB(e),VB(e)}),zV=j(31,e=>{cR(e.a2,e.a5),IV(e,wt(e.a5)),LV(e,yU(e)),RV(e,bU(e)),dB(e),TB(e),kB(e),Wz(e),$B(e),Kz(e),FV(e),$(e),Rz(e)}),BV=g(LR),VV=l(66,e=>{lR(e.a2,e.b4),TB(e),mB(e),gB(e),xB(e),CB(e),yB(e),_B(e),$(e),BV(e),NR(e)}),HV=j(32,e=>{VV(e,e.a6??ke()),$(e)}),UV=l(67,e=>{TB(e),CB(e),yB(e),cB(e),_B(e),$(e),FR(e)}),WV=j(33,e=>{UV(e,e.a7??null),$(e)}),GV=u(70,e=>{_(e.q,[`_gM`,{_gL:!e.b8}]),cC(e.r,e.b8),pV(e),$(e),CR(e)}),KV=s(36,e=>GV(e,e.a8,e.a9)),qV=j(34,KV),JV=j(35,KV),YV=r(`w48`,e=>{e.ah&&window.addEventListener(`keydown`,t=>{!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()===`f`&&(t.target instanceof HTMLTextAreaElement||(t.preventDefault(),e.ds()))},{capture:!0,signal:E(e,0)})}),XV=s(163,e=>{D(e,0),YV(e)}),ZV=j(162,XV),QV=u(74,e=>{WC(e.r,e.bc),ZV(e,xU(e))}),$V=s(39,e=>QV(e,e.ab,e.ac)),eH=j(37,$V),tH=j(38,$V),nH=j(77,YR),rH=j(78),iH=j(79,e=>{aH(e,e.bh?.key),GB(e)}),aH=j(80,nB),oH=j(83,e=>{TB(e),$(e)}),sH=j(84,e=>{gB(e),$(e)}),cH=j(86,TB),lH=j(89,e=>{dB(e),$(e)}),uH=j(91,$),dH=j(97,TB),fH=j(93,e=>{dH(e,SU(e)),CV(e),DB(e),$(e)}),pH=j(95,e=>{CV(e),$(e)}),mH=j(40,CV),hH=j(41,e=>{TB(e),$(e)}),gH=j(42,e=>{TB(e),$(e)}),_H=j(43,e=>{gB(e),XV(e),$(e)}),vH=j(44,xB),yH=j(45,e=>{CB(e),yB(e)}),bH=C(25,`<div></div>`,` `,Mz),xH=(e,t)=>bH(e,+!t),SH=j(122,e=>{iR(e.a2,e.co),FB(e),GB(e)}),CH=j(129,e=>{GB(e),ER(e)}),wH=C(15,`<optgroup label=Commits></optgroup>`,` `,SR),TH=(e,t)=>wH(e,+!t),EH=j(153,VB),DH=j(46,VB),OH=C(5,(e=>`<a title="Back to terminal (⌘/Ctrl+Shift+D)">${e}</a>`)(me),(e=>` D/${e}&l`)(Se),zz),kH=(e,t)=>OH(e,+!t),AH=h(`w41`,j(165)),jH=j(170,$),MH=s(169,e=>jH(e,CU(e))),NH=j(167,MH),PH=j(168,MH),FH=j(48,e=>{$(e),Nz(e)}),IH=j(51,$),LH=j(52,$),RH=j(49,g($R)),zH=j(50,g(tz)),BH=e=>function(){iV(e._,null)},VH=e=>function(){let t=e._._._.ct.find(t=>t.repo===e._.i);t&&e._._._.c1(t.key)},HH=e=>function(){IV(e._._._,``),lV(e._._._,!1),_V(e._._._,{query:``,hit:null,keys:[]})},UH=e=>function(){lV(e._._._,!e._._._.b3)},WH=e=>async(t,n)=>{let r=e.aw,i=e.db(t);if(tV(e,null),!(!r||!i))try{let t=await gt(`/api/workspaces/${e.a5}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`comment`,worktree:e.d9(i.repo),path:i.path,side:r.side,line_start:r.start,line_end:r.end,text:n.trim(),...e.da(i,r)})});eV(e,e.at.concat(t))}catch(t){iV(e,String(t.message||t))}},GH=e=>(t,n,r)=>{let i=e.aw,a=e.db(t),o=n.trim();if(!i||!a||!o)return Promise.resolve(!1);let s={id:-1,workspace_id:e.a5,worktree:e.d9(a.repo),path:a.path,side:i.side===`deletions`?`deletions`:`additions`,line_start:i.start,line_end:i.end,text:o,created_at:``,...e.da(a,i)};return e.dl([s],{session:r},[])},KH=e=>(t,n)=>{let r=e.ci.find(e=>e.id===t.repo),i=$b(t,t.key),a=n.side===`deletions`?`deletions`:`additions`;return{head:r?.head,snippet:i?rx(i,a,n.start,n.end):void 0}},qH=e=>t=>e.cm.find(e=>e.key===t),JH=e=>t=>{let n=0,r=0,i=0,a=0;for(let a of e.ct)a.repo===t.id&&(i++,n+=a.additions||0,r+=a.deletions||0);for(let e of t.files)e.changedSince&&a++;return{additions:n,deletions:r,files:i,fresh:a}},YH=e=>()=>{e.ar&&pe(e.a5,e.br)},XH=e=>()=>e.c4(e.b4,!0),ZH=e=>()=>{e.bm&&clearTimeout(e.bm),e.bm=setTimeout(()=>{e.bm=0,e.ah&&!e.ay&&e.c4(e.b4,!0)},400)},QH=e=>function(t){e.cf(t)},$H=e=>(t,n=!0)=>{t!==e.b4&&(VV(e,t),n&&Me(t),e.ai?.(t),e.c4(t))},eU=e=>t=>{t!==e.b5&&(UV(e,t),e.aj?.(t),e.c4(e.b4))},tU=e=>async(t=e.b4,n=!1)=>{let r=++e.bo;oV(e,!0),iV(e,null);try{let i=new URLSearchParams;t!==`committed`&&i.set(`scope`,t),n&&i.set(`refresh`,`1`),e.b5&&i.set(`rev`,e.b5);let a=await gt(`/api/workspaces/${e.a5}/diff?${i}`);if(r!==e.bo)return;let o=a.sections,s=a;if(KB(e,o),e.b3&&!o.some(e=>e.files.some(e=>e.changedSince))&&lV(e,!1),eV(e,s.comments||[]),e.bl=Xb(o),e.af&&e.c2(e.af),e.ag)e.c1(e.ag);else if(!e.af&&!n&&e.bo===1){let n=ne(e.a5);n&&n.scope===t&&e.bz(n)}}catch(t){if(r!==e.bo)return;iV(e,String(t.message||t))}finally{r===e.bo&&oV(e,!1)}},nU=e=>t=>{let n=(e.ar||[]).find(e=>e.pr&&`${e.worktree}/${e.pr.number}`===t),r=n?.files[0];n&&r&&(e.bv=null,e.bp.scrollToItem(`${n.worktree}/${r.path}`))},rU=e=>()=>{if(!e.ar)return;let t={},n={};for(let r of e.ar){t[r.id]=r.head;for(let e of r.files)e.hash&&(n[`${r.worktree}/${e.path}`]=e.hash)}fetch(`/api/workspaces/${e.a5}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`seen`,heads:t,dirty:n}),keepalive:!0}).catch(()=>{})},iU=e=>()=>e.dl(e.at,{clipboard:!0},`all`),aU=e=>t=>e.dl(e.at,{session:t},`all`),oU=e=>(t,n)=>{let r=e.at.find(e=>e.id===t);return r?e.dl([r],{session:n},[t]):Promise.resolve(!1)},sU=e=>async(t,n,r)=>{if(!t.length)return!0;e.dj++;try{let i=jx(t,e.ar);if(`clipboard`in n){if(!await st(i))return iV(e,`Copy failed: the clipboard needs HTTPS in this browser.`),!1}else await gt(`/api/sessions/${n.session}/send`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({text:`Please address this review feedback, then summarize what you changed.\n\n${i}`,...ze()||{}})}),e.ak?.(n.session);if(tV(e,null),r===`all`)eV(e,[]);else{let t=new Set(r);eV(e,e.at.filter(e=>!t.has(e.id)))}return(r===`all`||r.length)&&await e.de(r).catch(()=>{}),!0}catch(t){return iV(e,String(t.message||t)),!1}finally{e.dj--}},cU=e=>async t=>{eV(e,e.at.filter(e=>e.id!==t)),await e.de([t]).catch(()=>{})},lU=e=>async(t,n)=>{let r=e.at.find(e=>e.id===t);if(!r)return;let i=n.trim();if(!(!i||i===r.text)){eV(e,e.at.map(e=>e.id===t?{...e,text:i}:e));try{await gt(`/api/workspaces/${e.a5}/review/${t}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({text:i})})}catch(n){throw eV(e,e.at.map(e=>e.id===t?r:e)),iV(e,String(n.message||n)),n}}},uU=e=>t=>{IV(e,t)},dU=e=>function(t){e.c1(t)},fU=e=>t=>{e.bv=null,e.bx=t,e.ae?.(t),e.bp.scrollToItem(t)};function pU(){}function mU(e,t,n){}function hU(e){}function gU(e){return e.includes(`#`)?e.split(`#`)[0]:e}var _U=e=>t=>{dV(e,t)},vU=e=>t=>{GV(e,t)},yU=e=>async()=>{try{eV(e,(await gt(`/api/workspaces/${e.a5}/review`)).comments||[])}catch{}},bU=e=>t=>t===`all`?fetch(`/api/workspaces/${e.a5}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`clear`})}):Promise.all(t.map(t=>fetch(`/api/workspaces/${e.a5}/review/${t}`,{method:`DELETE`}))),xU=e=>()=>{GV(e,!0),QV(e,+e.bc+1),Bz(e)()},SU=e=>t=>{e.bv=t},CU=e=>t=>{if(!_e())return;let n=e.q;if(e.dx??=n.parentElement,cancelAnimationFrame(e.dy),!t){e.dx&&n.parentElement!==e.dx&&e.dx.append(n);return}let r=0,i=()=>{let t=document.getElementById(`review-find-host`);t?n.parentElement!==t&&(t.append(n),requestAnimationFrame(()=>setTimeout(Bz(e),0))):r++<20&&(e.dy=requestAnimationFrame(i))};i()};d(`w31`,BH),d(`w34`,VH),d(`w33`,HH),d(`w32`,UH),d(`w20`,WH),d(`w28`,GH),d(`w18`,KH),d(`w19`,qH),d(`w16`,JH),d(`w6`,YH),d(`w10`,XH),d(`w11`,ZH),d(`w0`,QH),d(`w13`,$H),d(`w14`,eU),d(`w9`,tU),d(`w8`,nU),d(`w15`,rU),d(`w25`,iU),d(`w26`,aU),d(`w27`,oU),d(`w24`,sU),d(`w22`,cU),d(`w23`,lU),d(`w1`,uU),d(`w35`,dU),d(`w7`,fU),d(`w4`,pU),d(`w3`,mU),d(`w2`,hU),d(`w17`,gU),d(`w36`,_U),d(`w30`,vU),d(`w12`,yU),d(`w21`,bU),d(`w29`,xU),d(`w5`,SU),d(`w37`,CU);export{_H as $input_active,qV as $input_findOpen,JV as $input_findOpenChange,eH as $input_findTick,tH as $input_findTickChange,gH as $input_focusFile,LH as $input_focusFileNonce,IH as $input_focusNonce,hH as $input_focusPr,kH as $input_onExit,mH as $input_onFileChange,yH as $input_onRevChange,vH as $input_onScopeChange,DH as $input_onSent,WV as $input_rev,HV as $input_scope,FH as $input_sessions,RH as $input_workspaceBranch,zV as $input_workspaceId,zH as $input_workspaceName,jV as $setup,mR as $template,hR as $walks};