@dylanpiercey/work 0.0.180 → 0.0.181

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 (75) hide show
  1. package/dist/index.mjs +462 -462
  2. package/dist/public/assets/{_CWOQeVjT.js → _AumMSBF2.js} +1 -1
  3. package/dist/public/assets/_AumMSBF2.js.br +0 -0
  4. package/dist/public/assets/_B1lvs6Ed.js +1 -0
  5. package/dist/public/assets/_BA5VbKUa.js +1 -0
  6. package/dist/public/assets/_BPDdIbcA.js +1 -0
  7. package/dist/public/assets/{_B-oTUisw.js → _BYSg0kuh.js} +7 -7
  8. package/dist/public/assets/_BYSg0kuh.js.br +0 -0
  9. package/dist/public/assets/_BtZ4zRTM.js +1 -0
  10. package/dist/public/assets/_ByQLiMx_.js +1 -0
  11. package/dist/public/assets/_C4CoxFZz.js +1 -0
  12. package/dist/public/assets/_C5ZFVPL5.js +1 -0
  13. package/dist/public/assets/_CWnM9LZn.js +1 -0
  14. package/dist/public/assets/_CcoGj7EM.js +1 -0
  15. package/dist/public/assets/_CxYmq8Hy.js +1 -0
  16. package/dist/public/assets/_CyY7QD_u.js +1 -0
  17. package/dist/public/assets/_DFsKkyqX.js +1 -0
  18. package/dist/public/assets/_DgFAR5nL.js +1 -0
  19. package/dist/public/assets/_Dhh3TcvZ.js +1 -0
  20. package/dist/public/assets/_DnA4pQlQ.js +1 -0
  21. package/dist/public/assets/_DvU6qlgB.js +1 -0
  22. package/dist/public/assets/_PlstTQyD.js +1 -0
  23. package/dist/public/assets/_V9CGuKPW.js +1 -0
  24. package/dist/public/assets/_mdsq_N_U.js +1 -0
  25. package/dist/public/assets/_tJqGKffn.js +1 -0
  26. package/dist/public/assets/{_D1_IgqEt.js → _x2jmrcuU.js} +4 -4
  27. package/dist/public/assets/_x2jmrcuU.js.br +0 -0
  28. package/dist/public/assets/_zLv_aEps.js +1 -0
  29. package/dist/public/assets/app-page-D4Ysb67H.css +1 -0
  30. package/dist/public/assets/app-page-D4Ysb67H.css.br +0 -0
  31. package/dist/public/assets/{icon-arrow-down-CnC9B8zr.css → icon-arrow-down-CdTaci0h.css} +1 -1
  32. package/dist/public/assets/icon-arrow-down-CdTaci0h.css.br +0 -0
  33. package/dist/public/assets/new-CYrxR3YR.js +1 -0
  34. package/dist/public/assets/{review-view-BYC11tmH.css → review-view-DGGzM59-.css} +1 -1
  35. package/dist/public/assets/review-view-DGGzM59-.css.br +0 -0
  36. package/dist/public/assets/review-view-Da6jS0sN.js +2 -0
  37. package/dist/public/assets/settings-CYrxR3YR.js +1 -0
  38. package/dist/public/assets/w-CYrxR3YR.js +1 -0
  39. package/dist/public/assets/w._-CYrxR3YR.js +1 -0
  40. package/dist/public/assets/w._-D9QYuJ3z.js +1 -0
  41. package/package.json +1 -1
  42. package/dist/public/assets/_9Dw0rpRB.js +0 -1
  43. package/dist/public/assets/_B-oTUisw.js.br +0 -0
  44. package/dist/public/assets/_BJMBesC8.js +0 -1
  45. package/dist/public/assets/_BaB2KTgs.js +0 -1
  46. package/dist/public/assets/_BafWVR1Z.js +0 -1
  47. package/dist/public/assets/_BdyS62ck.js +0 -1
  48. package/dist/public/assets/_CAiITnSL.js +0 -1
  49. package/dist/public/assets/_CWOQeVjT.js.br +0 -0
  50. package/dist/public/assets/_ChYNFrbw.js +0 -1
  51. package/dist/public/assets/_CoVBMgR8.js +0 -1
  52. package/dist/public/assets/_Cwrxarqf.js +0 -1
  53. package/dist/public/assets/_D1_IgqEt.js.br +0 -0
  54. package/dist/public/assets/_DLAN1x2w.js +0 -1
  55. package/dist/public/assets/_DTpscZKE.js +0 -1
  56. package/dist/public/assets/_Ddm9l-a6.js +0 -1
  57. package/dist/public/assets/_Dkh2Hw3W.js +0 -1
  58. package/dist/public/assets/_DnVYWVdu.js +0 -1
  59. package/dist/public/assets/_DxXAXTdz.js +0 -1
  60. package/dist/public/assets/_VR1nKvIB.js +0 -1
  61. package/dist/public/assets/_gKHSDI0E.js +0 -1
  62. package/dist/public/assets/_qaArnTZN.js +0 -1
  63. package/dist/public/assets/_sJ4x-tl2.js +0 -1
  64. package/dist/public/assets/_yTfgsrNO.js +0 -1
  65. package/dist/public/assets/_zFEdMvq1.js +0 -1
  66. package/dist/public/assets/app-page-ujOO9O9j.css +0 -1
  67. package/dist/public/assets/app-page-ujOO9O9j.css.br +0 -0
  68. package/dist/public/assets/icon-arrow-down-CnC9B8zr.css.br +0 -0
  69. package/dist/public/assets/new-OkHtBkzU.js +0 -1
  70. package/dist/public/assets/review-view-BYC11tmH.css.br +0 -0
  71. package/dist/public/assets/review-view-X_RUf4F7.js +0 -2
  72. package/dist/public/assets/settings-OkHtBkzU.js +0 -1
  73. package/dist/public/assets/w-OkHtBkzU.js +0 -1
  74. package/dist/public/assets/w._-Bl7_ITGh.js +0 -1
  75. package/dist/public/assets/w._-OkHtBkzU.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{A as r,B as i,E as a,F as o,G as s,H as c,I as l,L as u,M as d,N as f,O as p,P as m,R as h,T as g,V as _,W as v,_ as y,a as b,b as x,c as S,d as C,f as w,i as T,l as E,n as D,r as O,t as k,u as A,v as j,y as M,z as N}from"./_4WrdbxBF.js";import{$ as P,$t as ee,A as te,At as ne,B as re,Bt as ie,C as ae,Ct as oe,D as se,Dt as ce,E as le,Et as ue,F as de,G as fe,Gt as pe,H as me,I as he,J as ge,Jt as _e,K as ve,L as ye,Lt as be,M as xe,N as Se,Nt as Ce,O as we,Ot as Te,P as Ee,Q as F,Qt as De,R as Oe,S as ke,Sn as Ae,St as je,T as Me,Tt as Ne,U as Pe,V as Fe,W as Ie,X as Le,Y as Re,Z as ze,_t as Be,a as Ve,b as He,bt as Ue,c as We,cn as Ge,ct as Ke,d as qe,dn as Je,dt as Ye,en as Xe,et as Ze,f as Qe,ft as $e,gt as et,h as tt,ht as nt,i as rt,it,j as at,k as ot,kt as st,ln as ct,m as I,mt as L,n as lt,nn as ut,nt as dt,o as ft,p as pt,pt as mt,q as ht,qt as gt,r as _t,rn as vt,rt as yt,s as bt,sn as xt,st as St,t as Ct,tn as wt,tt as Tt,u as Et,un as Dt,ut as Ot,v as kt,vt as At,w as jt,wn as Mt,wt as Nt,x as Pt,xt as Ft,y as It,yt as Lt,z as Rt,zt}from"./_CWOQeVjT.js";var Bt=`diffs-container`,Vt=(()=>{try{return!1}catch{return!1}})(),Ht=/(?=^From [a-f0-9]+ .+$)/m,Ut=/(?=^diff --git)/gm,Wt=/(?<=\n)/,Gt=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Kt=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,qt=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Jt=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Yt=`header-prefix`,Xt=`header-filename-suffix`,Zt=`header-metadata`,Qt=`header-custom`,R={dark:`pierre-dark`,light:`pierre-light`},$t=`data-theme-css`,en=`data-unsafe-css`,tn=`data-diffs-scrollbar-measure`,nn=`data-diffs-code-view-header`,rn=`data-diffs-code-view-footer`,an=`--diffs-scrollbar-gutter-measured`,on=1e5,sn={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},cn={...sn,hunkLineCount:1},ln={paddingTop:8,paddingBottom:8,gap:8},un={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},dn=Object.freeze({fromStart:0,fromEnd:0}),fn={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},pn={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},mn=new Set,hn=null;function gn(e){mn.add(e),hn??=requestAnimationFrame(vn)}function _n(e){mn.delete(e)&&mn.size===0&&hn!=null&&(cancelAnimationFrame(hn),hn=null)}function vn(e){let t=new Set(mn);mn.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}hn=mn.size>0?requestAnimationFrame(vn):null}function yn(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 bn(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function xn(e,t){let n=e?.theme??R,r=t?.theme??R,i=Sn(e),a=Sn(t);return bn(n,r)&&yn(e,t,[`theme`,`parseDiffOptions`])&&yn(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 wn({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 Tn(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function En(e){return{type:`text`,value:e}}function z({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function Dn({name:e,width:t=16,height:n=16,properties:r}){return z({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[z({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function On(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 kn(e){return z({tagName:`div`,properties:{"data-gutter":``},children:e})}function An(e,t,n,r={}){return z({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[z({tagName:`span`,properties:{"data-line-number-content":``},children:[En(`${t}`)]})]})}function jn(e,t,n){return z({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 Mn(){return z({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[Dn({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function Nn(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Pn(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 Fn=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],In=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};In.prototype.normal={},In.prototype.property={},In.prototype.space=void 0;function Ln(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new In(n,r,t)}function Rn(e){return e.toLowerCase()}var zn=class{constructor(e,t){this.attribute=t,this.property=e}};zn.prototype.attribute=``,zn.prototype.booleanish=!1,zn.prototype.boolean=!1,zn.prototype.commaOrSpaceSeparated=!1,zn.prototype.commaSeparated=!1,zn.prototype.defined=!1,zn.prototype.mustUseProperty=!1,zn.prototype.number=!1,zn.prototype.overloadedBoolean=!1,zn.prototype.property=``,zn.prototype.spaceSeparated=!1,zn.prototype.space=void 0;var Bn=e({boolean:()=>B,booleanish:()=>Hn,commaOrSpaceSeparated:()=>Gn,commaSeparated:()=>Wn,number:()=>V,overloadedBoolean:()=>Un,spaceSeparated:()=>H}),Vn=0,B=Kn(),Hn=Kn(),Un=Kn(),V=Kn(),H=Kn(),Wn=Kn(),Gn=Kn();function Kn(){return 2**++Vn}var qn=Object.keys(Bn),Jn=class extends zn{constructor(e,t,n,r){let i=-1;if(super(e,t),Yn(this,`space`,r),typeof n==`number`)for(;++i<qn.length;){let e=qn[i];Yn(this,qn[i],(n&Bn[e])===Bn[e])}}};Jn.prototype.defined=!0;function Yn(e,t,n){n&&(e[t]=n)}function Xn(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Jn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Rn(r)]=r,n[Rn(a.attribute)]=r}return new In(t,n,e.space)}var Zn=Xn({properties:{ariaActiveDescendant:null,ariaAtomic:Hn,ariaAutoComplete:null,ariaBusy:Hn,ariaChecked:Hn,ariaColCount:V,ariaColIndex:V,ariaColSpan:V,ariaControls:H,ariaCurrent:null,ariaDescribedBy:H,ariaDetails:null,ariaDisabled:Hn,ariaDropEffect:H,ariaErrorMessage:null,ariaExpanded:Hn,ariaFlowTo:H,ariaGrabbed:Hn,ariaHasPopup:null,ariaHidden:Hn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:H,ariaLevel:V,ariaLive:null,ariaModal:Hn,ariaMultiLine:Hn,ariaMultiSelectable:Hn,ariaOrientation:null,ariaOwns:H,ariaPlaceholder:null,ariaPosInSet:V,ariaPressed:Hn,ariaReadOnly:Hn,ariaRelevant:null,ariaRequired:Hn,ariaRoleDescription:H,ariaRowCount:V,ariaRowIndex:V,ariaRowSpan:V,ariaSelected:Hn,ariaSetSize:V,ariaSort:null,ariaValueMax:V,ariaValueMin:V,ariaValueNow:V,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Qn(e,t){return t in e?e[t]:t}function $n(e,t){return Qn(e,t.toLowerCase())}var er=Xn({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Wn,acceptCharset:H,accessKey:H,action:null,allow:null,allowFullScreen:B,allowPaymentRequest:B,allowUserMedia:B,alpha:B,alt:null,as:null,async:B,autoCapitalize:null,autoComplete:H,autoFocus:B,autoPlay:B,blocking:H,capture:null,charSet:null,checked:B,cite:null,className:H,closedBy:null,colorSpace:null,cols:V,colSpan:V,command:null,commandFor:null,content:null,contentEditable:Hn,controls:B,controlsList:H,coords:V|Wn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:B,defer:B,dir:null,dirName:null,disabled:B,download:Un,draggable:Hn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:B,formTarget:null,headers:H,height:V,hidden:Un,high:V,href:null,hrefLang:null,htmlFor:H,httpEquiv:H,id:null,imageSizes:null,imageSrcSet:null,inert:B,inputMode:null,integrity:null,is:null,isMap:B,itemId:null,itemProp:H,itemRef:H,itemScope:B,itemType:H,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:B,low:V,manifest:null,max:null,maxLength:V,media:null,method:null,min:null,minLength:V,multiple:B,muted:B,name:null,nonce:null,noModule:B,noValidate:B,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:B,optimum:V,pattern:null,ping:H,placeholder:null,playsInline:B,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:B,referrerPolicy:null,rel:H,required:B,reversed:B,rows:V,rowSpan:V,sandbox:H,scope:null,scoped:B,seamless:B,selected:B,shadowRootClonable:B,shadowRootCustomElementRegistry:B,shadowRootDelegatesFocus:B,shadowRootMode:null,shadowRootSerializable:B,shape:null,size:V,sizes:null,slot:null,span:V,spellCheck:Hn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:V,step:null,style:null,tabIndex:V,target:null,title:null,translate:null,type:null,typeMustMatch:B,useMap:null,value:Hn,width:V,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:H,axis:null,background:null,bgColor:null,border:V,borderColor:null,bottomMargin:V,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:B,declare:B,event:null,face:null,frame:null,frameBorder:null,hSpace:V,leftMargin:V,link:null,longDesc:null,lowSrc:null,marginHeight:V,marginWidth:V,noResize:B,noHref:B,noShade:B,noWrap:B,object:null,profile:null,prompt:null,rev:null,rightMargin:V,rules:null,scheme:null,scrolling:Hn,standby:null,summary:null,text:null,topMargin:V,valueType:null,version:null,vAlign:null,vLink:null,vSpace:V,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:B,disablePictureInPicture:B,disableRemotePlayback:B,exportParts:Wn,part:H,prefix:null,property:null,results:V,security:null,unselectable:null},space:`html`,transform:$n}),tr=Xn({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:Gn,accentHeight:V,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:V,amplitude:V,arabicForm:null,ascent:V,attributeName:null,attributeType:null,azimuth:V,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:V,by:null,calcMode:null,capHeight:V,className:H,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:V,diffuseConstant:V,direction:null,display:null,dur:null,divisor:V,dominantBaseline:null,download:B,dx:null,dy:null,edgeMode:null,editable:null,elevation:V,enableBackground:null,end:null,event:null,exponent:V,externalResourcesRequired:null,fill:null,fillOpacity:V,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:Wn,g2:Wn,glyphName:Wn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:V,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:V,horizOriginX:V,horizOriginY:V,id:null,ideographic:V,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:V,k:V,k1:V,k2:V,k3:V,k4:V,kernelMatrix:Gn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:V,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:V,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:V,overlineThickness:V,paintOrder:null,panose1:null,path:null,pathLength:V,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:H,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:V,pointsAtY:V,pointsAtZ:V,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gn,rev:Gn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gn,requiredFeatures:Gn,requiredFonts:Gn,requiredFormats:Gn,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:V,specularExponent:V,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:V,strikethroughThickness:V,string:null,stroke:null,strokeDashArray:Gn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:V,strokeOpacity:V,strokeWidth:null,style:null,surfaceScale:V,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Gn,tabIndex:V,tableValues:null,target:null,targetX:V,targetY:V,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Gn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:V,underlineThickness:V,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:V,values:null,vAlphabetic:V,vMathematical:V,vectorEffect:null,vHanging:V,vIdeographic:V,version:null,vertAdvY:V,vertOriginX:V,vertOriginY:V,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:V,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Qn}),nr=Xn({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()}}),rr=Xn({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:$n}),ir=Xn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),ar=/[A-Z]/g,or=/-[a-z]/g,sr=/^data[-\w.:]+$/i;function cr(e,t){let n=Rn(t),r=t,i=zn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&sr.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(or,ur);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!or.test(e)){let n=e.replace(ar,lr);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Jn}return new i(r,t)}function lr(e){return`-`+e.toLowerCase()}function ur(e){return e.charAt(1).toUpperCase()}var dr=Ln([Zn,er,nr,rr,ir],`html`),fr=Ln([Zn,tr,nr,rr,ir],`svg`),pr={}.hasOwnProperty;function mr(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&pr.call(t,e)){let n=String(t[e]);i=pr.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 hr=/["&'<>`]/g,gr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,_r=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,vr=/[|\\{}()[\]^$+*?.]/g,yr=new WeakMap;function br(e,t){if(e=e.replace(t.subset?xr(t.subset):hr,r),t.subset||t.escapeOnly)return e;return e.replace(gr,n).replace(_r,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 xr(e){let t=yr.get(e);return t||(t=Sr(e),yr.set(e,t)),t}function Sr(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(vr,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var Cr=/[\dA-Fa-f]/;function wr(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!Cr.test(String.fromCharCode(t))?r:r+`;`}var Tr=/\d/;function Er(e,t,n){let r=`&#`+String(e);return n&&t&&!Tr.test(String.fromCharCode(t))?r:r+`;`}var Dr=`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(`.`),Or={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:`€`},kr=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],Ar={}.hasOwnProperty,jr={},Mr;for(Mr in Or)Ar.call(Or,Mr)&&(jr[Or[Mr]]=Mr);var Nr=/[^\dA-Za-z]/;function Pr(e,t,n,r){let i=String.fromCharCode(e);if(Ar.call(jr,i)){let e=jr[i],a=`&`+e;return n&&Dr.includes(e)&&!kr.includes(e)&&(!r||t&&t!==61&&Nr.test(String.fromCharCode(t)))?a:a+`;`}return``}function Fr(e,t,n){let r=wr(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Pr(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=Er(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function Ir(e,t){return br(e,Object.assign({format:Fr},t))}var Lr=/^>|^->|<!--|-->|--!>|<!-$/g,Rr=[`>`],zr=[`<`,`>`];function Br(e,t,n,r){return r.settings.bogusComments?`<?`+Ir(e.value,Object.assign({},r.settings.characterReferences,{subset:Rr}))+`>`:`<!--`+e.value.replace(Lr,i)+`-->`;function i(e){return Ir(e,Object.assign({},r.settings.characterReferences,{subset:zr}))}}function Vr(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function Hr(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 Ur(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function Wr(e){return e.join(` `).trim()}var Gr=/[ \t\n\f\r]/g;function Kr(e){return typeof e==`object`?e.type===`text`&&qr(e.value):qr(e)}function qr(e){return e.replace(Gr,``)===``}var Jr=Zr(1),Yr=Zr(-1),Xr=[];function Zr(e){return t;function t(t,n,r){let i=t?t.children:Xr,a=(n||0)+e,o=i[a];if(!r)for(;o&&Kr(o);)a+=e,o=i[a];return o}}var Qr={}.hasOwnProperty;function $r(e){return t;function t(t,n,r){return Qr.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var ei=$r({body:ri,caption:ti,colgroup:ti,dd:si,dt:oi,head:ti,html:ni,li:ai,optgroup:li,option:ui,p:ii,rp:ci,rt:ci,tbody:fi,td:hi,tfoot:pi,th:hi,thead:di,tr:mi});function ti(e,t,n){let r=Jr(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&Kr(r.value.charAt(0)))}function ni(e,t,n){let r=Jr(n,t);return!r||r.type!==`comment`}function ri(e,t,n){let r=Jr(n,t);return!r||r.type!==`comment`}function ii(e,t,n){let r=Jr(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 ai(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&r.tagName===`li`}function oi(e,t,n){let r=Jr(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function si(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function ci(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function li(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function ui(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function di(e,t,n){let r=Jr(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function fi(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function pi(e,t,n){return!Jr(n,t)}function mi(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function hi(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var gi=$r({body:yi,colgroup:bi,head:vi,html:_i,tbody:xi});function _i(e){let t=Jr(e,-1);return!t||t.type!==`comment`}function vi(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 yi(e){let t=Jr(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&Kr(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function bi(e,t,n){let r=Yr(n,t),i=Jr(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&ei(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function xi(e,t,n){let r=Yr(n,t),i=Jr(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&ei(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{A as r,B as i,E as a,F as o,G as s,H as c,I as l,L as u,M as d,N as f,O as p,P as m,R as h,T as g,V as _,W as v,_ as y,a as b,b as x,c as S,d as C,f as w,i as T,l as E,n as D,r as O,t as k,u as A,v as j,y as M,z as N}from"./_4WrdbxBF.js";import{$ as P,$t as ee,A as te,At as ne,B as re,Bt as ie,C as ae,Ct as oe,D as se,Dt as ce,E as le,Et as ue,F as de,G as fe,Gt as pe,H as me,I as he,J as ge,Jt as _e,K as ve,L as ye,Lt as be,M as xe,N as Se,Nt as Ce,O as we,Ot as Te,P as Ee,Q as F,Qt as De,R as Oe,S as ke,Sn as Ae,St as je,T as Me,Tt as Ne,U as Pe,V as Fe,W as Ie,X as Le,Y as Re,Z as ze,_t as Be,a as Ve,b as He,bt as Ue,c as We,cn as Ge,ct as Ke,d as qe,dn as Je,dt as Ye,en as Xe,et as Ze,f as Qe,ft as $e,gt as et,h as tt,ht as nt,i as rt,it,j as at,k as ot,kt as st,ln as ct,m as I,mt as L,n as lt,nn as ut,nt as dt,o as ft,p as pt,pt as mt,q as ht,qt as gt,r as _t,rn as vt,rt as yt,s as bt,sn as xt,st as St,t as Ct,tn as wt,tt as Tt,u as Et,un as Dt,ut as Ot,v as kt,vt as At,w as jt,wn as Mt,wt as Nt,x as Pt,xt as Ft,y as It,yt as Lt,z as Rt,zt}from"./_AumMSBF2.js";var Bt=`diffs-container`,Vt=(()=>{try{return!1}catch{return!1}})(),Ht=/(?=^From [a-f0-9]+ .+$)/m,Ut=/(?=^diff --git)/gm,Wt=/(?<=\n)/,Gt=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Kt=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,qt=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Jt=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Yt=`header-prefix`,Xt=`header-filename-suffix`,Zt=`header-metadata`,Qt=`header-custom`,R={dark:`pierre-dark`,light:`pierre-light`},$t=`data-theme-css`,en=`data-unsafe-css`,tn=`data-diffs-scrollbar-measure`,nn=`data-diffs-code-view-header`,rn=`data-diffs-code-view-footer`,an=`--diffs-scrollbar-gutter-measured`,on=1e5,sn={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},cn={...sn,hunkLineCount:1},ln={paddingTop:8,paddingBottom:8,gap:8},un={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},dn=Object.freeze({fromStart:0,fromEnd:0}),fn={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},pn={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},mn=new Set,hn=null;function gn(e){mn.add(e),hn??=requestAnimationFrame(vn)}function _n(e){mn.delete(e)&&mn.size===0&&hn!=null&&(cancelAnimationFrame(hn),hn=null)}function vn(e){let t=new Set(mn);mn.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}hn=mn.size>0?requestAnimationFrame(vn):null}function yn(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 bn(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function xn(e,t){let n=e?.theme??R,r=t?.theme??R,i=Sn(e),a=Sn(t);return bn(n,r)&&yn(e,t,[`theme`,`parseDiffOptions`])&&yn(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 wn({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 Tn(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function En(e){return{type:`text`,value:e}}function z({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function Dn({name:e,width:t=16,height:n=16,properties:r}){return z({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[z({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function On(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 kn(e){return z({tagName:`div`,properties:{"data-gutter":``},children:e})}function An(e,t,n,r={}){return z({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[z({tagName:`span`,properties:{"data-line-number-content":``},children:[En(`${t}`)]})]})}function jn(e,t,n){return z({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 Mn(){return z({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[Dn({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function Nn(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Pn(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 Fn=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],In=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};In.prototype.normal={},In.prototype.property={},In.prototype.space=void 0;function Ln(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new In(n,r,t)}function Rn(e){return e.toLowerCase()}var zn=class{constructor(e,t){this.attribute=t,this.property=e}};zn.prototype.attribute=``,zn.prototype.booleanish=!1,zn.prototype.boolean=!1,zn.prototype.commaOrSpaceSeparated=!1,zn.prototype.commaSeparated=!1,zn.prototype.defined=!1,zn.prototype.mustUseProperty=!1,zn.prototype.number=!1,zn.prototype.overloadedBoolean=!1,zn.prototype.property=``,zn.prototype.spaceSeparated=!1,zn.prototype.space=void 0;var Bn=e({boolean:()=>B,booleanish:()=>Hn,commaOrSpaceSeparated:()=>Gn,commaSeparated:()=>Wn,number:()=>V,overloadedBoolean:()=>Un,spaceSeparated:()=>H}),Vn=0,B=Kn(),Hn=Kn(),Un=Kn(),V=Kn(),H=Kn(),Wn=Kn(),Gn=Kn();function Kn(){return 2**++Vn}var qn=Object.keys(Bn),Jn=class extends zn{constructor(e,t,n,r){let i=-1;if(super(e,t),Yn(this,`space`,r),typeof n==`number`)for(;++i<qn.length;){let e=qn[i];Yn(this,qn[i],(n&Bn[e])===Bn[e])}}};Jn.prototype.defined=!0;function Yn(e,t,n){n&&(e[t]=n)}function Xn(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Jn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Rn(r)]=r,n[Rn(a.attribute)]=r}return new In(t,n,e.space)}var Zn=Xn({properties:{ariaActiveDescendant:null,ariaAtomic:Hn,ariaAutoComplete:null,ariaBusy:Hn,ariaChecked:Hn,ariaColCount:V,ariaColIndex:V,ariaColSpan:V,ariaControls:H,ariaCurrent:null,ariaDescribedBy:H,ariaDetails:null,ariaDisabled:Hn,ariaDropEffect:H,ariaErrorMessage:null,ariaExpanded:Hn,ariaFlowTo:H,ariaGrabbed:Hn,ariaHasPopup:null,ariaHidden:Hn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:H,ariaLevel:V,ariaLive:null,ariaModal:Hn,ariaMultiLine:Hn,ariaMultiSelectable:Hn,ariaOrientation:null,ariaOwns:H,ariaPlaceholder:null,ariaPosInSet:V,ariaPressed:Hn,ariaReadOnly:Hn,ariaRelevant:null,ariaRequired:Hn,ariaRoleDescription:H,ariaRowCount:V,ariaRowIndex:V,ariaRowSpan:V,ariaSelected:Hn,ariaSetSize:V,ariaSort:null,ariaValueMax:V,ariaValueMin:V,ariaValueNow:V,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Qn(e,t){return t in e?e[t]:t}function $n(e,t){return Qn(e,t.toLowerCase())}var er=Xn({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Wn,acceptCharset:H,accessKey:H,action:null,allow:null,allowFullScreen:B,allowPaymentRequest:B,allowUserMedia:B,alpha:B,alt:null,as:null,async:B,autoCapitalize:null,autoComplete:H,autoFocus:B,autoPlay:B,blocking:H,capture:null,charSet:null,checked:B,cite:null,className:H,closedBy:null,colorSpace:null,cols:V,colSpan:V,command:null,commandFor:null,content:null,contentEditable:Hn,controls:B,controlsList:H,coords:V|Wn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:B,defer:B,dir:null,dirName:null,disabled:B,download:Un,draggable:Hn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:B,formTarget:null,headers:H,height:V,hidden:Un,high:V,href:null,hrefLang:null,htmlFor:H,httpEquiv:H,id:null,imageSizes:null,imageSrcSet:null,inert:B,inputMode:null,integrity:null,is:null,isMap:B,itemId:null,itemProp:H,itemRef:H,itemScope:B,itemType:H,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:B,low:V,manifest:null,max:null,maxLength:V,media:null,method:null,min:null,minLength:V,multiple:B,muted:B,name:null,nonce:null,noModule:B,noValidate:B,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:B,optimum:V,pattern:null,ping:H,placeholder:null,playsInline:B,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:B,referrerPolicy:null,rel:H,required:B,reversed:B,rows:V,rowSpan:V,sandbox:H,scope:null,scoped:B,seamless:B,selected:B,shadowRootClonable:B,shadowRootCustomElementRegistry:B,shadowRootDelegatesFocus:B,shadowRootMode:null,shadowRootSerializable:B,shape:null,size:V,sizes:null,slot:null,span:V,spellCheck:Hn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:V,step:null,style:null,tabIndex:V,target:null,title:null,translate:null,type:null,typeMustMatch:B,useMap:null,value:Hn,width:V,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:H,axis:null,background:null,bgColor:null,border:V,borderColor:null,bottomMargin:V,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:B,declare:B,event:null,face:null,frame:null,frameBorder:null,hSpace:V,leftMargin:V,link:null,longDesc:null,lowSrc:null,marginHeight:V,marginWidth:V,noResize:B,noHref:B,noShade:B,noWrap:B,object:null,profile:null,prompt:null,rev:null,rightMargin:V,rules:null,scheme:null,scrolling:Hn,standby:null,summary:null,text:null,topMargin:V,valueType:null,version:null,vAlign:null,vLink:null,vSpace:V,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:B,disablePictureInPicture:B,disableRemotePlayback:B,exportParts:Wn,part:H,prefix:null,property:null,results:V,security:null,unselectable:null},space:`html`,transform:$n}),tr=Xn({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:Gn,accentHeight:V,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:V,amplitude:V,arabicForm:null,ascent:V,attributeName:null,attributeType:null,azimuth:V,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:V,by:null,calcMode:null,capHeight:V,className:H,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:V,diffuseConstant:V,direction:null,display:null,dur:null,divisor:V,dominantBaseline:null,download:B,dx:null,dy:null,edgeMode:null,editable:null,elevation:V,enableBackground:null,end:null,event:null,exponent:V,externalResourcesRequired:null,fill:null,fillOpacity:V,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:Wn,g2:Wn,glyphName:Wn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:V,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:V,horizOriginX:V,horizOriginY:V,id:null,ideographic:V,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:V,k:V,k1:V,k2:V,k3:V,k4:V,kernelMatrix:Gn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:V,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:V,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:V,overlineThickness:V,paintOrder:null,panose1:null,path:null,pathLength:V,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:H,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:V,pointsAtY:V,pointsAtZ:V,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gn,rev:Gn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gn,requiredFeatures:Gn,requiredFonts:Gn,requiredFormats:Gn,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:V,specularExponent:V,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:V,strikethroughThickness:V,string:null,stroke:null,strokeDashArray:Gn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:V,strokeOpacity:V,strokeWidth:null,style:null,surfaceScale:V,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Gn,tabIndex:V,tableValues:null,target:null,targetX:V,targetY:V,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Gn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:V,underlineThickness:V,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:V,values:null,vAlphabetic:V,vMathematical:V,vectorEffect:null,vHanging:V,vIdeographic:V,version:null,vertAdvY:V,vertOriginX:V,vertOriginY:V,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:V,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Qn}),nr=Xn({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()}}),rr=Xn({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:$n}),ir=Xn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),ar=/[A-Z]/g,or=/-[a-z]/g,sr=/^data[-\w.:]+$/i;function cr(e,t){let n=Rn(t),r=t,i=zn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&sr.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(or,ur);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!or.test(e)){let n=e.replace(ar,lr);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Jn}return new i(r,t)}function lr(e){return`-`+e.toLowerCase()}function ur(e){return e.charAt(1).toUpperCase()}var dr=Ln([Zn,er,nr,rr,ir],`html`),fr=Ln([Zn,tr,nr,rr,ir],`svg`),pr={}.hasOwnProperty;function mr(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&pr.call(t,e)){let n=String(t[e]);i=pr.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 hr=/["&'<>`]/g,gr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,_r=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,vr=/[|\\{}()[\]^$+*?.]/g,yr=new WeakMap;function br(e,t){if(e=e.replace(t.subset?xr(t.subset):hr,r),t.subset||t.escapeOnly)return e;return e.replace(gr,n).replace(_r,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 xr(e){let t=yr.get(e);return t||(t=Sr(e),yr.set(e,t)),t}function Sr(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(vr,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var Cr=/[\dA-Fa-f]/;function wr(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!Cr.test(String.fromCharCode(t))?r:r+`;`}var Tr=/\d/;function Er(e,t,n){let r=`&#`+String(e);return n&&t&&!Tr.test(String.fromCharCode(t))?r:r+`;`}var Dr=`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(`.`),Or={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:`€`},kr=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],Ar={}.hasOwnProperty,jr={},Mr;for(Mr in Or)Ar.call(Or,Mr)&&(jr[Or[Mr]]=Mr);var Nr=/[^\dA-Za-z]/;function Pr(e,t,n,r){let i=String.fromCharCode(e);if(Ar.call(jr,i)){let e=jr[i],a=`&`+e;return n&&Dr.includes(e)&&!kr.includes(e)&&(!r||t&&t!==61&&Nr.test(String.fromCharCode(t)))?a:a+`;`}return``}function Fr(e,t,n){let r=wr(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Pr(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=Er(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function Ir(e,t){return br(e,Object.assign({format:Fr},t))}var Lr=/^>|^->|<!--|-->|--!>|<!-$/g,Rr=[`>`],zr=[`<`,`>`];function Br(e,t,n,r){return r.settings.bogusComments?`<?`+Ir(e.value,Object.assign({},r.settings.characterReferences,{subset:Rr}))+`>`:`<!--`+e.value.replace(Lr,i)+`-->`;function i(e){return Ir(e,Object.assign({},r.settings.characterReferences,{subset:zr}))}}function Vr(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function Hr(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 Ur(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function Wr(e){return e.join(` `).trim()}var Gr=/[ \t\n\f\r]/g;function Kr(e){return typeof e==`object`?e.type===`text`&&qr(e.value):qr(e)}function qr(e){return e.replace(Gr,``)===``}var Jr=Zr(1),Yr=Zr(-1),Xr=[];function Zr(e){return t;function t(t,n,r){let i=t?t.children:Xr,a=(n||0)+e,o=i[a];if(!r)for(;o&&Kr(o);)a+=e,o=i[a];return o}}var Qr={}.hasOwnProperty;function $r(e){return t;function t(t,n,r){return Qr.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var ei=$r({body:ri,caption:ti,colgroup:ti,dd:si,dt:oi,head:ti,html:ni,li:ai,optgroup:li,option:ui,p:ii,rp:ci,rt:ci,tbody:fi,td:hi,tfoot:pi,th:hi,thead:di,tr:mi});function ti(e,t,n){let r=Jr(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&Kr(r.value.charAt(0)))}function ni(e,t,n){let r=Jr(n,t);return!r||r.type!==`comment`}function ri(e,t,n){let r=Jr(n,t);return!r||r.type!==`comment`}function ii(e,t,n){let r=Jr(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 ai(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&r.tagName===`li`}function oi(e,t,n){let r=Jr(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function si(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function ci(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function li(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function ui(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function di(e,t,n){let r=Jr(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function fi(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function pi(e,t,n){return!Jr(n,t)}function mi(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function hi(e,t,n){let r=Jr(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var gi=$r({body:yi,colgroup:bi,head:vi,html:_i,tbody:xi});function _i(e){let t=Jr(e,-1);return!t||t.type!==`comment`}function vi(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 yi(e){let t=Jr(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&Kr(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function bi(e,t,n){let r=Yr(n,t),i=Jr(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&ei(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function xi(e,t,n){let r=Yr(n,t),i=Jr(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&ei(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
@@ -1526,10 +1526,10 @@ diff --git`)}function m_(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
1526
1526
  `),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
1527
1527
  `)}function Yv(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>Xv(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,Zv(e)}function Xv(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function Zv(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 Qv(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(yg(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,Zv(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=bg(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-bg(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var $v=new WeakMap;function ey(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function ty(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 ny(e,t){let n=e.hunks,r=e.additionLines,i=ey(r),a=i===r?e:{...e,additionLines:i},o=fy(n,dy(a,t),e.deletionLines.length),s=hy(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,Ty(e),Hv(e,r),vy(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function ry(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<xy(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:xy(r);if(i==null||t<i||o!=null&&o!==s)return ny(e,n);o=s}if(o!=null){if(iy(e,i,o,r,n)){e.editSessionDirty=!0;return}return ny(e,n)}}function iy(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=ay(e),o=e.hunks[n];if(o.hunkContent.some(oy))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 ay(e){let t=$v.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return $v.set(e,{lines:e.deletionLines,set:n}),n}function oy(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function sy(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 cy(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=uv({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=Sy(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=pv({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=Sy(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function ly(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=Sy(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,Sy(i)+i.deletionCount,e.deletionLines.length),n}function uy(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Pv(e,t):Bv(e,t)),!0)}function dy(e,t){if(ty(e.deletionLines,e.additionLines)==null)return[];let n=Z_({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=Xv(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 fy(e,t,n){let r=e.map((e,t)=>{let n=Sy(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&&py(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=my(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 py(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function my(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 hy(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`);_y(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`);_y(s,c,i,r),r+=c,i+=c,n.push(gy(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 gy(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:Cy(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:wy(t.additionStart,r),deletionStart:Cy(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:wy(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${Cy(t.deletionStart,i)},${i} +${Cy(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return Zv(s),s}function _y(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function vy(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(Sy(r)!==Sy(i)||r.deletionCount!==i.deletionCount||xy(r)!==xy(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!yy(r,i))return!0}return!1}function yy(e,t){let n=by(e),r=by(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*by(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 xy(e){return yg(e.additionStart,e.additionCount)}function Sy(e){return yg(e.deletionStart,e.deletionCount)}function Cy(e,t){return t===0?e:e+1}function wy(e,t){return t===0?e-1:e}function Ty(e){Qv(e);for(let t=0;t<e.hunks.length;t++)Jv(e,t)}function Ey(e){let t=e.lang??mm(e.name),n=e.lang??(e.prevName==null?`text`:mm(e.prevName));return t===`text`&&n===`text`}var Dy=-1,Oy=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:R},t=vm,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=em(e.theme??R)?Zp():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,zv(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&&hg(r.diff,t),{result:c}=r;if(!r.highlighted||c==null||!ev(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||!hg(t.diff,e)||Ey(e)||By(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||!hg(n,e)||!hg(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);ev(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)??dn}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=Ng(u);s==null&&i&&(a.additionLines[t]=uh(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,zv(a,this.options.parseDiffOptions)),u=!0;else if(Lv(a,a.additionLines))this.applyRecomputePreservingSessionType(a,Rv(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=ry(a,c,this.options.parseDiffOptions,l);this.applyExpansionRemap(e),u=e!=null}}else Object.assign(a,Uv(a,c,this.options.parseDiffOptions))}return i.baseThemeType=t,r.isDirty=!0,u}applyExpansionRemap(e){e!=null&&(this.expandedHunks=sy(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=zy(e),i.code.additionLines=Ly(a,r.additionLines,i.code.additionLines,e),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,zv(r,this.options.parseDiffOptions)),i.code.additionLines[0]=Ry(0,e.getLineText(0))):this.editSessionActive?this.applySessionDocumentChange(r):Object.assign(r,Bv(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(Lv(e,n)){this.applyRecomputePreservingSessionType(e,Rv(e,n,t));return}this.applyExpansionRemap(ny(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=>im(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=R,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=on,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 Xp(_m(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=By(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!ev(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!Ey(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??mm(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??R}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||!hg(e,n.diff)||!ev(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(hg(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||Ey(e)||By(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||hg(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&em(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&em(t.theme)}renderDiff(e=this.diff,t=fn){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||Ey(e)||By(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!hg(e,this.renderCache.diff),d=!rm(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&ym(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,ym(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??mm(e.name);let t=this.highlighter!=null&&em(i.theme),n=this.highlighter!=null&&va(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=fn){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 lm({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=By(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??mm(e.name);let n=this.highlighter!=null&&em(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&va(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=Av(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(Sv({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]=Ry(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||!hg(i,e)||!ev(n,this.getRenderOptions(i).options)||(a.result==null||!a.highlighted||!ev(a.options,n)||!hg(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||!ev(t,n.options)))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&hg(n.diff,e)&&ev(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&&hg(e,n.diff)&&ev(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=Vy(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:kn(),deletionsGutterAST:kn(),additionsGutterAST:kn(),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=fv({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`,jn(void 0,`buffer`,this.size)),h?.push(tv(this.size))):(x.pushToGutter(`deletions`,jn(void 0,`buffer`,this.size)),g?.push(tv(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,An(t,n,r,i))};function T(e){C.flush(),a===`unified`?Py(`unified`,e,x):(Py(`deletions`,e,x),Py(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),Sv({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&&jy(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=Fy(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=Fy(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),Ny({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&&jy(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&My(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=Fy(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=Fy(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)}Ny({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&My(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(nv(e)),x.pushToGutter(`unified`,jn(e,`metadata`,1))):(x.deletionsContentAST.push(nv(e)),x.pushToGutter(`deletions`,jn(e,`metadata`,1)),k||(x.pushToGutter(`additions`,jn(void 0,`buffer`,1)),x.additionsContentAST.push(tv(1))))}if(k){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(nv(e)),x.pushToGutter(`unified`,jn(e,`metadata`,1))):(x.additionsContentAST.push(nv(e)),x.pushToGutter(`additions`,jn(e,`metadata`,1)),O||(x.pushToGutter(`deletions`,jn(void 0,`buffer`,1)),x.deletionsContentAST.push(tv(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(ov(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=kn(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,dh(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(z({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(z({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(z({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Ii(this.renderFullAST(e,t))}renderPartialHTML(e,t){return Ii(t==null?e:z({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(!lh(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(ch(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(ch(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Ny({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Ny({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 om({fileOrDiff:e,mode:t,stickyHeader:n})}},ky=new Intl.PluralRules(`en-US`);function Ay(e){return`${e} unmodified line${ky.select(e)===`one`?``:`s`}`}function jy(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function My(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 Ny({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`,jn(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`,jn(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`,jn(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Py(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,iv({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(iv({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,iv({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(iv({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=av(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?Ay(n):`More unchanged context may be available`;c.pushToGutter(e,iv({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(iv({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 Fy(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function Iy(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function Ly(e,t,n,r){let i=Iy(e),a=Iy(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]??=Ry(e,r.getLineText(e));return l}function Ry(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 zy(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function By(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Vy(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Hy(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Uy(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 Wy(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function Gy({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 Ky(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:Wh(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 qy(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function Jy(e){let t={...e};return delete t.cacheKey,t}function Yy(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??mm(e.name),r=t.lang??mm(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 Xy(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Zy(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&Xy(n.lines,t.deletionLines)}var Qy=-1,$y=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++Qy}`;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:R},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new oa,this.scrollSyncManager=new $_,this.interactionManager=new zi(`diff`,Bi(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 Ky(e)}createHunksRenderer(e){return new Oy(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=yg(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(Bi(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&&!bn(this.appliedThemeCSS.theme,this.options.theme??R)}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>Uh(this.editSessionAnnotations,e,vm);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,Hh(t,e,vm))}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;_n(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=Gy(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||ib(this.pre,nb({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||ab(this.headerElement,rb({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),Rh(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?Z_(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||!qy(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(wg(`merge`,e,t),this.setHydratedState(t),this.startHydratedEditSession(e)){this.rerender();return}await Wy(()=>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(eb(e)),t.__getDocumentSessionState()),!0):(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(hg(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(eb(e)),this.editor.__getDocumentSessionState())):(this.outgoingSessionDiff=n,e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e)),this.editSessionAnnotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSessionAnnotations=Vh(t,vm,this.editSessionAnnotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:Cg(t.contents),a=n!=null&&Zy(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=Jy(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,Qv(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=Gy(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=_&&(!tb(u,this.deletionFile)||!tb(d,this.additionFile)),y=e!=null&&!hg(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&rm(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=Z_(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()&&(uy(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,pn);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||!hg(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?Yy(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||ym(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return Sv({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&&Yy(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?_g(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??=Vh(this.lineAnnotations,vm);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(eb(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=vg(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=cy(e,this.hunksRenderer.getExpandedHunksMap(),t);return uy(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(ly(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 mv({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 hv({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]=lv(o);if(e<s){let c=uv({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=pv({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]=lv(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(){gn(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||Ey(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||!Uy(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||!Hy(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:Bh(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Bh(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=_h;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&&hg(r,n)?i:void 0)??Ii(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,Qt,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,Yt,f),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Xt,p),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Zt,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??=wh(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=jh(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??R,s=typeof o==`string`?o:{...o},c=Dh(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=qh({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Mh(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=Nh(this.themeCSSStyle.textContent??``,Dh(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Xh()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Kh(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=ob(t[0]),a=ob(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=Ii(i),r.content.innerHTML=Ii(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=Lh({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=Lh({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=Lh({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=ob(r?.[0]),a=ob(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=ob(r?.[0]),a=ob(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=Ii(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?Kh(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=ob(t[0]),i=ob(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};yh(u,this.appliedPreAttributes)||(zh(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 eb(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function tb(e,t){return e==null||t==null?e==null&&t==null:gg(e,t)}function nb({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function rb({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function ib(e,t,n=!1){return!n&&e==null&&t}function ab(e,t,n=!1){return e==null&&t&&!n}function ob(e){if(e!=null&&e.type===`element`)return e.children??[]}function sb({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=ag(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=uv({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=bv({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=cb(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?pv({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=xv({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=xv({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=sg(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function cb(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 lb(e,t)}function lb(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 ub=3e3,db=new Map,fb=-1,pb=class extends $y{__id=`little-virtualized-file-diff:${++fb}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:db,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=ig(n)}setMetrics(e,t=!1){let n=ig(e);!t&&yn(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 sh(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=!xn(t,e),r=n&&xb(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Sb(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=db,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()??db);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&&lh(this.renderRange)){let t=mb(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=Eb(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=ig(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=ag(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return Sv({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=bv({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=xv({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??ag(this.metrics,n)+this.cache.fileAnnotationHeight,u;return Sv({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=bv({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=xv({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||!hg(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=wg(`clone`,e,t);if(await Wy(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(wg(`merge`,e,t),this.setHydratedState(t),!this.startHydratedEditSession(e)&&(await Wy(()=>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 mv({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,!hg(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()??db);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=ag(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}=sb({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Cb(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=Gy(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!Tb(s,this.deletionFile)||!Tb(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=Z_(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!hg(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&&hg(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:!hg(a,o),renderedDiffChanged:!hg(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 wb(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=Cb(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=hb(this.cache.heightDeltas),u=ag(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=vb(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+yb(i,e)*this.metrics.lineHeight+gb(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=ub}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+gb(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=uv({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?bv({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?pv({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?xv({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:bb({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}=uv({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=pv({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=Cb(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=ag(this.metrics,i),h=e.hunks.length>0?sg(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,N;if(Sv({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?bv({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),N!=null)){if(N<=0)return!0;N--}let S=this.getLineHeight(l===`split`?m:h,g);if(k>n-S&&k<r&&(j??=x),M==null&&k+S>D&&(M=x),N==null&&k>=r&&b&&(N=T),A++,k+=S,c>0||v&&d){let e=xv({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 P=Math.round(M-w/2),ee=Math.max(0,Math.ceil(p/s)-w),te=Math.max(0,Math.min(P,ee)),ne=te*s,re=P<0?C+P*s:C,ie=E[te]??0,ae=ne===0?0:g+ie,oe=te+re/s,se=oe<E.length?v-E[oe]:v-(k-t-_);return{startingLine:ne,totalLines:re,bufferBefore:ae,bufferAfter:Math.max(0,se)}}};function mb(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===oh&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function hb(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 gb({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=_b(e,n);return(t[_b(e,r)]??0)-(t[i]??0)}function _b(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 vb(e){return Math.ceil(e/ub)*ub}function yb(e,t){let n=0;for(let r of e)r<t&&n++;return n}function bb({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 xb(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 Sb(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 Cb(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function wb(e){return typeof e==`function`?`custom`:e??`line-info`}function Tb(e,t){return e==null||t==null?e==null&&t==null:gg(e,t)}function Eb(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:Ob(e.items,t.items)}function Ob(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 kb(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(nn,``),t.before(r)):(r.setAttribute(rn,``),t.after(r)),n?.observe(r),r}function Ab(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var jb=`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(`.`),Mb=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],Nb=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],Pb=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],Fb=Symbol(`CodeView.itemOptionsState`);function Ib(e,t){Object.defineProperty(e,Fb,{configurable:!1,enumerable:!1,value:t})}function Lb(e){return e[Fb]}function Rb(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var zb=120,Bb=1,Vb=`--diffs-overflow-override`,Hb=12e6,Ub=1e6,Wb=2e6,Gb=1e7,Kb=11e6;function qb(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var Jb=(()=>{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)})(),Yb=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=cn;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:R},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??ln}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??cn.hunkLineCount,lineHeight:e?.lineHeight??cn.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??cn.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??cn.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??un}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return Vt&&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)<Bb||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),Jb&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Vb,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,zb)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(Vb,`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??kb(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(){_n(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(Bt),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))ex(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 Tn()?`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=Xb(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;Zb(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!yn(r,i),o=!yn(n,this.getLayout());o&&this.syncLayout();let s=a||Qb(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||$b(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),xn(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?(_n(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):gn(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=ox(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 pb(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 pg(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){qb(n);let r=Lb(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 Mb)Rb(e,t,()=>this.options[t]);Rb(e,`stickyHeader`,()=>this.options.stickyHeaders),Rb(e,`collapsed`,e=>{let t=Lb(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),Rb(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Lb(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of Nb)this.defineItemSharedCallback(e,`file`,t);for(let t of Pb)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of jb)Rb(e,t,()=>this.options[t]);Rb(e,`stickyHeader`,()=>this.options.stickyHeaders),Rb(e,`hunkSeparators`,()=>this.options.hunkSeparators),Rb(e,`collapsed`,e=>{let t=Lb(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),Rb(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Lb(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of Nb)this.defineItemSharedCallback(e,`diff`,t);for(let t of Pb)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return Ib(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return Ib(t,{id:e}),t}updateItemOptionsId(e,t){let n=Lb(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){Rb(e,n,e=>{if(this.options[n]==null)return;let r=Lb(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){Rb(e,n,e=>{let r=Lb(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()>Kb}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),Hb):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=Ab(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=Ab(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>Kb&&t<i,o=n<Ub&&t>0;return n<0||n>r||a||o?this.resolveScrollPageWindow(e,o?Math.min(Gb,r):Wb):{pagedScrollTop:Ab(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){let t=Ab(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 ${tx(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 ${tx(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=wn({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(),ix(this.stickyContainer,t.element,h),n.virtualizedSetup(),rx(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(ix(this.stickyContainer,t.element,h),rx(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=Ab(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)>=Bb){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=Ab(this.clampScrollTop(e)),i=Ab(t),{scrollPageOffset:a}=this,o=Ab(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||Ab(this.getScrollTop())===Ab(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 Xb(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 Zb(e,t){return!bn(e.theme??R,t.theme??R)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function Qb(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 $b(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 ex(e){return e instanceof SVGElement||Bh(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function tx(e){let t=nx(e.start,e.side),n=nx(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function nx(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function rx(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 ix(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function ax(e){return(e.annotations?.length??0)>0}function ox(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)ax(t.item)&&i.push(t);return i.length>0?i:void 0}function sx(e){let t=[];for(let n of e){let e=ma.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function cx(e){for(let t of Array.isArray(e)?e:[e])if(!ma.has(t))return!1;return!0}async function lx(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=dp(r)??up(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 ux(e){return Cp.getResolvedThemes(e)}async function dx(e){for(let t of e)Gp(t);let t=await Cp.resolveThemes(e);for(let n=0;n<e.length;n++)Kp(e[n],t[n]);return t}function fx(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 px(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 mx=new WeakMap;function hx(e,t){if(mx.has(e))return mx.get(e);let n=null;if(e.patch)try{n=Qg(e.patch,`${t}#${gx(e.patch)}`)[0]?.files[0]??null}catch{n=null}return mx.set(e,n),n}function gx(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${(t>>>0).toString(36)}${e.length.toString(36)}`}var _x=new WeakMap;function vx(e,t){let n=_x.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++]??``)}}_x.set(e,n)}return n[t]}function yx(e,t,n){let r=vx(e,t);if(!r.size)return!0;let i=n.split(`
1528
1528
  `),a=e=>e.replace(/\r?\n$/,``).replace(/\r$/,``);for(let[e,t]of r){let n=i[e-1];if(n===void 0||a(n)!==a(t))return!1}return!0}var bx=3;function xx(e,t,n,r){let i=vx(e,t),a=t===`deletions`?`-`:`+`,o=[];for(let e=Math.max(1,n-bx);e<=r+bx;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(`
1529
- `)}var Sx=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),Cx=Symbol(`IGNORE_RESPONSE`),wx=1e4,Tx=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},Ex=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`)}},Dx=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=R,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 Sx.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new Sx.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??R,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()||ev(a,this.renderOptions))return;let o=$p(e),c=[];if(bn(a.theme,this.renderOptions.theme)||(c=tm(o)?ux(o):await dx(o)),!s())return;if(this.highlighter!=null)wp(c,this.highlighter);else{let e=await Xp({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 Tx||!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);Ax(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=$p(this.renderOptions.theme),i=[];if(i=tm(r)?ux(r):await dx(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=cx(e)?sx(e):await lx(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([Xp({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 Tx||!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=hm(),i=r>0?gm():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??wx,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=kx(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);fh(t)||n!=null&&nm(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||fh(e)||t!=null&&nm(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 nh(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);Ey(t)||n!=null&&ev(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||Ey(e)||t!=null&&ev(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:Av(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 Tx;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 Tx;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):Ax(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&&(cx(r)?t.request.resolvedLanguages=sx(r):t.request.resolvedLanguages=await lx(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 Cx;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(Ax(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)||!nm(i,this.getFileRenderOptions()))throw Cx;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)||!ev(i,this.getDiffRenderOptions()))throw Cx;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!==Cx&&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,Ax(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&&(Ax(t)&&(this.rejectRenderTaskCallbacks(t,new Ex),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){Ox(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);for(let n of kx(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),Ax(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=hm();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=gm())}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 jx(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 Ex),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new Ex),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()))Ax(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of jx(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 jx(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of jx(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 jx(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)&&gg(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)&&hg(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())Ax(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function Ox(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function kx(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??mm(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??mm(e.request.diff.name)),t.add(e.request.diff.lang??mm(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function Ax(e){return e?.type===`file`||e?.type===`diff`}function jx(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 Nx;function Px({poolOptions:e,highlighterOptions:t}){return Nx??=new Dx(e,t),Nx}var Fx=`/assets/worker-C0KwUb8K.js`,Ix;function Lx(){return Ix??=Px({poolOptions:{workerFactory:()=>new Worker(Fx,{type:`module`}),poolSize:Math.min(2,navigator.hardwareConcurrency||2)},highlighterOptions:{theme:{dark:`pierre-dark`,light:`pierre-light`}}})}function Rx(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(zx(i))}return e=>!n.some(t=>t(e))&&t.every(t=>t(e))}function zx(e){if(!/[*?]/.test(e))return t=>tt(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=>tt(e,t)}}function Bx(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})}var Vx={apng:`image/apng`,avif:`image/avif`,bmp:`image/bmp`,gif:`image/gif`,ico:`image/x-icon`,jpeg:`image/jpeg`,jpg:`image/jpeg`,png:`image/png`,svg:`image/svg+xml`,webp:`image/webp`,pdf:`application/pdf`};function Hx(e){let t=e.lastIndexOf(`.`),n=Vx[t<0?``:e.slice(t+1).toLowerCase()];return n?{kind:n===`application/pdf`?`pdf`:`image`,type:n}:null}function Ux(e){if(e.length<=1)return null;let t=document.createElement(`select`);t.setAttribute(`aria-label`,`Send to session`),t.className=`_iY`;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 Gx(e,t,n){for(let r of e)r.disabled=t,n&&r.dataset.role===`send`&&(r.textContent=t?`Sending…`:n)}function Kx(e,t){let n=document.createElement(`button`);return n.type=`button`,n.textContent=e,n.className=t,n}function qx(e,t,n,r){if(!t){e.className=`_q ${r?be:``} _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=`_iW ${r?`_ij`:``}`,e.className=`_r _iX`,e.textContent=`Send to`,i.append(e,t),i}function Jx(e,t,n){e.onkeydown=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t()),e.key===`Escape`&&(e.preventDefault(),n())}}function Yx(e,t,n){let r=document.createElement(`div`);r.className=`_if`;let i=document.createElement(`div`),a=document.createElement(`div`);a.className=`_ii`;let o=()=>{i.replaceChildren(),a.replaceChildren();let r=document.createElement(`p`);r.className=`_ig`,r.textContent=e.text;let o=Kx(`Remove`,`_q ${be}`);o.onclick=()=>n.onDelete(e.id);let c=Kx(`Edit`,`_q ${be}`);c.hidden=!n.onEdit,c.onclick=()=>s();let l=t.sessions(),u=l.length>0&&!!n.onSend,d=Kx(`Send`,``);d.dataset.role=`send`,d.hidden=!u;let f=u?Ux(l):null,p=f?`Send to`:`Send`;if(d.onclick=()=>{(async()=>{let t=Wx(f,l);if(!(!t||d.disabled)){Gx([o,c,d],!0,p);try{await n.onSend?.(e.id,t)}finally{Gx([o,c,d],!1,p)}}})()},a.append(c,o),u&&a.append(qx(d,f,l,!0)),n.drifted){let e=document.createElement(`span`);e.className=`_N ${pe.warn} _ik`,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=`_Y _ih`;let r=Kx(`Save`,`_q _r`),s=Kx(`Cancel`,`_q`),c=()=>{let i=t.value.trim();if(!i||i===e.text){o();return}(async()=>{Gx([r,s],!0);try{await n.onEdit?.(e.id,i),e.text=i,o()}catch{Gx([r,s],!1)}})()};r.onclick=c,s.onclick=()=>o(),Jx(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 Xx(e,t){let n=document.createElement(`div`);n.className=`_if`;let r=document.createElement(`textarea`);r.placeholder=`Add a comment…`,r.rows=3,r.className=`_Y _ih`;let i=Kx(`Add`,`_q`),a=Kx(`Send`,``);a.dataset.role=`send`;let o=Kx(`Cancel`,`_q`),s=e.sessions(),c=s.length>0&&!!t.onSend;a.hidden=!c;let l=c?Ux(s):null,u=c?qx(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)){Gx([i,a,o],!0,d);try{await t.onSend?.(e,n)}finally{Gx([i,a,o],!1,d)}}})()};i.onclick=f,a.onclick=p,o.onclick=()=>t.onCancel(),Jx(r,c?p:f,()=>t.onCancel());let m=document.createElement(`div`);m.className=`_ii`,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 Zx(e,t){let n=document.createElement(e);return t&&(n.className=t),n}function Qx(e,t,n){let r=Zx(`div`,`_ie`),i=Zx(`span`,`_W`);i.textContent=n;let a=Zx(`a`,`_K`);return a.href=e,a.target=`_blank`,a.rel=`noreferrer`,a.textContent=`Open in a new tab`,r.append(i,a),r}function $x(e,t,n){let r=Zx(`div`,`_ib`),i=Zx(`span`,`_W`);i.textContent=n;let a=Zx(`img`,`_ic`);return a.alt=`${n}: ${t}`,a.loading=`lazy`,a.decoding=`async`,a.onload=()=>{i.textContent=`${n} · ${a.naturalWidth} × ${a.naturalHeight}`},a.onerror=()=>{r.replaceChildren(Qx(e,t,`This browser can't display this image.`))},a.src=e,r.append(a),{frame:r,meta:i}}function eS(e,t,n){let r=Zx(`span`,`_W`);if(r.textContent=n,!navigator.pdfViewerEnabled){let n=Zx(`div`,`_ib`);return n.append(Qx(e,t,`This browser can't display PDFs inline.`)),{frame:n,meta:r}}let i=Zx(`iframe`,`_id`);return i.src=e,i.title=`${n}: ${t}`,i.loading=`lazy`,{frame:i,meta:r}}function tS(e){let t=Zx(`div`,`_h_`);for(let n of e.sides){let r=Zx(`div`,`_ia`),{frame:i,meta:a}=e.kind===`pdf`?eS(n.src,e.name,n.label):$x(n.src,e.name,n.label);r.append(a,i),t.append(r)}return t}function nS(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(iS(e,n,a));for(let e of a){i++;let t=e.line_end===0?`whole file`:rS(e);r.push(``),r.push(`${i}. **${e.path}** (${t})`);let n=e.snippet;if(n!=null){let e=oS(n);r.push(``),r.push(sS(`${e}diff\n${n}\n${e}`))}r.push(``),r.push(sS(e.text))}}return r.join(`
1529
+ `)}var Sx=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),Cx=Symbol(`IGNORE_RESPONSE`),wx=1e4,Tx=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},Ex=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`)}},Dx=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=R,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 Sx.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new Sx.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??R,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()||ev(a,this.renderOptions))return;let o=$p(e),c=[];if(bn(a.theme,this.renderOptions.theme)||(c=tm(o)?ux(o):await dx(o)),!s())return;if(this.highlighter!=null)wp(c,this.highlighter);else{let e=await Xp({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 Tx||!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);Ax(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=$p(this.renderOptions.theme),i=[];if(i=tm(r)?ux(r):await dx(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=cx(e)?sx(e):await lx(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([Xp({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 Tx||!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=hm(),i=r>0?gm():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??wx,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=kx(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);fh(t)||n!=null&&nm(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||fh(e)||t!=null&&nm(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 nh(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);Ey(t)||n!=null&&ev(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||Ey(e)||t!=null&&ev(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:Av(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 Tx;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 Tx;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):Ax(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&&(cx(r)?t.request.resolvedLanguages=sx(r):t.request.resolvedLanguages=await lx(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 Cx;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(Ax(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)||!nm(i,this.getFileRenderOptions()))throw Cx;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)||!ev(i,this.getDiffRenderOptions()))throw Cx;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!==Cx&&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,Ax(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&&(Ax(t)&&(this.rejectRenderTaskCallbacks(t,new Ex),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){Ox(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);for(let n of kx(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),Ax(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=hm();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=gm())}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 jx(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 Ex),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new Ex),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()))Ax(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of jx(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 jx(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of jx(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 jx(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)&&gg(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)&&hg(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())Ax(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function Ox(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function kx(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??mm(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??mm(e.request.diff.name)),t.add(e.request.diff.lang??mm(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function Ax(e){return e?.type===`file`||e?.type===`diff`}function jx(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 Nx;function Px({poolOptions:e,highlighterOptions:t}){return Nx??=new Dx(e,t),Nx}var Fx=`/assets/worker-C0KwUb8K.js`,Ix;function Lx(){return Ix??=Px({poolOptions:{workerFactory:()=>new Worker(Fx,{type:`module`}),poolSize:Math.min(2,navigator.hardwareConcurrency||2)},highlighterOptions:{theme:{dark:`pierre-dark`,light:`pierre-light`}}})}function Rx(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(zx(i))}return e=>!n.some(t=>t(e))&&t.every(t=>t(e))}function zx(e){if(!/[*?]/.test(e))return t=>tt(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=>tt(e,t)}}function Bx(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})}var Vx={apng:`image/apng`,avif:`image/avif`,bmp:`image/bmp`,gif:`image/gif`,ico:`image/x-icon`,jpeg:`image/jpeg`,jpg:`image/jpeg`,png:`image/png`,svg:`image/svg+xml`,webp:`image/webp`,pdf:`application/pdf`};function Hx(e){let t=e.lastIndexOf(`.`),n=Vx[t<0?``:e.slice(t+1).toLowerCase()];return n?{kind:n===`application/pdf`?`pdf`:`image`,type:n}:null}function Ux(e){if(e.length<=1)return null;let t=document.createElement(`select`);t.setAttribute(`aria-label`,`Send to session`),t.className=`_iW`;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 Gx(e,t,n){for(let r of e)r.disabled=t,n&&r.dataset.role===`send`&&(r.textContent=t?`Sending…`:n)}function Kx(e,t){let n=document.createElement(`button`);return n.type=`button`,n.textContent=e,n.className=t,n}function qx(e,t,n,r){if(!t){e.className=`_q ${r?be:``} _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=`_iU ${r?`_i1`:``}`,e.className=`_r _iV`,e.textContent=`Send to`,i.append(e,t),i}function Jx(e,t,n){e.onkeydown=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t()),e.key===`Escape`&&(e.preventDefault(),n())}}function Yx(e,t,n){let r=document.createElement(`div`);r.className=`_iX`;let i=document.createElement(`div`),a=document.createElement(`div`);a.className=`_i0`;let o=()=>{i.replaceChildren(),a.replaceChildren();let r=document.createElement(`p`);r.className=`_iY`,r.textContent=e.text;let o=Kx(`Remove`,`_q ${be}`);o.onclick=()=>n.onDelete(e.id);let c=Kx(`Edit`,`_q ${be}`);c.hidden=!n.onEdit,c.onclick=()=>s();let l=t.sessions(),u=l.length>0&&!!n.onSend,d=Kx(`Send`,``);d.dataset.role=`send`,d.hidden=!u;let f=u?Ux(l):null,p=f?`Send to`:`Send`;if(d.onclick=()=>{(async()=>{let t=Wx(f,l);if(!(!t||d.disabled)){Gx([o,c,d],!0,p);try{await n.onSend?.(e.id,t)}finally{Gx([o,c,d],!1,p)}}})()},a.append(c,o),u&&a.append(qx(d,f,l,!0)),n.drifted){let e=document.createElement(`span`);e.className=`_N ${pe.warn} _i2`,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=`_Y _iZ`;let r=Kx(`Save`,`_q _r`),s=Kx(`Cancel`,`_q`),c=()=>{let i=t.value.trim();if(!i||i===e.text){o();return}(async()=>{Gx([r,s],!0);try{await n.onEdit?.(e.id,i),e.text=i,o()}catch{Gx([r,s],!1)}})()};r.onclick=c,s.onclick=()=>o(),Jx(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 Xx(e,t){let n=document.createElement(`div`);n.className=`_iX`;let r=document.createElement(`textarea`);r.placeholder=`Add a comment…`,r.rows=3,r.className=`_Y _iZ`;let i=Kx(`Add`,`_q`),a=Kx(`Send`,``);a.dataset.role=`send`;let o=Kx(`Cancel`,`_q`),s=e.sessions(),c=s.length>0&&!!t.onSend;a.hidden=!c;let l=c?Ux(s):null,u=c?qx(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)){Gx([i,a,o],!0,d);try{await t.onSend?.(e,n)}finally{Gx([i,a,o],!1,d)}}})()};i.onclick=f,a.onclick=p,o.onclick=()=>t.onCancel(),Jx(r,c?p:f,()=>t.onCancel());let m=document.createElement(`div`);m.className=`_i0`,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 Zx(e,t){let n=document.createElement(e);return t&&(n.className=t),n}function Qx(e,t,n){let r=Zx(`div`,`_hF`),i=Zx(`span`,`_W`);i.textContent=n;let a=Zx(`a`,`_K`);return a.href=e,a.target=`_blank`,a.rel=`noreferrer`,a.textContent=`Open in a new tab`,r.append(i,a),r}function $x(e,t,n){let r=Zx(`div`,`_hC`),i=Zx(`span`,`_W`);i.textContent=n;let a=Zx(`img`,`_hD`);return a.alt=`${n}: ${t}`,a.loading=`lazy`,a.decoding=`async`,a.onload=()=>{i.textContent=`${n} · ${a.naturalWidth} × ${a.naturalHeight}`},a.onerror=()=>{r.replaceChildren(Qx(e,t,`This browser can't display this image.`))},a.src=e,r.append(a),{frame:r,meta:i}}function eS(e,t,n){let r=Zx(`span`,`_W`);if(r.textContent=n,!navigator.pdfViewerEnabled){let n=Zx(`div`,`_hC`);return n.append(Qx(e,t,`This browser can't display PDFs inline.`)),{frame:n,meta:r}}let i=Zx(`iframe`,`_hE`);return i.src=e,i.title=`${n}: ${t}`,i.loading=`lazy`,{frame:i,meta:r}}function tS(e){let t=Zx(`div`,`_hA`);for(let n of e.sides){let r=Zx(`div`,`_hB`),{frame:i,meta:a}=e.kind===`pdf`?eS(n.src,e.name,n.label):$x(n.src,e.name,n.label);r.append(a,i),t.append(r)}return t}function nS(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(iS(e,n,a));for(let e of a){i++;let t=e.line_end===0?`whole file`:rS(e);r.push(``),r.push(`${i}. **${e.path}** (${t})`);let n=e.snippet;if(n!=null){let e=oS(n);r.push(``),r.push(sS(`${e}diff\n${n}\n${e}`))}r.push(``),r.push(sS(e.text))}}return r.join(`
1530
1530
  `)}function rS(e){let t=e.side===`deletions`?`Old`:`New`;return e.line_start===e.line_end?`${t} line ${e.line_start}`:`${t} lines ${e.line_start}-${e.line_end}`}function iS(e,t,n){if(t?.head){let n=aS(t.head),r=t.baseSha?aS(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=>aS(e)).join(`, `)}`:`${e}/`}function aS(e,t=12){return e.slice(0,t)}function oS(e){let t=3,n=/`+/g,r;for(;r=n.exec(e);)t=Math.max(t,r[0].length+1);return"`".repeat(t)}function sS(e){return e.split(`
1531
1531
  `).map(e=>e&&` ${e}`).join(`
1532
- `)}function cS(e){let t=e.replace(/^origin\//,``);return lS(t.includes(`/`)?t.slice(t.lastIndexOf(`/`)+1):t)}function lS(e){return e.replace(/-[a-z0-9]{1,6}$/i,``)||e}function uS(e,t){if(!t)return``;let n=e.replace(/^origin\//,``),r=t.replace(/^origin\//,``);return n.startsWith(`${r}-`)?n.slice(r.length+1):``}function dS(e){let t=lS(e);if(t.length<=20)return t;let n=t.split(`-`);return n.length>1?n[n.length-1]:t}function fS(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||cS(o):dS(a),topic:s?uS(a,o):``,title:a===i?i:`${a} vs ${i}`}}function pS(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||cS(i),t=uS(r,i);return t?`${e} [${t}]`:e}return dS(r)}var mS=`search-mark`,hS=`mark.${mS}`,gS=`mark.${mS}{display:inline;background:#ffd24a;color:#1a1408;-webkit-text-fill-color:#1a1408;border-radius:3px;padding:0 2px}mark.${mS} *,mark.${mS} *::before,mark.${mS} *::after{color:inherit!important;-webkit-text-fill-color:inherit!important;background:transparent!important}mark.${mS}.active{background:#ffb000;box-shadow:0 0 0 1px #c98400}`,_S={query:``,hit:null,keys:null},vS=new Map,yS=new WeakMap,bS=(e,t)=>t?`${e}\n${t.line}\n${t.side||``}`:e;function xS(e,t,n){_S.query=e,_S.hit=t,_S.keys=n?new Set(n):null;for(let[e,t]of vS)ES(e,t,!1);t&&SS(t)}function SS(e,t=0){requestAnimationFrame(()=>{requestAnimationFrame(()=>{let n=!1;for(let[r,i]of vS)if(i===e.key&&(n=!0,TS(r,e)||t>=40))return;t>=40||(!n||t<12)&&setTimeout(()=>SS(e,t+1),n?32:48)})})}function CS(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 wS(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 TS(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=>AS(e)===r)??e[0]??null})();if(!r)return!1;let i=e.closest(`[data-diff-main]`);if(i){if(!CS(i,r,`y`))return!1}else r.scrollIntoView({block:`center`,inline:`nearest`});let a=wS(r,e);return a&&CS(a,r,`x`),!0}function ES(e,t,n=!0){let r=t&&_S.hit?.key===t?_S.hit:null,i=_S.query.trim(),a=!!i&&!!_S.keys&&!!t&&!_S.keys.has(t),o=a?``:bS(i,r);!n&&yS.get(e)===o||(yS.set(e,o),FS(e,a?``:i,r),r&&SS(r))}function DS(e,t){return vS.set(e,t),ES(e,t),()=>{vS.delete(e),yS.delete(e)}}function OS(e){ES(e,vS.get(e))}function kS(e){let t=e.querySelectorAll(hS);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 AS(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 jS(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let e=t.nextNode();e;e=t.nextNode())e.parentElement?.closest(hS)||n.push(e);return n}function MS(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 NS(e,t,n,r,i){let a=MS(e,t,n),o=MS(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 PS(e,t,n,r){let i=jS(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=AS(e),u=Number(e.getAttribute(`data-line`)),d=r&&r.line===u&&(r.side||`additions`)===l?`${mS} active`:mS;for(let e=c.length-1;e>=0;e--)NS(i,a,c[e][0],c[e][1],d)}function FS(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(kS(e),s)for(let t of e.querySelectorAll(`[data-code] [data-line]`)){let e=t.textContent||``;(o?e:e.toLowerCase()).includes(s)&&PS(t,s,o,n)}}var IS=`_g3 _4 _l`,LS=`_g9 _ej`,RS=`_hC _u`,zS=st,BS=(e=>`/${e}&`)(ne);function VS(e){ce(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 HS=(e,t)=>Te(e.a,t),US=(e,t)=>ue(e.a,t),WS=(e=>`<div role=group><span>${e}<span aria-hidden=true> </span></span><button type=button aria-label="Copy comments as markdown"></button><!></div>`)(zS),GS=(e=>` D D/${e}& D m b%l`)(BS),KS=(e,t)=>T(e.a,`value`,t),qS=h(7,e=>c(e.b,e.f||e.g)),JS=M(5,qS),YS=M(6,qS),XS=(e,t)=>{KS(e,t[0]?.id),JS(e,t[0]?.title),YS(e,t[0]?.agent)},ZS=e=>{He(e.a),It(e.a,14),kt(e.a)},QS=e=>{Fe(e.a),re(e.a,14),Rt(e.a)},$S=j(26,e=>{T(e.b,`disabled`,e._._.o),T(e.c,`disabled`,e._._.o)},e=>e._._),eC=_(`k2`,e=>{u(e.b,`click`,function(){let t=e.c;typeof t.showPicker==`function`?t.showPicker():t.focus()}),C(e,`c`)}),tC=e=>{$S(e),rC(e),iC(e),b(e.a,`_iT`),b(e.b,[`_iO`,`_iP`,`_iU`]),b(e.c,`_iV`),eC(e)},nC=a(2,`<option> </option>`,` D `,0,XS),rC=j(27,e=>nC(e,[e._._.q,`id`]),e=>e._._),iC=j(29,e=>A(e,`c`,e._._.v,KC(e)),e=>e._._),aC=j(26,e=>c(e.a,e._._.o?`Sending…`:`Send`),e=>e._._),oC=aC,sC=h(4,e=>c(e.b,e._._.o?`Sending…`:`Send to ${e._._.w||e._._.x}`),2),cC=j(26,e=>{c(e.d,e._._.o?`Sending…`:`Send`),sC(e)},e=>e._._),lC=e=>{cC(e),uC(e),dC(e),b(e.a,[`_iS`,`_iR`]),b(e.c,`_iQ`)},uC=j(30,sC,e=>e._._),dC=j(31,sC,e=>e._._),fC=f(6,0,e=>T(e.a,`disabled`,e._.o)),pC=_(`k3`,e=>u(e.a,`click`,function(){e._.z()})),mC=e=>{fC._(e),_C._(e),yC._(e),bC._(e),b(e.a,[`_iO`,`_iP`]),pC(e)},hC=d(0,`<span> </span><span> </span>`,` D l D `,lC,` `,` `,oC),gC=d(1,`<span><button type=button aria-label="Choose session to send to"></button><select aria-label="Send comments to session" tabindex=-1></select></span>`,` D b `,tC),_C=f(6,0,e=>{hC(e,e._.s>1?0:1),gC(e,e._.s>1?0:1)}),vC=h(2,e=>T(e.a,`title`,`Send comments to ${e._.w||e._.x}`)),yC=f(6,0,vC),bC=f(6,0,vC),xC=d(5,me,(e=>`/${e}&`)(Pe),QS,Pt,(e=>`/${e}&`)(ke),ZS),SC=m(13,e=>{T(e.f,`title`,e.n?`Copied`:`Copy comments as markdown`),xC(e,+!e.n)}),CC=M(25),wC=h(20,e=>CC(e,qC(e)),2),TC=y(cC,aC,$S),EC=m(14,e=>{wC(e),fC(e),TC(e)}),DC=d(6,`<button type=button></button><!><!>`,` b%`,mC),OC=M(19,e=>{LC(e,e.t?.id),zC(e,e.t?.title),VC(e,e.t?.agent),DC(e,+!e.t),wC(e)}),kC=h(17,e=>OC(e,e.q.find(t=>t.id===e.p)??e.q[0]??null)),AC=m(15,kC),jC=_(`k4`,e=>u(e.f,`click`,function(){(async()=>{await e.m()&&(SC(e,!0),setTimeout(()=>{SC(e,!1)},1500))})()}));function MC(e){b(e.a,`_iK`),b(e.b,`_iL`),VS(e.c),HS(e.c,18),US(e.c,`_iM`),b(e.d,`_iN`),b(e.f,`_iO`),SC(e,!1),EC(e,!1),AC(e,null),jC(e)}var NC=y(rC),PC=M(16,e=>{FC(e,e.q.length),kC(e),NC(e)}),FC=M(18,_C),IC=(e,t)=>PC(e,t||[]),LC=M(21,y(iC)),RC=y(uC),zC=M(22,e=>{yC(e),RC(e)}),BC=y(dC),VC=M(23,e=>{bC(e),BC(e)}),HC=(e,t)=>{T(e.a,`aria-label`,t),T(e.b,`title`,t)},UC=(e,t)=>{c(e.e,t>99?`99+`:t),HC(e,`${t} comment${t===1?``:`s`}`)},WC=M(11,wC),GC=M(12),KC=e=>function(t){AC(e._._,t)},qC=e=>()=>{(async()=>{if(!(!e.t||e.o)){EC(e,!0);try{await e.l(e.t?.id)}finally{EC(e,!1)}}})()};N(`k0`,KC),N(`k1`,qC);var JC=st,YC=(e=>`/${e}&`)(ne);function XC(e){ce(e.a,`M2 11V4.6C2 4.26863 2.26863 4 2.6 4H8.77805C8.92127 4 9.05977 4.05124 9.16852 4.14445L12.3315 6.85555C12.4402 6.94876 12.5787 7 12.722 7H21.4C21.7314 7 22 7.26863 22 7.6V11M2 11V19.4C2 19.7314 2.26863 20 2.6 20H21.4C21.7314 20 22 19.7314 22 19.4V11M2 11H22`)}var ZC=(e,t)=>Te(e.a,t),QC=(e,t)=>ue(e.a,t),$C=40,ew;function tw(e){return e.length>=200?null:[...new Set(e.map(e=>e.key))]}function nw(e,t){let n=t.trim();if(!n)return[];if(ew&&ew.files===e&&ew.query===n)return ew.hits;let r=aw(e,n);return ew={files:e,query:n,hits:r},r}var rw=new WeakMap;function iw(e){let t=rw.get(e);if(!t){let n={additions:new Set,deletions:new Set};if(e.fileDiff){let n=vx(e.fileDiff,`additions`),r=vx(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};rw.set(e,t)}return t}function aw(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)){ow(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}=iw(t),l=new Set;sw(t,s,`additions`,r,n,l,a,o.additions),sw(t,c,`deletions`,r,n,l,a,o.deletions),a.length===e&&ow(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 ow(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 sw(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>=$C)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:cw(d,f,r.length)}))}}function cw(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 lw=((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>`)(ht,xe,rt,Nt),uw=((e,t,n,r)=>` D D/${e}&l b D l D/${t}&l D/${n}&l D/${r}&m`)(ge,Se,Ve,Ne),dw=_(`j8`,e=>e.ah=!!e.a1),fw=h(44,dw),pw=_(`j7`,e=>l(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(){if(e.z!==e.an&&(e.an=e.z,e.a1&&e.aw()),e.a1&&!e.ao)e.ao=!0,e.y||e.aw();else if(!e.a1&&e.ao){e.ao=!1;let t=e.d;t&&document.activeElement===t&&t.blur(),e.al&&=(clearTimeout(e.al),0),xS(``,null),jw(e,{query:``,hit:null,keys:[]})}},onDestroy:function(){e.al&&clearTimeout(e.al),this.abort.abort(),xS(``,null),jw(e,{query:``,hit:null,keys:[]})}})),mw=h(59,pw,11),hw=h(29,e=>b(e.a,[`_eC`,e.a0&&`_eL`,!e.a1&&`_eB`])),gw=h(41,e=>c(e.f,e.a1&&(e.a4||``).trim()?e.ab?`${e.ae+1}/${e.ab}`:`0/0`:``),3),_w=h(38,e=>{T(e.g,`disabled`,!e.ab||!e.a1),T(e.i,`disabled`,!e.ab||!e.a1)}),vw=o(27,e=>{T(e.a,`aria-hidden`,e.a1?`false`:`true`),T(e.d,`tabindex`,e.a1?0:-1),T(e.g,`tabindex`,e.a1?0:-1),T(e.i,`tabindex`,e.a1?0:-1),T(e.k,`tabindex`,e.a1?0:-1),fw(e),mw(e),hw(e),gw(e),_w(e)}),yw=h(16,e=>vw(e,e.o,e.p)),bw=M(14,yw),xw=M(15,yw),Sw=(e,t)=>qw(e,t?.length),Cw=h(32,e=>Sw(e,nw(e.x,e.a4||``))),ww=M(56,mw),Tw=h(53,e=>ww(e,iT(e)),4),Ew=h(55,e=>S(e,`d`,e.a4||``,aT(e))),Dw=o(30,e=>{Cw(e),Tw(e),mw(e),Ew(e),gw(e)}),Ow=h(19,e=>Dw(e,e.r,e.s)),kw=M(17,Ow),Aw=M(18,Ow),jw=o(33),Mw=h(22,e=>jw(e,e.u,e.v)),Nw=M(20,Mw),Pw=M(21,Mw),Fw=M(40,e=>{Tw(e),gw(e)}),Iw=h(39,e=>Fw(e,e.ab?Math.min(e.a9,e.ab-1):-1)),Lw=M(54,e=>{mw(e),Ew(e)}),Rw=h(52,e=>Lw(e,oT(e)),3),zw=M(51,e=>{Rw(e),Tw(e)}),Bw=h(45,e=>zw(e,sT(e)),2),Vw=m(35,e=>{Iw(e),Bw(e)}),Hw=(e,t)=>Zw(e,t.open),Uw=(e,t)=>{Qw(e,t.timer),$w(e,t.tick),eT(e,t.wasOpen)},Ww=M(58,e=>{i(e,e.aw),mw(e)}),Gw=_(`j6`,e=>{E(e,`d`),u(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))}}),u(e.g,`mousedown`,function(e){e.preventDefault()}),u(e.g,`click`,function(){e.au(-1)}),u(e.i,`mousedown`,function(e){e.preventDefault()}),u(e.i,`click`,function(){e.au(1)}),u(e.k,`mousedown`,function(e){e.preventDefault()}),u(e.k,`click`,function(){e.av()})});function Kw(e){b(e.b,`_eD`),ve(e.c),fe(e.c,13),Ie(e.c),b(e.e,`_eG`),at(e.h),te(e.h,14),ot(e.h),_t(e.j),lt(e.j,14),Ct(e.j),oe(e.l),je(e.l,14),Ft(e.l),Vw(e,0),Hw(e,{open:!1}),Uw(e,{timer:0,tick:0,wasOpen:!1}),Ww(e,cT(e)),Gw(e)}var qw=M(37,e=>{Iw(e),gw(e),_w(e)}),Jw=M(23,e=>{Cw(e),Bw(e),Rw(e)}),Yw=M(57,mw),Xw=h(48,e=>Yw(e,lT(e))),Zw=M(43,e=>{Bw(e),Rw(e),Tw(e),Xw(e),fw(e),mw(e)}),Qw=M(47,e=>{Rw(e),Tw(e),Xw(e),mw(e)}),$w=M(49,mw),eT=M(50,mw),tT=M(24,e=>{T(e.k,`hidden`,e.y),mw(e)}),nT=M(25,mw),rT=M(26,e=>{b(e.d,[bt,e.a0&&`_eN`]),b(e.g,[ft,e.a0&&`_eO`]),b(e.i,[ft,e.a0&&`_eO`]),b(e.k,[ft,e.a0&&`_eO`]),hw(e)}),iT=e=>t=>{e.ah&&(e.al&&=(clearTimeout(e.al),0),e.ap(e.a4||``,(e.ae<0?0:e.ae)+t))},aT=e=>function(t){e.as(t)},oT=e=>t=>{if(!e.ah)return;Dw(e,t),Vw(e,0);let n=nw(e.x,t);xS(t,n[0]??null,tw(n)??void 0),e.al&&clearTimeout(e.al),e.al=setTimeout(()=>{e.al=0,e.ap(t,0)},80)},sT=e=>(t,n)=>{if(!e.ah)return;let r=nw(e.x,t),i=[...new Set(r.map(e=>e.key))];if(!r.length){Vw(e,0),xS(t,null,i),jw(e,{query:t,hit:null,keys:i});return}Vw(e,(n%r.length+r.length)%r.length);let a=r[e.a9];xS(t,a,tw(r)??void 0),jw(e,{query:t,hit:a,keys:i})},cT=e=>()=>{let t=e.d;t&&(t.focus(),t.select(),document.activeElement!==t&&setTimeout(()=>{t.focus(),t.select()},0))},lT=e=>()=>{e.d?.blur(),vw(e,!1),e.ah=!1,e.al&&=(clearTimeout(e.al),0),xS(``,null),jw(e,{query:``,hit:null,keys:[]})};N(`j4`,iT),N(`j1`,aT),N(`j3`,oT),N(`j2`,sT),N(`j0`,cT),N(`j5`,lT);var uT=`_jG _y`,dT=`_jR _x`,fT=`<div><!><!><!><!><!><!><span><span><!> file<!></span><!><!><!></span></div>`,pT=` D%b%b%b%b%b%b E%c%l%b%b%m`,mT=j(82,e=>c(e.b,e._._.ar),e=>e._._),hT=e=>{mT(e),b(e.a,[`_N`,pe.accent,`_jX`])},gT=h(2,e=>T(e.a,`title`,`${e._.a6?`#${e._.a6.number}`:e._.aa} is already in ${e._.a8}; showing the working tree only`),2),_T=f(5,0,gT),vT=e=>{_T._(e),yT._(e),bT._(e),b(e.a,[`_N`,`_jY`])},yT=f(5,0,e=>{c(e.b,e._.a8),gT(e)}),bT=f(5,0,gT),xT=f(3,0,e=>c(e.b,aS(e._.ak,7))),ST=e=>{xT._(e),b(e.a,[`_N`,`_jY`])},CT=h(7,e=>T(e.a,`title`,`${e._.as} · ${e._.ah.slice(0,7)}…${e._.ai.slice(0,7)}`),2),wT=f(2,0,CT),TT=e=>{wT._(e),ET._(e),OT._(e),kT._(e),AT._(e),jT._(e),b(e.a,`_jT`),b(e.b,[`_N`,`_jU`]),b(e.d,[`_P`,`_jW`]),b(e.e,[`_N`,`_jV`])},ET=f(2,0,CT),DT=d(6,`<span> </span>`,` D `,hT),OT=f(2,0,e=>DT(e,+!e._.ar)),kT=f(2,0,CT),AT=f(2,0,e=>c(e.c,e._.at)),jT=f(2,0,e=>c(e.f,e._.au)),MT=f(1,1,e=>c(e.b,Ce(e._.aj))),NT=e=>{MT._(e),b(e.a,[dT,`_jS`])},PT=h(4,e=>T(e.a,`title`,`${e._.ag}: ${e._.a9} ${e._.ah} vs ${e._.a8} ${e._.ai}`),4),FT=f(1,0,PT),IT=e=>{FT._(e),LT._(e),RT._(e),zT._(e),BT._(e),VT._(e),HT._(e),b(e.a,[`_u`,`_v`]),b(e.c,dT)},LT=f(1,0,PT),RT=f(1,0,e=>c(e.b,e._.ae)),zT=f(1,0,e=>T(e.a,`href`,`${e._.af}/files`)),BT=f(1,0,e=>{c(e.d,e._.ag),PT(e)}),VT=f(1,0,PT),HT=f(1,0,PT),UT=f(12,0,e=>c(e.b,e._.a1)),WT=_(`x2`,e=>u(e.a,`click`,function(){e._.a4()})),GT=e=>{UT._(e),KT._(e),WT(e)},KT=f(12,0,e=>{b(e.a,[`_jQ`,{_jP:e._.a2}]),T(e.a,`aria-pressed`,e._.a2?`true`:`false`),T(e.a,`title`,e._.a2?`Show every file`:`Show only files changed since your last visit`)}),qT=f(11,0,e=>c(e.b,e._.z)),JT=_(`x1`,e=>u(e.a,`click`,function(){e._.a0()})),YT=e=>{qT._(e),b(e.a,`_jQ`),JT(e)},XT=f(10,0,e=>c(e.b,e._.w)),ZT=e=>{XT._(e),QT._(e),b(e.a,`_jN`),b(e.c,`_jO`)},QT=f(10,0,e=>c(e.d,e._.x)),$T=h(3,e=>c(e.b,pS(e._.aa,e._.q,e._.r)),2),eE=f(6,0,$T),tE=e=>{eE._(e),nE._(e),iE._(e),aE._(e),oE._(e),sE._(e),b(e.a,[`_N`,`_jY`])},nE=f(6,0,$T),rE=h(4,e=>T(e.a,`title`,`This view is ${aS(e._.ah)} (${e._.a9}); checked out is ${aS(e._.ap)} (${e._.aa})`),3),iE=f(6,0,rE),aE=f(6,0,e=>{rE(e),$T(e)}),oE=f(6,0,rE),sE=f(6,0,e=>{c(e.c,aS(e._.ap,7)),rE(e)}),cE=f(4,0,e=>T(e.a,`disabled`,e._.s)),lE=_(`x0`,e=>u(e.a,`click`,function(){e._.t()})),uE=e=>{cE._(e),fE._(e),pE._(e),mE._(e),b(e.a,[`_N`,pe.warn,`_jY`]),lE(e)},dE=h(3,e=>T(e.a,`title`,`origin/${e._.a9} ${e._.ah} · GitHub ${e._.am}. Reload to re-ask GitHub`),2),fE=f(4,0,dE),pE=f(4,0,e=>{c(e.b,aS(e._.ah,7)),dE(e)}),mE=f(4,0,e=>{c(e.c,aS(e._.am,7)),dE(e)}),hE=(e,t)=>{_E(e,t?.pr),EE(e,t?.base),DE(e,t?.branch),jE(e,t?.default_branch),ME(e,t?.worktree),NE(e,t?.head),PE(e,t?.baseSha),FE(e,t?.full_name),LE(e,t?.rev),zE(e,t?.githubDrift),HE(e,t?.contained),UE(e,t?.localHead)},gE=d(1,`<a target=_blank rel=noopener>#<!></a><span> </span>`,` Db%l D `,IT,`<span> </span>`,` D `,NT),_E=M(32,e=>{bE(e,e.a6?.baseRefName),xE(e,e.a6?.headRefName),SE(e,e.a6?.number),CE(e,e.a6?.url),wE(e,e.a6?.title),TE(e,e.a6?.headRefOid),gE(e,+!e.a6),_T(e)}),vE=(e,t)=>{ZE(e,t?.topic),QE(e,t?.title),$E(e,t?.base),eD(e,t?.head)},yE=h(37,e=>vE(e,fS(e.a7||e.a8,e.a9||e.aa,e.q,e.r)),5),bE=M(33,yE),xE=M(35,e=>{yE(e),fE(e),iE(e),LT(e)}),SE=M(40,RT),CE=M(41,zT),wE=M(42,BT),TE=M(48,mE),EE=M(34,e=>{yE(e),FT(e),yT(e)}),DE=M(36,e=>{yE(e),aE(e),bT(e)}),OE=d(2,`<span><span> </span><span aria-hidden=true>vs</span><span> </span><!></span>`,` D D l b D l%`,TT),kE=(e,t)=>OE(e,+!t),AE=h(59,e=>kE(e,!!e.ar||!!e.q&&e.aw!==e.q||!!e.ac&&e.av!==e.ac),4),jE=M(38,AE),ME=M(39),NE=M(43,e=>{pE(e),oE(e),VT(e),wT(e)}),PE=M(44,e=>{HT(e),ET(e)}),FE=M(45,MT),IE=d(3,`<span title="One commit against its parent">commit <!></span>`,` Db%`,ST),LE=M(46,e=>{IE(e,+!e.ak),xT(e)}),RE=d(4,`<button type=button>behind GitHub <!> → <!></button>`,` Db%c%`,uE),zE=(e,t)=>RE(e,+!t),BE=d(5,`<span>already in <!></span>`,` Db%`,vT),VE=h(50,e=>BE(e,e.an&&e.u?0:1)),HE=M(49,VE),UE=M(51,sE),WE=M(57,AE),GE=e=>{WE(e,(e.a7||e.a8).replace(/^origin\//,``))},KE=M(58,AE),qE=e=>{KE(e,(e.a9||e.aa).replace(/^origin\//,``))},JE=e=>{T(e.a,`data-pr`,e.a6?`${e.ad}/${e.a6.number}`:void 0)},YE=M(15,e=>{hE(e,e.p),GE(e),qE(e),JE(e)}),XE=y(mT),ZE=M(53,e=>{AE(e),OT(e),XE(e)}),QE=M(54,kT),$E=M(55,AT),eD=M(56,jT),tD=M(16,e=>{yE(e),AE(e),eE(e)}),nD=M(17,e=>{yE(e),nE(e)});function rD(e){b(e.a,`_jL`),b(e.h,`_jM`)}var iD=M(20,e=>{c(e.i,e.u),c(e.j,e.u===1?``:`s`),VE(e)}),aD=d(6,`<span>local <!><!></span>`,` Db%b%`,tE),oD=(e,t)=>aD(e,+!t),sD=d(10,`<span>+<!></span><span>−<!></span>`,` Db%l Db%`,ZT),cD=h(24,e=>sD(e,e.w||e.x?0:1)),lD=M(22,e=>{cD(e),XT(e)}),uD=M(23,e=>{cD(e),QT(e)}),dD=d(11,`<button type=button title="Filtered out of the list — show every file"><!> hidden</button>`,` D%`,YT),fD=M(25,e=>{dD(e,+!e.z),qT(e)}),pD=d(12,`<button type=button><!> new</button>`,` D%`,GT),mD=h(29,e=>pD(e,e.a1||e.a2?0:1)),hD=M(27,e=>{mD(e),UT(e)}),gD=M(28,e=>{mD(e),KT(e)}),_D=M(18,cE),vD=M(19),yD=M(26),bD=M(30),xD=`<!><!><!>`,SD=f(1,0,e=>c(e.b,e._.e)),CD=e=>{SD._(e),b(e.a,[uT,`_jC`])},wD=f(6,0,e=>c(e.b,e._.r)),TD=e=>{wD._(e),b(e.a,[`_u`,`_v`,`_jH`])},ED=j(34,e=>gD(e.c,e._._.k),e=>e._._),DD=e=>{ED(e),OD(e),kD(e),AD(e),jD(e),ND(e),PD(e),FD(e),LD(e),zD(e),BD(e),VD(e),HD(e),UD(e),GD(e),b(e.a,`_jI`),rD(e.c)},OD=j(35,e=>bD(e.c,e._._.l),e=>e._._),kD=j(36,e=>yD(e.c,e._._.m),e=>e._._),AD=j(37,e=>tD(e.c,e._._.n),e=>e._._),jD=j(38,e=>nD(e.c,e._._.o),e=>e._._),MD=h(9,e=>oD(e.c,e._._.p.has(e.i))),ND=j(39,MD,e=>e._._),PD=j(40,e=>vD(e.c,e._._.q),e=>e._._),FD=j(41,e=>_D(e.c,e._._.r),e=>e._._),ID=(e,t)=>{YE(e.c,t),KD(e,t?.worktree),qD(e,t?.files?.length),JD(e,t?.id)},LD=j(43,e=>ID(e,e._._.t),e=>e._._),RD=h(7,e=>iD(e.c,e._._.v||e.g)),zD=j(45,RD,e=>e._._),BD=j(46,e=>lD(e.c,e._._.w),e=>e._._),VD=j(47,e=>uD(e.c,e._._.x),e=>e._._),HD=j(48,e=>hD(e.c,e._._.y),e=>e._._),UD=j(49,e=>fD(e.c,e._._.z),e=>e._._),WD=d(1,`<span> </span>`,` D `,CD),GD=j(50,e=>WD(e,+!!e._._.a0),e=>e._._),KD=M(4,SD),qD=M(6,RD),JD=M(8,MD),YD=h(20,e=>b(e.a,[`_jB`,{_jz:e.s,_jA:e.t}])),XD=M(19,e=>{T(e.b,`title`,e.t?`Show this section's files`:`Hide this section's files`),T(e.b,`aria-expanded`,e.t?`false`:`true`),YD(e)}),ZD=h(12,e=>XD(e,e._._._.h.has(e.l))),QD=j(33,ZD,e=>e._._._),$D=e=>{QD(e),nO(e),b(e.b,`_jE`),b(e.c,`_jF`),b(e.d,`_jD`),b(e.e,uT)},eO=M(18,e=>{T(e.a,`aria-selected`,e.s?`true`:`false`),YD(e)}),tO=h(13,e=>eO(e,e._._._.u===e.l)),nO=j(44,tO,e=>e._._._),rO=(e,t)=>{aO(e,t?.id),cO(e,t?.pr),uO(e,t?.worktree)},iO=_(`y1`,e=>{u(e.b,`click`,function(){e._._._.i(e.l)}),u(e.d,`click`,function(){e._._._.j(e.l)})}),aO=M(11,e=>{tO(e),ZD(e),iO(e)}),oO=d(6,`<span>#<!></span>`,` Db%`,TD),sO=h(16,e=>T(e.a,`data-pr`,e.o?`${e.p}/${e.o.number}`:void 0)),cO=M(14,e=>{lO(e,e.o?.number),oO(e,+!e.o),sO(e)}),lO=M(17,wD),uO=M(15,e=>{c(e.f,e.p),sO(e)}),dO=rO,fO=a(0,`<div role=tab><button type=button><span>▾</span></button><button type=button title="Scroll to this section"><span> </span><!></button></div>`,` D D l D D l%`,$D,(e,t)=>dO(e,t[0]?.repo)),pO=j(31,e=>fO(e,[e._._.d,e=>e.repo.id]),e=>e._._),mO=_(`y3`,e=>u(e.a,`scroll`,function(){e._._.a4(e.a)})),hO=e=>{pO(e),vO(e),bO(e),xO(e),SO(e),mO(e)},gO=_(`y2`,e=>l(e,{count:e._._.g,onMount:function(){e._._.a4(e.a);let t=new ResizeObserver(()=>e._._.a4(e.a));return t.observe(e.a),{ro:t}},onUpdate:function(){e._._.a4(e.a)},onDestroy:function(){this.ro.disconnect()}})),_O=h(1,gO),vO=j(32,_O,e=>e._._),yO=h(2,e=>b(e.a,[`_jy`,{_jx:e._._.a2,_jw:e._._.a3}])),bO=j(51,yO,e=>e._._),xO=j(52,yO,e=>e._._),SO=j(53,_O,e=>e._._),CO=d(2,(e=>`<div><!>${e}</div>`)(fT),(e=>` D%b/${e}&l`)(pT),DD),wO=f(0,0,e=>CO(e,+!e._.s)),TO=e=>{wO._(e),DO._(e)},EO=d(1,`<div role=tablist></div>`,` `,hO),DO=f(0,0,e=>{b(e.a,[`_jv`,{_ju:e._.a0}]),EO(e,+!e._.a0)}),OO=M(18,e=>{AO(e,e.s?.repo),MO(e,e.s?.files),NO(e,e.s?.additions),PO(e,e.s?.deletions),FO(e,e.s?.fresh),IO(e,e.s?.hidden),wO(e)}),kO=y(LD),AO=M(19,e=>{jO(e,e.t?.id),kO(e)}),jO=M(20,y(nO)),MO=M(21,y(zD)),NO=M(22,y(BD)),PO=M(23,y(VD)),FO=M(24,y(HD)),IO=M(25,y(UD)),LO=h(5,e=>OO(e,e.d.find(t=>t.repo.id===e.e)||e.d[0])),RO=y(pO),zO=M(3,e=>{GO(e,e.d?.length),LO(e),RO(e)}),BO=M(4,LO),VO=y(GD),HO=M(26,e=>{DO(e),VO(e)}),UO=d(0,`<div><!><!></div>`,` D%b%`,TO),WO=y(vO),GO=M(6,e=>{HO(e,e.g>1),UO(e,+!e.g),WO(e)}),KO=M(30,y(SO)),qO=e=>{KO(e,lk(e))},JO=m(27,e=>{YO(e,e.a1?.end),XO(e,e.a1?.start),qO(e)}),YO=M(28,y(bO)),XO=M(29,y(xO));function ZO(e){JO(e,{start:!1,end:!1})}var QO=M(7,y(QD)),$O=M(8),ek=M(9),tk=M(10,y(ED)),nk=M(11,y(OD)),rk=M(12,y(kD)),ik=M(13,y(AD)),ak=M(14,y(jD)),ok=M(15,y(ND)),sk=M(16,y(PD)),ck=M(17,y(FD)),lk=e=>t=>{let n=t.scrollWidth-t.clientWidth-t.scrollLeft>1,r=t.scrollLeft>1;(n!==e.a2||r!==e.a3)&&JO(e,{start:r,end:n})};N(`y0`,lk);var uk=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1532
+ `)}function cS(e){let t=e.replace(/^origin\//,``);return lS(t.includes(`/`)?t.slice(t.lastIndexOf(`/`)+1):t)}function lS(e){return e.replace(/-[a-z0-9]{1,6}$/i,``)||e}function uS(e,t){if(!t)return``;let n=e.replace(/^origin\//,``),r=t.replace(/^origin\//,``);return n.startsWith(`${r}-`)?n.slice(r.length+1):``}function dS(e){let t=lS(e);if(t.length<=20)return t;let n=t.split(`-`);return n.length>1?n[n.length-1]:t}function fS(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||cS(o):dS(a),topic:s?uS(a,o):``,title:a===i?i:`${a} vs ${i}`}}function pS(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||cS(i),t=uS(r,i);return t?`${e} [${t}]`:e}return dS(r)}var mS=`search-mark`,hS=`mark.${mS}`,gS=`mark.${mS}{display:inline;background:#ffd24a;color:#1a1408;-webkit-text-fill-color:#1a1408;border-radius:3px;padding:0 2px}mark.${mS} *,mark.${mS} *::before,mark.${mS} *::after{color:inherit!important;-webkit-text-fill-color:inherit!important;background:transparent!important}mark.${mS}.active{background:#ffb000;box-shadow:0 0 0 1px #c98400}`,_S={query:``,hit:null,keys:null},vS=new Map,yS=new WeakMap,bS=(e,t)=>t?`${e}\n${t.line}\n${t.side||``}`:e;function xS(e,t,n){_S.query=e,_S.hit=t,_S.keys=n?new Set(n):null;for(let[e,t]of vS)ES(e,t,!1);t&&SS(t)}function SS(e,t=0){requestAnimationFrame(()=>{requestAnimationFrame(()=>{let n=!1;for(let[r,i]of vS)if(i===e.key&&(n=!0,TS(r,e)||t>=40))return;t>=40||(!n||t<12)&&setTimeout(()=>SS(e,t+1),n?32:48)})})}function CS(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 wS(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 TS(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=>AS(e)===r)??e[0]??null})();if(!r)return!1;let i=e.closest(`[data-diff-main]`);if(i){if(!CS(i,r,`y`))return!1}else r.scrollIntoView({block:`center`,inline:`nearest`});let a=wS(r,e);return a&&CS(a,r,`x`),!0}function ES(e,t,n=!0){let r=t&&_S.hit?.key===t?_S.hit:null,i=_S.query.trim(),a=!!i&&!!_S.keys&&!!t&&!_S.keys.has(t),o=a?``:bS(i,r);!n&&yS.get(e)===o||(yS.set(e,o),FS(e,a?``:i,r),r&&SS(r))}function DS(e,t){return vS.set(e,t),ES(e,t),()=>{vS.delete(e),yS.delete(e)}}function OS(e){ES(e,vS.get(e))}function kS(e){let t=e.querySelectorAll(hS);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 AS(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 jS(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let e=t.nextNode();e;e=t.nextNode())e.parentElement?.closest(hS)||n.push(e);return n}function MS(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 NS(e,t,n,r,i){let a=MS(e,t,n),o=MS(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 PS(e,t,n,r){let i=jS(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=AS(e),u=Number(e.getAttribute(`data-line`)),d=r&&r.line===u&&(r.side||`additions`)===l?`${mS} active`:mS;for(let e=c.length-1;e>=0;e--)NS(i,a,c[e][0],c[e][1],d)}function FS(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(kS(e),s)for(let t of e.querySelectorAll(`[data-code] [data-line]`)){let e=t.textContent||``;(o?e:e.toLowerCase()).includes(s)&&PS(t,s,o,n)}}var IS=`_e1 _4 _l`,LS=`_e7 _c0`,RS=`_fA _u`,zS=st,BS=(e=>`/${e}&`)(ne);function VS(e){ce(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 HS=(e,t)=>Te(e.a,t),US=(e,t)=>ue(e.a,t),WS=(e=>`<div role=group><span>${e}<span aria-hidden=true> </span></span><button type=button aria-label="Copy comments as markdown"></button><!></div>`)(zS),GS=(e=>` D D/${e}& D m b%l`)(BS),KS=(e,t)=>T(e.a,`value`,t),qS=h(7,e=>c(e.b,e.f||e.g)),JS=M(5,qS),YS=M(6,qS),XS=(e,t)=>{KS(e,t[0]?.id),JS(e,t[0]?.title),YS(e,t[0]?.agent)},ZS=e=>{He(e.a),It(e.a,14),kt(e.a)},QS=e=>{Fe(e.a),re(e.a,14),Rt(e.a)},$S=j(26,e=>{T(e.b,`disabled`,e._._.o),T(e.c,`disabled`,e._._.o)},e=>e._._),eC=_(`k2`,e=>{u(e.b,`click`,function(){let t=e.c;typeof t.showPicker==`function`?t.showPicker():t.focus()}),C(e,`c`)}),tC=e=>{$S(e),rC(e),iC(e),b(e.a,`_iR`),b(e.b,[`_iM`,`_iN`,`_iS`]),b(e.c,`_iT`),eC(e)},nC=a(2,`<option> </option>`,` D `,0,XS),rC=j(27,e=>nC(e,[e._._.q,`id`]),e=>e._._),iC=j(29,e=>A(e,`c`,e._._.v,KC(e)),e=>e._._),aC=j(26,e=>c(e.a,e._._.o?`Sending…`:`Send`),e=>e._._),oC=aC,sC=h(4,e=>c(e.b,e._._.o?`Sending…`:`Send to ${e._._.w||e._._.x}`),2),cC=j(26,e=>{c(e.d,e._._.o?`Sending…`:`Send`),sC(e)},e=>e._._),lC=e=>{cC(e),uC(e),dC(e),b(e.a,[`_iQ`,`_iP`]),b(e.c,`_iO`)},uC=j(30,sC,e=>e._._),dC=j(31,sC,e=>e._._),fC=f(6,0,e=>T(e.a,`disabled`,e._.o)),pC=_(`k3`,e=>u(e.a,`click`,function(){e._.z()})),mC=e=>{fC._(e),_C._(e),yC._(e),bC._(e),b(e.a,[`_iM`,`_iN`]),pC(e)},hC=d(0,`<span> </span><span> </span>`,` D l D `,lC,` `,` `,oC),gC=d(1,`<span><button type=button aria-label="Choose session to send to"></button><select aria-label="Send comments to session" tabindex=-1></select></span>`,` D b `,tC),_C=f(6,0,e=>{hC(e,e._.s>1?0:1),gC(e,e._.s>1?0:1)}),vC=h(2,e=>T(e.a,`title`,`Send comments to ${e._.w||e._.x}`)),yC=f(6,0,vC),bC=f(6,0,vC),xC=d(5,me,(e=>`/${e}&`)(Pe),QS,Pt,(e=>`/${e}&`)(ke),ZS),SC=m(13,e=>{T(e.f,`title`,e.n?`Copied`:`Copy comments as markdown`),xC(e,+!e.n)}),CC=M(25),wC=h(20,e=>CC(e,qC(e)),2),TC=y(cC,aC,$S),EC=m(14,e=>{wC(e),fC(e),TC(e)}),DC=d(6,`<button type=button></button><!><!>`,` b%`,mC),OC=M(19,e=>{LC(e,e.t?.id),zC(e,e.t?.title),VC(e,e.t?.agent),DC(e,+!e.t),wC(e)}),kC=h(17,e=>OC(e,e.q.find(t=>t.id===e.p)??e.q[0]??null)),AC=m(15,kC),jC=_(`k4`,e=>u(e.f,`click`,function(){(async()=>{await e.m()&&(SC(e,!0),setTimeout(()=>{SC(e,!1)},1500))})()}));function MC(e){b(e.a,`_iI`),b(e.b,`_iJ`),VS(e.c),HS(e.c,18),US(e.c,`_iK`),b(e.d,`_iL`),b(e.f,`_iM`),SC(e,!1),EC(e,!1),AC(e,null),jC(e)}var NC=y(rC),PC=M(16,e=>{FC(e,e.q.length),kC(e),NC(e)}),FC=M(18,_C),IC=(e,t)=>PC(e,t||[]),LC=M(21,y(iC)),RC=y(uC),zC=M(22,e=>{yC(e),RC(e)}),BC=y(dC),VC=M(23,e=>{bC(e),BC(e)}),HC=(e,t)=>{T(e.a,`aria-label`,t),T(e.b,`title`,t)},UC=(e,t)=>{c(e.e,t>99?`99+`:t),HC(e,`${t} comment${t===1?``:`s`}`)},WC=M(11,wC),GC=M(12),KC=e=>function(t){AC(e._._,t)},qC=e=>()=>{(async()=>{if(!(!e.t||e.o)){EC(e,!0);try{await e.l(e.t?.id)}finally{EC(e,!1)}}})()};N(`k0`,KC),N(`k1`,qC);var JC=st,YC=(e=>`/${e}&`)(ne);function XC(e){ce(e.a,`M2 11V4.6C2 4.26863 2.26863 4 2.6 4H8.77805C8.92127 4 9.05977 4.05124 9.16852 4.14445L12.3315 6.85555C12.4402 6.94876 12.5787 7 12.722 7H21.4C21.7314 7 22 7.26863 22 7.6V11M2 11V19.4C2 19.7314 2.26863 20 2.6 20H21.4C21.7314 20 22 19.7314 22 19.4V11M2 11H22`)}var ZC=(e,t)=>Te(e.a,t),QC=(e,t)=>ue(e.a,t),$C=40,ew;function tw(e){return e.length>=200?null:[...new Set(e.map(e=>e.key))]}function nw(e,t){let n=t.trim();if(!n)return[];if(ew&&ew.files===e&&ew.query===n)return ew.hits;let r=aw(e,n);return ew={files:e,query:n,hits:r},r}var rw=new WeakMap;function iw(e){let t=rw.get(e);if(!t){let n={additions:new Set,deletions:new Set};if(e.fileDiff){let n=vx(e.fileDiff,`additions`),r=vx(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};rw.set(e,t)}return t}function aw(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)){ow(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}=iw(t),l=new Set;sw(t,s,`additions`,r,n,l,a,o.additions),sw(t,c,`deletions`,r,n,l,a,o.deletions),a.length===e&&ow(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 ow(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 sw(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>=$C)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:cw(d,f,r.length)}))}}function cw(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 lw=((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>`)(ht,xe,rt,Nt),uw=((e,t,n,r)=>` D D/${e}&l b D l D/${t}&l D/${n}&l D/${r}&m`)(ge,Se,Ve,Ne),dw=_(`j8`,e=>e.ah=!!e.a1),fw=h(44,dw),pw=_(`j7`,e=>l(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(){if(e.z!==e.an&&(e.an=e.z,e.a1&&e.aw()),e.a1&&!e.ao)e.ao=!0,e.y||e.aw();else if(!e.a1&&e.ao){e.ao=!1;let t=e.d;t&&document.activeElement===t&&t.blur(),e.al&&=(clearTimeout(e.al),0),xS(``,null),jw(e,{query:``,hit:null,keys:[]})}},onDestroy:function(){e.al&&clearTimeout(e.al),this.abort.abort(),xS(``,null),jw(e,{query:``,hit:null,keys:[]})}})),mw=h(59,pw,11),hw=h(29,e=>b(e.a,[`_ct`,e.a0&&`_cC`,!e.a1&&`_cs`])),gw=h(41,e=>c(e.f,e.a1&&(e.a4||``).trim()?e.ab?`${e.ae+1}/${e.ab}`:`0/0`:``),3),_w=h(38,e=>{T(e.g,`disabled`,!e.ab||!e.a1),T(e.i,`disabled`,!e.ab||!e.a1)}),vw=o(27,e=>{T(e.a,`aria-hidden`,e.a1?`false`:`true`),T(e.d,`tabindex`,e.a1?0:-1),T(e.g,`tabindex`,e.a1?0:-1),T(e.i,`tabindex`,e.a1?0:-1),T(e.k,`tabindex`,e.a1?0:-1),fw(e),mw(e),hw(e),gw(e),_w(e)}),yw=h(16,e=>vw(e,e.o,e.p)),bw=M(14,yw),xw=M(15,yw),Sw=(e,t)=>qw(e,t?.length),Cw=h(32,e=>Sw(e,nw(e.x,e.a4||``))),ww=M(56,mw),Tw=h(53,e=>ww(e,iT(e)),4),Ew=h(55,e=>S(e,`d`,e.a4||``,aT(e))),Dw=o(30,e=>{Cw(e),Tw(e),mw(e),Ew(e),gw(e)}),Ow=h(19,e=>Dw(e,e.r,e.s)),kw=M(17,Ow),Aw=M(18,Ow),jw=o(33),Mw=h(22,e=>jw(e,e.u,e.v)),Nw=M(20,Mw),Pw=M(21,Mw),Fw=M(40,e=>{Tw(e),gw(e)}),Iw=h(39,e=>Fw(e,e.ab?Math.min(e.a9,e.ab-1):-1)),Lw=M(54,e=>{mw(e),Ew(e)}),Rw=h(52,e=>Lw(e,oT(e)),3),zw=M(51,e=>{Rw(e),Tw(e)}),Bw=h(45,e=>zw(e,sT(e)),2),Vw=m(35,e=>{Iw(e),Bw(e)}),Hw=(e,t)=>Zw(e,t.open),Uw=(e,t)=>{Qw(e,t.timer),$w(e,t.tick),eT(e,t.wasOpen)},Ww=M(58,e=>{i(e,e.aw),mw(e)}),Gw=_(`j6`,e=>{E(e,`d`),u(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))}}),u(e.g,`mousedown`,function(e){e.preventDefault()}),u(e.g,`click`,function(){e.au(-1)}),u(e.i,`mousedown`,function(e){e.preventDefault()}),u(e.i,`click`,function(){e.au(1)}),u(e.k,`mousedown`,function(e){e.preventDefault()}),u(e.k,`click`,function(){e.av()})});function Kw(e){b(e.b,`_cu`),ve(e.c),fe(e.c,13),Ie(e.c),b(e.e,`_cx`),at(e.h),te(e.h,14),ot(e.h),_t(e.j),lt(e.j,14),Ct(e.j),oe(e.l),je(e.l,14),Ft(e.l),Vw(e,0),Hw(e,{open:!1}),Uw(e,{timer:0,tick:0,wasOpen:!1}),Ww(e,cT(e)),Gw(e)}var qw=M(37,e=>{Iw(e),gw(e),_w(e)}),Jw=M(23,e=>{Cw(e),Bw(e),Rw(e)}),Yw=M(57,mw),Xw=h(48,e=>Yw(e,lT(e))),Zw=M(43,e=>{Bw(e),Rw(e),Tw(e),Xw(e),fw(e),mw(e)}),Qw=M(47,e=>{Rw(e),Tw(e),Xw(e),mw(e)}),$w=M(49,mw),eT=M(50,mw),tT=M(24,e=>{T(e.k,`hidden`,e.y),mw(e)}),nT=M(25,mw),rT=M(26,e=>{b(e.d,[bt,e.a0&&`_cE`]),b(e.g,[ft,e.a0&&`_cF`]),b(e.i,[ft,e.a0&&`_cF`]),b(e.k,[ft,e.a0&&`_cF`]),hw(e)}),iT=e=>t=>{e.ah&&(e.al&&=(clearTimeout(e.al),0),e.ap(e.a4||``,(e.ae<0?0:e.ae)+t))},aT=e=>function(t){e.as(t)},oT=e=>t=>{if(!e.ah)return;Dw(e,t),Vw(e,0);let n=nw(e.x,t);xS(t,n[0]??null,tw(n)??void 0),e.al&&clearTimeout(e.al),e.al=setTimeout(()=>{e.al=0,e.ap(t,0)},80)},sT=e=>(t,n)=>{if(!e.ah)return;let r=nw(e.x,t),i=[...new Set(r.map(e=>e.key))];if(!r.length){Vw(e,0),xS(t,null,i),jw(e,{query:t,hit:null,keys:i});return}Vw(e,(n%r.length+r.length)%r.length);let a=r[e.a9];xS(t,a,tw(r)??void 0),jw(e,{query:t,hit:a,keys:i})},cT=e=>()=>{let t=e.d;t&&(t.focus(),t.select(),document.activeElement!==t&&setTimeout(()=>{t.focus(),t.select()},0))},lT=e=>()=>{e.d?.blur(),vw(e,!1),e.ah=!1,e.al&&=(clearTimeout(e.al),0),xS(``,null),jw(e,{query:``,hit:null,keys:[]})};N(`j4`,iT),N(`j1`,aT),N(`j3`,oT),N(`j2`,sT),N(`j0`,cT),N(`j5`,lT);var uT=`_jG _y`,dT=`_jR _x`,fT=`<div><!><!><!><!><!><!><span><span><!> file<!></span><!><!><!></span></div>`,pT=` D%b%b%b%b%b%b E%c%l%b%b%m`,mT=j(82,e=>c(e.b,e._._.ar),e=>e._._),hT=e=>{mT(e),b(e.a,[`_N`,pe.accent,`_jX`])},gT=h(2,e=>T(e.a,`title`,`${e._.a6?`#${e._.a6.number}`:e._.aa} is already in ${e._.a8}; showing the working tree only`),2),_T=f(5,0,gT),vT=e=>{_T._(e),yT._(e),bT._(e),b(e.a,[`_N`,`_jY`])},yT=f(5,0,e=>{c(e.b,e._.a8),gT(e)}),bT=f(5,0,gT),xT=f(3,0,e=>c(e.b,aS(e._.ak,7))),ST=e=>{xT._(e),b(e.a,[`_N`,`_jY`])},CT=h(7,e=>T(e.a,`title`,`${e._.as} · ${e._.ah.slice(0,7)}…${e._.ai.slice(0,7)}`),2),wT=f(2,0,CT),TT=e=>{wT._(e),ET._(e),OT._(e),kT._(e),AT._(e),jT._(e),b(e.a,`_jT`),b(e.b,[`_N`,`_jU`]),b(e.d,[`_P`,`_jW`]),b(e.e,[`_N`,`_jV`])},ET=f(2,0,CT),DT=d(6,`<span> </span>`,` D `,hT),OT=f(2,0,e=>DT(e,+!e._.ar)),kT=f(2,0,CT),AT=f(2,0,e=>c(e.c,e._.at)),jT=f(2,0,e=>c(e.f,e._.au)),MT=f(1,1,e=>c(e.b,Ce(e._.aj))),NT=e=>{MT._(e),b(e.a,[dT,`_jS`])},PT=h(4,e=>T(e.a,`title`,`${e._.ag}: ${e._.a9} ${e._.ah} vs ${e._.a8} ${e._.ai}`),4),FT=f(1,0,PT),IT=e=>{FT._(e),LT._(e),RT._(e),zT._(e),BT._(e),VT._(e),HT._(e),b(e.a,[`_u`,`_v`]),b(e.c,dT)},LT=f(1,0,PT),RT=f(1,0,e=>c(e.b,e._.ae)),zT=f(1,0,e=>T(e.a,`href`,`${e._.af}/files`)),BT=f(1,0,e=>{c(e.d,e._.ag),PT(e)}),VT=f(1,0,PT),HT=f(1,0,PT),UT=f(12,0,e=>c(e.b,e._.a1)),WT=_(`x2`,e=>u(e.a,`click`,function(){e._.a4()})),GT=e=>{UT._(e),KT._(e),WT(e)},KT=f(12,0,e=>{b(e.a,[`_jQ`,{_jP:e._.a2}]),T(e.a,`aria-pressed`,e._.a2?`true`:`false`),T(e.a,`title`,e._.a2?`Show every file`:`Show only files changed since your last visit`)}),qT=f(11,0,e=>c(e.b,e._.z)),JT=_(`x1`,e=>u(e.a,`click`,function(){e._.a0()})),YT=e=>{qT._(e),b(e.a,`_jQ`),JT(e)},XT=f(10,0,e=>c(e.b,e._.w)),ZT=e=>{XT._(e),QT._(e),b(e.a,`_jN`),b(e.c,`_jO`)},QT=f(10,0,e=>c(e.d,e._.x)),$T=h(3,e=>c(e.b,pS(e._.aa,e._.q,e._.r)),2),eE=f(6,0,$T),tE=e=>{eE._(e),nE._(e),iE._(e),aE._(e),oE._(e),sE._(e),b(e.a,[`_N`,`_jY`])},nE=f(6,0,$T),rE=h(4,e=>T(e.a,`title`,`This view is ${aS(e._.ah)} (${e._.a9}); checked out is ${aS(e._.ap)} (${e._.aa})`),3),iE=f(6,0,rE),aE=f(6,0,e=>{rE(e),$T(e)}),oE=f(6,0,rE),sE=f(6,0,e=>{c(e.c,aS(e._.ap,7)),rE(e)}),cE=f(4,0,e=>T(e.a,`disabled`,e._.s)),lE=_(`x0`,e=>u(e.a,`click`,function(){e._.t()})),uE=e=>{cE._(e),fE._(e),pE._(e),mE._(e),b(e.a,[`_N`,pe.warn,`_jY`]),lE(e)},dE=h(3,e=>T(e.a,`title`,`origin/${e._.a9} ${e._.ah} · GitHub ${e._.am}. Reload to re-ask GitHub`),2),fE=f(4,0,dE),pE=f(4,0,e=>{c(e.b,aS(e._.ah,7)),dE(e)}),mE=f(4,0,e=>{c(e.c,aS(e._.am,7)),dE(e)}),hE=(e,t)=>{_E(e,t?.pr),EE(e,t?.base),DE(e,t?.branch),jE(e,t?.default_branch),ME(e,t?.worktree),NE(e,t?.head),PE(e,t?.baseSha),FE(e,t?.full_name),LE(e,t?.rev),zE(e,t?.githubDrift),HE(e,t?.contained),UE(e,t?.localHead)},gE=d(1,`<a target=_blank rel=noopener>#<!></a><span> </span>`,` Db%l D `,IT,`<span> </span>`,` D `,NT),_E=M(32,e=>{bE(e,e.a6?.baseRefName),xE(e,e.a6?.headRefName),SE(e,e.a6?.number),CE(e,e.a6?.url),wE(e,e.a6?.title),TE(e,e.a6?.headRefOid),gE(e,+!e.a6),_T(e)}),vE=(e,t)=>{ZE(e,t?.topic),QE(e,t?.title),$E(e,t?.base),eD(e,t?.head)},yE=h(37,e=>vE(e,fS(e.a7||e.a8,e.a9||e.aa,e.q,e.r)),5),bE=M(33,yE),xE=M(35,e=>{yE(e),fE(e),iE(e),LT(e)}),SE=M(40,RT),CE=M(41,zT),wE=M(42,BT),TE=M(48,mE),EE=M(34,e=>{yE(e),FT(e),yT(e)}),DE=M(36,e=>{yE(e),aE(e),bT(e)}),OE=d(2,`<span><span> </span><span aria-hidden=true>vs</span><span> </span><!></span>`,` D D l b D l%`,TT),kE=(e,t)=>OE(e,+!t),AE=h(59,e=>kE(e,!!e.ar||!!e.q&&e.aw!==e.q||!!e.ac&&e.av!==e.ac),4),jE=M(38,AE),ME=M(39),NE=M(43,e=>{pE(e),oE(e),VT(e),wT(e)}),PE=M(44,e=>{HT(e),ET(e)}),FE=M(45,MT),IE=d(3,`<span title="One commit against its parent">commit <!></span>`,` Db%`,ST),LE=M(46,e=>{IE(e,+!e.ak),xT(e)}),RE=d(4,`<button type=button>behind GitHub <!> → <!></button>`,` Db%c%`,uE),zE=(e,t)=>RE(e,+!t),BE=d(5,`<span>already in <!></span>`,` Db%`,vT),VE=h(50,e=>BE(e,e.an&&e.u?0:1)),HE=M(49,VE),UE=M(51,sE),WE=M(57,AE),GE=e=>{WE(e,(e.a7||e.a8).replace(/^origin\//,``))},KE=M(58,AE),qE=e=>{KE(e,(e.a9||e.aa).replace(/^origin\//,``))},JE=e=>{T(e.a,`data-pr`,e.a6?`${e.ad}/${e.a6.number}`:void 0)},YE=M(15,e=>{hE(e,e.p),GE(e),qE(e),JE(e)}),XE=y(mT),ZE=M(53,e=>{AE(e),OT(e),XE(e)}),QE=M(54,kT),$E=M(55,AT),eD=M(56,jT),tD=M(16,e=>{yE(e),AE(e),eE(e)}),nD=M(17,e=>{yE(e),nE(e)});function rD(e){b(e.a,`_jL`),b(e.h,`_jM`)}var iD=M(20,e=>{c(e.i,e.u),c(e.j,e.u===1?``:`s`),VE(e)}),aD=d(6,`<span>local <!><!></span>`,` Db%b%`,tE),oD=(e,t)=>aD(e,+!t),sD=d(10,`<span>+<!></span><span>−<!></span>`,` Db%l Db%`,ZT),cD=h(24,e=>sD(e,e.w||e.x?0:1)),lD=M(22,e=>{cD(e),XT(e)}),uD=M(23,e=>{cD(e),QT(e)}),dD=d(11,`<button type=button title="Filtered out of the list — show every file"><!> hidden</button>`,` D%`,YT),fD=M(25,e=>{dD(e,+!e.z),qT(e)}),pD=d(12,`<button type=button><!> new</button>`,` D%`,GT),mD=h(29,e=>pD(e,e.a1||e.a2?0:1)),hD=M(27,e=>{mD(e),UT(e)}),gD=M(28,e=>{mD(e),KT(e)}),_D=M(18,cE),vD=M(19),yD=M(26),bD=M(30),xD=`<!><!><!>`,SD=f(1,0,e=>c(e.b,e._.e)),CD=e=>{SD._(e),b(e.a,[uT,`_jC`])},wD=f(6,0,e=>c(e.b,e._.r)),TD=e=>{wD._(e),b(e.a,[`_u`,`_v`,`_jH`])},ED=j(34,e=>gD(e.c,e._._.k),e=>e._._),DD=e=>{ED(e),OD(e),kD(e),AD(e),jD(e),ND(e),PD(e),FD(e),LD(e),zD(e),BD(e),VD(e),HD(e),UD(e),GD(e),b(e.a,`_jI`),rD(e.c)},OD=j(35,e=>bD(e.c,e._._.l),e=>e._._),kD=j(36,e=>yD(e.c,e._._.m),e=>e._._),AD=j(37,e=>tD(e.c,e._._.n),e=>e._._),jD=j(38,e=>nD(e.c,e._._.o),e=>e._._),MD=h(9,e=>oD(e.c,e._._.p.has(e.i))),ND=j(39,MD,e=>e._._),PD=j(40,e=>vD(e.c,e._._.q),e=>e._._),FD=j(41,e=>_D(e.c,e._._.r),e=>e._._),ID=(e,t)=>{YE(e.c,t),KD(e,t?.worktree),qD(e,t?.files?.length),JD(e,t?.id)},LD=j(43,e=>ID(e,e._._.t),e=>e._._),RD=h(7,e=>iD(e.c,e._._.v||e.g)),zD=j(45,RD,e=>e._._),BD=j(46,e=>lD(e.c,e._._.w),e=>e._._),VD=j(47,e=>uD(e.c,e._._.x),e=>e._._),HD=j(48,e=>hD(e.c,e._._.y),e=>e._._),UD=j(49,e=>fD(e.c,e._._.z),e=>e._._),WD=d(1,`<span> </span>`,` D `,CD),GD=j(50,e=>WD(e,+!!e._._.a0),e=>e._._),KD=M(4,SD),qD=M(6,RD),JD=M(8,MD),YD=h(20,e=>b(e.a,[`_jB`,{_jz:e.s,_jA:e.t}])),XD=M(19,e=>{T(e.b,`title`,e.t?`Show this section's files`:`Hide this section's files`),T(e.b,`aria-expanded`,e.t?`false`:`true`),YD(e)}),ZD=h(12,e=>XD(e,e._._._.h.has(e.l))),QD=j(33,ZD,e=>e._._._),$D=e=>{QD(e),nO(e),b(e.b,`_jE`),b(e.c,`_jF`),b(e.d,`_jD`),b(e.e,uT)},eO=M(18,e=>{T(e.a,`aria-selected`,e.s?`true`:`false`),YD(e)}),tO=h(13,e=>eO(e,e._._._.u===e.l)),nO=j(44,tO,e=>e._._._),rO=(e,t)=>{aO(e,t?.id),cO(e,t?.pr),uO(e,t?.worktree)},iO=_(`y1`,e=>{u(e.b,`click`,function(){e._._._.i(e.l)}),u(e.d,`click`,function(){e._._._.j(e.l)})}),aO=M(11,e=>{tO(e),ZD(e),iO(e)}),oO=d(6,`<span>#<!></span>`,` Db%`,TD),sO=h(16,e=>T(e.a,`data-pr`,e.o?`${e.p}/${e.o.number}`:void 0)),cO=M(14,e=>{lO(e,e.o?.number),oO(e,+!e.o),sO(e)}),lO=M(17,wD),uO=M(15,e=>{c(e.f,e.p),sO(e)}),dO=rO,fO=a(0,`<div role=tab><button type=button><span>▾</span></button><button type=button title="Scroll to this section"><span> </span><!></button></div>`,` D D l D D l%`,$D,(e,t)=>dO(e,t[0]?.repo)),pO=j(31,e=>fO(e,[e._._.d,e=>e.repo.id]),e=>e._._),mO=_(`y3`,e=>u(e.a,`scroll`,function(){e._._.a4(e.a)})),hO=e=>{pO(e),vO(e),bO(e),xO(e),SO(e),mO(e)},gO=_(`y2`,e=>l(e,{count:e._._.g,onMount:function(){e._._.a4(e.a);let t=new ResizeObserver(()=>e._._.a4(e.a));return t.observe(e.a),{ro:t}},onUpdate:function(){e._._.a4(e.a)},onDestroy:function(){this.ro.disconnect()}})),_O=h(1,gO),vO=j(32,_O,e=>e._._),yO=h(2,e=>b(e.a,[`_jy`,{_jx:e._._.a2,_jw:e._._.a3}])),bO=j(51,yO,e=>e._._),xO=j(52,yO,e=>e._._),SO=j(53,_O,e=>e._._),CO=d(2,(e=>`<div><!>${e}</div>`)(fT),(e=>` D%b/${e}&l`)(pT),DD),wO=f(0,0,e=>CO(e,+!e._.s)),TO=e=>{wO._(e),DO._(e)},EO=d(1,`<div role=tablist></div>`,` `,hO),DO=f(0,0,e=>{b(e.a,[`_jv`,{_ju:e._.a0}]),EO(e,+!e._.a0)}),OO=M(18,e=>{AO(e,e.s?.repo),MO(e,e.s?.files),NO(e,e.s?.additions),PO(e,e.s?.deletions),FO(e,e.s?.fresh),IO(e,e.s?.hidden),wO(e)}),kO=y(LD),AO=M(19,e=>{jO(e,e.t?.id),kO(e)}),jO=M(20,y(nO)),MO=M(21,y(zD)),NO=M(22,y(BD)),PO=M(23,y(VD)),FO=M(24,y(HD)),IO=M(25,y(UD)),LO=h(5,e=>OO(e,e.d.find(t=>t.repo.id===e.e)||e.d[0])),RO=y(pO),zO=M(3,e=>{GO(e,e.d?.length),LO(e),RO(e)}),BO=M(4,LO),VO=y(GD),HO=M(26,e=>{DO(e),VO(e)}),UO=d(0,`<div><!><!></div>`,` D%b%`,TO),WO=y(vO),GO=M(6,e=>{HO(e,e.g>1),UO(e,+!e.g),WO(e)}),KO=M(30,y(SO)),qO=e=>{KO(e,lk(e))},JO=m(27,e=>{YO(e,e.a1?.end),XO(e,e.a1?.start),qO(e)}),YO=M(28,y(bO)),XO=M(29,y(xO));function ZO(e){JO(e,{start:!1,end:!1})}var QO=M(7,y(QD)),$O=M(8),ek=M(9),tk=M(10,y(ED)),nk=M(11,y(OD)),rk=M(12,y(kD)),ik=M(13,y(AD)),ak=M(14,y(jD)),ok=M(15,y(ND)),sk=M(16,y(PD)),ck=M(17,y(FD)),lk=e=>t=>{let n=t.scrollWidth-t.clientWidth-t.scrollLeft>1,r=t.scrollLeft>1;(n!==e.a2||r!==e.a3)&&JO(e,{start:r,end:n})};N(`y0`,lk);var uk=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1533
1533
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
1534
1534
  <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"/>
1535
1535
  </symbol>
@@ -2794,9 +2794,9 @@ diff --git`)}function m_(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
2794
2794
  }`}function CP(e){return`${xP}
2795
2795
  @layer unsafe {
2796
2796
  ${e}
2797
- }`}var wP=new WeakMap;function TP(e){let t=wP.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(EA,`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(),wP.set(e,i),i}function EP(e,t){if(!e.isConnected)return;let n=TP(t);if(n==null)return;let r=t.querySelector(`style[${DA}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(DA,``),t.appendChild(i)),i.textContent=`:host { ${OA}: ${n}px; }`}var DP;function OP(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){DP??(DP=new CSSStyleSheet,DP.replaceSync(SP(bP)));let t=!1;try{e.adoptedStyleSheets=[DP],t=!0}catch{}if(t){e.querySelector(`style[${wA}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(wA,``),t.textContent=SP(bP),e.prepend(t)}}function kP(e,t){AP(e,t),OP(t),EP(e,t)}function AP(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`});kP(this,e)}}if(customElements.define(CA,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(CA)))e instanceof HTMLElement&&kP(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var jP=e=>e.startsWith(`f::`)?e.slice(3):e;function MP(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function NP(e,t){return e===``?t:`${e}/${t}`}function PP({files:e,path:t,isFolder:n,nextBasename:r}){let i=jP(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}=MP(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=NP(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 FP(e){return e.endsWith(`/`)}function IP(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 LP(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 RP(e,t){return t.includes(e)?LP(t):[e]}function zP(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 BP(e,t){return{draggedPaths:e,target:t}}function VP(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(FP(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function HP(e,t){return t.kind===`root`||t.directoryPath==null?IP(e):t.directoryPath}function UP(e,t){let n=e.map(e=>{let n=HP(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 WP(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 GP(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(!WP(hP.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 KP(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function qP(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 JP(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function YP(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 JP(e,t.path)?n?e:null:e;case`move`:return qP(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=YP(r,e,n),r==null)return null;return r}}}function XP(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function ZP(e){switch(e.operation){case`add`:return{...XP(e),operation:`add`,path:e.path};case`remove`:return{...XP(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...XP(e),from:e.from,operation:`move`,to:e.to}}}function QP(e){return{...XP(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>ZP(e)),operation:`batch`}}function $P(e){switch(e.operation){case`add`:case`remove`:case`move`:return ZP(e);case`batch`:return QP(e);default:return null}}function eF(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function tF(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 nF(e){return tF(e).at(-1)??null}function rF(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function iF(e){return e.endsWith(`/`)}var aF=e=>e.toLowerCase();function oF(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function sF(e){return e.endsWith(`/`)?e.slice(0,-1):e}function cF(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var lF=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},uF=Symbol(`FILE_TREE_RENAME_VIEW`),dF=512,fF=512;function pF(e){return e===`top`||e===`center`?e:`nearest`}function mF(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=tF(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 hF(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:mF(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var gF=class e{static{Object.defineProperty(e.prototype,uF,{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=GP({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=nF(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:pF(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<=fF){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=RP(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=BP(t.draggedPaths,n);(VP(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}zP(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=BP(e.draggedPaths,t);if(VP(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=UP(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=iF(r),a=sF(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of tF(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=oF(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,iF(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,iF(e)?{recursive:!0}:void 0);return}let t=iF(e),n=PP({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:sF(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(cF(n.sourcePath,t),cF(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=GP({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=!eF(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=nF(e),n=rF(e,t),r=null,i=null;for(let e of this.#be()){if(nF(e)!==t)continue;let a=rF(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=tF(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=!eF(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 hP({...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 tF(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(aF),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(aF),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 tF(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:lF(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 tF(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 tF(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=hF(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,dF)),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=YP(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=YP(this.#c,e,!0),r=[...this.#B].map(t=>YP(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=YP(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return eF(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&&KP(e)&&(this.#i=null);let t=KP(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=$P(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},_F=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 vF(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 yF(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 bF(e,t){return t?`${e}/`:e}function xF(e,t=null){let n=_F(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=CF(t);e!=null&&EF({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 SF(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=wF(e);t!=null&&(c=TF({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=CF(e);t!=null&&(c=EF({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:kF(i),statusByPath:i}:e}function CF(e){return wF(e.path)}function wF(e){let t=vF(e);if(t!=null)return{canonicalPath:bF(t.path,t.isDirectory),isDirectory:t.isDirectory}}function TF({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),OF(t,n,e),!0)}function EF({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??DF(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function DF(e,t,n){for(let r of yF(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function OF(e,t,n){for(let r of yF(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function kF(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var X,AF,jF,MF,NF,PF,FF,IF,LF,RF,zF={},BF=[],VF=Array.isArray,HF=BF.slice,UF=Object.assign;function WF(e){e&&e.parentNode&&e.remove()}function GF(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?HF.call(arguments,2):n),KF(e,o,r,i,null)}function KF(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??++AF,__i:-1,__u:0};return i==null&&X.vnode!=null&&X.vnode(a),a}function qF(e){return e.children}function JF(e,t){this.props=e,this.context=t,this.__g=0}function YF(e,t){if(t==null)return e.__?YF(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`?YF(e):null}function XF(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 XF(e)}}function ZF(e){(8&e.__g||!(e.__g|=8)||!jF.push(e)||NF++)&&MF==X.debounceRendering||((MF=X.debounceRendering)||queueMicrotask)(QF)}function QF(){for(var e,t,n,r,i,a,o,s,c=1;jF.length;)jF.length>c&&jF.sort(PF),e=jF.shift(),c=jF.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=UF({},r)).__v=r.__v+1,X.vnode&&X.vnode(n),oI(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??YF(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,cI(a,n,o),n.__e!=i&&XF(n)));NF=0}function $F(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||BF,b=t.length;for(c=eI(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?zF:y[m.__i]||zF,m.__i=f,_=oI(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&dI(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=tI(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function eI(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?KF(null,o,null,null,null):VF(o)?KF(qF,{children:o},null,null,null):o.constructor==null&&o.__b>0?KF(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=nI(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=YF(s)),fI(s,s));return r}function tI(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=tI(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=YF(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function nI(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 rI(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function iI(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||rI(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||rI(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(FF,`$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=IF,e.addEventListener(t,a?RF:LF,a)):e.removeEventListener(t,a?RF:LF,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 aI(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=IF++;else if(t.u<n.l)return;return n(X.event?X.event(t):t)}}}function oI(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 JF(v,x),f.constructor=M,f.render=pI),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=UF({},f.__s)),UF(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=UF({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===qF&&d.key==null&&(E=lI(d.props.children)),s=$F(e,VF(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--;)WF(a[j]);sI(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||sI(t);X.__e(e,t,n)}else s=t.__e=uI(n.__e,t,n,r,i,a,o,c,l,u);return(d=X.diffed)&&d(t),128&t.__u?void 0:s}function sI(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(sI)}function cI(e,t,n){for(var r=0;r<n.length;r++)dI(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 lI(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:VF(e)?e.map(lI):UF({},e)}function uI(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&&=HF.call(e.childNodes),v=n.props||zF,!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;iI(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&&!_||iI(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=``),$F(b==`template`?e.content:e,VF(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&YF(n,0),s,c,l),a!=null)for(u=a.length;u--;)WF(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||iI(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&iI(e,u,g,v[u],i))}return e}function dI(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 fI(e,t,n){var r,i;if(X.unmount&&X.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||dI(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]&&fI(r[i],t,n||typeof e.type!=`function`);n||WF(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function pI(e,t,n){return this.constructor(e,n)}function mI(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=GF(qF,null,[e]),i=[],a=[],oI(t,e,r||zF,zF,t.namespaceURI,r?null:t.firstChild?HF.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),cI(i,e,a)}function hI(e,t){e.__u|=32,mI(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 NF=0,e}},AF=0,JF.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=UF({},this.state);typeof e==`function`&&(e=e(UF({},n),this.props)),e&&UF(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ZF(this))},JF.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),ZF(this))},JF.prototype.render=qF,jF=[],NF=0,PF=function(e,t){return e.__v.__b-t.__v.__b},FF=/(PointerCapture)$|Capture$/i,IF=0,LF=aI(!1),RF=aI(!0);var gI=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:--gI,__i:-1,__u:0,__source:i,__self:a};return X.vnode&&X.vnode(l),l}var _I=16,vI=16,yI={};function bI({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}=yI[e]??{width:_I,height:vI},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 xI=e=>e!==void 0&&/\s/.test(e),SI=(e,t)=>{let n=t=>xI(e[t-1])||xI(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},CI=e=>SI(e,Math.ceil(e.length/2)),wI=e=>{if(e.length<2)return[e,``];let t=CI(e);return[e.slice(0,t),e.slice(t)]},TI=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:CI(e);return[e.slice(0,r),e.slice(r)]},EI=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)]},DI=(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)]},OI=(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)]},kI=(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 AI({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 jI(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 MI({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Z(jI,{mode:t,children:e},`content`),o=Z(AI,{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 NI({children:e,...t}){"use no memo";return Z(MI,{mode:`truncate`,...t,children:e})}function PI({children:e,...t}){"use no memo";return Z(MI,{mode:`fruncate`,...t,children:e})}function FI({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(NI,{...s,children:t[0]}),l=Z(PI,{...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`?PI:NI,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=wI:r===`extension`?t=TI:r===`leaf-path`&&(t=EI);else if(typeof r==`number`)t=DI,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=OI:e===`first`&&(t=kI)}else typeof r==`function`&&(t=r);t??=wI;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(NI,{...s,..._,children:f}),l=Z(PI,{...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 II={endIndex:-1,startIndex:-1};function LI(e,t,n){return Math.min(Math.max(e,t),n)}function RI(e,t){return e<0||t<e?II:{endIndex:t,startIndex:e}}function zI(e){return e.startIndex<0||e.endIndex<e.startIndex}function BI(e,t){return zI(e)?0:(e.endIndex-e.startIndex+1)*t}function VI(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function HI(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function UI(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 WI(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 GI(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 KI(e,t,n){if(e.length===0||t<=0)return[];let r=GI(e),i=UI(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=WI(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 qI(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=LI(t.scrollTop,0,o),c=t.stickyRows??KI(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=VI(s,n,t.itemHeight),m=VI(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?II:RI(m,HI(u+d,n,t.itemHeight)),y=g+1,b=zI(v)?II:RI(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=BI(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:zI(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var JI={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},YI={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},XI=`Contains git status items`;function ZI(e){return e.current?!0:(e.current=!0,!1)}function QI(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 $I(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return QI({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 eL(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 tL(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 nL(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 rL(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function iL(e,t){return e!=null&&e>0?e:t}function aL(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 oL(e,t,n,r,i=0){let a=QI({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function sL(e,t,n,r,i,a,o=0){let s=$I({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function cL(e,t,n,r,i,a){let o=eL({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function lL(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function uL(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function dL({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 fL(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 pL(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 mL,hL,gL,_L,vL=Object.is,yL=0,bL=[],xL=X,SL=xL.__b,CL=xL.__r,wL=xL.diffed,TL=xL.__c,EL=xL.unmount,DL=xL.__;function OL(e,t){xL.__h&&xL.__h(hL,e,yL||t),yL=0;var n=hL.__H||(hL.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function kL(e){return yL=1,AL(VL,e)}function AL(e,t,n){var r=OL(mL++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):VL(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);vL(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=hL,!hL.__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,vL(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};hL.__f=!0;var a=hL.shouldComponentUpdate,o=hL.componentWillUpdate;hL.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)},hL.shouldComponentUpdate=i}return r.__N||r.__}function jL(e,t){var n=OL(mL++,3);!xL.__s&&BL(n.__H,t)&&(n.__=e,n.u=t,hL.__H.__h.push(n))}function ML(e,t){var n=OL(mL++,4);!xL.__s&&BL(n.__H,t)&&(n.__=e,n.u=t,hL.__h.push(n))}function Q(e){return yL=5,NL(function(){return{current:e}},[])}function NL(e,t){var n=OL(mL++,7);return BL(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function PL(e,t){return yL=8,NL(function(){return e},t)}function FL(){for(var e;e=bL.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(RL),e.__H.__h.forEach(zL),e.__H.__h=[]}catch(t){e.__H.__h=[],xL.__e(t,e.__v)}}xL.__b=function(e){hL=null,SL&&SL(e)},xL.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),DL&&DL(e,t)},xL.__r=function(e){CL&&CL(e),mL=0;var t=(hL=e.__c).__H;t&&(gL===hL?(t.__h=[],hL.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(RL),t.__h.forEach(zL),t.__h=[],mL=0)),gL=hL},xL.diffed=function(e){wL&&wL(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(bL.push(t)!==1&&_L===xL.requestAnimationFrame||((_L=xL.requestAnimationFrame)||LL)(FL)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),gL=hL=null},xL.__c=function(e,t){t.some(function(e){try{e.__h.forEach(RL),e.__h=e.__h.filter(function(e){return!e.__||zL(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],xL.__e(n,e.__v)}}),TL&&TL(e,t)},xL.unmount=function(e){EL&&EL(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{RL(e)}catch(e){t=e}}),n.__H=void 0,t&&xL.__e(t,n.__v))};var IL=typeof requestAnimationFrame==`function`;function LL(e){var t,n=function(){clearTimeout(r),IL&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);IL&&(t=requestAnimationFrame(n))}function RL(e){var t=hL,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),hL=t}function zL(e){var t=hL;e.__c=e.__(),hL=t}function BL(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!vL(t,e[n])})}function VL(e,t){return typeof t==`function`?t(e):t}function HL(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(qF,{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(NI,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function UL(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function WL(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function GL(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 KL({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=qI(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:GL(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?GL(u,1,t,o):i&&r<=0&&c.length>0?KI(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 qL=400,JL=40,YL=18;function XL(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))?ZL(e,t,n):a instanceof HTMLElement?a:null}function ZL(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 QL(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 $L(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 eR(){return navigator.vendor!==`Apple Computer, Inc.`}function tR(e,t){let n=e-t.top;if(n<JL)return-Math.ceil((JL-Math.max(0,n))/JL*YL);let r=t.bottom-e;return r<JL?Math.ceil((JL-Math.max(0,r))/JL*YL):0}function nR(e,t){if(e!=null){let t=JI[e];return t==null?null:{text:t,title:YI[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:XI}:null}function rR(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 iR(e){return e!=null&&`toggle`in e}function aR(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function oR(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function sR(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function cR(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function lR(e,t){return t&&cR(e)||(e.ctrlKey||e.metaKey)&&aR(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var uR=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function dR(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 fR(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 pR(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function mR(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function hR(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function gR(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 _R(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 vR(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 yR(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=vR(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 bR(e,t){return{kind:e.kind,name:WL(e),path:t}}function xR(e){return e==null?void 0:`${e}__tree`}function SR(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function CR(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function wR(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`?CR(e.icon)?t(e.icon):{name:e.icon}:CR(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(bI,{...n})})}function TR(e){e!=null&&tL(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function ER(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=UL(e);return Z(qF,{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(bI,{...t(`file-tree-icon-chevron`)}):Z(bI,{...t(`file-tree-icon-file`,u)})}),Z(`div`,{"data-item-section":`content`,children:e.isFlattened?HL(e,c,a):c??Z(FI,{minimumLength:5,split:`extension`,children:e.name})}),i?Z(`div`,{"data-item-section":`decoration`,children:r==null?null:wR(r,t)}):null,s?Z(`div`,{"data-item-section":`git`,children:wR(o,t)}):null,n?Z(`div`,{"data-item-section":`action`,children:l?Z(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Z(bI,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function DR(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:N}=e,P=UL(t),{isParked:ee=!1,mode:te=`flow`,style:ne}=r,re=te===`sticky`,ie=_?.get(P)??null??rR(t.ancestorPaths,v,y),ae=t.kind===`directory`&&(b?.has(P)??!1),oe=A(t,P),se=nR(ie,ae),ce=S&&w,le=oe!=null||x||ce,ue=ce&&T===`always`,de=a.getPath()===P,fe=de?a.getValue():``,pe=re||!de?null:Z(dL,{ref:D,ariaLabel:`Rename ${WL(t)}`,isFlattened:t.isFlattened,value:fe,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),me=ER(t,k,{actionLaneEnabled:ce,customDecoration:oe,decorationLaneEnabled:le,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:se,gitLaneActive:x,renameInput:pe,showDecorativeActionAffordance:ue}),he={...fL({ariaLabel:WL(t),domId:t.isFocused?SR(h,P,ee):void 0,extraStyle:ne,features:{actionLaneEnabled:ce,contextMenuButtonVisibility:ce?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:ee,itemHeight:g,mode:te,row:t,state:{containsGitChange:ae,effectiveGitStatus:ie,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(P),j(t,P,{anchorRect:pR(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:re?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:re?void 0:N,ref:e=>{O(P,e)}};return!re&&de?Z(`div`,{...he,children:me}):Z(`button`,{...he,type:`button`,draggable:u&&!ee,onDragEnd:u&&!ee?p:void 0,onDragStart:u&&!ee?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(re){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!ee?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,te)},children:me})}function OR(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(UL(e))).map((n,r)=>DR(e,n,t.start+r))}function kR({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=yP,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),N=Q(null),P=Q(null),ee=Q(!1),te=Q(null),ne=Q(null),re=Q(null),ie=Q(null),ae=Q(null),oe=Q(null),se=Q(null),ce=Q(null),le=Q(!1),ue=Q(null),de=Q(null),fe=Q(null),pe=Q(null),me=NL(()=>new Map,[]),[,he]=kL(0),ge=Q(!1),[_e,ve]=kL(null),[ye,be]=kL(null),[xe,Se]=kL(null),[Ce,we]=kL(null),[Te,Ee]=kL(0),[F,De]=kL(null),Oe=Q(F);Oe.current=F;let ke=Q(null),Ae=Q(null),je=Q(null),Me=Q(null),Ne=Q(null),Pe=Q(!1),Fe=()=>{Ae.current=null,je.current=null,Me.current=null},Ie=(e,t)=>{Ae.current=e,je.current=null,Me.current=t==null?null:{path:e,scrollTop:t}},Le=(e,t)=>{Ae.current=null,je.current={path:e,viewportOffset:t},Me.current=null},Re=Q(d===`retain`&&t.isSearchOpen()),[ze,Be]=kL(p);jL(()=>{p||Be(!1)},[p]);let Ve=Q(!1),He=PL(()=>{Ve.current=!0,Be(e=>e&&!1)},[]),[Ue,We]=kL(()=>KL({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ge,Ke]=kL(!1);jL(()=>{Ke(!0)},[]);let qe=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Je=e?.contextMenu?.triggerMode??(qe?`right-click`:`both`),Ye=Je===`both`||Je===`button`,Xe=e?.contextMenu?.buttonVisibility??`when-needed`,Ze=Je===`both`||Je===`right-click`;ML(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Ne.current=t,be(t),we(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Pe.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 Qe=PL((e,t)=>{hR(T.current,e,t)},[]),$e=PL((e,t)=>{hR(E.current,e,t)},[]),et=PL(e=>{x.current=e},[]),tt=PL(e=>gR(e,E.current,T.current),[]),nt=n!=null||r!=null||i!=null,{resolveIcon:rt}=NL(()=>RA(a),[a]),it=t[uF](),at=it.getPath(),ot=at!=null,st=t.isSearchOpen(),ct=t.getSearchValue(),I=t.getFocusedPath(),L=t.getFocusedIndex(),lt=t.getScrollRequest(),ut=t.isDragAndDropEnabled(),dt=t.getDragSession(),ft=NL(()=>dt==null?null:new Set(dt.draggedPaths),[dt]),pt=dt?.target??null,mt=dt?.primaryPath??null,ht=xR(o),{overlayHeight:gt,overlayRows:_t,snapshot:vt,visibleRows:yt}=Ue,bt=vt.physical.viewportHeight,xt=NL(()=>({end:vt.window.endIndex,start:vt.window.startIndex}),[vt.window.endIndex,vt.window.startIndex]),St=_t,Ct=vt.sticky.rows,wt=vt.physical.totalHeight,Tt=vt.sticky.height,Et=NL(()=>new Set(Ct.map(e=>UL(e.row))),[Ct]),Dt=L>=0&&L>=xt.start&&L<=xt.end,Ot=PL((e,t)=>u?.({item:bR(e,t),row:e})??null,[u]),kt=PL(e=>tL(e==null?null:T.current.get(e)??null)?!0:tL(S.current),[]),At=PL(e=>{kt(t.focusNearestPath(e))},[t,kt]),jt=Q(At);jt.current=At;let Mt=Q(!0),Nt=Q(()=>{}),Pt=PL((t=!0)=>{let n=Oe.current;n!=null&&(Mt.current=Mt.current&&t,De(null),e?.contextMenu?.onClose?.(),Mt.current&&At(n.path))},[e?.contextMenu,At]);Nt.current=Pt;let Ft=PL(e=>{let t=e==null?null:mR(S.current,e);Se(e=>e===t?e:t)},[]),It=PL((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=tt(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Ie(n,e?.scrollTop??null),M.current=!0,ve(e=>e===n?e:n)}i.focus(),Ft(a),Mt.current=!0,De({anchorRect:r?.anchorRect??null,item:bR(e,n),path:n,source:r?.source??`keyboard`})},[t,tt,Ft]),Lt=PL(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=rL(e,bt);te.current=L<0||e==null?null:Math.max(0,Math.min(L*s-e.scrollTop,Math.max(0,t-s))),ee.current=!0}t.startRenaming(e)!==!1&&(we(`focus`),he(e=>e+1))}},[t,L,s,l,bt]),Rt=PL((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=rL(i,bt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:KL({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,cL(i,a,s,l,u,d),D.current(),ke.current=n?e:null,!0},[t,s,c,bt,h]),zt=()=>y.current===!0||pe.current!=null||le.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=()=>{ie.current!=null&&(clearTimeout(ie.current),ie.current=null),re.current=null},Ut=()=>{oe.current?.remove(),oe.current=null},Wt=()=>{Vt(ne.current),ne.current=null,ae.current=null},Gt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Kt=()=>{ce.current?.(),ce.current=null,pe.current!=null&&(clearTimeout(pe.current),pe.current=null),le.current=!1,ue.current=null,fe.current=null,de.current!=null&&(de.current.setAttribute(`draggable`,`true`),de.current.style.removeProperty(`touch-action`),de.current=null),Ut(),Ht(),Wt(),se.current=null},qt=(e,n)=>{let r=S.current?.getRootNode(),i=QL(XL(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=iR(r)?r:null;if(i==null||i.isExpanded()){Ht();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;re.current!==a&&(Ht(),re.current=a,ie.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Yt=()=>{ne.current=null;let e=ae.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=tR(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)),ne.current=Bt(Yt)},Xt=(e,t)=>{ae.current={clientX:e,clientY:t},ne.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(se.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),eR())){let t=$L(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),oe.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Qt=()=>{Ut(),Ht(),Wt(),se.current=null,t.cancelDrag()},R=(e,n,r)=>{if(pe.current!=null||le.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;fe.current={clientX:i.clientX,clientY:i.clientY},de.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!le.current;pe.current!=null&&(clearTimeout(pe.current),pe.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),ce.current===o&&(ce.current=null),t&&(a.setAttribute(`draggable`,`true`),de.current===a&&(de.current=null),fe.current=null)},s=e=>{let t=e.touches[0],n=fe.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),ce.current=o,pe.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),de.current===a&&(de.current=null),fe.current=null;return}le.current=!0,de.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),se.current=n;let e=a.getBoundingClientRect(),s=$L(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),oe.current=s,ue.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=ue.current;n!=null&&oe.current!=null&&(oe.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()};ce.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)},qL)},$t=e=>{if(F!=null){if(e.key===`Escape`){Pt(),e.preventDefault(),e.stopPropagation();return}uR.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(it.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)it.cancel();else if(e.key===`Enter`)it.commit();else return;we(`focus`),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Lt(I??void 0),e.preventDefault(),e.stopPropagation();return}if(st){if(e.key===`Escape`)ee.current=!1,te.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=rL(n,bt);te.current=L<0||n==null?null:Math.max(0,Math.min(L*s-n.scrollTop,Math.max(0,r-s))),ee.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;we(`focus`),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&oR(e)){t.openSearch(e.key),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=qe&&cR(e),r=lR(e,qe),i=r&&S.current!=null?nL(S.current):null,a=r?new Set(_R(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==I&&a.has(o)){let e=C.current;Ie(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=iR(p)?p:null,h=u!=null&&(Et.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=gR(u,E.current,T.current);e==null||n==null?y=!1:It(e,u)}else if((e.ctrlKey||e.metaKey)&&aR(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;we(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Et.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Ie(b,v?.scrollTop??null),M.current=!0,ve(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Le(b,yR(S.current,v,i,u,s,Tt,bt)),M.current=!0,ve(e=>e===b?e:b)):Fe()}he(e=>e+1),e.preventDefault(),e.stopPropagation()};ML(()=>{if(!(!f||!st)){if(Re.current){Re.current=!1;return}tL(w.current)}},[st,f]),ML(()=>{let e=x.current;switch(uL({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:at})){case`reset`:P.current=null;return;case`reveal-canonical`:at!=null&&Rt(at,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(ke.current=null,P.current=at,tL(e),e.select());return}},[xt.end,xt.start,at,Rt,Et]),ML(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=nL(e)?.dataset.itemPath??null;ve(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,nL(e)!=null){r();return}M.current=!1,ve(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,ve(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;ve(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),ML(()=>{let e=S.current;e!=null&&(vt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[vt.physical.scrollTop]),ML(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=rL(n,g);let a=()=>{let e=t.getVisibleCount(),r=iL(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),We(KL({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=iL(O.current,g),i=t.getVisibleRows(e,e)[0]??null;oL(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(()=>{ZI(ge)&&he(e=>e+1),a()}),l=()=>{Pe.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,Ee(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&Pe.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),Oe.current!=null&&y.current&&Nt.current(),Pe.current===!0){y.current=!1;return}be(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:aL(e[0]))??rL(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]),ML(()=>{qe||F==null||Pt(!1)},[Pt,qe,F]);let en=NL(()=>F==null?null:`${F.path}::${F.source}`,[F]);ML(()=>{if(en==null){m?.clearSlotContent(AA);return}let t=Oe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??fR(n.getBoundingClientRect()),close:e=>{Nt.current(e?.restoreFocus??!0)},restoreFocus:()=>{Mt.current&&jt.current(Oe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(AA,i),e?.contextMenu?.onOpen?.(t.item,r),TR(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&TR(i)}),()=>{m?.clearSlotContent(AA)}},[en,e?.contextMenu,m]),ML(()=>{F!=null&&t.getItem(F.path)==null&&Pt()},[Pt,F,t]),ML(()=>{if(F==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(dR(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Pt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Pt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Pt,F]),ML(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=I;return}let r=I==null?null:T.current.get(I)??null,i=nL(n),a=i?.dataset.itemPath??null,o=ot&&x.current===i,c=f&&w.current===i,l=ee.current&&!st,u=te.current??0,d=ke.current,p=Ae.current,m=je.current,g=Me.current,_=i!=null,v=M.current||_,y=N.current!==I,b=p!=null&&p===I&&I!=null,E=!1,O=!1;if(lt!=null&&lt.id!==k.current){k.current=lt.id;let n=lt.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,bt-s))):Tt;E=!0,O=sL(e,n,s,bt,wt,lt.offset,t)}t.clearScrollRequest(lt.id)}let A=!E&&l&&cL(e,L,s,bt,wt,u),j=!E&&d!=null&&d===I&&cL(e,L,s,bt,wt,Tt),P=!E&&m!=null&&m.path===I&&cL(e,L,s,bt,wt,m.viewportOffset),ne=!E&&g!=null&&g.path===I&&e.scrollTop!==g.scrollTop;if(ne&&(e.scrollTop=g.scrollTop),(ne||O||j||P||A||v&&y&&d!==I&&!b&&oL(e,L,s,bt,Tt))&&D.current(),E){N.current=I;return}if(!v){N.current=I;return}if(o){N.current=I;return}if(c&&!l){N.current=I;return}if(r==null){l&&L>=0&&(cL(e,L,s,bt,wt,u),D.current()),N.current=I;return}(y||l||d===I||p===I||m?.path===I||g?.path===I||a==null||a!==I)&&(tL(r),d===I&&(ke.current=null),p===I&&(Ae.current=null),m?.path===I&&(je.current=null),g?.path===I&&(Me.current=null),ee.current=!1,te.current=null),N.current=I},[t,L,I,Dt,s,ot,st,xt,bt,f,lt,h,Tt,wt,yt]);let tn=L>=0&&L>=vt.visible.startIndex&&L<=vt.visible.endIndex,nn=I!=null&&St.some(e=>UL(e.row)===I),rn=tn||nn,an=Ye&&M.current===!0&&rn?I:null,on=Ce===`pointer`?ye:null,sn=F?.path??Ne.current??on??an??ye,cn=F?.source===`right-click`;ML(()=>{y.current&&F==null||Ft(tt(sn))},[F,tt,xt,bt,Te,St,sn,Ft,yt]);let ln=PL(e=>{if(y.current||dR(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&&we(e=>e===`pointer`?e:`pointer`),be(e=>e===i?e:i)},[]),un=PL(()=>{be(null)},[]);ML(()=>{if(!ut)return;let e=()=>{Kt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Kt(),t.cancelDrag()}},[t,ut]);let dn=e=>{if(!ut||t.getDragSession()==null||le.current)return;let n=QL(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(!ut||t.getDragSession()==null||le.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Ht(),Wt(),t.setDragTarget(null))},pn=e=>{!ut||t.getDragSession()==null||le.current||(e.preventDefault(),qt(e.clientX,e.clientY),t.completeDrag(),Ut(),Ht(),Wt(),se.current=null)},mn=vt.window.height,hn=vt.window.offsetTop,gn=Math.min(0,bt-mn),_n=Math.min(0,bt-mn-Tt),vn=_e===I||ee.current,yn=I!=null&&vn&&!Dt&&L>=0?yt[L]??t.getVisibleRows(L,L)[0]??null:null,bn=yn==null?null:lL(L,s,xt,mn),xn=se.current,Sn=mt!=null&&xn!=null&&xn.path===mt&&xn.index>=xt.start&&xn.index<=xt.end,Cn=mt!=null&&xn!=null&&xn.path===mt&&!Sn&&xn.path!==yn?.path?xn:null,wn=Cn==null?null:lL(Cn.index,s,xt,mn),Tn=sR((L>=0?yt[L]??t.getVisibleRows(L,L)[0]??null:null)?.ancestorPaths.at(-1)??null),En=st&&I!=null?SR(o,I,!Dt):void 0,z=F?.path??(st?I:_e),Dn=F?.path??ye,On=tt(sn),kn=qe&&Ye&&!cn&&!ot&&On!=null&&xe!=null&&sn!=null,An=qe&&(kn||F!=null),jn=F?.anchorRect,Mn=jn==null&&On!=null&&xe!=null&&(F!=null||kn)?xe:null,Nn=jn==null?Mn==null?void 0:{top:`${Mn}px`}:{left:`${jn.left}px`,position:`fixed`,right:`auto`,top:`${jn.top}px`},Pn=cn?{opacity:`0`}:void 0,Fn=PL((e,n,r,i)=>{let a=pL({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:st,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>=vt.visible.startIndex&&n.index<=vt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,ve(e=>e===c?e:c),we(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Rt(c,{targetOffset:`sticky-parents`})},[t,st,vt.visible.endIndex,vt.visible.startIndex,Rt]),In=()=>{if(y.current||!Ye||sn==null||On==null)return;let e=t.getItem(sn);e!=null&&(Ft(On),Mt.current=!0,De({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:On.getAttribute(`aria-label`)??sn,path:e.getPath()},path:e.getPath(),source:`button`}))},Ln={contextHoverPath:Dn,contextMenuButtonTriggerEnabled:Ye,contextMenuButtonVisibility:Xe,contextMenuEnabled:qe,contextMenuRightClickEnabled:Ze,contextMenuTriggerMode:Je,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:ut,draggedPathSet:ft,dragTarget:pt,gitLaneActive:nt,gitStatusByPath:n,handleRowDragEnd:Qt,handleRowDragStart:Zt,handleRowTouchStart:R,ignoredGitDirectories:r,ignoredInheritanceCache:me,instanceId:o,itemHeight:s,onKeyDown:$t,onRowClick:Fn,openContextMenuForRow:It,registerButton:Qe,registerRenameInput:et,renameView:it,renderDecorationForRow:Ot,resolveIcon:rt,shouldSuppressContextMenu:zt,visualFocusPath:z},Rn={...Ln,registerButton:$e};return Z(`div`,{ref:S,id:ht,"data-file-tree-context-menu-button-visibility":qe&&Ye?Xe:void 0,"data-file-tree-context-menu-trigger-mode":qe?Je:void 0,"data-file-tree-has-context-menu-action-lane":qe&&Ye?`true`:void 0,"data-file-tree-has-git-lane":nt?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:ut?fn:void 0,onDragOver:ut?dn:void 0,onDrop:ut?pn:void 0,onKeyDown:$t,onPointerLeave:qe?un:void 0,onPointerOver:qe?ln: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:kA,"data-type":`header-slot`}),f?Z(`div`,{"data-file-tree-search-container":!0,"data-open":st?`true`:`false`,children:Z(`input`,{ref:w,"aria-activedescendant":En,"aria-controls":ht,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":ze?`true`:void 0,value:ct,onBlur:()=>{d===`retain`&&!Ve.current||t.closeSearch()},onFocus:He,onPointerDown:He,onInput:e=>{He();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Z(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ge&&St.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:`${gt}px`},children:St.map((e,t)=>DR(Rn,e.row,`sticky:${UL(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${St.length-t}`}}))})}):null,Z(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${wt}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:[OR(Ln,xt,Et),yn!=null&&bn!=null?DR(Ln,yn,`parked:${yn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:mt===yn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${bn}px`}}):null,Cn!=null&&wn!=null?DR(Ln,Cn,`parked-drag:${Cn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${wn}px`}}):null]})]})]}),qe?Z(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":An?`true`:`false`,style:Nn,children:[Z(`button`,{ref:v,type:`button`,"data-type":jA,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":F==null?`false`:`true`,"data-visible":kn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),F!=null){Pt();return}In()},tabIndex:-1,style:Pn,children:Z(bI,{...rt(`file-tree-icon-ellipsis`)})}),F==null?null:Z(`slot`,{name:AA})]}):null,F==null?null:Z(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Pt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Pt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var AR={hydrateRoot:(e,t)=>{hI(GF(kR,t),e)},renderRoot:(e,t)=>{mI(GF(kR,t),e)},unmountRoot:e=>{mI(null,e)}};function jR(e,t){AR.renderRoot(e,t)}function MR(e,t){AR.hydrateRoot(e,t)}function NR(e){AR.unmountRoot(e)}var PR=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 FR(e,t,n){if(!e.s){if(n instanceof IR){if(!n.s)return void(n.o=FR.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(FR.bind(null,e,t),FR.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var IR=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{FR(r,1,a(this.v))}catch(e){FR(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?FR(r,1,t?t(i):i):n?FR(r,1,n(i)):FR(r,2,i)}catch(e){FR(r,2,e)}},r},e}();Array.isArray;var LR=0;function RR(e){return e!=null&&e.length>0?e:(LR+=1,`pst_ft_${LR}`)}function zR({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??yP)}function BR(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 VR(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 HR(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var UR=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new PR;#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=RR(a),this.#p=xF(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=vP(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new gF({...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&&(NR(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=SF(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&jR(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(),jR(t.wrapper,this.#w()))}setGitStatus(e){let t=xF(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&jR(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),jR(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),MR(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),jR(r,this.#w())}#C(){return{initialViewportHeight:zR({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(kA,e());return}this.#l.setSlotHtml(kA,this.#e?.header?.html??null)}#k(e){let t=HR(e).find(e=>VR(e)),n=BR(yA(NA(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=HR(e),n=t.find(e=>VR(e)),r=t.filter(e=>e!==n),i=NA(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=BR(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=NA(this.#m);t.colored&&xA(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${TA}]`);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(TA,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=CP(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 kP(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)}},WR=`_jK _n`,GR=`<div><input type=search placeholder="Filter files…" aria-label="Filter files"></div>`,KR=` D l`,qR=h(18,e=>S(e,`b`,e.l,lz(e))),JR=M(11,qR),YR=h(10,e=>JR(e,(e.j??e.h)||``)),XR=M(17,qR),ZR=h(16,e=>XR(e,uz(e))),QR=M(15,ZR),$R=h(14,e=>QR(e,dz(e)),2),ez=o(7,e=>{YR(e),$R(e)}),tz=h(6,e=>ez(e,e.e,e.f)),nz=M(4,tz),rz=M(5,tz),iz=m(9,e=>{YR(e),$R(e)}),az=(e,t)=>cz(e,t.timer),oz=_(`l3`,e=>{E(e,`b`),u(e.b,`keydown`,function(t){t.key===`Enter`&&e.p(),t.key===`Escape`&&e.l&&(t.preventDefault(),e.r(``))})});function sz(e){b(e.a,`_jJ`),b(e.b,WR),iz(e,null),az(e,{timer:0}),oz(e)}var cz=M(13,e=>{$R(e),ZR(e)}),lz=e=>function(t){e.r(t)},uz=e=>t=>{if(e.n&&clearTimeout(e.n),!t){e.n=0,iz(e,null),ez(e,``);return}iz(e,t),e.n=setTimeout(e.p,150)},dz=e=>()=>{e.n&&=(clearTimeout(e.n),0);let t=e.j===null?e.h||``:e.j;iz(e,null),ez(e,t)};N(`l0`,lz),N(`l2`,uz),N(`l1`,dz);var fz=(e=>`<div><div title="Drag to resize"></div><div>${e}</div><div></div></div>`)(GR),pz=(e=>` D b D/${e}&l l`)(KR),mz={A:`added`,D:`deleted`,M:`modified`,R:`renamed`},hz=h(7,e=>{T(e.a,`aria-expanded`,e._._.t.has(e._.f)?`false`:`true`),b(e.b,[`_i6`,{_i7:!e._._.t.has(e._.f)}])}),gz=j(29,hz,e=>e._._),_z=_(`z4`,e=>u(e.a,`click`,function(){let t=new Set(e._._.t);t.delete(e._.f)||t.add(e._.f),Iz(e._._,t)})),vz=e=>{gz(e),yz._(e),bz._(e),xz._(e),b(e.a,`_i5`),he(e.c),de(e.c,12),Ee(e.c),b(e.d,`_i8`),b(e.f,`_i9`),_z(e)},yz=f(1,0,hz),bz=f(1,0,e=>{T(e.a,`title`,e._.h),c(e.e,e._.h)}),xz=f(1,0,e=>c(e.g,e._.j)),Sz=d(1,(e=>`<button type=button><span aria-hidden=true>${e}</span><span> </span><span> </span></button>`)(ye),(e=>` D D/${e}&l D l D m`)(Oe),vz),Cz=g(4,e=>{b(e.a,[`_i4`,{_i3:e._.m===1}]),b(e.c,[`_ja`,{_i_:e._.m===1}]),Sz(e,e._.m>1?0:1)}),wz=e=>{Cz._(e),Ez._(e)},Tz=h(6,e=>T(e.c,`hidden`,e._.t.has(e.f))),Ez=g(4,Tz),Dz=M(5,e=>{T(e.a,`data-section`,e.f),T(e.c,`data-tree`,e.f),Tz(e),yz(e)}),Oz=(e,t)=>{Dz(e,t[0]?.id),kz(e,t[0]?.label),Az(e,t[0]?.files?.length)},kz=M(7,bz),Az=M(9,xz),jz=o(17,e=>nz(e.d,e.r)),Mz=h(9,e=>jz(e,e.h,e.i)),Nz=M(7,Mz),Pz=M(8,Mz),Fz=y(gz),Iz=m(19,e=>{Ez(e),Fz(e)}),Lz=M(27),Rz=h(24,e=>Lz(e,nB(e))),zz=m(20,e=>{w(e.a,e.u==null?void 0:`--tree-w:${e.u}px`),Rz(e)}),Bz=m(21,e=>b(e.b,[`_jc`,{_jb:e.v}])),Vz=(e,t)=>Kz(e,t.id),Hz=_(`z6`,e=>{u(e.b,`pointerdown`,function(t){e.z(t)}),u(e.b,`pointermove`,function(t){e.a0(t)}),u(e.b,`pointerup`,function(t){e.a1(t)}),u(e.b,`pointercancel`,function(t){e.a1(t)})});function Uz(e){b(e.c,`_i1`),sz(e.d),rz(e.d,rB(e)),b(e.e,`_i2`),Iz(e,new Set),zz(e,vt()),Bz(e,!1),Vz(e,{id:-1}),Hz(e)}var Wz=M(25),Gz=M(26),Kz=M(23,e=>{Wz(e,iB(e)),Gz(e,aB(e)),Rz(e)}),qz=(e,t)=>b(e.a,[`_i0`,{_iZ:t===!1}]),Jz=a(4,`<div><!><div></div></div>`,` D%b `,wz,Oz),Yz=_(`z5`,e=>l(e,{sections:e.l,commentCounts:e.n,newKeys:e.o,onMount:function(){let t=(e,t)=>`${e.id}/${t}`,n=e=>e.files.map(e=>({path:e.path,status:mz[e.status]??`modified`})),r=e=>e.files.map(e=>`${e.path}:${e.status}`).join(`
2798
- `),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 UR({paths:i.files.map(e=>e.path),gitStatus:n(i),initialExpansion:`open`,flattenEmptyDirectories:!0,search:!1,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)}},onUpdate:function(){let e=this.marks(this.commentCounts,this.newKeys),t=e!==this.shownMarks;this.shownMarks=e;let n=new Set(this.sections.map(e=>e.id));for(let[e,t]of this.trees)n.has(e)||(t.unsub(),t.tree.cleanUp(),this.trees.delete(e));for(let e of this.sections){let n=this.trees.get(e.id);if(!n){this.build(e);continue}let r=this.sig(e);r===n.sig?t&&n.tree.setGitStatus(this.gitStatus(e)):(n.sig=r,n.tree.resetPaths(e.files.map(e=>e.path)),n.tree.setGitStatus(this.gitStatus(e)))}},onDestroy:function(){for(let e of this.trees.values())e.unsub(),e.tree.cleanUp()}})),Xz=h(16,Yz,3),Zz=M(11,e=>{tB(e,e.l?.length),Jz(e,[e.l,`id`]),Xz(e)}),Qz=M(13,Xz),$z=M(14,Xz),eB=M(15,Xz),tB=M(12,Cz),nB=e=>t=>{t.pointerId===e.x&&(e.x=-1,Bz(e,!1),e.u!=null&&Je(e.u))},rB=e=>t=>{jz(e,t)},iB=e=>t=>{(t.pointerType!==`mouse`||t.button===0)&&(t.preventDefault(),e.x=t.pointerId,Bz(e,!0),e.b.setPointerCapture(t.pointerId))},aB=e=>t=>{if(t.pointerId!==e.x)return;let n=window.innerWidth-t.clientX;zz(e,Math.min(640,Math.max(200,n)))};N(`z2`,nB),N(`z3`,rB),N(`z0`,iB),N(`z1`,aB);var oB=`_jo _ba`,sB=`<!><!><!>`,cB=e=>b(e.a,`_jr`),lB=e=>{VS(e.a),HS(e.a,12),US(e.a,`_jt`)},uB=e=>b(e.a,[`_A`,`_js`]),dB=f(1,0,e=>{T(e.a,`title`,e._.f),c(e.b,e._.f)}),fB=e=>{dB._(e),b(e.a,oB)},pB=d(6,zS,(e=>`/${e}&`)(BS),lB),mB=h(11,e=>pB(e,+!e._._._._.w.has(e.k))),hB=j(29,mB,e=>e._._._._),gB=_(`i2`,e=>u(e.a,`click`,function(){JB(e._._._._,!1)})),_B=e=>{hB(e),bB(e),SB(e),b(e.a,[`_jn`,`_y`]),b(e.b,`__`),b(e.d,`_jp`),gB(e)},vB=d(5,`<span title="Changed since your last visit"></span>`,` `,uB),yB=h(12,e=>vB(e,+!e._._._._.x.has(e.k))),bB=j(30,yB,e=>e._._._._),xB=h(13,e=>T(e.a,`href`,e._._._._.z(e.k))),SB=j(32,xB,e=>e._._._._),CB=M(10,e=>{xB(e),yB(e),mB(e)}),wB=(e,t)=>{T(e.b,`data-status`,t),c(e.c,t)},TB=(e,t)=>c(e.e,t),EB=(e,t)=>{CB(e,(t?.[0]).file?.key),wB(e,(t?.[0]).file?.status),TB(e,(t?.[0]).name)},DB=e=>b(e.a,`_jm`),OB=d(1,`<div><bdi><!>/</bdi></div>`,` E%`,fB),kB=M(5,e=>{OB(e,+!e.f),dB(e)}),AB=a(2,`<a><span> </span><span><bdi> </bdi></span><!><!></a>`,` D D l E m%b%`,_B,EB),jB=(e,t)=>AB(e,[t,e=>e.file.key]),MB=(e,t)=>{kB(e,(t?.[0]).dir),jB(e,(t?.[0]).files)},NB=e=>{b(e.a,`_jk`),b(e.b,`_jl`)},PB=(e,t)=>c(e.c,t),FB=a(3,`<div><!><!></div>`,` D%b%`,DB,MB),IB=(e,t)=>FB(e,[t,`dir`]),LB=(e,t)=>{PB(e,t[0]?.repo),IB(e,t[0]?.dirs)},RB=d(13,`<p>No files match.</p>`,` `,cB),zB=h(14,e=>c(e.g,e._.n===e._.y?``:` / ${e._.y}`)),BB=f(0,0,e=>{c(e.f,e._.n),RB(e,+!!e._.n),zB(e)}),VB=_(`i3`,e=>{u(e.a,`click`,function(){JB(e._,!1)}),u(e.h,`click`,function(){JB(e._,!1)})}),HB=e=>{BB._(e),UB._(e),WB._(e),KB._(e),b(e.a,`_jf`),b(e.b,`_jg`),b(e.c,`_jh`),b(e.d,`_je`),b(e.e,`_ji`),b(e.h,[zt,`_jd`]),oe(e.i),je(e.i,16),Ft(e.i),b(e.j,`_jq`),sz(e.k),rz(e.k,gV(e)),b(e.l,`_jj`),VB(e)},UB=f(0,0,e=>nz(e.k,e._.u)),WB=f(0,0,zB),GB=a(12,`<div><div> </div><!></div>`,` D D l%`,NB,LB),KB=f(0,0,e=>GB(e,[e._.a0,`repo`])),qB=d(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>`)(Nt,GR),((e,t)=>` b D D b D%b%l D/${e}&m D/${t}&l D%b%m`)(Ne,KR),HB),JB=o(18,e=>qB(e,+!e.s)),YB=h(5,e=>JB(e,e.d,e.e)),XB=M(3,YB),ZB=M(4,YB),QB=o(20,UB),$B=h(8,e=>QB(e,e.g,e.h)),eV=M(6,$B),tV=M(7,$B),nV=M(22,y(hB)),rV=(e,t)=>nV(e,t||new Set),iV=M(23,y(bB)),aV=(e,t)=>iV(e,t||new Set),oV=M(24,WB),sV=h(14,e=>oV(e,e.l??e.n)),cV=M(11,sV),lV=M(13,e=>{sV(e),BB(e)}),uV=M(25,y(SB)),dV=h(17,e=>uV(e,_V(e))),fV=M(15,dV),pV=M(16,dV),mV=M(26,KB),hV=(e,t)=>{lV(e,t?.length),mV(e,(()=>{let e=[],n=new Map;for(let r of t){let t=r.key.slice(0,r.key.indexOf(`/`)).replace(`#`,` #`),i=r.label.slice(r.label.indexOf(`/`)+1),a=i.lastIndexOf(`/`),o=a<0?``:i.slice(0,a),s=a<0?i:i.slice(a+1),c=n.get(t);c||(n.set(t,c=new Map),e.push({repo:t,dirs:[]}));let l=c.get(o);l||(c.set(o,l={dir:o,files:[]}),e[e.length-1].dirs.push(l)),l.files.push({file:r,name:s})}return e})())},gV=e=>t=>{QB(e._,t)},_V=e=>t=>De({workspaceId:e.p,view:`diff`,scope:e.q??null,file:t});N(`i1`,gV),N(`i0`,_V);var vV=((e,t,n,r,i,a)=>`<div><div><div><div><div><!><h1>Review</h1><!></div><div><!><button title="Refresh diff">${e}</button><!><span><button aria-label=Compare>${t}</button><select aria-label=Compare tabindex=-1><option value=committed>Committed</option><option value=working>Working tree</option><option value=dirty>Uncommitted</option><!></select></span> <div>${n}</div><!></div><!>${r}</div><div><!><!><!><!></div></div><div data-diff-main></div></div>${i}${a}</div>`)(yt,pt,lw,xD,fz,sB),yV=((e,t,n,r,i,a)=>` D D D D D%b b%l D%b D/${e}&l%b D D/${t}&l Dd%mb D0${n}&l%l%b/${r}&l D%b%b%b%m l/${i}&/${a}&l`)(it,I,uw,`b%c`,pz,`b%c`);function bV(e){return e.split(`
2797
+ }`}var wP=new WeakMap;function TP(e){let t=wP.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(EA,`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(),wP.set(e,i),i}function EP(e,t){if(!e.isConnected)return;let n=TP(t);if(n==null)return;let r=t.querySelector(`style[${DA}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(DA,``),t.appendChild(i)),i.textContent=`:host { ${OA}: ${n}px; }`}var DP;function OP(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){DP??(DP=new CSSStyleSheet,DP.replaceSync(SP(bP)));let t=!1;try{e.adoptedStyleSheets=[DP],t=!0}catch{}if(t){e.querySelector(`style[${wA}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(wA,``),t.textContent=SP(bP),e.prepend(t)}}function kP(e,t){AP(e,t),OP(t),EP(e,t)}function AP(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`});kP(this,e)}}if(customElements.define(CA,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(CA)))e instanceof HTMLElement&&kP(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var jP=e=>e.startsWith(`f::`)?e.slice(3):e;function MP(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function NP(e,t){return e===``?t:`${e}/${t}`}function PP({files:e,path:t,isFolder:n,nextBasename:r}){let i=jP(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}=MP(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=NP(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 FP(e){return e.endsWith(`/`)}function IP(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 LP(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 RP(e,t){return t.includes(e)?LP(t):[e]}function zP(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 BP(e,t){return{draggedPaths:e,target:t}}function VP(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(FP(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function HP(e,t){return t.kind===`root`||t.directoryPath==null?IP(e):t.directoryPath}function UP(e,t){let n=e.map(e=>{let n=HP(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 WP(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 GP(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(!WP(hP.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 KP(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function qP(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 JP(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function YP(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 JP(e,t.path)?n?e:null:e;case`move`:return qP(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=YP(r,e,n),r==null)return null;return r}}}function XP(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function ZP(e){switch(e.operation){case`add`:return{...XP(e),operation:`add`,path:e.path};case`remove`:return{...XP(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...XP(e),from:e.from,operation:`move`,to:e.to}}}function QP(e){return{...XP(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>ZP(e)),operation:`batch`}}function $P(e){switch(e.operation){case`add`:case`remove`:case`move`:return ZP(e);case`batch`:return QP(e);default:return null}}function eF(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function tF(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 nF(e){return tF(e).at(-1)??null}function rF(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function iF(e){return e.endsWith(`/`)}var aF=e=>e.toLowerCase();function oF(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function sF(e){return e.endsWith(`/`)?e.slice(0,-1):e}function cF(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var lF=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},uF=Symbol(`FILE_TREE_RENAME_VIEW`),dF=512,fF=512;function pF(e){return e===`top`||e===`center`?e:`nearest`}function mF(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=tF(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 hF(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:mF(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var gF=class e{static{Object.defineProperty(e.prototype,uF,{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=GP({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=nF(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:pF(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<=fF){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=RP(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=BP(t.draggedPaths,n);(VP(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}zP(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=BP(e.draggedPaths,t);if(VP(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=UP(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=iF(r),a=sF(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of tF(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=oF(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,iF(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,iF(e)?{recursive:!0}:void 0);return}let t=iF(e),n=PP({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:sF(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(cF(n.sourcePath,t),cF(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=GP({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=!eF(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=nF(e),n=rF(e,t),r=null,i=null;for(let e of this.#be()){if(nF(e)!==t)continue;let a=rF(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=tF(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=!eF(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 hP({...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 tF(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(aF),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(aF),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 tF(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:lF(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 tF(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 tF(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=hF(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,dF)),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=YP(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=YP(this.#c,e,!0),r=[...this.#B].map(t=>YP(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=YP(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return eF(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&&KP(e)&&(this.#i=null);let t=KP(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=$P(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},_F=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 vF(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 yF(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 bF(e,t){return t?`${e}/`:e}function xF(e,t=null){let n=_F(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=CF(t);e!=null&&EF({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 SF(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=wF(e);t!=null&&(c=TF({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=CF(e);t!=null&&(c=EF({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:kF(i),statusByPath:i}:e}function CF(e){return wF(e.path)}function wF(e){let t=vF(e);if(t!=null)return{canonicalPath:bF(t.path,t.isDirectory),isDirectory:t.isDirectory}}function TF({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),OF(t,n,e),!0)}function EF({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??DF(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function DF(e,t,n){for(let r of yF(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function OF(e,t,n){for(let r of yF(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function kF(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var X,AF,jF,MF,NF,PF,FF,IF,LF,RF,zF={},BF=[],VF=Array.isArray,HF=BF.slice,UF=Object.assign;function WF(e){e&&e.parentNode&&e.remove()}function GF(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?HF.call(arguments,2):n),KF(e,o,r,i,null)}function KF(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??++AF,__i:-1,__u:0};return i==null&&X.vnode!=null&&X.vnode(a),a}function qF(e){return e.children}function JF(e,t){this.props=e,this.context=t,this.__g=0}function YF(e,t){if(t==null)return e.__?YF(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`?YF(e):null}function XF(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 XF(e)}}function ZF(e){(8&e.__g||!(e.__g|=8)||!jF.push(e)||NF++)&&MF==X.debounceRendering||((MF=X.debounceRendering)||queueMicrotask)(QF)}function QF(){for(var e,t,n,r,i,a,o,s,c=1;jF.length;)jF.length>c&&jF.sort(PF),e=jF.shift(),c=jF.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=UF({},r)).__v=r.__v+1,X.vnode&&X.vnode(n),oI(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??YF(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,cI(a,n,o),n.__e!=i&&XF(n)));NF=0}function $F(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||BF,b=t.length;for(c=eI(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?zF:y[m.__i]||zF,m.__i=f,_=oI(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&dI(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=tI(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function eI(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?KF(null,o,null,null,null):VF(o)?KF(qF,{children:o},null,null,null):o.constructor==null&&o.__b>0?KF(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=nI(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=YF(s)),fI(s,s));return r}function tI(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=tI(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=YF(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function nI(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 rI(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function iI(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||rI(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||rI(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(FF,`$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=IF,e.addEventListener(t,a?RF:LF,a)):e.removeEventListener(t,a?RF:LF,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 aI(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=IF++;else if(t.u<n.l)return;return n(X.event?X.event(t):t)}}}function oI(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 JF(v,x),f.constructor=M,f.render=pI),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=UF({},f.__s)),UF(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=UF({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===qF&&d.key==null&&(E=lI(d.props.children)),s=$F(e,VF(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--;)WF(a[j]);sI(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||sI(t);X.__e(e,t,n)}else s=t.__e=uI(n.__e,t,n,r,i,a,o,c,l,u);return(d=X.diffed)&&d(t),128&t.__u?void 0:s}function sI(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(sI)}function cI(e,t,n){for(var r=0;r<n.length;r++)dI(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 lI(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:VF(e)?e.map(lI):UF({},e)}function uI(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&&=HF.call(e.childNodes),v=n.props||zF,!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;iI(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&&!_||iI(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=``),$F(b==`template`?e.content:e,VF(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&YF(n,0),s,c,l),a!=null)for(u=a.length;u--;)WF(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||iI(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&iI(e,u,g,v[u],i))}return e}function dI(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 fI(e,t,n){var r,i;if(X.unmount&&X.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||dI(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]&&fI(r[i],t,n||typeof e.type!=`function`);n||WF(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function pI(e,t,n){return this.constructor(e,n)}function mI(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=GF(qF,null,[e]),i=[],a=[],oI(t,e,r||zF,zF,t.namespaceURI,r?null:t.firstChild?HF.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),cI(i,e,a)}function hI(e,t){e.__u|=32,mI(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 NF=0,e}},AF=0,JF.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=UF({},this.state);typeof e==`function`&&(e=e(UF({},n),this.props)),e&&UF(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ZF(this))},JF.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),ZF(this))},JF.prototype.render=qF,jF=[],NF=0,PF=function(e,t){return e.__v.__b-t.__v.__b},FF=/(PointerCapture)$|Capture$/i,IF=0,LF=aI(!1),RF=aI(!0);var gI=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:--gI,__i:-1,__u:0,__source:i,__self:a};return X.vnode&&X.vnode(l),l}var _I=16,vI=16,yI={};function bI({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}=yI[e]??{width:_I,height:vI},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 xI=e=>e!==void 0&&/\s/.test(e),SI=(e,t)=>{let n=t=>xI(e[t-1])||xI(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},CI=e=>SI(e,Math.ceil(e.length/2)),wI=e=>{if(e.length<2)return[e,``];let t=CI(e);return[e.slice(0,t),e.slice(t)]},TI=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:CI(e);return[e.slice(0,r),e.slice(r)]},EI=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)]},DI=(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)]},OI=(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)]},kI=(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 AI({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 jI(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 MI({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Z(jI,{mode:t,children:e},`content`),o=Z(AI,{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 NI({children:e,...t}){"use no memo";return Z(MI,{mode:`truncate`,...t,children:e})}function PI({children:e,...t}){"use no memo";return Z(MI,{mode:`fruncate`,...t,children:e})}function FI({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(NI,{...s,children:t[0]}),l=Z(PI,{...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`?PI:NI,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=wI:r===`extension`?t=TI:r===`leaf-path`&&(t=EI);else if(typeof r==`number`)t=DI,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=OI:e===`first`&&(t=kI)}else typeof r==`function`&&(t=r);t??=wI;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(NI,{...s,..._,children:f}),l=Z(PI,{...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 II={endIndex:-1,startIndex:-1};function LI(e,t,n){return Math.min(Math.max(e,t),n)}function RI(e,t){return e<0||t<e?II:{endIndex:t,startIndex:e}}function zI(e){return e.startIndex<0||e.endIndex<e.startIndex}function BI(e,t){return zI(e)?0:(e.endIndex-e.startIndex+1)*t}function VI(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function HI(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function UI(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 WI(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 GI(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 KI(e,t,n){if(e.length===0||t<=0)return[];let r=GI(e),i=UI(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=WI(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 qI(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=LI(t.scrollTop,0,o),c=t.stickyRows??KI(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=VI(s,n,t.itemHeight),m=VI(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?II:RI(m,HI(u+d,n,t.itemHeight)),y=g+1,b=zI(v)?II:RI(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=BI(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:zI(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var JI={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},YI={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},XI=`Contains git status items`;function ZI(e){return e.current?!0:(e.current=!0,!1)}function QI(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 $I(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return QI({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 eL(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 tL(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 nL(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 rL(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function iL(e,t){return e!=null&&e>0?e:t}function aL(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 oL(e,t,n,r,i=0){let a=QI({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function sL(e,t,n,r,i,a,o=0){let s=$I({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function cL(e,t,n,r,i,a){let o=eL({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function lL(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function uL(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function dL({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 fL(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 pL(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 mL,hL,gL,_L,vL=Object.is,yL=0,bL=[],xL=X,SL=xL.__b,CL=xL.__r,wL=xL.diffed,TL=xL.__c,EL=xL.unmount,DL=xL.__;function OL(e,t){xL.__h&&xL.__h(hL,e,yL||t),yL=0;var n=hL.__H||(hL.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function kL(e){return yL=1,AL(VL,e)}function AL(e,t,n){var r=OL(mL++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):VL(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);vL(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=hL,!hL.__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,vL(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};hL.__f=!0;var a=hL.shouldComponentUpdate,o=hL.componentWillUpdate;hL.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)},hL.shouldComponentUpdate=i}return r.__N||r.__}function jL(e,t){var n=OL(mL++,3);!xL.__s&&BL(n.__H,t)&&(n.__=e,n.u=t,hL.__H.__h.push(n))}function ML(e,t){var n=OL(mL++,4);!xL.__s&&BL(n.__H,t)&&(n.__=e,n.u=t,hL.__h.push(n))}function Q(e){return yL=5,NL(function(){return{current:e}},[])}function NL(e,t){var n=OL(mL++,7);return BL(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function PL(e,t){return yL=8,NL(function(){return e},t)}function FL(){for(var e;e=bL.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(RL),e.__H.__h.forEach(zL),e.__H.__h=[]}catch(t){e.__H.__h=[],xL.__e(t,e.__v)}}xL.__b=function(e){hL=null,SL&&SL(e)},xL.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),DL&&DL(e,t)},xL.__r=function(e){CL&&CL(e),mL=0;var t=(hL=e.__c).__H;t&&(gL===hL?(t.__h=[],hL.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(RL),t.__h.forEach(zL),t.__h=[],mL=0)),gL=hL},xL.diffed=function(e){wL&&wL(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(bL.push(t)!==1&&_L===xL.requestAnimationFrame||((_L=xL.requestAnimationFrame)||LL)(FL)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),gL=hL=null},xL.__c=function(e,t){t.some(function(e){try{e.__h.forEach(RL),e.__h=e.__h.filter(function(e){return!e.__||zL(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],xL.__e(n,e.__v)}}),TL&&TL(e,t)},xL.unmount=function(e){EL&&EL(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{RL(e)}catch(e){t=e}}),n.__H=void 0,t&&xL.__e(t,n.__v))};var IL=typeof requestAnimationFrame==`function`;function LL(e){var t,n=function(){clearTimeout(r),IL&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);IL&&(t=requestAnimationFrame(n))}function RL(e){var t=hL,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),hL=t}function zL(e){var t=hL;e.__c=e.__(),hL=t}function BL(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!vL(t,e[n])})}function VL(e,t){return typeof t==`function`?t(e):t}function HL(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(qF,{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(NI,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function UL(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function WL(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function GL(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 KL({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=qI(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:GL(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?GL(u,1,t,o):i&&r<=0&&c.length>0?KI(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 qL=400,JL=40,YL=18;function XL(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))?ZL(e,t,n):a instanceof HTMLElement?a:null}function ZL(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 QL(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 $L(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 eR(){return navigator.vendor!==`Apple Computer, Inc.`}function tR(e,t){let n=e-t.top;if(n<JL)return-Math.ceil((JL-Math.max(0,n))/JL*YL);let r=t.bottom-e;return r<JL?Math.ceil((JL-Math.max(0,r))/JL*YL):0}function nR(e,t){if(e!=null){let t=JI[e];return t==null?null:{text:t,title:YI[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:XI}:null}function rR(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 iR(e){return e!=null&&`toggle`in e}function aR(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function oR(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function sR(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function cR(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function lR(e,t){return t&&cR(e)||(e.ctrlKey||e.metaKey)&&aR(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var uR=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function dR(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 fR(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 pR(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function mR(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function hR(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function gR(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 _R(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 vR(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 yR(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=vR(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 bR(e,t){return{kind:e.kind,name:WL(e),path:t}}function xR(e){return e==null?void 0:`${e}__tree`}function SR(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function CR(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function wR(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`?CR(e.icon)?t(e.icon):{name:e.icon}:CR(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(bI,{...n})})}function TR(e){e!=null&&tL(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function ER(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=UL(e);return Z(qF,{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(bI,{...t(`file-tree-icon-chevron`)}):Z(bI,{...t(`file-tree-icon-file`,u)})}),Z(`div`,{"data-item-section":`content`,children:e.isFlattened?HL(e,c,a):c??Z(FI,{minimumLength:5,split:`extension`,children:e.name})}),i?Z(`div`,{"data-item-section":`decoration`,children:r==null?null:wR(r,t)}):null,s?Z(`div`,{"data-item-section":`git`,children:wR(o,t)}):null,n?Z(`div`,{"data-item-section":`action`,children:l?Z(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Z(bI,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function DR(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:N}=e,P=UL(t),{isParked:ee=!1,mode:te=`flow`,style:ne}=r,re=te===`sticky`,ie=_?.get(P)??null??rR(t.ancestorPaths,v,y),ae=t.kind===`directory`&&(b?.has(P)??!1),oe=A(t,P),se=nR(ie,ae),ce=S&&w,le=oe!=null||x||ce,ue=ce&&T===`always`,de=a.getPath()===P,fe=de?a.getValue():``,pe=re||!de?null:Z(dL,{ref:D,ariaLabel:`Rename ${WL(t)}`,isFlattened:t.isFlattened,value:fe,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),me=ER(t,k,{actionLaneEnabled:ce,customDecoration:oe,decorationLaneEnabled:le,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:se,gitLaneActive:x,renameInput:pe,showDecorativeActionAffordance:ue}),he={...fL({ariaLabel:WL(t),domId:t.isFocused?SR(h,P,ee):void 0,extraStyle:ne,features:{actionLaneEnabled:ce,contextMenuButtonVisibility:ce?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:ee,itemHeight:g,mode:te,row:t,state:{containsGitChange:ae,effectiveGitStatus:ie,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(P),j(t,P,{anchorRect:pR(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:re?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:re?void 0:N,ref:e=>{O(P,e)}};return!re&&de?Z(`div`,{...he,children:me}):Z(`button`,{...he,type:`button`,draggable:u&&!ee,onDragEnd:u&&!ee?p:void 0,onDragStart:u&&!ee?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(re){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!ee?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,te)},children:me})}function OR(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(UL(e))).map((n,r)=>DR(e,n,t.start+r))}function kR({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=yP,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),N=Q(null),P=Q(null),ee=Q(!1),te=Q(null),ne=Q(null),re=Q(null),ie=Q(null),ae=Q(null),oe=Q(null),se=Q(null),ce=Q(null),le=Q(!1),ue=Q(null),de=Q(null),fe=Q(null),pe=Q(null),me=NL(()=>new Map,[]),[,he]=kL(0),ge=Q(!1),[_e,ve]=kL(null),[ye,be]=kL(null),[xe,Se]=kL(null),[Ce,we]=kL(null),[Te,Ee]=kL(0),[F,De]=kL(null),Oe=Q(F);Oe.current=F;let ke=Q(null),Ae=Q(null),je=Q(null),Me=Q(null),Ne=Q(null),Pe=Q(!1),Fe=()=>{Ae.current=null,je.current=null,Me.current=null},Ie=(e,t)=>{Ae.current=e,je.current=null,Me.current=t==null?null:{path:e,scrollTop:t}},Le=(e,t)=>{Ae.current=null,je.current={path:e,viewportOffset:t},Me.current=null},Re=Q(d===`retain`&&t.isSearchOpen()),[ze,Be]=kL(p);jL(()=>{p||Be(!1)},[p]);let Ve=Q(!1),He=PL(()=>{Ve.current=!0,Be(e=>e&&!1)},[]),[Ue,We]=kL(()=>KL({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ge,Ke]=kL(!1);jL(()=>{Ke(!0)},[]);let qe=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Je=e?.contextMenu?.triggerMode??(qe?`right-click`:`both`),Ye=Je===`both`||Je===`button`,Xe=e?.contextMenu?.buttonVisibility??`when-needed`,Ze=Je===`both`||Je===`right-click`;ML(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Ne.current=t,be(t),we(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Pe.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 Qe=PL((e,t)=>{hR(T.current,e,t)},[]),$e=PL((e,t)=>{hR(E.current,e,t)},[]),et=PL(e=>{x.current=e},[]),tt=PL(e=>gR(e,E.current,T.current),[]),nt=n!=null||r!=null||i!=null,{resolveIcon:rt}=NL(()=>RA(a),[a]),it=t[uF](),at=it.getPath(),ot=at!=null,st=t.isSearchOpen(),ct=t.getSearchValue(),I=t.getFocusedPath(),L=t.getFocusedIndex(),lt=t.getScrollRequest(),ut=t.isDragAndDropEnabled(),dt=t.getDragSession(),ft=NL(()=>dt==null?null:new Set(dt.draggedPaths),[dt]),pt=dt?.target??null,mt=dt?.primaryPath??null,ht=xR(o),{overlayHeight:gt,overlayRows:_t,snapshot:vt,visibleRows:yt}=Ue,bt=vt.physical.viewportHeight,xt=NL(()=>({end:vt.window.endIndex,start:vt.window.startIndex}),[vt.window.endIndex,vt.window.startIndex]),St=_t,Ct=vt.sticky.rows,wt=vt.physical.totalHeight,Tt=vt.sticky.height,Et=NL(()=>new Set(Ct.map(e=>UL(e.row))),[Ct]),Dt=L>=0&&L>=xt.start&&L<=xt.end,Ot=PL((e,t)=>u?.({item:bR(e,t),row:e})??null,[u]),kt=PL(e=>tL(e==null?null:T.current.get(e)??null)?!0:tL(S.current),[]),At=PL(e=>{kt(t.focusNearestPath(e))},[t,kt]),jt=Q(At);jt.current=At;let Mt=Q(!0),Nt=Q(()=>{}),Pt=PL((t=!0)=>{let n=Oe.current;n!=null&&(Mt.current=Mt.current&&t,De(null),e?.contextMenu?.onClose?.(),Mt.current&&At(n.path))},[e?.contextMenu,At]);Nt.current=Pt;let Ft=PL(e=>{let t=e==null?null:mR(S.current,e);Se(e=>e===t?e:t)},[]),It=PL((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=tt(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Ie(n,e?.scrollTop??null),M.current=!0,ve(e=>e===n?e:n)}i.focus(),Ft(a),Mt.current=!0,De({anchorRect:r?.anchorRect??null,item:bR(e,n),path:n,source:r?.source??`keyboard`})},[t,tt,Ft]),Lt=PL(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=rL(e,bt);te.current=L<0||e==null?null:Math.max(0,Math.min(L*s-e.scrollTop,Math.max(0,t-s))),ee.current=!0}t.startRenaming(e)!==!1&&(we(`focus`),he(e=>e+1))}},[t,L,s,l,bt]),Rt=PL((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=rL(i,bt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:KL({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,cL(i,a,s,l,u,d),D.current(),ke.current=n?e:null,!0},[t,s,c,bt,h]),zt=()=>y.current===!0||pe.current!=null||le.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=()=>{ie.current!=null&&(clearTimeout(ie.current),ie.current=null),re.current=null},Ut=()=>{oe.current?.remove(),oe.current=null},Wt=()=>{Vt(ne.current),ne.current=null,ae.current=null},Gt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Kt=()=>{ce.current?.(),ce.current=null,pe.current!=null&&(clearTimeout(pe.current),pe.current=null),le.current=!1,ue.current=null,fe.current=null,de.current!=null&&(de.current.setAttribute(`draggable`,`true`),de.current.style.removeProperty(`touch-action`),de.current=null),Ut(),Ht(),Wt(),se.current=null},qt=(e,n)=>{let r=S.current?.getRootNode(),i=QL(XL(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=iR(r)?r:null;if(i==null||i.isExpanded()){Ht();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;re.current!==a&&(Ht(),re.current=a,ie.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Yt=()=>{ne.current=null;let e=ae.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=tR(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)),ne.current=Bt(Yt)},Xt=(e,t)=>{ae.current={clientX:e,clientY:t},ne.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(se.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),eR())){let t=$L(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),oe.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Qt=()=>{Ut(),Ht(),Wt(),se.current=null,t.cancelDrag()},R=(e,n,r)=>{if(pe.current!=null||le.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;fe.current={clientX:i.clientX,clientY:i.clientY},de.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!le.current;pe.current!=null&&(clearTimeout(pe.current),pe.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),ce.current===o&&(ce.current=null),t&&(a.setAttribute(`draggable`,`true`),de.current===a&&(de.current=null),fe.current=null)},s=e=>{let t=e.touches[0],n=fe.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),ce.current=o,pe.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),de.current===a&&(de.current=null),fe.current=null;return}le.current=!0,de.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),se.current=n;let e=a.getBoundingClientRect(),s=$L(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),oe.current=s,ue.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=ue.current;n!=null&&oe.current!=null&&(oe.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()};ce.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)},qL)},$t=e=>{if(F!=null){if(e.key===`Escape`){Pt(),e.preventDefault(),e.stopPropagation();return}uR.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(it.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)it.cancel();else if(e.key===`Enter`)it.commit();else return;we(`focus`),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Lt(I??void 0),e.preventDefault(),e.stopPropagation();return}if(st){if(e.key===`Escape`)ee.current=!1,te.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=rL(n,bt);te.current=L<0||n==null?null:Math.max(0,Math.min(L*s-n.scrollTop,Math.max(0,r-s))),ee.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;we(`focus`),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&oR(e)){t.openSearch(e.key),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=qe&&cR(e),r=lR(e,qe),i=r&&S.current!=null?nL(S.current):null,a=r?new Set(_R(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==I&&a.has(o)){let e=C.current;Ie(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=iR(p)?p:null,h=u!=null&&(Et.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=gR(u,E.current,T.current);e==null||n==null?y=!1:It(e,u)}else if((e.ctrlKey||e.metaKey)&&aR(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;we(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Et.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Ie(b,v?.scrollTop??null),M.current=!0,ve(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Le(b,yR(S.current,v,i,u,s,Tt,bt)),M.current=!0,ve(e=>e===b?e:b)):Fe()}he(e=>e+1),e.preventDefault(),e.stopPropagation()};ML(()=>{if(!(!f||!st)){if(Re.current){Re.current=!1;return}tL(w.current)}},[st,f]),ML(()=>{let e=x.current;switch(uL({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:at})){case`reset`:P.current=null;return;case`reveal-canonical`:at!=null&&Rt(at,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(ke.current=null,P.current=at,tL(e),e.select());return}},[xt.end,xt.start,at,Rt,Et]),ML(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=nL(e)?.dataset.itemPath??null;ve(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,nL(e)!=null){r();return}M.current=!1,ve(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,ve(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;ve(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),ML(()=>{let e=S.current;e!=null&&(vt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[vt.physical.scrollTop]),ML(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=rL(n,g);let a=()=>{let e=t.getVisibleCount(),r=iL(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),We(KL({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=iL(O.current,g),i=t.getVisibleRows(e,e)[0]??null;oL(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(()=>{ZI(ge)&&he(e=>e+1),a()}),l=()=>{Pe.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,Ee(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&Pe.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),Oe.current!=null&&y.current&&Nt.current(),Pe.current===!0){y.current=!1;return}be(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:aL(e[0]))??rL(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]),ML(()=>{qe||F==null||Pt(!1)},[Pt,qe,F]);let en=NL(()=>F==null?null:`${F.path}::${F.source}`,[F]);ML(()=>{if(en==null){m?.clearSlotContent(AA);return}let t=Oe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??fR(n.getBoundingClientRect()),close:e=>{Nt.current(e?.restoreFocus??!0)},restoreFocus:()=>{Mt.current&&jt.current(Oe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(AA,i),e?.contextMenu?.onOpen?.(t.item,r),TR(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&TR(i)}),()=>{m?.clearSlotContent(AA)}},[en,e?.contextMenu,m]),ML(()=>{F!=null&&t.getItem(F.path)==null&&Pt()},[Pt,F,t]),ML(()=>{if(F==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(dR(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Pt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Pt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Pt,F]),ML(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=I;return}let r=I==null?null:T.current.get(I)??null,i=nL(n),a=i?.dataset.itemPath??null,o=ot&&x.current===i,c=f&&w.current===i,l=ee.current&&!st,u=te.current??0,d=ke.current,p=Ae.current,m=je.current,g=Me.current,_=i!=null,v=M.current||_,y=N.current!==I,b=p!=null&&p===I&&I!=null,E=!1,O=!1;if(lt!=null&&lt.id!==k.current){k.current=lt.id;let n=lt.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,bt-s))):Tt;E=!0,O=sL(e,n,s,bt,wt,lt.offset,t)}t.clearScrollRequest(lt.id)}let A=!E&&l&&cL(e,L,s,bt,wt,u),j=!E&&d!=null&&d===I&&cL(e,L,s,bt,wt,Tt),P=!E&&m!=null&&m.path===I&&cL(e,L,s,bt,wt,m.viewportOffset),ne=!E&&g!=null&&g.path===I&&e.scrollTop!==g.scrollTop;if(ne&&(e.scrollTop=g.scrollTop),(ne||O||j||P||A||v&&y&&d!==I&&!b&&oL(e,L,s,bt,Tt))&&D.current(),E){N.current=I;return}if(!v){N.current=I;return}if(o){N.current=I;return}if(c&&!l){N.current=I;return}if(r==null){l&&L>=0&&(cL(e,L,s,bt,wt,u),D.current()),N.current=I;return}(y||l||d===I||p===I||m?.path===I||g?.path===I||a==null||a!==I)&&(tL(r),d===I&&(ke.current=null),p===I&&(Ae.current=null),m?.path===I&&(je.current=null),g?.path===I&&(Me.current=null),ee.current=!1,te.current=null),N.current=I},[t,L,I,Dt,s,ot,st,xt,bt,f,lt,h,Tt,wt,yt]);let tn=L>=0&&L>=vt.visible.startIndex&&L<=vt.visible.endIndex,nn=I!=null&&St.some(e=>UL(e.row)===I),rn=tn||nn,an=Ye&&M.current===!0&&rn?I:null,on=Ce===`pointer`?ye:null,sn=F?.path??Ne.current??on??an??ye,cn=F?.source===`right-click`;ML(()=>{y.current&&F==null||Ft(tt(sn))},[F,tt,xt,bt,Te,St,sn,Ft,yt]);let ln=PL(e=>{if(y.current||dR(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&&we(e=>e===`pointer`?e:`pointer`),be(e=>e===i?e:i)},[]),un=PL(()=>{be(null)},[]);ML(()=>{if(!ut)return;let e=()=>{Kt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Kt(),t.cancelDrag()}},[t,ut]);let dn=e=>{if(!ut||t.getDragSession()==null||le.current)return;let n=QL(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(!ut||t.getDragSession()==null||le.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Ht(),Wt(),t.setDragTarget(null))},pn=e=>{!ut||t.getDragSession()==null||le.current||(e.preventDefault(),qt(e.clientX,e.clientY),t.completeDrag(),Ut(),Ht(),Wt(),se.current=null)},mn=vt.window.height,hn=vt.window.offsetTop,gn=Math.min(0,bt-mn),_n=Math.min(0,bt-mn-Tt),vn=_e===I||ee.current,yn=I!=null&&vn&&!Dt&&L>=0?yt[L]??t.getVisibleRows(L,L)[0]??null:null,bn=yn==null?null:lL(L,s,xt,mn),xn=se.current,Sn=mt!=null&&xn!=null&&xn.path===mt&&xn.index>=xt.start&&xn.index<=xt.end,Cn=mt!=null&&xn!=null&&xn.path===mt&&!Sn&&xn.path!==yn?.path?xn:null,wn=Cn==null?null:lL(Cn.index,s,xt,mn),Tn=sR((L>=0?yt[L]??t.getVisibleRows(L,L)[0]??null:null)?.ancestorPaths.at(-1)??null),En=st&&I!=null?SR(o,I,!Dt):void 0,z=F?.path??(st?I:_e),Dn=F?.path??ye,On=tt(sn),kn=qe&&Ye&&!cn&&!ot&&On!=null&&xe!=null&&sn!=null,An=qe&&(kn||F!=null),jn=F?.anchorRect,Mn=jn==null&&On!=null&&xe!=null&&(F!=null||kn)?xe:null,Nn=jn==null?Mn==null?void 0:{top:`${Mn}px`}:{left:`${jn.left}px`,position:`fixed`,right:`auto`,top:`${jn.top}px`},Pn=cn?{opacity:`0`}:void 0,Fn=PL((e,n,r,i)=>{let a=pL({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:st,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>=vt.visible.startIndex&&n.index<=vt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,ve(e=>e===c?e:c),we(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Rt(c,{targetOffset:`sticky-parents`})},[t,st,vt.visible.endIndex,vt.visible.startIndex,Rt]),In=()=>{if(y.current||!Ye||sn==null||On==null)return;let e=t.getItem(sn);e!=null&&(Ft(On),Mt.current=!0,De({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:On.getAttribute(`aria-label`)??sn,path:e.getPath()},path:e.getPath(),source:`button`}))},Ln={contextHoverPath:Dn,contextMenuButtonTriggerEnabled:Ye,contextMenuButtonVisibility:Xe,contextMenuEnabled:qe,contextMenuRightClickEnabled:Ze,contextMenuTriggerMode:Je,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:ut,draggedPathSet:ft,dragTarget:pt,gitLaneActive:nt,gitStatusByPath:n,handleRowDragEnd:Qt,handleRowDragStart:Zt,handleRowTouchStart:R,ignoredGitDirectories:r,ignoredInheritanceCache:me,instanceId:o,itemHeight:s,onKeyDown:$t,onRowClick:Fn,openContextMenuForRow:It,registerButton:Qe,registerRenameInput:et,renameView:it,renderDecorationForRow:Ot,resolveIcon:rt,shouldSuppressContextMenu:zt,visualFocusPath:z},Rn={...Ln,registerButton:$e};return Z(`div`,{ref:S,id:ht,"data-file-tree-context-menu-button-visibility":qe&&Ye?Xe:void 0,"data-file-tree-context-menu-trigger-mode":qe?Je:void 0,"data-file-tree-has-context-menu-action-lane":qe&&Ye?`true`:void 0,"data-file-tree-has-git-lane":nt?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:ut?fn:void 0,onDragOver:ut?dn:void 0,onDrop:ut?pn:void 0,onKeyDown:$t,onPointerLeave:qe?un:void 0,onPointerOver:qe?ln: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:kA,"data-type":`header-slot`}),f?Z(`div`,{"data-file-tree-search-container":!0,"data-open":st?`true`:`false`,children:Z(`input`,{ref:w,"aria-activedescendant":En,"aria-controls":ht,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":ze?`true`:void 0,value:ct,onBlur:()=>{d===`retain`&&!Ve.current||t.closeSearch()},onFocus:He,onPointerDown:He,onInput:e=>{He();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Z(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ge&&St.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:`${gt}px`},children:St.map((e,t)=>DR(Rn,e.row,`sticky:${UL(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${St.length-t}`}}))})}):null,Z(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${wt}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:[OR(Ln,xt,Et),yn!=null&&bn!=null?DR(Ln,yn,`parked:${yn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:mt===yn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${bn}px`}}):null,Cn!=null&&wn!=null?DR(Ln,Cn,`parked-drag:${Cn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${wn}px`}}):null]})]})]}),qe?Z(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":An?`true`:`false`,style:Nn,children:[Z(`button`,{ref:v,type:`button`,"data-type":jA,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":F==null?`false`:`true`,"data-visible":kn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),F!=null){Pt();return}In()},tabIndex:-1,style:Pn,children:Z(bI,{...rt(`file-tree-icon-ellipsis`)})}),F==null?null:Z(`slot`,{name:AA})]}):null,F==null?null:Z(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Pt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Pt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var AR={hydrateRoot:(e,t)=>{hI(GF(kR,t),e)},renderRoot:(e,t)=>{mI(GF(kR,t),e)},unmountRoot:e=>{mI(null,e)}};function jR(e,t){AR.renderRoot(e,t)}function MR(e,t){AR.hydrateRoot(e,t)}function NR(e){AR.unmountRoot(e)}var PR=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 FR(e,t,n){if(!e.s){if(n instanceof IR){if(!n.s)return void(n.o=FR.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(FR.bind(null,e,t),FR.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var IR=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{FR(r,1,a(this.v))}catch(e){FR(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?FR(r,1,t?t(i):i):n?FR(r,1,n(i)):FR(r,2,i)}catch(e){FR(r,2,e)}},r},e}();Array.isArray;var LR=0;function RR(e){return e!=null&&e.length>0?e:(LR+=1,`pst_ft_${LR}`)}function zR({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??yP)}function BR(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 VR(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 HR(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var UR=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new PR;#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=RR(a),this.#p=xF(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=vP(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new gF({...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&&(NR(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=SF(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&jR(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(),jR(t.wrapper,this.#w()))}setGitStatus(e){let t=xF(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&jR(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),jR(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),MR(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),jR(r,this.#w())}#C(){return{initialViewportHeight:zR({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(kA,e());return}this.#l.setSlotHtml(kA,this.#e?.header?.html??null)}#k(e){let t=HR(e).find(e=>VR(e)),n=BR(yA(NA(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=HR(e),n=t.find(e=>VR(e)),r=t.filter(e=>e!==n),i=NA(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=BR(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=NA(this.#m);t.colored&&xA(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${TA}]`);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(TA,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=CP(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 kP(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)}},WR=`_jK _n`,GR=`<div><input type=search placeholder="Filter files…" aria-label="Filter files"></div>`,KR=` D l`,qR=h(18,e=>S(e,`b`,e.l,lz(e))),JR=M(11,qR),YR=h(10,e=>JR(e,(e.j??e.h)||``)),XR=M(17,qR),ZR=h(16,e=>XR(e,uz(e))),QR=M(15,ZR),$R=h(14,e=>QR(e,dz(e)),2),ez=o(7,e=>{YR(e),$R(e)}),tz=h(6,e=>ez(e,e.e,e.f)),nz=M(4,tz),rz=M(5,tz),iz=m(9,e=>{YR(e),$R(e)}),az=(e,t)=>cz(e,t.timer),oz=_(`l3`,e=>{E(e,`b`),u(e.b,`keydown`,function(t){t.key===`Enter`&&e.p(),t.key===`Escape`&&e.l&&(t.preventDefault(),e.r(``))})});function sz(e){b(e.a,`_jJ`),b(e.b,WR),iz(e,null),az(e,{timer:0}),oz(e)}var cz=M(13,e=>{$R(e),ZR(e)}),lz=e=>function(t){e.r(t)},uz=e=>t=>{if(e.n&&clearTimeout(e.n),!t){e.n=0,iz(e,null),ez(e,``);return}iz(e,t),e.n=setTimeout(e.p,150)},dz=e=>()=>{e.n&&=(clearTimeout(e.n),0);let t=e.j===null?e.h||``:e.j;iz(e,null),ez(e,t)};N(`l0`,lz),N(`l2`,uz),N(`l1`,dz);var fz=(e=>`<div><div title="Drag to resize"></div><div>${e}</div><div></div></div>`)(GR),pz=(e=>` D b D/${e}&l l`)(KR),mz={A:`added`,D:`deleted`,M:`modified`,R:`renamed`},hz=h(7,e=>{T(e.a,`aria-expanded`,e._._.t.has(e._.f)?`false`:`true`),b(e.b,[`_i_`,{_ja:!e._._.t.has(e._.f)}])}),gz=j(29,hz,e=>e._._),_z=_(`z4`,e=>u(e.a,`click`,function(){let t=new Set(e._._.t);t.delete(e._.f)||t.add(e._.f),Iz(e._._,t)})),vz=e=>{gz(e),yz._(e),bz._(e),xz._(e),b(e.a,`_i9`),he(e.c),de(e.c,12),Ee(e.c),b(e.d,`_jb`),b(e.f,`_jc`),_z(e)},yz=f(1,0,hz),bz=f(1,0,e=>{T(e.a,`title`,e._.h),c(e.e,e._.h)}),xz=f(1,0,e=>c(e.g,e._.j)),Sz=d(1,(e=>`<button type=button><span aria-hidden=true>${e}</span><span> </span><span> </span></button>`)(ye),(e=>` D D/${e}&l D l D m`)(Oe),vz),Cz=g(4,e=>{b(e.a,[`_i8`,{_i7:e._.m===1}]),b(e.c,[`_je`,{_jd:e._.m===1}]),Sz(e,e._.m>1?0:1)}),wz=e=>{Cz._(e),Ez._(e)},Tz=h(6,e=>T(e.c,`hidden`,e._.t.has(e.f))),Ez=g(4,Tz),Dz=M(5,e=>{T(e.a,`data-section`,e.f),T(e.c,`data-tree`,e.f),Tz(e),yz(e)}),Oz=(e,t)=>{Dz(e,t[0]?.id),kz(e,t[0]?.label),Az(e,t[0]?.files?.length)},kz=M(7,bz),Az=M(9,xz),jz=o(17,e=>nz(e.d,e.r)),Mz=h(9,e=>jz(e,e.h,e.i)),Nz=M(7,Mz),Pz=M(8,Mz),Fz=y(gz),Iz=m(19,e=>{Ez(e),Fz(e)}),Lz=M(27),Rz=h(24,e=>Lz(e,nB(e))),zz=m(20,e=>{w(e.a,e.u==null?void 0:`--tree-w:${e.u}px`),Rz(e)}),Bz=m(21,e=>b(e.b,[`_jg`,{_jf:e.v}])),Vz=(e,t)=>Kz(e,t.id),Hz=_(`z6`,e=>{u(e.b,`pointerdown`,function(t){e.z(t)}),u(e.b,`pointermove`,function(t){e.a0(t)}),u(e.b,`pointerup`,function(t){e.a1(t)}),u(e.b,`pointercancel`,function(t){e.a1(t)})});function Uz(e){b(e.c,`_i5`),sz(e.d),rz(e.d,rB(e)),b(e.e,`_i6`),Iz(e,new Set),zz(e,vt()),Bz(e,!1),Vz(e,{id:-1}),Hz(e)}var Wz=M(25),Gz=M(26),Kz=M(23,e=>{Wz(e,iB(e)),Gz(e,aB(e)),Rz(e)}),qz=(e,t)=>b(e.a,[`_i4`,{_i3:t===!1}]),Jz=a(4,`<div><!><div></div></div>`,` D%b `,wz,Oz),Yz=_(`z5`,e=>l(e,{sections:e.l,commentCounts:e.n,newKeys:e.o,onMount:function(){let t=(e,t)=>`${e.id}/${t}`,n=e=>e.files.map(e=>({path:e.path,status:mz[e.status]??`modified`})),r=e=>e.files.map(e=>`${e.path}:${e.status}`).join(`
2798
+ `),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 UR({paths:i.files.map(e=>e.path),gitStatus:n(i),initialExpansion:`open`,flattenEmptyDirectories:!0,search:!1,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)}},onUpdate:function(){let e=this.marks(this.commentCounts,this.newKeys),t=e!==this.shownMarks;this.shownMarks=e;let n=new Set(this.sections.map(e=>e.id));for(let[e,t]of this.trees)n.has(e)||(t.unsub(),t.tree.cleanUp(),this.trees.delete(e));for(let e of this.sections){let n=this.trees.get(e.id);if(!n){this.build(e);continue}let r=this.sig(e);r===n.sig?t&&n.tree.setGitStatus(this.gitStatus(e)):(n.sig=r,n.tree.resetPaths(e.files.map(e=>e.path)),n.tree.setGitStatus(this.gitStatus(e)))}},onDestroy:function(){for(let e of this.trees.values())e.unsub(),e.tree.cleanUp()}})),Xz=h(16,Yz,3),Zz=M(11,e=>{tB(e,e.l?.length),Jz(e,[e.l,`id`]),Xz(e)}),Qz=M(13,Xz),$z=M(14,Xz),eB=M(15,Xz),tB=M(12,Cz),nB=e=>t=>{t.pointerId===e.x&&(e.x=-1,Bz(e,!1),e.u!=null&&Je(e.u))},rB=e=>t=>{jz(e,t)},iB=e=>t=>{(t.pointerType!==`mouse`||t.button===0)&&(t.preventDefault(),e.x=t.pointerId,Bz(e,!0),e.b.setPointerCapture(t.pointerId))},aB=e=>t=>{if(t.pointerId!==e.x)return;let n=window.innerWidth-t.clientX;zz(e,Math.min(640,Math.max(200,n)))};N(`z2`,nB),N(`z3`,rB),N(`z0`,iB),N(`z1`,aB);var oB=`_iC _ba`,sB=`<!><!><!>`,cB=e=>b(e.a,`_iF`),lB=e=>{VS(e.a),HS(e.a,12),US(e.a,`_iH`)},uB=e=>b(e.a,[`_A`,`_iG`]),dB=f(1,0,e=>{T(e.a,`title`,e._.f),c(e.b,e._.f)}),fB=e=>{dB._(e),b(e.a,oB)},pB=d(6,zS,(e=>`/${e}&`)(BS),lB),mB=h(11,e=>pB(e,+!e._._._._.w.has(e.k))),hB=j(29,mB,e=>e._._._._),gB=_(`i2`,e=>u(e.a,`click`,function(){JB(e._._._._,!1)})),_B=e=>{hB(e),bB(e),SB(e),b(e.a,[`_iB`,`_y`]),b(e.b,`__`),b(e.d,`_iD`),gB(e)},vB=d(5,`<span title="Changed since your last visit"></span>`,` `,uB),yB=h(12,e=>vB(e,+!e._._._._.x.has(e.k))),bB=j(30,yB,e=>e._._._._),xB=h(13,e=>T(e.a,`href`,e._._._._.z(e.k))),SB=j(32,xB,e=>e._._._._),CB=M(10,e=>{xB(e),yB(e),mB(e)}),wB=(e,t)=>{T(e.b,`data-status`,t),c(e.c,t)},TB=(e,t)=>c(e.e,t),EB=(e,t)=>{CB(e,(t?.[0]).file?.key),wB(e,(t?.[0]).file?.status),TB(e,(t?.[0]).name)},DB=e=>b(e.a,`_iA`),OB=d(1,`<div><bdi><!>/</bdi></div>`,` E%`,fB),kB=M(5,e=>{OB(e,+!e.f),dB(e)}),AB=a(2,`<a><span> </span><span><bdi> </bdi></span><!><!></a>`,` D D l E m%b%`,_B,EB),jB=(e,t)=>AB(e,[t,e=>e.file.key]),MB=(e,t)=>{kB(e,(t?.[0]).dir),jB(e,(t?.[0]).files)},NB=e=>{b(e.a,`_iy`),b(e.b,`_iz`)},PB=(e,t)=>c(e.c,t),FB=a(3,`<div><!><!></div>`,` D%b%`,DB,MB),IB=(e,t)=>FB(e,[t,`dir`]),LB=(e,t)=>{PB(e,t[0]?.repo),IB(e,t[0]?.dirs)},RB=d(13,`<p>No files match.</p>`,` `,cB),zB=h(14,e=>c(e.g,e._.n===e._.y?``:` / ${e._.y}`)),BB=f(0,0,e=>{c(e.f,e._.n),RB(e,+!!e._.n),zB(e)}),VB=_(`i3`,e=>{u(e.a,`click`,function(){JB(e._,!1)}),u(e.h,`click`,function(){JB(e._,!1)})}),HB=e=>{BB._(e),UB._(e),WB._(e),KB._(e),b(e.a,`_it`),b(e.b,`_iu`),b(e.c,`_iv`),b(e.d,`_is`),b(e.e,`_iw`),b(e.h,[zt,`_ir`]),oe(e.i),je(e.i,16),Ft(e.i),b(e.j,`_iE`),sz(e.k),rz(e.k,gV(e)),b(e.l,`_ix`),VB(e)},UB=f(0,0,e=>nz(e.k,e._.u)),WB=f(0,0,zB),GB=a(12,`<div><div> </div><!></div>`,` D D l%`,NB,LB),KB=f(0,0,e=>GB(e,[e._.a0,`repo`])),qB=d(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>`)(Nt,GR),((e,t)=>` b D D b D%b%l D/${e}&m D/${t}&l D%b%m`)(Ne,KR),HB),JB=o(18,e=>qB(e,+!e.s)),YB=h(5,e=>JB(e,e.d,e.e)),XB=M(3,YB),ZB=M(4,YB),QB=o(20,UB),$B=h(8,e=>QB(e,e.g,e.h)),eV=M(6,$B),tV=M(7,$B),nV=M(22,y(hB)),rV=(e,t)=>nV(e,t||new Set),iV=M(23,y(bB)),aV=(e,t)=>iV(e,t||new Set),oV=M(24,WB),sV=h(14,e=>oV(e,e.l??e.n)),cV=M(11,sV),lV=M(13,e=>{sV(e),BB(e)}),uV=M(25,y(SB)),dV=h(17,e=>uV(e,_V(e))),fV=M(15,dV),pV=M(16,dV),mV=M(26,KB),hV=(e,t)=>{lV(e,t?.length),mV(e,(()=>{let e=[],n=new Map;for(let r of t){let t=r.key.slice(0,r.key.indexOf(`/`)).replace(`#`,` #`),i=r.label.slice(r.label.indexOf(`/`)+1),a=i.lastIndexOf(`/`),o=a<0?``:i.slice(0,a),s=a<0?i:i.slice(a+1),c=n.get(t);c||(n.set(t,c=new Map),e.push({repo:t,dirs:[]}));let l=c.get(o);l||(c.set(o,l={dir:o,files:[]}),e[e.length-1].dirs.push(l)),l.files.push({file:r,name:s})}return e})())},gV=e=>t=>{QB(e._,t)},_V=e=>t=>De({workspaceId:e.p,view:`diff`,scope:e.q??null,file:t});N(`i1`,gV),N(`i0`,_V);var vV=((e,t,n,r,i,a)=>`<div><div><div><div><div><!><h1>Review</h1><!></div><div><!><button title="Refresh diff">${e}</button><!><span><button aria-label=Compare>${t}</button><select aria-label=Compare tabindex=-1><option value=committed>Committed</option><option value=working>Working tree</option><option value=dirty>Uncommitted</option><!></select></span> <div>${n}</div><!></div><!>${r}</div><div><!><!><!><!></div></div><div data-diff-main></div></div>${i}${a}</div>`)(yt,pt,lw,xD,fz,sB),yV=((e,t,n,r,i,a)=>` D D D D D%b b%l D%b D/${e}&l%b D D/${t}&l Dd%mb D0${n}&l%l%b/${r}&l D%b%b%b%m l/${i}&/${a}&l`)(it,I,uw,`b%c`,pz,`b%c`);function bV(e){return e.split(`
2799
2799
  `).filter(e=>e[0]===`+`||e[0]===`-`).join(`
2800
- `)}var xV=p(0,`<div><div></div><div></div></div>`,` D b `,e=>{b(e.a,`_hi`),b(e.b,[`_hh`,`_hj`]),b(e.c,[`_hh`,`_hk`])}),SV=e=>{b(e.a,`_hg`),xV(e,[2,0,1])},CV=e=>{b(e.a,`_hl`),b(e.b,[`_hh`,`_hm`]),b(e.c,[`_hh`,`_hn`])},wV=(e,t)=>T(e.a,`value`,`rev:${t}`),TV=(e,t)=>c(e.b,t),EV=a(0,`<option> </option>`,` D `,0,(e,t)=>{wV(e,t[0]?.sha),TV(e,t[0]?.label)}),DV=f(17,0,e=>EV(e,[e._.de,`sha`])),OV=DV,kV=f(21,0,e=>T(e.a,`hidden`,e._.bb)),AV=_(`A43`,e=>u(e.a,`click`,function(){e._.e9()})),jV=e=>{kV._(e),b(e.a,[ie,`_g_`,`_g2`]),ve(e.b),fe(e.b,14),Ie(e.b),AV(e)},MV=f(12,0,e=>{T(e.a,`title`,`Jump to file (${e._.d4})`),T(e.a,`aria-label`,`Jump to file (${e._.d4} files)`),c(e.e,e._.d4>99?`99+`:e._.d4)}),NV=_(`A41`,e=>u(e.a,`click`,function(){KU(e._,!0)})),PV=e=>{MV._(e),b(e.a,[ie,`_g2`,`_ho`]),b(e.b,`_hp`),XC(e.c),ZC(e.c,20),QC(e.c,`_hq`),b(e.d,`_hr`),NV(e)},FV=f(9,0,e=>{b(e.a,[IS,`_g2`,{_g1:e._.b9}]),T(e.a,`title`,e._.b9?`Hide file tree`:`Show file tree`)}),IV=_(`A40`,e=>u(e.a,`click`,function(){GU(e._,!e._.b9),Dt(e._.b9)})),LV=e=>{FV._(e),le(e.b),Me(e.b,14),jt(e.b),IV(e)},RV=h(2,e=>c(e.b,e._.b8?`This commit is not in any of these repos.`:e._.co.some(e=>e.unborn)?`No commits yet.`:e._.b7===`dirty`?`Nothing uncommitted.`:e._.co.some(e=>e.pr)?`No file changes on these PRs.`:`No changes vs base.`),2),zV=f(28,0,RV),BV=e=>{zV._(e),VV._(e),HV._(e),b(e.a,`_cj`)},VV=f(28,0,RV),HV=f(28,0,RV),UV=j(195,e=>c(e.b,e._._.b7===`committed`?``:`, showing uncommitted changes only`),e=>e._._),WV=e=>{UV(e),GV(e)},GV=j(5,e=>c(e.a,e._.e)),KV=x(`A45`,`<!><!>.`,`%b%`,WV),qV=e=>{Be(e.a),Ye(e.a,KV(e)),L(e.a,`warn`),nt(e.a,`inline`),Ot(e.a),mt(e.a),et(e.a),$e(e.a,{})},JV=(e,t)=>Lt(e.a,`${t}: base not found`),YV=(e,t)=>{JV(e,t[0]?.worktree),XV(e,t[0]?.base)},XV=M(4,y(GV)),ZV=h(2,e=>c(e.b,e._.bi.trim()?`No matches in review.`:e._.b6&&!e._.b3?`Nothing changed since your last visit.`:`No files match "${e._.b3}".`),2),QV=f(28,1,ZV),$V=e=>{QV._(e),eH._(e),tH._(e),b(e.a,`_cj`)},eH=f(28,1,ZV),tH=f(28,1,ZV),nH=j(192,e=>c(e.a,e._._.b0),e=>e._._),rH=x(`A44`,` `,` `,nH),iH=e=>{Be(e.a),Ye(e.a,rH(e)),et(e.a,CG(e)),Ot(e.a),mt(e.a),L(e.a),nt(e.a),Lt(e.a),$e(e.a,{})},aH=f(7,0,e=>IC(e.b,e._.ar)),oH=e=>{aH._(e),sH._(e),cH._(e),lH._(e),b(e.a,`_g8`),MC(e.b)},sH=f(7,0,e=>UC(e.b,e._.ay)),cH=f(7,0,e=>GC(e.b,e._.e5)),lH=f(7,0,e=>WC(e.b,e._.e6)),uH=f(5,0,e=>T(e.a,`href`,`/w/${e._.a8}`)),dH=e=>{uH._(e),b(e.a,[ie,`_g7`]),ze(e.b),Le(e.b,14),Re(e.b)},fH=r(`A39`,182),pH=(e,t)=>ok(e.x,t),mH=_(`A46`,e=>l(e,{active:e.ak,load:e.ca,findOpen:e.bb,shownFiles:e.d2,commentsByFile:e.d6,draft:e.az,sessions:e.ar,collapsedFiles:e.bm,repos:e.au,onMount:function(){let t=new AbortController,n=()=>e.ar||[],r=(t,n=!0)=>{let r=e.a3,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 Mt(`/api/workspaces/${e.a8}/diff/contents?${i}`)).contents},o={viewer:null},s={key:null,top:null},c=new Map,l,u={draft:!0},d,f=e=>{let t=c.get(e.id);return(!t||t.comment.text!==e.text)&&(t={comment:e}),c.set(e.id,t),t},p=e=>(l!==e&&(l=e,u={draft:!0},d=void 0),u),m=(e,t,n)=>{let r=[];for(let e of t)r.push({side:e.side,lineNumber:e.line_end,metadata:f(e)});return n&&n.key===e&&r.push({side:n.side===`deletions`?`deletions`:`additions`,lineNumber:n.end,metadata:p(n)}),r},h=(e,t,n,r)=>{let i=r?[r]:[];for(let e of t)i.push({lineNumber:0,metadata:f(e)});return n&&n.key===e&&i.push({lineNumber:0,metadata:p(n)}),i.length?i:void 0},g=(e,t,n)=>e.map(e=>`${e.id}:${e.text.length}`).join(`,`)+(t&&t.key===n?`|d${t.side}${t.start}-${t.end}`:``),_=new Map,v=new WeakMap,y=(t,n,r,i)=>{let a=new URLSearchParams({worktree:t,path:n,rev:r});return i&&a.set(`v`,i),`/api/workspaces/${e.a8}/diff/blob?${a}`},b=(t,n)=>{let r=t.binary?Hx(t.path)?.kind:void 0;if(!r||!n)return;let i=e.dp(t.repo),a=t.status===`A`,o=t.status===`D`,s=[];if(!a&&n.oldRev&&s.push({label:o?`Deleted`:`Before`,src:y(i,t.oldPath||t.path,n.oldRev)}),!o&&n.newRev&&s.push({label:a?`Added`:`After`,src:y(i,t.path,n.newRev,t.hash)}),!s.length)return;let c=s.map(e=>e.src).join(` `),l=_.get(t.key);return(!l||l.sig!==c)&&(l={sig:c,meta:{preview:{kind:r,name:t.path,sides:s}}},_.set(t.key,l)),{lineNumber:0,metadata:l.meta}},x=t=>{RU(e,{key:t,side:`additions`,start:0,end:0})},S=(t,n)=>{if(!t)return;let r=t.endSide!=null&&t.endSide!==t.side;RU(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)})},C={theme:{dark:`pierre-dark`,light:`pierre-light`},themeType:St(),diffStyle:gt()?`unified`:`split`,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:44},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; } }`+gS,async loadDiffFiles(t){let n=i.get(t),r=(e.au||[]).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)]);if(o==null||s==null)throw VU(e,`${n.path} is too large to expand.`),Error(`diff contents unavailable`);if(t.type!==`new`&&!yx(t,`deletions`,o)||t.type!==`deleted`&&!yx(t,`additions`,s))throw VU(e,`${n.path} has changed since this diff was taken — refresh to expand it.`),Error(`diff contents out of date`);return{oldFile:{name:t.prevName||t.name,contents:o},newFile:{name:t.name,contents:s}}},renderCustomHeader(t,n){let r=n.item,i=e.ds(r.id),a=document.createElement(`div`);a.className=`_hu${r.collapsed?` _hv`:``}`;let c=i?.label??r.id;a.title=c;let l=document.createElement(`span`);l.className=`_hw`,l.textContent=`▾`;let u=document.createElement(`span`);u.className=`__`;let d=i?.status||(r.type===`diff`?r.fileDiff.type[0].toUpperCase():`M`);u.dataset.status=d,u.textContent=d;let f=document.createElement(`span`);f.className=`_hx`;let p=document.createElement(`bdi`);if(p.textContent=c,f.append(p),a.append(l,u,f),i?.changedSince){let e=document.createElement(`span`);e.className=`_A _hB`,e.title=`Changed since your last visit`,a.append(e)}let m=i&&e.d6.get(i.label)?.length||0;if(r.type===`file`){let t=document.createElement(`button`);t.type=`button`,t.className=RS,t.textContent=m?`✎ ${m}`:`✎`,t.title=m?`${m} comment${m>1?`s`:``} — add another`:`Comment on this file`,t.setAttribute(`aria-label`,`Comment on this file`),t.onclick=t=>{t.stopPropagation();let n=new Set(e.bm);n.delete(r.id)&&$U(e,n),x(r.id)},a.append(t)}else if(m){let e=document.createElement(`span`);e.className=`_u`,e.textContent=`✎ ${m}`,a.append(e)}if(i&&(i.additions||i.deletions)){let e=document.createElement(`span`);e.className=`_hy`;let t=document.createElement(`span`);t.className=`_hz`,t.textContent=`+${i.additions||0}`;let n=document.createElement(`span`);n.className=`_hA`,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.bm);t.delete(r.id)||t.add(r.id),$U(e,t)},a},renderAnnotation(t,i){let a=t.metadata||{},o=i.item.id;if(a.preview){let e=v.get(a);return e||v.set(a,e=tS(a.preview)),e}if(a.draft)return d??=Xx({sessions:n,reveal:r},{onSave:t=>e.du(o,t),onSend:(t,n)=>e.e8(o,t,n),onCancel:()=>{RU(e,null)}});let s=a.comment;if(!s)return;let c=i.item.type===`diff`?i.item.fileDiff:null,l=s.snippet!=null&&!!c&&bV(xx(c,s.side,s.line_start,s.line_end))!==bV(s.snippet);return Yx(s,{sessions:n,reveal:r},{onDelete:t=>e.dx(t),onEdit:(t,n)=>e.dy(t,n),onSend:(t,n)=>e.e7(t,n),drifted:l})},onLineSelectionEnd(e,t){t.item.type===`file`?x(t.item.id):S(e,t.item.id)},onPostRender(e,t,n,r){let i=e;if(n===`unmount`){w.get(i)?.(),w.delete(i);return}w.has(i)?OS(i):w.set(i,DS(i,r.item.id))}},w=new Map,T=new Yb(C,Lx());o.viewer=T,T.setup(e.a3);let E=Ke(e=>{C.themeType=e,T.setOptions({...C})});_e()&&Bx(()=>e.a3,t.signal),e.bu.scrollToItem=t=>{D.recs.has(t)&&(e.c2=null,T.scrollTo({type:`item`,id:t,align:`start`,behavior:`instant`}))},e.bu.scrollToLine=(e,t,n)=>T.scrollTo({type:`line`,id:e,lineNumber:t,side:n||`additions`,align:`center`,behavior:`instant`}),e.bu.clearSelection=()=>T.clearSelectedLines();let D={abort:t,viewer:T,unregTheme:E,unsubScroll:T.subscribeToScroll(t=>{e.by||=requestAnimationFrame(()=>{e.by=0;let n=null;for(let r of T.getRenderedItems()){let i=T.getTopForItem(r.id);i==null||i>t+1||(!n||i>(T.getTopForItem(n.key)??-1))&&(n={scope:e.b7,key:r.id,off:Math.round(t-i)})}t>0&&(e.bw=n);let r=n?.key??T.getRenderedItems()[0]?.id,i=r&&e.ds(r)?.repo;i&&i!==e.bn&&eW(e,i)})}),hostUnregs:w,loaded:!1,wasActive:!1,lastNonce:e.as||0,lastFileNonce:e.at||0,recs:new Map,order:``,revealedDraft:null,dockedOpen:!1,start:()=>{this.active&&!D.loaded&&(D.loaded=!0,this.load())},pin:t=>{let n=e.a3,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||!D.recs.has(t.key))return;let e=D.viewer.getTopForItem(t.key);if(e!=null){let n=e+t.off;Math.abs(D.viewer.getScrollTop()-n)>1&&D.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 a of this.shownFiles){n.add(a.key);let o=D.recs.get(a.key),s=o&&o.patch===a.patch&&o.status===a.status?o.fileDiff:hx(a,a.key),c=this.commentsByFile.get(a.label)||[],l=s?void 0:b(a,(this.repos||[]).find(e=>e.id===a.repo)),u=g(c,this.draft,a.key)+(l?`|p${_.get(a.key).sig}`:``),d=s?void 0:h(a.key,c,this.draft,l),f=this.collapsedFiles.has(a.key);s&&i.set(s,{worktree:e.dp(a.repo),path:a.path,repo:a.repo});let p={name:a.path,contents:l?` `:a.binary?`(binary file)`:a.tooLarge?`(file too large to display)`:`(file could not be read)`},v=o;!v||v.item.type===`diff`!=!!s?(v={item:s?{id:a.key,type:`diff`,fileDiff:s,annotations:m(a.key,c,this.draft),collapsed:f,version:(v?.item.version??0)+1}:{id:a.key,type:`file`,file:p,annotations:d,collapsed:f,version:(v?.item.version??0)+1},fileDiff:s,annSig:u,collapsed:f,patch:a.patch,status:a.status},D.recs.set(a.key,v),r=!0):(v.fileDiff!==s||v.annSig!==u||v.collapsed!==f)&&(v.item.type===`diff`&&s?(v.item.fileDiff=s,v.item.annotations=m(a.key,c,this.draft)):v.item.type===`file`&&(v.item.file.contents!==p.contents&&(v.item.file=p),v.item.annotations=d),v.item.collapsed=f,v.item.version=(v.item.version??0)+1,v.fileDiff=s,v.annSig=u,v.collapsed=f,v.patch=a.patch,v.status=a.status,r||D.viewer.updateItem(v.item)),t.push(v.item)}for(let e of[...D.recs.keys()])n.has(e)||D.recs.delete(e);let a=t.map(e=>e.id).join(`
2800
+ `)}var xV=p(0,`<div><div></div><div></div></div>`,` D b `,e=>{b(e.a,`_fg`),b(e.b,[`_ff`,`_fh`]),b(e.c,[`_ff`,`_fi`])}),SV=e=>{b(e.a,`_fe`),xV(e,[2,0,1])},CV=e=>{b(e.a,`_fj`),b(e.b,[`_ff`,`_fk`]),b(e.c,[`_ff`,`_fl`])},wV=(e,t)=>T(e.a,`value`,`rev:${t}`),TV=(e,t)=>c(e.b,t),EV=a(0,`<option> </option>`,` D `,0,(e,t)=>{wV(e,t[0]?.sha),TV(e,t[0]?.label)}),DV=f(17,0,e=>EV(e,[e._.de,`sha`])),OV=DV,kV=f(21,0,e=>T(e.a,`hidden`,e._.bb)),AV=_(`A43`,e=>u(e.a,`click`,function(){e._.e9()})),jV=e=>{kV._(e),b(e.a,[ie,`_e8`,`_e0`]),ve(e.b),fe(e.b,14),Ie(e.b),AV(e)},MV=f(12,0,e=>{T(e.a,`title`,`Jump to file (${e._.d4})`),T(e.a,`aria-label`,`Jump to file (${e._.d4} files)`),c(e.e,e._.d4>99?`99+`:e._.d4)}),NV=_(`A41`,e=>u(e.a,`click`,function(){KU(e._,!0)})),PV=e=>{MV._(e),b(e.a,[ie,`_e0`,`_fm`]),b(e.b,`_fn`),XC(e.c),ZC(e.c,20),QC(e.c,`_fo`),b(e.d,`_fp`),NV(e)},FV=f(9,0,e=>{b(e.a,[IS,`_e0`,{_eZ:e._.b9}]),T(e.a,`title`,e._.b9?`Hide file tree`:`Show file tree`)}),IV=_(`A40`,e=>u(e.a,`click`,function(){GU(e._,!e._.b9),Dt(e._.b9)})),LV=e=>{FV._(e),le(e.b),Me(e.b,14),jt(e.b),IV(e)},RV=h(2,e=>c(e.b,e._.b8?`This commit is not in any of these repos.`:e._.co.some(e=>e.unborn)?`No commits yet.`:e._.b7===`dirty`?`Nothing uncommitted.`:e._.co.some(e=>e.pr)?`No file changes on these PRs.`:`No changes vs base.`),2),zV=f(28,0,RV),BV=e=>{zV._(e),VV._(e),HV._(e),b(e.a,`_b6`)},VV=f(28,0,RV),HV=f(28,0,RV),UV=j(195,e=>c(e.b,e._._.b7===`committed`?``:`, showing uncommitted changes only`),e=>e._._),WV=e=>{UV(e),GV(e)},GV=j(5,e=>c(e.a,e._.e)),KV=x(`A45`,`<!><!>.`,`%b%`,WV),qV=e=>{Be(e.a),Ye(e.a,KV(e)),L(e.a,`warn`),nt(e.a,`inline`),Ot(e.a),mt(e.a),et(e.a),$e(e.a,{})},JV=(e,t)=>Lt(e.a,`${t}: base not found`),YV=(e,t)=>{JV(e,t[0]?.worktree),XV(e,t[0]?.base)},XV=M(4,y(GV)),ZV=h(2,e=>c(e.b,e._.bi.trim()?`No matches in review.`:e._.b6&&!e._.b3?`Nothing changed since your last visit.`:`No files match "${e._.b3}".`),2),QV=f(28,1,ZV),$V=e=>{QV._(e),eH._(e),tH._(e),b(e.a,`_b6`)},eH=f(28,1,ZV),tH=f(28,1,ZV),nH=j(192,e=>c(e.a,e._._.b0),e=>e._._),rH=x(`A44`,` `,` `,nH),iH=e=>{Be(e.a),Ye(e.a,rH(e)),et(e.a,CG(e)),Ot(e.a),mt(e.a),L(e.a),nt(e.a),Lt(e.a),$e(e.a,{})},aH=f(7,0,e=>IC(e.b,e._.ar)),oH=e=>{aH._(e),sH._(e),cH._(e),lH._(e),b(e.a,`_e6`),MC(e.b)},sH=f(7,0,e=>UC(e.b,e._.ay)),cH=f(7,0,e=>GC(e.b,e._.e5)),lH=f(7,0,e=>WC(e.b,e._.e6)),uH=f(5,0,e=>T(e.a,`href`,`/w/${e._.a8}`)),dH=e=>{uH._(e),b(e.a,[ie,`_e5`]),ze(e.b),Le(e.b,14),Re(e.b)},fH=r(`A39`,182),pH=(e,t)=>ok(e.x,t),mH=_(`A46`,e=>l(e,{active:e.ak,load:e.ca,findOpen:e.bb,shownFiles:e.d2,commentsByFile:e.d6,draft:e.az,sessions:e.ar,collapsedFiles:e.bm,repos:e.au,onMount:function(){let t=new AbortController,n=()=>e.ar||[],r=(t,n=!0)=>{let r=e.a3,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 Mt(`/api/workspaces/${e.a8}/diff/contents?${i}`)).contents},o={viewer:null},s={key:null,top:null},c=new Map,l,u={draft:!0},d,f=e=>{let t=c.get(e.id);return(!t||t.comment.text!==e.text)&&(t={comment:e}),c.set(e.id,t),t},p=e=>(l!==e&&(l=e,u={draft:!0},d=void 0),u),m=(e,t,n)=>{let r=[];for(let e of t)r.push({side:e.side,lineNumber:e.line_end,metadata:f(e)});return n&&n.key===e&&r.push({side:n.side===`deletions`?`deletions`:`additions`,lineNumber:n.end,metadata:p(n)}),r},h=(e,t,n,r)=>{let i=r?[r]:[];for(let e of t)i.push({lineNumber:0,metadata:f(e)});return n&&n.key===e&&i.push({lineNumber:0,metadata:p(n)}),i.length?i:void 0},g=(e,t,n)=>e.map(e=>`${e.id}:${e.text.length}`).join(`,`)+(t&&t.key===n?`|d${t.side}${t.start}-${t.end}`:``),_=new Map,v=new WeakMap,y=(t,n,r,i)=>{let a=new URLSearchParams({worktree:t,path:n,rev:r});return i&&a.set(`v`,i),`/api/workspaces/${e.a8}/diff/blob?${a}`},b=(t,n)=>{let r=t.binary?Hx(t.path)?.kind:void 0;if(!r||!n)return;let i=e.dp(t.repo),a=t.status===`A`,o=t.status===`D`,s=[];if(!a&&n.oldRev&&s.push({label:o?`Deleted`:`Before`,src:y(i,t.oldPath||t.path,n.oldRev)}),!o&&n.newRev&&s.push({label:a?`Added`:`After`,src:y(i,t.path,n.newRev,t.hash)}),!s.length)return;let c=s.map(e=>e.src).join(` `),l=_.get(t.key);return(!l||l.sig!==c)&&(l={sig:c,meta:{preview:{kind:r,name:t.path,sides:s}}},_.set(t.key,l)),{lineNumber:0,metadata:l.meta}},x=t=>{RU(e,{key:t,side:`additions`,start:0,end:0})},S=(t,n)=>{if(!t)return;let r=t.endSide!=null&&t.endSide!==t.side;RU(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)})},C={theme:{dark:`pierre-dark`,light:`pierre-light`},themeType:St(),diffStyle:gt()?`unified`:`split`,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:44},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; } }`+gS,async loadDiffFiles(t){let n=i.get(t),r=(e.au||[]).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)]);if(o==null||s==null)throw VU(e,`${n.path} is too large to expand.`),Error(`diff contents unavailable`);if(t.type!==`new`&&!yx(t,`deletions`,o)||t.type!==`deleted`&&!yx(t,`additions`,s))throw VU(e,`${n.path} has changed since this diff was taken — refresh to expand it.`),Error(`diff contents out of date`);return{oldFile:{name:t.prevName||t.name,contents:o},newFile:{name:t.name,contents:s}}},renderCustomHeader(t,n){let r=n.item,i=e.ds(r.id),a=document.createElement(`div`);a.className=`_fs${r.collapsed?` _ft`:``}`;let c=i?.label??r.id;a.title=c;let l=document.createElement(`span`);l.className=`_fu`,l.textContent=`▾`;let u=document.createElement(`span`);u.className=`__`;let d=i?.status||(r.type===`diff`?r.fileDiff.type[0].toUpperCase():`M`);u.dataset.status=d,u.textContent=d;let f=document.createElement(`span`);f.className=`_fv`;let p=document.createElement(`bdi`);if(p.textContent=c,f.append(p),a.append(l,u,f),i?.changedSince){let e=document.createElement(`span`);e.className=`_A _fz`,e.title=`Changed since your last visit`,a.append(e)}let m=i&&e.d6.get(i.label)?.length||0;if(r.type===`file`){let t=document.createElement(`button`);t.type=`button`,t.className=RS,t.textContent=m?`✎ ${m}`:`✎`,t.title=m?`${m} comment${m>1?`s`:``} — add another`:`Comment on this file`,t.setAttribute(`aria-label`,`Comment on this file`),t.onclick=t=>{t.stopPropagation();let n=new Set(e.bm);n.delete(r.id)&&$U(e,n),x(r.id)},a.append(t)}else if(m){let e=document.createElement(`span`);e.className=`_u`,e.textContent=`✎ ${m}`,a.append(e)}if(i&&(i.additions||i.deletions)){let e=document.createElement(`span`);e.className=`_fw`;let t=document.createElement(`span`);t.className=`_fx`,t.textContent=`+${i.additions||0}`;let n=document.createElement(`span`);n.className=`_fy`,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.bm);t.delete(r.id)||t.add(r.id),$U(e,t)},a},renderAnnotation(t,i){let a=t.metadata||{},o=i.item.id;if(a.preview){let e=v.get(a);return e||v.set(a,e=tS(a.preview)),e}if(a.draft)return d??=Xx({sessions:n,reveal:r},{onSave:t=>e.du(o,t),onSend:(t,n)=>e.e8(o,t,n),onCancel:()=>{RU(e,null)}});let s=a.comment;if(!s)return;let c=i.item.type===`diff`?i.item.fileDiff:null,l=s.snippet!=null&&!!c&&bV(xx(c,s.side,s.line_start,s.line_end))!==bV(s.snippet);return Yx(s,{sessions:n,reveal:r},{onDelete:t=>e.dx(t),onEdit:(t,n)=>e.dy(t,n),onSend:(t,n)=>e.e7(t,n),drifted:l})},onLineSelectionEnd(e,t){t.item.type===`file`?x(t.item.id):S(e,t.item.id)},onPostRender(e,t,n,r){let i=e;if(n===`unmount`){w.get(i)?.(),w.delete(i);return}w.has(i)?OS(i):w.set(i,DS(i,r.item.id))}},w=new Map,T=new Yb(C,Lx());o.viewer=T,T.setup(e.a3);let E=Ke(e=>{C.themeType=e,T.setOptions({...C})});_e()&&Bx(()=>e.a3,t.signal),e.bu.scrollToItem=t=>{D.recs.has(t)&&(e.c2=null,T.scrollTo({type:`item`,id:t,align:`start`,behavior:`instant`}))},e.bu.scrollToLine=(e,t,n)=>T.scrollTo({type:`line`,id:e,lineNumber:t,side:n||`additions`,align:`center`,behavior:`instant`}),e.bu.clearSelection=()=>T.clearSelectedLines();let D={abort:t,viewer:T,unregTheme:E,unsubScroll:T.subscribeToScroll(t=>{e.by||=requestAnimationFrame(()=>{e.by=0;let n=null;for(let r of T.getRenderedItems()){let i=T.getTopForItem(r.id);i==null||i>t+1||(!n||i>(T.getTopForItem(n.key)??-1))&&(n={scope:e.b7,key:r.id,off:Math.round(t-i)})}t>0&&(e.bw=n);let r=n?.key??T.getRenderedItems()[0]?.id,i=r&&e.ds(r)?.repo;i&&i!==e.bn&&eW(e,i)})}),hostUnregs:w,loaded:!1,wasActive:!1,lastNonce:e.as||0,lastFileNonce:e.at||0,recs:new Map,order:``,revealedDraft:null,dockedOpen:!1,start:()=>{this.active&&!D.loaded&&(D.loaded=!0,this.load())},pin:t=>{let n=e.a3,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||!D.recs.has(t.key))return;let e=D.viewer.getTopForItem(t.key);if(e!=null){let n=e+t.off;Math.abs(D.viewer.getScrollTop()-n)>1&&D.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 a of this.shownFiles){n.add(a.key);let o=D.recs.get(a.key),s=o&&o.patch===a.patch&&o.status===a.status?o.fileDiff:hx(a,a.key),c=this.commentsByFile.get(a.label)||[],l=s?void 0:b(a,(this.repos||[]).find(e=>e.id===a.repo)),u=g(c,this.draft,a.key)+(l?`|p${_.get(a.key).sig}`:``),d=s?void 0:h(a.key,c,this.draft,l),f=this.collapsedFiles.has(a.key);s&&i.set(s,{worktree:e.dp(a.repo),path:a.path,repo:a.repo});let p={name:a.path,contents:l?` `:a.binary?`(binary file)`:a.tooLarge?`(file too large to display)`:`(file could not be read)`},v=o;!v||v.item.type===`diff`!=!!s?(v={item:s?{id:a.key,type:`diff`,fileDiff:s,annotations:m(a.key,c,this.draft),collapsed:f,version:(v?.item.version??0)+1}:{id:a.key,type:`file`,file:p,annotations:d,collapsed:f,version:(v?.item.version??0)+1},fileDiff:s,annSig:u,collapsed:f,patch:a.patch,status:a.status},D.recs.set(a.key,v),r=!0):(v.fileDiff!==s||v.annSig!==u||v.collapsed!==f)&&(v.item.type===`diff`&&s?(v.item.fileDiff=s,v.item.annotations=m(a.key,c,this.draft)):v.item.type===`file`&&(v.item.file.contents!==p.contents&&(v.item.file=p),v.item.annotations=d),v.item.collapsed=f,v.item.version=(v.item.version??0)+1,v.fileDiff=s,v.annSig=u,v.collapsed=f,v.patch=a.patch,v.status=a.status,r||D.viewer.updateItem(v.item)),t.push(v.item)}for(let e of[...D.recs.keys()])n.has(e)||D.recs.delete(e);let a=t.map(e=>e.id).join(`
2801
2801
  `);if((r||a!==D.order)&&(D.order=a,D.viewer.setItems(t)),s.key){let{key:e,top:t}=s;s.key=null,t!=null&&t<D.viewer.getScrollTop()&&D.viewer.scrollTo({type:`item`,id:e,align:`start`,behavior:`instant`})}let o=this.draft;o&&o!==D.revealedDraft&&D.recs.has(o.key)&&(D.revealedDraft=o,D.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.c0;c&&D.recs.has(c.key)&&(e.c0=null,D.pin(c)),e.c2&&D.recs.has(e.c2)&&e.bu.scrollToItem(e.c2)}};return D.wasActive=!!this.active,this.findOpen&&(D.dockedOpen=!0,e.eh(!0)),Ae().addEventListener(`review.changed`,t=>{D.loaded&&t.data?.workspaceId===e.a8&&e.ch()},{signal:t.signal}),Ae().addEventListener(`status.changed`,t=>{if(!this.active||!D.loaded||e.b1)return;let n=t.data,r=n&&n[e.a8];if(!r)return;let i=px(r);!i||!e.bq||i===e.bq||e.cg()},{signal:t.signal}),window.addEventListener(`pagehide`,()=>{this.active&&D.loaded&&(e.cn(),e.c6())},{signal:t.signal}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&this.active&&D.loaded&&e.c6()},{signal:t.signal}),D.start(),D},onUpdate:function(){this.start(),this.active&&this.loaded&&!this.wasActive&&e.cf(),!this.active&&this.loaded&&this.wasActive&&(e.cn(),e.c6()),this.wasActive=!!this.active,!!this.findOpen!==this.dockedOpen&&(this.dockedOpen=!!this.findOpen,e.eh(this.dockedOpen));let t=e.as||0;this.loaded&&e.ai&&t!==this.lastNonce&&e.c8(e.ai),this.lastNonce=t;let n=e.at||0;this.loaded&&e.aj&&n!==this.lastFileNonce?(e.c7(e.aj),this.lastFileNonce=n):this.loaded&&(this.lastFileNonce=n),e.a9&&e.a9!==e.b7&&e.ci(e.a9,!1),e.aa!==void 0&&(e.aa??null)!==e.b8&&e.cj(e.aa??null),this.draft||this.viewer.clearSelectedLines(),this.sync()},onDestroy:function(){e.br&&clearTimeout(e.br),this.loaded&&(e.cn(),e.c6()),this.abort.abort(),this.unsubScroll(),this.unregTheme();for(let e of this.hostUnregs.values())e();this.viewer.cleanUp()}})),$=h(188,mH,43),hH=M(164,$),gH=h(163,e=>hH(e,wG(e)),5),_H=M(178,$),vH=h(174,e=>_H(e,TG(e)),5),yH=M(160,e=>{gH(e),vH(e)}),bH=a(26,At,(e=>`/${e}&`)(Ue),qV,YV),xH=(e,t)=>{$z(e.a4,t),aV(e.a5,t)},SH=M(162,e=>{gH(e),vH(e),$(e)}),CH=M(161,e=>SH(e,DG(e))),wH=(e,t)=>Jw(e.t,t),TH=h(158,e=>T(e.o,`title`,`${e.dh}\n${e.dn}`)),EH=M(157,TH),DH=h(156,e=>EH(e,e.dl.map(({repo:t})=>{let n=fS(t.pr?.baseRefName||t.base,t.pr?.headRefName||t.branch,e.an||``,e.ao||``);return`${t.worktree}: ${n.title}`}).join(`
2802
- `)),2),OH=M(155,e=>{zO(e.x,e.dl),DH(e)}),kH=h(154,e=>OH(e,e.cq.filter(e=>e.files.length||e.pr).map(t=>{let n=e.dj(t);return{repo:t,files:n.files,additions:n.additions,deletions:n.deletions,fresh:n.fresh,hidden:t.files.length-n.files}}))),AH=M(153,kH),jH=(e,t)=>Zz(e.a4,t),MH=h(137,e=>jH(e,(()=>{let t=new Map;for(let n of e.cq)t.set(n.worktree,(t.get(n.worktree)||0)+1);return e.cq.map(n=>({id:n.id,label:n.pr&&(t.get(n.worktree)||0)>1?`${n.worktree} #${n.pr.number}`:n.worktree,files:e.d2.filter(e=>e.repo===n.id)})).filter(e=>e.files.length)})())),NH=M(136,e=>{hV(e.a5,e.d2),oG(e,e.d2?.length),MH(e),$(e)}),PH=h(133,e=>NH(e,e.cy.filter(t=>!e.bo.has(t.repo)))),FH=M(132,e=>{aG(e,e.cy?.length),AH(e,OG(e)),PH(e)}),IH=h(131,e=>FH(e,e.cw?e.cv.filter(t=>e.cw.has(t.key)||t.key===e.bl):e.cv),2),LH=M(129,e=>{wH(e,e.cv.map(e=>({...e,fileDiff:hx(e,e.key)}))),IH(e)}),RH=h(126,e=>LH(e,(()=>{let t=Rx(e.b3);return e.cr.filter(n=>t(n.label)&&(!e.b6||n.changedSince))})()),2),zH=(e,t)=>rV(e.a5,t),BH=(e,t)=>{Qz(e.a4,t),zH(e,new Set(t.keys()))},VH=h(141,e=>BH(e,new Map(e.cr.flatMap(t=>{let n=e.d6.get(t.label)?.length;return n?[[t.key,n]]:[]})))),HH=M(125,e=>{iG(e,e.cr?.length),xH(e,new Set(e.cr.filter(e=>e.changedSince).map(e=>e.key))),CH(e,new Map(e.cr.map(e=>[e.key,e]))),RH(e),VH(e)}),UH=M(124,e=>{HH(e,e.cq.flatMap(e=>e.files.map(t=>({...t,repo:e.id,key:`${e.id}/${t.path}`,label:`${e.worktree}/${t.path}`})))),MH(e),kH(e)}),WH=M(151,TH),GH=h(149,e=>WH(e,e.b8?e.de.find(t=>t.sha===e.b8)?.label??aS(e.b8,7):{committed:`Committed`,working:`Working tree`,dirty:`Uncommitted`}[e.b7]),2),KH=M(148,e=>{cG(e,e.de?.length),GH(e),DV(e)}),qH=h(123,e=>{UH(e,e.b8?e.co.filter(e=>e.rev):e.co),KH(e,(()=>{let t=new Set,n=[];for(let r of e.co)for(let e of r.commits||[])t.has(e.sha)||(t.add(e.sha),n.push({sha:e.sha,label:`${r.worktree}#${aS(e.sha,7)} ${e.subject}`}));return e.b8&&!t.has(e.b8)&&n.unshift({sha:e.b8,label:aS(e.b8,7)}),n})())}),JH=M(122,e=>{pH(e,new Set(e.co.filter(e=>!!e.pr&&!!e.localHead&&(e.localHead!==e.head||e.branch!==e.pr.headRefName)).map(e=>e.id))),yH(e,EG(e)),bH(e,[e.co.filter(e=>e.baseMissing),`id`]),qH(e),HV(e)}),YH=M(104,$),XH=h(95,e=>YH(e,kG(e)),2),ZH=M(113,e=>{sk(e.x,e.cf),$(e)}),QH=h(109,e=>ZH(e,AG(e))),$H=M(114,$),eU=h(112,e=>$H(e,jG(e)),4),tU=h(120,e=>A(e,`q`,e.b8?`rev:${e.b8}`:e.b7,MG(e)),2),nU=M(119,tU),rU=h(118,e=>nU(e,t=>{if(t.startsWith(`rev:`)){e.cj(t.slice(4));return}let n=t;if(e.b8&&(EW(e,null),e.am?.(null),n===e.b7)){e.ca(e.b7);return}e.ci(n)}),5),iU=M(116,e=>{rU(e),$(e)}),aU=h(110,e=>iU(e,NG(e)),2),oU=M(117,e=>{rU(e),$(e)}),sU=h(111,e=>oU(e,PG(e)),3),cU=M(108,e=>{QH(e),eU(e),aU(e),sU(e),rU(e),$(e)}),lU=h(107,e=>cU(e,FG(e)),10),uU=M(106,e=>{lU(e),$(e)}),dU=h(99,e=>uU(e,IG(e)),2),fU=M(121,$),pU=h(57,e=>fU(e,LG(e))),mU=d(9,(e=>`<button>${e}</button>`)(se),(e=>` D/${e}&l`)(we),LV),hU=d(12,(e=>`<button><span aria-hidden=true>${e}<span> </span></span></button>`)(JC),(e=>` D D/${e}& D n`)(YC),PV),gU=d(21,(e=>`<button title="Find in review (⌘/Ctrl+F)" aria-label="Find in review">${e}</button>`)(ht),(e=>` D/${e}&l`)(ge),jV),_U=h(147,e=>gU(e,e.dc&&!e.bd?0:1)),vU=M(146,e=>{mU(e,+!e.dc),hU(e,+!e.dc),_U(e)}),yU=h(128,e=>vU(e,!e.au||e.ct>0)),bU=M(175,cH),xU=M(176,lH),SU=M(177,$),CU=h(173,e=>{bU(e,RG(e)),xU(e,zG(e)),SU(e,BG(e))}),wU=M(172,e=>{CU(e),vH(e)}),TU=h(171,e=>wU(e,VG(e)),4),EU=d(22,`<div aria-hidden=true><div></div><div></div></div>`,` D b `,CV),DU=d(27,`<div aria-hidden=true></div>`,` `,SV),OU=h(64,e=>{EU(e,!e.au&&e.b1?0:1),DU(e,!e.au&&e.b1?0:1)}),kU=d(28,`<p> </p>`,` D `,BV,`<p> </p>`,` D `,$V),AU=h(135,e=>kU(e,e.au&&!e.ct?0:e.au&&!e.d0&&!e.bk?1:2),3),jU=m(56,e=>{JH(e,e.au||[]),XH(e),dU(e),pU(e),yU(e),TU(e),OU(e),AU(e),$(e)}),MU=M(140,e=>{VH(e),$(e)}),NU=M(167,$),PU=h(166,e=>NU(e,HG(e))),FU=M(168,$),IU=h(59,e=>FU(e,UG(e))),LU=m(58,e=>{gW(e,e.aw?.length),MU(e,(()=>{let t=new Map;for(let n of e.aw){let e=`${n.worktree}/${n.path}`;t.set(e,[...t.get(e)||[],n])}return t})()),gH(e),PU(e),IU(e),TU(e),CU(e)}),RU=m(61,e=>{gH(e),vH(e),$(e)}),zU=d(25,At,(e=>`/${e}&`)(Ue),iH),BU=y(nH),VU=m(62,e=>{zU(e,+!e.b0),BU(e)}),HU=m(63,e=>{T(e.k,`disabled`,e.b1),Ze(e.l,e.b1&&`_F`),T(e.o,`disabled`,e.b1),T(e.q,`disabled`,e.b1),ck(e.x,e.b1),eU(e),OU(e),$(e)}),UU=(e,t)=>{Pz(e.a4,t),tV(e.a5,t)},WU=m(68,e=>{tk(e.x,e.b6),lU(e),RH(e),eH(e)}),GU=m(71,e=>{qz(e.a4,e.b9),FV(e)}),KU=m(72,e=>XB(e.a5,e.ba)),qU=_(`A50`,e=>{e.bd&&!e.bb&&OW(e,!0)}),JU=h(76,qU),YU=M(75,e=>{tT(e.t,e.bd),rT(e.t,!e.bd),JU(e),_U(e)}),XU=M(130,IH),ZU=e=>{XU(e,e.bi.trim()?new Set(e.bj):null)},QU=m(79,e=>{zW(e,e.bh?.query),BW(e,e.bh?.keys),VW(e,e.bh?.hit),ZU(e)}),$U=m(84,$),eW=m(85,e=>{BO(e.x,e.bn),$(e)}),tW=M(105,e=>{eB(e.a4,GG(e)),lU(e),$(e)}),nW=h(102,e=>tW(e,KG(e)),4),rW=m(86,e=>{QO(e.x,e.bo),nW(e),PH(e)}),iW=(e,t)=>{UW(e,t.sig),WW(e,t.timer)},aW=(e,t)=>GW(e,t.seq),oW=(e,t)=>Pw(e.t,function(e){t(e)}),sW=M(92,e=>{oW(e,t=>{if(QU(e,t),!t.hit)return;let n=t.hit;setTimeout(()=>{n.line<1?e.bu.scrollToItem(n.key):e.bu.scrollToLine(n.key,n.line,n.side)},0)}),nW(e),dU(e),$(e)}),cW=(e,t)=>{KW(e,t.anchor),qW(e,t.raf)},lW=(e,t)=>{XW(e,t.pos),ZW(e,t.jump)},uW=M(159,e=>{gH(e),vH(e),$(e)}),dW=(e,t)=>dG(e,t.busy),fW=(e,t)=>{vG(e,t.home),yG(e,t.raf)},pW=_(`A48`,e=>{u(e.k,`click`,function(){e.cf()}),u(e.o,`click`,function(){let t=e.q;typeof t.showPicker==`function`?t.showPicker():t.focus()}),C(e,`q`)});function mW(e){v(e,19,hG),b(e.a,`_g0`),b(e.b,`_g5`),b(e.c,`_hE`),b(e.d,`_g6`),b(e.e,`_hc`),b(e.g,LS),b(e.i,[`_g4`,`_hD`]),b(e.k,[ie,`_g2`]),dt(e.l),Tt(e.l,14),b(e.n,`_hd`),Qe(e.p),qe(e.p,14),Et(e.p),b(e.q,`_he`),Kw(e.t),xw(e.t,tK(e)),kw(e.t),Aw(e.t),Nw(e.t),ZO(e.x),ek(e.x,eK(e)),nk(e.x,$G(e)),rk(e.x,QG(e)),b(e.y,`_hs`),b(e.a3,`_ht`),Uz(e.a4),e.a5,ZB(e.a5,ZG(e)),i(e,fH(e)),jU(e,null),LU(e,[]),RU(e,null),VU(e,null),HU(e,!1),UU(e,WG(e)),WU(e,!1),GU(e,ut()),KU(e,!1),YU(e,!gt()),QU(e,{query:``,hit:null,keys:[]}),$U(e,new Set),eW(e,null),rW(e,new Set),iW(e,{sig:``,timer:0}),aW(e,{seq:0}),sW(e,{scrollToItem:YG,scrollToLine:JG,clearSelection:qG}),cW(e,{anchor:null,raf:0}),lW(e,{pos:null,jump:null}),uW(e,XG),dW(e,{busy:0}),fW(e,{home:null,raf:0}),pW(e)}var hW=d(7,(e=>`<span>${e}</span>`)(WS),(e=>` D/${e}&l`)(GS),oH),gW=M(60,e=>{hW(e,+!e.ay),sH(e)}),_W=_(`A47`,e=>{e.b3!==ee(e.a8)&&xt(e.a8,e.b3)}),vW=h(66,_W),yW=m(65,e=>{Nz(e.a4,e.b3),eV(e.a5,e.b3),RH(e),vW(e),QV(e)}),bW=M(115,$),xW=M(165,e=>{PU(e),TU(e)}),SW=M(34,e=>{fV(e.a5,e.a8),yW(e,ee(e.a8)),bW(e,nK(e)),xW(e,rK(e)),XH(e),lU(e),pU(e),gH(e),IU(e),vH(e),vW(e),$(e),uH(e)}),CW=y(UV),wW=m(69,e=>{pV(e.a5,e.b7),lU(e),QH(e),eU(e),aU(e),sU(e),rU(e),GH(e),tU(e),$(e),CW(e),zV(e)}),TW=M(35,e=>{wW(e,e.a9??wt()),$(e)}),EW=m(70,e=>{b(e.o,[ie,`_g2`,{_g1:!!e.b8}]),lU(e),sU(e),rU(e),qH(e),GH(e),tU(e),$(e),VV(e)}),DW=M(36,e=>{EW(e,e.aa??null),$(e)}),OW=o(73,e=>{b(e.s,[`_hb`,{_ha:!e.bb}]),bw(e.t,e.bb),JU(e),$(e),kV(e)}),kW=h(39,e=>OW(e,e.ab,e.ac)),AW=M(37,kW),jW=M(38,kW),MW=_(`A49`,e=>{e.ak&&window.addEventListener(`keydown`,t=>{!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()===`f`&&(t.target instanceof HTMLTextAreaElement||(t.preventDefault(),e.e9()))},{capture:!0,signal:D(e,0)})}),NW=h(180,e=>{O(e,0),MW(e)}),PW=M(179,NW),FW=o(77,e=>{nT(e.t,e.bf),PW(e,iK(e))}),IW=h(42,e=>FW(e,e.ae,e.af)),LW=M(40,IW),RW=M(41,IW),zW=M(80,tH),BW=M(81),VW=M(82,e=>{HW(e,e.bk?.key),AU(e)}),HW=M(83,IH),UW=M(88,e=>{lU(e),$(e)}),WW=M(89,e=>{eU(e),$(e)}),GW=M(91,lU),KW=M(94,e=>{XH(e),$(e)}),qW=M(96,$),JW=M(103,lU),YW=h(101,e=>$O(e.x,oK(e))),XW=M(98,e=>{JW(e,aK(e)),nW(e),dU(e),YW(e),$(e)}),ZW=M(100,e=>{nW(e),YW(e),$(e)}),QW=M(43,nW),$W=M(44,e=>{lU(e),$(e)}),eG=M(45,e=>{lU(e),$(e)}),tG=M(46,e=>{eU(e),NW(e),$(e)}),nG=M(47,aU),rG=M(48,e=>{sU(e),rU(e)}),iG=M(127,e=>{cV(e.a5,e.ct),yU(e),AU(e)}),aG=M(134,AU),oG=M(138,MV),sG=d(17,`<optgroup label=Commits></optgroup>`,` `,OV),cG=(e,t)=>sG(e,+!t),lG=M(49,e=>{ik(e.x,e.an||``),DH(e)}),uG=M(50,e=>{ak(e.x,e.ao||``),DH(e)}),dG=M(170,TU),fG=M(51,TU),pG=d(5,(e=>`<a title="Back to terminal (⌘/Ctrl+Shift+D)">${e}</a>`)(F),(e=>` D/${e}&l`)(P),dH),mG=(e,t)=>pG(e,+!t),hG=s(`A42`,M(182)),gG=M(187,$),_G=h(186,e=>gG(e,sK(e))),vG=M(184,_G),yG=M(185,_G),bG=M(53,e=>{$(e),aH(e)}),xG=M(54,$),SG=M(55,$),CG=e=>function(){VU(e._,null)},wG=e=>async(t,n)=>{let r=e.az,i=e.ds(t);if(RU(e,null),!(!r||!i))try{let t=await Mt(`/api/workspaces/${e.a8}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`comment`,worktree:e.dp(i.repo),path:i.path,side:r.side,line_start:r.start,line_end:r.end,text:n.trim(),...e.dq(i,r)})});LU(e,e.aw.some(e=>e.id===t.id)?e.aw:e.aw.concat(t))}catch(t){VU(e,String(t.message||t))}},TG=e=>(t,n,r)=>{let i=e.az,a=e.ds(t),o=n.trim();if(!i||!a||!o)return Promise.resolve(!1);let s={id:-1,workspace_id:e.a8,worktree:e.dp(a.repo),path:a.path,side:i.side===`deletions`?`deletions`:`additions`,line_start:i.start,line_end:i.end,text:o,created_at:``,...e.dq(a,i)};return e.e2([s],{session:r},[])},EG=e=>(t,n)=>{let r=e.co.find(e=>e.id===t.repo),i=hx(t,t.key),a=n.side===`deletions`?`deletions`:`additions`;return{head:r?.head,snippet:i?xx(i,a,n.start,n.end):void 0}},DG=e=>t=>e.dr.get(t),OG=e=>t=>{let n=0,r=0,i=0,a=0;for(let a of e.cy)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}},kG=e=>()=>{e.au&&Ge(e.a8,e.bw)},AG=e=>()=>e.ca(e.b7,!0),jG=e=>()=>{e.br&&clearTimeout(e.br),e.br=setTimeout(()=>{e.br=0,e.ak&&!e.b1&&e.ca(e.b7,!0)},400)},MG=e=>function(t){e.cl(t)},NG=e=>(t,n=!0)=>{t!==e.b7&&(wW(e,t),n&&ct(t),e.al?.(t),e.ca(t))},PG=e=>t=>{t!==e.b8&&(EW(e,t),e.am?.(t),e.ca(e.b7))},FG=e=>async(t=e.b7,n=!1)=>{let r=++e.bt;HU(e,!0),VU(e,null);try{let i=new URLSearchParams;t!==`committed`&&i.set(`scope`,t),n&&i.set(`refresh`,`1`),e.b8&&i.set(`rev`,e.b8);let a=await Mt(`/api/workspaces/${e.a8}/diff?${i}`);if(r!==e.bt)return;let o=a.sections,s=a;if(jU(e,o),e.b6&&!o.some(e=>e.files.some(e=>e.changedSince))&&WU(e,!1),LU(e,s.comments||[]),e.bq=fx(o),e.ai&&e.c8(e.ai),e.aj)e.c7(e.aj);else if(!e.ai&&!n&&e.bt===1){let n=Xe(e.a8);n&&n.scope===t&&e.c5(n)}}catch(t){if(r!==e.bt)return;VU(e,String(t.message||t))}finally{r===e.bt&&HU(e,!1)}},IG=e=>t=>{let n=(e.au||[]).find(e=>e.pr&&`${e.worktree}/${e.pr.number}`===t),r=n?.files[0];n&&r&&(e.c0=null,e.bu.scrollToItem(`${n.id}/${r.path}`))},LG=e=>()=>{if(!e.au)return;let t={},n={};for(let r of e.au){t[r.id]=r.head;for(let e of r.files)e.hash&&(n[`${r.worktree}/${e.path}`]=e.hash)}fetch(`/api/workspaces/${e.a8}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`seen`,heads:t,dirty:n}),keepalive:!0}).catch(()=>{})},RG=e=>()=>e.e2(e.aw,{clipboard:!0},`all`),zG=e=>t=>e.e2(e.aw,{session:t},`all`),BG=e=>(t,n)=>{let r=e.aw.find(e=>e.id===t);return r?e.e2([r],{session:n},[t]):Promise.resolve(!1)},VG=e=>async(t,n,r)=>{if(!t.length)return!0;e.e0++;try{let i=nS(t,e.au);if(`clipboard`in n){if(!await ae(i))return VU(e,`Copy failed: the clipboard needs HTTPS in this browser.`),!1}else await Mt(`/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}`,...We()||{}})}),e.ap?.(n.session);if(RU(e,null),r===`all`)LU(e,[]);else{let t=new Set(r);LU(e,e.aw.filter(e=>!t.has(e.id)))}return(r===`all`||r.length)&&await e.dv(r).catch(()=>{}),!0}catch(t){return VU(e,String(t.message||t)),!1}finally{e.e0--}},HG=e=>async t=>{LU(e,e.aw.filter(e=>e.id!==t)),await e.dv([t]).catch(()=>{})},UG=e=>async(t,n)=>{let r=e.aw.find(e=>e.id===t);if(!r)return;let i=n.trim();if(!(!i||i===r.text)){LU(e,e.aw.map(e=>e.id===t?{...e,text:i}:e));try{await Mt(`/api/workspaces/${e.a8}/review/${t}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({text:i})})}catch(n){throw LU(e,e.aw.map(e=>e.id===t?r:e)),VU(e,String(n.message||n)),n}}},WG=e=>t=>{yW(e,t)},GG=e=>function(t){e.c7(t)},KG=e=>t=>{let n=t.slice(0,t.indexOf(`/`));if(e.bo.has(n)){let t=new Set(e.bo);t.delete(n),rW(e,t)}e.c0=null,e.c2=t,e.ah?.(t),e.bu.scrollToItem(t)};function qG(){}function JG(e,t,n){}function YG(e){}function XG(e){return e.includes(`#`)?e.split(`#`)[0]:e}var ZG=e=>t=>{KU(e,t)},QG=e=>function(){yW(e,``),WU(e,!1),QU(e,{query:``,hit:null,keys:[]})},$G=e=>function(){WU(e,!e.b6)},eK=e=>function(t){eW(e,t);let n=e.d2.find(e=>e.repo===t);n&&e.c7(n.key)},tK=e=>t=>{OW(e,t)},nK=e=>async()=>{try{LU(e,(await Mt(`/api/workspaces/${e.a8}/review`)).comments||[])}catch{}},rK=e=>t=>t===`all`?fetch(`/api/workspaces/${e.a8}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`clear`})}):Promise.all(t.map(t=>fetch(`/api/workspaces/${e.a8}/review/${t}`,{method:`DELETE`}))),iK=e=>()=>{OW(e,!0),FW(e,+e.bf+1),fH(e)()},aK=e=>t=>{e.c0=t},oK=e=>function(t){let n=new Set(e.bo),r=!n.delete(t);r&&n.add(t);let i=e.cy.filter(e=>!n.has(e.repo)),a=i.findIndex(e=>e.repo===t),o=e.cy.findIndex(e=>e.repo===t),s=r?e.cy.slice(Math.max(o,0)).find(e=>!n.has(e.repo))??i[i.length-1]:i[a];rW(e,n),eW(e,t),s&&(e.c0=null,e.c2=s.key)},sK=e=>t=>{if(!gt())return;let n=e.s;if(e.ee??=n.parentElement,cancelAnimationFrame(e.ef),!t){e.ee&&n.parentElement!==e.ee&&e.ee.append(n);return}let r=0,i=()=>{let t=document.getElementById(`review-find-host`);t?n.parentElement!==t&&(t.append(n),requestAnimationFrame(()=>setTimeout(fH(e),0))):r++<20&&(e.ef=requestAnimationFrame(i))};i()};N(`A35`,CG),N(`A20`,wG),N(`A28`,TG),N(`A18`,EG),N(`A19`,DG),N(`A16`,OG),N(`A6`,kG),N(`A10`,AG),N(`A11`,jG),N(`A0`,MG),N(`A13`,NG),N(`A14`,PG),N(`A9`,FG),N(`A8`,IG),N(`A15`,LG),N(`A25`,RG),N(`A26`,zG),N(`A27`,BG),N(`A24`,VG),N(`A22`,HG),N(`A23`,UG),N(`A1`,WG),N(`A36`,GG),N(`A7`,KG),N(`A4`,qG),N(`A3`,JG),N(`A2`,YG),N(`A17`,XG),N(`A37`,ZG),N(`A34`,QG),N(`A33`,$G),N(`A31`,eK),N(`A30`,tK),N(`A12`,nK),N(`A21`,rK),N(`A29`,iK),N(`A5`,aK),N(`A32`,oK),N(`A38`,sK);export{tG as $input_active,AW as $input_findOpen,jW as $input_findOpenChange,LW as $input_findTick,RW as $input_findTickChange,eG as $input_focusFile,SG as $input_focusFileNonce,xG as $input_focusNonce,$W as $input_focusPr,mG as $input_onExit,QW as $input_onFileChange,rG as $input_onRevChange,nG as $input_onScopeChange,fG as $input_onSent,DW as $input_rev,TW as $input_scope,bG as $input_sessions,lG as $input_workspaceBranch,SW as $input_workspaceId,uG as $input_workspaceName,mW as $setup,vV as $template,yV as $walks};
2802
+ `)),2),OH=M(155,e=>{zO(e.x,e.dl),DH(e)}),kH=h(154,e=>OH(e,e.cq.filter(e=>e.files.length||e.pr).map(t=>{let n=e.dj(t);return{repo:t,files:n.files,additions:n.additions,deletions:n.deletions,fresh:n.fresh,hidden:t.files.length-n.files}}))),AH=M(153,kH),jH=(e,t)=>Zz(e.a4,t),MH=h(137,e=>jH(e,(()=>{let t=new Map;for(let n of e.cq)t.set(n.worktree,(t.get(n.worktree)||0)+1);return e.cq.map(n=>({id:n.id,label:n.pr&&(t.get(n.worktree)||0)>1?`${n.worktree} #${n.pr.number}`:n.worktree,files:e.d2.filter(e=>e.repo===n.id)})).filter(e=>e.files.length)})())),NH=M(136,e=>{hV(e.a5,e.d2),oG(e,e.d2?.length),MH(e),$(e)}),PH=h(133,e=>NH(e,e.cy.filter(t=>!e.bo.has(t.repo)))),FH=M(132,e=>{aG(e,e.cy?.length),AH(e,OG(e)),PH(e)}),IH=h(131,e=>FH(e,e.cw?e.cv.filter(t=>e.cw.has(t.key)||t.key===e.bl):e.cv),2),LH=M(129,e=>{wH(e,e.cv.map(e=>({...e,fileDiff:hx(e,e.key)}))),IH(e)}),RH=h(126,e=>LH(e,(()=>{let t=Rx(e.b3);return e.cr.filter(n=>t(n.label)&&(!e.b6||n.changedSince))})()),2),zH=(e,t)=>rV(e.a5,t),BH=(e,t)=>{Qz(e.a4,t),zH(e,new Set(t.keys()))},VH=h(141,e=>BH(e,new Map(e.cr.flatMap(t=>{let n=e.d6.get(t.label)?.length;return n?[[t.key,n]]:[]})))),HH=M(125,e=>{iG(e,e.cr?.length),xH(e,new Set(e.cr.filter(e=>e.changedSince).map(e=>e.key))),CH(e,new Map(e.cr.map(e=>[e.key,e]))),RH(e),VH(e)}),UH=M(124,e=>{HH(e,e.cq.flatMap(e=>e.files.map(t=>({...t,repo:e.id,key:`${e.id}/${t.path}`,label:`${e.worktree}/${t.path}`})))),MH(e),kH(e)}),WH=M(151,TH),GH=h(149,e=>WH(e,e.b8?e.de.find(t=>t.sha===e.b8)?.label??aS(e.b8,7):{committed:`Committed`,working:`Working tree`,dirty:`Uncommitted`}[e.b7]),2),KH=M(148,e=>{cG(e,e.de?.length),GH(e),DV(e)}),qH=h(123,e=>{UH(e,e.b8?e.co.filter(e=>e.rev):e.co),KH(e,(()=>{let t=new Set,n=[];for(let r of e.co)for(let e of r.commits||[])t.has(e.sha)||(t.add(e.sha),n.push({sha:e.sha,label:`${r.worktree}#${aS(e.sha,7)} ${e.subject}`}));return e.b8&&!t.has(e.b8)&&n.unshift({sha:e.b8,label:aS(e.b8,7)}),n})())}),JH=M(122,e=>{pH(e,new Set(e.co.filter(e=>!!e.pr&&!!e.localHead&&(e.localHead!==e.head||e.branch!==e.pr.headRefName)).map(e=>e.id))),yH(e,EG(e)),bH(e,[e.co.filter(e=>e.baseMissing),`id`]),qH(e),HV(e)}),YH=M(104,$),XH=h(95,e=>YH(e,kG(e)),2),ZH=M(113,e=>{sk(e.x,e.cf),$(e)}),QH=h(109,e=>ZH(e,AG(e))),$H=M(114,$),eU=h(112,e=>$H(e,jG(e)),4),tU=h(120,e=>A(e,`q`,e.b8?`rev:${e.b8}`:e.b7,MG(e)),2),nU=M(119,tU),rU=h(118,e=>nU(e,t=>{if(t.startsWith(`rev:`)){e.cj(t.slice(4));return}let n=t;if(e.b8&&(EW(e,null),e.am?.(null),n===e.b7)){e.ca(e.b7);return}e.ci(n)}),5),iU=M(116,e=>{rU(e),$(e)}),aU=h(110,e=>iU(e,NG(e)),2),oU=M(117,e=>{rU(e),$(e)}),sU=h(111,e=>oU(e,PG(e)),3),cU=M(108,e=>{QH(e),eU(e),aU(e),sU(e),rU(e),$(e)}),lU=h(107,e=>cU(e,FG(e)),10),uU=M(106,e=>{lU(e),$(e)}),dU=h(99,e=>uU(e,IG(e)),2),fU=M(121,$),pU=h(57,e=>fU(e,LG(e))),mU=d(9,(e=>`<button>${e}</button>`)(se),(e=>` D/${e}&l`)(we),LV),hU=d(12,(e=>`<button><span aria-hidden=true>${e}<span> </span></span></button>`)(JC),(e=>` D D/${e}& D n`)(YC),PV),gU=d(21,(e=>`<button title="Find in review (⌘/Ctrl+F)" aria-label="Find in review">${e}</button>`)(ht),(e=>` D/${e}&l`)(ge),jV),_U=h(147,e=>gU(e,e.dc&&!e.bd?0:1)),vU=M(146,e=>{mU(e,+!e.dc),hU(e,+!e.dc),_U(e)}),yU=h(128,e=>vU(e,!e.au||e.ct>0)),bU=M(175,cH),xU=M(176,lH),SU=M(177,$),CU=h(173,e=>{bU(e,RG(e)),xU(e,zG(e)),SU(e,BG(e))}),wU=M(172,e=>{CU(e),vH(e)}),TU=h(171,e=>wU(e,VG(e)),4),EU=d(22,`<div aria-hidden=true><div></div><div></div></div>`,` D b `,CV),DU=d(27,`<div aria-hidden=true></div>`,` `,SV),OU=h(64,e=>{EU(e,!e.au&&e.b1?0:1),DU(e,!e.au&&e.b1?0:1)}),kU=d(28,`<p> </p>`,` D `,BV,`<p> </p>`,` D `,$V),AU=h(135,e=>kU(e,e.au&&!e.ct?0:e.au&&!e.d0&&!e.bk?1:2),3),jU=m(56,e=>{JH(e,e.au||[]),XH(e),dU(e),pU(e),yU(e),TU(e),OU(e),AU(e),$(e)}),MU=M(140,e=>{VH(e),$(e)}),NU=M(167,$),PU=h(166,e=>NU(e,HG(e))),FU=M(168,$),IU=h(59,e=>FU(e,UG(e))),LU=m(58,e=>{gW(e,e.aw?.length),MU(e,(()=>{let t=new Map;for(let n of e.aw){let e=`${n.worktree}/${n.path}`;t.set(e,[...t.get(e)||[],n])}return t})()),gH(e),PU(e),IU(e),TU(e),CU(e)}),RU=m(61,e=>{gH(e),vH(e),$(e)}),zU=d(25,At,(e=>`/${e}&`)(Ue),iH),BU=y(nH),VU=m(62,e=>{zU(e,+!e.b0),BU(e)}),HU=m(63,e=>{T(e.k,`disabled`,e.b1),Ze(e.l,e.b1&&`_F`),T(e.o,`disabled`,e.b1),T(e.q,`disabled`,e.b1),ck(e.x,e.b1),eU(e),OU(e),$(e)}),UU=(e,t)=>{Pz(e.a4,t),tV(e.a5,t)},WU=m(68,e=>{tk(e.x,e.b6),lU(e),RH(e),eH(e)}),GU=m(71,e=>{qz(e.a4,e.b9),FV(e)}),KU=m(72,e=>XB(e.a5,e.ba)),qU=_(`A50`,e=>{e.bd&&!e.bb&&OW(e,!0)}),JU=h(76,qU),YU=M(75,e=>{tT(e.t,e.bd),rT(e.t,!e.bd),JU(e),_U(e)}),XU=M(130,IH),ZU=e=>{XU(e,e.bi.trim()?new Set(e.bj):null)},QU=m(79,e=>{zW(e,e.bh?.query),BW(e,e.bh?.keys),VW(e,e.bh?.hit),ZU(e)}),$U=m(84,$),eW=m(85,e=>{BO(e.x,e.bn),$(e)}),tW=M(105,e=>{eB(e.a4,GG(e)),lU(e),$(e)}),nW=h(102,e=>tW(e,KG(e)),4),rW=m(86,e=>{QO(e.x,e.bo),nW(e),PH(e)}),iW=(e,t)=>{UW(e,t.sig),WW(e,t.timer)},aW=(e,t)=>GW(e,t.seq),oW=(e,t)=>Pw(e.t,function(e){t(e)}),sW=M(92,e=>{oW(e,t=>{if(QU(e,t),!t.hit)return;let n=t.hit;setTimeout(()=>{n.line<1?e.bu.scrollToItem(n.key):e.bu.scrollToLine(n.key,n.line,n.side)},0)}),nW(e),dU(e),$(e)}),cW=(e,t)=>{KW(e,t.anchor),qW(e,t.raf)},lW=(e,t)=>{XW(e,t.pos),ZW(e,t.jump)},uW=M(159,e=>{gH(e),vH(e),$(e)}),dW=(e,t)=>dG(e,t.busy),fW=(e,t)=>{vG(e,t.home),yG(e,t.raf)},pW=_(`A48`,e=>{u(e.k,`click`,function(){e.cf()}),u(e.o,`click`,function(){let t=e.q;typeof t.showPicker==`function`?t.showPicker():t.focus()}),C(e,`q`)});function mW(e){v(e,19,hG),b(e.a,`_eY`),b(e.b,`_e3`),b(e.c,`_fC`),b(e.d,`_e4`),b(e.e,`_fa`),b(e.g,LS),b(e.i,[`_e2`,`_fB`]),b(e.k,[ie,`_e0`]),dt(e.l),Tt(e.l,14),b(e.n,`_fb`),Qe(e.p),qe(e.p,14),Et(e.p),b(e.q,`_fc`),Kw(e.t),xw(e.t,tK(e)),kw(e.t),Aw(e.t),Nw(e.t),ZO(e.x),ek(e.x,eK(e)),nk(e.x,$G(e)),rk(e.x,QG(e)),b(e.y,`_fq`),b(e.a3,`_fr`),Uz(e.a4),e.a5,ZB(e.a5,ZG(e)),i(e,fH(e)),jU(e,null),LU(e,[]),RU(e,null),VU(e,null),HU(e,!1),UU(e,WG(e)),WU(e,!1),GU(e,ut()),KU(e,!1),YU(e,!gt()),QU(e,{query:``,hit:null,keys:[]}),$U(e,new Set),eW(e,null),rW(e,new Set),iW(e,{sig:``,timer:0}),aW(e,{seq:0}),sW(e,{scrollToItem:YG,scrollToLine:JG,clearSelection:qG}),cW(e,{anchor:null,raf:0}),lW(e,{pos:null,jump:null}),uW(e,XG),dW(e,{busy:0}),fW(e,{home:null,raf:0}),pW(e)}var hW=d(7,(e=>`<span>${e}</span>`)(WS),(e=>` D/${e}&l`)(GS),oH),gW=M(60,e=>{hW(e,+!e.ay),sH(e)}),_W=_(`A47`,e=>{e.b3!==ee(e.a8)&&xt(e.a8,e.b3)}),vW=h(66,_W),yW=m(65,e=>{Nz(e.a4,e.b3),eV(e.a5,e.b3),RH(e),vW(e),QV(e)}),bW=M(115,$),xW=M(165,e=>{PU(e),TU(e)}),SW=M(34,e=>{fV(e.a5,e.a8),yW(e,ee(e.a8)),bW(e,nK(e)),xW(e,rK(e)),XH(e),lU(e),pU(e),gH(e),IU(e),vH(e),vW(e),$(e),uH(e)}),CW=y(UV),wW=m(69,e=>{pV(e.a5,e.b7),lU(e),QH(e),eU(e),aU(e),sU(e),rU(e),GH(e),tU(e),$(e),CW(e),zV(e)}),TW=M(35,e=>{wW(e,e.a9??wt()),$(e)}),EW=m(70,e=>{b(e.o,[ie,`_e0`,{_eZ:!!e.b8}]),lU(e),sU(e),rU(e),qH(e),GH(e),tU(e),$(e),VV(e)}),DW=M(36,e=>{EW(e,e.aa??null),$(e)}),OW=o(73,e=>{b(e.s,[`_e_`,{_e9:!e.bb}]),bw(e.t,e.bb),JU(e),$(e),kV(e)}),kW=h(39,e=>OW(e,e.ab,e.ac)),AW=M(37,kW),jW=M(38,kW),MW=_(`A49`,e=>{e.ak&&window.addEventListener(`keydown`,t=>{!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()===`f`&&(t.target instanceof HTMLTextAreaElement||(t.preventDefault(),e.e9()))},{capture:!0,signal:D(e,0)})}),NW=h(180,e=>{O(e,0),MW(e)}),PW=M(179,NW),FW=o(77,e=>{nT(e.t,e.bf),PW(e,iK(e))}),IW=h(42,e=>FW(e,e.ae,e.af)),LW=M(40,IW),RW=M(41,IW),zW=M(80,tH),BW=M(81),VW=M(82,e=>{HW(e,e.bk?.key),AU(e)}),HW=M(83,IH),UW=M(88,e=>{lU(e),$(e)}),WW=M(89,e=>{eU(e),$(e)}),GW=M(91,lU),KW=M(94,e=>{XH(e),$(e)}),qW=M(96,$),JW=M(103,lU),YW=h(101,e=>$O(e.x,oK(e))),XW=M(98,e=>{JW(e,aK(e)),nW(e),dU(e),YW(e),$(e)}),ZW=M(100,e=>{nW(e),YW(e),$(e)}),QW=M(43,nW),$W=M(44,e=>{lU(e),$(e)}),eG=M(45,e=>{lU(e),$(e)}),tG=M(46,e=>{eU(e),NW(e),$(e)}),nG=M(47,aU),rG=M(48,e=>{sU(e),rU(e)}),iG=M(127,e=>{cV(e.a5,e.ct),yU(e),AU(e)}),aG=M(134,AU),oG=M(138,MV),sG=d(17,`<optgroup label=Commits></optgroup>`,` `,OV),cG=(e,t)=>sG(e,+!t),lG=M(49,e=>{ik(e.x,e.an||``),DH(e)}),uG=M(50,e=>{ak(e.x,e.ao||``),DH(e)}),dG=M(170,TU),fG=M(51,TU),pG=d(5,(e=>`<a title="Back to terminal (⌘/Ctrl+Shift+D)">${e}</a>`)(F),(e=>` D/${e}&l`)(P),dH),mG=(e,t)=>pG(e,+!t),hG=s(`A42`,M(182)),gG=M(187,$),_G=h(186,e=>gG(e,sK(e))),vG=M(184,_G),yG=M(185,_G),bG=M(53,e=>{$(e),aH(e)}),xG=M(54,$),SG=M(55,$),CG=e=>function(){VU(e._,null)},wG=e=>async(t,n)=>{let r=e.az,i=e.ds(t);if(RU(e,null),!(!r||!i))try{let t=await Mt(`/api/workspaces/${e.a8}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`comment`,worktree:e.dp(i.repo),path:i.path,side:r.side,line_start:r.start,line_end:r.end,text:n.trim(),...e.dq(i,r)})});LU(e,e.aw.some(e=>e.id===t.id)?e.aw:e.aw.concat(t))}catch(t){VU(e,String(t.message||t))}},TG=e=>(t,n,r)=>{let i=e.az,a=e.ds(t),o=n.trim();if(!i||!a||!o)return Promise.resolve(!1);let s={id:-1,workspace_id:e.a8,worktree:e.dp(a.repo),path:a.path,side:i.side===`deletions`?`deletions`:`additions`,line_start:i.start,line_end:i.end,text:o,created_at:``,...e.dq(a,i)};return e.e2([s],{session:r},[])},EG=e=>(t,n)=>{let r=e.co.find(e=>e.id===t.repo),i=hx(t,t.key),a=n.side===`deletions`?`deletions`:`additions`;return{head:r?.head,snippet:i?xx(i,a,n.start,n.end):void 0}},DG=e=>t=>e.dr.get(t),OG=e=>t=>{let n=0,r=0,i=0,a=0;for(let a of e.cy)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}},kG=e=>()=>{e.au&&Ge(e.a8,e.bw)},AG=e=>()=>e.ca(e.b7,!0),jG=e=>()=>{e.br&&clearTimeout(e.br),e.br=setTimeout(()=>{e.br=0,e.ak&&!e.b1&&e.ca(e.b7,!0)},400)},MG=e=>function(t){e.cl(t)},NG=e=>(t,n=!0)=>{t!==e.b7&&(wW(e,t),n&&ct(t),e.al?.(t),e.ca(t))},PG=e=>t=>{t!==e.b8&&(EW(e,t),e.am?.(t),e.ca(e.b7))},FG=e=>async(t=e.b7,n=!1)=>{let r=++e.bt;HU(e,!0),VU(e,null);try{let i=new URLSearchParams;t!==`committed`&&i.set(`scope`,t),n&&i.set(`refresh`,`1`),e.b8&&i.set(`rev`,e.b8);let a=await Mt(`/api/workspaces/${e.a8}/diff?${i}`);if(r!==e.bt)return;let o=a.sections,s=a;if(jU(e,o),e.b6&&!o.some(e=>e.files.some(e=>e.changedSince))&&WU(e,!1),LU(e,s.comments||[]),e.bq=fx(o),e.ai&&e.c8(e.ai),e.aj)e.c7(e.aj);else if(!e.ai&&!n&&e.bt===1){let n=Xe(e.a8);n&&n.scope===t&&e.c5(n)}}catch(t){if(r!==e.bt)return;VU(e,String(t.message||t))}finally{r===e.bt&&HU(e,!1)}},IG=e=>t=>{let n=(e.au||[]).find(e=>e.pr&&`${e.worktree}/${e.pr.number}`===t),r=n?.files[0];n&&r&&(e.c0=null,e.bu.scrollToItem(`${n.id}/${r.path}`))},LG=e=>()=>{if(!e.au)return;let t={},n={};for(let r of e.au){t[r.id]=r.head;for(let e of r.files)e.hash&&(n[`${r.worktree}/${e.path}`]=e.hash)}fetch(`/api/workspaces/${e.a8}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`seen`,heads:t,dirty:n}),keepalive:!0}).catch(()=>{})},RG=e=>()=>e.e2(e.aw,{clipboard:!0},`all`),zG=e=>t=>e.e2(e.aw,{session:t},`all`),BG=e=>(t,n)=>{let r=e.aw.find(e=>e.id===t);return r?e.e2([r],{session:n},[t]):Promise.resolve(!1)},VG=e=>async(t,n,r)=>{if(!t.length)return!0;e.e0++;try{let i=nS(t,e.au);if(`clipboard`in n){if(!await ae(i))return VU(e,`Copy failed: the clipboard needs HTTPS in this browser.`),!1}else await Mt(`/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}`,...We()||{}})}),e.ap?.(n.session);if(RU(e,null),r===`all`)LU(e,[]);else{let t=new Set(r);LU(e,e.aw.filter(e=>!t.has(e.id)))}return(r===`all`||r.length)&&await e.dv(r).catch(()=>{}),!0}catch(t){return VU(e,String(t.message||t)),!1}finally{e.e0--}},HG=e=>async t=>{LU(e,e.aw.filter(e=>e.id!==t)),await e.dv([t]).catch(()=>{})},UG=e=>async(t,n)=>{let r=e.aw.find(e=>e.id===t);if(!r)return;let i=n.trim();if(!(!i||i===r.text)){LU(e,e.aw.map(e=>e.id===t?{...e,text:i}:e));try{await Mt(`/api/workspaces/${e.a8}/review/${t}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({text:i})})}catch(n){throw LU(e,e.aw.map(e=>e.id===t?r:e)),VU(e,String(n.message||n)),n}}},WG=e=>t=>{yW(e,t)},GG=e=>function(t){e.c7(t)},KG=e=>t=>{let n=t.slice(0,t.indexOf(`/`));if(e.bo.has(n)){let t=new Set(e.bo);t.delete(n),rW(e,t)}e.c0=null,e.c2=t,e.ah?.(t),e.bu.scrollToItem(t)};function qG(){}function JG(e,t,n){}function YG(e){}function XG(e){return e.includes(`#`)?e.split(`#`)[0]:e}var ZG=e=>t=>{KU(e,t)},QG=e=>function(){yW(e,``),WU(e,!1),QU(e,{query:``,hit:null,keys:[]})},$G=e=>function(){WU(e,!e.b6)},eK=e=>function(t){eW(e,t);let n=e.d2.find(e=>e.repo===t);n&&e.c7(n.key)},tK=e=>t=>{OW(e,t)},nK=e=>async()=>{try{LU(e,(await Mt(`/api/workspaces/${e.a8}/review`)).comments||[])}catch{}},rK=e=>t=>t===`all`?fetch(`/api/workspaces/${e.a8}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`clear`})}):Promise.all(t.map(t=>fetch(`/api/workspaces/${e.a8}/review/${t}`,{method:`DELETE`}))),iK=e=>()=>{OW(e,!0),FW(e,+e.bf+1),fH(e)()},aK=e=>t=>{e.c0=t},oK=e=>function(t){let n=new Set(e.bo),r=!n.delete(t);r&&n.add(t);let i=e.cy.filter(e=>!n.has(e.repo)),a=i.findIndex(e=>e.repo===t),o=e.cy.findIndex(e=>e.repo===t),s=r?e.cy.slice(Math.max(o,0)).find(e=>!n.has(e.repo))??i[i.length-1]:i[a];rW(e,n),eW(e,t),s&&(e.c0=null,e.c2=s.key)},sK=e=>t=>{if(!gt())return;let n=e.s;if(e.ee??=n.parentElement,cancelAnimationFrame(e.ef),!t){e.ee&&n.parentElement!==e.ee&&e.ee.append(n);return}let r=0,i=()=>{let t=document.getElementById(`review-find-host`);t?n.parentElement!==t&&(t.append(n),requestAnimationFrame(()=>setTimeout(fH(e),0))):r++<20&&(e.ef=requestAnimationFrame(i))};i()};N(`A35`,CG),N(`A20`,wG),N(`A28`,TG),N(`A18`,EG),N(`A19`,DG),N(`A16`,OG),N(`A6`,kG),N(`A10`,AG),N(`A11`,jG),N(`A0`,MG),N(`A13`,NG),N(`A14`,PG),N(`A9`,FG),N(`A8`,IG),N(`A15`,LG),N(`A25`,RG),N(`A26`,zG),N(`A27`,BG),N(`A24`,VG),N(`A22`,HG),N(`A23`,UG),N(`A1`,WG),N(`A36`,GG),N(`A7`,KG),N(`A4`,qG),N(`A3`,JG),N(`A2`,YG),N(`A17`,XG),N(`A37`,ZG),N(`A34`,QG),N(`A33`,$G),N(`A31`,eK),N(`A30`,tK),N(`A12`,nK),N(`A21`,rK),N(`A29`,iK),N(`A5`,aK),N(`A32`,oK),N(`A38`,sK);export{tG as $input_active,AW as $input_findOpen,jW as $input_findOpenChange,LW as $input_findTick,RW as $input_findTickChange,eG as $input_focusFile,SG as $input_focusFileNonce,xG as $input_focusNonce,$W as $input_focusPr,mG as $input_onExit,QW as $input_onFileChange,rG as $input_onRevChange,nG as $input_onScopeChange,fG as $input_onSent,DW as $input_rev,TW as $input_scope,bG as $input_sessions,lG as $input_workspaceBranch,SW as $input_workspaceId,uG as $input_workspaceName,mW as $setup,vV as $template,yV as $walks};