@p4code/cli 0.2.32 → 0.3.0
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.
- package/dist/bin.mjs +321 -37
- package/dist/client/assets/{DiffPanel-yOCWQcwu.js → DiffPanel-xKJcGo_H.js} +3 -3
- package/dist/client/assets/{FilePreviewPanel-PGNwfXHq.js → FilePreviewPanel-B-eIWgzu.js} +14 -14
- package/dist/client/assets/PreviewPanel-Bd3EmzjZ.js +2 -0
- package/dist/client/assets/{PullRequestCodeTab-Dz4XF0Nb.js → PullRequestCodeTab-GH9TVdPS.js} +2 -2
- package/dist/client/assets/arrow-right-D9TMoIs8.js +2 -0
- package/dist/client/assets/{fileCommentAnnotations-HbTI3JHj.js → fileCommentAnnotations-DQvXruQa.js} +2 -2
- package/dist/client/assets/index-CbSZYklw.js +2536 -0
- package/dist/client/assets/index-DuYVlfPp.css +1 -0
- package/dist/client/assets/previewAssetResource-BU7ePoYc.js +48 -0
- package/dist/client/assets/{renderFileChildren-Da9sM-D2.js → renderFileChildren-Dub6Umny.js} +2 -2
- package/dist/client/assets/{toggle-group-DzmkwXrU.js → toggle-group-Db7Sgk7U.js} +2 -2
- package/dist/client/index.html +3 -3
- package/package.json +1 -1
- package/dist/client/assets/PreviewPanel-DuOntA1w.js +0 -2
- package/dist/client/assets/arrow-right-BPchBceB.js +0 -2
- package/dist/client/assets/index-CfY-70_w.css +0 -1
- package/dist/client/assets/index-rdR8RpSW.js +0 -2531
- package/dist/client/assets/previewAssetResource-B_r-a_Fy.js +0 -48
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{At as i,Dr as a,El as o,G as s,Ot as c,Pa as l,Qc as u,Wc as d,Yc as f,_a as p,al as m,dt as h,ft as g,gt as _,h as v,ht as y,il as b,jl as x,mt as S,n as C,o as w,st as T,vf as E,vt as D,wt as O,x as ee,xr as k,xt as te,yt as A}from"./previewAssetResource-B_r-a_Fy.js";import{n as j,r as M,t as N}from"./renderFileChildren-Da9sM-D2.js";import{$ as ne,Ar as re,Bn as ie,Cn as ae,Cr as oe,D as se,E as ce,Fn as le,Fr as ue,Gn as de,Gt as fe,Hn as pe,Hr as P,Ht as me,Jr as he,Jt as ge,Kn as F,Kt as _e,Mn as ve,Pr as ye,T as be,Un as xe,Ut as Se,Vn as Ce,Wn as we,Z as Te,Zr as I,_r as Ee,_t as De,an as Oe,b as ke,bn as Ae,br as je,ct as Me,d as Ne,ei as Pe,et as Fe,f as Ie,fn as Le,gt as Re,hr as ze,ii as Be,kr as Ve,l as He,m as Ue,on as We,p as Ge,qn as Ke,ri as qe,ti as Je,tt as Ye,u as Xe,v as Ze,vr as Qe,w as $e,wn as et,x as tt,y as nt,yr as rt,zr as it}from"./index-rdR8RpSW.js";import{a as at,i as ot,n as st,r as L,t as R}from"./fileCommentAnnotations-HbTI3JHj.js";var ct=u(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),lt=u(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),ut=`file-tree-container`,dt=`data-file-tree-style`,ft=`data-file-tree-unsafe-css`,pt=`data-file-tree-scrollbar-measure`,mt=`data-file-tree-scrollbar-gutter-measured`,ht=`--trees-scrollbar-gutter-measured`,gt=`header`,_t=`context-menu`,vt=`context-menu-trigger`,yt=5,bt=1<<yt,xt=bt*4;function z(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function St(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Ct(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function wt(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function Tt(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function Et(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function Dt(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,jt(e,t)}function Ot(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=wt(e).get(t);if(i===void 0)return;let a=i>>yt;e.childVisibleChunkSums[a]+=r}function kt(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=Mt(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=bt}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function At(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>yt;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<yt}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function jt(e,t){if(t.childIds.length<xt){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/bt),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>yt]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function Mt(e,t,n,r){let i=Math.min(t.childIds.length,n+bt),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var Nt=7,Pt=3,Ft=1<<Pt,It=4;function Lt(e,t,n=0){return e<<It|n<<Pt|t}function Rt(e){return e.depthAndFlags>>>It}function zt(e){return(e.depthAndFlags&Ft)>>Pt}function B(e){return(e.depthAndFlags&Ft)!==0}function Bt(e){return e.depthAndFlags&Nt}function Vt(e,t){return(Bt(e)&t)!==0}function Ht(e,t){e.depthAndFlags|=t}function Ut(e,t){e.depthAndFlags=Lt(t,Bt(e),zt(e))}var Wt=Symbol(`benchmarkInstrumentation`);function Gt(e,t){return t==null||Object.defineProperty(e,Wt,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Kt(e){return e==null?null:e[Wt]??null}function V(e,t,n){return e==null?n():e.measurePhase(t,n)}function qt(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Jt(e){return e>=48&&e<=57}function Yt(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Jt(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&Jt(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function Xt(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Yt(t)}}function Zt(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function Qt(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=Zt(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function $t(e,t,n){let r=Qt(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function en(e,t){return $t(e,t,Xt)}function tn(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function nn(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=tn(e,r);return a===tn(t,r)?en(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function rn(e,t){return nn(e,t)}function an(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Xt(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=tn(e,n);return o===tn(t,n)?$t(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function on(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Xt(r);return e.sortKeyById[t]=i,i}function sn(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function cn(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function ln(e){let{hasTrailingSlash:t,segments:n}=cn(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function un(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=cn(e);return{requiresDirectory:t,segments:n}}var dn=``;function fn(){let e=new Map;return e.set(dn,0),{idByValue:e,valueById:[dn],sortKeyById:[Xt(dn)]}}function pn(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function mn(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var hn=Symbol(`pathStorePreparedInputKind`);function gn(e,t){return e[hn]=t,e}function _n(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function vn(e,t,n){return n==="default"?rn(e,t):n(_n(e),_n(t))}function yn(){return{depthAndFlags:Lt(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function bn(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function xn(e){return e.isDirectory?e.segments.length:e.segments.length-1}function Sn(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function Cn(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function wn(e,t={}){return An(e,t).map(e=>e.path)}function Tn(e,t={}){let n=An(e,t);return gn({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function En(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return gn({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function Dn(e){let t=e,n=t.preparedPaths;if(t[hn]===`prepared`&&n!=null)return n;if(!Sn(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function On(e){let t=e;return t[hn]===`presorted`&&t.presortedPaths!=null||Cn(t.presortedPaths)?t.presortedPaths:null}function kn(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function An(e,t={}){let n=sn(t),r=Kt(t);qt(r,`workload.inputFiles`,e.length);let i=V(r,`store.preparePathEntries.parse`,()=>e.map(e=>ln(e)));return V(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>vn(e,t,n.sort))),i}var jn=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[yn()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=fn();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Kt(e),this.options=sn(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,z())}appendPaths(e){return V(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>ln(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,V(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return V(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:Lt(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:Lt(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:Lt(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=ln(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:Lt(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:Lt(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=ln(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(V(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||V(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?an(this.lastPreparedPath,e,this.segmentSortKeyCache):vn(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=xn(e),i=n==null?0:xn(n),a=n==null?0:bn(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=pn(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),Tt(i,s),s}createFileChildUnchecked(e,t){let n=pn(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tt(r,a),a}getOrCreateDirectoryChild(e,t){let n=pn(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!B(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tt(r,a),this.directories.set(a,z()),a}createDirectoryChild(e,t){let n=pn(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tt(r,a),this.directories.set(a,z()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!B(n))throw Error(`Path is not a directory: "${t}"`);if(Vt(n,1))throw Error(`Duplicate path: "${t}"`);Ht(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,St());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(B(a)){let t=St();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;B(n)&&this.directories.set(t,z());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),Tt(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!B(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return Dt(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function Mn(e,t=`closed`,n=null){let r=Pn(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function Nn(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function Pn(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function Fn(e,t){return Vt(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:Rt(t)<=e.defaultExpansion}function In(e,t,n=e.snapshot.nodes[t]){return n==null||!B(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:Fn(e,n)}function Ln(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!B(r))return;let i=Fn(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function Rn(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function zn(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function Bn(e,t){let n=Rn(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function Vn(e,t){let n=Rn(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function Hn(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function Un(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function Wn(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function Gn(e,t){e.directoryLoadInfoById.delete(t)}function Kn(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function qn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Jn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function Yn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function Xn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Zn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Qn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function $n(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function er(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function tr(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function nr(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function rr(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function ir(e,t,n){return{...n,visibleCountDelta:hr(e)-t}}function ar(e,t){let n=hr(e),r=Nn();e.transactionStack.push(r);try{t()}catch(t){throw cr(e,r,!1),t}cr(e,r,!0,hr(e)-n)}function or(e,t){let n=e.instrumentation;if(n==null){sr(e,t);return}V(n,`store.events.record`,()=>sr(e,t))}function sr(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){pr(e,t);return}n.events.push(t),fr(n,t)}function cr(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?dr(i,t):V(n,`store.events.batch.merge`,()=>dr(i,t));return}let a=lr(t,r),o=e.instrumentation;if(o==null){pr(e,a);return}V(o,`store.events.batch.commit`,()=>pr(e,a))}function lr(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function ur(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function dr(e,t){for(let n of t.events)e.events.push(n);ur(e,t)}function fr(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function pr(e,t){let n=e.instrumentation;if(n==null){mr(e,t);return}V(n,`store.events.emit`,()=>mr(e,t))}function mr(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function hr(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function gr(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!B(n)||Vt(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!B(a)?null:i}function _r(e,t){let n=t;for(;;){let t=gr(e,n);if(t==null)return n;n=t}}function vr(e,t){let n=[t],r=t;for(;;){let t=gr(e,r);if(t==null)return n;n.push(t),r=t}}function yr(e,t){let n=t==null?e.snapshot.rootId:Or(e,t);return n==null?[]:Ar(e,n)}function br(e,t){let n=ln(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Gr(e,Wr(e,r)),{createdNodeIds:a,directoryId:o}=jr(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=W(e,o);if(Vt(n,1))throw Error(`Path already exists: "${t}"`);Ht(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=Nr(e,o,n.basename),s.add(c);Tr(e,o);let l=Gr(e,o);return qn({affectedAncestorIds:Dr(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Kr(i,l)})}function xr(e,t,n){let r=Or(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=W(e,r);if(Vt(i,2))throw Error(`The root node cannot be removed`);if(B(i)&&U(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Gr(e,a),s=Hr(e,r);Ir(e,a,r,i.nameId),Ur(e,a),Tr(e,a);let c=Gr(e,a);return Jn({affectedAncestorIds:Dr(e,a),affectedNodeIds:s,path:t,projectionChanged:Kr(o,c),recursive:n.recursive===!0})}function Sr(e,t,n,r){let i=Or(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=W(e,i);if(Vt(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=Br(e,i,n),c=Gr(e,a.parentId),l=Gr(e,s.parentId),u=mn(e.snapshot.segmentTable,a.nameId),d=pn(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(B(a)&&Xr(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=Ct(e.snapshot.nodes,U(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Vr(e,p,o,zt(a))===`skip`)return null;let m=a.parentId;Ir(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Yr(e,i),Fr(e,s.parentId,i),Ur(e,m),e.pathCacheVersion++,Tr(e,m),s.parentId!==m&&Tr(e,s.parentId);let h=Gr(e,m),g=Gr(e,s.parentId);return Yn({affectedAncestorIds:[...new Set([...Dr(e,m),...Dr(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:qr([c,l],[h,g]),to:H(e,i)})}function Cr(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function wr(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function H(e,t){let n=W(e,t),r=Cr(e,t);if(r!=null)return r;if(Vt(n,2))return wr(e,t,``);let i=H(e,n.parentId),a=mn(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return wr(e,t,B(n)?`${o}/`:o)}function Tr(e,t){let n=e.instrumentation;if(n==null){Qr(e,t);return}V(n,`store.recomputeCountsUpwardFrom`,()=>Qr(e,t))}function Er(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!B(o)){Zr(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Zr(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function Dr(e,t){let n=[],r=t;for(;r!=null;){let t=W(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function Or(e,t){if(t.length===0)return e.snapshot.rootId;let n=un(t);return kr(e,n.segments,n.requiresDirectory)}function kr(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=U(e,r),a=Ct(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=W(e,r);return n&&!B(i)?null:r}function U(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function W(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Vt(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function Ar(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Vt(n,4))return[];if(!B(n))return[H(e,t)];if(U(e,t).childIds.length===0)return Vt(n,1)&&!Vt(n,2)?[H(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||Vt(n,4)){i.pop();continue}if(!B(n)){r.push(H(e,t.nodeId)),i.pop();continue}let a=U(e,t.nodeId);if(a.childIds.length===0){Vt(n,1)&&!Vt(n,2)&&r.push(H(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function jr(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=pn(e.snapshot.segmentTable,i),a=U(e,r),o=Ct(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!B(W(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=Mr(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function Mr(e,t,n){let r=W(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Lt(Rt(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,z()),Fr(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function Nr(e,t,n){let r=pn(e.snapshot.segmentTable,n),i=U(e,t);if(Ct(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${ei(e,t,n)}"`);let a=W(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Lt(Rt(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),Fr(e,t,o),e.activeNodeCount++,o}function Pr(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}Lr(e,n,o)<0?i=a:r=a+1}return r}function Fr(e,t,n){let r=U(e,t),i=W(e,n);Ct(e.snapshot.nodes,r).set(i.nameId,n),Ot(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=Pr(e,r,n);r.childIds.splice(a,0,n),Et(r,a),jt(e.snapshot.nodes,r)}function Ir(e,t,n,r){let i=U(e,t),a=wt(i),o=a.get(n)??-1;Ct(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Ot(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),Et(i,o),jt(e.snapshot.nodes,i))}function Lr(e,t,n){let r=e.snapshot.options.sort;return r==="default"?Rr(e,t,n):r(zr(e,t),zr(e,n))}function Rr(e,t,n){let r=W(e,t),i=W(e,n),a=B(r);if(a!==B(i))return a?-1:1;let o=Qt(on(e.snapshot.segmentTable,r.nameId),on(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=mn(e.snapshot.segmentTable,r.nameId),c=mn(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function zr(e,t){let n=W(e,t),r=H(e,t),i=B(n),a=i?r.slice(0,-1):r;return{basename:mn(e.snapshot.segmentTable,n.nameId),depth:Rt(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function Br(e,t,n){let r=W(e,t),i=Or(e,n);if(i!=null){let t=W(e,i);if(B(t))return{basename:mn(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=un(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=un(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:kr(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Vr(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${H(e,t)}"`);let i=W(e,t);if(zt(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(B(i)&&U(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return Hr(e,t),Ir(e,a,t,o),Ur(e,a),Tr(e,a),`handled`}function Hr(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=W(e,t.nodeId);if(t.visitedChildren||!B(i)){B(i)&&e.snapshot.directories.delete(t.nodeId),Ht(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Gn(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=U(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function Ur(e,t){let n=t;for(;n!=null;){let t=W(e,n);if(!B(t)||Vt(t,2)||U(e,n).childIds.length>0)return;Ht(t,1),n=t.parentId===n?null:t.parentId}}function Wr(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=Ct(e.snapshot.nodes,U(e,n)).get(t);if(i==null||!B(W(e,i)))break;n=i}return n}function Gr(e,t){let n=Jr(e,t);if(n==null)return null;let r=_r(e,n),i=W(e,r),a=n===r?null:vr(e,n).map(t=>H(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:U(e,r).childIds.length>0,path:H(e,r),terminalKind:zt(i)})}function Kr(e,t){return qr([e],[t])}function qr(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function Jr(e,t){let n=t;for(;n!=null;){let t=W(e,n);if(!B(t)||Vt(t,2))return null;if(!In(e,n,t))return n;n=t.parentId}return null}function Yr(e,t){let n=W(e,t);if(Ut(n,(t===e.snapshot.rootId?-1:Rt(W(e,n.parentId)))+1),!B(n))return;let r=U(e,t);for(let t of r.childIds)Yr(e,t)}function Xr(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=W(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Zr(e,t,n=W(e,t),r=!1){let i=e.instrumentation;if(i==null){$r(e,t,n,r);return}V(i,`store.recomputeNodeCounts`,()=>$r(e,t,n,r))}function Qr(e,t){let n=t;for(;n!=null;){let t=W(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Zr(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Ot(U(e,s),n,a,o),n=s}}function $r(e,t,n,r){if(!B(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=U(e,t);if(r){let t=e.instrumentation;t==null?Dt(e.snapshot.nodes,i):V(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>Dt(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,Vt(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=gr(e,t)==null?In(e,t,n)?1+o:1:o}function ei(e,t,n){let r=H(e,t);return r.length===0?n:`${r}${n}`}function ti(e){return e!=null&&!Vt(e,4)}function ni(e,t){let n=e.snapshot.nodes[t];return!ti(n)||!B(n)||Vt(n,2)?null:n}function ri(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&ti(e.snapshot.nodes[n])&&(t+=1);return t}function ii(e){return Math.max(0,e.valueById.length-1)}function ai(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:ri(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:ii(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function oi(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function si(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)ni(e,n)!=null&&t.push(H(e,n));for(let t of e.expandedDirectoryIds)ni(e,t)!=null&&n.push(H(e,t));return{collapsedPaths:t,expandedPaths:n}}function ci(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)ni(e,n)==null||zn(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:H(e,n)});return t}function li(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=Or(e,n);t!=null&&Ln(e,t,!0,W(e,t))}for(let n of t.collapsedPaths){let t=Or(e,n);t!=null&&Ln(e,t,!1,W(e,t))}}function ui(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=Or(e,n.path);t!=null&&ni(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function di(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function fi(e){let t=e.snapshot.segmentTable,n=fn();for(let r of e.snapshot.nodes)if(ti(r)){if(Vt(r,2)){r.nameId=0;continue}r.nameId=pn(n,mn(t,r.nameId))}e.snapshot.segmentTable=n}function pi(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!ti(r)||!B(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return ti(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[W(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),Dt(e.snapshot.nodes,n)}}function mi(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(ti(n))break;--t}e.snapshot.nodes.length=t+1}function hi(e){let t=si(e),n=ci(e);V(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>di(e)),V(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>fi(e)),V(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>pi(e)),V(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>mi(e)),V(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>li(e,t)),V(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>ui(e,n)),V(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>Er(e,e.snapshot.rootId))}function gi(e){let t=si(e),n=ci(e),r=V(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>yr(e)),i=Gt({...e.snapshot.options},e.instrumentation),a=V(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new jn(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,V(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>li(e,t)),V(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>ui(e,n)),V(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>Er(e,e.snapshot.rootId))}function _i(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function vi(e,t){let n=ai(e);t===`stable`?V(e.instrumentation,`store.cleanup.stable`,()=>hi(e)):V(e.instrumentation,`store.cleanup.aggressive`,()=>gi(e));let r=ai(e);return oi(t,t===`stable`,n,r)}var yi=64;function bi(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function xi(e){return W(e,e.snapshot.rootId).visibleSubtreeCount}function Si(e,t,n,r){let i=W(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function Ci(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Hi(e,t.cursor),setSize:t.setSize,subtreeEndIndex:Si(e,t.cursor,t.index,n)}}function wi(e,t,n,r,i,a){let o=U(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=kt(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return Ti(e,u,l,r+c,i+1,s,o.childIds.length,a)}function Ti(e,t,n,r,i,a,o,s){if(!B(W(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=Ii(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=W(e,c.terminalNodeId);if(!B(l)||!In(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return wi(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function Ei(e,t){let n=xi(e);if(t<0||t>=n)return null;let r=wi(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>H(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=Ci(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:Hi(e,r.cursor),setSize:r.setSize,subtreeEndIndex:Si(e,r.cursor,r.index,n)}}function Di(e,t,n){let r=e.instrumentation,i=xi(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return Vi(e,o+1);let t=[],n=Ni(e,a);for(let r=a;r<=o&&n!=null;r++){let r=Hi(e,n);t.push(r),n=Ri(e,n)}return t}let s=[],c=0,l=0,u=V(r,`store.getVisibleSlice.selectFirstRow`,()=>Ni(e,a));for(let t=a;t<=o&&u!=null;t++){let t=V(r,`store.getVisibleSlice.materializeRow`,()=>Hi(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=V(r,`store.getVisibleSlice.advanceCursor`,()=>Ri(e,u))}return qt(r,`workload.visibleRowsRead`,s.length),qt(r,`workload.flattenedRowsRead`,c),qt(r,`workload.flattenedSegmentsRead`,l),s}function Oi(e,t=xi(e)){let n=e.instrumentation;return n==null?Bi(e,t):V(n,`store.getVisibleTreeProjection`,()=>Bi(e,t))}function ki(e){return zi(Oi(e))}function Ai(e,t){let n=Or(e,t);if(n==null||n===e.snapshot.rootId||B(W(e,n))&&_r(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=W(e,i).parentId,n=U(e,t),s=wt(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=At(a,n,s),t!==o){let n=W(e,t),a=gr(e,t);if(!In(e,t,n)&&a!==i)return null;_r(e,t)===t&&(r+=1)}i=t}return r}function ji(e,t){let n=Or(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=W(e,n);if(!B(r))throw Error(`Path is not a directory: "${t}"`);return In(e,n,r)?null:(Ln(e,n,!0,r),Tr(e,n),Xn({affectedAncestorIds:Dr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function Mi(e,t){let n=Or(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=W(e,n);if(!B(r))throw Error(`Path is not a directory: "${t}"`);return In(e,n,r)?(Ln(e,n,!1,r),Tr(e,n),Zn({affectedAncestorIds:Dr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function Ni(e,t){return t<0||t>=xi(e)?null:Pi(e,e.snapshot.rootId,t,-1)}function Pi(e,t,n,r){let i=U(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?kt(e.snapshot.nodes,i,n):V(a,`store.getVisibleSlice.selectChildIndex`,()=>kt(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return Fi(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function Fi(e,t,n,r){if(!B(W(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=Ii(e,t,r);if(n===0)return i;let a=W(e,i.terminalNodeId);if(!B(a)||!In(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Pi(e,i.terminalNodeId,n-1,i.visibleDepth)}function Ii(e,t,n){return B(W(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:_r(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:V(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>_r(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Li(e,t){let n=W(e,t);if(!B(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:gr(e,r)!==t}function Ri(e,t){let n=W(e,t.terminalNodeId);if(B(n)){let r=U(e,t.terminalNodeId);if(In(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:Fi(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=W(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=U(e,n),o=wt(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return Fi(e,s,0,i);Li(e,r)&&i--,r=n}}function zi(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function Bi(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(yi);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=bi(o,y);let x,S=_;if(B(v))S=f?_r(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:H(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&B(C)&&In(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function Vi(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!B(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:H(e,f)};continue}let h=l?_r(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=Hi(e,g);let _=i[h];_!=null&&B(_)&&In(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function Hi(e,t){let n=W(e,t.terminalNodeId),r=B(n)?Ui(e,t):null,i=H(e,t.terminalNodeId),a=mn(e.snapshot.segmentTable,n.nameId),o=B(n)&&U(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?vr(e,t.headNodeId).map(n=>{let r=W(e,n);return{isTerminal:n===t.terminalNodeId,name:mn(e.snapshot.segmentTable,r.nameId),nodeId:n,path:H(e,n)}}):V(c,`store.getVisibleSlice.flatten.collectSegments`,()=>vr(e,t.headNodeId).map(n=>{let r=W(e,n);return{isTerminal:n===t.terminalNodeId,name:mn(e.snapshot.segmentTable,r.nameId),nodeId:n,path:H(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:B(n)&&In(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:B(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Ui(e,t){if(t.headNodeId===t.terminalNodeId)return zn(e,t.terminalNodeId);let n=vr(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=zn(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function Wi(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!B(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&jt(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&B(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,jt(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Gi(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Ki=class e{#e;constructor(e={}){let t=Kt(e),n=V(t,`store.builder.create`,()=>new jn(e));if(e.preparedInput!=null){let t=On(e.preparedInput);t==null?n.appendPreparedPaths(Dn(e.preparedInput),!1):n.appendPresortedPaths(t,kn(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(V(t,`store.preparePathEntries`,()=>An(r,e)))}let r=V(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=V(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=V(t,`store.state.create`,()=>Mn(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:V(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Gi(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&V(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?V(t,`store.state.initializeOpenVisibleCounts`,()=>Wi(this.#e)):V(t,`store.state.recomputeCounts`,()=>Er(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return wn(e,t)}static prepareInput(e,t={}){return Tn(e,t)}static preparePresortedInput(e){return En(e)}list(e){return V(this.#e.instrumentation,`store.list`,()=>yr(this.#e,e))}add(e){V(this.#e.instrumentation,`store.add`,()=>{let t=xi(this.#e);or(this.#e,ir(this.#e,t,br(this.#e,e)))})}remove(e,t={}){V(this.#e.instrumentation,`store.remove`,()=>{let n=xi(this.#e);or(this.#e,ir(this.#e,n,xr(this.#e,e,t)))})}move(e,t,n={}){V(this.#e.instrumentation,`store.move`,()=>{let r=xi(this.#e),i=Sr(this.#e,e,t,n);i!=null&&or(this.#e,ir(this.#e,r,i))})}batch(e){ar(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return V(this.#e.instrumentation,`store.getVisibleCount`,()=>xi(this.#e))}getVisibleSlice(e,t){return V(this.#e.instrumentation,`store.getVisibleSlice`,()=>Di(this.#e,e,t))}getVisibleRowContext(e){return V(this.#e.instrumentation,`store.getVisibleRowContext`,()=>Ei(this.#e,e))}getVisibleTreeProjection(){return ki(this.#e)}getVisibleTreeProjectionData(e){return Oi(this.#e,e)}getVisibleIndex(e){return V(this.#e.instrumentation,`store.getVisibleIndex`,()=>Ai(this.#e,e))}getPathInfo(e){return V(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=Or(this.#e,e);if(t==null)return null;let n=W(this.#e,t);return{depth:Rt(n),kind:B(n)?`directory`:`file`,path:H(this.#e,t)}})}isExpanded(e){return V(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=W(this.#e,t);return In(this.#e,t,n)})}expand(e){V(this.#e.instrumentation,`store.expand`,()=>{let t=xi(this.#e),n=ji(this.#e,e);n!=null&&or(this.#e,ir(this.#e,t,n))})}collapse(e){V(this.#e.instrumentation,`store.collapse`,()=>{let t=xi(this.#e),n=Mi(this.#e,e);n!=null&&or(this.#e,ir(this.#e,t,n))})}on(e,t){return Kn(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return zn(this.#e,t)}markDirectoryUnloaded(e){V(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(U(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=xi(this.#e);Vn(this.#e,t),or(this.#e,ir(this.#e,n,Qn({affectedAncestorIds:Dr(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return V(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=xi(this.#e),r=Bn(this.#e,t);return or(this.#e,ir(this.#e,n,$n({affectedAncestorIds:Dr(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return V(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||zn(this.#e,n)!==`loading`||!Un(this.#e,n,e.attemptId))return!1;let r=H(this.#e,n);this.validateChildPatch(r,t);let i=xi(this.#e),a=[];for(let e of t.operations){qi(r,e);let t=xi(this.#e);switch(e.type){case`add`:a.push(ir(this.#e,t,br(this.#e,e.path)));break;case`remove`:a.push(ir(this.#e,t,xr(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=Sr(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(ir(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return or(this.#e,ir(this.#e,i,er({affectedAncestorIds:Dr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:H(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return V(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=xi(this.#e),r=Hn(this.#e,t,e.attemptId);return or(this.#e,ir(this.#e,n,tr({affectedAncestorIds:Dr(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:H(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return V(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=xi(this.#e),i=Wn(this.#e,n,e.attemptId,t);return or(this.#e,ir(this.#e,r,nr({affectedAncestorIds:Dr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:H(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return V(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(_i(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=xi(this.#e),n=vi(this.#e,e.mode??`stable`);return or(this.#e,ir(this.#e,t,rr({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=U(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Xt(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=Qt(on(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!B(W(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=W(this.#e,n);In(this.#e,n,i)||(Ln(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=W(this.#e,e);if(!In(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=Or(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!B(W(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!B(W(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=W(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=W(this.#e,e),r=gr(this.#e,e);if(!In(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function qi(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var Ji={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function Yi(e,t){if(typeof e==`number`)return{itemHeight:t??Ji.default.itemHeight,factor:e};let n=Ji[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Xi=Ji.default.itemHeight,Zi=`@layer base, theme, unsafe;
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{At as i,Dr as a,El as o,G as s,Ot as c,Pa as l,Qc as u,Wc as d,Yc as f,_a as p,al as m,dt as h,ft as g,gt as _,h as v,ht as y,il as b,jl as x,mt as S,n as C,o as w,st as T,vt as E,wt as D,x as O,xr as ee,xt as k,yf as A,yt as j}from"./previewAssetResource-BU7ePoYc.js";import{n as M,r as N,t as P}from"./renderFileChildren-Dub6Umny.js";import{$ as te,Ar as ne,Bn as re,Cn as ie,Cr as ae,D as oe,E as se,Fn as ce,Fr as le,Gn as ue,Gt as de,Hn as fe,Hr as F,Ht as pe,Jr as me,Jt as he,Kn as I,Kt as ge,Mn as _e,Pr as ve,T as ye,Un as be,Ut as xe,Vn as Se,Wn as Ce,Z as we,Zr as L,_r as Te,_t as Ee,an as De,b as Oe,bn as ke,br as Ae,ct as je,d as Me,ei as Ne,et as Pe,f as Fe,fn as Ie,gt as Le,hr as Re,ii as ze,kr as Be,l as Ve,m as He,on as Ue,p as We,qn as Ge,ri as Ke,ti as qe,tt as Je,u as Ye,v as Xe,vr as Ze,w as Qe,wn as $e,x as et,y as tt,yr as nt,zr as rt}from"./index-CbSZYklw.js";import{a as it,i as at,n as ot,r as R,t as z}from"./fileCommentAnnotations-DQvXruQa.js";var st=u(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),ct=u(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),lt=`file-tree-container`,ut=`data-file-tree-style`,dt=`data-file-tree-unsafe-css`,ft=`data-file-tree-scrollbar-measure`,pt=`data-file-tree-scrollbar-gutter-measured`,mt=`--trees-scrollbar-gutter-measured`,ht=`header`,gt=`context-menu`,_t=`context-menu-trigger`,vt=5,yt=1<<vt,bt=yt*4;function xt(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function St(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Ct(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function wt(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function Tt(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function Et(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function Dt(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,jt(e,t)}function Ot(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=wt(e).get(t);if(i===void 0)return;let a=i>>vt;e.childVisibleChunkSums[a]+=r}function kt(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=Mt(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=yt}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function At(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>vt;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<vt}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function jt(e,t){if(t.childIds.length<bt){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/yt),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>vt]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function Mt(e,t,n,r){let i=Math.min(t.childIds.length,n+yt),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var Nt=7,Pt=3,Ft=1<<Pt,It=4;function Lt(e,t,n=0){return e<<It|n<<Pt|t}function Rt(e){return e.depthAndFlags>>>It}function zt(e){return(e.depthAndFlags&Ft)>>Pt}function B(e){return(e.depthAndFlags&Ft)!==0}function Bt(e){return e.depthAndFlags&Nt}function Vt(e,t){return(Bt(e)&t)!==0}function Ht(e,t){e.depthAndFlags|=t}function Ut(e,t){e.depthAndFlags=Lt(t,Bt(e),zt(e))}var Wt=Symbol(`benchmarkInstrumentation`);function Gt(e,t){return t==null||Object.defineProperty(e,Wt,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Kt(e){return e==null?null:e[Wt]??null}function V(e,t,n){return e==null?n():e.measurePhase(t,n)}function qt(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Jt(e){return e>=48&&e<=57}function Yt(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Jt(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&Jt(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function Xt(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Yt(t)}}function Zt(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function Qt(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=Zt(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function $t(e,t,n){let r=Qt(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function en(e,t){return $t(e,t,Xt)}function tn(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function nn(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=tn(e,r);return a===tn(t,r)?en(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function rn(e,t){return nn(e,t)}function an(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Xt(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=tn(e,n);return o===tn(t,n)?$t(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function on(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Xt(r);return e.sortKeyById[t]=i,i}function sn(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function cn(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function ln(e){let{hasTrailingSlash:t,segments:n}=cn(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function un(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=cn(e);return{requiresDirectory:t,segments:n}}var dn=``;function fn(){let e=new Map;return e.set(dn,0),{idByValue:e,valueById:[dn],sortKeyById:[Xt(dn)]}}function pn(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function mn(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var hn=Symbol(`pathStorePreparedInputKind`);function gn(e,t){return e[hn]=t,e}function _n(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function vn(e,t,n){return n==="default"?rn(e,t):n(_n(e),_n(t))}function yn(){return{depthAndFlags:Lt(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function bn(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function xn(e){return e.isDirectory?e.segments.length:e.segments.length-1}function Sn(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function Cn(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function wn(e,t={}){return An(e,t).map(e=>e.path)}function Tn(e,t={}){let n=An(e,t);return gn({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function En(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return gn({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function Dn(e){let t=e,n=t.preparedPaths;if(t[hn]===`prepared`&&n!=null)return n;if(!Sn(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function On(e){let t=e;return t[hn]===`presorted`&&t.presortedPaths!=null||Cn(t.presortedPaths)?t.presortedPaths:null}function kn(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function An(e,t={}){let n=sn(t),r=Kt(t);qt(r,`workload.inputFiles`,e.length);let i=V(r,`store.preparePathEntries.parse`,()=>e.map(e=>ln(e)));return V(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>vn(e,t,n.sort))),i}var jn=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[yn()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=fn();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Kt(e),this.options=sn(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,xt())}appendPaths(e){return V(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>ln(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,V(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return V(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:Lt(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:Lt(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:Lt(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=ln(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:Lt(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:Lt(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=ln(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(V(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||V(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?an(this.lastPreparedPath,e,this.segmentSortKeyCache):vn(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=xn(e),i=n==null?0:xn(n),a=n==null?0:bn(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=pn(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),Tt(i,s),s}createFileChildUnchecked(e,t){let n=pn(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tt(r,a),a}getOrCreateDirectoryChild(e,t){let n=pn(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!B(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tt(r,a),this.directories.set(a,xt()),a}createDirectoryChild(e,t){let n=pn(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tt(r,a),this.directories.set(a,xt()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!B(n))throw Error(`Path is not a directory: "${t}"`);if(Vt(n,1))throw Error(`Duplicate path: "${t}"`);Ht(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,St());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(B(a)){let t=St();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;B(n)&&this.directories.set(t,xt());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),Tt(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!B(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return Dt(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function Mn(e,t=`closed`,n=null){let r=Pn(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function Nn(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function Pn(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function Fn(e,t){return Vt(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:Rt(t)<=e.defaultExpansion}function In(e,t,n=e.snapshot.nodes[t]){return n==null||!B(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:Fn(e,n)}function Ln(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!B(r))return;let i=Fn(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function Rn(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function zn(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function Bn(e,t){let n=Rn(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function Vn(e,t){let n=Rn(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function Hn(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function Un(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function Wn(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function Gn(e,t){e.directoryLoadInfoById.delete(t)}function Kn(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function qn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Jn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function Yn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function Xn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Zn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Qn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function $n(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function er(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function tr(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function nr(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function rr(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function ir(e,t,n){return{...n,visibleCountDelta:hr(e)-t}}function ar(e,t){let n=hr(e),r=Nn();e.transactionStack.push(r);try{t()}catch(t){throw cr(e,r,!1),t}cr(e,r,!0,hr(e)-n)}function or(e,t){let n=e.instrumentation;if(n==null){sr(e,t);return}V(n,`store.events.record`,()=>sr(e,t))}function sr(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){pr(e,t);return}n.events.push(t),fr(n,t)}function cr(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?dr(i,t):V(n,`store.events.batch.merge`,()=>dr(i,t));return}let a=lr(t,r),o=e.instrumentation;if(o==null){pr(e,a);return}V(o,`store.events.batch.commit`,()=>pr(e,a))}function lr(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function ur(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function dr(e,t){for(let n of t.events)e.events.push(n);ur(e,t)}function fr(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function pr(e,t){let n=e.instrumentation;if(n==null){mr(e,t);return}V(n,`store.events.emit`,()=>mr(e,t))}function mr(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function hr(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function gr(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!B(n)||Vt(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!B(a)?null:i}function _r(e,t){let n=t;for(;;){let t=gr(e,n);if(t==null)return n;n=t}}function vr(e,t){let n=[t],r=t;for(;;){let t=gr(e,r);if(t==null)return n;n.push(t),r=t}}function yr(e,t){let n=t==null?e.snapshot.rootId:Or(e,t);return n==null?[]:Ar(e,n)}function br(e,t){let n=ln(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Gr(e,Wr(e,r)),{createdNodeIds:a,directoryId:o}=jr(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=W(e,o);if(Vt(n,1))throw Error(`Path already exists: "${t}"`);Ht(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=Nr(e,o,n.basename),s.add(c);Tr(e,o);let l=Gr(e,o);return qn({affectedAncestorIds:Dr(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Kr(i,l)})}function xr(e,t,n){let r=Or(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=W(e,r);if(Vt(i,2))throw Error(`The root node cannot be removed`);if(B(i)&&U(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Gr(e,a),s=Hr(e,r);Ir(e,a,r,i.nameId),Ur(e,a),Tr(e,a);let c=Gr(e,a);return Jn({affectedAncestorIds:Dr(e,a),affectedNodeIds:s,path:t,projectionChanged:Kr(o,c),recursive:n.recursive===!0})}function Sr(e,t,n,r){let i=Or(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=W(e,i);if(Vt(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=Br(e,i,n),c=Gr(e,a.parentId),l=Gr(e,s.parentId),u=mn(e.snapshot.segmentTable,a.nameId),d=pn(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(B(a)&&Xr(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=Ct(e.snapshot.nodes,U(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Vr(e,p,o,zt(a))===`skip`)return null;let m=a.parentId;Ir(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Yr(e,i),Fr(e,s.parentId,i),Ur(e,m),e.pathCacheVersion++,Tr(e,m),s.parentId!==m&&Tr(e,s.parentId);let h=Gr(e,m),g=Gr(e,s.parentId);return Yn({affectedAncestorIds:[...new Set([...Dr(e,m),...Dr(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:qr([c,l],[h,g]),to:H(e,i)})}function Cr(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function wr(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function H(e,t){let n=W(e,t),r=Cr(e,t);if(r!=null)return r;if(Vt(n,2))return wr(e,t,``);let i=H(e,n.parentId),a=mn(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return wr(e,t,B(n)?`${o}/`:o)}function Tr(e,t){let n=e.instrumentation;if(n==null){Qr(e,t);return}V(n,`store.recomputeCountsUpwardFrom`,()=>Qr(e,t))}function Er(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!B(o)){Zr(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Zr(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function Dr(e,t){let n=[],r=t;for(;r!=null;){let t=W(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function Or(e,t){if(t.length===0)return e.snapshot.rootId;let n=un(t);return kr(e,n.segments,n.requiresDirectory)}function kr(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=U(e,r),a=Ct(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=W(e,r);return n&&!B(i)?null:r}function U(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function W(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Vt(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function Ar(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Vt(n,4))return[];if(!B(n))return[H(e,t)];if(U(e,t).childIds.length===0)return Vt(n,1)&&!Vt(n,2)?[H(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||Vt(n,4)){i.pop();continue}if(!B(n)){r.push(H(e,t.nodeId)),i.pop();continue}let a=U(e,t.nodeId);if(a.childIds.length===0){Vt(n,1)&&!Vt(n,2)&&r.push(H(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function jr(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=pn(e.snapshot.segmentTable,i),a=U(e,r),o=Ct(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!B(W(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=Mr(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function Mr(e,t,n){let r=W(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Lt(Rt(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,xt()),Fr(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function Nr(e,t,n){let r=pn(e.snapshot.segmentTable,n),i=U(e,t);if(Ct(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${ei(e,t,n)}"`);let a=W(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Lt(Rt(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),Fr(e,t,o),e.activeNodeCount++,o}function Pr(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}Lr(e,n,o)<0?i=a:r=a+1}return r}function Fr(e,t,n){let r=U(e,t),i=W(e,n);Ct(e.snapshot.nodes,r).set(i.nameId,n),Ot(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=Pr(e,r,n);r.childIds.splice(a,0,n),Et(r,a),jt(e.snapshot.nodes,r)}function Ir(e,t,n,r){let i=U(e,t),a=wt(i),o=a.get(n)??-1;Ct(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Ot(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),Et(i,o),jt(e.snapshot.nodes,i))}function Lr(e,t,n){let r=e.snapshot.options.sort;return r==="default"?Rr(e,t,n):r(zr(e,t),zr(e,n))}function Rr(e,t,n){let r=W(e,t),i=W(e,n),a=B(r);if(a!==B(i))return a?-1:1;let o=Qt(on(e.snapshot.segmentTable,r.nameId),on(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=mn(e.snapshot.segmentTable,r.nameId),c=mn(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function zr(e,t){let n=W(e,t),r=H(e,t),i=B(n),a=i?r.slice(0,-1):r;return{basename:mn(e.snapshot.segmentTable,n.nameId),depth:Rt(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function Br(e,t,n){let r=W(e,t),i=Or(e,n);if(i!=null){let t=W(e,i);if(B(t))return{basename:mn(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=un(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=un(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:kr(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Vr(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${H(e,t)}"`);let i=W(e,t);if(zt(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(B(i)&&U(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return Hr(e,t),Ir(e,a,t,o),Ur(e,a),Tr(e,a),`handled`}function Hr(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=W(e,t.nodeId);if(t.visitedChildren||!B(i)){B(i)&&e.snapshot.directories.delete(t.nodeId),Ht(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Gn(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=U(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function Ur(e,t){let n=t;for(;n!=null;){let t=W(e,n);if(!B(t)||Vt(t,2)||U(e,n).childIds.length>0)return;Ht(t,1),n=t.parentId===n?null:t.parentId}}function Wr(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=Ct(e.snapshot.nodes,U(e,n)).get(t);if(i==null||!B(W(e,i)))break;n=i}return n}function Gr(e,t){let n=Jr(e,t);if(n==null)return null;let r=_r(e,n),i=W(e,r),a=n===r?null:vr(e,n).map(t=>H(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:U(e,r).childIds.length>0,path:H(e,r),terminalKind:zt(i)})}function Kr(e,t){return qr([e],[t])}function qr(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function Jr(e,t){let n=t;for(;n!=null;){let t=W(e,n);if(!B(t)||Vt(t,2))return null;if(!In(e,n,t))return n;n=t.parentId}return null}function Yr(e,t){let n=W(e,t);if(Ut(n,(t===e.snapshot.rootId?-1:Rt(W(e,n.parentId)))+1),!B(n))return;let r=U(e,t);for(let t of r.childIds)Yr(e,t)}function Xr(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=W(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Zr(e,t,n=W(e,t),r=!1){let i=e.instrumentation;if(i==null){$r(e,t,n,r);return}V(i,`store.recomputeNodeCounts`,()=>$r(e,t,n,r))}function Qr(e,t){let n=t;for(;n!=null;){let t=W(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Zr(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Ot(U(e,s),n,a,o),n=s}}function $r(e,t,n,r){if(!B(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=U(e,t);if(r){let t=e.instrumentation;t==null?Dt(e.snapshot.nodes,i):V(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>Dt(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,Vt(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=gr(e,t)==null?In(e,t,n)?1+o:1:o}function ei(e,t,n){let r=H(e,t);return r.length===0?n:`${r}${n}`}function ti(e){return e!=null&&!Vt(e,4)}function ni(e,t){let n=e.snapshot.nodes[t];return!ti(n)||!B(n)||Vt(n,2)?null:n}function ri(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&ti(e.snapshot.nodes[n])&&(t+=1);return t}function ii(e){return Math.max(0,e.valueById.length-1)}function ai(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:ri(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:ii(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function oi(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function si(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)ni(e,n)!=null&&t.push(H(e,n));for(let t of e.expandedDirectoryIds)ni(e,t)!=null&&n.push(H(e,t));return{collapsedPaths:t,expandedPaths:n}}function ci(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)ni(e,n)==null||zn(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:H(e,n)});return t}function li(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=Or(e,n);t!=null&&Ln(e,t,!0,W(e,t))}for(let n of t.collapsedPaths){let t=Or(e,n);t!=null&&Ln(e,t,!1,W(e,t))}}function ui(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=Or(e,n.path);t!=null&&ni(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function di(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function fi(e){let t=e.snapshot.segmentTable,n=fn();for(let r of e.snapshot.nodes)if(ti(r)){if(Vt(r,2)){r.nameId=0;continue}r.nameId=pn(n,mn(t,r.nameId))}e.snapshot.segmentTable=n}function pi(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!ti(r)||!B(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return ti(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[W(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),Dt(e.snapshot.nodes,n)}}function mi(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(ti(n))break;--t}e.snapshot.nodes.length=t+1}function hi(e){let t=si(e),n=ci(e);V(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>di(e)),V(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>fi(e)),V(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>pi(e)),V(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>mi(e)),V(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>li(e,t)),V(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>ui(e,n)),V(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>Er(e,e.snapshot.rootId))}function gi(e){let t=si(e),n=ci(e),r=V(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>yr(e)),i=Gt({...e.snapshot.options},e.instrumentation),a=V(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new jn(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,V(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>li(e,t)),V(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>ui(e,n)),V(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>Er(e,e.snapshot.rootId))}function _i(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function vi(e,t){let n=ai(e);t===`stable`?V(e.instrumentation,`store.cleanup.stable`,()=>hi(e)):V(e.instrumentation,`store.cleanup.aggressive`,()=>gi(e));let r=ai(e);return oi(t,t===`stable`,n,r)}var yi=64;function bi(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function xi(e){return W(e,e.snapshot.rootId).visibleSubtreeCount}function Si(e,t,n,r){let i=W(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function Ci(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Hi(e,t.cursor),setSize:t.setSize,subtreeEndIndex:Si(e,t.cursor,t.index,n)}}function wi(e,t,n,r,i,a){let o=U(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=kt(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return Ti(e,u,l,r+c,i+1,s,o.childIds.length,a)}function Ti(e,t,n,r,i,a,o,s){if(!B(W(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=Ii(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=W(e,c.terminalNodeId);if(!B(l)||!In(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return wi(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function Ei(e,t){let n=xi(e);if(t<0||t>=n)return null;let r=wi(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>H(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=Ci(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:Hi(e,r.cursor),setSize:r.setSize,subtreeEndIndex:Si(e,r.cursor,r.index,n)}}function Di(e,t,n){let r=e.instrumentation,i=xi(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return Vi(e,o+1);let t=[],n=Ni(e,a);for(let r=a;r<=o&&n!=null;r++){let r=Hi(e,n);t.push(r),n=Ri(e,n)}return t}let s=[],c=0,l=0,u=V(r,`store.getVisibleSlice.selectFirstRow`,()=>Ni(e,a));for(let t=a;t<=o&&u!=null;t++){let t=V(r,`store.getVisibleSlice.materializeRow`,()=>Hi(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=V(r,`store.getVisibleSlice.advanceCursor`,()=>Ri(e,u))}return qt(r,`workload.visibleRowsRead`,s.length),qt(r,`workload.flattenedRowsRead`,c),qt(r,`workload.flattenedSegmentsRead`,l),s}function Oi(e,t=xi(e)){let n=e.instrumentation;return n==null?Bi(e,t):V(n,`store.getVisibleTreeProjection`,()=>Bi(e,t))}function ki(e){return zi(Oi(e))}function Ai(e,t){let n=Or(e,t);if(n==null||n===e.snapshot.rootId||B(W(e,n))&&_r(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=W(e,i).parentId,n=U(e,t),s=wt(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=At(a,n,s),t!==o){let n=W(e,t),a=gr(e,t);if(!In(e,t,n)&&a!==i)return null;_r(e,t)===t&&(r+=1)}i=t}return r}function ji(e,t){let n=Or(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=W(e,n);if(!B(r))throw Error(`Path is not a directory: "${t}"`);return In(e,n,r)?null:(Ln(e,n,!0,r),Tr(e,n),Xn({affectedAncestorIds:Dr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function Mi(e,t){let n=Or(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=W(e,n);if(!B(r))throw Error(`Path is not a directory: "${t}"`);return In(e,n,r)?(Ln(e,n,!1,r),Tr(e,n),Zn({affectedAncestorIds:Dr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function Ni(e,t){return t<0||t>=xi(e)?null:Pi(e,e.snapshot.rootId,t,-1)}function Pi(e,t,n,r){let i=U(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?kt(e.snapshot.nodes,i,n):V(a,`store.getVisibleSlice.selectChildIndex`,()=>kt(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return Fi(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function Fi(e,t,n,r){if(!B(W(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=Ii(e,t,r);if(n===0)return i;let a=W(e,i.terminalNodeId);if(!B(a)||!In(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Pi(e,i.terminalNodeId,n-1,i.visibleDepth)}function Ii(e,t,n){return B(W(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:_r(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:V(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>_r(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Li(e,t){let n=W(e,t);if(!B(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:gr(e,r)!==t}function Ri(e,t){let n=W(e,t.terminalNodeId);if(B(n)){let r=U(e,t.terminalNodeId);if(In(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:Fi(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=W(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=U(e,n),o=wt(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return Fi(e,s,0,i);Li(e,r)&&i--,r=n}}function zi(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function Bi(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(yi);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=bi(o,y);let x,S=_;if(B(v))S=f?_r(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:H(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&B(C)&&In(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function Vi(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!B(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:H(e,f)};continue}let h=l?_r(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=Hi(e,g);let _=i[h];_!=null&&B(_)&&In(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function Hi(e,t){let n=W(e,t.terminalNodeId),r=B(n)?Ui(e,t):null,i=H(e,t.terminalNodeId),a=mn(e.snapshot.segmentTable,n.nameId),o=B(n)&&U(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?vr(e,t.headNodeId).map(n=>{let r=W(e,n);return{isTerminal:n===t.terminalNodeId,name:mn(e.snapshot.segmentTable,r.nameId),nodeId:n,path:H(e,n)}}):V(c,`store.getVisibleSlice.flatten.collectSegments`,()=>vr(e,t.headNodeId).map(n=>{let r=W(e,n);return{isTerminal:n===t.terminalNodeId,name:mn(e.snapshot.segmentTable,r.nameId),nodeId:n,path:H(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:B(n)&&In(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:B(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Ui(e,t){if(t.headNodeId===t.terminalNodeId)return zn(e,t.terminalNodeId);let n=vr(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=zn(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function Wi(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!B(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&jt(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&B(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,jt(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Gi(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Ki=class e{#e;constructor(e={}){let t=Kt(e),n=V(t,`store.builder.create`,()=>new jn(e));if(e.preparedInput!=null){let t=On(e.preparedInput);t==null?n.appendPreparedPaths(Dn(e.preparedInput),!1):n.appendPresortedPaths(t,kn(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(V(t,`store.preparePathEntries`,()=>An(r,e)))}let r=V(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=V(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=V(t,`store.state.create`,()=>Mn(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:V(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Gi(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&V(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?V(t,`store.state.initializeOpenVisibleCounts`,()=>Wi(this.#e)):V(t,`store.state.recomputeCounts`,()=>Er(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return wn(e,t)}static prepareInput(e,t={}){return Tn(e,t)}static preparePresortedInput(e){return En(e)}list(e){return V(this.#e.instrumentation,`store.list`,()=>yr(this.#e,e))}add(e){V(this.#e.instrumentation,`store.add`,()=>{let t=xi(this.#e);or(this.#e,ir(this.#e,t,br(this.#e,e)))})}remove(e,t={}){V(this.#e.instrumentation,`store.remove`,()=>{let n=xi(this.#e);or(this.#e,ir(this.#e,n,xr(this.#e,e,t)))})}move(e,t,n={}){V(this.#e.instrumentation,`store.move`,()=>{let r=xi(this.#e),i=Sr(this.#e,e,t,n);i!=null&&or(this.#e,ir(this.#e,r,i))})}batch(e){ar(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return V(this.#e.instrumentation,`store.getVisibleCount`,()=>xi(this.#e))}getVisibleSlice(e,t){return V(this.#e.instrumentation,`store.getVisibleSlice`,()=>Di(this.#e,e,t))}getVisibleRowContext(e){return V(this.#e.instrumentation,`store.getVisibleRowContext`,()=>Ei(this.#e,e))}getVisibleTreeProjection(){return ki(this.#e)}getVisibleTreeProjectionData(e){return Oi(this.#e,e)}getVisibleIndex(e){return V(this.#e.instrumentation,`store.getVisibleIndex`,()=>Ai(this.#e,e))}getPathInfo(e){return V(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=Or(this.#e,e);if(t==null)return null;let n=W(this.#e,t);return{depth:Rt(n),kind:B(n)?`directory`:`file`,path:H(this.#e,t)}})}isExpanded(e){return V(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=W(this.#e,t);return In(this.#e,t,n)})}expand(e){V(this.#e.instrumentation,`store.expand`,()=>{let t=xi(this.#e),n=ji(this.#e,e);n!=null&&or(this.#e,ir(this.#e,t,n))})}collapse(e){V(this.#e.instrumentation,`store.collapse`,()=>{let t=xi(this.#e),n=Mi(this.#e,e);n!=null&&or(this.#e,ir(this.#e,t,n))})}on(e,t){return Kn(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return zn(this.#e,t)}markDirectoryUnloaded(e){V(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(U(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=xi(this.#e);Vn(this.#e,t),or(this.#e,ir(this.#e,n,Qn({affectedAncestorIds:Dr(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return V(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=xi(this.#e),r=Bn(this.#e,t);return or(this.#e,ir(this.#e,n,$n({affectedAncestorIds:Dr(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return V(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||zn(this.#e,n)!==`loading`||!Un(this.#e,n,e.attemptId))return!1;let r=H(this.#e,n);this.validateChildPatch(r,t);let i=xi(this.#e),a=[];for(let e of t.operations){qi(r,e);let t=xi(this.#e);switch(e.type){case`add`:a.push(ir(this.#e,t,br(this.#e,e.path)));break;case`remove`:a.push(ir(this.#e,t,xr(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=Sr(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(ir(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return or(this.#e,ir(this.#e,i,er({affectedAncestorIds:Dr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:H(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return V(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=xi(this.#e),r=Hn(this.#e,t,e.attemptId);return or(this.#e,ir(this.#e,n,tr({affectedAncestorIds:Dr(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:H(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return V(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=xi(this.#e),i=Wn(this.#e,n,e.attemptId,t);return or(this.#e,ir(this.#e,r,nr({affectedAncestorIds:Dr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:H(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return V(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(_i(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=xi(this.#e),n=vi(this.#e,e.mode??`stable`);return or(this.#e,ir(this.#e,t,rr({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=U(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Xt(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=Qt(on(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!B(W(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=W(this.#e,n);In(this.#e,n,i)||(Ln(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=W(this.#e,e);if(!In(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=Or(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!B(W(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!B(W(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=W(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=W(this.#e,e),r=gr(this.#e,e);if(!In(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function qi(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var Ji={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function Yi(e,t){if(typeof e==`number`)return{itemHeight:t??Ji.default.itemHeight,factor:e};let n=Ji[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Xi=Ji.default.itemHeight,Zi=`@layer base, theme, unsafe;
|
|
2
2
|
|
|
3
3
|
@layer base {
|
|
4
4
|
:host {
|
|
@@ -1668,14 +1668,14 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}f
|
|
|
1668
1668
|
}`}function ea(e){return`${Qi}
|
|
1669
1669
|
@layer unsafe {
|
|
1670
1670
|
${e}
|
|
1671
|
-
}`}var ta=new WeakMap;function na(e){let t=ta.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(pt,`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(),ta.set(e,i),i}function ra(e,t){if(!e.isConnected)return;let n=na(t);if(n==null)return;let r=t.querySelector(`style[${mt}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(mt,``),t.appendChild(i)),i.textContent=`:host { ${ht}: ${n}px; }`}var ia;function aa(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){ia??(ia=new CSSStyleSheet,ia.replaceSync($i(Zi)));let t=!1;try{e.adoptedStyleSheets=[ia],t=!0}catch{}if(t){e.querySelector(`style[${dt}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(dt,``),t.textContent=$i(Zi),e.prepend(t)}}function oa(e,t){sa(e,t),aa(t),ra(e,t)}function sa(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`});oa(this,e)}}if(customElements.define(ut,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(ut)))e instanceof HTMLElement&&oa(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var ca=e=>e.startsWith(`f::`)?e.slice(3):e;function la(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function ua(e,t){return e===``?t:`${e}/${t}`}function da({files:e,path:t,isFolder:n,nextBasename:r}){let i=ca(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}=la(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=ua(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 fa(e){return e.endsWith(`/`)}function pa(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 ma(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 ha(e,t){return t.includes(e)?ma(t):[e]}function ga(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 _a(e,t){return{draggedPaths:e,target:t}}function va(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(fa(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function ya(e,t){return t.kind===`root`||t.directoryPath==null?pa(e):t.directoryPath}function ba(e,t){let n=e.map(e=>{let n=ya(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 xa(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 Sa(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(!xa(Ki.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 Ca(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function wa(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 Ta(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Ea(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 Ta(e,t.path)?n?e:null:e;case`move`:return wa(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Ea(r,e,n),r==null)return null;return r}}}function Da(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Oa(e){switch(e.operation){case`add`:return{...Da(e),operation:`add`,path:e.path};case`remove`:return{...Da(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...Da(e),from:e.from,operation:`move`,to:e.to}}}function ka(e){return{...Da(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>Oa(e)),operation:`batch`}}function Aa(e){switch(e.operation){case`add`:case`remove`:case`move`:return Oa(e);case`batch`:return ka(e);default:return null}}function ja(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function Ma(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 Na(e){return Ma(e).at(-1)??null}function Pa(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function Fa(e){return e.endsWith(`/`)}var Ia=e=>e.toLowerCase();function La(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function Ra(e){return e.endsWith(`/`)?e.slice(0,-1):e}function za(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var Ba=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Va=Symbol(`FILE_TREE_RENAME_VIEW`),Ha=512,Ua=512;function Wa(e){return e===`top`||e===`center`?e:`nearest`}function Ga(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=Ma(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 Ka(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:Ga(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var qa=class{#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=Sa({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=Na(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:Wa(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<=Ua){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=ha(t,n);return this.#r.canDrag?.(r)===!1?!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=_a(t.draggedPaths,n);(va(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}ga(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=_a(e.draggedPaths,t);if(va(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=ba(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=Fa(r),a=Ra(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of Ma(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=La(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[Va](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#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,Fa(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,Fa(e)?{recursive:!0}:void 0);return}let t=Fa(e),n=da({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:Ra(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(za(n.sourcePath,t),za(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=Sa({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!ja(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=Na(e),n=Pa(e,t),r=null,i=null;for(let e of this.#be()){if(Na(e)!==t)continue;let a=Pa(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=Ma(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=!ja(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 Ki({...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 Ma(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(Ia),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(Ia),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 Ma(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:Ba(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 Ma(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 Ma(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=Ka(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,Ha)),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=Ea(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Ea(this.#c,e,!0),r=[...this.#B].map(t=>Ea(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Ea(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return ja(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&&Ca(e)&&(this.#i=null);let t=Ca(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=Aa(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},Ja=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 Ya(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 Xa(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 Za(e,t){return t?`${e}/`:e}function Qa(e,t=null){let n=Ja(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;for(let t of e??[]){let e=Ya(t.path);if(e==null)continue;let n=Za(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of Xa(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var G,$a,eo,to,no,ro,io,ao,oo,so,co={},lo=[],uo=Array.isArray,fo=lo.slice,po=Object.assign;function mo(e){e&&e.parentNode&&e.remove()}function ho(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?fo.call(arguments,2):n),go(e,o,r,i,null)}function go(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??++$a,__i:-1,__u:0};return i==null&&G.vnode!=null&&G.vnode(a),a}function _o(e){return e.children}function vo(e,t){this.props=e,this.context=t,this.__g=0}function yo(e,t){if(t==null)return e.__?yo(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`?yo(e):null}function bo(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 bo(e)}}function xo(e){(8&e.__g||!(e.__g|=8)||!eo.push(e)||no++)&&to==G.debounceRendering||((to=G.debounceRendering)||queueMicrotask)(So)}function So(){for(var e,t,n,r,i,a,o,s,c=1;eo.length;)eo.length>c&&eo.sort(ro),e=eo.shift(),c=eo.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=po({},r)).__v=r.__v+1,G.vnode&&G.vnode(n),Ao(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??yo(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,Mo(a,n,o),n.__e!=i&&bo(n)));no=0}function Co(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||lo,b=t.length;for(c=wo(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?co:y[m.__i]||co,m.__i=f,_=Ao(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Fo(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=To(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function wo(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?go(null,o,null,null,null):uo(o)?go(_o,{children:o},null,null,null):o.constructor==null&&o.__b>0?go(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=Eo(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=yo(s)),Io(s,s));return r}function To(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=To(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=yo(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Eo(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;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 Do(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function Oo(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||Do(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||Do(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(io,`$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=ao,e.addEventListener(t,a?so:oo,a)):e.removeEventListener(t,a?so:oo,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 ko(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=ao++;else if(t.u<n.l)return;return n(G.event?G.event(t):t)}}}function Ao(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,ee,k,te,A=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=G.__b)&&d(t);n:if(typeof A==`function`)try{if(v=t.props,y=`prototype`in A&&A.prototype.render,b=(d=A.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 A(v,x):(t.__c=f=new vo(v,x),f.constructor=A,f.render=Lo),b&&b.sub(f),f.props=v,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&&A.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=po({},f.__s)),po(f.__s,A.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&A.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&A.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=G.__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=po({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===_o&&d.key==null&&(E=No(d.props.children)),s=Co(e,uo(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=[],ee=0;ee<a.length;ee++)(k=a[ee])==null||O||(k.nodeType==8&&k.data==`$s`?(D>0&&t.__c.__z.push(k),D++,a[ee]=null):k.nodeType==8&&k.data==`/$s`?(--D>0&&t.__c.__z.push(k),O=D===0,s=a[ee],a[ee]=null):D>0&&(t.__c.__z.push(k),a[ee]=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(te=a.length;te--;)mo(a[te]);jo(t)}else t.__e=n.__e,t.__k=n.__k,e.then||jo(t);G.__e(e,t,n)}else s=t.__e=Po(n.__e,t,n,r,i,a,o,c,l,u);return(d=G.diffed)&&d(t),128&t.__u?void 0:s}function jo(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(jo)}function Mo(e,t,n){for(var r=0;r<n.length;r++)Fo(n[r],n[++r],n[++r]);G.__c&&G.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){G.__e(e,t.__v)}})}function No(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:uo(e)?e.map(No):po({},e)}function Po(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&&=(G.__m&&G.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=fo.call(e.childNodes),v=n.props||co,!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;Oo(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&&!_||Oo(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=``),Co(b==`template`?e.content:e,uo(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&yo(n,0),s,c,l),a!=null)for(u=a.length;u--;)mo(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||Oo(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&Oo(e,u,g,v[u],i))}return e}function Fo(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){G.__e(e,n)}}function Io(e,t,n){var r,i;if(G.unmount&&G.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Fo(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){G.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Io(r[i],t,n||typeof e.type!=`function`);n||mo(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Lo(e,t,n){return this.constructor(e,n)}function Ro(e,t){var n,r,i,a;t==document&&(t=document.documentElement),G.__&&G.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=ho(_o,null,[e]),i=[],a=[],Ao(t,e,r||co,co,t.namespaceURI,r?null:t.firstChild?fo.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),Mo(i,e,a)}function zo(e,t){e.__u|=32,Ro(e,t)}G={__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 no=0,e}},$a=0,vo.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=po({},this.state);typeof e==`function`&&(e=e(po({},n),this.props)),e&&po(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),xo(this))},vo.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),xo(this))},vo.prototype.render=_o,eo=[],no=0,ro=function(e,t){return e.__v.__b-t.__v.__b},io=/(PointerCapture)$|Capture$/i,ao=0,oo=ko(!1),so=ko(!0);var Bo=0;Array.isArray;function K(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:--Bo,__i:-1,__u:0,__source:i,__self:a};return G.vnode&&G.vnode(l),l}var Vo=16,Ho=16,Uo={};function Wo({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}=Uo[e]??{width:Vo,height:Ho},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return K(`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:K(`use`,{href:c})})}var Go=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},Ko=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},qo=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)]},Jo=(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)]},Yo=(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)]},Xo=(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 Zo({children:e,marker:t,variant:n=`default`}){"use no memo";return K(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:K(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?K(`span`,{"data-truncate-fade":!0}):t})})}function Qo(e){"use no memo";let{mode:t,children:n}=e;return K(`div`,{children:[K(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?K(`span`,{children:n}):n}),K(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?K(`span`,{children:n}):n})]})}function $o({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=K(Qo,{mode:t,children:e},`content`),o=K(Zo,{marker:n,mode:t,variant:r},`marker`),s=K(`div`,{"data-truncate-fill":!0},`fill`);return K(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:K(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function es({children:e,...t}){"use no memo";return K($o,{mode:`truncate`,...t,children:e})}function ts({children:e,...t}){"use no memo";return K($o,{mode:`fruncate`,...t,children:e})}function ns({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=K(es,{...s,children:t[0]}),l=K(ts,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return K(`div`,{className:a,style:o});if(e.length<i)return K(n===`end`?ts:es,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Go:r===`extension`?t=Ko:r===`leaf-path`&&(t=qo);else if(typeof r==`number`)t=Jo,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=Yo:e===`first`&&(t=Xo)}else typeof r==`function`&&(t=r);t??=Go;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=K(es,{...s,..._,children:f}),l=K(ts,{...s,...v,children:p})}return K(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[K(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),K(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var rs={endIndex:-1,startIndex:-1};function is(e,t,n){return Math.min(Math.max(e,t),n)}function as(e,t){return e<0||t<e?rs:{endIndex:t,startIndex:e}}function os(e){return e.startIndex<0||e.endIndex<e.startIndex}function ss(e,t){return os(e)?0:(e.endIndex-e.startIndex+1)*t}function cs(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function ls(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function us(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 ds(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 fs(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 ps(e,t,n){if(e.length===0||t<=0)return[];let r=fs(e),i=us(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=ds(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 ms(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=is(t.scrollTop,0,o),c=t.stickyRows??ps(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=cs(s,n,t.itemHeight),m=cs(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?rs:as(m,ls(u+d,n,t.itemHeight)),y=g+1,b=os(v)?rs:as(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=ss(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:os(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var hs={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},gs={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},_s=`Contains git status items`;function vs(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 ys(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return vs({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 bs(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 xs(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 Ss(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 Cs(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function ws(e,t){return e!=null&&e>0?e:t}function Ts(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 Es(e,t,n,r,i=0){let a=vs({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function Ds(e,t,n,r,i,a,o=0){let s=ys({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function Os(e,t,n,r,i,a){let o=bs({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function ks(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function As(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function js({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return K(`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 Ms(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 Ns(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 Ps,Fs,Is,Ls,Rs=Object.is,zs=0,Bs=[],Vs=G,Hs=Vs.__b,Us=Vs.__r,Ws=Vs.diffed,Gs=Vs.__c,Ks=Vs.unmount,qs=Vs.__;function Js(e,t){Vs.__h&&Vs.__h(Fs,e,zs||t),zs=0;var n=Fs.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Ys(e){return zs=1,Xs(sc,e)}function Xs(e,t,n){var r=Js(Ps++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):sc(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Rs(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Fs,!Fs.__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,Rs(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};Fs.__f=!0;var a=Fs.shouldComponentUpdate,o=Fs.componentWillUpdate;Fs.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)},Fs.shouldComponentUpdate=i}return r.__N||r.__}function Zs(e,t){var n=Js(Ps++,3);!Vs.__s&&oc(n.__H,t)&&(n.__=e,n.u=t,Fs.__H.__h.push(n))}function Qs(e,t){var n=Js(Ps++,4);!Vs.__s&&oc(n.__H,t)&&(n.__=e,n.u=t,Fs.__h.push(n))}function q(e){return zs=5,$s(function(){return{current:e}},[])}function $s(e,t){var n=Js(Ps++,7);return oc(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ec(e,t){return zs=8,$s(function(){return e},t)}function tc(){for(var e;e=Bs.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ic),e.__H.__h.forEach(ac),e.__H.__h=[]}catch(t){e.__H.__h=[],Vs.__e(t,e.__v)}}Vs.__b=function(e){Fs=null,Hs&&Hs(e)},Vs.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),qs&&qs(e,t)},Vs.__r=function(e){Us&&Us(e),Ps=0;var t=(Fs=e.__c).__H;t&&(Is===Fs?(t.__h=[],Fs.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(ic),t.__h.forEach(ac),t.__h=[],Ps=0)),Is=Fs},Vs.diffed=function(e){Ws&&Ws(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Bs.push(t)!==1&&Ls===Vs.requestAnimationFrame||((Ls=Vs.requestAnimationFrame)||rc)(tc)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Is=Fs=null},Vs.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ic),e.__h=e.__h.filter(function(e){return!e.__||ac(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Vs.__e(n,e.__v)}}),Gs&&Gs(e,t)},Vs.unmount=function(e){Ks&&Ks(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ic(e)}catch(e){t=e}}),n.__H=void 0,t&&Vs.__e(t,n.__v))};var nc=typeof requestAnimationFrame==`function`;function rc(e){var t,n=function(){clearTimeout(r),nc&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);nc&&(t=requestAnimationFrame(n))}function ic(e){var t=Fs,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Fs=t}function ac(e){var t=Fs;e.__c=e.__(),Fs=t}function oc(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!Rs(t,e[n])})}function sc(e,t){return typeof t==`function`?t(e):t}function cc(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:K(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return K(_o,{children:[K(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:K(es,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function lc(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function uc(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function dc(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 fc({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=ms(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:dc(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?dc(u,1,t,o):i&&r<=0&&c.length>0?ps(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 pc=400,mc=10,hc=40,gc=18;function _c(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))?vc(e,t,n):a instanceof HTMLElement?a:null}function vc(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 yc(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 bc(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 xc(){return navigator.vendor!==`Apple Computer, Inc.`}function Sc(e,t){let n=e-t.top;if(n<hc)return-Math.ceil((hc-Math.max(0,n))/hc*gc);let r=t.bottom-e;return r<hc?Math.ceil((hc-Math.max(0,r))/hc*gc):0}function Cc(e,t){if(e!=null){let t=hs[e];return t==null?null:{text:t,title:gs[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:_s}:null}function wc(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 Tc(e){return e!=null&&`toggle`in e}function Ec(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function Dc(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function Oc(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function kc(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function Ac(e,t){return t&&kc(e)||(e.ctrlKey||e.metaKey)&&Ec(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var jc=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function Mc(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 Nc(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 Pc(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Fc(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function Ic(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function Lc(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 Rc(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 zc(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 Bc(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=zc(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 Vc(e,t){return{kind:e.kind,name:uc(e),path:t}}function Hc(e){return e==null?void 0:`${e}__tree`}function Uc(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function Wc(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Gc(e,t){if(e==null)return null;if(`text`in e)return K(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?Wc(e.icon)?t(e.icon):{name:e.icon}:Wc(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return K(`span`,{title:e.title,children:K(Wo,{...n})})}function Kc(e){e!=null&&xs(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function qc(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=lc(e);return K(_o,{children:[e.depth>0?K(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>K(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,K(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?K(Wo,{...t(`file-tree-icon-chevron`)}):K(Wo,{...t(`file-tree-icon-file`,u)})}),K(`div`,{"data-item-section":`content`,children:e.isFlattened?cc(e,c,a):c??K(ns,{minimumLength:5,split:`extension`,children:e.name})}),i?K(`div`,{"data-item-section":`decoration`,children:r==null?null:Gc(r,t)}):null,s?K(`div`,{"data-item-section":`git`,children:Gc(o,t)}):null,n?K(`div`,{"data-item-section":`action`,children:l?K(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:K(Wo,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function Jc(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:ee,renderDecorationForRow:k,openContextMenuForRow:te,onRowClick:A,onKeyDown:j}=e,M=lc(t),{isParked:N=!1,mode:ne=`flow`,style:re}=r,ie=ne===`sticky`,ae=_?.get(M)??null??wc(t.ancestorPaths,v,y),oe=t.kind===`directory`&&(b?.has(M)??!1),se=k(t,M),ce=Cc(ae,oe),le=S&&w,ue=se!=null||x||le,de=le&&T===`always`,fe=a.getPath()===M,pe=fe?a.getValue():``,P=ie||!fe?null:K(js,{ref:D,ariaLabel:`Rename ${uc(t)}`,isFlattened:t.isFlattened,value:pe,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),me=qc(t,ee,{actionLaneEnabled:le,customDecoration:se,decorationLaneEnabled:ue,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:ce,gitLaneActive:x,renameInput:P,showDecorativeActionAffordance:de}),he={...Ms({ariaLabel:uc(t),domId:t.isFocused?Uc(h,M,N):void 0,extraStyle:re,features:{actionLaneEnabled:le,contextMenuButtonVisibility:le?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:N,itemHeight:g,mode:ne,row:t,state:{containsGitChange:oe,effectiveGitStatus:ae,isContextHovered:s===M,isDragTarget:l?.kind===`directory`&&l.directoryPath===M,isDragging:c?.has(M)===!0,isFocusRinged:t.isFocused&&o===M},targetPath:M}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(M),te(t,M,{anchorRect:Pc(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:ie?void 0:()=>{i.focusMountedPathFromInput(M)},onKeyDown:ie?void 0:j,ref:e=>{O(M,e)}};return!ie&&fe?K(`div`,{...he,children:me}):K(`button`,{...he,type:`button`,draggable:u&&!N,onDragEnd:u&&!N?p:void 0,onDragStart:u&&!N?e=>{f(e,t,M)}:void 0,onMouseDown:e=>{if(ie){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!N?e=>{m(e,t,M)}:void 0,onClick:e=>{A(e,t,M,ne)},children:me})}function Yc(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(lc(e))).map((n,r)=>Jc(e,n,t.start+r))}function Xc({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Xi,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),ee=q(0),k=q(!1),te=q(null);te.current!==t&&(k.current=!1,te.current=t);let A=q(!1),j=q(null),M=q(null),N=q(!1),ne=q(null),re=q(null),ie=q(null),ae=q(null),oe=q(null),se=q(null),ce=q(null),le=q(null),ue=q(!1),de=q(null),fe=q(null),pe=q(null),P=q(null),me=$s(()=>new Map,[]),[,he]=Ys(0),[ge,F]=Ys(null),[_e,ve]=Ys(null),[ye,be]=Ys(null),[xe,Se]=Ys(null),[we,Te]=Ys(0),[I,Ee]=Ys(null),De=q(I);De.current=I;let Oe=q(null),ke=q(null),Ae=q(null),je=q(null),Me=q(null),Ne=q(!1),Pe=()=>{ke.current=null,Ae.current=null,je.current=null},Fe=(e,t)=>{ke.current=e,Ae.current=null,je.current=t==null?null:{path:e,scrollTop:t}},Ie=(e,t)=>{ke.current=null,Ae.current={path:e,viewportOffset:t},je.current=null},Le=q(d===`retain`&&t.isSearchOpen()),[Re,ze]=Ys(p);Zs(()=>{p||ze(!1)},[p]);let Be=q(!1),Ve=ec(()=>{Be.current=!0,ze(e=>e&&!1)},[]),[He,Ue]=Ys(()=>fc({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[We,Ge]=Ys(!1);Zs(()=>{Ge(!0)},[]);let Ke=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,qe=e?.contextMenu?.triggerMode??(Ke?`right-click`:`both`),Je=qe===`both`||qe===`button`,Ye=e?.contextMenu?.buttonVisibility??`when-needed`,Xe=qe===`both`||qe===`right-click`;Qs(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Me.current=t,ve(t),Se(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Ne.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 Ze=ec((e,t)=>{Ic(T.current,e,t)},[]),Qe=ec((e,t)=>{Ic(E.current,e,t)},[]),$e=ec(e=>{x.current=e},[]),et=ec(e=>Lc(e,E.current,T.current),[]),tt=n!=null||r!=null||i!=null,{resolveIcon:nt}=$s(()=>Ce(a),[a]),rt=t[Va](),it=rt.getPath(),at=it!=null,ot=t.isSearchOpen(),st=t.getSearchValue(),L=t.getFocusedPath(),R=t.getFocusedIndex(),ct=t.getScrollRequest(),lt=t.isDragAndDropEnabled(),ut=t.getDragSession(),dt=$s(()=>ut==null?null:new Set(ut.draggedPaths),[ut]),ft=ut?.target??null,pt=ut?.primaryPath??null,mt=Hc(o),{overlayHeight:ht,overlayRows:yt,snapshot:bt,visibleRows:xt}=He,z=bt.physical.viewportHeight,St=$s(()=>({end:bt.window.endIndex,start:bt.window.startIndex}),[bt.window.endIndex,bt.window.startIndex]),Ct=yt,wt=bt.sticky.rows,Tt=bt.physical.totalHeight,Et=bt.sticky.height,Dt=$s(()=>new Set(wt.map(e=>lc(e.row))),[wt]),Ot=R>=0&&R>=St.start&&R<=St.end,kt=ec((e,t)=>u?.({item:Vc(e,t),row:e})??null,[u]),At=ec(e=>xs(e==null?null:T.current.get(e)??null)?!0:xs(S.current),[]),jt=ec(e=>{At(t.focusNearestPath(e))},[t,At]),Mt=q(jt);Mt.current=jt;let Nt=q(!0),Pt=q(()=>{}),Ft=ec((t=!0)=>{let n=De.current;n!=null&&(Nt.current=Nt.current&&t,Ee(null),e?.contextMenu?.onClose?.(),Nt.current&&jt(n.path))},[e?.contextMenu,jt]);Pt.current=Ft;let It=ec(e=>{let t=e==null?null:Fc(S.current,e);be(e=>e===t?e:t)},[]),Lt=ec((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=et(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Fe(n,e?.scrollTop??null),A.current=!0,F(e=>e===n?e:n)}i.focus(),It(a),Nt.current=!0,Ee({anchorRect:r?.anchorRect??null,item:Vc(e,n),path:n,source:r?.source??`keyboard`})},[t,et,It]),Rt=ec(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=Cs(e,z);ne.current=R<0||e==null?null:Math.max(0,Math.min(R*s-e.scrollTop,Math.max(0,t-s))),N.current=!0}t.startRenaming(e)!==!1&&(Se(`focus`),he(e=>e+1))}},[t,R,s,l,z]),zt=ec((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=Cs(i,z),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:fc({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return A.current=!0,Os(i,a,s,l,u,d),D.current(),Oe.current=n?e:null,!0},[t,s,c,z,h]),B=()=>y.current===!0||P.current!=null||ue.current===!0,Bt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Vt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Ht=()=>{ae.current!=null&&(clearTimeout(ae.current),ae.current=null),ie.current=null},Ut=()=>{se.current?.remove(),se.current=null},Wt=()=>{Vt(re.current),re.current=null,oe.current=null},Gt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Kt=()=>{le.current?.(),le.current=null,P.current!=null&&(clearTimeout(P.current),P.current=null),ue.current=!1,de.current=null,pe.current=null,fe.current!=null&&(fe.current.setAttribute(`draggable`,`true`),fe.current.style.removeProperty(`touch-action`),fe.current=null),Ut(),Ht(),Wt(),ce.current=null},V=(e,n)=>{let r=S.current?.getRootNode(),i=yc(_c(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},qt=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=Tc(r)?r:null;if(i==null||i.isExpanded()){Ht();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;ie.current!==a&&(Ht(),ie.current=a,ae.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Jt=()=>{re.current=null;let e=oe.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=Sc(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()),qt(V(e.clientX,e.clientY)),re.current=Bt(Jt)},Yt=(e,t)=>{oe.current={clientX:e,clientY:t},re.current??=Bt(Jt)},Xt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Kt(),Ut(),Ht(),Wt(),t.startDrag(r)===!1){e.preventDefault();return}if(ce.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),xc())){let t=bc(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Gt(t),se.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Zt=()=>{Ut(),Ht(),Wt(),ce.current=null,t.cancelDrag()},Qt=(e,n,r)=>{if(P.current!=null||ue.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;pe.current={clientX:i.clientX,clientY:i.clientY},fe.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!ue.current;P.current!=null&&(clearTimeout(P.current),P.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),le.current===o&&(le.current=null),t&&(a.setAttribute(`draggable`,`true`),fe.current===a&&(fe.current=null),pe.current=null)},s=e=>{let t=e.touches[0],n=pe.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=mc*mc||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),le.current=o,P.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),fe.current===a&&(fe.current=null),pe.current=null;return}ue.current=!0,fe.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),ce.current=n;let e=a.getBoundingClientRect(),s=bc(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Gt(s),se.current=s,de.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=de.current;n!=null&&se.current!=null&&(se.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),qt(V(t.clientX,t.clientY)),Yt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&V(n.clientX,n.clientY),t.completeDrag(),Kt()},u=()=>{t.cancelDrag(),Kt()};le.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},pc)},$t=e=>{if(I!=null){if(e.key===`Escape`){Ft(),e.preventDefault(),e.stopPropagation();return}jc.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(rt.isActive()){if(e.key===`Escape`)rt.cancel();else if(e.key===`Enter`)rt.commit();else return;Se(`focus`),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Rt(L??void 0),e.preventDefault(),e.stopPropagation();return}if(ot){if(e.key===`Escape`)N.current=!1,ne.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=Cs(n,z);ne.current=R<0||n==null?null:Math.max(0,Math.min(R*s-n.scrollTop,Math.max(0,r-s))),N.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;Se(`focus`),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&Dc(e)){t.openSearch(e.key),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ke&&kc(e),r=Ac(e,Ke),i=r&&S.current!=null?Ss(S.current):null,a=r?new Set(Rc(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==L&&a.has(o)){let e=C.current;Fe(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=Tc(p)?p:null,h=u!=null&&(Dt.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=Lc(u,E.current,T.current);e==null||n==null?y=!1:Lt(e,u)}else if((e.ctrlKey||e.metaKey)&&Ec(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;Se(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Dt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Fe(b,v?.scrollTop??null),A.current=!0,F(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Ie(b,Bc(S.current,v,i,u,s,Et,z)),A.current=!0,F(e=>e===b?e:b)):Pe()}he(e=>e+1),e.preventDefault(),e.stopPropagation()};Qs(()=>{if(!(!f||!ot)){if(Le.current){Le.current=!1;return}xs(w.current)}},[ot,f]),Qs(()=>{let e=x.current;switch(As({hasRenderedInput:e!=null,previousRenamingPath:M.current,renamingPath:it})){case`reset`:M.current=null;return;case`reveal-canonical`:it!=null&&zt(it,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Oe.current=null,M.current=it,xs(e),e.select());return}},[St.end,St.start,it,zt,Dt]),Qs(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=Ss(e)?.dataset.itemPath??null;F(e=>e===t?e:t)},i=()=>{n(),A.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,Ss(e)!=null){r();return}A.current=!1,F(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),A.current=!1,F(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;F(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),Qs(()=>{let e=S.current;e!=null&&(bt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[bt.physical.scrollTop]),Qs(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=Cs(n,g);let a=()=>{let e=t.getVisibleCount(),r=ws(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ue(fc({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!k.current){k.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=ws(O.current,g),i=t.getVisibleRows(e,e)[0]??null;Es(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=!1,l=t.subscribe(()=>{o?he(e=>e+1):o=!0,a()}),u=()=>{Ne.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,Te(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||Ne.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),De.current!=null&&y.current&&Pt.current(),Ne.current===!0){y.current=!1;return}ve(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:Ts(e[0]))??Cs(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),Qs(()=>{Ke||I==null||Ft(!1)},[Ft,Ke,I]);let en=$s(()=>I==null?null:`${I.path}::${I.source}`,[I]);Qs(()=>{if(en==null){m?.clearSlotContent(_t);return}let t=De.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??Nc(n.getBoundingClientRect()),close:e=>{Pt.current(e?.restoreFocus??!0)},restoreFocus:()=>{Nt.current&&Mt.current(De.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(_t,i),e?.contextMenu?.onOpen?.(t.item,r),Kc(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&Kc(i)}),()=>{m?.clearSlotContent(_t)}},[en,e?.contextMenu,m]),Qs(()=>{I!=null&&t.getItem(I.path)==null&&Ft()},[Ft,I,t]),Qs(()=>{if(I==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(Mc(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Ft())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Ft())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Ft,I]),Qs(()=>{let e=C.current,n=S.current;if(e==null||n==null){j.current=L;return}let r=L==null?null:T.current.get(L)??null,i=Ss(n),a=i?.dataset.itemPath??null,o=at&&x.current===i,c=f&&w.current===i,l=N.current&&!ot,u=ne.current??0,d=Oe.current,p=ke.current,m=Ae.current,g=je.current,_=i!=null,v=A.current||_,y=j.current!==L,b=p!=null&&p===L&&L!=null,E=!1,O=!1;if(ct!=null&&ct.id!==ee.current){ee.current=ct.id;let n=ct.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,z-s))):Et;E=!0,O=Ds(e,n,s,z,Tt,ct.offset,t)}t.clearScrollRequest(ct.id)}let k=!E&&l&&Os(e,R,s,z,Tt,u),te=!E&&d!=null&&d===L&&Os(e,R,s,z,Tt,Et),M=!E&&m!=null&&m.path===L&&Os(e,R,s,z,Tt,m.viewportOffset),re=!E&&g!=null&&g.path===L&&e.scrollTop!==g.scrollTop;if(re&&(e.scrollTop=g.scrollTop),(re||O||te||M||k||v&&y&&d!==L&&!b&&Es(e,R,s,z,Et))&&D.current(),E){j.current=L;return}if(!v){j.current=L;return}if(o){j.current=L;return}if(c&&!l){j.current=L;return}if(r==null){l&&R>=0&&(Os(e,R,s,z,Tt,u),D.current()),j.current=L;return}(y||l||d===L||p===L||m?.path===L||g?.path===L||a==null||a!==L)&&(xs(r),d===L&&(Oe.current=null),p===L&&(ke.current=null),m?.path===L&&(Ae.current=null),g?.path===L&&(je.current=null),N.current=!1,ne.current=null),j.current=L},[t,R,L,Ot,s,at,ot,St,z,f,ct,h,Et,Tt,xt]);let tn=R>=0&&R>=bt.visible.startIndex&&R<=bt.visible.endIndex,nn=L!=null&&Ct.some(e=>lc(e.row)===L),rn=tn||nn,an=Je&&A.current===!0&&rn?L:null,on=xe===`pointer`?_e:null,sn=I?.path??Me.current??on??an??_e,cn=I?.source===`right-click`;Qs(()=>{y.current&&I==null||It(et(sn))},[I,et,St,z,we,Ct,sn,It,xt]);let ln=ec(e=>{if(y.current||Mc(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&&Se(e=>e===`pointer`?e:`pointer`),ve(e=>e===i?e:i)},[]),un=ec(()=>{ve(null)},[]);Qs(()=>{if(!lt)return;let e=()=>{Kt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Kt(),t.cancelDrag()}},[t,lt]);let dn=e=>{if(!lt||t.getDragSession()==null||ue.current)return;let n=yc(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),qt(t.getDragSession()?.target??null),Yt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},fn=e=>{if(!lt||t.getDragSession()==null||ue.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Ht(),Wt(),t.setDragTarget(null))},pn=e=>{!lt||t.getDragSession()==null||ue.current||(e.preventDefault(),V(e.clientX,e.clientY),t.completeDrag(),Ut(),Ht(),Wt(),ce.current=null)},mn=bt.window.height,hn=bt.window.offsetTop,gn=Math.min(0,z-mn),_n=Math.min(0,z-mn-Et),vn=ge===L||N.current,yn=L!=null&&vn&&!Ot&&R>=0?xt[R]??t.getVisibleRows(R,R)[0]??null:null,bn=yn==null?null:ks(R,s,St,mn),xn=ce.current,Sn=pt!=null&&xn!=null&&xn.path===pt&&xn.index>=St.start&&xn.index<=St.end,Cn=pt!=null&&xn!=null&&xn.path===pt&&!Sn&&xn.path!==yn?.path?xn:null,wn=Cn==null?null:ks(Cn.index,s,St,mn),Tn=Oc((R>=0?xt[R]??t.getVisibleRows(R,R)[0]??null:null)?.ancestorPaths.at(-1)??null),En=ot&&L!=null?Uc(o,L,!Ot):void 0,Dn=I?.path??(ot?L:ge),On=I?.path??_e,kn=et(sn),An=Ke&&Je&&!cn&&!at&&kn!=null&&ye!=null&&sn!=null,jn=Ke&&(An||I!=null),Mn=I?.anchorRect,Nn=Mn==null&&kn!=null&&ye!=null&&(I!=null||An)?ye:null,Pn=Mn==null?Nn==null?void 0:{top:`${Nn}px`}:{left:`${Mn.left}px`,position:`fixed`,right:`auto`,top:`${Mn.top}px`},Fn=cn?{opacity:`0`}:void 0,In=ec((e,n,r,i)=>{let a=Ns({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:ot,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);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=bt.visible.startIndex&&n.index<=bt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(A.current=!0,F(e=>e===c?e:c),Se(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&zt(c,{targetOffset:`sticky-parents`})},[t,ot,bt.visible.endIndex,bt.visible.startIndex,zt]),Ln=()=>{if(y.current||!Je||sn==null||kn==null)return;let e=t.getItem(sn);e!=null&&(It(kn),Nt.current=!0,Ee({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:kn.getAttribute(`aria-label`)??sn,path:e.getPath()},path:e.getPath(),source:`button`}))},Rn={contextHoverPath:On,contextMenuButtonTriggerEnabled:Je,contextMenuButtonVisibility:Ye,contextMenuEnabled:Ke,contextMenuRightClickEnabled:Xe,contextMenuTriggerMode:qe,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:lt,draggedPathSet:dt,dragTarget:ft,gitLaneActive:tt,gitStatusByPath:n,handleRowDragEnd:Zt,handleRowDragStart:Xt,handleRowTouchStart:Qt,ignoredGitDirectories:r,ignoredInheritanceCache:me,instanceId:o,itemHeight:s,onKeyDown:$t,onRowClick:In,openContextMenuForRow:Lt,registerButton:Ze,registerRenameInput:$e,renameView:rt,renderDecorationForRow:kt,resolveIcon:nt,shouldSuppressContextMenu:B,visualFocusPath:Dn},zn={...Rn,registerButton:Qe};return K(`div`,{ref:S,id:mt,"data-file-tree-context-menu-button-visibility":Ke&&Je?Ye:void 0,"data-file-tree-context-menu-trigger-mode":Ke?qe:void 0,"data-file-tree-has-context-menu-action-lane":Ke&&Je?`true`:void 0,"data-file-tree-has-git-lane":tt?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:lt?fn:void 0,onDragOver:lt?dn:void 0,onDrop:lt?pn:void 0,onKeyDown:$t,onPointerLeave:Ke?un:void 0,onPointerOver:Ke?ln:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[K(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:Tn}}),K(`slot`,{name:gt,"data-type":`header-slot`}),f?K(`div`,{"data-file-tree-search-container":!0,"data-open":ot?`true`:`false`,children:K(`input`,{ref:w,"aria-activedescendant":En,"aria-controls":mt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Re?`true`:void 0,value:st,onBlur:()=>{d===`retain`&&!Be.current||t.closeSearch()},onFocus:Ve,onPointerDown:Ve,onInput:e=>{Ve();let n=e.currentTarget;t.setSearch(n.value)}})}):null,K(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&We&&Ct.length>0?K(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:K(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${ht}px`},children:Ct.map((e,t)=>Jc(zn,e.row,`sticky:${lc(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${Ct.length-t}`}}))})}):null,K(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${Tt}px`},children:[K(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${hn}px`}}),K(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${mn}px`,top:`${gn}px`,bottom:`${_n}px`},children:[Yc(Rn,St,Dt),yn!=null&&bn!=null?Jc(Rn,yn,`parked:${yn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:pt===yn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${bn}px`}}):null,Cn!=null&&wn!=null?Jc(Rn,Cn,`parked-drag:${Cn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${wn}px`}}):null]})]})]}),Ke?K(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":jn?`true`:`false`,style:Pn,children:[K(`button`,{ref:v,type:`button`,"data-type":vt,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":I==null?`false`:`true`,"data-visible":An?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),I!=null){Ft();return}Ln()},tabIndex:-1,style:Fn,children:K(Wo,{...nt(`file-tree-icon-ellipsis`)})}),I==null?null:K(`slot`,{name:_t})]}):null,I==null?null:K(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Ft()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Ft()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var Zc={hydrateRoot:(e,t)=>{zo(ho(Xc,t),e)},renderRoot:(e,t)=>{Ro(ho(Xc,t),e)},unmountRoot:e=>{Ro(null,e)}};function Qc(e,t){Zc.renderRoot(e,t)}function $c(e,t){Zc.hydrateRoot(e,t)}function el(e){Zc.unmountRoot(e)}var tl=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)}}},nl=`__c`,rl=`__k`,il=`__d`,al=`__s`,ol=/[\s\n\\/='"\0<>]/,sl=/^(xlink|xmlns|xml)([A-Z])/,cl=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,ll=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,ul=new Set([`draggable`,`spellcheck`]);function dl(e){e.__g===void 0?e[il]=!0:e.__g|=8}function fl(e){e.__g===void 0?e[il]=!1:e.__g&=-9}function pl(e){return e.__g===void 0?!0===e[il]:!!(8&e.__g)}var ml=/["&<]/;function hl(e){if(e.length===0||!1===ml.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`"`;break;case 38:i=`&`;break;case 60:i=`<`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var gl={},_l=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),vl=/[A-Z]/g;function yl(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:gl[n]||(gl[n]=n.replace(vl,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||_l.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function bl(){this.__d=!0}function xl(e,t){return{__v:e,context:t,props:e.props,setState:bl,forceUpdate:bl,__d:!0,__h:[]}}function Sl(e,t,n){if(!e.s){if(n instanceof Cl){if(!n.s)return void(n.o=Sl.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Sl.bind(null,e,t),Sl.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var Cl=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{Sl(r,1,a(this.v))}catch(e){Sl(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?Sl(r,1,t?t(i):i):n?Sl(r,1,n(i)):Sl(r,2,i)}catch(e){Sl(r,2,e)}},r},e}(),wl,Tl,El,Dl,Ol={},kl=Array.isArray,Al=Object.assign,jl=``,Ml=`<!--$s-->`,Nl=`<!--/$s-->`;function Pl(e,t){var n,r=e.type,i=!0;return e[nl]?(i=!1,(n=e[nl]).state=n[al]):n=new r(e.props,t),e[nl]=n,n.__v=e,n.props=e.props,n.context=t,dl(n),n.state??=Ol,n[al]??(n[al]=n.state),r.getDerivedStateFromProps?n.state=Al({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[al]===n.state?n.state:n[al]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),El&&El(e),n.render(n.props,n.state,t)}function Fl(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===jl)return jl;var s=typeof e;if(s!=`object`)return s==`function`?jl:s==`string`?hl(e):e+jl;if(kl(e)){var c,l=jl;i[rl]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=Fl(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=jl,kl(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return jl;e.__=i,wl&&wl(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===_o){if(`tpl`in g){for(var x=jl,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!kl(C)?x+=C:x+=Fl(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+hl(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=Pl(e,b),y=e[nl];else{e[nl]=y=xl(e,b);for(var E=0;pl(y)&&E++<25;){fl(y),El&&El(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}dl(y)}if(y.getChildContext!=null&&(t=Al({},t,y.getChildContext())),T&&G.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===_o&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return Fl(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[al]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,Ol),pl(y)?(v=Pl(e,t),(y=e[nl]).getChildContext!=null&&(t=Al({},t,y.getChildContext())),Fl(v=v!=null&&v.type===_o&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):jl}finally{Tl&&Tl(e),Dl&&Dl(e)}}}v=v!=null&&v.type===_o&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=Fl(v,t,n,r,e,a,o);return Tl&&Tl(e),G.unmount&&G.unmount(e),e._suspended?typeof D==`string`?Ml+D+Nl:kl(D)?(D.unshift(Ml),D.push(Nl),D):D.then(function(e){return Ml+e+Nl}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return Fl(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var ee=G.__e;return ee&&ee(i,e),jl}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=Fl(v,t,n,r,e,a,o);return e._suspended?Ml+s+Nl:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var k,te=`<`+h,A=jl;for(var j in g){var M=g[j];if(typeof(M=Ll(M)?M.value:M)!=`function`||j===`class`||j===`className`){switch(j){case`children`:k=M;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;j=`for`;break;case`className`:if(`class`in g)continue;j=`class`;break;case`defaultChecked`:j=`checked`;break;case`defaultSelected`:j=`selected`;break;case`defaultValue`:case`value`:switch(j=`value`,h){case`textarea`:k=M;continue;case`select`:r=M;continue;case`option`:r!=M||`selected`in g||(te+=` selected`)}break;case`dangerouslySetInnerHTML`:A=M&&M.__html;continue;case`style`:typeof M==`object`&&(M=yl(M));break;case`acceptCharset`:j=`accept-charset`;break;case`httpEquiv`:j=`http-equiv`;break;default:if(sl.test(j))j=j.replace(sl,`$1:$2`).toLowerCase();else{if(ol.test(j))continue;j[4]!==`-`&&!ul.has(j)||M==null?n?ll.test(j)&&(j=j===`panose1`?`panose-1`:j.replace(/([A-Z])/g,`-$1`).toLowerCase()):cl.test(j)&&(j=j.toLowerCase()):M+=jl}}M!=null&&!1!==M&&(te=!0===M||M===jl?te+` `+j:te+` `+j+`="`+(typeof M==`string`?hl(M):M+jl)+`"`)}}if(ol.test(h))throw Error(h+` is not a valid HTML tag name in `+te+`>`);if(A||(typeof k==`string`?A=hl(k):k!=null&&!1!==k&&!0!==k&&(A=Fl(k,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),Tl&&Tl(e),Dl&&Dl(e),!A&&Il.has(h))return te+`/>`;var N=`</`+h+`>`,ne=te+`>`;return kl(A)?[ne].concat(A,[N]):typeof A==`string`?ne+A+N:[ne,A,N]}var Il=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function Ll(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var Rl=0;function zl(e){return e!=null&&e.length>0?e:(Rl+=1,`pst_ft_${Rl}`)}function Bl({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Xi)}function Vl(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 Hl(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 Ul(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var Wl=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new tl;#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=zl(a),this.#p=Qa(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=Yi(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new qa({...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&&(el(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()}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)}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)}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){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),Qc(t.wrapper,this.#w()))}setGitStatus(e){this.#p=Qa(e,this.#p);let t=this.#T();t!=null&&Qc(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),Qc(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),$c(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),Qc(r,this.#w())}#C(){return{initialViewportHeight:Bl({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(gt,e());return}this.#l.setSlotHtml(gt,this.#e?.header?.html??null)}#k(e){let t=Ul(e).find(e=>Hl(e)),n=Vl(xe(pe(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=Ul(e),n=t.find(e=>Hl(e)),r=t.filter(e=>e!==n),i=pe(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=Vl(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=pe(this.#m);t.colored&&we(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${ft}]`);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(ft,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=ea(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 oa(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)}},J=e(n(),1),Gl=typeof window>`u`?J.useEffect:J.useLayoutEffect;function Kl({file:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=nt(),f=i!==void 0,p=(0,J.useContext)(tt),m=ce(),h=(0,J.useRef)(null),g=se(n=>{if(n!=null){if(h.current!=null)throw Error(`File: An instance should not already exist when a node is created`);d==null?h.current=new M(ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new j(ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({file:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`File: A File instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return Gl(()=>{if(h.current==null)return;let n=ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),a=n!==void 0&&!Ae(h.current.options,n);h.current.setOptions(n),h.current.render({file:e,lineAnnotations:r,forceRender:a}),i!==void 0&&h.current.setSelectedLines(i)}),Gl(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`File: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`File: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,J.useCallback)(()=>h.current?.getHoveredLine(),[])}}function ql({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?$e:e?.renderCustomHeader,renderGutterUtility:r?$e:e?.renderGutterUtility}:e}var Y=t();function Jl({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,metrics:a,className:o,style:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,prerenderedHTML:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=Kl({file:e,options:r,editorOptions:i,metrics:a,lineAnnotations:t,selectedLines:n,prerenderedHTML:p,hasGutterRenderUtility:m!=null,hasCustomHeader:l!=null,disableWorkerPool:h,edit:g});return(0,Y.jsx)(le,{ref:_,className:o,style:s,children:ke(N({file:e,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,renderGutterUtility:m,lineAnnotations:t,getHoveredLine:v}),p)})}var Yl=100,Xl=1,Zl=2,Ql=3,$l=class{#e=[];#t=[];#n;#r=!1;constructor(e){this.#n=Math.max(1,e?.maxEntries??Yl)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}clear(){this.#e.length=0,this.#t.length=0,this.#r=!1}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#r=!0,this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}peekUndoForCoalescing(){return this.#r?this.peekUndo():void 0}replaceLastUndo(e){if(this.#e.length===0){this.push(e);return}this.#e[this.#e.length-1]=e,this.clearRedo(),this.#r=!0}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),this.#r=!1,e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),this.#r=!1,e}};function eu(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[],u;if(i?.length===c.length){let t=[];for(let n of i){if(n.start.line!==n.end.line||n.start.character!==n.end.character)break;t.push(e.offsetAt(n.start))}if(t.length===c.length){t.sort((e,t)=>e-t);let e=!0,n=!0;for(let r=0;r<c.length;r++){let i=c[r];if(i.text.length>0||i.start===i.end){e=!1,n=!1;break}e&&=t[r]===i.end,n&&=t[r]===i.start}u=e?Zl:n?Ql:void 0}}for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice(),coalescingMode:u}}function tu(e,t){if(e===void 0||e.undoBoundary===!0||t.undoBoundary===!0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=iu(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
|
|
1671
|
+
}`}var ta=new WeakMap;function na(e){let t=ta.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(ft,`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(),ta.set(e,i),i}function ra(e,t){if(!e.isConnected)return;let n=na(t);if(n==null)return;let r=t.querySelector(`style[${pt}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(pt,``),t.appendChild(i)),i.textContent=`:host { ${mt}: ${n}px; }`}var ia;function aa(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){ia??(ia=new CSSStyleSheet,ia.replaceSync($i(Zi)));let t=!1;try{e.adoptedStyleSheets=[ia],t=!0}catch{}if(t){e.querySelector(`style[${ut}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(ut,``),t.textContent=$i(Zi),e.prepend(t)}}function oa(e,t){sa(e,t),aa(t),ra(e,t)}function sa(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`});oa(this,e)}}if(customElements.define(lt,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(lt)))e instanceof HTMLElement&&oa(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var ca=e=>e.startsWith(`f::`)?e.slice(3):e;function la(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function ua(e,t){return e===``?t:`${e}/${t}`}function da({files:e,path:t,isFolder:n,nextBasename:r}){let i=ca(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}=la(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=ua(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 fa(e){return e.endsWith(`/`)}function pa(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 ma(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 ha(e,t){return t.includes(e)?ma(t):[e]}function ga(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 _a(e,t){return{draggedPaths:e,target:t}}function va(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(fa(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function ya(e,t){return t.kind===`root`||t.directoryPath==null?pa(e):t.directoryPath}function ba(e,t){let n=e.map(e=>{let n=ya(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 xa(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 Sa(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(!xa(Ki.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 Ca(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function wa(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 Ta(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Ea(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 Ta(e,t.path)?n?e:null:e;case`move`:return wa(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Ea(r,e,n),r==null)return null;return r}}}function Da(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Oa(e){switch(e.operation){case`add`:return{...Da(e),operation:`add`,path:e.path};case`remove`:return{...Da(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...Da(e),from:e.from,operation:`move`,to:e.to}}}function ka(e){return{...Da(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>Oa(e)),operation:`batch`}}function Aa(e){switch(e.operation){case`add`:case`remove`:case`move`:return Oa(e);case`batch`:return ka(e);default:return null}}function ja(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function Ma(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 Na(e){return Ma(e).at(-1)??null}function Pa(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function Fa(e){return e.endsWith(`/`)}var Ia=e=>e.toLowerCase();function La(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function Ra(e){return e.endsWith(`/`)?e.slice(0,-1):e}function za(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var Ba=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Va=Symbol(`FILE_TREE_RENAME_VIEW`),Ha=512,Ua=512;function Wa(e){return e===`top`||e===`center`?e:`nearest`}function Ga(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=Ma(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 Ka(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:Ga(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var qa=class{#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=Sa({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=Na(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:Wa(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<=Ua){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=ha(t,n);return this.#r.canDrag?.(r)===!1?!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=_a(t.draggedPaths,n);(va(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}ga(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=_a(e.draggedPaths,t);if(va(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=ba(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=Fa(r),a=Ra(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of Ma(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=La(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[Va](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#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,Fa(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,Fa(e)?{recursive:!0}:void 0);return}let t=Fa(e),n=da({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:Ra(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(za(n.sourcePath,t),za(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=Sa({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!ja(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=Na(e),n=Pa(e,t),r=null,i=null;for(let e of this.#be()){if(Na(e)!==t)continue;let a=Pa(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=Ma(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=!ja(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 Ki({...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 Ma(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(Ia),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(Ia),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 Ma(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:Ba(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 Ma(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 Ma(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=Ka(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,Ha)),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=Ea(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Ea(this.#c,e,!0),r=[...this.#B].map(t=>Ea(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Ea(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return ja(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&&Ca(e)&&(this.#i=null);let t=Ca(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=Aa(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},Ja=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 Ya(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 Xa(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 Za(e,t){return t?`${e}/`:e}function Qa(e,t=null){let n=Ja(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;for(let t of e??[]){let e=Ya(t.path);if(e==null)continue;let n=Za(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of Xa(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var G,$a,eo,to,no,ro,io,ao,oo,so,co={},lo=[],uo=Array.isArray,fo=lo.slice,po=Object.assign;function mo(e){e&&e.parentNode&&e.remove()}function ho(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?fo.call(arguments,2):n),go(e,o,r,i,null)}function go(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??++$a,__i:-1,__u:0};return i==null&&G.vnode!=null&&G.vnode(a),a}function _o(e){return e.children}function vo(e,t){this.props=e,this.context=t,this.__g=0}function yo(e,t){if(t==null)return e.__?yo(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`?yo(e):null}function bo(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 bo(e)}}function xo(e){(8&e.__g||!(e.__g|=8)||!eo.push(e)||no++)&&to==G.debounceRendering||((to=G.debounceRendering)||queueMicrotask)(So)}function So(){for(var e,t,n,r,i,a,o,s,c=1;eo.length;)eo.length>c&&eo.sort(ro),e=eo.shift(),c=eo.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=po({},r)).__v=r.__v+1,G.vnode&&G.vnode(n),Ao(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??yo(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,Mo(a,n,o),n.__e!=i&&bo(n)));no=0}function Co(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||lo,b=t.length;for(c=wo(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?co:y[m.__i]||co,m.__i=f,_=Ao(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Fo(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=To(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function wo(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?go(null,o,null,null,null):uo(o)?go(_o,{children:o},null,null,null):o.constructor==null&&o.__b>0?go(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=Eo(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=yo(s)),Io(s,s));return r}function To(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=To(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=yo(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Eo(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;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 Do(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function Oo(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||Do(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||Do(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(io,`$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=ao,e.addEventListener(t,a?so:oo,a)):e.removeEventListener(t,a?so:oo,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 ko(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=ao++;else if(t.u<n.l)return;return n(G.event?G.event(t):t)}}}function Ao(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,ee,k,A,j=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=G.__b)&&d(t);n:if(typeof j==`function`)try{if(v=t.props,y=`prototype`in j&&j.prototype.render,b=(d=j.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 j(v,x):(t.__c=f=new vo(v,x),f.constructor=j,f.render=Lo),b&&b.sub(f),f.props=v,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&&j.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=po({},f.__s)),po(f.__s,j.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&j.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&j.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=G.__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=po({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===_o&&d.key==null&&(E=No(d.props.children)),s=Co(e,uo(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=[],ee=0;ee<a.length;ee++)(k=a[ee])==null||O||(k.nodeType==8&&k.data==`$s`?(D>0&&t.__c.__z.push(k),D++,a[ee]=null):k.nodeType==8&&k.data==`/$s`?(--D>0&&t.__c.__z.push(k),O=D===0,s=a[ee],a[ee]=null):D>0&&(t.__c.__z.push(k),a[ee]=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(A=a.length;A--;)mo(a[A]);jo(t)}else t.__e=n.__e,t.__k=n.__k,e.then||jo(t);G.__e(e,t,n)}else s=t.__e=Po(n.__e,t,n,r,i,a,o,c,l,u);return(d=G.diffed)&&d(t),128&t.__u?void 0:s}function jo(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(jo)}function Mo(e,t,n){for(var r=0;r<n.length;r++)Fo(n[r],n[++r],n[++r]);G.__c&&G.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){G.__e(e,t.__v)}})}function No(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:uo(e)?e.map(No):po({},e)}function Po(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&&=(G.__m&&G.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=fo.call(e.childNodes),v=n.props||co,!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;Oo(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&&!_||Oo(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=``),Co(b==`template`?e.content:e,uo(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&yo(n,0),s,c,l),a!=null)for(u=a.length;u--;)mo(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||Oo(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&Oo(e,u,g,v[u],i))}return e}function Fo(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){G.__e(e,n)}}function Io(e,t,n){var r,i;if(G.unmount&&G.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Fo(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){G.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Io(r[i],t,n||typeof e.type!=`function`);n||mo(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Lo(e,t,n){return this.constructor(e,n)}function Ro(e,t){var n,r,i,a;t==document&&(t=document.documentElement),G.__&&G.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=ho(_o,null,[e]),i=[],a=[],Ao(t,e,r||co,co,t.namespaceURI,r?null:t.firstChild?fo.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),Mo(i,e,a)}function zo(e,t){e.__u|=32,Ro(e,t)}G={__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 no=0,e}},$a=0,vo.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=po({},this.state);typeof e==`function`&&(e=e(po({},n),this.props)),e&&po(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),xo(this))},vo.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),xo(this))},vo.prototype.render=_o,eo=[],no=0,ro=function(e,t){return e.__v.__b-t.__v.__b},io=/(PointerCapture)$|Capture$/i,ao=0,oo=ko(!1),so=ko(!0);var Bo=0;Array.isArray;function K(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:--Bo,__i:-1,__u:0,__source:i,__self:a};return G.vnode&&G.vnode(l),l}var Vo=16,Ho=16,Uo={};function Wo({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}=Uo[e]??{width:Vo,height:Ho},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return K(`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:K(`use`,{href:c})})}var Go=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},Ko=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},qo=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)]},Jo=(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)]},Yo=(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)]},Xo=(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 Zo({children:e,marker:t,variant:n=`default`}){"use no memo";return K(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:K(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?K(`span`,{"data-truncate-fade":!0}):t})})}function Qo(e){"use no memo";let{mode:t,children:n}=e;return K(`div`,{children:[K(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?K(`span`,{children:n}):n}),K(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?K(`span`,{children:n}):n})]})}function $o({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=K(Qo,{mode:t,children:e},`content`),o=K(Zo,{marker:n,mode:t,variant:r},`marker`),s=K(`div`,{"data-truncate-fill":!0},`fill`);return K(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:K(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function es({children:e,...t}){"use no memo";return K($o,{mode:`truncate`,...t,children:e})}function ts({children:e,...t}){"use no memo";return K($o,{mode:`fruncate`,...t,children:e})}function ns({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=K(es,{...s,children:t[0]}),l=K(ts,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return K(`div`,{className:a,style:o});if(e.length<i)return K(n===`end`?ts:es,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Go:r===`extension`?t=Ko:r===`leaf-path`&&(t=qo);else if(typeof r==`number`)t=Jo,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=Yo:e===`first`&&(t=Xo)}else typeof r==`function`&&(t=r);t??=Go;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=K(es,{...s,..._,children:f}),l=K(ts,{...s,...v,children:p})}return K(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[K(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),K(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var rs={endIndex:-1,startIndex:-1};function is(e,t,n){return Math.min(Math.max(e,t),n)}function as(e,t){return e<0||t<e?rs:{endIndex:t,startIndex:e}}function os(e){return e.startIndex<0||e.endIndex<e.startIndex}function ss(e,t){return os(e)?0:(e.endIndex-e.startIndex+1)*t}function cs(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function ls(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function us(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 ds(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 fs(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 ps(e,t,n){if(e.length===0||t<=0)return[];let r=fs(e),i=us(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=ds(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 ms(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=is(t.scrollTop,0,o),c=t.stickyRows??ps(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=cs(s,n,t.itemHeight),m=cs(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?rs:as(m,ls(u+d,n,t.itemHeight)),y=g+1,b=os(v)?rs:as(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=ss(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:os(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var hs={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},gs={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},_s=`Contains git status items`;function vs(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 ys(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return vs({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 bs(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 xs(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 Ss(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 Cs(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function ws(e,t){return e!=null&&e>0?e:t}function Ts(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 Es(e,t,n,r,i=0){let a=vs({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function Ds(e,t,n,r,i,a,o=0){let s=ys({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function Os(e,t,n,r,i,a){let o=bs({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function ks(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function As(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function js({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return K(`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 Ms(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 Ns(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 Ps,Fs,Is,Ls,Rs=Object.is,zs=0,Bs=[],Vs=G,Hs=Vs.__b,Us=Vs.__r,Ws=Vs.diffed,Gs=Vs.__c,Ks=Vs.unmount,qs=Vs.__;function Js(e,t){Vs.__h&&Vs.__h(Fs,e,zs||t),zs=0;var n=Fs.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Ys(e){return zs=1,Xs(sc,e)}function Xs(e,t,n){var r=Js(Ps++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):sc(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Rs(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Fs,!Fs.__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,Rs(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};Fs.__f=!0;var a=Fs.shouldComponentUpdate,o=Fs.componentWillUpdate;Fs.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)},Fs.shouldComponentUpdate=i}return r.__N||r.__}function Zs(e,t){var n=Js(Ps++,3);!Vs.__s&&oc(n.__H,t)&&(n.__=e,n.u=t,Fs.__H.__h.push(n))}function Qs(e,t){var n=Js(Ps++,4);!Vs.__s&&oc(n.__H,t)&&(n.__=e,n.u=t,Fs.__h.push(n))}function q(e){return zs=5,$s(function(){return{current:e}},[])}function $s(e,t){var n=Js(Ps++,7);return oc(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ec(e,t){return zs=8,$s(function(){return e},t)}function tc(){for(var e;e=Bs.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ic),e.__H.__h.forEach(ac),e.__H.__h=[]}catch(t){e.__H.__h=[],Vs.__e(t,e.__v)}}Vs.__b=function(e){Fs=null,Hs&&Hs(e)},Vs.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),qs&&qs(e,t)},Vs.__r=function(e){Us&&Us(e),Ps=0;var t=(Fs=e.__c).__H;t&&(Is===Fs?(t.__h=[],Fs.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(ic),t.__h.forEach(ac),t.__h=[],Ps=0)),Is=Fs},Vs.diffed=function(e){Ws&&Ws(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Bs.push(t)!==1&&Ls===Vs.requestAnimationFrame||((Ls=Vs.requestAnimationFrame)||rc)(tc)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Is=Fs=null},Vs.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ic),e.__h=e.__h.filter(function(e){return!e.__||ac(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Vs.__e(n,e.__v)}}),Gs&&Gs(e,t)},Vs.unmount=function(e){Ks&&Ks(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ic(e)}catch(e){t=e}}),n.__H=void 0,t&&Vs.__e(t,n.__v))};var nc=typeof requestAnimationFrame==`function`;function rc(e){var t,n=function(){clearTimeout(r),nc&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);nc&&(t=requestAnimationFrame(n))}function ic(e){var t=Fs,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Fs=t}function ac(e){var t=Fs;e.__c=e.__(),Fs=t}function oc(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!Rs(t,e[n])})}function sc(e,t){return typeof t==`function`?t(e):t}function cc(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:K(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return K(_o,{children:[K(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:K(es,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function lc(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function uc(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function dc(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 fc({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=ms(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:dc(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?dc(u,1,t,o):i&&r<=0&&c.length>0?ps(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 pc=400,mc=10,hc=40,gc=18;function _c(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))?vc(e,t,n):a instanceof HTMLElement?a:null}function vc(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 yc(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 bc(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 xc(){return navigator.vendor!==`Apple Computer, Inc.`}function Sc(e,t){let n=e-t.top;if(n<hc)return-Math.ceil((hc-Math.max(0,n))/hc*gc);let r=t.bottom-e;return r<hc?Math.ceil((hc-Math.max(0,r))/hc*gc):0}function Cc(e,t){if(e!=null){let t=hs[e];return t==null?null:{text:t,title:gs[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:_s}:null}function wc(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 Tc(e){return e!=null&&`toggle`in e}function Ec(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function Dc(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function Oc(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function kc(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function Ac(e,t){return t&&kc(e)||(e.ctrlKey||e.metaKey)&&Ec(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var jc=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function Mc(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 Nc(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 Pc(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Fc(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function Ic(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function Lc(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 Rc(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 zc(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 Bc(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=zc(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 Vc(e,t){return{kind:e.kind,name:uc(e),path:t}}function Hc(e){return e==null?void 0:`${e}__tree`}function Uc(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function Wc(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Gc(e,t){if(e==null)return null;if(`text`in e)return K(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?Wc(e.icon)?t(e.icon):{name:e.icon}:Wc(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return K(`span`,{title:e.title,children:K(Wo,{...n})})}function Kc(e){e!=null&&xs(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function qc(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=lc(e);return K(_o,{children:[e.depth>0?K(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>K(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,K(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?K(Wo,{...t(`file-tree-icon-chevron`)}):K(Wo,{...t(`file-tree-icon-file`,u)})}),K(`div`,{"data-item-section":`content`,children:e.isFlattened?cc(e,c,a):c??K(ns,{minimumLength:5,split:`extension`,children:e.name})}),i?K(`div`,{"data-item-section":`decoration`,children:r==null?null:Gc(r,t)}):null,s?K(`div`,{"data-item-section":`git`,children:Gc(o,t)}):null,n?K(`div`,{"data-item-section":`action`,children:l?K(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:K(Wo,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function Jc(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:ee,renderDecorationForRow:k,openContextMenuForRow:A,onRowClick:j,onKeyDown:M}=e,N=lc(t),{isParked:P=!1,mode:te=`flow`,style:ne}=r,re=te===`sticky`,ie=_?.get(N)??null??wc(t.ancestorPaths,v,y),ae=t.kind===`directory`&&(b?.has(N)??!1),oe=k(t,N),se=Cc(ie,ae),ce=S&&w,le=oe!=null||x||ce,ue=ce&&T===`always`,de=a.getPath()===N,fe=de?a.getValue():``,F=re||!de?null:K(js,{ref:D,ariaLabel:`Rename ${uc(t)}`,isFlattened:t.isFlattened,value:fe,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),pe=qc(t,ee,{actionLaneEnabled:ce,customDecoration:oe,decorationLaneEnabled:le,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:se,gitLaneActive:x,renameInput:F,showDecorativeActionAffordance:ue}),me={...Ms({ariaLabel:uc(t),domId:t.isFocused?Uc(h,N,P):void 0,extraStyle:ne,features:{actionLaneEnabled:ce,contextMenuButtonVisibility:ce?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:P,itemHeight:g,mode:te,row:t,state:{containsGitChange:ae,effectiveGitStatus:ie,isContextHovered:s===N,isDragTarget:l?.kind===`directory`&&l.directoryPath===N,isDragging:c?.has(N)===!0,isFocusRinged:t.isFocused&&o===N},targetPath:N}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(N),A(t,N,{anchorRect:Pc(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:re?void 0:()=>{i.focusMountedPathFromInput(N)},onKeyDown:re?void 0:M,ref:e=>{O(N,e)}};return!re&&de?K(`div`,{...me,children:pe}):K(`button`,{...me,type:`button`,draggable:u&&!P,onDragEnd:u&&!P?p:void 0,onDragStart:u&&!P?e=>{f(e,t,N)}:void 0,onMouseDown:e=>{if(re){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!P?e=>{m(e,t,N)}:void 0,onClick:e=>{j(e,t,N,te)},children:pe})}function Yc(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(lc(e))).map((n,r)=>Jc(e,n,t.start+r))}function Xc({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Xi,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),ee=q(0),k=q(!1),A=q(null);A.current!==t&&(k.current=!1,A.current=t);let j=q(!1),M=q(null),N=q(null),P=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),F=q(null),pe=$s(()=>new Map,[]),[,me]=Ys(0),[he,I]=Ys(null),[ge,_e]=Ys(null),[ve,ye]=Ys(null),[be,xe]=Ys(null),[Ce,we]=Ys(0),[L,Te]=Ys(null),Ee=q(L);Ee.current=L;let De=q(null),Oe=q(null),ke=q(null),Ae=q(null),je=q(null),Me=q(!1),Ne=()=>{Oe.current=null,ke.current=null,Ae.current=null},Pe=(e,t)=>{Oe.current=e,ke.current=null,Ae.current=t==null?null:{path:e,scrollTop:t}},Fe=(e,t)=>{Oe.current=null,ke.current={path:e,viewportOffset:t},Ae.current=null},Ie=q(d===`retain`&&t.isSearchOpen()),[Le,Re]=Ys(p);Zs(()=>{p||Re(!1)},[p]);let ze=q(!1),Be=ec(()=>{ze.current=!0,Re(e=>e&&!1)},[]),[Ve,He]=Ys(()=>fc({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ue,We]=Ys(!1);Zs(()=>{We(!0)},[]);let Ge=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ke=e?.contextMenu?.triggerMode??(Ge?`right-click`:`both`),qe=Ke===`both`||Ke===`button`,Je=e?.contextMenu?.buttonVisibility??`when-needed`,Ye=Ke===`both`||Ke===`right-click`;Qs(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;je.current=t,_e(t),xe(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Me.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 Xe=ec((e,t)=>{Ic(T.current,e,t)},[]),Ze=ec((e,t)=>{Ic(E.current,e,t)},[]),Qe=ec(e=>{x.current=e},[]),$e=ec(e=>Lc(e,E.current,T.current),[]),et=n!=null||r!=null||i!=null,{resolveIcon:tt}=$s(()=>Se(a),[a]),nt=t[Va](),rt=nt.getPath(),it=rt!=null,at=t.isSearchOpen(),ot=t.getSearchValue(),R=t.getFocusedPath(),z=t.getFocusedIndex(),st=t.getScrollRequest(),ct=t.isDragAndDropEnabled(),lt=t.getDragSession(),ut=$s(()=>lt==null?null:new Set(lt.draggedPaths),[lt]),dt=lt?.target??null,ft=lt?.primaryPath??null,pt=Hc(o),{overlayHeight:mt,overlayRows:vt,snapshot:yt,visibleRows:bt}=Ve,xt=yt.physical.viewportHeight,St=$s(()=>({end:yt.window.endIndex,start:yt.window.startIndex}),[yt.window.endIndex,yt.window.startIndex]),Ct=vt,wt=yt.sticky.rows,Tt=yt.physical.totalHeight,Et=yt.sticky.height,Dt=$s(()=>new Set(wt.map(e=>lc(e.row))),[wt]),Ot=z>=0&&z>=St.start&&z<=St.end,kt=ec((e,t)=>u?.({item:Vc(e,t),row:e})??null,[u]),At=ec(e=>xs(e==null?null:T.current.get(e)??null)?!0:xs(S.current),[]),jt=ec(e=>{At(t.focusNearestPath(e))},[t,At]),Mt=q(jt);Mt.current=jt;let Nt=q(!0),Pt=q(()=>{}),Ft=ec((t=!0)=>{let n=Ee.current;n!=null&&(Nt.current=Nt.current&&t,Te(null),e?.contextMenu?.onClose?.(),Nt.current&&jt(n.path))},[e?.contextMenu,jt]);Pt.current=Ft;let It=ec(e=>{let t=e==null?null:Fc(S.current,e);ye(e=>e===t?e:t)},[]),Lt=ec((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=$e(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Pe(n,e?.scrollTop??null),j.current=!0,I(e=>e===n?e:n)}i.focus(),It(a),Nt.current=!0,Te({anchorRect:r?.anchorRect??null,item:Vc(e,n),path:n,source:r?.source??`keyboard`})},[t,$e,It]),Rt=ec(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=Cs(e,xt);te.current=z<0||e==null?null:Math.max(0,Math.min(z*s-e.scrollTop,Math.max(0,t-s))),P.current=!0}t.startRenaming(e)!==!1&&(xe(`focus`),me(e=>e+1))}},[t,z,s,l,xt]),zt=ec((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=Cs(i,xt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:fc({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return j.current=!0,Os(i,a,s,l,u,d),D.current(),De.current=n?e:null,!0},[t,s,c,xt,h]),B=()=>y.current===!0||F.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,F.current!=null&&(clearTimeout(F.current),F.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},V=(e,n)=>{let r=S.current?.getRootNode(),i=yc(_c(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},qt=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=Tc(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))},Jt=()=>{ne.current=null;let e=ae.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=Sc(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()),qt(V(e.clientX,e.clientY)),ne.current=Bt(Jt)},Yt=(e,t)=>{ae.current={clientX:e,clientY:t},ne.current??=Bt(Jt)},Xt=(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),xc())){let t=bc(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))}}},Zt=()=>{Ut(),Ht(),Wt(),se.current=null,t.cancelDrag()},Qt=(e,n,r)=>{if(F.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;F.current!=null&&(clearTimeout(F.current),F.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<=mc*mc||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),ce.current=o,F.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=bc(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)`),qt(V(t.clientX,t.clientY)),Yt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&V(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)},pc)},$t=e=>{if(L!=null){if(e.key===`Escape`){Ft(),e.preventDefault(),e.stopPropagation();return}jc.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(nt.isActive()){if(e.key===`Escape`)nt.cancel();else if(e.key===`Enter`)nt.commit();else return;xe(`focus`),me(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Rt(R??void 0),e.preventDefault(),e.stopPropagation();return}if(at){if(e.key===`Escape`)P.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=Cs(n,xt);te.current=z<0||n==null?null:Math.max(0,Math.min(z*s-n.scrollTop,Math.max(0,r-s))),P.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;xe(`focus`),me(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&Dc(e)){t.openSearch(e.key),me(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ge&&kc(e),r=Ac(e,Ge),i=r&&S.current!=null?Ss(S.current):null,a=r?new Set(Rc(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==R&&a.has(o)){let e=C.current;Pe(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=Tc(p)?p:null,h=u!=null&&(Dt.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=Lc(u,E.current,T.current);e==null||n==null?y=!1:Lt(e,u)}else if((e.ctrlKey||e.metaKey)&&Ec(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;xe(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Dt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Pe(b,v?.scrollTop??null),j.current=!0,I(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Fe(b,Bc(S.current,v,i,u,s,Et,xt)),j.current=!0,I(e=>e===b?e:b)):Ne()}me(e=>e+1),e.preventDefault(),e.stopPropagation()};Qs(()=>{if(!(!f||!at)){if(Ie.current){Ie.current=!1;return}xs(w.current)}},[at,f]),Qs(()=>{let e=x.current;switch(As({hasRenderedInput:e!=null,previousRenamingPath:N.current,renamingPath:rt})){case`reset`:N.current=null;return;case`reveal-canonical`:rt!=null&&zt(rt,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(De.current=null,N.current=rt,xs(e),e.select());return}},[St.end,St.start,rt,zt,Dt]),Qs(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=Ss(e)?.dataset.itemPath??null;I(e=>e===t?e:t)},i=()=>{n(),j.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,Ss(e)!=null){r();return}j.current=!1,I(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),j.current=!1,I(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;I(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),Qs(()=>{let e=S.current;e!=null&&(yt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[yt.physical.scrollTop]),Qs(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=Cs(n,g);let a=()=>{let e=t.getVisibleCount(),r=ws(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),He(fc({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!k.current){k.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=ws(O.current,g),i=t.getVisibleRows(e,e)[0]??null;Es(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=!1,l=t.subscribe(()=>{o?me(e=>e+1):o=!0,a()}),u=()=>{Me.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,we(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||Me.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),Ee.current!=null&&y.current&&Pt.current(),Me.current===!0){y.current=!1;return}_e(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:Ts(e[0]))??Cs(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),Qs(()=>{Ge||L==null||Ft(!1)},[Ft,Ge,L]);let en=$s(()=>L==null?null:`${L.path}::${L.source}`,[L]);Qs(()=>{if(en==null){m?.clearSlotContent(gt);return}let t=Ee.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??Nc(n.getBoundingClientRect()),close:e=>{Pt.current(e?.restoreFocus??!0)},restoreFocus:()=>{Nt.current&&Mt.current(Ee.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(gt,i),e?.contextMenu?.onOpen?.(t.item,r),Kc(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&Kc(i)}),()=>{m?.clearSlotContent(gt)}},[en,e?.contextMenu,m]),Qs(()=>{L!=null&&t.getItem(L.path)==null&&Ft()},[Ft,L,t]),Qs(()=>{if(L==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(Mc(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Ft())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Ft())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Ft,L]),Qs(()=>{let e=C.current,n=S.current;if(e==null||n==null){M.current=R;return}let r=R==null?null:T.current.get(R)??null,i=Ss(n),a=i?.dataset.itemPath??null,o=it&&x.current===i,c=f&&w.current===i,l=P.current&&!at,u=te.current??0,d=De.current,p=Oe.current,m=ke.current,g=Ae.current,_=i!=null,v=j.current||_,y=M.current!==R,b=p!=null&&p===R&&R!=null,E=!1,O=!1;if(st!=null&&st.id!==ee.current){ee.current=st.id;let n=st.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,xt-s))):Et;E=!0,O=Ds(e,n,s,xt,Tt,st.offset,t)}t.clearScrollRequest(st.id)}let k=!E&&l&&Os(e,z,s,xt,Tt,u),A=!E&&d!=null&&d===R&&Os(e,z,s,xt,Tt,Et),N=!E&&m!=null&&m.path===R&&Os(e,z,s,xt,Tt,m.viewportOffset),ne=!E&&g!=null&&g.path===R&&e.scrollTop!==g.scrollTop;if(ne&&(e.scrollTop=g.scrollTop),(ne||O||A||N||k||v&&y&&d!==R&&!b&&Es(e,z,s,xt,Et))&&D.current(),E){M.current=R;return}if(!v){M.current=R;return}if(o){M.current=R;return}if(c&&!l){M.current=R;return}if(r==null){l&&z>=0&&(Os(e,z,s,xt,Tt,u),D.current()),M.current=R;return}(y||l||d===R||p===R||m?.path===R||g?.path===R||a==null||a!==R)&&(xs(r),d===R&&(De.current=null),p===R&&(Oe.current=null),m?.path===R&&(ke.current=null),g?.path===R&&(Ae.current=null),P.current=!1,te.current=null),M.current=R},[t,z,R,Ot,s,it,at,St,xt,f,st,h,Et,Tt,bt]);let tn=z>=0&&z>=yt.visible.startIndex&&z<=yt.visible.endIndex,nn=R!=null&&Ct.some(e=>lc(e.row)===R),rn=tn||nn,an=qe&&j.current===!0&&rn?R:null,on=be===`pointer`?ge:null,sn=L?.path??je.current??on??an??ge,cn=L?.source===`right-click`;Qs(()=>{y.current&&L==null||It($e(sn))},[L,$e,St,xt,Ce,Ct,sn,It,bt]);let ln=ec(e=>{if(y.current||Mc(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&&xe(e=>e===`pointer`?e:`pointer`),_e(e=>e===i?e:i)},[]),un=ec(()=>{_e(null)},[]);Qs(()=>{if(!ct)return;let e=()=>{Kt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Kt(),t.cancelDrag()}},[t,ct]);let dn=e=>{if(!ct||t.getDragSession()==null||le.current)return;let n=yc(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),qt(t.getDragSession()?.target??null),Yt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},fn=e=>{if(!ct||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=>{!ct||t.getDragSession()==null||le.current||(e.preventDefault(),V(e.clientX,e.clientY),t.completeDrag(),Ut(),Ht(),Wt(),se.current=null)},mn=yt.window.height,hn=yt.window.offsetTop,gn=Math.min(0,xt-mn),_n=Math.min(0,xt-mn-Et),vn=he===R||P.current,yn=R!=null&&vn&&!Ot&&z>=0?bt[z]??t.getVisibleRows(z,z)[0]??null:null,bn=yn==null?null:ks(z,s,St,mn),xn=se.current,Sn=ft!=null&&xn!=null&&xn.path===ft&&xn.index>=St.start&&xn.index<=St.end,Cn=ft!=null&&xn!=null&&xn.path===ft&&!Sn&&xn.path!==yn?.path?xn:null,wn=Cn==null?null:ks(Cn.index,s,St,mn),Tn=Oc((z>=0?bt[z]??t.getVisibleRows(z,z)[0]??null:null)?.ancestorPaths.at(-1)??null),En=at&&R!=null?Uc(o,R,!Ot):void 0,Dn=L?.path??(at?R:he),On=L?.path??ge,kn=$e(sn),An=Ge&&qe&&!cn&&!it&&kn!=null&&ve!=null&&sn!=null,jn=Ge&&(An||L!=null),Mn=L?.anchorRect,Nn=Mn==null&&kn!=null&&ve!=null&&(L!=null||An)?ve:null,Pn=Mn==null?Nn==null?void 0:{top:`${Nn}px`}:{left:`${Mn.left}px`,position:`fixed`,right:`auto`,top:`${Mn.top}px`},Fn=cn?{opacity:`0`}:void 0,In=ec((e,n,r,i)=>{let a=Ns({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:at,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);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=yt.visible.startIndex&&n.index<=yt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(j.current=!0,I(e=>e===c?e:c),xe(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&zt(c,{targetOffset:`sticky-parents`})},[t,at,yt.visible.endIndex,yt.visible.startIndex,zt]),Ln=()=>{if(y.current||!qe||sn==null||kn==null)return;let e=t.getItem(sn);e!=null&&(It(kn),Nt.current=!0,Te({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:kn.getAttribute(`aria-label`)??sn,path:e.getPath()},path:e.getPath(),source:`button`}))},Rn={contextHoverPath:On,contextMenuButtonTriggerEnabled:qe,contextMenuButtonVisibility:Je,contextMenuEnabled:Ge,contextMenuRightClickEnabled:Ye,contextMenuTriggerMode:Ke,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:ct,draggedPathSet:ut,dragTarget:dt,gitLaneActive:et,gitStatusByPath:n,handleRowDragEnd:Zt,handleRowDragStart:Xt,handleRowTouchStart:Qt,ignoredGitDirectories:r,ignoredInheritanceCache:pe,instanceId:o,itemHeight:s,onKeyDown:$t,onRowClick:In,openContextMenuForRow:Lt,registerButton:Xe,registerRenameInput:Qe,renameView:nt,renderDecorationForRow:kt,resolveIcon:tt,shouldSuppressContextMenu:B,visualFocusPath:Dn},zn={...Rn,registerButton:Ze};return K(`div`,{ref:S,id:pt,"data-file-tree-context-menu-button-visibility":Ge&&qe?Je:void 0,"data-file-tree-context-menu-trigger-mode":Ge?Ke:void 0,"data-file-tree-has-context-menu-action-lane":Ge&&qe?`true`:void 0,"data-file-tree-has-git-lane":et?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:ct?fn:void 0,onDragOver:ct?dn:void 0,onDrop:ct?pn:void 0,onKeyDown:$t,onPointerLeave:Ge?un:void 0,onPointerOver:Ge?ln:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[K(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:Tn}}),K(`slot`,{name:ht,"data-type":`header-slot`}),f?K(`div`,{"data-file-tree-search-container":!0,"data-open":at?`true`:`false`,children:K(`input`,{ref:w,"aria-activedescendant":En,"aria-controls":pt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Le?`true`:void 0,value:ot,onBlur:()=>{d===`retain`&&!ze.current||t.closeSearch()},onFocus:Be,onPointerDown:Be,onInput:e=>{Be();let n=e.currentTarget;t.setSearch(n.value)}})}):null,K(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ue&&Ct.length>0?K(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:K(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${mt}px`},children:Ct.map((e,t)=>Jc(zn,e.row,`sticky:${lc(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${Ct.length-t}`}}))})}):null,K(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${Tt}px`},children:[K(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${hn}px`}}),K(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${mn}px`,top:`${gn}px`,bottom:`${_n}px`},children:[Yc(Rn,St,Dt),yn!=null&&bn!=null?Jc(Rn,yn,`parked:${yn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:ft===yn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${bn}px`}}):null,Cn!=null&&wn!=null?Jc(Rn,Cn,`parked-drag:${Cn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${wn}px`}}):null]})]})]}),Ge?K(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":jn?`true`:`false`,style:Pn,children:[K(`button`,{ref:v,type:`button`,"data-type":_t,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":L==null?`false`:`true`,"data-visible":An?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),L!=null){Ft();return}Ln()},tabIndex:-1,style:Fn,children:K(Wo,{...tt(`file-tree-icon-ellipsis`)})}),L==null?null:K(`slot`,{name:gt})]}):null,L==null?null:K(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Ft()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Ft()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var Zc={hydrateRoot:(e,t)=>{zo(ho(Xc,t),e)},renderRoot:(e,t)=>{Ro(ho(Xc,t),e)},unmountRoot:e=>{Ro(null,e)}};function Qc(e,t){Zc.renderRoot(e,t)}function $c(e,t){Zc.hydrateRoot(e,t)}function el(e){Zc.unmountRoot(e)}var tl=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)}}},nl=`__c`,rl=`__k`,il=`__d`,al=`__s`,ol=/[\s\n\\/='"\0<>]/,sl=/^(xlink|xmlns|xml)([A-Z])/,cl=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,ll=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,ul=new Set([`draggable`,`spellcheck`]);function dl(e){e.__g===void 0?e[il]=!0:e.__g|=8}function fl(e){e.__g===void 0?e[il]=!1:e.__g&=-9}function pl(e){return e.__g===void 0?!0===e[il]:!!(8&e.__g)}var ml=/["&<]/;function hl(e){if(e.length===0||!1===ml.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`"`;break;case 38:i=`&`;break;case 60:i=`<`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var gl={},_l=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),vl=/[A-Z]/g;function yl(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:gl[n]||(gl[n]=n.replace(vl,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||_l.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function bl(){this.__d=!0}function xl(e,t){return{__v:e,context:t,props:e.props,setState:bl,forceUpdate:bl,__d:!0,__h:[]}}function Sl(e,t,n){if(!e.s){if(n instanceof Cl){if(!n.s)return void(n.o=Sl.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Sl.bind(null,e,t),Sl.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var Cl=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{Sl(r,1,a(this.v))}catch(e){Sl(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?Sl(r,1,t?t(i):i):n?Sl(r,1,n(i)):Sl(r,2,i)}catch(e){Sl(r,2,e)}},r},e}(),wl,Tl,El,Dl,Ol={},kl=Array.isArray,Al=Object.assign,jl=``,Ml=`<!--$s-->`,Nl=`<!--/$s-->`;function Pl(e,t){var n,r=e.type,i=!0;return e[nl]?(i=!1,(n=e[nl]).state=n[al]):n=new r(e.props,t),e[nl]=n,n.__v=e,n.props=e.props,n.context=t,dl(n),n.state??=Ol,n[al]??(n[al]=n.state),r.getDerivedStateFromProps?n.state=Al({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[al]===n.state?n.state:n[al]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),El&&El(e),n.render(n.props,n.state,t)}function Fl(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===jl)return jl;var s=typeof e;if(s!=`object`)return s==`function`?jl:s==`string`?hl(e):e+jl;if(kl(e)){var c,l=jl;i[rl]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=Fl(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=jl,kl(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return jl;e.__=i,wl&&wl(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===_o){if(`tpl`in g){for(var x=jl,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!kl(C)?x+=C:x+=Fl(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+hl(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=Pl(e,b),y=e[nl];else{e[nl]=y=xl(e,b);for(var E=0;pl(y)&&E++<25;){fl(y),El&&El(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}dl(y)}if(y.getChildContext!=null&&(t=Al({},t,y.getChildContext())),T&&G.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===_o&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return Fl(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[al]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,Ol),pl(y)?(v=Pl(e,t),(y=e[nl]).getChildContext!=null&&(t=Al({},t,y.getChildContext())),Fl(v=v!=null&&v.type===_o&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):jl}finally{Tl&&Tl(e),Dl&&Dl(e)}}}v=v!=null&&v.type===_o&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=Fl(v,t,n,r,e,a,o);return Tl&&Tl(e),G.unmount&&G.unmount(e),e._suspended?typeof D==`string`?Ml+D+Nl:kl(D)?(D.unshift(Ml),D.push(Nl),D):D.then(function(e){return Ml+e+Nl}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return Fl(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var ee=G.__e;return ee&&ee(i,e),jl}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=Fl(v,t,n,r,e,a,o);return e._suspended?Ml+s+Nl:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var k,A=`<`+h,j=jl;for(var M in g){var N=g[M];if(typeof(N=Ll(N)?N.value:N)!=`function`||M===`class`||M===`className`){switch(M){case`children`:k=N;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;M=`for`;break;case`className`:if(`class`in g)continue;M=`class`;break;case`defaultChecked`:M=`checked`;break;case`defaultSelected`:M=`selected`;break;case`defaultValue`:case`value`:switch(M=`value`,h){case`textarea`:k=N;continue;case`select`:r=N;continue;case`option`:r!=N||`selected`in g||(A+=` selected`)}break;case`dangerouslySetInnerHTML`:j=N&&N.__html;continue;case`style`:typeof N==`object`&&(N=yl(N));break;case`acceptCharset`:M=`accept-charset`;break;case`httpEquiv`:M=`http-equiv`;break;default:if(sl.test(M))M=M.replace(sl,`$1:$2`).toLowerCase();else{if(ol.test(M))continue;M[4]!==`-`&&!ul.has(M)||N==null?n?ll.test(M)&&(M=M===`panose1`?`panose-1`:M.replace(/([A-Z])/g,`-$1`).toLowerCase()):cl.test(M)&&(M=M.toLowerCase()):N+=jl}}N!=null&&!1!==N&&(A=!0===N||N===jl?A+` `+M:A+` `+M+`="`+(typeof N==`string`?hl(N):N+jl)+`"`)}}if(ol.test(h))throw Error(h+` is not a valid HTML tag name in `+A+`>`);if(j||(typeof k==`string`?j=hl(k):k!=null&&!1!==k&&!0!==k&&(j=Fl(k,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),Tl&&Tl(e),Dl&&Dl(e),!j&&Il.has(h))return A+`/>`;var P=`</`+h+`>`,te=A+`>`;return kl(j)?[te].concat(j,[P]):typeof j==`string`?te+j+P:[te,j,P]}var Il=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function Ll(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var Rl=0;function zl(e){return e!=null&&e.length>0?e:(Rl+=1,`pst_ft_${Rl}`)}function Bl({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Xi)}function Vl(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 Hl(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 Ul(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var Wl=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new tl;#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=zl(a),this.#p=Qa(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=Yi(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new qa({...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&&(el(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()}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)}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)}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){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),Qc(t.wrapper,this.#w()))}setGitStatus(e){this.#p=Qa(e,this.#p);let t=this.#T();t!=null&&Qc(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),Qc(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),$c(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),Qc(r,this.#w())}#C(){return{initialViewportHeight:Bl({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(ht,e());return}this.#l.setSlotHtml(ht,this.#e?.header?.html??null)}#k(e){let t=Ul(e).find(e=>Hl(e)),n=Vl(be(fe(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=Ul(e),n=t.find(e=>Hl(e)),r=t.filter(e=>e!==n),i=fe(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=Vl(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=fe(this.#m);t.colored&&Ce(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${dt}]`);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(dt,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=ea(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 oa(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)}},J=e(n(),1),Gl=typeof window>`u`?J.useEffect:J.useLayoutEffect;function Kl({file:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=tt(),f=i!==void 0,p=(0,J.useContext)(et),m=se(),h=(0,J.useRef)(null),g=oe(n=>{if(n!=null){if(h.current!=null)throw Error(`File: An instance should not already exist when a node is created`);d==null?h.current=new N(ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new M(ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({file:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`File: A File instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return Gl(()=>{if(h.current==null)return;let n=ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),a=n!==void 0&&!ke(h.current.options,n);h.current.setOptions(n),h.current.render({file:e,lineAnnotations:r,forceRender:a}),i!==void 0&&h.current.setSelectedLines(i)}),Gl(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`File: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`File: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,J.useCallback)(()=>h.current?.getHoveredLine(),[])}}function ql({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?Qe:e?.renderCustomHeader,renderGutterUtility:r?Qe:e?.renderGutterUtility}:e}var Y=t();function Jl({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,metrics:a,className:o,style:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,prerenderedHTML:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=Kl({file:e,options:r,editorOptions:i,metrics:a,lineAnnotations:t,selectedLines:n,prerenderedHTML:p,hasGutterRenderUtility:m!=null,hasCustomHeader:l!=null,disableWorkerPool:h,edit:g});return(0,Y.jsx)(ce,{ref:_,className:o,style:s,children:Oe(P({file:e,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,renderGutterUtility:m,lineAnnotations:t,getHoveredLine:v}),p)})}var Yl=100,Xl=1,Zl=2,Ql=3,$l=class{#e=[];#t=[];#n;#r=!1;constructor(e){this.#n=Math.max(1,e?.maxEntries??Yl)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}clear(){this.#e.length=0,this.#t.length=0,this.#r=!1}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#r=!0,this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}peekUndoForCoalescing(){return this.#r?this.peekUndo():void 0}replaceLastUndo(e){if(this.#e.length===0){this.push(e);return}this.#e[this.#e.length-1]=e,this.clearRedo(),this.#r=!0}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),this.#r=!1,e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),this.#r=!1,e}};function eu(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[],u;if(i?.length===c.length){let t=[];for(let n of i){if(n.start.line!==n.end.line||n.start.character!==n.end.character)break;t.push(e.offsetAt(n.start))}if(t.length===c.length){t.sort((e,t)=>e-t);let e=!0,n=!0;for(let r=0;r<c.length;r++){let i=c[r];if(i.text.length>0||i.start===i.end){e=!1,n=!1;break}e&&=t[r]===i.end,n&&=t[r]===i.start}u=e?Zl:n?Ql:void 0}}for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice(),coalescingMode:u}}function tu(e,t){if(e===void 0||e.undoBoundary===!0||t.undoBoundary===!0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=iu(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
|
|
1672
1672
|
`)&&!a.text.includes(`
|
|
1673
1673
|
`),u=o.start===o.end&&o.text.length>0&&!o.text.includes(`
|
|
1674
|
-
`)&&s.text.length===0;if(l&&u){if(o.start!==a.end||(n??=Xl,n!==Xl||e.coalescingMode!==void 0&&e.coalescingMode!==Xl||t.coalescingMode!==void 0&&t.coalescingMode!==Xl))return!1;continue}let d=i.text.length===0&&i.end>i.start&&a.text.length>0,f=o.text.length===0&&o.end>o.start&&s.text.length>0;if(d&&f){let r;if(c===i.end)r=Ql;else if(c+(o.end-o.start)!==i.start)return!1;else r=Zl;if(n??=r,n!==r||e.coalescingMode!==void 0&&e.coalescingMode!==r||t.coalescingMode!==void 0&&t.coalescingMode!==r)return!1;continue}return!1}return n!==void 0}function nu(e,t){let n=[],r=[],i;for(let a=0;a<e.forwardEdits.length;a++){let o=e.forwardEdits[a],s=e.inverseEdits[a],c=t.forwardEdits[a],l=t.inverseEdits[a],u=iu(c.start,e.forwardEdits);if(o.text.length>0){i??=Xl,n.push({start:o.start,end:o.end,text:o.text+c.text}),r.push(s.text);continue}if(u===o.end){i??=Ql,n.push({start:o.start,end:u+(c.end-c.start),text:``}),r.push(s.text+l.text);continue}i??=Zl,n.push({start:Math.min(o.start,u),end:o.end,text:``}),r.push(l.text+s.text)}return{forwardEdits:n,inverseEdits:ru(n,r),versionBefore:e.versionBefore,versionAfter:t.versionAfter,selectionsBefore:e.selectionsBefore?.slice(),selectionsAfter:t.selectionsAfter?.slice(),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:t.lineAnnotationsAfter?.slice(),coalescingMode:i}}function ru(e,t){let n=[];for(let r=0,i=0;r<e.length;r++){let a=e[r],o=a.start+i;n.push({start:o,end:o+a.text.length,text:t[r]}),i+=a.text.length-(a.end-a.start)}return n}function iu(e,t){let n=e;for(let e of t){let t=e.end-e.start,r=e.text.length,i=r-t;if(!(n<e.start)){if(n>=e.start+r){n-=i;continue}n=e.start+Math.min(n-e.start,t)}}return n}var au=1e5,ou=10,su=13,cu=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,lu=class{source;offset;length;lineOffsetStart;lineOffsetEnd;hasVirtualTrailingCRBreak;firstCharCode;lastCharCode;static Original=0;static Added=1;constructor(e,t,n,r,i,a,o,s){this.source=e,this.offset=t,this.length=n,this.lineOffsetStart=r,this.lineOffsetEnd=i,this.hasVirtualTrailingCRBreak=a,this.firstCharCode=o,this.lastCharCode=s}get lineBreakCount(){return this.lineOffsetEnd-this.lineOffsetStart+ +!!this.hasVirtualTrailingCRBreak}},uu=class{text;lineOffsets;constructor(e){this.text=e,this.lineOffsets=
|
|
1675
|
-
`)||e.text.includes(`\r`)||e.regex&&(e.text.includes(`\\n`)||e.text.includes(`\\r`)))return[];let t;try{t=Tu(e.text,e.regex,e.caseSensitive)}catch{return[]}return this.#l(t,e.wholeWord,au)}#l(e,t,n){let r=[],i=this.#g(),a=i.length,o=
|
|
1674
|
+
`)&&s.text.length===0;if(l&&u){if(o.start!==a.end||(n??=Xl,n!==Xl||e.coalescingMode!==void 0&&e.coalescingMode!==Xl||t.coalescingMode!==void 0&&t.coalescingMode!==Xl))return!1;continue}let d=i.text.length===0&&i.end>i.start&&a.text.length>0,f=o.text.length===0&&o.end>o.start&&s.text.length>0;if(d&&f){let r;if(c===i.end)r=Ql;else if(c+(o.end-o.start)!==i.start)return!1;else r=Zl;if(n??=r,n!==r||e.coalescingMode!==void 0&&e.coalescingMode!==r||t.coalescingMode!==void 0&&t.coalescingMode!==r)return!1;continue}return!1}return n!==void 0}function nu(e,t){let n=[],r=[],i;for(let a=0;a<e.forwardEdits.length;a++){let o=e.forwardEdits[a],s=e.inverseEdits[a],c=t.forwardEdits[a],l=t.inverseEdits[a],u=iu(c.start,e.forwardEdits);if(o.text.length>0){i??=Xl,n.push({start:o.start,end:o.end,text:o.text+c.text}),r.push(s.text);continue}if(u===o.end){i??=Ql,n.push({start:o.start,end:u+(c.end-c.start),text:``}),r.push(s.text+l.text);continue}i??=Zl,n.push({start:Math.min(o.start,u),end:o.end,text:``}),r.push(l.text+s.text)}return{forwardEdits:n,inverseEdits:ru(n,r),versionBefore:e.versionBefore,versionAfter:t.versionAfter,selectionsBefore:e.selectionsBefore?.slice(),selectionsAfter:t.selectionsAfter?.slice(),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:t.lineAnnotationsAfter?.slice(),coalescingMode:i}}function ru(e,t){let n=[];for(let r=0,i=0;r<e.length;r++){let a=e[r],o=a.start+i;n.push({start:o,end:o+a.text.length,text:t[r]}),i+=a.text.length-(a.end-a.start)}return n}function iu(e,t){let n=e;for(let e of t){let t=e.end-e.start,r=e.text.length,i=r-t;if(!(n<e.start)){if(n>=e.start+r){n-=i;continue}n=e.start+Math.min(n-e.start,t)}}return n}var au=1e5,ou=10,su=13,cu=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,lu=class{source;offset;length;lineOffsetStart;lineOffsetEnd;hasVirtualTrailingCRBreak;firstCharCode;lastCharCode;static Original=0;static Added=1;constructor(e,t,n,r,i,a,o,s){this.source=e,this.offset=t,this.length=n,this.lineOffsetStart=r,this.lineOffsetEnd=i,this.hasVirtualTrailingCRBreak=a,this.firstCharCode=o,this.lastCharCode=s}get lineBreakCount(){return this.lineOffsetEnd-this.lineOffsetStart+ +!!this.hasVirtualTrailingCRBreak}},uu=class{text;lineOffsets;constructor(e){this.text=e,this.lineOffsets=pe(e)}append(e){let t=this.text.length;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r!==ou&&r!==su||(r===su&&e.charCodeAt(n+1)===ou&&n++,this.lineOffsets.push(t+n+1))}return this.text+=e,t}},du=class{piece;subtreeLength;subtreeLineBreakCount;subtreeFirstCharCode;subtreeLastCharCode;left=null;right=null;parent=null;priority=0;constructor(e,t=e.length,n=e.lineBreakCount,r=e.firstCharCode,i=e.lastCharCode){this.piece=e,this.subtreeLength=t,this.subtreeLineBreakCount=n,this.subtreeFirstCharCode=r,this.subtreeLastCharCode=i}updateSubtreeLength(){this.subtreeLength=(this.left?.subtreeLength??0)+this.piece.length+(this.right?.subtreeLength??0),this.subtreeLineBreakCount=(this.left?.subtreeLineBreakCount??0)+this.piece.lineBreakCount+(this.right?.subtreeLineBreakCount??0)-+!!bu(this.left?.subtreeLastCharCode,this.piece.firstCharCode)-!!bu(this.piece.lastCharCode,this.right?.subtreeFirstCharCode),this.subtreeFirstCharCode=this.left?.subtreeFirstCharCode??this.piece.firstCharCode,this.subtreeLastCharCode=this.right?.subtreeLastCharCode??this.piece.lastCharCode}},fu=class{#e;#t=new uu(``);#n=null;#r=0;#i=0;#a=null;#o=null;#s=null;#c=2654435769;constructor(e){this.#e=new uu(e);let t=this.#y(lu.Original,0,e.length);this.#n=t.length>0?this.#C(t):null,this.#r=this.#n?.subtreeLength??0,this.#i=(this.#n?.subtreeLineBreakCount??0)+1}get lineCount(){return this.#i}getText(e){if(e===void 0)return this.#g();let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this.getTextSlice(t,n)}getLineText(e,t=!1){if(this.#a!==null&&this.#a[0]===e&&this.#a[1]===t)return this.#a[2];let n=this.#f(e);if(n===void 0)throw Error(`Line index out of range: ${e}`);let r=this.getTextSlice(n[0],n[1],!t);return this.#a=[e,t,r],this.#o=[e,t,r.length],r}getLineLength(e,t=!1){let n=this.#o,r=this.#a;if(n!==null&&n[0]===e&&n[1]===t)return n[2];if(r!==null&&r[0]===e&&r[1]===t){let n=r[2].length;return this.#o=[e,t,n],n}let i=this.#f(e);if(i===void 0)throw Error(`Line index out of range: ${e}`);let[a,o]=i,s=o-a;if(!t)for(;s>0&&pu(this.charAt(a+s-1).charCodeAt(0));)s--;return this.#o=[e,t,s],s}getTextSlice(e,t,n=!1){if(e>=t)return``;let r=mu(e,0,this.#r),i=mu(t,r,this.#r);if(r>=i)return``;let a=this.#u(r);if(a===void 0)return``;let o=[],[s,c]=a,l=i-r;for(;s!==null&&l>0;){let e=Math.min(s.piece.length-c,l),t=this.#v(s.piece.source),r=s.piece.offset+c,i=r+e;if(n)for(;i>r&&pu(t.text.charCodeAt(i-1));)i--;o.push(t.text.slice(r,i)),l-=e,c=0,s=this.#d(s)}return o.join(``)}charAt(e){let t=this.#u(e);if(t===void 0)return``;let[n,r]=t;return this.#v(n.piece.source).text.charAt(n.piece.offset+r)}includes(e){if(e.length===0)return!0;let t=hu(e),n=0,r=!1;return this.#_(i=>{for(let a=i.start;a<i.end;a++){let o=i.text.charCodeAt(a);for(;n>0&&o!==e.charCodeAt(n);)n=t[n-1];if(o===e.charCodeAt(n)&&n++,n===e.length)return r=!0,!1}return!0}),r}findNextNonOverlappingSubstring(e,t){if(e.length===0||e.length>this.#r)return;let n=gu(t,this.#r),r=n.reduce((e,[,t])=>Math.max(e,t),0),i=hu(e),a=0,o=0,s,c;return this.#_(t=>{for(let l=t.start;l<t.end;l++){let u=t.text.charCodeAt(l);for(;a>0&&u!==e.charCodeAt(a);)a=i[a-1];if(u===e.charCodeAt(a)&&a++,a===e.length){let t=o-e.length+1;if(!_u(n,t,t+e.length)){if(t>=r)return c=t,!1;s??=t}a=i[a-1]}o++}return!0}),c??s}search(e){if(e.text.length===0||this.#r===0||e.text.includes(`
|
|
1675
|
+
`)||e.text.includes(`\r`)||e.regex&&(e.text.includes(`\\n`)||e.text.includes(`\\r`)))return[];let t;try{t=Tu(e.text,e.regex,e.caseSensitive)}catch{return[]}return this.#l(t,e.wholeWord,au)}#l(e,t,n){let r=[],i=this.#g(),a=i.length,o=pe(i);for(let s=0;s<o.length;s++){let c=o[s],l=o[s+1]??a;for(;l>c&&pu(i.charCodeAt(l-1));)l--;let u=i.slice(c,l);e.lastIndex=0;let d;for(;(d=e.exec(u))!==null;){let a=d.index,o=d[0];if(o.length===0){e.lastIndex=Ou(u,a);continue}let s=c+a;if((!t||wu(i,s,o.length))&&(r.push([s,s+o.length]),r.length>=n))return r;a===e.lastIndex&&(e.lastIndex=Ou(u,a))}}return r}insert(e,t){if(e.length===0)return;let n=mu(t,0,this.#r);this.#b(n,n,e),this.#x()}delete(e,t){if(t<=0||this.#r===0)return;let n=mu(e,0,this.#r),r=mu(n+t,n,this.#r);n!==r&&(this.#b(n,r,``),this.#x())}applyEdits(e){if(e.length!==0){for(let t=e.length-1;t>=0;t--){let n=e[t],r=mu(n.start,0,this.#r),i=mu(n.end,r,this.#r);this.#b(r,i,n.text)}this.#x()}}positionAt(e){let t=mu(e,0,this.#r);if(this.#r===0)return{line:0,character:0};let n=this.#p(t),r=t-(n===0?0:this.#m(n-1));return this.#s=[n,r,t],{line:n,character:r}}positionsAt(e){let t=Array.from({length:e.length});if(e.length===0)return t;if(this.#r===0)return t.fill({line:0,character:0});for(let n=0;n<e.length;n++)t[n]=this.positionAt(e[n]);return t}offsetAt(e){if(e.line<0||this.#r===0)return 0;if(e.line>=this.#i)throw Error(`Line index out of range: ${e.line}`);let t=this.#s;if(t!==null&&t[0]===e.line&&t[1]===e.character)return t[2];let n=this.#f(e.line);if(n===void 0)throw Error(`Line index out of range: ${e.line}`);let r=mu(e.character,0,n[1]-n[0]);return n[0]+r}#u(e){if(e<0||e>=this.#r)return;let t=this.#n,n=e;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e){t=t.left;continue}if(n-=e,n<t.piece.length)return[t,n];n-=t.piece.length,t=t.right}}#d(e){if(e.right!==null){let t=e.right;for(;t.left!==null;)t=t.left;return t}let t=e;for(;t.parent!==null&&t===t.parent.right;)t=t.parent;return t.parent}#f(e){if(e<0)throw Error(`Line index out of range: ${e}`);if(this.#r===0){if(e===0)return[0,0];throw Error(`Line index out of range: ${e}`)}if(e>=this.#i)throw Error(`Line index out of range: ${e}`);return[e===0?0:this.#m(e-1),e<this.#i-1?this.#m(e):this.#r]}#p(e){let t=this.#n,n=mu(e,0,this.#r),r=0;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e){t=t.left;continue}if(r+=(t.left?.subtreeLineBreakCount??0)-+!!bu(t.left?.subtreeLastCharCode,t.piece.firstCharCode),n-=e,n<=t.piece.length){let e=this.#v(t.piece.source),i=Math.min(xu(e.lineOffsets,t.piece.offset+n),t.piece.lineOffsetEnd);return r+=i-t.piece.lineOffsetStart,n===t.piece.length&&t.piece.hasVirtualTrailingCRBreak&&r++,n===t.piece.length&&bu(t.piece.lastCharCode,this.#d(t)?.piece.firstCharCode)&&r--,r}r+=t.piece.lineBreakCount-+!!bu(t.piece.lastCharCode,t.right?.subtreeFirstCharCode),n-=t.piece.length,t=t.right}return this.#i-1}#m(e){let t=this.#n,n=e,r=0,i;for(;t!==null;){let e=(t.left?.subtreeLineBreakCount??0)-+!!bu(t.left?.subtreeLastCharCode,t.piece.firstCharCode);if(n<e){i=t.piece.firstCharCode,t=t.left;continue}let a=t.left?.subtreeLength??0;r+=a,n-=e;let o=t.right?.subtreeFirstCharCode??i,s=t.piece.lineBreakCount-+!!bu(t.piece.lastCharCode,o);if(n<s)return r+this.#h(t.piece,n);r+=t.piece.length,n-=s,t=t.right}return this.#r}#h(e,t){return t<e.lineOffsetEnd-e.lineOffsetStart?this.#v(e.source).lineOffsets[e.lineOffsetStart+t]-e.offset:e.length}#g(){let e=[];return this.#_(t=>{e.push(t.text.slice(t.start,t.end))}),e.join(``)}#_(e){this.#j(this.#n,t=>{let n=this.#v(t.piece.source);return e({text:n.text,lineOffsets:n.lineOffsets,lineOffsetStart:t.piece.lineOffsetStart,lineOffsetEnd:t.piece.lineOffsetEnd,start:t.piece.offset,end:t.piece.offset+t.piece.length})})}#v(e){return e===lu.Original?this.#e:this.#t}#y(e,t,n){let r=this.#v(e),i=t+n,a=xu(r.lineOffsets,t),o=xu(r.lineOffsets,i),s=r.text.charCodeAt(i-1);return new lu(e,t,n,a,o,s===su&&r.lineOffsets[o-1]!==i,r.text.charCodeAt(t),s)}#b(e,t,n){if(e===t&&n.length===0)return;let[r,i]=this.#E(this.#n,e),a=this.#D(i,t-e),o;if(n.length>0){let e=this.#y(lu.Added,this.#t.append(n),n.length);o=this.#O(this.#k(r,e),a)}else{let[e,t]=this.#A(a);o=e===void 0?r:this.#O(this.#k(r,e),t)}o!==null&&(o.parent=null),this.#n=o,this.#r=o?.subtreeLength??0,this.#i=(o?.subtreeLineBreakCount??0)+1}#x(){this.#a=null,this.#o=null,this.#s=null}#S(){return this.#c=Math.imul(this.#c,1664525)+1013904223>>>0,this.#c}#C(e){let t=new du(e);return t.priority=this.#S(),t}#w(e,t){e.left=t,t!==null&&(t.parent=e)}#T(e,t){e.right=t,t!==null&&(t.parent=e)}#E(e,t){if(e===null)return[null,null];if(t<=0)return[null,e];if(t>=e.subtreeLength)return[e,null];let n=e.left?.subtreeLength??0;if(t<=n){let[n,r]=this.#E(e.left,t);return this.#w(e,r),e.updateSubtreeLength(),[n,e]}let r=e.piece.length;if(t>=n+r){let[i,a]=this.#E(e.right,t-n-r);return this.#T(e,i),e.updateSubtreeLength(),[e,a]}let i=t-n,a=new du(this.#y(e.piece.source,e.piece.offset,i)),o=new du(this.#y(e.piece.source,e.piece.offset+i,r-i));return a.priority=e.priority,o.priority=e.priority,this.#w(a,e.left),this.#T(o,e.right),a.updateSubtreeLength(),o.updateSubtreeLength(),[a,o]}#D(e,t){if(e===null||t>=e.subtreeLength)return null;if(t<=0)return e;let n=e.left?.subtreeLength??0;if(t<=n)return this.#w(e,this.#D(e.left,t)),e.updateSubtreeLength(),e;let r=n+e.piece.length;if(t>=r)return this.#D(e.right,t-r);let i=t-n,a=new du(this.#y(e.piece.source,e.piece.offset+i,e.piece.length-i));return a.priority=e.priority,this.#T(a,e.right),a.updateSubtreeLength(),a}#O(e,t){return e===null?t:t===null?e:e.priority>=t.priority?(this.#T(e,this.#O(e.right,t)),e.updateSubtreeLength(),e):(this.#w(t,this.#O(e,t.left)),t.updateSubtreeLength(),t)}#k(e,t){if(e===null)return this.#C(t);let n=e;for(;n.right!==null;)n=n.right;if(vu(n.piece,t)){n.piece=yu(n.piece,t);for(let t=n;t!==null&&(t.updateSubtreeLength(),t!==e);)t=t.parent;return e}return this.#O(e,this.#C(t))}#A(e){if(e===null)return[void 0,null];if(e.left===null)return[e.piece,e.right];let[t,n]=this.#A(e.left);return this.#w(e,n),e.updateSubtreeLength(),[t,e]}#j(e,t){return e===null?!0:!this.#j(e.left,t)||t(e)===!1?!1:this.#j(e.right,t)}};function pu(e){return e===10||e===13}function mu(e,t,n){return Math.min(Math.max(e,t),n)}function hu(e){let t=Array.from({length:e.length}).fill(0),n=0;for(let r=1;r<e.length;r++){let i=e.charCodeAt(r);for(;n>0&&i!==e.charCodeAt(n);)n=t[n-1];i===e.charCodeAt(n)&&n++,t[r]=n}return t}function gu(e,t){let n=[];for(let[r,i]of e){let e=mu(r,0,t),a=mu(i,e,t);e<a&&n.push([e,a])}n.sort((e,t)=>e[0]-t[0]);let r=[];for(let e of n){let t=r[r.length-1];if(t!==void 0&&e[0]<=t[1]){t[1]=Math.max(t[1],e[1]);continue}r.push(e)}return r}function _u(e,t,n){let r=0,i=e.length;for(;r<i;){let n=r+Math.floor((i-r)/2);e[n][1]<=t?r=n+1:i=n}let a=e[r];return a!==void 0&&a[0]<n}function vu(e,t){return e.source===t.source&&e.offset+e.length===t.offset&&!bu(e.lastCharCode,t.firstCharCode)}function yu(e,t){return new lu(e.source,e.offset,e.length+t.length,e.lineOffsetStart,t.lineOffsetEnd,t.hasVirtualTrailingCRBreak,e.firstCharCode,t.lastCharCode)}function bu(e,t){return e===su&&t===ou}function xu(e,t){let n=0,r=e.length;for(;n<r;){let i=n+Math.floor((r-n)/2);e[i]<=t?n=i+1:r=i}return n}function Su(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Cu(e){if(e<=32||e===127)return!0;let t=String.fromCharCode(e);return cu.includes(t)}function wu(e,t,n){let r=t<=0||Cu(e.charCodeAt(t-1)),i=t+n>=e.length||Cu(e.charCodeAt(t+n));return r&&i}function Tu(e,t,n){let r=t?e:Su(e);return new RegExp(r,`g${n?``:`i`}${t?`m`:``}`)}function Eu(e,t){return e.replace(/\$([$&]|\d+)/g,(e,n)=>n===`$`?`$`:n===`&`?t[0]??``:t[Number(n)]??``)}function Du(e,t,n,r,i,a){if(!r.regex)return r.replaceText;let o=e(i),s=n(o.line),c=i-t({line:o.line,character:0}),l;try{l=Tu(r.text,!0,r.caseSensitive)}catch{return r.replaceText}l.lastIndex=c;let u=l.exec(s);return u===null||u.index!==c||u[0].length!==a-i?r.replaceText:Eu(r.replaceText,u)}function Ou(e,t){if(t+1<e.length){let n=e.charCodeAt(t),r=e.charCodeAt(t+1);if(n>=55296&&n<=56319&&r>=56320&&r<=57343)return t+2}return t+1}var ku=class e{#e;#t;#n;#r;#i;#a;constructor(e,t,n=`text`,r=0,i=new $l){this.#e=new URL(e,`file://`).toString(),this.#t=n,this.#n=r,this.#r=new fu(t),this.#i=i;let a=this.#r.getLineText(0,!0);a.endsWith(`\r
|
|
1676
1676
|
`)?this.#a=`\r
|
|
1677
1677
|
`:a.endsWith(`\r`)?this.#a=`\r`:this.#a=`
|
|
1678
|
-
`}get uri(){return this.#e}get languageId(){return this.#t}get version(){return this.#n}get lineCount(){return this.#r.lineCount}get eol(){return this.#a}get canUndo(){return this.#i.canUndo}get canRedo(){return this.#i.canRedo}positionAt(e){return this.normalizePosition(this.#r.positionAt(e))}positionsAt(e){let t=this.#r.positionsAt(e);for(let e=0;e<t.length;e++)t[e]=this.normalizePosition(t[e]);return t}offsetAt(e){return this.#r.offsetAt(this.normalizePosition(e))}getText(e){return e===void 0?this.#r.getText():this.#r.getText({start:this.normalizePosition(e.start),end:this.normalizePosition(e.end)})}getLineText(e,t){return this.#r.getLineText(e,t)}normalizeEol(e){return e.replace(/\r\n|\r|\n/g,this.eol)}getLineLength(e,t){return this.#r.getLineLength(e,t)}charAt(e){return typeof e==`number`?this.#r.charAt(e):this.#r.charAt(this.offsetAt(e))}getTextSlice(e,t){return this.#r.getTextSlice(e,t)}findNextNonOverlappingSubstring(e,t){return this.#r.findNextNonOverlappingSubstring(e,t)}search(e){return this.#r.search(e)}applyEdits(e,t=!0,n,r,i=!1){if(e.length!==0)return this.#o(this.#d(this.resolveEdits(e)),t,n,r,i)}resolveEdits(e){return e.map(e=>this.#c(e))}applyResolvedEdits(e,t=!0,n,r,i=!1){if(e.length!==0)return this.#o(this.#d(e.map(e=>this.#l(e))),t,n,r,i)}#o(e,t,n,r,i){let a=eu(this,e,this.#n,this.#n+1,t?n:void 0,t?r:void 0);t&&i&&(a.undoBoundary=!0);let o=this.#i.peekUndoForCoalescing(),s=this.#f(e);return this.#n++,s.lineDelta===0&&tu(o,a)?this.#i.replaceLastUndo(nu(o,a)):this.#i.push(a),s}setLastUndoSelectionsAfter(e){this.#i.setLastUndoSelectionsAfter(e)}setLastUndoLineAnnotations(e,t){this.#i.setLastUndoLineAnnotations(e,t)}undo(){let e=this.#i.popUndoToRedo();if(e===void 0)return;let t=this.#f(e.inverseEdits);if(t===void 0)return;this.#n=e.versionBefore;let n=e.selectionsBefore?.slice();return[t,n,e.lineAnnotationsBefore?.slice(),n===void 0?e.inverseEdits.map(e=>({...e})):void 0]}redo(){let e=this.#i.popRedoToUndo();if(e===void 0)return;let t=this.#f(e.forwardEdits);if(t===void 0)return;this.#n=e.versionAfter;let n=e.selectionsAfter?.slice();return[t,n,e.lineAnnotationsAfter?.slice(),n===void 0?e.forwardEdits.map(e=>({...e})):void 0]}normalizePosition(t){let n=e.#s(t.line,this.lineCount-1);return{line:n,character:e.#s(t.character,this.getLineLength(n))}}static#s(e,t){return Number.isNaN(e)?0:Math.max(0,Math.min(Math.floor(e),t))}#c(e){let t=this.offsetAt(e.range.start),n=this.offsetAt(e.range.end);if(t>n){let e=t;t=n,n=e}return this.#l({start:t,end:n,text:e.newText})}#l(e){let{start:t,end:n}=e,r=t===n;return this.#u(t)&&t--,r?n=t:this.#u(n)&&n++,{start:t,end:n,text:e.text}}#u(e){let t=this.#r.charAt(e-1).charCodeAt(0),n=this.#r.charAt(e).charCodeAt(0);return t>=55296&&t<=56319&&n>=56320&&n<=57343}#d(e){let t=[...e].sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});for(let e=0;e<t.length-1;e++)if(t[e].end>t[e+1].start)throw Error(`Overlapping text edits are not supported`);return t}#f(e){let t=this.#r.lineCount,n=this.positionsAt(e.flatMap(e=>[e.start,e.end])),r=this.#p(e,n),i=n[0],a=n[n.length-1],o=a.line===t-1&&a.character===this.#r.getLineLength(a.line);this.#r.applyEdits(e);let s=this.#r.lineCount;return{changes:e.map((e,t)=>({...e,range:{start:n[t*2],end:n[t*2+1]}})),startLine:r.startLine,startCharacter:i.character,endCharacter:a.character,endLine:Math.min(r.endLine,Math.max(0,s-1)),endedAtDocumentEnd:o,previousLineCount:t,lineCount:s,lineDelta:s-t,changedLineRanges:r.ranges,changedLineChanges:r.changes}}#p(e,t){let n=1/0,r=0,i=0,a=[],o=[],s=this.#r.lineCount-1,c=this.#r.getLineLength(s);for(let l=0;l<e.length;l++){let u=e[l],d=t[l*2],f=t[l*2+1],p=d.line,m=f.line,h=
|
|
1678
|
+
`}get uri(){return this.#e}get languageId(){return this.#t}get version(){return this.#n}get lineCount(){return this.#r.lineCount}get eol(){return this.#a}get canUndo(){return this.#i.canUndo}get canRedo(){return this.#i.canRedo}positionAt(e){return this.normalizePosition(this.#r.positionAt(e))}positionsAt(e){let t=this.#r.positionsAt(e);for(let e=0;e<t.length;e++)t[e]=this.normalizePosition(t[e]);return t}offsetAt(e){return this.#r.offsetAt(this.normalizePosition(e))}getText(e){return e===void 0?this.#r.getText():this.#r.getText({start:this.normalizePosition(e.start),end:this.normalizePosition(e.end)})}getLineText(e,t){return this.#r.getLineText(e,t)}normalizeEol(e){return e.replace(/\r\n|\r|\n/g,this.eol)}getLineLength(e,t){return this.#r.getLineLength(e,t)}charAt(e){return typeof e==`number`?this.#r.charAt(e):this.#r.charAt(this.offsetAt(e))}getTextSlice(e,t){return this.#r.getTextSlice(e,t)}findNextNonOverlappingSubstring(e,t){return this.#r.findNextNonOverlappingSubstring(e,t)}search(e){return this.#r.search(e)}applyEdits(e,t=!0,n,r,i=!1){if(e.length!==0)return this.#o(this.#d(this.resolveEdits(e)),t,n,r,i)}resolveEdits(e){return e.map(e=>this.#c(e))}applyResolvedEdits(e,t=!0,n,r,i=!1){if(e.length!==0)return this.#o(this.#d(e.map(e=>this.#l(e))),t,n,r,i)}#o(e,t,n,r,i){let a=eu(this,e,this.#n,this.#n+1,t?n:void 0,t?r:void 0);t&&i&&(a.undoBoundary=!0);let o=this.#i.peekUndoForCoalescing(),s=this.#f(e);return this.#n++,s.lineDelta===0&&tu(o,a)?this.#i.replaceLastUndo(nu(o,a)):this.#i.push(a),s}setLastUndoSelectionsAfter(e){this.#i.setLastUndoSelectionsAfter(e)}setLastUndoLineAnnotations(e,t){this.#i.setLastUndoLineAnnotations(e,t)}undo(){let e=this.#i.popUndoToRedo();if(e===void 0)return;let t=this.#f(e.inverseEdits);if(t===void 0)return;this.#n=e.versionBefore;let n=e.selectionsBefore?.slice();return[t,n,e.lineAnnotationsBefore?.slice(),n===void 0?e.inverseEdits.map(e=>({...e})):void 0]}redo(){let e=this.#i.popRedoToUndo();if(e===void 0)return;let t=this.#f(e.forwardEdits);if(t===void 0)return;this.#n=e.versionAfter;let n=e.selectionsAfter?.slice();return[t,n,e.lineAnnotationsAfter?.slice(),n===void 0?e.forwardEdits.map(e=>({...e})):void 0]}normalizePosition(t){let n=e.#s(t.line,this.lineCount-1);return{line:n,character:e.#s(t.character,this.getLineLength(n))}}static#s(e,t){return Number.isNaN(e)?0:Math.max(0,Math.min(Math.floor(e),t))}#c(e){let t=this.offsetAt(e.range.start),n=this.offsetAt(e.range.end);if(t>n){let e=t;t=n,n=e}return this.#l({start:t,end:n,text:e.newText})}#l(e){let{start:t,end:n}=e,r=t===n;return this.#u(t)&&t--,r?n=t:this.#u(n)&&n++,{start:t,end:n,text:e.text}}#u(e){let t=this.#r.charAt(e-1).charCodeAt(0),n=this.#r.charAt(e).charCodeAt(0);return t>=55296&&t<=56319&&n>=56320&&n<=57343}#d(e){let t=[...e].sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});for(let e=0;e<t.length-1;e++)if(t[e].end>t[e+1].start)throw Error(`Overlapping text edits are not supported`);return t}#f(e){let t=this.#r.lineCount,n=this.positionsAt(e.flatMap(e=>[e.start,e.end])),r=this.#p(e,n),i=n[0],a=n[n.length-1],o=a.line===t-1&&a.character===this.#r.getLineLength(a.line);this.#r.applyEdits(e);let s=this.#r.lineCount;return{changes:e.map((e,t)=>({...e,range:{start:n[t*2],end:n[t*2+1]}})),startLine:r.startLine,startCharacter:i.character,endCharacter:a.character,endLine:Math.min(r.endLine,Math.max(0,s-1)),endedAtDocumentEnd:o,previousLineCount:t,lineCount:s,lineDelta:s-t,changedLineRanges:r.ranges,changedLineChanges:r.changes}}#p(e,t){let n=1/0,r=0,i=0,a=[],o=[],s=this.#r.lineCount-1,c=this.#r.getLineLength(s);for(let l=0;l<e.length;l++){let u=e[l],d=t[l*2],f=t[l*2+1],p=d.line,m=f.line,h=xe(u.text),g=p+i,_=g+h,v=h-(m-p);n=Math.min(n,p),r=Math.max(r,_);let y=a[a.length-1];y!==void 0&&g<=y[1]+1?a[a.length-1]=[y[0],Math.max(y[1],_)]:a.push([g,_]),o.push([g,_,v,d.character,f.character,m===s&&f.character===c]),i+=v}return n===1/0?{startLine:0,endLine:0,ranges:[[0,0]],changes:[[0,0,0,0,0,!1]]}:{startLine:n,endLine:r,ranges:a,changes:o}}};function Au({metaKey:e,ctrlKey:t},n=Le()){return n?e&&!t:t&&!e}function ju(e){if(Le()&&e.ctrlKey&&!e.altKey&&!e.metaKey)switch(e.key){case`a`:return`start`;case`e`:return`end`;case`p`:return`up`;case`n`:return`down`;case`f`:return`right`;case`b`:return`left`}if(!e.altKey&&!e.ctrlKey&&!e.metaKey){if(e.key===`ArrowUp`)return`up`;if(e.key===`ArrowDown`)return`down`;if(e.key===`ArrowLeft`)return`left`;if(e.key===`ArrowRight`)return`right`;if(e.key===`Home`)return`start`;if(e.key===`End`)return`end`}if(Au(e)){if(e.key===`ArrowLeft`)return`textStart`;if(e.key===`ArrowRight`)return`end`}}var Mu=new WeakMap,Nu=Fu([{bindings:{Tab:`indent`,"shift+Tab":`outdent`,"cmdOrCtrl+[":`indentLess`,"cmdOrCtrl+]":`indentMore`,"cmdOrCtrl+z":`undo`,"cmdOrCtrl+shift+z":`redo`,"cmdOrCtrl+a":`selectAll`,"cmdOrCtrl+d":`findNextMatch`,"cmdOrCtrl+f":`openSearchPanel`,"cmdOrCtrl+alt+f":`openSearchReplacePanel`,"alt+ArrowUp":`moveLineUp`,"alt+ArrowDown":`moveLineDown`,"shift+alt+ArrowUp":`copyLineUp`,"shift+alt+ArrowDown":`copyLineDown`,Escape:`simplifySelection`,"cmdOrCtrl+Enter":`insertBlankLine`,"cmdOrCtrl+/":`toggleComment`,"shift+alt+a":`toggleBlockComment`,"cmdOrCtrl+Home":`moveCursorToDocStart`,"cmdOrCtrl+End":`moveCursorToDocEnd`,"cmdOrCtrl+shift+Home":`expandSelectionDocStart`,"cmdOrCtrl+shift+End":`expandSelectionDocEnd`}},{platform:`mac`,bindings:{"ctrl+k":`deleteHardLineForward`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`,"cmd+ArrowUp":`moveCursorToDocStart`,"cmd+ArrowDown":`moveCursorToDocEnd`,"cmd+shift+ArrowUp":`expandSelectionDocStart`,"cmd+shift+ArrowDown":`expandSelectionDocEnd`}},{platform:`windows`,bindings:{"ctrl+y":`redo`}},{platform:`linux`,bindings:{"ctrl+y":`redo`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`}}]),Pu={Backquote:"`",Minus:`-`,Equal:`=`,Comma:`,`,Period:`.`,Slash:`/`,Semicolon:`;`,Quote:`'`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Space:`Space`};function Fu(e){let t=Mu.get(e);if(t===void 0){t={mac:new Map,windows:new Map,linux:new Map};for(let n of e)for(let e of Object.keys(n.bindings)){let r=n.bindings[e];if(r===void 0)continue;let i=e.split(`+`),a=i.pop();for(let e of[`mac`,`windows`,`linux`]){if(n.platform!==void 0&&n.platform!==e)continue;let o=0;for(let t of i)t===`alt`?o|=1:t===`ctrl`?o|=2:t===`cmd`?o|=4:t===`shift`?o|=8:t===`cmdOrCtrl`&&(o|=e===`mac`?4:2);let s=t[e].get(o);s===void 0&&(s=new Map,t[e].set(o,s)),s.set(a,r)}}Mu.set(e,t)}return t}function Iu(e,t,n=Le()){let r=e.key===` `?`Space`:e.key.length===1?e.key.toLowerCase():e.key,i=e.code??``,a=i.startsWith(`Key`)&&i.length===4?i.slice(3).toLowerCase():i.startsWith(`Digit`)&&i.length===6?i.slice(5):Pu[i],o=n?`mac`:globalThis.navigator?.platform.includes(`Linux`)===!0?`linux`:`windows`,s=!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0);if(t!==void 0){let e=Fu(t)[o].get(s),n=e?.get(r)??(a===void 0?void 0:e?.get(a));if(n!==void 0)return n}let c=Nu[o].get(s);return c?.get(r)??(a===void 0?void 0:c?.get(a))}function Lu(e,t=Le()){if(!e.altKey&&Au(e,t)&&((e.key.length===1?e.key.toLowerCase():e.key)===`g`||e.code===`KeyG`))return e.shiftKey?`previous`:`next`}var Ru=`::selection {
|
|
1679
1679
|
background-color: #0000;
|
|
1680
1680
|
}
|
|
1681
1681
|
|
|
@@ -2131,7 +2131,7 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}f
|
|
|
2131
2131
|
}
|
|
2132
2132
|
}
|
|
2133
2133
|
`,zu=`//`,Bu=[`/*`,`*/`],Vu={sql:{lineComment:`--`},ruby:{lineComment:`#`,blockComment:[`=begin`,`=end`]},rst:{lineComment:`..`},coffeescript:{lineComment:`#`,blockComment:[`###`,`###`]},cmd:{lineComment:`@REM`},julia:{lineComment:`#`,blockComment:[`#=`,`=#`]},yaml:{lineComment:`#`},yml:{lineComment:`#`},markdown:{lineComment:null,blockComment:[`<!--`,`-->`]},zsh:{lineComment:`#`},makefile:{lineComment:`#`},handlebars:{lineComment:null,blockComment:[`{{!--`,`--}}`]},ini:{lineComment:`;`,blockComment:[`;`,` `]},powershell:{lineComment:`#`,blockComment:[`<#`,`#>`]},vb:{lineComment:`'`},xml:{lineComment:null,blockComment:[`<!--`,`-->`]},lua:{lineComment:`--`,blockComment:[`--[[`,`]]`]},html:{lineComment:null,blockComment:[`<!--`,`-->`]},diff:{lineComment:`#`,blockComment:[`#`,` `]},r:{lineComment:`#`},fsharp:{blockComment:[`(*`,`*)`]},pug:{lineComment:`//-`},perl:{lineComment:`#`},tex:{lineComment:`%`},clojure:{lineComment:`;;`},css:{lineComment:null},python:{lineComment:`#`,blockComment:[`"""`,`"""`]},dotenv:{lineComment:`#`},dockerfile:{lineComment:`#`},razor:{lineComment:null,blockComment:[`<!--`,`-->`]},prompt:{lineComment:null,blockComment:[`<!--`,`-->`]}};function Hu(e,t){let n={...Vu[e],...t?.[e]};return{lineComment:n.lineComment===void 0?zu:n.lineComment,blockComment:n.blockComment??Bu}}function Uu(e,t,n){let r=[],i=new Set;for(let a of t){let t=a.end.line;a.start.line<t&&a.end.character===0&&t--;let o=r.length,s=1/0;for(let o=a.start.line;o<=t;o++){if(i.has(o))continue;i.add(o);let t=e.getLineText(o),a=t.length-t.trimStart().length,c=a===t.length;c||(s=Math.min(s,a)),r.push({line:o,comment:t.slice(a,a+n.length)===n?a:-1,empty:c,indent:a,single:!1})}if(s!==1/0)for(let e=o;e<r.length;e++)r[e].empty||(r[e].indent=s);r.length===o+1&&(r[o].single=!0)}let a=r.some(e=>e.comment<0&&(!e.empty||e.single)),o=[];if(a){for(let e of r){if(e.empty&&!e.single)continue;let t={line:e.line,character:e.indent};o.push({range:{start:t,end:t},newText:n+` `})}return o}for(let t of r){if(t.comment<0)continue;let r=e.getLineText(t.line),i=t.comment,a=i+n.length+ +(r[i+n.length]===` `);o.push({range:{start:{line:t.line,character:i},end:{line:t.line,character:a}},newText:``})}return o}var Wu=50;function Gu(e,t,n,r,i){let a=Math.max(0,r-Wu),o=e.getTextSlice(a,r),s=e.getTextSlice(i,i+Wu),c=o.length-o.trimEnd().length,l=s.length-s.trimStart().length,u=o.length-c;if(o.slice(u-t.length,u)===t&&s.slice(l,l+n.length)===n)return{open:{start:r-c-t.length,end:r-c+ +(c>0),text:``},close:{start:i+l-+(l>0),end:i+l+n.length,text:``},contentStart:r,contentEnd:i};let d=i-r<=Wu*2?e.getTextSlice(r,i):void 0,f=d??e.getTextSlice(r,r+Wu),p=d??e.getTextSlice(i-Wu,i),m=f.length-f.trimStart().length,h=i-(p.length-p.trimEnd().length)-n.length;if(f.slice(m,m+t.length)!==t||e.getTextSlice(h,h+n.length)!==n)return;let g=r+m,_=g+t.length+ +!!/\s/.test(f[t.length+m]??``),v=h-+!!/\s/.test(e.getTextSlice(h-1,h));return{open:{start:g,end:_,text:``},close:{start:v,end:h+n.length,text:``},contentStart:_,contentEnd:v}}function Ku(e,t,n,r){let i=0,a=t.length;for(;i<a;){let n=i+a>>>1;t[n].end<e?i=n+1:a=n}let o=n[i];for(let n=i;n<t.length;n++){let i=t[n];if(e<i.start)break;if(i.start===i.end&&e===i.start){if(r<0)break;o+=i.text.length;continue}if(e>i.end){o+=i.text.length-(i.end-i.start);continue}return e===i.end?i.start+o+i.text.length:i.start+o+(r>0?i.text.length:0)}return e+o}function qu(e,t,[n,r],i=!1){let a=t.map(t=>{let{start:n,end:r}=t;if(i){let t=r.line;n.line<t&&r.character===0&&t--;let i=e.getLineText(n.line),a=i.length-i.trimStart().length;n={line:n.line,character:a},r={line:t,character:e.getLineLength(t)}}return{from:e.offsetAt(n),to:e.offsetAt(r),direction:t.direction,comment:void 0}});if(i&&a.length>1){a.sort((e,t)=>{let n=e.from-t.from;return n===0?e.to-t.to:n});let e=0;for(let t=1;t<a.length;t++){let n=a[e],r=a[t];r.from<=n.to?n.to=Math.max(n.to,r.to):a[++e]=r}a.length=e+1}for(let t of a)t.comment=Gu(e,n,r,t.from,t.to);let o=a.every(e=>e.comment!==void 0),s=[];for(let e of a){let t=e.comment;if(o&&t!==void 0){s.push(t.open,t.close);continue}if(t===void 0){if(e.from===e.to){s.push({start:e.from,end:e.to,text:n+` `+r});continue}s.push({start:e.from,end:e.from,text:n+` `},{start:e.to,end:e.to,text:` `+r})}}if(s.length===0)return;s.sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});let c=s.map(t=>({range:{start:e.positionAt(t.start),end:e.positionAt(t.end)},newText:t.text}));if(i)return{edits:c,nextSelectionOffsets:[]};let l=a.map(e=>{let t=e.comment;return o&&t!==void 0?{start:t.contentStart,end:t.contentEnd,startAssociation:1,endAssociation:-1}:t===void 0?e.from===e.to?{start:e.from,end:e.to,startAssociation:-1,endAssociation:-1,collapsedInset:n.length+1}:{start:e.from,end:e.to,startAssociation:1,endAssociation:-1}:{start:e.from,end:e.to,startAssociation:1,endAssociation:1}}),u=Array(s.length+1);u[0]=0;for(let e=0;e<s.length;e++){let t=s[e];u[e+1]=u[e]+t.text.length-(t.end-t.start)}return{edits:c,nextSelectionOffsets:l.map((e,t)=>{let n=Ku(e.start,s,u,e.startAssociation)+(e.collapsedInset??0);return[n,e.collapsedInset===void 0?Ku(e.end,s,u,e.endAssociation):n,a[t].direction]})}}function X(e,t,n){let{style:r,dataset:i,children:a,...o}=t??{},s=document.createElement(e);return Object.assign(s,o),r!==void 0&&(typeof r==`string`?s.style.cssText=r:Object.assign(s.style,r)),i!==void 0&&(typeof i==`string`?s.dataset[i]=``:Array.isArray(i)?i.forEach(e=>{s.dataset[e]=``}):Object.assign(s.dataset,i)),a!==void 0&&s.replaceChildren(...a),n!==void 0&&n.appendChild(s),s}function Z(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function Ju(e,t=`line`){let n=e.dataset[t];if(n===void 0)return;let r=parseInt(n,10);if(!Number.isNaN(r))return r}function Yu(e,t){if(e.nodeType===3){let n=e.textContent?.length??0;return Math.max(0,Math.min(t,n))}return e.nodeType===1?Math.max(0,Math.min(t,e.childNodes.length)):0}function Xu(e,t){return Object.assign(e,t)}function Zu(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}function Qu(e,t=1e3){return Math.round(e*t)/t}function $u(e){return e.endsWith(`
|
|
2134
|
-
`)||e.endsWith(`\r`)}function ed(e){if(!(typeof Intl>`u`||typeof Intl.Segmenter!=`function`))return new Intl.Segmenter(void 0,e)}var td,nd=!1;function rd(){return nd||=(td=ed({granularity:`grapheme`}),!0),td}function id(e){let t=e.ownerDocument,n=e.parentElement;for(;n!=null&&n!==t.body&&n!==t.documentElement;){let e=n.ownerDocument.defaultView?.getComputedStyle(n).overflowY;if(e===`auto`||e===`scroll`||e===`overlay`)return n;n=n.parentElement}return t}function ad(e,t){let n=od(e);if(n.length===0)return;let r=[],i=!1;for(let a of t){if(a.side===`deletions`||a.lineNumber<=0){r.push(a);continue}let t=a.lineNumber-1,o=e.previousLineCount,s=!1;for(let e of n){let n=Math.max(1,o+e.lineDelta),r=sd(t,e,n);if(r===void 0){s=!0,t=void 0;break}(r!==t||ld(t,e))&&(s=!0),t=r,o=n}if(t===void 0){i=!0;continue}let c=t+1;if(s){r.push(c===a.lineNumber?a:{...a,lineNumber:c}),i=!0;continue}r.push(a)}return i?r:void 0}function od(e){if(e.changedLineChanges!==void 0)return e.changedLineChanges.flatMap(([e,t,n,r=0,i=0,a=!1])=>{if(n===0)return[];let o=Math.max(0,t-e);return[{startLine:e,startCharacter:r,endLine:e+Math.max(0,o-n),deletesEndLine:n<0&&a,insertedLineBreaks:o,lineDelta:n}]});if(e.lineDelta===0)return e.changedLineRanges.flatMap(([e,t])=>{let n=t-e;return n<=0?[]:[{startLine:e,startCharacter:0,endLine:e,deletesEndLine:!1,insertedLineBreaks:n,lineDelta:n}]});let t=Math.max(0,-e.lineDelta),n=e.endedAtDocumentEnd&&e.startLine+t===e.previousLineCount-1;return[{startLine:e.startLine,startCharacter:e.startCharacter,endLine:e.startLine+t,deletesEndLine:n,insertedLineBreaks:Math.max(0,e.lineDelta),lineDelta:e.lineDelta}]}function sd(e,t,n){if(e<t.startLine)return e;if(e>t.endLine||t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)return e+t.lineDelta;if(t.startLine===t.endLine)return t.startCharacter===0?e+t.insertedLineBreaks:e;if(cd(e,t))return;let r=Math.min(Math.max(0,e-t.startLine),t.insertedLineBreaks);return ud(t.startLine+r,n)}function cd(e,t){return!(t.lineDelta>=0||e<t.startLine||e>t.endLine||e===t.startLine&&t.startCharacter>0||e===t.endLine&&!t.deletesEndLine)}function ld(e,t){return t.lineDelta===0||e<t.startLine||e>t.endLine?!1:!(t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)}function ud(e,t){return Math.max(0,Math.min(e,Math.max(0,t-1)))}function dd(e,t,n){let r=new Map,i=new Map;for(let t of e){let e=t.lineNumber;r.has(e)||r.set(e,[]),i.has(e)||i.set(e,[]),(t.side===`deletions`?i:r).get(e).push(_e(t))}let a=t.parentElement?.previousElementSibling,o,s;if(a!=null&&a instanceof HTMLElement&&a.dataset.deletions!==void 0)for(let e of a.children){let t=e,{gutter:n,content:r}=t.dataset;n===void 0?r!==void 0&&(s=t):o=t}fd(t,n),s!==void 0&&fd(s,o);let c=pd(r,t,n);if(s===void 0)return;let l=pd(i,s,o);requestAnimationFrame(()=>{md(r,i,c,l)})}function fd(e,t){let n=[];for(let r=1;r<e.childElementCount;r++){let i=e.children[r];i.dataset.lineAnnotation!==void 0&&(n.push(i),t!==void 0&&n.push(t.children[r]))}for(let e of n)e.remove()}function pd(e,t,n){let r=new Map;for(let n of t.children){let t=Ju(n);if(t!==void 0){let i=e.get(t);if(i!==void 0){let e=X(`div`,{dataset:{lineAnnotation:`0,`+(t-1)},children:[X(`div`,{dataset:`annotationContent`,children:i.map(e=>X(`slot`,{name:e}))})]});n.after(e),r.set(t,e)}}}if(n!==void 0)for(let t of n.children){let n=Ju(t,`columnNumber`);if(n!==void 0&&e.has(n)){let e=X(`div`,{dataset:{gutterBuffer:`annotation`,bufferSize:`1`},style:{gridRow:`span 1`}});t.after(e)}}return r}function md(e,t,n,r){let i=new Map;for(let[t,n]of e.entries()){let e=r.get(t);if(n.length===0&&e!==void 0){let n=hd(e);n>0&&i.set(t,n)}}for(let[e,r]of t.entries()){let t=n.get(e);if(r.length===0&&t!==void 0){let n=hd(t);n>0&&i.set(e,n)}}gd(e,n,i),gd(t,r,i)}function hd(e){let t=e.firstElementChild;return t instanceof HTMLElement?t.getBoundingClientRect().height:0}function gd(e,t,n){for(let[r,i]of t.entries()){let t=e.get(r),a=n.get(r);t?.length===0&&a!==void 0&&i.style.setProperty(`--diffs-annotation-min-height`,`${a}px`)}}var _d=class{#e;#t;#n;#r;#i;#a;#o=0;#s=0;#c=0;#l=!0;#u;#d=new Map;#f;#p;constructor(e){this.#f=e.hasActivePopover,this.#p=e.updateActivePopover}setViewportElements(e,t){let n=this.#e!==e||this.#t!==t;this.#e=e,n&&(this.#t=t,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0)}cleanUp(){this.#t=void 0,this.#e=void 0,this.#n=void 0,this.#r=void 0,this.#i=void 0,this.#a=void 0,this.#o=0,this.#s=0,this.#c=0,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0,this.#d.clear()}resetPlacement(e=`default`){this.#d.delete(e)}setPlacement(e,t=`default`){this.#d.set(t,e)}choosePlacement(e){let{preferred:t,fallback:n,viewport:r,popoverHeight:i,atDocumentEdge:a,placementKey:o=`default`}=e,s=this.#d.get(o),c;if(r!==void 0&&i>0){let e=(e,t=0)=>e.top>=r.top+t&&e.bottom<=r.bottom-t;c=s===`fallback`&&e(n)&&!e(t,4)||!e(t)&&e(n)?`fallback`:`preferred`}else c=a?`fallback`:`preferred`;return this.#d.set(o,c),c}getPlacementBounds(){let e=this.#g();if(e===void 0)return;let t=this.#_(),n,r;if(t===void 0?(n=0,r=window.innerHeight):(n=t.top,r=t.bottom),n=Math.max(n,e.top),r=Math.min(r,e.bottom),r<=n)return;let i=this.#o,a=this.#s,o=this.#c>0?this.#c:e.width,s=t===void 0?0:t.left,c=t===void 0?window.innerWidth:t.right,l=i,u=i+o,d=Math.max(l,s-e.left+i),f=Math.min(u,c-e.left+i);return{top:n-e.top+a,bottom:r-e.top+a,left:d,right:Math.max(d,f)}}#m(){let e=this.#e;if(e===void 0)return;if(this.#r===e&&(this.#n===void 0||this.#n.isConnected))return this.#n;let t=e.parentElement;for(;t!==null;){let n=getComputedStyle(t).overflowY;if(n===`auto`||n===`scroll`||n===`overlay`)return this.#n=t,this.#r=e,t;t=t.parentElement}this.#n=void 0,this.#r=e}#h(){if(!this.#l)return;this.#v();let e=this.#t;this.#i=e?.getBoundingClientRect(),this.#o=e?.scrollLeft??0,this.#s=e?.scrollTop??0,this.#c=e?.clientWidth??0,this.#a=this.#m()?.getBoundingClientRect(),this.#l=!1}#g(){return this.#h(),this.#i}#_(){return this.#h(),this.#a}#v(){if(this.#u!==void 0)return;let e,t=()=>{this.#l=!0,!(!this.#f()||e!==void 0)&&(e=requestAnimationFrame(()=>{e=void 0,this.#p()}))},n=this.#m(),r=this.#t;this.#u=[Z(n===void 0?window:n,`scroll`,t,{passive:!0}),...r===void 0?[]:[Z(r,`scroll`,t,{passive:!0})],Z(window,`resize`,t,{passive:!0}),()=>{e!==void 0&&(cancelAnimationFrame(e),e=void 0)}]}};function vd(e,{gutterWidth:t,placeAbove:n,viewport:r,x:i,y:a}){if(e.style.setProperty(`--gutter-width`,t+`px`),e.style.setProperty(`--popover-x`,i+`px`),e.style.setProperty(`--popover-y`,a+`px`),e.style.setProperty(`--popover-y-shift`,n?`-100%`:`0px`),r===void 0){e.style.removeProperty(`--popover-viewport-left`),e.style.removeProperty(`--popover-viewport-right`),e.style.removeProperty(`--popover-viewport-top`),e.style.removeProperty(`--popover-viewport-bottom`);return}e.style.setProperty(`--popover-viewport-left`,r.left+`px`),e.style.setProperty(`--popover-viewport-right`,r.right+`px`),e.style.setProperty(`--popover-viewport-top`,r.top+`px`),e.style.setProperty(`--popover-viewport-bottom`,r.bottom+`px`)}var yd=new Map([[`'`,`'`],[`"`,`"`],["`","`"],[`{`,`}`],[`[`,`]`],[`<`,`>`],[`(`,`)`]]),bd=new Set([`'`,`"`,"`"]),xd=new Set([`{`,`[`,`(`,`<`]);function Sd(e,t=0){let n=Df(e.startContainer,e.startOffset),r=Df(e.endContainer,e.endOffset);if(!(n===null||r===null))return{start:n,end:r,direction:t}}function Cd(e,t,n,r){if(e===void 0)return[[],t];let{start:i,end:a}=t,o=[],s={...t},c=i.line!==a.line,l=a.line;i.line<a.line&&a.character===0&&l--;for(let t=i.line;t<=l;t++){let l=e.getLineText(t);if(l===void 0||c&&l.trim().length===0)continue;let u=l.startsWith(` `)?` `:` `.repeat(n),d=0,f=u;if(r){if(l.startsWith(` `))d=1;else if(l.startsWith(` `)){let e=l.length-l.trimStart().length;d=Math.min(u.length,e)}if(d===0)continue;f=``}o.push({range:{start:{line:t,character:0},end:{line:t,character:d}},newText:f});let p=f.length-d;t===i.line&&(s={...s,start:{...i,character:Math.max(0,i.character+p)}}),t===a.line&&(s={...s,end:{...a,character:Math.max(0,a.character+p)}})}return[o,s]}function wd(e,t,n,r={}){let i=e.lineCount;return t.map(t=>{let{line:a,character:o}=n===`up`||n===`left`?t.start:t.end;if(n===`textStart`||n===`start`||n===`end`){let i=Ud(t);a=i.line,o=i.character;let s=Dd(e,a,o,r);if(n===`textStart`){let t=e.getLineText(a).slice(s.start,s.end),n=s.start+wf(t);o=o===n?s.start:n}else o=n===`start`?s.start:s.end}else if(n===`up`){let t=Td(e,a,o,-1,r);t===void 0?a>0&&(a=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`)??a):(a=t.line,o=t.character)}else if(n===`down`){let t=Td(e,a,o,1,r);if(t!==void 0)a=t.line,o=t.character;else{let e=Math.max(i-1,0);a<e&&(a=r.resolveRenderableLine==null?a+1:Math.min(r.resolveRenderableLine(a+1,`down`)??a,e))}}else if(Q(t)){let t=e.getLineLength(a);if(o=Math.min(o,t),n===`left`){if(o>0)o=bf(e,a,o,!1);else if(a>0){let t=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`);t!==void 0&&(a=t,o=e.getLineLength(a))}}else if(o<t)o=bf(e,a,o,!0);else if(a<i-1){let e=r.resolveRenderableLine==null?a+1:r.resolveRenderableLine(a+1,`down`);e!==void 0&&(a=Math.min(e,i-1),o=0)}}let s={line:a,character:o};return{start:s,end:s,direction:0}})}function Td(e,t,n,r,i){if(i.getSoftLineOffsets===void 0)return;let a=Dd(e,t,n,i),o=a.index+r,s=t,c;if(o>=0&&o<a.count)c=kd(e,s,o,i);else{let a=t+r;if(a<0||a>=e.lineCount)return{line:t,character:n};let o=i.resolveRenderableLine==null?a:i.resolveRenderableLine(a,r<0?`up`:`down`);if(o===void 0)return{line:t,character:n};s=Math.min(o,e.lineCount-1);let l=Od(e,s,i);c=kd(e,s,r<0?l-1:0,i)}let l=Math.max(0,n-a.start),u=c.start+l,d=c.index===c.count-1?u:Math.min(u,c.end),f=e.getLineText(s);return{line:s,character:d>f.length?d:Ed(f,d)}}function Ed(e,t){if(t<=0||t>=e.length)return t;let n=rd();if(n!==void 0){for(let r of n.segment(e)){if(t<=r.index)return t;let e=r.index+r.segment.length;if(t<e)return e}return t}let r=0;for(let n of e){if(t<=r)return t;let e=r+n.length;if(t<e)return e;r=e}return t}function Dd(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};for(let i=0;i+1<a.length;i++){let a=kd(e,t,i,r);if(n>=a.start&&n<=a.end)return a}return kd(e,t,n<(a[0]??0)?0:a.length-2,r)}function Od(e,t,n){let r=n.getSoftLineOffsets?.(t);return r===void 0||r.length<2?1:r.length-1}function kd(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};let o=a.length-1,s=Math.max(0,Math.min(n,o-1)),c=Math.max(0,Math.min(i,a[s]??0));return{start:c,end:Math.max(c,Math.min(i,a[s+1]??i)),index:s,count:o}}function Ad(e,t,n,r={}){return t.map(t=>{let i=t.direction===-1?t.start:t.end,[a]=wd(e,[{start:i,end:i,direction:0}],n,r);return Yd(t,a)})}function jd(e,t,n,r,i=2,a=!1){if(t[t.length-1]===void 0)return{nextSelections:[]};let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=s[(t.length-1)*2],l=s[(t.length-1)*2+1],u=[],d=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=u[u.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(d=!1),u.push(t)}d||u.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let f=Ef(e,n,i),p=[],m=Array.from({length:t.length}),h=0,g,_=()=>{if(g===void 0)return;let t=Ef(e,{start:g.start,end:g.end,text:f.text},i),n=Cf(e,t.text,t.start);p.push({start:t.start,end:t.end,text:n});let r=[g.start+h+n.length,g.start+h+n.length];for(let e of g.indices)m[e]=r;h+=n.length-(t.end-t.start),g=void 0};for(let e of u){let t=Math.max(0,e.start+(f.start-c)),n=Math.max(t,e.end+(f.end-l));if(g!==void 0&&t<g.end){g.end=Math.max(g.end,n),g.indices.push(e.index);continue}_(),g={start:t,end:n,indices:[e.index]}}_();let v=e.applyResolvedEdits(p,!0,t,void 0,a),y=Tf(e,m.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(y),v!==void 0&&r!==void 0){let t=ad(v,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:y,change:v}}function Md(e,t){if(t.length!==e.length+2)return;let n=yd.get(t[0]);if(!(n===void 0||t[t.length-1]!==n||t.slice(1,-1)!==e))return 1}function Nd(e,t,n,r){let i=t.start+n,a=i+r.length;if(t.end-t.start>0){let n=e.getTextSlice(t.start,t.end),a=Md(n,r)??r.indexOf(n);if(a!==-1&&a+n.length<=r.length){let e=i+a;return[e,e+n.length]}}return[a,a]}function Pd(e,t,n,r,i=!1,a=`selection`){if(t.length!==n.length)throw Error(`Selection text replacements must match the selection count`);let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=[],l=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=c[c.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(l=!1),c.push(t)}l||c.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let u=n.every(e=>e===``),d,f=Array.from({length:t.length});if(u){d=[];let e=!1;for(let t of c){if(f[t.index]=[t.end,t.end],t.start>=t.end)continue;e=!0;let n=d[d.length-1];n!==void 0&&t.start<n.end?d[d.length-1]={start:n.start,end:Math.max(n.end,t.end),text:``}:d.push({start:t.start,end:t.end,text:``})}if(!e)return{nextSelections:t};for(let e of c){let t=e.end,n=0,r=t;for(let e of d){if(t<=e.start)break;if(t>=e.end){n-=e.end-e.start;continue}r=e.start+n;break}r===t&&(r+=n),f[e.index]=[r,r]}}else{d=[];let t=0,r=-1;for(let i=0;i<c.length;i++){let o=c[i];if(o.start<r)throw Error(`Overlapping multi-selection edits are not supported`);r=o.end;let s=Cf(e,n[a===`document`?i:o.index],o.start);d.push({start:o.start,end:o.end,text:s}),f[o.index]=Nd(e,o,t,s),t+=s.length-(o.end-o.start)}}let p=e.applyResolvedEdits(d,!0,t,void 0,i),m=Tf(e,f.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(m),p!==void 0&&r!==void 0){let t=ad(p,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:m,change:p}}function Fd(e,t){return e===`never`?!1:e===`brackets`?xd.has(t):e===`quotes`?bd.has(t):!0}function Id(e,t,n,r){if(n.length!==1||t.length===0)return;let i=yd.get(n);if(i===void 0||!Fd(r,n))return;let a=[];for(let r of t){if(Q(r))return;a.push(n+e.getText(r)+i)}return a}function Ld(e,t,n){let r=[],i=[];for(let n of t){let[t,a]=xf(e,n);if(!Q(n)){i.push([t,a]);continue}let{line:o,character:s}=n.start,c=t,l=e.getLineText(o),u=l.length,d=c-s,f=yf(l),p;if(s>0&&s<u){let e=vf(l,s,!1,f),t=vf(l,s,!0,f);p={start:d+e,end:d+t,text:l.slice(s,t)+l.slice(e,s)},i.push([d+t,d+t])}else if(s===u&&f.length>=2){let e=f[f.length-1],t=f[f.length-2];p={start:d+t,end:c,text:l.slice(e,u)+l.slice(t,e)},i.push([c,c])}else if(s===0&&o>0&&u>0){let t=o-1,n=e.getLineText(t),r=n.length,a=e.offsetAt({line:t,character:r}),s=r>0?vf(n,r,!1,yf(n)):r,u=vf(l,0,!0,f),d=a-(r-s),m=l.slice(0,u)+e.getTextSlice(a,c)+n.slice(s,r);p={start:d,end:c+u,text:m};let h=d+m.length;i.push([h,h])}else{i.push([t,a]);continue}r.push(p)}if(r.length===0)return{nextSelections:t};r.sort((e,t)=>e.start-t.start);for(let e=1;e<r.length;e++)if(r[e].start<r[e-1].end)throw Error(`Overlapping multi-selection edits are not supported`);let a=e.applyResolvedEdits(r,!0,t),o=Tf(e,i);if(e.setLastUndoSelectionsAfter(o),a!==void 0&&n!==void 0){let t=ad(a,n);t!==void 0&&e.setLastUndoLineAnnotations(n,t)}return{nextSelections:o,change:a}}function Rd(e,t,n){let r=t.map(t=>{let n=Sf(e,t);return{start:n.start,end:n.end,direction:0}});return Pd(e,r,r.map(()=>``),n)}function zd(e,t,n,r){let i=t.map(t=>{if(!Q(t))return{start:t.start,end:t.end,direction:0};let r=Ud(t),{line:i,character:a}=r,o=n?.(i,a)??0;if(a>o)return{start:{line:i,character:o},end:{line:i,character:a},direction:0};if(i===0)return{start:r,end:r,direction:0};let s=e.getLineLength(i-1);return{start:{line:i-1,character:s},end:{line:i,character:0},direction:0}});return Pd(e,i,i.map(()=>``),r)}function Bd(e,t,n){let r=t.map(t=>{let[n,r]=_f(e,t);return{start:n,end:r,direction:0}});return Pd(e,r,r.map(()=>``),n)}function Vd(e,t,n){if(!Q(t))return[t.start,t.end];let r=Ud(t),{line:i,character:a}=r,o=e.getLineLength(i),s=e.lineCount;if(a=Math.min(a,o),n)return a<o?[{line:i,character:a},{line:i,character:bf(e,i,a,!0)}]:i<s-1?[{line:i,character:o},{line:i+1,character:0}]:[r,r];if(a>0)return[{line:i,character:bf(e,i,a,!1)},{line:i,character:a}];if(i>0){let t=e.getLineLength(i-1);return[{line:i-1,character:t},{line:i,character:0}]}return[r,r]}function Hd(e,t,n,r,i=2){let a=t.map(t=>{let[r,a]=Vd(e,t,n);if(!n&&Q(t)){let t=Ef(e,{start:e.offsetAt(r),end:e.offsetAt(a),text:``},i);r=e.positionAt(t.start),a=e.positionAt(t.end)}return{start:r,end:a,direction:0}});return Pd(e,a,a.map(()=>``),r)}function Q(e){return e.start.line===e.end.line&&e.start.character===e.end.character}function Ud(e){let{start:t,end:n,direction:r}=e;return r===-1?t:n}function Wd(e){return e===`context`||e===`context-expanded`||e===`change-addition`}function Gd(e,t){let n=Q(e),r=Q(t);return n&&r?$(e.start,t.start)===0:n?$(t.start,e.start)<=0&&$(e.start,t.end)<=0:r?$(e.start,t.start)<=0&&$(t.start,e.end)<=0:$(e.start,t.end)<0&&$(t.start,e.end)<0}function $(e,t){return e.line===t.line?e.character-t.character:e.line-t.line}function Kd(e,t,n){let r=t===n?0:t<n?1:-1,i=Math.min(t,n),a=Math.max(t,n);return{start:e.positionAt(i),end:e.positionAt(a),direction:r}}function qd(e,t){let n=0;for(let r of t){if(e<r.start)break;if(e>=r.end)n+=r.text.length-(r.end-r.start);else return r.start+n+r.text.length}return e+n}function Jd(e,t,n,r){return t.map((t,i)=>{let[a,o]=n[i],s=qd(a,r),c=qd(o,r);return Kd(e,t.direction===-1?c:s,t.direction===-1?s:c)})}function Yd(e,t){let n=e.direction===-1?e.end:e.start,r=$(n,t.start),i=$(n,t.end),a=t.end;a=r<=0?t.end:i>=0?t.start:r===0?t.end:t.start;let o=$(n,a);return{start:o<=0?n:a,end:o<=0?a:n,direction:o===0?0:o<0?1:-1}}function Xd(e,t){let n=$(t.start,e.start)<0,r=$(t.end,e.end)>0;return n&&!r?{start:t.start,end:e.end,direction:-1}:r&&!n?{start:e.start,end:t.end,direction:1}:e.direction===-1?{start:t.start,end:e.end,direction:$(t.start,e.end)===0?0:-1}:{start:e.start,end:t.end,direction:$(e.start,t.end)===0?0:1}}function Zd(e,t){return Qd(e.map(e=>Xd(e,t)))}function Qd(e){if(e.length<=1)return e;let t=e.map((e,t)=>({index:t,selection:e})).sort((e,t)=>{let n=$(e.selection.start,t.selection.start);if(n!==0)return n;let r=$(e.selection.end,t.selection.end);return r===0?e.index-t.index:r}),n=[],r=t[0];for(let e of t.slice(1)){if(Gd(r.selection,e.selection)){let t=e.index>r.index?e:r,n=$(e.selection.start,r.selection.start)<0?e.selection.start:r.selection.start,i=$(e.selection.end,r.selection.end)>0?e.selection.end:r.selection.end,a=t.selection.direction;a===0&&$(n,i)!==0&&(a=$(t.selection.start,n)===0?-1:1),r={index:t.index,selection:{direction:a,end:i,start:n}};continue}n.push(r),r=e}return n.push(r),n.sort((e,t)=>e.index-t.index).map(({selection:e})=>e)}function $d(e){let t=e.map(e=>{let t=e.end.line;return e.end.character===0&&$(e.start,e.end)!==0&&t--,{startLine:e.start.line,endLine:Math.max(e.start.line,t)}}).sort((e,t)=>{let n=e.startLine-t.startLine;return n===0?e.endLine-t.endLine:n}),n=[];for(let e of t){let t=n.at(-1);t!==void 0&&e.startLine<=t.endLine+1?t.endLine=Math.max(t.endLine,e.endLine):n.push({...e})}return n}function ef(e,t,n,r){let i=e=>{let i=e.line+t;if(i>=n){let e=Math.max(0,n-1);return{line:e,character:r(e)}}return i<0?{line:0,character:0}:{line:i,character:e.character}};return{start:i(e.start),end:i(e.end),direction:e.direction}}function tf(e,t){if(t.length===0)return;let n=t.map(t=>Q(t)?hf(e,t):t),r=n.map(t=>e.getText(t)),i=r[0];if(i.length===0||r.some(e=>e!==i))return;let a=n.map(t=>[e.offsetAt(t.start),e.offsetAt(t.end)]),o=e.findNextNonOverlappingSubstring(i,a);if(o===void 0)return n.some((e,n)=>{let r=t[n];return $(e.start,r.start)!==0||$(e.end,r.end)!==0||e.direction!==r.direction})?n:void 0;let s=Kd(e,o,o+i.length);return[...n,s]}function nf(e){let t=e.lineCount-1;return{start:{line:0,character:0},end:{line:t,character:e.getLineLength(t)},direction:1}}function rf(e,t,n){let r=0;if(t){let t=e.lineCount-1;r=n===!0&&t>0&&e.getLineLength(t)===0?t-1:t}let i=t?e.getLineLength(r):0,a={line:r,character:i};return{start:a,end:a,direction:1}}function af(e,t){if(Q(t)){let n=t.start.line;return{start:e.offsetAt({line:n,character:0}),end:n<e.lineCount-1?e.offsetAt({line:n+1,character:0}):e.offsetAt({line:n,character:e.getLineLength(n)})}}let n=e.offsetAt(t.start),r=e.offsetAt(t.end);return n<=r?{start:n,end:r}:{start:r,end:n}}function of(e,t){return t.map(t=>af(e,t)).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n})}function sf(e,t){return of(e,t).map(({start:t,end:n})=>e.getTextSlice(t,n))}function cf(e,t){let n=of(e,t),r=e.eol,i=``,a=-1;for(let t of n)if(!(t.end<=t.start)){if(t.start<=a){t.end>a&&(i+=e.getTextSlice(a,t.end),a=t.end);continue}i.length>0&&!$u(i)&&(i+=r),i+=e.getTextSlice(t.start,t.end),a=t.end}return i}function lf(e,t){if(Q(t))return uf(e,t);let[n,r]=$(t.start,t.end)<=0?[t.start,t.end]:[t.end,t.start];return{start:e.offsetAt(n),end:e.offsetAt(r),text:``}}function uf(e,t){let n=t.start.line,r=e.offsetAt({line:n,character:0}),i=e.offsetAt({line:n,character:e.getLineLength(n)});return n<e.lineCount-1?{start:r,end:e.offsetAt({line:n+1,character:0}),text:``}:n>0?{start:e.offsetAt({line:n-1,character:e.getLineLength(n-1)}),end:i,text:``}:{start:r,end:i,text:``}}function df(e){let t=[];for(let{edit:n}of e){if(n.start>=n.end)continue;let e=t.at(-1);e!==void 0&&n.start<=e.end?t[t.length-1]={start:e.start,end:Math.max(e.end,n.end),text:``}:t.push(n)}return t}function ff(e,t){let n=Array.from({length:e.length}),r=0,i=0;for(let a of e){for(;r<t.length&&a.edit.start>t[r].end;){let e=t[r];i-=e.end-e.start,r++}let e=t[r];e!==void 0&&a.edit.start>=e.start&&a.edit.start<=e.end?n[a.index]=e.start+i:n[a.index]=a.edit.start+i}return n}function pf(e,t){let n=[...t.map((t,n)=>({index:n,edit:lf(e,t)}))].sort((e,t)=>{let n=e.edit.start-t.edit.start;if(n!==0)return n;let r=e.edit.end-t.edit.end;return r===0?e.index-t.index:r}),r=df(n);return{text:cf(e,t),edits:r,nextSelectionOffsets:ff(n,r)}}function mf(e,t){let n=Math.max(0,t),r=Of(e),i=null;for(let e of r){i=e;let t=If(e);if(n<=t+(e.textContent?.length??0)){let r=kf(e,n<t?0:n-t);if(r!==null)return r}}if(i!==null){let e=kf(i,i.textContent?.length??0);return e===null?[i,0]:e}let a=0,o=null;for(let t of e.childNodes){if(t.nodeType===1&&t.tagName===`BR`)return[t,0];if(t.nodeType!==3)continue;o=t;let e=Lf(o.textContent,o.textContent?.length??0);if(n<=a+e)return[o,Lf(o.textContent,n-a)];a+=e}return o===null?[e,0]:[o,Lf(o.textContent,o.textContent?.length??0)]}function hf(e,t){let{line:n,character:r}=t.start,i=e.getLineText(n),a=gf(i,Math.max(0,Math.min(r,i.length)));return a===void 0?t:{start:{line:n,character:a.start},end:{line:n,character:a.end},direction:1}}function gf(e,t){let n=ed({granularity:`word`});if(n!==void 0){for(let r of n.segment(e)){if(r.isWordLike!==!0)continue;let e=r.index,n=e+r.segment.length;if(t>=e&&t<=n)return{start:e,end:n}}return}let r=/[\p{Alphabetic}\p{Number}_]+/gu,i;for(;(i=r.exec(e))!==null;){let e=i.index,n=e+i[0].length;if(t>=e&&t<=n)return{start:e,end:n}}}function _f(e,t){if(!Q(t))return[t.start,t.end];let n=Ud(t),{line:r,character:i}=n;if(i===0){if(r===0)return[n,n];let t=e.getLineLength(r-1);return[{line:r-1,character:t},{line:r,character:0}]}let a=e.getLineText(r),o=yf(a),s=i,c;for(;s>0;){let e=vf(a,s,!1,o),t=a.slice(e,s),n=/\S/.test(t)?/\p{Alphabetic}|\p{Number}|_/u.test(t)?1:2:0;if(c!==void 0&&n!==c)break;(n!==0||s!==i)&&(c=n),s=e}return[{line:r,character:s},{line:r,character:i}]}function vf(e,t,n,r){if(n){for(let e of r)if(e>t)return e;return e.length}for(let e=r.length-1;e>=0;e--){let n=r[e];if(n<t)return n}return 0}function yf(e){let t=[0],n=rd();if(n!==void 0){for(let r of n.segment(e))r.index>0&&t.push(r.index);return t}let r=0;for(let n of e)r>0&&t.push(r),r+=n.length;return t}function bf(e,t,n,r){let i=e.getLineLength(t);if(r){if(n>=i)return i;let r=e.offsetAt({line:t,character:0}),a=e.getTextSlice(r+n,r+i),o=rd();if(o!==void 0){for(let e of o.segment(a))return n+e.segment.length;return i}for(let e of a)return n+e.length;return i}if(n<=0)return 0;let a=e.offsetAt({line:t,character:0}),o=e.getTextSlice(a,a+n),s=0,c=rd();if(c!==void 0){for(let e of c.segment(o))s=e.index;return s}let l=0;for(let e of o)s=l,l+=e.length;return s}function xf(e,t){let n=t.direction===-1;return[e.offsetAt(n?t.end:t.start),e.offsetAt(Ud(t))]}function Sf(e,t){if(!Q(t))return{start:t.start,end:t.end};let{line:n,character:r}=t.start,i=e.getLineText(n).length;return r<i?{start:{line:n,character:r},end:{line:n,character:i}}:n<e.lineCount-1?{start:{line:n,character:r},end:{line:n+1,character:0}}:{start:{line:n,character:r},end:{line:n,character:r}}}function Cf(e,t,n){if(t!==`
|
|
2134
|
+
`)||e.endsWith(`\r`)}function ed(e){if(!(typeof Intl>`u`||typeof Intl.Segmenter!=`function`))return new Intl.Segmenter(void 0,e)}var td,nd=!1;function rd(){return nd||=(td=ed({granularity:`grapheme`}),!0),td}function id(e){let t=e.ownerDocument,n=e.parentElement;for(;n!=null&&n!==t.body&&n!==t.documentElement;){let e=n.ownerDocument.defaultView?.getComputedStyle(n).overflowY;if(e===`auto`||e===`scroll`||e===`overlay`)return n;n=n.parentElement}return t}function ad(e,t){let n=od(e);if(n.length===0)return;let r=[],i=!1;for(let a of t){if(a.side===`deletions`||a.lineNumber<=0){r.push(a);continue}let t=a.lineNumber-1,o=e.previousLineCount,s=!1;for(let e of n){let n=Math.max(1,o+e.lineDelta),r=sd(t,e,n);if(r===void 0){s=!0,t=void 0;break}(r!==t||ld(t,e))&&(s=!0),t=r,o=n}if(t===void 0){i=!0;continue}let c=t+1;if(s){r.push(c===a.lineNumber?a:{...a,lineNumber:c}),i=!0;continue}r.push(a)}return i?r:void 0}function od(e){if(e.changedLineChanges!==void 0)return e.changedLineChanges.flatMap(([e,t,n,r=0,i=0,a=!1])=>{if(n===0)return[];let o=Math.max(0,t-e);return[{startLine:e,startCharacter:r,endLine:e+Math.max(0,o-n),deletesEndLine:n<0&&a,insertedLineBreaks:o,lineDelta:n}]});if(e.lineDelta===0)return e.changedLineRanges.flatMap(([e,t])=>{let n=t-e;return n<=0?[]:[{startLine:e,startCharacter:0,endLine:e,deletesEndLine:!1,insertedLineBreaks:n,lineDelta:n}]});let t=Math.max(0,-e.lineDelta),n=e.endedAtDocumentEnd&&e.startLine+t===e.previousLineCount-1;return[{startLine:e.startLine,startCharacter:e.startCharacter,endLine:e.startLine+t,deletesEndLine:n,insertedLineBreaks:Math.max(0,e.lineDelta),lineDelta:e.lineDelta}]}function sd(e,t,n){if(e<t.startLine)return e;if(e>t.endLine||t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)return e+t.lineDelta;if(t.startLine===t.endLine)return t.startCharacter===0?e+t.insertedLineBreaks:e;if(cd(e,t))return;let r=Math.min(Math.max(0,e-t.startLine),t.insertedLineBreaks);return ud(t.startLine+r,n)}function cd(e,t){return!(t.lineDelta>=0||e<t.startLine||e>t.endLine||e===t.startLine&&t.startCharacter>0||e===t.endLine&&!t.deletesEndLine)}function ld(e,t){return t.lineDelta===0||e<t.startLine||e>t.endLine?!1:!(t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)}function ud(e,t){return Math.max(0,Math.min(e,Math.max(0,t-1)))}function dd(e,t,n){let r=new Map,i=new Map;for(let t of e){let e=t.lineNumber;r.has(e)||r.set(e,[]),i.has(e)||i.set(e,[]),(t.side===`deletions`?i:r).get(e).push(ge(t))}let a=t.parentElement?.previousElementSibling,o,s;if(a!=null&&a instanceof HTMLElement&&a.dataset.deletions!==void 0)for(let e of a.children){let t=e,{gutter:n,content:r}=t.dataset;n===void 0?r!==void 0&&(s=t):o=t}fd(t,n),s!==void 0&&fd(s,o);let c=pd(r,t,n);if(s===void 0)return;let l=pd(i,s,o);requestAnimationFrame(()=>{md(r,i,c,l)})}function fd(e,t){let n=[];for(let r=1;r<e.childElementCount;r++){let i=e.children[r];i.dataset.lineAnnotation!==void 0&&(n.push(i),t!==void 0&&n.push(t.children[r]))}for(let e of n)e.remove()}function pd(e,t,n){let r=new Map;for(let n of t.children){let t=Ju(n);if(t!==void 0){let i=e.get(t);if(i!==void 0){let e=X(`div`,{dataset:{lineAnnotation:`0,`+(t-1)},children:[X(`div`,{dataset:`annotationContent`,children:i.map(e=>X(`slot`,{name:e}))})]});n.after(e),r.set(t,e)}}}if(n!==void 0)for(let t of n.children){let n=Ju(t,`columnNumber`);if(n!==void 0&&e.has(n)){let e=X(`div`,{dataset:{gutterBuffer:`annotation`,bufferSize:`1`},style:{gridRow:`span 1`}});t.after(e)}}return r}function md(e,t,n,r){let i=new Map;for(let[t,n]of e.entries()){let e=r.get(t);if(n.length===0&&e!==void 0){let n=hd(e);n>0&&i.set(t,n)}}for(let[e,r]of t.entries()){let t=n.get(e);if(r.length===0&&t!==void 0){let n=hd(t);n>0&&i.set(e,n)}}gd(e,n,i),gd(t,r,i)}function hd(e){let t=e.firstElementChild;return t instanceof HTMLElement?t.getBoundingClientRect().height:0}function gd(e,t,n){for(let[r,i]of t.entries()){let t=e.get(r),a=n.get(r);t?.length===0&&a!==void 0&&i.style.setProperty(`--diffs-annotation-min-height`,`${a}px`)}}var _d=class{#e;#t;#n;#r;#i;#a;#o=0;#s=0;#c=0;#l=!0;#u;#d=new Map;#f;#p;constructor(e){this.#f=e.hasActivePopover,this.#p=e.updateActivePopover}setViewportElements(e,t){let n=this.#e!==e||this.#t!==t;this.#e=e,n&&(this.#t=t,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0)}cleanUp(){this.#t=void 0,this.#e=void 0,this.#n=void 0,this.#r=void 0,this.#i=void 0,this.#a=void 0,this.#o=0,this.#s=0,this.#c=0,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0,this.#d.clear()}resetPlacement(e=`default`){this.#d.delete(e)}setPlacement(e,t=`default`){this.#d.set(t,e)}choosePlacement(e){let{preferred:t,fallback:n,viewport:r,popoverHeight:i,atDocumentEdge:a,placementKey:o=`default`}=e,s=this.#d.get(o),c;if(r!==void 0&&i>0){let e=(e,t=0)=>e.top>=r.top+t&&e.bottom<=r.bottom-t;c=s===`fallback`&&e(n)&&!e(t,4)||!e(t)&&e(n)?`fallback`:`preferred`}else c=a?`fallback`:`preferred`;return this.#d.set(o,c),c}getPlacementBounds(){let e=this.#g();if(e===void 0)return;let t=this.#_(),n,r;if(t===void 0?(n=0,r=window.innerHeight):(n=t.top,r=t.bottom),n=Math.max(n,e.top),r=Math.min(r,e.bottom),r<=n)return;let i=this.#o,a=this.#s,o=this.#c>0?this.#c:e.width,s=t===void 0?0:t.left,c=t===void 0?window.innerWidth:t.right,l=i,u=i+o,d=Math.max(l,s-e.left+i),f=Math.min(u,c-e.left+i);return{top:n-e.top+a,bottom:r-e.top+a,left:d,right:Math.max(d,f)}}#m(){let e=this.#e;if(e===void 0)return;if(this.#r===e&&(this.#n===void 0||this.#n.isConnected))return this.#n;let t=e.parentElement;for(;t!==null;){let n=getComputedStyle(t).overflowY;if(n===`auto`||n===`scroll`||n===`overlay`)return this.#n=t,this.#r=e,t;t=t.parentElement}this.#n=void 0,this.#r=e}#h(){if(!this.#l)return;this.#v();let e=this.#t;this.#i=e?.getBoundingClientRect(),this.#o=e?.scrollLeft??0,this.#s=e?.scrollTop??0,this.#c=e?.clientWidth??0,this.#a=this.#m()?.getBoundingClientRect(),this.#l=!1}#g(){return this.#h(),this.#i}#_(){return this.#h(),this.#a}#v(){if(this.#u!==void 0)return;let e,t=()=>{this.#l=!0,!(!this.#f()||e!==void 0)&&(e=requestAnimationFrame(()=>{e=void 0,this.#p()}))},n=this.#m(),r=this.#t;this.#u=[Z(n===void 0?window:n,`scroll`,t,{passive:!0}),...r===void 0?[]:[Z(r,`scroll`,t,{passive:!0})],Z(window,`resize`,t,{passive:!0}),()=>{e!==void 0&&(cancelAnimationFrame(e),e=void 0)}]}};function vd(e,{gutterWidth:t,placeAbove:n,viewport:r,x:i,y:a}){if(e.style.setProperty(`--gutter-width`,t+`px`),e.style.setProperty(`--popover-x`,i+`px`),e.style.setProperty(`--popover-y`,a+`px`),e.style.setProperty(`--popover-y-shift`,n?`-100%`:`0px`),r===void 0){e.style.removeProperty(`--popover-viewport-left`),e.style.removeProperty(`--popover-viewport-right`),e.style.removeProperty(`--popover-viewport-top`),e.style.removeProperty(`--popover-viewport-bottom`);return}e.style.setProperty(`--popover-viewport-left`,r.left+`px`),e.style.setProperty(`--popover-viewport-right`,r.right+`px`),e.style.setProperty(`--popover-viewport-top`,r.top+`px`),e.style.setProperty(`--popover-viewport-bottom`,r.bottom+`px`)}var yd=new Map([[`'`,`'`],[`"`,`"`],["`","`"],[`{`,`}`],[`[`,`]`],[`<`,`>`],[`(`,`)`]]),bd=new Set([`'`,`"`,"`"]),xd=new Set([`{`,`[`,`(`,`<`]);function Sd(e,t=0){let n=Df(e.startContainer,e.startOffset),r=Df(e.endContainer,e.endOffset);if(!(n===null||r===null))return{start:n,end:r,direction:t}}function Cd(e,t,n,r){if(e===void 0)return[[],t];let{start:i,end:a}=t,o=[],s={...t},c=i.line!==a.line,l=a.line;i.line<a.line&&a.character===0&&l--;for(let t=i.line;t<=l;t++){let l=e.getLineText(t);if(l===void 0||c&&l.trim().length===0)continue;let u=l.startsWith(` `)?` `:` `.repeat(n),d=0,f=u;if(r){if(l.startsWith(` `))d=1;else if(l.startsWith(` `)){let e=l.length-l.trimStart().length;d=Math.min(u.length,e)}if(d===0)continue;f=``}o.push({range:{start:{line:t,character:0},end:{line:t,character:d}},newText:f});let p=f.length-d;t===i.line&&(s={...s,start:{...i,character:Math.max(0,i.character+p)}}),t===a.line&&(s={...s,end:{...a,character:Math.max(0,a.character+p)}})}return[o,s]}function wd(e,t,n,r={}){let i=e.lineCount;return t.map(t=>{let{line:a,character:o}=n===`up`||n===`left`?t.start:t.end;if(n===`textStart`||n===`start`||n===`end`){let i=Ud(t);a=i.line,o=i.character;let s=Dd(e,a,o,r);if(n===`textStart`){let t=e.getLineText(a).slice(s.start,s.end),n=s.start+wf(t);o=o===n?s.start:n}else o=n===`start`?s.start:s.end}else if(n===`up`){let t=Td(e,a,o,-1,r);t===void 0?a>0&&(a=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`)??a):(a=t.line,o=t.character)}else if(n===`down`){let t=Td(e,a,o,1,r);if(t!==void 0)a=t.line,o=t.character;else{let e=Math.max(i-1,0);a<e&&(a=r.resolveRenderableLine==null?a+1:Math.min(r.resolveRenderableLine(a+1,`down`)??a,e))}}else if(Q(t)){let t=e.getLineLength(a);if(o=Math.min(o,t),n===`left`){if(o>0)o=bf(e,a,o,!1);else if(a>0){let t=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`);t!==void 0&&(a=t,o=e.getLineLength(a))}}else if(o<t)o=bf(e,a,o,!0);else if(a<i-1){let e=r.resolveRenderableLine==null?a+1:r.resolveRenderableLine(a+1,`down`);e!==void 0&&(a=Math.min(e,i-1),o=0)}}let s={line:a,character:o};return{start:s,end:s,direction:0}})}function Td(e,t,n,r,i){if(i.getSoftLineOffsets===void 0)return;let a=Dd(e,t,n,i),o=a.index+r,s=t,c;if(o>=0&&o<a.count)c=kd(e,s,o,i);else{let a=t+r;if(a<0||a>=e.lineCount)return{line:t,character:n};let o=i.resolveRenderableLine==null?a:i.resolveRenderableLine(a,r<0?`up`:`down`);if(o===void 0)return{line:t,character:n};s=Math.min(o,e.lineCount-1);let l=Od(e,s,i);c=kd(e,s,r<0?l-1:0,i)}let l=Math.max(0,n-a.start),u=c.start+l,d=c.index===c.count-1?u:Math.min(u,c.end),f=e.getLineText(s);return{line:s,character:d>f.length?d:Ed(f,d)}}function Ed(e,t){if(t<=0||t>=e.length)return t;let n=rd();if(n!==void 0){for(let r of n.segment(e)){if(t<=r.index)return t;let e=r.index+r.segment.length;if(t<e)return e}return t}let r=0;for(let n of e){if(t<=r)return t;let e=r+n.length;if(t<e)return e;r=e}return t}function Dd(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};for(let i=0;i+1<a.length;i++){let a=kd(e,t,i,r);if(n>=a.start&&n<=a.end)return a}return kd(e,t,n<(a[0]??0)?0:a.length-2,r)}function Od(e,t,n){let r=n.getSoftLineOffsets?.(t);return r===void 0||r.length<2?1:r.length-1}function kd(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};let o=a.length-1,s=Math.max(0,Math.min(n,o-1)),c=Math.max(0,Math.min(i,a[s]??0));return{start:c,end:Math.max(c,Math.min(i,a[s+1]??i)),index:s,count:o}}function Ad(e,t,n,r={}){return t.map(t=>{let i=t.direction===-1?t.start:t.end,[a]=wd(e,[{start:i,end:i,direction:0}],n,r);return Yd(t,a)})}function jd(e,t,n,r,i=2,a=!1){if(t[t.length-1]===void 0)return{nextSelections:[]};let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=s[(t.length-1)*2],l=s[(t.length-1)*2+1],u=[],d=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=u[u.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(d=!1),u.push(t)}d||u.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let f=Ef(e,n,i),p=[],m=Array.from({length:t.length}),h=0,g,_=()=>{if(g===void 0)return;let t=Ef(e,{start:g.start,end:g.end,text:f.text},i),n=Cf(e,t.text,t.start);p.push({start:t.start,end:t.end,text:n});let r=[g.start+h+n.length,g.start+h+n.length];for(let e of g.indices)m[e]=r;h+=n.length-(t.end-t.start),g=void 0};for(let e of u){let t=Math.max(0,e.start+(f.start-c)),n=Math.max(t,e.end+(f.end-l));if(g!==void 0&&t<g.end){g.end=Math.max(g.end,n),g.indices.push(e.index);continue}_(),g={start:t,end:n,indices:[e.index]}}_();let v=e.applyResolvedEdits(p,!0,t,void 0,a),y=Tf(e,m.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(y),v!==void 0&&r!==void 0){let t=ad(v,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:y,change:v}}function Md(e,t){if(t.length!==e.length+2)return;let n=yd.get(t[0]);if(!(n===void 0||t[t.length-1]!==n||t.slice(1,-1)!==e))return 1}function Nd(e,t,n,r){let i=t.start+n,a=i+r.length;if(t.end-t.start>0){let n=e.getTextSlice(t.start,t.end),a=Md(n,r)??r.indexOf(n);if(a!==-1&&a+n.length<=r.length){let e=i+a;return[e,e+n.length]}}return[a,a]}function Pd(e,t,n,r,i=!1,a=`selection`){if(t.length!==n.length)throw Error(`Selection text replacements must match the selection count`);let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=[],l=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=c[c.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(l=!1),c.push(t)}l||c.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let u=n.every(e=>e===``),d,f=Array.from({length:t.length});if(u){d=[];let e=!1;for(let t of c){if(f[t.index]=[t.end,t.end],t.start>=t.end)continue;e=!0;let n=d[d.length-1];n!==void 0&&t.start<n.end?d[d.length-1]={start:n.start,end:Math.max(n.end,t.end),text:``}:d.push({start:t.start,end:t.end,text:``})}if(!e)return{nextSelections:t};for(let e of c){let t=e.end,n=0,r=t;for(let e of d){if(t<=e.start)break;if(t>=e.end){n-=e.end-e.start;continue}r=e.start+n;break}r===t&&(r+=n),f[e.index]=[r,r]}}else{d=[];let t=0,r=-1;for(let i=0;i<c.length;i++){let o=c[i];if(o.start<r)throw Error(`Overlapping multi-selection edits are not supported`);r=o.end;let s=Cf(e,n[a===`document`?i:o.index],o.start);d.push({start:o.start,end:o.end,text:s}),f[o.index]=Nd(e,o,t,s),t+=s.length-(o.end-o.start)}}let p=e.applyResolvedEdits(d,!0,t,void 0,i),m=Tf(e,f.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(m),p!==void 0&&r!==void 0){let t=ad(p,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:m,change:p}}function Fd(e,t){return e===`never`?!1:e===`brackets`?xd.has(t):e===`quotes`?bd.has(t):!0}function Id(e,t,n,r){if(n.length!==1||t.length===0)return;let i=yd.get(n);if(i===void 0||!Fd(r,n))return;let a=[];for(let r of t){if(Q(r))return;a.push(n+e.getText(r)+i)}return a}function Ld(e,t,n){let r=[],i=[];for(let n of t){let[t,a]=xf(e,n);if(!Q(n)){i.push([t,a]);continue}let{line:o,character:s}=n.start,c=t,l=e.getLineText(o),u=l.length,d=c-s,f=yf(l),p;if(s>0&&s<u){let e=vf(l,s,!1,f),t=vf(l,s,!0,f);p={start:d+e,end:d+t,text:l.slice(s,t)+l.slice(e,s)},i.push([d+t,d+t])}else if(s===u&&f.length>=2){let e=f[f.length-1],t=f[f.length-2];p={start:d+t,end:c,text:l.slice(e,u)+l.slice(t,e)},i.push([c,c])}else if(s===0&&o>0&&u>0){let t=o-1,n=e.getLineText(t),r=n.length,a=e.offsetAt({line:t,character:r}),s=r>0?vf(n,r,!1,yf(n)):r,u=vf(l,0,!0,f),d=a-(r-s),m=l.slice(0,u)+e.getTextSlice(a,c)+n.slice(s,r);p={start:d,end:c+u,text:m};let h=d+m.length;i.push([h,h])}else{i.push([t,a]);continue}r.push(p)}if(r.length===0)return{nextSelections:t};r.sort((e,t)=>e.start-t.start);for(let e=1;e<r.length;e++)if(r[e].start<r[e-1].end)throw Error(`Overlapping multi-selection edits are not supported`);let a=e.applyResolvedEdits(r,!0,t),o=Tf(e,i);if(e.setLastUndoSelectionsAfter(o),a!==void 0&&n!==void 0){let t=ad(a,n);t!==void 0&&e.setLastUndoLineAnnotations(n,t)}return{nextSelections:o,change:a}}function Rd(e,t,n){let r=t.map(t=>{let n=Sf(e,t);return{start:n.start,end:n.end,direction:0}});return Pd(e,r,r.map(()=>``),n)}function zd(e,t,n,r){let i=t.map(t=>{if(!Q(t))return{start:t.start,end:t.end,direction:0};let r=Ud(t),{line:i,character:a}=r,o=n?.(i,a)??0;if(a>o)return{start:{line:i,character:o},end:{line:i,character:a},direction:0};if(i===0)return{start:r,end:r,direction:0};let s=e.getLineLength(i-1);return{start:{line:i-1,character:s},end:{line:i,character:0},direction:0}});return Pd(e,i,i.map(()=>``),r)}function Bd(e,t,n){let r=t.map(t=>{let[n,r]=_f(e,t);return{start:n,end:r,direction:0}});return Pd(e,r,r.map(()=>``),n)}function Vd(e,t,n){if(!Q(t))return[t.start,t.end];let r=Ud(t),{line:i,character:a}=r,o=e.getLineLength(i),s=e.lineCount;if(a=Math.min(a,o),n)return a<o?[{line:i,character:a},{line:i,character:bf(e,i,a,!0)}]:i<s-1?[{line:i,character:o},{line:i+1,character:0}]:[r,r];if(a>0)return[{line:i,character:bf(e,i,a,!1)},{line:i,character:a}];if(i>0){let t=e.getLineLength(i-1);return[{line:i-1,character:t},{line:i,character:0}]}return[r,r]}function Hd(e,t,n,r,i=2){let a=t.map(t=>{let[r,a]=Vd(e,t,n);if(!n&&Q(t)){let t=Ef(e,{start:e.offsetAt(r),end:e.offsetAt(a),text:``},i);r=e.positionAt(t.start),a=e.positionAt(t.end)}return{start:r,end:a,direction:0}});return Pd(e,a,a.map(()=>``),r)}function Q(e){return e.start.line===e.end.line&&e.start.character===e.end.character}function Ud(e){let{start:t,end:n,direction:r}=e;return r===-1?t:n}function Wd(e){return e===`context`||e===`context-expanded`||e===`change-addition`}function Gd(e,t){let n=Q(e),r=Q(t);return n&&r?$(e.start,t.start)===0:n?$(t.start,e.start)<=0&&$(e.start,t.end)<=0:r?$(e.start,t.start)<=0&&$(t.start,e.end)<=0:$(e.start,t.end)<0&&$(t.start,e.end)<0}function $(e,t){return e.line===t.line?e.character-t.character:e.line-t.line}function Kd(e,t,n){let r=t===n?0:t<n?1:-1,i=Math.min(t,n),a=Math.max(t,n);return{start:e.positionAt(i),end:e.positionAt(a),direction:r}}function qd(e,t){let n=0;for(let r of t){if(e<r.start)break;if(e>=r.end)n+=r.text.length-(r.end-r.start);else return r.start+n+r.text.length}return e+n}function Jd(e,t,n,r){return t.map((t,i)=>{let[a,o]=n[i],s=qd(a,r),c=qd(o,r);return Kd(e,t.direction===-1?c:s,t.direction===-1?s:c)})}function Yd(e,t){let n=e.direction===-1?e.end:e.start,r=$(n,t.start),i=$(n,t.end),a=t.end;a=r<=0?t.end:i>=0?t.start:r===0?t.end:t.start;let o=$(n,a);return{start:o<=0?n:a,end:o<=0?a:n,direction:o===0?0:o<0?1:-1}}function Xd(e,t){let n=$(t.start,e.start)<0,r=$(t.end,e.end)>0;return n&&!r?{start:t.start,end:e.end,direction:-1}:r&&!n?{start:e.start,end:t.end,direction:1}:e.direction===-1?{start:t.start,end:e.end,direction:$(t.start,e.end)===0?0:-1}:{start:e.start,end:t.end,direction:$(e.start,t.end)===0?0:1}}function Zd(e,t){return Qd(e.map(e=>Xd(e,t)))}function Qd(e){if(e.length<=1)return e;let t=e.map((e,t)=>({index:t,selection:e})).sort((e,t)=>{let n=$(e.selection.start,t.selection.start);if(n!==0)return n;let r=$(e.selection.end,t.selection.end);return r===0?e.index-t.index:r}),n=[],r=t[0];for(let e of t.slice(1)){if(Gd(r.selection,e.selection)){let t=e.index>r.index?e:r,n=$(e.selection.start,r.selection.start)<0?e.selection.start:r.selection.start,i=$(e.selection.end,r.selection.end)>0?e.selection.end:r.selection.end,a=t.selection.direction;a===0&&$(n,i)!==0&&(a=$(t.selection.start,n)===0?-1:1),r={index:t.index,selection:{direction:a,end:i,start:n}};continue}n.push(r),r=e}return n.push(r),n.sort((e,t)=>e.index-t.index).map(({selection:e})=>e)}function $d(e){let t=e.map(e=>{let t=e.end.line;return e.end.character===0&&$(e.start,e.end)!==0&&t--,{startLine:e.start.line,endLine:Math.max(e.start.line,t)}}).sort((e,t)=>{let n=e.startLine-t.startLine;return n===0?e.endLine-t.endLine:n}),n=[];for(let e of t){let t=n.at(-1);t!==void 0&&e.startLine<=t.endLine+1?t.endLine=Math.max(t.endLine,e.endLine):n.push({...e})}return n}function ef(e,t,n,r){let i=e=>{let i=e.line+t;if(i>=n){let e=Math.max(0,n-1);return{line:e,character:r(e)}}return i<0?{line:0,character:0}:{line:i,character:e.character}};return{start:i(e.start),end:i(e.end),direction:e.direction}}function tf(e,t){if(t.length===0)return;let n=t.map(t=>Q(t)?hf(e,t):t),r=n.map(t=>e.getText(t)),i=r[0];if(i.length===0||r.some(e=>e!==i))return;let a=n.map(t=>[e.offsetAt(t.start),e.offsetAt(t.end)]),o=e.findNextNonOverlappingSubstring(i,a);if(o===void 0)return n.some((e,n)=>{let r=t[n];return $(e.start,r.start)!==0||$(e.end,r.end)!==0||e.direction!==r.direction})?n:void 0;let s=Kd(e,o,o+i.length);return[...n,s]}function nf(e){let t=e.lineCount-1;return{start:{line:0,character:0},end:{line:t,character:e.getLineLength(t)},direction:1}}function rf(e,t,n){let r=0;if(t){let t=e.lineCount-1;r=n===!0&&t>0&&e.getLineLength(t)===0?t-1:t}let i=t?e.getLineLength(r):0,a={line:r,character:i};return{start:a,end:a,direction:1}}function af(e,t){if(Q(t)){let n=t.start.line;return{start:e.offsetAt({line:n,character:0}),end:n<e.lineCount-1?e.offsetAt({line:n+1,character:0}):e.offsetAt({line:n,character:e.getLineLength(n)})}}let n=e.offsetAt(t.start),r=e.offsetAt(t.end);return n<=r?{start:n,end:r}:{start:r,end:n}}function of(e,t){return t.map(t=>af(e,t)).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n})}function sf(e,t){return of(e,t).map(({start:t,end:n})=>e.getTextSlice(t,n))}function cf(e,t){let n=of(e,t),r=e.eol,i=``,a=-1;for(let t of n)if(!(t.end<=t.start)){if(t.start<=a){t.end>a&&(i+=e.getTextSlice(a,t.end),a=t.end);continue}i.length>0&&!$u(i)&&(i+=r),i+=e.getTextSlice(t.start,t.end),a=t.end}return i}function lf(e,t){if(Q(t))return uf(e,t);let[n,r]=$(t.start,t.end)<=0?[t.start,t.end]:[t.end,t.start];return{start:e.offsetAt(n),end:e.offsetAt(r),text:``}}function uf(e,t){let n=t.start.line,r=e.offsetAt({line:n,character:0}),i=e.offsetAt({line:n,character:e.getLineLength(n)});return n<e.lineCount-1?{start:r,end:e.offsetAt({line:n+1,character:0}),text:``}:n>0?{start:e.offsetAt({line:n-1,character:e.getLineLength(n-1)}),end:i,text:``}:{start:r,end:i,text:``}}function df(e){let t=[];for(let{edit:n}of e){if(n.start>=n.end)continue;let e=t.at(-1);e!==void 0&&n.start<=e.end?t[t.length-1]={start:e.start,end:Math.max(e.end,n.end),text:``}:t.push(n)}return t}function ff(e,t){let n=Array.from({length:e.length}),r=0,i=0;for(let a of e){for(;r<t.length&&a.edit.start>t[r].end;){let e=t[r];i-=e.end-e.start,r++}let e=t[r];e!==void 0&&a.edit.start>=e.start&&a.edit.start<=e.end?n[a.index]=e.start+i:n[a.index]=a.edit.start+i}return n}function pf(e,t){let n=[...t.map((t,n)=>({index:n,edit:lf(e,t)}))].sort((e,t)=>{let n=e.edit.start-t.edit.start;if(n!==0)return n;let r=e.edit.end-t.edit.end;return r===0?e.index-t.index:r}),r=df(n);return{text:cf(e,t),edits:r,nextSelectionOffsets:ff(n,r)}}function mf(e,t){let n=Math.max(0,t),r=Of(e),i=null;for(let e of r){i=e;let t=If(e);if(n<=t+(e.textContent?.length??0)){let r=kf(e,n<t?0:n-t);if(r!==null)return r}}if(i!==null){let e=kf(i,i.textContent?.length??0);return e===null?[i,0]:e}let a=0,o=null;for(let t of e.childNodes){if(t.nodeType===1&&t.tagName===`BR`)return[t,0];if(t.nodeType!==3)continue;o=t;let e=Lf(o.textContent,o.textContent?.length??0);if(n<=a+e)return[o,Lf(o.textContent,n-a)];a+=e}return o===null?[e,0]:[o,Lf(o.textContent,o.textContent?.length??0)]}function hf(e,t){let{line:n,character:r}=t.start,i=e.getLineText(n),a=gf(i,Math.max(0,Math.min(r,i.length)));return a===void 0?t:{start:{line:n,character:a.start},end:{line:n,character:a.end},direction:1}}function gf(e,t){let n=ed({granularity:`word`});if(n!==void 0){for(let r of n.segment(e)){if(r.isWordLike!==!0)continue;let e=r.index,n=e+r.segment.length;if(t>=e&&t<=n)return{start:e,end:n}}return}let r=/[\p{Alphabetic}\p{Number}_]+/gu,i;for(;(i=r.exec(e))!==null;){let e=i.index,n=e+i[0].length;if(t>=e&&t<=n)return{start:e,end:n}}}function _f(e,t){if(!Q(t))return[t.start,t.end];let n=Ud(t),{line:r,character:i}=n;if(i===0){if(r===0)return[n,n];let t=e.getLineLength(r-1);return[{line:r-1,character:t},{line:r,character:0}]}let a=e.getLineText(r),o=yf(a),s=i,c;for(;s>0;){let e=vf(a,s,!1,o),t=a.slice(e,s),n=/\S/.test(t)?/\p{Alphabetic}|\p{Number}|_/u.test(t)?1:2:0;if(c!==void 0&&n!==c)break;(n!==0||s!==i)&&(c=n),s=e}return[{line:r,character:s},{line:r,character:i}]}function vf(e,t,n,r){if(n){for(let e of r)if(e>t)return e;return e.length}for(let e=r.length-1;e>=0;e--){let n=r[e];if(n<t)return n}return 0}function yf(e){let t=[0],n=rd();if(n!==void 0){for(let r of n.segment(e))r.index>0&&t.push(r.index);return t}let r=0;for(let n of e)r>0&&t.push(r),r+=n.length;return t}function bf(e,t,n,r){let i=e.getLineLength(t);if(r){if(n>=i)return i;let r=e.offsetAt({line:t,character:0}),a=e.getTextSlice(r+n,r+i),o=rd();if(o!==void 0){for(let e of o.segment(a))return n+e.segment.length;return i}for(let e of a)return n+e.length;return i}if(n<=0)return 0;let a=e.offsetAt({line:t,character:0}),o=e.getTextSlice(a,a+n),s=0,c=rd();if(c!==void 0){for(let e of c.segment(o))s=e.index;return s}let l=0;for(let e of o)s=l,l+=e.length;return s}function xf(e,t){let n=t.direction===-1;return[e.offsetAt(n?t.end:t.start),e.offsetAt(Ud(t))]}function Sf(e,t){if(!Q(t))return{start:t.start,end:t.end};let{line:n,character:r}=t.start,i=e.getLineText(n).length;return r<i?{start:{line:n,character:r},end:{line:n,character:i}}:n<e.lineCount-1?{start:{line:n,character:r},end:{line:n+1,character:0}}:{start:{line:n,character:r},end:{line:n,character:r}}}function Cf(e,t,n){if(t!==`
|
|
2135
2135
|
`&&t!==`\r`&&t!==`\r
|
|
2136
2136
|
`)return t;let r=e.positionAt(n).line,i=e.getLineText(r),a=wf(i);return a===0?t:t+i.slice(0,a)}function wf(e){let t=0;for(;t<e.length;t++){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}return t}function Tf(e,t){let n=[];for(let[e,r]of t)n.push(Math.min(e,r),Math.max(e,r));let r=e.positionsAt(n);return t.map(([e,t],n)=>{let i=e===t?0:e<t?1:-1;return{start:r[n*2],end:r[n*2+1],direction:i}})}function Ef(e,t,n){if(t.text!==``||t.start!==t.end-1)return t;let r=e.positionAt(t.end);if(r.character===0)return t;let i=e.getLineText(r.line),a=i.slice(0,r.character);if(/[^ \t]/.test(a)||i[r.character-1]===` `)return t;let o=Math.max(0,r.character-n),s=i.slice(o,r.character);return s.length===n&&/^ +$/.test(s)?{...t,start:t.end-s.length}:t}function Df(e,t){let n=e.nodeType===1?e:e.parentElement;for(;n!==null&&Ff(n)===void 0;)n=n.parentElement;if(n===null)return null;let r=Ff(n);if(r===void 0)return null;if(e.nodeType===3)return e.parentElement===null?null:Nf(e.parentElement)===null?{line:r,character:Mf(n,e)+Lf(e.textContent,t)}:{line:r,character:Pf(e,t)};if(e.nodeType===1){let i=e;if(i.tagName===`DIV`){let e=0;for(let n=0;n<t;n++)e=Pf(i.childNodes[n]);return{line:r,character:e}}if(i.tagName===`BR`)return{line:r,character:0};if(i.tagName===`SPAN`){if(t<i.childNodes.length){let e=i.childNodes[t];if(e?.nodeType===1){let t=If(e);if(t!==void 0)return{line:r,character:t};let n=Nf(e),i=n===null?void 0:If(n);if(i!==void 0)return{line:r,character:i}}}return{line:r,character:t>0?Pf(i.childNodes[t-1]):Mf(n,i)}}return{line:r,character:Mf(n,i)}}return null}function Of(e){let t=[];for(let n of e.childNodes){if(n.nodeType!==1)continue;let e=n;if(e.tagName===`SPAN`){if(If(e)!==void 0){t.push(e);continue}for(let n of e.childNodes)n.nodeType===1&&If(n)!==void 0&&t.push(n)}}return t}function kf(e,t){let n=Math.max(0,t),r=[{container:e,index:0}];for(;r.length>0;){let e=r[r.length-1];if(e.index>=e.container.childNodes.length){r.pop();continue}let t=e.container.childNodes[e.index];if(e.index++,t.nodeType===3){let e=Lf(t.textContent,t.textContent?.length??0);if(n<=e)return[t,n];n-=e}else t.nodeType===1&&r.push({container:t,index:0})}return null}function Af(e,t){let n=0,r=[{container:e,index:0}];for(;r.length>0;){let e=r[r.length-1];if(e.index>=e.container.childNodes.length){r.pop();continue}let i=e.container.childNodes[e.index];if(i===t)return n;e.index++,i.nodeType===3?n+=Lf(i.textContent,i.textContent?.length??0):i.nodeType===1&&r.push({container:i,index:0})}return n}function jf(e,t){let n=t;for(;n!==null;){if(n===e)return!0;n=n.parentElement}return!1}function Mf(e,t){if(t.parentElement===e){let n=0,r=Array.prototype.indexOf.call(e.childNodes,t);for(let t=0;t<r;t++)n=Pf(e.childNodes[t]);return n}for(let n of Of(e))if(jf(n,t))return If(n)+(t.nodeType===3?Af(n,t):0);let n=0,r=t.nodeType===1?t:t.parentElement;for(;r!==null&&r.parentElement!==null&&Ff(r.parentElement)===void 0;){let e=r.parentElement,t=Array.prototype.indexOf.call(e.childNodes,r);for(let r=0;r<t;r++)n=Pf(e.childNodes[r]);r=e}return n}function Nf(e){let t=e;for(;t!==null;){if(Ff(t)!==void 0)return null;if(If(t)!==void 0)return t;t=t.parentElement}return null}function Pf(e,t){if(e===void 0)return 0;if(e.nodeType===3){let n=e.parentElement;if(n===null)return 0;let r=Nf(n);if(r===null)return 0;let i=If(r);if(i===void 0)return 0;let a=t===void 0?Lf(e.textContent,e.textContent?.length??0):Lf(e.textContent,t);return i+Af(r,e)+a}if(e.nodeType!==1)return 0;let n=e;if(n.tagName!==`SPAN`&&n.tagName!==`BR`)return 0;let r=If(n);if(r!==void 0)return r+(n.textContent?.length??0);let i=0;for(let e of n.childNodes)i=Math.max(i,Pf(e));return i}function Ff(e){let{line:t,lineType:n}=e.dataset;if(t!==void 0&&n!==`change-deletion`){let e=parseInt(t,10);if(!Number.isNaN(e))return e-1}}function If(e){let{char:t}=e.dataset;if(t!==void 0){let e=parseInt(t,10);if(!Number.isNaN(e))return e}}function Lf(e,t){let n=e??``,r=n.search(/[\r\n]/);return Math.min(t,r===-1?n.length:r)}var Rf=300,zf=100,Bf=`marker-popover`,Vf=class{#e;#t=[];#n=0;#r;#i;#a;#o;#s;#c;#l;#u=!1;constructor(e){this.#e=e}get markers(){return this.#t}isPopoverVisible(){return this.#l!==void 0}updatePopoverPosition(){let e=this.#l,t=this.#r;if(e===void 0||t===void 0)return;let n=this.#t[e];if(n===void 0){this.removePopover();return}this.#_(t,n.start.line,n.start.character)}setMarkers(e,t){this.#n=t.lineCount,this.#t=e.map(e=>({...e,start:t.normalizePosition(e.start),end:t.normalizePosition(e.end)})),this.removePopover()}listenHover(e){this.#a?.forEach(e=>e()),this.#a=void 0,this.#t.length!==0&&(this.#a=[Z(e,`mouseover`,e=>{if(this.#e.isMouseDown())return;let t=e.composedPath()[0];if(t===void 0)return;let n=this.#d(t);n===void 0?(this.#f(),this.#h()):this.#m(n)}),Z(e,`mouseleave`,()=>{this.#f(),this.#h()})])}removePopover(){this.#f(),this.#p(),this.#v()}cleanup(){this.#a?.forEach(e=>e()),this.#a=void 0,this.removePopover(),this.#t=[]}#d(e){let t=e.closest(`[data-line]`);if(t==null)return;let n=Ju(t);if(n===void 0)return;let r;if(e.tagName===`SPAN`){let t=e.dataset.char;if(t===void 0||(r=parseInt(t,10),Number.isNaN(r)))return}else if(e.tagName===`BR`)r=0;else return;let i={line:n-1,character:r};for(let e=this.#t.length-1;e>=0;e--)if(Gd({start:i,end:i},this.#t[e]))return e}#f(){this.#o!==void 0&&(clearTimeout(this.#o),this.#o=void 0),this.#c=void 0}#p(){this.#s!==void 0&&(clearTimeout(this.#s),this.#s=void 0)}#m(e){if(e===this.#l||e===this.#c){this.#p();return}if(this.#f(),this.#p(),this.#r!==void 0){this.#y(e);return}this.#c=e,this.#o=setTimeout(()=>{this.#o=void 0,this.#c=void 0,this.#y(e)},Rf)}#h(){this.#u||(this.#p(),this.#s=setTimeout(()=>{this.#s=void 0,this.#u||this.removePopover()},zf))}#g(e,t,n,r,i=this.#e.popoverManager.getPlacementBounds()){vd(e,{gutterWidth:this.#e.getGutterWidth(),placeAbove:r,viewport:i,x:t,y:n})}#_(e,t,n){let{getCharX:r,getLineY:i,getLineHeight:a,popoverManager:o}=this.#e,[s,c]=r(t,n),l=a(),u=i(t)+c*l,d=e.offsetHeight,f={top:u+l,bottom:u+l+d},p={top:u-d,bottom:u},m=t>=this.#n-3,h=o.getPlacementBounds(),g=o.choosePlacement({preferred:f,fallback:p,viewport:h,popoverHeight:d,atDocumentEdge:m,placementKey:Bf})===`fallback`;this.#g(e,s,g?u:u+l,g,h)}#v(){this.#i?.forEach(e=>e()),this.#i=void 0,this.#r?.remove(),this.#r=void 0,this.#l=void 0,this.#u=!1,this.#e.popoverManager.resetPlacement(Bf)}#y(e){if(e===this.#l)return;let t=this.#e.getOverlayElement();if(e>=this.#t.length||t==null)return;let{start:n,message:r,severity:i}=this.#t[e],{line:a,character:o}=n,s=this.#r;if(this.#e.popoverManager.resetPlacement(Bf),s!==void 0){Uf(s,i);let t=s.firstElementChild;t?.dataset.markerMessage!==void 0&&(typeof r==`string`?t.textContent=r:r instanceof HTMLElement?t.replaceChildren(r):t.innerHTML=r.html),this.#_(s,a,o),this.#l=e;return}this.#r=X(`div`,{dataset:{editorWidget:``,markerPopover:``,[Wf(i)]:``},children:[X(`div`,{dataset:`markerMessage`,...typeof r==`string`?{textContent:r}:r instanceof HTMLElement?{children:[r]}:{innerHTML:r.html}})]},t),this.#_(this.#r,a,o),this.#l=e,this.#i=[Z(this.#r,`mouseenter`,()=>{this.#u=!0,this.#p()}),Z(this.#r,`mouseleave`,()=>{this.#u=!1,this.#h()})]}},Hf=[`error`,`warning`,`info`,`hint`];function Uf(e,t){for(let t of Hf)delete e.dataset[Wf(t)];e.dataset[Wf(t)]=``}function Wf(e){switch(e){case`error`:return`markerError`;case`warning`:return`markerWarning`;case`info`:return`markerInfo`;case`hint`:return`markerHint`}}var Gf=new Map([[`(`,`)`],[`[`,`]`],[`{`,`}`]]),Kf=new Map([...Gf].map(([e,t])=>[t,e])),qf=1e3,Jf=5e4;function Yf(e,t,n){let r=Xf(e,t,e.normalizePosition(n));if(r===void 0)return;let i=Gf.get(r.char),a=Kf.get(r.char);if(i!==void 0)return ap(r,$f(e,t,r,i));if(a!==void 0)return ap(ep(e,t,r,a),r)}function Xf(e,t,n){let r=Zf(n);if(r!==void 0){let n=Qf(e,t,r);if(n!==void 0)return n}return Qf(e,t,n)}function Zf(e){if(e.character>0)return{line:e.line,character:e.character-1}}function Qf(e,t,n){let r=e.getLineText(n.line)[n.character];if(!(r===void 0||!Gf.has(r)&&!Kf.has(r)||tp(t,n)))return{...n,char:r}}function $f(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s<e.lineCount;s++){if(a>=qf)return;a++;let c=e.getLineText(s),l=t.getStringCommentRegexpRangesInLine(s),u={index:0},d=s===n.line?n.character:0;for(let e=d;e<c.length;e++){if(o>=Jf)return;if(o++,rp(l,e,u))continue;let t=c[e];if(t===n.char)i++;else if(t===r&&(i--,i===0))return{line:s,character:e,char:t}}}}function ep(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s>=0;s--){if(a>=qf)return;a++;let c=e.getLineText(s),l=t.getStringCommentRegexpRangesInLine(s),u={index:l===null?-1:l.length-1},d=s===n.line?n.character:c.length-1;for(let e=d;e>=0;e--){if(o>=Jf)return;if(o++,ip(l,e,u))continue;let t=c[e];if(t===n.char)i++;else if(t===r&&(i--,i===0))return{line:s,character:e,char:t}}}}function tp(e,t){return np(e.getStringCommentRegexpRangesInLine(t.line),t.character)}function np(e,t){if(e===null)return!1;for(let[n,r]of e){if(t<n)return!1;if(t<r)return!0}return!1}function rp(e,t,n){if(e===null)return!1;for(;n.index<e.length&&t>=e[n.index][1];)n.index++;let r=e[n.index];return r!==void 0&&t>=r[0]}function ip(e,t,n){if(e===null)return!1;for(;n.index>=0&&t<e[n.index][0];)n.index--;let r=e[n.index];return r!==void 0&&t<r[1]}function ap(e,t){if(!(e===void 0||t===void 0))return[op(e),op(t)]}function op(e){return{start:{line:e.line,character:e.character},end:{line:e.line,character:e.character+1}}}var sp=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
2137
2137
|
<symbol id="diffs-editor-icon-close" viewBox="0 0 16 16">
|
|
@@ -2164,7 +2164,7 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}f
|
|
|
2164
2164
|
</symbol>
|
|
2165
2165
|
</svg>`,cp=()=>{let e=document.createElement(`div`);e.innerHTML=sp;let t=e.firstElementChild;if(t===null||!(t instanceof SVGSVGElement))throw Error(`Failed to create sprite element`);return t},lp=(e,t=16)=>`<svg width="${t}" height="${t}" aria-hidden="true" focusable="false">
|
|
2166
2166
|
<use href="#diffs-editor-icon-${e}"></use>
|
|
2167
|
-
</svg>`,up=class{#e;#t;#n;#r;#i;#a;constructor(e){let{textDocument:t,containerElement:n,defaultQuery:r,mode:i=`find`,initialMatch:a,scrollToMatch:o,applyReplace:s,onUpdate:c,onClose:l}=e,u={text:r,replaceText:``,caseSensitive:!1,wholeWord:!1,regex:!1},d={all:[],current:void 0},f=X(`div`,{dataset:{matches:``,noMatches:``},textContent:`No results`}),p=e=>{d.all=u.text===``?[]:t.search(u);let n=d.all.length===0;if(te.disabled=n,A.disabled=n,n){f.textContent=`No results`,f.dataset.noMatches=``,d.current=void 0,c([]);return}if(delete f.dataset.noMatches,e?.syncSelection===!1){m(c(d.all,{syncSelection:!1}));return}m(c(d.all))};this.#n=p;let m=e=>{if(e===void 0)f.textContent=`${d.all.length} results`;else{let[t,n]=e;f.textContent=`${d.all.findIndex(e=>e[0]===t&&e[1]===n)+1} of ${d.all.length}`}d.current=e},h=(e,t)=>{u[e]=t,p()},g=(e=!1,t=!1)=>{let n=d.all,r=n[0];if(n.length>0)if(e){let e=d.current?.[0]??0;r=n.at(-1);for(let t of n)if(t[1]<=e)r=t;else break}else{let e=d.current?.[1]??0;for(let t of n)if(t[0]>=e){r=t;break}}r!==void 0&&(m(r),o(r,t)),d.current=r};this.#i=e=>g(e,!0);let _=(e,n)=>({start:e,end:n,text:Du(e=>t.positionAt(e),e=>t.offsetAt(e),e=>t.getLineText(e),u,e,n)}),v=()=>{if(u.text===``||d.all.length===0)return;let e=d.current;if(e===void 0&&(g(!1,!0),e=d.current,e===void 0))return;let[t,n]=e,r=_(t,n);s([r]),o([t+r.text.length,t+r.text.length],!0),d.current=void 0,p()},y=()=>{u.text===``||d.all.length===0||(s(d.all.map(([e,t])=>_(e,t))),d.current=void 0,p())},b=()=>{this.cleanup(),l()};this.#a=b;let x=e=>X(`button`,{type:`button`,title:e.label,ariaLabel:e.label,dataset:{searchIcon:``,...e.dataset},innerHTML:lp(e.icon,e.size??16),onclick:e.onClick}),S=(e,t,n)=>{let r=x({icon:e,label:t,size:14,onClick:()=>{let e=!u[n];r.ariaPressed=String(e),h(n,e)}});return r.ariaPressed=String(u[n]),r},C=S(`case`,`Match Case`,`caseSensitive`),w=S(`whole-word`,`Whole Word`,`wholeWord`),T=S(`regex`,`Regexp`,`regex`),E=X(`input`,{type:`text`,placeholder:`Replace`,dataset:`replace`,value:``,oninput:e=>{u.replaceText=e.target.value},onkeydown:e=>{if(e.isComposing)return;let t=Lu(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),v()):t!==void 0&&(e.preventDefault(),g(t===`previous`,!0))}});this.#t=X(`input`,{type:`text`,placeholder:`Search`,dataset:`search`,value:r,oninput:e=>{u.text=e.target.value,d.current=void 0,p()},onkeydown:e=>{let t=Lu(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),g(e.shiftKey,!0)):t===void 0?Au(e)&&(e.key===`f`||e.code===`KeyF`)&&(e.preventDefault(),ne(e.altKey?`replace`:`find`)):(e.preventDefault(),g(t===`previous`,!0))}});let D=X(`div`,{dataset:`searchToggles`,children:[C,w,T]}),O=X(`div`,{dataset:{inputBox:``,find:``},children:[this.#t,D]}),ee=X(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[E]}),k=X(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[x({icon:`replace`,label:`Replace`,onClick:v}),x({icon:`replace-all`,label:`Replace All`,onClick:y})]}),te=x({icon:`arrow-up`,label:`Previous`,onClick:()=>{g(!0)}}),A=x({icon:`arrow-down`,label:`Next`,onClick:()=>{g()}});te.disabled=!0,A.disabled=!0;let j=X(`div`,{dataset:`searchNav`,children:[te,A]}),M=x({icon:`close`,label:`Close`,onClick:b,dataset:{searchClose:``}}),N=X(`div`,{dataset:{searchGrid:``,mode:i},children:[O,ee,k,f,j,M]}),ne=e=>{N.dataset.mode=e,this.#t.focus(),this.#t.select()};this.#r=ne,this.#e=X(`div`,{dataset:`searchPanel`,children:[X(`div`,{dataset:`editorWidget`,children:[N]})]}),d.current=a,n.before(this.#e),requestAnimationFrame(()=>{a===void 0?c([]):p(),this.#t.select()})}focus(){this.#t.focus()}navigate(e){this.#i?.(e)}updateMatches(e){this.#n?.(e)}setMode(e){this.#r?.(e)}close(){this.#a?.()}cleanup(){this.#e.remove()}},dp=class{#e;#t;#n;constructor(e,t,n){this.#e=X(`div`,{dataset:{editorWidget:``,selectionActionPopover:``},contentEditable:`false`,children:[e]},t),this.#t=this.#e.offsetHeight,this.#n=new ResizeObserver(()=>{let e=this.#e.offsetHeight;e!==this.#t&&(this.#t=e,n())}),this.#n.observe(this.#e)}reposition(e,t,n,r,i,a){this.#e.style.visibility=i?``:`hidden`,vd(this.#e,{gutterWidth:n,placeAbove:r,viewport:a,x:e,y:t})}get height(){return this.#t}cleanup(){this.#n.disconnect(),this.#e.remove()}};function fp(e){return{selections:e.selections?.map(e=>({start:{...e.start},end:{...e.end},direction:e.direction})),view:e.view===void 0?void 0:{...e.view}}}function pp(e){return typeof e==`object`?e:e===`indexedDB`?new vp:new mp}var mp=class{#e=new Map;get(e){let t=this.#e.get(e);return t===void 0?void 0:fp(t)}set(e,t){this.#e.set(e,fp(t))}},hp=`pierre-diffs-editor-state`,gp=1,_p=`states`,vp=class{#e=yp();async get(e){let t=await this.#e;if(t===void 0)return;let n=await bp(t.transaction(_p,`readonly`).objectStore(_p).get(e));return n===void 0?void 0:fp(n)}async set(e,t){let n=await this.#e;n!==void 0&&await bp(n.transaction(_p,`readwrite`).objectStore(_p).put(fp(t),e))}};function yp(){try{let e=globalThis.indexedDB;if(e===void 0)return Promise.resolve(void 0);let t=e.open(hp,gp);return t.onupgradeneeded=()=>{let e=t.result;e.objectStoreNames.contains(_p)||e.createObjectStore(_p)},bp(t)}catch{return Promise.resolve(void 0)}}function bp(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}var xp=4096,Sp=/\p{Mark}/u,Cp=class{#e;#t;#n;#r=new Map;ch=-1;tabSize=2;lineHeight=20;paddingTop=0;init(e){if(this.#e===e&&this.#t!==void 0&&this.ch!==-1)return;if(this.#e=e,this.#t??=document.createElement(`canvas`).getContext(`2d`)??void 0,this.#t===void 0)throw Error(`Could not get canvas context`);let t=e.parentElement;if(t!==null){let{paddingTop:e}=getComputedStyle(t);e.endsWith(`px`)&&(this.paddingTop=parseFloat(e.slice(0,-2)))}let{fontSize:n,fontFamily:r,tabSize:i,lineHeight:a}=getComputedStyle(e);a.endsWith(`px`)?this.lineHeight=parseFloat(a.slice(0,-2)):n.endsWith(`px`)&&(this.lineHeight=Qu(parseFloat(n.slice(0,-2))*parseFloat(a)));let o=n+` `+r;(this.#n!==o||this.ch===-1)&&(this.#n=o,this.#t.font=o,this.ch=this.canvasMeasureTextWidth(`0`),this.clearTextWidthCache());let s=parseInt(i,10);Number.isNaN(s)||(this.tabSize=s)}remeasureCharacterWidth(){if(this.#t===void 0||this.#n===void 0)return!1;this.#t.font=this.#n;let e=this.canvasMeasureTextWidth(`0`),t=e!==this.ch;t&&(this.ch=e);let n=this.#a();return t||n}measureTextWidth(e){if(!e.includes(` `))return this.#i(e);if(this.#t===void 0)throw Error(`Metrics not initialized`);let t=Dp(e,this.tabSize);if(t!==-1)return t*this.ch;let n=0,r=0,i=this.tabSize*this.ch;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===9){if(t>r&&(n+=this.#i(e.slice(r,t))),i>0){let e=n%i;n+=e===0?i:i-e}r=t+1}return r<e.length&&(n+=this.#i(e.slice(r))),Qu(n)}#i(e){return wp(e)?this.domMeasureTextWidth(e):this.canvasMeasureTextWidth(e)}canvasMeasureTextWidth(e){if(this.#t===void 0)throw Error(`Metrics not initialized`);return Qu(this.#t.measureText(e).width)}domMeasureTextWidth(e){if(this.#e===void 0)throw Error(`Metrics not initialized`);let t=e+`|`+this.#n,n=this.#r.get(t);if(n!==void 0)return n;let r=X(`span`,{style:{position:`absolute`,top:`0`,left:`0`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre`,font:`inherit`},textContent:e},this.#e),i;try{i=Qu(r.getBoundingClientRect().width)}finally{r.remove()}if(this.#r.size>=xp){let e=this.#r.keys().next().value;e!==void 0&&this.#r.delete(e)}return this.#r.set(t,i),i}clearTextWidthCache(){this.#a()}#a(){let e=this.#r.size>0;return this.#r.clear(),e}};function wp(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=57343||n===8205||n===65038||n===65039||n>127&&Sp.test(e.charAt(t)))return!0}return!1}function Tp(e,t){let n=Math.max(0,Math.min(t,e.length));if(n===0||n===e.length||!wp(e))return n;let r=rd();if(r!==void 0){for(let t of r.segment(e)){let e=t.index,r=e+t.segment.length;if(n>e&&n<r)return r;if(n<=e)break}return n}let i=0;for(let t of e){let e=i+t.length;if(n>i&&n<e)return e;if(n<=i)break;i=e}return n}function Ep(e){if(!wp(e))return;let t=[0],n=rd();if(n!==void 0){for(let r of n.segment(e))t.push(r.index+r.segment.length);return t}let r=0;for(let n of e)r+=n.length,t.push(r);return t}function Dp(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i>127)return-1;n+=i===9?t-n%t:1}return n}var Op=500,kp=0,Ap=class{#e;#t;#n;#r=`dark`;#i=``;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=!1;#h=[We];#g=[];#_=0;#v=[];#y=-1;#b=!0;#x=!1;#S=0;#C=++kp;#w=-1;#T=-1;#E;#D=0;#O=[];#k=!1;#A=Zu(async e=>{if(this.#m)return;let{startingLine:t=0,totalLines:n=1/0}=e??{},r=Math.min(n===1/0?1/0:t+n,this.#o.lineCount);if(this.#t===void 0&&!Np(this.#o.languageId)){if(await this.#e.loadLanguage(this.#o.languageId),this.#m)return;this.#t=this.#e.getLanguage(this.#o.languageId)}this.#F(),this.#V(r)},500);#j=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,tokenizerId:n,jobId:r}=e;t===`tokenize`&&n===this.#C&&typeof r==`number`&&r===this.#S&&(this.#w>=0?this.#q(r):this.#J(r))};get themeType(){return this.#r}getStringCommentRegexpRangesInLine(e){if(!this.#d||e<0||e>=this.#o.lineCount||(this.#I(),this.#t===void 0))return null;if(this.#O[e]===void 0){this.#K(e);let t=this.#h[e]??We,n=this.#H(e,t);this.#h[e+1]=n.state}return this.#O[e]??null}constructor({codeOptions:e,highlighter:t,textDocument:n,matchBrackets:r,setStyle:i,onDeferTokenize:a,onThemeChange:o,__debug:s}){let{themeType:c=`system`,theme:l=ve,tokenizeMaxLineLength:u=1e3}=e;this.#n=window.matchMedia(`(prefers-color-scheme: dark)`);let d;if(d=c===`system`?this.#N():c,typeof l!=`string`&&c===`system`){let e=new MutationObserver(e=>{for(let{type:t,attributeName:n}of e)if(t===`attributes`&&n!==null&&(n===`class`||n.startsWith(`data-`))){let e=this.#N();this.#M(l[e],e);break}});e.observe(document.documentElement,{attributes:!0}),e.observe(document.body,{attributes:!0}),this.#p=[Z(this.#n,`change`,()=>{let e=this.#N();this.#M(l[e],e)}),()=>e.disconnect()]}this.#e=t,this.#o=n,this.#s=u,this.#c=i,this.#l=a,this.#u=o,this.#d=r!==!1,this.#f=s??!1,this.#I(),this.#a=[],this.#P(typeof l==`string`?l:l[d],typeof l==`string`?void 0:d)}#M(e,t){e===this.#i&&t===this.#r||(this.#P(e,t),this.stopBackgroundTokenize(),this.#h=[We],this.#g=[],this.#_=0,this.#v=[],this.#t!==void 0&&this.#o.lineCount>0&&this.#B(0),this.#u?.())}#N(){try{if(typeof document<`u`&&typeof getComputedStyle==`function`&&document.body!=null){let e=getComputedStyle(document.body).colorScheme.split(/\s+/),t=e.includes(`dark`);if(t!==e.includes(`light`))return t?`dark`:`light`}}catch{}return this.#n.matches?`dark`:`light`}syncTheme(e){let{themeType:t=`system`,theme:n=ve}=e;if(typeof n==`string`){let e=this.#e.getTheme(n).type;if(n===this.#i&&e===this.#r)return;this.#M(n,e);return}let r=t===`system`?this.#N():t,i=n[r];r===this.#r&&i===this.#i||this.#M(i,r)}#P(e,t){let{theme:n,colorMap:r}=this.#e.setTheme(e),{colors:i={}}=this.#e.getTheme(e),a=i[`editor.selectionBackground`],o=i[`editor.lineHighlightBackground`],s=o!=null&&o.trim()!==``&&!fe.isFullyTransparent(o)?o:void 0,c=i[`editor.lineHighlightBorder`]??(s==null?`color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-fg))`:`transparent`),l=s==null?`100%`:`85%`,u=i[`editorCursor.foreground`],d=i[`editor.findMatchBackground`],f=i[`editor.findMatchHighlightBackground`],p=i[`editorBracketMatch.background`],m=i[`editorBracketMatch.border`],h=i[`editorHint.foreground`],g=i[`editorInfo.foreground`],_=i[`editorWarning.foreground`],v=i[`editorError.foreground`];this.#c(`:host {
|
|
2167
|
+
</svg>`,up=class{#e;#t;#n;#r;#i;#a;constructor(e){let{textDocument:t,containerElement:n,defaultQuery:r,mode:i=`find`,initialMatch:a,scrollToMatch:o,applyReplace:s,onUpdate:c,onClose:l}=e,u={text:r,replaceText:``,caseSensitive:!1,wholeWord:!1,regex:!1},d={all:[],current:void 0},f=X(`div`,{dataset:{matches:``,noMatches:``},textContent:`No results`}),p=e=>{d.all=u.text===``?[]:t.search(u);let n=d.all.length===0;if(A.disabled=n,j.disabled=n,n){f.textContent=`No results`,f.dataset.noMatches=``,d.current=void 0,c([]);return}if(delete f.dataset.noMatches,e?.syncSelection===!1){m(c(d.all,{syncSelection:!1}));return}m(c(d.all))};this.#n=p;let m=e=>{if(e===void 0)f.textContent=`${d.all.length} results`;else{let[t,n]=e;f.textContent=`${d.all.findIndex(e=>e[0]===t&&e[1]===n)+1} of ${d.all.length}`}d.current=e},h=(e,t)=>{u[e]=t,p()},g=(e=!1,t=!1)=>{let n=d.all,r=n[0];if(n.length>0)if(e){let e=d.current?.[0]??0;r=n.at(-1);for(let t of n)if(t[1]<=e)r=t;else break}else{let e=d.current?.[1]??0;for(let t of n)if(t[0]>=e){r=t;break}}r!==void 0&&(m(r),o(r,t)),d.current=r};this.#i=e=>g(e,!0);let _=(e,n)=>({start:e,end:n,text:Du(e=>t.positionAt(e),e=>t.offsetAt(e),e=>t.getLineText(e),u,e,n)}),v=()=>{if(u.text===``||d.all.length===0)return;let e=d.current;if(e===void 0&&(g(!1,!0),e=d.current,e===void 0))return;let[t,n]=e,r=_(t,n);s([r]),o([t+r.text.length,t+r.text.length],!0),d.current=void 0,p()},y=()=>{u.text===``||d.all.length===0||(s(d.all.map(([e,t])=>_(e,t))),d.current=void 0,p())},b=()=>{this.cleanup(),l()};this.#a=b;let x=e=>X(`button`,{type:`button`,title:e.label,ariaLabel:e.label,dataset:{searchIcon:``,...e.dataset},innerHTML:lp(e.icon,e.size??16),onclick:e.onClick}),S=(e,t,n)=>{let r=x({icon:e,label:t,size:14,onClick:()=>{let e=!u[n];r.ariaPressed=String(e),h(n,e)}});return r.ariaPressed=String(u[n]),r},C=S(`case`,`Match Case`,`caseSensitive`),w=S(`whole-word`,`Whole Word`,`wholeWord`),T=S(`regex`,`Regexp`,`regex`),E=X(`input`,{type:`text`,placeholder:`Replace`,dataset:`replace`,value:``,oninput:e=>{u.replaceText=e.target.value},onkeydown:e=>{if(e.isComposing)return;let t=Lu(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),v()):t!==void 0&&(e.preventDefault(),g(t===`previous`,!0))}});this.#t=X(`input`,{type:`text`,placeholder:`Search`,dataset:`search`,value:r,oninput:e=>{u.text=e.target.value,d.current=void 0,p()},onkeydown:e=>{let t=Lu(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),g(e.shiftKey,!0)):t===void 0?Au(e)&&(e.key===`f`||e.code===`KeyF`)&&(e.preventDefault(),te(e.altKey?`replace`:`find`)):(e.preventDefault(),g(t===`previous`,!0))}});let D=X(`div`,{dataset:`searchToggles`,children:[C,w,T]}),O=X(`div`,{dataset:{inputBox:``,find:``},children:[this.#t,D]}),ee=X(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[E]}),k=X(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[x({icon:`replace`,label:`Replace`,onClick:v}),x({icon:`replace-all`,label:`Replace All`,onClick:y})]}),A=x({icon:`arrow-up`,label:`Previous`,onClick:()=>{g(!0)}}),j=x({icon:`arrow-down`,label:`Next`,onClick:()=>{g()}});A.disabled=!0,j.disabled=!0;let M=X(`div`,{dataset:`searchNav`,children:[A,j]}),N=x({icon:`close`,label:`Close`,onClick:b,dataset:{searchClose:``}}),P=X(`div`,{dataset:{searchGrid:``,mode:i},children:[O,ee,k,f,M,N]}),te=e=>{P.dataset.mode=e,this.#t.focus(),this.#t.select()};this.#r=te,this.#e=X(`div`,{dataset:`searchPanel`,children:[X(`div`,{dataset:`editorWidget`,children:[P]})]}),d.current=a,n.before(this.#e),requestAnimationFrame(()=>{a===void 0?c([]):p(),this.#t.select()})}focus(){this.#t.focus()}navigate(e){this.#i?.(e)}updateMatches(e){this.#n?.(e)}setMode(e){this.#r?.(e)}close(){this.#a?.()}cleanup(){this.#e.remove()}},dp=class{#e;#t;#n;constructor(e,t,n){this.#e=X(`div`,{dataset:{editorWidget:``,selectionActionPopover:``},contentEditable:`false`,children:[e]},t),this.#t=this.#e.offsetHeight,this.#n=new ResizeObserver(()=>{let e=this.#e.offsetHeight;e!==this.#t&&(this.#t=e,n())}),this.#n.observe(this.#e)}reposition(e,t,n,r,i,a){this.#e.style.visibility=i?``:`hidden`,vd(this.#e,{gutterWidth:n,placeAbove:r,viewport:a,x:e,y:t})}get height(){return this.#t}cleanup(){this.#n.disconnect(),this.#e.remove()}};function fp(e){return{selections:e.selections?.map(e=>({start:{...e.start},end:{...e.end},direction:e.direction})),view:e.view===void 0?void 0:{...e.view}}}function pp(e){return typeof e==`object`?e:e===`indexedDB`?new vp:new mp}var mp=class{#e=new Map;get(e){let t=this.#e.get(e);return t===void 0?void 0:fp(t)}set(e,t){this.#e.set(e,fp(t))}},hp=`pierre-diffs-editor-state`,gp=1,_p=`states`,vp=class{#e=yp();async get(e){let t=await this.#e;if(t===void 0)return;let n=await bp(t.transaction(_p,`readonly`).objectStore(_p).get(e));return n===void 0?void 0:fp(n)}async set(e,t){let n=await this.#e;n!==void 0&&await bp(n.transaction(_p,`readwrite`).objectStore(_p).put(fp(t),e))}};function yp(){try{let e=globalThis.indexedDB;if(e===void 0)return Promise.resolve(void 0);let t=e.open(hp,gp);return t.onupgradeneeded=()=>{let e=t.result;e.objectStoreNames.contains(_p)||e.createObjectStore(_p)},bp(t)}catch{return Promise.resolve(void 0)}}function bp(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}var xp=4096,Sp=/\p{Mark}/u,Cp=class{#e;#t;#n;#r=new Map;ch=-1;tabSize=2;lineHeight=20;paddingTop=0;init(e){if(this.#e===e&&this.#t!==void 0&&this.ch!==-1)return;if(this.#e=e,this.#t??=document.createElement(`canvas`).getContext(`2d`)??void 0,this.#t===void 0)throw Error(`Could not get canvas context`);let t=e.parentElement;if(t!==null){let{paddingTop:e}=getComputedStyle(t);e.endsWith(`px`)&&(this.paddingTop=parseFloat(e.slice(0,-2)))}let{fontSize:n,fontFamily:r,tabSize:i,lineHeight:a}=getComputedStyle(e);a.endsWith(`px`)?this.lineHeight=parseFloat(a.slice(0,-2)):n.endsWith(`px`)&&(this.lineHeight=Qu(parseFloat(n.slice(0,-2))*parseFloat(a)));let o=n+` `+r;(this.#n!==o||this.ch===-1)&&(this.#n=o,this.#t.font=o,this.ch=this.canvasMeasureTextWidth(`0`),this.clearTextWidthCache());let s=parseInt(i,10);Number.isNaN(s)||(this.tabSize=s)}remeasureCharacterWidth(){if(this.#t===void 0||this.#n===void 0)return!1;this.#t.font=this.#n;let e=this.canvasMeasureTextWidth(`0`),t=e!==this.ch;t&&(this.ch=e);let n=this.#a();return t||n}measureTextWidth(e){if(!e.includes(` `))return this.#i(e);if(this.#t===void 0)throw Error(`Metrics not initialized`);let t=Dp(e,this.tabSize);if(t!==-1)return t*this.ch;let n=0,r=0,i=this.tabSize*this.ch;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===9){if(t>r&&(n+=this.#i(e.slice(r,t))),i>0){let e=n%i;n+=e===0?i:i-e}r=t+1}return r<e.length&&(n+=this.#i(e.slice(r))),Qu(n)}#i(e){return wp(e)?this.domMeasureTextWidth(e):this.canvasMeasureTextWidth(e)}canvasMeasureTextWidth(e){if(this.#t===void 0)throw Error(`Metrics not initialized`);return Qu(this.#t.measureText(e).width)}domMeasureTextWidth(e){if(this.#e===void 0)throw Error(`Metrics not initialized`);let t=e+`|`+this.#n,n=this.#r.get(t);if(n!==void 0)return n;let r=X(`span`,{style:{position:`absolute`,top:`0`,left:`0`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre`,font:`inherit`},textContent:e},this.#e),i;try{i=Qu(r.getBoundingClientRect().width)}finally{r.remove()}if(this.#r.size>=xp){let e=this.#r.keys().next().value;e!==void 0&&this.#r.delete(e)}return this.#r.set(t,i),i}clearTextWidthCache(){this.#a()}#a(){let e=this.#r.size>0;return this.#r.clear(),e}};function wp(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=57343||n===8205||n===65038||n===65039||n>127&&Sp.test(e.charAt(t)))return!0}return!1}function Tp(e,t){let n=Math.max(0,Math.min(t,e.length));if(n===0||n===e.length||!wp(e))return n;let r=rd();if(r!==void 0){for(let t of r.segment(e)){let e=t.index,r=e+t.segment.length;if(n>e&&n<r)return r;if(n<=e)break}return n}let i=0;for(let t of e){let e=i+t.length;if(n>i&&n<e)return e;if(n<=i)break;i=e}return n}function Ep(e){if(!wp(e))return;let t=[0],n=rd();if(n!==void 0){for(let r of n.segment(e))t.push(r.index+r.segment.length);return t}let r=0;for(let n of e)r+=n.length,t.push(r);return t}function Dp(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i>127)return-1;n+=i===9?t-n%t:1}return n}var Op=500,kp=0,Ap=class{#e;#t;#n;#r=`dark`;#i=``;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=!1;#h=[Ue];#g=[];#_=0;#v=[];#y=-1;#b=!0;#x=!1;#S=0;#C=++kp;#w=-1;#T=-1;#E;#D=0;#O=[];#k=!1;#A=Zu(async e=>{if(this.#m)return;let{startingLine:t=0,totalLines:n=1/0}=e??{},r=Math.min(n===1/0?1/0:t+n,this.#o.lineCount);if(this.#t===void 0&&!Np(this.#o.languageId)){if(await this.#e.loadLanguage(this.#o.languageId),this.#m)return;this.#t=this.#e.getLanguage(this.#o.languageId)}this.#F(),this.#V(r)},500);#j=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,tokenizerId:n,jobId:r}=e;t===`tokenize`&&n===this.#C&&typeof r==`number`&&r===this.#S&&(this.#w>=0?this.#q(r):this.#J(r))};get themeType(){return this.#r}getStringCommentRegexpRangesInLine(e){if(!this.#d||e<0||e>=this.#o.lineCount||(this.#I(),this.#t===void 0))return null;if(this.#O[e]===void 0){this.#K(e);let t=this.#h[e]??Ue,n=this.#H(e,t);this.#h[e+1]=n.state}return this.#O[e]??null}constructor({codeOptions:e,highlighter:t,textDocument:n,matchBrackets:r,setStyle:i,onDeferTokenize:a,onThemeChange:o,__debug:s}){let{themeType:c=`system`,theme:l=_e,tokenizeMaxLineLength:u=1e3}=e;this.#n=window.matchMedia(`(prefers-color-scheme: dark)`);let d;if(d=c===`system`?this.#N():c,typeof l!=`string`&&c===`system`){let e=new MutationObserver(e=>{for(let{type:t,attributeName:n}of e)if(t===`attributes`&&n!==null&&(n===`class`||n.startsWith(`data-`))){let e=this.#N();this.#M(l[e],e);break}});e.observe(document.documentElement,{attributes:!0}),e.observe(document.body,{attributes:!0}),this.#p=[Z(this.#n,`change`,()=>{let e=this.#N();this.#M(l[e],e)}),()=>e.disconnect()]}this.#e=t,this.#o=n,this.#s=u,this.#c=i,this.#l=a,this.#u=o,this.#d=r!==!1,this.#f=s??!1,this.#I(),this.#a=[],this.#P(typeof l==`string`?l:l[d],typeof l==`string`?void 0:d)}#M(e,t){e===this.#i&&t===this.#r||(this.#P(e,t),this.stopBackgroundTokenize(),this.#h=[Ue],this.#g=[],this.#_=0,this.#v=[],this.#t!==void 0&&this.#o.lineCount>0&&this.#B(0),this.#u?.())}#N(){try{if(typeof document<`u`&&typeof getComputedStyle==`function`&&document.body!=null){let e=getComputedStyle(document.body).colorScheme.split(/\s+/),t=e.includes(`dark`);if(t!==e.includes(`light`))return t?`dark`:`light`}}catch{}return this.#n.matches?`dark`:`light`}syncTheme(e){let{themeType:t=`system`,theme:n=_e}=e;if(typeof n==`string`){let e=this.#e.getTheme(n).type;if(n===this.#i&&e===this.#r)return;this.#M(n,e);return}let r=t===`system`?this.#N():t,i=n[r];r===this.#r&&i===this.#i||this.#M(i,r)}#P(e,t){let{theme:n,colorMap:r}=this.#e.setTheme(e),{colors:i={}}=this.#e.getTheme(e),a=i[`editor.selectionBackground`],o=i[`editor.lineHighlightBackground`],s=o!=null&&o.trim()!==``&&!de.isFullyTransparent(o)?o:void 0,c=i[`editor.lineHighlightBorder`]??(s==null?`color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-fg))`:`transparent`),l=s==null?`100%`:`85%`,u=i[`editorCursor.foreground`],d=i[`editor.findMatchBackground`],f=i[`editor.findMatchHighlightBackground`],p=i[`editorBracketMatch.background`],m=i[`editorBracketMatch.border`],h=i[`editorHint.foreground`],g=i[`editorInfo.foreground`],_=i[`editorWarning.foreground`],v=i[`editorError.foreground`];this.#c(`:host {
|
|
2168
2168
|
--diffs-editor-selection-bg: ${a??`var(--diffs-line-bg)`};
|
|
2169
2169
|
--diffs-editor-line-highlight-border: ${c};
|
|
2170
2170
|
--diffs-editor-active-line-source-mix: ${l};
|
|
@@ -2177,15 +2177,15 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}f
|
|
|
2177
2177
|
--diffs-editor-info-fg: ${g??`initial`};
|
|
2178
2178
|
--diffs-editor-warning-fg: ${_??`initial`};
|
|
2179
2179
|
--diffs-editor-error-fg: ${v??`initial`};
|
|
2180
|
-
}`),this.#i=e,this.#r=t??n.type,this.#a=r}#F(){if(this.#i===``)return;let{colorMap:e}=this.#e.setTheme(this.#i);this.#a=e}cleanUp(){this.#m=!0,this.stopBackgroundTokenize(),this.#R(),this.#p?.forEach(e=>e()),this.#p=void 0}tokenize(e,t,n=!1){if(this.#I(),this.#F(),this.#t===void 0&&!Np(this.#o.languageId))throw Error(`Grammar for language "${this.#o.languageId}" not loaded`);this.#d&&(this.#O.length=Math.min(this.#O.length,e.startLine));let{lineCount:r}=this.#o,{startingLine:i=0,totalLines:a=1/0}=t??{},o=a===1/0?r:Math.min(i+a,r),s=e.startLine,c=Math.max(i,s),l=t!==void 0&&a!==1/0&&e.lineDelta>0&&s<o&&e.endLine>=o,u=e.lineDelta===0&&(e.changedLineChanges?.every(([,,e])=>e===0)??!0),d=n&&e.lineDelta!==0&&s>=i,f=u||t===void 0||s>=c,p=e.changedLineRanges??[[s,e.endLine]];this.#g=[],this.#_=0,this.#v=[];let m=-1;if(s<c)for(let[e,t]of p)e<c&&(m=Math.max(m,Math.min(t,c-1)));let h=m>=s&&(u||e.lineDelta<0);u?this.#K(s):(this.#W(e),(t===void 0||s>=c)&&this.#K(c));let g=0,_=p[g][1],v,y=0,b=u?p[g][0]:c,x=!1,S=new Map,C=h?new Map:void 0;if(C!==void 0&&!u){let e=Math.min(m+1,c,o);if(e>s){this.#K(e);let t=s,n=this.#h[t]??We;for(;t<e;t++){let e=this.#H(t,n);n=e.state,C.set(t,e.resolvedTokens)}this.#h[e]=n}}let w=this.#h[b]??We;for(;b<o;){let e=u?this.#h[b+1]:d?this.#G(b+1):void 0;f&&(this.#h[b]=w);let{resolvedTokens:t,state:n}=this.#H(b,w);if(w=n,b>=c?S.set(b,t):C?.set(b,t),f&&(this.#h[b+1]=w),x=b>=_&&(u||d)&&e!==void 0&&w.equals(e),x){g++;let e=p[g];if(e===void 0)break;if(e[0]>=o){v=e[0],y=g;break}let t=this.#h[e[0]];if(d)for(let n=b+2;n<=e[0]&&(t=this.#G(n),t!==void 0);n++)this.#h[n]=t;t===void 0?(_=e[1],b++):(b=e[0],w=t,_=e[1]),x=!1;continue}b++}if(f&&(b<o?this.#h[b+1]=w:this.#h[b]=w),x&&d&&v===void 0){for(let e=b+2;e<=r;e++){let t=this.#G(e);if(t===void 0)break;this.#h[e]=t}this.#g=[],this.#_=0,this.#v=[]}if(C!==void 0&&C.size>0&&this.#l(C,this.#r),v!==void 0)this.#B(v,p,y);else if(!x&&b<r){let e=l&&s>=c?o:s<c&&!u?s:b;this.#B(e,p,g)}return S}prebuildStateStack(e){this.#I(),this.#A(e)}stopBackgroundTokenize(){this.#T=-1,!this.#b&&(this.#b=!0,this.#x=!1,this.#y=-1,this.#w=-1,this.#E=void 0,this.#D=0,this.#g=[],this.#_=0,this.#v=[],this.#R())}pauseBackgroundTokenize(){this.#b||this.#x||(this.#f&&console.log(`[diffs/editor] background tokenization paused`,{jobId:this.#S}),this.#x=!0)}resumeBackgroundTokenize(){this.#b||!this.#x||this.#t===void 0||this.#y<0||(this.#f&&console.log(`[diffs/editor] background tokenization resumed`,{jobId:this.#S}),this.#x=!1,this.#z(this.#S))}#I(){this.#t===void 0&&!Np(this.#o.languageId)&&this.#e.getLoadedLanguages().includes(this.#o.languageId)&&(this.#t=this.#e.getLanguage(this.#o.languageId))}#L(){this.#k||=(globalThis.addEventListener(`message`,this.#j),!0)}#R(){this.#k&&=(globalThis.removeEventListener(`message`,this.#j),!1)}#z(e){globalThis.postMessage({type:`tokenize`,tokenizerId:this.#C,jobId:e})}#B(e,t,n=0){if(Np(this.#o.languageId))return;let r=++this.#S;this.#f&&console.log(`[diffs/editor] background tokenization scheduled`,{jobId:r,startLine:e,changedLineRanges:t,changedRangeIndex:n}),this.#b=!1,this.#x=!1,this.#y=e,this.#w>=0&&(this.#T=Math.max(this.#T,this.#w)),this.#w=-1,this.#E=t,this.#D=n,this.#L(),this.#z(r)}#V(e){if(this.#t===void 0||this.#h.length>e)return;if(!this.#b){this.#w>=0?this.#w=Math.max(this.#w,e):this.#T=Math.max(this.#T,e);return}let t=++this.#S;this.#b=!1,this.#x=!1,this.#y=this.#h.length-1,this.#w=e,this.#T=-1,this.#E=void 0,this.#D=0,this.#L(),this.#z(t)}#H(e,t){let n=this.#o.getLineText(e);if(n.length>this.#s)return console.warn(`[diffs] Line(${e}) too long to tokenize: ${n.length}`),this.#U(e,null),{resolvedTokens:[[0,``,n]],state:t};if(this.#t===void 0||n===``||n.trim()===``)return this.#U(e,null),{resolvedTokens:[[0,``,n]],state:t};let r=jp(this.#t,this.#a,n,t,Op,this.#d);return this.#U(e,r.bracketIgnoredRanges),{resolvedTokens:r.resolvedTokens,state:r.ruleStack}}#U(e,t){this.#d&&(this.#O[e]=t)}#W(e){let t=e.changedLineChanges??[[e.startLine,e.endLine,e.lineDelta]],n=e.startLine+1;n<=this.#h.length-n?(this.#g=this.#h,this.#_=0,this.#h=this.#h.slice(0,n)):(this.#_=n,this.#g=this.#h.slice(n),this.#h.length=Math.min(this.#h.length,n)),this.#v=t}#G(e){let t=e;for(let n=this.#v.length-1;n>=0;n--){let[r,i,a]=this.#v[n];if(a!==0){if(t>i)t-=a;else if(t>r)return this.#h[e]}}return this.#g[t-this.#_]??this.#h[e]}#K(e,t){let n=Math.min(Math.max(0,e),this.#o.lineCount);if(this.#h.length>n||this.#t===void 0)return!0;let r=t===void 0?0:performance.now(),i=this.#h.length-1,a=this.#h[i]??We;for(;i<n;){this.#h[i]=a;let e=this.#o.getLineText(i);if(e.length<=this.#s&&e!==``&&e.trim()!==``){let t=jp(this.#t,this.#a,e,a,Op,this.#d,!1);this.#U(i,t.bracketIgnoredRanges),a=t.ruleStack}else this.#U(i,null);if(i++,this.#h[i]=a,t!==void 0&&performance.now()-r>t)break}return i>=n}#q(e){if(this.#b||this.#x||this.#t===void 0||e!==this.#S)return;this.#F();let t=this.#K(this.#w,1);if(!(this.#b||this.#x||e!==this.#S)){if(t){this.stopBackgroundTokenize();return}this.#y=this.#h.length-1,this.#z(e)}}#J(e){if(this.#b||this.#x||this.#t===void 0||e!==this.#S)return;this.#F();let t=performance.now(),n=new Map,r=this.#o.lineCount,i=this.#E,a=this.#y,o=this.#h[a]??We,s=!1,c=this.#D,l=i?.[c]?.[1];for(;a<r;){this.#h[a]=o;let e=l===void 0?void 0:this.#G(a+1),r=this.#o.getLineText(a);if(r.length>this.#s)console.warn(`[diffs] Line(${a}) too long to tokenize: ${r.length}`),n.set(a,[[0,``,r]]),this.#U(a,null);else if(r===``||r.trim()===``)n.set(a,[[0,``,r]]),this.#U(a,null);else{let e=jp(this.#t,this.#a,r,o,Op,this.#d);n.set(a,e.resolvedTokens),this.#U(a,e.bracketIgnoredRanges),o=e.ruleStack}if(this.#h[a+1]=o,s=l!==void 0&&a>=l&&e!==void 0&&o.equals(e),a++,s){c++;let e=i?.[c];if(e===void 0)break;if(l=e[1],this.#h[e[0]]===void 0)s=!1;else{a=e[0],o=this.#h[a]??o,s=!1;continue}}if(performance.now()-t>1)break}if(this.#l(n,this.#r),!(this.#b||this.#x||e!==this.#S)){if(s||a>=r){let e=this.#T;this.stopBackgroundTokenize(),e>=0&&this.#V(e);return}this.#y=a,this.#D=c,this.#z(e)}}};function jp(e,t,n,r,i,a=!0,o=!0){let s=e.tokenizeLine2(n,r,i);s.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${n.substring(0,100)}`);let c=s.tokens,l=c.length/2,u=[],d=[];if(!o&&!a)return{ruleStack:s.ruleStack,resolvedTokens:u,bracketIgnoredRanges:d};for(let e=0;e<l;e++){let r=c[2*e],i=e+1<l?c[2*e+2]:n.length;if(r===i)continue;let s=c[2*e+1];if(o){let e=Oe.getForeground(s);u.push([r,t[e],n.slice(r,i)])}a&&Oe.getTokenType(s)>0&&d.push([r,i])}return{ruleStack:s.ruleStack,resolvedTokens:u,bracketIgnoredRanges:d}}function Mp(e){return e.map(([e,t,n])=>e===0&&t===``?n===``?X(`br`):n:X(`span`,{dataset:{char:e.toString()},style:`color:${t};`,textContent:n}))}function Np(e){return e===`text`||e===`ansi`}function Pp(e){let t=e.getSelection?.();if(t==null||t.rangeCount===0)return;let n=t.getRangeAt(0);return{collapsed:n.collapsed,startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}}function Fp(e){if(typeof e.cacheKey!=`string`||e.cacheKey.length===0)throw Error(`Editor persistState requires a non-empty file.cacheKey for "${e.name}". Provide a unique, stable cacheKey for every editable file.`);return e.cacheKey}function Ip(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}var Lp=2,Rp=1e4,zp=`selection-action`,Bp=`application/vnd.pierre.diffs-selections+json`,Vp=class{#e;#t=new Cp;#n;#r;#i=new Map;#a;#o;#s=new Map;#c;#l=0;#u=!1;#d;#f;#p;#m;#h={generation:0,callback:void 0,delivered:!1};#g;#_;#v;#y=new Map;#b=new Map;#x=new Map;#S;#C;#w;#T;#E;#D;#O;#k;#A;#j;#M;#N;#P;#F;#I;#L;#R;#z;#B;#V;#H;#U=!0;#W=!1;#G=!1;#K=!1;#q;#J=!1;#Y=!1;#X=!1;#Z=!1;#Q;#$=``;#ee;#te;#ne;#re;#ie;#ae;#oe=!1;#se=!1;#ce=!1;#le=!1;#ue;#de=(e,t)=>{if(this.#P?.updateRenderCache(e,t),this.#R!==void 0&&this.#R.totalLines!==1/0){let{startingLine:t,totalLines:n}=this.#R,r=Math.min(t+n,this.#L?.lineCount??0);for(let[n,i]of e)if(n>=t&&n<r){let e=this.#zt(n);e!==void 0&&e.replaceChildren(...Mp(i))}}};constructor(e={}){this.#e=e}setOptions(e){let t=this.#e.persistStateStorage??`inMemory`,n={...this.#e,...e};if(n.persistState===!0&&this.#P?.type===`file`){let e=this.#P.__getCurrentFile?.()??this.#F;e!==void 0&&Fp(e)}this.#e=n,this.#e.persistState!==!0&&(this.#i.clear(),this.#l++,this.#u=!1),(this.#e.persistStateStorage??`inMemory`)!==t&&(this.#l++,this.#a=void 0,this.#o=void 0,this.#s.clear())}edit(e){if(this.#e.persistState===!0&&e.type===`file`){let t=e.__getCurrentFile?.();t!==void 0&&Fp(t)}return this.#Oe(),this.#P=e,this.#Ne(),this.#m=e.attachEditor(this),()=>this.cleanUp()}applyEdits(e,t=!0){let n=this.#L;if(n==null)throw Error(`Editor is not attached`);let r=this.#K,i=this.#ne,a=i?.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]),o=i===void 0?void 0:n.resolveEdits(e).sort((e,t)=>e.start-t.start),s=n.applyEdits(e,t,i);if(s===void 0)return;let c;i!==void 0&&a!==void 0&&o!==void 0&&(c=Jd(n,i,a,o),t&&n.setLastUndoSelectionsAfter(c)),this.#It(s,c,this.#Lt(s),{skipFocus:!r})}get canUndo(){return this.#L?.canUndo??!1}get canRedo(){return this.#L?.canRedo??!1}undo(){this.#Ve(`undo`)}redo(){this.#Ve(`redo`)}getFile(){let e=this.#F,t=this.#L;if(e===void 0||t===void 0)return;let n={...e};return Object.defineProperty(n,"contents",{enumerable:!0,get:()=>t.getText()}),n}getText(){return this.#L?.getText()??``}getState(){let e=this.#P;return{selections:this.#ne,view:e==null?void 0:{scrollLeft:e.getCodeScrollLeft(),scrollTop:this.#je()}}}setState({selections:e,view:t}){if(this.#P===void 0||this.#L===void 0)throw Error(`Editor is not attached`);if(this.#U=!1,this.#gt(e??[]),t!=null){this.#P.setCodeScrollLeft(t.scrollLeft),t.scrollTop!==void 0&&this.#Me(t.scrollTop);return}this.#rt()}setSelections(e){let t=this.#L;if(t===void 0)throw Error(`Text document is not initialized`);let n=e.map(e=>{let n=t.normalizePosition(e.start),r=t.normalizePosition(e.end),i=e.direction===`none`?0:e.direction===`backward`?-1:1;return $(n,r)>0&&([n,r]=[r,n],i!==0&&(i=i===1?-1:1)),{direction:i,start:n,end:r}});this.#U=!1,this.#gt(n);let r=n.at(-1);r!==void 0&&this.#xe(Ud(r).line),this.#rt()}setMarkers(e){let t=this.#L;if(t===void 0)throw Error(`Text document is not initialized`);if(e.length===0){this.#B?.cleanup(),this.#B=void 0,this.#gt(this.#ne??[]);return}this.#B??=new Vf({popoverManager:this.#Te(),getLineHeight:()=>this.#t.lineHeight,getOverlayElement:()=>this.#A,getGutterWidth:()=>this.#Bt(),getCharX:(e,t)=>this.#Ut(e,t),getLineY:e=>this.#Ht(e),isMouseDown:()=>this.#X||this.#Y}),this.#B.setMarkers(e,t),this.#k!==void 0&&this.#B.listenHover(this.#k),this.#gt(this.#ne??[])}focus(e){let t=e?.preventScroll??!1,n=e?.lineNumber;if(n===`first-visible`||typeof n==`number`){let r=this.#L;if(r==null||this.#P==null)return;let i=n===`first-visible`?this.#et(e?.offset):n;if(i==null)return;let a=r.normalizePosition({line:i-1,character:n===`first-visible`?0:e?.character??0});this.#tt(a,t);return}let r=this.#ne?.at(-1);if(r!==void 0){let e=r.direction===-1?r.end:r.start;this.#Ze(e,t)}else this.#Ze(void 0,t)}blur(){this.#q=void 0,this.#K=!1,this.#W=!1,this.#k?.blur()}cleanUp(e=!1){this.#Oe(),e||(this.#h.delivered=!1);let t=this.#P!=null,n=this.#e.persistState===!0;this.#l++,this.#me(),t&&(this.#u=n),ae(this.#Re),this.#n?.cleanUp(),this.#n=void 0,e||(this.#L=void 0,this.#F=void 0),this.#f?.forEach(e=>e()),this.#f=void 0,this.#d?.forEach(e=>e()),this.#d=void 0,this.#p?.forEach(e=>e()),this.#p=void 0,this.#m?.(e),this.#m=void 0,this.#_=void 0,this.#v=void 0,this.#y.clear(),this.#b.clear(),this.#x.clear(),this.#S=void 0,this.#C?.remove(),this.#C=void 0,this.#w?.remove(),this.#w=void 0,this.#T?.remove(),this.#T=void 0,this.#E?.remove(),this.#E=void 0,this.#D=void 0,this.#r?.cleanUp(),this.#r=void 0,this.#O=void 0,this.#k?.removeAttribute(`contentEditable`),this.#k=void 0,this.#q=void 0,this.#K=!1,this.#A?.remove(),this.#A=void 0,this.#N?.disconnect(),this.#N=void 0,this.#le=!1,this.#ue!==void 0&&(cancelAnimationFrame(this.#ue),this.#ue=void 0),this.#De(),this.#P=void 0}__prepareFile(e){if(this.#e.persistState!==!0)return e;let t=Fp(e),n=this.#F,r=e.lang??ge(e.name);n!==void 0&&(Fp(n)!==t||n.name!==e.name||this.#L?.languageId!==r)&&(this.#l++,this.#me());let i=this.#fe(e,t);return i===void 0||i.getText()===e.contents?e:{...e,contents:i.getText()}}__postponeBgTokenizeToNextFrame(){let e=this.#n;e!==void 0&&(e.pauseBackgroundTokenize(),requestAnimationFrame(()=>{e.resumeBackgroundTokenize()}))}__captureFocusForDOMReplacement(){let e=this.#k,t=this.#D?.shadowRoot?.activeElement;e!=null&&(this.#K||t===e||t!=null&&e.contains(t))&&(this.#q={})}__syncRenderView=(e,t,n,r,i)=>{let a=this.#P;if(a==null)return;let o=t.shadowRoot;if(o==null){console.error(`[editor] Could not find the shadow root.`);return}let s,c,l;for(let e of o.querySelectorAll(`[data-code]`))if(e.dataset.deletions===void 0){s=e;for(let t of e.children){let e=t,{gutter:n,content:r}=e.dataset;n===void 0?r!==void 0&&(l=e):c=e}break}if(s===void 0||l===void 0){this.#q=void 0;return}this.#Te().setViewportElements(t,s),this.#D!==t&&(this.#D=t,this.#C!==void 0&&t.appendChild(this.#C),this.#w!==void 0&&o.appendChild(this.#w),this.#T!==void 0&&o.appendChild(this.#T),this.#E!==void 0&&o.prepend(this.#E));let u=this.#L===void 0||this.#F===void 0||this.#F.name!==n.name||this.#F.lang!==n.lang||this.#F.cacheKey!==n.cacheKey,d=this.#e.persistState===!0?Fp(n):void 0,f;if(u){this.#Oe();let e=``;e=`contents`in n?n.contents:n.additionLines.join(``);let t=new $l({maxEntries:this.#e.historyMaxEntries}),{name:r,lang:i,cacheKey:o}=n,s=i??ge(n.name),c=d===void 0?void 0:this.#fe(n,d),l=a.type===`file`||c?.getText()===e?c:void 0,u=l??new ku(n.name,e,s,0,t);this.#F={name:r,lang:i,cacheKey:o},this.#L=u,d!==void 0&&(this.#i.set(d,u),f={cacheKey:d,textDocument:u}),this.#n?.cleanUp(),this.#n=void 0,this.#De(),this.#b.clear(),this.#ne=this.#te,this.#e.__debug===!0&&console.log(l===void 0?`[diffs/editor] text document rebuilt from`:`[diffs/editor] cached text document reused for`,n.name)}f===void 0&&this.#u&&d!==void 0&&this.#L!==void 0&&(f={cacheKey:d,textDocument:this.#L});let p=this.#L;if(this.#n==null&&p!=null&&(this.#n=new Ap({highlighter:e,textDocument:p,codeOptions:this.#P?.__getEffectiveCodeOptions()??{},matchBrackets:this.#e.matchBrackets,onDeferTokenize:this.#de,onThemeChange:()=>this.#ht(),setStyle:e=>{this.#T.textContent=e},__debug:this.#e.__debug})),this.#k!==l&&(this.#O=c,this.#k=Xu(l,{contentEditable:`true`,role:`textbox`,ariaMultiLine:`true`,autocapitalize:`off`,writingSuggestions:`off`,autocorrect:!1,spellcheck:!1,translate:!1}),this.#A!==void 0&&l.after(this.#A),this.#t.init(l),this.#Je(),this.#Le(l,c),this.#k!==void 0&&this.#e.__debug===!0&&console.log(`[diffs/editor] full re-render triggered !!!`)),this.#q!=null&&(this.#q.target=l),l.ariaLabel!==n.name&&(l.ariaLabel=n.name),r!==void 0&&r.length>0||this.#Ce)for(let e of this.#k.children){let t=e,{lineAnnotation:n,lineType:r,separator:i}=t.dataset;(n!==void 0||i!==void 0||r===`change-deletion`)&&t.setAttribute(`contenteditable`,`false`)}if(this.#Ee(),this.#n?.syncTheme(this.#P?.__getEffectiveCodeOptions()??{}),this.#I=r,this.#R=i,this.#z=i?.totalLines,this.#n?.prebuildStateStack(i),this.#B?.removePopover(),(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&this.#gt(this.#ne??[]),this.#te!==void 0&&this.#M!==void 0?(this.#te=void 0,this.#rt(!1,`center`)):this.#ie===void 0?this.#q===void 0?this.#ne!==void 0&&this.#ne.length>0&&this.#K&&!this.#ce&&this.focus({preventScroll:!0}):this.#Qe():this.#at(this.#ie,this.#ae,this.#se),this.#ce&&this.#V?.focus(),this.#e.__debug===!0&&i!==void 0){let{startingLine:e,totalLines:t}=i;console.log(`[diffs/editor] render file:`,n.name,`RenderRange:`,e+`-`+(e+t),`of`,this.#L?.lineCount,`lines`)}f!==void 0&&(this.#u=!1,this.#_e(f.cacheKey,f.textDocument)),this.#ke(a)};#fe(e,t){let n=this.#i.get(t),r=e.lang??ge(e.name);return n?.languageId===r?n:void 0}#pe(){let e=this.#e.persistStateStorage??`inMemory`;return(this.#a===void 0||this.#o!==e)&&(this.#a=pp(e),this.#o=e),this.#a}#me(){let e=this.#F,t=this.#L;if(this.#e.persistState!==!0||this.#P===void 0||e===void 0||t===void 0)return;let n=Fp(e);this.#i.set(n,t);let r;try{r=this.#pe()}catch{return}let i=fp(this.getState()),a=this.#c;if(a?.cacheKey===n&&a.textDocument===t){if(this.#c=void 0,t.version===a.documentVersion&&this.#ne===a.selections&&i.view?.scrollLeft===a.view?.scrollLeft&&i.view?.scrollTop===a.view?.scrollTop)return;this.#he(r,n,i,a.completion);return}this.#he(r,n,i)}#he(e,t,n,r){let i=this.#s.get(t);if(r!==void 0||i!==void 0){let a=r??Promise.resolve();i!==void 0&&(a=a.then(()=>i)),this.#ge(t,a.then(()=>e.set(t,n)));return}let a;try{a=e.set(t,n)}catch{return}Ip(a)&&this.#ge(t,a)}#ge(e,t){let n=t.catch(()=>{});this.#s.set(e,n),n.finally(()=>{this.#s.get(e)===n&&this.#s.delete(e)})}#_e(e,t){let n=++this.#l,r=t.version,i=this.#ne,a=this.getState().view,o,s=s=>{let c=this.getState().view;if(n!==this.#l||this.#L!==t||t.version!==r||this.#ne!==i||c?.scrollLeft!==a?.scrollLeft||this.#F===void 0||Fp(this.#F)!==e)return;let l=o?.userScrolled()===!0;if(s===void 0){this.#P?.setCodeScrollLeft(0),l||this.#Me(0);return}let u=fp(s);l&&u.view!==void 0&&(u.view={scrollLeft:u.view.scrollLeft}),this.setState(u)},c=()=>{let t;try{t=this.#pe().get(e)}catch{return}if(Ip(t))return t.then(s).catch(()=>{});try{s(t)}catch{}},l=this.#s.get(e),u=l===void 0?c():l.then(c);if(Ip(u)){o=this.#ve();let n={cacheKey:e,textDocument:t,documentVersion:r,selections:i,view:a,completion:u.catch(()=>{})};this.#c=n,n.completion.finally(()=>{o?.dispose(),this.#c===n&&(this.#c=void 0)})}}#ve(){let e=this.#Ae();if(!(e instanceof HTMLElement))return;let t=!1,n=[`wheel`,`touchstart`,`mousedown`],r=()=>{for(let t of n)e.removeEventListener(t,i,{capture:!0})},i=()=>{t=!0,r()};for(let t of n)e.addEventListener(t,i,{capture:!0,passive:!0});return{userScrolled:()=>t,dispose:r}}#ye(e){return this.#P?.isLineRenderable?.(e+1)??!0}get#be(){let e=this.#P;if(e?.getNearestRenderableLine!=null)return(t,n)=>{let r=e.getNearestRenderableLine(t+1,n);return r==null?void 0:r-1}}#xe(e){this.#ye(e)||this.#P?.revealLine?.(e+1)}get#Se(){return this.#P?.options.diffStyle??`split`}get#Ce(){return this.#P?.type===`file-diff`}get#we(){return this.#P?.options.overflow===`wrap`}#Te(){return this.#r??=new _d({hasActivePopover:()=>this.#H!==void 0||this.#B?.isPopoverVisible()===!0,updateActivePopover:()=>{this.#St(),this.#B?.updatePopoverPosition()}})}#Ee(){this.#y.clear(),this.#x.clear(),this.#S=void 0}#De(){this.#mt(null),this.#_=void 0,this.#v=void 0,this.#W=!1,this.#G=!1,this.#j?.forEach(e=>e.remove()),this.#j=void 0,this.#ne=void 0,this.#ee=void 0,this.#ie=void 0,this.#B?.cleanup(),this.#B=void 0,this.#V?.cleanup(),this.#V=void 0,this.#H?.cleanup(),this.#H=void 0,this.#U=!0}#Oe(){let e=this.#h;e.generation++,e.callback!=null&&(ae(e.callback),e.callback=void 0)}#ke(e){let t=this.#h,n=this.#L;if(t.delivered||t.callback!=null||n==null)return;let{generation:r}=t,i=()=>{if(t.callback!==i||(t.callback=void 0,r!==t.generation||this.#P!==e||this.#L!==n))return;let a=this.#k,o=this.#D?.shadowRoot;a==null||o==null||!o.contains(a)||(t.delivered=!0,this.#e.onAttach?.(this,e))};t.callback=i,et(i)}#Ae(){let e=this.#P?.getEditorViewport?.();if(e!==void 0)return e;let t=this.#D;if(!(this.#P==null||t==null))return id(t)}#je(){let e=this.#Ae();return e instanceof HTMLElement?e.scrollTop:e?.defaultView?.scrollY??0}#Me(e){let t=this.#Ae();t instanceof HTMLElement?t.scrollTop=e:t instanceof Document&&t.defaultView?.scrollTo({top:e})}#Ne(){this.#C=X(`style`,{dataset:`editorGlobalCss`,textContent:`
|
|
2180
|
+
}`),this.#i=e,this.#r=t??n.type,this.#a=r}#F(){if(this.#i===``)return;let{colorMap:e}=this.#e.setTheme(this.#i);this.#a=e}cleanUp(){this.#m=!0,this.stopBackgroundTokenize(),this.#R(),this.#p?.forEach(e=>e()),this.#p=void 0}tokenize(e,t,n=!1){if(this.#I(),this.#F(),this.#t===void 0&&!Np(this.#o.languageId))throw Error(`Grammar for language "${this.#o.languageId}" not loaded`);this.#d&&(this.#O.length=Math.min(this.#O.length,e.startLine));let{lineCount:r}=this.#o,{startingLine:i=0,totalLines:a=1/0}=t??{},o=a===1/0?r:Math.min(i+a,r),s=e.startLine,c=Math.max(i,s),l=t!==void 0&&a!==1/0&&e.lineDelta>0&&s<o&&e.endLine>=o,u=e.lineDelta===0&&(e.changedLineChanges?.every(([,,e])=>e===0)??!0),d=n&&e.lineDelta!==0&&s>=i,f=u||t===void 0||s>=c,p=e.changedLineRanges??[[s,e.endLine]];this.#g=[],this.#_=0,this.#v=[];let m=-1;if(s<c)for(let[e,t]of p)e<c&&(m=Math.max(m,Math.min(t,c-1)));let h=m>=s&&(u||e.lineDelta<0);u?this.#K(s):(this.#W(e),(t===void 0||s>=c)&&this.#K(c));let g=0,_=p[g][1],v,y=0,b=u?p[g][0]:c,x=!1,S=new Map,C=h?new Map:void 0;if(C!==void 0&&!u){let e=Math.min(m+1,c,o);if(e>s){this.#K(e);let t=s,n=this.#h[t]??Ue;for(;t<e;t++){let e=this.#H(t,n);n=e.state,C.set(t,e.resolvedTokens)}this.#h[e]=n}}let w=this.#h[b]??Ue;for(;b<o;){let e=u?this.#h[b+1]:d?this.#G(b+1):void 0;f&&(this.#h[b]=w);let{resolvedTokens:t,state:n}=this.#H(b,w);if(w=n,b>=c?S.set(b,t):C?.set(b,t),f&&(this.#h[b+1]=w),x=b>=_&&(u||d)&&e!==void 0&&w.equals(e),x){g++;let e=p[g];if(e===void 0)break;if(e[0]>=o){v=e[0],y=g;break}let t=this.#h[e[0]];if(d)for(let n=b+2;n<=e[0]&&(t=this.#G(n),t!==void 0);n++)this.#h[n]=t;t===void 0?(_=e[1],b++):(b=e[0],w=t,_=e[1]),x=!1;continue}b++}if(f&&(b<o?this.#h[b+1]=w:this.#h[b]=w),x&&d&&v===void 0){for(let e=b+2;e<=r;e++){let t=this.#G(e);if(t===void 0)break;this.#h[e]=t}this.#g=[],this.#_=0,this.#v=[]}if(C!==void 0&&C.size>0&&this.#l(C,this.#r),v!==void 0)this.#B(v,p,y);else if(!x&&b<r){let e=l&&s>=c?o:s<c&&!u?s:b;this.#B(e,p,g)}return S}prebuildStateStack(e){this.#I(),this.#A(e)}stopBackgroundTokenize(){this.#T=-1,!this.#b&&(this.#b=!0,this.#x=!1,this.#y=-1,this.#w=-1,this.#E=void 0,this.#D=0,this.#g=[],this.#_=0,this.#v=[],this.#R())}pauseBackgroundTokenize(){this.#b||this.#x||(this.#f&&console.log(`[diffs/editor] background tokenization paused`,{jobId:this.#S}),this.#x=!0)}resumeBackgroundTokenize(){this.#b||!this.#x||this.#t===void 0||this.#y<0||(this.#f&&console.log(`[diffs/editor] background tokenization resumed`,{jobId:this.#S}),this.#x=!1,this.#z(this.#S))}#I(){this.#t===void 0&&!Np(this.#o.languageId)&&this.#e.getLoadedLanguages().includes(this.#o.languageId)&&(this.#t=this.#e.getLanguage(this.#o.languageId))}#L(){this.#k||=(globalThis.addEventListener(`message`,this.#j),!0)}#R(){this.#k&&=(globalThis.removeEventListener(`message`,this.#j),!1)}#z(e){globalThis.postMessage({type:`tokenize`,tokenizerId:this.#C,jobId:e})}#B(e,t,n=0){if(Np(this.#o.languageId))return;let r=++this.#S;this.#f&&console.log(`[diffs/editor] background tokenization scheduled`,{jobId:r,startLine:e,changedLineRanges:t,changedRangeIndex:n}),this.#b=!1,this.#x=!1,this.#y=e,this.#w>=0&&(this.#T=Math.max(this.#T,this.#w)),this.#w=-1,this.#E=t,this.#D=n,this.#L(),this.#z(r)}#V(e){if(this.#t===void 0||this.#h.length>e)return;if(!this.#b){this.#w>=0?this.#w=Math.max(this.#w,e):this.#T=Math.max(this.#T,e);return}let t=++this.#S;this.#b=!1,this.#x=!1,this.#y=this.#h.length-1,this.#w=e,this.#T=-1,this.#E=void 0,this.#D=0,this.#L(),this.#z(t)}#H(e,t){let n=this.#o.getLineText(e);if(n.length>this.#s)return console.warn(`[diffs] Line(${e}) too long to tokenize: ${n.length}`),this.#U(e,null),{resolvedTokens:[[0,``,n]],state:t};if(this.#t===void 0||n===``||n.trim()===``)return this.#U(e,null),{resolvedTokens:[[0,``,n]],state:t};let r=jp(this.#t,this.#a,n,t,Op,this.#d);return this.#U(e,r.bracketIgnoredRanges),{resolvedTokens:r.resolvedTokens,state:r.ruleStack}}#U(e,t){this.#d&&(this.#O[e]=t)}#W(e){let t=e.changedLineChanges??[[e.startLine,e.endLine,e.lineDelta]],n=e.startLine+1;n<=this.#h.length-n?(this.#g=this.#h,this.#_=0,this.#h=this.#h.slice(0,n)):(this.#_=n,this.#g=this.#h.slice(n),this.#h.length=Math.min(this.#h.length,n)),this.#v=t}#G(e){let t=e;for(let n=this.#v.length-1;n>=0;n--){let[r,i,a]=this.#v[n];if(a!==0){if(t>i)t-=a;else if(t>r)return this.#h[e]}}return this.#g[t-this.#_]??this.#h[e]}#K(e,t){let n=Math.min(Math.max(0,e),this.#o.lineCount);if(this.#h.length>n||this.#t===void 0)return!0;let r=t===void 0?0:performance.now(),i=this.#h.length-1,a=this.#h[i]??Ue;for(;i<n;){this.#h[i]=a;let e=this.#o.getLineText(i);if(e.length<=this.#s&&e!==``&&e.trim()!==``){let t=jp(this.#t,this.#a,e,a,Op,this.#d,!1);this.#U(i,t.bracketIgnoredRanges),a=t.ruleStack}else this.#U(i,null);if(i++,this.#h[i]=a,t!==void 0&&performance.now()-r>t)break}return i>=n}#q(e){if(this.#b||this.#x||this.#t===void 0||e!==this.#S)return;this.#F();let t=this.#K(this.#w,1);if(!(this.#b||this.#x||e!==this.#S)){if(t){this.stopBackgroundTokenize();return}this.#y=this.#h.length-1,this.#z(e)}}#J(e){if(this.#b||this.#x||this.#t===void 0||e!==this.#S)return;this.#F();let t=performance.now(),n=new Map,r=this.#o.lineCount,i=this.#E,a=this.#y,o=this.#h[a]??Ue,s=!1,c=this.#D,l=i?.[c]?.[1];for(;a<r;){this.#h[a]=o;let e=l===void 0?void 0:this.#G(a+1),r=this.#o.getLineText(a);if(r.length>this.#s)console.warn(`[diffs] Line(${a}) too long to tokenize: ${r.length}`),n.set(a,[[0,``,r]]),this.#U(a,null);else if(r===``||r.trim()===``)n.set(a,[[0,``,r]]),this.#U(a,null);else{let e=jp(this.#t,this.#a,r,o,Op,this.#d);n.set(a,e.resolvedTokens),this.#U(a,e.bracketIgnoredRanges),o=e.ruleStack}if(this.#h[a+1]=o,s=l!==void 0&&a>=l&&e!==void 0&&o.equals(e),a++,s){c++;let e=i?.[c];if(e===void 0)break;if(l=e[1],this.#h[e[0]]===void 0)s=!1;else{a=e[0],o=this.#h[a]??o,s=!1;continue}}if(performance.now()-t>1)break}if(this.#l(n,this.#r),!(this.#b||this.#x||e!==this.#S)){if(s||a>=r){let e=this.#T;this.stopBackgroundTokenize(),e>=0&&this.#V(e);return}this.#y=a,this.#D=c,this.#z(e)}}};function jp(e,t,n,r,i,a=!0,o=!0){let s=e.tokenizeLine2(n,r,i);s.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${n.substring(0,100)}`);let c=s.tokens,l=c.length/2,u=[],d=[];if(!o&&!a)return{ruleStack:s.ruleStack,resolvedTokens:u,bracketIgnoredRanges:d};for(let e=0;e<l;e++){let r=c[2*e],i=e+1<l?c[2*e+2]:n.length;if(r===i)continue;let s=c[2*e+1];if(o){let e=De.getForeground(s);u.push([r,t[e],n.slice(r,i)])}a&&De.getTokenType(s)>0&&d.push([r,i])}return{ruleStack:s.ruleStack,resolvedTokens:u,bracketIgnoredRanges:d}}function Mp(e){return e.map(([e,t,n])=>e===0&&t===``?n===``?X(`br`):n:X(`span`,{dataset:{char:e.toString()},style:`color:${t};`,textContent:n}))}function Np(e){return e===`text`||e===`ansi`}function Pp(e){let t=e.getSelection?.();if(t==null||t.rangeCount===0)return;let n=t.getRangeAt(0);return{collapsed:n.collapsed,startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}}function Fp(e){if(typeof e.cacheKey!=`string`||e.cacheKey.length===0)throw Error(`Editor persistState requires a non-empty file.cacheKey for "${e.name}". Provide a unique, stable cacheKey for every editable file.`);return e.cacheKey}function Ip(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}var Lp=2,Rp=1e4,zp=`selection-action`,Bp=`application/vnd.pierre.diffs-selections+json`,Vp=class{#e;#t=new Cp;#n;#r;#i=new Map;#a;#o;#s=new Map;#c;#l=0;#u=!1;#d;#f;#p;#m;#h={generation:0,callback:void 0,delivered:!1};#g;#_;#v;#y=new Map;#b=new Map;#x=new Map;#S;#C;#w;#T;#E;#D;#O;#k;#A;#j;#M;#N;#P;#F;#I;#L;#R;#z;#B;#V;#H;#U=!0;#W=!1;#G=!1;#K=!1;#q;#J=!1;#Y=!1;#X=!1;#Z=!1;#Q;#$=``;#ee;#te;#ne;#re;#ie;#ae;#oe=!1;#se=!1;#ce=!1;#le=!1;#ue;#de=(e,t)=>{if(this.#P?.updateRenderCache(e,t),this.#R!==void 0&&this.#R.totalLines!==1/0){let{startingLine:t,totalLines:n}=this.#R,r=Math.min(t+n,this.#L?.lineCount??0);for(let[n,i]of e)if(n>=t&&n<r){let e=this.#zt(n);e!==void 0&&e.replaceChildren(...Mp(i))}}};constructor(e={}){this.#e=e}setOptions(e){let t=this.#e.persistStateStorage??`inMemory`,n={...this.#e,...e};if(n.persistState===!0&&this.#P?.type===`file`){let e=this.#P.__getCurrentFile?.()??this.#F;e!==void 0&&Fp(e)}this.#e=n,this.#e.persistState!==!0&&(this.#i.clear(),this.#l++,this.#u=!1),(this.#e.persistStateStorage??`inMemory`)!==t&&(this.#l++,this.#a=void 0,this.#o=void 0,this.#s.clear())}edit(e){if(this.#e.persistState===!0&&e.type===`file`){let t=e.__getCurrentFile?.();t!==void 0&&Fp(t)}return this.#Oe(),this.#P=e,this.#Ne(),this.#m=e.attachEditor(this),()=>this.cleanUp()}applyEdits(e,t=!0){let n=this.#L;if(n==null)throw Error(`Editor is not attached`);let r=this.#K,i=this.#ne,a=i?.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]),o=i===void 0?void 0:n.resolveEdits(e).sort((e,t)=>e.start-t.start),s=n.applyEdits(e,t,i);if(s===void 0)return;let c;i!==void 0&&a!==void 0&&o!==void 0&&(c=Jd(n,i,a,o),t&&n.setLastUndoSelectionsAfter(c)),this.#It(s,c,this.#Lt(s),{skipFocus:!r})}get canUndo(){return this.#L?.canUndo??!1}get canRedo(){return this.#L?.canRedo??!1}undo(){this.#Ve(`undo`)}redo(){this.#Ve(`redo`)}getFile(){let e=this.#F,t=this.#L;if(e===void 0||t===void 0)return;let n={...e};return Object.defineProperty(n,"contents",{enumerable:!0,get:()=>t.getText()}),n}getText(){return this.#L?.getText()??``}getState(){let e=this.#P;return{selections:this.#ne,view:e==null?void 0:{scrollLeft:e.getCodeScrollLeft(),scrollTop:this.#je()}}}setState({selections:e,view:t}){if(this.#P===void 0||this.#L===void 0)throw Error(`Editor is not attached`);if(this.#U=!1,this.#gt(e??[]),t!=null){this.#P.setCodeScrollLeft(t.scrollLeft),t.scrollTop!==void 0&&this.#Me(t.scrollTop);return}this.#rt()}setSelections(e){let t=this.#L;if(t===void 0)throw Error(`Text document is not initialized`);let n=e.map(e=>{let n=t.normalizePosition(e.start),r=t.normalizePosition(e.end),i=e.direction===`none`?0:e.direction===`backward`?-1:1;return $(n,r)>0&&([n,r]=[r,n],i!==0&&(i=i===1?-1:1)),{direction:i,start:n,end:r}});this.#U=!1,this.#gt(n);let r=n.at(-1);r!==void 0&&this.#xe(Ud(r).line),this.#rt()}setMarkers(e){let t=this.#L;if(t===void 0)throw Error(`Text document is not initialized`);if(e.length===0){this.#B?.cleanup(),this.#B=void 0,this.#gt(this.#ne??[]);return}this.#B??=new Vf({popoverManager:this.#Te(),getLineHeight:()=>this.#t.lineHeight,getOverlayElement:()=>this.#A,getGutterWidth:()=>this.#Bt(),getCharX:(e,t)=>this.#Ut(e,t),getLineY:e=>this.#Ht(e),isMouseDown:()=>this.#X||this.#Y}),this.#B.setMarkers(e,t),this.#k!==void 0&&this.#B.listenHover(this.#k),this.#gt(this.#ne??[])}focus(e){let t=e?.preventScroll??!1,n=e?.lineNumber;if(n===`first-visible`||typeof n==`number`){let r=this.#L;if(r==null||this.#P==null)return;let i=n===`first-visible`?this.#et(e?.offset):n;if(i==null)return;let a=r.normalizePosition({line:i-1,character:n===`first-visible`?0:e?.character??0});this.#tt(a,t);return}let r=this.#ne?.at(-1);if(r!==void 0){let e=r.direction===-1?r.end:r.start;this.#Ze(e,t)}else this.#Ze(void 0,t)}blur(){this.#q=void 0,this.#K=!1,this.#W=!1,this.#k?.blur()}cleanUp(e=!1){this.#Oe(),e||(this.#h.delivered=!1);let t=this.#P!=null,n=this.#e.persistState===!0;this.#l++,this.#me(),t&&(this.#u=n),ie(this.#Re),this.#n?.cleanUp(),this.#n=void 0,e||(this.#L=void 0,this.#F=void 0),this.#f?.forEach(e=>e()),this.#f=void 0,this.#d?.forEach(e=>e()),this.#d=void 0,this.#p?.forEach(e=>e()),this.#p=void 0,this.#m?.(e),this.#m=void 0,this.#_=void 0,this.#v=void 0,this.#y.clear(),this.#b.clear(),this.#x.clear(),this.#S=void 0,this.#C?.remove(),this.#C=void 0,this.#w?.remove(),this.#w=void 0,this.#T?.remove(),this.#T=void 0,this.#E?.remove(),this.#E=void 0,this.#D=void 0,this.#r?.cleanUp(),this.#r=void 0,this.#O=void 0,this.#k?.removeAttribute(`contentEditable`),this.#k=void 0,this.#q=void 0,this.#K=!1,this.#A?.remove(),this.#A=void 0,this.#N?.disconnect(),this.#N=void 0,this.#le=!1,this.#ue!==void 0&&(cancelAnimationFrame(this.#ue),this.#ue=void 0),this.#De(),this.#P=void 0}__prepareFile(e){if(this.#e.persistState!==!0)return e;let t=Fp(e),n=this.#F,r=e.lang??he(e.name);n!==void 0&&(Fp(n)!==t||n.name!==e.name||this.#L?.languageId!==r)&&(this.#l++,this.#me());let i=this.#fe(e,t);return i===void 0||i.getText()===e.contents?e:{...e,contents:i.getText()}}__postponeBgTokenizeToNextFrame(){let e=this.#n;e!==void 0&&(e.pauseBackgroundTokenize(),requestAnimationFrame(()=>{e.resumeBackgroundTokenize()}))}__captureFocusForDOMReplacement(){let e=this.#k,t=this.#D?.shadowRoot?.activeElement;e!=null&&(this.#K||t===e||t!=null&&e.contains(t))&&(this.#q={})}__syncRenderView=(e,t,n,r,i)=>{let a=this.#P;if(a==null)return;let o=t.shadowRoot;if(o==null){console.error(`[editor] Could not find the shadow root.`);return}let s,c,l;for(let e of o.querySelectorAll(`[data-code]`))if(e.dataset.deletions===void 0){s=e;for(let t of e.children){let e=t,{gutter:n,content:r}=e.dataset;n===void 0?r!==void 0&&(l=e):c=e}break}if(s===void 0||l===void 0){this.#q=void 0;return}this.#Te().setViewportElements(t,s),this.#D!==t&&(this.#D=t,this.#C!==void 0&&t.appendChild(this.#C),this.#w!==void 0&&o.appendChild(this.#w),this.#T!==void 0&&o.appendChild(this.#T),this.#E!==void 0&&o.prepend(this.#E));let u=this.#L===void 0||this.#F===void 0||this.#F.name!==n.name||this.#F.lang!==n.lang||this.#F.cacheKey!==n.cacheKey,d=this.#e.persistState===!0?Fp(n):void 0,f;if(u){this.#Oe();let e=``;e=`contents`in n?n.contents:n.additionLines.join(``);let t=new $l({maxEntries:this.#e.historyMaxEntries}),{name:r,lang:i,cacheKey:o}=n,s=i??he(n.name),c=d===void 0?void 0:this.#fe(n,d),l=a.type===`file`||c?.getText()===e?c:void 0,u=l??new ku(n.name,e,s,0,t);this.#F={name:r,lang:i,cacheKey:o},this.#L=u,d!==void 0&&(this.#i.set(d,u),f={cacheKey:d,textDocument:u}),this.#n?.cleanUp(),this.#n=void 0,this.#De(),this.#b.clear(),this.#ne=this.#te,this.#e.__debug===!0&&console.log(l===void 0?`[diffs/editor] text document rebuilt from`:`[diffs/editor] cached text document reused for`,n.name)}f===void 0&&this.#u&&d!==void 0&&this.#L!==void 0&&(f={cacheKey:d,textDocument:this.#L});let p=this.#L;if(this.#n==null&&p!=null&&(this.#n=new Ap({highlighter:e,textDocument:p,codeOptions:this.#P?.__getEffectiveCodeOptions()??{},matchBrackets:this.#e.matchBrackets,onDeferTokenize:this.#de,onThemeChange:()=>this.#ht(),setStyle:e=>{this.#T.textContent=e},__debug:this.#e.__debug})),this.#k!==l&&(this.#O=c,this.#k=Xu(l,{contentEditable:`true`,role:`textbox`,ariaMultiLine:`true`,autocapitalize:`off`,writingSuggestions:`off`,autocorrect:!1,spellcheck:!1,translate:!1}),this.#A!==void 0&&l.after(this.#A),this.#t.init(l),this.#Je(),this.#Le(l,c),this.#k!==void 0&&this.#e.__debug===!0&&console.log(`[diffs/editor] full re-render triggered !!!`)),this.#q!=null&&(this.#q.target=l),l.ariaLabel!==n.name&&(l.ariaLabel=n.name),r!==void 0&&r.length>0||this.#Ce)for(let e of this.#k.children){let t=e,{lineAnnotation:n,lineType:r,separator:i}=t.dataset;(n!==void 0||i!==void 0||r===`change-deletion`)&&t.setAttribute(`contenteditable`,`false`)}if(this.#Ee(),this.#n?.syncTheme(this.#P?.__getEffectiveCodeOptions()??{}),this.#I=r,this.#R=i,this.#z=i?.totalLines,this.#n?.prebuildStateStack(i),this.#B?.removePopover(),(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&this.#gt(this.#ne??[]),this.#te!==void 0&&this.#M!==void 0?(this.#te=void 0,this.#rt(!1,`center`)):this.#ie===void 0?this.#q===void 0?this.#ne!==void 0&&this.#ne.length>0&&this.#K&&!this.#ce&&this.focus({preventScroll:!0}):this.#Qe():this.#at(this.#ie,this.#ae,this.#se),this.#ce&&this.#V?.focus(),this.#e.__debug===!0&&i!==void 0){let{startingLine:e,totalLines:t}=i;console.log(`[diffs/editor] render file:`,n.name,`RenderRange:`,e+`-`+(e+t),`of`,this.#L?.lineCount,`lines`)}f!==void 0&&(this.#u=!1,this.#_e(f.cacheKey,f.textDocument)),this.#ke(a)};#fe(e,t){let n=this.#i.get(t),r=e.lang??he(e.name);return n?.languageId===r?n:void 0}#pe(){let e=this.#e.persistStateStorage??`inMemory`;return(this.#a===void 0||this.#o!==e)&&(this.#a=pp(e),this.#o=e),this.#a}#me(){let e=this.#F,t=this.#L;if(this.#e.persistState!==!0||this.#P===void 0||e===void 0||t===void 0)return;let n=Fp(e);this.#i.set(n,t);let r;try{r=this.#pe()}catch{return}let i=fp(this.getState()),a=this.#c;if(a?.cacheKey===n&&a.textDocument===t){if(this.#c=void 0,t.version===a.documentVersion&&this.#ne===a.selections&&i.view?.scrollLeft===a.view?.scrollLeft&&i.view?.scrollTop===a.view?.scrollTop)return;this.#he(r,n,i,a.completion);return}this.#he(r,n,i)}#he(e,t,n,r){let i=this.#s.get(t);if(r!==void 0||i!==void 0){let a=r??Promise.resolve();i!==void 0&&(a=a.then(()=>i)),this.#ge(t,a.then(()=>e.set(t,n)));return}let a;try{a=e.set(t,n)}catch{return}Ip(a)&&this.#ge(t,a)}#ge(e,t){let n=t.catch(()=>{});this.#s.set(e,n),n.finally(()=>{this.#s.get(e)===n&&this.#s.delete(e)})}#_e(e,t){let n=++this.#l,r=t.version,i=this.#ne,a=this.getState().view,o,s=s=>{let c=this.getState().view;if(n!==this.#l||this.#L!==t||t.version!==r||this.#ne!==i||c?.scrollLeft!==a?.scrollLeft||this.#F===void 0||Fp(this.#F)!==e)return;let l=o?.userScrolled()===!0;if(s===void 0){this.#P?.setCodeScrollLeft(0),l||this.#Me(0);return}let u=fp(s);l&&u.view!==void 0&&(u.view={scrollLeft:u.view.scrollLeft}),this.setState(u)},c=()=>{let t;try{t=this.#pe().get(e)}catch{return}if(Ip(t))return t.then(s).catch(()=>{});try{s(t)}catch{}},l=this.#s.get(e),u=l===void 0?c():l.then(c);if(Ip(u)){o=this.#ve();let n={cacheKey:e,textDocument:t,documentVersion:r,selections:i,view:a,completion:u.catch(()=>{})};this.#c=n,n.completion.finally(()=>{o?.dispose(),this.#c===n&&(this.#c=void 0)})}}#ve(){let e=this.#Ae();if(!(e instanceof HTMLElement))return;let t=!1,n=[`wheel`,`touchstart`,`mousedown`],r=()=>{for(let t of n)e.removeEventListener(t,i,{capture:!0})},i=()=>{t=!0,r()};for(let t of n)e.addEventListener(t,i,{capture:!0,passive:!0});return{userScrolled:()=>t,dispose:r}}#ye(e){return this.#P?.isLineRenderable?.(e+1)??!0}get#be(){let e=this.#P;if(e?.getNearestRenderableLine!=null)return(t,n)=>{let r=e.getNearestRenderableLine(t+1,n);return r==null?void 0:r-1}}#xe(e){this.#ye(e)||this.#P?.revealLine?.(e+1)}get#Se(){return this.#P?.options.diffStyle??`split`}get#Ce(){return this.#P?.type===`file-diff`}get#we(){return this.#P?.options.overflow===`wrap`}#Te(){return this.#r??=new _d({hasActivePopover:()=>this.#H!==void 0||this.#B?.isPopoverVisible()===!0,updateActivePopover:()=>{this.#St(),this.#B?.updatePopoverPosition()}})}#Ee(){this.#y.clear(),this.#x.clear(),this.#S=void 0}#De(){this.#mt(null),this.#_=void 0,this.#v=void 0,this.#W=!1,this.#G=!1,this.#j?.forEach(e=>e.remove()),this.#j=void 0,this.#ne=void 0,this.#ee=void 0,this.#ie=void 0,this.#B?.cleanup(),this.#B=void 0,this.#V?.cleanup(),this.#V=void 0,this.#H?.cleanup(),this.#H=void 0,this.#U=!0}#Oe(){let e=this.#h;e.generation++,e.callback!=null&&(ie(e.callback),e.callback=void 0)}#ke(e){let t=this.#h,n=this.#L;if(t.delivered||t.callback!=null||n==null)return;let{generation:r}=t,i=()=>{if(t.callback!==i||(t.callback=void 0,r!==t.generation||this.#P!==e||this.#L!==n))return;let a=this.#k,o=this.#D?.shadowRoot;a==null||o==null||!o.contains(a)||(t.delivered=!0,this.#e.onAttach?.(this,e))};t.callback=i,$e(i)}#Ae(){let e=this.#P?.getEditorViewport?.();if(e!==void 0)return e;let t=this.#D;if(!(this.#P==null||t==null))return id(t)}#je(){let e=this.#Ae();return e instanceof HTMLElement?e.scrollTop:e?.defaultView?.scrollY??0}#Me(e){let t=this.#Ae();t instanceof HTMLElement?t.scrollTop=e:t instanceof Document&&t.defaultView?.scrollTo({top:e})}#Ne(){this.#C=X(`style`,{dataset:`editorGlobalCss`,textContent:`
|
|
2181
2181
|
[data-annotation-slot] {
|
|
2182
2182
|
user-select: none;
|
|
2183
2183
|
-webkit-user-select: none;
|
|
2184
2184
|
}
|
|
2185
|
-
`}),this.#w=X(`style`,{dataset:`editorCss`,textContent:Ru}),this.#T=X(`style`,{dataset:`editorThemeCss`}),this.#E=cp(),this.#A=X(`div`,{dataset:`editorOverlay`});let e=e=>{let t=e.composedPath()[0];return t instanceof Node&&this.#k?.contains(t)===!0},t=()=>{this.#q!=null&&(this.#q=void 0,this.#K=!1,this.#W=!1)};this.#f=[Z(document,`focusin`,n=>{e(n)||t()},{passive:!0}),Z(document,`pointerdown`,n=>{e(n)||queueMicrotask(t)},{capture:!0,passive:!0}),Z(document,`selectionchange`,()=>{let e=this.#D?.shadowRoot;if(this.#W||this.#G||e==null||!this.#K||this.#ne!==void 0&&this.#ne.length>1&&!this.#X)return;let t=document.getSelection();if(t==null)return;let n=typeof t.getComposedRanges==`function`?t.getComposedRanges({shadowRoots:[e]})?.[0]:Pp(e);if(n===void 0||!this.#Kt(n))return;let r=Sd(n,0);if(r!==void 0){if(this.#X&&this.#Z&&this.#ne!==void 0&&this.#ne.length>0){let e=this.#ne.at(-1);this.#gt([Xd(e,r)]);return}if(this.#X)this.#Q===void 0?this.#Q=r:r=Yd(this.#Q,r);else if(this.#Q!==void 0)r.direction=Yd(this.#Q,r).direction;else if(this.#ne!==void 0&&this.#ne.length===1){let e=this.#ne[0];$(e.start,r.start)===0&&$(e.end,r.end)===0&&(r.direction=e.direction)}this.#ee===void 0?this.#gt([r]):this.#gt([...this.#ee.filter(e=>!Gd(e,r)),r])}},{passive:!0}),Z(document,`pointerup`,e=>{e.pointerType===`mouse`&&(this.#p?.forEach(e=>e()),this.#p=void 0,this.#Y&&(this.#Y=!1,this.#Ze()),this.#W=!1,this.#X=!1,this.#Z=!1,this.#Q=void 0,this.#ee=void 0,this.#e.enabledSelectionAction===!0&&this.#ne!==void 0&&this.#ne.length>0&&!Q(this.#ne.at(-1))&&this.#gt(this.#ne))},{passive:!0}),Z(document,`keydown`,e=>{e.key===`Shift`&&(this.#Q=this.#ne?.at(-1))},{passive:!0}),Z(document,`keyup`,e=>{e.key===`Shift`&&(this.#Q=void 0)},{passive:!0})]}#Pe(e){this.#p?.forEach(e=>e()),this.#p=e}#Fe(){return this.#P?.options.enableLineSelection===!0}#Ie(){this.#G=this.#ne!==void 0}#Le(e,t){let{onFocus:n,onBlur:r}=this.#e,i=t=>{let n=t.composedPath()[0];return n!==void 0&&(n===e||e.contains(n))};this.#d?.forEach(e=>e()),this.#d=[Z(e,`focus`,()=>{this.#K=!0,n?.(),!this.#X&&!this.#W&&this.#ne!==void 0&&this.#ne.length>0&&this.#nt(this.#ne.at(-1))},{passive:!0}),Z(e,`blur`,()=>{this.#q?.target===e&&(this.#q=void 0,this.#W=!1),this.#K=!1,r?.()},{passive:!0}),Z(e,`pointerdown`,t=>{if(this.#U=!0,this.#G=!1,t.pointerType===`mouse`){if(this.#st(t)){this.#pt(!0),this.#ne!==void 0&&this.#gt([]);return}if(this.#pt(!1),this.#B?.removePopover(),De()&&this.#I!==void 0&&this.#I.length>0){let t=[...e.querySelectorAll(`[data-line-annotation]`)].map(e=>[Z(e,`mouseenter`,()=>{this.#W=!0}),Z(e,`mouseleave`,()=>{this.#W=!1})]).flat();this.#Pe(t)}if(this.#X=!0,this.#Q=void 0,t.button===0&&Au(t)&&(this.#ee=this.#ne?.map(e=>({...e}))),t.shiftKey){let e=this.#ne?.at(-1);if(e!==void 0){let t=e.direction===-1?e.end:e.start;this.#nt({start:t,end:t,direction:0})}this.#Z=!0}}},{passive:!0}),Z(e,`keydown`,e=>{if(!i(e))return;this.#U=!0,this.#G=!1;let t=Iu(e,this.#e.keymap);if(t!==void 0){e.preventDefault(),t===`simplifySelection`&&(this.#V?.close(),this.#V=void 0,this.#ce=!1,this.#H?.cleanup(),this.#H=void 0),this.#Ve(t);return}let n=ju(e),r=this.#L;if(this.#ne!==void 0&&this.#ne.length>0&&n!==void 0&&r!==void 0){let t={getSoftLineOffsets:this.#we?e=>this.#Gt(e):void 0,resolveRenderableLine:this.#be};e.shiftKey?this.#gt(Ad(r,this.#ne,n,t)):this.#gt(wd(r,this.#ne,n,t)),this.#rt(),e.preventDefault();return}if((e.key.length===1?e.key.toLowerCase():e.key)===`v`&&Au(e)){if(e.repeat&&this.#Ce){e.preventDefault();return}if(this.#e.clipboard!==void 0){e.preventDefault(),et(this.#Re);return}}if(this.#V!==void 0){let t=Lu(e);if(t!==void 0){e.preventDefault(),this.#V.navigate(t===`previous`);return}}}),Z(e,`copy`,e=>{i(e)&&(e.preventDefault(),this.#dt()?e.clipboardData?.setData(`text`,this.#ft()):this.#Dt(e.clipboardData,this.#Tt(),this.#Et()))}),Z(e,`cut`,e=>{if(i(e))if(e.preventDefault(),this.#dt())e.clipboardData?.setData(`text`,this.#ft());else{let t=this.#Et();this.#Dt(e.clipboardData,this.#Ot(),t)}}),Z(e,`paste`,e=>{if(!i(e))return;e.preventDefault();let t=e.clipboardData,n=this.#L;if(t===null||n===void 0)return;let r=t.getData(`text`),a=this.#ne?.length??0;if(a>1){let e=t.getData(Bp);if(e!==void 0)try{let t=JSON.parse(e);Array.isArray(t)&&t.length===a&&(r=t)}catch{}}this.#At(Array.isArray(r)?r.map(e=>n.normalizeEol(e)):n.normalizeEol(r),void 0,!0,`document`)}),Z(e,`beforeinput`,e=>{i(e)&&e.inputType!==`insertCompositionText`&&(e.preventDefault(),this.#Xe(e.inputType,e.data))}),Z(e,`drop`,e=>{i(e)&&e.preventDefault()}),Z(e,`compositionstart`,e=>{i(e)&&(this.#J=!0,this.#W=!0)},{passive:!0}),Z(e,`compositionend`,e=>{if(!i(e))return;this.#W=!1;let t=this.#J;this.#J=!1,(e.data!==``||!t)&&this.#Xe(`insertText`,e.data)},{passive:!0})];let a=this.#D?.shadowRoot?.querySelector(`[data-deletions]`);if(a!=null&&this.#d.push(Z(a,`pointerdown`,e=>{let t=e.composedPath();if(Le(t)){this.#Ie();return}let n=t[0],r=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(r instanceof HTMLElement){if(this.#Fe()){this.#Ie();return}if(this.#ut(r,a,e.pointerType===`mouse`))return}this.#pt(!0),this.#ne!==void 0&&this.#gt([])},{passive:!0})),t!==void 0){let e=(e,t=!1)=>{let n=e;return n?.dataset.lineNumberContent===void 0?t&&n?.tagName===`SPAN`&&(n=n.closest(`[data-line]`)):n=n.parentElement??void 0,n},n=e=>{if(e===void 0)return;let t=e.dataset.lineType,n=Ju(e)??Ju(e,`columnNumber`);if(!(n===void 0||t===void 0||!Wd(t)))return n-1};this.#d.push(Z(t,`pointerdown`,t=>{let r=t.composedPath();if(Le(r)){this.#Ie();return}let i=e(r[0]);if(i!==void 0&&this.#Fe()){this.#Ie();return}if(i?.dataset.lineType===`change-deletion`){let e=i.closest(`[data-code]`);e!=null&&this.#ut(i,e,t.pointerType===`mouse`);return}if(t.pointerType!==`mouse`)return;let a=this.#L,o=n(i);if(o===void 0||a===void 0)return;this.#U=!0,this.#B?.removePopover();let s=this.#ot(o,o,a);this.#Y=!0,this.#Q=s,this.#gt([s]),this.#nt(s),this.#Ze(),this.#Pe([Z(document,`mousemove`,t=>{if(!this.#Y)return;let r=this.#L,i=n(e(t.composedPath()[0],!0));if(i===void 0||r===void 0)return;let a=this.#Q?.start.line??i,o=this.#ot(a,i,r);this.#Q??=o,this.#gt([o]),this.#Ze(o.direction===-1?o.start:o.end)},{passive:!0})])},{passive:!0}))}this.#B?.listenHover(e),this.#N?.disconnect(),this.#N=new ResizeObserver(this.#qe),this.#N.observe(e),this.#N.observe(e.parentElement),this.#ze(e)}#Re=async()=>{let e=this.#e.clipboard;if(e!==void 0){let t=await e.readText(),n=this.#ne?.length??0;if(n>1){let r=await e.readText(Bp);try{let e=JSON.parse(r);Array.isArray(e)&&e.length===n&&(t=e)}catch{}}let r=this.#L;r!==void 0&&this.#At(Array.isArray(t)?t.map(e=>r.normalizeEol(e)):r.normalizeEol(t),void 0,!0,`document`)}};#ze(e){this.#Ce&&this.#Se===`split`&&this.#we&&(this.#g={top:e.offsetTop,left:e.offsetLeft-this.#Bt()},this.#e.__debug===!0&&console.log(`[diffs/editor] content offset:`,this.#g))}get#Be(){if(this.#Ce&&this.#Se===`split`&&this.#we)return this.#g}#Ve(e){let t=this.#L;if(t!==void 0)switch(e){case`openSearchPanel`:this.#Ct(`find`);break;case`openSearchReplacePanel`:this.#Ct(`replace`);break;case`findNextMatch`:{let e=this.#ne;if(e===void 0)break;if(e.some(Q)){let n=e.map(e=>Q(e)?hf(t,e):e);this.#gt(n),this.focus()}else{let n=tf(t,e);if(n!==void 0){this.#gt(n);let e=n.at(-1);e!==void 0&&this.#xe(Ud(e).line),this.#rt()}}break}case`moveLineUp`:case`moveLineDown`:this.#Ke(e===`moveLineUp`?-1:1);break;case`copyLineUp`:case`copyLineDown`:this.#We(e===`copyLineUp`?-1:1);break;case`simplifySelection`:{let e=this.#ne,t=e?.at(-1);if(e===void 0||t===void 0)break;if(e.length>1)this.#gt([t]),this.#Ze(Ud(t));else if(!Q(t)){let e=Ud(t);this.#gt([{start:e,end:e,direction:0}]),this.#Ze(e)}break}case`insertBlankLine`:this.#Ge();break;case`deleteHardLineForward`:this.#Pt();break;case`toggleComment`:case`toggleBlockComment`:{let n=this.#ne;if(n===void 0)break;let{lineComment:r,blockComment:i}=Hu(t.languageId,this.#e.languageCommentConfig);if(e===`toggleComment`&&r!==null){this.#Ue(Uu(t,n,r));break}let a=e===`toggleComment`,o=qu(t,n,i,a);o!==void 0&&this.#Ue(o.edits,a?void 0:e=>o.nextSelectionOffsets.map(([t,n,r])=>({start:e.positionAt(t),end:e.positionAt(n),direction:r})));break}case`indent`:case`outdent`:case`indentLess`:case`indentMore`:if(this.#ne!==void 0){let n=[],r=[],i=new Set,a=[];for(let o of this.#ne){let s=o.start.line,c=e===`outdent`||e===`indentLess`,l=e===`indentLess`||e===`indentMore`;if(s!==o.end.line||c||l){let e=Cd(t,o,this.#t.tabSize,c);for(let t of e[0]){let e=t.range.start.line;i.has(e)||(i.add(e),n.push(t))}r.push(e[1])}else{let e=t.charAt({line:s,character:0})===` `?` `:` `.repeat(this.#t.tabSize);n.push({range:o,newText:e}),a.push({line:s,startCharacter:o.start.character,addedLength:e.length-(o.end.character-o.start.character),selectionIndex:r.length});let i={line:o.start.line,character:o.start.character+e.length};r.push({start:i,end:i,direction:0})}}for(let e of a){let t=0;for(let n of a)n.line===e.line&&n.startCharacter<e.startCharacter&&(t+=n.addedLength);if(t!==0){let n=r[e.selectionIndex],i={line:e.line,character:n.start.character+t};r[e.selectionIndex]={start:i,end:i,direction:0}}}let o=t.applyEdits(n,!0,this.#ne,r);o!==void 0&&this.#It(o,r)}break;case`selectAll`:{let e=nf(t);this.#gt([e]),this.focus();let n=this.#Rt(),r=n[0]?.[0],i=n.at(-1)?.[1];r!==void 0&&i!==void 0&&(this.#G=!0,this.#nt({start:{line:r,character:0},end:{line:i,character:t.getLineLength(i)},direction:1}));break}case`moveCursorToDocStart`:case`moveCursorToDocEnd`:{let n=rf(t,e===`moveCursorToDocEnd`,this.#Ce);this.#gt([n]),this.#xe(Ud(n).line),this.#rt()}break;case`expandSelectionDocStart`:case`expandSelectionDocEnd`:{let n=e===`expandSelectionDocEnd`,r=this.#ne;if(r!==void 0){let e=rf(t,n,this.#Ce);this.#gt(Zd(r,e)),this.#xe(Ud(e).line),this.#rt()}}break;case`undo`:case`redo`:this.#He(e);break}}#He(e){let t=this.#L;if(t===void 0||e===`undo`&&!t.canUndo||e===`redo`&&!t.canRedo)return;let n=this.#ne,r=n?.map(e=>[t.offsetAt(e.start),t.offsetAt(e.end)]),i=e===`undo`?t.undo():t.redo();if(i===void 0)return;let[a,o,s,c]=i,l=o??(n!==void 0&&r!==void 0&&c!==void 0?Jd(t,n,r,c):void 0);this.#It(a,l,s)}#Ue(e,t){let n=this.#L,r=this.#ne;if(n===void 0||r===void 0)return;let i=t===void 0,a=i?r.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]):void 0,o=i?e.map(e=>{let t=n.offsetAt(e.range.start),r=n.offsetAt(e.range.end);return{start:Math.min(t,r),end:Math.max(t,r),text:e.newText}}).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n}):void 0,s=n.applyEdits(e,!0,r,void 0,!0);if(s===void 0)return;let c=i?Jd(n,r,a,o):t(n);n.setLastUndoSelectionsAfter(c),this.#It(s,c,this.#Lt(s))}#We(e){let t=this.#L,n=this.#ne;if(t===void 0||n===void 0)return;let r=$d(n);if(r.length===0)return;let i=[],a=0,o=[];for(let n of r){i.push(a);let r=n.endLine-n.startLine+1;a+=r;let s=t.getText({start:{line:n.startLine,character:0},end:{line:n.endLine,character:t.getLineLength(n.endLine)}});if(e>0){let e={line:n.startLine,character:0};o.push({range:{start:e,end:e},newText:s+t.eol})}else if(n.endLine<t.lineCount-1){let e={line:n.endLine+1,character:0};o.push({range:{start:e,end:e},newText:s+t.eol})}else{let e={line:n.endLine,character:t.getLineLength(n.endLine)};o.push({range:{start:e,end:e},newText:t.eol+s})}}let s=n.map(t=>{let n=t.start.line,a=0,o=r.length-1;for(;a<=o;){let e=a+o>>>1,t=r[e];if(n<t.startLine)o=e-1;else if(n>t.endLine)a=e+1;else{a=e;break}}let s=Math.max(0,a<=o?a:o),c=r[s],l=i[s]+(e>0?c.endLine-c.startLine+1:0);return{start:{...t.start,line:t.start.line+l},end:{...t.end,line:t.end.line+l},direction:t.direction}});this.#Ue(o,()=>s)}#Ge(){let e=this.#L,t=this.#ne;if(e===void 0||t===void 0)return;let n=t.map(e=>Ud(e).line),r=Array.from(new Set(n)).sort((e,t)=>e-t),i=new Map,a=new Map,o=[];for(let t=0;t<r.length;t++){let n=r[t],s=e.getLineText(n),c=/^\s*/.exec(s)?.[0]??``;i.set(n,t),a.set(n,c);let l={line:n,character:e.getLineLength(n)};o.push({range:{start:l,end:l},newText:e.eol+c})}let s=t.map((e,t)=>{let r=n[t],o={line:r+1+i.get(r),character:a.get(r).length};return{start:o,end:o,direction:0}});this.#Ue(o,()=>s)}#Ke(e){let t=this.#L,n=this.#ne;if(t===void 0||n===void 0)return;let r=$d(n);if(r.length===0||e<0&&r[0].startLine===0||e>0&&r.at(-1).endLine>=t.lineCount-1)return;let i=t.lineCount,a=e=>e<i-1?{line:e+1,character:0}:{line:e,character:t.getLineLength(e)},o=(e,n)=>{let r=e.map(e=>t.getLineText(e)).join(t.eol);return n?r+t.eol:r},s=[];if(e<0)for(let e of r){let t=e.startLine-1,n=[];for(let t=e.startLine;t<=e.endLine;t++)n.push(t);s.push({range:{start:{line:t,character:0},end:a(e.endLine)},newText:o([...n,t],e.endLine<i-1)})}else for(let e=r.length-1;e>=0;e--){let t=r[e],n=t.endLine+1,c=[];for(let e=t.startLine;e<=t.endLine;e++)c.push(e);s.push({range:{start:{line:t.startLine,character:0},end:a(n)},newText:o([n,...c],n<i-1)})}let c=r.at(-1),l=e>0&&c.endLine===i-2?t.getLineLength(c.endLine):t.getLineLength(i-1),u=n.map(n=>ef(n,e,i,e=>e===i-1?l:t.getLineLength(e))),d=t.applyEdits(s,!0,n,u,!0);d!==void 0&&this.#It(d,u)}#qe=()=>{let e=this.#I?.length??0,t=this.#_,n=this.#v;this.#_=void 0,this.#v=void 0;let r=this.#Bt()!==t,i=this.#Vt()!==n;!r&&!i||(this.#x.clear(),this.#S=void 0,this.#t.clearTextWidthCache(),i&&(this.#b.clear(),(this.#we||e>0)&&this.#y.clear()),(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&(this.#gt(this.#ne??[]),this.#ne!==void 0&&this.#K&&this.focus()),this.#B?.removePopover(),this.#ze(this.#k))};#Je(){if(this.#le)return;let e=document.fonts;e!==void 0&&(this.#le=!0,e.ready.then(()=>{this.#k===void 0||!this.#t.remeasureCharacterWidth()||(this.#_=void 0,this.#v=void 0,this.#Ee(),this.#b.clear(),(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&this.#gt(this.#ne??[]),this.#B?.removePopover())}))}#Ye(e,t,n=this.#R,r){let i=this.#n,a=this.#P,o=this.#L,s=this.#O,c=this.#k;if(i===void 0||a===void 0||o===void 0||c===void 0)return;i.stopBackgroundTokenize();let l=performance.now(),u=i.tokenize(e,n,!this.#Ce),d=performance.now();if(u.size>0){let e=c.children,t=new Set;for(let e of u.keys())this.#ye(e)&&t.add(e);for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0){let e=Ju(r),n=r.dataset.lineType;if(e===void 0||n===`change-deletion`)continue;let i=e-1;if(t.has(i)){let e=u.get(i);if(r.replaceChildren(...Mp(e)),t.delete(i),t.size===0)break}}}if(t.size>0){let n=0;for(let t=e.length-1;t>=0;t--){let r=e[t],i=Ju(r);if(i!==void 0&&r.dataset.lineType!==`change-deletion`){n=i;break}}for(let e of t){if(e<n)continue;let t=u.get(e),r=String(e+1);X(`div`,{dataset:{line:r,lineType:`context`,lineIndex:e.toString()},children:Mp(t)},c),s!==void 0&&X(`div`,{dataset:{lineType:`context`,columnNumber:r,lineIndex:e.toString()},children:[X(`span`,{dataset:{lineNumberContent:``},textContent:r})]},s)}}}if(e.lineDelta<0)for(let t of[c.children,s?.children??[]])for(let n=t.length-1;n>=0;n--){let r=t[n],i=Ju(r)??Ju(r,`columnNumber`),a=r.dataset.lineType;if(!(i===void 0||a===`change-deletion`)){if(i-1<e.lineCount)break;r.remove()}}let f=e.lineDelta!==0;if(f){let e=c.children.length;for(let t of c.children){let{bufferSize:n}=t.dataset;n!==void 0&&(e+=parseInt(n)-1)}c.style.gridRow=`span `+e,s!==void 0&&(s.style.gridRow=`span `+e)}a.updateRenderCache(u,i.themeType,{shouldRefreshDiffsView:this.#Ce&&!f,lineCountChangeInFlight:f}),f&&a.applyDocumentChange(o,t,r),(f||this.#Ce&&this.#Se===`unified`)&&this.#Ee(),t!==void 0&&(this.#I=t,dd(t,c,s)),this.#e.__debug===!0&&console.log(`[diffs/editor] re-render in: ${Qu(performance.now()-d)}ms,`,`tokenize in: ${Qu(d-l)}ms (${u.size} dirty lines)`)}#Xe(e,t){switch(e){case`insertText`:{let e=t??``,n=this.#L,r=this.#ne,i=n!==void 0&&r!==void 0?Id(n,r,e,this.#e.autoSurround):void 0;this.#At(i??e);break}case`insertCompositionText`:break;case`insertLineBreak`:case`insertParagraph`:this.#At(this.#L?.eol??`
|
|
2186
|
-
`);break;case`deleteContentBackward`:this.#jt();break;case`deleteContentForward`:this.#jt(!0);break;case`deleteSoftLineBackward`:case`deleteHardLineBackward`:this.#Mt();break;case`deleteWordBackward`:this.#Nt();break;case`insertTranspose`:this.#Ft();break;default:console.warn(`[diffs] Unknown input type: ${e}`,t);break}}#Ze(e,t=!0,n){this.#K=!0,e===void 0?n?.()===!1?this.#K=!1:this.#k?.focus({preventScroll:t}):(this.#W=!0,this.#nt({start:e,end:e,direction:0})
|
|
2185
|
+
`}),this.#w=X(`style`,{dataset:`editorCss`,textContent:Ru}),this.#T=X(`style`,{dataset:`editorThemeCss`}),this.#E=cp(),this.#A=X(`div`,{dataset:`editorOverlay`});let e=e=>{let t=e.composedPath()[0];return t instanceof Node&&this.#k?.contains(t)===!0},t=()=>{this.#q!=null&&(this.#q=void 0,this.#K=!1,this.#W=!1)};this.#f=[Z(document,`focusin`,n=>{e(n)||t()},{passive:!0}),Z(document,`pointerdown`,n=>{e(n)||queueMicrotask(t)},{capture:!0,passive:!0}),Z(document,`selectionchange`,()=>{let e=this.#D?.shadowRoot;if(this.#W||this.#G||e==null||!this.#K||this.#ne!==void 0&&this.#ne.length>1&&!this.#X)return;let t=document.getSelection();if(t==null)return;let n=typeof t.getComposedRanges==`function`?t.getComposedRanges({shadowRoots:[e]})?.[0]:Pp(e);if(n===void 0||!this.#Kt(n))return;let r=Sd(n,0);if(r!==void 0){if(this.#X&&this.#Z&&this.#ne!==void 0&&this.#ne.length>0){let e=this.#ne.at(-1);this.#gt([Xd(e,r)]);return}if(this.#X)this.#Q===void 0?this.#Q=r:r=Yd(this.#Q,r);else if(this.#Q!==void 0)r.direction=Yd(this.#Q,r).direction;else if(this.#ne!==void 0&&this.#ne.length===1){let e=this.#ne[0];$(e.start,r.start)===0&&$(e.end,r.end)===0&&(r.direction=e.direction)}this.#ee===void 0?this.#gt([r]):this.#gt([...this.#ee.filter(e=>!Gd(e,r)),r])}},{passive:!0}),Z(document,`pointerup`,e=>{e.pointerType===`mouse`&&(this.#p?.forEach(e=>e()),this.#p=void 0,this.#Y&&(this.#Y=!1,this.#Ze()),this.#W=!1,this.#X=!1,this.#Z=!1,this.#Q=void 0,this.#ee=void 0,this.#e.enabledSelectionAction===!0&&this.#ne!==void 0&&this.#ne.length>0&&!Q(this.#ne.at(-1))&&this.#gt(this.#ne))},{passive:!0}),Z(document,`keydown`,e=>{e.key===`Shift`&&(this.#Q=this.#ne?.at(-1))},{passive:!0}),Z(document,`keyup`,e=>{e.key===`Shift`&&(this.#Q=void 0)},{passive:!0})]}#Pe(e){this.#p?.forEach(e=>e()),this.#p=e}#Fe(){return this.#P?.options.enableLineSelection===!0}#Ie(){this.#G=this.#ne!==void 0}#Le(e,t){let{onFocus:n,onBlur:r}=this.#e,i=t=>{let n=t.composedPath()[0];return n!==void 0&&(n===e||e.contains(n))};this.#d?.forEach(e=>e()),this.#d=[Z(e,`focus`,()=>{this.#K=!0,n?.(),!this.#X&&!this.#W&&this.#ne!==void 0&&this.#ne.length>0&&this.#nt(this.#ne.at(-1))},{passive:!0}),Z(e,`blur`,()=>{this.#q?.target===e&&(this.#q=void 0,this.#W=!1),this.#K=!1,r?.()},{passive:!0}),Z(e,`pointerdown`,t=>{if(this.#U=!0,this.#G=!1,t.pointerType===`mouse`){if(this.#st(t)){this.#pt(!0),this.#ne!==void 0&&this.#gt([]);return}if(this.#pt(!1),this.#B?.removePopover(),Ee()&&this.#I!==void 0&&this.#I.length>0){let t=[...e.querySelectorAll(`[data-line-annotation]`)].map(e=>[Z(e,`mouseenter`,()=>{this.#W=!0}),Z(e,`mouseleave`,()=>{this.#W=!1})]).flat();this.#Pe(t)}if(this.#X=!0,this.#Q=void 0,t.button===0&&Au(t)&&(this.#ee=this.#ne?.map(e=>({...e}))),t.shiftKey){let e=this.#ne?.at(-1);if(e!==void 0){let t=e.direction===-1?e.end:e.start;this.#nt({start:t,end:t,direction:0})}this.#Z=!0}}},{passive:!0}),Z(e,`keydown`,e=>{if(!i(e))return;this.#U=!0,this.#G=!1;let t=Iu(e,this.#e.keymap);if(t!==void 0){e.preventDefault(),t===`simplifySelection`&&(this.#V?.close(),this.#V=void 0,this.#ce=!1,this.#H?.cleanup(),this.#H=void 0),this.#Ve(t);return}let n=ju(e),r=this.#L;if(this.#ne!==void 0&&this.#ne.length>0&&n!==void 0&&r!==void 0){let t={getSoftLineOffsets:this.#we?e=>this.#Gt(e):void 0,resolveRenderableLine:this.#be};e.shiftKey?this.#gt(Ad(r,this.#ne,n,t)):this.#gt(wd(r,this.#ne,n,t)),this.#rt(),e.preventDefault();return}if((e.key.length===1?e.key.toLowerCase():e.key)===`v`&&Au(e)){if(e.repeat&&this.#Ce){e.preventDefault();return}if(this.#e.clipboard!==void 0){e.preventDefault(),$e(this.#Re);return}}if(this.#V!==void 0){let t=Lu(e);if(t!==void 0){e.preventDefault(),this.#V.navigate(t===`previous`);return}}}),Z(e,`copy`,e=>{i(e)&&(e.preventDefault(),this.#dt()?e.clipboardData?.setData(`text`,this.#ft()):this.#Dt(e.clipboardData,this.#Tt(),this.#Et()))}),Z(e,`cut`,e=>{if(i(e))if(e.preventDefault(),this.#dt())e.clipboardData?.setData(`text`,this.#ft());else{let t=this.#Et();this.#Dt(e.clipboardData,this.#Ot(),t)}}),Z(e,`paste`,e=>{if(!i(e))return;e.preventDefault();let t=e.clipboardData,n=this.#L;if(t===null||n===void 0)return;let r=t.getData(`text`),a=this.#ne?.length??0;if(a>1){let e=t.getData(Bp);if(e!==void 0)try{let t=JSON.parse(e);Array.isArray(t)&&t.length===a&&(r=t)}catch{}}this.#At(Array.isArray(r)?r.map(e=>n.normalizeEol(e)):n.normalizeEol(r),void 0,!0,`document`)}),Z(e,`beforeinput`,e=>{i(e)&&e.inputType!==`insertCompositionText`&&(e.preventDefault(),this.#Xe(e.inputType,e.data))}),Z(e,`drop`,e=>{i(e)&&e.preventDefault()}),Z(e,`compositionstart`,e=>{i(e)&&(this.#J=!0,this.#W=!0)},{passive:!0}),Z(e,`compositionend`,e=>{if(!i(e))return;this.#W=!1;let t=this.#J;this.#J=!1,(e.data!==``||!t)&&this.#Xe(`insertText`,e.data)},{passive:!0})];let a=this.#D?.shadowRoot?.querySelector(`[data-deletions]`);if(a!=null&&this.#d.push(Z(a,`pointerdown`,e=>{let t=e.composedPath();if(Ie(t)){this.#Ie();return}let n=t[0],r=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(r instanceof HTMLElement){if(this.#Fe()){this.#Ie();return}if(this.#ut(r,a,e.pointerType===`mouse`))return}this.#pt(!0),this.#ne!==void 0&&this.#gt([])},{passive:!0})),t!==void 0){let e=(e,t=!1)=>{let n=e;return n?.dataset.lineNumberContent===void 0?t&&n?.tagName===`SPAN`&&(n=n.closest(`[data-line]`)):n=n.parentElement??void 0,n},n=e=>{if(e===void 0)return;let t=e.dataset.lineType,n=Ju(e)??Ju(e,`columnNumber`);if(!(n===void 0||t===void 0||!Wd(t)))return n-1};this.#d.push(Z(t,`pointerdown`,t=>{let r=t.composedPath();if(Ie(r)){this.#Ie();return}let i=e(r[0]);if(i!==void 0&&this.#Fe()){this.#Ie();return}if(i?.dataset.lineType===`change-deletion`){let e=i.closest(`[data-code]`);e!=null&&this.#ut(i,e,t.pointerType===`mouse`);return}if(t.pointerType!==`mouse`)return;let a=this.#L,o=n(i);if(o===void 0||a===void 0)return;this.#U=!0,this.#B?.removePopover();let s=this.#ot(o,o,a);this.#Y=!0,this.#Q=s,this.#gt([s]),this.#nt(s),this.#Ze(),this.#Pe([Z(document,`mousemove`,t=>{if(!this.#Y)return;let r=this.#L,i=n(e(t.composedPath()[0],!0));if(i===void 0||r===void 0)return;let a=this.#Q?.start.line??i,o=this.#ot(a,i,r);this.#Q??=o,this.#gt([o]),this.#Ze(o.direction===-1?o.start:o.end)},{passive:!0})])},{passive:!0}))}this.#B?.listenHover(e),this.#N?.disconnect(),this.#N=new ResizeObserver(this.#qe),this.#N.observe(e),this.#N.observe(e.parentElement),this.#ze(e)}#Re=async()=>{let e=this.#e.clipboard;if(e!==void 0){let t=await e.readText(),n=this.#ne?.length??0;if(n>1){let r=await e.readText(Bp);try{let e=JSON.parse(r);Array.isArray(e)&&e.length===n&&(t=e)}catch{}}let r=this.#L;r!==void 0&&this.#At(Array.isArray(t)?t.map(e=>r.normalizeEol(e)):r.normalizeEol(t),void 0,!0,`document`)}};#ze(e){this.#Ce&&this.#Se===`split`&&this.#we&&(this.#g={top:e.offsetTop,left:e.offsetLeft-this.#Bt()},this.#e.__debug===!0&&console.log(`[diffs/editor] content offset:`,this.#g))}get#Be(){if(this.#Ce&&this.#Se===`split`&&this.#we)return this.#g}#Ve(e){let t=this.#L;if(t!==void 0)switch(e){case`openSearchPanel`:this.#Ct(`find`);break;case`openSearchReplacePanel`:this.#Ct(`replace`);break;case`findNextMatch`:{let e=this.#ne;if(e===void 0)break;if(e.some(Q)){let n=e.map(e=>Q(e)?hf(t,e):e);this.#gt(n),this.focus()}else{let n=tf(t,e);if(n!==void 0){this.#gt(n);let e=n.at(-1);e!==void 0&&this.#xe(Ud(e).line),this.#rt()}}break}case`moveLineUp`:case`moveLineDown`:this.#Ke(e===`moveLineUp`?-1:1);break;case`copyLineUp`:case`copyLineDown`:this.#We(e===`copyLineUp`?-1:1);break;case`simplifySelection`:{let e=this.#ne,t=e?.at(-1);if(e===void 0||t===void 0)break;if(e.length>1)this.#gt([t]),this.#Ze(Ud(t));else if(!Q(t)){let e=Ud(t);this.#gt([{start:e,end:e,direction:0}]),this.#Ze(e)}break}case`insertBlankLine`:this.#Ge();break;case`deleteHardLineForward`:this.#Pt();break;case`toggleComment`:case`toggleBlockComment`:{let n=this.#ne;if(n===void 0)break;let{lineComment:r,blockComment:i}=Hu(t.languageId,this.#e.languageCommentConfig);if(e===`toggleComment`&&r!==null){this.#Ue(Uu(t,n,r));break}let a=e===`toggleComment`,o=qu(t,n,i,a);o!==void 0&&this.#Ue(o.edits,a?void 0:e=>o.nextSelectionOffsets.map(([t,n,r])=>({start:e.positionAt(t),end:e.positionAt(n),direction:r})));break}case`indent`:case`outdent`:case`indentLess`:case`indentMore`:if(this.#ne!==void 0){let n=[],r=[],i=new Set,a=[];for(let o of this.#ne){let s=o.start.line,c=e===`outdent`||e===`indentLess`,l=e===`indentLess`||e===`indentMore`;if(s!==o.end.line||c||l){let e=Cd(t,o,this.#t.tabSize,c);for(let t of e[0]){let e=t.range.start.line;i.has(e)||(i.add(e),n.push(t))}r.push(e[1])}else{let e=t.charAt({line:s,character:0})===` `?` `:` `.repeat(this.#t.tabSize);n.push({range:o,newText:e}),a.push({line:s,startCharacter:o.start.character,addedLength:e.length-(o.end.character-o.start.character),selectionIndex:r.length});let i={line:o.start.line,character:o.start.character+e.length};r.push({start:i,end:i,direction:0})}}for(let e of a){let t=0;for(let n of a)n.line===e.line&&n.startCharacter<e.startCharacter&&(t+=n.addedLength);if(t!==0){let n=r[e.selectionIndex],i={line:e.line,character:n.start.character+t};r[e.selectionIndex]={start:i,end:i,direction:0}}}let o=t.applyEdits(n,!0,this.#ne,r);o!==void 0&&this.#It(o,r)}break;case`selectAll`:{let e=nf(t);this.#gt([e]),this.focus();let n=this.#Rt(),r=n[0]?.[0],i=n.at(-1)?.[1];r!==void 0&&i!==void 0&&(this.#G=!0,this.#nt({start:{line:r,character:0},end:{line:i,character:t.getLineLength(i)},direction:1}));break}case`moveCursorToDocStart`:case`moveCursorToDocEnd`:{let n=rf(t,e===`moveCursorToDocEnd`,this.#Ce);this.#gt([n]),this.#xe(Ud(n).line),this.#rt()}break;case`expandSelectionDocStart`:case`expandSelectionDocEnd`:{let n=e===`expandSelectionDocEnd`,r=this.#ne;if(r!==void 0){let e=rf(t,n,this.#Ce);this.#gt(Zd(r,e)),this.#xe(Ud(e).line),this.#rt()}}break;case`undo`:case`redo`:this.#He(e);break}}#He(e){let t=this.#L;if(t===void 0||e===`undo`&&!t.canUndo||e===`redo`&&!t.canRedo)return;let n=this.#ne,r=n?.map(e=>[t.offsetAt(e.start),t.offsetAt(e.end)]),i=e===`undo`?t.undo():t.redo();if(i===void 0)return;let[a,o,s,c]=i,l=o??(n!==void 0&&r!==void 0&&c!==void 0?Jd(t,n,r,c):void 0);this.#It(a,l,s)}#Ue(e,t){let n=this.#L,r=this.#ne;if(n===void 0||r===void 0)return;let i=t===void 0,a=i?r.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]):void 0,o=i?e.map(e=>{let t=n.offsetAt(e.range.start),r=n.offsetAt(e.range.end);return{start:Math.min(t,r),end:Math.max(t,r),text:e.newText}}).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n}):void 0,s=n.applyEdits(e,!0,r,void 0,!0);if(s===void 0)return;let c=i?Jd(n,r,a,o):t(n);n.setLastUndoSelectionsAfter(c),this.#It(s,c,this.#Lt(s))}#We(e){let t=this.#L,n=this.#ne;if(t===void 0||n===void 0)return;let r=$d(n);if(r.length===0)return;let i=[],a=0,o=[];for(let n of r){i.push(a);let r=n.endLine-n.startLine+1;a+=r;let s=t.getText({start:{line:n.startLine,character:0},end:{line:n.endLine,character:t.getLineLength(n.endLine)}});if(e>0){let e={line:n.startLine,character:0};o.push({range:{start:e,end:e},newText:s+t.eol})}else if(n.endLine<t.lineCount-1){let e={line:n.endLine+1,character:0};o.push({range:{start:e,end:e},newText:s+t.eol})}else{let e={line:n.endLine,character:t.getLineLength(n.endLine)};o.push({range:{start:e,end:e},newText:t.eol+s})}}let s=n.map(t=>{let n=t.start.line,a=0,o=r.length-1;for(;a<=o;){let e=a+o>>>1,t=r[e];if(n<t.startLine)o=e-1;else if(n>t.endLine)a=e+1;else{a=e;break}}let s=Math.max(0,a<=o?a:o),c=r[s],l=i[s]+(e>0?c.endLine-c.startLine+1:0);return{start:{...t.start,line:t.start.line+l},end:{...t.end,line:t.end.line+l},direction:t.direction}});this.#Ue(o,()=>s)}#Ge(){let e=this.#L,t=this.#ne;if(e===void 0||t===void 0)return;let n=t.map(e=>Ud(e).line),r=Array.from(new Set(n)).sort((e,t)=>e-t),i=new Map,a=new Map,o=[];for(let t=0;t<r.length;t++){let n=r[t],s=e.getLineText(n),c=/^\s*/.exec(s)?.[0]??``;i.set(n,t),a.set(n,c);let l={line:n,character:e.getLineLength(n)};o.push({range:{start:l,end:l},newText:e.eol+c})}let s=t.map((e,t)=>{let r=n[t],o={line:r+1+i.get(r),character:a.get(r).length};return{start:o,end:o,direction:0}});this.#Ue(o,()=>s)}#Ke(e){let t=this.#L,n=this.#ne;if(t===void 0||n===void 0)return;let r=$d(n);if(r.length===0||e<0&&r[0].startLine===0||e>0&&r.at(-1).endLine>=t.lineCount-1)return;let i=t.lineCount,a=e=>e<i-1?{line:e+1,character:0}:{line:e,character:t.getLineLength(e)},o=(e,n)=>{let r=e.map(e=>t.getLineText(e)).join(t.eol);return n?r+t.eol:r},s=[];if(e<0)for(let e of r){let t=e.startLine-1,n=[];for(let t=e.startLine;t<=e.endLine;t++)n.push(t);s.push({range:{start:{line:t,character:0},end:a(e.endLine)},newText:o([...n,t],e.endLine<i-1)})}else for(let e=r.length-1;e>=0;e--){let t=r[e],n=t.endLine+1,c=[];for(let e=t.startLine;e<=t.endLine;e++)c.push(e);s.push({range:{start:{line:t.startLine,character:0},end:a(n)},newText:o([n,...c],n<i-1)})}let c=r.at(-1),l=e>0&&c.endLine===i-2?t.getLineLength(c.endLine):t.getLineLength(i-1),u=n.map(n=>ef(n,e,i,e=>e===i-1?l:t.getLineLength(e))),d=t.applyEdits(s,!0,n,u,!0);d!==void 0&&this.#It(d,u)}#qe=()=>{let e=this.#I?.length??0,t=this.#_,n=this.#v;this.#_=void 0,this.#v=void 0;let r=this.#Bt()!==t,i=this.#Vt()!==n;!r&&!i||(this.#x.clear(),this.#S=void 0,this.#t.clearTextWidthCache(),i&&(this.#b.clear(),(this.#we||e>0)&&this.#y.clear()),(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&(this.#gt(this.#ne??[]),this.#ne!==void 0&&this.#K&&this.focus()),this.#B?.removePopover(),this.#ze(this.#k))};#Je(){if(this.#le)return;let e=document.fonts;e!==void 0&&(this.#le=!0,e.ready.then(()=>{this.#k===void 0||!this.#t.remeasureCharacterWidth()||(this.#_=void 0,this.#v=void 0,this.#Ee(),this.#b.clear(),(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&this.#gt(this.#ne??[]),this.#B?.removePopover())}))}#Ye(e,t,n=this.#R,r){let i=this.#n,a=this.#P,o=this.#L,s=this.#O,c=this.#k;if(i===void 0||a===void 0||o===void 0||c===void 0)return;i.stopBackgroundTokenize();let l=performance.now(),u=i.tokenize(e,n,!this.#Ce),d=performance.now();if(u.size>0){let e=c.children,t=new Set;for(let e of u.keys())this.#ye(e)&&t.add(e);for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0){let e=Ju(r),n=r.dataset.lineType;if(e===void 0||n===`change-deletion`)continue;let i=e-1;if(t.has(i)){let e=u.get(i);if(r.replaceChildren(...Mp(e)),t.delete(i),t.size===0)break}}}if(t.size>0){let n=0;for(let t=e.length-1;t>=0;t--){let r=e[t],i=Ju(r);if(i!==void 0&&r.dataset.lineType!==`change-deletion`){n=i;break}}for(let e of t){if(e<n)continue;let t=u.get(e),r=String(e+1);X(`div`,{dataset:{line:r,lineType:`context`,lineIndex:e.toString()},children:Mp(t)},c),s!==void 0&&X(`div`,{dataset:{lineType:`context`,columnNumber:r,lineIndex:e.toString()},children:[X(`span`,{dataset:{lineNumberContent:``},textContent:r})]},s)}}}if(e.lineDelta<0)for(let t of[c.children,s?.children??[]])for(let n=t.length-1;n>=0;n--){let r=t[n],i=Ju(r)??Ju(r,`columnNumber`),a=r.dataset.lineType;if(!(i===void 0||a===`change-deletion`)){if(i-1<e.lineCount)break;r.remove()}}let f=e.lineDelta!==0;if(f){let e=c.children.length;for(let t of c.children){let{bufferSize:n}=t.dataset;n!==void 0&&(e+=parseInt(n)-1)}c.style.gridRow=`span `+e,s!==void 0&&(s.style.gridRow=`span `+e)}a.updateRenderCache(u,i.themeType,{shouldRefreshDiffsView:this.#Ce&&!f,lineCountChangeInFlight:f}),f&&a.applyDocumentChange(o,t,r),(f||this.#Ce&&this.#Se===`unified`)&&this.#Ee(),t!==void 0&&(this.#I=t,dd(t,c,s)),this.#e.__debug===!0&&console.log(`[diffs/editor] re-render in: ${Qu(performance.now()-d)}ms,`,`tokenize in: ${Qu(d-l)}ms (${u.size} dirty lines)`)}#Xe(e,t){switch(e){case`insertText`:{let e=t??``,n=this.#L,r=this.#ne,i=n!==void 0&&r!==void 0?Id(n,r,e,this.#e.autoSurround):void 0;this.#At(i??e);break}case`insertCompositionText`:break;case`insertLineBreak`:case`insertParagraph`:this.#At(this.#L?.eol??`
|
|
2186
|
+
`);break;case`deleteContentBackward`:this.#jt();break;case`deleteContentForward`:this.#jt(!0);break;case`deleteSoftLineBackward`:case`deleteHardLineBackward`:this.#Mt();break;case`deleteWordBackward`:this.#Nt();break;case`insertTranspose`:this.#Ft();break;default:console.warn(`[diffs] Unknown input type: ${e}`,t);break}}#Ze(e,t=!0,n){this.#K=!0,e===void 0?n?.()===!1?this.#K=!1:this.#k?.focus({preventScroll:t}):(this.#W=!0,this.#nt({start:e,end:e,direction:0}),$e(()=>{if(n?.()===!1||!this.#K){this.#W=!1;return}this.#k?.focus({preventScroll:t}),$e(()=>{this.#W=!1})}))}#Qe(e){let t=this.#q;if(t==null)return;if(this.#ce){this.#q=void 0,this.#K=!1,this.#W=!1;return}let n=this.#k;if(n==null||!this.#$e(n)){this.#q=void 0,this.#K=!1;return}let r=()=>{if(this.#q!==t)return!1;let e=this.#$e(n);return this.#q=void 0,e};if(e!=null){this.#Ze(e,!0,r);return}let i=this.#ne?.at(-1);if(i==null){this.#Ze(void 0,!0,r);return}let a=i.direction===-1?i.end:i.start;this.#Ze(a,!0,r)}#$e(e){let t=this.#D,n=t?.shadowRoot;if(t==null||n==null||this.#k!==e||!n.contains(e))return!1;let{activeElement:r}=n;if(r===e||r!=null&&e.contains(r))return!0;if(r!=null)return!1;let{ownerDocument:i}=t,{activeElement:a}=i;return a==null||a===i.body||a===i.documentElement||a===t}#et(e=0){let t=this.#k,n=this.#D;if(this.#L==null||t==null||n==null)return;let r=this.#Ae();if(r===void 0)return;let i,a;if(r instanceof HTMLElement){let e=r.getBoundingClientRect();i=e.top,a=e.bottom}else i=0,a=r.defaultView?.innerHeight??0;let o=n.shadowRoot?.querySelector(`[data-diffs-header][data-sticky]`);if(o!=null&&(i=Math.max(i,o.getBoundingClientRect().bottom)),Number.isFinite(e)&&(i+=Math.max(0,e)),!(a<=i))for(let e of t.children){let t=e,n=Ju(t),r=t.dataset.lineType;if(n==null||r==null||!Wd(r))continue;let o=t.getBoundingClientRect();if(!(o.bottom<=o.top)&&o.top>=i&&o.top<a)return n}}#tt(e,t){let n={start:e,end:e,direction:0};this.#U=!1,this.#gt([n]),this.#xe(e.line),t?this.#Ze(e,!0):this.#rt()}#nt(e){let t=window.getSelection();if(t===null)return;let{start:n,end:r,direction:i}=e;$(n,r)>0&&([n,r]=[r,n]);let a=this.#zt(n.line),o=this.#zt(r.line);if(a===void 0||o===void 0)return;let[s,c]=mf(a,n.character),[l,u]=mf(o,r.character);i===-1&&([s,c,l,u]=[l,u,s,c]);try{t.setBaseAndExtent(s,Yu(s,c),l,Yu(l,u))}catch(e){console.error(`[diffs/editor] failed to update window selection:`,e)}}#rt(e=!1,t=`nearest`){let n=this.#ne?.at(-1);if(n===void 0)return;let r=this.#M;if(r!==void 0){if(r.scrollIntoView({block:t,inline:`nearest`}),!e){let e=n.direction===-1?n.end:n.start;this.#q===void 0?this.#Ze(e):this.#Qe(e)}}else{let t=Ud(n);this.#at(t.line,t.character,e)}}#it(){let e=this.#V===void 0?0:48,t=this.#Bt()+this.#t.ch;return`${e}px ${this.#t.ch}px 0 ${t}px`}#at(e,t=0,n=!1){this.__postponeBgTokenizeToNextFrame();let r=X(`div`,{style:{position:`absolute`,left:`0`,width:`2px`,height:this.#t.lineHeight+`px`,scrollMargin:this.#it()}});if(this.#zt(e)!==void 0){let[i,a]=this.#Ut(e,t),o=this.#Ht(e)+a*this.#t.lineHeight;if(r.style.top=o+`px`,r.style.left=i+`px`,this.#A?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),!n){let n={line:e,character:t};this.#q===void 0?this.#Ze(n):this.#Qe(n)}this.#ie=void 0,this.#ae=void 0,this.#oe=!1,this.#se=!1}else{let i=this.#P?.getLinePosition?.(e+1);if(i!==void 0)r.style.top=i.top+`px`,this.#D?.shadowRoot?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),i.height>0&&this.#ye(e)?(this.#ie=e,this.#ae=t,this.#se=n):(this.#ie=void 0,this.#ae=void 0,this.#se=!1);else{let i=0;if(this.#ie===e&&this.#k!==void 0)for(let t=this.#k.childElementCount-1;t>=0;t--){let n=this.#k.children[t],r=n.dataset.lineType,a=Ju(n);if(r!==void 0&&Wd(r)&&a!==void 0){i=(e-(a-1))*this.#t.lineHeight;break}}let a=((this.#I??[]).filter(t=>t.lineNumber<e).length+e)*this.#t.lineHeight+i;r.style.top=a+`px`,this.#D?.shadowRoot?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),this.#ie===e&&(i===0||this.#oe)||!this.#ye(e)?(this.#ie=void 0,this.#ae=void 0,this.#oe=!1,this.#se=!1):(this.#ie=e,this.#ae=t,this.#oe=i!==0,this.#se=n)}}r.remove()}#ot(e,t,n){let r=e=>({line:e,character:0}),i=e=>({line:e,character:n.getLineText(e).length});return t<e?{start:r(t),end:i(e),direction:-1}:{start:r(e),end:i(t),direction:1}}#st(e){let t=e.composedPath()[0];return t instanceof HTMLElement&&t.closest(`[data-line]`)?.getAttribute(`data-line-type`)===`change-deletion`}#ct(e,t,n){let r=[...n.querySelectorAll(`[data-content] > [data-line]`)],i=r.indexOf(e),a=r.indexOf(t),[o,s]=a<i?[t,e]:[e,t],c=window.getSelection();if(c!==null){let e=document.createRange();e.setStart(o,0),e.setEnd(s,s.childNodes.length),c.removeAllRanges(),c.addRange(e)}this.#pt(!0),this.#gt([]),this.#mt(Ju(t)??null,!0,`deletions`);let l=Math.min(i,a),u=Math.max(i,a);this.#$=l<0?``:r.slice(l,u+1).filter(e=>e.getAttribute(`data-line-type`)===`change-deletion`).map(e=>e.textContent??``).join(`
|
|
2187
2187
|
`)}#lt(e,t){let n=e.parentElement;if(n==null||t==null)return;let r=[...n.children].indexOf(e),i=t.children[r];return i instanceof HTMLElement?i:void 0}#ut(e,t,n){let r=t.querySelector(`[data-content]`),i=this.#lt(e,r);return i===void 0?!1:(this.#ct(i,i,t),n&&this.#Pe([Z(document,`mousemove`,e=>{let n=e.composedPath()[0],a=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(a instanceof HTMLElement&&t.contains(a)){let e=this.#lt(a,r);e!==void 0&&this.#ct(i,e,t)}},{passive:!0})]),!0)}#dt(){return this.#D?.shadowRoot?.querySelector(`pre`)?.hasAttribute(`data-deleted-text-selection`)??!1}#ft(){return this.#$===``?window.getSelection()?.toString()??``:this.#$}#pt(e){let t=this.#D?.shadowRoot?.querySelector(`pre`);t!=null&&(e?(t.setAttribute(`data-deleted-text-selection`,``),this.#mt(null),this.#$=``):(t.removeAttribute(`data-deleted-text-selection`),this.#$=``))}#mt(e,t=!1,n=`additions`){try{this.#P?.setEditorActiveLine(e,{lineNumberOnly:t,side:n})}catch{}}#ht(){this.#ue===void 0&&(this.#ue=requestAnimationFrame(()=>{this.#ue=void 0,(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&this.#gt(this.#ne??[])}))}#gt(e){if(this.__postponeBgTokenizeToNextFrame(),this.#M=void 0,this.#mt(null),e.length===0&&this.#re===void 0&&this.#B===void 0){this.#ne=void 0,this.#j?.forEach(e=>e.remove()),this.#j?.clear(),this.#H?.cleanup(),this.#H=void 0;return}let t=document.createDocumentFragment(),n={fragment:t,elements:new Map};if(e.length>0){let t=Qd(e),r=t.at(-1);this.#ne=t;let i=t.some(e=>!Q(e)),a=Ud(r).line+1;this.#mt(a,i);for(let e of t)Q(e)||this.#_t(n,`selection`,e),this.#xt(n,e,e===r);let o=this.#e.matchBrackets!==!1&&this.#L!==void 0&&this.#n!==void 0&&Q(r)?Yf(this.#L,this.#n,r.start):void 0;if(o!==void 0)for(let e of o)this.#_t(n,`bracketMatch`,e)}let r=this.#L;if(this.#re!==void 0&&r!==void 0){let e=this.#re,t=this.#R,i=t!==void 0&&Number.isFinite(t.totalLines)||this.#Ce&&this.#P?.options.expandUnchanged!==!0?this.#Rt():void 0,a=this.#ne?.at(-1),o=a===void 0?-1:r.offsetAt(a.start),s=a===void 0?-1:r.offsetAt(a.end),c=0,l=i?.length??1;for(let t=0;t<l;t++){let a=1/0,l=i?.[t];if(l!==void 0){let[t,n]=l,i=r.offsetAt({line:t,character:0}),o=n+1;a=o<r.lineCount?r.offsetAt({line:o,character:0}):r.offsetAt({line:o-1,character:r.getLineLength(o-1)});let s=c,u=e.length;for(;s<u;){let t=s+Math.floor((u-s)/2);e[t][1]<=i?s=t+1:u=t}c=s}for(;c<e.length;c++){let[t,i]=e[c];if(t>=a)break;let l={start:r.positionAt(t),end:r.positionAt(i)},u=o===t&&s===i;this.#_t(n,`match`,l,u?`focus`:void 0)}}}if(this.#B!==void 0&&r!==void 0)for(let e of this.#B.markers)this.#_t(n,`marker`,e,Wf(e.severity));this.#A?.appendChild(t),this.#j?.forEach(e=>e.remove()),this.#j?.clear(),this.#j=n.elements,this.#St()}#_t(e,t,n,r){if(this.#L===void 0)return;let{start:i,end:a}=n,o=i.line,s=a.line+1;if(this.#R!==void 0){let{startingLine:e,totalLines:t}=this.#R;o=Math.max(o,e),s=Math.min(s,e+t)}for(let n=o;n<s;n++){if(!this.#qt(n))continue;let o=n===a.line,s=n===i.line?i.character:0,c=o?a.character:this.#L.getLineLength(n);if(this.#we){let i=this.#Vt(),a=this.#L.getLineText(n);if(2*this.#t.ch+this.#t.measureTextWidth(a)>i){this.#vt(e,n,a,s,c,o,t,r);continue}}let l=0,u=0,d=0;l=s===0?this.#Bt()+this.#t.ch+(this.#Be?.left??0):this.#Ut(n,s)[0],!o&&t===`selection`&&(d=this.#t.ch),u=s===c?d:this.#Ut(n,c)[0]-l+d,this.#bt(e,t,n,0,l,u,r)}}#vt(e,t,n,r,i,a,o,s){let c=this.#Gt(t),l=c.length-1,u=this.#Bt()+this.#t.ch+(this.#Be?.left??0);for(let d=0;d<l;d++){let f=c[d],p=c[d+1],m=Math.max(r,f),h=Math.min(i,p);if(m>h)continue;let g=this.#yt(n,f,m),_=u+g,v=0;!a&&d===l-1&&o===`selection`&&(v=this.#t.ch);let y=m===h?v:this.#yt(n,f,h)-g+v;this.#bt(e,o,t,d,_,y,s)}}#yt(e,t,n){if(n<=t)return 0;let r=e.slice(t,n),i=Dp(r,this.#t.tabSize);return i===-1?this.#t.measureTextWidth(r):i*this.#t.ch}#bt(e,t,n,r,i,a,o){if(a===0)return;let{ch:s,lineHeight:c}=this.#t,l=this.#Ht(n)+r*c,u=`${t}-${n}/${r}-${i}-${a} ${o??``}`,d=this.#j,f=(this.#e.roundedSelection??!0)&&t===`selection`,p=(n,r,i,a)=>{let o=this.#Ht(n)+r*c,l=this.#zt(n),u=`initial`;l!==void 0&&(l.dataset.lineType===`change-addition`||l.dataset.selectedLine!==void 0)&&(u=getComputedStyle(l).getPropertyValue(`--diffs-line-bg`));let f=`width:${s}px;transform:translateX(${i}px) translateY(${o}px);--diffs-selection-corner-bg:${u}`,p={selectionCorner:``,[a]:``},m=`${t}-block-${n}/${r}-${i}-1ch`,h=m+`-`+a;if(a===`rbl`){let t=m+`-rtl`,n=e.elements.get(t);n!==void 0&&(n.remove(),e.elements.delete(t),h+=`-rtl`,p.rtl=``)}let g=e.elements.get(h);g===void 0&&(d?.has(h)===!0?(g=d.get(h),g.style.cssText=f,d.delete(h)):g=X(`div`,{dataset:`selectionRange`,style:{cssText:f},children:[X(`div`,{dataset:p})]},e.fragment),e.elements.set(h,g))},m=t=>{let o=i+a,c=t.dataset,l=e.previousSelectionRange;if((l===void 0||l.line!==n||l.wrapLine!==r)&&(e.previousSelectionRange={element:t,line:n,wrapLine:r,left:i,width:a}),l===void 0||o<=l.left)[`rtl`,`rtr`,`rbl`,`rbr`].forEach(e=>{c[e]=``});else{let e=l.line,t=l.wrapLine,a=l.left,u=l.element.dataset,d=a+l.width;a>i&&p(e,t,a-s,`rbr`),delete u.rbl,delete c.rtl,delete c.rtr,o>=d&&delete u.rbr,o>d&&(p(e,t,d,`rbl`),c.rtr=``),o<d&&p(n,r,o,`rtl`),i<a&&(c.rtl=``),c.rbl=``,c.rbr=``}},h=e.elements.get(u);if(h!==void 0){f&&m(h);return}d?.has(u)===!0?(h=d.get(u),d.delete(u)):h=X(`div`,{dataset:o?[t+`Range`,o]:t+`Range`},e.fragment),h.style.width=`${a}px`,h.style.transform=`translateX(${i}px) translateY(${l}px)`,f&&m(h),e.elements.set(u,h)}#xt(e,t,n){let{line:r,character:i}=Ud(t);if(!this.#qt(r))return;let[a,o]=this.#Ut(r,i),s=`caret-`+r+`/`+o+`:`+i;if(e.elements.has(s))return;let c=X(`div`,{dataset:`caret`,style:{transform:`translateX(${a-1}px) translateY(${this.#Ht(r)+o*this.#t.lineHeight}px)`}},e.fragment);e.elements.set(s,c),n&&(c.style.scrollMargin=this.#it(),this.#M=c)}#St(){let e=this.#ne?.at(-1),t=this.#A,n=this.#L,r=this.#e.renderSelectionAction,i=()=>{this.#H?.cleanup(),this.#H=void 0};if(this.#e.enabledSelectionAction!==!0||r===void 0||e===void 0||Q(e)||this.#X||t===void 0||n===void 0){i();return}let a=Ud(e);if(!this.#qt(a.line)){i();return}if(this.#H===void 0){if(!this.#U)return;let a=()=>this.#ne?.at(-1)??e,o=r({textDocument:n,get selection(){return a()},applyEdits:e=>this.applyEdits(e),getSelectionText:()=>this.#L?.getText(a())??``,replaceSelectionText:e=>{this.#At(e,[a()])},close:()=>{i(),this.#rt()}});this.#H=new dp(o,t,()=>this.#St()),this.#Te().resetPlacement(zp)}let o=this.#t.lineHeight,s=e.direction===-1,c={placeAbove:s,anchor:a},l=s?{placeAbove:!1,anchor:e.end}:{placeAbove:!0,anchor:e.start},u=this.#H.height,d=e=>{let[t,n]=this.#Ut(e.anchor.line,e.anchor.character),r=this.#Ht(e.anchor.line)+n*o,i=e.placeAbove?r:r+o,a=e.placeAbove?i-u:i;return{top:a,bottom:a+u,left:t,anchorTop:i,rowTop:r}},f=d(c),p=n.lineCount,m=s?a.line<3:a.line>=p-3,h=this.#qt(l.anchor.line)?d(l):void 0,g=this.#Te(),_=g.getPlacementBounds(),v=h!==void 0&&g.choosePlacement({preferred:f,fallback:h,viewport:_,popoverHeight:u,atDocumentEdge:m,placementKey:zp})===`fallback`;h===void 0&&g.setPlacement(`preferred`,zp);let{placeAbove:y}=v?l:c,{left:b,anchorTop:x}=v&&h!==void 0?h:f,S=s?f.rowTop:h?.rowTop??-1/0,C=(s?h?.rowTop??1/0:f.rowTop)+(e.end.line>e.start.line&&e.end.character===0?0:o),w=_===void 0||C>_.top&&S<_.bottom;this.#H.reposition(b,x,this.#Bt(),y,w,_)}#Ct(e){if(this.#V!==void 0){this.#V.setMode(e);return}this.#wt(e)}#wt(e){this.#V?.cleanup();let t=this.#L,n=this.#D?.shadowRoot?.querySelector(`pre`),r=this.#ne;if(t===void 0||n==null)return;let i=``,a;if(r!==void 0&&r.length>0){let e=r.at(-1);if(Q(e)){e=hf(t,e),this.#gt([...r.slice(0,-1),e]);let n=t.getText(e);n!==``&&!n.includes(`
|
|
2188
|
-
`)&&(i=n,a=[t.offsetAt(e.start),t.offsetAt(e.end)])}}let o=([e,n],r)=>{let i=Kd(t,e,n);this.#gt([i]),this.#xe(Ud(i).line),this.#rt(!0),this.#ce=r},s=new up({textDocument:t,containerElement:n,defaultQuery:i,mode:e,initialMatch:a,scrollToMatch:o,applyReplace:e=>{if(e.length===0)return;let n=t.applyEdits(e.map(e=>({range:{start:t.positionAt(e.start),end:t.positionAt(e.end)},newText:e.text})),!0,this.#ne);n!==void 0&&this.#It(n,void 0,this.#Lt(n),{skipSearchRefresh:!0})},onUpdate:(e,n)=>{if(e.length===0){this.#re=void 0,this.#gt(this.#ne??[]);return}if(this.#re=e,n?.syncSelection===!1){this.#gt(this.#ne??[]);let n=this.#ne?.at(-1);if(n!==void 0){let r=t.offsetAt(n.start),i=t.offsetAt(n.end);for(let t of e)if(t[0]===r&&t[1]===i)return t}return}let r=this.#ne?.at(-1),i=0,a;r!==void 0&&(i=t.offsetAt(r.start));for(let t of e)if(t[0]>=i){a=t;break}return a===void 0?this.#gt(this.#ne??[]):o(a,!0),a},onClose:()=>{this.#V=void 0,this.#ce=!1,this.#re=void 0,this.#gt(this.#ne??[])}});this.#V=s,this.#ce=!1}#Tt(){let e=this.#L,t=this.#ne;return e===void 0||t===void 0?``:cf(e,t)}#Et(){let e=this.#L,t=this.#ne;return e===void 0||t===void 0?[]:sf(e,t)}#Dt(e,t,n){e!==null&&(e.setData(`text`,t),n.length>1&&e.setData(Bp,JSON.stringify(n)))}#Ot(){let e=this.#L,t=this.#ne;if(e===void 0||t===void 0||t.length===0)return``;if(t.some(e=>Q(e))){let n=pf(e,t);return this.#kt(n.edits,n.nextSelectionOffsets),n.text}let n=cf(e,t);return this.#At(``,void 0,!0),n}#kt(e,t){let n=this.#L,r=this.#ne;if(n===void 0||r===void 0||e.length===0)return;let i=n.applyResolvedEdits(e,!0,r,void 0,!0);if(i===void 0)return;let a=t.map(e=>{let t=n.positionAt(e);return{start:t,end:t,direction:0}});n.setLastUndoSelectionsAfter(a),this.#It(i,a,this.#Lt(i))}#At(e,t=this.#ne,n=!1,r=`selection`){if(t===void 0)return;let i=this.#L,a=t.at(-1);if(i===void 0||a===void 0)return;let{nextSelections:o,change:s}=Array.isArray(e)&&e.length===t.length?Pd(i,t,e,this.#I,n,r):jd(i,t,{start:i.offsetAt(a.start),end:i.offsetAt(a.end),text:Array.isArray(e)?e.join(i.eol):e},this.#I,void 0,n);s!==void 0&&this.#It(s,o,this.#Lt(s))}#jt(e=!1){let t=this.#ne,n=this.#L;if(t===void 0||n===void 0)return;let{nextSelections:r,change:i}=Hd(n,t,e,this.#I,this.#t.tabSize);i!==void 0&&this.#It(i,r,this.#Lt(i))}#Mt(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=zd(t,e,this.#we?(e,t)=>{let n=this.#Gt(e);for(let e=0;e+1<n.length;e++){let r=n[e],i=n[e+1];if(t>=r&&t<=i)return r}return 0}:void 0,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#Nt(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Bd(t,e,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#Pt(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Rd(t,e,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#Ft(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Ld(t,e,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#It(e,t,n,r){let i=this.getFile(),a=this.#e.onChange;if(i!==void 0&&a!==void 0){let t=n??this.#I;a(i,t,{changes:e.changes,file:i,lineAnnotations:t})}if(e.lineDelta!==0||this.#we)for(let t of this.#y.keys())t>=e.startLine&&this.#y.delete(t);if(this.#b.size>0)if(e.lineDelta===0&&(e.changedLineRanges.length===1||e.changedLineChanges?.every(([,,e])=>e===0)===!0))for(let[t,n]of e.changedLineRanges)for(let e=t;e<=n;e++)this.#b.delete(e);else for(let t of this.#b.keys())t>=e.startLine&&this.#b.delete(t);this.#S=void 0;let o=this.#R,s;if(o!==void 0&&t!==void 0&&t.length>0){let n=t.at(-1),r=o.startingLine+o.totalLines;if(n.end.line>=r){let t=n.end.line-o.startingLine+1,i=this.#z===void 0||this.#z===1/0?1/0:this.#z*Lp;e.startLine<=r&&t<=i&&this.#ye(n.end.line)?(n.end.line>r&&(s=!0),o={...o,totalLines:t},this.#R=o):s=!0}}if(this.#Ye(e,n,o,s),r?.skipSearchRefresh!==!0&&this.#V!==void 0&&this.#re!==void 0&&this.#V.updateMatches({syncSelection:!1}),t!==void 0&&(this.#gt(t),r?.skipFocus!==!0)){let e=t.at(-1);if(e!==void 0&&this.#xe(Ud(e).line),this.#M!==void 0)requestAnimationFrame(()=>{this.#M?.scrollIntoView({block:`nearest`,inline:`nearest`})});else if(t.length>0){let e=Ud(t.at(-1));this.#at(e.line,e.character)}this.focus({preventScroll:!0})}}#Lt(e){if(this.#I!==void 0){let t=ad(e,this.#I);if(t!==void 0)return this.#L?.setLastUndoLineAnnotations(this.#I,t),t}}#Rt(){let e=this.#k;if(e===void 0)return[];let t=[];for(let n of e.children){let e=n,r=e.dataset.lineType,i=Ju(e);if(i===void 0||r===void 0||!Wd(r))continue;let a=i-1,o=t.at(-1);o!==void 0&&a<=o[1]+1?o[1]=Math.max(o[1],a):t.push([a,a])}return t}#zt(e){let t=this.#x.get(e);if(t!==void 0)return t??void 0;let n=this.#R;if(n!==void 0&&(e<n.startingLine||e>=n.startingLine+n.totalLines))return;let r=this.#k;if(r!==void 0){if(n!==void 0){let{startingLine:i}=n,{children:a}=r;for(let n=e-i;n<=a.length;n++){let r=a[n];if(r===void 0)break;let i=Ju(r),o=r.dataset.lineType;if(i!==void 0&&i===e+1&&o!==void 0&&Wd(o)){t=r;break}}}return t??=r.querySelector(`[data-line="${e+1}"]`+(this.#Se===`unified`?`:not([data-line-type="change-deletion"])`:``)),t!==void 0&&this.#x.set(e,t),t??void 0}}#Bt(){if(this.#O===void 0)return 0;if(this.#_===void 0){let e=this.#k?.parentElement?.style.getPropertyValue(`--diffs-column-number-width`);e!==void 0&&e.length>2&&e.endsWith(`px`)?this.#_=parseInt(e.slice(0,-2),10):this.#_=this.#O.offsetWidth}return this.#_}#Vt(){if(this.#k===void 0)return 0;if(this.#v===void 0){let e=this.#k.parentElement?.style.getPropertyValue(`--diffs-column-content-width`);e!==void 0&&e.length>2&&e.endsWith(`px`)?this.#v=parseFloat(e.slice(0,-2)):this.#v=this.#k.offsetWidth}return this.#v}#Ht(e){let t=this.#y.get(e);if(t!==void 0)return t;let n=this.#zt(e);if(n===void 0)return-1;let r=n.offsetTop+this.#t.paddingTop;return r+=this.#Be?.top??0,this.#y.set(e,r),r}#Ut(e,t){if(this.#S!==void 0&&this.#S[0]===e&&this.#S[1]===t)return[this.#S[2],this.#S[3]];let n=this.#L?.getLineText(e),r=this.#Bt()+this.#t.ch;if(n===void 0||n.length===0||t<=0)return[r+(this.#Be?.left??0),0];let i=Tp(n,Math.min(t,n.length)),a=n.slice(0,i),o=Dp(a,this.#t.tabSize),s=0,c=0;if(s=o===-1?r+this.#t.measureTextWidth(a):r+o*this.#t.ch,this.#we){let t=this.#Vt();if(2*this.#t.ch+this.#t.measureTextWidth(n)>t){let t=this.#Wt(e);if(t==null)return[s+(this.#Be?.left??0),0];for(let e=0;e+1<t.length;e++){let a=t[e];if(i<=t[e+1]){c=e;let t=n.slice(a,i),o=Dp(t,this.#t.tabSize);s=o===-1?r+this.#t.measureTextWidth(t):r+o*this.#t.ch;break}}}s+=this.#Be?.left??0}return this.#S===void 0?this.#S=[e,t,s,c]:(this.#S[0]=e,this.#S[1]=t,this.#S[2]=s,this.#S[3]=c),[s,c]}#Wt(e){let t=this.#b.get(e);if(t!==void 0)return t;this.#b.size>=Rp&&this.#b.clear();let n=this.#L?.getLineText(e);if(n===void 0||n.length===0){let t=new Uint32Array([0]);return this.#b.set(e,t),t}let r=this.#k;if(r==null||!r.isConnected)return;let i=X(`div`,{style:{position:`absolute`,top:`0`,left:`0`,width:`100%`,boxSizing:`border-box`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,font:`inherit`,paddingInline:`1ch`,tabSize:this.#t.tabSize.toString()},textContent:n},r),a=i.firstChild,o=document.createRange(),s=[];try{let t=i.getBoundingClientRect();if(t.width===0)return;let r=Ep(n),c=t.left+this.#t.ch,l=r===void 0?n.length:r.length-1,u=e=>r===void 0?e:r[e],d=e=>(o.setStart(a,u(e)),o.setEnd(a,u(e+1)),o.getBoundingClientRect());s.push(0);let f=d(0).top,p=1;for(;p<l;){let e=p,t=l;for(;e<t;){let n=e+t>>1;d(n).top>f?t=n:e=n+1}if(e>=l)break;let{left:n,top:r}=d(e),i=De()&&n-c>this.#t.ch/2;s.push(u(i?e-1:e)),f=r,p=e+1}let m=new Uint32Array(s.length+1);for(let e=0;e<s.length;e++)m[e]=s[e];return m[s.length]=n.length,this.#b.set(e,m),m}finally{i.remove()}}#Gt(e){let t=this.#Wt(e);if(t!==void 0)return t;let n=this.#L?.getLineText(e)?.length??0;return Uint32Array.of(0,n)}#Kt({startContainer:e,endContainer:t}){let n=this.#k;return n===void 0?!1:n.contains(e)&&n.contains(t)}#qt(e){let t=this.#L?.lineCount??0;return e<0||e>=t?!1:this.#zt(e)!==void 0}},Hp=typeof window>`u`?J.useEffect:J.useLayoutEffect;function Up(e,t,n){let r=e==null?null:(0,Y.jsx)(`div`,{slot:gt,children:e}),i=t!=null&&n!=null?(0,Y.jsx)(`div`,{slot:_t,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Y.jsxs)(Y.Fragment,{children:[r,i]})}function Wp(e,t){return typeof window>`u`&&t!=null?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,Y.jsx)(Y.Fragment,{children:e})}function Gp(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function Kp(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function qp({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),u=(0,J.useRef)(n.getComposition()),d=(0,J.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,J.useCallback)(()=>{s(null)},[]),m=(0,J.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,J.useMemo)(()=>Kp(h,e,f,p,m),[h,p,m,f,e]),_=(0,J.useCallback)(e=>{l(e)},[]);(0,J.useEffect)(()=>{f||s(null)},[f]),Hp(()=>{n.setComposition(g)},[g,n]),Hp(()=>{if(c!=null)return r!=null&&Gp(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=Wp(Up(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,Y.jsx)(ut,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function Jp(e){let[t]=(0,J.useState)(()=>new Wl(e)),n=(0,J.useRef)({timeout:null,model:t});return(0,J.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}var Yp=r(),Xp=e=>{if(typeof e!=`object`||!e)return null;let t=e;return typeof t.getAttribute==`function`?t.getAttribute(`data-item-path`):null};function Zp(e){let t=[],n=[];return{isDragInProgress:()=>n.length>0,handleSelectionChange(e){t=e},handleDragStart(e){if(e.dataTransfer===null)return;let r=null;for(let t of e.composedPath())if(r=Xp(t),r!==null)break;if(r===null)return;let i=t.includes(r)?t:[r],a=i.map(e=>F(e)).filter(e=>e!==null);a.length!==0&&(n=i,e.dataTransfer.setData(de,a.join(` `)))},handleDragEnd(){if(n.length!==0){for(let t of n)e.deselect(t);n=[]}}}}var Qp=`
|
|
2188
|
+
`)&&(i=n,a=[t.offsetAt(e.start),t.offsetAt(e.end)])}}let o=([e,n],r)=>{let i=Kd(t,e,n);this.#gt([i]),this.#xe(Ud(i).line),this.#rt(!0),this.#ce=r},s=new up({textDocument:t,containerElement:n,defaultQuery:i,mode:e,initialMatch:a,scrollToMatch:o,applyReplace:e=>{if(e.length===0)return;let n=t.applyEdits(e.map(e=>({range:{start:t.positionAt(e.start),end:t.positionAt(e.end)},newText:e.text})),!0,this.#ne);n!==void 0&&this.#It(n,void 0,this.#Lt(n),{skipSearchRefresh:!0})},onUpdate:(e,n)=>{if(e.length===0){this.#re=void 0,this.#gt(this.#ne??[]);return}if(this.#re=e,n?.syncSelection===!1){this.#gt(this.#ne??[]);let n=this.#ne?.at(-1);if(n!==void 0){let r=t.offsetAt(n.start),i=t.offsetAt(n.end);for(let t of e)if(t[0]===r&&t[1]===i)return t}return}let r=this.#ne?.at(-1),i=0,a;r!==void 0&&(i=t.offsetAt(r.start));for(let t of e)if(t[0]>=i){a=t;break}return a===void 0?this.#gt(this.#ne??[]):o(a,!0),a},onClose:()=>{this.#V=void 0,this.#ce=!1,this.#re=void 0,this.#gt(this.#ne??[])}});this.#V=s,this.#ce=!1}#Tt(){let e=this.#L,t=this.#ne;return e===void 0||t===void 0?``:cf(e,t)}#Et(){let e=this.#L,t=this.#ne;return e===void 0||t===void 0?[]:sf(e,t)}#Dt(e,t,n){e!==null&&(e.setData(`text`,t),n.length>1&&e.setData(Bp,JSON.stringify(n)))}#Ot(){let e=this.#L,t=this.#ne;if(e===void 0||t===void 0||t.length===0)return``;if(t.some(e=>Q(e))){let n=pf(e,t);return this.#kt(n.edits,n.nextSelectionOffsets),n.text}let n=cf(e,t);return this.#At(``,void 0,!0),n}#kt(e,t){let n=this.#L,r=this.#ne;if(n===void 0||r===void 0||e.length===0)return;let i=n.applyResolvedEdits(e,!0,r,void 0,!0);if(i===void 0)return;let a=t.map(e=>{let t=n.positionAt(e);return{start:t,end:t,direction:0}});n.setLastUndoSelectionsAfter(a),this.#It(i,a,this.#Lt(i))}#At(e,t=this.#ne,n=!1,r=`selection`){if(t===void 0)return;let i=this.#L,a=t.at(-1);if(i===void 0||a===void 0)return;let{nextSelections:o,change:s}=Array.isArray(e)&&e.length===t.length?Pd(i,t,e,this.#I,n,r):jd(i,t,{start:i.offsetAt(a.start),end:i.offsetAt(a.end),text:Array.isArray(e)?e.join(i.eol):e},this.#I,void 0,n);s!==void 0&&this.#It(s,o,this.#Lt(s))}#jt(e=!1){let t=this.#ne,n=this.#L;if(t===void 0||n===void 0)return;let{nextSelections:r,change:i}=Hd(n,t,e,this.#I,this.#t.tabSize);i!==void 0&&this.#It(i,r,this.#Lt(i))}#Mt(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=zd(t,e,this.#we?(e,t)=>{let n=this.#Gt(e);for(let e=0;e+1<n.length;e++){let r=n[e],i=n[e+1];if(t>=r&&t<=i)return r}return 0}:void 0,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#Nt(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Bd(t,e,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#Pt(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Rd(t,e,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#Ft(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Ld(t,e,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#It(e,t,n,r){let i=this.getFile(),a=this.#e.onChange;if(i!==void 0&&a!==void 0){let t=n??this.#I;a(i,t,{changes:e.changes,file:i,lineAnnotations:t})}if(e.lineDelta!==0||this.#we)for(let t of this.#y.keys())t>=e.startLine&&this.#y.delete(t);if(this.#b.size>0)if(e.lineDelta===0&&(e.changedLineRanges.length===1||e.changedLineChanges?.every(([,,e])=>e===0)===!0))for(let[t,n]of e.changedLineRanges)for(let e=t;e<=n;e++)this.#b.delete(e);else for(let t of this.#b.keys())t>=e.startLine&&this.#b.delete(t);this.#S=void 0;let o=this.#R,s;if(o!==void 0&&t!==void 0&&t.length>0){let n=t.at(-1),r=o.startingLine+o.totalLines;if(n.end.line>=r){let t=n.end.line-o.startingLine+1,i=this.#z===void 0||this.#z===1/0?1/0:this.#z*Lp;e.startLine<=r&&t<=i&&this.#ye(n.end.line)?(n.end.line>r&&(s=!0),o={...o,totalLines:t},this.#R=o):s=!0}}if(this.#Ye(e,n,o,s),r?.skipSearchRefresh!==!0&&this.#V!==void 0&&this.#re!==void 0&&this.#V.updateMatches({syncSelection:!1}),t!==void 0&&(this.#gt(t),r?.skipFocus!==!0)){let e=t.at(-1);if(e!==void 0&&this.#xe(Ud(e).line),this.#M!==void 0)requestAnimationFrame(()=>{this.#M?.scrollIntoView({block:`nearest`,inline:`nearest`})});else if(t.length>0){let e=Ud(t.at(-1));this.#at(e.line,e.character)}this.focus({preventScroll:!0})}}#Lt(e){if(this.#I!==void 0){let t=ad(e,this.#I);if(t!==void 0)return this.#L?.setLastUndoLineAnnotations(this.#I,t),t}}#Rt(){let e=this.#k;if(e===void 0)return[];let t=[];for(let n of e.children){let e=n,r=e.dataset.lineType,i=Ju(e);if(i===void 0||r===void 0||!Wd(r))continue;let a=i-1,o=t.at(-1);o!==void 0&&a<=o[1]+1?o[1]=Math.max(o[1],a):t.push([a,a])}return t}#zt(e){let t=this.#x.get(e);if(t!==void 0)return t??void 0;let n=this.#R;if(n!==void 0&&(e<n.startingLine||e>=n.startingLine+n.totalLines))return;let r=this.#k;if(r!==void 0){if(n!==void 0){let{startingLine:i}=n,{children:a}=r;for(let n=e-i;n<=a.length;n++){let r=a[n];if(r===void 0)break;let i=Ju(r),o=r.dataset.lineType;if(i!==void 0&&i===e+1&&o!==void 0&&Wd(o)){t=r;break}}}return t??=r.querySelector(`[data-line="${e+1}"]`+(this.#Se===`unified`?`:not([data-line-type="change-deletion"])`:``)),t!==void 0&&this.#x.set(e,t),t??void 0}}#Bt(){if(this.#O===void 0)return 0;if(this.#_===void 0){let e=this.#k?.parentElement?.style.getPropertyValue(`--diffs-column-number-width`);e!==void 0&&e.length>2&&e.endsWith(`px`)?this.#_=parseInt(e.slice(0,-2),10):this.#_=this.#O.offsetWidth}return this.#_}#Vt(){if(this.#k===void 0)return 0;if(this.#v===void 0){let e=this.#k.parentElement?.style.getPropertyValue(`--diffs-column-content-width`);e!==void 0&&e.length>2&&e.endsWith(`px`)?this.#v=parseFloat(e.slice(0,-2)):this.#v=this.#k.offsetWidth}return this.#v}#Ht(e){let t=this.#y.get(e);if(t!==void 0)return t;let n=this.#zt(e);if(n===void 0)return-1;let r=n.offsetTop+this.#t.paddingTop;return r+=this.#Be?.top??0,this.#y.set(e,r),r}#Ut(e,t){if(this.#S!==void 0&&this.#S[0]===e&&this.#S[1]===t)return[this.#S[2],this.#S[3]];let n=this.#L?.getLineText(e),r=this.#Bt()+this.#t.ch;if(n===void 0||n.length===0||t<=0)return[r+(this.#Be?.left??0),0];let i=Tp(n,Math.min(t,n.length)),a=n.slice(0,i),o=Dp(a,this.#t.tabSize),s=0,c=0;if(s=o===-1?r+this.#t.measureTextWidth(a):r+o*this.#t.ch,this.#we){let t=this.#Vt();if(2*this.#t.ch+this.#t.measureTextWidth(n)>t){let t=this.#Wt(e);if(t==null)return[s+(this.#Be?.left??0),0];for(let e=0;e+1<t.length;e++){let a=t[e];if(i<=t[e+1]){c=e;let t=n.slice(a,i),o=Dp(t,this.#t.tabSize);s=o===-1?r+this.#t.measureTextWidth(t):r+o*this.#t.ch;break}}}s+=this.#Be?.left??0}return this.#S===void 0?this.#S=[e,t,s,c]:(this.#S[0]=e,this.#S[1]=t,this.#S[2]=s,this.#S[3]=c),[s,c]}#Wt(e){let t=this.#b.get(e);if(t!==void 0)return t;this.#b.size>=Rp&&this.#b.clear();let n=this.#L?.getLineText(e);if(n===void 0||n.length===0){let t=new Uint32Array([0]);return this.#b.set(e,t),t}let r=this.#k;if(r==null||!r.isConnected)return;let i=X(`div`,{style:{position:`absolute`,top:`0`,left:`0`,width:`100%`,boxSizing:`border-box`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,font:`inherit`,paddingInline:`1ch`,tabSize:this.#t.tabSize.toString()},textContent:n},r),a=i.firstChild,o=document.createRange(),s=[];try{let t=i.getBoundingClientRect();if(t.width===0)return;let r=Ep(n),c=t.left+this.#t.ch,l=r===void 0?n.length:r.length-1,u=e=>r===void 0?e:r[e],d=e=>(o.setStart(a,u(e)),o.setEnd(a,u(e+1)),o.getBoundingClientRect());s.push(0);let f=d(0).top,p=1;for(;p<l;){let e=p,t=l;for(;e<t;){let n=e+t>>1;d(n).top>f?t=n:e=n+1}if(e>=l)break;let{left:n,top:r}=d(e),i=Ee()&&n-c>this.#t.ch/2;s.push(u(i?e-1:e)),f=r,p=e+1}let m=new Uint32Array(s.length+1);for(let e=0;e<s.length;e++)m[e]=s[e];return m[s.length]=n.length,this.#b.set(e,m),m}finally{i.remove()}}#Gt(e){let t=this.#Wt(e);if(t!==void 0)return t;let n=this.#L?.getLineText(e)?.length??0;return Uint32Array.of(0,n)}#Kt({startContainer:e,endContainer:t}){let n=this.#k;return n===void 0?!1:n.contains(e)&&n.contains(t)}#qt(e){let t=this.#L?.lineCount??0;return e<0||e>=t?!1:this.#zt(e)!==void 0}},Hp=typeof window>`u`?J.useEffect:J.useLayoutEffect;function Up(e,t,n){let r=e==null?null:(0,Y.jsx)(`div`,{slot:ht,children:e}),i=t!=null&&n!=null?(0,Y.jsx)(`div`,{slot:gt,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Y.jsxs)(Y.Fragment,{children:[r,i]})}function Wp(e,t){return typeof window>`u`&&t!=null?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,Y.jsx)(Y.Fragment,{children:e})}function Gp(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function Kp(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function qp({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),u=(0,J.useRef)(n.getComposition()),d=(0,J.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,J.useCallback)(()=>{s(null)},[]),m=(0,J.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,J.useMemo)(()=>Kp(h,e,f,p,m),[h,p,m,f,e]),_=(0,J.useCallback)(e=>{l(e)},[]);(0,J.useEffect)(()=>{f||s(null)},[f]),Hp(()=>{n.setComposition(g)},[g,n]),Hp(()=>{if(c!=null)return r!=null&&Gp(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=Wp(Up(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,Y.jsx)(lt,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function Jp(e){let[t]=(0,J.useState)(()=>new Wl(e)),n=(0,J.useRef)({timeout:null,model:t});return(0,J.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}var Yp=r(),Xp=e=>{if(typeof e!=`object`||!e)return null;let t=e;return typeof t.getAttribute==`function`?t.getAttribute(`data-item-path`):null};function Zp(e){let t=[],n=[];return{isDragInProgress:()=>n.length>0,handleSelectionChange(e){t=e},handleDragStart(e){if(e.dataTransfer===null)return;let r=null;for(let t of e.composedPath())if(r=Xp(t),r!==null)break;if(r===null)return;let i=t.includes(r)?t:[r],a=i.map(e=>I(e)).filter(e=>e!==null);a.length!==0&&(n=i,e.dataTransfer.setData(ue,a.join(` `)))},handleDragEnd(){if(n.length!==0){for(let t of n)e.deselect(t);n=[]}}}}var Qp=`
|
|
2189
2189
|
:host {
|
|
2190
2190
|
--trees-bg-override: transparent;
|
|
2191
2191
|
--trees-selected-bg-override: color-mix(in srgb, currentColor 12%, transparent);
|
|
@@ -2195,7 +2195,7 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}f
|
|
|
2195
2195
|
--trees-font-size-override: 12px;
|
|
2196
2196
|
}
|
|
2197
2197
|
button[data-type='item'] { border-radius: 5px; }
|
|
2198
|
-
`;function $p(e){return e.kind===`directory`?`${e.path}/`:e.path}function em({environmentId:e,cwd:t,projectName:n,onOpenFile:r}){let{resolvedTheme:a}=
|
|
2198
|
+
`;function $p(e){return e.kind===`directory`?`${e.path}/`:e.path}function em({environmentId:e,cwd:t,projectName:n,onOpenFile:r}){let{resolvedTheme:a}=O(),o=Re(),s=Fe(e,t),c=s.data?.entries??[],u=(0,J.useMemo)(()=>new Map(c.map(e=>[e.path,e.kind])),[c]),d=(0,J.useRef)(u),f=(0,J.useMemo)(()=>c.map($p),[c]),p=(0,J.useRef)([]),m=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=e=>{m.current={x:e.clientX,y:e.clientY,at:e.timeStamp}};return document.addEventListener(`contextmenu`,e,!0),()=>document.removeEventListener(`contextmenu`,e,!0)},[]);let g=async(e,t)=>{let n=i();if(!n){t.close();return}let r=e.path.replace(/\/$/,``),a=Ge(r),s=m.current,c=s!==null&&performance.now()-s.at<1e3,l=t.anchorElement.getBoundingClientRect(),u=c?{x:s.x,y:s.y}:{x:l.left,y:l.bottom};try{let e=await n.contextMenu.show([{id:`copy-mention`,label:`Copy mention`},{id:`add-to-chat`,label:`Add to chat`}],u);if(e===`copy-mention`){try{await S(a),h.add({type:`success`,title:`Mention copied`,description:r})}catch(e){h.add({type:`error`,title:`Failed to copy mention`,description:e instanceof Error?e.message:`An error occurred.`})}return}if(e===`add-to-chat`){let e=o?.current;if(!e){h.add({type:`error`,title:`Unable to add to chat`,description:`Open a chat for this project and try again.`});return}e.insertTextAtEnd(`${a} `,{ensureLeadingBoundary:!0})||h.add({type:`error`,title:`Unable to add to chat`,description:`The chat isn't ready to accept input right now.`})}}finally{t.close()}},_=(0,J.useRef)(g);(0,J.useEffect)(()=>{_.current=g});let v=(0,J.useRef)(null),y=(0,J.useMemo)(()=>Zp({deselect:e=>v.current?.getItem(e)?.deselect()}),[]),{model:b}=Jp({composition:{contextMenu:{triggerMode:`right-click`,onOpen:(e,t)=>{_.current(e,t)}}},dragAndDrop:{canDrop:()=>!1},density:`compact`,fileTreeSearchMode:`hide-non-matches`,flattenEmptyDirectories:!0,initialExpansion:1,icons:re,onSelectionChange:e=>{if(y.handleSelectionChange(e),y.isDragInProgress())return;let t=e.at(-1)?.replace(/\/$/,``);t&&d.current.get(t)===`file`&&r(t)},paths:[],search:!0,unsafeCSS:Qp});(0,J.useEffect)(()=>{p.current!==f&&(d.current=u,p.current=f,b.resetPaths(f))},[u,b,f]);let x=(0,J.useMemo)(()=>c.reduce((e,t)=>e+ +(t.kind===`file`),0),[c]),C=(0,J.useRef)(null);return(0,J.useEffect)(()=>{v.current=b},[b]),(0,J.useEffect)(()=>{let e=C.current;if(e===null)return;let t=e=>y.handleDragStart(e),n=()=>y.handleDragEnd();return e.addEventListener(`dragstart`,t,!0),e.addEventListener(`dragend`,n),()=>{e.removeEventListener(`dragstart`,t,!0),e.removeEventListener(`dragend`,n)}},[y]),(0,Y.jsxs)(`div`,{ref:C,className:`flex min-h-0 flex-1 flex-col bg-background`,"data-file-browser-panel":`${e}:${t}`,children:[(0,Y.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-border/60 px-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:n}),(0,Y.jsxs)(`div`,{className:`truncate text-[10px] leading-none text-muted-foreground`,children:[s.isPending&&s.data===null?`Indexing…`:`${x.toLocaleString()} files`,s.data?.truncated?` · partial`:``]})]}),(0,Y.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground`,"aria-label":`Search workspace files`,onClick:()=>b.openSearch(),children:(0,Y.jsx)(rt,{className:`size-3.5`})}),(0,Y.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground`,"aria-label":`Refresh workspace files`,onClick:s.refresh,children:(0,Y.jsx)(F,{className:l(`size-3.5`,s.isPending&&`animate-spin`)})})]}),s.error&&s.data===null?(0,Y.jsx)(`div`,{className:`p-4 text-xs leading-relaxed text-destructive`,children:s.error}):(0,Y.jsx)(qp,{model:b,"aria-label":`${n} files`,className:`min-h-0 flex-1 overflow-hidden`,style:{colorScheme:a,"--trees-fg-override":`var(--foreground)`}})]})}function tm(e){let t=(0,Yp.c)(11),{open:n,title:r,onOpenChange:i,children:a}=e,o;t[0]===r?o=t[1]:(o=(0,Y.jsx)(Ae,{className:`shrink-0 border-b border-border/60 px-4 py-2.5 pe-12 text-sm font-medium`,children:r}),t[0]=r,t[1]=o);let s;t[2]===a?s=t[3]:(s=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:a}),t[2]=a,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Y.jsxs)(nt,{className:`row-start-1 row-end-4 flex h-full max-h-full w-full max-w-none flex-col overflow-hidden p-0`,bottomStickOnMobile:!1,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==n||t[9]!==c?(l=(0,Y.jsx)(Ze,{open:n,onOpenChange:i,children:c}),t[7]=i,t[8]=n,t[9]=c,t[10]=l):l=t[10],l}var nm=1024,rm=[`B`,`KB`,`MB`,`GB`,`TB`];function im(e){if(!Number.isFinite(e)||e<0)return`unknown size`;let t=e,n=0;for(;t>=nm&&n<rm.length-1;)t/=nm,n+=1;return`${n===0?t:Math.round(t*10)/10} ${rm[n]}`}function am(e){let t=e.lastIndexOf(`.`);return t<=0||t===e.length-1?`File`:`${e.slice(t+1).toUpperCase()} file`}function om(e){let t=(0,Yp.c)(35),{environmentId:n,keybindings:r,availableEditors:a,absolutePath:o,name:s,byteLength:c,canRevealInFileManager:l}=e,u;t[0]===o?u=t[1]:(u=()=>{let e=i();e&&e.shell.showItemInFolder(o).catch(cm)},t[0]=o,t[1]=u);let d=u,f;t[2]===o?f=t[3]:(f=()=>{if(!navigator.clipboard?.writeText){h.add(g({type:`error`,title:`Failed to copy path`,description:`Clipboard API unavailable.`}));return}navigator.clipboard.writeText(o).then(()=>h.add({type:`success`,title:`Path copied`,description:o}),sm)},t[2]=o,t[3]=f);let m=f,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Y.jsx)(st,{className:`mt-0.5 size-5 shrink-0 text-muted-foreground`}),t[4]=_):_=t[4];let v;t[5]===s?v=t[6]:(v=(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium`,title:s,children:s}),t[5]=s,t[6]=v);let y;t[7]===s?y=t[8]:(y=am(s),t[7]=s,t[8]=y);let b;t[9]===c?b=t[10]:(b=im(c),t[9]=c,t[10]=b);let x;t[11]!==y||t[12]!==b?(x=(0,Y.jsxs)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[y,` · `,b]}),t[11]=y,t[12]=b,t[13]=x):x=t[13];let S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Y.jsx)(`div`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`This file cannot be shown here.`}),t[14]=S):S=t[14];let C;t[15]!==v||t[16]!==x?(C=(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[_,(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[v,x,S]})]}),t[15]=v,t[16]=x,t[17]=C):C=t[17];let w;t[18]!==o||t[19]!==a||t[20]!==n||t[21]!==r?(w=(0,Y.jsx)(He,{environmentId:n,keybindings:r,availableEditors:a,openInCwd:o,compact:!0,enableShortcut:!1}),t[18]=o,t[19]=a,t[20]=n,t[21]=r,t[22]=w):w=t[22];let T;t[23]!==l||t[24]!==d?(T=l?(0,Y.jsxs)(p,{variant:`outline`,size:`sm`,onClick:d,children:[(0,Y.jsx)(Ne,{className:`size-3.5`}),`Reveal in Finder`]}):null,t[23]=l,t[24]=d,t[25]=T):T=t[25];let E;t[26]===m?E=t[27]:(E=(0,Y.jsx)(p,{variant:`outline`,size:`sm`,onClick:m,children:`Copy path`}),t[26]=m,t[27]=E);let D;t[28]!==w||t[29]!==T||t[30]!==E?(D=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[w,T,E]}),t[28]=w,t[29]=T,t[30]=E,t[31]=D):D=t[31];let O;return t[32]!==D||t[33]!==C?(O=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6`,children:(0,Y.jsxs)(`div`,{className:`flex w-full max-w-md flex-col gap-4 rounded-lg border border-border/60 bg-card p-5`,children:[C,D]})}),t[32]=D,t[33]=C,t[34]=O):O=t[34],O}function sm(e){return h.add(g({type:`error`,title:`Failed to copy path`,description:e instanceof Error?e.message:`An error occurred.`}))}function cm(e){h.add(g({type:`error`,title:`Unable to reveal file`,description:e instanceof Error?e.message:`An error occurred.`}))}function lm({root:e,resolveEditor:t,onDismiss:n}){n(),t()?.setSelections([]);let r=e.querySelector(`diffs-container`)?.shadowRoot?.activeElement;r instanceof HTMLElement&&r.blur()}function um(e){return e.querySelector(`diffs-container`)?.shadowRoot?.activeElement?.hasAttribute(`data-content`)===!0}function dm({root:e,resolveEditor:t,isBlocked:n,onDismiss:r}){let i=i=>{n()||i.composedPath().includes(e)||lm({root:e,resolveEditor:t,onDismiss:r})},a=i=>{i.key!==`Escape`||n()||!um(e)||(i.preventDefault(),i.stopImmediatePropagation(),lm({root:e,resolveEditor:t,onDismiss:r}))};return document.addEventListener(`pointerdown`,i,!0),document.addEventListener(`keydown`,a,!0),()=>{document.removeEventListener(`pointerdown`,i,!0),document.removeEventListener(`keydown`,a,!0)}}function fm(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${e.length}:${(t>>>0).toString(36)}`}function pm(e,t,n){return`${e}:${t}:${fm(n)}`}function mm(e,t){let n=t.split(`/`).filter(Boolean);return[{label:e,path:``,kind:`project`},...n.map((e,t)=>({label:e,path:n.slice(0,t+1).join(`/`),kind:t===n.length-1?`file`:`directory`}))]}var hm=e=>/\.(?:md|mdx)$/i.test(e);function gm(e,t,n){return t<0||e[t]!==`[`||!/[ xX]/.test(e[t+1]??``)||e[t+2]!==`]`?e:`${e.slice(0,t+1)}${n?`x`:` `}${e.slice(t+2)}`}var _m=class{options;timer=null;latestContents=``;latestRevision=0;lastChangeAt=0;saving=!1;disposed=!1;constructor(e){this.options=e}change(e){this.latestContents=e,this.latestRevision+=1,this.lastChangeAt=Date.now(),this.options.onPendingChange(!0),this.schedule(this.options.debounceMs)}dispose(){this.disposed=!0,this.clearTimer(),this.latestRevision>0&&this.persistLatest()}schedule(e){this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,this.persistLatest()},e)}clearTimer(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null)}async persistLatest(){if(this.saving||this.latestRevision===0)return;this.saving=!0;let e=this.latestContents,t=this.latestRevision,n=(await this.options.persist(e))._tag===`Success`;if(n&&this.options.onConfirmed(e),this.saving=!1,t===this.latestRevision){n&&this.options.onPendingChange(!1);return}let r=Math.max(0,this.options.debounceMs-(Date.now()-this.lastChangeAt));this.disposed?this.persistLatest():this.schedule(r)}},vm=`p4code.fileExplorerOpen`,ym=500,bm=`data-file-link-reveal`,xm=`
|
|
2199
2199
|
[${bm}][data-line] {
|
|
2200
2200
|
background-color: light-dark(
|
|
2201
2201
|
color-mix(
|
|
@@ -2226,5 +2226,5 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}f
|
|
|
2226
2226
|
) !important;
|
|
2227
2227
|
color: var(--diffs-selection-number-fg) !important;
|
|
2228
2228
|
}
|
|
2229
|
-
`;function Sm(e){let t=(0,Yp.c)(5),n=Ve(e.environmentId,e.resource),[r,i]=(0,J.useState)(null);if(n._tag===`Failure`||n._tag===`Success`&&r===n.url){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:`Unable to load image.`}),t[0]=e):e=t[0],e}let a;return t[1]!==n._tag||t[2]!==n.url||t[3]!==e.alt?(a=n._tag===`Success`?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,Y.jsx)(`img`,{className:`max-h-full max-w-full object-contain`,src:n.url,alt:e.alt,onError:()=>i(n.url)})}):(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Y.jsx)(d,{className:`size-5 animate-spin`})}),t[1]=n._tag,t[2]=n.url,t[3]=e.alt,t[4]=a):a=t[4],a}function Cm(e,t){let n=1;for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);r===10?n+=1:r===13&&(n+=1,e.charCodeAt(t+1)===10&&(t+=1))}return Math.min(Math.max(1,t),n)}function wm(e,t){let n=e.shadowRoot??e;for(let e of n.querySelectorAll(`[${bm}]`))e.removeAttribute(bm);t!==null&&(n.querySelector(`[data-line="${t}"]`)?.setAttribute(bm,``),n.querySelector(`[data-column-number="${t}"]`)?.setAttribute(bm,``))}function Tm(e,t,n){let r=(0,Yp.c)(7),[i]=(0,J.useState)(Om),[a]=(0,J.useState)(Dm),[o]=(0,J.useState)(Em),s;return r[0]!==i||r[1]!==a||r[2]!==o||r[3]!==e||r[4]!==t||r[5]!==n?(s=(r,s,c)=>{if(e===null)return;let l=()=>{let t=o.get(e);t!==void 0&&(cancelAnimationFrame(t),o.delete(e))};if(c===`unmount`){l();return}let u=t===null?null:Cm(s.file?.contents??``,t);if(wm(r,u),!(s instanceof j))return;if(a.get(e)!==n&&(l(),a.set(e,n)),u===null){r.style.minHeight=``;return}let d=r.closest(`.file-preview-virtualizer`);!d||(r.style.minHeight=`${Math.ceil(Math.max(s.height,d.clientHeight))}px`,i.get(e)===n||o.has(e))||o.set(e,requestAnimationFrame(()=>{if(o.delete(e),a.get(e)!==n||!r.isConnected)return;let t=s.getLinePosition(u);if(!t)return;let c=d.scrollTop+r.getBoundingClientRect().top-d.getBoundingClientRect().top,l=Math.max(0,c+t.top-Math.max(0,(d.clientHeight-t.height)/2)),f=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=Math.min(l,f),i.set(e,n)}))},r[0]=i,r[1]=a,r[2]=o,r[3]=e,r[4]=t,r[5]=n,r[6]=s):s=r[6],s}function Em(){return new Map}function Dm(){return new Map}function Om(){return new Map}function km(e){let t=(0,Yp.c)(19),{environmentId:n,cwd:r,relativePath:i,onPendingChange:a}=e,o=A(ye.writeFile),s;t[0]!==a||t[1]!==i?(s=e=>a(i,e),t[0]=a,t[1]=i,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n||t[5]!==i||t[6]!==o?(c=e=>o({environmentId:n,input:{cwd:r,relativePath:i,contents:e}}),t[3]=r,t[4]=n,t[5]=i,t[6]=o,t[7]=c):c=t[7];let l;t[8]!==r||t[9]!==n||t[10]!==i?(l=e=>{He(n,r,i,e)},t[8]=r,t[9]=n,t[10]=i,t[11]=l):l=t[11];let u;t[12]!==s||t[13]!==c||t[14]!==l?(u=new _m({debounceMs:ym,onPendingChange:s,persist:c,onConfirmed:l}),t[12]=s,t[13]=c,t[14]=l,t[15]=u):u=t[15];let d=u,f,p;return t[16]===d?(f=t[17],p=t[18]):(f=()=>()=>d.dispose(),p=[d],t[16]=d,t[17]=f,t[18]=p),(0,J.useEffect)(f,p),d}function Am(e){let t=(0,Yp.c)(73),{environmentId:n,cwd:r,relativePath:i,composerDraftTarget:o,contents:s,resolvedTheme:c,revealRequestId:l,wordWrap:u,onPostRender:d,onPendingChange:f}=e,p=k(Lm),m=k(Im),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=[],t[0]=h):h=t[0];let[g,_]=(0,J.useState)(h),[v,y]=(0,J.useState)(null),b=v?.revealRequestId===l?v.range:null,x;t[1]===l?x=t[2]:(x=e=>{y({revealRequestId:l,range:e})},t[1]=l,t[2]=x);let S=x,C=(0,J.useRef)(null),w=(0,J.useRef)(null),T;t[3]!==r||t[4]!==n||t[5]!==f||t[6]!==i?(T={environmentId:n,cwd:r,relativePath:i,onPendingChange:f},t[3]=r,t[4]=n,t[5]=f,t[6]=i,t[7]=T):T=t[7];let E=km(T),D=(0,J.useRef)(null),O;t[8]!==p||t[9]!==o||t[10]!==r||t[11]!==n||t[12]!==i||t[13]!==E?(O=(e,t)=>{if(Ne(n,r,i,e.contents),E.change(e.contents),t){let n=ot(t);_(n);for(let t of n)for(let n of t.metadata.entries)n.kind===`comment`&&p(o,a({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:n.text,contents:e.contents}))}},t[8]=p,t[9]=o,t[10]=r,t[11]=n,t[12]=i,t[13]=E,t[14]=O):O=t[14];let ee=O,te;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(te=e=>{let t=new Vp(e);return D.current=t,t},t[15]=te):te=t[15];let A=te,j,M;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>{D.current?.cleanUp(),D.current=null},M=[],t[16]=j,t[17]=M):(j=t[16],M=t[17]),(0,J.useEffect)(j,M);let N;t[18]!==o||t[19]!==m||t[20]!==S?(N=e=>{S(null),m(o,e),_(t=>t.flatMap(t=>{let n=t.metadata.entries.filter(t=>t.id!==e);return n.length>0?[{...t,metadata:{entries:n}}]:[]}))},t[18]=o,t[19]=m,t[20]=S,t[21]=N):N=t[21];let ne=N,re;t[22]!==p||t[23]!==o||t[24]!==s||t[25]!==g||t[26]!==i||t[27]!==S?(re=(e,t)=>{S(null);let n=g.flatMap(Fm).find(t=>t.id===e);n&&p(o,a({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:t,contents:s})),_(n=>n.map(n=>({...n,metadata:{entries:n.metadata.entries.map(n=>n.id===e?{...n,kind:`comment`,text:t}:n)}})))},t[22]=p,t[23]=o,t[24]=s,t[25]=g,t[26]=i,t[27]=S,t[28]=re):re=t[28];let ie=re,ae;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ae=e=>{let{startLine:t,endLine:n}=L(e),r={id:st(),kind:`draft`,startLine:t,endLine:n,text:``};_(e=>{let t=e.flatMap(Nm),i=t.findIndex(e=>e.lineNumber===n);return i<0?[...t,{lineNumber:n,metadata:{entries:[r]}}]:t.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,r]}}:e)})},t[29]=ae):ae=t[29];let oe=ae,se;t[30]===g?se=t[31]:(se=g.some(jm),t[30]=g,t[31]=se);let ce=se,le,ue;t[32]!==ce||t[33]!==S?(le=()=>{let e=C.current;if(e)return dm({root:e,resolveEditor:()=>D.current,isBlocked:()=>ce,onDismiss:()=>S(null)})},ue=[ce,S],t[32]=ce,t[33]=S,t[34]=le,t[35]=ue):(le=t[34],ue=t[35]),(0,J.useEffect)(le,ue);let de;t[36]===S?de=t[37]:(de=e=>{S(e),e&&oe(e)},t[36]=S,t[37]=de);let fe=de,pe;t[38]!==d||t[39]!==b?(pe=(e,t,n)=>{d(e,t,n),w.current!==null&&(cancelAnimationFrame(w.current),w.current=null),n!==`unmount`&&(w.current=requestAnimationFrame(()=>{w.current=null,e.isConnected&&t.setSelectedLines(b,{notify:!1})}))},t[38]=d,t[39]=b,t[40]=pe):pe=t[40];let P=pe,me;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(me={overscrollSize:600,intersectionObserverMargin:1200},t[41]=me):me=t[41];let he;t[42]!==s||t[43]!==r||t[44]!==i?(he=pm(r,i,s),t[42]=s,t[43]=r,t[44]=i,t[45]=he):he=t[45];let ge;t[46]!==s||t[47]!==i||t[48]!==he?(ge={name:i,contents:s,cacheKey:he},t[46]=s,t[47]=i,t[48]=he,t[49]=ge):ge=t[49];let F=!ce,_e=!ce,ve=u?`wrap`:`scroll`,ye;t[50]===c?ye=t[51]:(ye=Me(c),t[50]=c,t[51]=ye);let xe;t[52]!==fe||t[53]!==P||t[54]!==c||t[55]!==S||t[56]!==F||t[57]!==_e||t[58]!==ve||t[59]!==ye?(xe={disableFileHeader:!0,enableGutterUtility:F,enableLineSelection:_e,onGutterUtilityClick:S,onLineSelectionChange:S,onLineSelectionEnd:fe,overflow:ve,theme:ye,themeType:c,unsafeCSS:xm,onPostRender:P},t[52]=fe,t[53]=P,t[54]=c,t[55]=S,t[56]=F,t[57]=_e,t[58]=ve,t[59]=ye,t[60]=xe):xe=t[60];let Se;t[61]!==ne||t[62]!==ie?(Se=e=>(0,Y.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,Y.jsx)(at,{kind:e.kind,rangeLabel:R(e.startLine,e.endLine),text:e.text,onCancel:()=>ne(e.id),onComment:t=>ie(e.id,t),onDelete:()=>ne(e.id)},e.id))}),t[61]=ne,t[62]=ie,t[63]=Se):Se=t[63];let Ce;t[64]===ee?Ce=t[65]:(Ce={onChange:ee},t[64]=ee,t[65]=Ce);let we;return t[66]!==g||t[67]!==b||t[68]!==ge||t[69]!==xe||t[70]!==Se||t[71]!==Ce?(we=(0,Y.jsx)(be,{createEditor:A,children:(0,Y.jsx)(`div`,{ref:C,className:`flex min-h-0 flex-1`,children:(0,Y.jsx)(Ze,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:me,children:(0,Y.jsx)(Jl,{file:ge,options:xe,selectedLines:b,lineAnnotations:g,renderAnnotation:Se,className:`min-h-full`,edit:!0,editorOptions:Ce})})})}),t[66]=g,t[67]=b,t[68]=ge,t[69]=xe,t[70]=Se,t[71]=Ce,t[72]=we):we=t[72],we}function jm(e){return e.metadata.entries.some(Mm)}function Mm(e){return e.kind===`draft`}function Nm(e){let t=e.metadata.entries.filter(Pm);return t.length>0?[{...e,metadata:{entries:t}}]:[]}function Pm(e){return e.kind!==`draft`}function Fm(e){return e.metadata.entries}function Im(e){return e.removeReviewComment}function Lm(e){return e.addReviewComment}function Rm(e){let t=(0,Yp.c)(17),{environmentId:n,cwd:r,relativePath:i,contents:a,threadRef:o,readOnly:s,onPendingChange:c}=e,l;t[0]!==r||t[1]!==n||t[2]!==c||t[3]!==i?(l={environmentId:n,cwd:r,relativePath:i,onPendingChange:c},t[0]=r,t[1]=n,t[2]=c,t[3]=i,t[4]=l):l=t[4];let u=km(l),d;t[5]!==a||t[6]!==r||t[7]!==n||t[8]!==s||t[9]!==i||t[10]!==u?(d=s?{}:{onTaskListChange:e=>{let{markerOffset:t,checked:o}=e,s=Xe(n,r,i)?.contents??a,c=gm(s,t,o);c!==s&&(Ne(n,r,i,c),u.change(c))}},t[5]=a,t[6]=r,t[7]=n,t[8]=s,t[9]=i,t[10]=u,t[11]=d):d=t[11];let f;return t[12]!==a||t[13]!==r||t[14]!==d||t[15]!==o?(f=(0,Y.jsx)(oe,{className:`min-h-0 flex-1`,children:(0,Y.jsx)(ne,{text:a,cwd:r,threadRef:o,className:`mx-auto max-w-4xl px-6 py-5`,...d})}),t[12]=a,t[13]=r,t[14]=d,t[15]=o,t[16]=f):f=t[16],f}function zm(){try{return b(vm,E)??!0}catch(e){return console.error(e),!0}}function Bm(e){let t=(0,Yp.c)(103),{environmentId:n,cwd:r,projectName:i,workspaceRoot:a,relativePath:u,absolutePath:p,isOutsideWorkspace:m,threadRef:b,composerDraftTarget:S,keybindings:E,availableEditors:k,revealLine:j,revealRequestId:M,onOpenFile:N,onPendingChange:ne}=e,{resolvedTheme:ie}=ee(),ae=ue(Hm),se=O(),ce=te(n),le;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(le={reportFailure:!1},t[0]=le):le=t[0];let de=Ee(re.createUrl,le),fe;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(fe={reportFailure:!1},t[1]=fe):fe=t[1];let pe=A(T.open,fe),P=n===se,me;t[2]===u?me=t[3]:(me=u!==null&&w(u),t[2]=u,t[3]=me);let ge=me,F=Ge(n,r,u,!ge,p),[_e,ve]=(0,J.useState)(zm),[ye,be]=(0,J.useState)(!1),xe;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(xe={path:null,revealRequestId:null},t[4]=xe):xe=t[4];let[Se,Ce]=(0,J.useState)(xe),we=(0,J.useRef)(null),De;t[5]===u?De=t[6]:(De=u?hm(u):!1,t[5]=u,t[6]=De);let Oe=De,ke=Oe&&Se.path===u&&(j===null||Se.revealRequestId===M),Ae;t[7]===u?Ae=t[8]:(Ae=u!==null&&s()&&Fe(u),t[7]=u,t[8]=Ae);let je=Ae,Ne;t[9]!==r||t[10]!==p||t[11]!==u?(Ne=p??(u?v(u,r):null),t[9]=r,t[10]=p,t[11]=u,t[12]=Ne):Ne=t[12];let Pe=Ne,Ie;t[13]!==Pe||t[14]!==P||t[15]!==b.threadId||t[16]!==a?(Ie=Pe===null?null:C({filePath:Pe,threadId:b.threadId,workspaceRoot:a,allowLocalFiles:P}),t[13]=Pe,t[14]=P,t[15]=b.threadId,t[16]=a,t[17]=Ie):Ie=t[17];let Le=Ie,Re;t[18]!==r||t[19]!==m||t[20]!==i||t[21]!==u?(Re=u?mm(m?r:i,u):[],t[18]=r,t[19]=m,t[20]=i,t[21]=u,t[22]=Re):Re=t[22];let ze=Re,Ve=Tm(u,j,M),He;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(He=()=>{(we.current?.querySelector(`[data-current-file-crumb='true']`))?.scrollIntoView({block:`nearest`,inline:`end`})},t[23]=He):He=t[23];let We;t[24]===u?We=t[25]:(We=[u],t[24]=u,t[25]=We),(0,J.useEffect)(He,We);let Ke;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=()=>{ve(Vm)},t[26]=Ke):Ke=t[26];let Xe=Ke,Qe;t[27]!==Pe||t[28]!==P||t[29]!==de||t[30]!==ce||t[31]!==pe||t[32]!==ie||t[33]!==b||t[34]!==a?(Qe=()=>{!Pe||!ce||(async()=>{let e=await Ye({threadRef:b,filePath:Pe,httpBaseUrl:ce,workspaceRoot:a,allowLocalFiles:P,theme:ie,createAssetUrl:de,openPreview:pe});if(e._tag===`Success`||o(e))return;let t=x(e);h.add(g({type:`error`,title:`Unable to open file in browser`,description:t instanceof Error?t.message:`An error occurred.`}))})()},t[27]=Pe,t[28]=P,t[29]=de,t[30]=ce,t[31]=pe,t[32]=ie,t[33]=b,t[34]=a,t[35]=Qe):Qe=t[35];let $e=Qe,et;t[36]!==Pe||t[37]!==P||t[38]!==k||t[39]!==S||t[40]!==r||t[41]!==n||t[42]!==F||t[43]!==Le||t[44]!==ge||t[45]!==Oe||t[46]!==m||t[47]!==E||t[48]!==Ve||t[49]!==ne||t[50]!==u||t[51]!==ke||t[52]!==ie||t[53]!==M||t[54]!==b||t[55]!==ae?(et=u&&ge&&Le?(0,Y.jsx)(Sm,{environmentId:n,resource:Le,alt:u},Pe??u):u&&F.error&&F.data===null?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:F.error}):u&&F.data===null?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Y.jsx)(d,{className:`size-5 animate-spin`})}):u&&F.data?F.data.binary&&Pe?(0,Y.jsx)(om,{environmentId:n,keybindings:E,availableEditors:k,absolutePath:Pe,name:u.slice(u.lastIndexOf(`/`)+1),byteLength:F.data.byteLength,canRevealInFileManager:P&&c()}):Oe&&ke?(0,Y.jsx)(Rm,{environmentId:n,cwd:r,relativePath:u,threadRef:b,contents:F.data.contents,readOnly:m,onPendingChange:ne}):F.data.truncated||m?(0,Y.jsx)(Ze,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:(0,Y.jsx)(Jl,{file:{name:u,contents:F.data.contents,cacheKey:pm(r,u,F.data.contents)},options:{disableFileHeader:!0,overflow:ae?`wrap`:`scroll`,theme:Me(ie),themeType:ie,unsafeCSS:xm,onPostRender:Ve},className:`min-h-full`})},`${u}:${ie}:${F.data.byteLength}`):(0,Y.jsx)(Am,{environmentId:n,cwd:r,relativePath:u,composerDraftTarget:S,contents:F.data.contents,resolvedTheme:ie,revealRequestId:M,wordWrap:ae,onPostRender:Ve,onPendingChange:ne},`${u}:${ie}`):null,t[36]=Pe,t[37]=P,t[38]=k,t[39]=S,t[40]=r,t[41]=n,t[42]=F,t[43]=Le,t[44]=ge,t[45]=Oe,t[46]=m,t[47]=E,t[48]=Ve,t[49]=ne,t[50]=u,t[51]=ke,t[52]=ie,t[53]=M,t[54]=b,t[55]=ae,t[56]=et):et=t[56];let tt=et,nt;t[57]!==Pe||t[58]!==k||t[59]!==ze||t[60]!==je||t[61]!==n||t[62]!==ye||t[63]!==_e||t[64]!==$e||t[65]!==Oe||t[66]!==E||t[67]!==se||t[68]!==i||t[69]!==u||t[70]!==ke||t[71]!==M?(nt=u?(0,Y.jsxs)(`div`,{className:`surface-subheader gap-2 px-3`,"data-surface-subheader":!0,children:[(0,Y.jsx)(oe,{ref:we,hideScrollbars:!0,scrollFade:!0,className:`min-w-0 flex-1 rounded-none`,"data-file-breadcrumbs":!0,children:(0,Y.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center text-xs`,children:ze.map((e,t)=>(0,Y.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center`,"data-current-file-crumb":e.kind===`file`,children:[t>0?(0,Y.jsx)(f,{className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}):null,(0,Y.jsx)(`span`,{className:l(`max-w-40 truncate`,e.kind===`file`?`font-medium text-foreground`:`text-muted-foreground`),title:e.path||i,children:e.label})]},e.path||`project`))})}),Pe&&n===se?(0,Y.jsx)(Ue,{environmentId:n,keybindings:E,availableEditors:k,openInCwd:Pe,compact:!0,enableShortcut:!1}):null,Oe?(0,Y.jsxs)(y,{children:[(0,Y.jsx)(D,{render:(0,Y.jsx)(Te,{className:`shrink-0`,pressed:ke,onPressedChange:e=>{Ce({path:e?u:null,revealRequestId:e?M:null})},"aria-label":ke?`Show markdown source`:`Show rendered markdown`,variant:`ghost`,size:`sm`,children:ke?(0,Y.jsx)(Be,{className:`size-3.5`}):(0,Y.jsx)(Je,{className:`size-3.5`})})}),(0,Y.jsx)(_,{children:ke?`Show markdown source`:`Show rendered markdown`})]}):null,je?(0,Y.jsxs)(y,{children:[(0,Y.jsx)(D,{render:(0,Y.jsx)(Te,{className:`shrink-0`,pressed:!1,onPressedChange:$e,"aria-label":`Open file in preview browser`,variant:`ghost`,size:`sm`,children:(0,Y.jsx)(qe,{className:`size-3.5`})})}),(0,Y.jsx)(_,{children:`Open file in preview browser`})]}):null,(0,Y.jsxs)(y,{children:[(0,Y.jsx)(D,{render:(0,Y.jsx)(Te,{className:`shrink-0`,pressed:ye,onPressedChange:be,"aria-label":ye?`Collapse file preview`:`Expand file preview`,variant:`ghost`,size:`sm`,children:ye?(0,Y.jsx)(he,{className:`size-3.5`}):(0,Y.jsx)(I,{className:`size-3.5`})})}),(0,Y.jsx)(_,{children:ye?`Collapse file preview`:`Expand file preview`})]}),(0,Y.jsxs)(y,{children:[(0,Y.jsx)(D,{render:(0,Y.jsx)(Te,{className:`shrink-0`,pressed:_e,onPressedChange:Xe,"aria-label":_e?`Hide file explorer`:`Show file explorer`,variant:`ghost`,size:`sm`,children:(0,Y.jsx)(lt,{className:`size-3.5`})})}),(0,Y.jsx)(_,{children:_e?`Hide file explorer`:`Show file explorer`})]})]}):null,t[57]=Pe,t[58]=k,t[59]=ze,t[60]=je,t[61]=n,t[62]=ye,t[63]=_e,t[64]=$e,t[65]=Oe,t[66]=E,t[67]=se,t[68]=i,t[69]=u,t[70]=ke,t[71]=M,t[72]=nt):nt=t[72];let rt;t[73]!==F||t[74]!==u?(rt=u&&F.data?.truncated?(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-amber-500/20 bg-amber-500/8 px-3 py-1.5 text-[11px] text-amber-700 dark:text-amber-300`,children:[`Preview limited to the first 1 MB of a `,F.data.byteLength.toLocaleString(),` byte file.`]}):null,t[73]=F,t[74]=u,t[75]=rt):rt=t[75];let it=u?`flex`:`hidden`,at;t[76]===it?at=t[77]:(at=l(`min-w-0 flex-1 flex-col overflow-hidden`,it),t[76]=it,t[77]=at);let ot;t[78]!==ye||t[79]!==tt?(ot=ye?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs text-muted-foreground`,children:`Shown in the expanded view.`}):tt,t[78]=ye,t[79]=tt,t[80]=ot):ot=t[80];let st;t[81]!==at||t[82]!==ot?(st=(0,Y.jsx)(`div`,{className:at,children:ot}),t[81]=at,t[82]=ot,t[83]=st):st=t[83];let L;t[84]!==r||t[85]!==n||t[86]!==_e||t[87]!==N||t[88]!==i||t[89]!==u?(L=_e||u===null?(0,Y.jsx)(`aside`,{className:l(`flex min-h-0 shrink-0 bg-background`,u?`w-[min(22rem,46%)] min-w-64 border-l border-border/60`:`min-w-0 flex-1`),children:(0,Y.jsx)(em,{environmentId:n,cwd:r,projectName:i,onOpenFile:N},`${n}:${r}`)}):null,t[84]=r,t[85]=n,t[86]=_e,t[87]=N,t[88]=i,t[89]=u,t[90]=L):L=t[90];let R;t[91]!==st||t[92]!==L?(R=(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[st,L]}),t[91]=st,t[92]=L,t[93]=R):R=t[93];let ct=ye&&u!==null,ut=u??``,dt;t[94]!==tt||t[95]!==ct||t[96]!==ut?(dt=(0,Y.jsx)(tm,{open:ct,title:ut,onOpenChange:be,children:tt}),t[94]=tt,t[95]=ct,t[96]=ut,t[97]=dt):dt=t[97];let ft;return t[98]!==nt||t[99]!==rt||t[100]!==R||t[101]!==dt?(ft=(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[nt,rt,R,dt]}),t[98]=nt,t[99]=rt,t[100]=R,t[101]=dt,t[102]=ft):ft=t[102],ft}function Vm(e){let t=!e;try{m(vm,t,E)}catch(e){console.error(e)}return t}function Hm(e){return e.wordWrap}export{Bm as default};
|
|
2230
|
-
//# sourceMappingURL=FilePreviewPanel-
|
|
2229
|
+
`;function Sm(e){let t=(0,Yp.c)(5),n=Be(e.environmentId,e.resource),[r,i]=(0,J.useState)(null);if(n._tag===`Failure`||n._tag===`Success`&&r===n.url){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:`Unable to load image.`}),t[0]=e):e=t[0],e}let a;return t[1]!==n._tag||t[2]!==n.url||t[3]!==e.alt?(a=n._tag===`Success`?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,Y.jsx)(`img`,{className:`max-h-full max-w-full object-contain`,src:n.url,alt:e.alt,onError:()=>i(n.url)})}):(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Y.jsx)(d,{className:`size-5 animate-spin`})}),t[1]=n._tag,t[2]=n.url,t[3]=e.alt,t[4]=a):a=t[4],a}function Cm(e,t){let n=1;for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);r===10?n+=1:r===13&&(n+=1,e.charCodeAt(t+1)===10&&(t+=1))}return Math.min(Math.max(1,t),n)}function wm(e,t){let n=e.shadowRoot??e;for(let e of n.querySelectorAll(`[${bm}]`))e.removeAttribute(bm);t!==null&&(n.querySelector(`[data-line="${t}"]`)?.setAttribute(bm,``),n.querySelector(`[data-column-number="${t}"]`)?.setAttribute(bm,``))}function Tm(e,t,n){let r=(0,Yp.c)(7),[i]=(0,J.useState)(Om),[a]=(0,J.useState)(Dm),[o]=(0,J.useState)(Em),s;return r[0]!==i||r[1]!==a||r[2]!==o||r[3]!==e||r[4]!==t||r[5]!==n?(s=(r,s,c)=>{if(e===null)return;let l=()=>{let t=o.get(e);t!==void 0&&(cancelAnimationFrame(t),o.delete(e))};if(c===`unmount`){l();return}let u=t===null?null:Cm(s.file?.contents??``,t);if(wm(r,u),!(s instanceof M))return;if(a.get(e)!==n&&(l(),a.set(e,n)),u===null){r.style.minHeight=``;return}let d=r.closest(`.file-preview-virtualizer`);!d||(r.style.minHeight=`${Math.ceil(Math.max(s.height,d.clientHeight))}px`,i.get(e)===n||o.has(e))||o.set(e,requestAnimationFrame(()=>{if(o.delete(e),a.get(e)!==n||!r.isConnected)return;let t=s.getLinePosition(u);if(!t)return;let c=d.scrollTop+r.getBoundingClientRect().top-d.getBoundingClientRect().top,l=Math.max(0,c+t.top-Math.max(0,(d.clientHeight-t.height)/2)),f=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=Math.min(l,f),i.set(e,n)}))},r[0]=i,r[1]=a,r[2]=o,r[3]=e,r[4]=t,r[5]=n,r[6]=s):s=r[6],s}function Em(){return new Map}function Dm(){return new Map}function Om(){return new Map}function km(e){let t=(0,Yp.c)(19),{environmentId:n,cwd:r,relativePath:i,onPendingChange:a}=e,o=j(ve.writeFile),s;t[0]!==a||t[1]!==i?(s=e=>a(i,e),t[0]=a,t[1]=i,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n||t[5]!==i||t[6]!==o?(c=e=>o({environmentId:n,input:{cwd:r,relativePath:i,contents:e}}),t[3]=r,t[4]=n,t[5]=i,t[6]=o,t[7]=c):c=t[7];let l;t[8]!==r||t[9]!==n||t[10]!==i?(l=e=>{Ve(n,r,i,e)},t[8]=r,t[9]=n,t[10]=i,t[11]=l):l=t[11];let u;t[12]!==s||t[13]!==c||t[14]!==l?(u=new _m({debounceMs:ym,onPendingChange:s,persist:c,onConfirmed:l}),t[12]=s,t[13]=c,t[14]=l,t[15]=u):u=t[15];let d=u,f,p;return t[16]===d?(f=t[17],p=t[18]):(f=()=>()=>d.dispose(),p=[d],t[16]=d,t[17]=f,t[18]=p),(0,J.useEffect)(f,p),d}function Am(e){let t=(0,Yp.c)(73),{environmentId:n,cwd:r,relativePath:i,composerDraftTarget:o,contents:s,resolvedTheme:c,revealRequestId:l,wordWrap:u,onPostRender:d,onPendingChange:f}=e,p=ee(Lm),m=ee(Im),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=[],t[0]=h):h=t[0];let[g,_]=(0,J.useState)(h),[v,y]=(0,J.useState)(null),b=v?.revealRequestId===l?v.range:null,x;t[1]===l?x=t[2]:(x=e=>{y({revealRequestId:l,range:e})},t[1]=l,t[2]=x);let S=x,C=(0,J.useRef)(null),w=(0,J.useRef)(null),T;t[3]!==r||t[4]!==n||t[5]!==f||t[6]!==i?(T={environmentId:n,cwd:r,relativePath:i,onPendingChange:f},t[3]=r,t[4]=n,t[5]=f,t[6]=i,t[7]=T):T=t[7];let E=km(T),D=(0,J.useRef)(null),O;t[8]!==p||t[9]!==o||t[10]!==r||t[11]!==n||t[12]!==i||t[13]!==E?(O=(e,t)=>{if(Me(n,r,i,e.contents),E.change(e.contents),t){let n=at(t);_(n);for(let t of n)for(let n of t.metadata.entries)n.kind===`comment`&&p(o,a({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:n.text,contents:e.contents}))}},t[8]=p,t[9]=o,t[10]=r,t[11]=n,t[12]=i,t[13]=E,t[14]=O):O=t[14];let k=O,A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=new Vp(e);return D.current=t,t},t[15]=A):A=t[15];let j=A,M,N;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>{D.current?.cleanUp(),D.current=null},N=[],t[16]=M,t[17]=N):(M=t[16],N=t[17]),(0,J.useEffect)(M,N);let P;t[18]!==o||t[19]!==m||t[20]!==S?(P=e=>{S(null),m(o,e),_(t=>t.flatMap(t=>{let n=t.metadata.entries.filter(t=>t.id!==e);return n.length>0?[{...t,metadata:{entries:n}}]:[]}))},t[18]=o,t[19]=m,t[20]=S,t[21]=P):P=t[21];let te=P,ne;t[22]!==p||t[23]!==o||t[24]!==s||t[25]!==g||t[26]!==i||t[27]!==S?(ne=(e,t)=>{S(null);let n=g.flatMap(Fm).find(t=>t.id===e);n&&p(o,a({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:t,contents:s})),_(n=>n.map(n=>({...n,metadata:{entries:n.metadata.entries.map(n=>n.id===e?{...n,kind:`comment`,text:t}:n)}})))},t[22]=p,t[23]=o,t[24]=s,t[25]=g,t[26]=i,t[27]=S,t[28]=ne):ne=t[28];let re=ne,ie;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>{let{startLine:t,endLine:n}=R(e),r={id:ot(),kind:`draft`,startLine:t,endLine:n,text:``};_(e=>{let t=e.flatMap(Nm),i=t.findIndex(e=>e.lineNumber===n);return i<0?[...t,{lineNumber:n,metadata:{entries:[r]}}]:t.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,r]}}:e)})},t[29]=ie):ie=t[29];let ae=ie,oe;t[30]===g?oe=t[31]:(oe=g.some(jm),t[30]=g,t[31]=oe);let se=oe,ce,le;t[32]!==se||t[33]!==S?(ce=()=>{let e=C.current;if(e)return dm({root:e,resolveEditor:()=>D.current,isBlocked:()=>se,onDismiss:()=>S(null)})},le=[se,S],t[32]=se,t[33]=S,t[34]=ce,t[35]=le):(ce=t[34],le=t[35]),(0,J.useEffect)(ce,le);let ue;t[36]===S?ue=t[37]:(ue=e=>{S(e),e&&ae(e)},t[36]=S,t[37]=ue);let de=ue,fe;t[38]!==d||t[39]!==b?(fe=(e,t,n)=>{d(e,t,n),w.current!==null&&(cancelAnimationFrame(w.current),w.current=null),n!==`unmount`&&(w.current=requestAnimationFrame(()=>{w.current=null,e.isConnected&&t.setSelectedLines(b,{notify:!1})}))},t[38]=d,t[39]=b,t[40]=fe):fe=t[40];let F=fe,pe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(pe={overscrollSize:600,intersectionObserverMargin:1200},t[41]=pe):pe=t[41];let me;t[42]!==s||t[43]!==r||t[44]!==i?(me=pm(r,i,s),t[42]=s,t[43]=r,t[44]=i,t[45]=me):me=t[45];let he;t[46]!==s||t[47]!==i||t[48]!==me?(he={name:i,contents:s,cacheKey:me},t[46]=s,t[47]=i,t[48]=me,t[49]=he):he=t[49];let I=!se,ge=!se,_e=u?`wrap`:`scroll`,ve;t[50]===c?ve=t[51]:(ve=je(c),t[50]=c,t[51]=ve);let be;t[52]!==de||t[53]!==F||t[54]!==c||t[55]!==S||t[56]!==I||t[57]!==ge||t[58]!==_e||t[59]!==ve?(be={disableFileHeader:!0,enableGutterUtility:I,enableLineSelection:ge,onGutterUtilityClick:S,onLineSelectionChange:S,onLineSelectionEnd:de,overflow:_e,theme:ve,themeType:c,unsafeCSS:xm,onPostRender:F},t[52]=de,t[53]=F,t[54]=c,t[55]=S,t[56]=I,t[57]=ge,t[58]=_e,t[59]=ve,t[60]=be):be=t[60];let xe;t[61]!==te||t[62]!==re?(xe=e=>(0,Y.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,Y.jsx)(it,{kind:e.kind,rangeLabel:z(e.startLine,e.endLine),text:e.text,onCancel:()=>te(e.id),onComment:t=>re(e.id,t),onDelete:()=>te(e.id)},e.id))}),t[61]=te,t[62]=re,t[63]=xe):xe=t[63];let Se;t[64]===k?Se=t[65]:(Se={onChange:k},t[64]=k,t[65]=Se);let Ce;return t[66]!==g||t[67]!==b||t[68]!==he||t[69]!==be||t[70]!==xe||t[71]!==Se?(Ce=(0,Y.jsx)(ye,{createEditor:j,children:(0,Y.jsx)(`div`,{ref:C,className:`flex min-h-0 flex-1`,children:(0,Y.jsx)(Xe,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:pe,children:(0,Y.jsx)(Jl,{file:he,options:be,selectedLines:b,lineAnnotations:g,renderAnnotation:xe,className:`min-h-full`,edit:!0,editorOptions:Se})})})}),t[66]=g,t[67]=b,t[68]=he,t[69]=be,t[70]=xe,t[71]=Se,t[72]=Ce):Ce=t[72],Ce}function jm(e){return e.metadata.entries.some(Mm)}function Mm(e){return e.kind===`draft`}function Nm(e){let t=e.metadata.entries.filter(Pm);return t.length>0?[{...e,metadata:{entries:t}}]:[]}function Pm(e){return e.kind!==`draft`}function Fm(e){return e.metadata.entries}function Im(e){return e.removeReviewComment}function Lm(e){return e.addReviewComment}function Rm(e){let t=(0,Yp.c)(17),{environmentId:n,cwd:r,relativePath:i,contents:a,threadRef:o,readOnly:s,onPendingChange:c}=e,l;t[0]!==r||t[1]!==n||t[2]!==c||t[3]!==i?(l={environmentId:n,cwd:r,relativePath:i,onPendingChange:c},t[0]=r,t[1]=n,t[2]=c,t[3]=i,t[4]=l):l=t[4];let u=km(l),d;t[5]!==a||t[6]!==r||t[7]!==n||t[8]!==s||t[9]!==i||t[10]!==u?(d=s?{}:{onTaskListChange:e=>{let{markerOffset:t,checked:o}=e,s=Ye(n,r,i)?.contents??a,c=gm(s,t,o);c!==s&&(Me(n,r,i,c),u.change(c))}},t[5]=a,t[6]=r,t[7]=n,t[8]=s,t[9]=i,t[10]=u,t[11]=d):d=t[11];let f;return t[12]!==a||t[13]!==r||t[14]!==d||t[15]!==o?(f=(0,Y.jsx)(ae,{className:`min-h-0 flex-1`,children:(0,Y.jsx)(te,{text:a,cwd:r,threadRef:o,className:`mx-auto max-w-4xl px-6 py-5`,...d})}),t[12]=a,t[13]=r,t[14]=d,t[15]=o,t[16]=f):f=t[16],f}function zm(){try{return b(vm,A)??!0}catch(e){return console.error(e),!0}}function Bm(e){let t=(0,Yp.c)(103),{environmentId:n,cwd:r,projectName:i,workspaceRoot:a,relativePath:u,absolutePath:p,isOutsideWorkspace:m,threadRef:b,composerDraftTarget:S,keybindings:ee,availableEditors:A,revealLine:M,revealRequestId:N,onOpenFile:P,onPendingChange:te}=e,{resolvedTheme:re}=O(),ie=le(Hm),oe=D(),se=k(n),ce;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(ce={reportFailure:!1},t[0]=ce):ce=t[0];let ue=Te(ne.createUrl,ce),de;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(de={reportFailure:!1},t[1]=de):de=t[1];let fe=j(T.open,de),F=n===oe,pe;t[2]===u?pe=t[3]:(pe=u!==null&&w(u),t[2]=u,t[3]=pe);let he=pe,I=We(n,r,u,!he,p),[ge,_e]=(0,J.useState)(zm),[ve,ye]=(0,J.useState)(!1),be;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(be={path:null,revealRequestId:null},t[4]=be):be=t[4];let[xe,Se]=(0,J.useState)(be),Ce=(0,J.useRef)(null),Ee;t[5]===u?Ee=t[6]:(Ee=u?hm(u):!1,t[5]=u,t[6]=Ee);let De=Ee,Oe=De&&xe.path===u&&(M===null||xe.revealRequestId===N),ke;t[7]===u?ke=t[8]:(ke=u!==null&&s()&&Pe(u),t[7]=u,t[8]=ke);let Ae=ke,Me;t[9]!==r||t[10]!==p||t[11]!==u?(Me=p??(u?v(u,r):null),t[9]=r,t[10]=p,t[11]=u,t[12]=Me):Me=t[12];let Ne=Me,Fe;t[13]!==Ne||t[14]!==F||t[15]!==b.threadId||t[16]!==a?(Fe=Ne===null?null:C({filePath:Ne,threadId:b.threadId,workspaceRoot:a,allowLocalFiles:F}),t[13]=Ne,t[14]=F,t[15]=b.threadId,t[16]=a,t[17]=Fe):Fe=t[17];let Ie=Fe,Le;t[18]!==r||t[19]!==m||t[20]!==i||t[21]!==u?(Le=u?mm(m?r:i,u):[],t[18]=r,t[19]=m,t[20]=i,t[21]=u,t[22]=Le):Le=t[22];let Re=Le,Be=Tm(u,M,N),Ve;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=()=>{(Ce.current?.querySelector(`[data-current-file-crumb='true']`))?.scrollIntoView({block:`nearest`,inline:`end`})},t[23]=Ve):Ve=t[23];let Ue;t[24]===u?Ue=t[25]:(Ue=[u],t[24]=u,t[25]=Ue),(0,J.useEffect)(Ve,Ue);let Ge;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=()=>{_e(Vm)},t[26]=Ge):Ge=t[26];let Ye=Ge,Ze;t[27]!==Ne||t[28]!==F||t[29]!==ue||t[30]!==se||t[31]!==fe||t[32]!==re||t[33]!==b||t[34]!==a?(Ze=()=>{!Ne||!se||(async()=>{let e=await Je({threadRef:b,filePath:Ne,httpBaseUrl:se,workspaceRoot:a,allowLocalFiles:F,theme:re,createAssetUrl:ue,openPreview:fe});if(e._tag===`Success`||o(e))return;let t=x(e);h.add(g({type:`error`,title:`Unable to open file in browser`,description:t instanceof Error?t.message:`An error occurred.`}))})()},t[27]=Ne,t[28]=F,t[29]=ue,t[30]=se,t[31]=fe,t[32]=re,t[33]=b,t[34]=a,t[35]=Ze):Ze=t[35];let Qe=Ze,$e;t[36]!==Ne||t[37]!==F||t[38]!==A||t[39]!==S||t[40]!==r||t[41]!==n||t[42]!==I||t[43]!==Ie||t[44]!==he||t[45]!==De||t[46]!==m||t[47]!==ee||t[48]!==Be||t[49]!==te||t[50]!==u||t[51]!==Oe||t[52]!==re||t[53]!==N||t[54]!==b||t[55]!==ie?($e=u&&he&&Ie?(0,Y.jsx)(Sm,{environmentId:n,resource:Ie,alt:u},Ne??u):u&&I.error&&I.data===null?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:I.error}):u&&I.data===null?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Y.jsx)(d,{className:`size-5 animate-spin`})}):u&&I.data?I.data.binary&&Ne?(0,Y.jsx)(om,{environmentId:n,keybindings:ee,availableEditors:A,absolutePath:Ne,name:u.slice(u.lastIndexOf(`/`)+1),byteLength:I.data.byteLength,canRevealInFileManager:F&&c()}):De&&Oe?(0,Y.jsx)(Rm,{environmentId:n,cwd:r,relativePath:u,threadRef:b,contents:I.data.contents,readOnly:m,onPendingChange:te}):I.data.truncated||m?(0,Y.jsx)(Xe,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:(0,Y.jsx)(Jl,{file:{name:u,contents:I.data.contents,cacheKey:pm(r,u,I.data.contents)},options:{disableFileHeader:!0,overflow:ie?`wrap`:`scroll`,theme:je(re),themeType:re,unsafeCSS:xm,onPostRender:Be},className:`min-h-full`})},`${u}:${re}:${I.data.byteLength}`):(0,Y.jsx)(Am,{environmentId:n,cwd:r,relativePath:u,composerDraftTarget:S,contents:I.data.contents,resolvedTheme:re,revealRequestId:N,wordWrap:ie,onPostRender:Be,onPendingChange:te},`${u}:${re}`):null,t[36]=Ne,t[37]=F,t[38]=A,t[39]=S,t[40]=r,t[41]=n,t[42]=I,t[43]=Ie,t[44]=he,t[45]=De,t[46]=m,t[47]=ee,t[48]=Be,t[49]=te,t[50]=u,t[51]=Oe,t[52]=re,t[53]=N,t[54]=b,t[55]=ie,t[56]=$e):$e=t[56];let et=$e,tt;t[57]!==Ne||t[58]!==A||t[59]!==Re||t[60]!==Ae||t[61]!==n||t[62]!==ve||t[63]!==ge||t[64]!==Qe||t[65]!==De||t[66]!==ee||t[67]!==oe||t[68]!==i||t[69]!==u||t[70]!==Oe||t[71]!==N?(tt=u?(0,Y.jsxs)(`div`,{className:`surface-subheader gap-2 px-3`,"data-surface-subheader":!0,children:[(0,Y.jsx)(ae,{ref:Ce,hideScrollbars:!0,scrollFade:!0,className:`min-w-0 flex-1 rounded-none`,"data-file-breadcrumbs":!0,children:(0,Y.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center text-xs`,children:Re.map((e,t)=>(0,Y.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center`,"data-current-file-crumb":e.kind===`file`,children:[t>0?(0,Y.jsx)(f,{className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}):null,(0,Y.jsx)(`span`,{className:l(`max-w-40 truncate`,e.kind===`file`?`font-medium text-foreground`:`text-muted-foreground`),title:e.path||i,children:e.label})]},e.path||`project`))})}),Ne&&n===oe?(0,Y.jsx)(He,{environmentId:n,keybindings:ee,availableEditors:A,openInCwd:Ne,compact:!0,enableShortcut:!1}):null,De?(0,Y.jsxs)(y,{children:[(0,Y.jsx)(E,{render:(0,Y.jsx)(we,{className:`shrink-0`,pressed:Oe,onPressedChange:e=>{Se({path:e?u:null,revealRequestId:e?N:null})},"aria-label":Oe?`Show markdown source`:`Show rendered markdown`,variant:`ghost`,size:`sm`,children:Oe?(0,Y.jsx)(ze,{className:`size-3.5`}):(0,Y.jsx)(qe,{className:`size-3.5`})})}),(0,Y.jsx)(_,{children:Oe?`Show markdown source`:`Show rendered markdown`})]}):null,Ae?(0,Y.jsxs)(y,{children:[(0,Y.jsx)(E,{render:(0,Y.jsx)(we,{className:`shrink-0`,pressed:!1,onPressedChange:Qe,"aria-label":`Open file in preview browser`,variant:`ghost`,size:`sm`,children:(0,Y.jsx)(Ke,{className:`size-3.5`})})}),(0,Y.jsx)(_,{children:`Open file in preview browser`})]}):null,(0,Y.jsxs)(y,{children:[(0,Y.jsx)(E,{render:(0,Y.jsx)(we,{className:`shrink-0`,pressed:ve,onPressedChange:ye,"aria-label":ve?`Collapse file preview`:`Expand file preview`,variant:`ghost`,size:`sm`,children:ve?(0,Y.jsx)(me,{className:`size-3.5`}):(0,Y.jsx)(L,{className:`size-3.5`})})}),(0,Y.jsx)(_,{children:ve?`Collapse file preview`:`Expand file preview`})]}),(0,Y.jsxs)(y,{children:[(0,Y.jsx)(E,{render:(0,Y.jsx)(we,{className:`shrink-0`,pressed:ge,onPressedChange:Ye,"aria-label":ge?`Hide file explorer`:`Show file explorer`,variant:`ghost`,size:`sm`,children:(0,Y.jsx)(ct,{className:`size-3.5`})})}),(0,Y.jsx)(_,{children:ge?`Hide file explorer`:`Show file explorer`})]})]}):null,t[57]=Ne,t[58]=A,t[59]=Re,t[60]=Ae,t[61]=n,t[62]=ve,t[63]=ge,t[64]=Qe,t[65]=De,t[66]=ee,t[67]=oe,t[68]=i,t[69]=u,t[70]=Oe,t[71]=N,t[72]=tt):tt=t[72];let nt;t[73]!==I||t[74]!==u?(nt=u&&I.data?.truncated?(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-amber-500/20 bg-amber-500/8 px-3 py-1.5 text-[11px] text-amber-700 dark:text-amber-300`,children:[`Preview limited to the first 1 MB of a `,I.data.byteLength.toLocaleString(),` byte file.`]}):null,t[73]=I,t[74]=u,t[75]=nt):nt=t[75];let rt=u?`flex`:`hidden`,it;t[76]===rt?it=t[77]:(it=l(`min-w-0 flex-1 flex-col overflow-hidden`,rt),t[76]=rt,t[77]=it);let at;t[78]!==ve||t[79]!==et?(at=ve?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs text-muted-foreground`,children:`Shown in the expanded view.`}):et,t[78]=ve,t[79]=et,t[80]=at):at=t[80];let ot;t[81]!==it||t[82]!==at?(ot=(0,Y.jsx)(`div`,{className:it,children:at}),t[81]=it,t[82]=at,t[83]=ot):ot=t[83];let R;t[84]!==r||t[85]!==n||t[86]!==ge||t[87]!==P||t[88]!==i||t[89]!==u?(R=ge||u===null?(0,Y.jsx)(`aside`,{className:l(`flex min-h-0 shrink-0 bg-background`,u?`w-[min(22rem,46%)] min-w-64 border-l border-border/60`:`min-w-0 flex-1`),children:(0,Y.jsx)(em,{environmentId:n,cwd:r,projectName:i,onOpenFile:P},`${n}:${r}`)}):null,t[84]=r,t[85]=n,t[86]=ge,t[87]=P,t[88]=i,t[89]=u,t[90]=R):R=t[90];let z;t[91]!==ot||t[92]!==R?(z=(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[ot,R]}),t[91]=ot,t[92]=R,t[93]=z):z=t[93];let st=ve&&u!==null,lt=u??``,ut;t[94]!==et||t[95]!==st||t[96]!==lt?(ut=(0,Y.jsx)(tm,{open:st,title:lt,onOpenChange:ye,children:et}),t[94]=et,t[95]=st,t[96]=lt,t[97]=ut):ut=t[97];let dt;return t[98]!==tt||t[99]!==nt||t[100]!==z||t[101]!==ut?(dt=(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[tt,nt,z,ut]}),t[98]=tt,t[99]=nt,t[100]=z,t[101]=ut,t[102]=dt):dt=t[102],dt}function Vm(e){let t=!e;try{m(vm,t,A)}catch(e){console.error(e)}return t}function Hm(e){return e.wordWrap}export{Bm as default};
|
|
2230
|
+
//# sourceMappingURL=FilePreviewPanel-B-eIWgzu.js.map
|