@hyperpuncher/pi-ui 0.54.0 → 0.54.1
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/README.md +2 -1
- package/dist/npm/server-main.js +2 -2
- package/package.json +1 -1
- package/static/app.css +1 -1
- package/static/build/chunks/angular-html-9t1z861h.js +1 -0
- package/static/build/chunks/{angular-ts-wpa0ntyd.js → angular-ts-yces35hm.js} +1 -1
- package/static/build/chunks/bat-sykj1aa7.js +1 -0
- package/static/build/chunks/bibtex-f2ty1dx3.js +1 -0
- package/static/build/chunks/{bsl-ekqr89hb.js → bsl-dhrmm1jj.js} +1 -1
- package/static/build/chunks/cmake-5z22d5ee.js +1 -0
- package/static/build/chunks/{code-theme-a5ywgc5d.js → code-theme-ame4fn6s.js} +1 -1
- package/static/build/chunks/csv-j1nr2egp.js +1 -0
- package/static/build/chunks/{erb-ssgyt8yk.js → erb-5ke38pz0.js} +1 -1
- package/static/build/chunks/{fortran-fixed-form-yqrdwjab.js → fortran-fixed-form-eawvv1am.js} +1 -1
- package/static/build/chunks/fortran-free-form-wpe8st7g.js +1 -0
- package/static/build/chunks/fsharp-9e2dnvk9.js +1 -0
- package/static/build/chunks/{gdresource-4fj86xjd.js → gdresource-gfrqcbcg.js} +1 -1
- package/static/build/chunks/gdscript-5nb9fzmy.js +1 -0
- package/static/build/chunks/gdshader-ba7x07gg.js +1 -0
- package/static/build/chunks/{graphql-ddq2qt0v.js → graphql-6dembcfz.js} +1 -1
- package/static/build/chunks/haml-fs8t607p.js +1 -0
- package/static/build/chunks/handlebars-qxp1hmm5.js +1 -0
- package/static/build/chunks/haxe-63hhvesn.js +1 -0
- package/static/build/chunks/hlsl-99cqj6by.js +1 -0
- package/static/build/chunks/{http-q7kc4tj6.js → http-r101fvka.js} +1 -1
- package/static/build/chunks/{hurl-megk96q7.js → hurl-hzcngdvj.js} +1 -1
- package/static/build/chunks/{hxml-6ch21be5.js → hxml-psqp1nsp.js} +1 -1
- package/static/build/chunks/{index-wg53q3y0.js → index-hynb8kca.js} +13 -13
- package/static/build/chunks/jsonc-15dhk5z3.js +1 -0
- package/static/build/chunks/jsx-h2hggewx.js +1 -0
- package/static/build/chunks/{julia-mgfk32ya.js → julia-427d8qjf.js} +1 -1
- package/static/build/chunks/{just-rjtrh43a.js → just-ezfq4t7j.js} +1 -1
- package/static/build/chunks/latex-41146jxq.js +1 -0
- package/static/build/chunks/log-jvqtv319.js +1 -0
- package/static/build/chunks/{main-hw5rht8r.js → main-098d512h.js} +2 -2
- package/static/build/chunks/{main-dedmwdfs.js → main-0g6qtbm7.js} +2 -2
- package/static/build/chunks/{main-17y72e2k.js → main-25shm7ha.js} +2 -2
- package/static/build/chunks/{main-q53pa7e1.js → main-29fmzgdz.js} +1 -1
- package/static/build/chunks/{main-c4y2m713.js → main-5dymmn8v.js} +2 -2
- package/static/build/chunks/{main-b4j28cva.js → main-6yfb802z.js} +2 -2
- package/static/build/chunks/{main-s13hhth9.js → main-8nztd0r5.js} +2 -2
- package/static/build/chunks/{main-epsspf8t.js → main-93jq8y6w.js} +2 -2
- package/static/build/chunks/{main-vqg1a9c8.js → main-9brcqyac.js} +2 -2
- package/static/build/chunks/{main-sh14kcap.js → main-9kwttvkk.js} +2 -2
- package/static/build/chunks/{main-v6yya2rp.js → main-aabsw5zs.js} +2 -2
- package/static/build/chunks/{main-q0zg1fh4.js → main-brz9x4r1.js} +2 -2
- package/static/build/chunks/{main-z8x5tyev.js → main-ch19n8dg.js} +2 -2
- package/static/build/chunks/{main-q6xq4ymt.js → main-d2jmsjyj.js} +2 -2
- package/static/build/chunks/{main-60jmcz5q.js → main-d5kpdgb3.js} +2 -2
- package/static/build/chunks/{main-drhnr196.js → main-dckqpwtw.js} +1 -1
- package/static/build/chunks/{main-0tfr6zpw.js → main-e3dchyzh.js} +2 -2
- package/static/build/chunks/{main-aj799kta.js → main-gza5czsg.js} +2 -2
- package/static/build/chunks/{main-0m5jmwcm.js → main-jx88bb4k.js} +2 -2
- package/static/build/chunks/{main-z9ya2zyf.js → main-kqvqxvs9.js} +15 -15
- package/static/build/chunks/{main-m23prjtn.js → main-m3gqgzj2.js} +2 -2
- package/static/build/chunks/{main-75b7czew.js → main-mvvsw424.js} +2 -2
- package/static/build/chunks/{main-0eq28dnr.js → main-mwqd3xej.js} +2 -2
- package/static/build/chunks/{main-wg1rgmq8.js → main-mx73v44m.js} +2 -2
- package/static/build/chunks/{main-320cz9m0.js → main-n1amqv0y.js} +2 -2
- package/static/build/chunks/{main-1h81h5tc.js → main-n2gksx7q.js} +2 -2
- package/static/build/chunks/{main-fxxjfq5x.js → main-na165zc6.js} +2 -2
- package/static/build/chunks/{main-w4ktfx46.js → main-qjaabb97.js} +2 -2
- package/static/build/chunks/{main-fnryfy0w.js → main-trx88rdg.js} +2 -2
- package/static/build/chunks/{main-12hs60r7.js → main-v9hveeqk.js} +2 -2
- package/static/build/chunks/{main-svq37c5n.js → main-vyjr38wk.js} +2 -2
- package/static/build/chunks/{main-g5cvv1jb.js → main-wjv4knsy.js} +2 -2
- package/static/build/chunks/{main-n354gvtx.js → main-xxtt0kat.js} +2 -2
- package/static/build/chunks/{main-ncmhhxpc.js → main-ze318jkq.js} +2 -2
- package/static/build/chunks/{main-pf4sasgx.js → main-zne4xghc.js} +1 -1
- package/static/build/chunks/{nextflow-vsm9mewk.js → nextflow-ecafj8kf.js} +1 -1
- package/static/build/chunks/nextflow-groovy-xvrmcddz.js +1 -0
- package/static/build/chunks/{nim-rjrps4r1.js → nim-jcfn78ep.js} +1 -1
- package/static/build/chunks/ocaml-3t7q77vf.js +1 -0
- package/static/build/chunks/{org-41f97gct.js → org-83gwmman.js} +1 -1
- package/static/build/chunks/powershell-bft3fprh.js +1 -0
- package/static/build/chunks/pug-67fg5zkc.js +1 -0
- package/static/build/chunks/{rst-qgaks9ys.js → rst-0j7thaq8.js} +1 -1
- package/static/build/chunks/{ruby-10gnpa9m.js → ruby-h41d1jye.js} +1 -1
- package/static/build/chunks/sdbl-pe5gn8zr.js +1 -0
- package/static/build/chunks/{shaderlab-qdakc6m7.js → shaderlab-b58smhfe.js} +1 -1
- package/static/build/chunks/{sparql-hrn3zm8y.js → sparql-wz87e1pd.js} +1 -1
- package/static/build/chunks/stylus-x9mf4enc.js +1 -0
- package/static/build/chunks/swift-zn3gdbrz.js +1 -0
- package/static/build/chunks/system-verilog-gcgja1bf.js +1 -0
- package/static/build/chunks/tex-pxg823cm.js +1 -0
- package/static/build/chunks/turtle-rygwqp46.js +1 -0
- package/static/build/chunks/{twig-1rd58h0d.js → twig-zr6z9qb5.js} +1 -1
- package/static/build/chunks/{typst-pg1czsjz.js → typst-5t62efc4.js} +1 -1
- package/static/build/chunks/verilog-jp5dkmgg.js +1 -0
- package/static/build/chunks/{vue-vine-d46tfy6m.js → vue-vine-x1pd5ydv.js} +1 -1
- package/static/build/chunks/{workspace-review-73s0n7hc.js → workspace-review-5r77y1ft.js} +11 -11
- package/static/build/chunks/zig-98xskbfp.js +1 -0
- package/static/build/main.js +4 -4
- package/static/build/chunks/angular-html-z4fqs47k.js +0 -1
- package/static/build/chunks/bat-4986hex0.js +0 -1
- package/static/build/chunks/bibtex-n2nhe0wx.js +0 -1
- package/static/build/chunks/cmake-86bharq9.js +0 -1
- package/static/build/chunks/csv-kzar1n4v.js +0 -1
- package/static/build/chunks/fortran-free-form-4tb589s6.js +0 -1
- package/static/build/chunks/fsharp-5v62w2jq.js +0 -1
- package/static/build/chunks/gdscript-4h1shwqj.js +0 -1
- package/static/build/chunks/gdshader-5za4a2j9.js +0 -1
- package/static/build/chunks/haml-vsp7hh3f.js +0 -1
- package/static/build/chunks/handlebars-59gn5dj7.js +0 -1
- package/static/build/chunks/haxe-zvpwvpvn.js +0 -1
- package/static/build/chunks/hlsl-svktsk04.js +0 -1
- package/static/build/chunks/jsonc-ssb35fmp.js +0 -1
- package/static/build/chunks/jsx-9ct7s1py.js +0 -1
- package/static/build/chunks/latex-xha4wvvc.js +0 -1
- package/static/build/chunks/log-jnggnqka.js +0 -1
- package/static/build/chunks/nextflow-groovy-b4w15vkr.js +0 -1
- package/static/build/chunks/ocaml-yt0kq4b3.js +0 -1
- package/static/build/chunks/powershell-8cv2gpfc.js +0 -1
- package/static/build/chunks/pug-s4e1p0x9.js +0 -1
- package/static/build/chunks/sdbl-rw2b1wff.js +0 -1
- package/static/build/chunks/stylus-051daetz.js +0 -1
- package/static/build/chunks/swift-c3wmm92e.js +0 -1
- package/static/build/chunks/system-verilog-cysaabmv.js +0 -1
- package/static/build/chunks/tex-yj0j713p.js +0 -1
- package/static/build/chunks/turtle-am0wf2w4.js +0 -1
- package/static/build/chunks/verilog-1bxyw8xv.js +0 -1
- package/static/build/chunks/zig-rdjds834.js +0 -1
- /package/static/build/chunks/{main-0spvwn6n.js → main-m9dfhq6m.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u,U,C,Ne,j,ae,E,ze,L,p,Je,et,He,V,Ue,m,be,Gt,A,Ze,Z,Ht,tt,nt,at,rt,it,x,Ut,r,We,o,he,y,c,i,oe,ot,le,Me,ye,st}from"./main-z9ya2zyf.js";import{Ve}from"./main-0spvwn6n.js";import{Nt,e,Ke,Xe,se,de,Zt,ue,ne,pe}from"../main.js";var ns=Nt(Ve(),1),Ji=Symbol("IGNORE_RESPONSE"),Gh=1e4,eo=class extends Error{constructor(){super("WorkerPoolManager: operation canceled because the pool terminated")}},ts=class extends Error{constructor(){super("WorkerPoolManager: operation canceled before the task completed")}},rs=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(t,{langs:n,theme:s=u,useTokenTransformer:a=!1,lineDiffType:l="word-alt",maxLineDiffLength:d=1000,tokenizeMaxLineLength:h=1000,preferredHighlighter:f="shiki-js"}){this.options=t,this.preferredHighlighter=f,this.renderOptions={theme:s,useTokenTransformer:a,lineDiffType:l,maxLineDiffLength:d,tokenizeMaxLineLength:h},this.fileCache=new ns.default.LRUMap(t.totalASTLRUCacheSize??100),this.diffCache=new ns.default.LRUMap(t.totalASTLRUCacheSize??100),this.queueInitialization(n)}isWorkingPool(){return!this.workersFailed}getFileResultCache(t){return t.cacheKey!=null?this.fileCache.get(t.cacheKey):void 0}getDiffResultCache(t){return t.cacheKey!=null?this.diffCache.get(t.cacheKey):void 0}inspectCaches(){let{fileCache:t,diffCache:n}=this;return{fileCache:t,diffCache:n}}evictFileFromCache(t){try{return this.fileCache.delete(t)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(t){try{return this.diffCache.delete(t)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:t=this.renderOptions.theme??u,useTokenTransformer:n=this.renderOptions.useTokenTransformer??!1,lineDiffType:s=this.renderOptions.lineDiffType??"word-alt",maxLineDiffLength:a=this.renderOptions.maxLineDiffLength??1000,tokenizeMaxLineLength:l=this.renderOptions.tokenizeMaxLineLength??1000}){let{lifecycleGeneration:d}=this,h=++this.renderOptionsRequestVersion,f=()=>this.isCurrentLifecycle(d)&&this.renderOptionsRequestVersion===h;try{let g={theme:t,useTokenTransformer:n,lineDiffType:s,maxLineDiffLength:a,tokenizeMaxLineLength:l};if(!this.isInitialized())await this.initialize();if(!f()||A(g,this.renderOptions))return;let b=C(t),w=[];if(!E(g.theme,this.renderOptions.theme))if(ze(b))w=rt(b);else w=await it(b);if(!f())return;if(this.highlighter!=null)Ne(w,this.highlighter);else{let v=await j({themes:b,langs:["text"],preferredHighlighter:this.preferredHighlighter});if(!f())return;this.highlighter=v}let I=this.setRenderOptionsOnWorkers(g,w);this.renderOptions=g,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let v of this.themeSubscribers)v.onThemeChange();await I}catch(g){if(g instanceof eo||!f())return;throw g}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:t,theme:n,useTokenTransformer:s}=this.renderOptions;return{theme:n,useTokenTransformer:s,tokenizeMaxLineLength:t}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(t,n){if(this.workersFailed)return;if(!this.isInitialized())await this.initialize();let s=[];for(let a of this.workers){if(!a.initialized)throw console.log({managedWorker:a}),Error("setRenderOptionsOnWorkers: Somehow we have an uninitialized worker");s.push(new Promise((l,d)=>{let h=this.generateRequestId(),f={type:"set-render-options",id:h,request:{type:"set-render-options",id:h,renderOptions:t,resolvedThemes:n},resolve:l,reject:d,requestStart:Date.now()};this.activeTaskById.set(h,f),a.pendingSetupRequestId=h,a.worker.postMessage(f.request)}))}await Promise.all(s)}subscribeToThemeChanges(t){return this.themeSubscribers.add(t),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(t),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(t){this.themeSubscribers.delete(t),this.queueBroadcastStateChanges()}subscribeToStatChanges(t){return this.statSubscribers.add(t),t(this.getStats()),()=>{this.statSubscribers.delete(t)}}queueBroadcastStateChanges(){if(this._queuedBroadcast!=null)return;this._queuedBroadcast=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{if(this._queuedBroadcast!=null)cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0;let t=this.getStats();for(let n of this.statSubscribers)n(t)};cleanUpTasks(t){this.detachInstanceFromQueuedTasks(t);let n=this.activeRequestByInstance.get(t);if(n!=null){let s=this.activeTaskById.get(n);if(Rn(s)){if(this.detachInstanceFromRenderTask(s,t),!s.primeCache&&s.instances.size===0)this.removeActiveTask(s)}else this.activeTaskById.delete(n)}this.activeRequestByInstance.delete(t),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(t=[]){if(this.initialized===!0)return;else if(this.initialized===!1){let{lifecycleGeneration:n}=this;this.initialized=new Promise((s,a)=>{(async()=>{try{let l=C(this.renderOptions.theme),d=[];if(ze(l))d=rt(l);else d=await it(l);if(!this.isCurrentLifecycle(n)){s();return}let h=[];if(nt(t))h=tt(t);else h=await at(t);if(!this.isCurrentLifecycle(n)){s();return}let[f]=await Promise.all([j({themes:l,langs:["text",...t],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(d,h)]);if(!this.isCurrentLifecycle(n)){this.terminateWorkers(),s();return}this.highlighter=f,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),s()}catch(l){if(l instanceof eo||!this.isCurrentLifecycle(n)){s();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(let d of this.queuedTasks)this.rejectRenderTaskCallbacks(d,to(l));this.queueBroadcastStateChanges(),a(l)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}async initializeWorkers(t,n){this.workersFailed=!1;let s=[],a=Je(),l=a>0?et():void 0;if(this.workers.length>0)this.terminateWorkers();for(let f=0;f<(this.options.poolSize??8);f++){let g=this.options.workerFactory(),b={worker:g,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set(["text",...n.map(({name:w})=>w)]),customExtensionsVersion:0};g.addEventListener("message",(w)=>{this.handleWorkerMessage(b,w.data)}),g.addEventListener("error",(w)=>this.handleWorkerError(b,w)),this.workers.push(b),s.push(new Promise((w,I)=>{let v=this.generateRequestId(),_={type:"initialize",id:v,request:{type:"initialize",id:v,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:t,resolvedLanguages:n,customExtensionsVersion:l!=null?a:void 0,customExtensionMap:l},resolve(){b.initialized=!0,w()},reject:I,requestStart:Date.now()};b.pendingSetupRequestId=v,this.activeTaskById.set(v,_),this.executeTask(b,_)}))}let d=this.options.workerInitializationTimeout??Gh,h;try{await Promise.race([Promise.all(s),new Promise((f,g)=>{h=setTimeout(()=>{g(Error(`WorkerPoolManager: worker initialization timed out after ${d}ms`))},d)})])}finally{if(h!=null)clearTimeout(h)}}handleWorkerError(t,n){console.error("Worker error:",n,t);let{pendingSetupRequestId:s}=t;if(s==null)return;let a=this.activeTaskById.get(s);if(a?.type!=="initialize")return;a.reject(to(n)),this.cleanWorkerAndTask(t,a)}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized!==!0||this.queuedTasks.length===0)return;for(let t=0;t<this.queuedTasks.length;){let n=this.queuedTasks[t];if(this.hasActiveRequest(n)){t++;continue}let s=Yh(n),a=this.getAvailableWorker(s);if(a==null)break;this.queuedTasks.splice(t,1),this.assignWorkerToTask(n,a),this.resolveLanguagesAndExecuteTask(a,n,s)}this.queueBroadcastStateChanges()};highlightFileAST(t,n){let s=this.getFileResultCache(n);if(V(n)||s!=null&&L(s.options,this.getFileRenderOptions()))return;if(!this.hasMatchingFileInstanceTask(t,n))this.submitTask(t,{type:"file",file:n})}primeFileHighlightCache(t){if(!this.isWorkingPool())return Promise.reject(Error("WorkerPoolManager.primeFileHighlightCache: worker pool is not working"));let n=this.getOrCreateFileHighlightCacheTask(t);return n!=null?this.createRenderTaskCallbacks(n):Promise.resolve()}getOrCreateFileHighlightCacheTask(t){if(t.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${t.name}".`);return}let n=this.getFileResultCache(t),s=this.getFileHighlightKey(t);if(s==null||V(t)||n!=null&&L(n.options,this.getFileRenderOptions()))return;let a=this.getTaskByHighlightKey(s);if(a!=null)return a.primeCache=!0,a.type==="file"?a:void 0;else{let l=this.submitCacheTask({type:"file",file:t},s);return l.type==="file"?l:void 0}}getPlainFileAST(t,n,s,a){if(this.highlighter==null){this.queueInitialization();return}return He(t,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:n,totalLines:s,lines:a})}highlightDiffAST(t,n){let s=this.getDiffResultCache(n);if(Z(n)||s!=null&&A(s.options,this.getDiffRenderOptions()))return;if(!this.hasMatchingDiffInstanceTask(t,n))this.submitTask(t,{type:"diff",diff:n})}primeDiffHighlightCache(t){if(!this.isWorkingPool())return Promise.reject(Error("WorkerPoolManager.primeDiffHighlightCache: worker pool is not working"));let n=this.getOrCreateDiffHighlightCacheTask(t);return n!=null?this.createRenderTaskCallbacks(n):Promise.resolve()}getOrCreateDiffHighlightCacheTask(t){if(t.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${t.prevName??t.name}" -> "${t.name}".`);return}let n=this.getDiffResultCache(t),s=this.getDiffHighlightKey(t);if(s==null||Z(t)||n!=null&&A(n.options,this.getDiffRenderOptions()))return;let a=this.getTaskByHighlightKey(s);if(a!=null)return a.primeCache=!0,a.type==="diff"?a:void 0;else{let l=this.submitCacheTask({type:"diff",diff:t},s);return l.type==="diff"?l:void 0}}getPlainDiffAST(t,n,s,a,l){return this.highlighter!=null?Ze(t,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:n,totalLines:s,expandedHunks:a,collapsedContextThreshold:l}):void 0}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let t=new eo;for(let n of this.queuedTasks)this.rejectRenderTaskCallbacks(n,t);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(t){return this.lifecycleGeneration===t}queueInitialization(t){this.initialize(t).catch((n)=>{console.error(n)})}cancelActiveWorkerTasks(){let t=new eo;for(let n of this.activeTaskById.values())if("reject"in n)n.reject(t);else if(Rn(n))this.rejectRenderTaskCallbacks(n,t)}terminateWorkers(){for(let t of this.workers)t.worker.terminate();this.workers.length=0}getStats(){return{managerState:(()=>{if(this.initialized===!1)return"waiting";if(this.initialized!==!0)return"initializing";return"initialized"})(),totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter((t)=>t.requestId!=null||t.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(t,n){if(this.initialized===!1)this.queueInitialization();let s=this.getHighlightKeyForRequest(n),a=s!=null?this.getTaskByHighlightKey(s):void 0;if(a!=null){this.detachInstanceFromQueuedTasks(t,a),this.addInstanceToTask(a,t),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(t);let l=this.generateRequestId(),d=Date.now(),{renderOptionsVersion:h}=this,f=(()=>{switch(n.type){case"file":return{type:"file",id:l,request:{...n,id:l},instances:new Set([t]),primeCache:!1,highlightKey:s,callbacks:new Set,renderOptionsVersion:h,requestStart:d};case"diff":return{type:"diff",id:l,request:{...n,id:l},instances:new Set([t]),primeCache:!1,highlightKey:s,callbacks:new Set,renderOptionsVersion:h,requestStart:d}}})();this.enqueueRenderTask(f,t)}submitCacheTask(t,n){if(this.initialized===!1)this.queueInitialization();let s=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:l}=this,d=(()=>{switch(t.type){case"file":return{type:"file",id:s,request:{...t,id:s},instances:new Set,primeCache:!0,highlightKey:n,callbacks:new Set,renderOptionsVersion:l,requestStart:a};case"diff":return{type:"diff",id:s,request:{...t,id:s},instances:new Set,primeCache:!0,highlightKey:n,callbacks:new Set,renderOptionsVersion:l,requestStart:a}}})();return this.enqueueRenderTask(d),d}enqueueRenderTask(t,n){if(this.queuedTasks.push(t),n!=null)this.queuedTaskByInstance.set(n,t);if(t.highlightKey!=null)this.taskByHighlightKey.set(t.highlightKey,t);this.queueDrain()}async resolveLanguagesAndExecuteTask(t,n,s){try{let a=s.filter((d)=>!U(d));if(a.length>0)j({themes:C(this.renderOptions.theme),langs:["text",...a],preferredHighlighter:this.preferredHighlighter}).catch((d)=>{console.error(d)});let l=s.filter((d)=>!t.langs.has(d));if(l.length>0)if(nt(l))n.request.resolvedLanguages=tt(l);else n.request.resolvedLanguages=await at(l);if(!this.activeTaskById.has(n.id)){if(t.requestId===n.id){if(this.cleanWorkerAndTask(t,n),this.queueBroadcastStateChanges(),this.queuedTasks.length>0)this.queueDrain()}return}this.executeTask(t,n)}catch(a){if(this.rejectRenderTaskCallbacks(n,to(a)),this.cleanWorkerAndTask(t,n),this.queueBroadcastStateChanges(),this.queuedTasks.length>0)this.queueDrain()}}handleWorkerMessage(t,n){let s=this.activeTaskById.get(n.id);try{if(s==null)throw Ji;else if(n.type==="error"){let a=Error(n.error);if(n.stack)a.stack=n.stack;if("reject"in s)s.reject(a);else if(Rn(s))this.notifyHighlightError(s,a),this.rejectRenderTaskCallbacks(s,a);else throw Error("handleWorkerMessage: unknown task type");throw a}else{if(Rn(s))for(let{name:a}of s.request.resolvedLanguages??[])t.langs.add(a);switch(n.requestType){case"initialize":if(s.type!=="initialize")throw Error("handleWorkerMessage: task/response dont match");this.syncCustomExtensionVersion(t,s.request),s.resolve();break;case"set-render-options":if(s.type!=="set-render-options")throw Error("handleWorkerMessage: task/response dont match");s.resolve();break;case"file":{if(s.type!=="file")throw Error("handleWorkerMessage: task/response dont match");let{result:a,options:l}=n;if(!this.isCurrentRenderTask(s)||!L(l,this.getFileRenderOptions()))throw Ji;let{request:d}=s;if(this.syncCustomExtensionVersion(t,d),s.cacheKeyAtDispatch!=null)this.fileCache.set(s.cacheKeyAtDispatch,{result:a,options:l});this.resolveRenderTaskCallbacks(s),this.notifyFileInstances(s,a,l);break}case"diff":{if(s.type!=="diff")throw Error("handleWorkerMessage: task/response dont match");let{result:a,options:l}=n;if(!this.isCurrentRenderTask(s)||!A(l,this.getDiffRenderOptions()))throw Ji;let{request:d}=s;if(this.syncCustomExtensionVersion(t,d),s.cacheKeyAtDispatch!=null)this.diffCache.set(s.cacheKeyAtDispatch,{result:a,options:l});this.resolveRenderTaskCallbacks(s),this.notifyDiffInstances(s,a,l);break}}}}catch(a){if(a!==Ji)console.error(a,s,n)}if(this.cleanWorkerAndTask(t,s,n.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0)this.queueDrain()}_queuedDrain;queueDrain(){if(this._queuedDrain!=null)return;this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges()}assignWorkerToTask(t,n){if(n.requestId=t.id,Rn(t))this.clearQueuedInstanceRequests(t),this.trackInstanceRequests(t);this.activeTaskById.set(t.id,t)}cleanWorkerAndTask(t,n,s=n?.id){if(t.requestId===s)t.requestId=void 0;if(t.pendingSetupRequestId===s)t.pendingSetupRequestId=void 0;if(n!=null){if(Rn(n))this.rejectRenderTaskCallbacks(n,new ts),this.clearInstanceRequests(n),this.clearHighlightKey(n);this.activeTaskById.delete(n.id)}}executeTask(t,n){if(Xh(n.request))this.maybeAttachCustomExtensions(t,n.request);if(!this.activeTaskById.has(n.id))this.assignWorkerToTask(n,t);try{if(n.type==="file")n.cacheKeyAtDispatch=n.request.file.cacheKey;else if(n.type==="diff")n.cacheKeyAtDispatch=n.request.diff.cacheKey;t.worker.postMessage(n.request)}catch(s){if(console.error("Failed to post message to worker:",s),Rn(n))this.notifyHighlightError(n,s),this.rejectRenderTaskCallbacks(n,to(s));else if("reject"in n)n.reject(s);if(this.cleanWorkerAndTask(t,n),this.queuedTasks.length>0)this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(t,n){if(n.customExtensionsVersion!=null)return;let s=Je();if(t.customExtensionsVersion>=s)return;n.customExtensionsVersion=s,n.customExtensionMap=et()}syncCustomExtensionVersion(t,n){if(n.customExtensionsVersion==null)return;t.customExtensionsVersion=n.customExtensionsVersion}getAvailableWorker(t){let n;for(let s of this.workers){if(s.requestId!=null||s.pendingSetupRequestId!=null||!s.initialized)continue;if(n=s,t.length===0)break;let a=!0;for(let l of t)if(!s.langs.has(l)){a=!1;break}if(a)break}return n}getFileHighlightKey(t){if(t.cacheKey==null)return;return`file:${t.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(t){if(t.cacheKey==null)return;return`diff:${t.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(t){switch(t.type){case"file":return this.getFileHighlightKey(t.file);case"diff":return this.getDiffHighlightKey(t.diff)}}hasActiveRequest(t){for(let n of pi(t))if(this.activeRequestByInstance.has(n))return!0;return!1}addInstanceToTask(t,n){if(t.type==="file")t.instances.add(n);else t.instances.add(n);if(this.activeTaskById.has(t.id))this.activeRequestByInstance.set(n,t.id);else this.queuedTaskByInstance.set(n,t)}detachInstanceFromQueuedTasks(t,n){let s=this.queuedTaskByInstance.get(t);if(s==null||s===n)return;if(this.queuedTaskByInstance.delete(t),this.detachInstanceFromRenderTask(s,t),!s.primeCache&&s.instances.size===0)this.removeQueuedTask(s)}detachInstanceFromRenderTask(t,n){if(t.type==="file")t.instances.delete(n);else t.instances.delete(n)}removeQueuedTask(t){let n=this.queuedTasks.indexOf(t);if(n!==-1)this.queuedTasks.splice(n,1);this.rejectRenderTaskCallbacks(t,new ts),this.clearQueuedInstanceRequests(t),this.clearHighlightKey(t)}removeActiveTask(t){this.rejectRenderTaskCallbacks(t,new ts),this.clearInstanceRequests(t),this.clearHighlightKey(t),this.activeTaskById.delete(t.id)}createRenderTaskCallbacks(t){return new Promise((n,s)=>{t.callbacks.add({resolve:n,reject:s})})}resolveRenderTaskCallbacks(t){for(let n of t.callbacks)n.resolve();t.callbacks.clear()}rejectRenderTaskCallbacks(t,n){for(let s of t.callbacks)s.reject(n);t.callbacks.clear()}invalidateRenderTasks(){for(let t=this.queuedTasks.length-1;t>=0;t--){let n=this.queuedTasks[t];if(n.renderOptionsVersion!==this.renderOptionsVersion)this.removeQueuedTask(n)}for(let t of Array.from(this.activeTaskById.values()))if(Rn(t)&&t.renderOptionsVersion!==this.renderOptionsVersion)this.removeActiveTask(t)}clearQueuedInstanceRequests(t){for(let n of pi(t))if(this.queuedTaskByInstance.get(n)===t)this.queuedTaskByInstance.delete(n)}clearHighlightKey(t){if(t.highlightKey!=null&&this.taskByHighlightKey.get(t.highlightKey)===t)this.taskByHighlightKey.delete(t.highlightKey)}trackInstanceRequests(t){for(let n of pi(t))this.activeRequestByInstance.set(n,t.id)}clearInstanceRequests(t){for(let n of pi(t))if(this.activeRequestByInstance.get(n)===t.id)this.activeRequestByInstance.delete(n)}notifyFileInstances(t,n,s){for(let a of t.instances)if(this.activeRequestByInstance.get(a)===t.id)a.onHighlightSuccess(t.request.file,n,s)}notifyDiffInstances(t,n,s){for(let a of t.instances)if(this.activeRequestByInstance.get(a)===t.id)a.onHighlightSuccess(t.request.diff,n,s)}notifyHighlightError(t,n){for(let s of pi(t))if(this.activeRequestByInstance.get(s)===t.id)s.onHighlightError(n)}hasMatchingFileInstanceTask(t,n){for(let s of this.iterateRenderTasks())if(s.type==="file"&&this.isCurrentRenderTask(s)&&s.instances.has(t)&&be(n,s.request.file))return!0;return!1}hasMatchingDiffInstanceTask(t,n){for(let s of this.iterateRenderTasks())if(s.type==="diff"&&this.isCurrentRenderTask(s)&&s.instances.has(t)&&m(s.request.diff,n))return!0;return!1}getTaskByHighlightKey(t){let n=this.taskByHighlightKey.get(t);return n!=null&&this.isCurrentRenderTask(n)?n:void 0}isCurrentRenderTask(t){return t.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let t of this.queuedTasks)yield t;for(let t of this.activeTaskById.values())if(Rn(t))yield t}generateRequestId(){return`req_${++this.nextRequestId}`}};function Xh(t){return t.type==="initialize"||t.type==="file"||t.type==="diff"}function Yh(t){let n=new Set;if(t.type==="initialize"||t.type==="set-render-options")return[];switch(t.type){case"file":n.add(t.request.file.lang??p(t.request.file.name));break;case"diff":n.add(t.request.diff.lang??p(t.request.diff.name)),n.add(t.request.diff.lang??p(t.request.diff.prevName??"-"))}return n.delete("text"),Array.from(n)}function Rn(t){return t?.type==="file"||t?.type==="diff"}function pi(t){return t.instances}function to(t){if(t instanceof Error)return t;if(t!=null&&typeof t==="object"){if("error"in t&&t.error instanceof Error)return t.error;if("message"in t&&typeof t.message==="string")return Error(t.message)}return Error(String(t))}var mi;function is({poolOptions:t,highlighterOptions:n}){return mi??=new rs(t,n),mi}function os(){if(mi==null)return;mi.terminate(),mi=void 0}var Qh=[`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
|
|
1
|
+
import{u,U,C,Ne,j,re,E,ze,L,p,et,tt,He,V,Ue,m,be,Ht,A,Ze,Z,Ut,nt,at,rt,it,ot,x,Zt,r,We,o,he,y,c,i,se,st,de,Me,ye,ct}from"./main-kqvqxvs9.js";import{Ve}from"./main-m9dfhq6m.js";import{zt,e,Ke,Xe,ce,ue,Ye,ne,ae,pe}from"../main.js";var ns=zt(Ve(),1),Ji=Symbol("IGNORE_RESPONSE"),Xh=1e4,Zi=class extends Error{constructor(){super("WorkerPoolManager: operation canceled because the pool terminated")}},ts=class extends Error{constructor(){super("WorkerPoolManager: operation canceled before the task completed")}},rs=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(t,{langs:n,theme:s=u,useTokenTransformer:a=!1,lineDiffType:l="word-alt",maxLineDiffLength:d=1000,tokenizeMaxLineLength:h=1000,preferredHighlighter:f="shiki-js"}){this.options=t,this.preferredHighlighter=f,this.renderOptions={theme:s,useTokenTransformer:a,lineDiffType:l,maxLineDiffLength:d,tokenizeMaxLineLength:h},this.fileCache=new ns.default.LRUMap(t.totalASTLRUCacheSize??100),this.diffCache=new ns.default.LRUMap(t.totalASTLRUCacheSize??100),this.queueInitialization(n)}isWorkingPool(){return!this.workersFailed}getFileResultCache(t){return t.cacheKey!=null?this.fileCache.get(t.cacheKey):void 0}getDiffResultCache(t){return t.cacheKey!=null?this.diffCache.get(t.cacheKey):void 0}inspectCaches(){let{fileCache:t,diffCache:n}=this;return{fileCache:t,diffCache:n}}evictFileFromCache(t){try{return this.fileCache.delete(t)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(t){try{return this.diffCache.delete(t)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:t=this.renderOptions.theme??u,useTokenTransformer:n=this.renderOptions.useTokenTransformer??!1,lineDiffType:s=this.renderOptions.lineDiffType??"word-alt",maxLineDiffLength:a=this.renderOptions.maxLineDiffLength??1000,tokenizeMaxLineLength:l=this.renderOptions.tokenizeMaxLineLength??1000}){let{lifecycleGeneration:d}=this,h=++this.renderOptionsRequestVersion,f=()=>this.isCurrentLifecycle(d)&&this.renderOptionsRequestVersion===h;try{let g={theme:t,useTokenTransformer:n,lineDiffType:s,maxLineDiffLength:a,tokenizeMaxLineLength:l};if(!this.isInitialized())await this.initialize();if(!f()||A(g,this.renderOptions))return;let b=C(t),w=[];if(!E(g.theme,this.renderOptions.theme))if(ze(b))w=it(b);else w=await ot(b);if(!f())return;if(this.highlighter!=null)Ne(w,this.highlighter);else{let v=await j({themes:b,langs:["text"],preferredHighlighter:this.preferredHighlighter});if(!f())return;this.highlighter=v}let I=this.setRenderOptionsOnWorkers(g,w);this.renderOptions=g,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let v of this.themeSubscribers)v.onThemeChange();await I}catch(g){if(g instanceof Zi||!f())return;throw g}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:t,theme:n,useTokenTransformer:s}=this.renderOptions;return{theme:n,useTokenTransformer:s,tokenizeMaxLineLength:t}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(t,n){if(this.workersFailed)return;if(!this.isInitialized())await this.initialize();let s=[];for(let a of this.workers){if(!a.initialized)throw console.log({managedWorker:a}),Error("setRenderOptionsOnWorkers: Somehow we have an uninitialized worker");s.push(new Promise((l,d)=>{let h=this.generateRequestId(),f={type:"set-render-options",id:h,request:{type:"set-render-options",id:h,renderOptions:t,resolvedThemes:n},resolve:l,reject:d,requestStart:Date.now()};this.activeTaskById.set(h,f),a.pendingSetupRequestId=h,a.worker.postMessage(f.request)}))}await Promise.all(s)}subscribeToThemeChanges(t){return this.themeSubscribers.add(t),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(t),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(t){this.themeSubscribers.delete(t),this.queueBroadcastStateChanges()}subscribeToStatChanges(t){return this.statSubscribers.add(t),t(this.getStats()),()=>{this.statSubscribers.delete(t)}}queueBroadcastStateChanges(){if(this._queuedBroadcast!=null)return;this._queuedBroadcast=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{if(this._queuedBroadcast!=null)cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0;let t=this.getStats();for(let n of this.statSubscribers)n(t)};cleanUpTasks(t){this.detachInstanceFromQueuedTasks(t);let n=this.activeRequestByInstance.get(t);if(n!=null){let s=this.activeTaskById.get(n);if(Pn(s)){if(this.detachInstanceFromRenderTask(s,t),!s.primeCache&&s.instances.size===0)this.removeActiveTask(s)}else this.activeTaskById.delete(n)}this.activeRequestByInstance.delete(t),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(t=[]){if(this.initialized===!0)return;else if(this.initialized===!1){let{lifecycleGeneration:n}=this;this.initialized=new Promise((s,a)=>{(async()=>{try{let l=C(this.renderOptions.theme),d=[];if(ze(l))d=it(l);else d=await ot(l);if(!this.isCurrentLifecycle(n)){s();return}let h=[];if(at(t))h=nt(t);else h=await rt(t);if(!this.isCurrentLifecycle(n)){s();return}let[f]=await Promise.all([j({themes:l,langs:["text",...t],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(d,h)]);if(!this.isCurrentLifecycle(n)){this.terminateWorkers(),s();return}this.highlighter=f,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),s()}catch(l){if(l instanceof Zi||!this.isCurrentLifecycle(n)){s();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(let d of this.queuedTasks)this.rejectRenderTaskCallbacks(d,eo(l));this.queueBroadcastStateChanges(),a(l)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}async initializeWorkers(t,n){this.workersFailed=!1;let s=[],a=et(),l=a>0?tt():void 0;if(this.workers.length>0)this.terminateWorkers();for(let f=0;f<(this.options.poolSize??8);f++){let g=this.options.workerFactory(),b={worker:g,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set(["text",...n.map(({name:w})=>w)]),customExtensionsVersion:0};g.addEventListener("message",(w)=>{this.handleWorkerMessage(b,w.data)}),g.addEventListener("error",(w)=>this.handleWorkerError(b,w)),this.workers.push(b),s.push(new Promise((w,I)=>{let v=this.generateRequestId(),_={type:"initialize",id:v,request:{type:"initialize",id:v,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:t,resolvedLanguages:n,customExtensionsVersion:l!=null?a:void 0,customExtensionMap:l},resolve(){b.initialized=!0,w()},reject:I,requestStart:Date.now()};b.pendingSetupRequestId=v,this.activeTaskById.set(v,_),this.executeTask(b,_)}))}let d=this.options.workerInitializationTimeout??Xh,h;try{await Promise.race([Promise.all(s),new Promise((f,g)=>{h=setTimeout(()=>{g(Error(`WorkerPoolManager: worker initialization timed out after ${d}ms`))},d)})])}finally{if(h!=null)clearTimeout(h)}}handleWorkerError(t,n){console.error("Worker error:",n,t);let{pendingSetupRequestId:s}=t;if(s==null)return;let a=this.activeTaskById.get(s);if(a?.type!=="initialize")return;a.reject(eo(n)),this.cleanWorkerAndTask(t,a)}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized!==!0||this.queuedTasks.length===0)return;for(let t=0;t<this.queuedTasks.length;){let n=this.queuedTasks[t];if(this.hasActiveRequest(n)){t++;continue}let s=Qh(n),a=this.getAvailableWorker(s);if(a==null)break;this.queuedTasks.splice(t,1),this.assignWorkerToTask(n,a),this.resolveLanguagesAndExecuteTask(a,n,s)}this.queueBroadcastStateChanges()};highlightFileAST(t,n){let s=this.getFileResultCache(n);if(V(n)||s!=null&&L(s.options,this.getFileRenderOptions()))return;if(!this.hasMatchingFileInstanceTask(t,n))this.submitTask(t,{type:"file",file:n})}primeFileHighlightCache(t){if(!this.isWorkingPool())return Promise.reject(Error("WorkerPoolManager.primeFileHighlightCache: worker pool is not working"));let n=this.getOrCreateFileHighlightCacheTask(t);return n!=null?this.createRenderTaskCallbacks(n):Promise.resolve()}getOrCreateFileHighlightCacheTask(t){if(t.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${t.name}".`);return}let n=this.getFileResultCache(t),s=this.getFileHighlightKey(t);if(s==null||V(t)||n!=null&&L(n.options,this.getFileRenderOptions()))return;let a=this.getTaskByHighlightKey(s);if(a!=null)return a.primeCache=!0,a.type==="file"?a:void 0;else{let l=this.submitCacheTask({type:"file",file:t},s);return l.type==="file"?l:void 0}}getPlainFileAST(t,n,s,a){if(this.highlighter==null){this.queueInitialization();return}return He(t,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:n,totalLines:s,lines:a})}highlightDiffAST(t,n){let s=this.getDiffResultCache(n);if(Z(n)||s!=null&&A(s.options,this.getDiffRenderOptions()))return;if(!this.hasMatchingDiffInstanceTask(t,n))this.submitTask(t,{type:"diff",diff:n})}primeDiffHighlightCache(t){if(!this.isWorkingPool())return Promise.reject(Error("WorkerPoolManager.primeDiffHighlightCache: worker pool is not working"));let n=this.getOrCreateDiffHighlightCacheTask(t);return n!=null?this.createRenderTaskCallbacks(n):Promise.resolve()}getOrCreateDiffHighlightCacheTask(t){if(t.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${t.prevName??t.name}" -> "${t.name}".`);return}let n=this.getDiffResultCache(t),s=this.getDiffHighlightKey(t);if(s==null||Z(t)||n!=null&&A(n.options,this.getDiffRenderOptions()))return;let a=this.getTaskByHighlightKey(s);if(a!=null)return a.primeCache=!0,a.type==="diff"?a:void 0;else{let l=this.submitCacheTask({type:"diff",diff:t},s);return l.type==="diff"?l:void 0}}getPlainDiffAST(t,n,s,a,l){return this.highlighter!=null?Ze(t,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:n,totalLines:s,expandedHunks:a,collapsedContextThreshold:l}):void 0}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let t=new Zi;for(let n of this.queuedTasks)this.rejectRenderTaskCallbacks(n,t);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(t){return this.lifecycleGeneration===t}queueInitialization(t){this.initialize(t).catch((n)=>{console.error(n)})}cancelActiveWorkerTasks(){let t=new Zi;for(let n of this.activeTaskById.values())if("reject"in n)n.reject(t);else if(Pn(n))this.rejectRenderTaskCallbacks(n,t)}terminateWorkers(){for(let t of this.workers)t.worker.terminate();this.workers.length=0}getStats(){return{managerState:(()=>{if(this.initialized===!1)return"waiting";if(this.initialized!==!0)return"initializing";return"initialized"})(),totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter((t)=>t.requestId!=null||t.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(t,n){if(this.initialized===!1)this.queueInitialization();let s=this.getHighlightKeyForRequest(n),a=s!=null?this.getTaskByHighlightKey(s):void 0;if(a!=null){this.detachInstanceFromQueuedTasks(t,a),this.addInstanceToTask(a,t),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(t);let l=this.generateRequestId(),d=Date.now(),{renderOptionsVersion:h}=this,f=(()=>{switch(n.type){case"file":return{type:"file",id:l,request:{...n,id:l},instances:new Set([t]),primeCache:!1,highlightKey:s,callbacks:new Set,renderOptionsVersion:h,requestStart:d};case"diff":return{type:"diff",id:l,request:{...n,id:l},instances:new Set([t]),primeCache:!1,highlightKey:s,callbacks:new Set,renderOptionsVersion:h,requestStart:d}}})();this.enqueueRenderTask(f,t)}submitCacheTask(t,n){if(this.initialized===!1)this.queueInitialization();let s=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:l}=this,d=(()=>{switch(t.type){case"file":return{type:"file",id:s,request:{...t,id:s},instances:new Set,primeCache:!0,highlightKey:n,callbacks:new Set,renderOptionsVersion:l,requestStart:a};case"diff":return{type:"diff",id:s,request:{...t,id:s},instances:new Set,primeCache:!0,highlightKey:n,callbacks:new Set,renderOptionsVersion:l,requestStart:a}}})();return this.enqueueRenderTask(d),d}enqueueRenderTask(t,n){if(this.queuedTasks.push(t),n!=null)this.queuedTaskByInstance.set(n,t);if(t.highlightKey!=null)this.taskByHighlightKey.set(t.highlightKey,t);this.queueDrain()}async resolveLanguagesAndExecuteTask(t,n,s){try{let a=s.filter((d)=>!U(d));if(a.length>0)j({themes:C(this.renderOptions.theme),langs:["text",...a],preferredHighlighter:this.preferredHighlighter}).catch((d)=>{console.error(d)});let l=s.filter((d)=>!t.langs.has(d));if(l.length>0)if(at(l))n.request.resolvedLanguages=nt(l);else n.request.resolvedLanguages=await rt(l);if(!this.activeTaskById.has(n.id)){if(t.requestId===n.id){if(this.cleanWorkerAndTask(t,n),this.queueBroadcastStateChanges(),this.queuedTasks.length>0)this.queueDrain()}return}this.executeTask(t,n)}catch(a){if(this.rejectRenderTaskCallbacks(n,eo(a)),this.cleanWorkerAndTask(t,n),this.queueBroadcastStateChanges(),this.queuedTasks.length>0)this.queueDrain()}}handleWorkerMessage(t,n){let s=this.activeTaskById.get(n.id);try{if(s==null)throw Ji;else if(n.type==="error"){let a=Error(n.error);if(n.stack)a.stack=n.stack;if("reject"in s)s.reject(a);else if(Pn(s))this.notifyHighlightError(s,a),this.rejectRenderTaskCallbacks(s,a);else throw Error("handleWorkerMessage: unknown task type");throw a}else{if(Pn(s))for(let{name:a}of s.request.resolvedLanguages??[])t.langs.add(a);switch(n.requestType){case"initialize":if(s.type!=="initialize")throw Error("handleWorkerMessage: task/response dont match");this.syncCustomExtensionVersion(t,s.request),s.resolve();break;case"set-render-options":if(s.type!=="set-render-options")throw Error("handleWorkerMessage: task/response dont match");s.resolve();break;case"file":{if(s.type!=="file")throw Error("handleWorkerMessage: task/response dont match");let{result:a,options:l}=n;if(!this.isCurrentRenderTask(s)||!L(l,this.getFileRenderOptions()))throw Ji;let{request:d}=s;if(this.syncCustomExtensionVersion(t,d),s.cacheKeyAtDispatch!=null)this.fileCache.set(s.cacheKeyAtDispatch,{result:a,options:l});this.resolveRenderTaskCallbacks(s),this.notifyFileInstances(s,a,l);break}case"diff":{if(s.type!=="diff")throw Error("handleWorkerMessage: task/response dont match");let{result:a,options:l}=n;if(!this.isCurrentRenderTask(s)||!A(l,this.getDiffRenderOptions()))throw Ji;let{request:d}=s;if(this.syncCustomExtensionVersion(t,d),s.cacheKeyAtDispatch!=null)this.diffCache.set(s.cacheKeyAtDispatch,{result:a,options:l});this.resolveRenderTaskCallbacks(s),this.notifyDiffInstances(s,a,l);break}}}}catch(a){if(a!==Ji)console.error(a,s,n)}if(this.cleanWorkerAndTask(t,s,n.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0)this.queueDrain()}_queuedDrain;queueDrain(){if(this._queuedDrain!=null)return;this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges()}assignWorkerToTask(t,n){if(n.requestId=t.id,Pn(t))this.clearQueuedInstanceRequests(t),this.trackInstanceRequests(t);this.activeTaskById.set(t.id,t)}cleanWorkerAndTask(t,n,s=n?.id){if(t.requestId===s)t.requestId=void 0;if(t.pendingSetupRequestId===s)t.pendingSetupRequestId=void 0;if(n!=null){if(Pn(n))this.rejectRenderTaskCallbacks(n,new ts),this.clearInstanceRequests(n),this.clearHighlightKey(n);this.activeTaskById.delete(n.id)}}executeTask(t,n){if(Yh(n.request))this.maybeAttachCustomExtensions(t,n.request);if(!this.activeTaskById.has(n.id))this.assignWorkerToTask(n,t);try{if(n.type==="file")n.cacheKeyAtDispatch=n.request.file.cacheKey;else if(n.type==="diff")n.cacheKeyAtDispatch=n.request.diff.cacheKey;t.worker.postMessage(n.request)}catch(s){if(console.error("Failed to post message to worker:",s),Pn(n))this.notifyHighlightError(n,s),this.rejectRenderTaskCallbacks(n,eo(s));else if("reject"in n)n.reject(s);if(this.cleanWorkerAndTask(t,n),this.queuedTasks.length>0)this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(t,n){if(n.customExtensionsVersion!=null)return;let s=et();if(t.customExtensionsVersion>=s)return;n.customExtensionsVersion=s,n.customExtensionMap=tt()}syncCustomExtensionVersion(t,n){if(n.customExtensionsVersion==null)return;t.customExtensionsVersion=n.customExtensionsVersion}getAvailableWorker(t){let n;for(let s of this.workers){if(s.requestId!=null||s.pendingSetupRequestId!=null||!s.initialized)continue;if(n=s,t.length===0)break;let a=!0;for(let l of t)if(!s.langs.has(l)){a=!1;break}if(a)break}return n}getFileHighlightKey(t){if(t.cacheKey==null)return;return`file:${t.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(t){if(t.cacheKey==null)return;return`diff:${t.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(t){switch(t.type){case"file":return this.getFileHighlightKey(t.file);case"diff":return this.getDiffHighlightKey(t.diff)}}hasActiveRequest(t){for(let n of fi(t))if(this.activeRequestByInstance.has(n))return!0;return!1}addInstanceToTask(t,n){if(t.type==="file")t.instances.add(n);else t.instances.add(n);if(this.activeTaskById.has(t.id))this.activeRequestByInstance.set(n,t.id);else this.queuedTaskByInstance.set(n,t)}detachInstanceFromQueuedTasks(t,n){let s=this.queuedTaskByInstance.get(t);if(s==null||s===n)return;if(this.queuedTaskByInstance.delete(t),this.detachInstanceFromRenderTask(s,t),!s.primeCache&&s.instances.size===0)this.removeQueuedTask(s)}detachInstanceFromRenderTask(t,n){if(t.type==="file")t.instances.delete(n);else t.instances.delete(n)}removeQueuedTask(t){let n=this.queuedTasks.indexOf(t);if(n!==-1)this.queuedTasks.splice(n,1);this.rejectRenderTaskCallbacks(t,new ts),this.clearQueuedInstanceRequests(t),this.clearHighlightKey(t)}removeActiveTask(t){this.rejectRenderTaskCallbacks(t,new ts),this.clearInstanceRequests(t),this.clearHighlightKey(t),this.activeTaskById.delete(t.id)}createRenderTaskCallbacks(t){return new Promise((n,s)=>{t.callbacks.add({resolve:n,reject:s})})}resolveRenderTaskCallbacks(t){for(let n of t.callbacks)n.resolve();t.callbacks.clear()}rejectRenderTaskCallbacks(t,n){for(let s of t.callbacks)s.reject(n);t.callbacks.clear()}invalidateRenderTasks(){for(let t=this.queuedTasks.length-1;t>=0;t--){let n=this.queuedTasks[t];if(n.renderOptionsVersion!==this.renderOptionsVersion)this.removeQueuedTask(n)}for(let t of Array.from(this.activeTaskById.values()))if(Pn(t)&&t.renderOptionsVersion!==this.renderOptionsVersion)this.removeActiveTask(t)}clearQueuedInstanceRequests(t){for(let n of fi(t))if(this.queuedTaskByInstance.get(n)===t)this.queuedTaskByInstance.delete(n)}clearHighlightKey(t){if(t.highlightKey!=null&&this.taskByHighlightKey.get(t.highlightKey)===t)this.taskByHighlightKey.delete(t.highlightKey)}trackInstanceRequests(t){for(let n of fi(t))this.activeRequestByInstance.set(n,t.id)}clearInstanceRequests(t){for(let n of fi(t))if(this.activeRequestByInstance.get(n)===t.id)this.activeRequestByInstance.delete(n)}notifyFileInstances(t,n,s){for(let a of t.instances)if(this.activeRequestByInstance.get(a)===t.id)a.onHighlightSuccess(t.request.file,n,s)}notifyDiffInstances(t,n,s){for(let a of t.instances)if(this.activeRequestByInstance.get(a)===t.id)a.onHighlightSuccess(t.request.diff,n,s)}notifyHighlightError(t,n){for(let s of fi(t))if(this.activeRequestByInstance.get(s)===t.id)s.onHighlightError(n)}hasMatchingFileInstanceTask(t,n){for(let s of this.iterateRenderTasks())if(s.type==="file"&&this.isCurrentRenderTask(s)&&s.instances.has(t)&&be(n,s.request.file))return!0;return!1}hasMatchingDiffInstanceTask(t,n){for(let s of this.iterateRenderTasks())if(s.type==="diff"&&this.isCurrentRenderTask(s)&&s.instances.has(t)&&m(s.request.diff,n))return!0;return!1}getTaskByHighlightKey(t){let n=this.taskByHighlightKey.get(t);return n!=null&&this.isCurrentRenderTask(n)?n:void 0}isCurrentRenderTask(t){return t.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let t of this.queuedTasks)yield t;for(let t of this.activeTaskById.values())if(Pn(t))yield t}generateRequestId(){return`req_${++this.nextRequestId}`}};function Yh(t){return t.type==="initialize"||t.type==="file"||t.type==="diff"}function Qh(t){let n=new Set;if(t.type==="initialize"||t.type==="set-render-options")return[];switch(t.type){case"file":n.add(t.request.file.lang??p(t.request.file.name));break;case"diff":n.add(t.request.diff.lang??p(t.request.diff.name)),n.add(t.request.diff.lang??p(t.request.diff.prevName??"-"))}return n.delete("text"),Array.from(n)}function Pn(t){return t?.type==="file"||t?.type==="diff"}function fi(t){return t.instances}function eo(t){if(t instanceof Error)return t;if(t!=null&&typeof t==="object"){if("error"in t&&t.error instanceof Error)return t.error;if("message"in t&&typeof t.message==="string")return Error(t.message)}return Error(String(t))}var pi;function is({poolOptions:t,highlighterOptions:n}){return pi??=new rs(t,n),pi}function os(){if(pi==null)return;pi.terminate(),pi=void 0}var Jh=[`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
|
|
2
2
|
<path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
|
|
3
3
|
<path fill="currentColor" d="M11.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zM7 6.75C7 6.42 6.64 6 6 6s-1 .42-1 .75q-.01.25.22.41.26.21.89.35.74.14 1.28.53c.37.29.61.7.61 1.21 0 .87-.68 1.5-1.5 1.7v.55a.5.5 0 0 1-1 0v-.56c-.82-.18-1.5-.82-1.5-1.69a.5.5 0 0 1 1 0c0 .33.36.75 1 .75s1-.42 1-.75q.01-.25-.22-.41a2 2 0 0 0-.89-.35q-.74-.14-1.28-.53A1.5 1.5 0 0 1 4 6.75c0-.87.68-1.5 1.5-1.7V4.5a.5.5 0 0 1 1 0v.56c.82.18 1.5.82 1.5 1.69a.5.5 0 0 1-1 0" class="fg-stroke"/>
|
|
4
4
|
</symbol>`,`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
|
|
@@ -147,10 +147,10 @@ import{u,U,C,Ne,j,ae,E,ze,L,p,Je,et,He,V,Ue,m,be,Gt,A,Ze,Z,Ht,tt,nt,at,rt,it,x,U
|
|
|
147
147
|
</symbol>`,`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
|
|
148
148
|
<path fill="currentColor" d="m14.73 1.5-7.29 8.82h4.17l-1.73 2.04H5.76L1.27 14.5l7.3-8.91H4.39l1.73-2.05h4.12z"/>
|
|
149
149
|
<path fill="currentColor" d="M5.21 3.54 3.56 5.6h-.55v4.73h.83L2.1 12.36H1V3.54zm9.79 0v8.82h-4.3l1.74-2.04h.55V5.68h-.83l1.74-2.14z"/>
|
|
150
|
-
</symbol>`];function
|
|
150
|
+
</symbol>`];function ja(t,n){if(n.length===0)return t;return t.replace("</svg>",`
|
|
151
151
|
${n.join(`
|
|
152
152
|
`)}
|
|
153
|
-
</svg>`)}var
|
|
153
|
+
</svg>`)}var Wa=ja(`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
154
154
|
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
155
155
|
<path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
|
|
156
156
|
</symbol>
|
|
@@ -167,7 +167,7 @@ import{u,U,C,Ne,j,ae,E,ze,L,p,Je,et,He,V,Ue,m,be,Gt,A,Ze,Z,Ht,tt,nt,at,rt,it,x,U
|
|
|
167
167
|
<symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
|
|
168
168
|
<path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />
|
|
169
169
|
</symbol>
|
|
170
|
-
</svg>`,
|
|
170
|
+
</svg>`,Jh),ef={minimal:`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
171
171
|
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
172
172
|
<path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
|
|
173
173
|
</symbol>
|
|
@@ -184,7 +184,7 @@ import{u,U,C,Ne,j,ae,E,ze,L,p,Je,et,He,V,Ue,m,be,Gt,A,Ze,Z,Ht,tt,nt,at,rt,it,x,U
|
|
|
184
184
|
<symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
|
|
185
185
|
<path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />
|
|
186
186
|
</symbol>
|
|
187
|
-
</svg>`,standard:qa,complete:Wa(qa,Zh)},ef={".babelrc":"babel",".babelrc.json":"babel",".bash_profile":"bash",".bashrc":"bash",".browserslistrc":"browserslist",".dockerignore":"docker",".eslintignore":"eslint",".eslintrc":"eslint",".eslintrc.cjs":"eslint",".eslintrc.js":"eslint",".eslintrc.json":"eslint",".eslintrc.yaml":"eslint",".eslintrc.yml":"eslint",".gitattributes":"git",".gitignore":"git",".gitkeep":"git",".gitmodules":"git",".oxlintrc.json":"oxc",".postcssrc":"postcss",".postcssrc.json":"postcss",".postcssrc.yaml":"postcss",".postcssrc.yml":"postcss",".prettierignore":"prettier",".prettierrc":"prettier",".prettierrc.cjs":"prettier",".prettierrc.js":"prettier",".prettierrc.json":"prettier",".prettierrc.mjs":"prettier",".prettierrc.toml":"prettier",".prettierrc.yaml":"prettier",".prettierrc.yml":"prettier",".stylelintignore":"stylelint",".stylelintrc":"stylelint",".stylelintrc.cjs":"stylelint",".stylelintrc.js":"stylelint",".stylelintrc.json":"stylelint",".stylelintrc.mjs":"stylelint",".stylelintrc.yaml":"stylelint",".stylelintrc.yml":"stylelint",".terraform.lock.hcl":"terraform",".zprofile":"bash",".zshenv":"bash",".zshrc":"bash","babel.config.cjs":"babel","babel.config.js":"babel","babel.config.json":"babel","babel.config.mjs":"babel","biome.json":"biome","biome.jsonc":"biome","bootstrap.bundle.js":"bootstrap","bootstrap.bundle.min.js":"bootstrap","bootstrap.css":"bootstrap","bootstrap.js":"bootstrap","bootstrap.min.css":"bootstrap","bootstrap.min.js":"bootstrap","bun.lock":"bun","bun.lockb":"bun","bunfig.toml":"bun","claude.md":"claude","compose.yaml":"docker","compose.yml":"docker","docker-compose.override.yml":"docker","docker-compose.yaml":"docker","docker-compose.yml":"docker",dockerfile:"docker","eslint.config.cjs":"eslint","eslint.config.js":"eslint","eslint.config.mjs":"eslint","eslint.config.mts":"eslint","eslint.config.ts":"eslint",gemfile:"ruby","next.config.js":"nextjs","next.config.mjs":"nextjs","next.config.mts":"nextjs","next.config.ts":"nextjs","postcss.config.cjs":"postcss","postcss.config.js":"postcss","postcss.config.mjs":"postcss","postcss.config.ts":"postcss","prettier.config.cjs":"prettier","prettier.config.js":"prettier","prettier.config.mjs":"prettier",rakefile:"ruby","readme.md":"markdown","stylelint.config.cjs":"stylelint","stylelint.config.js":"stylelint","stylelint.config.mjs":"stylelint","svgo.config.cjs":"svgo","svgo.config.js":"svgo","svgo.config.mjs":"svgo","svgo.config.ts":"svgo","tailwind.config.cjs":"tailwind","tailwind.config.js":"tailwind","tailwind.config.mjs":"tailwind","tailwind.config.ts":"tailwind","vite.config.js":"vite","vite.config.mjs":"vite","vite.config.mts":"vite","vite.config.ts":"vite","webpack.config.babel.js":"webpack","webpack.config.cjs":"webpack","webpack.config.js":"webpack","webpack.config.mjs":"webpack","webpack.config.ts":"webpack"},tf={"7z":"zip",astro:"astro",AUTHORS:"text",avif:"image",bash:"bash",bmp:"image",bz2:"zip",c:"c",cc:"cpp",cfg:"text",CHANGELOG:"text",cjs:"javascript","code-workspace":"vscode",conf:"text",CONTRIBUTORS:"text",cpp:"cpp",csh:"bash",css:"css",csv:"table",cts:"typescript",cxx:"cpp",db:"database",editorconfig:"text",env:"text","env.development":"text","env.local":"text","env.production":"text",eot:"font",erb:"ruby",fish:"bash",gemspec:"ruby",gif:"image",go:"go",gql:"graphql",graphql:"graphql",gz:"zip",h:"c",hh:"cpp",hpp:"cpp",htm:"html",html:"html",hxx:"cpp",icns:"image",ico:"image",ini:"text",inl:"cpp",jar:"zip",jpeg:"image",jpg:"image",js:"javascript",json:"json",json5:"json",jsonc:"json",jsonl:"json",jsx:"javascript",ksh:"bash",less:"css",LICENSE:"text",log:"text",markdown:"markdown",mcp:"mcp",md:"markdown",mdx:"markdown","mdx.tsx":"markdown",mjs:"javascript",mm:"cpp",mts:"typescript",ods:"table",otf:"font",png:"image",postcss:"css",py:"python",pyi:"python",pyw:"python",pyx:"python",rake:"ruby",rar:"zip",rb:"ruby",rs:"rust",rst:"text",rtf:"text",sass:"css",scss:"css",sh:"bash",sql:"database",sqlite:"database",sqlite3:"database",styl:"css",svelte:"svelte",svg:"svg",swift:"swift",tar:"zip",tf:"terraform",tfstate:"terraform",tfvars:"terraform",tgz:"zip",tif:"image",tiff:"image",ts:"typescript",tsv:"table",tsx:"typescript",ttf:"font",txt:"text",vue:"vue",war:"zip",wasm:"wasm",wast:"wasm",wat:"wasm",webp:"image",woff:"font",woff2:"font",xhtml:"html",xls:"table",xlsx:"table",xz:"zip",yaml:"yml",yml:"yml",zig:"zig",zip:"zip",zsh:"bash"},nf={jsx:"react",sass:"sass",scss:"sass",tsx:"react"},za=new Set(["bash","c","cpp","css","database","default","font","git","go","html","image","javascript","json","markdown","mcp","python","ruby","rust","swift","table","text","typescript","zip"]),rf=new Set(["complete"]);function ss(t){return Jh[t==="none"?"minimal":t]}function $a(t){return`file-tree-builtin-${t}`}function ja(t){return t!=="none"&&rf.has(t)}function Ka(t,n,s){if(t==="minimal"||t==="none")return;let a=t==="complete",l=ef[n.toLowerCase()];if(l!=null){if(a||za.has(l))return l}for(let d of s){if(a){let f=nf[d];if(f!=null)return f}let h=tf[d];if(h!=null){if(a||za.has(h))return h}}return"default"}var no="file-tree-container",gi="data-file-tree-style",ro="data-file-tree-unsafe-css",as="data-file-tree-scrollbar-measure",io="data-file-tree-scrollbar-gutter-measured",ls="--trees-scrollbar-gutter-measured";var kr="header",Cr="context-menu",cs="context-menu-trigger";function of(t){return t.spriteSheet!=null||t.remap!=null||t.byFileName!=null||t.byFileExtension!=null||t.byFileNameContains!=null}function xr(t){if(t==null)return{set:"complete",colored:!0};if(typeof t==="string")return{set:t,colored:!0};return{...t,set:t.set??(of(t)?"none":"complete"),colored:t.colored??!0}}var sf=(t)=>t.trim().toLowerCase(),af=(t)=>t.split("/").at(-1)??t,lf=(t)=>{let n=t.toLowerCase().split("."),s=[];for(let a=1;a<n.length;a+=1)s.push(n.slice(a).join("."));return s};function vi(t,n){if(typeof t==="string")return{name:t,remappedFrom:n};return{...t,remappedFrom:n}}function ds(t){let n=xr(t),s=n.remap,a=new Map;for(let[f,g]of Object.entries(n.byFileName??{}))a.set(f.toLowerCase(),g);let l=new Map;for(let[f,g]of Object.entries(n.byFileExtension??{}))l.set(sf(f),g);let d=Object.entries(n.byFileNameContains??{}).map(([f,g])=>[f.toLowerCase(),g]);return{resolveIcon:(f,g)=>{if(f==="file-tree-icon-file"&&g!=null){let w=af(g),I=w.toLowerCase(),v=a.get(I);if(v!=null)return vi(v,f);for(let[T,R]of d)if(I.includes(T))return vi(R,f);let _=lf(w);for(let T of _){let R=l.get(T);if(R!=null)return vi(R,f)}let k=Ka(n.set,w,_);if(k!=null&&n.set!=="none"){if(k==="default"){let T=s?.[f];if(T!=null)return vi(T,f)}return{name:$a(k),remappedFrom:f,token:k}}}let b=s?.[f];if(b==null)return{name:f};return vi(b,f)}}}function sr(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function us(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Wn(t,n){if(n.childIdByNameId!=null)return n.childIdByNameId;let s=new Map;for(let a of n.childIds){let l=t[a];if(l!=null)s.set(l.nameId,a)}return n.childIdByNameId=s,s}function _r(t){if(t.childPositionById!=null)return t.childPositionById;let n=new Map;for(let s=0;s<t.childIds.length;s++){let a=t.childIds[s];if(a!=null)n.set(a,s)}return t.childPositionById=n,n}function Er(t,n){if(t.childPositionById!=null)t.childPositionById.set(n,t.childIds.length);t.childIds.push(n)}function hs(t,n){if(t.childPositionById==null)return;for(let s=n;s<t.childIds.length;s++){let a=t.childIds[s];if(a!=null)t.childPositionById.set(a,s)}}function ar(t,n){let s=0,a=0;for(let l of n.childIds){let d=t[l];if(d==null)continue;s+=d.subtreeNodeCount,a+=d.visibleSubtreeCount}n.totalChildSubtreeNodeCount=s,n.totalChildVisibleSubtreeCount=a,$n(t,n)}function oo(t,n,s,a){if(t.totalChildSubtreeNodeCount+=s,t.totalChildVisibleSubtreeCount+=a,t.childVisibleChunkSums==null||a===0)return;let l=_r(t).get(n);if(l===void 0)return;let d=l>>5;t.childVisibleChunkSums[d]+=a}function so(t,n,s){let a=n.childVisibleChunkSums;if(a!=null){let d=s,h=0;for(let f of a){if(d<f){let g=hf(t,n,h,d);return{...g,childVisibleIndex:s-g.localVisibleIndex}}d-=f,h+=32}throw Error(`Visible child index ${String(s)} is out of range`)}let l=s;for(let d=0;d<n.childIds.length;d++){let h=n.childIds[d];if(h==null)continue;let f=t[h];if(f==null)continue;if(l<f.visibleSubtreeCount)return{childIndex:d,childVisibleIndex:s-l,localVisibleIndex:l};l-=f.visibleSubtreeCount}throw Error(`Visible child index ${String(s)} is out of range`)}function Ua(t,n,s){let a=0,l=n.childVisibleChunkSums,d=0;if(l!=null){let h=s>>5;for(let f=0;f<h;f+=1)a+=l[f]??0;d=h<<5}for(let h=d;h<s;h+=1){let f=n.childIds[h];if(f==null)continue;let g=t[f];if(g==null)continue;a+=g.visibleSubtreeCount}return a}function $n(t,n){if(n.childIds.length<128){n.childVisibleChunkSums=null;return}let s=Math.ceil(n.childIds.length/32),a=new Int32Array(s);for(let l=0;l<n.childIds.length;l++){let d=n.childIds[l];if(d==null)continue;let h=t[d];if(h==null)continue;a[l>>5]+=h.visibleSubtreeCount}n.childVisibleChunkSums=a}function hf(t,n,s,a){let l=Math.min(n.childIds.length,s+32),d=a;for(let h=s;h<l;h++){let f=n.childIds[h];if(f==null)continue;let g=t[f];if(g==null)continue;if(d<g.visibleSubtreeCount)return{childIndex:h,localVisibleIndex:d};d-=g.visibleSubtreeCount}throw Error(`Visible child index ${String(a)} is out of range`)}function Vt(t,n,s=0){return t<<4|s<<3|n}function jt(t){return t.depthAndFlags>>>4}function yi(t){return(t.depthAndFlags&8)>>3}function Y(t){return(t.depthAndFlags&8)!==0}function Ga(t){return t.depthAndFlags&7}function Ge(t,n){return(Ga(t)&n)!==0}function Tr(t,n){t.depthAndFlags|=n}function Xa(t,n){t.depthAndFlags=Vt(n,Ga(t),yi(t))}var Ya=Symbol("benchmarkInstrumentation");function Qa(t,n){if(n==null)return t;return Object.defineProperty(t,Ya,{configurable:!0,enumerable:!1,value:n,writable:!1}),t}function bi(t){if(t==null)return null;return t[Ya]??null}function W(t,n,s){if(t==null)return s();return t.measurePhase(n,s)}function Pr(t,n,s){if(!Number.isFinite(s)||t==null)return;t.setCounter(n,s)}function Za(t){return t>=48&&t<=57}function ff(t){let n=[],s=0,a=0;while(a<t.length){while(a<t.length&&!Za(t.charCodeAt(a)))a+=1;if(a>=t.length)break;if(a>s)n.push(t.slice(s,a));let l=0;while(a<t.length&&Za(t.charCodeAt(a)))l=l*10+(t.charCodeAt(a)-48),a+=1;n.push(l),s=a}if(s<t.length||n.length===0)n.push(t.slice(s));return n}function lr(t){let n=t.toLowerCase();return{lowerValue:n,tokens:ff(n)}}function pf(t,n){let s=Math.min(t.length,n.length);for(let a=0;a<s;a++){let l=t[a],d=n[a];if(l===d)continue;if(typeof l==="number"&&typeof d==="number")return l<d?-1:1;let h=String(l),f=String(d);if(h!==f)return h<f?-1:1}if(t.length!==n.length)return t.length<n.length?-1:1;return 0}function wi(t,n){if(t.tokens.length===1&&n.tokens.length===1&&typeof t.tokens[0]==="string"&&typeof n.tokens[0]==="string"){if(t.lowerValue===n.lowerValue)return 0;return t.lowerValue<n.lowerValue?-1:1}let s=pf(t.tokens,n.tokens);if(s!==0)return s;if(t.lowerValue!==n.lowerValue)return t.lowerValue<n.lowerValue?-1:1;return 0}function Ja(t,n,s){let a=wi(s(t),s(n));if(a!==0)return a;if(t===n)return 0;return t<n?-1:1}function mf(t,n){return Ja(t,n,lr)}function ao(t,n){if(n!==t.segments.length-1)return 1;return t.isDirectory?1:0}function gf(t,n){let s=Math.min(t.segments.length,n.segments.length);for(let a=0;a<s;a++){let l=t.segments[a],d=n.segments[a];if(l===d)continue;let h=ao(t,a);if(h!==ao(n,a))return h===1?-1:1;return mf(l,d)}if(t.segments.length!==n.segments.length)return t.segments.length<n.segments.length?-1:1;if(t.isDirectory===n.isDirectory)return 0;return t.isDirectory?-1:1}function el(t,n){return gf(t,n)}function tl(t,n,s){let a=(d)=>{let h=s.get(d);if(h!=null)return h;let f=lr(d);return s.set(d,f),f},l=Math.min(t.segments.length,n.segments.length);for(let d=0;d<l;d++){let h=t.segments[d],f=n.segments[d];if(h===f)continue;let g=ao(t,d);if(g!==ao(n,d))return g===1?-1:1;return Ja(h,f,a)}if(t.segments.length!==n.segments.length)return t.segments.length<n.segments.length?-1:1;if(t.isDirectory===n.isDirectory)return 0;return t.isDirectory?-1:1}function Si(t,n){let s=t.sortKeyById[n];if(s!==void 0)return s;let a=t.valueById[n],l=lr(a);return t.sortKeyById[n]=l,l}function fs(t={}){return{flattenEmptyDirectories:t.flattenEmptyDirectories!==!1,sort:t.sort??"default"}}function nl(t){let n=t.length>0&&t.charCodeAt(t.length-1)===47,s=n?t.length-1:t.length,a=[],l=0;for(let d=0;d<s;d++){if(t.charCodeAt(d)!==47)continue;a.push(t.slice(l,d)),l=d+1}return a.push(t.slice(l,s)),{hasTrailingSlash:n,segments:a}}function cr(t){let{hasTrailingSlash:n,segments:s}=nl(t);return{basename:s[s.length-1]??"",isDirectory:n,path:t,segments:s}}function lo(t){if(t.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:n,segments:s}=nl(t);return{requiresDirectory:n,segments:s}}function co(){let t=new Map;return t.set("",0),{idByValue:t,valueById:[""],sortKeyById:[lr("")]}}function fn(t,n){let s=t.idByValue.get(n);if(s!==void 0)return s;let a=t.valueById.length;return t.idByValue.set(n,a),t.valueById.push(n),a}function Xt(t,n){let s=t.valueById[n];if(s===void 0)throw Error(`Unknown segment ID: ${String(n)}`);return s}var ps=Symbol("pathStorePreparedInputKind");function ol(t,n){return t[ps]=n,t}function rl(t){return{basename:t.basename,depth:t.segments.length,isDirectory:t.isDirectory,path:t.path,segments:t.segments}}function sl(t,n,s){if(s==="default")return el(t,n);return s(rl(t),rl(n))}function vf(){return{depthAndFlags:Vt(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function yf(t,n){let s=Math.min(t.length,n.length);for(let a=0;a<s;a++)if(t[a]!==n[a])return a;return s}function il(t){return t.isDirectory?t.segments.length:t.segments.length-1}function bf(t){return Array.isArray(t)&&t.every((n)=>n!=null&&typeof n==="object"&&typeof n.path==="string"&&Array.isArray(n.segments)&&typeof n.basename==="string"&&typeof n.isDirectory==="boolean")}function wf(t){return Array.isArray(t)&&t.every((n)=>typeof n==="string")}function al(t,n={}){return uo(t,n).map((s)=>s.path)}function ll(t,n={}){let s=uo(t,n);return ol({paths:s.map((a)=>a.path),preparedPaths:s},"prepared")}function cl(t){let n=t.length,s=!1;for(let a=0;a<n;a+=1){let l=t[a];if(l.length>0&&l.charCodeAt(l.length-1)===47){s=!0;break}}return ol({paths:t,presortedPaths:t,presortedPathsContainDirectories:s},"presorted")}function dl(t){let n=t,s=n.preparedPaths;if(n[ps]==="prepared"&&s!=null)return s;if(!bf(s))throw Error("preparedInput must come from PathStore.prepareInput()");return s}function ul(t){let n=t;if(n[ps]==="presorted"&&n.presortedPaths!=null)return n.presortedPaths;return wf(n.presortedPaths)?n.presortedPaths:null}function hl(t){let n=t;return typeof n.presortedPathsContainDirectories==="boolean"?n.presortedPathsContainDirectories:null}function uo(t,n={}){let s=fs(n),a=bi(n);Pr(a,"workload.inputFiles",t.length);let l=W(a,"store.preparePathEntries.parse",()=>t.map((d)=>cr(d)));return W(a,"store.preparePathEntries.sort",()=>l.sort((d,h)=>sl(d,h,s.sort))),l}var ho=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[vf()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=co();hasDeferredDirectoryIndexes=!1;constructor(t={}){this.instrumentation=bi(t),this.options=fs(t);let n=t.initialExpandedPaths??null;if(n==null||n.length===0)this.initialExpandedPathSet=null;else{let s=new Set,a=n.length;for(let l=0;l<a;l+=1){let d=n[l],h=d.length;s.add(h>0&&d.charCodeAt(h-1)===47?d.slice(0,h-1):d)}this.initialExpandedPathSet=s,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,sr())}appendPaths(t){return W(this.instrumentation,"store.builder.appendPaths.parse",()=>this.appendPreparedPaths(t.map((n)=>cr(n))))}appendPreparedPaths(t,n=!0){return this.createdDirectoriesAllExpanded=!1,W(this.instrumentation,"store.builder.appendPreparedPaths",()=>{for(let s of t)this.appendPreparedPath(s,n)}),this}appendPresortedPaths(t,n=null){return W(this.instrumentation,"store.builder.appendPresortedPaths",()=>{if(n===!1){this.appendPresortedFilePaths(t);return}this.createdDirectoriesAllExpanded=!1;let s=null,a=0,l=this.nodes,d=this.segmentTable,{idByValue:h,valueById:f}=d,g=this.directoryStack,b=0,w="",I=0;for(let v of t){if(s===v)throw Error(`Duplicate path: "${v}"`);let _=v.length>0&&v.charCodeAt(v.length-1)===47,k=_?v.length-1:v.length,T=0,R=0;if(s!=null)if(w.length>0&&v.length>w.length&&v.startsWith(w))T=I,R=w.length;else{let D=Math.min(k,s.length),N=!0;for(let H=0;H<D;H++){let X=v.charCodeAt(H);if(X!==s.charCodeAt(H)){N=!1;break}if(X===47)T++,R=H+1}if(N&&_&&D===k&&s.length>k&&s.charCodeAt(k)===47)T++,R=k+1}b=T,a=T;let B=R,F=v.indexOf("/",B);while(F>=0&&F<k){let D=g[b];if(D===void 0)throw Error("Directory stack underflow while building the path store");a++;let N=v.slice(B,F),H=h.get(N);if(H===void 0)H=f.length,h.set(N,H),f.push(N);let X=l.length;l.push({depthAndFlags:Vt(a,0,1),nameId:H,parentId:D,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(v.slice(0,F)),b++,g[b]=X,B=F+1,F=v.indexOf("/",B)}if(_){if(B<k){let N=g[b];if(N===void 0)throw Error(`Unable to resolve directory parent for "${v}"`);a++;let H=v.slice(B,k),X=h.get(H);if(X===void 0)X=f.length,h.set(H,X),f.push(H);let fe=l.length;l.push({depthAndFlags:Vt(a,0,1),nameId:X,parentId:N,subtreeNodeCount:1,visibleSubtreeCount:1}),b++,g[b]=fe,B=k+1}let D=g[b];if(D===void 0)throw Error(`Unable to resolve directory node for "${v}"`);this.promoteDirectoryToExplicit(D,v)}else{let D=g[b];if(D===void 0)throw Error(`Unable to resolve file parent for "${v}"`);let N=v.slice(B),H=h.get(N);if(H===void 0)H=f.length,h.set(N,H),f.push(N);l.push({depthAndFlags:Vt(a+1,0),nameId:H,parentId:D,subtreeNodeCount:1,visibleSubtreeCount:1})}if(B!==w.length)w=v.substring(0,B),I=a;s=v}if(g.length=b+1,s!=null)this.lastPreparedPath=cr(s);this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(t){let n=null,s=0,a=this.nodes,l=this.segmentTable,{idByValue:d,valueById:h}=l,f=this.directoryStack,g=0,b="",w=0;for(let I of t){if(n===I)throw Error(`Duplicate path: "${I}"`);let v=I.length,_=0,k=0;if(n!=null)if(b.length>0&&I.length>b.length&&I.startsWith(b))_=w,k=b.length;else{let N=Math.min(v,n.length);for(let H=0;H<N;H++){let X=I.charCodeAt(H);if(X!==n.charCodeAt(H))break;if(X===47)_++,k=H+1}}g=_,s=_;let T=k,R=I.indexOf("/",T);while(R>=0){let N=f[g];if(N===void 0)throw Error("Directory stack underflow while building the path store");s++;let H=I.slice(T,R),X=d.get(H);if(X===void 0)X=h.length,d.set(H,X),h.push(H);let fe=a.length;a.push({depthAndFlags:Vt(s,0,1),nameId:X,parentId:N,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(I.slice(0,R)),this.presortedDirectoryNodeIds.push(fe),g++,f[g]=fe,T=R+1,R=I.indexOf("/",T)}let B=f[g];if(B===void 0)throw Error(`Unable to resolve file parent for "${I}"`);let F=I.slice(T),D=d.get(F);if(D===void 0)D=h.length,d.set(F,D),h.push(F);if(a.push({depthAndFlags:Vt(s+1,0),nameId:D,parentId:B,subtreeNodeCount:1,visibleSubtreeCount:1}),T!==b.length)b=I.substring(0,T),w=s;n=I}if(f.length=g+1,n!=null)this.lastPreparedPath=cr(n);this.hasDeferredDirectoryIndexes=!0}finish(t={}){let n=t.skipSubtreeCountPass===!0;if(this.hasDeferredDirectoryIndexes)W(this.instrumentation,"store.builder.buildDirectoryIndexes",()=>this.buildPresortedFinish(n)),this.hasDeferredDirectoryIndexes=!1;else if(!n)W(this.instrumentation,"store.builder.computeSubtreeCounts",()=>this.computeSubtreeCounts(0));return{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(t,n){if(this.hasDeferredDirectoryIndexes)this.buildDirectoryIndexes(),this.hasDeferredDirectoryIndexes=!1;if(this.lastPreparedPath!=null){if(t.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${t.path}"`);if(n){if((this.options.sort==="default"?tl(this.lastPreparedPath,t,this.segmentSortKeyCache):sl(this.lastPreparedPath,t,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${t.path}"`)}}let s=this.lastPreparedPath,a=il(t),l=s==null?0:il(s),d=s==null?0:yf(s.segments,t.segments),h=Math.min(d,a,l);this.directoryStack.length=h+1;for(let g=h;g<a;g++){let b=this.directoryStack[this.directoryStack.length-1];if(b===void 0)throw Error("Directory stack underflow while building the path store");let w=n?this.getOrCreateDirectoryChild(b,t.segments[g]):this.createDirectoryChild(b,t.segments[g]);this.directoryStack.push(w)}if(t.isDirectory){let g=this.directoryStack[this.directoryStack.length-1];if(g===void 0)throw Error(`Unable to resolve directory node for "${t.path}"`);this.promoteDirectoryToExplicit(g,t.path),this.lastPreparedPath=t;return}let f=this.directoryStack[this.directoryStack.length-1];if(f===void 0)throw Error(`Unable to resolve file parent for "${t.path}"`);if(n)this.createFileChild(f,t.basename,t.path);else this.createFileChildUnchecked(f,t.basename);this.lastPreparedPath=t}recordCreatedDirectoryPath(t){if(!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null)return;if(this.createdDirectoryCount+=1,!this.initialExpandedPathSet.has(t))this.createdDirectoriesAllExpanded=!1}createFileChild(t,n,s){let a=fn(this.segmentTable,n),l=this.getDirectoryIndex(t),d=l.childIdByNameId;if(d!=null){if(d.get(a)!==void 0)throw Error(`Path collides with an existing entry: "${s}"`)}let h=this.nodes[t];if(h===void 0)throw Error(`Unknown parent node ID: ${String(t)}`);let f=this.nodes.length;if(this.nodes.push({depthAndFlags:Vt(jt(h)+1,0),nameId:a,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),d!=null)d.set(a,f);return Er(l,f),f}createFileChildUnchecked(t,n){let s=fn(this.segmentTable,n),a=this.getDirectoryIndex(t),l=this.nodes[t];if(l===void 0)throw Error(`Unknown parent node ID: ${String(t)}`);let d=this.nodes.length;if(this.nodes.push({depthAndFlags:Vt(jt(l)+1,0),nameId:s,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),a.childIdByNameId!=null)a.childIdByNameId.set(s,d);return Er(a,d),d}getOrCreateDirectoryChild(t,n){let s=fn(this.segmentTable,n),a=this.getDirectoryIndex(t);if(a.childIdByNameId!=null){let h=a.childIdByNameId.get(s);if(h!==void 0){let f=this.nodes[h];if(f!=null&&!Y(f))throw Error(`Path collides with an existing file while creating directory "${n}"`);return h}}let l=this.nodes[t];if(l===void 0)throw Error(`Unknown parent node ID: ${String(t)}`);let d=this.nodes.length;if(this.nodes.push({depthAndFlags:Vt(jt(l)+1,0,1),nameId:s,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),a.childIdByNameId!=null)a.childIdByNameId.set(s,d);return Er(a,d),this.directories.set(d,sr()),d}createDirectoryChild(t,n){let s=fn(this.segmentTable,n),a=this.getDirectoryIndex(t),l=this.nodes[t];if(l===void 0)throw Error(`Unknown parent node ID: ${String(t)}`);let d=this.nodes.length;if(this.nodes.push({depthAndFlags:Vt(jt(l)+1,0,1),nameId:s,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),a.childIdByNameId!=null)a.childIdByNameId.set(s,d);return Er(a,d),this.directories.set(d,sr()),d}promoteDirectoryToExplicit(t,n){let s=this.nodes[t];if(s===void 0)throw Error(`Unknown directory node ID: ${String(t)}`);if(!Y(s))throw Error(`Path is not a directory: "${n}"`);if(Ge(s,1))throw Error(`Duplicate path: "${n}"`);Tr(s,1)}getDirectoryIndex(t){let n=this.directories.get(t);if(n!==void 0)return n;throw Error(`Unknown directory child index for node ${String(t)}`)}buildPresortedFinish(t){let n=this.nodes,s=this.directories;s.set(0,us());let a=-1,l=null;for(let d=1;d<n.length;d++){let h=n[d];if(h==null)continue;if(Y(h)){let g=us();s.set(d,g),a=d,l=g}let f;if(h.parentId===a)f=l;else f=s.get(h.parentId),a=h.parentId,l=f??null;if(f!=null)f.childIds.push(d)}if(t)return;for(let d=n.length-1;d>=1;d--){let h=n[d];if(h==null)continue;let f=n[h.parentId];if(f!=null)f.subtreeNodeCount+=h.subtreeNodeCount,f.visibleSubtreeCount+=h.visibleSubtreeCount}}buildDirectoryIndexes(){let t=this.nodes;for(let n=1;n<t.length;n++){let s=t[n];if(s==null)continue;if(Y(s))this.directories.set(n,sr());let a=this.directories.get(s.parentId);if(a!=null){if(a.childIdByNameId!=null)a.childIdByNameId.set(s.nameId,n);Er(a,n)}}}computeSubtreeCounts(t){let n=this.nodes[t];if(n===void 0)throw Error(`Unknown node ID: ${String(t)}`);if(!Y(n))return n.subtreeNodeCount=1,n.visibleSubtreeCount=1,1;let s=this.getDirectoryIndex(t),a=1;for(let l of s.childIds)a+=this.computeSubtreeCounts(l);return ar(this.nodes,s),n.subtreeNodeCount=a,n.visibleSubtreeCount=a,a}};function fl(t,n="closed",s=null){let a=Sf(n);return{activeNodeCount:t.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:a,directoriesOpenByDefault:a==="open",hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:s,listeners:new Map,pathCacheByNodeId:new Map([[t.rootId,{path:"",version:0}]]),pathCacheVersion:0,snapshot:t,transactionStack:[]}}function pl(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function Sf(t){if(typeof t!=="number")return t;if(!Number.isInteger(t)||t<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(t)}`);return t}function ml(t,n){if(Ge(n,2))return!0;if(t.defaultExpansion==="open")return!0;if(t.defaultExpansion==="closed")return!1;return jt(n)<=t.defaultExpansion}function Ct(t,n,s=t.snapshot.nodes[n]){if(s==null||!Y(s))return!1;if(t.directoriesOpenByDefault&&!t.hasCollapsedDirectoryOverrides)return!0;if(t.collapsedDirectoryIds.has(n))return!1;if(t.expandedDirectoryIds.has(n))return!0;return ml(t,s)}function jn(t,n,s,a=t.snapshot.nodes[n]){if(a==null||!Y(a))return;let l=ml(t,a);if(s){if(l){t.collapsedDirectoryIds.delete(n),t.hasCollapsedDirectoryOverrides=t.collapsedDirectoryIds.size>0;return}t.expandedDirectoryIds.add(n);return}if(l){t.collapsedDirectoryIds.add(n),t.hasCollapsedDirectoryOverrides=!0;return}t.expandedDirectoryIds.delete(n)}function gl(t,n){let s=t.directoryLoadInfoById.get(n);if(s!=null)return s;let a={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:"loaded"};return t.directoryLoadInfoById.set(n,a),a}function Kn(t,n){return t.directoryLoadInfoById.get(n)?.state??"loaded"}function vl(t,n){let s=gl(t,n);if(s.state==="loading"&&s.activeAttemptId!=null)return{attemptId:s.activeAttemptId,nodeId:n,reused:!0};let a=s.nextAttemptId;return s.activeAttemptId=a,s.errorMessage=null,s.nextAttemptId+=1,s.state="loading",{attemptId:a,nodeId:n,reused:!1}}function yl(t,n){let s=gl(t,n);s.activeAttemptId=null,s.errorMessage=null,s.state="unloaded"}function bl(t,n,s){let a=t.directoryLoadInfoById.get(n);if(a==null||a.activeAttemptId!==s)return!1;return a.activeAttemptId=null,a.errorMessage=null,a.state="loaded",!0}function wl(t,n,s){return t.directoryLoadInfoById.get(n)?.activeAttemptId===s}function Sl(t,n,s,a){let l=t.directoryLoadInfoById.get(n);if(l==null||l.activeAttemptId!==s)return!1;return l.activeAttemptId=null,l.errorMessage=a??null,l.state="error",!0}function Il(t,n){t.directoryLoadInfoById.delete(n)}function El(t,n,s){let a=s,l=t.listeners.get(n);if(l!=null)l.add(a);else t.listeners.set(n,new Set([a]));return()=>{let d=t.listeners.get(n);if(d==null)return;if(d.delete(a),d.size===0)t.listeners.delete(n)}}function Tl(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],canonicalChanged:!0,operation:"add",path:t.path,projectionChanged:t.projectionChanged,visibleCountDelta:null}}function Pl(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],canonicalChanged:!0,operation:"remove",path:t.path,projectionChanged:t.projectionChanged,recursive:t.recursive,visibleCountDelta:null}}function Rl(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],canonicalChanged:!0,from:t.from,operation:"move",projectionChanged:t.projectionChanged,to:t.to,visibleCountDelta:null}}function Dl(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],canonicalChanged:!1,operation:"expand",path:t.path,projectionChanged:!0,visibleCountDelta:null}}function Ml(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],canonicalChanged:!1,operation:"collapse",path:t.path,projectionChanged:!0,visibleCountDelta:null}}function Al(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],canonicalChanged:!1,operation:"mark-directory-unloaded",path:t.path,projectionChanged:t.projectionChanged,visibleCountDelta:null}}function Nl(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],attemptId:t.attemptId,canonicalChanged:!1,operation:"begin-child-load",path:t.path,projectionChanged:t.projectionChanged,reused:t.reused,visibleCountDelta:null}}function Fl(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],attemptId:t.attemptId,canonicalChanged:t.childEvents.some((n)=>n.canonicalChanged),childEvents:t.childEvents,operation:"apply-child-patch",path:t.path,projectionChanged:t.projectionChanged,visibleCountDelta:null}}function Ll(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],attemptId:t.attemptId,canonicalChanged:!1,operation:"complete-child-load",path:t.path,projectionChanged:t.projectionChanged,stale:t.stale,visibleCountDelta:null}}function Bl(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],attemptId:t.attemptId,canonicalChanged:!1,errorMessage:t.errorMessage,operation:"fail-child-load",path:t.path,projectionChanged:t.projectionChanged,stale:t.stale,visibleCountDelta:null}}function Hl(t){return{activeNodeCountAfter:t.activeNodeCountAfter,activeNodeCountBefore:t.activeNodeCountBefore,affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],cachedPathEntryCountAfter:t.cachedPathEntryCountAfter,cachedPathEntryCountBefore:t.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:t.idsPreserved,loadInfoEntryCountAfter:t.loadInfoEntryCountAfter,loadInfoEntryCountBefore:t.loadInfoEntryCountBefore,mode:t.mode,operation:"cleanup",projectionChanged:t.projectionChanged,reclaimedCachedPathEntryCount:t.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:t.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:t.reclaimedNodeSlotCount,reclaimedSegmentCount:t.reclaimedSegmentCount,segmentCountAfter:t.segmentCountAfter,segmentCountBefore:t.segmentCountBefore,totalNodeSlotCountAfter:t.totalNodeSlotCountAfter,totalNodeSlotCountBefore:t.totalNodeSlotCountBefore,visibleCountDelta:null}}function Ot(t,n,s){return{...s,visibleCountDelta:gs(t)-n}}function Vl(t,n){let s=gs(t),a=pl();t.transactionStack.push(a);try{n()}catch(l){throw Cl(t,a,!1),l}Cl(t,a,!0,gs(t)-s)}function sn(t,n){let s=t.instrumentation;if(s==null){kl(t,n);return}W(s,"store.events.record",()=>kl(t,n))}function kl(t,n){let s=t.transactionStack[t.transactionStack.length-1]??null;if(s==null){ms(t,n);return}s.events.push(n),Cf(s,n)}function Cl(t,n,s,a=null){if(t.transactionStack.pop()!==n)throw Error("Transaction stack underflow");if(!s)return;let l=t.transactionStack[t.transactionStack.length-1]??null;if(l!=null){let f=t.instrumentation;if(f==null)xl(l,n);else W(f,"store.events.batch.merge",()=>xl(l,n));return}let d=If(n,a),h=t.instrumentation;if(h==null){ms(t,d);return}W(h,"store.events.batch.commit",()=>ms(t,d))}function If(t,n){return{affectedAncestorIds:[...t.affectedAncestorIds],affectedNodeIds:[...t.affectedNodeIds],canonicalChanged:t.events.some((s)=>s.canonicalChanged),events:[...t.events],operation:"batch",projectionChanged:t.events.some((s)=>s.projectionChanged),visibleCountDelta:n}}function kf(t,n){for(let s of n.affectedAncestorIds)t.affectedAncestorIds.add(s);for(let s of n.affectedNodeIds)t.affectedNodeIds.add(s)}function xl(t,n){for(let s of n.events)t.events.push(s);kf(t,n)}function Cf(t,n){for(let s of n.affectedNodeIds)t.affectedNodeIds.add(s);for(let s of n.affectedAncestorIds)t.affectedAncestorIds.add(s)}function ms(t,n){let s=t.instrumentation;if(s==null){_l(t,n);return}W(s,"store.events.emit",()=>_l(t,n))}function _l(t,n){t.listeners.get(n.operation)?.forEach((s)=>s(n)),t.listeners.get("*")?.forEach((s)=>s(n))}function gs(t){return t.snapshot.nodes[t.snapshot.rootId]?.visibleSubtreeCount??0}function Dn(t,n){if(t.snapshot.options.flattenEmptyDirectories!==!0)return null;let s=t.snapshot.nodes[n];if(s==null||!Y(s)||Ge(s,2))return null;let a=t.snapshot.directories.get(n);if(a==null||a.childIds.length!==1)return null;let l=a.childIds[0];if(l==null)return null;let d=t.snapshot.nodes[l];if(d==null||!Y(d))return null;return l}function Mn(t,n){let s=n;while(!0){let a=Dn(t,s);if(a==null)return s;s=a}}function Rr(t,n){let s=[n],a=n;while(!0){let l=Dn(t,a);if(l==null)return s;s.push(l),a=l}}function fo(t,n){let s=n==null?t.snapshot.rootId:qt(t,n);if(s==null)return[];return _f(t,s)}function ys(t,n){let s=cr(n),a=s.isDirectory?s.segments:s.segments.slice(0,-1),l=Un(t,Ff(t,a)),{createdNodeIds:d,directoryId:h}=Ef(t,a),f=new Set(d),g=h;if(s.isDirectory){let w=Q(t,h);if(Ge(w,1))throw Error(`Path already exists: "${n}"`);Tr(w,1),t.pathCacheByNodeId.set(h,{path:n,version:t.pathCacheVersion}),f.add(h)}else g=Pf(t,h,s.basename),f.add(g);Gn(t,h);let b=Un(t,h);return Tl({affectedAncestorIds:Yt(t,g),affectedNodeIds:[...f],path:n,projectionChanged:Kl(l,b)})}function bs(t,n,s){let a=qt(t,n);if(a==null)throw Error(`Path does not exist: "${n}"`);let l=Q(t,a);if(Ge(l,2))throw Error("The root node cannot be removed");if(Y(l)&&Fe(t,a).childIds.length>0&&s.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${n}"`);let d=l.parentId,h=Un(t,d),f=jl(t,a);Is(t,d,a,l.nameId),ks(t,d),Gn(t,d);let g=Un(t,d);return Pl({affectedAncestorIds:Yt(t,d),affectedNodeIds:f,path:n,projectionChanged:Kl(h,g),recursive:s.recursive===!0})}function ws(t,n,s,a){let l=qt(t,n);if(l==null)throw Error(`Source path does not exist: "${n}"`);let d=Q(t,l);if(Ge(d,2))throw Error("The root node cannot be moved");let h=a.collision??"error",f=Af(t,l,s),g=Un(t,d.parentId),b=Un(t,f.parentId),w=Xt(t.snapshot.segmentTable,d.nameId),I=fn(t.snapshot.segmentTable,f.basename);if(f.parentId===d.parentId&&w===f.basename)return null;if(Y(d)&&Bf(t,l,f.parentId))throw Error("Cannot move a directory into one of its descendants");let v=Wn(t.snapshot.nodes,Fe(t,f.parentId)).get(I),_=f.existingNodeId??v??null;if(_!=null&&_!==l){if(Nf(t,_,h,yi(d))==="skip")return null}let k=d.parentId;if(Is(t,k,l,d.nameId),d.parentId=f.parentId,d.nameId=I,t.pathCacheByNodeId.delete(l),Gl(t,l),Ss(t,f.parentId,l),ks(t,k),t.pathCacheVersion++,Gn(t,k),f.parentId!==k)Gn(t,f.parentId);let T=Un(t,k),R=Un(t,f.parentId);return Rl({affectedAncestorIds:[...new Set([...Yt(t,k),...Yt(t,f.parentId)])],affectedNodeIds:[l],from:n,projectionChanged:Ul([g,b],[T,R]),to:Pe(t,l)})}function xf(t,n){let s=t.pathCacheByNodeId.get(n);return s!=null&&s.version===t.pathCacheVersion?s.path:null}function Ol(t,n,s){return t.pathCacheByNodeId.set(n,{path:s,version:t.pathCacheVersion}),s}function Pe(t,n){let s=Q(t,n),a=xf(t,n);if(a!=null)return a;if(Ge(s,2))return Ol(t,n,"");let l=Pe(t,s.parentId),d=Xt(t.snapshot.segmentTable,s.nameId),h=l.length===0?d:`${l}${d}`;return Ol(t,n,Y(s)?`${h}/`:h)}function Gn(t,n){let s=t.instrumentation;if(s==null){zl(t,n);return}W(s,"store.recomputeCountsUpwardFrom",()=>zl(t,n))}function Ii(t,n){let s=[[n,0]],{nodes:a,directories:l}=t.snapshot;while(s.length>0){let d=s[s.length-1],h=d[0],f=a[h];if(f==null||!Y(f)){vs(t,h,f,!0),s.pop();continue}let g=l.get(h);if(g==null||d[1]>=g.childIds.length){vs(t,h,f,!0),s.pop();continue}let b=g.childIds[d[1]++];s.push([b,0])}}function Yt(t,n){let s=[],a=n;while(a!=null){let l=Q(t,a);if(s.push(a),a===t.snapshot.rootId)break;a=l.parentId}return s}function qt(t,n){if(n.length===0)return t.snapshot.rootId;let s=lo(n);return $l(t,s.segments,s.requiresDirectory)}function $l(t,n,s){let a=t.snapshot.rootId;for(let d of n){let h=t.snapshot.segmentTable.idByValue.get(d);if(h===void 0)return null;let f=Fe(t,a),g=Wn(t.snapshot.nodes,f).get(h);if(g===void 0)return null;a=g}let l=Q(t,a);if(s&&!Y(l))return null;return a}function Fe(t,n){let s=t.snapshot.directories.get(n);if(s===void 0)throw Error(`Unknown directory child index for node ${String(n)}`);return s}function Q(t,n){let s=t.snapshot.nodes[n];if(s===void 0||Ge(s,4))throw Error(`Unknown node ID: ${String(n)}`);return s}function _f(t,n){let s=t.snapshot.nodes[n];if(s===void 0||Ge(s,4))return[];if(!Y(s))return[Pe(t,n)];if(Fe(t,n).childIds.length===0)return Ge(s,1)&&!Ge(s,2)?[Pe(t,n)]:[];let a=[],l=[{childIndex:0,nodeId:n}];while(l.length>0){let d=l[l.length-1];if(d==null)break;let h=t.snapshot.nodes[d.nodeId];if(h===void 0||Ge(h,4)){l.pop();continue}if(!Y(h)){a.push(Pe(t,d.nodeId)),l.pop();continue}let f=Fe(t,d.nodeId);if(f.childIds.length===0){if(Ge(h,1)&&!Ge(h,2))a.push(Pe(t,d.nodeId));l.pop();continue}let g=f.childIds[d.childIndex];if(g==null){l.pop();continue}d.childIndex++,l.push({childIndex:0,nodeId:g})}return a}function Ef(t,n){let s=[],a=t.snapshot.rootId;for(let l of n){let d=fn(t.snapshot.segmentTable,l),h=Fe(t,a),f=Wn(t.snapshot.nodes,h).get(d);if(f!==void 0){if(!Y(Q(t,f)))throw Error(`Cannot create a directory that collides with an existing file: "${l}"`);a=f;continue}a=Tf(t,a,d),s.push(a)}return{createdNodeIds:s,directoryId:a}}function Tf(t,n,s){let a=Q(t,n),l=t.snapshot.nodes.length;if(t.snapshot.nodes.push({depthAndFlags:Vt(jt(a)+1,0,1),nameId:s,parentId:n,subtreeNodeCount:1,visibleSubtreeCount:1}),t.snapshot.directories.set(l,sr()),Ss(t,n,l),t.collapseNewDirectoriesByDefault)t.collapsedDirectoryIds.add(l),t.hasCollapsedDirectoryOverrides=!0;return t.activeNodeCount++,l}function Pf(t,n,s){let a=fn(t.snapshot.segmentTable,s),l=Fe(t,n);if(Wn(t.snapshot.nodes,l).has(a))throw Error(`Path already exists: "${Hf(t,n,s)}"`);let d=Q(t,n),h=t.snapshot.nodes.length;return t.snapshot.nodes.push({depthAndFlags:Vt(jt(d)+1,0),nameId:a,parentId:n,subtreeNodeCount:1,visibleSubtreeCount:1}),Ss(t,n,h),t.activeNodeCount++,h}function Rf(t,n,s){let a=0,l=n.childIds.length;while(a<l){let d=a+l>>>1,h=n.childIds[d];if(h==null){l=d;continue}if(Df(t,s,h)<0)l=d;else a=d+1}return a}function Ss(t,n,s){let a=Fe(t,n),l=Q(t,s);Wn(t.snapshot.nodes,a).set(l.nameId,s),oo(a,s,l.subtreeNodeCount,l.visibleSubtreeCount);let d=Rf(t,a,s);a.childIds.splice(d,0,s),hs(a,d),$n(t.snapshot.nodes,a)}function Is(t,n,s,a){let l=Fe(t,n),d=_r(l),h=d.get(s)??-1;Wn(t.snapshot.nodes,l).delete(a),d.delete(s);let f=t.snapshot.nodes[s];if(f!=null)oo(l,s,-f.subtreeNodeCount,-f.visibleSubtreeCount);if(h>=0)l.childIds.splice(h,1),hs(l,h),$n(t.snapshot.nodes,l)}function Df(t,n,s){let a=t.snapshot.options.sort;if(a==="default")return Mf(t,n,s);return a(ql(t,n),ql(t,s))}function Mf(t,n,s){let a=Q(t,n),l=Q(t,s),d=Y(a);if(d!==Y(l))return d?-1:1;let h=wi(Si(t.snapshot.segmentTable,a.nameId),Si(t.snapshot.segmentTable,l.nameId));if(h!==0)return h;let f=Xt(t.snapshot.segmentTable,a.nameId),g=Xt(t.snapshot.segmentTable,l.nameId);if(f!==g)return f<g?-1:1;return n<s?-1:1}function ql(t,n){let s=Q(t,n),a=Pe(t,n),l=Y(s),d=l?a.slice(0,-1):a;return{basename:Xt(t.snapshot.segmentTable,s.nameId),depth:jt(s),isDirectory:l,path:a,segments:d.length===0?[]:d.split("/")}}function Af(t,n,s){let a=Q(t,n),l=qt(t,s);if(l!=null){let b=Q(t,l);if(Y(b))return{basename:Xt(t.snapshot.segmentTable,a.nameId),existingNodeId:null,parentId:l};let w=lo(s).segments;return{basename:w[w.length-1]??"",existingNodeId:l,parentId:b.parentId}}let d=lo(s),h=d.segments[d.segments.length-1]??"",f=d.segments.slice(0,-1),g=f.length===0?t.snapshot.rootId:$l(t,f,!0);if(g==null)throw Error(`Destination parent does not exist: "${s}"`);return{basename:h,existingNodeId:null,parentId:g}}function Nf(t,n,s,a){if(s==="skip")return"skip";if(s==="error")throw Error(`Destination already exists: "${Pe(t,n)}"`);let l=Q(t,n);if(yi(l)!==a)throw Error("replace collision requires the same source and destination kinds");if(Y(l)&&Fe(t,n).childIds.length>0)throw Error("replace collision does not support non-empty directories");let{parentId:d,nameId:h}=l;return jl(t,n),Is(t,d,n,h),ks(t,d),Gn(t,d),"handled"}function jl(t,n){let s=[],a=[{nodeId:n,visitedChildren:!1}];while(a.length>0){let l=a.pop();if(l==null)break;let d=Q(t,l.nodeId);if(l.visitedChildren||!Y(d)){if(Y(d))t.snapshot.directories.delete(l.nodeId);if(Tr(d,4),t.pathCacheByNodeId.delete(l.nodeId),t.collapsedDirectoryIds.delete(l.nodeId))t.hasCollapsedDirectoryOverrides=t.collapsedDirectoryIds.size>0;t.expandedDirectoryIds.delete(l.nodeId),Il(t,l.nodeId),t.activeNodeCount--,s.push(l.nodeId);continue}a.push({nodeId:l.nodeId,visitedChildren:!0});let h=Fe(t,l.nodeId);for(let f=h.childIds.length-1;f>=0;f--){let g=h.childIds[f];if(g!=null)a.push({nodeId:g,visitedChildren:!1})}}return s}function ks(t,n){let s=n;while(s!=null){let a=Q(t,s);if(!Y(a)||Ge(a,2))return;if(Fe(t,s).childIds.length>0)return;Tr(a,1),s=a.parentId===s?null:a.parentId}}function Ff(t,n){let s=t.snapshot.rootId;for(let a of n){let l=t.snapshot.segmentTable.idByValue.get(a);if(l==null)break;let d=Wn(t.snapshot.nodes,Fe(t,s)).get(l);if(d==null)break;if(!Y(Q(t,d)))break;s=d}return s}function Un(t,n){let s=Lf(t,n);if(s==null)return null;let a=Mn(t,s),l=Q(t,a),d=s===a?null:Rr(t,s).map((h)=>Pe(t,h));return JSON.stringify({flattenedSegmentPaths:d,hasChildren:Fe(t,a).childIds.length>0,path:Pe(t,a),terminalKind:yi(l)})}function Kl(t,n){return Ul([t],[n])}function Ul(t,n){for(let s=0;s<t.length;s+=1){let a=t[s],l=n[s];if(a==null||l==null||a!==l)return!0}return!1}function Lf(t,n){let s=n;while(s!=null){let a=Q(t,s);if(!Y(a)||Ge(a,2))return null;if(!Ct(t,s,a))return s;s=a.parentId}return null}function Gl(t,n){let s=Q(t,n);if(Xa(s,(n===t.snapshot.rootId?-1:jt(Q(t,s.parentId)))+1),!Y(s))return;let a=Fe(t,n);for(let l of a.childIds)Gl(t,l)}function Bf(t,n,s){let a=s;while(a!=null){if(a===n)return!0;let l=Q(t,a);if(a===t.snapshot.rootId)return!1;a=l.parentId}return!1}function vs(t,n,s=Q(t,n),a=!1){let l=t.instrumentation;if(l==null){Wl(t,n,s,a);return}W(l,"store.recomputeNodeCounts",()=>Wl(t,n,s,a))}function zl(t,n){let s=n;while(s!=null){let a=Q(t,s),{subtreeNodeCount:l,visibleSubtreeCount:d}=a;if(vs(t,s,a),s===t.snapshot.rootId)return;let h=a.subtreeNodeCount-l,f=a.visibleSubtreeCount-d,g=a.parentId;if(h!==0||f!==0)oo(Fe(t,g),s,h,f);s=g}}function Wl(t,n,s,a){if(!Y(s)){s.subtreeNodeCount=1,s.visibleSubtreeCount=1;return}let l=Fe(t,n);if(a){let f=t.instrumentation;if(f==null)ar(t.snapshot.nodes,l);else W(f,"store.recomputeNodeCounts.rebuildChildAggregates",()=>ar(t.snapshot.nodes,l))}let d=1+l.totalChildSubtreeNodeCount,h=l.totalChildVisibleSubtreeCount;if(s.subtreeNodeCount=d,Ge(s,2)){s.visibleSubtreeCount=h;return}s.visibleSubtreeCount=Dn(t,n)!=null?h:Ct(t,n,s)?1+h:1}function Hf(t,n,s){let a=Pe(t,n);return a.length===0?s:`${a}${s}`}function Dr(t){return t!=null&&!Ge(t,4)}function po(t,n){let s=t.snapshot.nodes[n];if(!Dr(s)||!Y(s)||Ge(s,2))return null;return s}function Vf(t){let n=0;for(let[s,a]of t.pathCacheByNodeId){if(a.version!==t.pathCacheVersion)continue;if(!Dr(t.snapshot.nodes[s]))continue;n+=1}return n}function Of(t){return Math.max(0,t.valueById.length-1)}function Xl(t){return{activeNodeCount:t.activeNodeCount,cachedPathEntryCount:Vf(t),loadInfoEntryCount:t.directoryLoadInfoById.size,segmentCount:Of(t.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,t.snapshot.nodes.length-1)}}function qf(t,n,s,a){return{activeNodeCountAfter:a.activeNodeCount,activeNodeCountBefore:s.activeNodeCount,cachedPathEntryCountAfter:a.cachedPathEntryCount,cachedPathEntryCountBefore:s.cachedPathEntryCount,idsPreserved:n,loadInfoEntryCountAfter:a.loadInfoEntryCount,loadInfoEntryCountBefore:s.loadInfoEntryCount,mode:t,reclaimedCachedPathEntryCount:s.cachedPathEntryCount-a.cachedPathEntryCount,reclaimedLoadInfoEntryCount:s.loadInfoEntryCount-a.loadInfoEntryCount,reclaimedNodeSlotCount:s.totalNodeSlotCount-a.totalNodeSlotCount,reclaimedSegmentCount:s.segmentCount-a.segmentCount,segmentCountAfter:a.segmentCount,segmentCountBefore:s.segmentCount,totalNodeSlotCountAfter:a.totalNodeSlotCount,totalNodeSlotCountBefore:s.totalNodeSlotCount}}function Yl(t){let n=[],s=[];for(let a of t.collapsedDirectoryIds)if(po(t,a)!=null)n.push(Pe(t,a));for(let a of t.expandedDirectoryIds)if(po(t,a)!=null)s.push(Pe(t,a));return{collapsedPaths:n,expandedPaths:s}}function Ql(t){let n=[];for(let[s,a]of t.directoryLoadInfoById){if(po(t,s)==null||Kn(t,s)==="loaded")continue;n.push({info:{activeAttemptId:null,errorMessage:a.errorMessage,nextAttemptId:a.nextAttemptId,state:a.state},path:Pe(t,s)})}return n}function Zl(t,n){t.collapsedDirectoryIds.clear(),t.hasCollapsedDirectoryOverrides=!1,t.expandedDirectoryIds.clear();for(let s of n.expandedPaths){let a=qt(t,s);if(a==null)continue;jn(t,a,!0,Q(t,a))}for(let s of n.collapsedPaths){let a=qt(t,s);if(a==null)continue;jn(t,a,!1,Q(t,a))}}function Jl(t,n){t.directoryLoadInfoById.clear();for(let s of n){let a=qt(t,s.path);if(a==null)continue;if(po(t,a)==null)continue;t.directoryLoadInfoById.set(a,{activeAttemptId:null,errorMessage:s.info.errorMessage,nextAttemptId:s.info.nextAttemptId,state:s.info.state})}}function zf(t){t.pathCacheVersion+=1,t.pathCacheByNodeId.clear(),t.pathCacheByNodeId.set(t.snapshot.rootId,{path:"",version:t.pathCacheVersion})}function Wf(t){let n=t.snapshot.segmentTable,s=co();for(let a of t.snapshot.nodes){if(!Dr(a))continue;if(Ge(a,2)){a.nameId=0;continue}a.nameId=fn(s,Xt(n,a.nameId))}t.snapshot.segmentTable=s}function $f(t){for(let[n,s]of t.snapshot.directories){let a=t.snapshot.nodes[n];if(!Dr(a)||!Y(a)){t.snapshot.directories.delete(n);continue}let l=s.childIds.filter((d)=>{let h=t.snapshot.nodes[d];return Dr(h)&&h.parentId===n});s.childIds=l,s.childIdByNameId=new Map(l.map((d)=>[Q(t,d).nameId,d])),s.childPositionById=new Map(l.map((d,h)=>[d,h])),ar(t.snapshot.nodes,s)}}function jf(t){let n=t.snapshot.nodes.length-1;while(n>t.snapshot.rootId){let s=t.snapshot.nodes[n];if(Dr(s))break;n-=1}t.snapshot.nodes.length=n+1}function Kf(t){let n=Yl(t),s=Ql(t);W(t.instrumentation,"store.cleanup.stable.clearPathCaches",()=>zf(t)),W(t.instrumentation,"store.cleanup.stable.rebuildSegmentTable",()=>Wf(t)),W(t.instrumentation,"store.cleanup.stable.rebuildDirectoryIndexes",()=>$f(t)),W(t.instrumentation,"store.cleanup.stable.trimTrailingRemovedNodeSlots",()=>jf(t)),W(t.instrumentation,"store.cleanup.stable.restoreExpansionOverrides",()=>Zl(t,n)),W(t.instrumentation,"store.cleanup.stable.restoreDirectoryLoadInfos",()=>Jl(t,s)),W(t.instrumentation,"store.cleanup.stable.recomputeCounts",()=>Ii(t,t.snapshot.rootId))}function Uf(t){let n=Yl(t),s=Ql(t),a=W(t.instrumentation,"store.cleanup.aggressive.listPaths",()=>fo(t)),l=Qa({...t.snapshot.options},t.instrumentation),d=W(t.instrumentation,"store.cleanup.aggressive.rebuildSnapshot",()=>{let h=new ho(l);return h.appendPaths(a),h.finish()});t.snapshot=d,t.activeNodeCount=d.nodes.length-1,t.pathCacheByNodeId=new Map([[d.rootId,{path:"",version:0}]]),t.pathCacheVersion=0,W(t.instrumentation,"store.cleanup.aggressive.restoreExpansionOverrides",()=>Zl(t,n)),W(t.instrumentation,"store.cleanup.aggressive.restoreDirectoryLoadInfos",()=>Jl(t,s)),W(t.instrumentation,"store.cleanup.aggressive.recomputeCounts",()=>Ii(t,t.snapshot.rootId))}function ec(t){for(let n of t.directoryLoadInfoById.values())if(n.state==="loading"&&n.activeAttemptId!=null)return!0;return!1}function tc(t,n){let s=Xl(t);if(n==="stable")W(t.instrumentation,"store.cleanup.stable",()=>Kf(t));else W(t.instrumentation,"store.cleanup.aggressive",()=>Uf(t));let a=Xl(t);return qf(n,n==="stable",s,a)}var Gf=64;function Xf(t,n){let s=n+2;if(s<=t.length)return t;let a=t.length;while(a<s)a*=2;let l=new Int32Array(a);return l.fill(-1),l.set(t),l}function xt(t){return Q(t,t.snapshot.rootId).visibleSubtreeCount}function oc(t,n,s,a){let l=Q(t,n.terminalNodeId),d=Math.max(1,l.visibleSubtreeCount);return Math.min(a-1,s+d-1)}function Yf(t,n,s,a){return{ancestorPaths:a,index:n.index,posInSet:n.posInSet,row:ki(t,n.cursor),setSize:n.setSize,subtreeEndIndex:oc(t,n.cursor,n.index,s)}}function sc(t,n,s,a,l,d){let h=Fe(t,n),{childIndex:f,childVisibleIndex:g,localVisibleIndex:b}=so(t.snapshot.nodes,h,s),w=h.childIds[f];if(w==null)throw Error(`Visible index ${String(s)} is out of range`);return Qf(t,w,b,a+g,l+1,f,h.childIds.length,d)}function Qf(t,n,s,a,l,d,h,f){if(!Y(Q(t,n))){if(s===0)return{ancestors:f,cursor:{headNodeId:n,terminalNodeId:n,visibleDepth:l},index:a,posInSet:d,setSize:h};throw Error(`Visible index ${String(s)} is out of range for file`)}let g=pc(t,n,l);if(s===0)return{ancestors:f,cursor:g,index:a,posInSet:d,setSize:h};let b=Q(t,g.terminalNodeId);if(!Y(b)||!Ct(t,g.terminalNodeId,b))throw Error(`Visible index ${String(s)} is out of range for collapsed directory`);return sc(t,g.terminalNodeId,s-1,a+1,g.visibleDepth,[...f,{cursor:g,index:a,posInSet:d,setSize:h}])}function ac(t,n){let s=xt(t);if(n<0||n>=s)return null;let a=sc(t,t.snapshot.rootId,n,0,-1,[]),l=a.ancestors.map((h)=>Pe(t,h.cursor.terminalNodeId)),d=null;return{ancestorPaths:l,get ancestorRows(){if(d!=null)return d;let h=[],f=[];for(let g of a.ancestors){let b=Yf(t,g,s,[...f]);h.push(b),f.push(b.row.path)}return d=h,d},index:a.index,posInSet:a.posInSet,row:ki(t,a.cursor),setSize:a.setSize,subtreeEndIndex:oc(t,a.cursor,a.index,s)}}function lc(t,n,s){let a=t.instrumentation,l=xt(t);if(l<=0||s<n)return[];let d=Math.max(0,Math.min(n,l-1)),h=Math.max(d,Math.min(s,l-1));if(a==null){if(d===0)return ep(t,h+1);let I=[],v=nc(t,d);for(let _=d;_<=h&&v!=null;_++){let k=ki(t,v);I.push(k),v=rc(t,v)}return I}let f=[],g=0,b=0,w=W(a,"store.getVisibleSlice.selectFirstRow",()=>nc(t,d));for(let I=d;I<=h&&w!=null;I++){let v=W(a,"store.getVisibleSlice.materializeRow",()=>ki(t,w));if(f.push(v),v.isFlattened)g++,b+=v.flattenedSegments?.length??0;w=W(a,"store.getVisibleSlice.advanceCursor",()=>rc(t,w))}return Pr(a,"workload.visibleRowsRead",f.length),Pr(a,"workload.flattenedRowsRead",g),Pr(a,"workload.flattenedSegmentsRead",b),f}function xs(t,n=xt(t)){let s=t.instrumentation;if(s==null)return ic(t,n);return W(s,"store.getVisibleTreeProjection",()=>ic(t,n))}function cc(t){return Jf(xs(t))}function dc(t,n){let s=qt(t,n);if(s==null||s===t.snapshot.rootId)return null;if(Y(Q(t,s))&&Mn(t,s)!==s)return null;let a=0,l=s,{nodes:d,rootId:h}=t.snapshot;while(l!==h){let f=Q(t,l).parentId,g=Fe(t,f),b=_r(g).get(l);if(b==null)throw Error(`Child ${String(l)} was not found in its parent index`);if(a+=Ua(d,g,b),f!==h){let w=Q(t,f),I=Dn(t,f);if(!Ct(t,f,w)&&I!==l)return null;if(Mn(t,f)===f)a+=1}l=f}return a}function uc(t,n){let s=qt(t,n);if(s==null)throw Error(`Path does not exist: "${n}"`);let a=Q(t,s);if(!Y(a))throw Error(`Path is not a directory: "${n}"`);if(Ct(t,s,a))return null;return jn(t,s,!0,a),Gn(t,s),Dl({affectedAncestorIds:Yt(t,s),affectedNodeIds:[s],path:n,projectionChanged:!0})}function hc(t,n){let s=qt(t,n);if(s==null)throw Error(`Path does not exist: "${n}"`);let a=Q(t,s);if(!Y(a))throw Error(`Path is not a directory: "${n}"`);if(!Ct(t,s,a))return null;return jn(t,s,!1,a),Gn(t,s),Ml({affectedAncestorIds:Yt(t,s),affectedNodeIds:[s],path:n,projectionChanged:!0})}function nc(t,n){if(n<0||n>=xt(t))return null;return fc(t,t.snapshot.rootId,n,-1)}function fc(t,n,s,a){let l=Fe(t,n),d=t.instrumentation,{childIndex:h,localVisibleIndex:f}=d==null?so(t.snapshot.nodes,l,s):W(d,"store.getVisibleSlice.selectChildIndex",()=>so(t.snapshot.nodes,l,s)),g=l.childIds[h];if(g!=null)return Cs(t,g,f,a+1);throw Error(`Visible index ${String(s)} is out of range`)}function Cs(t,n,s,a){if(!Y(Q(t,n))){if(s===0)return{headNodeId:n,terminalNodeId:n,visibleDepth:a};throw Error(`Visible index ${String(s)} is out of range for file`)}let l=pc(t,n,a);if(s===0)return l;let d=Q(t,l.terminalNodeId);if(!Y(d)||!Ct(t,l.terminalNodeId,d))throw Error(`Visible index ${String(s)} is out of range for collapsed directory`);return fc(t,l.terminalNodeId,s-1,l.visibleDepth)}function pc(t,n,s){if(!Y(Q(t,n)))return{headNodeId:n,terminalNodeId:n,visibleDepth:s};if(t.instrumentation==null)return{headNodeId:n,terminalNodeId:Mn(t,n),visibleDepth:s};return{headNodeId:n,terminalNodeId:W(t.instrumentation,"store.getVisibleSlice.flatten.resolveTerminalDirectory",()=>Mn(t,n)),visibleDepth:s}}function Zf(t,n){let s=Q(t,n);if(!Y(s))return!0;let a=s.parentId;if(a===t.snapshot.rootId)return!0;return Dn(t,a)!==n}function rc(t,n){let s=Q(t,n.terminalNodeId);if(Y(s)){let d=Fe(t,n.terminalNodeId);if(Ct(t,n.terminalNodeId,s)&&d.childIds.length>0){let h=d.childIds[0];return h==null?null:Cs(t,h,0,n.visibleDepth+1)}}let{terminalNodeId:a,visibleDepth:l}=n;while(!0){let d=Q(t,a);if(a===t.snapshot.rootId)return null;let h=d.parentId,f=Fe(t,h),g=_r(f).get(a)??-1;if(g<0)throw Error(`Child ${String(a)} was not found in its parent index`);let b=f.childIds[g+1]??null;if(b!=null)return Cs(t,b,0,l);if(Zf(t,a))l--;a=h}}function Jf(t){let n=t.paths.length,s=Array(n);for(let a=0;a<n;a+=1){let l=t.getParentIndex(a);s[a]={index:a,parentPath:l>=0?t.paths[l]??null:null,path:t.paths[a]??"",posInSet:t.posInSetByIndex[a]??0,setSize:t.setSizeByIndex[a]??0}}return{getParentIndex:t.getParentIndex,rows:s,get visibleIndexByPath(){return t.visibleIndexByPath}}}function ic(t,n){let s=Array(n),a=new Int32Array(n),l=new Int32Array(n),d=new Int32Array(n),h=new Int32Array(Gf);h.fill(-1);let f=0,{nodes:g,directories:b,segmentTable:w}=t.snapshot,I=[[b.get(t.snapshot.rootId),0,-1,""]],v=t.snapshot.options.flattenEmptyDirectories,{pathCacheByNodeId:_,pathCacheVersion:k}=t,T=w.valueById;while(I.length>0&&f<n){let N=I[I.length-1],H=N[0];if(N[1]>=H.childIds.length){I.pop();continue}let X=N[1],fe=H.childIds[N[1]++],vt=g[fe],Le=N[2]+1,yt=N[3];h=Xf(h,Le);let Ie,Be=fe;if(!Y(vt)){let qe=_.get(fe);Ie=qe!=null&&qe.version===k?qe.path:`${yt}${T[vt.nameId]}`}else Be=v?Mn(t,fe):fe,Ie=Be===fe?`${yt}${T[vt.nameId]}/`:Pe(t,Be);a[f]=h[Le],s[f]=Ie,l[f]=X,d[f]=H.childIds.length,h[Le+1]=f,f+=1;let Ye=g[Be];if(Ye!=null&&Y(Ye)&&Ct(t,Be,Ye))I.push([b.get(Be),0,Le,Ie])}if(f<n)s.length=f;let R=a.subarray(0,f),B=l.subarray(0,f),F=d.subarray(0,f),D=null;return{getParentIndex(N){return N<0||N>=f?-1:R[N]??-1},paths:s,posInSetByIndex:B,setSizeByIndex:F,get visibleIndexByPath(){if(D==null){D=new Map;for(let N=0;N<f;N+=1)D.set(s[N]??"",N)}return D}}}function ep(t,n){let s=Array(n),a=0,{nodes:l,directories:d,segmentTable:h}=t.snapshot,f=[[d.get(t.snapshot.rootId),0,-1]],g=h.valueById,b=t.snapshot.options.flattenEmptyDirectories,{pathCacheByNodeId:w,pathCacheVersion:I}=t;while(f.length>0&&a<n){let v=f[f.length-1],_=v[0];if(v[1]>=_.childIds.length){f.pop();continue}let k=_.childIds[v[1]++],T=l[k],R=v[2]+1;if(!Y(T)){let N=w.get(k);s[a++]={depth:R,flattenedSegments:void 0,hasChildren:!1,id:k,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:"file",loadState:void 0,name:g[T.nameId],path:N!=null&&N.version===I?N.path:Pe(t,k)};continue}let B=b?Mn(t,k):k,F={headNodeId:k,terminalNodeId:B,visibleDepth:R};s[a++]=ki(t,F);let D=l[B];if(D!=null&&Y(D)&&Ct(t,B,D))f.push([d.get(B),0,R])}if(a<n)s.length=a;return s}function ki(t,n){let s=Q(t,n.terminalNodeId),a=Y(s)?tp(t,n):null,l=Pe(t,n.terminalNodeId),d=Xt(t.snapshot.segmentTable,s.nameId),h=Y(s)&&Fe(t,n.terminalNodeId).childIds.length>0,f=n.headNodeId!==n.terminalNodeId,g=t.instrumentation,b=f?g==null?Rr(t,n.headNodeId).map((w)=>{let I=Q(t,w);return{isTerminal:w===n.terminalNodeId,name:Xt(t.snapshot.segmentTable,I.nameId),nodeId:w,path:Pe(t,w)}}):W(g,"store.getVisibleSlice.flatten.collectSegments",()=>Rr(t,n.headNodeId).map((w)=>{let I=Q(t,w);return{isTerminal:w===n.terminalNodeId,name:Xt(t.snapshot.segmentTable,I.nameId),nodeId:w,path:Pe(t,w)}})):void 0;return{depth:n.visibleDepth,flattenedSegments:b,hasChildren:h,id:n.terminalNodeId,isExpanded:Y(s)&&Ct(t,n.terminalNodeId,s),isFlattened:f,isLoading:a==="loading",kind:Y(s)?"directory":"file",loadState:a==null||a==="loaded"?void 0:a,name:d,path:l}}function tp(t,n){if(n.headNodeId===n.terminalNodeId)return Kn(t,n.terminalNodeId);let s=Rr(t,n.headNodeId),a=!1,l=!1;for(let d of s){let h=Kn(t,d);if(h==="loading")return"loading";if(h==="error"){l=!0;continue}if(h==="unloaded")a=!0}if(l)return"error";if(a)return"unloaded";return"loaded"}var mc=8;function gc(t){let{nodes:n,directories:s,rootId:a,options:l}=t,d=n.length,h=new Int32Array(d),f=new Int32Array(d),g=new Int32Array(d),b=new Int32Array(d),w=new Int32Array(d),I=new Int32Array(d),v=new Int32Array(d);for(let R=0;R<d;R+=1){let B=n[R];if(B==null)continue;h[R]=B.parentId,f[R]=B.nameId,g[R]=B.depthAndFlags,b[R]=B.subtreeNodeCount,w[R]=B.visibleSubtreeCount}let _=0;for(let R of s.values())_+=R.childIds.length;let k=new Int32Array(_),T=0;for(let[R,B]of s){let F=B.childIds;I[R]=T,v[R]=F.length;for(let D=0;D<F.length;D+=1)k[T]=F[D],T+=1}return{nodeCount:d,rootId:a,flattenEmptyDirectories:l.flattenEmptyDirectories===!0,parentId:h,nameId:f,depthAndFlags:g,subtreeNodeCount:b,visibleSubtreeCount:w,childStart:I,childCount:v,childIdsFlat:k}}function vc(t){let{nodeCount:n,rootId:s,flattenEmptyDirectories:a,depthAndFlags:l,subtreeNodeCount:d,visibleSubtreeCount:h,childStart:f,childCount:g,childIdsFlat:b}=t;for(let k=n-1;k>=1;k-=1){if((l[k]&mc)===0)continue;let T=f[k],R=g[k],B=0,F=0;for(let N=0;N<R;N+=1){let H=b[T+N];B+=d[H],F+=h[H]}d[k]=1+B;let D;if(a&&R===1)D=(l[b[T]]&mc)!==0?F:1+F;else D=1+F;h[k]=D}let w=f[s],I=g[s],v=0,_=0;for(let k=0;k<I;k+=1){let T=b[w+k];v+=d[T],_+=h[T]}d[s]=1+v,h[s]=_}function np(t){let{directories:n,nodes:s,options:a,rootId:l,presortedDirectoryNodeIds:d}=t.snapshot,h=a.flattenEmptyDirectories===!0,f=(_)=>{let k=s[_];if(k==null||!Y(k))return;let T=n.get(_);if(T==null)throw Error(`Unknown directory child index for node ${String(_)}`);let R=T.childIds,B=R.length,F=0,D=0;for(let H=0;H<B;H++){let X=R[H];if(X==null)continue;let fe=s[X];F+=fe.subtreeNodeCount,D+=fe.visibleSubtreeCount}if(T.totalChildSubtreeNodeCount=F,T.totalChildVisibleSubtreeCount=D,B>=128)$n(s,T);k.subtreeNodeCount=1+F;let N;if(h&&B===1){let H=s[R[0]];N=H!=null&&Y(H)?D:1+D}else N=1+D;k.visibleSubtreeCount=N};if(d!=null)for(let _=d.length-1;_>=0;_--)f(d[_]);else for(let _=s.length-1;_>=1;_--)f(_);let g=s[l],b=n.get(l);if(g==null||b==null)return;let w=b.childIds,I=0,v=0;for(let _=0;_<w.length;_++){let k=w[_];if(k==null)continue;let T=s[k];I+=T.subtreeNodeCount,v+=T.visibleSubtreeCount}b.totalChildSubtreeNodeCount=I,b.totalChildVisibleSubtreeCount=v,$n(s,b),g.subtreeNodeCount=1+I,g.visibleSubtreeCount=v}function rp(t){let{directories:n,nodes:s,rootId:a}=t.snapshot,l=gc(t.snapshot);vc(l);let{subtreeNodeCount:d,visibleSubtreeCount:h}=l;for(let f=0;f<s.length;f+=1){let g=s[f];if(g==null)continue;g.subtreeNodeCount=d[f],g.visibleSubtreeCount=h[f]}for(let[f,g]of n){let b=g.childIds,w=b.length,I=0,v=0;for(let _=0;_<w;_++){let k=b[_];if(k==null)continue;let T=s[k];I+=T.subtreeNodeCount,v+=T.visibleSubtreeCount}if(g.totalChildSubtreeNodeCount=I,g.totalChildVisibleSubtreeCount=v,f===a||w>=128)$n(s,g)}}function ip(t){return t.initialExpansion==="open"&&(t.initialExpandedPaths==null||t.initialExpandedPaths.length===0)}var Mr=class t{#e;constructor(n={}){let s=bi(n),a=W(s,"store.builder.create",()=>new ho(n));if(n.preparedInput!=null){let f=ul(n.preparedInput);if(f!=null)a.appendPresortedPaths(f,hl(n.preparedInput));else a.appendPreparedPaths(dl(n.preparedInput),!1)}else{let f=n.paths??[];if(n.presorted===!0)a.appendPaths(f);else a.appendPreparedPaths(W(s,"store.preparePathEntries",()=>uo(f,n)))}let l=W(s,"store.builder.finish",()=>a.finish({skipSubtreeCountPass:!0})),d=W(s,"store.state.detectAllDirectoriesExpanded",()=>(n.initialExpansion??"closed")==="closed"&&a.didMatchAllInitialExpandedPaths());if(this.#e=W(s,"store.state.create",()=>fl(l,d?"open":n.initialExpansion??"closed",s)),d)this.#e.collapseNewDirectoriesByDefault=!0;let h=d?this.#e.snapshot.directories.size-1:W(s,"store.state.initializeExpandedPaths",()=>this.initializeExpandedPaths(n.initialExpandedPaths));if(d||ip(n)||(n.initialExpansion??"closed")==="closed"&&h===this.#e.snapshot.directories.size-1||(n.initialExpandedPaths?.length??0)>0&&W(s,"store.state.checkAllDirectoriesExpanded",()=>this.hasAllDirectoriesExpanded()))if(n.useSoaCountSweep===!0)W(s,"store.state.initializeOpenVisibleCountsViaSoa",()=>rp(this.#e));else W(s,"store.state.initializeOpenVisibleCounts",()=>np(this.#e));else W(s,"store.state.recomputeCounts",()=>Ii(this.#e,this.#e.snapshot.rootId))}static preparePaths(n,s={}){return al(n,s)}static prepareInput(n,s={}){return ll(n,s)}static preparePresortedInput(n){return cl(n)}list(n){return W(this.#e.instrumentation,"store.list",()=>fo(this.#e,n))}add(n){W(this.#e.instrumentation,"store.add",()=>{let s=xt(this.#e);sn(this.#e,Ot(this.#e,s,ys(this.#e,n)))})}remove(n,s={}){W(this.#e.instrumentation,"store.remove",()=>{let a=xt(this.#e);sn(this.#e,Ot(this.#e,a,bs(this.#e,n,s)))})}move(n,s,a={}){W(this.#e.instrumentation,"store.move",()=>{let l=xt(this.#e),d=ws(this.#e,n,s,a);if(d!=null)sn(this.#e,Ot(this.#e,l,d))})}batch(n){Vl(this.#e,()=>{if(typeof n==="function"){n(this);return}for(let s of n)switch(s.type){case"add":this.add(s.path);break;case"remove":this.remove(s.path,{recursive:s.recursive});break;case"move":this.move(s.from,s.to,{collision:s.collision});break}})}getVisibleCount(){return W(this.#e.instrumentation,"store.getVisibleCount",()=>xt(this.#e))}getVisibleSlice(n,s){return W(this.#e.instrumentation,"store.getVisibleSlice",()=>lc(this.#e,n,s))}getVisibleRowContext(n){return W(this.#e.instrumentation,"store.getVisibleRowContext",()=>ac(this.#e,n))}getVisibleTreeProjection(){return cc(this.#e)}getVisibleTreeProjectionData(n){return xs(this.#e,n)}getVisibleIndex(n){return W(this.#e.instrumentation,"store.getVisibleIndex",()=>dc(this.#e,n))}getPathInfo(n){return W(this.#e.instrumentation,"store.getPathInfo",()=>{let s=qt(this.#e,n);if(s==null)return null;let a=Q(this.#e,s);return{depth:jt(a),kind:Y(a)?"directory":"file",path:Pe(this.#e,s)}})}isExpanded(n){return W(this.#e.instrumentation,"store.isExpanded",()=>{let s=this.requireDirectoryNodeId(n),a=Q(this.#e,s);return Ct(this.#e,s,a)})}expand(n){W(this.#e.instrumentation,"store.expand",()=>{let s=xt(this.#e),a=uc(this.#e,n);if(a!=null)sn(this.#e,Ot(this.#e,s,a))})}collapse(n){W(this.#e.instrumentation,"store.collapse",()=>{let s=xt(this.#e),a=hc(this.#e,n);if(a!=null)sn(this.#e,Ot(this.#e,s,a))})}on(n,s){return El(this.#e,n,s)}getDirectoryLoadState(n){let s=this.requireDirectoryNodeId(n);return Kn(this.#e,s)}markDirectoryUnloaded(n){W(this.#e.instrumentation,"store.markDirectoryUnloaded",()=>{let s=this.requireDirectoryNodeId(n);if(Fe(this.#e,s).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${n}"`);let a=xt(this.#e);yl(this.#e,s),sn(this.#e,Ot(this.#e,a,Al({affectedAncestorIds:Yt(this.#e,s),affectedNodeIds:[s],path:n,projectionChanged:this.isDirectoryProjectionVisible(s)})))})}beginChildLoad(n){return W(this.#e.instrumentation,"store.beginChildLoad",()=>{let s=this.requireDirectoryNodeId(n),a=xt(this.#e),l=vl(this.#e,s);return sn(this.#e,Ot(this.#e,a,Nl({affectedAncestorIds:Yt(this.#e,s),affectedNodeIds:[s],attemptId:l.attemptId,path:n,projectionChanged:this.isDirectoryProjectionVisible(s),reused:l.reused}))),l})}applyChildPatch(n,s){return W(this.#e.instrumentation,"store.applyChildPatch",()=>{let a=this.resolveActiveDirectoryNodeId(n.nodeId);if(a==null||Kn(this.#e,a)!=="loading"||!wl(this.#e,a,n.attemptId))return!1;let l=Pe(this.#e,a);this.validateChildPatch(l,s);let d=xt(this.#e),h=[];for(let g of s.operations){op(l,g);let b=xt(this.#e);switch(g.type){case"add":h.push(Ot(this.#e,b,ys(this.#e,g.path)));break;case"remove":h.push(Ot(this.#e,b,bs(this.#e,g.path,{recursive:g.recursive})));break;case"move":{let w=ws(this.#e,g.from,g.to,{collision:g.collision});if(w!=null)h.push(Ot(this.#e,b,w));break}}}let f=h.some((g)=>g.projectionChanged)||this.isDirectoryProjectionVisible(a);return sn(this.#e,Ot(this.#e,d,Fl({affectedAncestorIds:Yt(this.#e,a),affectedNodeIds:[a],attemptId:n.attemptId,childEvents:h,path:Pe(this.#e,a),projectionChanged:f}))),!0})}completeChildLoad(n){return W(this.#e.instrumentation,"store.completeChildLoad",()=>{let s=this.resolveActiveDirectoryNodeId(n.nodeId);if(s==null)return!1;let a=xt(this.#e),l=bl(this.#e,s,n.attemptId);return sn(this.#e,Ot(this.#e,a,Ll({affectedAncestorIds:Yt(this.#e,s),affectedNodeIds:[s],attemptId:n.attemptId,path:Pe(this.#e,s),projectionChanged:this.isDirectoryProjectionVisible(s),stale:!l}))),l})}failChildLoad(n,s){return W(this.#e.instrumentation,"store.failChildLoad",()=>{let a=this.resolveActiveDirectoryNodeId(n.nodeId);if(a==null)return!1;let l=xt(this.#e),d=Sl(this.#e,a,n.attemptId,s);return sn(this.#e,Ot(this.#e,l,Bl({affectedAncestorIds:Yt(this.#e,a),affectedNodeIds:[a],attemptId:n.attemptId,errorMessage:s,path:Pe(this.#e,a),projectionChanged:this.isDirectoryProjectionVisible(a),stale:!d}))),d})}cleanup(n={}){return W(this.#e.instrumentation,"store.cleanup",()=>{if(this.#e.transactionStack.length>0)throw Error("Cleanup cannot run during an open batch or transaction.");if(ec(this.#e))throw Error("Cleanup cannot run while directory loads are active.");let s=xt(this.#e),a=tc(this.#e,n.mode??"stable");return sn(this.#e,Ot(this.#e,s,Hl({...a,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:a.idsPreserved===!1}))),a})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(n){if(n==null||n.length===0)return 0;let s=0,a=[],l=[],d=0,h=null,f=this.#e.snapshot.segmentTable,g=f.valueById,b=this.#e.snapshot.nodes,w=new Map;for(let I of n){if(h!=null&&I<h)h=null,d=0,a.length=0,l.length=0;let v=I.length>0&&I.charCodeAt(I.length-1)===47?I.length-1:I.length;if(v===0){h=I,d=v,a.length=0,l.length=0;continue}let _=0,k=0;if(h!=null){let D=Math.min(v,d),N=!0;for(let H=0;H<D;H+=1){let X=I.charCodeAt(H);if(X!==h.charCodeAt(H)){N=!1;break}if(X===47)_+=1,k=H+1}if(N){if(D===d&&v>D&&I.charCodeAt(D)===47)_+=1,k=D+1;else if(D===v&&d>D&&h.charCodeAt(D)===47)_+=1,k=v+1}_=Math.min(_,l.length)}let T=_===0?this.#e.snapshot.rootId:l[_-1]??this.#e.snapshot.rootId,R=_,B=!0,F=k;while(F<=v){let D=I.indexOf("/",F),N=D===-1||D>v?v:D,H=I.slice(F,N),X=Fe(this.#e,T).childIds,fe=R===_?a[R]??0:0,vt=fe,Le,yt=w.get(H)??lr(H);w.set(H,yt);let Ie=(Be,Ye)=>{for(vt=Be;vt<Ye;vt+=1){let qe=X[vt],_t=b[qe],ke=g[_t.nameId];if(ke===H)return Le=qe,!0;let ve=wi(Si(f,_t.nameId),yt);if(ve>0||ve===0&&ke>H)return!1}return!1};if(!Ie(fe,X.length)&&fe>0)Ie(0,fe);if(Le===void 0){B=!1;break}if(!Y(Q(this.#e,Le))){B=!1;break}if(a[R]=vt,l[R]=Le,T=Le,R+=1,N===v)break;F=N+1}if(h=I,d=v,a.length=R,l.length=R,!B){h=null,d=0,a.length=0,l.length=0;continue}for(let D=_;D<R;D+=1){let N=l[D];if(N==null)continue;let H=Q(this.#e,N);if(Ct(this.#e,N,H))continue;jn(this.#e,N,!0,H),s+=1}}return s}hasAllDirectoriesExpanded(){for(let n of this.#e.snapshot.directories.keys()){if(n===this.#e.snapshot.rootId)continue;let s=Q(this.#e,n);if(!Ct(this.#e,n,s))return!1}return!0}requireDirectoryNodeId(n){let s=qt(this.#e,n);if(s==null)throw Error(`Path does not exist: "${n}"`);if(!Y(Q(this.#e,s)))throw Error(`Path is not a directory: "${n}"`);return s}resolveActiveDirectoryNodeId(n){try{if(!Y(Q(this.#e,n)))throw Error(`Node is not a directory: ${String(n)}`);return n}catch{return null}}isDirectoryProjectionVisible(n){let s=n;while(s!==this.#e.snapshot.rootId){let a=Q(this.#e,s).parentId;if(a!==this.#e.snapshot.rootId){let l=Q(this.#e,a),d=Dn(this.#e,a);if(!Ct(this.#e,a,l)&&d!==s)return!1}s=a}return!0}validateChildPatch(n,s){new t({paths:this.list(n),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(s.operations)}};function op(t,n){switch(n.type){case"add":case"remove":if(!n.path.startsWith(t)||n.path===t)throw Error(`Child patch operation must stay within ${t}: "${n.path}"`);break;case"move":if(!n.from.startsWith(t)||!n.to.startsWith(t)||n.from===t||n.to===t)throw Error(`Child patch move must stay within ${t}: "${n.from}" -> "${n.to}"`);break}}var Ci={compact:{itemHeight:24,factor:0.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function yc(t,n){if(typeof t==="number")return{itemHeight:n??Ci.default.itemHeight,factor:t};let s=Ci[t??"default"];return{itemHeight:n??s.itemHeight,factor:s.factor}}var xi=Ci.default.itemHeight;var mo=`@layer base {
|
|
187
|
+
</svg>`,standard:Wa,complete:ja(Wa,Zh)},tf={".babelrc":"babel",".babelrc.json":"babel",".bash_profile":"bash",".bashrc":"bash",".browserslistrc":"browserslist",".dockerignore":"docker",".eslintignore":"eslint",".eslintrc":"eslint",".eslintrc.cjs":"eslint",".eslintrc.js":"eslint",".eslintrc.json":"eslint",".eslintrc.yaml":"eslint",".eslintrc.yml":"eslint",".gitattributes":"git",".gitignore":"git",".gitkeep":"git",".gitmodules":"git",".oxlintrc.json":"oxc",".postcssrc":"postcss",".postcssrc.json":"postcss",".postcssrc.yaml":"postcss",".postcssrc.yml":"postcss",".prettierignore":"prettier",".prettierrc":"prettier",".prettierrc.cjs":"prettier",".prettierrc.js":"prettier",".prettierrc.json":"prettier",".prettierrc.mjs":"prettier",".prettierrc.toml":"prettier",".prettierrc.yaml":"prettier",".prettierrc.yml":"prettier",".stylelintignore":"stylelint",".stylelintrc":"stylelint",".stylelintrc.cjs":"stylelint",".stylelintrc.js":"stylelint",".stylelintrc.json":"stylelint",".stylelintrc.mjs":"stylelint",".stylelintrc.yaml":"stylelint",".stylelintrc.yml":"stylelint",".terraform.lock.hcl":"terraform",".zprofile":"bash",".zshenv":"bash",".zshrc":"bash","babel.config.cjs":"babel","babel.config.js":"babel","babel.config.json":"babel","babel.config.mjs":"babel","biome.json":"biome","biome.jsonc":"biome","bootstrap.bundle.js":"bootstrap","bootstrap.bundle.min.js":"bootstrap","bootstrap.css":"bootstrap","bootstrap.js":"bootstrap","bootstrap.min.css":"bootstrap","bootstrap.min.js":"bootstrap","bun.lock":"bun","bun.lockb":"bun","bunfig.toml":"bun","claude.md":"claude","compose.yaml":"docker","compose.yml":"docker","docker-compose.override.yml":"docker","docker-compose.yaml":"docker","docker-compose.yml":"docker",dockerfile:"docker","eslint.config.cjs":"eslint","eslint.config.js":"eslint","eslint.config.mjs":"eslint","eslint.config.mts":"eslint","eslint.config.ts":"eslint",gemfile:"ruby","next.config.js":"nextjs","next.config.mjs":"nextjs","next.config.mts":"nextjs","next.config.ts":"nextjs","postcss.config.cjs":"postcss","postcss.config.js":"postcss","postcss.config.mjs":"postcss","postcss.config.ts":"postcss","prettier.config.cjs":"prettier","prettier.config.js":"prettier","prettier.config.mjs":"prettier",rakefile:"ruby","readme.md":"markdown","stylelint.config.cjs":"stylelint","stylelint.config.js":"stylelint","stylelint.config.mjs":"stylelint","svgo.config.cjs":"svgo","svgo.config.js":"svgo","svgo.config.mjs":"svgo","svgo.config.ts":"svgo","tailwind.config.cjs":"tailwind","tailwind.config.js":"tailwind","tailwind.config.mjs":"tailwind","tailwind.config.ts":"tailwind","vite.config.js":"vite","vite.config.mjs":"vite","vite.config.mts":"vite","vite.config.ts":"vite","webpack.config.babel.js":"webpack","webpack.config.cjs":"webpack","webpack.config.js":"webpack","webpack.config.mjs":"webpack","webpack.config.ts":"webpack"},nf={"7z":"zip",astro:"astro",AUTHORS:"text",avif:"image",bash:"bash",bmp:"image",bz2:"zip",c:"c",cc:"cpp",cfg:"text",CHANGELOG:"text",cjs:"javascript","code-workspace":"vscode",conf:"text",CONTRIBUTORS:"text",cpp:"cpp",csh:"bash",css:"css",csv:"table",cts:"typescript",cxx:"cpp",db:"database",editorconfig:"text",env:"text","env.development":"text","env.local":"text","env.production":"text",eot:"font",erb:"ruby",fish:"bash",gemspec:"ruby",gif:"image",go:"go",gql:"graphql",graphql:"graphql",gz:"zip",h:"c",hh:"cpp",hpp:"cpp",htm:"html",html:"html",hxx:"cpp",icns:"image",ico:"image",ini:"text",inl:"cpp",jar:"zip",jpeg:"image",jpg:"image",js:"javascript",json:"json",json5:"json",jsonc:"json",jsonl:"json",jsx:"javascript",ksh:"bash",less:"css",LICENSE:"text",log:"text",markdown:"markdown",mcp:"mcp",md:"markdown",mdx:"markdown","mdx.tsx":"markdown",mjs:"javascript",mm:"cpp",mts:"typescript",ods:"table",otf:"font",png:"image",postcss:"css",py:"python",pyi:"python",pyw:"python",pyx:"python",rake:"ruby",rar:"zip",rb:"ruby",rs:"rust",rst:"text",rtf:"text",sass:"css",scss:"css",sh:"bash",sql:"database",sqlite:"database",sqlite3:"database",styl:"css",svelte:"svelte",svg:"svg",swift:"swift",tar:"zip",tf:"terraform",tfstate:"terraform",tfvars:"terraform",tgz:"zip",tif:"image",tiff:"image",ts:"typescript",tsv:"table",tsx:"typescript",ttf:"font",txt:"text",vue:"vue",war:"zip",wasm:"wasm",wast:"wasm",wat:"wasm",webp:"image",woff:"font",woff2:"font",xhtml:"html",xls:"table",xlsx:"table",xz:"zip",yaml:"yml",yml:"yml",zig:"zig",zip:"zip",zsh:"bash"},rf={jsx:"react",sass:"sass",scss:"sass",tsx:"react"},$a=new Set(["bash","c","cpp","css","database","default","font","git","go","html","image","javascript","json","markdown","mcp","python","ruby","rust","swift","table","text","typescript","zip"]),of=new Set(["complete"]);function ss(t){return ef[t==="none"?"minimal":t]}function Ka(t){return`file-tree-builtin-${t}`}function Ua(t){return t!=="none"&&of.has(t)}function Ga(t,n,s){if(t==="minimal"||t==="none")return;let a=t==="complete",l=tf[n.toLowerCase()];if(l!=null){if(a||$a.has(l))return l}for(let d of s){if(a){let f=rf[d];if(f!=null)return f}let h=nf[d];if(h!=null){if(a||$a.has(h))return h}}return"default"}var to="file-tree-container",mi="data-file-tree-style",no="data-file-tree-unsafe-css",as="data-file-tree-scrollbar-measure",ro="data-file-tree-scrollbar-gutter-measured",ls="--trees-scrollbar-gutter-measured";var Er="header",Tr="context-menu",cs="context-menu-trigger";function sf(t){return t.spriteSheet!=null||t.remap!=null||t.byFileName!=null||t.byFileExtension!=null||t.byFileNameContains!=null}function Pr(t){if(t==null)return{set:"complete",colored:!0};if(typeof t==="string")return{set:t,colored:!0};return{...t,set:t.set??(sf(t)?"none":"complete"),colored:t.colored??!0}}var af=(t)=>t.trim().toLowerCase(),lf=(t)=>t.split("/").at(-1)??t,cf=(t)=>{let n=t.toLowerCase().split("."),s=[];for(let a=1;a<n.length;a+=1)s.push(n.slice(a).join("."));return s};function gi(t,n){if(typeof t==="string")return{name:t,remappedFrom:n};return{...t,remappedFrom:n}}function ds(t){let n=Pr(t),s=n.remap,a=new Map;for(let[f,g]of Object.entries(n.byFileName??{}))a.set(f.toLowerCase(),g);let l=new Map;for(let[f,g]of Object.entries(n.byFileExtension??{}))l.set(af(f),g);let d=Object.entries(n.byFileNameContains??{}).map(([f,g])=>[f.toLowerCase(),g]);return{resolveIcon:(f,g)=>{if(f==="file-tree-icon-file"&&g!=null){let w=lf(g),I=w.toLowerCase(),v=a.get(I);if(v!=null)return gi(v,f);for(let[T,R]of d)if(I.includes(T))return gi(R,f);let _=cf(w);for(let T of _){let R=l.get(T);if(R!=null)return gi(R,f)}let k=Ga(n.set,w,_);if(k!=null&&n.set!=="none"){if(k==="default"){let T=s?.[f];if(T!=null)return gi(T,f)}return{name:Ka(k),remappedFrom:f,token:k}}}let b=s?.[f];if(b==null)return{name:f};return gi(b,f)}}}function dr(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function us(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function $n(t,n){if(n.childIdByNameId!=null)return n.childIdByNameId;let s=new Map;for(let a of n.childIds){let l=t[a];if(l!=null)s.set(l.nameId,a)}return n.childIdByNameId=s,s}function Rr(t){if(t.childPositionById!=null)return t.childPositionById;let n=new Map;for(let s=0;s<t.childIds.length;s++){let a=t.childIds[s];if(a!=null)n.set(a,s)}return t.childPositionById=n,n}function Dr(t,n){if(t.childPositionById!=null)t.childPositionById.set(n,t.childIds.length);t.childIds.push(n)}function hs(t,n){if(t.childPositionById==null)return;for(let s=n;s<t.childIds.length;s++){let a=t.childIds[s];if(a!=null)t.childPositionById.set(a,s)}}function ur(t,n){let s=0,a=0;for(let l of n.childIds){let d=t[l];if(d==null)continue;s+=d.subtreeNodeCount,a+=d.visibleSubtreeCount}n.totalChildSubtreeNodeCount=s,n.totalChildVisibleSubtreeCount=a,jn(t,n)}function io(t,n,s,a){if(t.totalChildSubtreeNodeCount+=s,t.totalChildVisibleSubtreeCount+=a,t.childVisibleChunkSums==null||a===0)return;let l=Rr(t).get(n);if(l===void 0)return;let d=l>>5;t.childVisibleChunkSums[d]+=a}function oo(t,n,s){let a=n.childVisibleChunkSums;if(a!=null){let d=s,h=0;for(let f of a){if(d<f){let g=ff(t,n,h,d);return{...g,childVisibleIndex:s-g.localVisibleIndex}}d-=f,h+=32}throw Error(`Visible child index ${String(s)} is out of range`)}let l=s;for(let d=0;d<n.childIds.length;d++){let h=n.childIds[d];if(h==null)continue;let f=t[h];if(f==null)continue;if(l<f.visibleSubtreeCount)return{childIndex:d,childVisibleIndex:s-l,localVisibleIndex:l};l-=f.visibleSubtreeCount}throw Error(`Visible child index ${String(s)} is out of range`)}function Xa(t,n,s){let a=0,l=n.childVisibleChunkSums,d=0;if(l!=null){let h=s>>5;for(let f=0;f<h;f+=1)a+=l[f]??0;d=h<<5}for(let h=d;h<s;h+=1){let f=n.childIds[h];if(f==null)continue;let g=t[f];if(g==null)continue;a+=g.visibleSubtreeCount}return a}function jn(t,n){if(n.childIds.length<128){n.childVisibleChunkSums=null;return}let s=Math.ceil(n.childIds.length/32),a=new Int32Array(s);for(let l=0;l<n.childIds.length;l++){let d=n.childIds[l];if(d==null)continue;let h=t[d];if(h==null)continue;a[l>>5]+=h.visibleSubtreeCount}n.childVisibleChunkSums=a}function ff(t,n,s,a){let l=Math.min(n.childIds.length,s+32),d=a;for(let h=s;h<l;h++){let f=n.childIds[h];if(f==null)continue;let g=t[f];if(g==null)continue;if(d<g.visibleSubtreeCount)return{childIndex:h,localVisibleIndex:d};d-=g.visibleSubtreeCount}throw Error(`Visible child index ${String(a)} is out of range`)}function qt(t,n,s=0){return t<<4|s<<3|n}function Gt(t){return t.depthAndFlags>>>4}function vi(t){return(t.depthAndFlags&8)>>3}function Y(t){return(t.depthAndFlags&8)!==0}function Ya(t){return t.depthAndFlags&7}function Ge(t,n){return(Ya(t)&n)!==0}function Mr(t,n){t.depthAndFlags|=n}function Qa(t,n){t.depthAndFlags=qt(n,Ya(t),vi(t))}var Ja=Symbol("benchmarkInstrumentation");function Za(t,n){if(n==null)return t;return Object.defineProperty(t,Ja,{configurable:!0,enumerable:!1,value:n,writable:!1}),t}function yi(t){if(t==null)return null;return t[Ja]??null}function z(t,n,s){if(t==null)return s();return t.measurePhase(n,s)}function Ar(t,n,s){if(!Number.isFinite(s)||t==null)return;t.setCounter(n,s)}function el(t){return t>=48&&t<=57}function pf(t){let n=[],s=0,a=0;while(a<t.length){while(a<t.length&&!el(t.charCodeAt(a)))a+=1;if(a>=t.length)break;if(a>s)n.push(t.slice(s,a));let l=0;while(a<t.length&&el(t.charCodeAt(a)))l=l*10+(t.charCodeAt(a)-48),a+=1;n.push(l),s=a}if(s<t.length||n.length===0)n.push(t.slice(s));return n}function hr(t){let n=t.toLowerCase();return{lowerValue:n,tokens:pf(n)}}function mf(t,n){let s=Math.min(t.length,n.length);for(let a=0;a<s;a++){let l=t[a],d=n[a];if(l===d)continue;if(typeof l==="number"&&typeof d==="number")return l<d?-1:1;let h=String(l),f=String(d);if(h!==f)return h<f?-1:1}if(t.length!==n.length)return t.length<n.length?-1:1;return 0}function bi(t,n){if(t.tokens.length===1&&n.tokens.length===1&&typeof t.tokens[0]==="string"&&typeof n.tokens[0]==="string"){if(t.lowerValue===n.lowerValue)return 0;return t.lowerValue<n.lowerValue?-1:1}let s=mf(t.tokens,n.tokens);if(s!==0)return s;if(t.lowerValue!==n.lowerValue)return t.lowerValue<n.lowerValue?-1:1;return 0}function tl(t,n,s){let a=bi(s(t),s(n));if(a!==0)return a;if(t===n)return 0;return t<n?-1:1}function gf(t,n){return tl(t,n,hr)}function so(t,n){if(n!==t.segments.length-1)return 1;return t.isDirectory?1:0}function vf(t,n){let s=Math.min(t.segments.length,n.segments.length);for(let a=0;a<s;a++){let l=t.segments[a],d=n.segments[a];if(l===d)continue;let h=so(t,a);if(h!==so(n,a))return h===1?-1:1;return gf(l,d)}if(t.segments.length!==n.segments.length)return t.segments.length<n.segments.length?-1:1;if(t.isDirectory===n.isDirectory)return 0;return t.isDirectory?-1:1}function nl(t,n){return vf(t,n)}function rl(t,n,s){let a=(d)=>{let h=s.get(d);if(h!=null)return h;let f=hr(d);return s.set(d,f),f},l=Math.min(t.segments.length,n.segments.length);for(let d=0;d<l;d++){let h=t.segments[d],f=n.segments[d];if(h===f)continue;let g=so(t,d);if(g!==so(n,d))return g===1?-1:1;return tl(h,f,a)}if(t.segments.length!==n.segments.length)return t.segments.length<n.segments.length?-1:1;if(t.isDirectory===n.isDirectory)return 0;return t.isDirectory?-1:1}function wi(t,n){let s=t.sortKeyById[n];if(s!==void 0)return s;let a=t.valueById[n],l=hr(a);return t.sortKeyById[n]=l,l}function fs(t={}){return{flattenEmptyDirectories:t.flattenEmptyDirectories!==!1,sort:t.sort??"default"}}function il(t){let n=t.length>0&&t.charCodeAt(t.length-1)===47,s=n?t.length-1:t.length,a=[],l=0;for(let d=0;d<s;d++){if(t.charCodeAt(d)!==47)continue;a.push(t.slice(l,d)),l=d+1}return a.push(t.slice(l,s)),{hasTrailingSlash:n,segments:a}}function fr(t){let{hasTrailingSlash:n,segments:s}=il(t);return{basename:s[s.length-1]??"",isDirectory:n,path:t,segments:s}}function ao(t){if(t.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:n,segments:s}=il(t);return{requiresDirectory:n,segments:s}}function lo(){let t=new Map;return t.set("",0),{idByValue:t,valueById:[""],sortKeyById:[hr("")]}}function fn(t,n){let s=t.idByValue.get(n);if(s!==void 0)return s;let a=t.valueById.length;return t.idByValue.set(n,a),t.valueById.push(n),a}function Qt(t,n){let s=t.valueById[n];if(s===void 0)throw Error(`Unknown segment ID: ${String(n)}`);return s}var ps=Symbol("pathStorePreparedInputKind");function al(t,n){return t[ps]=n,t}function ol(t){return{basename:t.basename,depth:t.segments.length,isDirectory:t.isDirectory,path:t.path,segments:t.segments}}function ll(t,n,s){if(s==="default")return nl(t,n);return s(ol(t),ol(n))}function yf(){return{depthAndFlags:qt(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function bf(t,n){let s=Math.min(t.length,n.length);for(let a=0;a<s;a++)if(t[a]!==n[a])return a;return s}function sl(t){return t.isDirectory?t.segments.length:t.segments.length-1}function wf(t){return Array.isArray(t)&&t.every((n)=>n!=null&&typeof n==="object"&&typeof n.path==="string"&&Array.isArray(n.segments)&&typeof n.basename==="string"&&typeof n.isDirectory==="boolean")}function Sf(t){return Array.isArray(t)&&t.every((n)=>typeof n==="string")}function cl(t,n={}){return co(t,n).map((s)=>s.path)}function dl(t,n={}){let s=co(t,n);return al({paths:s.map((a)=>a.path),preparedPaths:s},"prepared")}function ul(t){let n=t.length,s=!1;for(let a=0;a<n;a+=1){let l=t[a];if(l.length>0&&l.charCodeAt(l.length-1)===47){s=!0;break}}return al({paths:t,presortedPaths:t,presortedPathsContainDirectories:s},"presorted")}function hl(t){let n=t,s=n.preparedPaths;if(n[ps]==="prepared"&&s!=null)return s;if(!wf(s))throw Error("preparedInput must come from PathStore.prepareInput()");return s}function fl(t){let n=t;if(n[ps]==="presorted"&&n.presortedPaths!=null)return n.presortedPaths;return Sf(n.presortedPaths)?n.presortedPaths:null}function pl(t){let n=t;return typeof n.presortedPathsContainDirectories==="boolean"?n.presortedPathsContainDirectories:null}function co(t,n={}){let s=fs(n),a=yi(n);Ar(a,"workload.inputFiles",t.length);let l=z(a,"store.preparePathEntries.parse",()=>t.map((d)=>fr(d)));return z(a,"store.preparePathEntries.sort",()=>l.sort((d,h)=>ll(d,h,s.sort))),l}var uo=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[yf()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=lo();hasDeferredDirectoryIndexes=!1;constructor(t={}){this.instrumentation=yi(t),this.options=fs(t);let n=t.initialExpandedPaths??null;if(n==null||n.length===0)this.initialExpandedPathSet=null;else{let s=new Set,a=n.length;for(let l=0;l<a;l+=1){let d=n[l],h=d.length;s.add(h>0&&d.charCodeAt(h-1)===47?d.slice(0,h-1):d)}this.initialExpandedPathSet=s,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,dr())}appendPaths(t){return z(this.instrumentation,"store.builder.appendPaths.parse",()=>this.appendPreparedPaths(t.map((n)=>fr(n))))}appendPreparedPaths(t,n=!0){return this.createdDirectoriesAllExpanded=!1,z(this.instrumentation,"store.builder.appendPreparedPaths",()=>{for(let s of t)this.appendPreparedPath(s,n)}),this}appendPresortedPaths(t,n=null){return z(this.instrumentation,"store.builder.appendPresortedPaths",()=>{if(n===!1){this.appendPresortedFilePaths(t);return}this.createdDirectoriesAllExpanded=!1;let s=null,a=0,l=this.nodes,d=this.segmentTable,{idByValue:h,valueById:f}=d,g=this.directoryStack,b=0,w="",I=0;for(let v of t){if(s===v)throw Error(`Duplicate path: "${v}"`);let _=v.length>0&&v.charCodeAt(v.length-1)===47,k=_?v.length-1:v.length,T=0,R=0;if(s!=null)if(w.length>0&&v.length>w.length&&v.startsWith(w))T=I,R=w.length;else{let D=Math.min(k,s.length),N=!0;for(let H=0;H<D;H++){let X=v.charCodeAt(H);if(X!==s.charCodeAt(H)){N=!1;break}if(X===47)T++,R=H+1}if(N&&_&&D===k&&s.length>k&&s.charCodeAt(k)===47)T++,R=k+1}b=T,a=T;let B=R,F=v.indexOf("/",B);while(F>=0&&F<k){let D=g[b];if(D===void 0)throw Error("Directory stack underflow while building the path store");a++;let N=v.slice(B,F),H=h.get(N);if(H===void 0)H=f.length,h.set(N,H),f.push(N);let X=l.length;l.push({depthAndFlags:qt(a,0,1),nameId:H,parentId:D,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(v.slice(0,F)),b++,g[b]=X,B=F+1,F=v.indexOf("/",B)}if(_){if(B<k){let N=g[b];if(N===void 0)throw Error(`Unable to resolve directory parent for "${v}"`);a++;let H=v.slice(B,k),X=h.get(H);if(X===void 0)X=f.length,h.set(H,X),f.push(H);let fe=l.length;l.push({depthAndFlags:qt(a,0,1),nameId:X,parentId:N,subtreeNodeCount:1,visibleSubtreeCount:1}),b++,g[b]=fe,B=k+1}let D=g[b];if(D===void 0)throw Error(`Unable to resolve directory node for "${v}"`);this.promoteDirectoryToExplicit(D,v)}else{let D=g[b];if(D===void 0)throw Error(`Unable to resolve file parent for "${v}"`);let N=v.slice(B),H=h.get(N);if(H===void 0)H=f.length,h.set(N,H),f.push(N);l.push({depthAndFlags:qt(a+1,0),nameId:H,parentId:D,subtreeNodeCount:1,visibleSubtreeCount:1})}if(B!==w.length)w=v.substring(0,B),I=a;s=v}if(g.length=b+1,s!=null)this.lastPreparedPath=fr(s);this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(t){let n=null,s=0,a=this.nodes,l=this.segmentTable,{idByValue:d,valueById:h}=l,f=this.directoryStack,g=0,b="",w=0;for(let I of t){if(n===I)throw Error(`Duplicate path: "${I}"`);let v=I.length,_=0,k=0;if(n!=null)if(b.length>0&&I.length>b.length&&I.startsWith(b))_=w,k=b.length;else{let N=Math.min(v,n.length);for(let H=0;H<N;H++){let X=I.charCodeAt(H);if(X!==n.charCodeAt(H))break;if(X===47)_++,k=H+1}}g=_,s=_;let T=k,R=I.indexOf("/",T);while(R>=0){let N=f[g];if(N===void 0)throw Error("Directory stack underflow while building the path store");s++;let H=I.slice(T,R),X=d.get(H);if(X===void 0)X=h.length,d.set(H,X),h.push(H);let fe=a.length;a.push({depthAndFlags:qt(s,0,1),nameId:X,parentId:N,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(I.slice(0,R)),this.presortedDirectoryNodeIds.push(fe),g++,f[g]=fe,T=R+1,R=I.indexOf("/",T)}let B=f[g];if(B===void 0)throw Error(`Unable to resolve file parent for "${I}"`);let F=I.slice(T),D=d.get(F);if(D===void 0)D=h.length,d.set(F,D),h.push(F);if(a.push({depthAndFlags:qt(s+1,0),nameId:D,parentId:B,subtreeNodeCount:1,visibleSubtreeCount:1}),T!==b.length)b=I.substring(0,T),w=s;n=I}if(f.length=g+1,n!=null)this.lastPreparedPath=fr(n);this.hasDeferredDirectoryIndexes=!0}finish(t={}){let n=t.skipSubtreeCountPass===!0;if(this.hasDeferredDirectoryIndexes)z(this.instrumentation,"store.builder.buildDirectoryIndexes",()=>this.buildPresortedFinish(n)),this.hasDeferredDirectoryIndexes=!1;else if(!n)z(this.instrumentation,"store.builder.computeSubtreeCounts",()=>this.computeSubtreeCounts(0));return{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(t,n){if(this.hasDeferredDirectoryIndexes)this.buildDirectoryIndexes(),this.hasDeferredDirectoryIndexes=!1;if(this.lastPreparedPath!=null){if(t.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${t.path}"`);if(n){if((this.options.sort==="default"?rl(this.lastPreparedPath,t,this.segmentSortKeyCache):ll(this.lastPreparedPath,t,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${t.path}"`)}}let s=this.lastPreparedPath,a=sl(t),l=s==null?0:sl(s),d=s==null?0:bf(s.segments,t.segments),h=Math.min(d,a,l);this.directoryStack.length=h+1;for(let g=h;g<a;g++){let b=this.directoryStack[this.directoryStack.length-1];if(b===void 0)throw Error("Directory stack underflow while building the path store");let w=n?this.getOrCreateDirectoryChild(b,t.segments[g]):this.createDirectoryChild(b,t.segments[g]);this.directoryStack.push(w)}if(t.isDirectory){let g=this.directoryStack[this.directoryStack.length-1];if(g===void 0)throw Error(`Unable to resolve directory node for "${t.path}"`);this.promoteDirectoryToExplicit(g,t.path),this.lastPreparedPath=t;return}let f=this.directoryStack[this.directoryStack.length-1];if(f===void 0)throw Error(`Unable to resolve file parent for "${t.path}"`);if(n)this.createFileChild(f,t.basename,t.path);else this.createFileChildUnchecked(f,t.basename);this.lastPreparedPath=t}recordCreatedDirectoryPath(t){if(!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null)return;if(this.createdDirectoryCount+=1,!this.initialExpandedPathSet.has(t))this.createdDirectoriesAllExpanded=!1}createFileChild(t,n,s){let a=fn(this.segmentTable,n),l=this.getDirectoryIndex(t),d=l.childIdByNameId;if(d!=null){if(d.get(a)!==void 0)throw Error(`Path collides with an existing entry: "${s}"`)}let h=this.nodes[t];if(h===void 0)throw Error(`Unknown parent node ID: ${String(t)}`);let f=this.nodes.length;if(this.nodes.push({depthAndFlags:qt(Gt(h)+1,0),nameId:a,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),d!=null)d.set(a,f);return Dr(l,f),f}createFileChildUnchecked(t,n){let s=fn(this.segmentTable,n),a=this.getDirectoryIndex(t),l=this.nodes[t];if(l===void 0)throw Error(`Unknown parent node ID: ${String(t)}`);let d=this.nodes.length;if(this.nodes.push({depthAndFlags:qt(Gt(l)+1,0),nameId:s,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),a.childIdByNameId!=null)a.childIdByNameId.set(s,d);return Dr(a,d),d}getOrCreateDirectoryChild(t,n){let s=fn(this.segmentTable,n),a=this.getDirectoryIndex(t);if(a.childIdByNameId!=null){let h=a.childIdByNameId.get(s);if(h!==void 0){let f=this.nodes[h];if(f!=null&&!Y(f))throw Error(`Path collides with an existing file while creating directory "${n}"`);return h}}let l=this.nodes[t];if(l===void 0)throw Error(`Unknown parent node ID: ${String(t)}`);let d=this.nodes.length;if(this.nodes.push({depthAndFlags:qt(Gt(l)+1,0,1),nameId:s,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),a.childIdByNameId!=null)a.childIdByNameId.set(s,d);return Dr(a,d),this.directories.set(d,dr()),d}createDirectoryChild(t,n){let s=fn(this.segmentTable,n),a=this.getDirectoryIndex(t),l=this.nodes[t];if(l===void 0)throw Error(`Unknown parent node ID: ${String(t)}`);let d=this.nodes.length;if(this.nodes.push({depthAndFlags:qt(Gt(l)+1,0,1),nameId:s,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),a.childIdByNameId!=null)a.childIdByNameId.set(s,d);return Dr(a,d),this.directories.set(d,dr()),d}promoteDirectoryToExplicit(t,n){let s=this.nodes[t];if(s===void 0)throw Error(`Unknown directory node ID: ${String(t)}`);if(!Y(s))throw Error(`Path is not a directory: "${n}"`);if(Ge(s,1))throw Error(`Duplicate path: "${n}"`);Mr(s,1)}getDirectoryIndex(t){let n=this.directories.get(t);if(n!==void 0)return n;throw Error(`Unknown directory child index for node ${String(t)}`)}buildPresortedFinish(t){let n=this.nodes,s=this.directories;s.set(0,us());let a=-1,l=null;for(let d=1;d<n.length;d++){let h=n[d];if(h==null)continue;if(Y(h)){let g=us();s.set(d,g),a=d,l=g}let f;if(h.parentId===a)f=l;else f=s.get(h.parentId),a=h.parentId,l=f??null;if(f!=null)f.childIds.push(d)}if(t)return;for(let d=n.length-1;d>=1;d--){let h=n[d];if(h==null)continue;let f=n[h.parentId];if(f!=null)f.subtreeNodeCount+=h.subtreeNodeCount,f.visibleSubtreeCount+=h.visibleSubtreeCount}}buildDirectoryIndexes(){let t=this.nodes;for(let n=1;n<t.length;n++){let s=t[n];if(s==null)continue;if(Y(s))this.directories.set(n,dr());let a=this.directories.get(s.parentId);if(a!=null){if(a.childIdByNameId!=null)a.childIdByNameId.set(s.nameId,n);Dr(a,n)}}}computeSubtreeCounts(t){let n=this.nodes[t];if(n===void 0)throw Error(`Unknown node ID: ${String(t)}`);if(!Y(n))return n.subtreeNodeCount=1,n.visibleSubtreeCount=1,1;let s=this.getDirectoryIndex(t),a=1;for(let l of s.childIds)a+=this.computeSubtreeCounts(l);return ur(this.nodes,s),n.subtreeNodeCount=a,n.visibleSubtreeCount=a,a}};function ml(t,n="closed",s=null){let a=If(n);return{activeNodeCount:t.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:a,directoriesOpenByDefault:a==="open",hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:s,listeners:new Map,pathCacheByNodeId:new Map([[t.rootId,{path:"",version:0}]]),pathCacheVersion:0,snapshot:t,transactionStack:[]}}function gl(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function If(t){if(typeof t!=="number")return t;if(!Number.isInteger(t)||t<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(t)}`);return t}function vl(t,n){if(Ge(n,2))return!0;if(t.defaultExpansion==="open")return!0;if(t.defaultExpansion==="closed")return!1;return Gt(n)<=t.defaultExpansion}function _t(t,n,s=t.snapshot.nodes[n]){if(s==null||!Y(s))return!1;if(t.directoriesOpenByDefault&&!t.hasCollapsedDirectoryOverrides)return!0;if(t.collapsedDirectoryIds.has(n))return!1;if(t.expandedDirectoryIds.has(n))return!0;return vl(t,s)}function Kn(t,n,s,a=t.snapshot.nodes[n]){if(a==null||!Y(a))return;let l=vl(t,a);if(s){if(l){t.collapsedDirectoryIds.delete(n),t.hasCollapsedDirectoryOverrides=t.collapsedDirectoryIds.size>0;return}t.expandedDirectoryIds.add(n);return}if(l){t.collapsedDirectoryIds.add(n),t.hasCollapsedDirectoryOverrides=!0;return}t.expandedDirectoryIds.delete(n)}function yl(t,n){let s=t.directoryLoadInfoById.get(n);if(s!=null)return s;let a={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:"loaded"};return t.directoryLoadInfoById.set(n,a),a}function Un(t,n){return t.directoryLoadInfoById.get(n)?.state??"loaded"}function bl(t,n){let s=yl(t,n);if(s.state==="loading"&&s.activeAttemptId!=null)return{attemptId:s.activeAttemptId,nodeId:n,reused:!0};let a=s.nextAttemptId;return s.activeAttemptId=a,s.errorMessage=null,s.nextAttemptId+=1,s.state="loading",{attemptId:a,nodeId:n,reused:!1}}function wl(t,n){let s=yl(t,n);s.activeAttemptId=null,s.errorMessage=null,s.state="unloaded"}function Sl(t,n,s){let a=t.directoryLoadInfoById.get(n);if(a==null||a.activeAttemptId!==s)return!1;return a.activeAttemptId=null,a.errorMessage=null,a.state="loaded",!0}function Il(t,n,s){return t.directoryLoadInfoById.get(n)?.activeAttemptId===s}function kl(t,n,s,a){let l=t.directoryLoadInfoById.get(n);if(l==null||l.activeAttemptId!==s)return!1;return l.activeAttemptId=null,l.errorMessage=a??null,l.state="error",!0}function Cl(t,n){t.directoryLoadInfoById.delete(n)}function Pl(t,n,s){let a=s,l=t.listeners.get(n);if(l!=null)l.add(a);else t.listeners.set(n,new Set([a]));return()=>{let d=t.listeners.get(n);if(d==null)return;if(d.delete(a),d.size===0)t.listeners.delete(n)}}function Rl(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],canonicalChanged:!0,operation:"add",path:t.path,projectionChanged:t.projectionChanged,visibleCountDelta:null}}function Dl(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],canonicalChanged:!0,operation:"remove",path:t.path,projectionChanged:t.projectionChanged,recursive:t.recursive,visibleCountDelta:null}}function Ml(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],canonicalChanged:!0,from:t.from,operation:"move",projectionChanged:t.projectionChanged,to:t.to,visibleCountDelta:null}}function Al(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],canonicalChanged:!1,operation:"expand",path:t.path,projectionChanged:!0,visibleCountDelta:null}}function Nl(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],canonicalChanged:!1,operation:"collapse",path:t.path,projectionChanged:!0,visibleCountDelta:null}}function Fl(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],canonicalChanged:!1,operation:"mark-directory-unloaded",path:t.path,projectionChanged:t.projectionChanged,visibleCountDelta:null}}function Ll(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],attemptId:t.attemptId,canonicalChanged:!1,operation:"begin-child-load",path:t.path,projectionChanged:t.projectionChanged,reused:t.reused,visibleCountDelta:null}}function Bl(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],attemptId:t.attemptId,canonicalChanged:t.childEvents.some((n)=>n.canonicalChanged),childEvents:t.childEvents,operation:"apply-child-patch",path:t.path,projectionChanged:t.projectionChanged,visibleCountDelta:null}}function Hl(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],attemptId:t.attemptId,canonicalChanged:!1,operation:"complete-child-load",path:t.path,projectionChanged:t.projectionChanged,stale:t.stale,visibleCountDelta:null}}function Vl(t){return{affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],attemptId:t.attemptId,canonicalChanged:!1,errorMessage:t.errorMessage,operation:"fail-child-load",path:t.path,projectionChanged:t.projectionChanged,stale:t.stale,visibleCountDelta:null}}function Ol(t){return{activeNodeCountAfter:t.activeNodeCountAfter,activeNodeCountBefore:t.activeNodeCountBefore,affectedAncestorIds:t.affectedAncestorIds??[],affectedNodeIds:t.affectedNodeIds??[],cachedPathEntryCountAfter:t.cachedPathEntryCountAfter,cachedPathEntryCountBefore:t.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:t.idsPreserved,loadInfoEntryCountAfter:t.loadInfoEntryCountAfter,loadInfoEntryCountBefore:t.loadInfoEntryCountBefore,mode:t.mode,operation:"cleanup",projectionChanged:t.projectionChanged,reclaimedCachedPathEntryCount:t.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:t.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:t.reclaimedNodeSlotCount,reclaimedSegmentCount:t.reclaimedSegmentCount,segmentCountAfter:t.segmentCountAfter,segmentCountBefore:t.segmentCountBefore,totalNodeSlotCountAfter:t.totalNodeSlotCountAfter,totalNodeSlotCountBefore:t.totalNodeSlotCountBefore,visibleCountDelta:null}}function Wt(t,n,s){return{...s,visibleCountDelta:gs(t)-n}}function ql(t,n){let s=gs(t),a=gl();t.transactionStack.push(a);try{n()}catch(l){throw _l(t,a,!1),l}_l(t,a,!0,gs(t)-s)}function on(t,n){let s=t.instrumentation;if(s==null){xl(t,n);return}z(s,"store.events.record",()=>xl(t,n))}function xl(t,n){let s=t.transactionStack[t.transactionStack.length-1]??null;if(s==null){ms(t,n);return}s.events.push(n),xf(s,n)}function _l(t,n,s,a=null){if(t.transactionStack.pop()!==n)throw Error("Transaction stack underflow");if(!s)return;let l=t.transactionStack[t.transactionStack.length-1]??null;if(l!=null){let f=t.instrumentation;if(f==null)El(l,n);else z(f,"store.events.batch.merge",()=>El(l,n));return}let d=kf(n,a),h=t.instrumentation;if(h==null){ms(t,d);return}z(h,"store.events.batch.commit",()=>ms(t,d))}function kf(t,n){return{affectedAncestorIds:[...t.affectedAncestorIds],affectedNodeIds:[...t.affectedNodeIds],canonicalChanged:t.events.some((s)=>s.canonicalChanged),events:[...t.events],operation:"batch",projectionChanged:t.events.some((s)=>s.projectionChanged),visibleCountDelta:n}}function Cf(t,n){for(let s of n.affectedAncestorIds)t.affectedAncestorIds.add(s);for(let s of n.affectedNodeIds)t.affectedNodeIds.add(s)}function El(t,n){for(let s of n.events)t.events.push(s);Cf(t,n)}function xf(t,n){for(let s of n.affectedNodeIds)t.affectedNodeIds.add(s);for(let s of n.affectedAncestorIds)t.affectedAncestorIds.add(s)}function ms(t,n){let s=t.instrumentation;if(s==null){Tl(t,n);return}z(s,"store.events.emit",()=>Tl(t,n))}function Tl(t,n){t.listeners.get(n.operation)?.forEach((s)=>s(n)),t.listeners.get("*")?.forEach((s)=>s(n))}function gs(t){return t.snapshot.nodes[t.snapshot.rootId]?.visibleSubtreeCount??0}function Rn(t,n){if(t.snapshot.options.flattenEmptyDirectories!==!0)return null;let s=t.snapshot.nodes[n];if(s==null||!Y(s)||Ge(s,2))return null;let a=t.snapshot.directories.get(n);if(a==null||a.childIds.length!==1)return null;let l=a.childIds[0];if(l==null)return null;let d=t.snapshot.nodes[l];if(d==null||!Y(d))return null;return l}function Dn(t,n){let s=n;while(!0){let a=Rn(t,s);if(a==null)return s;s=a}}function Nr(t,n){let s=[n],a=n;while(!0){let l=Rn(t,a);if(l==null)return s;s.push(l),a=l}}function ho(t,n){let s=n==null?t.snapshot.rootId:$t(t,n);if(s==null)return[];return Ef(t,s)}function ys(t,n){let s=fr(n),a=s.isDirectory?s.segments:s.segments.slice(0,-1),l=Gn(t,Lf(t,a)),{createdNodeIds:d,directoryId:h}=Tf(t,a),f=new Set(d),g=h;if(s.isDirectory){let w=Q(t,h);if(Ge(w,1))throw Error(`Path already exists: "${n}"`);Mr(w,1),t.pathCacheByNodeId.set(h,{path:n,version:t.pathCacheVersion}),f.add(h)}else g=Rf(t,h,s.basename),f.add(g);Xn(t,h);let b=Gn(t,h);return Rl({affectedAncestorIds:Jt(t,g),affectedNodeIds:[...f],path:n,projectionChanged:Gl(l,b)})}function bs(t,n,s){let a=$t(t,n);if(a==null)throw Error(`Path does not exist: "${n}"`);let l=Q(t,a);if(Ge(l,2))throw Error("The root node cannot be removed");if(Y(l)&&Fe(t,a).childIds.length>0&&s.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${n}"`);let d=l.parentId,h=Gn(t,d),f=Ul(t,a);Is(t,d,a,l.nameId),ks(t,d),Xn(t,d);let g=Gn(t,d);return Dl({affectedAncestorIds:Jt(t,d),affectedNodeIds:f,path:n,projectionChanged:Gl(h,g),recursive:s.recursive===!0})}function ws(t,n,s,a){let l=$t(t,n);if(l==null)throw Error(`Source path does not exist: "${n}"`);let d=Q(t,l);if(Ge(d,2))throw Error("The root node cannot be moved");let h=a.collision??"error",f=Nf(t,l,s),g=Gn(t,d.parentId),b=Gn(t,f.parentId),w=Qt(t.snapshot.segmentTable,d.nameId),I=fn(t.snapshot.segmentTable,f.basename);if(f.parentId===d.parentId&&w===f.basename)return null;if(Y(d)&&Hf(t,l,f.parentId))throw Error("Cannot move a directory into one of its descendants");let v=$n(t.snapshot.nodes,Fe(t,f.parentId)).get(I),_=f.existingNodeId??v??null;if(_!=null&&_!==l){if(Ff(t,_,h,vi(d))==="skip")return null}let k=d.parentId;if(Is(t,k,l,d.nameId),d.parentId=f.parentId,d.nameId=I,t.pathCacheByNodeId.delete(l),Yl(t,l),Ss(t,f.parentId,l),ks(t,k),t.pathCacheVersion++,Xn(t,k),f.parentId!==k)Xn(t,f.parentId);let T=Gn(t,k),R=Gn(t,f.parentId);return Ml({affectedAncestorIds:[...new Set([...Jt(t,k),...Jt(t,f.parentId)])],affectedNodeIds:[l],from:n,projectionChanged:Xl([g,b],[T,R]),to:Pe(t,l)})}function _f(t,n){let s=t.pathCacheByNodeId.get(n);return s!=null&&s.version===t.pathCacheVersion?s.path:null}function zl(t,n,s){return t.pathCacheByNodeId.set(n,{path:s,version:t.pathCacheVersion}),s}function Pe(t,n){let s=Q(t,n),a=_f(t,n);if(a!=null)return a;if(Ge(s,2))return zl(t,n,"");let l=Pe(t,s.parentId),d=Qt(t.snapshot.segmentTable,s.nameId),h=l.length===0?d:`${l}${d}`;return zl(t,n,Y(s)?`${h}/`:h)}function Xn(t,n){let s=t.instrumentation;if(s==null){$l(t,n);return}z(s,"store.recomputeCountsUpwardFrom",()=>$l(t,n))}function Si(t,n){let s=[[n,0]],{nodes:a,directories:l}=t.snapshot;while(s.length>0){let d=s[s.length-1],h=d[0],f=a[h];if(f==null||!Y(f)){vs(t,h,f,!0),s.pop();continue}let g=l.get(h);if(g==null||d[1]>=g.childIds.length){vs(t,h,f,!0),s.pop();continue}let b=g.childIds[d[1]++];s.push([b,0])}}function Jt(t,n){let s=[],a=n;while(a!=null){let l=Q(t,a);if(s.push(a),a===t.snapshot.rootId)break;a=l.parentId}return s}function $t(t,n){if(n.length===0)return t.snapshot.rootId;let s=ao(n);return Kl(t,s.segments,s.requiresDirectory)}function Kl(t,n,s){let a=t.snapshot.rootId;for(let d of n){let h=t.snapshot.segmentTable.idByValue.get(d);if(h===void 0)return null;let f=Fe(t,a),g=$n(t.snapshot.nodes,f).get(h);if(g===void 0)return null;a=g}let l=Q(t,a);if(s&&!Y(l))return null;return a}function Fe(t,n){let s=t.snapshot.directories.get(n);if(s===void 0)throw Error(`Unknown directory child index for node ${String(n)}`);return s}function Q(t,n){let s=t.snapshot.nodes[n];if(s===void 0||Ge(s,4))throw Error(`Unknown node ID: ${String(n)}`);return s}function Ef(t,n){let s=t.snapshot.nodes[n];if(s===void 0||Ge(s,4))return[];if(!Y(s))return[Pe(t,n)];if(Fe(t,n).childIds.length===0)return Ge(s,1)&&!Ge(s,2)?[Pe(t,n)]:[];let a=[],l=[{childIndex:0,nodeId:n}];while(l.length>0){let d=l[l.length-1];if(d==null)break;let h=t.snapshot.nodes[d.nodeId];if(h===void 0||Ge(h,4)){l.pop();continue}if(!Y(h)){a.push(Pe(t,d.nodeId)),l.pop();continue}let f=Fe(t,d.nodeId);if(f.childIds.length===0){if(Ge(h,1)&&!Ge(h,2))a.push(Pe(t,d.nodeId));l.pop();continue}let g=f.childIds[d.childIndex];if(g==null){l.pop();continue}d.childIndex++,l.push({childIndex:0,nodeId:g})}return a}function Tf(t,n){let s=[],a=t.snapshot.rootId;for(let l of n){let d=fn(t.snapshot.segmentTable,l),h=Fe(t,a),f=$n(t.snapshot.nodes,h).get(d);if(f!==void 0){if(!Y(Q(t,f)))throw Error(`Cannot create a directory that collides with an existing file: "${l}"`);a=f;continue}a=Pf(t,a,d),s.push(a)}return{createdNodeIds:s,directoryId:a}}function Pf(t,n,s){let a=Q(t,n),l=t.snapshot.nodes.length;if(t.snapshot.nodes.push({depthAndFlags:qt(Gt(a)+1,0,1),nameId:s,parentId:n,subtreeNodeCount:1,visibleSubtreeCount:1}),t.snapshot.directories.set(l,dr()),Ss(t,n,l),t.collapseNewDirectoriesByDefault)t.collapsedDirectoryIds.add(l),t.hasCollapsedDirectoryOverrides=!0;return t.activeNodeCount++,l}function Rf(t,n,s){let a=fn(t.snapshot.segmentTable,s),l=Fe(t,n);if($n(t.snapshot.nodes,l).has(a))throw Error(`Path already exists: "${Vf(t,n,s)}"`);let d=Q(t,n),h=t.snapshot.nodes.length;return t.snapshot.nodes.push({depthAndFlags:qt(Gt(d)+1,0),nameId:a,parentId:n,subtreeNodeCount:1,visibleSubtreeCount:1}),Ss(t,n,h),t.activeNodeCount++,h}function Df(t,n,s){let a=0,l=n.childIds.length;while(a<l){let d=a+l>>>1,h=n.childIds[d];if(h==null){l=d;continue}if(Mf(t,s,h)<0)l=d;else a=d+1}return a}function Ss(t,n,s){let a=Fe(t,n),l=Q(t,s);$n(t.snapshot.nodes,a).set(l.nameId,s),io(a,s,l.subtreeNodeCount,l.visibleSubtreeCount);let d=Df(t,a,s);a.childIds.splice(d,0,s),hs(a,d),jn(t.snapshot.nodes,a)}function Is(t,n,s,a){let l=Fe(t,n),d=Rr(l),h=d.get(s)??-1;$n(t.snapshot.nodes,l).delete(a),d.delete(s);let f=t.snapshot.nodes[s];if(f!=null)io(l,s,-f.subtreeNodeCount,-f.visibleSubtreeCount);if(h>=0)l.childIds.splice(h,1),hs(l,h),jn(t.snapshot.nodes,l)}function Mf(t,n,s){let a=t.snapshot.options.sort;if(a==="default")return Af(t,n,s);return a(Wl(t,n),Wl(t,s))}function Af(t,n,s){let a=Q(t,n),l=Q(t,s),d=Y(a);if(d!==Y(l))return d?-1:1;let h=bi(wi(t.snapshot.segmentTable,a.nameId),wi(t.snapshot.segmentTable,l.nameId));if(h!==0)return h;let f=Qt(t.snapshot.segmentTable,a.nameId),g=Qt(t.snapshot.segmentTable,l.nameId);if(f!==g)return f<g?-1:1;return n<s?-1:1}function Wl(t,n){let s=Q(t,n),a=Pe(t,n),l=Y(s),d=l?a.slice(0,-1):a;return{basename:Qt(t.snapshot.segmentTable,s.nameId),depth:Gt(s),isDirectory:l,path:a,segments:d.length===0?[]:d.split("/")}}function Nf(t,n,s){let a=Q(t,n),l=$t(t,s);if(l!=null){let b=Q(t,l);if(Y(b))return{basename:Qt(t.snapshot.segmentTable,a.nameId),existingNodeId:null,parentId:l};let w=ao(s).segments;return{basename:w[w.length-1]??"",existingNodeId:l,parentId:b.parentId}}let d=ao(s),h=d.segments[d.segments.length-1]??"",f=d.segments.slice(0,-1),g=f.length===0?t.snapshot.rootId:Kl(t,f,!0);if(g==null)throw Error(`Destination parent does not exist: "${s}"`);return{basename:h,existingNodeId:null,parentId:g}}function Ff(t,n,s,a){if(s==="skip")return"skip";if(s==="error")throw Error(`Destination already exists: "${Pe(t,n)}"`);let l=Q(t,n);if(vi(l)!==a)throw Error("replace collision requires the same source and destination kinds");if(Y(l)&&Fe(t,n).childIds.length>0)throw Error("replace collision does not support non-empty directories");let{parentId:d,nameId:h}=l;return Ul(t,n),Is(t,d,n,h),ks(t,d),Xn(t,d),"handled"}function Ul(t,n){let s=[],a=[{nodeId:n,visitedChildren:!1}];while(a.length>0){let l=a.pop();if(l==null)break;let d=Q(t,l.nodeId);if(l.visitedChildren||!Y(d)){if(Y(d))t.snapshot.directories.delete(l.nodeId);if(Mr(d,4),t.pathCacheByNodeId.delete(l.nodeId),t.collapsedDirectoryIds.delete(l.nodeId))t.hasCollapsedDirectoryOverrides=t.collapsedDirectoryIds.size>0;t.expandedDirectoryIds.delete(l.nodeId),Cl(t,l.nodeId),t.activeNodeCount--,s.push(l.nodeId);continue}a.push({nodeId:l.nodeId,visitedChildren:!0});let h=Fe(t,l.nodeId);for(let f=h.childIds.length-1;f>=0;f--){let g=h.childIds[f];if(g!=null)a.push({nodeId:g,visitedChildren:!1})}}return s}function ks(t,n){let s=n;while(s!=null){let a=Q(t,s);if(!Y(a)||Ge(a,2))return;if(Fe(t,s).childIds.length>0)return;Mr(a,1),s=a.parentId===s?null:a.parentId}}function Lf(t,n){let s=t.snapshot.rootId;for(let a of n){let l=t.snapshot.segmentTable.idByValue.get(a);if(l==null)break;let d=$n(t.snapshot.nodes,Fe(t,s)).get(l);if(d==null)break;if(!Y(Q(t,d)))break;s=d}return s}function Gn(t,n){let s=Bf(t,n);if(s==null)return null;let a=Dn(t,s),l=Q(t,a),d=s===a?null:Nr(t,s).map((h)=>Pe(t,h));return JSON.stringify({flattenedSegmentPaths:d,hasChildren:Fe(t,a).childIds.length>0,path:Pe(t,a),terminalKind:vi(l)})}function Gl(t,n){return Xl([t],[n])}function Xl(t,n){for(let s=0;s<t.length;s+=1){let a=t[s],l=n[s];if(a==null||l==null||a!==l)return!0}return!1}function Bf(t,n){let s=n;while(s!=null){let a=Q(t,s);if(!Y(a)||Ge(a,2))return null;if(!_t(t,s,a))return s;s=a.parentId}return null}function Yl(t,n){let s=Q(t,n);if(Qa(s,(n===t.snapshot.rootId?-1:Gt(Q(t,s.parentId)))+1),!Y(s))return;let a=Fe(t,n);for(let l of a.childIds)Yl(t,l)}function Hf(t,n,s){let a=s;while(a!=null){if(a===n)return!0;let l=Q(t,a);if(a===t.snapshot.rootId)return!1;a=l.parentId}return!1}function vs(t,n,s=Q(t,n),a=!1){let l=t.instrumentation;if(l==null){jl(t,n,s,a);return}z(l,"store.recomputeNodeCounts",()=>jl(t,n,s,a))}function $l(t,n){let s=n;while(s!=null){let a=Q(t,s),{subtreeNodeCount:l,visibleSubtreeCount:d}=a;if(vs(t,s,a),s===t.snapshot.rootId)return;let h=a.subtreeNodeCount-l,f=a.visibleSubtreeCount-d,g=a.parentId;if(h!==0||f!==0)io(Fe(t,g),s,h,f);s=g}}function jl(t,n,s,a){if(!Y(s)){s.subtreeNodeCount=1,s.visibleSubtreeCount=1;return}let l=Fe(t,n);if(a){let f=t.instrumentation;if(f==null)ur(t.snapshot.nodes,l);else z(f,"store.recomputeNodeCounts.rebuildChildAggregates",()=>ur(t.snapshot.nodes,l))}let d=1+l.totalChildSubtreeNodeCount,h=l.totalChildVisibleSubtreeCount;if(s.subtreeNodeCount=d,Ge(s,2)){s.visibleSubtreeCount=h;return}s.visibleSubtreeCount=Rn(t,n)!=null?h:_t(t,n,s)?1+h:1}function Vf(t,n,s){let a=Pe(t,n);return a.length===0?s:`${a}${s}`}function Fr(t){return t!=null&&!Ge(t,4)}function fo(t,n){let s=t.snapshot.nodes[n];if(!Fr(s)||!Y(s)||Ge(s,2))return null;return s}function Of(t){let n=0;for(let[s,a]of t.pathCacheByNodeId){if(a.version!==t.pathCacheVersion)continue;if(!Fr(t.snapshot.nodes[s]))continue;n+=1}return n}function qf(t){return Math.max(0,t.valueById.length-1)}function Ql(t){return{activeNodeCount:t.activeNodeCount,cachedPathEntryCount:Of(t),loadInfoEntryCount:t.directoryLoadInfoById.size,segmentCount:qf(t.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,t.snapshot.nodes.length-1)}}function zf(t,n,s,a){return{activeNodeCountAfter:a.activeNodeCount,activeNodeCountBefore:s.activeNodeCount,cachedPathEntryCountAfter:a.cachedPathEntryCount,cachedPathEntryCountBefore:s.cachedPathEntryCount,idsPreserved:n,loadInfoEntryCountAfter:a.loadInfoEntryCount,loadInfoEntryCountBefore:s.loadInfoEntryCount,mode:t,reclaimedCachedPathEntryCount:s.cachedPathEntryCount-a.cachedPathEntryCount,reclaimedLoadInfoEntryCount:s.loadInfoEntryCount-a.loadInfoEntryCount,reclaimedNodeSlotCount:s.totalNodeSlotCount-a.totalNodeSlotCount,reclaimedSegmentCount:s.segmentCount-a.segmentCount,segmentCountAfter:a.segmentCount,segmentCountBefore:s.segmentCount,totalNodeSlotCountAfter:a.totalNodeSlotCount,totalNodeSlotCountBefore:s.totalNodeSlotCount}}function Jl(t){let n=[],s=[];for(let a of t.collapsedDirectoryIds)if(fo(t,a)!=null)n.push(Pe(t,a));for(let a of t.expandedDirectoryIds)if(fo(t,a)!=null)s.push(Pe(t,a));return{collapsedPaths:n,expandedPaths:s}}function Zl(t){let n=[];for(let[s,a]of t.directoryLoadInfoById){if(fo(t,s)==null||Un(t,s)==="loaded")continue;n.push({info:{activeAttemptId:null,errorMessage:a.errorMessage,nextAttemptId:a.nextAttemptId,state:a.state},path:Pe(t,s)})}return n}function ec(t,n){t.collapsedDirectoryIds.clear(),t.hasCollapsedDirectoryOverrides=!1,t.expandedDirectoryIds.clear();for(let s of n.expandedPaths){let a=$t(t,s);if(a==null)continue;Kn(t,a,!0,Q(t,a))}for(let s of n.collapsedPaths){let a=$t(t,s);if(a==null)continue;Kn(t,a,!1,Q(t,a))}}function tc(t,n){t.directoryLoadInfoById.clear();for(let s of n){let a=$t(t,s.path);if(a==null)continue;if(fo(t,a)==null)continue;t.directoryLoadInfoById.set(a,{activeAttemptId:null,errorMessage:s.info.errorMessage,nextAttemptId:s.info.nextAttemptId,state:s.info.state})}}function Wf(t){t.pathCacheVersion+=1,t.pathCacheByNodeId.clear(),t.pathCacheByNodeId.set(t.snapshot.rootId,{path:"",version:t.pathCacheVersion})}function $f(t){let n=t.snapshot.segmentTable,s=lo();for(let a of t.snapshot.nodes){if(!Fr(a))continue;if(Ge(a,2)){a.nameId=0;continue}a.nameId=fn(s,Qt(n,a.nameId))}t.snapshot.segmentTable=s}function jf(t){for(let[n,s]of t.snapshot.directories){let a=t.snapshot.nodes[n];if(!Fr(a)||!Y(a)){t.snapshot.directories.delete(n);continue}let l=s.childIds.filter((d)=>{let h=t.snapshot.nodes[d];return Fr(h)&&h.parentId===n});s.childIds=l,s.childIdByNameId=new Map(l.map((d)=>[Q(t,d).nameId,d])),s.childPositionById=new Map(l.map((d,h)=>[d,h])),ur(t.snapshot.nodes,s)}}function Kf(t){let n=t.snapshot.nodes.length-1;while(n>t.snapshot.rootId){let s=t.snapshot.nodes[n];if(Fr(s))break;n-=1}t.snapshot.nodes.length=n+1}function Uf(t){let n=Jl(t),s=Zl(t);z(t.instrumentation,"store.cleanup.stable.clearPathCaches",()=>Wf(t)),z(t.instrumentation,"store.cleanup.stable.rebuildSegmentTable",()=>$f(t)),z(t.instrumentation,"store.cleanup.stable.rebuildDirectoryIndexes",()=>jf(t)),z(t.instrumentation,"store.cleanup.stable.trimTrailingRemovedNodeSlots",()=>Kf(t)),z(t.instrumentation,"store.cleanup.stable.restoreExpansionOverrides",()=>ec(t,n)),z(t.instrumentation,"store.cleanup.stable.restoreDirectoryLoadInfos",()=>tc(t,s)),z(t.instrumentation,"store.cleanup.stable.recomputeCounts",()=>Si(t,t.snapshot.rootId))}function Gf(t){let n=Jl(t),s=Zl(t),a=z(t.instrumentation,"store.cleanup.aggressive.listPaths",()=>ho(t)),l=Za({...t.snapshot.options},t.instrumentation),d=z(t.instrumentation,"store.cleanup.aggressive.rebuildSnapshot",()=>{let h=new uo(l);return h.appendPaths(a),h.finish()});t.snapshot=d,t.activeNodeCount=d.nodes.length-1,t.pathCacheByNodeId=new Map([[d.rootId,{path:"",version:0}]]),t.pathCacheVersion=0,z(t.instrumentation,"store.cleanup.aggressive.restoreExpansionOverrides",()=>ec(t,n)),z(t.instrumentation,"store.cleanup.aggressive.restoreDirectoryLoadInfos",()=>tc(t,s)),z(t.instrumentation,"store.cleanup.aggressive.recomputeCounts",()=>Si(t,t.snapshot.rootId))}function nc(t){for(let n of t.directoryLoadInfoById.values())if(n.state==="loading"&&n.activeAttemptId!=null)return!0;return!1}function rc(t,n){let s=Ql(t);if(n==="stable")z(t.instrumentation,"store.cleanup.stable",()=>Uf(t));else z(t.instrumentation,"store.cleanup.aggressive",()=>Gf(t));let a=Ql(t);return zf(n,n==="stable",s,a)}var Xf=64;function Yf(t,n){let s=n+2;if(s<=t.length)return t;let a=t.length;while(a<s)a*=2;let l=new Int32Array(a);return l.fill(-1),l.set(t),l}function Et(t){return Q(t,t.snapshot.rootId).visibleSubtreeCount}function ac(t,n,s,a){let l=Q(t,n.terminalNodeId),d=Math.max(1,l.visibleSubtreeCount);return Math.min(a-1,s+d-1)}function Qf(t,n,s,a){return{ancestorPaths:a,index:n.index,posInSet:n.posInSet,row:Ii(t,n.cursor),setSize:n.setSize,subtreeEndIndex:ac(t,n.cursor,n.index,s)}}function lc(t,n,s,a,l,d){let h=Fe(t,n),{childIndex:f,childVisibleIndex:g,localVisibleIndex:b}=oo(t.snapshot.nodes,h,s),w=h.childIds[f];if(w==null)throw Error(`Visible index ${String(s)} is out of range`);return Jf(t,w,b,a+g,l+1,f,h.childIds.length,d)}function Jf(t,n,s,a,l,d,h,f){if(!Y(Q(t,n))){if(s===0)return{ancestors:f,cursor:{headNodeId:n,terminalNodeId:n,visibleDepth:l},index:a,posInSet:d,setSize:h};throw Error(`Visible index ${String(s)} is out of range for file`)}let g=gc(t,n,l);if(s===0)return{ancestors:f,cursor:g,index:a,posInSet:d,setSize:h};let b=Q(t,g.terminalNodeId);if(!Y(b)||!_t(t,g.terminalNodeId,b))throw Error(`Visible index ${String(s)} is out of range for collapsed directory`);return lc(t,g.terminalNodeId,s-1,a+1,g.visibleDepth,[...f,{cursor:g,index:a,posInSet:d,setSize:h}])}function cc(t,n){let s=Et(t);if(n<0||n>=s)return null;let a=lc(t,t.snapshot.rootId,n,0,-1,[]),l=a.ancestors.map((h)=>Pe(t,h.cursor.terminalNodeId)),d=null;return{ancestorPaths:l,get ancestorRows(){if(d!=null)return d;let h=[],f=[];for(let g of a.ancestors){let b=Qf(t,g,s,[...f]);h.push(b),f.push(b.row.path)}return d=h,d},index:a.index,posInSet:a.posInSet,row:Ii(t,a.cursor),setSize:a.setSize,subtreeEndIndex:ac(t,a.cursor,a.index,s)}}function dc(t,n,s){let a=t.instrumentation,l=Et(t);if(l<=0||s<n)return[];let d=Math.max(0,Math.min(n,l-1)),h=Math.max(d,Math.min(s,l-1));if(a==null){if(d===0)return tp(t,h+1);let I=[],v=ic(t,d);for(let _=d;_<=h&&v!=null;_++){let k=Ii(t,v);I.push(k),v=oc(t,v)}return I}let f=[],g=0,b=0,w=z(a,"store.getVisibleSlice.selectFirstRow",()=>ic(t,d));for(let I=d;I<=h&&w!=null;I++){let v=z(a,"store.getVisibleSlice.materializeRow",()=>Ii(t,w));if(f.push(v),v.isFlattened)g++,b+=v.flattenedSegments?.length??0;w=z(a,"store.getVisibleSlice.advanceCursor",()=>oc(t,w))}return Ar(a,"workload.visibleRowsRead",f.length),Ar(a,"workload.flattenedRowsRead",g),Ar(a,"workload.flattenedSegmentsRead",b),f}function xs(t,n=Et(t)){let s=t.instrumentation;if(s==null)return sc(t,n);return z(s,"store.getVisibleTreeProjection",()=>sc(t,n))}function uc(t){return ep(xs(t))}function hc(t,n){let s=$t(t,n);if(s==null||s===t.snapshot.rootId)return null;if(Y(Q(t,s))&&Dn(t,s)!==s)return null;let a=0,l=s,{nodes:d,rootId:h}=t.snapshot;while(l!==h){let f=Q(t,l).parentId,g=Fe(t,f),b=Rr(g).get(l);if(b==null)throw Error(`Child ${String(l)} was not found in its parent index`);if(a+=Xa(d,g,b),f!==h){let w=Q(t,f),I=Rn(t,f);if(!_t(t,f,w)&&I!==l)return null;if(Dn(t,f)===f)a+=1}l=f}return a}function fc(t,n){let s=$t(t,n);if(s==null)throw Error(`Path does not exist: "${n}"`);let a=Q(t,s);if(!Y(a))throw Error(`Path is not a directory: "${n}"`);if(_t(t,s,a))return null;return Kn(t,s,!0,a),Xn(t,s),Al({affectedAncestorIds:Jt(t,s),affectedNodeIds:[s],path:n,projectionChanged:!0})}function pc(t,n){let s=$t(t,n);if(s==null)throw Error(`Path does not exist: "${n}"`);let a=Q(t,s);if(!Y(a))throw Error(`Path is not a directory: "${n}"`);if(!_t(t,s,a))return null;return Kn(t,s,!1,a),Xn(t,s),Nl({affectedAncestorIds:Jt(t,s),affectedNodeIds:[s],path:n,projectionChanged:!0})}function ic(t,n){if(n<0||n>=Et(t))return null;return mc(t,t.snapshot.rootId,n,-1)}function mc(t,n,s,a){let l=Fe(t,n),d=t.instrumentation,{childIndex:h,localVisibleIndex:f}=d==null?oo(t.snapshot.nodes,l,s):z(d,"store.getVisibleSlice.selectChildIndex",()=>oo(t.snapshot.nodes,l,s)),g=l.childIds[h];if(g!=null)return Cs(t,g,f,a+1);throw Error(`Visible index ${String(s)} is out of range`)}function Cs(t,n,s,a){if(!Y(Q(t,n))){if(s===0)return{headNodeId:n,terminalNodeId:n,visibleDepth:a};throw Error(`Visible index ${String(s)} is out of range for file`)}let l=gc(t,n,a);if(s===0)return l;let d=Q(t,l.terminalNodeId);if(!Y(d)||!_t(t,l.terminalNodeId,d))throw Error(`Visible index ${String(s)} is out of range for collapsed directory`);return mc(t,l.terminalNodeId,s-1,l.visibleDepth)}function gc(t,n,s){if(!Y(Q(t,n)))return{headNodeId:n,terminalNodeId:n,visibleDepth:s};if(t.instrumentation==null)return{headNodeId:n,terminalNodeId:Dn(t,n),visibleDepth:s};return{headNodeId:n,terminalNodeId:z(t.instrumentation,"store.getVisibleSlice.flatten.resolveTerminalDirectory",()=>Dn(t,n)),visibleDepth:s}}function Zf(t,n){let s=Q(t,n);if(!Y(s))return!0;let a=s.parentId;if(a===t.snapshot.rootId)return!0;return Rn(t,a)!==n}function oc(t,n){let s=Q(t,n.terminalNodeId);if(Y(s)){let d=Fe(t,n.terminalNodeId);if(_t(t,n.terminalNodeId,s)&&d.childIds.length>0){let h=d.childIds[0];return h==null?null:Cs(t,h,0,n.visibleDepth+1)}}let{terminalNodeId:a,visibleDepth:l}=n;while(!0){let d=Q(t,a);if(a===t.snapshot.rootId)return null;let h=d.parentId,f=Fe(t,h),g=Rr(f).get(a)??-1;if(g<0)throw Error(`Child ${String(a)} was not found in its parent index`);let b=f.childIds[g+1]??null;if(b!=null)return Cs(t,b,0,l);if(Zf(t,a))l--;a=h}}function ep(t){let n=t.paths.length,s=Array(n);for(let a=0;a<n;a+=1){let l=t.getParentIndex(a);s[a]={index:a,parentPath:l>=0?t.paths[l]??null:null,path:t.paths[a]??"",posInSet:t.posInSetByIndex[a]??0,setSize:t.setSizeByIndex[a]??0}}return{getParentIndex:t.getParentIndex,rows:s,get visibleIndexByPath(){return t.visibleIndexByPath}}}function sc(t,n){let s=Array(n),a=new Int32Array(n),l=new Int32Array(n),d=new Int32Array(n),h=new Int32Array(Xf);h.fill(-1);let f=0,{nodes:g,directories:b,segmentTable:w}=t.snapshot,I=[[b.get(t.snapshot.rootId),0,-1,""]],v=t.snapshot.options.flattenEmptyDirectories,{pathCacheByNodeId:_,pathCacheVersion:k}=t,T=w.valueById;while(I.length>0&&f<n){let N=I[I.length-1],H=N[0];if(N[1]>=H.childIds.length){I.pop();continue}let X=N[1],fe=H.childIds[N[1]++],yt=g[fe],Le=N[2]+1,bt=N[3];h=Yf(h,Le);let Ie,Be=fe;if(!Y(yt)){let qe=_.get(fe);Ie=qe!=null&&qe.version===k?qe.path:`${bt}${T[yt.nameId]}`}else Be=v?Dn(t,fe):fe,Ie=Be===fe?`${bt}${T[yt.nameId]}/`:Pe(t,Be);a[f]=h[Le],s[f]=Ie,l[f]=X,d[f]=H.childIds.length,h[Le+1]=f,f+=1;let Qe=g[Be];if(Qe!=null&&Y(Qe)&&_t(t,Be,Qe))I.push([b.get(Be),0,Le,Ie])}if(f<n)s.length=f;let R=a.subarray(0,f),B=l.subarray(0,f),F=d.subarray(0,f),D=null;return{getParentIndex(N){return N<0||N>=f?-1:R[N]??-1},paths:s,posInSetByIndex:B,setSizeByIndex:F,get visibleIndexByPath(){if(D==null){D=new Map;for(let N=0;N<f;N+=1)D.set(s[N]??"",N)}return D}}}function tp(t,n){let s=Array(n),a=0,{nodes:l,directories:d,segmentTable:h}=t.snapshot,f=[[d.get(t.snapshot.rootId),0,-1]],g=h.valueById,b=t.snapshot.options.flattenEmptyDirectories,{pathCacheByNodeId:w,pathCacheVersion:I}=t;while(f.length>0&&a<n){let v=f[f.length-1],_=v[0];if(v[1]>=_.childIds.length){f.pop();continue}let k=_.childIds[v[1]++],T=l[k],R=v[2]+1;if(!Y(T)){let N=w.get(k);s[a++]={depth:R,flattenedSegments:void 0,hasChildren:!1,id:k,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:"file",loadState:void 0,name:g[T.nameId],path:N!=null&&N.version===I?N.path:Pe(t,k)};continue}let B=b?Dn(t,k):k,F={headNodeId:k,terminalNodeId:B,visibleDepth:R};s[a++]=Ii(t,F);let D=l[B];if(D!=null&&Y(D)&&_t(t,B,D))f.push([d.get(B),0,R])}if(a<n)s.length=a;return s}function Ii(t,n){let s=Q(t,n.terminalNodeId),a=Y(s)?np(t,n):null,l=Pe(t,n.terminalNodeId),d=Qt(t.snapshot.segmentTable,s.nameId),h=Y(s)&&Fe(t,n.terminalNodeId).childIds.length>0,f=n.headNodeId!==n.terminalNodeId,g=t.instrumentation,b=f?g==null?Nr(t,n.headNodeId).map((w)=>{let I=Q(t,w);return{isTerminal:w===n.terminalNodeId,name:Qt(t.snapshot.segmentTable,I.nameId),nodeId:w,path:Pe(t,w)}}):z(g,"store.getVisibleSlice.flatten.collectSegments",()=>Nr(t,n.headNodeId).map((w)=>{let I=Q(t,w);return{isTerminal:w===n.terminalNodeId,name:Qt(t.snapshot.segmentTable,I.nameId),nodeId:w,path:Pe(t,w)}})):void 0;return{depth:n.visibleDepth,flattenedSegments:b,hasChildren:h,id:n.terminalNodeId,isExpanded:Y(s)&&_t(t,n.terminalNodeId,s),isFlattened:f,isLoading:a==="loading",kind:Y(s)?"directory":"file",loadState:a==null||a==="loaded"?void 0:a,name:d,path:l}}function np(t,n){if(n.headNodeId===n.terminalNodeId)return Un(t,n.terminalNodeId);let s=Nr(t,n.headNodeId),a=!1,l=!1;for(let d of s){let h=Un(t,d);if(h==="loading")return"loading";if(h==="error"){l=!0;continue}if(h==="unloaded")a=!0}if(l)return"error";if(a)return"unloaded";return"loaded"}var vc=8;function yc(t){let{nodes:n,directories:s,rootId:a,options:l}=t,d=n.length,h=new Int32Array(d),f=new Int32Array(d),g=new Int32Array(d),b=new Int32Array(d),w=new Int32Array(d),I=new Int32Array(d),v=new Int32Array(d);for(let R=0;R<d;R+=1){let B=n[R];if(B==null)continue;h[R]=B.parentId,f[R]=B.nameId,g[R]=B.depthAndFlags,b[R]=B.subtreeNodeCount,w[R]=B.visibleSubtreeCount}let _=0;for(let R of s.values())_+=R.childIds.length;let k=new Int32Array(_),T=0;for(let[R,B]of s){let F=B.childIds;I[R]=T,v[R]=F.length;for(let D=0;D<F.length;D+=1)k[T]=F[D],T+=1}return{nodeCount:d,rootId:a,flattenEmptyDirectories:l.flattenEmptyDirectories===!0,parentId:h,nameId:f,depthAndFlags:g,subtreeNodeCount:b,visibleSubtreeCount:w,childStart:I,childCount:v,childIdsFlat:k}}function bc(t){let{nodeCount:n,rootId:s,flattenEmptyDirectories:a,depthAndFlags:l,subtreeNodeCount:d,visibleSubtreeCount:h,childStart:f,childCount:g,childIdsFlat:b}=t;for(let k=n-1;k>=1;k-=1){if((l[k]&vc)===0)continue;let T=f[k],R=g[k],B=0,F=0;for(let N=0;N<R;N+=1){let H=b[T+N];B+=d[H],F+=h[H]}d[k]=1+B;let D;if(a&&R===1)D=(l[b[T]]&vc)!==0?F:1+F;else D=1+F;h[k]=D}let w=f[s],I=g[s],v=0,_=0;for(let k=0;k<I;k+=1){let T=b[w+k];v+=d[T],_+=h[T]}d[s]=1+v,h[s]=_}function rp(t){let{directories:n,nodes:s,options:a,rootId:l,presortedDirectoryNodeIds:d}=t.snapshot,h=a.flattenEmptyDirectories===!0,f=(_)=>{let k=s[_];if(k==null||!Y(k))return;let T=n.get(_);if(T==null)throw Error(`Unknown directory child index for node ${String(_)}`);let R=T.childIds,B=R.length,F=0,D=0;for(let H=0;H<B;H++){let X=R[H];if(X==null)continue;let fe=s[X];F+=fe.subtreeNodeCount,D+=fe.visibleSubtreeCount}if(T.totalChildSubtreeNodeCount=F,T.totalChildVisibleSubtreeCount=D,B>=128)jn(s,T);k.subtreeNodeCount=1+F;let N;if(h&&B===1){let H=s[R[0]];N=H!=null&&Y(H)?D:1+D}else N=1+D;k.visibleSubtreeCount=N};if(d!=null)for(let _=d.length-1;_>=0;_--)f(d[_]);else for(let _=s.length-1;_>=1;_--)f(_);let g=s[l],b=n.get(l);if(g==null||b==null)return;let w=b.childIds,I=0,v=0;for(let _=0;_<w.length;_++){let k=w[_];if(k==null)continue;let T=s[k];I+=T.subtreeNodeCount,v+=T.visibleSubtreeCount}b.totalChildSubtreeNodeCount=I,b.totalChildVisibleSubtreeCount=v,jn(s,b),g.subtreeNodeCount=1+I,g.visibleSubtreeCount=v}function ip(t){let{directories:n,nodes:s,rootId:a}=t.snapshot,l=yc(t.snapshot);bc(l);let{subtreeNodeCount:d,visibleSubtreeCount:h}=l;for(let f=0;f<s.length;f+=1){let g=s[f];if(g==null)continue;g.subtreeNodeCount=d[f],g.visibleSubtreeCount=h[f]}for(let[f,g]of n){let b=g.childIds,w=b.length,I=0,v=0;for(let _=0;_<w;_++){let k=b[_];if(k==null)continue;let T=s[k];I+=T.subtreeNodeCount,v+=T.visibleSubtreeCount}if(g.totalChildSubtreeNodeCount=I,g.totalChildVisibleSubtreeCount=v,f===a||w>=128)jn(s,g)}}function op(t){return t.initialExpansion==="open"&&(t.initialExpandedPaths==null||t.initialExpandedPaths.length===0)}var Lr=class t{#e;constructor(n={}){let s=yi(n),a=z(s,"store.builder.create",()=>new uo(n));if(n.preparedInput!=null){let f=fl(n.preparedInput);if(f!=null)a.appendPresortedPaths(f,pl(n.preparedInput));else a.appendPreparedPaths(hl(n.preparedInput),!1)}else{let f=n.paths??[];if(n.presorted===!0)a.appendPaths(f);else a.appendPreparedPaths(z(s,"store.preparePathEntries",()=>co(f,n)))}let l=z(s,"store.builder.finish",()=>a.finish({skipSubtreeCountPass:!0})),d=z(s,"store.state.detectAllDirectoriesExpanded",()=>(n.initialExpansion??"closed")==="closed"&&a.didMatchAllInitialExpandedPaths());if(this.#e=z(s,"store.state.create",()=>ml(l,d?"open":n.initialExpansion??"closed",s)),d)this.#e.collapseNewDirectoriesByDefault=!0;let h=d?this.#e.snapshot.directories.size-1:z(s,"store.state.initializeExpandedPaths",()=>this.initializeExpandedPaths(n.initialExpandedPaths));if(d||op(n)||(n.initialExpansion??"closed")==="closed"&&h===this.#e.snapshot.directories.size-1||(n.initialExpandedPaths?.length??0)>0&&z(s,"store.state.checkAllDirectoriesExpanded",()=>this.hasAllDirectoriesExpanded()))if(n.useSoaCountSweep===!0)z(s,"store.state.initializeOpenVisibleCountsViaSoa",()=>ip(this.#e));else z(s,"store.state.initializeOpenVisibleCounts",()=>rp(this.#e));else z(s,"store.state.recomputeCounts",()=>Si(this.#e,this.#e.snapshot.rootId))}static preparePaths(n,s={}){return cl(n,s)}static prepareInput(n,s={}){return dl(n,s)}static preparePresortedInput(n){return ul(n)}list(n){return z(this.#e.instrumentation,"store.list",()=>ho(this.#e,n))}add(n){z(this.#e.instrumentation,"store.add",()=>{let s=Et(this.#e);on(this.#e,Wt(this.#e,s,ys(this.#e,n)))})}remove(n,s={}){z(this.#e.instrumentation,"store.remove",()=>{let a=Et(this.#e);on(this.#e,Wt(this.#e,a,bs(this.#e,n,s)))})}move(n,s,a={}){z(this.#e.instrumentation,"store.move",()=>{let l=Et(this.#e),d=ws(this.#e,n,s,a);if(d!=null)on(this.#e,Wt(this.#e,l,d))})}batch(n){ql(this.#e,()=>{if(typeof n==="function"){n(this);return}for(let s of n)switch(s.type){case"add":this.add(s.path);break;case"remove":this.remove(s.path,{recursive:s.recursive});break;case"move":this.move(s.from,s.to,{collision:s.collision});break}})}getVisibleCount(){return z(this.#e.instrumentation,"store.getVisibleCount",()=>Et(this.#e))}getVisibleSlice(n,s){return z(this.#e.instrumentation,"store.getVisibleSlice",()=>dc(this.#e,n,s))}getVisibleRowContext(n){return z(this.#e.instrumentation,"store.getVisibleRowContext",()=>cc(this.#e,n))}getVisibleTreeProjection(){return uc(this.#e)}getVisibleTreeProjectionData(n){return xs(this.#e,n)}getVisibleIndex(n){return z(this.#e.instrumentation,"store.getVisibleIndex",()=>hc(this.#e,n))}getPathInfo(n){return z(this.#e.instrumentation,"store.getPathInfo",()=>{let s=$t(this.#e,n);if(s==null)return null;let a=Q(this.#e,s);return{depth:Gt(a),kind:Y(a)?"directory":"file",path:Pe(this.#e,s)}})}isExpanded(n){return z(this.#e.instrumentation,"store.isExpanded",()=>{let s=this.requireDirectoryNodeId(n),a=Q(this.#e,s);return _t(this.#e,s,a)})}expand(n){z(this.#e.instrumentation,"store.expand",()=>{let s=Et(this.#e),a=fc(this.#e,n);if(a!=null)on(this.#e,Wt(this.#e,s,a))})}collapse(n){z(this.#e.instrumentation,"store.collapse",()=>{let s=Et(this.#e),a=pc(this.#e,n);if(a!=null)on(this.#e,Wt(this.#e,s,a))})}on(n,s){return Pl(this.#e,n,s)}getDirectoryLoadState(n){let s=this.requireDirectoryNodeId(n);return Un(this.#e,s)}markDirectoryUnloaded(n){z(this.#e.instrumentation,"store.markDirectoryUnloaded",()=>{let s=this.requireDirectoryNodeId(n);if(Fe(this.#e,s).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${n}"`);let a=Et(this.#e);wl(this.#e,s),on(this.#e,Wt(this.#e,a,Fl({affectedAncestorIds:Jt(this.#e,s),affectedNodeIds:[s],path:n,projectionChanged:this.isDirectoryProjectionVisible(s)})))})}beginChildLoad(n){return z(this.#e.instrumentation,"store.beginChildLoad",()=>{let s=this.requireDirectoryNodeId(n),a=Et(this.#e),l=bl(this.#e,s);return on(this.#e,Wt(this.#e,a,Ll({affectedAncestorIds:Jt(this.#e,s),affectedNodeIds:[s],attemptId:l.attemptId,path:n,projectionChanged:this.isDirectoryProjectionVisible(s),reused:l.reused}))),l})}applyChildPatch(n,s){return z(this.#e.instrumentation,"store.applyChildPatch",()=>{let a=this.resolveActiveDirectoryNodeId(n.nodeId);if(a==null||Un(this.#e,a)!=="loading"||!Il(this.#e,a,n.attemptId))return!1;let l=Pe(this.#e,a);this.validateChildPatch(l,s);let d=Et(this.#e),h=[];for(let g of s.operations){sp(l,g);let b=Et(this.#e);switch(g.type){case"add":h.push(Wt(this.#e,b,ys(this.#e,g.path)));break;case"remove":h.push(Wt(this.#e,b,bs(this.#e,g.path,{recursive:g.recursive})));break;case"move":{let w=ws(this.#e,g.from,g.to,{collision:g.collision});if(w!=null)h.push(Wt(this.#e,b,w));break}}}let f=h.some((g)=>g.projectionChanged)||this.isDirectoryProjectionVisible(a);return on(this.#e,Wt(this.#e,d,Bl({affectedAncestorIds:Jt(this.#e,a),affectedNodeIds:[a],attemptId:n.attemptId,childEvents:h,path:Pe(this.#e,a),projectionChanged:f}))),!0})}completeChildLoad(n){return z(this.#e.instrumentation,"store.completeChildLoad",()=>{let s=this.resolveActiveDirectoryNodeId(n.nodeId);if(s==null)return!1;let a=Et(this.#e),l=Sl(this.#e,s,n.attemptId);return on(this.#e,Wt(this.#e,a,Hl({affectedAncestorIds:Jt(this.#e,s),affectedNodeIds:[s],attemptId:n.attemptId,path:Pe(this.#e,s),projectionChanged:this.isDirectoryProjectionVisible(s),stale:!l}))),l})}failChildLoad(n,s){return z(this.#e.instrumentation,"store.failChildLoad",()=>{let a=this.resolveActiveDirectoryNodeId(n.nodeId);if(a==null)return!1;let l=Et(this.#e),d=kl(this.#e,a,n.attemptId,s);return on(this.#e,Wt(this.#e,l,Vl({affectedAncestorIds:Jt(this.#e,a),affectedNodeIds:[a],attemptId:n.attemptId,errorMessage:s,path:Pe(this.#e,a),projectionChanged:this.isDirectoryProjectionVisible(a),stale:!d}))),d})}cleanup(n={}){return z(this.#e.instrumentation,"store.cleanup",()=>{if(this.#e.transactionStack.length>0)throw Error("Cleanup cannot run during an open batch or transaction.");if(nc(this.#e))throw Error("Cleanup cannot run while directory loads are active.");let s=Et(this.#e),a=rc(this.#e,n.mode??"stable");return on(this.#e,Wt(this.#e,s,Ol({...a,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:a.idsPreserved===!1}))),a})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(n){if(n==null||n.length===0)return 0;let s=0,a=[],l=[],d=0,h=null,f=this.#e.snapshot.segmentTable,g=f.valueById,b=this.#e.snapshot.nodes,w=new Map;for(let I of n){if(h!=null&&I<h)h=null,d=0,a.length=0,l.length=0;let v=I.length>0&&I.charCodeAt(I.length-1)===47?I.length-1:I.length;if(v===0){h=I,d=v,a.length=0,l.length=0;continue}let _=0,k=0;if(h!=null){let D=Math.min(v,d),N=!0;for(let H=0;H<D;H+=1){let X=I.charCodeAt(H);if(X!==h.charCodeAt(H)){N=!1;break}if(X===47)_+=1,k=H+1}if(N){if(D===d&&v>D&&I.charCodeAt(D)===47)_+=1,k=D+1;else if(D===v&&d>D&&h.charCodeAt(D)===47)_+=1,k=v+1}_=Math.min(_,l.length)}let T=_===0?this.#e.snapshot.rootId:l[_-1]??this.#e.snapshot.rootId,R=_,B=!0,F=k;while(F<=v){let D=I.indexOf("/",F),N=D===-1||D>v?v:D,H=I.slice(F,N),X=Fe(this.#e,T).childIds,fe=R===_?a[R]??0:0,yt=fe,Le,bt=w.get(H)??hr(H);w.set(H,bt);let Ie=(Be,Qe)=>{for(yt=Be;yt<Qe;yt+=1){let qe=X[yt],Tt=b[qe],Ce=g[Tt.nameId];if(Ce===H)return Le=qe,!0;let we=bi(wi(f,Tt.nameId),bt);if(we>0||we===0&&Ce>H)return!1}return!1};if(!Ie(fe,X.length)&&fe>0)Ie(0,fe);if(Le===void 0){B=!1;break}if(!Y(Q(this.#e,Le))){B=!1;break}if(a[R]=yt,l[R]=Le,T=Le,R+=1,N===v)break;F=N+1}if(h=I,d=v,a.length=R,l.length=R,!B){h=null,d=0,a.length=0,l.length=0;continue}for(let D=_;D<R;D+=1){let N=l[D];if(N==null)continue;let H=Q(this.#e,N);if(_t(this.#e,N,H))continue;Kn(this.#e,N,!0,H),s+=1}}return s}hasAllDirectoriesExpanded(){for(let n of this.#e.snapshot.directories.keys()){if(n===this.#e.snapshot.rootId)continue;let s=Q(this.#e,n);if(!_t(this.#e,n,s))return!1}return!0}requireDirectoryNodeId(n){let s=$t(this.#e,n);if(s==null)throw Error(`Path does not exist: "${n}"`);if(!Y(Q(this.#e,s)))throw Error(`Path is not a directory: "${n}"`);return s}resolveActiveDirectoryNodeId(n){try{if(!Y(Q(this.#e,n)))throw Error(`Node is not a directory: ${String(n)}`);return n}catch{return null}}isDirectoryProjectionVisible(n){let s=n;while(s!==this.#e.snapshot.rootId){let a=Q(this.#e,s).parentId;if(a!==this.#e.snapshot.rootId){let l=Q(this.#e,a),d=Rn(this.#e,a);if(!_t(this.#e,a,l)&&d!==s)return!1}s=a}return!0}validateChildPatch(n,s){new t({paths:this.list(n),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(s.operations)}};function sp(t,n){switch(n.type){case"add":case"remove":if(!n.path.startsWith(t)||n.path===t)throw Error(`Child patch operation must stay within ${t}: "${n.path}"`);break;case"move":if(!n.from.startsWith(t)||!n.to.startsWith(t)||n.from===t||n.to===t)throw Error(`Child patch move must stay within ${t}: "${n.from}" -> "${n.to}"`);break}}var ki={compact:{itemHeight:24,factor:0.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function wc(t,n){if(typeof t==="number")return{itemHeight:n??ki.default.itemHeight,factor:t};let s=ki[t??"default"];return{itemHeight:n??s.itemHeight,factor:s.factor}}var Ci=ki.default.itemHeight;var po=`@layer base {
|
|
188
188
|
:host {
|
|
189
189
|
--trees-accent: var(--trees-accent-override, #009fff);
|
|
190
190
|
--trees-fg: var(--trees-fg-override, var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1)));
|
|
@@ -1276,16 +1276,16 @@ import{u,U,C,Ne,j,ae,E,ze,L,p,Je,et,He,V,Ue,m,be,Gt,A,Ze,Z,Ht,tt,nt,at,rt,it,x,U
|
|
|
1276
1276
|
}
|
|
1277
1277
|
|
|
1278
1278
|
@layer theme, unsafe;
|
|
1279
|
-
`;function
|
|
1279
|
+
`;function mo(t){return`@layer base, unsafe;
|
|
1280
1280
|
@layer base {
|
|
1281
1281
|
${t}
|
|
1282
|
-
}`}function
|
|
1282
|
+
}`}function Sc(t){return`@layer base, unsafe;
|
|
1283
1283
|
@layer unsafe {
|
|
1284
1284
|
${t}
|
|
1285
|
-
}`}var wc=new WeakMap;function sp(t){let n=wc.get(t);if(n!=null)return n;let s=document.createElement("div");s.setAttribute(as,"true");let a=document.createElement("div");a.style.position="relative",a.style.height="200%",s.appendChild(a),t.appendChild(s);let l=Math.max(s.offsetWidth-s.clientWidth,0);return s.remove(),wc.set(t,l),l}function Sc(t,n){if(!t.isConnected)return;let s=sp(n);if(s==null)return;let a=n.querySelector(`style[${io}]`),l=a instanceof HTMLStyleElement?a:document.createElement("style");if(!(a instanceof HTMLStyleElement))l.setAttribute(io,""),n.appendChild(l);l.textContent=`:host { ${ls}: ${s}px; }`}var vo;function ap(t){if(typeof CSSStyleSheet<"u"&&typeof CSSStyleSheet.prototype.replaceSync==="function"&&"adoptedStyleSheets"in t){if(vo==null)vo=new CSSStyleSheet,vo.replaceSync(go(mo));let n=!1;try{t.adoptedStyleSheets=[vo],n=!0}catch{}if(n){t.querySelector(`style[${gi}]`)?.remove();return}}if(t.querySelector("style[data-file-tree-style]")==null){let n=document.createElement("style");n.setAttribute(gi,""),n.textContent=go(mo),t.prepend(n)}}function yo(t,n){lp(t,n),ap(n),Sc(t,n)}function lp(t,n){let s=t.querySelector('template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]');if(!(s instanceof HTMLTemplateElement))return;if(n.childNodes.length>0)return;if(n.appendChild(s.content.cloneNode(!0)),s.hasAttribute("shadowrootmode"))s.remove()}if(typeof HTMLElement<"u"&&customElements.get("file-tree-container")==null){class t extends HTMLElement{constructor(){super()}connectedCallback(){let n=this.shadowRoot??this.attachShadow({mode:"open"});yo(this,n)}}if(customElements.define(no,t),typeof document<"u")for(let n of Array.from(document.querySelectorAll(no))){if(!(n instanceof HTMLElement))continue;yo(n,n.shadowRoot??n.attachShadow({mode:"open"}))}}var Ic=(t)=>t.startsWith("f::")?t.slice(3):t;function cp(t){let n=t.lastIndexOf("/");if(n<0)return{parentPath:"",baseName:t};return{parentPath:t.slice(0,n),baseName:t.slice(n+1)}}function dp(t,n){return t===""?n:`${t}/${n}`}function kc({files:t,path:n,isFolder:s,nextBasename:a}){let l=Ic(n),d=a.trim();if(d.length===0)return{error:"Name cannot be empty."};if(d.includes("/"))return{error:'Name cannot include "/".'};let{parentPath:h,baseName:f}=cp(l);if(d===f)return{nextFiles:t,sourcePath:l,destinationPath:l,isFolder:s};let g=dp(h,d),b=Array(t.length),w=new Set;if(!s){let k=`${g}/`,T=!1;for(let R=0;R<t.length;R++){let B=t[R];if(B!==l&&B.startsWith(k))return{error:`"${g}" already exists.`};let F=B===l?g:B;if(w.has(F))return{error:`"${g}" already exists.`};if(w.add(F),b[R]=F,B===l)T=!0}if(!T)return{error:"Could not find the selected file to rename."};return{nextFiles:b,sourcePath:l,destinationPath:g,isFolder:s}}let I=`${l}/`,v=`${g}/`,_=0;for(let k=0;k<t.length;k++){let T=t[k],R=T===l||T.startsWith(I);if(!R&&(T===g||T.startsWith(v)))return{error:`"${g}" already exists.`};let B=R?`${g}${T.slice(l.length)}`:T;if(w.has(B))return{error:`"${g}" already exists.`};if(w.add(B),b[k]=B,R)_++}if(_===0)return{error:"Could not find the selected folder to rename."};return{nextFiles:b,sourcePath:l,destinationPath:g,isFolder:s}}function up(t){return t.endsWith("/")}function hp(t){let n=t.endsWith("/")?t.slice(0,-1):t,s=n.lastIndexOf("/"),a=s<0?n:n.slice(s+1);return t.endsWith("/")?`${a}/`:a}function fp(t){let n=[],s=new Set;for(let l of t){if(s.has(l))continue;s.add(l),n.push(l)}let a=new Set;for(let l of n.toSorted((d,h)=>{if(d.length!==h.length)return d.length-h.length;return d.localeCompare(h)})){let d=(l.endsWith("/")?l.slice(0,-1):l).split("/"),h=!1;for(let f=0;f<d.length-1;f+=1){let g=`${d.slice(0,f+1).join("/")}/`;if(!a.has(g))continue;h=!0;break}if(h)continue;a.add(l)}return n.filter((l)=>a.has(l))}function Cc(t,n){return n.includes(t)?fp(n):[t]}function xc(t,n){if(t===n)return!0;if(t==null||n==null)return!1;return t.kind===n.kind&&t.directoryPath===n.directoryPath&&t.flattenedSegmentPath===n.flattenedSegmentPath&&t.hoveredPath===n.hoveredPath}function _s(t,n){return{draggedPaths:t,target:n}}function Es(t,n){if(n.kind!=="directory"||n.directoryPath==null)return!1;for(let s of t){if(!up(s))continue;if(n.directoryPath===s||n.directoryPath.startsWith(s))return!0}return!1}function pp(t,n){if(n.kind==="root"||n.directoryPath==null)return hp(t);return n.directoryPath}function _c(t,n){let s=t.map((a)=>{let l=pp(a,n);if(l===a)return null;return{from:a,to:l,type:"move"}}).filter((a)=>a!=null);if(s.length===0)return null;return{operations:s,result:{draggedPaths:t,operation:s.length===1?"move":"batch",target:n}}}function mp(t,n){if(t===n)return!0;if(t.length!==n.length)return!1;for(let s=0;s<t.length;s+=1)if(t[s]!==n[s])return!1;return!0}function Ts(t,n,s){let{paths:a,preparedInput:l}=t;if(l==null){if(a==null)throw Error("FileTree requires paths or preparedInput");return{paths:a,preparedInput:void 0}}let d=l.paths;if(a==null)return{paths:d,preparedInput:l};if(!mp(Mr.preparePaths(a,s==null?{}:{sort:s}),d))throw Error(`FileTree ${n} received paths and preparedInput for different path lists`);return{paths:d,preparedInput:l}}function Ps(t){return t.operation==="add"||t.operation==="remove"||t.operation==="move"||t.operation==="batch"}function gp(t,n,s){if(t===n)return s;let a=n.endsWith("/")?n:`${n}/`;if(!t.startsWith(a))return t;return`${s.endsWith("/")?s:`${s}/`}${t.slice(a.length)}`}function vp(t,n){if(t===n)return!0;let s=n.endsWith("/")?n:`${n}/`;return t.startsWith(s)}function Ar(t,n,s=!1){if(t==null)return null;switch(n.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 t;case"remove":return vp(t,n.path)?s?t:null:t;case"move":return gp(t,n.from,n.to);case"batch":{let a=t;for(let l of n.events)if(a=Ar(a,l,s),a==null)return null;return a}}}function bo(t){return{canonicalChanged:t.canonicalChanged,projectionChanged:t.projectionChanged,visibleCountDelta:t.visibleCountDelta}}function Ec(t){switch(t.operation){case"add":return{...bo(t),operation:"add",path:t.path};case"remove":return{...bo(t),operation:"remove",path:t.path,recursive:t.recursive};case"move":return{...bo(t),from:t.from,operation:"move",to:t.to}}}function yp(t){return{...bo(t),events:t.events.filter((n)=>n.operation==="add"||n.operation==="remove"||n.operation==="move").map((n)=>Ec(n)),operation:"batch"}}function Tc(t){switch(t.operation){case"add":case"remove":case"move":return Ec(t);case"batch":return yp(t);default:return null}}function wo(t,n){if(t.size!==n.length)return!1;for(let s of n)if(!t.has(s))return!1;return!0}function An(t){let n=t.endsWith("/")?t.slice(0,-1):t;if(n.length===0)return[];let s=n.split("/");return s.slice(0,-1).map((a,l)=>`${s.slice(0,l+1).join("/")}/`)}function So(t){return An(t).at(-1)??null}function Rs(t,n){if(n==null)return t;return t.startsWith(n)?t.slice(n.length):t}function _i(t){return t.endsWith("/")}var Ds=(t)=>t.toLowerCase();function Pc(t){let n=t.endsWith("/")?t.slice(0,-1):t,s=n.lastIndexOf("/");return s<0?n:n.slice(s+1)}function Ms(t){return t.endsWith("/")?t.slice(0,-1):t}function As(t,n){return n&&!t.endsWith("/")?`${t}/`:t}var Rc=(t)=>{let n=t.trim();if(n.length===0)return"";return(n.includes("\\")?n.replaceAll("\\","/"):n).toLowerCase()};var Ns=Symbol("FILE_TREE_RENAME_VIEW"),bp=512,wp=512;function Sp(t){return t==="top"||t==="center"?t:"nearest"}function Ip(t,n,s){if(t===0)return-1;if(s!=null){let a=n(s);if(a!=null)return a;let l=An(s);for(let d=l.length-1;d>=0;d-=1){let h=l[d];if(h==null)continue;let f=n(h);if(f!=null)return f}}return 0}function kp(t,n,s){if(t.paths.length===0)return{focusedIndex:-1,getParentIndex:t.getParentIndex,paths:t.paths,posInSetByIndex:t.posInSetByIndex,setSizeByIndex:t.setSizeByIndex};if(n==null)return{focusedIndex:0,getParentIndex:t.getParentIndex,paths:t.paths,posInSetByIndex:t.posInSetByIndex,setSizeByIndex:t.setSizeByIndex};let a=s??((l)=>t.visibleIndexByPath.get(l)??null);return{focusedIndex:Ip(t.paths.length,a,n),getParentIndex:t.getParentIndex,paths:t.paths,posInSetByIndex:t.posInSetByIndex,setSizeByIndex:t.setSizeByIndex}}var Dc=class t{static{Object.defineProperty(t.prototype,Ns,{configurable:!0,value(){return{cancel:()=>{this.#_e()},commit:()=>{this.#Ee()},getPath:()=>this.#s,getValue:()=>this.#g,isActive:()=>this.#s!=null,setValue:(n)=>{this.#Te(n)}}},writable:!0})}#e;#t=new Set;#c=new Map;#d=null;#a=null;#V=new Map;#O=new Map;#v=-1;#r=null;#y=!1;#T=(n)=>-1;#b=new Map;#m=null;#h=null;#w=null;#S=null;#f=null;#q;#z;#N;#i=[];#W=new Int32Array(0);#$=new Int32Array(0);#Z=void 0;#P=!1;#s=null;#g="";#R=!1;#x=new Set;#j=[];#K;#U=null;#l=null;#F=null;#M=null;#C=null;#L=null;#J=null;#xe=0;#I=null;#o=new Set;#G=0;#n;#ne=0;#re=!1;#p=0;#X;constructor(n){let{dragAndDrop:s,fileTreeSearchMode:a,initialSearchQuery:l,initialSelectedPaths:d,renaming:h,onSearchChange:f,paths:g,preparedInput:b,...w}=n,I=Ts({paths:g,preparedInput:b},"constructor",w.sort);if(this.#e=w,s!=null&&s!==!1)this.#d=s===!0?{}:s;if(this.#P=h!=null&&h!==!1,h!=null&&h!==!1&&h!==!0)this.#Z=h.canRename,this.#z=h.onError,this.#q=h.onRename;this.#N=f,this.#K=a??"hide-non-matches",this.#n=this.#oe(I.paths,I.preparedInput);let v=d?.map((k)=>this.#A(k)).filter((k)=>k!=null)??[],_=v.at(-1)??null;if(v.length>0)this.#o=new Set(v),this.#I=_,this.#G=1;if(this.#H(_,!1),l!=null)this.#Y(l,!1);this.#X=this.#ke()}destroy(){this.#X?.(),this.#X=null,this.#c.clear(),this.#t.clear(),this.#b.clear(),this.#a=null,this.#ae()}focusFirstItem(){if(this.#_().length>0)this.#E(0)}focusLastItem(){if(this.#p<=0)return;this.#D(),this.#E(this.#p-1)}focusNextItem(){this.#Ie(1)}focusParentItem(){if(this.#r==null)return;let n=So(this.#r);if(n==null)return;let s=this.#B(n);if(s>=0)this.#E(s)}focusPath(n){let s=this.#n.getPathInfo(n)?.path??null;if(s==null)return;this.#D();let a=this.#B(s);if(a>=0)this.#E(a)}scrollToPath(n,s){let a=this.#n.getPathInfo(n)?.path??null;if(a==null)return;this.#D();let l=this.#He(a);if(l<0)return;if(this.#le(l)==null)return;if(s?.focus!==!1)this.#E(l,!1);this.#J={id:this.#xe+=1,offset:Sp(s?.offset),visibleIndex:l},this.#u()}focusMountedPathFromInput(n){let s=this.#n.getPathInfo(n)?.path??null;if(s==null)return;let a=this.#B(s);if(a>=0)this.#E(a)}focusNearestPath(n){let s=this.resolveNearestVisiblePath(n);if(s==null)return null;let a=this.#B(s);if(a>=0)return this.#E(a),this.#_()[a]??s;return null}focusPreviousItem(){this.#Ie(-1)}getFocusedIndex(){return this.#v}getFocusedItem(){return this.#r==null?null:this.#ce(this.#r)}getFocusedPath(){return this.#r}getScrollRequest(){return this.#J}clearScrollRequest(n){if(this.#J?.id===n)this.#J=null}resolveNearestVisiblePath(n){let s=this.#_();if(this.#p===0)return null;if(n==null)return this.#r??s[0]??null;let a=this.#n.getPathInfo(n)?.path??n,l=this.#B(a);if(l>=0)return s[l]??a;let d=this.#Pe(a);if(d!=null)return d;return this.#r??s[0]??null}getSelectedPaths(){return[...this.#o]}getSelectionVersion(){return this.#G}getVisibleCount(){return this.#p}getVisibleRows(n,s){if(s<n||this.#p===0)return[];let a=Math.max(0,n),l=Math.min(this.#p-1,s);if(l<a)return[];let d=l-a+1;if(this.#C==null&&!this.#y&&l>=this.#i.length&&d<=wp){let h=[];for(let f=a;f<=l;f+=1){let g=this.#n.getVisibleRowContext(f);if(g==null)break;h.push(this.#de(g))}return h}if(!this.#y&&l>=this.#i.length)this.#D();if(this.#C!=null){let h=Array.from({length:l-a+1},(w,I)=>this.#ve(a+I)),f=new Map,g=h[0]??-1,b=g;for(let w=1;w<=h.length;w+=1){let I=h[w];if(I!=null&&I===b+1){b=I;continue}if(g>=0)this.#n.getVisibleSlice(g,b).forEach((v,_)=>{f.set(g+_,v)});if(I==null){g=-1,b=-1;continue}g=I,b=I}return Array.from({length:l-a+1},(w,I)=>{let v=a+I,_=this.#ve(v),k=f.get(_),T=this.#i[_];if(k==null||T==null)throw Error(`Missing projection row for filtered visible index ${String(v)}`);return this.#ie(k,v,_,{ancestorPaths:this.#fe(_),path:T})})}return this.#n.getVisibleSlice(a,l).map((h,f)=>{let g=a+f,b=this.#i[g];if(b==null)throw Error(`Missing projection path for visible index ${String(g)}`);return this.#ie(h,g,g,{ancestorPaths:this.#fe(g),path:b})})}getStickyRowCandidates(n,s){if(this.#C!=null)return null;if(this.#p===0||n<=0||s<=0)return[];let a=[];for(let l=0;l<this.#p;l+=1){let d=n+l*s,h=Math.min(this.#p-1,Math.floor(d/s)),f=this.#ue(h,l)??(h>0?this.#ue(h-1,l):void 0);if(f==null)break;a.push({row:this.#de(f),subtreeEndIndex:f.subtreeEndIndex})}return a}getItem(n){let s=this.#n.getPathInfo(n);return s==null?null:this.#ce(s.path,s)}resolveMountedDirectoryPathFromInput(n){let s=this.#n.getPathInfo(n);return s?.kind==="directory"?s.path:null}toggleMountedDirectoryFromInput(n){let s=this.resolveMountedDirectoryPathFromInput(n);if(s==null)return;this.#Ce(s)}selectAllVisiblePaths(){this.#D();let n=[...this.#_()];this.#k(n,this.#r??this.#I)}selectOnlyPath(n){let s=this.#A(n);if(s==null)return;this.#k([s],s)}selectOnlyMountedPathFromInput(n){this.#k([n],n)}selectPath(n){let s=this.#A(n);if(s==null||this.#o.has(s))return;this.#k([...this.#o,s])}deselectPath(n){let s=this.#A(n);if(s==null||!this.#o.has(s))return;this.#k([...this.#o].filter((a)=>a!==s))}toggleFocusedSelection(){if(this.#r==null)return;this.togglePathSelectionFromInput(this.#r)}togglePathSelection(n){let s=this.#A(n);if(s==null)return;if(this.#o.has(s)){this.deselectPath(s);return}this.selectPath(s)}togglePathSelectionFromInput(n){let s=this.#A(n);if(s==null)return;if(this.#o.has(s)){this.#k([...this.#o].filter((a)=>a!==s),s);return}this.#k([...this.#o,s],s)}selectPathRange(n,s){let a=this.#A(n);if(a==null)return;this.#D();let l=this.#I,d=l==null?-1:this.#te(l),h=this.#te(a);if(d===-1||h===-1){let I=s?[...this.#o,a]:[a];this.#k(I,a);return}let[f,g]=d<=h?[d,h]:[h,d],b=this.#_().slice(f,g+1),w=s?[...this.#o,...b]:b;this.#k(w,l)}extendSelectionFromFocused(n){if(this.#r==null)return;let s=this.#v;if(s===-1)return;let a=Math.min(this.#p-1,Math.max(0,s+n));if(a===s)return;if(!this.#y&&a>=this.#i.length)this.#D();let l=this.#_(),d=l[s]??null,h=l[a]??null;if(d==null||h==null)return;let f=new Set(this.#o);if(f.has(d)&&f.has(h))f.delete(d);else f.add(h);this.#k([...f],this.#I??d,!1),this.#E(a)}getDragAndDropConfig(){return this.#d}isDragAndDropEnabled(){return this.#d!=null}getDragSession(){if(this.#a==null)return null;return{draggedPaths:[...this.#a.draggedPaths],primaryPath:this.#a.primaryPath,target:this.#a.target==null?null:{...this.#a.target}}}startDrag(n){if(this.#d==null)return!1;let s=this.#A(n);if(s==null)return!1;if(this.#l!=null&&this.#l.length>0)return!1;let a=this.getSelectedPaths(),l=Cc(s,a);if(this.#d.canDrag?.(l)===!1)return!1;if(!a.includes(s))this.#k([s],s,!1);return this.#Q(s),this.#a={draggedPaths:l,primaryPath:s,target:null},this.#u(),!0}setDragTarget(n){let s=this.#a;if(s==null)return;let a=n;if(a!=null){let l=_s(s.draggedPaths,a);if(Es(s.draggedPaths,a)||this.#d?.canDrop?.(l)===!1)a=null}if(xc(s.target,a))return;this.#a={...s,target:a},this.#u()}cancelDrag(){if(this.#a==null)return;this.#a=null,this.#u()}completeDrag(){let n=this.#a;if(n==null)return!1;this.#a=null;let s=n.target==null?null:{...n.target};if(s==null)return this.#u(),!1;let a=_s(n.draggedPaths,s);if(Es(n.draggedPaths,s)||this.#d?.canDrop?.(a)===!1)return this.#u(),!1;let l=_c(n.draggedPaths,s);if(l==null)return this.#u(),!1;try{if(l.operations.length===1){let d=l.operations[0];if(d==null||d.type!=="move")throw Error("Expected a single move operation for one-item drops");this.#n.move(d.from,d.to,{collision:d.collision})}else this.#Me(l.operations),this.#n.batch(l.operations)}catch(d){return this.#u(),this.#d?.onDropError?.(d instanceof Error?d.message:String(d),a),!1}return this.#d?.onDropComplete?.(l.result),!0}subscribe(n){return this.#t.add(n),n(),()=>{this.#t.delete(n)}}add(n){this.#n.add(n)}remove(n,s={}){this.#n.remove(n,s)}move(n,s,a={}){this.#n.move(n,s,a)}batch(n){this.#n.batch(n)}onMutation(n,s){let a=n,l=s,d=this.#c.get(a);if(d==null)d=new Set,this.#c.set(a,d);return d.add(l),()=>{let h=this.#c.get(a);if(h?.delete(l),h?.size===0)this.#c.delete(a)}}setSearch(n){this.#Y(n,!0)}openSearch(n=""){this.#Y(n,!0)}closeSearch(){this.#Y(null,!0)}isSearchOpen(){return this.#l!==null}getSearchValue(){return this.#l??""}getSearchMatchingPaths(){return this.#j}focusNextSearchMatch(){this.#ye(1)}focusPreviousSearchMatch(){this.#ye(-1)}startRenaming(n=this.#r??"",s={}){if(!this.#P)return!1;let a=this.#n.getPathInfo(n);if(a==null)return!1;let l=a.path,d=_i(l),h=Ms(l);if(this.#Z?.({isFolder:d,path:h})===!1)return!1;for(let f of An(l))if(!this.#n.isExpanded(f))this.#n.expand(f);if(this.#k([l],l,!1),this.#l!=null)this.#Y(null,!1),this.#N?.(this.#l);return this.#Q(l),this.#s=l,this.#g=Pc(l),this.#R=s.removeIfCanceled??!1,this.#u(),!0}#_e(){if(this.#s==null)return;let n=this.#s,s=this.#R;if(this.#s=null,this.#g="",this.#R=!1,s){this.remove(n,_i(n)?{recursive:!0}:void 0);return}this.#Q(n),this.#u()}#Ee(){let n=this.#s;if(n==null)return;if(this.#R&&this.#g.trim().length===0){this.#s=null,this.#g="",this.#R=!1,this.remove(n,_i(n)?{recursive:!0}:void 0);return}let s=_i(n),a=kc({files:this.#n.list(),isFolder:s,nextBasename:this.#g,path:Ms(n)});if(this.#s=null,this.#g="",this.#R=!1,"error"in a){this.#Q(n),this.#z?.(a.error),this.#u();return}if(a.sourcePath===a.destinationPath){this.#Q(n),this.#u();return}this.#q?.({destinationPath:a.destinationPath,isFolder:a.isFolder,sourcePath:a.sourcePath}),this.move(As(a.sourcePath,s),As(a.destinationPath,s))}#Te(n){if(this.#s==null||this.#g===n)return;this.#g=n,this.#u()}resetPaths(n,s={}){let a=!Array.isArray(n),l=a?void 0:n,d=a?n:s,h=this.#n.list().length,f=this.#p,g=Ts({paths:l,preparedInput:d.preparedInput},"resetPaths",this.#e.sort),b=this.#oe(g.paths,g.preparedInput,d.initialExpandedPaths),w=this.#r,I=this.#s,v=this.getSelectedPaths(),_=this.#I;this.#X?.(),this.#n=b,this.#b.clear(),this.#ae();let k=v.map((R)=>b.getPathInfo(R)?.path??null).filter((R)=>R!=null),T=!wo(this.#o,k);if(this.#o=new Set(k),T)this.#G+=1;if(this.#I=_==null?null:b.getPathInfo(_)?.path??null,this.#s=I==null?null:b.getPathInfo(I)?.path??null,this.#s==null)this.#g="",this.#R=!1;this.#H(w,w!=null||k.length>0||this.#I!=null),this.#X=this.#ke(),this.#u(),this.#we({canonicalChanged:!0,operation:"reset",pathCountAfter:g.paths.length,pathCountBefore:h,projectionChanged:!0,usedPreparedInput:d.preparedInput!=null,visibleCountDelta:this.#p-f})}#Pe(n){this.#D();let s=So(n),a=Rs(n,s),l=null,d=null;for(let h of this.#_()){if(So(h)!==s)continue;let f=Rs(h,s);if(f<a){l=h;continue}if(f>a){d=h;break}}return l??d}#B(n){let s=this.#te(n);if(s!==-1)return s;let a=An(n);for(let l=a.length-1;l>=0;l-=1){let d=a[l];if(d==null)continue;let h=this.#te(d);if(h!==-1)return h}return this.#_().length>0?0:-1}#ce(n,s){let a=this.#b.get(n);if(a!=null)return a;let l=s??this.#n.getPathInfo(n);if(l==null)return null;let d=l.kind==="directory"?this.#Re(l.path):this.#De(l.path);return this.#b.set(l.path,d),d}#ie(n,s,a,l){return{ancestorPaths:l.ancestorPaths,depth:n.depth,flattenedSegments:n.flattenedSegments?.map((d)=>({isTerminal:d.isTerminal,name:d.name,path:d.path})),hasChildren:n.hasChildren,index:s,isExpanded:n.isExpanded,isFlattened:n.isFlattened,isFocused:l.path===this.#r,isSelected:this.#o.has(l.path),kind:n.kind,level:n.depth,name:n.name,path:l.path,posInSet:l.posInSet??this.#W[a]??0,setSize:l.setSize??this.#$[a]??0}}#de(n){return this.#ie(n.row,n.index,n.index,{ancestorPaths:n.ancestorPaths,path:n.row.path,posInSet:n.posInSet,setSize:n.setSize})}#ue(n,s){let a=this.#n.getVisibleRowContext(n);if(a==null)return;let l=a.ancestorRows[s];if(l!=null)return l;return s===a.ancestorRows.length&&a.row.kind==="directory"&&a.row.isExpanded?a:void 0}#he(n){let s=this.#V.get(n);if(s!=null)return s;let a=this.#T(n),l=a<0?[]:[...this.#he(a),a];return this.#V.set(n,l),l}#fe(n){let s=this.#O.get(n);if(s!=null)return s;let a=this.#he(n).map((l)=>this.#i[l]??"").filter((l)=>l!=="");return this.#O.set(n,a),a}#pe(n){this.#n.collapse(n)}#k(n,s=this.#I,a=!0){let l=[...new Set(n)],d=!wo(this.#o,l),h=this.#I!==s;if(!d&&!h)return;if(this.#o=new Set(l),this.#I=s,d)this.#G+=1;if(a)this.#u()}#Re(n){return{collapse:()=>{this.#pe(n)},deselect:()=>{this.deselectPath(n)},expand:()=>{this.#Se(n)},focus:()=>{this.focusPath(n)},getPath:()=>n,isDirectory:()=>!0,isExpanded:()=>this.#n.isExpanded(n),isFocused:()=>this.#r===n,isSelected:()=>this.#o.has(n),select:()=>{this.selectPath(n)},toggleSelect:()=>{this.togglePathSelection(n)},toggle:()=>{this.#Ce(n)}}}#De(n){return{deselect:()=>{this.deselectPath(n)},focus:()=>{this.focusPath(n)},getPath:()=>n,isDirectory:()=>!1,isFocused:()=>this.#r===n,isSelected:()=>this.#o.has(n),select:()=>{this.selectPath(n)},toggleSelect:()=>{this.togglePathSelection(n)}}}#Me(n){let s=this.#n.list();this.#oe(s).batch(n)}#oe(n,s,a){return new Mr({...this.#e,paths:n,preparedInput:s==null?void 0:s,...a!==void 0?{initialExpandedPaths:a}:{}})}#se(){if(this.#S!=null)return this.#S;return this.#S=this.#n.list(),this.#S}#Ae(){if(this.#w!=null)return this.#w;let n=new Set;for(let s of this.#se()){n.add(s);for(let a of An(s))n.add(a)}return this.#w=[...n].sort(),this.#w}#Ne(){if(this.#f!=null)return this.#f;return this.#f=this.#se().map(Ds),this.#f}#ee(){if(this.#m!=null)return this.#m;return this.#m=this.#Ae().filter((n)=>n.endsWith("/")),this.#m}#Fe(){if(this.#h!=null)return this.#h;return this.#h=this.#ee().map(Ds),this.#h}#ae(){this.#m=null,this.#h=null,this.#w=null,this.#S=null,this.#f=null}#Le(){return this.#ee().filter((n)=>this.#n.isExpanded(n))}#me(n){let s=new Set(this.#U??[]);if(n)for(let a of this.#o)for(let l of An(a))s.add(l);this.#ge(s)}#ge(n){this.#re=!0;try{for(let s of this.#ee()){let a=n.has(s),l=this.#n.isExpanded(s);if(a&&!l)this.#n.expand(s);else if(!a&&l)this.#n.collapse(s)}}finally{this.#re=!1}}#Be(){if(this.#l==null||this.#l.length===0){this.#j=[],this.#C=null,this.#L=null,this.#M=null,this.#p=this.#ne;return}let n=this.#i;if(this.#j=n.filter((d)=>this.#x.has(d)),this.#K!=="hide-non-matches"||this.#x.size===0){this.#C=null,this.#L=null,this.#M=null,this.#p=this.#ne;return}let s=[],a=[],l=new Map;for(let[d,h]of n.entries()){if(this.#F?.has(h)!==!0)continue;l.set(h,a.length),s.push(d),a.push(h)}this.#C=s,this.#L=a,this.#M=l,this.#p=a.length}#_(){return this.#L??this.#i}#He(n){if(this.#L!=null)return this.#M?.get(n)??-1;return this.#n.getVisibleIndex(n)??-1}#ve(n){return this.#C?.[n]??n}#te(n){let s=this.#M?.get(n);if(s!=null)return s;return this.#n.getVisibleIndex(n)??-1}#ye(n){let s=this.#j;if(s.length===0)return;let a=this.#r,l=a==null?-1:s.indexOf(a),d=s[l<0?n>0?0:s.length-1:Math.min(s.length-1,Math.max(0,l+n))];if(d!=null)this.focusPath(d)}#Y(n,s){let a=n==null?null:Rc(n),l=this.#l;if(l===a)return;if(l==null&&a!=null)this.#U=this.#Le();if(this.#l=a,a==null)this.#me(!0),this.#U=null,this.#x.clear(),this.#F=null,this.#H(this.#r,!0);else if(a.length===0)this.#me(!1),this.#x.clear(),this.#F=null,this.#H(this.#r,!0);else{let d=this.#be();this.#H(d,!0)}if(s)this.#N?.(this.#l),this.#u()}#be(){if(this.#l==null||this.#l.length===0)return this.#x.clear(),this.#r;let n=this.#l,s=this.#se(),a=this.#Ne(),l=[],d=new Set,h=null;for(let I=0;I<s.length;I+=1){if(!a[I].includes(n))continue;let v=s[I];l.push(v),d.add(v),h??=v}let f=this.#ee(),g=this.#Fe();for(let I=0;I<f.length;I+=1){if(!g[I].includes(n))continue;let v=f[I];if(d.has(v))continue;l.push(v),d.add(v),h??=v}this.#x=d;let b=this.#K==="hide-non-matches"&&l.length>0?new Set:null;this.#F=b;let w=this.#K==="expand-matches"?new Set(this.#U??[]):new Set;for(let I of l){if(b!=null)b.add(I);if(I.endsWith("/"))w.add(I);for(let v of An(I))if(w.add(v),b!=null)b.add(v)}return this.#ge(w),h??this.#r}#u(){for(let n of this.#t)n()}#we(n){this.#c.get(n.operation)?.forEach((s)=>{s(n)}),this.#c.get("*")?.forEach((s)=>{s(n)})}#Se(n){for(let s of An(n)){if(this.#n.isExpanded(s))continue;this.#n.expand(s)}if(!this.#n.isExpanded(n))this.#n.expand(n)}#Ie(n){let s=this.#p;if(s===0)return;let a=this.#v===-1?0:this.#v,l=Math.min(s-1,Math.max(0,a+n));if(l!==a||this.#v===-1){if(!this.#y&&this.#C==null&&l>=this.#i.length)this.#D();this.#E(l)}}#H(n,s=!0){let a=this.#n.getVisibleCount();this.#ne=a;let l=kp(this.#n.getVisibleTreeProjectionData(s?void 0:Math.min(a,bp)),n,s?(d)=>this.#n.getVisibleIndex(d):void 0);this.#V.clear(),this.#O.clear(),this.#y=l.paths.length>=a,this.#T=l.getParentIndex,this.#i=l.paths,this.#W=l.posInSetByIndex,this.#$=l.setSizeByIndex,this.#Be(),this.#v=n==null?this.#_().length>0?0:-1:this.#B(n),this.#r=this.#v<0?null:this.#le(this.#v)}#le(n){let s=this.#_()[n];if(s!=null)return s;if(this.#C!=null)return null;return this.#n.getVisibleRowContext(n)?.row.path??null}#A(n){return this.#n.getPathInfo(n)?.path??null}#Q(n){if(n==null)return;let s=this.#B(n);if(s>=0)this.#E(s,!1)}#E(n,s=!0){let a=this.#le(n);if(a==null)return;if(this.#v===n&&this.#r===a)return;if(this.#v=n,this.#r=a,s)this.#u()}#D(){if(this.#y)return;this.#H(this.#r,!0)}#Ve(n){let s=Ar(this.#s,n);if(s==null&&this.#s!=null)this.#g="";this.#s=s;let a=Ar(this.#r,n,!0),l=[...this.#o].map((g)=>Ar(g,n)).filter((g)=>g!=null).map((g)=>this.#n.getPathInfo(g)?.path??null).filter((g)=>g!=null),d=Ar(this.#I,n),h=d==null?null:this.#n.getPathInfo(d)?.path??null,f=[...new Set(l)];if(!wo(this.#o,f))this.#o=new Set(f),this.#G+=1;return this.#I=h,a}#ke(){return this.#n.on("*",(n)=>{if(this.#re)return;if(n.canonicalChanged)this.#b.clear(),this.#ae();if(this.#a!=null&&Ps(n))this.#a=null;let s=Ps(n)?this.#Ve(n):this.#r,a=this.#l!=null&&this.#l.length>0?this.#be():this.#l===""?this.#r:s,l=this.#l!=null||n.operation!=="expand"&&n.operation!=="collapse";this.#H(a,l),this.#u();let d=Tc(n);if(d!=null)this.#we(d)})}#Ce(n){if(this.#n.isExpanded(n)){this.#pe(n);return}this.#Se(n)}};var Mc=(t)=>{if(t==null||t.length===0)return"0";let n=`${t.length}`;for(let s of t)n+=`\x00${s.path}\x00${s.status}`;return n};function Ac(t){let n=t.endsWith("/"),s="",a=-1;for(let l=0;l<=t.length;l+=1){if(!(t[l]==="/"||l===t.length)){if(a===-1)a=l;continue}if(a===-1)continue;if(s!=="")s+="/";s+=t.slice(a,l),a=-1}if(s==="")return null;return{isDirectory:n,path:s}}function Nc(t){let n=t.endsWith("/")?t.slice(0,-1):t;if(n.length===0)return[];let s=[],a=0;for(;;){let l=n.indexOf("/",a);if(l===-1)break;s.push(n.slice(0,l+1)),a=l+1}return s}function Cp(t,n){return n?`${t}/`:t}function Fs(t,n=null){let s=Mc(t==null?void 0:[...t]);if(s==="0")return null;if(n?.signature===s)return n;let a=new Map,l=new Set,d=new Set,h=new Map;for(let f of t??[]){let g=Lc(f);if(g==null)continue;Hc({canonicalPath:g.canonicalPath,changeCountByDirectoryPath:h,directoriesWithChanges:l,ignoredDirectoryPaths:d,isDirectory:g.isDirectory,status:f.status,statusByPath:a})}if(a.size===0)return null;return{changeCountByDirectoryPath:h,directoriesWithChanges:l,ignoredDirectoryPaths:d,signature:s,statusByPath:a}}function Fc(t,n){let s=n?.remove??[],a=n?.set??[];if(s.length===0&&a.length===0)return t;let l=new Map(t?.statusByPath),d=new Set(t?.directoriesWithChanges),h=new Set(t?.ignoredDirectoryPaths),f=new Map(t?.changeCountByDirectoryPath),g=!1;for(let b of s){let w=Bc(b);if(w==null)continue;g=xp({canonicalPath:w.canonicalPath,changeCountByDirectoryPath:f,directoriesWithChanges:d,ignoredDirectoryPaths:h,statusByPath:l})||g}for(let b of a){let w=Lc(b);if(w==null)continue;g=Hc({canonicalPath:w.canonicalPath,changeCountByDirectoryPath:f,directoriesWithChanges:d,ignoredDirectoryPaths:h,isDirectory:w.isDirectory,status:b.status,statusByPath:l})||g}if(!g)return t;if(l.size===0)return null;return{changeCountByDirectoryPath:f,directoriesWithChanges:d,ignoredDirectoryPaths:h,signature:Tp(l),statusByPath:l}}function Lc(t){return Bc(t.path)}function Bc(t){let n=Ac(t);if(n==null)return;return{canonicalPath:Cp(n.path,n.isDirectory),isDirectory:n.isDirectory}}function xp({canonicalPath:t,changeCountByDirectoryPath:n,directoriesWithChanges:s,ignoredDirectoryPaths:a,statusByPath:l}){let d=l.get(t);if(d==null)return!1;if(l.delete(t),d==="ignored"&&t.endsWith("/"))a.delete(t);return Ep(n,s,t),!0}function Hc({canonicalPath:t,changeCountByDirectoryPath:n,directoriesWithChanges:s,ignoredDirectoryPaths:a,isDirectory:l,status:d,statusByPath:h}){let f=h.get(t);if(f===d)return!1;if(f==null)_p(n,s,t);if(h.set(t,d),d==="ignored"&&l)a.add(t);else if(l)a.delete(t);return!0}function _p(t,n,s){for(let a of Nc(s))t.set(a,(t.get(a)??0)+1),n.add(a)}function Ep(t,n,s){for(let a of Nc(s)){let l=(t.get(a)??0)-1;if(l>0)t.set(a,l);else t.delete(a),n.delete(a)}}function Tp(t){let n=`${t.size}`;for(let[s,a]of t)n+=`\x00${s}\x00${a}`;return n}var xe,Wc,Pp,dr,Vc,xo,$c,jc,Vs,Ls,Bs,Rp,Ei={},Kc=[],_o=Array.isArray,Os=Kc.slice,Xn=Object.assign;function qs(t){t&&t.parentNode&&t.remove()}function Fr(t,n,s){var a,l,d,h={};for(d in n)d=="key"?a=n[d]:d=="ref"&&typeof t!="function"?l=n[d]:h[d]=n[d];return arguments.length>2&&(h.children=arguments.length>3?Os.call(arguments,2):s),ko(t,h,a,l,null)}function ko(t,n,s,a,l){var d={type:t,props:n,key:s,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:l==null?++Wc:l,__i:-1,__u:0};return l==null&&xe.vnode!=null&&xe.vnode(d),d}function wn(t){return t.children}function Co(t,n){this.props=t,this.context=n,this.__g=0}function Nr(t,n){if(n==null)return t.__?Nr(t.__,t.__i+1):null;for(var s;n<t.__k.length;n++)if((s=t.__k[n])!=null&&s.__e!=null)return s.__e;return typeof t.type=="function"?Nr(t):null}function Uc(t){var n,s;if((t=t.__)!=null&&t.__c!=null){for(t.__e=null,n=0;n<t.__k.length;n++)if((s=t.__k[n])!=null&&s.__e!=null){t.__e=s.__e;break}return Uc(t)}}function Oc(t){(8&t.__g||!(t.__g|=8)||!dr.push(t)||xo++)&&Vc==xe.debounceRendering||((Vc=xe.debounceRendering)||queueMicrotask)(Dp)}function Dp(){for(var t,n,s,a,l,d,h,f,g=1;dr.length;)dr.length>g&&dr.sort($c),t=dr.shift(),g=dr.length,8&t.__g&&(s=void 0,l=(a=(n=t).__v).__e,d=[],h=[],(f=n.__P)&&((s=Xn({},a)).__v=a.__v+1,xe.vnode&&xe.vnode(s),zs(f,s,a,n.__n,f.namespaceURI,32&a.__u?[l]:null,d,l==null?Nr(a):l,!!(32&a.__u),h,f.ownerDocument),s.__v=a.__v,s.__.__k[s.__i]=s,Yc(d,s,h),s.__e!=l&&Uc(s)));xo=0}function Gc(t,n,s,a,l,d,h,f,g,b,w,I){var v,_,k,T,R,B,F,D=a&&a.__k||Kc,N=n.length;for(g=Mp(s,n,D,g,N),v=0;v<N;v++)(k=s.__k[v])!=null&&(_=k.__i==-1?Ei:D[k.__i]||Ei,k.__i=v,B=zs(t,k,_,l,d,h,f,g,b,w,I),T=k.__e,k.ref&&_.ref!=k.ref&&(_.ref&&Ws(_.ref,null,k),w.push(k.ref,k.__c||T,k)),R==null&&T!=null&&(R=T),(F=!!(4&k.__u))||_.__k===k.__k?g=Xc(k,g,t,F):typeof k.type=="function"&&B!==void 0?g=B:T&&(g=T.nextSibling),k.__u&=-7);return s.__e=R,g}function Mp(t,n,s,a,l){var d,h,f,g,b,w=s.length,I=w,v=0;for(t.__k=Array(l),d=0;d<l;d++)(h=n[d])!=null&&typeof h!="boolean"&&typeof h!="function"?(g=d+v,(h=t.__k[d]=typeof h=="string"||typeof h=="number"||typeof h=="bigint"||h.constructor==String?ko(null,h,null,null,null):_o(h)?ko(wn,{children:h},null,null,null):h.constructor==null&&h.__b>0?ko(h.type,h.props,h.key,h.ref?h.ref:null,h.__v):h).__=t,h.__b=t.__b+1,f=null,(b=h.__i=Ap(h,s,g,I))!=-1&&(I--,(f=s[b])&&(f.__u|=2)),f==null||f.__v==null?(b==-1&&(l>w?v--:l<w&&v++),typeof h.type!="function"&&(h.__u|=4)):b!=g&&(b==g-1?v--:b==g+1?v++:(b>g?v--:v++,h.__u|=4))):t.__k[d]=null;if(I)for(d=0;d<w;d++)(f=s[d])!=null&&(2&f.__u)==0&&(f.__e==a&&(a=Nr(f)),Zc(f,f));return a}function Xc(t,n,s,a){var l,d;if(typeof t.type=="function"){for(l=t.__k,d=0;l&&d<l.length;d++)l[d]&&(l[d].__=t,n=Xc(l[d],n,s,a));return n}t.__e!=n&&(a&&(n&&t.type&&!n.parentNode&&(n=Nr(t)),s.insertBefore(t.__e,n||null)),n=t.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function Ap(t,n,s,a){var l,d,h,{key:f,type:g}=t,b=n[s],w=b!=null&&(2&b.__u)==0;if(b===null&&t.key==null||w&&f==b.key&&g==b.type)return s;if(a>(w?1:0)){for(l=s-1,d=s+1;l>=0||d<n.length;)if((b=n[h=l>=0?l--:d++])!=null&&(2&b.__u)==0&&f==b.key&&g==b.type)return h}return-1}function qc(t,n,s){n[0]=="-"?t.setProperty(n,s==null?"":s):t[n]=s==null?"":s}function Io(t,n,s,a,l){var d;e:if(n=="style")if(typeof s=="string")t.style.cssText=s;else{if(typeof a=="string"&&(t.style.cssText=a=""),a)for(n in a)s&&n in s||qc(t.style,n,"");if(s)for(n in s)a&&s[n]==a[n]||qc(t.style,n,s[n])}else if(n[0]=="o"&&n[1]=="n")d=n!=(n=n.replace(jc,"$1")),(n=n.slice(2))[0].toLowerCase()!=n[0]&&(n=n.toLowerCase()),t.__l||(t.__l={}),t.__l[n+d]=s,s?a?s.l=a.l:(s.l=Vs,t.addEventListener(n,d?Bs:Ls,d)):t.removeEventListener(n,d?Bs:Ls,d);else{if(l=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in t)try{t[n]=s==null?"":s;break e}catch(h){}typeof s=="function"||(s==null||s===!1&&n[4]!="-"?t.removeAttribute(n):t.setAttribute(n,n=="popover"&&s==1?"":s))}}function zc(t){return function(n){if(this.__l){var s=this.__l[n.type+t];if(n.u==null)n.u=Vs++;else if(n.u<s.l)return;return s(xe.event?xe.event(n):n)}}}function zs(t,n,s,a,l,d,h,f,g,b,w){var I,v,_,k,T,R,B,F,D,N,H,X,fe,vt,Le,yt,Ie,Be,Ye,qe,_t,ke=n.type;if(n.constructor!=null)return null;128&s.__u&&(g=!!(32&s.__u),s.__c.__z&&(f=n.__e=s.__e=(d=s.__c.__z)[0],s.__c.__z=null)),(I=xe.__b)&&I(n);e:if(typeof ke=="function")try{if(F=n.props,D="prototype"in ke&&ke.prototype.render,N=(I=ke.contextType)&&a[I.__c],H=I?N?N.props.value:I.__:a,s.__c?2&(v=n.__c=s.__c).__g&&(v.__g|=1,B=!0):(D?n.__c=v=new ke(F,H):(n.__c=v=new Co(F,H),v.constructor=ke,v.render=Fp),N&&N.sub(v),v.props=F,v.state||(v.state={}),v.context=H,v.__n=a,_=!0,v.__g|=8,v.__h=[],v._sb=[]),D&&v.__s==null&&(v.__s=v.state),D&&ke.getDerivedStateFromProps!=null&&(v.__s==v.state&&(v.__s=Xn({},v.__s)),Xn(v.__s,ke.getDerivedStateFromProps(F,v.__s))),k=v.props,T=v.state,v.__v=n,_)D&&ke.getDerivedStateFromProps==null&&v.componentWillMount!=null&&v.componentWillMount(),D&&v.componentDidMount!=null&&v.__h.push(v.componentDidMount);else{if(D&&ke.getDerivedStateFromProps==null&&F!==k&&v.componentWillReceiveProps!=null&&v.componentWillReceiveProps(F,H),!(4&v.__g)&&v.shouldComponentUpdate!=null&&v.shouldComponentUpdate(F,v.__s,H)===!1||n.__v==s.__v){for(n.__v!=s.__v&&(v.props=F,v.state=v.__s,v.__g&=-9),n.__e=s.__e,n.__k=s.__k,n.__k.some(function(ve){ve&&(ve.__=n)}),X=0;X<v._sb.length;X++)v.__h.push(v._sb[X]);v._sb=[],v.__h.length&&h.push(v);break e}v.componentWillUpdate!=null&&v.componentWillUpdate(F,v.__s,H),D&&v.componentDidUpdate!=null&&v.__h.push(function(){v.componentDidUpdate(k,T,R)})}if(v.context=H,v.props=F,v.__P=t,v.__g&=-5,fe=xe.__r,vt=0,D){for(v.state=v.__s,v.__g&=-9,fe&&fe(n),I=v.render(v.props,v.state,v.context),Le=0;Le<v._sb.length;Le++)v.__h.push(v._sb[Le]);v._sb=[]}else do v.__g&=-9,fe&&fe(n),I=v.render(v.props,v.state,v.context),v.state=v.__s;while(8&v.__g&&++vt<25);v.state=v.__s,v.getChildContext!=null&&(a=Xn({},a,v.getChildContext())),D&&!_&&v.getSnapshotBeforeUpdate!=null&&(R=v.getSnapshotBeforeUpdate(k,T)),yt=I,I!=null&&I.type===wn&&I.key==null&&(yt=Qc(I.props.children)),f=Gc(t,_o(yt)?yt:[yt],n,s,a,l,d,h,f,g,b,w),n.__u&=-161,v.__h.length&&h.push(v),B&&(v.__g&=-4)}catch(ve){if(n.__v=null,g||d!=null)if(ve.then){for(Ie=0,Be=!1,n.__u|=g?160:128,n.__c.__z=[],Ye=0;Ye<d.length;Ye++)(qe=d[Ye])==null||Be||(qe.nodeType==8&&qe.data=="$s"?(Ie>0&&n.__c.__z.push(qe),Ie++,d[Ye]=null):qe.nodeType==8&&qe.data=="/$s"?(--Ie>0&&n.__c.__z.push(qe),Be=Ie===0,f=d[Ye],d[Ye]=null):Ie>0&&(n.__c.__z.push(qe),d[Ye]=null));if(!Be){for(;f&&f.nodeType==8&&f.nextSibling;)f=f.nextSibling;d[d.indexOf(f)]=null,n.__c.__z=[f]}n.__e=f}else{for(_t=d.length;_t--;)qs(d[_t]);Hs(n)}else n.__e=s.__e,n.__k=s.__k,ve.then||Hs(n);xe.__e(ve,n,s)}else f=n.__e=Np(s.__e,n,s,a,l,d,h,g,b,w);return(I=xe.diffed)&&I(n),128&n.__u?void 0:f}function Hs(t){t&&t.__c&&(t.__c.__g|=4),t&&t.__k&&t.__k.forEach(Hs)}function Yc(t,n,s){for(var a=0;a<s.length;a++)Ws(s[a],s[++a],s[++a]);xe.__c&&xe.__c(n,t),t.some(function(l){try{t=l.__h,l.__h=[],t.some(function(d){d.call(l)})}catch(d){xe.__e(d,l.__v)}})}function Qc(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:_o(t)?t.map(Qc):Xn({},t)}function Np(t,n,s,a,l,d,h,f,g,b){var w,I,v,_,k,T,R,B,F=s.props,{props:D,type:N}=n;if(N=="svg"?l="http://www.w3.org/2000/svg":N=="math"?l="http://www.w3.org/1998/Math/MathML":l||(l="http://www.w3.org/1999/xhtml"),d!=null){for(w=0;w<d.length;w++)if((k=d[w])&&"setAttribute"in k==!!N&&(N?k.localName==N:k.nodeType==3)){t=k,d[w]=null;break}}if(t==null){if(N==null)return b.createTextNode(D);t=b.createElementNS(l,N,D.is&&D),f&&(xe.__m&&xe.__m(n,d),f=!1),d=null}if(N==null)F===D||f&&t.data==D||(t.data=D);else{if(d=d&&Os.call(t.childNodes),F=s.props||Ei,!f&&d!=null)for(F={},w=0;w<t.attributes.length;w++)F[(k=t.attributes[w]).name]=k.value;for(w in F)if(k=F[w],w=="children");else if(w=="dangerouslySetInnerHTML")v=k;else if(!(w in D)){if(w=="value"&&"defaultValue"in D||w=="checked"&&"defaultChecked"in D)continue;Io(t,w,null,k,l)}for(w in B=1&s.__u,D)k=D[w],w=="children"?_=k:w=="dangerouslySetInnerHTML"?I=k:w=="value"?T=k:w=="checked"?R=k:f&&typeof k!="function"||F[w]===k&&!B||Io(t,w,k,F[w],l);if(I)f||v&&(I.__html==v.__html||I.__html==t.innerHTML)||(t.innerHTML=I.__html),n.__k=[];else if(v&&(t.innerHTML=""),Gc(N=="template"?t.content:t,_o(_)?_:[_],n,s,a,N=="foreignObject"?"http://www.w3.org/1999/xhtml":l,d,h,d?d[0]:s.__k&&Nr(s,0),f,g,b),d!=null)for(w=d.length;w--;)qs(d[w]);f||(w="value",N=="progress"&&T==null?t.removeAttribute("value"):T==null||T===t[w]&&(N!=="progress"||T)||Io(t,w,T,F[w],l),w="checked",R!=null&&R!=t[w]&&Io(t,w,R,F[w],l))}return t}function Ws(t,n,s){try{if(typeof t=="function"){var a=typeof t.__u=="function";a&&t.__u(),a&&n==null||(t.__u=t(n))}else t.current=n}catch(l){xe.__e(l,s)}}function Zc(t,n,s){var a,l;if(xe.unmount&&xe.unmount(t),(a=t.ref)&&(a.current&&a.current!=t.__e||Ws(a,null,n)),(a=t.__c)!=null){if(a.componentWillUnmount)try{a.componentWillUnmount()}catch(d){xe.__e(d,n)}a.__P=null}if(a=t.__k)for(l=0;l<a.length;l++)a[l]&&Zc(a[l],n,s||typeof t.type!="function");s||qs(t.__e),t.__e&&t.__e.__l&&(t.__e.__l=null),t.__e=t.__c=t.__=null}function Fp(t,n,s){return this.constructor(t,s)}function Eo(t,n){var s,a,l,d;n==document&&(n=document.documentElement),xe.__&&xe.__(t,n),a=(s=!!(t&&32&t.__u))?null:n.__k,t=n.__k=Fr(wn,null,[t]),l=[],d=[],zs(n,t,a||Ei,Ei,n.namespaceURI,a?null:n.firstChild?Os.call(n.childNodes):null,l,a?a.__e:n.firstChild,s,d,n.ownerDocument),Yc(l,t,d)}function Jc(t,n){t.__u|=32,Eo(t,n)}xe={__e:function(t,n,s,a){for(var l,d,h;n=n.__;)if((l=n.__c)&&!(1&l.__g)){l.__g|=4;try{if((d=l.constructor)&&d.getDerivedStateFromError!=null&&(l.setState(d.getDerivedStateFromError(t)),h=8&l.__g),l.componentDidCatch!=null&&(l.componentDidCatch(t,a||{}),h=8&l.__g),h)return void(l.__g|=2)}catch(f){t=f}}throw xo=0,t}},Wc=0,Pp=function(t){return t!=null&&t.constructor==null},Co.prototype.setState=function(t,n){var s;s=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Xn({},this.state),typeof t=="function"&&(t=t(Xn({},s),this.props)),t&&Xn(s,t),t!=null&&this.__v&&(n&&this._sb.push(n),Oc(this))},Co.prototype.forceUpdate=function(t){this.__v&&(this.__g|=4,t&&this.__h.push(t),Oc(this))},Co.prototype.render=wn,dr=[],xo=0,$c=function(t,n){return t.__v.__b-n.__v.__b},jc=/(PointerCapture)$|Capture$/i,Vs=0,Ls=zc(!1),Bs=zc(!0),Rp=0;var Lp=0;function O(t,n,s,a,l,d){n||(n={});var h,f,g=n;if("ref"in g&&typeof t!="function")for(f in g={},n)f=="ref"?h=n[f]:g[f]=n[f];var b={type:t,props:g,key:s,ref:h,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Lp,__i:-1,__u:0,__source:l,__self:d};return xe.vnode&&xe.vnode(b),b}var Bp=16,Hp=16,Vp={};function Lr({name:t,remappedFrom:n,token:s,width:a,height:l,viewBox:d,label:h,alignCapitals:f=!1}){let g=`#${t.replace(/^#/,"")}`,{width:b,height:w,viewBox:I}=Vp[t]??{width:Bp,height:Hp},v=a??b,_=l??w,k=d??I??`0 0 ${b} ${w}`;return O("svg",{"data-icon-name":n??t,"data-icon-token":s,"data-align-capitals":f,...h!=null?{"aria-label":h,role:"img"}:{"aria-hidden":!0},viewBox:k,width:v,height:_,children:O("use",{href:g})})}var ed=(t)=>t!==void 0&&/\s/.test(t),Op=(t,n)=>{let s=(a)=>ed(t[a-1])||ed(t[a]);if(!s(n))return n;for(let a=1;a<t.length;a++){let l=n-a;if(l>0&&!s(l))return l;let d=n+a;if(d<t.length&&!s(d))return d}return n},nd=(t)=>Op(t,Math.ceil(t.length/2)),td=(t)=>{if(t.length<2)return[t,""];let n=nd(t);return[t.slice(0,n),t.slice(n)]},qp=(t)=>{if(t.length<4)return[t,""];let n=t.lastIndexOf(".")+1,s=t.length-n>10,a=n>=1&&!s?n:nd(t);return[t.slice(0,a),t.slice(a)]},zp=(t)=>{if(t.length<4)return[t,""];let n=t.lastIndexOf("/")+1,s=t.length-n>25,a=n>=1&&!s?n:Math.ceil(t.length/2);return[t.slice(0,a),t.slice(a)]},Wp=(t,{splitIndex:n}={})=>{if(typeof n!=="number"){let s=Math.ceil(t.length/2);return[t.slice(0,s),t.slice(s)]}return[t.slice(0,n),t.slice(n)]},$p=(t,{splitOffset:n}={})=>{if(typeof n!=="number"||n<=0||n>=t.length){let a=Math.ceil(t.length/2);return[t.slice(0,a),t.slice(a)]}let s=t.length-n;return[t.slice(0,s),t.slice(s)]},jp=(t,{splitOffset:n}={})=>{if(typeof n!=="number"||n<=0||n>=t.length){let a=Math.ceil(t.length/2);return[t.slice(0,a),t.slice(a)]}let s=n;return[t.slice(0,s),t.slice(s)]};function Kp({children:t,marker:n,variant:s="default"}){return O("div",{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:O("div",{"data-truncate-marker":!0,children:typeof n==="function"?n({children:t}):s==="fade"?O("span",{"data-truncate-fade":!0}):n})})}function Up(t){let{mode:n,children:s}=t;return O("div",{children:[O("div",{"data-truncate-content":"visible",children:n==="fruncate"?O("span",{children:s}):s}),O("div",{"data-truncate-content":"overflow","aria-hidden":!0,children:n==="fruncate"?O("span",{children:s}):s})]})}function rd({children:t,mode:n="truncate",marker:s="…",variant:a="default",...l}){let d=O(Up,{mode:n,children:t},"content"),h=O(Kp,{marker:s,mode:n,variant:a},"marker"),f=O("div",{"data-truncate-fill":!0},"fill");return O("div",{"data-truncate-container":n,"data-truncate-variant":a,...l,children:O("div",{"data-truncate-grid":!0,children:n==="truncate"?[d,h]:[h,d,f]})})}function Ti({children:t,...n}){return O(rd,{mode:"truncate",...n,children:t})}function $s({children:t,...n}){return O(rd,{mode:"fruncate",...n,children:t})}function id({children:t,contents:n,priority:s="end",split:a="center",minimumLength:l=12,className:d,style:h,...f}){let g=null,b=null;if(Array.isArray(n)){if(n.length!==2)return console.error("MiddleTruncate: contents must be an array of two items"),null;g=O(Ti,{...f,children:n[0]}),b=O($s,{...f,children:n[1]})}else{if(typeof t!=="string")return console.error("MiddleTruncate: children must be a string"),null;if(t.length===0)return O("div",{className:d,style:h});if(t.length<l)if(s==="end")return O($s,{...f,className:d,style:h,children:t});else return O(Ti,{...f,className:d,style:h,children:t});let w=null,I=null,v=null;if(typeof a==="string"){if(a==="center")w=td;else if(a==="extension")w=qp;else if(a==="leaf-path")w=zp}else if(typeof a==="number")w=Wp,I=a;else if(Array.isArray(a)){let[N,H]=a;if(v=H,N==="last")w=$p;else if(N==="first")w=jp}else if(typeof a==="function")w=a;w??=td;let[_,k]=w(t,{priority:s,variant:f.variant,splitIndex:typeof I==="number"?I:void 0,splitOffset:typeof v==="number"?v:void 0}),T=_.length>=k.length,R=s==="equal"&&!T,B=s==="equal"&&T,F={},D={};if(R)F.marker="";if(B)D.marker="";g=O(Ti,{...f,...F,children:_}),b=O($s,{...f,...D,children:k})}return O("div",{"data-truncate-group-container":"middle",className:d,style:h,children:[O("div",{"data-truncate-segment-priority":s==="start"||s==="equal"?"1":"2",children:g}),O("div",{"data-truncate-segment-priority":s==="end"||s==="equal"?"1":"2",children:b})]})}var js={endIndex:-1,startIndex:-1};function Gp(t,n,s){return Math.min(Math.max(t,n),s)}function od(t,n){return t<0||n<t?js:{endIndex:n,startIndex:t}}function Ks(t){return t.startIndex<0||t.endIndex<t.startIndex}function Xp(t,n){return Ks(t)?0:(t.endIndex-t.startIndex+1)*n}function sd(t,n,s){if(n<=0)return-1;let a=n*s;if(t<=0)return 0;if(t>=a)return n;return Math.floor(t/s)}function Yp(t,n,s){if(n<=0||t<=0)return-1;if(t>=n*s)return n-1;return Math.ceil(t/s)-1}function Qp(t){let n=new Map;return t.forEach((s,a)=>{if(s.kind!=="directory"||!s.isExpanded)return;let l=s.ancestorPaths.length,d=n.get(l);if(d==null){n.set(l,[a]);return}d.push(a)}),n}function Zp(t,n){let s=0,a=t.length-1,l=-1;while(s<=a){let d=Math.floor((s+a)/2),h=t[d];if(h==null)break;if(h<=n){l=d,s=d+1;continue}a=d-1}return l}function Jp(t){let n=new Map,s=[];for(let l=0;l<t.length;l+=1){let d=t[l];if(d==null)continue;let h=d.kind==="directory"&&d.isExpanded?[...d.ancestorPaths,d.path]:d.ancestorPaths,f=0;while(f<s.length&&f<h.length&&s[f]===h[f])f+=1;for(let g=s.length-1;g>=f;g-=1){let b=s[g];if(b!=null)n.set(b,l-1)}s.length=f;for(let g=f;g<h.length;g+=1){let b=h[g];if(b!=null)s.push(b)}}let a=t.length-1;for(let l of s)n.set(l,a);return n}function Us(t,n,s){if(t.length===0||n<=0)return[];let a=Jp(t),l=Qp(t),d=[];for(let h=0;h<t.length;h+=1){let f=l.get(h);if(f==null||f.length===0)break;let g=n+h*s,b=Zp(f,Math.min(t.length-1,Math.floor(g/s))),w=null;while(b>=0){let I=f[b],v=I==null?null:t[I]??null;if(v!=null&&(h===0||v.ancestorPaths[h-1]===d[h-1]?.path)){w=v;break}b-=1}if(w==null)break;d.push(w)}return d.map((h,f)=>{let g=f*s,b=(a.get(h.path)??t.length-1)+1;if(b>=t.length)return{row:h,top:g};let w=b*s-n;return{row:h,top:Math.min(g,w-s)}}).filter((h)=>h.top+s>0)}function ad(t,n){let s=n.totalRowCount??t.length,a=s*n.itemHeight,l=Math.max(0,n.viewportHeight),d=Math.max(0,Math.floor(n.overscan)),h=Math.max(0,a-l),f=Gp(n.scrollTop,0,h),g=n.stickyRows??Us(t,f,n.itemHeight),b=g.reduce((X,fe)=>Math.max(X,fe.top+n.itemHeight),0),w=Math.min(a,f+b),I=Math.max(0,l-b),v=Math.max(0,a-w),_=sd(f,s,n.itemHeight),k=sd(w,s,n.itemHeight),T=b<=0||_<0||_>=s?-1:_,R=T===-1?-1:Math.min(s-1,k-1),B=T===-1||R<T?0:R-T+1,F=I<=0||k>=s?js:od(k,Yp(w+I,s,n.itemHeight)),D=R+1,N=Ks(F)?js:od(Math.max(D,F.startIndex-d),Math.min(s-1,F.endIndex+d)),H=Xp(N,n.itemHeight);return{occlusion:{firstOccludedIndex:T,lastOccludedIndex:R,occludedCount:B},physical:{itemHeight:n.itemHeight,maxScrollTop:h,overscan:d,scrollTop:f,totalHeight:a,totalRowCount:s,viewportHeight:l},projected:{contentHeight:v,paneHeight:I,paneTop:w},sticky:{height:b,rows:g},visible:F,window:{endIndex:N.endIndex,height:H,offsetTop:Ks(N)?0:N.startIndex*n.itemHeight,startIndex:N.startIndex}}}var ld={added:"A",deleted:"D",ignored:null,modified:"M",renamed:"R",untracked:"U"},cd={added:"Git status: added",deleted:"Git status: deleted",ignored:"Git status: ignored",modified:"Git status: modified",renamed:"Git status: renamed",untracked:"Git status: untracked"},dd="Contains git status items";function ud(t){if(t.current)return!0;return t.current=!0,!1}function Gs(t){let{currentScrollTop:n,focusedIndex:s,itemHeight:a,topInset:l=0,viewportHeight:d}=t;if(s<0)return null;let h=Math.max(0,l),f=s*a,g=f+a;if(f<n+h){let b=Math.max(0,f-h);return b===n?null:b}if(g>n+d){let b=g-d;return b===n?null:b}return null}function hd(t){let{currentScrollTop:n,focusedIndex:s,itemHeight:a,offset:l,topInset:d=0,totalHeight:h,viewportHeight:f}=t;if(l==="nearest")return Gs({currentScrollTop:n,focusedIndex:s,itemHeight:a,topInset:d,viewportHeight:f});if(s<0)return null;let g=Math.max(0,d),b=s*a,w=Math.max(0,f-g),I=l==="center"?g+Math.max(0,(w-a)/2):g,v=Math.max(0,h-f),_=Math.max(0,Math.min(b-I,v));return _===n?null:_}function fd(t){let{currentScrollTop:n,focusedIndex:s,itemHeight:a,targetViewportOffset:l,totalHeight:d,viewportHeight:h}=t;if(s<0)return null;let f=Math.max(0,l),g=s*a,b=g+a,w=n+f,I=n+h;if(g>=w&&b<=I)return null;let v=Math.max(0,d-h),_=Math.max(0,Math.min(g-f,v));return _===n?null:_}function ur(t){if(t==null||!t.isConnected)return!1;if(t===document.body||t===document.documentElement)return!1;t.focus({preventScroll:!0});let n=t.getRootNode();if(n instanceof ShadowRoot)return n.activeElement===t;return document.activeElement===t}function Pi(t){let n=t.getRootNode();if(n instanceof ShadowRoot){let a=n.activeElement;return a instanceof HTMLElement?a:null}let s=document.activeElement;return s instanceof HTMLElement&&t.contains(s)?s:null}function Br(t,n){if(t==null)return n;let s=t.getBoundingClientRect().height;if(s>0)return s;return t.clientHeight>0?t.clientHeight:n}function Xs(t,n){return t!=null&&t>0?t:n}function pd(t){let n=t.borderBoxSize,s=Array.isArray(n)?n[0]:n;if(s!=null&&Number.isFinite(s.blockSize)&&s.blockSize>0)return s.blockSize;return t.contentRect.height>0?t.contentRect.height:null}function Ys(t,n,s,a,l=0){let d=Gs({currentScrollTop:t.scrollTop,focusedIndex:n,itemHeight:s,topInset:l,viewportHeight:a});if(d==null)return!1;return t.scrollTop=d,!0}function md(t,n,s,a,l,d,h=0){let f=hd({currentScrollTop:t.scrollTop,focusedIndex:n,itemHeight:s,offset:d,topInset:h,totalHeight:l,viewportHeight:a});if(f==null)return!1;return t.scrollTop=f,!0}function Hr(t,n,s,a,l,d){let h=fd({currentScrollTop:t.scrollTop,focusedIndex:n,itemHeight:s,targetViewportOffset:d,totalHeight:l,viewportHeight:a});if(h==null)return!1;return t.scrollTop=h,!0}function Qs(t,n,s,a){if(s.end<s.start)return null;if(t<s.start)return-n;if(t>s.end)return a;return null}function gd(t){let{renamingPath:n,previousRenamingPath:s,hasRenderedInput:a}=t;if(n==null)return"reset";if(!a)return"reveal-canonical";if(s===n)return"ignore";return"focus-input"}function vd({ariaLabel:t,isFlattened:n=!1,ref:s,value:a,onBlur:l,onInput:d}){return O("input",{ref:s,"data-item-rename-input":!0,...n?{"data-item-flattened-rename-input":!0}:{},"aria-label":t,value:a,onBlur:l,onInput:d,onClick:(h)=>h.stopPropagation(),onMouseDown:(h)=>h.stopPropagation(),onPointerDown:(h)=>h.stopPropagation()})}function yd(t){let{row:n,mode:s,targetPath:a,ariaLabel:l,domId:d,isParked:h,itemHeight:f,features:g,state:b,extraStyle:w}=t,I=s==="sticky",v=n.ancestorPaths.at(-1)??"",_={};if(b.isFocusRinged)_["data-item-focused"]=!0;if(n.isSelected)_["data-item-selected"]=!0;if(b.isContextHovered)_["data-item-context-hover"]="true";if(b.isDragTarget)_["data-item-drag-target"]=!0;if(b.isDragging)_["data-item-dragging"]=!0;if(b.effectiveGitStatus!=null)_["data-item-git-status"]=b.effectiveGitStatus;if(b.containsGitChange)_["data-item-contains-git-change"]="true";return{"aria-expanded":!I&&n.kind==="directory"?n.isExpanded:void 0,"aria-haspopup":g.contextMenuEnabled?"menu":void 0,"aria-label":l,"aria-level":!I?n.level+1:void 0,"aria-posinset":!I?n.posInSet+1:void 0,"aria-selected":!I?n.isSelected?"true":"false":void 0,"aria-setsize":!I?n.setSize:void 0,"data-file-tree-sticky-path":I?a:void 0,"data-file-tree-sticky-row":I?"true":void 0,"data-item-context-menu-button-visibility":g.actionLaneEnabled?g.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":g.contextMenuEnabled?g.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":g.actionLaneEnabled?"true":void 0,"data-item-has-git-lane":g.gitLaneActive?"true":void 0,"data-item-parent-path":v.length>0?v:void 0,"data-item-parked":h?"true":void 0,"data-item-path":a,"data-item-type":n.kind==="directory"?"folder":"file","data-type":"item",id:!I?d:void 0,role:!I?"treeitem":void 0,style:{minHeight:`${f}px`,...w},tabIndex:!I&&n.isFocused?0:-1,..._}}function bd(t){let{event:n,mode:s,isSearchOpen:a,isDirectory:l}=t,d=n.ctrlKey||n.metaKey,h=n.shiftKey||d,f=n.shiftKey?{additive:d,kind:"range"}:d?{kind:"toggle"}:{kind:"single"};return{closeSearch:a,revealCanonical:s==="sticky",selection:f,toggleDirectory:!h&&l}}var Vr,mt,Zs,wd,Js=Object.is,Ri=0,Td=[],gt=xe,{__b:Sd,__r:Id,diffed:kd,__c:Cd,unmount:xd,__:_d}=gt;function Po(t,n){gt.__h&>.__h(mt,t,Ri||n),Ri=0;var s=mt.__H||(mt.__H={__:[],__h:[]});return t>=s.__.length&&s.__.push({}),s.__[t]}function pn(t){return Ri=1,em(Pd,t)}function em(t,n,s){var a=Po(Vr++,2);if(a.t=t,!a.__c&&(a.__=[s?s(n):Pd(void 0,n),function(f){var g=a.__N?a.__N[0]:a.__[0],b=a.t(g,f);Js(g,b)||(a.__N=[b,a.__[1]],a.__c.setState({}))}],a.__c=mt,!mt.__f)){var l=function(f,g,b){if(!a.__c.__H)return!0;var w=a.__c.__H.__.filter(function(v){return!!v.__c});if(w.every(function(v){return!v.__N}))return!d||d.call(this,f,g,b);var I=a.__c.props!==f;return w.forEach(function(v){if(v.__N){var _=v.__[0];v.__=v.__N,v.__N=void 0,Js(_,v.__[0])||(I=!0)}}),d&&d.call(this,f,g,b)||I};mt.__f=!0;var d=mt.shouldComponentUpdate,h=mt.componentWillUpdate;mt.componentWillUpdate=function(f,g,b){if(4&this.__g){var w=d;d=void 0,l(f,g,b),d=w}h&&h.call(this,f,g,b)},mt.shouldComponentUpdate=l}return a.__N||a.__}function ta(t,n){var s=Po(Vr++,3);!gt.__s&&na(s.__H,n)&&(s.__=t,s.u=n,mt.__H.__h.push(s))}function Kt(t,n){var s=Po(Vr++,4);!gt.__s&&na(s.__H,n)&&(s.__=t,s.u=n,mt.__h.push(s))}function ce(t){return Ri=5,Nn(function(){return{current:t}},[])}function Nn(t,n){var s=Po(Vr++,7);return na(s.__H,n)&&(s.__=t(),s.__H=n,s.__h=t),s.__}function Pt(t,n){return Ri=8,Nn(function(){return t},n)}function tm(){for(var t;t=Td.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(To),t.__H.__h.forEach(ea),t.__H.__h=[]}catch(n){t.__H.__h=[],gt.__e(n,t.__v)}}gt.__b=function(t){mt=null,Sd&&Sd(t)},gt.__=function(t,n){t&&n.__k&&n.__k.__m&&(t.__m=n.__k.__m),_d&&_d(t,n)},gt.__r=function(t){Id&&Id(t),Vr=0;var n=(mt=t.__c).__H;n&&(Zs===mt?(n.__h=[],mt.__h=[],n.__.forEach(function(s){s.__N&&(s.__=s.__N),s.u=s.__N=void 0})):(n.__h.forEach(To),n.__h.forEach(ea),n.__h=[],Vr=0)),Zs=mt},gt.diffed=function(t){kd&&kd(t);var n=t.__c;n&&n.__H&&(n.__H.__h.length&&(Td.push(n)!==1&&wd===gt.requestAnimationFrame||((wd=gt.requestAnimationFrame)||nm)(tm)),n.__H.__.forEach(function(s){s.u&&(s.__H=s.u),s.u=void 0})),Zs=mt=null},gt.__c=function(t,n){n.some(function(s){try{s.__h.forEach(To),s.__h=s.__h.filter(function(a){return!a.__||ea(a)})}catch(a){n.some(function(l){l.__h&&(l.__h=[])}),n=[],gt.__e(a,s.__v)}}),Cd&&Cd(t,n)},gt.unmount=function(t){xd&&xd(t);var n,s=t.__c;s&&s.__H&&(s.__H.__.forEach(function(a){try{To(a)}catch(l){n=l}}),s.__H=void 0,n&>.__e(n,s.__v))};var Ed=typeof requestAnimationFrame=="function";function nm(t){var n,s=function(){clearTimeout(a),Ed&&cancelAnimationFrame(n),setTimeout(t)},a=setTimeout(s,35);Ed&&(n=requestAnimationFrame(s))}function To(t){var n=mt,s=t.__c;typeof s=="function"&&(t.__c=void 0,s()),mt=n}function ea(t){var n=mt;t.__c=t.__(),mt=n}function na(t,n){return!t||t.length!==n.length||n.some(function(s,a){return!Js(s,t[a])})}function Pd(t,n){return typeof n=="function"?n(t):n}function rm(t,n=null,s=null){let a=t.flattenedSegments;if(a==null||a.length===0)return n??t.name;return O("span",{"data-item-flattened-subitems":!0,children:a.map((l,d)=>{let h=d===a.length-1;return O(wn,{children:[O("span",{"data-item-flattened-subitem":l.path,"data-item-flattened-subitem-drag-target":s===l.path?"true":void 0,children:h&&n!=null?n:O(Ti,{children:l.name})}),d<a.length-1?" / ":""]},l.path)})})}function qr(t){return t.isFlattened?t.flattenedSegments?.findLast((n)=>n.isTerminal)?.path??t.path:t.path}function ia(t){let n=t.flattenedSegments;if(n==null||n.length===0)return t.name;return n.map((s)=>s.name).join(" / ")}function Rd(t,n,s,a){return t.map((l,d)=>{let h=d*s,f=l.subtreeEndIndex+1;if(f>=a)return{row:l.row,top:h};let g=f*s-n;return{row:l.row,top:Math.min(h,g-s)}}).filter((l)=>l.top+s>0)}function ra({controller:t,itemHeight:n,overscan:s,scrollTop:a,stickyFolders:l,viewportHeight:d}){let h=t.getVisibleCount(),f=l&&h>0?t.getStickyRowCandidates(a,n):[],g=f==null&&l&&h>0?t.getVisibleRows(0,h-1):[],b=ad(g,{itemHeight:n,overscan:s,scrollTop:a,stickyRows:f==null?void 0:Rd(f,a,n,h),totalRowCount:h,viewportHeight:d}),w=l&&a<=0&&h>0?t.getStickyRowCandidates(1,n):[],I=w!=null&&a<=0?Rd(w,1,n,h):l&&a<=0&&g.length>0?Us(g,1,n):b.sticky.rows;return{overlayHeight:I.reduce((v,_)=>Math.max(v,_.top+n),0),overlayRows:I,snapshot:b,visibleRows:g}}var im=400,Dd=10,Or=40,Md=18;function om(t,n,s){let a=t,l=document.elementFromPoint?.bind(document)??null,d=a.elementFromPoint?.(n,s)??l?.(n,s)??null;if(t instanceof ShadowRoot&&(d==null||!t.contains(d)))return sm(t,n,s);return d instanceof HTMLElement?d:null}function sm(t,n,s){let a=Array.from(t.querySelectorAll('[data-type="item"], [data-item-flattened-subitem]'));for(let l=a.length-1;l>=0;l--){let d=a[l],h=d.getBoundingClientRect();if(n>=h.left&&n<=h.right&&s>=h.top&&s<=h.bottom)return d}return null}function Ad(t){let n=t?.closest?.('[data-type="item"]');if(!(n instanceof HTMLElement))return null;let s=n.dataset.itemPath??null;if(s==null)return null;let a=t?.closest?.("[data-item-flattened-subitem]"),l=a instanceof HTMLElement?a.getAttribute("data-item-flattened-subitem")??null:null;if(l!=null&&l.endsWith("/"))return{directoryPath:l,flattenedSegmentPath:l,hoveredPath:s,kind:"directory"};if(n.dataset.itemType==="folder")return{directoryPath:s,flattenedSegmentPath:null,hoveredPath:s,kind:"directory"};let d=n.dataset.itemParentPath??null;if(d==null||d.length===0)return{directoryPath:null,flattenedSegmentPath:null,hoveredPath:s,kind:"root"};return{directoryPath:d,flattenedSegmentPath:null,hoveredPath:s,kind:"directory"}}function Nd(t){let n=t.cloneNode(!0);return n.removeAttribute("id"),n.dataset.fileTreeDragPreview="true",n.setAttribute("aria-hidden","true"),n.tabIndex=-1,Object.assign(n.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"}),n}function am(){return navigator.vendor!=="Apple Computer, Inc."}function lm(t,n){let s=t-n.top;if(s<Or)return-Math.ceil((Or-Math.max(0,s))/Or*Md);let a=n.bottom-t;if(a<Or)return Math.ceil((Or-Math.max(0,a))/Or*Md);return 0}function cm(t,n){if(t!=null){let s=ld[t];if(s==null)return null;return{text:s,title:cd[t]}}if(n)return{icon:{name:"file-tree-icon-dot",width:6,height:6},title:dd};return null}function dm(t,n,s){if(n==null||n.size===0)return null;let a=[];for(let l=t.length-1;l>=0;l-=1){let d=t[l],h=s.get(d);if(h!=null){for(let f of a)s.set(f,h);return h?"ignored":null}if(n.has(d)){s.set(d,!0);for(let f of a)s.set(f,!0);return"ignored"}a.push(d)}for(let l of a)s.set(l,!1);return null}function Fd(t){return t!=null&&"toggle"in t}function Wd(t){return t.code==="Space"||t.key===" "||t.key==="Spacebar"}function um(t){return t.key.length===1&&/^[\p{L}\p{N}]$/u.test(t.key)&&!t.ctrlKey&&!t.metaKey&&!t.altKey}function hm(t){if(t==null)return"";return`[data-item-section="spacing-item"][data-ancestor-path="${t.replaceAll("\\","\\\\").replaceAll('"',"\\\"")}"] { opacity: 1; }`}function $d(t){return t.shiftKey&&t.key==="F10"||t.key==="ContextMenu"}function fm(t,n){if(n&&$d(t))return!0;if((t.ctrlKey||t.metaKey)&&Wd(t))return!0;return t.key==="ArrowDown"||t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="ArrowUp"}var pm=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"]);function Ld(t){for(let n of t.composedPath()){if(!(n instanceof HTMLElement))continue;if(n.dataset.fileTreeContextMenuRoot==="true")return!0;if(n.dataset.type==="context-menu-anchor"||n.dataset.type==="context-menu-trigger")return!0;if(n.getAttribute("slot")==="context-menu")return!0}return!1}function mm(t){return{bottom:t.bottom,height:t.height,left:t.left,right:t.right,top:t.top,width:t.width,x:t.x,y:t.y}}function gm(t,n){return{bottom:n,height:0,left:t,right:t,top:n,width:0,x:t,y:n}}function vm(t,n){if(t==null)return n.offsetTop;let s=n.getBoundingClientRect(),a=t.getBoundingClientRect();return s.top-a.top}function Bd(t,n,s){if(s==null){t.delete(n);return}t.set(n,s)}function Hd(t,n,s){if(t==null)return null;let a=n.get(t)??null;if(a!=null)return a;let l=s.get(t)??null;return l?.dataset.itemParked==="true"?null:l}function ym(t){if(t==null)return[];let n=[];for(let s of t.querySelectorAll('button[data-file-tree-sticky-row="true"]')){if(!(s instanceof HTMLElement))continue;let a=s.dataset.fileTreeStickyPath;if(a!=null)n.push(a)}return n}function bm(t,n){if(t==null||n==null)return null;for(let s of t.querySelectorAll('button[data-item-focused="true"][data-item-parked="true"]'))if(s instanceof HTMLElement&&s.dataset.itemPath===n)return s;return null}function wm(t,n,s,a,l,d,h){let f=Math.max(0,d-l),g=n?.getBoundingClientRect()??null,b=g==null||s==null?null:s.getBoundingClientRect().top-g.top,w=bm(t,a),I=g==null||w==null?null:w.getBoundingClientRect().top-g.top;return Math.max(0,Math.min(I??Math.max(b??0,f),Math.max(0,h-l)))}function Vd(t,n){return{kind:t.kind,name:ia(t),path:n}}function Sm(t){return t==null?void 0:`${t}__tree`}function jd(t,n,s){if(t==null)return;return`${t}__focused-item-${encodeURIComponent(n)}${s?"__parked":""}`}function Od(t){return t==="file-tree-icon-chevron"||t==="file-tree-icon-dot"||t==="file-tree-icon-file"||t==="file-tree-icon-lock"}function qd(t,n){if(t==null)return null;if("text"in t){if(t.parts!=null)return O("span",{title:t.title,children:t.parts.map((a,l)=>O("span",{style:{color:a.color},children:a.text},l))});return O("span",{title:t.title,children:t.text})}let s=typeof t.icon==="string"?Od(t.icon)?n(t.icon):{name:t.icon}:Od(t.icon.name)?(()=>{let a=n(t.icon.name),{name:l,...d}=t.icon;return{...a,...d}})():t.icon;return O("span",{title:t.title,children:O(Lr,{...s})})}function zd(t){if(t==null)return;ur(t.querySelector(["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", "))??t)}function Im(t,n,{actionLaneEnabled:s=!1,customDecoration:a=null,decorationLaneEnabled:l=!1,dragTargetFlattenedSegmentPath:d=null,gitDecoration:h=null,gitLaneActive:f=!1,renameInput:g=null,showDecorativeActionAffordance:b=!1}={}){let w=qr(t);return O(wn,{children:[t.depth>0?O("div",{"data-item-section":"spacing",children:Array.from({length:t.depth}).map((I,v)=>O("div",{"data-item-section":"spacing-item","data-ancestor-path":t.ancestorPaths[v]},v))}):null,O("div",{"data-item-section":"icon",children:t.kind==="directory"?O(Lr,{...n("file-tree-icon-chevron")}):O(Lr,{...n("file-tree-icon-file",w)})}),O("div",{"data-item-section":"content",children:t.isFlattened?rm(t,g,d):g??O(id,{minimumLength:5,split:"extension",children:t.name})}),l?O("div",{"data-item-section":"decoration",children:a!=null?qd(a,n):null}):null,f?O("div",{"data-item-section":"git",children:qd(h,n)}):null,s?O("div",{"data-item-section":"action",children:b?O("span",{"aria-hidden":"true","data-item-action-affordance":"decorative",children:O(Lr,{...n("file-tree-icon-ellipsis")})}):null}):null]})}function Ro(t,n,s,a={}){let{controller:l,renameView:d,visualFocusPath:h,contextHoverPath:f,draggedPathSet:g,dragTarget:b,dragAndDropEnabled:w,shouldSuppressContextMenu:I,handleRowDragStart:v,handleRowDragEnd:_,handleRowTouchStart:k,instanceId:T,itemHeight:R,gitStatusByPath:B,ignoredGitDirectories:F,ignoredInheritanceCache:D,directoriesWithGitChanges:N,gitLaneActive:H,contextMenuEnabled:X,contextMenuTriggerMode:fe,contextMenuButtonTriggerEnabled:vt,contextMenuButtonVisibility:Le,contextMenuRightClickEnabled:yt,registerRenameInput:Ie,registerButton:Be,resolveIcon:Ye,renderDecorationForRow:qe,openContextMenuForRow:_t,onRowClick:ke,onKeyDown:ve}=t,te=qr(n),{isParked:Re=!1,mode:St="flow",style:$e}=a,ut=St==="sticky",It=B?.get(te)??null??dm(n.ancestorPaths,F,D),ht=n.kind==="directory"&&(N?.has(te)??!1),Wt=qe(n,te),Rt=cm(It,ht),wt=X&&vt,Et=Wt!=null||H||wt,ft=wt&&Le==="always",Dt=d.getPath()===te,tn=Dt?d.getValue():"",$t=ut||!Dt?null:O(vd,{ref:Ie,ariaLabel:`Rename ${ia(n)}`,isFlattened:n.isFlattened,value:tn,onBlur:()=>{d.commit()},onInput:(Qe)=>{d.setValue(Qe.currentTarget.value)}}),pr=Im(n,Ye,{actionLaneEnabled:wt,customDecoration:Wt,decorationLaneEnabled:Et,dragTargetFlattenedSegmentPath:b?.flattenedSegmentPath??null,gitDecoration:Rt,gitLaneActive:H,renameInput:$t,showDecorativeActionAffordance:ft}),cn={...yd({ariaLabel:ia(n),domId:n.isFocused?jd(T,te,Re):void 0,extraStyle:$e,features:{actionLaneEnabled:wt,contextMenuButtonVisibility:wt?Le:null,contextMenuEnabled:X,contextMenuTriggerMode:X?fe:null,gitLaneActive:H},isParked:Re,itemHeight:R,mode:St,row:n,state:{containsGitChange:ht,effectiveGitStatus:It,isContextHovered:f===te,isDragTarget:b?.kind==="directory"&&b.directoryPath===te,isDragging:g?.has(te)===!0,isFocusRinged:n.isFocused&&h===te},targetPath:te}),key:s,onContextMenu:X||w?(Qe)=>{if(I()){Qe.preventDefault();return}if(!X)return;if(Qe.preventDefault(),!yt)return;l.focusMountedPathFromInput(te),_t(n,te,{anchorRect:gm(Qe.clientX,Qe.clientY),source:"right-click"})}:void 0,onFocus:!ut?()=>{l.focusMountedPathFromInput(te)}:void 0,onKeyDown:!ut?ve:void 0,ref:(Qe)=>{Be(te,Qe)}};if(!ut&&Dt)return O("div",{...cn,children:pr});return O("button",{...cn,type:"button",draggable:w&&!Re,onDragEnd:w&&!Re?_:void 0,onDragStart:w&&!Re?(Qe)=>{v(Qe,n,te)}:void 0,onMouseDown:(Qe)=>{if(ut){Qe.preventDefault();return}if(l.isSearchOpen())Qe.preventDefault()},onTouchStart:w&&!Re?(Qe)=>{k(Qe,n,te)}:void 0,onClick:(Qe)=>{ke(Qe,n,te,St)},children:pr})}function km(t,n,s){if(n.end<n.start)return[];return t.controller.getVisibleRows(n.start,n.end).filter((a)=>!s.has(qr(a))).map((a,l)=>Ro(t,a,n.start+l))}function Do({composition:t,controller:n,gitStatusByPath:s,ignoredGitDirectories:a,directoriesWithGitChanges:l,icons:d,instanceId:h,itemHeight:f=xi,overscan:g=10,renamingEnabled:b=!1,renderRowDecoration:w,searchBlurBehavior:I="close",searchEnabled:v=!1,searchFakeFocus:_=!1,slotHost:k,stickyFolders:T=!1,initialViewportHeight:R=420}){let B=ce(null),F=ce(null),D=ce(!1),N=ce(null),H=ce(null),X=ce(null),fe=ce(null),vt=ce(null),Le=ce(new Map),yt=ce(new Map),Ie=ce(()=>{}),Be=ce(null),Ye=ce(0),qe=ce(!1),_t=ce(null);if(_t.current!==n)qe.current=!1,_t.current=n;let ke=ce(!1),ve=ce(null),te=ce(null),Re=ce(!1),St=ce(null),$e=ce(null),ut=ce(null),It=ce(null),ht=ce(null),Wt=ce(null),Rt=ce(null),wt=ce(null),Et=ce(!1),ft=ce(null),Dt=ce(null),tn=ce(null),$t=ce(null),pr=Nn(()=>new Map,[]),[,cn]=pn(0),Qe=ce(!1),[er,nn]=pn(null),[Zr,Hn]=pn(null),[Jr,$o]=pn(null),[Oi,Cn]=pn(null),[jo,xn]=pn(0),[Ce,mr]=pn(null),_n=ce(Ce);_n.current=Ce;let mn=ce(null),tr=ce(null),gn=ce(null),nr=ce(null),ei=ce(null),dn=ce(!1),gr=()=>{tr.current=null,gn.current=null,nr.current=null},vn=(S,M)=>{tr.current=S,gn.current=null,nr.current=M==null?null:{path:S,scrollTop:M}},En=(S,M)=>{tr.current=null,gn.current={path:S,viewportOffset:M},nr.current=null},rn=ce(I==="retain"&&n.isSearchOpen()),[ct,ti]=pn(_);ta(()=>{if(!_)ti(!1)},[_]);let ni=ce(!1),Vn=Pt(()=>{ni.current=!0,ti((S)=>S?!1:S)},[]),[ri,Ko]=pn(()=>ra({controller:n,itemHeight:f,overscan:g,scrollTop:0,stickyFolders:T,viewportHeight:R})),[Uo,Go]=pn(!1);ta(()=>{Go(!0)},[]);let P=t?.contextMenu?.enabled===!0||t?.contextMenu?.render!=null||t?.contextMenu?.onOpen!=null||t?.contextMenu?.onClose!=null,K=t?.contextMenu?.triggerMode??(P?"right-click":"both"),z=K==="both"||K==="button",J=t?.contextMenu?.buttonVisibility??"when-needed",Se=K==="both"||K==="right-click";Kt(()=>{let S=X.current;if(S==null)return;let M=(q)=>{if(!(q instanceof CustomEvent))return;let G=q.detail?.path??null;ei.current=G,Hn(G),Cn(G==null?null:"pointer")},ee=(q)=>{if(!(q instanceof CustomEvent))return;dn.current=q.detail?.disabled===!0};return S.addEventListener("file-tree-debug-set-context-menu-trigger",M),S.addEventListener("file-tree-debug-set-scroll-suppression",ee),()=>{S.removeEventListener("file-tree-debug-set-context-menu-trigger",M),S.removeEventListener("file-tree-debug-set-scroll-suppression",ee)}},[]);let Lt=Pt((S,M)=>{Bd(Le.current,S,M)},[]),On=Pt((S,M)=>{Bd(yt.current,S,M)},[]),vr=Pt((S)=>{H.current=S},[]),Tn=Pt((S)=>Hd(S,yt.current,Le.current),[]),qi=s!=null||a!=null||l!=null,{resolveIcon:yr}=Nn(()=>ds(d),[d]),ii=n[Ns](),br=ii.getPath(),Xo=br!=null,yn=n.isSearchOpen(),dh=n.getSearchValue(),ge=n.getFocusedPath(),De=n.getFocusedIndex(),rr=n.getScrollRequest(),Pn=n.isDragAndDropEnabled(),oi=n.getDragSession(),uh=Nn(()=>oi==null?null:new Set(oi.draggedPaths),[oi]),hh=oi?.target??null,si=oi?.primaryPath??null,xa=Sm(h),{overlayHeight:fh,overlayRows:ph,snapshot:kt,visibleRows:zi}=ri,Tt=kt.physical.viewportHeight,un=Nn(()=>({end:kt.window.endIndex,start:kt.window.startIndex}),[kt.window.endIndex,kt.window.startIndex]),ai=ph,_a=kt.sticky.rows,ir=kt.physical.totalHeight,wr=kt.sticky.height,Wi=Nn(()=>new Set(_a.map((S)=>qr(S.row))),[_a]),Yo=De>=0&&De>=un.start&&De<=un.end,mh=Pt((S,M)=>w?.({item:Vd(S,M),row:S})??null,[w]),Ea=Pt((S)=>{if(ur(S==null?null:Le.current.get(S)??null))return!0;return ur(X.current)},[]),$i=Pt((S)=>{Ea(n.focusNearestPath(S))},[n,Ea]),Ta=ce($i);Ta.current=$i;let Sr=ce(!0),Qo=ce(()=>{}),on=Pt((S=!0)=>{let M=_n.current;if(M==null)return;if(Sr.current=Sr.current&&S,mr(null),t?.contextMenu?.onClose?.(),Sr.current)$i(M.path)},[t?.contextMenu,$i]);Qo.current=on;let li=Pt((S)=>{let M=S==null?null:vm(X.current,S);$o((ee)=>ee===M?ee:M)},[]),Pa=Pt((S,M,ee)=>{let q=n.getItem(M);if(q==null)return;let G=Tn(M);if(G?.dataset.fileTreeStickyRow==="true"){let ie=fe.current;vn(M,ie?.scrollTop??null),ke.current=!0,nn((je)=>je===M?je:M)}q.focus(),li(G),Sr.current=!0,mr({anchorRect:ee?.anchorRect??null,item:Vd(S,M),path:M,source:ee?.source??"keyboard"})},[n,Tn,li]),gh=Pt((S)=>{if(!b)return;if(n.isSearchOpen()){let M=fe.current,ee=Br(M,Tt);St.current=De<0||M==null?null:Math.max(0,Math.min(De*f-M.scrollTop,Math.max(0,ee-f))),Re.current=!0}if(n.startRenaming(S)===!1)return;Cn("focus"),cn((M)=>M+1)},[n,De,f,b,Tt]),ji=Pt((S,{restoreTreeFocus:M=!0,targetOffset:ee="live-overlay"}={})=>{let q=fe.current;if(q==null)return!1;n.focusPath(S);let G=n.getFocusedIndex();if(G<0)return!1;let ie=n.getVisibleRows(G,G)[0]??null;if(ie==null)return!1;let je=Br(q,Tt),re=n.getVisibleCount()*f,Te=ee==="sticky-parents"?ie.ancestorPaths.length*f:ra({controller:n,itemHeight:f,overscan:g,scrollTop:q.scrollTop,stickyFolders:T,viewportHeight:je}).snapshot.sticky.height;return ke.current=!0,Hr(q,G,f,je,re,Te),Ie.current(),mn.current=M?S:null,!0},[n,f,g,Tt,T]),vh=()=>D.current===!0||$t.current!=null||Et.current===!0,Ra=(S)=>typeof window.requestAnimationFrame==="function"?window.requestAnimationFrame(()=>{S()}):window.setTimeout(S,16),yh=(S)=>{if(S==null)return;if(typeof window.cancelAnimationFrame==="function"){window.cancelAnimationFrame(S);return}window.clearTimeout(S)},qn=()=>{if(It.current!=null)clearTimeout(It.current),It.current=null;ut.current=null},Ki=()=>{Wt.current?.remove(),Wt.current=null},ci=()=>{yh($e.current),$e.current=null,ht.current=null},Da=(S)=>{let M=X.current?.getRootNode();if(M instanceof ShadowRoot){M.append(S);return}document.body.append(S)},di=()=>{if(wt.current?.(),wt.current=null,$t.current!=null)clearTimeout($t.current),$t.current=null;if(Et.current=!1,ft.current=null,tn.current=null,Dt.current!=null)Dt.current.setAttribute("draggable","true"),Dt.current.style.removeProperty("touch-action"),Dt.current=null;Ki(),qn(),ci(),Rt.current=null},Ui=(S,M)=>{let ee=X.current?.getRootNode(),q=Ad(om(ee instanceof ShadowRoot?ee:document,S,M));return n.setDragTarget(q),n.getDragSession()?.target??null},Zo=(S)=>{let M=n.getDragAndDropConfig()?.openOnDropDelay??800;if(S==null||S.kind!=="directory"||S.directoryPath==null||M<=0){qn();return}let ee=n.getItem(S.directoryPath),q=Fd(ee)?ee:null;if(q==null||q.isExpanded()){qn();return}let G=`${S.directoryPath}::${S.flattenedSegmentPath??""}`;if(ut.current===G)return;qn(),ut.current=G,It.current=setTimeout(()=>{let ie=n.getDragSession()?.target;if(ie?.kind!=="directory"||ie.directoryPath!==S.directoryPath||ie.flattenedSegmentPath!==S.flattenedSegmentPath)return;q.expand()},M)},Ma=()=>{$e.current=null;let S=ht.current,M=fe.current;if(S==null||M==null||n.getDragSession()==null)return;let ee=M.getBoundingClientRect(),q=lm(S.clientY,ee);if(q===0)return;let G=Math.max(0,M.scrollHeight-M.clientHeight),ie=Math.max(0,Math.min(G,M.scrollTop+q));if(ie!==M.scrollTop)M.scrollTop=ie,Ie.current();Zo(Ui(S.clientX,S.clientY)),$e.current=Ra(Ma)},Aa=(S,M)=>{ht.current={clientX:S,clientY:M},$e.current??=Ra(Ma)},bh=(S,M,ee)=>{let q=S.currentTarget;if(q==null)return;if(di(),Ki(),qn(),ci(),n.startDrag(ee)===!1){S.preventDefault();return}if(Rt.current=M,S.dataTransfer!=null){if(S.dataTransfer.effectAllowed="move",S.dataTransfer.dropEffect="move",S.dataTransfer.setData("text/plain",ee),am()){let G=Nd(q),ie=q.getBoundingClientRect();Object.assign(G.style,{height:`${ie.height}px`,opacity:"0.85",transform:"translate3d(-9999px, 0px, 0)",width:`${ie.width}px`}),Da(G),Wt.current=G,S.dataTransfer.setDragImage(G,Math.max(0,S.clientX-ie.left),Math.max(0,S.clientY-ie.top))}}},wh=()=>{Ki(),qn(),ci(),Rt.current=null,n.cancelDrag()},Sh=(S,M,ee)=>{if($t.current!=null||Et.current)return;let q=S.touches[0],G=S.currentTarget;if(q==null||G==null)return;tn.current={clientX:q.clientX,clientY:q.clientY},Dt.current=G,G.setAttribute("draggable","false");let ie=(Te={})=>{let Oe=Te.restoreNativeDraggable??!Et.current;if($t.current!=null)clearTimeout($t.current),$t.current=null;if(document.removeEventListener("touchmove",je),document.removeEventListener("touchend",re),document.removeEventListener("touchcancel",re),wt.current===ie)wt.current=null;if(Oe){if(G.setAttribute("draggable","true"),Dt.current===G)Dt.current=null;tn.current=null}},je=(Te)=>{let Oe=Te.touches[0],Ae=tn.current;if(Oe==null||Ae==null)return;let lt=Oe.clientX-Ae.clientX,Mt=Oe.clientY-Ae.clientY;if(lt*lt+Mt*Mt<=Dd*Dd)return;ie()},re=()=>{ie()};document.addEventListener("touchmove",je,{passive:!0}),document.addEventListener("touchend",re),document.addEventListener("touchcancel",re),wt.current=ie,$t.current=setTimeout(()=>{if(ie({restoreNativeDraggable:!1}),n.startDrag(ee)===!1){if(G.setAttribute("draggable","true"),Dt.current===G)Dt.current=null;tn.current=null;return}Et.current=!0,Dt.current=G,G.setAttribute("draggable","false"),G.style.setProperty("touch-action","none"),Rt.current=M;let Te=G.getBoundingClientRect(),Oe=Nd(G);Object.assign(Oe.style,{height:`${Te.height}px`,opacity:"0.85",transform:`translate3d(${Te.left}px, ${Te.top}px, 0)`,width:`${Te.width}px`}),Da(Oe),Wt.current=Oe,ft.current={x:q.clientX-Te.left,y:q.clientY-Te.top};let Ae=(hn)=>{let bt=hn.touches[0];if(bt==null)return;hn.preventDefault();let _e=ft.current;if(_e!=null&&Wt.current!=null)Wt.current.style.transform=`translate3d(${bt.clientX-_e.x}px, ${bt.clientY-_e.y}px, 0)`;Zo(Ui(bt.clientX,bt.clientY)),Aa(bt.clientX,bt.clientY)},lt=(hn)=>{let bt=hn.changedTouches[0];if(bt!=null)Ui(bt.clientX,bt.clientY);n.completeDrag(),di()},Mt=()=>{n.cancelDrag(),di()};wt.current=()=>{document.removeEventListener("touchmove",Ae),document.removeEventListener("touchend",lt),document.removeEventListener("touchcancel",Mt)},document.addEventListener("touchmove",Ae,{passive:!1}),document.addEventListener("touchend",lt),document.addEventListener("touchcancel",Mt)},im)},Na=(S)=>{if(Ce!=null){if(S.key==="Escape"){on(),S.preventDefault(),S.stopPropagation();return}if(pm.has(S.key))S.preventDefault(),S.stopPropagation();return}if(ii.isActive()){if(S.isComposing||S.keyCode===229)return;if(S.key==="Escape")ii.cancel();else if(S.key==="Enter")ii.commit();else return;Cn("focus"),cn((pt)=>pt+1),S.preventDefault(),S.stopPropagation();return}if(b&&S.key==="F2"){gh(ge??void 0),S.preventDefault(),S.stopPropagation();return}if(yn){if(S.key==="Escape")Re.current=!1,St.current=null,n.closeSearch();else if(S.key==="Enter"){let pt=n.getFocusedPath();if(pt!=null)n.selectOnlyPath(pt);let bn=fe.current,Zi=Br(bn,Tt);St.current=De<0||bn==null?null:Math.max(0,Math.min(De*f-bn.scrollTop,Math.max(0,Zi-f))),Re.current=!0,n.closeSearch()}else if(S.key==="ArrowDown")n.focusNextSearchMatch();else if(S.key==="ArrowUp")n.focusPreviousSearchMatch();else return;Cn("focus"),cn((pt)=>pt+1),S.preventDefault(),S.stopPropagation();return}if(v&&um(S)){n.openSearch(S.key),cn((pt)=>pt+1),S.preventDefault(),S.stopPropagation();return}let M=P&&$d(S),ee=fm(S,P),q=ee&&X.current!=null?Pi(X.current):null,G=ee?new Set(ym(X.current)):new Set,ie=q?.dataset.fileTreeStickyPath??null,je=q?.dataset.fileTreeStickyRow==="true"&&ie!=null;if(je&&ie!==ge&&G.has(ie)){let pt=fe.current;vn(ie,pt?.scrollTop??null),n.focusPath(ie)}let re=n.getFocusedPath(),Te=n.getFocusedIndex(),Oe=n.getFocusedItem();if(Oe==null)return;let Ae=Fd(Oe)?Oe:null,lt=re!=null&&(Wi.has(re)||je&&ie===re&&G.has(re)),Mt=S.key==="ArrowDown"||S.key==="ArrowUp"||S.key==="ArrowRight"&&Ae!=null&&Ae.isExpanded(),hn=S.key==="ArrowLeft"&<&&Ae!=null&&Ae.isExpanded(),bt=fe.current,_e=!0;if(S.shiftKey&&S.key==="ArrowDown")n.extendSelectionFromFocused(1);else if(S.shiftKey&&S.key==="ArrowUp")n.extendSelectionFromFocused(-1);else if(M&&re!=null&&Te>=0){let pt=n.getVisibleRows(Te,Te)[0]??null,bn=Hd(re,yt.current,Le.current);if(pt==null||bn==null)_e=!1;else Pa(pt,re)}else if((S.ctrlKey||S.metaKey)&&Wd(S))n.toggleFocusedSelection();else if((S.ctrlKey||S.metaKey)&&S.key.toLowerCase()==="a")n.selectAllVisiblePaths();else switch(S.key){case"ArrowDown":n.focusNextItem();break;case"ArrowUp":n.focusPreviousItem();break;case"ArrowRight":if(Ae==null||Ae.isExpanded())n.focusNextItem();else Ae.expand();break;case"ArrowLeft":if(Ae!=null&&Ae.isExpanded())Ae.collapse();else n.focusParentItem();break;case"Home":n.focusFirstItem();break;case"End":n.focusLastItem();break;default:_e=!1}if(!_e)return;Cn("focus");let dt=n.getFocusedPath(),Bt=dt!=null&&(Wi.has(dt)||G.has(dt)),Yi=Mt&&dt!==re,Qi=M&&je&&ie===re&&dt===re;if((lt||Qi)&&dt!=null&&(Yi&&Bt||Qi))vn(dt,bt?.scrollTop??null),ke.current=!0,nn((pt)=>pt===dt?pt:dt);else{let pt=S.key==="ArrowUp"&<&&dt!==re;if(dt!=null&&(pt||hn&&dt===re))En(dt,wm(X.current,bt,q,re,f,wr,Tt)),ke.current=!0,nn((bn)=>bn===dt?bn:dt);else gr()}cn((pt)=>pt+1),S.preventDefault(),S.stopPropagation()};Kt(()=>{if(!v||!yn)return;if(rn.current){rn.current=!1;return}ur(vt.current)},[yn,v]),Kt(()=>{let S=H.current;switch(gd({hasRenderedInput:S!=null,previousRenamingPath:te.current,renamingPath:br})){case"reset":te.current=null;return;case"reveal-canonical":if(br!=null)ji(br,{restoreTreeFocus:!1,targetOffset:"live-overlay"});return;case"ignore":return;case"focus-input":if(S!=null)mn.current=null,te.current=br,ur(S),S.select();return}},[un.end,un.start,br,ji,Wi]),Kt(()=>{let S=X.current;if(S==null)return;let M=null,ee=()=>{if(M==null)return;clearTimeout(M),M=null},q=()=>{let je=Pi(S)?.dataset.itemPath??null;nn((re)=>re===je?re:je)},G=()=>{ee(),ke.current=!0,q()},ie=(je)=>{let re=je.relatedTarget;if(re==null){ee(),M=setTimeout(()=>{if(M=null,Pi(S)!=null){q();return}ke.current=!1,nn(null)},0);return}if(!(re instanceof Node)||!S.contains(re)){ee(),ke.current=!1,nn(null);return}let Te=re instanceof HTMLElement?re.dataset.itemPath??null:null;nn((Oe)=>Oe===Te?Oe:Te)};return S.addEventListener("focusin",G),S.addEventListener("focusout",ie),()=>{ee(),S.removeEventListener("focusin",G),S.removeEventListener("focusout",ie)}},[]),Kt(()=>{let S=X.current;if(S==null)return;if(kt.physical.scrollTop<=0)S.dataset.scrollAtTop="true";else delete S.dataset.scrollAtTop},[kt.physical.scrollTop]),Kt(()=>{let S=null,M=fe.current,ee=N.current,q=X.current;if(M==null)return;Be.current=Br(M,R);let G=()=>{let _e=n.getVisibleCount(),dt=Xs(Be.current,R),Bt=Math.max(0,_e*f-dt);if(M.scrollTop>Bt)M.scrollTop=Bt;Ko(ra({controller:n,itemHeight:f,overscan:g,scrollTop:Math.min(M.scrollTop,Bt),stickyFolders:T,viewportHeight:dt}))};if(!qe.current){qe.current=!0;let _e=n.getFocusedIndex();if(_e>=0){let dt=Xs(Be.current,R),Bt=n.getVisibleRows(_e,_e)[0]??null;Ys(M,_e,f,dt,T&&Bt!=null?Math.max(0,Math.min(Bt.ancestorPaths.length*f,Math.max(0,dt-f))):0)}}Ie.current=G;let ie=n.subscribe(()=>{if(ud(Qe))cn((_e)=>_e+1);G()}),je=()=>{if(dn.current===!0)return;if(ee!=null)ee.dataset.isScrolling??="";if(q!=null)q.dataset.isScrolling??="";if(D.current=!0,S!=null)clearTimeout(S);S=setTimeout(()=>{if(ee!=null)delete ee.dataset.isScrolling;if(q!=null)delete q.dataset.isScrolling;D.current=!1,xn((_e)=>_e+1),S=null},50)},re=null,Te=()=>{if(q!=null)delete q.dataset.overlayReveal;if(re!=null)clearTimeout(re),re=null},Oe=()=>{if(q==null||dn.current===!0)return;if(M.scrollTop>0)return;if(q.dataset.overlayReveal="true",re!=null)clearTimeout(re);re=setTimeout(()=>{Te()},200)},Ae=()=>{if(G(),M.scrollTop>0)Te();if(_n.current!=null&&D.current)Qo.current();if(dn.current===!0){D.current=!1;return}Hn((_e)=>_e==null?_e:null),je()},lt=()=>{je(),Oe()},Mt=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"," ","Spacebar"]),hn=(_e)=>{if(!Mt.has(_e.key))return;lt()};M.addEventListener("scroll",Ae,{passive:!0}),M.addEventListener("wheel",lt,{passive:!0}),M.addEventListener("touchmove",lt,{passive:!0}),M.addEventListener("keydown",hn);let bt=typeof ResizeObserver<"u"?new ResizeObserver((_e)=>{Be.current=(_e[0]==null?null:pd(_e[0]))??Br(M,R),G()}):null;return bt?.observe(M),()=>{if(Ie.current=()=>{},ie(),M.removeEventListener("scroll",Ae),M.removeEventListener("wheel",lt),M.removeEventListener("touchmove",lt),M.removeEventListener("keydown",hn),S!=null)clearTimeout(S);if(re!=null)clearTimeout(re);if(ee!=null)delete ee.dataset.isScrolling;if(q!=null)delete q.dataset.isScrolling,delete q.dataset.overlayReveal;D.current=!1,Be.current=null,bt?.disconnect()}},[n,R,f,g,T]),Kt(()=>{if(P||Ce==null)return;on(!1)},[on,P,Ce]);let Fa=Nn(()=>Ce==null?null:`${Ce.path}::${Ce.source}`,[Ce]);Kt(()=>{if(Fa==null){k?.clearSlotContent(Cr);return}let S=_n.current;if(S==null)return;let M=F.current??B.current;if(M==null)return;let ee={anchorElement:M,anchorRect:S.anchorRect??mm(M.getBoundingClientRect()),close:(G)=>{Qo.current(G?.restoreFocus??!0)},restoreFocus:()=>{if(!Sr.current)return;Ta.current(_n.current?.path??null)}},q=t?.contextMenu?.render?.(S.item,ee)??null;return k?.setSlotContent(Cr,q),t?.contextMenu?.onOpen?.(S.item,ee),zd(q),queueMicrotask(()=>{if(q==null||!q.isConnected)return;if(document.activeElement!==q)return;zd(q)}),()=>{k?.clearSlotContent(Cr)}},[Fa,t?.contextMenu,k]),Kt(()=>{if(Ce!=null&&n.getItem(Ce.path)==null)on()},[on,Ce,n]),Kt(()=>{if(Ce==null)return;let S=X.current?.getRootNode(),M=S instanceof ShadowRoot?S.host:X.current,ee=(G)=>{let ie=G.target;if(!(ie instanceof Node))return;if(Ld(G))return;if(B.current?.contains(ie)===!0)return;if(M?.contains(ie)===!0)return;on()},q=(G)=>{if(G.key==="Escape")G.preventDefault(),G.stopPropagation(),on()};return document.addEventListener("mousedown",ee,!0),document.addEventListener("keydown",q,!0),()=>{document.removeEventListener("mousedown",ee,!0),document.removeEventListener("keydown",q,!0)}},[on,Ce]),Kt(()=>{let S=fe.current,M=X.current;if(S==null||M==null){ve.current=ge;return}let ee=ge==null?null:Le.current.get(ge)??null,q=Pi(M),G=q?.dataset.itemPath??null,ie=Xo&&H.current===q,je=v&&vt.current===q,re=Re.current&&!yn,Te=St.current??0,Oe=mn.current,Ae=tr.current,lt=gn.current,Mt=nr.current,hn=q!=null,bt=ke.current||hn,_e=ve.current!==ge,dt=Ae!=null&&Ae===ge&&ge!=null,Bt=!1,Yi=!1;if(rr!=null&&rr.id!==Ye.current){Ye.current=rr.id;let es=rr.visibleIndex,Oa=n.getVisibleRows(es,es)[0]??null;if(Oa!=null){let Uh=T?Math.max(0,Math.min(Oa.ancestorPaths.length*f,Math.max(0,Tt-f))):wr;Bt=!0,Yi=md(S,es,f,Tt,ir,rr.offset,Uh)}n.clearScrollRequest(rr.id)}let Qi=!Bt&&re&&Hr(S,De,f,Tt,ir,Te),pt=!Bt&&Oe!=null&&Oe===ge&&Hr(S,De,f,Tt,ir,wr),bn=!Bt&<!=null&<.path===ge&&Hr(S,De,f,Tt,ir,lt.viewportOffset),Zi=!Bt&&Mt!=null&&Mt.path===ge&&S.scrollTop!==Mt.scrollTop;if(Zi)S.scrollTop=Mt.scrollTop;if(Zi||Yi||pt||bn||Qi||bt&&_e&&Oe!==ge&&!dt&&Ys(S,De,f,Tt,wr))Ie.current();if(Bt){ve.current=ge;return}if(!bt){ve.current=ge;return}if(ie){ve.current=ge;return}if(je&&!re){ve.current=ge;return}if(ee==null){if(re&&De>=0)Hr(S,De,f,Tt,ir,Te),Ie.current();ve.current=ge;return}if(_e||re||Oe===ge||Ae===ge||lt?.path===ge||Mt?.path===ge||G==null||G!==ge){if(ur(ee),Oe===ge)mn.current=null;if(Ae===ge)tr.current=null;if(lt?.path===ge)gn.current=null;if(Mt?.path===ge)nr.current=null;Re.current=!1,St.current=null}ve.current=ge},[n,De,ge,Yo,f,Xo,yn,un,Tt,v,rr,T,wr,ir,zi]);let Ih=De>=0&&De>=kt.visible.startIndex&&De<=kt.visible.endIndex,kh=ge!=null&&ai.some((S)=>qr(S.row)===ge),Ch=Ih||kh,xh=z&&ke.current===!0&&Ch?ge:null,_h=Oi==="pointer"?Zr:null,or=Ce?.path??ei.current??_h??xh??Zr,La=Ce?.source==="right-click";Kt(()=>{if(D.current&&Ce==null)return;li(Tn(or))},[Ce,Tn,un,Tt,jo,ai,or,li,zi]);let Eh=Pt((S)=>{if(D.current)return;if(Ld(S))return;let M=S.target;if(!(M instanceof HTMLElement))return;if(M.closest?.('[data-type="context-menu-trigger"]')!=null)return;let ee=M.closest?.('[data-file-tree-sticky-row="true"]'),q=M.closest?.('[data-type="item"]'),G=ee instanceof HTMLElement?ee.dataset.fileTreeStickyPath??null:q instanceof HTMLElement?q.dataset.itemPath??null:null;if(G!=null)Cn((ie)=>ie==="pointer"?ie:"pointer");Hn((ie)=>ie===G?ie:G)},[]),Th=Pt(()=>{Hn(null)},[]);Kt(()=>{if(!Pn)return;let S=()=>{di(),n.cancelDrag()};return window.addEventListener("dragend",S),()=>{window.removeEventListener("dragend",S),di(),n.cancelDrag()}},[n,Pn]);let Ph=(S)=>{if(!Pn||n.getDragSession()==null||Et.current)return;let M=Ad(S.target instanceof HTMLElement?S.target:null);if(n.setDragTarget(M),Zo(n.getDragSession()?.target??null),Aa(S.clientX,S.clientY),S.dataTransfer!=null)S.dataTransfer.dropEffect="move";S.preventDefault()},Rh=(S)=>{if(!Pn||n.getDragSession()==null||Et.current)return;let M=S.relatedTarget;if(M instanceof Node&&X.current?.contains(M)===!0)return;qn(),ci(),n.setDragTarget(null)},Dh=(S)=>{if(!Pn||n.getDragSession()==null||Et.current)return;S.preventDefault(),Ui(S.clientX,S.clientY),n.completeDrag(),Ki(),qn(),ci(),Rt.current=null},ui=kt.window.height,Mh=kt.window.offsetTop,Ah=Math.min(0,Tt-ui),Nh=Math.min(0,Tt-ui-wr),Fh=er===ge||Re.current,Ir=ge!=null&&Fh&&!Yo&&De>=0?zi[De]??n.getVisibleRows(De,De)[0]??null:null,Ba=Ir==null?null:Qs(De,f,un,ui),zn=Rt.current,Lh=si!=null&&zn!=null&&zn.path===si&&zn.index>=un.start&&zn.index<=un.end,hi=si!=null&&zn!=null&&zn.path===si&&!Lh&&zn.path!==Ir?.path?zn:null,Ha=hi==null?null:Qs(hi.index,f,un,ui),Bh=hm((De>=0?zi[De]??n.getVisibleRows(De,De)[0]??null:null)?.ancestorPaths.at(-1)??null),Hh=yn&&ge!=null?jd(h,ge,!Yo):void 0,Vh=Ce?.path??(yn?ge:er),Oh=Ce?.path??Zr,fi=Tn(or),Jo=P&&z&&!La&&!Xo&&fi!=null&&Jr!=null&&or!=null,qh=P&&(Jo||Ce!=null),Gi=Ce?.anchorRect,Va=Gi==null&&fi!=null&&Jr!=null&&(Ce!=null||Jo)?Jr:null,zh=Gi!=null?{left:`${Gi.left}px`,position:"fixed",right:"auto",top:`${Gi.top}px`}:Va!=null?{top:`${Va}px`}:void 0,Wh=La?{opacity:"0"}:void 0,$h=Pt((S,M,ee,q)=>{let G=bd({event:{ctrlKey:S.ctrlKey,metaKey:S.metaKey,shiftKey:S.shiftKey},isDirectory:M.kind==="directory",isSearchOpen:yn,mode:q}),ie=G.toggleDirectory&&M.kind==="directory",je=ie?n.resolveMountedDirectoryPathFromInput(ee):null;if(ie&&je==null)return;let re=je??ee;switch(G.selection.kind){case"range":n.selectPathRange(re,G.selection.additive);break;case"toggle":n.togglePathSelectionFromInput(re);break;case"single":n.selectOnlyMountedPathFromInput(re);break}let Te=S.currentTarget instanceof HTMLElement?S.currentTarget:null,Oe=M.index>=kt.visible.startIndex&&M.index<=kt.visible.endIndex,Ae=q==="flow"&&Oe&&Te!=null&&Te.dataset.itemParked!=="true";if(n.focusMountedPathFromInput(re),Ae)ke.current=!0,nn((lt)=>lt===re?lt:re),Cn("focus");if(ie)n.toggleMountedDirectoryFromInput(re);if(G.closeSearch)n.closeSearch();if(G.revealCanonical)ji(re,{targetOffset:"sticky-parents"})},[n,yn,kt.visible.endIndex,kt.visible.startIndex,ji]),jh=()=>{if(D.current)return;if(!z)return;if(or==null||fi==null)return;let S=n.getItem(or);if(S==null)return;li(fi),Sr.current=!0,mr({anchorRect:null,item:{kind:S.isDirectory()?"directory":"file",name:fi.getAttribute("aria-label")??or,path:S.getPath()},path:S.getPath(),source:"button"})},Xi={contextHoverPath:Oh,contextMenuButtonTriggerEnabled:z,contextMenuButtonVisibility:J,contextMenuEnabled:P,contextMenuRightClickEnabled:Se,contextMenuTriggerMode:K,controller:n,directoriesWithGitChanges:l,dragAndDropEnabled:Pn,draggedPathSet:uh,dragTarget:hh,gitLaneActive:qi,gitStatusByPath:s,handleRowDragEnd:wh,handleRowDragStart:bh,handleRowTouchStart:Sh,ignoredGitDirectories:a,ignoredInheritanceCache:pr,instanceId:h,itemHeight:f,onKeyDown:Na,onRowClick:$h,openContextMenuForRow:Pa,registerButton:Lt,registerRenameInput:vr,renameView:ii,renderDecorationForRow:mh,resolveIcon:yr,shouldSuppressContextMenu:vh,visualFocusPath:Vh},Kh={...Xi,registerButton:On};return O("div",{ref:X,id:xa,"data-file-tree-context-menu-button-visibility":P&&z?J:void 0,"data-file-tree-context-menu-trigger-mode":P?K:void 0,"data-file-tree-has-context-menu-action-lane":P&&z?"true":void 0,"data-file-tree-has-git-lane":qi?"true":void 0,"data-file-tree-virtualized-root":"true",onDragLeave:Pn?Rh:void 0,onDragOver:Pn?Ph:void 0,onDrop:Pn?Dh:void 0,onKeyDown:Na,onPointerLeave:P?Th:void 0,onPointerOver:P?Eh:void 0,role:"tree",tabIndex:-1,style:{outline:"none",position:"relative"},children:[O("style",{"data-file-tree-guide-style":"true",dangerouslySetInnerHTML:{__html:Bh}}),O("slot",{name:kr,"data-type":"header-slot"}),v?O("div",{"data-file-tree-search-container":!0,"data-open":yn?"true":"false",children:O("input",{ref:vt,"aria-activedescendant":Hh,"aria-controls":xa,placeholder:"Search…","data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":ct?"true":void 0,value:dh,onBlur:()=>{if(I==="retain"&&!ni.current)return;n.closeSearch()},onFocus:Vn,onPointerDown:Vn,onInput:(S)=>{Vn();let M=S.currentTarget;n.setSearch(M.value)}})}):null,O("div",{ref:fe,"data-file-tree-virtualized-scroll":"true",children:[T&&Uo&&ai.length>0?O("div",{"aria-hidden":"true","data-file-tree-sticky-overlay":"true",children:O("div",{"data-file-tree-sticky-overlay-content":"true",style:{height:`${fh}px`},children:ai.map((S,M)=>Ro(Kh,S.row,`sticky:${qr(S.row)}`,{mode:"sticky",style:{left:"0",position:"absolute",right:"0",top:`${S.top}px`,zIndex:`${ai.length-M}`}}))})}):null,O("div",{ref:N,"data-file-tree-virtualized-list":"true",style:{height:`${ir}px`},children:[O("div",{"data-file-tree-virtualized-sticky-offset":"true","aria-hidden":"true",style:{height:`${Mh}px`}}),O("div",{"data-file-tree-virtualized-sticky":"true",style:{height:`${ui}px`,top:`${Ah}px`,bottom:`${Nh}px`},children:[km(Xi,un,Wi),Ir!=null&&Ba!=null?Ro(Xi,Ir,`parked:${Ir.path}`,{isParked:!0,style:{left:"0",opacity:"0",pointerEvents:si===Ir.path?"none":void 0,position:"absolute",right:"0",top:`${Ba}px`}}):null,hi!=null&&Ha!=null?Ro(Xi,hi,`parked-drag:${hi.path}`,{isParked:!0,style:{left:"0",opacity:"0",pointerEvents:"none",position:"absolute",right:"0",top:`${Ha}px`}}):null]})]})]}),P?O("div",{ref:B,"data-type":"context-menu-anchor","data-visible":qh?"true":"false",style:zh,children:[O("button",{ref:F,type:"button","data-type":cs,"aria-label":"Options","aria-haspopup":"menu","aria-expanded":Ce!=null?"true":"false","data-visible":Jo?"true":"false",onMouseDown:(S)=>{S.preventDefault()},onClick:(S)=>{if(S.preventDefault(),S.stopPropagation(),Ce!=null){on();return}jh()},tabIndex:-1,style:Wh,children:O(Lr,{...yr("file-tree-icon-ellipsis")})}),Ce!=null?O("slot",{name:Cr}):null]}):null,Ce!=null?O("div",{"data-type":"context-menu-wash","aria-hidden":"true",onMouseDownCapture:(S)=>{S.preventDefault(),on()},onTouchStartCapture:(S)=>{S.preventDefault(),S.stopPropagation(),on()},onTouchMoveCapture:(S)=>{S.preventDefault(),S.stopPropagation()},onWheelCapture:(S)=>{S.preventDefault(),S.stopPropagation()}}):null]})}var oa={hydrateRoot:(t,n)=>{Jc(Fr(Do,n),t)},renderRoot:(t,n)=>{Eo(Fr(Do,n),t)},unmountRoot:(t)=>{Eo(null,t)}};function zr(t,n){oa.renderRoot(t,n)}function Kd(t,n){oa.hydrateRoot(t,n)}function Ud(t){oa.unmountRoot(t)}var Gd=class{#e=new Map;#t=null;clearAll(){for(let t of this.#e.values())t.remove();this.#e.clear()}clearSlotContent(t){let n=this.#c(t);if(n==null)return;n.remove(),this.#e.delete(t)}setHost(t){if(this.#t=t,t==null)return;this.#a(t);for(let[n,s]of this.#e)this.#d(n,s)}setSlotContent(t,n){let s=this.#c(t);if(s===n){if(n!=null)this.#e.set(t,n),this.#d(t,n);return}if(s?.remove(),n==null){this.#e.delete(t);return}this.#e.set(t,n),this.#d(t,n)}setSlotHtml(t,n){let s=n?.trim()??"";if(s.length===0){this.setSlotContent(t,null);return}let a=this.#c(t);if(a!=null&&a.innerHTML===s){this.#e.set(t,a),this.#d(t,a);return}let l=document.createElement("div");l.innerHTML=s,this.setSlotContent(t,l)}#c(t){let n=this.#e.get(t)??null;if(n!=null)return n;let s=this.#t;if(s==null)return null;for(let a of Array.from(s.children)){if(!(a instanceof HTMLElement))continue;if(a.dataset.fileTreeManagedSlot===t)return a}return null}#d(t,n){if(n.slot=t,n.dataset.fileTreeManagedSlot=t,this.#t!=null&&n.parentNode!==this.#t)this.#t.appendChild(n)}#a(t){for(let n of Array.from(t.children)){if(!(n instanceof HTMLElement))continue;let s=n.dataset.fileTreeManagedSlot;if(s==null||this.#e.has(s))continue;this.#e.set(s,n)}}};function Fn(t,n,s){if(!t.s){if(s instanceof Cm){if(!s.s)return void(s.o=Fn.bind(null,t,n));1&n&&(n=s.s),s=s.v}if(s&&s.then)return void s.then(Fn.bind(null,t,n),Fn.bind(null,t,2));t.s=n,t.v=s;let a=t.o;a&&a(t)}}var Cm=function(){function t(){}return t.prototype.then=function(n,s){var a=new t,l=this.s;if(l){var d=1&l?n:s;if(d){try{Fn(a,1,d(this.v))}catch(h){Fn(a,2,h)}return a}return this}return this.o=function(h){try{var f=h.v;1&h.s?Fn(a,1,n?n(f):f):s?Fn(a,1,s(f)):Fn(a,2,f)}catch(g){Fn(a,2,g)}},a},t}();var Xd=0;function xm(t){if(t!=null&&t.length>0)return t;return Xd+=1,`pst_ft_${Xd}`}function _m({initialVisibleRowCount:t,itemHeight:n}){return t==null?420:Math.max(0,t)*(n??xi)}function Yd(t){if(typeof document>"u")return;let n=document.createElement("div");n.innerHTML=t;let s=n.querySelector("svg");return s instanceof SVGElement?s:void 0}function Qd(t){return t.querySelector("#file-tree-icon-chevron")instanceof SVGElement&&t.querySelector("#file-tree-icon-file")instanceof SVGElement&&t.querySelector("#file-tree-icon-dot")instanceof SVGElement&&t.querySelector("#file-tree-icon-lock")instanceof SVGElement}function Zd(t){return Array.from(t.children).filter((n)=>n instanceof SVGElement)}var Di=class{static LoadedCustomComponent=!0;#e;#t;#c;#d;#a;#V;#O;#v;#r;#y=new Gd;#T;#b;#m;#h;#w;#S;#f;#q;#z;#N=null;#i;#W=!1;#$=!1;constructor(t){let{composition:n,density:s,fileTreeSearchMode:a,gitStatus:l,id:d,initialSearchQuery:h,icons:f,itemHeight:g,onSearchChange:b,onSelectionChange:w,overscan:I,renderRowDecoration:v,renaming:_,search:k,searchBlurBehavior:T,searchFakeFocus:R,stickyFolders:B,unsafeCSS:F,initialVisibleRowCount:D,...N}=t;this.#e=n,this.#c=xm(d),this.#h=Fs(l),this.#w=f,this.#S=F,this.#d=w,this.#a=v,this.#V=_!=null&&_!==!1,this.#O=T,this.#v=k===!0,this.#r=R===!0,this.#T=yc(s,g),this.#b={itemHeight:this.#T.itemHeight,overscan:I,stickyFolders:B,initialVisibleRowCount:D},this.#t=new Dc({...N,fileTreeSearchMode:a,initialSearchQuery:h,onSearchChange:b,renaming:_}),this.#z=this.#t.getSelectionVersion(),this.#N=this.#d==null?null:this.subscribe(()=>{this.#R()})}unmount(){if(this.#i!=null)Ud(this.#i),delete this.#i.dataset.fileTreeVirtualizedWrapper,this.#i=void 0;if(this.#y.clearAll(),this.#y.setHost(null),this.#m!=null)delete this.#m.dataset.fileTreeVirtualized,this.#L(this.#m),this.#m=void 0}cleanUp(){this.unmount(),this.#N?.(),this.#N=null,this.#t.destroy()}getFileTreeContainer(){return this.#m}getItem(t){return this.#t.getItem(t)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(t,n){return this.#t.getVisibleRows(t,n)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#T.itemHeight}getDensityFactor(){return this.#T.factor}subscribe(t){let n=!1;return this.#t.subscribe(()=>{if(!n){n=!0;return}t()})}focusPath(t){this.#t.focusPath(t)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(t,n){this.#t.scrollToPath(t,n)}focusNearestPath(t){return this.#t.focusNearestPath(t)}add(t){this.#t.add(t)}batch(t){this.#t.batch(t)}applyGitStatusPatch(t){let n=Fc(this.#h,t);if(n===this.#h)return;this.#h=n;let s=this.#s();if(s==null)return;zr(s.wrapper,this.#P())}move(t,n,s){this.#t.move(t,n,s)}onMutation(t,n){return this.#t.onMutation(t,n)}setSearch(t){this.#t.setSearch(t)}openSearch(t){this.#t.openSearch(t)}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(t,n){return this.#t.startRenaming(t,n)}remove(t,n){this.#t.remove(t,n)}resetPaths(t,n){if(Array.isArray(t))this.#t.resetPaths(t,n);else this.#t.resetPaths(t)}setComposition(t){this.#e=t;let n=this.#s();if(n==null)return;this.#x(),zr(n.wrapper,this.#P())}setGitStatus(t){let n=Fs(t,this.#h);if(n===this.#h)return;this.#h=n;let s=this.#s();if(s==null)return;zr(s.wrapper,this.#P())}setIcons(t){this.#w=t;let n=this.#s();if(n==null)return;this.#g(n.host,n.wrapper),zr(n.wrapper,this.#P())}hydrate({fileTreeContainer:t}){let n=this.#M(t),s=this.#F(n);this.#x(),Kd(s,this.#P())}render({containerWrapper:t,fileTreeContainer:n}){let s=this.#M(n??this.#m,t),a=this.#F(s);this.#x(),zr(a,this.#P())}#Z(){return{initialViewportHeight:_m({initialVisibleRowCount:this.#b.initialVisibleRowCount,itemHeight:this.#b.itemHeight}),itemHeight:this.#b.itemHeight,overscan:this.#b.overscan,stickyFolders:this.#b.stickyFolders}}#P(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#h?.statusByPath,ignoredGitDirectories:this.#h?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#h?.directoriesWithChanges,icons:this.#w,instanceId:this.#c,renamingEnabled:this.#V,renderRowDecoration:this.#a,searchBlurBehavior:this.#O,searchEnabled:this.#v,searchFakeFocus:this.#r,slotHost:this.#y,...this.#Z()}}#s(){let t=this.#m,n=this.#i;if(t==null||n==null)return null;return{host:t,wrapper:n}}#g(t,n){let s=t.shadowRoot;if(s!=null)this.#j(s),this.#K(s);this.#U(n)}#R(){let t=this.#d;if(t==null)return;let n=this.#t.getSelectionVersion();if(n===this.#z)return;this.#z=n,t(this.#t.getSelectedPaths())}#x(){let t=this.#e?.header?.render;if(t!=null){this.#y.setSlotContent(kr,t());return}this.#y.setSlotHtml(kr,this.#e?.header?.html??null)}#j(t){let n=Zd(t).find((a)=>Qd(a)),s=Yd(ss(xr(this.#w).set));if(s==null)return;if(n!=null&&n.outerHTML===s.outerHTML)return;if(n!=null)n.replaceWith(s);else t.prepend(s)}#K(t){let n=Zd(t),s=n.find((h)=>Qd(h)),a=n.filter((h)=>h!==s),l=xr(this.#w).spriteSheet?.trim()??"";if(l.length===0){for(let h of a)h.remove();return}let d=Yd(l);if(d==null){for(let h of a)h.remove();return}if(a.length===1&&a[0].outerHTML===d.outerHTML)return;for(let h of a)h.remove();t.appendChild(d)}#U(t){let n=xr(this.#w);if(n.colored&&ja(n.set))t.dataset.fileTreeColoredIcons="true";else delete t.dataset.fileTreeColoredIcons}#l(t){let n=t.querySelector(`style[${ro}]`);if(this.#f==null&&n instanceof HTMLStyleElement)this.#f=n;if(this.#S==null||this.#S===""){this.#f?.remove(),this.#f=void 0,this.#q=void 0;return}if(this.#f?.parentNode===t&&this.#q===this.#S)return;if(this.#f??=document.createElement("style"),this.#f.setAttribute(ro,""),this.#f.parentNode!==t)t.appendChild(this.#f);this.#f.textContent=bc(this.#S),this.#q=this.#S}#F(t){if(this.#i!=null)return this.#i;let n=t.shadowRoot;if(n==null)throw Error("FileTree requires a shadow root");let s=Array.from(n.children).filter((l)=>l instanceof HTMLDivElement&&typeof l.dataset.fileTreeId==="string"&&l.dataset.fileTreeId.length>0),a=s.find((l)=>l.dataset.fileTreeId===this.#c)??s[0];if(a!=null)this.#c=a.dataset.fileTreeId??this.#c;if(this.#i=a??document.createElement("div"),this.#i.dataset.fileTreeId=this.#c,this.#i.dataset.fileTreeVirtualizedWrapper="true",this.#g(t,this.#i),this.#i.parentNode!==n)n.appendChild(this.#i);return this.#i}#M(t,n){let s=t??this.#m??document.createElement("file-tree-container");if(n!=null&&s.parentNode!==n)n.appendChild(s);let a=s.shadowRoot??s.attachShadow({mode:"open"});return yo(s,a),this.#l(a),s.dataset.fileTreeVirtualized="true",s.style.display="flex",this.#C(s),this.#y.setHost(s),this.#m=s,s}#C(t){if(t.style.getPropertyValue("--trees-item-height")==="")t.style.setProperty("--trees-item-height",`${String(this.#T.itemHeight)}px`),this.#W=!0;if(t.style.getPropertyValue("--trees-density-override")==="")t.style.setProperty("--trees-density-override",String(this.#T.factor)),this.#$=!0}#L(t){if(this.#W)t.style.removeProperty("--trees-item-height"),this.#W=!1;if(this.#$)t.style.removeProperty("--trees-density-override"),this.#$=!1}};var Jd=["--trees-bg-override: var(--surface-pane)","--trees-bg-muted-override: var(--surface-muted)","--trees-border-color-override: transparent","--trees-fg-override: var(--text)","--trees-font-family-override: var(--font-sans)","--trees-focus-ring-color-override: var(--text-muted)","--trees-padding-inline-override: 8px","--trees-scrollbar-gutter-override: 4px","--trees-search-bg-override: light-dark(var(--surface-base), var(--surface-control))","--trees-selected-bg-override: var(--selection)","--trees-selected-focused-border-color-override: var(--text-muted)"].join("; "),sa=`
|
|
1285
|
+
}`}var Ic=new WeakMap;function ap(t){let n=Ic.get(t);if(n!=null)return n;let s=document.createElement("div");s.setAttribute(as,"true");let a=document.createElement("div");a.style.position="relative",a.style.height="200%",s.appendChild(a),t.appendChild(s);let l=Math.max(s.offsetWidth-s.clientWidth,0);return s.remove(),Ic.set(t,l),l}function kc(t,n){if(!t.isConnected)return;let s=ap(n);if(s==null)return;let a=n.querySelector(`style[${ro}]`),l=a instanceof HTMLStyleElement?a:document.createElement("style");if(!(a instanceof HTMLStyleElement))l.setAttribute(ro,""),n.appendChild(l);l.textContent=`:host { ${ls}: ${s}px; }`}var go;function lp(t){if(typeof CSSStyleSheet<"u"&&typeof CSSStyleSheet.prototype.replaceSync==="function"&&"adoptedStyleSheets"in t){if(go==null)go=new CSSStyleSheet,go.replaceSync(mo(po));let n=!1;try{t.adoptedStyleSheets=[go],n=!0}catch{}if(n){t.querySelector(`style[${mi}]`)?.remove();return}}if(t.querySelector("style[data-file-tree-style]")==null){let n=document.createElement("style");n.setAttribute(mi,""),n.textContent=mo(po),t.prepend(n)}}function vo(t,n){cp(t,n),lp(n),kc(t,n)}function cp(t,n){let s=t.querySelector('template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]');if(!(s instanceof HTMLTemplateElement))return;if(n.childNodes.length>0)return;if(n.appendChild(s.content.cloneNode(!0)),s.hasAttribute("shadowrootmode"))s.remove()}if(typeof HTMLElement<"u"&&customElements.get("file-tree-container")==null){class t extends HTMLElement{constructor(){super()}connectedCallback(){let n=this.shadowRoot??this.attachShadow({mode:"open"});vo(this,n)}}if(customElements.define(to,t),typeof document<"u")for(let n of Array.from(document.querySelectorAll(to))){if(!(n instanceof HTMLElement))continue;vo(n,n.shadowRoot??n.attachShadow({mode:"open"}))}}var Cc=(t)=>t.startsWith("f::")?t.slice(3):t;function dp(t){let n=t.lastIndexOf("/");if(n<0)return{parentPath:"",baseName:t};return{parentPath:t.slice(0,n),baseName:t.slice(n+1)}}function up(t,n){return t===""?n:`${t}/${n}`}function xc({files:t,path:n,isFolder:s,nextBasename:a}){let l=Cc(n),d=a.trim();if(d.length===0)return{error:"Name cannot be empty."};if(d.includes("/"))return{error:'Name cannot include "/".'};let{parentPath:h,baseName:f}=dp(l);if(d===f)return{nextFiles:t,sourcePath:l,destinationPath:l,isFolder:s};let g=up(h,d),b=Array(t.length),w=new Set;if(!s){let k=`${g}/`,T=!1;for(let R=0;R<t.length;R++){let B=t[R];if(B!==l&&B.startsWith(k))return{error:`"${g}" already exists.`};let F=B===l?g:B;if(w.has(F))return{error:`"${g}" already exists.`};if(w.add(F),b[R]=F,B===l)T=!0}if(!T)return{error:"Could not find the selected file to rename."};return{nextFiles:b,sourcePath:l,destinationPath:g,isFolder:s}}let I=`${l}/`,v=`${g}/`,_=0;for(let k=0;k<t.length;k++){let T=t[k],R=T===l||T.startsWith(I);if(!R&&(T===g||T.startsWith(v)))return{error:`"${g}" already exists.`};let B=R?`${g}${T.slice(l.length)}`:T;if(w.has(B))return{error:`"${g}" already exists.`};if(w.add(B),b[k]=B,R)_++}if(_===0)return{error:"Could not find the selected folder to rename."};return{nextFiles:b,sourcePath:l,destinationPath:g,isFolder:s}}function hp(t){return t.endsWith("/")}function fp(t){let n=t.endsWith("/")?t.slice(0,-1):t,s=n.lastIndexOf("/"),a=s<0?n:n.slice(s+1);return t.endsWith("/")?`${a}/`:a}function pp(t){let n=[],s=new Set;for(let l of t){if(s.has(l))continue;s.add(l),n.push(l)}let a=new Set;for(let l of n.toSorted((d,h)=>{if(d.length!==h.length)return d.length-h.length;return d.localeCompare(h)})){let d=(l.endsWith("/")?l.slice(0,-1):l).split("/"),h=!1;for(let f=0;f<d.length-1;f+=1){let g=`${d.slice(0,f+1).join("/")}/`;if(!a.has(g))continue;h=!0;break}if(h)continue;a.add(l)}return n.filter((l)=>a.has(l))}function _c(t,n){return n.includes(t)?pp(n):[t]}function Ec(t,n){if(t===n)return!0;if(t==null||n==null)return!1;return t.kind===n.kind&&t.directoryPath===n.directoryPath&&t.flattenedSegmentPath===n.flattenedSegmentPath&&t.hoveredPath===n.hoveredPath}function _s(t,n){return{draggedPaths:t,target:n}}function Es(t,n){if(n.kind!=="directory"||n.directoryPath==null)return!1;for(let s of t){if(!hp(s))continue;if(n.directoryPath===s||n.directoryPath.startsWith(s))return!0}return!1}function mp(t,n){if(n.kind==="root"||n.directoryPath==null)return fp(t);return n.directoryPath}function Tc(t,n){let s=t.map((a)=>{let l=mp(a,n);if(l===a)return null;return{from:a,to:l,type:"move"}}).filter((a)=>a!=null);if(s.length===0)return null;return{operations:s,result:{draggedPaths:t,operation:s.length===1?"move":"batch",target:n}}}function gp(t,n){if(t===n)return!0;if(t.length!==n.length)return!1;for(let s=0;s<t.length;s+=1)if(t[s]!==n[s])return!1;return!0}function Ts(t,n,s){let{paths:a,preparedInput:l}=t;if(l==null){if(a==null)throw Error("FileTree requires paths or preparedInput");return{paths:a,preparedInput:void 0}}let d=l.paths;if(a==null)return{paths:d,preparedInput:l};if(!gp(Lr.preparePaths(a,s==null?{}:{sort:s}),d))throw Error(`FileTree ${n} received paths and preparedInput for different path lists`);return{paths:d,preparedInput:l}}function Ps(t){return t.operation==="add"||t.operation==="remove"||t.operation==="move"||t.operation==="batch"}function vp(t,n,s){if(t===n)return s;let a=n.endsWith("/")?n:`${n}/`;if(!t.startsWith(a))return t;return`${s.endsWith("/")?s:`${s}/`}${t.slice(a.length)}`}function yp(t,n){if(t===n)return!0;let s=n.endsWith("/")?n:`${n}/`;return t.startsWith(s)}function Br(t,n,s=!1){if(t==null)return null;switch(n.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 t;case"remove":return yp(t,n.path)?s?t:null:t;case"move":return vp(t,n.from,n.to);case"batch":{let a=t;for(let l of n.events)if(a=Br(a,l,s),a==null)return null;return a}}}function yo(t){return{canonicalChanged:t.canonicalChanged,projectionChanged:t.projectionChanged,visibleCountDelta:t.visibleCountDelta}}function Pc(t){switch(t.operation){case"add":return{...yo(t),operation:"add",path:t.path};case"remove":return{...yo(t),operation:"remove",path:t.path,recursive:t.recursive};case"move":return{...yo(t),from:t.from,operation:"move",to:t.to}}}function bp(t){return{...yo(t),events:t.events.filter((n)=>n.operation==="add"||n.operation==="remove"||n.operation==="move").map((n)=>Pc(n)),operation:"batch"}}function Rc(t){switch(t.operation){case"add":case"remove":case"move":return Pc(t);case"batch":return bp(t);default:return null}}function bo(t,n){if(t.size!==n.length)return!1;for(let s of n)if(!t.has(s))return!1;return!0}function Mn(t){let n=t.endsWith("/")?t.slice(0,-1):t;if(n.length===0)return[];let s=n.split("/");return s.slice(0,-1).map((a,l)=>`${s.slice(0,l+1).join("/")}/`)}function wo(t){return Mn(t).at(-1)??null}function Rs(t,n){if(n==null)return t;return t.startsWith(n)?t.slice(n.length):t}function xi(t){return t.endsWith("/")}var Ds=(t)=>t.toLowerCase();function Dc(t){let n=t.endsWith("/")?t.slice(0,-1):t,s=n.lastIndexOf("/");return s<0?n:n.slice(s+1)}function Ms(t){return t.endsWith("/")?t.slice(0,-1):t}function As(t,n){return n&&!t.endsWith("/")?`${t}/`:t}var Mc=(t)=>{let n=t.trim();if(n.length===0)return"";return(n.includes("\\")?n.replaceAll("\\","/"):n).toLowerCase()};var Ns=Symbol("FILE_TREE_RENAME_VIEW"),wp=512,Sp=512;function Ip(t){return t==="top"||t==="center"?t:"nearest"}function kp(t,n,s){if(t===0)return-1;if(s!=null){let a=n(s);if(a!=null)return a;let l=Mn(s);for(let d=l.length-1;d>=0;d-=1){let h=l[d];if(h==null)continue;let f=n(h);if(f!=null)return f}}return 0}function Cp(t,n,s){if(t.paths.length===0)return{focusedIndex:-1,getParentIndex:t.getParentIndex,paths:t.paths,posInSetByIndex:t.posInSetByIndex,setSizeByIndex:t.setSizeByIndex};if(n==null)return{focusedIndex:0,getParentIndex:t.getParentIndex,paths:t.paths,posInSetByIndex:t.posInSetByIndex,setSizeByIndex:t.setSizeByIndex};let a=s??((l)=>t.visibleIndexByPath.get(l)??null);return{focusedIndex:kp(t.paths.length,a,n),getParentIndex:t.getParentIndex,paths:t.paths,posInSetByIndex:t.posInSetByIndex,setSizeByIndex:t.setSizeByIndex}}var Ac=class t{static{Object.defineProperty(t.prototype,Ns,{configurable:!0,value(){return{cancel:()=>{this.#_e()},commit:()=>{this.#Ee()},getPath:()=>this.#s,getValue:()=>this.#g,isActive:()=>this.#s!=null,setValue:(n)=>{this.#Te(n)}}},writable:!0})}#e;#t=new Set;#c=new Map;#d=null;#a=null;#V=new Map;#O=new Map;#v=-1;#r=null;#y=!1;#T=(n)=>-1;#b=new Map;#m=null;#h=null;#w=null;#S=null;#f=null;#q;#z;#N;#i=[];#W=new Int32Array(0);#$=new Int32Array(0);#J=void 0;#P=!1;#s=null;#g="";#R=!1;#x=new Set;#j=[];#K;#U=null;#l=null;#F=null;#M=null;#C=null;#L=null;#Z=null;#xe=0;#I=null;#o=new Set;#G=0;#n;#ne=0;#re=!1;#p=0;#X;constructor(n){let{dragAndDrop:s,fileTreeSearchMode:a,initialSearchQuery:l,initialSelectedPaths:d,renaming:h,onSearchChange:f,paths:g,preparedInput:b,...w}=n,I=Ts({paths:g,preparedInput:b},"constructor",w.sort);if(this.#e=w,s!=null&&s!==!1)this.#d=s===!0?{}:s;if(this.#P=h!=null&&h!==!1,h!=null&&h!==!1&&h!==!0)this.#J=h.canRename,this.#z=h.onError,this.#q=h.onRename;this.#N=f,this.#K=a??"hide-non-matches",this.#n=this.#oe(I.paths,I.preparedInput);let v=d?.map((k)=>this.#A(k)).filter((k)=>k!=null)??[],_=v.at(-1)??null;if(v.length>0)this.#o=new Set(v),this.#I=_,this.#G=1;if(this.#H(_,!1),l!=null)this.#Y(l,!1);this.#X=this.#ke()}destroy(){this.#X?.(),this.#X=null,this.#c.clear(),this.#t.clear(),this.#b.clear(),this.#a=null,this.#ae()}focusFirstItem(){if(this.#_().length>0)this.#E(0)}focusLastItem(){if(this.#p<=0)return;this.#D(),this.#E(this.#p-1)}focusNextItem(){this.#Ie(1)}focusParentItem(){if(this.#r==null)return;let n=wo(this.#r);if(n==null)return;let s=this.#B(n);if(s>=0)this.#E(s)}focusPath(n){let s=this.#n.getPathInfo(n)?.path??null;if(s==null)return;this.#D();let a=this.#B(s);if(a>=0)this.#E(a)}scrollToPath(n,s){let a=this.#n.getPathInfo(n)?.path??null;if(a==null)return;this.#D();let l=this.#He(a);if(l<0)return;if(this.#le(l)==null)return;if(s?.focus!==!1)this.#E(l,!1);this.#Z={id:this.#xe+=1,offset:Ip(s?.offset),visibleIndex:l},this.#u()}focusMountedPathFromInput(n){let s=this.#n.getPathInfo(n)?.path??null;if(s==null)return;let a=this.#B(s);if(a>=0)this.#E(a)}focusNearestPath(n){let s=this.resolveNearestVisiblePath(n);if(s==null)return null;let a=this.#B(s);if(a>=0)return this.#E(a),this.#_()[a]??s;return null}focusPreviousItem(){this.#Ie(-1)}getFocusedIndex(){return this.#v}getFocusedItem(){return this.#r==null?null:this.#ce(this.#r)}getFocusedPath(){return this.#r}getScrollRequest(){return this.#Z}clearScrollRequest(n){if(this.#Z?.id===n)this.#Z=null}resolveNearestVisiblePath(n){let s=this.#_();if(this.#p===0)return null;if(n==null)return this.#r??s[0]??null;let a=this.#n.getPathInfo(n)?.path??n,l=this.#B(a);if(l>=0)return s[l]??a;let d=this.#Pe(a);if(d!=null)return d;return this.#r??s[0]??null}getSelectedPaths(){return[...this.#o]}getSelectionVersion(){return this.#G}getVisibleCount(){return this.#p}getVisibleRows(n,s){if(s<n||this.#p===0)return[];let a=Math.max(0,n),l=Math.min(this.#p-1,s);if(l<a)return[];let d=l-a+1;if(this.#C==null&&!this.#y&&l>=this.#i.length&&d<=Sp){let h=[];for(let f=a;f<=l;f+=1){let g=this.#n.getVisibleRowContext(f);if(g==null)break;h.push(this.#de(g))}return h}if(!this.#y&&l>=this.#i.length)this.#D();if(this.#C!=null){let h=Array.from({length:l-a+1},(w,I)=>this.#ve(a+I)),f=new Map,g=h[0]??-1,b=g;for(let w=1;w<=h.length;w+=1){let I=h[w];if(I!=null&&I===b+1){b=I;continue}if(g>=0)this.#n.getVisibleSlice(g,b).forEach((v,_)=>{f.set(g+_,v)});if(I==null){g=-1,b=-1;continue}g=I,b=I}return Array.from({length:l-a+1},(w,I)=>{let v=a+I,_=this.#ve(v),k=f.get(_),T=this.#i[_];if(k==null||T==null)throw Error(`Missing projection row for filtered visible index ${String(v)}`);return this.#ie(k,v,_,{ancestorPaths:this.#fe(_),path:T})})}return this.#n.getVisibleSlice(a,l).map((h,f)=>{let g=a+f,b=this.#i[g];if(b==null)throw Error(`Missing projection path for visible index ${String(g)}`);return this.#ie(h,g,g,{ancestorPaths:this.#fe(g),path:b})})}getStickyRowCandidates(n,s){if(this.#C!=null)return null;if(this.#p===0||n<=0||s<=0)return[];let a=[];for(let l=0;l<this.#p;l+=1){let d=n+l*s,h=Math.min(this.#p-1,Math.floor(d/s)),f=this.#ue(h,l)??(h>0?this.#ue(h-1,l):void 0);if(f==null)break;a.push({row:this.#de(f),subtreeEndIndex:f.subtreeEndIndex})}return a}getItem(n){let s=this.#n.getPathInfo(n);return s==null?null:this.#ce(s.path,s)}resolveMountedDirectoryPathFromInput(n){let s=this.#n.getPathInfo(n);return s?.kind==="directory"?s.path:null}toggleMountedDirectoryFromInput(n){let s=this.resolveMountedDirectoryPathFromInput(n);if(s==null)return;this.#Ce(s)}selectAllVisiblePaths(){this.#D();let n=[...this.#_()];this.#k(n,this.#r??this.#I)}selectOnlyPath(n){let s=this.#A(n);if(s==null)return;this.#k([s],s)}selectOnlyMountedPathFromInput(n){this.#k([n],n)}selectPath(n){let s=this.#A(n);if(s==null||this.#o.has(s))return;this.#k([...this.#o,s])}deselectPath(n){let s=this.#A(n);if(s==null||!this.#o.has(s))return;this.#k([...this.#o].filter((a)=>a!==s))}toggleFocusedSelection(){if(this.#r==null)return;this.togglePathSelectionFromInput(this.#r)}togglePathSelection(n){let s=this.#A(n);if(s==null)return;if(this.#o.has(s)){this.deselectPath(s);return}this.selectPath(s)}togglePathSelectionFromInput(n){let s=this.#A(n);if(s==null)return;if(this.#o.has(s)){this.#k([...this.#o].filter((a)=>a!==s),s);return}this.#k([...this.#o,s],s)}selectPathRange(n,s){let a=this.#A(n);if(a==null)return;this.#D();let l=this.#I,d=l==null?-1:this.#te(l),h=this.#te(a);if(d===-1||h===-1){let I=s?[...this.#o,a]:[a];this.#k(I,a);return}let[f,g]=d<=h?[d,h]:[h,d],b=this.#_().slice(f,g+1),w=s?[...this.#o,...b]:b;this.#k(w,l)}extendSelectionFromFocused(n){if(this.#r==null)return;let s=this.#v;if(s===-1)return;let a=Math.min(this.#p-1,Math.max(0,s+n));if(a===s)return;if(!this.#y&&a>=this.#i.length)this.#D();let l=this.#_(),d=l[s]??null,h=l[a]??null;if(d==null||h==null)return;let f=new Set(this.#o);if(f.has(d)&&f.has(h))f.delete(d);else f.add(h);this.#k([...f],this.#I??d,!1),this.#E(a)}getDragAndDropConfig(){return this.#d}isDragAndDropEnabled(){return this.#d!=null}getDragSession(){if(this.#a==null)return null;return{draggedPaths:[...this.#a.draggedPaths],primaryPath:this.#a.primaryPath,target:this.#a.target==null?null:{...this.#a.target}}}startDrag(n){if(this.#d==null)return!1;let s=this.#A(n);if(s==null)return!1;if(this.#l!=null&&this.#l.length>0)return!1;let a=this.getSelectedPaths(),l=_c(s,a);if(this.#d.canDrag?.(l)===!1)return!1;if(!a.includes(s))this.#k([s],s,!1);return this.#Q(s),this.#a={draggedPaths:l,primaryPath:s,target:null},this.#u(),!0}setDragTarget(n){let s=this.#a;if(s==null)return;let a=n;if(a!=null){let l=_s(s.draggedPaths,a);if(Es(s.draggedPaths,a)||this.#d?.canDrop?.(l)===!1)a=null}if(Ec(s.target,a))return;this.#a={...s,target:a},this.#u()}cancelDrag(){if(this.#a==null)return;this.#a=null,this.#u()}completeDrag(){let n=this.#a;if(n==null)return!1;this.#a=null;let s=n.target==null?null:{...n.target};if(s==null)return this.#u(),!1;let a=_s(n.draggedPaths,s);if(Es(n.draggedPaths,s)||this.#d?.canDrop?.(a)===!1)return this.#u(),!1;let l=Tc(n.draggedPaths,s);if(l==null)return this.#u(),!1;try{if(l.operations.length===1){let d=l.operations[0];if(d==null||d.type!=="move")throw Error("Expected a single move operation for one-item drops");this.#n.move(d.from,d.to,{collision:d.collision})}else this.#Me(l.operations),this.#n.batch(l.operations)}catch(d){return this.#u(),this.#d?.onDropError?.(d instanceof Error?d.message:String(d),a),!1}return this.#d?.onDropComplete?.(l.result),!0}subscribe(n){return this.#t.add(n),n(),()=>{this.#t.delete(n)}}add(n){this.#n.add(n)}remove(n,s={}){this.#n.remove(n,s)}move(n,s,a={}){this.#n.move(n,s,a)}batch(n){this.#n.batch(n)}onMutation(n,s){let a=n,l=s,d=this.#c.get(a);if(d==null)d=new Set,this.#c.set(a,d);return d.add(l),()=>{let h=this.#c.get(a);if(h?.delete(l),h?.size===0)this.#c.delete(a)}}setSearch(n){this.#Y(n,!0)}openSearch(n=""){this.#Y(n,!0)}closeSearch(){this.#Y(null,!0)}isSearchOpen(){return this.#l!==null}getSearchValue(){return this.#l??""}getSearchMatchingPaths(){return this.#j}focusNextSearchMatch(){this.#ye(1)}focusPreviousSearchMatch(){this.#ye(-1)}startRenaming(n=this.#r??"",s={}){if(!this.#P)return!1;let a=this.#n.getPathInfo(n);if(a==null)return!1;let l=a.path,d=xi(l),h=Ms(l);if(this.#J?.({isFolder:d,path:h})===!1)return!1;for(let f of Mn(l))if(!this.#n.isExpanded(f))this.#n.expand(f);if(this.#k([l],l,!1),this.#l!=null)this.#Y(null,!1),this.#N?.(this.#l);return this.#Q(l),this.#s=l,this.#g=Dc(l),this.#R=s.removeIfCanceled??!1,this.#u(),!0}#_e(){if(this.#s==null)return;let n=this.#s,s=this.#R;if(this.#s=null,this.#g="",this.#R=!1,s){this.remove(n,xi(n)?{recursive:!0}:void 0);return}this.#Q(n),this.#u()}#Ee(){let n=this.#s;if(n==null)return;if(this.#R&&this.#g.trim().length===0){this.#s=null,this.#g="",this.#R=!1,this.remove(n,xi(n)?{recursive:!0}:void 0);return}let s=xi(n),a=xc({files:this.#n.list(),isFolder:s,nextBasename:this.#g,path:Ms(n)});if(this.#s=null,this.#g="",this.#R=!1,"error"in a){this.#Q(n),this.#z?.(a.error),this.#u();return}if(a.sourcePath===a.destinationPath){this.#Q(n),this.#u();return}this.#q?.({destinationPath:a.destinationPath,isFolder:a.isFolder,sourcePath:a.sourcePath}),this.move(As(a.sourcePath,s),As(a.destinationPath,s))}#Te(n){if(this.#s==null||this.#g===n)return;this.#g=n,this.#u()}resetPaths(n,s={}){let a=!Array.isArray(n),l=a?void 0:n,d=a?n:s,h=this.#n.list().length,f=this.#p,g=Ts({paths:l,preparedInput:d.preparedInput},"resetPaths",this.#e.sort),b=this.#oe(g.paths,g.preparedInput,d.initialExpandedPaths),w=this.#r,I=this.#s,v=this.getSelectedPaths(),_=this.#I;this.#X?.(),this.#n=b,this.#b.clear(),this.#ae();let k=v.map((R)=>b.getPathInfo(R)?.path??null).filter((R)=>R!=null),T=!bo(this.#o,k);if(this.#o=new Set(k),T)this.#G+=1;if(this.#I=_==null?null:b.getPathInfo(_)?.path??null,this.#s=I==null?null:b.getPathInfo(I)?.path??null,this.#s==null)this.#g="",this.#R=!1;this.#H(w,w!=null||k.length>0||this.#I!=null),this.#X=this.#ke(),this.#u(),this.#we({canonicalChanged:!0,operation:"reset",pathCountAfter:g.paths.length,pathCountBefore:h,projectionChanged:!0,usedPreparedInput:d.preparedInput!=null,visibleCountDelta:this.#p-f})}#Pe(n){this.#D();let s=wo(n),a=Rs(n,s),l=null,d=null;for(let h of this.#_()){if(wo(h)!==s)continue;let f=Rs(h,s);if(f<a){l=h;continue}if(f>a){d=h;break}}return l??d}#B(n){let s=this.#te(n);if(s!==-1)return s;let a=Mn(n);for(let l=a.length-1;l>=0;l-=1){let d=a[l];if(d==null)continue;let h=this.#te(d);if(h!==-1)return h}return this.#_().length>0?0:-1}#ce(n,s){let a=this.#b.get(n);if(a!=null)return a;let l=s??this.#n.getPathInfo(n);if(l==null)return null;let d=l.kind==="directory"?this.#Re(l.path):this.#De(l.path);return this.#b.set(l.path,d),d}#ie(n,s,a,l){return{ancestorPaths:l.ancestorPaths,depth:n.depth,flattenedSegments:n.flattenedSegments?.map((d)=>({isTerminal:d.isTerminal,name:d.name,path:d.path})),hasChildren:n.hasChildren,index:s,isExpanded:n.isExpanded,isFlattened:n.isFlattened,isFocused:l.path===this.#r,isSelected:this.#o.has(l.path),kind:n.kind,level:n.depth,name:n.name,path:l.path,posInSet:l.posInSet??this.#W[a]??0,setSize:l.setSize??this.#$[a]??0}}#de(n){return this.#ie(n.row,n.index,n.index,{ancestorPaths:n.ancestorPaths,path:n.row.path,posInSet:n.posInSet,setSize:n.setSize})}#ue(n,s){let a=this.#n.getVisibleRowContext(n);if(a==null)return;let l=a.ancestorRows[s];if(l!=null)return l;return s===a.ancestorRows.length&&a.row.kind==="directory"&&a.row.isExpanded?a:void 0}#he(n){let s=this.#V.get(n);if(s!=null)return s;let a=this.#T(n),l=a<0?[]:[...this.#he(a),a];return this.#V.set(n,l),l}#fe(n){let s=this.#O.get(n);if(s!=null)return s;let a=this.#he(n).map((l)=>this.#i[l]??"").filter((l)=>l!=="");return this.#O.set(n,a),a}#pe(n){this.#n.collapse(n)}#k(n,s=this.#I,a=!0){let l=[...new Set(n)],d=!bo(this.#o,l),h=this.#I!==s;if(!d&&!h)return;if(this.#o=new Set(l),this.#I=s,d)this.#G+=1;if(a)this.#u()}#Re(n){return{collapse:()=>{this.#pe(n)},deselect:()=>{this.deselectPath(n)},expand:()=>{this.#Se(n)},focus:()=>{this.focusPath(n)},getPath:()=>n,isDirectory:()=>!0,isExpanded:()=>this.#n.isExpanded(n),isFocused:()=>this.#r===n,isSelected:()=>this.#o.has(n),select:()=>{this.selectPath(n)},toggleSelect:()=>{this.togglePathSelection(n)},toggle:()=>{this.#Ce(n)}}}#De(n){return{deselect:()=>{this.deselectPath(n)},focus:()=>{this.focusPath(n)},getPath:()=>n,isDirectory:()=>!1,isFocused:()=>this.#r===n,isSelected:()=>this.#o.has(n),select:()=>{this.selectPath(n)},toggleSelect:()=>{this.togglePathSelection(n)}}}#Me(n){let s=this.#n.list();this.#oe(s).batch(n)}#oe(n,s,a){return new Lr({...this.#e,paths:n,preparedInput:s==null?void 0:s,...a!==void 0?{initialExpandedPaths:a}:{}})}#se(){if(this.#S!=null)return this.#S;return this.#S=this.#n.list(),this.#S}#Ae(){if(this.#w!=null)return this.#w;let n=new Set;for(let s of this.#se()){n.add(s);for(let a of Mn(s))n.add(a)}return this.#w=[...n].sort(),this.#w}#Ne(){if(this.#f!=null)return this.#f;return this.#f=this.#se().map(Ds),this.#f}#ee(){if(this.#m!=null)return this.#m;return this.#m=this.#Ae().filter((n)=>n.endsWith("/")),this.#m}#Fe(){if(this.#h!=null)return this.#h;return this.#h=this.#ee().map(Ds),this.#h}#ae(){this.#m=null,this.#h=null,this.#w=null,this.#S=null,this.#f=null}#Le(){return this.#ee().filter((n)=>this.#n.isExpanded(n))}#me(n){let s=new Set(this.#U??[]);if(n)for(let a of this.#o)for(let l of Mn(a))s.add(l);this.#ge(s)}#ge(n){this.#re=!0;try{for(let s of this.#ee()){let a=n.has(s),l=this.#n.isExpanded(s);if(a&&!l)this.#n.expand(s);else if(!a&&l)this.#n.collapse(s)}}finally{this.#re=!1}}#Be(){if(this.#l==null||this.#l.length===0){this.#j=[],this.#C=null,this.#L=null,this.#M=null,this.#p=this.#ne;return}let n=this.#i;if(this.#j=n.filter((d)=>this.#x.has(d)),this.#K!=="hide-non-matches"||this.#x.size===0){this.#C=null,this.#L=null,this.#M=null,this.#p=this.#ne;return}let s=[],a=[],l=new Map;for(let[d,h]of n.entries()){if(this.#F?.has(h)!==!0)continue;l.set(h,a.length),s.push(d),a.push(h)}this.#C=s,this.#L=a,this.#M=l,this.#p=a.length}#_(){return this.#L??this.#i}#He(n){if(this.#L!=null)return this.#M?.get(n)??-1;return this.#n.getVisibleIndex(n)??-1}#ve(n){return this.#C?.[n]??n}#te(n){let s=this.#M?.get(n);if(s!=null)return s;return this.#n.getVisibleIndex(n)??-1}#ye(n){let s=this.#j;if(s.length===0)return;let a=this.#r,l=a==null?-1:s.indexOf(a),d=s[l<0?n>0?0:s.length-1:Math.min(s.length-1,Math.max(0,l+n))];if(d!=null)this.focusPath(d)}#Y(n,s){let a=n==null?null:Mc(n),l=this.#l;if(l===a)return;if(l==null&&a!=null)this.#U=this.#Le();if(this.#l=a,a==null)this.#me(!0),this.#U=null,this.#x.clear(),this.#F=null,this.#H(this.#r,!0);else if(a.length===0)this.#me(!1),this.#x.clear(),this.#F=null,this.#H(this.#r,!0);else{let d=this.#be();this.#H(d,!0)}if(s)this.#N?.(this.#l),this.#u()}#be(){if(this.#l==null||this.#l.length===0)return this.#x.clear(),this.#r;let n=this.#l,s=this.#se(),a=this.#Ne(),l=[],d=new Set,h=null;for(let I=0;I<s.length;I+=1){if(!a[I].includes(n))continue;let v=s[I];l.push(v),d.add(v),h??=v}let f=this.#ee(),g=this.#Fe();for(let I=0;I<f.length;I+=1){if(!g[I].includes(n))continue;let v=f[I];if(d.has(v))continue;l.push(v),d.add(v),h??=v}this.#x=d;let b=this.#K==="hide-non-matches"&&l.length>0?new Set:null;this.#F=b;let w=this.#K==="expand-matches"?new Set(this.#U??[]):new Set;for(let I of l){if(b!=null)b.add(I);if(I.endsWith("/"))w.add(I);for(let v of Mn(I))if(w.add(v),b!=null)b.add(v)}return this.#ge(w),h??this.#r}#u(){for(let n of this.#t)n()}#we(n){this.#c.get(n.operation)?.forEach((s)=>{s(n)}),this.#c.get("*")?.forEach((s)=>{s(n)})}#Se(n){for(let s of Mn(n)){if(this.#n.isExpanded(s))continue;this.#n.expand(s)}if(!this.#n.isExpanded(n))this.#n.expand(n)}#Ie(n){let s=this.#p;if(s===0)return;let a=this.#v===-1?0:this.#v,l=Math.min(s-1,Math.max(0,a+n));if(l!==a||this.#v===-1){if(!this.#y&&this.#C==null&&l>=this.#i.length)this.#D();this.#E(l)}}#H(n,s=!0){let a=this.#n.getVisibleCount();this.#ne=a;let l=Cp(this.#n.getVisibleTreeProjectionData(s?void 0:Math.min(a,wp)),n,s?(d)=>this.#n.getVisibleIndex(d):void 0);this.#V.clear(),this.#O.clear(),this.#y=l.paths.length>=a,this.#T=l.getParentIndex,this.#i=l.paths,this.#W=l.posInSetByIndex,this.#$=l.setSizeByIndex,this.#Be(),this.#v=n==null?this.#_().length>0?0:-1:this.#B(n),this.#r=this.#v<0?null:this.#le(this.#v)}#le(n){let s=this.#_()[n];if(s!=null)return s;if(this.#C!=null)return null;return this.#n.getVisibleRowContext(n)?.row.path??null}#A(n){return this.#n.getPathInfo(n)?.path??null}#Q(n){if(n==null)return;let s=this.#B(n);if(s>=0)this.#E(s,!1)}#E(n,s=!0){let a=this.#le(n);if(a==null)return;if(this.#v===n&&this.#r===a)return;if(this.#v=n,this.#r=a,s)this.#u()}#D(){if(this.#y)return;this.#H(this.#r,!0)}#Ve(n){let s=Br(this.#s,n);if(s==null&&this.#s!=null)this.#g="";this.#s=s;let a=Br(this.#r,n,!0),l=[...this.#o].map((g)=>Br(g,n)).filter((g)=>g!=null).map((g)=>this.#n.getPathInfo(g)?.path??null).filter((g)=>g!=null),d=Br(this.#I,n),h=d==null?null:this.#n.getPathInfo(d)?.path??null,f=[...new Set(l)];if(!bo(this.#o,f))this.#o=new Set(f),this.#G+=1;return this.#I=h,a}#ke(){return this.#n.on("*",(n)=>{if(this.#re)return;if(n.canonicalChanged)this.#b.clear(),this.#ae();if(this.#a!=null&&Ps(n))this.#a=null;let s=Ps(n)?this.#Ve(n):this.#r,a=this.#l!=null&&this.#l.length>0?this.#be():this.#l===""?this.#r:s,l=this.#l!=null||n.operation!=="expand"&&n.operation!=="collapse";this.#H(a,l),this.#u();let d=Rc(n);if(d!=null)this.#we(d)})}#Ce(n){if(this.#n.isExpanded(n)){this.#pe(n);return}this.#Se(n)}};var Nc=(t)=>{if(t==null||t.length===0)return"0";let n=`${t.length}`;for(let s of t)n+=`\x00${s.path}\x00${s.status}`;return n};function Fc(t){let n=t.endsWith("/"),s="",a=-1;for(let l=0;l<=t.length;l+=1){if(!(t[l]==="/"||l===t.length)){if(a===-1)a=l;continue}if(a===-1)continue;if(s!=="")s+="/";s+=t.slice(a,l),a=-1}if(s==="")return null;return{isDirectory:n,path:s}}function Lc(t){let n=t.endsWith("/")?t.slice(0,-1):t;if(n.length===0)return[];let s=[],a=0;for(;;){let l=n.indexOf("/",a);if(l===-1)break;s.push(n.slice(0,l+1)),a=l+1}return s}function xp(t,n){return n?`${t}/`:t}function Fs(t,n=null){let s=Nc(t==null?void 0:[...t]);if(s==="0")return null;if(n?.signature===s)return n;let a=new Map,l=new Set,d=new Set,h=new Map;for(let f of t??[]){let g=Hc(f);if(g==null)continue;Oc({canonicalPath:g.canonicalPath,changeCountByDirectoryPath:h,directoriesWithChanges:l,ignoredDirectoryPaths:d,isDirectory:g.isDirectory,status:f.status,statusByPath:a})}if(a.size===0)return null;return{changeCountByDirectoryPath:h,directoriesWithChanges:l,ignoredDirectoryPaths:d,signature:s,statusByPath:a}}function Bc(t,n){let s=n?.remove??[],a=n?.set??[];if(s.length===0&&a.length===0)return t;let l=new Map(t?.statusByPath),d=new Set(t?.directoriesWithChanges),h=new Set(t?.ignoredDirectoryPaths),f=new Map(t?.changeCountByDirectoryPath),g=!1;for(let b of s){let w=Vc(b);if(w==null)continue;g=_p({canonicalPath:w.canonicalPath,changeCountByDirectoryPath:f,directoriesWithChanges:d,ignoredDirectoryPaths:h,statusByPath:l})||g}for(let b of a){let w=Hc(b);if(w==null)continue;g=Oc({canonicalPath:w.canonicalPath,changeCountByDirectoryPath:f,directoriesWithChanges:d,ignoredDirectoryPaths:h,isDirectory:w.isDirectory,status:b.status,statusByPath:l})||g}if(!g)return t;if(l.size===0)return null;return{changeCountByDirectoryPath:f,directoriesWithChanges:d,ignoredDirectoryPaths:h,signature:Pp(l),statusByPath:l}}function Hc(t){return Vc(t.path)}function Vc(t){let n=Fc(t);if(n==null)return;return{canonicalPath:xp(n.path,n.isDirectory),isDirectory:n.isDirectory}}function _p({canonicalPath:t,changeCountByDirectoryPath:n,directoriesWithChanges:s,ignoredDirectoryPaths:a,statusByPath:l}){let d=l.get(t);if(d==null)return!1;if(l.delete(t),d==="ignored"&&t.endsWith("/"))a.delete(t);return Tp(n,s,t),!0}function Oc({canonicalPath:t,changeCountByDirectoryPath:n,directoriesWithChanges:s,ignoredDirectoryPaths:a,isDirectory:l,status:d,statusByPath:h}){let f=h.get(t);if(f===d)return!1;if(f==null)Ep(n,s,t);if(h.set(t,d),d==="ignored"&&l)a.add(t);else if(l)a.delete(t);return!0}function Ep(t,n,s){for(let a of Lc(s))t.set(a,(t.get(a)??0)+1),n.add(a)}function Tp(t,n,s){for(let a of Lc(s)){let l=(t.get(a)??0)-1;if(l>0)t.set(a,l);else t.delete(a),n.delete(a)}}function Pp(t){let n=`${t.size}`;for(let[s,a]of t)n+=`\x00${s}\x00${a}`;return n}var xe,jc,Rp,pr,qc,Co,Kc,Uc,Vs,Ls,Bs,Dp,_i={},Gc=[],xo=Array.isArray,Os=Gc.slice,Yn=Object.assign;function qs(t){t&&t.parentNode&&t.remove()}function Vr(t,n,s){var a,l,d,h={};for(d in n)d=="key"?a=n[d]:d=="ref"&&typeof t!="function"?l=n[d]:h[d]=n[d];return arguments.length>2&&(h.children=arguments.length>3?Os.call(arguments,2):s),Io(t,h,a,l,null)}function Io(t,n,s,a,l){var d={type:t,props:n,key:s,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:l==null?++jc:l,__i:-1,__u:0};return l==null&&xe.vnode!=null&&xe.vnode(d),d}function Sn(t){return t.children}function ko(t,n){this.props=t,this.context=n,this.__g=0}function Hr(t,n){if(n==null)return t.__?Hr(t.__,t.__i+1):null;for(var s;n<t.__k.length;n++)if((s=t.__k[n])!=null&&s.__e!=null)return s.__e;return typeof t.type=="function"?Hr(t):null}function Xc(t){var n,s;if((t=t.__)!=null&&t.__c!=null){for(t.__e=null,n=0;n<t.__k.length;n++)if((s=t.__k[n])!=null&&s.__e!=null){t.__e=s.__e;break}return Xc(t)}}function zc(t){(8&t.__g||!(t.__g|=8)||!pr.push(t)||Co++)&&qc==xe.debounceRendering||((qc=xe.debounceRendering)||queueMicrotask)(Mp)}function Mp(){for(var t,n,s,a,l,d,h,f,g=1;pr.length;)pr.length>g&&pr.sort(Kc),t=pr.shift(),g=pr.length,8&t.__g&&(s=void 0,l=(a=(n=t).__v).__e,d=[],h=[],(f=n.__P)&&((s=Yn({},a)).__v=a.__v+1,xe.vnode&&xe.vnode(s),zs(f,s,a,n.__n,f.namespaceURI,32&a.__u?[l]:null,d,l==null?Hr(a):l,!!(32&a.__u),h,f.ownerDocument),s.__v=a.__v,s.__.__k[s.__i]=s,Jc(d,s,h),s.__e!=l&&Xc(s)));Co=0}function Yc(t,n,s,a,l,d,h,f,g,b,w,I){var v,_,k,T,R,B,F,D=a&&a.__k||Gc,N=n.length;for(g=Ap(s,n,D,g,N),v=0;v<N;v++)(k=s.__k[v])!=null&&(_=k.__i==-1?_i:D[k.__i]||_i,k.__i=v,B=zs(t,k,_,l,d,h,f,g,b,w,I),T=k.__e,k.ref&&_.ref!=k.ref&&(_.ref&&Ws(_.ref,null,k),w.push(k.ref,k.__c||T,k)),R==null&&T!=null&&(R=T),(F=!!(4&k.__u))||_.__k===k.__k?g=Qc(k,g,t,F):typeof k.type=="function"&&B!==void 0?g=B:T&&(g=T.nextSibling),k.__u&=-7);return s.__e=R,g}function Ap(t,n,s,a,l){var d,h,f,g,b,w=s.length,I=w,v=0;for(t.__k=Array(l),d=0;d<l;d++)(h=n[d])!=null&&typeof h!="boolean"&&typeof h!="function"?(g=d+v,(h=t.__k[d]=typeof h=="string"||typeof h=="number"||typeof h=="bigint"||h.constructor==String?Io(null,h,null,null,null):xo(h)?Io(Sn,{children:h},null,null,null):h.constructor==null&&h.__b>0?Io(h.type,h.props,h.key,h.ref?h.ref:null,h.__v):h).__=t,h.__b=t.__b+1,f=null,(b=h.__i=Np(h,s,g,I))!=-1&&(I--,(f=s[b])&&(f.__u|=2)),f==null||f.__v==null?(b==-1&&(l>w?v--:l<w&&v++),typeof h.type!="function"&&(h.__u|=4)):b!=g&&(b==g-1?v--:b==g+1?v++:(b>g?v--:v++,h.__u|=4))):t.__k[d]=null;if(I)for(d=0;d<w;d++)(f=s[d])!=null&&(2&f.__u)==0&&(f.__e==a&&(a=Hr(f)),ed(f,f));return a}function Qc(t,n,s,a){var l,d;if(typeof t.type=="function"){for(l=t.__k,d=0;l&&d<l.length;d++)l[d]&&(l[d].__=t,n=Qc(l[d],n,s,a));return n}t.__e!=n&&(a&&(n&&t.type&&!n.parentNode&&(n=Hr(t)),s.insertBefore(t.__e,n||null)),n=t.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function Np(t,n,s,a){var l,d,h,{key:f,type:g}=t,b=n[s],w=b!=null&&(2&b.__u)==0;if(b===null&&t.key==null||w&&f==b.key&&g==b.type)return s;if(a>(w?1:0)){for(l=s-1,d=s+1;l>=0||d<n.length;)if((b=n[h=l>=0?l--:d++])!=null&&(2&b.__u)==0&&f==b.key&&g==b.type)return h}return-1}function Wc(t,n,s){n[0]=="-"?t.setProperty(n,s==null?"":s):t[n]=s==null?"":s}function So(t,n,s,a,l){var d;e:if(n=="style")if(typeof s=="string")t.style.cssText=s;else{if(typeof a=="string"&&(t.style.cssText=a=""),a)for(n in a)s&&n in s||Wc(t.style,n,"");if(s)for(n in s)a&&s[n]==a[n]||Wc(t.style,n,s[n])}else if(n[0]=="o"&&n[1]=="n")d=n!=(n=n.replace(Uc,"$1")),(n=n.slice(2))[0].toLowerCase()!=n[0]&&(n=n.toLowerCase()),t.__l||(t.__l={}),t.__l[n+d]=s,s?a?s.l=a.l:(s.l=Vs,t.addEventListener(n,d?Bs:Ls,d)):t.removeEventListener(n,d?Bs:Ls,d);else{if(l=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in t)try{t[n]=s==null?"":s;break e}catch(h){}typeof s=="function"||(s==null||s===!1&&n[4]!="-"?t.removeAttribute(n):t.setAttribute(n,n=="popover"&&s==1?"":s))}}function $c(t){return function(n){if(this.__l){var s=this.__l[n.type+t];if(n.u==null)n.u=Vs++;else if(n.u<s.l)return;return s(xe.event?xe.event(n):n)}}}function zs(t,n,s,a,l,d,h,f,g,b,w){var I,v,_,k,T,R,B,F,D,N,H,X,fe,yt,Le,bt,Ie,Be,Qe,qe,Tt,Ce=n.type;if(n.constructor!=null)return null;128&s.__u&&(g=!!(32&s.__u),s.__c.__z&&(f=n.__e=s.__e=(d=s.__c.__z)[0],s.__c.__z=null)),(I=xe.__b)&&I(n);e:if(typeof Ce=="function")try{if(F=n.props,D="prototype"in Ce&&Ce.prototype.render,N=(I=Ce.contextType)&&a[I.__c],H=I?N?N.props.value:I.__:a,s.__c?2&(v=n.__c=s.__c).__g&&(v.__g|=1,B=!0):(D?n.__c=v=new Ce(F,H):(n.__c=v=new ko(F,H),v.constructor=Ce,v.render=Lp),N&&N.sub(v),v.props=F,v.state||(v.state={}),v.context=H,v.__n=a,_=!0,v.__g|=8,v.__h=[],v._sb=[]),D&&v.__s==null&&(v.__s=v.state),D&&Ce.getDerivedStateFromProps!=null&&(v.__s==v.state&&(v.__s=Yn({},v.__s)),Yn(v.__s,Ce.getDerivedStateFromProps(F,v.__s))),k=v.props,T=v.state,v.__v=n,_)D&&Ce.getDerivedStateFromProps==null&&v.componentWillMount!=null&&v.componentWillMount(),D&&v.componentDidMount!=null&&v.__h.push(v.componentDidMount);else{if(D&&Ce.getDerivedStateFromProps==null&&F!==k&&v.componentWillReceiveProps!=null&&v.componentWillReceiveProps(F,H),!(4&v.__g)&&v.shouldComponentUpdate!=null&&v.shouldComponentUpdate(F,v.__s,H)===!1||n.__v==s.__v){for(n.__v!=s.__v&&(v.props=F,v.state=v.__s,v.__g&=-9),n.__e=s.__e,n.__k=s.__k,n.__k.some(function(we){we&&(we.__=n)}),X=0;X<v._sb.length;X++)v.__h.push(v._sb[X]);v._sb=[],v.__h.length&&h.push(v);break e}v.componentWillUpdate!=null&&v.componentWillUpdate(F,v.__s,H),D&&v.componentDidUpdate!=null&&v.__h.push(function(){v.componentDidUpdate(k,T,R)})}if(v.context=H,v.props=F,v.__P=t,v.__g&=-5,fe=xe.__r,yt=0,D){for(v.state=v.__s,v.__g&=-9,fe&&fe(n),I=v.render(v.props,v.state,v.context),Le=0;Le<v._sb.length;Le++)v.__h.push(v._sb[Le]);v._sb=[]}else do v.__g&=-9,fe&&fe(n),I=v.render(v.props,v.state,v.context),v.state=v.__s;while(8&v.__g&&++yt<25);v.state=v.__s,v.getChildContext!=null&&(a=Yn({},a,v.getChildContext())),D&&!_&&v.getSnapshotBeforeUpdate!=null&&(R=v.getSnapshotBeforeUpdate(k,T)),bt=I,I!=null&&I.type===Sn&&I.key==null&&(bt=Zc(I.props.children)),f=Yc(t,xo(bt)?bt:[bt],n,s,a,l,d,h,f,g,b,w),n.__u&=-161,v.__h.length&&h.push(v),B&&(v.__g&=-4)}catch(we){if(n.__v=null,g||d!=null)if(we.then){for(Ie=0,Be=!1,n.__u|=g?160:128,n.__c.__z=[],Qe=0;Qe<d.length;Qe++)(qe=d[Qe])==null||Be||(qe.nodeType==8&&qe.data=="$s"?(Ie>0&&n.__c.__z.push(qe),Ie++,d[Qe]=null):qe.nodeType==8&&qe.data=="/$s"?(--Ie>0&&n.__c.__z.push(qe),Be=Ie===0,f=d[Qe],d[Qe]=null):Ie>0&&(n.__c.__z.push(qe),d[Qe]=null));if(!Be){for(;f&&f.nodeType==8&&f.nextSibling;)f=f.nextSibling;d[d.indexOf(f)]=null,n.__c.__z=[f]}n.__e=f}else{for(Tt=d.length;Tt--;)qs(d[Tt]);Hs(n)}else n.__e=s.__e,n.__k=s.__k,we.then||Hs(n);xe.__e(we,n,s)}else f=n.__e=Fp(s.__e,n,s,a,l,d,h,g,b,w);return(I=xe.diffed)&&I(n),128&n.__u?void 0:f}function Hs(t){t&&t.__c&&(t.__c.__g|=4),t&&t.__k&&t.__k.forEach(Hs)}function Jc(t,n,s){for(var a=0;a<s.length;a++)Ws(s[a],s[++a],s[++a]);xe.__c&&xe.__c(n,t),t.some(function(l){try{t=l.__h,l.__h=[],t.some(function(d){d.call(l)})}catch(d){xe.__e(d,l.__v)}})}function Zc(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:xo(t)?t.map(Zc):Yn({},t)}function Fp(t,n,s,a,l,d,h,f,g,b){var w,I,v,_,k,T,R,B,F=s.props,{props:D,type:N}=n;if(N=="svg"?l="http://www.w3.org/2000/svg":N=="math"?l="http://www.w3.org/1998/Math/MathML":l||(l="http://www.w3.org/1999/xhtml"),d!=null){for(w=0;w<d.length;w++)if((k=d[w])&&"setAttribute"in k==!!N&&(N?k.localName==N:k.nodeType==3)){t=k,d[w]=null;break}}if(t==null){if(N==null)return b.createTextNode(D);t=b.createElementNS(l,N,D.is&&D),f&&(xe.__m&&xe.__m(n,d),f=!1),d=null}if(N==null)F===D||f&&t.data==D||(t.data=D);else{if(d=d&&Os.call(t.childNodes),F=s.props||_i,!f&&d!=null)for(F={},w=0;w<t.attributes.length;w++)F[(k=t.attributes[w]).name]=k.value;for(w in F)if(k=F[w],w=="children");else if(w=="dangerouslySetInnerHTML")v=k;else if(!(w in D)){if(w=="value"&&"defaultValue"in D||w=="checked"&&"defaultChecked"in D)continue;So(t,w,null,k,l)}for(w in B=1&s.__u,D)k=D[w],w=="children"?_=k:w=="dangerouslySetInnerHTML"?I=k:w=="value"?T=k:w=="checked"?R=k:f&&typeof k!="function"||F[w]===k&&!B||So(t,w,k,F[w],l);if(I)f||v&&(I.__html==v.__html||I.__html==t.innerHTML)||(t.innerHTML=I.__html),n.__k=[];else if(v&&(t.innerHTML=""),Yc(N=="template"?t.content:t,xo(_)?_:[_],n,s,a,N=="foreignObject"?"http://www.w3.org/1999/xhtml":l,d,h,d?d[0]:s.__k&&Hr(s,0),f,g,b),d!=null)for(w=d.length;w--;)qs(d[w]);f||(w="value",N=="progress"&&T==null?t.removeAttribute("value"):T==null||T===t[w]&&(N!=="progress"||T)||So(t,w,T,F[w],l),w="checked",R!=null&&R!=t[w]&&So(t,w,R,F[w],l))}return t}function Ws(t,n,s){try{if(typeof t=="function"){var a=typeof t.__u=="function";a&&t.__u(),a&&n==null||(t.__u=t(n))}else t.current=n}catch(l){xe.__e(l,s)}}function ed(t,n,s){var a,l;if(xe.unmount&&xe.unmount(t),(a=t.ref)&&(a.current&&a.current!=t.__e||Ws(a,null,n)),(a=t.__c)!=null){if(a.componentWillUnmount)try{a.componentWillUnmount()}catch(d){xe.__e(d,n)}a.__P=null}if(a=t.__k)for(l=0;l<a.length;l++)a[l]&&ed(a[l],n,s||typeof t.type!="function");s||qs(t.__e),t.__e&&t.__e.__l&&(t.__e.__l=null),t.__e=t.__c=t.__=null}function Lp(t,n,s){return this.constructor(t,s)}function _o(t,n){var s,a,l,d;n==document&&(n=document.documentElement),xe.__&&xe.__(t,n),a=(s=!!(t&&32&t.__u))?null:n.__k,t=n.__k=Vr(Sn,null,[t]),l=[],d=[],zs(n,t,a||_i,_i,n.namespaceURI,a?null:n.firstChild?Os.call(n.childNodes):null,l,a?a.__e:n.firstChild,s,d,n.ownerDocument),Jc(l,t,d)}function td(t,n){t.__u|=32,_o(t,n)}xe={__e:function(t,n,s,a){for(var l,d,h;n=n.__;)if((l=n.__c)&&!(1&l.__g)){l.__g|=4;try{if((d=l.constructor)&&d.getDerivedStateFromError!=null&&(l.setState(d.getDerivedStateFromError(t)),h=8&l.__g),l.componentDidCatch!=null&&(l.componentDidCatch(t,a||{}),h=8&l.__g),h)return void(l.__g|=2)}catch(f){t=f}}throw Co=0,t}},jc=0,Rp=function(t){return t!=null&&t.constructor==null},ko.prototype.setState=function(t,n){var s;s=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Yn({},this.state),typeof t=="function"&&(t=t(Yn({},s),this.props)),t&&Yn(s,t),t!=null&&this.__v&&(n&&this._sb.push(n),zc(this))},ko.prototype.forceUpdate=function(t){this.__v&&(this.__g|=4,t&&this.__h.push(t),zc(this))},ko.prototype.render=Sn,pr=[],Co=0,Kc=function(t,n){return t.__v.__b-n.__v.__b},Uc=/(PointerCapture)$|Capture$/i,Vs=0,Ls=$c(!1),Bs=$c(!0),Dp=0;var Bp=0;function O(t,n,s,a,l,d){n||(n={});var h,f,g=n;if("ref"in g&&typeof t!="function")for(f in g={},n)f=="ref"?h=n[f]:g[f]=n[f];var b={type:t,props:g,key:s,ref:h,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Bp,__i:-1,__u:0,__source:l,__self:d};return xe.vnode&&xe.vnode(b),b}var Hp=16,Vp=16,Op={};function Or({name:t,remappedFrom:n,token:s,width:a,height:l,viewBox:d,label:h,alignCapitals:f=!1}){let g=`#${t.replace(/^#/,"")}`,{width:b,height:w,viewBox:I}=Op[t]??{width:Hp,height:Vp},v=a??b,_=l??w,k=d??I??`0 0 ${b} ${w}`;return O("svg",{"data-icon-name":n??t,"data-icon-token":s,"data-align-capitals":f,...h!=null?{"aria-label":h,role:"img"}:{"aria-hidden":!0},viewBox:k,width:v,height:_,children:O("use",{href:g})})}var nd=(t)=>t!==void 0&&/\s/.test(t),qp=(t,n)=>{let s=(a)=>nd(t[a-1])||nd(t[a]);if(!s(n))return n;for(let a=1;a<t.length;a++){let l=n-a;if(l>0&&!s(l))return l;let d=n+a;if(d<t.length&&!s(d))return d}return n},id=(t)=>qp(t,Math.ceil(t.length/2)),rd=(t)=>{if(t.length<2)return[t,""];let n=id(t);return[t.slice(0,n),t.slice(n)]},zp=(t)=>{if(t.length<4)return[t,""];let n=t.lastIndexOf(".")+1,s=t.length-n>10,a=n>=1&&!s?n:id(t);return[t.slice(0,a),t.slice(a)]},Wp=(t)=>{if(t.length<4)return[t,""];let n=t.lastIndexOf("/")+1,s=t.length-n>25,a=n>=1&&!s?n:Math.ceil(t.length/2);return[t.slice(0,a),t.slice(a)]},$p=(t,{splitIndex:n}={})=>{if(typeof n!=="number"){let s=Math.ceil(t.length/2);return[t.slice(0,s),t.slice(s)]}return[t.slice(0,n),t.slice(n)]},jp=(t,{splitOffset:n}={})=>{if(typeof n!=="number"||n<=0||n>=t.length){let a=Math.ceil(t.length/2);return[t.slice(0,a),t.slice(a)]}let s=t.length-n;return[t.slice(0,s),t.slice(s)]},Kp=(t,{splitOffset:n}={})=>{if(typeof n!=="number"||n<=0||n>=t.length){let a=Math.ceil(t.length/2);return[t.slice(0,a),t.slice(a)]}let s=n;return[t.slice(0,s),t.slice(s)]};function Up({children:t,marker:n,variant:s="default"}){return O("div",{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:O("div",{"data-truncate-marker":!0,children:typeof n==="function"?n({children:t}):s==="fade"?O("span",{"data-truncate-fade":!0}):n})})}function Gp(t){let{mode:n,children:s}=t;return O("div",{children:[O("div",{"data-truncate-content":"visible",children:n==="fruncate"?O("span",{children:s}):s}),O("div",{"data-truncate-content":"overflow","aria-hidden":!0,children:n==="fruncate"?O("span",{children:s}):s})]})}function od({children:t,mode:n="truncate",marker:s="…",variant:a="default",...l}){let d=O(Gp,{mode:n,children:t},"content"),h=O(Up,{marker:s,mode:n,variant:a},"marker"),f=O("div",{"data-truncate-fill":!0},"fill");return O("div",{"data-truncate-container":n,"data-truncate-variant":a,...l,children:O("div",{"data-truncate-grid":!0,children:n==="truncate"?[d,h]:[h,d,f]})})}function Ei({children:t,...n}){return O(od,{mode:"truncate",...n,children:t})}function $s({children:t,...n}){return O(od,{mode:"fruncate",...n,children:t})}function sd({children:t,contents:n,priority:s="end",split:a="center",minimumLength:l=12,className:d,style:h,...f}){let g=null,b=null;if(Array.isArray(n)){if(n.length!==2)return console.error("MiddleTruncate: contents must be an array of two items"),null;g=O(Ei,{...f,children:n[0]}),b=O($s,{...f,children:n[1]})}else{if(typeof t!=="string")return console.error("MiddleTruncate: children must be a string"),null;if(t.length===0)return O("div",{className:d,style:h});if(t.length<l)if(s==="end")return O($s,{...f,className:d,style:h,children:t});else return O(Ei,{...f,className:d,style:h,children:t});let w=null,I=null,v=null;if(typeof a==="string"){if(a==="center")w=rd;else if(a==="extension")w=zp;else if(a==="leaf-path")w=Wp}else if(typeof a==="number")w=$p,I=a;else if(Array.isArray(a)){let[N,H]=a;if(v=H,N==="last")w=jp;else if(N==="first")w=Kp}else if(typeof a==="function")w=a;w??=rd;let[_,k]=w(t,{priority:s,variant:f.variant,splitIndex:typeof I==="number"?I:void 0,splitOffset:typeof v==="number"?v:void 0}),T=_.length>=k.length,R=s==="equal"&&!T,B=s==="equal"&&T,F={},D={};if(R)F.marker="";if(B)D.marker="";g=O(Ei,{...f,...F,children:_}),b=O($s,{...f,...D,children:k})}return O("div",{"data-truncate-group-container":"middle",className:d,style:h,children:[O("div",{"data-truncate-segment-priority":s==="start"||s==="equal"?"1":"2",children:g}),O("div",{"data-truncate-segment-priority":s==="end"||s==="equal"?"1":"2",children:b})]})}var js={endIndex:-1,startIndex:-1};function Xp(t,n,s){return Math.min(Math.max(t,n),s)}function ad(t,n){return t<0||n<t?js:{endIndex:n,startIndex:t}}function Ks(t){return t.startIndex<0||t.endIndex<t.startIndex}function Yp(t,n){return Ks(t)?0:(t.endIndex-t.startIndex+1)*n}function ld(t,n,s){if(n<=0)return-1;let a=n*s;if(t<=0)return 0;if(t>=a)return n;return Math.floor(t/s)}function Qp(t,n,s){if(n<=0||t<=0)return-1;if(t>=n*s)return n-1;return Math.ceil(t/s)-1}function Jp(t){let n=new Map;return t.forEach((s,a)=>{if(s.kind!=="directory"||!s.isExpanded)return;let l=s.ancestorPaths.length,d=n.get(l);if(d==null){n.set(l,[a]);return}d.push(a)}),n}function Zp(t,n){let s=0,a=t.length-1,l=-1;while(s<=a){let d=Math.floor((s+a)/2),h=t[d];if(h==null)break;if(h<=n){l=d,s=d+1;continue}a=d-1}return l}function em(t){let n=new Map,s=[];for(let l=0;l<t.length;l+=1){let d=t[l];if(d==null)continue;let h=d.kind==="directory"&&d.isExpanded?[...d.ancestorPaths,d.path]:d.ancestorPaths,f=0;while(f<s.length&&f<h.length&&s[f]===h[f])f+=1;for(let g=s.length-1;g>=f;g-=1){let b=s[g];if(b!=null)n.set(b,l-1)}s.length=f;for(let g=f;g<h.length;g+=1){let b=h[g];if(b!=null)s.push(b)}}let a=t.length-1;for(let l of s)n.set(l,a);return n}function Us(t,n,s){if(t.length===0||n<=0)return[];let a=em(t),l=Jp(t),d=[];for(let h=0;h<t.length;h+=1){let f=l.get(h);if(f==null||f.length===0)break;let g=n+h*s,b=Zp(f,Math.min(t.length-1,Math.floor(g/s))),w=null;while(b>=0){let I=f[b],v=I==null?null:t[I]??null;if(v!=null&&(h===0||v.ancestorPaths[h-1]===d[h-1]?.path)){w=v;break}b-=1}if(w==null)break;d.push(w)}return d.map((h,f)=>{let g=f*s,b=(a.get(h.path)??t.length-1)+1;if(b>=t.length)return{row:h,top:g};let w=b*s-n;return{row:h,top:Math.min(g,w-s)}}).filter((h)=>h.top+s>0)}function cd(t,n){let s=n.totalRowCount??t.length,a=s*n.itemHeight,l=Math.max(0,n.viewportHeight),d=Math.max(0,Math.floor(n.overscan)),h=Math.max(0,a-l),f=Xp(n.scrollTop,0,h),g=n.stickyRows??Us(t,f,n.itemHeight),b=g.reduce((X,fe)=>Math.max(X,fe.top+n.itemHeight),0),w=Math.min(a,f+b),I=Math.max(0,l-b),v=Math.max(0,a-w),_=ld(f,s,n.itemHeight),k=ld(w,s,n.itemHeight),T=b<=0||_<0||_>=s?-1:_,R=T===-1?-1:Math.min(s-1,k-1),B=T===-1||R<T?0:R-T+1,F=I<=0||k>=s?js:ad(k,Qp(w+I,s,n.itemHeight)),D=R+1,N=Ks(F)?js:ad(Math.max(D,F.startIndex-d),Math.min(s-1,F.endIndex+d)),H=Yp(N,n.itemHeight);return{occlusion:{firstOccludedIndex:T,lastOccludedIndex:R,occludedCount:B},physical:{itemHeight:n.itemHeight,maxScrollTop:h,overscan:d,scrollTop:f,totalHeight:a,totalRowCount:s,viewportHeight:l},projected:{contentHeight:v,paneHeight:I,paneTop:w},sticky:{height:b,rows:g},visible:F,window:{endIndex:N.endIndex,height:H,offsetTop:Ks(N)?0:N.startIndex*n.itemHeight,startIndex:N.startIndex}}}var dd={added:"A",deleted:"D",ignored:null,modified:"M",renamed:"R",untracked:"U"},ud={added:"Git status: added",deleted:"Git status: deleted",ignored:"Git status: ignored",modified:"Git status: modified",renamed:"Git status: renamed",untracked:"Git status: untracked"},hd="Contains git status items";function fd(t){if(t.current)return!0;return t.current=!0,!1}function Gs(t){let{currentScrollTop:n,focusedIndex:s,itemHeight:a,topInset:l=0,viewportHeight:d}=t;if(s<0)return null;let h=Math.max(0,l),f=s*a,g=f+a;if(f<n+h){let b=Math.max(0,f-h);return b===n?null:b}if(g>n+d){let b=g-d;return b===n?null:b}return null}function pd(t){let{currentScrollTop:n,focusedIndex:s,itemHeight:a,offset:l,topInset:d=0,totalHeight:h,viewportHeight:f}=t;if(l==="nearest")return Gs({currentScrollTop:n,focusedIndex:s,itemHeight:a,topInset:d,viewportHeight:f});if(s<0)return null;let g=Math.max(0,d),b=s*a,w=Math.max(0,f-g),I=l==="center"?g+Math.max(0,(w-a)/2):g,v=Math.max(0,h-f),_=Math.max(0,Math.min(b-I,v));return _===n?null:_}function md(t){let{currentScrollTop:n,focusedIndex:s,itemHeight:a,targetViewportOffset:l,totalHeight:d,viewportHeight:h}=t;if(s<0)return null;let f=Math.max(0,l),g=s*a,b=g+a,w=n+f,I=n+h;if(g>=w&&b<=I)return null;let v=Math.max(0,d-h),_=Math.max(0,Math.min(g-f,v));return _===n?null:_}function mr(t){if(t==null||!t.isConnected)return!1;if(t===document.body||t===document.documentElement)return!1;t.focus({preventScroll:!0});let n=t.getRootNode();if(n instanceof ShadowRoot)return n.activeElement===t;return document.activeElement===t}function Ti(t){let n=t.getRootNode();if(n instanceof ShadowRoot){let a=n.activeElement;return a instanceof HTMLElement?a:null}let s=document.activeElement;return s instanceof HTMLElement&&t.contains(s)?s:null}function qr(t,n){if(t==null)return n;let s=t.getBoundingClientRect().height;if(s>0)return s;return t.clientHeight>0?t.clientHeight:n}function Xs(t,n){return t!=null&&t>0?t:n}function gd(t){let n=t.borderBoxSize,s=Array.isArray(n)?n[0]:n;if(s!=null&&Number.isFinite(s.blockSize)&&s.blockSize>0)return s.blockSize;return t.contentRect.height>0?t.contentRect.height:null}function Ys(t,n,s,a,l=0){let d=Gs({currentScrollTop:t.scrollTop,focusedIndex:n,itemHeight:s,topInset:l,viewportHeight:a});if(d==null)return!1;return t.scrollTop=d,!0}function vd(t,n,s,a,l,d,h=0){let f=pd({currentScrollTop:t.scrollTop,focusedIndex:n,itemHeight:s,offset:d,topInset:h,totalHeight:l,viewportHeight:a});if(f==null)return!1;return t.scrollTop=f,!0}function zr(t,n,s,a,l,d){let h=md({currentScrollTop:t.scrollTop,focusedIndex:n,itemHeight:s,targetViewportOffset:d,totalHeight:l,viewportHeight:a});if(h==null)return!1;return t.scrollTop=h,!0}function Qs(t,n,s,a){if(s.end<s.start)return null;if(t<s.start)return-n;if(t>s.end)return a;return null}function yd(t){let{renamingPath:n,previousRenamingPath:s,hasRenderedInput:a}=t;if(n==null)return"reset";if(!a)return"reveal-canonical";if(s===n)return"ignore";return"focus-input"}function bd({ariaLabel:t,isFlattened:n=!1,ref:s,value:a,onBlur:l,onInput:d}){return O("input",{ref:s,"data-item-rename-input":!0,...n?{"data-item-flattened-rename-input":!0}:{},"aria-label":t,value:a,onBlur:l,onInput:d,onClick:(h)=>h.stopPropagation(),onMouseDown:(h)=>h.stopPropagation(),onPointerDown:(h)=>h.stopPropagation()})}function wd(t){let{row:n,mode:s,targetPath:a,ariaLabel:l,domId:d,isParked:h,itemHeight:f,features:g,state:b,extraStyle:w}=t,I=s==="sticky",v=n.ancestorPaths.at(-1)??"",_={};if(b.isFocusRinged)_["data-item-focused"]=!0;if(n.isSelected)_["data-item-selected"]=!0;if(b.isContextHovered)_["data-item-context-hover"]="true";if(b.isDragTarget)_["data-item-drag-target"]=!0;if(b.isDragging)_["data-item-dragging"]=!0;if(b.effectiveGitStatus!=null)_["data-item-git-status"]=b.effectiveGitStatus;if(b.containsGitChange)_["data-item-contains-git-change"]="true";return{"aria-expanded":!I&&n.kind==="directory"?n.isExpanded:void 0,"aria-haspopup":g.contextMenuEnabled?"menu":void 0,"aria-label":l,"aria-level":!I?n.level+1:void 0,"aria-posinset":!I?n.posInSet+1:void 0,"aria-selected":!I?n.isSelected?"true":"false":void 0,"aria-setsize":!I?n.setSize:void 0,"data-file-tree-sticky-path":I?a:void 0,"data-file-tree-sticky-row":I?"true":void 0,"data-item-context-menu-button-visibility":g.actionLaneEnabled?g.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":g.contextMenuEnabled?g.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":g.actionLaneEnabled?"true":void 0,"data-item-has-git-lane":g.gitLaneActive?"true":void 0,"data-item-parent-path":v.length>0?v:void 0,"data-item-parked":h?"true":void 0,"data-item-path":a,"data-item-type":n.kind==="directory"?"folder":"file","data-type":"item",id:!I?d:void 0,role:!I?"treeitem":void 0,style:{minHeight:`${f}px`,...w},tabIndex:!I&&n.isFocused?0:-1,..._}}function Sd(t){let{event:n,mode:s,isSearchOpen:a,isDirectory:l}=t,d=n.ctrlKey||n.metaKey,h=n.shiftKey||d,f=n.shiftKey?{additive:d,kind:"range"}:d?{kind:"toggle"}:{kind:"single"};return{closeSearch:a,revealCanonical:s==="sticky",selection:f,toggleDirectory:!h&&l}}var Wr,mt,Js,Id,Zs=Object.is,Pi=0,Rd=[],vt=xe,{__b:kd,__r:Cd,diffed:xd,__c:_d,unmount:Ed,__:Td}=vt;function To(t,n){vt.__h&&vt.__h(mt,t,Pi||n),Pi=0;var s=mt.__H||(mt.__H={__:[],__h:[]});return t>=s.__.length&&s.__.push({}),s.__[t]}function pn(t){return Pi=1,tm(Dd,t)}function tm(t,n,s){var a=To(Wr++,2);if(a.t=t,!a.__c&&(a.__=[s?s(n):Dd(void 0,n),function(f){var g=a.__N?a.__N[0]:a.__[0],b=a.t(g,f);Zs(g,b)||(a.__N=[b,a.__[1]],a.__c.setState({}))}],a.__c=mt,!mt.__f)){var l=function(f,g,b){if(!a.__c.__H)return!0;var w=a.__c.__H.__.filter(function(v){return!!v.__c});if(w.every(function(v){return!v.__N}))return!d||d.call(this,f,g,b);var I=a.__c.props!==f;return w.forEach(function(v){if(v.__N){var _=v.__[0];v.__=v.__N,v.__N=void 0,Zs(_,v.__[0])||(I=!0)}}),d&&d.call(this,f,g,b)||I};mt.__f=!0;var d=mt.shouldComponentUpdate,h=mt.componentWillUpdate;mt.componentWillUpdate=function(f,g,b){if(4&this.__g){var w=d;d=void 0,l(f,g,b),d=w}h&&h.call(this,f,g,b)},mt.shouldComponentUpdate=l}return a.__N||a.__}function ta(t,n){var s=To(Wr++,3);!vt.__s&&na(s.__H,n)&&(s.__=t,s.u=n,mt.__H.__h.push(s))}function Xt(t,n){var s=To(Wr++,4);!vt.__s&&na(s.__H,n)&&(s.__=t,s.u=n,mt.__h.push(s))}function le(t){return Pi=5,An(function(){return{current:t}},[])}function An(t,n){var s=To(Wr++,7);return na(s.__H,n)&&(s.__=t(),s.__H=n,s.__h=t),s.__}function Dt(t,n){return Pi=8,An(function(){return t},n)}function nm(){for(var t;t=Rd.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Eo),t.__H.__h.forEach(ea),t.__H.__h=[]}catch(n){t.__H.__h=[],vt.__e(n,t.__v)}}vt.__b=function(t){mt=null,kd&&kd(t)},vt.__=function(t,n){t&&n.__k&&n.__k.__m&&(t.__m=n.__k.__m),Td&&Td(t,n)},vt.__r=function(t){Cd&&Cd(t),Wr=0;var n=(mt=t.__c).__H;n&&(Js===mt?(n.__h=[],mt.__h=[],n.__.forEach(function(s){s.__N&&(s.__=s.__N),s.u=s.__N=void 0})):(n.__h.forEach(Eo),n.__h.forEach(ea),n.__h=[],Wr=0)),Js=mt},vt.diffed=function(t){xd&&xd(t);var n=t.__c;n&&n.__H&&(n.__H.__h.length&&(Rd.push(n)!==1&&Id===vt.requestAnimationFrame||((Id=vt.requestAnimationFrame)||rm)(nm)),n.__H.__.forEach(function(s){s.u&&(s.__H=s.u),s.u=void 0})),Js=mt=null},vt.__c=function(t,n){n.some(function(s){try{s.__h.forEach(Eo),s.__h=s.__h.filter(function(a){return!a.__||ea(a)})}catch(a){n.some(function(l){l.__h&&(l.__h=[])}),n=[],vt.__e(a,s.__v)}}),_d&&_d(t,n)},vt.unmount=function(t){Ed&&Ed(t);var n,s=t.__c;s&&s.__H&&(s.__H.__.forEach(function(a){try{Eo(a)}catch(l){n=l}}),s.__H=void 0,n&&vt.__e(n,s.__v))};var Pd=typeof requestAnimationFrame=="function";function rm(t){var n,s=function(){clearTimeout(a),Pd&&cancelAnimationFrame(n),setTimeout(t)},a=setTimeout(s,35);Pd&&(n=requestAnimationFrame(s))}function Eo(t){var n=mt,s=t.__c;typeof s=="function"&&(t.__c=void 0,s()),mt=n}function ea(t){var n=mt;t.__c=t.__(),mt=n}function na(t,n){return!t||t.length!==n.length||n.some(function(s,a){return!Zs(s,t[a])})}function Dd(t,n){return typeof n=="function"?n(t):n}function im(t,n=null,s=null){let a=t.flattenedSegments;if(a==null||a.length===0)return n??t.name;return O("span",{"data-item-flattened-subitems":!0,children:a.map((l,d)=>{let h=d===a.length-1;return O(Sn,{children:[O("span",{"data-item-flattened-subitem":l.path,"data-item-flattened-subitem-drag-target":s===l.path?"true":void 0,children:h&&n!=null?n:O(Ei,{children:l.name})}),d<a.length-1?" / ":""]},l.path)})})}function jr(t){return t.isFlattened?t.flattenedSegments?.findLast((n)=>n.isTerminal)?.path??t.path:t.path}function ia(t){let n=t.flattenedSegments;if(n==null||n.length===0)return t.name;return n.map((s)=>s.name).join(" / ")}function Md(t,n,s,a){return t.map((l,d)=>{let h=d*s,f=l.subtreeEndIndex+1;if(f>=a)return{row:l.row,top:h};let g=f*s-n;return{row:l.row,top:Math.min(h,g-s)}}).filter((l)=>l.top+s>0)}function ra({controller:t,itemHeight:n,overscan:s,scrollTop:a,stickyFolders:l,viewportHeight:d}){let h=t.getVisibleCount(),f=l&&h>0?t.getStickyRowCandidates(a,n):[],g=f==null&&l&&h>0?t.getVisibleRows(0,h-1):[],b=cd(g,{itemHeight:n,overscan:s,scrollTop:a,stickyRows:f==null?void 0:Md(f,a,n,h),totalRowCount:h,viewportHeight:d}),w=l&&a<=0&&h>0?t.getStickyRowCandidates(1,n):[],I=w!=null&&a<=0?Md(w,1,n,h):l&&a<=0&&g.length>0?Us(g,1,n):b.sticky.rows;return{overlayHeight:I.reduce((v,_)=>Math.max(v,_.top+n),0),overlayRows:I,snapshot:b,visibleRows:g}}var om=400,Ad=10,$r=40,Nd=18;function sm(t,n,s){let a=t,l=document.elementFromPoint?.bind(document)??null,d=a.elementFromPoint?.(n,s)??l?.(n,s)??null;if(t instanceof ShadowRoot&&(d==null||!t.contains(d)))return am(t,n,s);return d instanceof HTMLElement?d:null}function am(t,n,s){let a=Array.from(t.querySelectorAll('[data-type="item"], [data-item-flattened-subitem]'));for(let l=a.length-1;l>=0;l--){let d=a[l],h=d.getBoundingClientRect();if(n>=h.left&&n<=h.right&&s>=h.top&&s<=h.bottom)return d}return null}function Fd(t){let n=t?.closest?.('[data-type="item"]');if(!(n instanceof HTMLElement))return null;let s=n.dataset.itemPath??null;if(s==null)return null;let a=t?.closest?.("[data-item-flattened-subitem]"),l=a instanceof HTMLElement?a.getAttribute("data-item-flattened-subitem")??null:null;if(l!=null&&l.endsWith("/"))return{directoryPath:l,flattenedSegmentPath:l,hoveredPath:s,kind:"directory"};if(n.dataset.itemType==="folder")return{directoryPath:s,flattenedSegmentPath:null,hoveredPath:s,kind:"directory"};let d=n.dataset.itemParentPath??null;if(d==null||d.length===0)return{directoryPath:null,flattenedSegmentPath:null,hoveredPath:s,kind:"root"};return{directoryPath:d,flattenedSegmentPath:null,hoveredPath:s,kind:"directory"}}function Ld(t){let n=t.cloneNode(!0);return n.removeAttribute("id"),n.dataset.fileTreeDragPreview="true",n.setAttribute("aria-hidden","true"),n.tabIndex=-1,Object.assign(n.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"}),n}function lm(){return navigator.vendor!=="Apple Computer, Inc."}function cm(t,n){let s=t-n.top;if(s<$r)return-Math.ceil(($r-Math.max(0,s))/$r*Nd);let a=n.bottom-t;if(a<$r)return Math.ceil(($r-Math.max(0,a))/$r*Nd);return 0}function dm(t,n){if(t!=null){let s=dd[t];if(s==null)return null;return{text:s,title:ud[t]}}if(n)return{icon:{name:"file-tree-icon-dot",width:6,height:6},title:hd};return null}function um(t,n,s){if(n==null||n.size===0)return null;let a=[];for(let l=t.length-1;l>=0;l-=1){let d=t[l],h=s.get(d);if(h!=null){for(let f of a)s.set(f,h);return h?"ignored":null}if(n.has(d)){s.set(d,!0);for(let f of a)s.set(f,!0);return"ignored"}a.push(d)}for(let l of a)s.set(l,!1);return null}function Bd(t){return t!=null&&"toggle"in t}function jd(t){return t.code==="Space"||t.key===" "||t.key==="Spacebar"}function hm(t){return t.key.length===1&&/^[\p{L}\p{N}]$/u.test(t.key)&&!t.ctrlKey&&!t.metaKey&&!t.altKey}function fm(t){if(t==null)return"";return`[data-item-section="spacing-item"][data-ancestor-path="${t.replaceAll("\\","\\\\").replaceAll('"',"\\\"")}"] { opacity: 1; }`}function Kd(t){return t.shiftKey&&t.key==="F10"||t.key==="ContextMenu"}function pm(t,n){if(n&&Kd(t))return!0;if((t.ctrlKey||t.metaKey)&&jd(t))return!0;return t.key==="ArrowDown"||t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="ArrowUp"}var mm=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"]);function Hd(t){for(let n of t.composedPath()){if(!(n instanceof HTMLElement))continue;if(n.dataset.fileTreeContextMenuRoot==="true")return!0;if(n.dataset.type==="context-menu-anchor"||n.dataset.type==="context-menu-trigger")return!0;if(n.getAttribute("slot")==="context-menu")return!0}return!1}function gm(t){return{bottom:t.bottom,height:t.height,left:t.left,right:t.right,top:t.top,width:t.width,x:t.x,y:t.y}}function vm(t,n){return{bottom:n,height:0,left:t,right:t,top:n,width:0,x:t,y:n}}function ym(t,n){if(t==null)return n.offsetTop;let s=n.getBoundingClientRect(),a=t.getBoundingClientRect();return s.top-a.top}function Vd(t,n,s){if(s==null){t.delete(n);return}t.set(n,s)}function Od(t,n,s){if(t==null)return null;let a=n.get(t)??null;if(a!=null)return a;let l=s.get(t)??null;return l?.dataset.itemParked==="true"?null:l}function bm(t){if(t==null)return[];let n=[];for(let s of t.querySelectorAll('button[data-file-tree-sticky-row="true"]')){if(!(s instanceof HTMLElement))continue;let a=s.dataset.fileTreeStickyPath;if(a!=null)n.push(a)}return n}function wm(t,n){if(t==null||n==null)return null;for(let s of t.querySelectorAll('button[data-item-focused="true"][data-item-parked="true"]'))if(s instanceof HTMLElement&&s.dataset.itemPath===n)return s;return null}function Sm(t,n,s,a,l,d,h){let f=Math.max(0,d-l),g=n?.getBoundingClientRect()??null,b=g==null||s==null?null:s.getBoundingClientRect().top-g.top,w=wm(t,a),I=g==null||w==null?null:w.getBoundingClientRect().top-g.top;return Math.max(0,Math.min(I??Math.max(b??0,f),Math.max(0,h-l)))}function qd(t,n){return{kind:t.kind,name:ia(t),path:n}}function Im(t){return t==null?void 0:`${t}__tree`}function Ud(t,n,s){if(t==null)return;return`${t}__focused-item-${encodeURIComponent(n)}${s?"__parked":""}`}function zd(t){return t==="file-tree-icon-chevron"||t==="file-tree-icon-dot"||t==="file-tree-icon-file"||t==="file-tree-icon-lock"}function Wd(t,n){if(t==null)return null;if("text"in t){if(t.parts!=null)return O("span",{title:t.title,children:t.parts.map((a,l)=>O("span",{style:{color:a.color},children:a.text},l))});return O("span",{title:t.title,children:t.text})}let s=typeof t.icon==="string"?zd(t.icon)?n(t.icon):{name:t.icon}:zd(t.icon.name)?(()=>{let a=n(t.icon.name),{name:l,...d}=t.icon;return{...a,...d}})():t.icon;return O("span",{title:t.title,children:O(Or,{...s})})}function $d(t){if(t==null)return;mr(t.querySelector(["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", "))??t)}function km(t,n,{actionLaneEnabled:s=!1,customDecoration:a=null,decorationLaneEnabled:l=!1,dragTargetFlattenedSegmentPath:d=null,gitDecoration:h=null,gitLaneActive:f=!1,renameInput:g=null,showDecorativeActionAffordance:b=!1}={}){let w=jr(t);return O(Sn,{children:[t.depth>0?O("div",{"data-item-section":"spacing",children:Array.from({length:t.depth}).map((I,v)=>O("div",{"data-item-section":"spacing-item","data-ancestor-path":t.ancestorPaths[v]},v))}):null,O("div",{"data-item-section":"icon",children:t.kind==="directory"?O(Or,{...n("file-tree-icon-chevron")}):O(Or,{...n("file-tree-icon-file",w)})}),O("div",{"data-item-section":"content",children:t.isFlattened?im(t,g,d):g??O(sd,{minimumLength:5,split:"extension",children:t.name})}),l?O("div",{"data-item-section":"decoration",children:a!=null?Wd(a,n):null}):null,f?O("div",{"data-item-section":"git",children:Wd(h,n)}):null,s?O("div",{"data-item-section":"action",children:b?O("span",{"aria-hidden":"true","data-item-action-affordance":"decorative",children:O(Or,{...n("file-tree-icon-ellipsis")})}):null}):null]})}function Po(t,n,s,a={}){let{controller:l,renameView:d,visualFocusPath:h,contextHoverPath:f,draggedPathSet:g,dragTarget:b,dragAndDropEnabled:w,shouldSuppressContextMenu:I,handleRowDragStart:v,handleRowDragEnd:_,handleRowTouchStart:k,instanceId:T,itemHeight:R,gitStatusByPath:B,ignoredGitDirectories:F,ignoredInheritanceCache:D,directoriesWithGitChanges:N,gitLaneActive:H,contextMenuEnabled:X,contextMenuTriggerMode:fe,contextMenuButtonTriggerEnabled:yt,contextMenuButtonVisibility:Le,contextMenuRightClickEnabled:bt,registerRenameInput:Ie,registerButton:Be,resolveIcon:Qe,renderDecorationForRow:qe,openContextMenuForRow:Tt,onRowClick:Ce,onKeyDown:we}=t,te=jr(n),{isParked:Re=!1,mode:It="flow",style:$e}=a,ut=It==="sticky",kt=B?.get(te)??null??um(n.ancestorPaths,F,D),ht=n.kind==="directory"&&(N?.has(te)??!1),Kt=qe(n,te),Mt=dm(kt,ht),St=X&&yt,Pt=Kt!=null||H||St,ft=St&&Le==="always",Ct=d.getPath()===te,_n=Ct?d.getValue():"",At=ut||!Ct?null:O(bd,{ref:Ie,ariaLabel:`Rename ${ia(n)}`,isFlattened:n.isFlattened,value:_n,onBlur:()=>{d.commit()},onInput:(gt)=>{d.setValue(gt.currentTarget.value)}}),tr=km(n,Qe,{actionLaneEnabled:St,customDecoration:Kt,decorationLaneEnabled:Pt,dragTargetFlattenedSegmentPath:b?.flattenedSegmentPath??null,gitDecoration:Mt,gitLaneActive:H,renameInput:At,showDecorativeActionAffordance:ft}),ln={...wd({ariaLabel:ia(n),domId:n.isFocused?Ud(T,te,Re):void 0,extraStyle:$e,features:{actionLaneEnabled:St,contextMenuButtonVisibility:St?Le:null,contextMenuEnabled:X,contextMenuTriggerMode:X?fe:null,gitLaneActive:H},isParked:Re,itemHeight:R,mode:It,row:n,state:{containsGitChange:ht,effectiveGitStatus:kt,isContextHovered:f===te,isDragTarget:b?.kind==="directory"&&b.directoryPath===te,isDragging:g?.has(te)===!0,isFocusRinged:n.isFocused&&h===te},targetPath:te}),key:s,onContextMenu:X||w?(gt)=>{if(I()){gt.preventDefault();return}if(!X)return;if(gt.preventDefault(),!bt)return;l.focusMountedPathFromInput(te),Tt(n,te,{anchorRect:vm(gt.clientX,gt.clientY),source:"right-click"})}:void 0,onFocus:!ut?()=>{l.focusMountedPathFromInput(te)}:void 0,onKeyDown:!ut?we:void 0,ref:(gt)=>{Be(te,gt)}};if(!ut&&Ct)return O("div",{...ln,children:tr});return O("button",{...ln,type:"button",draggable:w&&!Re,onDragEnd:w&&!Re?_:void 0,onDragStart:w&&!Re?(gt)=>{v(gt,n,te)}:void 0,onMouseDown:(gt)=>{if(ut){gt.preventDefault();return}if(l.isSearchOpen())gt.preventDefault()},onTouchStart:w&&!Re?(gt)=>{k(gt,n,te)}:void 0,onClick:(gt)=>{Ce(gt,n,te,It)},children:tr})}function Cm(t,n,s){if(n.end<n.start)return[];return t.controller.getVisibleRows(n.start,n.end).filter((a)=>!s.has(jr(a))).map((a,l)=>Po(t,a,n.start+l))}function Ro({composition:t,controller:n,gitStatusByPath:s,ignoredGitDirectories:a,directoriesWithGitChanges:l,icons:d,instanceId:h,itemHeight:f=Ci,overscan:g=10,renamingEnabled:b=!1,renderRowDecoration:w,searchBlurBehavior:I="close",searchEnabled:v=!1,searchFakeFocus:_=!1,slotHost:k,stickyFolders:T=!1,initialViewportHeight:R=420}){let B=le(null),F=le(null),D=le(!1),N=le(null),H=le(null),X=le(null),fe=le(null),yt=le(null),Le=le(new Map),bt=le(new Map),Ie=le(()=>{}),Be=le(null),Qe=le(0),qe=le(!1),Tt=le(null);if(Tt.current!==n)qe.current=!1,Tt.current=n;let Ce=le(!1),we=le(null),te=le(null),Re=le(!1),It=le(null),$e=le(null),ut=le(null),kt=le(null),ht=le(null),Kt=le(null),Mt=le(null),St=le(null),Pt=le(!1),ft=le(null),Ct=le(null),_n=le(null),At=le(null),tr=An(()=>new Map,[]),[,ln]=pn(0),gt=le(!1),[nr,Yt]=pn(null),[rr,yr]=pn(null),[ir,Wo]=pn(null),[$o,mn]=pn(null),[jo,Ko]=pn(0),[ve,br]=pn(null),Ln=le(ve);Ln.current=ve;let Bn=le(null),cn=le(null),or=le(null),gn=le(null),Vi=le(null),sr=le(!1),Hn=()=>{cn.current=null,or.current=null,gn.current=null},Vn=(S,M)=>{cn.current=S,or.current=null,gn.current=M==null?null:{path:S,scrollTop:M}},On=(S,M)=>{cn.current=null,or.current={path:S,viewportOffset:M},gn.current=null},vn=le(I==="retain"&&n.isSearchOpen()),[dn,Je]=pn(_);ta(()=>{if(!_)Je(!1)},[_]);let ni=le(!1),wr=Dt(()=>{ni.current=!0,Je((S)=>S?!1:S)},[]),[Sr,ri]=pn(()=>ra({controller:n,itemHeight:f,overscan:g,scrollTop:0,stickyFolders:T,viewportHeight:R})),[Uo,Go]=pn(!1);ta(()=>{Go(!0)},[]);let Nt=t?.contextMenu?.enabled===!0||t?.contextMenu?.render!=null||t?.contextMenu?.onOpen!=null||t?.contextMenu?.onClose!=null,P=t?.contextMenu?.triggerMode??(Nt?"right-click":"both"),W=P==="both"||P==="button",G=t?.contextMenu?.buttonVisibility??"when-needed",J=P==="both"||P==="right-click";Xt(()=>{let S=X.current;if(S==null)return;let M=(q)=>{if(!(q instanceof CustomEvent))return;let K=q.detail?.path??null;Vi.current=K,yr(K),mn(K==null?null:"pointer")},ee=(q)=>{if(!(q instanceof CustomEvent))return;sr.current=q.detail?.disabled===!0};return S.addEventListener("file-tree-debug-set-context-menu-trigger",M),S.addEventListener("file-tree-debug-set-scroll-suppression",ee),()=>{S.removeEventListener("file-tree-debug-set-context-menu-trigger",M),S.removeEventListener("file-tree-debug-set-scroll-suppression",ee)}},[]);let ke=Dt((S,M)=>{Vd(Le.current,S,M)},[]),Vt=Dt((S,M)=>{Vd(bt.current,S,M)},[]),qn=Dt((S)=>{H.current=S},[]),yn=Dt((S)=>Od(S,bt.current,Le.current),[]),Ir=s!=null||a!=null||l!=null,{resolveIcon:Oi}=An(()=>ds(d),[d]),En=n[Ns](),kr=En.getPath(),Xo=kr!=null,bn=n.isSearchOpen(),uh=n.getSearchValue(),ge=n.getFocusedPath(),De=n.getFocusedIndex(),ar=n.getScrollRequest(),Tn=n.isDragAndDropEnabled(),ii=n.getDragSession(),hh=An(()=>ii==null?null:new Set(ii.draggedPaths),[ii]),fh=ii?.target??null,oi=ii?.primaryPath??null,Ea=Im(h),{overlayHeight:ph,overlayRows:mh,snapshot:xt,visibleRows:qi}=Sr,Rt=xt.physical.viewportHeight,un=An(()=>({end:xt.window.endIndex,start:xt.window.startIndex}),[xt.window.endIndex,xt.window.startIndex]),si=mh,Ta=xt.sticky.rows,lr=xt.physical.totalHeight,Cr=xt.sticky.height,zi=An(()=>new Set(Ta.map((S)=>jr(S.row))),[Ta]),Yo=De>=0&&De>=un.start&&De<=un.end,gh=Dt((S,M)=>w?.({item:qd(S,M),row:S})??null,[w]),Pa=Dt((S)=>{if(mr(S==null?null:Le.current.get(S)??null))return!0;return mr(X.current)},[]),Wi=Dt((S)=>{Pa(n.focusNearestPath(S))},[n,Pa]),Ra=le(Wi);Ra.current=Wi;let xr=le(!0),Qo=le(()=>{}),rn=Dt((S=!0)=>{let M=Ln.current;if(M==null)return;if(xr.current=xr.current&&S,br(null),t?.contextMenu?.onClose?.(),xr.current)Wi(M.path)},[t?.contextMenu,Wi]);Qo.current=rn;let ai=Dt((S)=>{let M=S==null?null:ym(X.current,S);Wo((ee)=>ee===M?ee:M)},[]),Da=Dt((S,M,ee)=>{let q=n.getItem(M);if(q==null)return;let K=yn(M);if(K?.dataset.fileTreeStickyRow==="true"){let oe=fe.current;Vn(M,oe?.scrollTop??null),Ce.current=!0,Yt((je)=>je===M?je:M)}q.focus(),ai(K),xr.current=!0,br({anchorRect:ee?.anchorRect??null,item:qd(S,M),path:M,source:ee?.source??"keyboard"})},[n,yn,ai]),vh=Dt((S)=>{if(!b)return;if(n.isSearchOpen()){let M=fe.current,ee=qr(M,Rt);It.current=De<0||M==null?null:Math.max(0,Math.min(De*f-M.scrollTop,Math.max(0,ee-f))),Re.current=!0}if(n.startRenaming(S)===!1)return;mn("focus"),ln((M)=>M+1)},[n,De,f,b,Rt]),$i=Dt((S,{restoreTreeFocus:M=!0,targetOffset:ee="live-overlay"}={})=>{let q=fe.current;if(q==null)return!1;n.focusPath(S);let K=n.getFocusedIndex();if(K<0)return!1;let oe=n.getVisibleRows(K,K)[0]??null;if(oe==null)return!1;let je=qr(q,Rt),ie=n.getVisibleCount()*f,Te=ee==="sticky-parents"?oe.ancestorPaths.length*f:ra({controller:n,itemHeight:f,overscan:g,scrollTop:q.scrollTop,stickyFolders:T,viewportHeight:je}).snapshot.sticky.height;return Ce.current=!0,zr(q,K,f,je,ie,Te),Ie.current(),Bn.current=M?S:null,!0},[n,f,g,Rt,T]),yh=()=>D.current===!0||At.current!=null||Pt.current===!0,Ma=(S)=>typeof window.requestAnimationFrame==="function"?window.requestAnimationFrame(()=>{S()}):window.setTimeout(S,16),bh=(S)=>{if(S==null)return;if(typeof window.cancelAnimationFrame==="function"){window.cancelAnimationFrame(S);return}window.clearTimeout(S)},zn=()=>{if(kt.current!=null)clearTimeout(kt.current),kt.current=null;ut.current=null},ji=()=>{Kt.current?.remove(),Kt.current=null},li=()=>{bh($e.current),$e.current=null,ht.current=null},Aa=(S)=>{let M=X.current?.getRootNode();if(M instanceof ShadowRoot){M.append(S);return}document.body.append(S)},ci=()=>{if(St.current?.(),St.current=null,At.current!=null)clearTimeout(At.current),At.current=null;if(Pt.current=!1,ft.current=null,_n.current=null,Ct.current!=null)Ct.current.setAttribute("draggable","true"),Ct.current.style.removeProperty("touch-action"),Ct.current=null;ji(),zn(),li(),Mt.current=null},Ki=(S,M)=>{let ee=X.current?.getRootNode(),q=Fd(sm(ee instanceof ShadowRoot?ee:document,S,M));return n.setDragTarget(q),n.getDragSession()?.target??null},Jo=(S)=>{let M=n.getDragAndDropConfig()?.openOnDropDelay??800;if(S==null||S.kind!=="directory"||S.directoryPath==null||M<=0){zn();return}let ee=n.getItem(S.directoryPath),q=Bd(ee)?ee:null;if(q==null||q.isExpanded()){zn();return}let K=`${S.directoryPath}::${S.flattenedSegmentPath??""}`;if(ut.current===K)return;zn(),ut.current=K,kt.current=setTimeout(()=>{let oe=n.getDragSession()?.target;if(oe?.kind!=="directory"||oe.directoryPath!==S.directoryPath||oe.flattenedSegmentPath!==S.flattenedSegmentPath)return;q.expand()},M)},Na=()=>{$e.current=null;let S=ht.current,M=fe.current;if(S==null||M==null||n.getDragSession()==null)return;let ee=M.getBoundingClientRect(),q=cm(S.clientY,ee);if(q===0)return;let K=Math.max(0,M.scrollHeight-M.clientHeight),oe=Math.max(0,Math.min(K,M.scrollTop+q));if(oe!==M.scrollTop)M.scrollTop=oe,Ie.current();Jo(Ki(S.clientX,S.clientY)),$e.current=Ma(Na)},Fa=(S,M)=>{ht.current={clientX:S,clientY:M},$e.current??=Ma(Na)},wh=(S,M,ee)=>{let q=S.currentTarget;if(q==null)return;if(ci(),ji(),zn(),li(),n.startDrag(ee)===!1){S.preventDefault();return}if(Mt.current=M,S.dataTransfer!=null){if(S.dataTransfer.effectAllowed="move",S.dataTransfer.dropEffect="move",S.dataTransfer.setData("text/plain",ee),lm()){let K=Ld(q),oe=q.getBoundingClientRect();Object.assign(K.style,{height:`${oe.height}px`,opacity:"0.85",transform:"translate3d(-9999px, 0px, 0)",width:`${oe.width}px`}),Aa(K),Kt.current=K,S.dataTransfer.setDragImage(K,Math.max(0,S.clientX-oe.left),Math.max(0,S.clientY-oe.top))}}},Sh=()=>{ji(),zn(),li(),Mt.current=null,n.cancelDrag()},Ih=(S,M,ee)=>{if(At.current!=null||Pt.current)return;let q=S.touches[0],K=S.currentTarget;if(q==null||K==null)return;_n.current={clientX:q.clientX,clientY:q.clientY},Ct.current=K,K.setAttribute("draggable","false");let oe=(Te={})=>{let Oe=Te.restoreNativeDraggable??!Pt.current;if(At.current!=null)clearTimeout(At.current),At.current=null;if(document.removeEventListener("touchmove",je),document.removeEventListener("touchend",ie),document.removeEventListener("touchcancel",ie),St.current===oe)St.current=null;if(Oe){if(K.setAttribute("draggable","true"),Ct.current===K)Ct.current=null;_n.current=null}},je=(Te)=>{let Oe=Te.touches[0],Ae=_n.current;if(Oe==null||Ae==null)return;let lt=Oe.clientX-Ae.clientX,Ft=Oe.clientY-Ae.clientY;if(lt*lt+Ft*Ft<=Ad*Ad)return;oe()},ie=()=>{oe()};document.addEventListener("touchmove",je,{passive:!0}),document.addEventListener("touchend",ie),document.addEventListener("touchcancel",ie),St.current=oe,At.current=setTimeout(()=>{if(oe({restoreNativeDraggable:!1}),n.startDrag(ee)===!1){if(K.setAttribute("draggable","true"),Ct.current===K)Ct.current=null;_n.current=null;return}Pt.current=!0,Ct.current=K,K.setAttribute("draggable","false"),K.style.setProperty("touch-action","none"),Mt.current=M;let Te=K.getBoundingClientRect(),Oe=Ld(K);Object.assign(Oe.style,{height:`${Te.height}px`,opacity:"0.85",transform:`translate3d(${Te.left}px, ${Te.top}px, 0)`,width:`${Te.width}px`}),Aa(Oe),Kt.current=Oe,ft.current={x:q.clientX-Te.left,y:q.clientY-Te.top};let Ae=(hn)=>{let wt=hn.touches[0];if(wt==null)return;hn.preventDefault();let _e=ft.current;if(_e!=null&&Kt.current!=null)Kt.current.style.transform=`translate3d(${wt.clientX-_e.x}px, ${wt.clientY-_e.y}px, 0)`;Jo(Ki(wt.clientX,wt.clientY)),Fa(wt.clientX,wt.clientY)},lt=(hn)=>{let wt=hn.changedTouches[0];if(wt!=null)Ki(wt.clientX,wt.clientY);n.completeDrag(),ci()},Ft=()=>{n.cancelDrag(),ci()};St.current=()=>{document.removeEventListener("touchmove",Ae),document.removeEventListener("touchend",lt),document.removeEventListener("touchcancel",Ft)},document.addEventListener("touchmove",Ae,{passive:!1}),document.addEventListener("touchend",lt),document.addEventListener("touchcancel",Ft)},om)},La=(S)=>{if(ve!=null){if(S.key==="Escape"){rn(),S.preventDefault(),S.stopPropagation();return}if(mm.has(S.key))S.preventDefault(),S.stopPropagation();return}if(En.isActive()){if(S.isComposing||S.keyCode===229)return;if(S.key==="Escape")En.cancel();else if(S.key==="Enter")En.commit();else return;mn("focus"),ln((pt)=>pt+1),S.preventDefault(),S.stopPropagation();return}if(b&&S.key==="F2"){vh(ge??void 0),S.preventDefault(),S.stopPropagation();return}if(bn){if(S.key==="Escape")Re.current=!1,It.current=null,n.closeSearch();else if(S.key==="Enter"){let pt=n.getFocusedPath();if(pt!=null)n.selectOnlyPath(pt);let wn=fe.current,Qi=qr(wn,Rt);It.current=De<0||wn==null?null:Math.max(0,Math.min(De*f-wn.scrollTop,Math.max(0,Qi-f))),Re.current=!0,n.closeSearch()}else if(S.key==="ArrowDown")n.focusNextSearchMatch();else if(S.key==="ArrowUp")n.focusPreviousSearchMatch();else return;mn("focus"),ln((pt)=>pt+1),S.preventDefault(),S.stopPropagation();return}if(v&&hm(S)){n.openSearch(S.key),ln((pt)=>pt+1),S.preventDefault(),S.stopPropagation();return}let M=Nt&&Kd(S),ee=pm(S,Nt),q=ee&&X.current!=null?Ti(X.current):null,K=ee?new Set(bm(X.current)):new Set,oe=q?.dataset.fileTreeStickyPath??null,je=q?.dataset.fileTreeStickyRow==="true"&&oe!=null;if(je&&oe!==ge&&K.has(oe)){let pt=fe.current;Vn(oe,pt?.scrollTop??null),n.focusPath(oe)}let ie=n.getFocusedPath(),Te=n.getFocusedIndex(),Oe=n.getFocusedItem();if(Oe==null)return;let Ae=Bd(Oe)?Oe:null,lt=ie!=null&&(zi.has(ie)||je&&oe===ie&&K.has(ie)),Ft=S.key==="ArrowDown"||S.key==="ArrowUp"||S.key==="ArrowRight"&&Ae!=null&&Ae.isExpanded(),hn=S.key==="ArrowLeft"&<&&Ae!=null&&Ae.isExpanded(),wt=fe.current,_e=!0;if(S.shiftKey&&S.key==="ArrowDown")n.extendSelectionFromFocused(1);else if(S.shiftKey&&S.key==="ArrowUp")n.extendSelectionFromFocused(-1);else if(M&&ie!=null&&Te>=0){let pt=n.getVisibleRows(Te,Te)[0]??null,wn=Od(ie,bt.current,Le.current);if(pt==null||wn==null)_e=!1;else Da(pt,ie)}else if((S.ctrlKey||S.metaKey)&&jd(S))n.toggleFocusedSelection();else if((S.ctrlKey||S.metaKey)&&S.key.toLowerCase()==="a")n.selectAllVisiblePaths();else switch(S.key){case"ArrowDown":n.focusNextItem();break;case"ArrowUp":n.focusPreviousItem();break;case"ArrowRight":if(Ae==null||Ae.isExpanded())n.focusNextItem();else Ae.expand();break;case"ArrowLeft":if(Ae!=null&&Ae.isExpanded())Ae.collapse();else n.focusParentItem();break;case"Home":n.focusFirstItem();break;case"End":n.focusLastItem();break;default:_e=!1}if(!_e)return;mn("focus");let dt=n.getFocusedPath(),Ot=dt!=null&&(zi.has(dt)||K.has(dt)),Xi=Ft&&dt!==ie,Yi=M&&je&&oe===ie&&dt===ie;if((lt||Yi)&&dt!=null&&(Xi&&Ot||Yi))Vn(dt,wt?.scrollTop??null),Ce.current=!0,Yt((pt)=>pt===dt?pt:dt);else{let pt=S.key==="ArrowUp"&<&&dt!==ie;if(dt!=null&&(pt||hn&&dt===ie))On(dt,Sm(X.current,wt,q,ie,f,Cr,Rt)),Ce.current=!0,Yt((wn)=>wn===dt?wn:dt);else Hn()}ln((pt)=>pt+1),S.preventDefault(),S.stopPropagation()};Xt(()=>{if(!v||!bn)return;if(vn.current){vn.current=!1;return}mr(yt.current)},[bn,v]),Xt(()=>{let S=H.current;switch(yd({hasRenderedInput:S!=null,previousRenamingPath:te.current,renamingPath:kr})){case"reset":te.current=null;return;case"reveal-canonical":if(kr!=null)$i(kr,{restoreTreeFocus:!1,targetOffset:"live-overlay"});return;case"ignore":return;case"focus-input":if(S!=null)Bn.current=null,te.current=kr,mr(S),S.select();return}},[un.end,un.start,kr,$i,zi]),Xt(()=>{let S=X.current;if(S==null)return;let M=null,ee=()=>{if(M==null)return;clearTimeout(M),M=null},q=()=>{let je=Ti(S)?.dataset.itemPath??null;Yt((ie)=>ie===je?ie:je)},K=()=>{ee(),Ce.current=!0,q()},oe=(je)=>{let ie=je.relatedTarget;if(ie==null){ee(),M=setTimeout(()=>{if(M=null,Ti(S)!=null){q();return}Ce.current=!1,Yt(null)},0);return}if(!(ie instanceof Node)||!S.contains(ie)){ee(),Ce.current=!1,Yt(null);return}let Te=ie instanceof HTMLElement?ie.dataset.itemPath??null:null;Yt((Oe)=>Oe===Te?Oe:Te)};return S.addEventListener("focusin",K),S.addEventListener("focusout",oe),()=>{ee(),S.removeEventListener("focusin",K),S.removeEventListener("focusout",oe)}},[]),Xt(()=>{let S=X.current;if(S==null)return;if(xt.physical.scrollTop<=0)S.dataset.scrollAtTop="true";else delete S.dataset.scrollAtTop},[xt.physical.scrollTop]),Xt(()=>{let S=null,M=fe.current,ee=N.current,q=X.current;if(M==null)return;Be.current=qr(M,R);let K=()=>{let _e=n.getVisibleCount(),dt=Xs(Be.current,R),Ot=Math.max(0,_e*f-dt);if(M.scrollTop>Ot)M.scrollTop=Ot;ri(ra({controller:n,itemHeight:f,overscan:g,scrollTop:Math.min(M.scrollTop,Ot),stickyFolders:T,viewportHeight:dt}))};if(!qe.current){qe.current=!0;let _e=n.getFocusedIndex();if(_e>=0){let dt=Xs(Be.current,R),Ot=n.getVisibleRows(_e,_e)[0]??null;Ys(M,_e,f,dt,T&&Ot!=null?Math.max(0,Math.min(Ot.ancestorPaths.length*f,Math.max(0,dt-f))):0)}}Ie.current=K;let oe=n.subscribe(()=>{if(fd(gt))ln((_e)=>_e+1);K()}),je=()=>{if(sr.current===!0)return;if(ee!=null)ee.dataset.isScrolling??="";if(q!=null)q.dataset.isScrolling??="";if(D.current=!0,S!=null)clearTimeout(S);S=setTimeout(()=>{if(ee!=null)delete ee.dataset.isScrolling;if(q!=null)delete q.dataset.isScrolling;D.current=!1,Ko((_e)=>_e+1),S=null},50)},ie=null,Te=()=>{if(q!=null)delete q.dataset.overlayReveal;if(ie!=null)clearTimeout(ie),ie=null},Oe=()=>{if(q==null||sr.current===!0)return;if(M.scrollTop>0)return;if(q.dataset.overlayReveal="true",ie!=null)clearTimeout(ie);ie=setTimeout(()=>{Te()},200)},Ae=()=>{if(K(),M.scrollTop>0)Te();if(Ln.current!=null&&D.current)Qo.current();if(sr.current===!0){D.current=!1;return}yr((_e)=>_e==null?_e:null),je()},lt=()=>{je(),Oe()},Ft=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"," ","Spacebar"]),hn=(_e)=>{if(!Ft.has(_e.key))return;lt()};M.addEventListener("scroll",Ae,{passive:!0}),M.addEventListener("wheel",lt,{passive:!0}),M.addEventListener("touchmove",lt,{passive:!0}),M.addEventListener("keydown",hn);let wt=typeof ResizeObserver<"u"?new ResizeObserver((_e)=>{Be.current=(_e[0]==null?null:gd(_e[0]))??qr(M,R),K()}):null;return wt?.observe(M),()=>{if(Ie.current=()=>{},oe(),M.removeEventListener("scroll",Ae),M.removeEventListener("wheel",lt),M.removeEventListener("touchmove",lt),M.removeEventListener("keydown",hn),S!=null)clearTimeout(S);if(ie!=null)clearTimeout(ie);if(ee!=null)delete ee.dataset.isScrolling;if(q!=null)delete q.dataset.isScrolling,delete q.dataset.overlayReveal;D.current=!1,Be.current=null,wt?.disconnect()}},[n,R,f,g,T]),Xt(()=>{if(Nt||ve==null)return;rn(!1)},[rn,Nt,ve]);let Ba=An(()=>ve==null?null:`${ve.path}::${ve.source}`,[ve]);Xt(()=>{if(Ba==null){k?.clearSlotContent(Tr);return}let S=Ln.current;if(S==null)return;let M=F.current??B.current;if(M==null)return;let ee={anchorElement:M,anchorRect:S.anchorRect??gm(M.getBoundingClientRect()),close:(K)=>{Qo.current(K?.restoreFocus??!0)},restoreFocus:()=>{if(!xr.current)return;Ra.current(Ln.current?.path??null)}},q=t?.contextMenu?.render?.(S.item,ee)??null;return k?.setSlotContent(Tr,q),t?.contextMenu?.onOpen?.(S.item,ee),$d(q),queueMicrotask(()=>{if(q==null||!q.isConnected)return;if(document.activeElement!==q)return;$d(q)}),()=>{k?.clearSlotContent(Tr)}},[Ba,t?.contextMenu,k]),Xt(()=>{if(ve!=null&&n.getItem(ve.path)==null)rn()},[rn,ve,n]),Xt(()=>{if(ve==null)return;let S=X.current?.getRootNode(),M=S instanceof ShadowRoot?S.host:X.current,ee=(K)=>{let oe=K.target;if(!(oe instanceof Node))return;if(Hd(K))return;if(B.current?.contains(oe)===!0)return;if(M?.contains(oe)===!0)return;rn()},q=(K)=>{if(K.key==="Escape")K.preventDefault(),K.stopPropagation(),rn()};return document.addEventListener("mousedown",ee,!0),document.addEventListener("keydown",q,!0),()=>{document.removeEventListener("mousedown",ee,!0),document.removeEventListener("keydown",q,!0)}},[rn,ve]),Xt(()=>{let S=fe.current,M=X.current;if(S==null||M==null){we.current=ge;return}let ee=ge==null?null:Le.current.get(ge)??null,q=Ti(M),K=q?.dataset.itemPath??null,oe=Xo&&H.current===q,je=v&&yt.current===q,ie=Re.current&&!bn,Te=It.current??0,Oe=Bn.current,Ae=cn.current,lt=or.current,Ft=gn.current,hn=q!=null,wt=Ce.current||hn,_e=we.current!==ge,dt=Ae!=null&&Ae===ge&&ge!=null,Ot=!1,Xi=!1;if(ar!=null&&ar.id!==Qe.current){Qe.current=ar.id;let es=ar.visibleIndex,za=n.getVisibleRows(es,es)[0]??null;if(za!=null){let Gh=T?Math.max(0,Math.min(za.ancestorPaths.length*f,Math.max(0,Rt-f))):Cr;Ot=!0,Xi=vd(S,es,f,Rt,lr,ar.offset,Gh)}n.clearScrollRequest(ar.id)}let Yi=!Ot&&ie&&zr(S,De,f,Rt,lr,Te),pt=!Ot&&Oe!=null&&Oe===ge&&zr(S,De,f,Rt,lr,Cr),wn=!Ot&<!=null&<.path===ge&&zr(S,De,f,Rt,lr,lt.viewportOffset),Qi=!Ot&&Ft!=null&&Ft.path===ge&&S.scrollTop!==Ft.scrollTop;if(Qi)S.scrollTop=Ft.scrollTop;if(Qi||Xi||pt||wn||Yi||wt&&_e&&Oe!==ge&&!dt&&Ys(S,De,f,Rt,Cr))Ie.current();if(Ot){we.current=ge;return}if(!wt){we.current=ge;return}if(oe){we.current=ge;return}if(je&&!ie){we.current=ge;return}if(ee==null){if(ie&&De>=0)zr(S,De,f,Rt,lr,Te),Ie.current();we.current=ge;return}if(_e||ie||Oe===ge||Ae===ge||lt?.path===ge||Ft?.path===ge||K==null||K!==ge){if(mr(ee),Oe===ge)Bn.current=null;if(Ae===ge)cn.current=null;if(lt?.path===ge)or.current=null;if(Ft?.path===ge)gn.current=null;Re.current=!1,It.current=null}we.current=ge},[n,De,ge,Yo,f,Xo,bn,un,Rt,v,ar,T,Cr,lr,qi]);let kh=De>=0&&De>=xt.visible.startIndex&&De<=xt.visible.endIndex,Ch=ge!=null&&si.some((S)=>jr(S.row)===ge),xh=kh||Ch,_h=W&&Ce.current===!0&&xh?ge:null,Eh=$o==="pointer"?rr:null,cr=ve?.path??Vi.current??Eh??_h??rr,Ha=ve?.source==="right-click";Xt(()=>{if(D.current&&ve==null)return;ai(yn(cr))},[ve,yn,un,Rt,jo,si,cr,ai,qi]);let Th=Dt((S)=>{if(D.current)return;if(Hd(S))return;let M=S.target;if(!(M instanceof HTMLElement))return;if(M.closest?.('[data-type="context-menu-trigger"]')!=null)return;let ee=M.closest?.('[data-file-tree-sticky-row="true"]'),q=M.closest?.('[data-type="item"]'),K=ee instanceof HTMLElement?ee.dataset.fileTreeStickyPath??null:q instanceof HTMLElement?q.dataset.itemPath??null:null;if(K!=null)mn((oe)=>oe==="pointer"?oe:"pointer");yr((oe)=>oe===K?oe:K)},[]),Ph=Dt(()=>{yr(null)},[]);Xt(()=>{if(!Tn)return;let S=()=>{ci(),n.cancelDrag()};return window.addEventListener("dragend",S),()=>{window.removeEventListener("dragend",S),ci(),n.cancelDrag()}},[n,Tn]);let Rh=(S)=>{if(!Tn||n.getDragSession()==null||Pt.current)return;let M=Fd(S.target instanceof HTMLElement?S.target:null);if(n.setDragTarget(M),Jo(n.getDragSession()?.target??null),Fa(S.clientX,S.clientY),S.dataTransfer!=null)S.dataTransfer.dropEffect="move";S.preventDefault()},Dh=(S)=>{if(!Tn||n.getDragSession()==null||Pt.current)return;let M=S.relatedTarget;if(M instanceof Node&&X.current?.contains(M)===!0)return;zn(),li(),n.setDragTarget(null)},Mh=(S)=>{if(!Tn||n.getDragSession()==null||Pt.current)return;S.preventDefault(),Ki(S.clientX,S.clientY),n.completeDrag(),ji(),zn(),li(),Mt.current=null},di=xt.window.height,Ah=xt.window.offsetTop,Nh=Math.min(0,Rt-di),Fh=Math.min(0,Rt-di-Cr),Lh=nr===ge||Re.current,_r=ge!=null&&Lh&&!Yo&&De>=0?qi[De]??n.getVisibleRows(De,De)[0]??null:null,Va=_r==null?null:Qs(De,f,un,di),Wn=Mt.current,Bh=oi!=null&&Wn!=null&&Wn.path===oi&&Wn.index>=un.start&&Wn.index<=un.end,ui=oi!=null&&Wn!=null&&Wn.path===oi&&!Bh&&Wn.path!==_r?.path?Wn:null,Oa=ui==null?null:Qs(ui.index,f,un,di),Hh=fm((De>=0?qi[De]??n.getVisibleRows(De,De)[0]??null:null)?.ancestorPaths.at(-1)??null),Vh=bn&&ge!=null?Ud(h,ge,!Yo):void 0,Oh=ve?.path??(bn?ge:nr),qh=ve?.path??rr,hi=yn(cr),Zo=Nt&&W&&!Ha&&!Xo&&hi!=null&&ir!=null&&cr!=null,zh=Nt&&(Zo||ve!=null),Ui=ve?.anchorRect,qa=Ui==null&&hi!=null&&ir!=null&&(ve!=null||Zo)?ir:null,Wh=Ui!=null?{left:`${Ui.left}px`,position:"fixed",right:"auto",top:`${Ui.top}px`}:qa!=null?{top:`${qa}px`}:void 0,$h=Ha?{opacity:"0"}:void 0,jh=Dt((S,M,ee,q)=>{let K=Sd({event:{ctrlKey:S.ctrlKey,metaKey:S.metaKey,shiftKey:S.shiftKey},isDirectory:M.kind==="directory",isSearchOpen:bn,mode:q}),oe=K.toggleDirectory&&M.kind==="directory",je=oe?n.resolveMountedDirectoryPathFromInput(ee):null;if(oe&&je==null)return;let ie=je??ee;switch(K.selection.kind){case"range":n.selectPathRange(ie,K.selection.additive);break;case"toggle":n.togglePathSelectionFromInput(ie);break;case"single":n.selectOnlyMountedPathFromInput(ie);break}let Te=S.currentTarget instanceof HTMLElement?S.currentTarget:null,Oe=M.index>=xt.visible.startIndex&&M.index<=xt.visible.endIndex,Ae=q==="flow"&&Oe&&Te!=null&&Te.dataset.itemParked!=="true";if(n.focusMountedPathFromInput(ie),Ae)Ce.current=!0,Yt((lt)=>lt===ie?lt:ie),mn("focus");if(oe)n.toggleMountedDirectoryFromInput(ie);if(K.closeSearch)n.closeSearch();if(K.revealCanonical)$i(ie,{targetOffset:"sticky-parents"})},[n,bn,xt.visible.endIndex,xt.visible.startIndex,$i]),Kh=()=>{if(D.current)return;if(!W)return;if(cr==null||hi==null)return;let S=n.getItem(cr);if(S==null)return;ai(hi),xr.current=!0,br({anchorRect:null,item:{kind:S.isDirectory()?"directory":"file",name:hi.getAttribute("aria-label")??cr,path:S.getPath()},path:S.getPath(),source:"button"})},Gi={contextHoverPath:qh,contextMenuButtonTriggerEnabled:W,contextMenuButtonVisibility:G,contextMenuEnabled:Nt,contextMenuRightClickEnabled:J,contextMenuTriggerMode:P,controller:n,directoriesWithGitChanges:l,dragAndDropEnabled:Tn,draggedPathSet:hh,dragTarget:fh,gitLaneActive:Ir,gitStatusByPath:s,handleRowDragEnd:Sh,handleRowDragStart:wh,handleRowTouchStart:Ih,ignoredGitDirectories:a,ignoredInheritanceCache:tr,instanceId:h,itemHeight:f,onKeyDown:La,onRowClick:jh,openContextMenuForRow:Da,registerButton:ke,registerRenameInput:qn,renameView:En,renderDecorationForRow:gh,resolveIcon:Oi,shouldSuppressContextMenu:yh,visualFocusPath:Oh},Uh={...Gi,registerButton:Vt};return O("div",{ref:X,id:Ea,"data-file-tree-context-menu-button-visibility":Nt&&W?G:void 0,"data-file-tree-context-menu-trigger-mode":Nt?P:void 0,"data-file-tree-has-context-menu-action-lane":Nt&&W?"true":void 0,"data-file-tree-has-git-lane":Ir?"true":void 0,"data-file-tree-virtualized-root":"true",onDragLeave:Tn?Dh:void 0,onDragOver:Tn?Rh:void 0,onDrop:Tn?Mh:void 0,onKeyDown:La,onPointerLeave:Nt?Ph:void 0,onPointerOver:Nt?Th:void 0,role:"tree",tabIndex:-1,style:{outline:"none",position:"relative"},children:[O("style",{"data-file-tree-guide-style":"true",dangerouslySetInnerHTML:{__html:Hh}}),O("slot",{name:Er,"data-type":"header-slot"}),v?O("div",{"data-file-tree-search-container":!0,"data-open":bn?"true":"false",children:O("input",{ref:yt,"aria-activedescendant":Vh,"aria-controls":Ea,placeholder:"Search…","data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":dn?"true":void 0,value:uh,onBlur:()=>{if(I==="retain"&&!ni.current)return;n.closeSearch()},onFocus:wr,onPointerDown:wr,onInput:(S)=>{wr();let M=S.currentTarget;n.setSearch(M.value)}})}):null,O("div",{ref:fe,"data-file-tree-virtualized-scroll":"true",children:[T&&Uo&&si.length>0?O("div",{"aria-hidden":"true","data-file-tree-sticky-overlay":"true",children:O("div",{"data-file-tree-sticky-overlay-content":"true",style:{height:`${ph}px`},children:si.map((S,M)=>Po(Uh,S.row,`sticky:${jr(S.row)}`,{mode:"sticky",style:{left:"0",position:"absolute",right:"0",top:`${S.top}px`,zIndex:`${si.length-M}`}}))})}):null,O("div",{ref:N,"data-file-tree-virtualized-list":"true",style:{height:`${lr}px`},children:[O("div",{"data-file-tree-virtualized-sticky-offset":"true","aria-hidden":"true",style:{height:`${Ah}px`}}),O("div",{"data-file-tree-virtualized-sticky":"true",style:{height:`${di}px`,top:`${Nh}px`,bottom:`${Fh}px`},children:[Cm(Gi,un,zi),_r!=null&&Va!=null?Po(Gi,_r,`parked:${_r.path}`,{isParked:!0,style:{left:"0",opacity:"0",pointerEvents:oi===_r.path?"none":void 0,position:"absolute",right:"0",top:`${Va}px`}}):null,ui!=null&&Oa!=null?Po(Gi,ui,`parked-drag:${ui.path}`,{isParked:!0,style:{left:"0",opacity:"0",pointerEvents:"none",position:"absolute",right:"0",top:`${Oa}px`}}):null]})]})]}),Nt?O("div",{ref:B,"data-type":"context-menu-anchor","data-visible":zh?"true":"false",style:Wh,children:[O("button",{ref:F,type:"button","data-type":cs,"aria-label":"Options","aria-haspopup":"menu","aria-expanded":ve!=null?"true":"false","data-visible":Zo?"true":"false",onMouseDown:(S)=>{S.preventDefault()},onClick:(S)=>{if(S.preventDefault(),S.stopPropagation(),ve!=null){rn();return}Kh()},tabIndex:-1,style:$h,children:O(Or,{...Oi("file-tree-icon-ellipsis")})}),ve!=null?O("slot",{name:Tr}):null]}):null,ve!=null?O("div",{"data-type":"context-menu-wash","aria-hidden":"true",onMouseDownCapture:(S)=>{S.preventDefault(),rn()},onTouchStartCapture:(S)=>{S.preventDefault(),S.stopPropagation(),rn()},onTouchMoveCapture:(S)=>{S.preventDefault(),S.stopPropagation()},onWheelCapture:(S)=>{S.preventDefault(),S.stopPropagation()}}):null]})}var oa={hydrateRoot:(t,n)=>{td(Vr(Ro,n),t)},renderRoot:(t,n)=>{_o(Vr(Ro,n),t)},unmountRoot:(t)=>{_o(null,t)}};function Kr(t,n){oa.renderRoot(t,n)}function Gd(t,n){oa.hydrateRoot(t,n)}function Xd(t){oa.unmountRoot(t)}var Yd=class{#e=new Map;#t=null;clearAll(){for(let t of this.#e.values())t.remove();this.#e.clear()}clearSlotContent(t){let n=this.#c(t);if(n==null)return;n.remove(),this.#e.delete(t)}setHost(t){if(this.#t=t,t==null)return;this.#a(t);for(let[n,s]of this.#e)this.#d(n,s)}setSlotContent(t,n){let s=this.#c(t);if(s===n){if(n!=null)this.#e.set(t,n),this.#d(t,n);return}if(s?.remove(),n==null){this.#e.delete(t);return}this.#e.set(t,n),this.#d(t,n)}setSlotHtml(t,n){let s=n?.trim()??"";if(s.length===0){this.setSlotContent(t,null);return}let a=this.#c(t);if(a!=null&&a.innerHTML===s){this.#e.set(t,a),this.#d(t,a);return}let l=document.createElement("div");l.innerHTML=s,this.setSlotContent(t,l)}#c(t){let n=this.#e.get(t)??null;if(n!=null)return n;let s=this.#t;if(s==null)return null;for(let a of Array.from(s.children)){if(!(a instanceof HTMLElement))continue;if(a.dataset.fileTreeManagedSlot===t)return a}return null}#d(t,n){if(n.slot=t,n.dataset.fileTreeManagedSlot=t,this.#t!=null&&n.parentNode!==this.#t)this.#t.appendChild(n)}#a(t){for(let n of Array.from(t.children)){if(!(n instanceof HTMLElement))continue;let s=n.dataset.fileTreeManagedSlot;if(s==null||this.#e.has(s))continue;this.#e.set(s,n)}}};function Nn(t,n,s){if(!t.s){if(s instanceof xm){if(!s.s)return void(s.o=Nn.bind(null,t,n));1&n&&(n=s.s),s=s.v}if(s&&s.then)return void s.then(Nn.bind(null,t,n),Nn.bind(null,t,2));t.s=n,t.v=s;let a=t.o;a&&a(t)}}var xm=function(){function t(){}return t.prototype.then=function(n,s){var a=new t,l=this.s;if(l){var d=1&l?n:s;if(d){try{Nn(a,1,d(this.v))}catch(h){Nn(a,2,h)}return a}return this}return this.o=function(h){try{var f=h.v;1&h.s?Nn(a,1,n?n(f):f):s?Nn(a,1,s(f)):Nn(a,2,f)}catch(g){Nn(a,2,g)}},a},t}();var Qd=0;function _m(t){if(t!=null&&t.length>0)return t;return Qd+=1,`pst_ft_${Qd}`}function Em({initialVisibleRowCount:t,itemHeight:n}){return t==null?420:Math.max(0,t)*(n??Ci)}function Jd(t){if(typeof document>"u")return;let n=document.createElement("div");n.innerHTML=t;let s=n.querySelector("svg");return s instanceof SVGElement?s:void 0}function Zd(t){return t.querySelector("#file-tree-icon-chevron")instanceof SVGElement&&t.querySelector("#file-tree-icon-file")instanceof SVGElement&&t.querySelector("#file-tree-icon-dot")instanceof SVGElement&&t.querySelector("#file-tree-icon-lock")instanceof SVGElement}function eu(t){return Array.from(t.children).filter((n)=>n instanceof SVGElement)}var Ri=class{static LoadedCustomComponent=!0;#e;#t;#c;#d;#a;#V;#O;#v;#r;#y=new Yd;#T;#b;#m;#h;#w;#S;#f;#q;#z;#N=null;#i;#W=!1;#$=!1;constructor(t){let{composition:n,density:s,fileTreeSearchMode:a,gitStatus:l,id:d,initialSearchQuery:h,icons:f,itemHeight:g,onSearchChange:b,onSelectionChange:w,overscan:I,renderRowDecoration:v,renaming:_,search:k,searchBlurBehavior:T,searchFakeFocus:R,stickyFolders:B,unsafeCSS:F,initialVisibleRowCount:D,...N}=t;this.#e=n,this.#c=_m(d),this.#h=Fs(l),this.#w=f,this.#S=F,this.#d=w,this.#a=v,this.#V=_!=null&&_!==!1,this.#O=T,this.#v=k===!0,this.#r=R===!0,this.#T=wc(s,g),this.#b={itemHeight:this.#T.itemHeight,overscan:I,stickyFolders:B,initialVisibleRowCount:D},this.#t=new Ac({...N,fileTreeSearchMode:a,initialSearchQuery:h,onSearchChange:b,renaming:_}),this.#z=this.#t.getSelectionVersion(),this.#N=this.#d==null?null:this.subscribe(()=>{this.#R()})}unmount(){if(this.#i!=null)Xd(this.#i),delete this.#i.dataset.fileTreeVirtualizedWrapper,this.#i=void 0;if(this.#y.clearAll(),this.#y.setHost(null),this.#m!=null)delete this.#m.dataset.fileTreeVirtualized,this.#L(this.#m),this.#m=void 0}cleanUp(){this.unmount(),this.#N?.(),this.#N=null,this.#t.destroy()}getFileTreeContainer(){return this.#m}getItem(t){return this.#t.getItem(t)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(t,n){return this.#t.getVisibleRows(t,n)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#T.itemHeight}getDensityFactor(){return this.#T.factor}subscribe(t){let n=!1;return this.#t.subscribe(()=>{if(!n){n=!0;return}t()})}focusPath(t){this.#t.focusPath(t)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(t,n){this.#t.scrollToPath(t,n)}focusNearestPath(t){return this.#t.focusNearestPath(t)}add(t){this.#t.add(t)}batch(t){this.#t.batch(t)}applyGitStatusPatch(t){let n=Bc(this.#h,t);if(n===this.#h)return;this.#h=n;let s=this.#s();if(s==null)return;Kr(s.wrapper,this.#P())}move(t,n,s){this.#t.move(t,n,s)}onMutation(t,n){return this.#t.onMutation(t,n)}setSearch(t){this.#t.setSearch(t)}openSearch(t){this.#t.openSearch(t)}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(t,n){return this.#t.startRenaming(t,n)}remove(t,n){this.#t.remove(t,n)}resetPaths(t,n){if(Array.isArray(t))this.#t.resetPaths(t,n);else this.#t.resetPaths(t)}setComposition(t){this.#e=t;let n=this.#s();if(n==null)return;this.#x(),Kr(n.wrapper,this.#P())}setGitStatus(t){let n=Fs(t,this.#h);if(n===this.#h)return;this.#h=n;let s=this.#s();if(s==null)return;Kr(s.wrapper,this.#P())}setIcons(t){this.#w=t;let n=this.#s();if(n==null)return;this.#g(n.host,n.wrapper),Kr(n.wrapper,this.#P())}hydrate({fileTreeContainer:t}){let n=this.#M(t),s=this.#F(n);this.#x(),Gd(s,this.#P())}render({containerWrapper:t,fileTreeContainer:n}){let s=this.#M(n??this.#m,t),a=this.#F(s);this.#x(),Kr(a,this.#P())}#J(){return{initialViewportHeight:Em({initialVisibleRowCount:this.#b.initialVisibleRowCount,itemHeight:this.#b.itemHeight}),itemHeight:this.#b.itemHeight,overscan:this.#b.overscan,stickyFolders:this.#b.stickyFolders}}#P(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#h?.statusByPath,ignoredGitDirectories:this.#h?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#h?.directoriesWithChanges,icons:this.#w,instanceId:this.#c,renamingEnabled:this.#V,renderRowDecoration:this.#a,searchBlurBehavior:this.#O,searchEnabled:this.#v,searchFakeFocus:this.#r,slotHost:this.#y,...this.#J()}}#s(){let t=this.#m,n=this.#i;if(t==null||n==null)return null;return{host:t,wrapper:n}}#g(t,n){let s=t.shadowRoot;if(s!=null)this.#j(s),this.#K(s);this.#U(n)}#R(){let t=this.#d;if(t==null)return;let n=this.#t.getSelectionVersion();if(n===this.#z)return;this.#z=n,t(this.#t.getSelectedPaths())}#x(){let t=this.#e?.header?.render;if(t!=null){this.#y.setSlotContent(Er,t());return}this.#y.setSlotHtml(Er,this.#e?.header?.html??null)}#j(t){let n=eu(t).find((a)=>Zd(a)),s=Jd(ss(Pr(this.#w).set));if(s==null)return;if(n!=null&&n.outerHTML===s.outerHTML)return;if(n!=null)n.replaceWith(s);else t.prepend(s)}#K(t){let n=eu(t),s=n.find((h)=>Zd(h)),a=n.filter((h)=>h!==s),l=Pr(this.#w).spriteSheet?.trim()??"";if(l.length===0){for(let h of a)h.remove();return}let d=Jd(l);if(d==null){for(let h of a)h.remove();return}if(a.length===1&&a[0].outerHTML===d.outerHTML)return;for(let h of a)h.remove();t.appendChild(d)}#U(t){let n=Pr(this.#w);if(n.colored&&Ua(n.set))t.dataset.fileTreeColoredIcons="true";else delete t.dataset.fileTreeColoredIcons}#l(t){let n=t.querySelector(`style[${no}]`);if(this.#f==null&&n instanceof HTMLStyleElement)this.#f=n;if(this.#S==null||this.#S===""){this.#f?.remove(),this.#f=void 0,this.#q=void 0;return}if(this.#f?.parentNode===t&&this.#q===this.#S)return;if(this.#f??=document.createElement("style"),this.#f.setAttribute(no,""),this.#f.parentNode!==t)t.appendChild(this.#f);this.#f.textContent=Sc(this.#S),this.#q=this.#S}#F(t){if(this.#i!=null)return this.#i;let n=t.shadowRoot;if(n==null)throw Error("FileTree requires a shadow root");let s=Array.from(n.children).filter((l)=>l instanceof HTMLDivElement&&typeof l.dataset.fileTreeId==="string"&&l.dataset.fileTreeId.length>0),a=s.find((l)=>l.dataset.fileTreeId===this.#c)??s[0];if(a!=null)this.#c=a.dataset.fileTreeId??this.#c;if(this.#i=a??document.createElement("div"),this.#i.dataset.fileTreeId=this.#c,this.#i.dataset.fileTreeVirtualizedWrapper="true",this.#g(t,this.#i),this.#i.parentNode!==n)n.appendChild(this.#i);return this.#i}#M(t,n){let s=t??this.#m??document.createElement("file-tree-container");if(n!=null&&s.parentNode!==n)n.appendChild(s);let a=s.shadowRoot??s.attachShadow({mode:"open"});return vo(s,a),this.#l(a),s.dataset.fileTreeVirtualized="true",s.style.display="flex",this.#C(s),this.#y.setHost(s),this.#m=s,s}#C(t){if(t.style.getPropertyValue("--trees-item-height")==="")t.style.setProperty("--trees-item-height",`${String(this.#T.itemHeight)}px`),this.#W=!0;if(t.style.getPropertyValue("--trees-density-override")==="")t.style.setProperty("--trees-density-override",String(this.#T.factor)),this.#$=!0}#L(t){if(this.#W)t.style.removeProperty("--trees-item-height"),this.#W=!1;if(this.#$)t.style.removeProperty("--trees-density-override"),this.#$=!1}};var tu=["--trees-bg-override: var(--surface-pane)","--trees-bg-muted-override: var(--surface-muted)","--trees-border-color-override: transparent","--trees-fg-override: var(--text)","--trees-font-family-override: var(--font-sans)","--trees-focus-ring-color-override: var(--text-muted)","--trees-padding-inline-override: 8px","--trees-scrollbar-gutter-override: 4px","--trees-search-bg-override: light-dark(var(--surface-base), var(--surface-control))","--trees-selected-bg-override: var(--selection)","--trees-selected-focused-border-color-override: var(--text-muted)"].join("; "),sa=`
|
|
1286
1286
|
[data-item-git-status] > [data-item-section='content'] { color: var(--trees-fg); }
|
|
1287
1287
|
[data-file-tree-virtualized-sticky='true'] { will-change: auto; }
|
|
1288
|
-
`,
|
|
1288
|
+
`,nu={density:"compact",fileTreeSearchMode:"hide-non-matches",flattenEmptyDirectories:!0,id:"review-file-tree",initialExpansion:"open",initialVisibleRowCount:20,search:!0,searchBlurBehavior:"retain",stickyFolders:!1,unsafeCSS:sa};var Ur=50;var Rm=0.35,Dm=0.65;var Mm=224,Am=480;var Nm=0.3,Fm=0.7;function ru(t){let n=0,s=0,a=!1;for(let l of t)if(n+=l.additions,s+=l.deletions,l.status!=="untracked")a=!0;return{additions:n,deletions:s,tracked:a}}function iu(t){if(!ne(t))return{};let n={changesRatio:aa(t.changesRatio,Nm,Fm),gitPaneRatio:aa(t.gitPaneRatio,Rm,Dm),layout:t.layout==="split"||t.layout==="unified"?t.layout:void 0,mode:t.mode==="all"||t.mode==="selected"?t.mode:void 0,reviewSidebarWidth:aa(t.reviewSidebarWidth,Mm,Am),tab:t.tab==="files"||t.tab==="git"?t.tab:void 0,wrap:Ye(t.wrap)?t.wrap:void 0};return Object.fromEntries(Object.entries(n).filter(([,s])=>s!==void 0))}function aa(t,n,s){return ue(t)&&Number.isFinite(t)?Math.min(Math.max(t,n),s):void 0}var Lm={branch:null,changes:[],commits:[],isGitRepository:!1,changeCount:0,revision:"non-git"},b2={...Lm,revision:"git-unloaded"},ou=se(r({additions:y(),deletions:y(),path:c(),status:i([o("added"),o("deleted"),o("modified"),o("renamed"),o("untracked")])})),la=se(r({author:c(),authoredAt:c(),hash:c(),pushed:i([We(),he()]),shortHash:c(),subject:c()})),Bm=se(r({changes:se(x(ou)),commit:la,patch:c()})),Hm=se(r({branch:i([c(),he()]),changes:se(x(ou)),commits:se(x(la)),isGitRepository:We(),changeCount:y(),revision:c()})),Vm=de(Bm),Om=de(x(la)),qm=de(Hm);function su(t){return Vm.Check(t)}function au(t){return Om.Check(t)}function ca(t){return qm.Check(t)}function Do(t,n){let s=document.getElementById(t);if(!(s instanceof n))throw Error(`Missing #${t}`);return s}function Ee(t){return Do(t,HTMLElement)}function Lt(t){return Do(t,HTMLButtonElement)}function da(t){return Do(t,HTMLDialogElement)}function lu(t){return Do(t,HTMLInputElement)}var cu=i([r({kind:i([o("audio"),o("font"),o("html"),o("image"),o("pdf"),o("video")]),mimeType:c(),url:c()}),r({html:c(),kind:o("markdown"),mimeType:c()})]),du=r({path:c(),contents:c(),preview:Zt(cu),revision:c(),size:y()}),zm=i([du,r({path:c(),preview:cu,revision:c(),size:y()}),r({message:c(),path:c(),size:y()})]),Wm=r({paths:x(c()),workspacePath:c()}),ua=r({path:c()});function uu(t){let n=`${t}/content`,s=`${t}/entry`;return{async create(a,l){return(await Gr(s,ua,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({kind:l,path:a})})).path},async list(){return await Gr(t,Wm)},async move(a,l){return(await Gr(s,ua,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({destination:l,path:a})})).path},async read(a){return await Gr(`${n}?path=${encodeURIComponent(a)}`,zm)},async remove(a){await Gr(s,ua,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({path:a})})},async save(a,l,d){return await Gr(n,du,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({contents:l,path:a,revision:d})})}}}async function Gr(t,n,s){let a=await fetch(t,{...s,headers:{accept:"application/json",...s?.headers}});if(!a.ok)throw Error(await pe(a,`Request failed (${a.status})`));return st(n,await a.json())}function ha(t){let n=new Set(t);for(let s of t)for(let a=s.indexOf("/");a!==-1;a=s.indexOf("/",a+1))n.add(s.slice(0,a+1));return n}function Mo(t,n,s,a){let l=new Set,d=()=>`pi-ui:tree-expansion:${n}:${s()}`;function h(g,b){if($m(t,g,b),l=new Set([...ha(b)].filter((w)=>w.endsWith("/"))),g)return;try{let w=JSON.parse((a??window.sessionStorage).getItem(d())??"null");if(!ne(w))return;for(let[I,v]of Object.entries(w).toSorted(([_],[k])=>k.length-_.length)){let _=t.getItem(I);if(!Ye(v)||!_||!("expand"in _))continue;if(v)_.expand();else _.collapse()}}catch{}}function f(){if(l.size===0)return;t.closeSearch();let g={};for(let b of l){let w=t.getItem(b);if(w&&"isExpanded"in w)g[b]=w.isExpanded()}try{(a??window.sessionStorage).setItem(d(),JSON.stringify(g))}catch{}}return{sync:h,save:f}}function $m(t,n,s){if(!n){t.resetPaths(s);return}if(n.length===s.length&&n.every((h,f)=>h===s[f]))return;let a=ha(n),l=ha(s),d=[];for(let h of s)if(!a.has(h))d.push({type:"add",path:h});for(let h of[...a.difference(l)].toSorted((f,g)=>g.length-f.length))d.push({type:"remove",path:h});if(d.length>0)t.batch(d)}function fa(t){requestAnimationFrame(()=>{(t.querySelector("file-tree-container")?.shadowRoot?.querySelector('[role="tree"]')??t).focus({preventScroll:!0})})}function pu(t){let n=uu(t.endpoint),s=Ee("workspace-file-tree"),a=Ee("workspace-file-main"),l=Ee("workspace-file-view"),d=Ee("workspace-file-preview"),h=Ee("workspace-file-empty"),f=Ee("workspace-file-path"),g=Ee("workspace-file-status"),b=Lt("workspace-file-edit"),w=Lt("workspace-file-download"),I=Ee("workspace-file-mode"),v=Lt("workspace-file-preview-mode"),_=Lt("workspace-file-source-mode"),k=Ee("workspace-file-wrap-control"),T=Lt("workspace-file-wrap"),R=da("workspace-entry-dialog"),B=Ee("workspace-entry-title"),F=Ee("workspace-entry-description"),D=lu("workspace-entry-input"),N=Ee("workspace-entry-error"),H=Lt("workspace-entry-action"),X=da("workspace-confirm-dialog"),fe=Ee("workspace-confirm-title"),yt=Ee("workspace-confirm-description"),Le=Lt("workspace-confirm-cancel"),bt=Lt("workspace-confirm-action");s.style.cssText=tu;let Ie=t.initialWorkspacePath,Be=[],Qe,qe=!1,Tt=!1,Ce=0,we=0,te,Re,It,$e="source",ut,kt="",ht=!1,Kt=!0,Mt,St,Pt=new Ue(rr()),ft=new Ri({composition:{contextMenu:{enabled:!0,render:_n,triggerMode:"right-click"}},density:"compact",fileTreeSearchMode:"hide-non-matches",flattenEmptyDirectories:!0,gitStatus:t.initialGitStatus,id:"workspace-files-tree",initialExpansion:"closed",paths:[],search:!0,searchBlurBehavior:"retain",stickyFolders:!1,unsafeCSS:sa,onSelectionChange(P){let W=P.length===1?P[0]:void 0;if(!W)return;let G=ft.getItem(W);if(G?.isDirectory()){Je(""),G.deselect();return}br(W)}}),Ct=Mo(ft,"files",()=>Ie);ft.render({containerWrapper:s}),w.addEventListener("click",()=>{let P=ut;if(!P)return;let W=document.createElement("a");W.href=`${t.endpoint}/content?path=${encodeURIComponent(P)}&download=1`,W.download=P.split("/").at(-1)??"download",W.click()}),v.addEventListener("click",()=>{if(!ht)Ln("preview")}),_.addEventListener("click",()=>void Ln("source")),b.addEventListener("click",()=>void sr()),l.addEventListener("keydown",(P)=>{if((P.ctrlKey||P.metaKey)&&!P.altKey&&!P.shiftKey&&P.code==="KeyS")P.preventDefault(),sr()}),T.addEventListener("click",()=>{Kt=!Kt,T.setAttribute("aria-pressed",String(Kt)),Pt.setOptions(rr())}),window.addEventListener("pi-ui-code-theme-changed",()=>{Pt.setOptions(rr()),Pt.rerender()});function _n(P,W){let G=document.createElement("div");return G.className="workspace-tree-context-menu",G.setAttribute("role","menu"),G.append(At("New file",()=>{W.close({restoreFocus:!1}),tr(P,"file")}),At("New folder",()=>{W.close({restoreFocus:!1}),tr(P,"folder")}),At("Rename",()=>{W.close({restoreFocus:!1}),ln(P)}),At("Delete",()=>{W.close({restoreFocus:!1}),gt(P)},!0)),G}function At(P,W,G=!1){let J=document.createElement("button");return J.type="button",J.className=`workspace-tree-context-menu-item${G?" workspace-tree-context-menu-item-destructive":""}`,J.setAttribute("role","menuitem"),J.textContent=P,J.addEventListener("click",W),J}async function tr(P,W){let G=await ni({title:`New ${W}`,description:`Enter a name for the new ${W}.`,action:"Create"});if(!G)return;let J=P.kind==="directory"?P.path:hu(P.path),ke=fu(J,G);try{let Vt=await n.create(ke,W);if(await ve(!0),W==="file")await ir(Vt);else{let qn=ft.getItem(Vt);if(qn&&"expand"in qn)qn.expand()}}catch(Vt){Je(ae(Vt))}}async function ln(P){if(Yt(P.path)&&ht){await ri("Unsaved changes","Save or discard your changes before renaming this item.");return}let W=await ni({title:`Rename ${P.kind==="directory"?"folder":"file"}`,description:`Enter a new name for ${P.name}.`,action:"Rename",initialValue:P.name});if(!W||W===P.name)return;let G=fu(hu(P.path),W),J=ut&&Yt(P.path)?`${G}${ut.slice(P.path.length)}`:void 0;try{if(await n.move(P.path,G),J)nr();if(await ve(!0),J)await ir(J)}catch(ke){Je(ae(ke))}}async function gt(P){if(Yt(P.path)&&ht){await ri("Unsaved changes","Save or discard your changes before deleting this item.");return}let W=P.kind==="directory"?"folder":"file";if(!await Sr({title:`Delete ${W}?`,description:`This will permanently delete ${P.name}${P.kind==="directory"?" and all of its contents":""}. This action cannot be undone.`,action:"Delete"}))return;try{if(await n.remove(P.path),Yt(P.path))nr();await ve(!0)}catch(G){Je(ae(G))}}function nr(){we+=1,Hn(),te=void 0,Re=void 0,It=void 0,$e="source",kt="",ht=!1,Vn(),f.textContent="Select a file",Je(""),dn("Open a file from the workspace"),vn()}function Yt(P){return ut===P||ut?.startsWith(`${P}/`)===!0}function rr(){return{disableFileHeader:!0,overflow:Kt?"wrap":"scroll",tokenizeMaxLineLength:1e4,theme:ye(),themeType:"system",onEditChange({file:P}){kt=P.contents,ht=kt!==te?.contents,On()},unsafeCSS:`
|
|
1289
1289
|
@media (prefers-reduced-motion: no-preference) {
|
|
1290
1290
|
[data-caret] {
|
|
1291
1291
|
animation-timing-function: step-end;
|
|
@@ -1299,7 +1299,7 @@ import{u,U,C,Ne,j,ae,E,ze,L,p,Je,et,He,V,Ue,m,be,Gt,A,Ze,Z,Ht,tt,nt,at,rt,it,x,U
|
|
|
1299
1299
|
[data-file] {
|
|
1300
1300
|
min-width: 100%;
|
|
1301
1301
|
}
|
|
1302
|
-
`}}function Zr(P){if(_t=P,_t)xn()}async function Hn(P){_t=!0,await xn();for(let z of ft.getSelectedPaths())ft.getItem(z)?.deselect();let K=ft.getItem(P);if(K)K.select();else await Ce(P)}function Jr(P=!0){Oi(P)}function $o(P){if(te?.path===P)ht=!1,vn();Oi()}async function Oi(P=!0){let K=ut,z=te?.revision??St,J=ve;if(await xn(P),!K||ve!==J)return;try{let Se=await n.read(K);if(ut!==K||ve!==J)return;if("message"in Se){if(ht)ct("File changed on disk");else Qe(),gr(Se.path),f.textContent=Se.path,ct(Mi(Se.size)),rn(Se.message);return}if("revision"in Se&&z===Se.revision)return;if(ht){ct("File changed on disk");return}let Lt=++ve;if(dn(),ct(Mi(Se.size)),"contents"in Se)if(te=Se,Re=Se.preview,St=Se.revision,It=Se.contents,$e=Re?$e:"source",$e==="preview")mn();else await _n(Lt);else te=void 0,Re=Se.preview,St=Se.revision,It="",$e="preview",mn();En()}catch(Se){if(ut!==K||ve!==J)return;ct(ne(Se))}}function Cn(P){ft.setGitStatus(P)}function jo(P){if(Ie===P)return;if(Ie=P,Be=[],Ye=void 0,ke+=1,Qe(),ft.resetPaths([]),_t)xn()}async function xn(P=!1){if(P)qe=!0;let K=++ke;if(!_t||!qe&&Ye===Ie)return;if(!P)ct("Loading files…");try{let z=await n.list();if(K!==ke||z.workspacePath!==Ie)return;if(Ao(ft,Ye===Ie?Be:void 0,z.paths),Ye=Ie,Be=z.paths,qe=!1,ut){if(te)ct(Mi(te.size));return}let J=z.paths.includes("README.md")?"README.md":z.paths.find((Se)=>!Se.endsWith("/"));if(J)ft.getItem(J)?.select();else ct(""),rn("No files in this workspace")}catch(z){if(K!==ke)return;ct(ne(z)),rn("Could not load workspace files")}}async function Ce(P){if(ut===P)return;if(ht&&!await Vn({title:"Discard unsaved changes?",description:`Your unsaved changes to ${te?.path??"this file"} will be lost.`,action:"Discard"})){ft.getItem(P)?.deselect(),ft.getItem(te?.path??"")?.select();return}let K=++ve;dn(),te=void 0,Re=void 0,St=void 0,ht=!1,f.textContent=P,gr(),ct("");try{let z=await n.read(P);if(K!==ve)return;if(gr(z.path),f.textContent=z.path,ct(Mi(z.size)),"message"in z){$e="source",rn(z.message),En();return}if(Re=z.preview,St=z.revision,$e=Re?"preview":"source","contents"in z)if(te=z,It=z.contents,$e==="source")await _n(K);else mn();else It="",mn();En()}catch(z){if(K!==ve)return;te=void 0,Re=void 0,St=void 0,$e="source",ct(""),rn(ne(z)),En()}}async function mr(P){if(P===$e||P==="preview"&&(!Re||ht))return;if(P==="source"&&!te)return;let K=++ve;if($e=P,dn(),$e==="preview")mn();else await _n(K);En()}async function _n(P){if(!te)return;gn(),d.replaceChildren(),d.hidden=!0,h.hidden=!0,l.hidden=!1;let K=te.path.toLowerCase().endsWith(".svg")?"xml":p(te.path),z={cacheKey:`${Ie}:${te.path}:${te.revision}`,contents:It,lang:K,name:te.path},J=ye();if(await ae({langs:[K],themes:[J.dark,J.light]}).catch(()=>{return}),P!==ve)return;Et.render({file:z,containerWrapper:l}),await nr(P)}function mn(){if(!Re)return;dn(),gn();let P=Re,K=ut?.split("/").at(-1)??"file",z;if(P.kind==="markdown"){let J=document.createElement("article");J.className="workspace-file-markdown markdown-content";let Se=new DOMParser().parseFromString(P.html,"text/html");J.append(...Se.body.childNodes),z=J}else if(P.kind==="image"){let J=new Image;if(J.alt=`Preview of ${K}`,J.decoding="async",P.mimeType==="image/svg+xml")J.role="img";z=J}else if(P.kind==="audio"){let J=document.createElement("audio");J.controls=!0,J.preload="metadata",J.textContent="This browser cannot preview this audio file.",z=J}else if(P.kind==="font")z=tr(P.url,K);else if(P.kind==="video"){let J=document.createElement("video");J.controls=!0,J.playsInline=!0,J.preload="metadata",J.textContent="This browser cannot preview this video file.",z=J}else{let J=document.createElement("iframe");J.referrerPolicy="no-referrer",J.title=`Preview of ${K}`,z=J}if("url"in P&&P.kind!=="font"){let J=P.url;z.addEventListener("error",()=>{if($e==="preview"&&J===z.getAttribute("src"))rn("This browser cannot preview this file.")}),z.setAttribute("src",J)}d.replaceChildren(z),h.hidden=!0,l.hidden=!0,d.hidden=!1}function tr(P,K){let z=document.createElement("article");z.className="workspace-font-preview";let J=document.createElement("h2");J.className="sr-only",J.textContent=`Font specimen for ${K}`;let Se=document.createElement("p");Se.className="workspace-font-loading",Se.textContent="Loading font…";let Lt=document.createElement("div");Lt.className="workspace-font-specimen",Lt.hidden=!0;for(let[Tn,qi]of[["workspace-font-display","Hamburgefontsiv"],["workspace-font-sample","The quick brown fox jumps over the lazy dog."],["workspace-font-sample","ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["workspace-font-sample","abcdefghijklmnopqrstuvwxyz"],["workspace-font-sample","0123456789 · !?&@#$%"],["workspace-font-sample","ÁÉÍÓÚ"],["workspace-font-sample","АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"],["workspace-font-sample","абвгдеёжзийклмнопрстуфхцчшщъыьэюя"],["workspace-font-sample","Съешь же ещё этих мягких французских булок, да выпей чаю."]]){let yr=document.createElement("p");yr.className=Tn,yr.textContent=qi,Lt.append(yr)}z.append(J,Se,Lt);let On=`pi-ui-font-preview-${ve}`,vr=new FontFace(On,`url(${JSON.stringify(P)})`);return wt=vr,vr.load().then((Tn)=>{if(wt!==vr)return;document.fonts.add(Tn),Lt.style.fontFamily=On,Lt.hidden=!1,Se.remove()},()=>{if(wt===vr)rn("This browser cannot preview this font.")}),z}function gn(){if(!wt)return;document.fonts.delete(wt),wt=void 0}async function nr(P){b.disabled=!0;try{let{Editor:K}=await (e("wg53q3y0"),import("./index-wg53q3y0.js"));if(P!==ve||!te)return;Rt=new K("file"),Rt.edit(Et)}catch(K){Rt=void 0,ct(ne(K))}finally{vn()}}async function ei(){if(!te||!Rt||!ht)return;b.disabled=!0,ct("Saving…");try{te=await n.save(te.path,It,te.revision),Re=te.preview,St=te.revision,It=te.contents,ht=!1,ct(Mi(te.size))}catch(P){ct(ne(P))}finally{vn()}}function dn(){Rt?.cleanUp("discard"),Rt=void 0,vn()}function gr(P){ut=P,w.disabled=!P}function vn(){En()}function En(){let P=Boolean(te)&&$e==="source";I.hidden=!te?.preview,v.setAttribute("aria-pressed",String($e==="preview")),v.disabled=ht,_.setAttribute("aria-pressed",String($e==="source")),k.hidden=!P,b.hidden=!P,b.disabled=!P||!Rt||!ht}function rn(P){gn(),d.replaceChildren(),h.textContent=P,h.hidden=!1,l.hidden=!0,d.hidden=!0}function ct(P){g.textContent=P}function ti(P){B.textContent=P.title,F.textContent=P.description,H.textContent=P.action,D.value=P.initialValue??"",N.textContent="",N.hidden=!0,R.returnValue="";let{promise:K,resolve:z}=Promise.withResolvers();return R.addEventListener("close",()=>z(R.returnValue==="submit"?D.value:void 0),{once:!0}),R.showModal(),D.select(),K}function ni(){if(!Wm(D.value)){N.textContent="Use a non-empty name without slashes, '.', or '..'.",N.hidden=!1;return}R.close("submit")}function Vn(P){fe.textContent=P.title,vt.textContent=P.description,yt.textContent=P.action,Le.hidden=P.showCancel===!1,yt.dataset.variant=P.destructive===!1?"default":"destructive",X.returnValue="";let{promise:K,resolve:z}=Promise.withResolvers();return X.addEventListener("close",()=>z(X.returnValue==="confirm"),{once:!0}),X.showModal(),K}async function ri(P,K){await Vn({title:P,description:K,action:"OK",showCancel:!1,destructive:!1})}H.addEventListener("click",ni),D.addEventListener("keydown",(P)=>{if(P.key!=="Enter"||P.isComposing)return;P.preventDefault(),ni()});function Ko(){let P=ft.getSelectedPaths()[0]??ft.getFocusedPath()??Be[0];if(P)ft.scrollToPath(P,{focus:!0});ha(s)}function Uo(){($e==="preview"&&Re?d:te?l:a).focus({preventScroll:!0})}function Go(){dn(),gn(),d.replaceChildren(),Et.cleanUp(),ft.cleanUp()}return vn(),rn("Open a file from the workspace"),{cleanUp:Go,focusEditor:Uo,focusTree:Ko,openFile:Hn,refresh:Jr,refreshAfterDiscard:$o,requestConfirmation:Vn,requestNotice:ri,setGitStatus:Cn,setVisible:Zr,setWorkspace:jo}}function Wm(t){return Boolean(t&&t===t.trim()&&t!=="."&&t!==".."&&!t.includes("/")&&!t.includes("\\"))}function uu(t){let n=t.lastIndexOf("/");return n===-1?"":t.slice(0,n)}function hu(t,n){return t?`${t}/${n}`:n}function Mi(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(1)} MB`}function pu(t){return{async loadDiff(n,s,a){let l=new URLSearchParams({workspacePath:n});if(s!==void 0)l.set("path",s);let d=await fetch(`${t}/diff?${l}`,{signal:a});if(d.ok)return d.text();throw Error(await pe(d,`Unable to load diff (${d.status})`))},async discard(n){let s=await fetch(`${t}/discard`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:n})});if(s.ok)return;throw Error(await pe(s,`Request failed (${s.status})`))},async loadCommit(n){try{let s=await fetch(`${t}/commit?hash=${encodeURIComponent(n)}`,{headers:{accept:"application/json"}});if(!s.ok)return;let a=await s.json();return iu(a)?a:void 0}catch{return}},async loadHistory(n){try{let s=await fetch(`${t}/history?offset=${n}`,{headers:{accept:"application/json"}});if(!s.ok)return;let a=await s.json();return ou(a)?a:void 0}catch{return}}}}var No=globalThis.navigator?.platform??globalThis.process?.platform,mu=No==="win32"||No?.startsWith("Win")?"windows":No==="darwin"||No?.startsWith("Mac")?"darwin":"linux";function gu(t,n=mu){return n==="darwin"?t.metaKey&&!t.ctrlKey:t.ctrlKey&&!t.metaKey}function vu(){let t=new Map,n=new Map,s=0;function a(I,v,_){if(f())return!1;let k={lineNumber:Math.max(_.start,_.end),metadata:{body:null,id:`review-comment-${++s}`,range:{..._}},side:$m(_)};return t.set(I,[...t.get(I)??[],k]),n.set(I,v),!0}function l(I,v){let _=v.trim();if(!_)return;return w(I,(k)=>({...k,metadata:{...k.metadata,body:_}}))}function d(I){for(let[v,_]of t){let k=_.filter((T)=>T.metadata.id!==I);if(k.length===_.length)continue;if(k.length>0)t.set(v,k);else t.delete(v),n.delete(v);return v}return}function h(I,v){let _=[];for(let k of t.keys()){if(!I.has(k)&&v?.has(k))continue;if(I.get(k)===n.get(k))continue;t.delete(k),n.delete(k),_.push(k)}return _}function f(){for(let I of t.values())if(I.some((v)=>v.metadata.body===null))return!0;return!1}function g(){let I=[];for(let[v,_]of t)for(let k of _){let T=k.metadata.body;if(T===null)continue;I.push({body:T,endLine:k.metadata.range.end,endSide:k.metadata.range.endSide??k.metadata.range.side??k.side,path:v,startLine:k.metadata.range.start,startSide:k.metadata.range.side??k.side})}return I}function b(){t.clear(),n.clear()}function w(I,v){for(let[_,k]of t){let T=k.findIndex((R)=>R.metadata.id===I);if(T<0)continue;return t.set(_,k.with(T,v(k[T]))),_}return}return{add:a,annotations:t,hasDraft:f,reconcileFiles:h,remove:d,reset:b,save:l,savedComments:g}}function $m(t){return t.endSide??t.side??"additions"}var jm=navigator.userAgent.includes("Macintosh")?"darwin":"linux";function bu(t){let n=vu(),s,a=!1;t.submitButton.addEventListener("click",()=>void w()),I();function l(k,T){let R=k.fileDiff.name;if(n.add(R,yu(k.fileDiff),T))b(R)}function d(k){if(!("side"in k))return;let{metadata:T}=k,R=document.createElement("div");R.className="review-comment-wrapper",R.dataset.reviewCommentId=T.id;let B=document.createElement("div");B.className="review-comment-card",R.append(B);let F=document.createElement("p");if(F.className="review-comment-label",F.textContent=Km(T.range,k.side),B.append(F),T.body===null)h(B,T.id);else f(B,T.id,T.body);return R}function h(k,T){let R=document.createElement("textarea");R.className="textarea review-comment-input",R.placeholder="Leave a comment for the agent…",R.setAttribute("aria-label","Review comment");let B=document.createElement("div");B.className="review-comment-actions";let F=fa("Add comment");F.disabled=!0;let D=fa("Cancel","outline"),N=()=>{let H=n.save(T,R.value);if(!H)return;b(H),t.clearSelection()};F.addEventListener("click",N),D.addEventListener("click",()=>g(T)),R.addEventListener("input",()=>{F.disabled=R.value.trim()===""}),R.addEventListener("keydown",(H)=>{if(H.key==="Escape")H.preventDefault(),g(T);else if(H.key==="Enter"&&gu(H,jm))H.preventDefault(),N()}),B.append(F,D),k.append(R,B),setTimeout(()=>R.focus(),0)}function f(k,T,R){let B=document.createElement("p");B.className="review-comment-body",B.textContent=R;let F=document.createElement("div");F.className="review-comment-actions";let D=fa("Remove","ghost");D.classList.add("error-foreground"),D.addEventListener("click",()=>g(T)),F.append(D),k.append(B,F)}function g(k){let T=n.remove(k);if(!T)return;t.clearSelection(),b(T)}function b(k){s=void 0,I(),t.onAnnotationsChange(k)}async function w(){let k=n.savedComments();if(k.length===0||n.hasDraft()||a)return;a=!0,s=void 0,I();let T=await t.submit(k).catch(()=>!1);if(a=!1,!T){s="Couldn’t send",I();return}n.reset(),I(),t.onSubmitted()}function I(){let k=n.savedComments().length,T=n.hasDraft();t.submitButton.hidden=k===0&&!T,t.submitButton.disabled=k===0||T||a,t.submitButton.textContent=a?"Sending…":`Submit review${k>0?` (${k})`:""}`,t.status.hidden=!s,t.status.textContent=s??""}function v(k,T){if(n.reconcileFiles(new Map(k.values().filter((B)=>n.annotations.has(B.fileDiff.name)).map((B)=>[B.fileDiff.name,yu(B.fileDiff)]).toArray()),T).length===0)return;t.clearSelection(),s="Changes updated; outdated comments removed",I()}function _(){n.reset(),s=void 0,I()}return{add:l,annotations:n.annotations,canAdd:()=>!n.hasDraft(),reconcileItems:v,render:d,reset:_}}function fa(t,n){let s=document.createElement("button");if(s.type="button",s.className="btn",s.dataset.size="xs",n)s.dataset.variant=n;return s.textContent=t,s}function yu(t){return JSON.stringify(t)}function Km(t,n){let s=t.side??n,a=t.endSide??t.side??n,l=(f)=>f==="additions"?"new":"old";if(s!==a)return`${l(s)} line ${t.start} to ${l(a)} line ${t.end}`;let d=Math.min(t.start,t.end),h=Math.max(t.start,t.end);return d===h?`${l(s)} line ${d}`:`${l(s)} lines ${d}–${h}`}function wu({commits:t,getCommitDetail:n,history:s,loading:a,onSelectCommit:l,onSelectCommitPath:d,revision:h,selection:f}){let g=s.scrollTop;if(s.replaceChildren(),t.length===0){let w=document.createElement("p");w.className="review-history-message",w.textContent=h==="git-unloaded"?"Loading history…":"No commits yet",s.append(w);return}let b;for(let w of t){if(w.pushed!==b)s.append(Um(w.pushed)),b=w.pushed;let I=f.kind==="commit"&&f.hash===w.hash,v=document.createElement("div"),_=document.createElement("button");_.type="button",_.className="review-commit",_.setAttribute("aria-pressed",String(I)),_.title=w.subject,_.addEventListener("click",()=>l(w.hash));let k=document.createElement("span");k.className="review-commit-subject",k.textContent=w.subject||"Untitled commit";let T=document.createElement("span");T.className="fine-print review-commit-meta";let R=document.createElement("span");R.className="review-commit-hash",R.textContent=w.shortHash;let B=document.createElement("span");B.className="review-commit-author",B.textContent=w.author;let F=document.createElement("time");if(F.className="formatted-date",F.dateTime=w.authoredAt,F.title=ku(w.authoredAt),F.textContent=Xm(w.authoredAt),T.append(R,B,F),_.append(k,T),v.append(_),I){let D=n(w.hash);if(D)v.append(Gm(w.hash,D.changes,f.path,d))}s.append(v)}if(a){let w=document.createElement("p");w.className="fine-print review-history-loading",w.textContent="Loading older commits…",s.append(w)}s.scrollTop=g}function Su(t,n){t.replaceChildren(),t.hidden=!1;let s=document.createElement("div");s.className="review-detail-heading";let a=document.createElement("div");a.className="review-detail-subject",a.textContent=n.commit.subject||"Untitled commit";let l=tu(n.changes),d=document.createElement("span");d.className="review-detail-totals";let h=document.createElement("span");h.className="review-additions",h.textContent=`+${l.additions}`;let f=document.createElement("span");f.className="review-deletions",f.textContent=`-${l.deletions}`,d.append(h,f),s.append(a,d);let g=document.createElement("div");g.className="fine-print review-detail-meta";let b=document.createElement("span");b.className="review-detail-hash",b.textContent=n.commit.shortHash;let w=document.createElement("span");w.className="review-detail-author",w.textContent=n.commit.author;let I=document.createElement("time");I.className="formatted-date",I.dateTime=n.commit.authoredAt,I.title=ku(n.commit.authoredAt),I.textContent=I.title,g.append(b,w,I),t.append(s,g)}function Iu(t){t.hidden=!0,t.replaceChildren()}function Um(t){let n=document.createElement("div");n.className="fine-print review-push-group";let s=document.createElement("span");s.textContent=t===null?"No upstream":t?"Pushed":"Not pushed";let a=document.createElement("span");return a.className="review-push-rule",n.append(s,a),n}function Gm(t,n,s,a){let l=document.createElement("div");l.className="review-commit-files";for(let d of n){let h=document.createElement("button");h.type="button",h.className="fine-print review-commit-file",h.setAttribute("aria-pressed",String(s===d.path)),h.title=d.path,h.addEventListener("click",()=>a(t,d.path));let f=document.createElement("span");f.className="review-commit-file-status",f.textContent=Ym(d.status);let g=document.createElement("span");g.className="review-commit-file-path",g.textContent=d.path,h.append(f,g),l.append(h)}return l}function ku(t,n){return Xe(new Date(t),n)}function Xm(t,n=new Date,s){return Ke(new Date(t),n,s)}function Ym(t){if(t==="added")return"A";if(t==="deleted")return"D";if(t==="renamed")return"R";if(t==="untracked")return"U";return"M"}function Ai(t){return t==="git-unloaded"}function Cu(t,n){return t.workspacePath!==n.workspacePath||t.revision!==n.revision}function xu(t,n,s){if(t[0]?.hash!==s[0]?.hash)return{commits:[...s],hasMore:s.length===Wr,reset:!0};let l=new Set(s.map(({hash:d})=>d));return{commits:[...s,...t.slice(Wr).filter(({hash:d})=>!l.has(d))],hasMore:n,reset:!1}}function _u(t,n){if(t.kind==="commit"&&n[0])return{kind:"working",path:n[0].path};return t}function Eu(t,n,s,a){if(n){if(s[0])return{kind:"working",path:s[0].path};if(a[0])return{hash:a[0].hash,kind:"commit"};return{kind:"working"}}if(t.kind!=="working")return t;return{kind:"working",path:s.some(({path:l})=>l===t.path)?t.path:s[0]?.path}}function Tu(t,n){let s=new Set(t.map(({hash:l})=>l)),a=n.filter(({hash:l})=>!s.has(l));return{commits:[...t,...a],hasMore:n.length===Wr&&a.length>0}}var Qm=10,Zm=2,Jm=new Set(["ArrowDown","ArrowUp","Home","End"]),Pu=document.body.dataset.codeThemeLight,Ru=document.body.dataset.codeThemeDark;if(Pu&&Ru)st({dark:Ru,light:Pu});var e1=document.body.dataset.workspaceReviewEndpoint??"",t1=document.body.dataset.workspaceFilesEndpoint??"",Ho=pu(e1);window.addEventListener("pi-ui-code-theme-changed",(t)=>{if(!(t instanceof CustomEvent)||!Me(t.detail))return;let n=t.detail;if(st(n),Ft)sh().setRenderOptions({theme:n}).then(Yr).catch((s)=>console.error("Failed to update workspace theme",s))});var n1=Ee("app"),r1=document.querySelectorAll("[data-workspace-mode]"),ba=Ee("review-tree"),kn=Ee("review-history"),Bu=Ee("review-detail-header"),Kr=Ee("review-diff-view"),i1=Ee("workspace-file-tree"),Du=Ee("workspace-file-view"),Mu=Ee("review-empty"),Hu=At("review-mode-all"),Vu=At("review-mode-selected"),Ou=At("review-layout-split"),qu=At("review-layout-stacked"),pa=At("review-wrap"),zu=Ee("workspace-review"),o1=Ee("workspace-shell"),s1=At("review-submit-comments"),a1=Ee("review-comment-status"),l1=Ee("workspace-review-data-region"),c1=Ee("workspace-review-data"),Sn=JSON.parse(c1.textContent??"");if(!ue(Sn)||!de(Sn.filesRevision)||!de(Sn.treeRevision)||!se(Sn.workspacePath)||!ca(Sn.snapshot))throw Error("Invalid initial workspace review state");var Vo=nu(Sn.preferences),{workspacePath:Ln,filesRevision:Au,treeRevision:Nu,snapshot:me}=Sn,hr=[...me.commits],Ur=me.commits.length===Wr,Gr=!1,Bo=0,Jt=Vo.mode??"selected",we={kind:"working",path:me.changes[0]?.path},ma=Vo.layout,jr=Vo.wrap??!0,Wu=0,ga=new Map,Ft,va,Zn=bu({clearSelection:()=>Ft?.clearSelectedLines(),onAnnotationsChange:D1,onSubmitted(){if(Qt=rh(Qt),we.kind==="working")an=Qt,Jn=Bi(an),Ft?.clearSelectedLines(),fr();window.piUi.messageScroll.scrollBottom()},status:a1,submit:R1,submitButton:s1}),Qt=[],Ni,wa,Yn,Fi,an=Qt,Jn=Bi(an),Fo=me.revision!=="git-unloaded",Oo=new Map,Lo=new Map,ya=0,zt=fu({endpoint:t1,initialGitStatus:me.changes,initialWorkspacePath:Ln}),Sa=Vo.tab,In=b1(Sa,me.isGitRepository),ln=T1(n1,!0,(t)=>{if(zt.setVisible(t&&In==="files"),t&&In==="git")ch();else Xr()});for(let t of r1)t.addEventListener("click",()=>{let n=t.dataset.workspaceMode;if(n==="files"||n==="git"&&me.isGitRepository)Hi(n)});var en=new Di({...eu,composition:{contextMenu:{enabled:!0,render:_1,triggerMode:"right-click"}},gitStatus:me.changes,paths:me.changes.map(({path:t})=>t),onSelectionChange(t){let n=t.length===1?t[0]:void 0;if(n&&!en.getItem(n)?.isDirectory())Qu(n,!0)}});en.render({containerWrapper:ba});C1();window.piUi.workspaceReview={...ln,focusEditor:k1,focusFiles:w1,focusGit:S1};kn.addEventListener("scroll",zo,{passive:!0});kn.addEventListener("keydown",I1);Hu.addEventListener("click",()=>Xu("all"));Vu.addEventListener("click",()=>Xu("selected"));Ou.addEventListener("click",()=>Yu("split"));qu.addEventListener("click",()=>Yu("unified"));pa.addEventListener("click",()=>{jr=!jr,pa.setAttribute("aria-pressed",String(jr)),Vi({wrap:jr}),Yr()});var Li=Qr(),$u=()=>getComputedStyle(zu).getPropertyValue("--review-side-by-side").trim()==="1",Fu=$u(),Ia=new ResizeObserver(()=>{let t=$u();if(Fu&&!t&&ln.isOpen())ln.close();Fu=t;let n=Qr();if(Ca(n),n===Li)return;Li=n,Yr()});Ia.observe(Kr);Ia.observe(o1);var ju=new MutationObserver(Yr);ju.observe(document.documentElement,{attributeFilter:["class"],attributes:!0});function Ku(){try{let t=document.getElementById("workspace-review-data"),n=JSON.parse(t?.textContent??"");if(ue(n)&&de(n.filesRevision)&&de(n.treeRevision)&&se(n.workspacePath)&&ca(n.snapshot)){let s=n.workspacePath===Ln&&n.filesRevision!==Au,a=n.treeRevision!==Nu;if(Au=n.filesRevision,Nu=n.treeRevision,s)th();if(d1(n.workspacePath,n.snapshot),s){if(zt.refresh(a),we.kind==="working")qo(we.path)}}}catch{}}var Uu=new MutationObserver(Ku);Uu.observe(l1,{characterData:!0,childList:!0,subtree:!0});ka();Ca();pa.setAttribute("aria-pressed",String(jr));Gu(me);Ku();window.addEventListener("pagehide",()=>{Uu.disconnect(),Ia.disconnect(),ju.disconnect(),en.cleanUp(),zt.cleanUp(),Ft?.cleanUp(),Xr(),os()},{once:!0});function d1(t,n){if(!Cu({revision:me.revision,workspacePath:Ln},{revision:n.revision,workspacePath:t}))return;if(t!==Ln)Ln=t,zt.setWorkspace(Ln),ya++,Bo++,hr=[],Ur=!1,Gr=!1,Oo.clear(),Lo.clear(),ga.clear(),Zn.reset(),Fo=!1,we={kind:"working"};Gu(n)}function Gu(t){let n=Ai(me.revision)||!Fo,s=n?void 0:me.changes.map(({path:d})=>d),a=me.isGitRepository,l=xu(hr,Ur,t.commits);if(me=t,zt.setGitStatus(me.changes),hr=l.commits,Ur=l.hasMore,l.reset)Bo++,Gr=!1;if(!me.isGitRepository)In="files";else if(!a&&Sa!=="files")In="git";if(zt.setVisible(ln.isOpen()&&In==="files"),th(),Ao(en,s,me.changes.map(({path:d})=>d)),en.setGitStatus(me.changes),Ai(me.revision)){Fo=!1,Bn(),Ft?.setItems([]),Yn=void 0,Qn("Loading Git data…");return}if(we=Eu(we,n,eh(),me.commits),n)Fo=!0;if(Bn(),ln.isOpen()&&In==="git")requestAnimationFrame(zo);if(we.kind==="commit")Zu(we.hash,we.path);else qo(we.path)}function Xu(t){if(Jt=t,ka(),Vi({mode:Jt}),Jt==="selected"&&!we.path)we.path=an[0]?.fileDiff.name;Bn(),fr()}function Yu(t){ma=t,Li=Qr(),Ca(Li),Vi({layout:ma}),Yr()}function Qu(t,n=!1){if(n&&Fi&&Jt==="all")Jt="selected",ka(),Vi({mode:Jt});if(qo(t),Bn(),t&&!n)en.scrollToPath(t,{focus:!1,offset:"nearest"});if(t)Ju(t)}function qo(t){we={kind:"working",path:t},an=Qt,Jn=Bi(an),y1(),fr()}async function Zu(t,n){Xr(),Yn=void 0,we={hash:t,kind:"commit",path:n},f1(),Bn();let s=Oo.get(t);if(s){Lu(s,n);return}Qn("Loading commit…");let a=await u1(t);if(we.kind!=="commit"||we.hash!==t)return;if(!a){Qn("Unable to load commit");return}Lu(a,n)}function Lu(t,n){an=t.items,Jn=Bi(an),we={hash:t.detail.commit.hash,kind:"commit",path:n&&Jn.has(n)?n:an[0]?.fileDiff.name},v1(t.detail),Bn(),fr()}function u1(t){let n=Lo.get(t);if(n)return n;let s=ya,a=Ho.loadCommit(t).then((l)=>{if(!l)return;let d={detail:l,items:nh(l.changes,l.patch,l.commit.hash)};if(s!==ya)return;return Oo.set(t,d),d}).finally(()=>Lo.delete(t));return Lo.set(t,a),a}function h1(t,n){if(we.kind!=="commit"||we.hash!==t)return;if(we.path=n,Bn(),Jt==="selected")fr();else Ju(n)}function Ju(t){let n=Jn.get(t);if(n&&Ft)Ft.scrollTo({type:"item",id:n.id,align:"start",behavior:"smooth-auto"})}function eh(){let t=new Set(me.changes.map(({path:a})=>a)),n=en.getVisibleRows(0,en.getVisibleCount()).find((a)=>a.kind==="file"&&t.has(a.path))?.path;if(!n||n===me.changes[0]?.path)return me.changes;let s=me.changes.find(({path:a})=>a===n);return s?[s,...me.changes.filter(({path:a})=>a!==n)]:me.changes}function f1(){for(let t of en.getSelectedPaths())en.getItem(t)?.deselect()}function Xr(){Ni?.abort(),Ni=void 0,wa=void 0,Fi=void 0}function th(){Xr(),Qt=[],Zn.reconcileItems([],new Set(me.changes.map((t)=>t.path)))}async function p1(t){Xr(),wa=t;let n=new AbortController;if(Ni=n,Yn!==t)Yn=void 0,Ft?.setItems([]),Qn("Loading diff…");let s=Jt==="selected"?we.path:void 0,a=me.changes.filter((l)=>s===void 0||l.path===s);try{let l=await Ho.loadDiff(Ln,s,n.signal);if(n.signal.aborted)return;let d=nh(a,l,"working");Zn.reconcileItems(d,new Set(me.changes.map((h)=>h.path))),Qt=rh(d),Yn=t}catch(l){if(n.signal.aborted)return;Qt=[],Yn=void 0,Ft?.setItems([]),Fi=Error.isError(l)?l.message:"Unable to load diff"}finally{if(!n.signal.aborted)Ni=void 0,qo(we.path)}}function fr(){if(!ln.isOpen()||In!=="git")return;if(we.kind==="working"&&me.changes.length>0&&!Ai(me.revision)){let n=JSON.stringify([Ln,Jt,Jt==="selected"?we.path:null]);if(wa!==n){p1(n);return}if(Ni||Fi){if(Yn!==n)Qn(Fi??"Loading diff…");return}}let t=Jt==="all"?an:we.path&&Jn.has(we.path)?[Jn.get(we.path)]:[];if(t.length===0){Yn=void 0,Ft?.setItems([]),Qn(P1());return}if(Qn(),!Ft){Li=Qr();let n=oh();Ft=new Ht(n,sh()),va=n.enableGutterUtility,Ft.setup(Kr)}else if(va!==ih())Yr();Ft.setItems(t)}function nh(t,n,s){let a=new Map;for(let l of Gt(n))for(let d of l.files)a.set(d.name,d);return t.map((l)=>{let d=a.get(l.path)??m1(l),h=`${s}:${l.path}`,f=JSON.stringify({...d,cacheKey:void 0}),g=ga.get(h),b=g?.content===f?g.version:++Wu;return ga.set(h,{content:f,version:b}),{fileDiff:{...d,cacheKey:`pi-ui:${h}:${b}`},id:`diff:${h}`,type:"diff",version:b}})}function rh(t){return t.map((n)=>({...n,annotations:Zn.annotations.get(n.fileDiff.name)}))}function Bi(t){return new Map(t.map((n)=>[n.fileDiff.name,n]))}function m1(t){return{additionLines:[],deletionLines:[],hunks:[],isPartial:!0,name:t.path,splitLineCount:0,type:t.status==="added"||t.status==="untracked"?"new":t.status==="deleted"?"deleted":t.status==="renamed"?"rename-pure":"change",unifiedLineCount:0}}function Bn(){wu({commits:hr,getCommitDetail:(t)=>Oo.get(t)?.detail,history:kn,loading:Gr,onSelectCommit:(t)=>void Zu(t),onSelectCommitPath:h1,revision:me.revision,selection:we})}function zo(){if(!ln.isOpen()||Gr||!Ur||kn.scrollHeight-kn.scrollTop-kn.clientHeight>120)return;g1()}async function g1(){Gr=!0;let t=Bo;Bn();let n=await Ho.loadHistory(hr.length);if(t!==Bo)return;if(n){let s=Tu(hr,n);hr=s.commits,Ur=s.hasMore}else Ur=!1;Gr=!1,Bn(),requestAnimationFrame(zo)}function v1(t){Su(Bu,t)}function y1(){Iu(Bu)}function ih(){return we.kind==="working"&&Zn.canAdd()}function Yr(){if(!Ft)return;let t=oh();Ft.setOptions(t),va=t.enableGutterUtility}function oh(){let t=ih();return{diffIndicators:"none",enableGutterUtility:t,enableLineSelection:t,onGutterUtilityClick(n,s){if(s.item.type==="diff")Zn.add(s.item,n)},pointerEventsOnScroll:!0,renderAnnotation:Zn.render,diffStyle:Qr(),hunkSeparators:"simple",itemMetrics:{diffHeaderHeight:36,paddingBottom:0,spacing:0},layout:{gap:Zm,paddingBottom:Qm,paddingTop:0},lineHoverHighlight:"both",overflow:jr?"wrap":"scroll",stickyHeaders:!0,theme:ye(),themeType:document.documentElement.classList.contains("dark")?"dark":"light",unsafeCSS:`
|
|
1302
|
+
`}}function yr(P){if(Tt=P,Tt)ve()}async function ir(P){Tt=!0,await ve();for(let G of ft.getSelectedPaths())ft.getItem(G)?.deselect();let W=ft.getItem(P);if(W)W.select();else await br(P)}function Wo(P=!0){mn(P)}function $o(P){if(te?.path===P)ht=!1,On();mn()}async function mn(P=!0){let W=ut,G=te?.revision??It,J=we;if(await ve(P),!W||we!==J)return;try{let ke=await n.read(W);if(ut!==W||we!==J)return;if("message"in ke){if(ht)Je("File changed on disk");else nr(),Vn(ke.path),f.textContent=ke.path,Je(Di(ke.size)),dn(ke.message);return}if("revision"in ke&&G===ke.revision)return;if(ht){Je("File changed on disk");return}let Vt=++we;if(Hn(),Je(Di(ke.size)),"contents"in ke)if(te=ke,Re=ke.preview,It=ke.revision,kt=ke.contents,$e=Re?$e:"source",$e==="preview")cn();else await Bn(Vt);else te=void 0,Re=ke.preview,It=ke.revision,kt="",$e="preview",cn();vn()}catch(ke){if(ut!==W||we!==J)return;Je(ae(ke))}}function jo(P){ft.setGitStatus(P)}function Ko(P){if(Ie===P)return;if(Ct.save(),Ie=P,Be=[],Qe=void 0,Ce+=1,nr(),ft.resetPaths([]),Tt)ve()}async function ve(P=!1){if(P)qe=!0;let W=++Ce;if(!Tt||!qe&&Qe===Ie)return;if(!P)Je("Loading files…");try{let G=await n.list();if(W!==Ce||G.workspacePath!==Ie)return;if(Ct.sync(Qe===Ie?Be:void 0,G.paths),Qe=Ie,Be=G.paths,qe=!1,ut){if(te)Je(Di(te.size));return}let J=G.paths.includes("README.md")?"README.md":G.paths.find((ke)=>!ke.endsWith("/"));if(J)ft.getItem(J)?.select();else Je(""),dn("No files in this workspace")}catch(G){if(W!==Ce)return;Je(ae(G)),dn("Could not load workspace files")}}async function br(P){if(ut===P)return;if(ht&&!await Sr({title:"Discard unsaved changes?",description:`Your unsaved changes to ${te?.path??"this file"} will be lost.`,action:"Discard"})){ft.getItem(P)?.deselect(),ft.getItem(te?.path??"")?.select();return}let W=++we;Hn(),te=void 0,Re=void 0,It=void 0,ht=!1,f.textContent=P,Vn(),Je("");try{let G=await n.read(P);if(W!==we)return;if(Vn(G.path),f.textContent=G.path,Je(Di(G.size)),"message"in G){$e="source",dn(G.message),vn();return}if(Re=G.preview,It=G.revision,$e=Re?"preview":"source","contents"in G)if(te=G,kt=G.contents,$e==="source")await Bn(W);else cn();else kt="",cn();vn()}catch(G){if(W!==we)return;te=void 0,Re=void 0,It=void 0,$e="source",Je(""),dn(ae(G)),vn()}}async function Ln(P){if(P===$e||P==="preview"&&(!Re||ht))return;if(P==="source"&&!te)return;let W=++we;if($e=P,Hn(),$e==="preview")cn();else await Bn(W);vn()}async function Bn(P){if(!te)return;gn(),d.replaceChildren(),d.hidden=!0,h.hidden=!0,l.hidden=!1;let W=te.path.toLowerCase().endsWith(".svg")?"xml":p(te.path),G={cacheKey:`${Ie}:${te.path}:${te.revision}`,contents:kt,lang:W,name:te.path},J=ye();if(await re({langs:[W],themes:[J.dark,J.light]}).catch(()=>{return}),P!==we)return;Pt.render({file:G,containerWrapper:l}),await Vi(P)}function cn(){if(!Re)return;Hn(),gn();let P=Re,W=ut?.split("/").at(-1)??"file",G;if(P.kind==="markdown"){let J=document.createElement("article");J.className="workspace-file-markdown markdown-content";let ke=new DOMParser().parseFromString(P.html,"text/html");J.append(...ke.body.childNodes),G=J}else if(P.kind==="image"){let J=new Image;if(J.alt=`Preview of ${W}`,J.decoding="async",P.mimeType==="image/svg+xml")J.role="img";G=J}else if(P.kind==="audio"){let J=document.createElement("audio");J.controls=!0,J.preload="metadata",J.textContent="This browser cannot preview this audio file.",G=J}else if(P.kind==="font")G=or(P.url,W);else if(P.kind==="video"){let J=document.createElement("video");J.controls=!0,J.playsInline=!0,J.preload="metadata",J.textContent="This browser cannot preview this video file.",G=J}else{let J=document.createElement("iframe");J.referrerPolicy="no-referrer",J.title=`Preview of ${W}`,G=J}if("url"in P&&P.kind!=="font"){let J=P.url;G.addEventListener("error",()=>{if($e==="preview"&&J===G.getAttribute("src"))dn("This browser cannot preview this file.")}),G.setAttribute("src",J)}d.replaceChildren(G),h.hidden=!0,l.hidden=!0,d.hidden=!1}function or(P,W){let G=document.createElement("article");G.className="workspace-font-preview";let J=document.createElement("h2");J.className="sr-only",J.textContent=`Font specimen for ${W}`;let ke=document.createElement("p");ke.className="workspace-font-loading",ke.textContent="Loading font…";let Vt=document.createElement("div");Vt.className="workspace-font-specimen",Vt.hidden=!0;for(let[Ir,Oi]of[["workspace-font-display","Hamburgefontsiv"],["workspace-font-sample","The quick brown fox jumps over the lazy dog."],["workspace-font-sample","ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["workspace-font-sample","abcdefghijklmnopqrstuvwxyz"],["workspace-font-sample","0123456789 · !?&@#$%"],["workspace-font-sample","ÁÉÍÓÚ"],["workspace-font-sample","АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"],["workspace-font-sample","абвгдеёжзийклмнопрстуфхцчшщъыьэюя"],["workspace-font-sample","Съешь же ещё этих мягких французских булок, да выпей чаю."]]){let En=document.createElement("p");En.className=Ir,En.textContent=Oi,Vt.append(En)}G.append(J,ke,Vt);let qn=`pi-ui-font-preview-${we}`,yn=new FontFace(qn,`url(${JSON.stringify(P)})`);return St=yn,yn.load().then((Ir)=>{if(St!==yn)return;document.fonts.add(Ir),Vt.style.fontFamily=qn,Vt.hidden=!1,ke.remove()},()=>{if(St===yn)dn("This browser cannot preview this font.")}),G}function gn(){if(!St)return;document.fonts.delete(St),St=void 0}async function Vi(P){b.disabled=!0;try{let{Editor:W}=await (e("hynb8kca"),import("./index-hynb8kca.js"));if(P!==we||!te)return;Mt=new W("file"),Mt.edit(Pt)}catch(W){Mt=void 0,Je(ae(W))}finally{On()}}async function sr(){if(!te||!Mt||!ht)return;b.disabled=!0,Je("Saving…");try{te=await n.save(te.path,kt,te.revision),Re=te.preview,It=te.revision,kt=te.contents,ht=!1,Je(Di(te.size))}catch(P){Je(ae(P))}finally{On()}}function Hn(){Mt?.cleanUp("discard"),Mt=void 0,On()}function Vn(P){ut=P,w.disabled=!P}function On(){vn()}function vn(){let P=Boolean(te)&&$e==="source";I.hidden=!te?.preview,v.setAttribute("aria-pressed",String($e==="preview")),v.disabled=ht,_.setAttribute("aria-pressed",String($e==="source")),k.hidden=!P,b.hidden=!P,b.disabled=!P||!Mt||!ht}function dn(P){gn(),d.replaceChildren(),h.textContent=P,h.hidden=!1,l.hidden=!0,d.hidden=!0}function Je(P){g.textContent=P}function ni(P){B.textContent=P.title,F.textContent=P.description,H.textContent=P.action,D.value=P.initialValue??"",N.textContent="",N.hidden=!0,R.returnValue="";let{promise:W,resolve:G}=Promise.withResolvers();return R.addEventListener("close",()=>G(R.returnValue==="submit"?D.value:void 0),{once:!0}),R.showModal(),D.select(),W}function wr(){if(!jm(D.value)){N.textContent="Use a non-empty name without slashes, '.', or '..'.",N.hidden=!1;return}R.close("submit")}function Sr(P){fe.textContent=P.title,yt.textContent=P.description,bt.textContent=P.action,Le.hidden=P.showCancel===!1,bt.dataset.variant=P.destructive===!1?"default":"destructive",X.returnValue="";let{promise:W,resolve:G}=Promise.withResolvers();return X.addEventListener("close",()=>G(X.returnValue==="confirm"),{once:!0}),X.showModal(),W}async function ri(P,W){await Sr({title:P,description:W,action:"OK",showCancel:!1,destructive:!1})}H.addEventListener("click",wr),D.addEventListener("keydown",(P)=>{if(P.key!=="Enter"||P.isComposing)return;P.preventDefault(),wr()});function Uo(){let P=ft.getSelectedPaths()[0]??ft.getFocusedPath()??Be[0];if(P)ft.scrollToPath(P,{focus:!0});fa(s)}function Go(){($e==="preview"&&Re?d:te?l:a).focus({preventScroll:!0})}function Nt(){Ct.save(),Hn(),gn(),d.replaceChildren(),Pt.cleanUp(),ft.cleanUp()}return On(),dn("Open a file from the workspace"),{cleanUp:Nt,focusEditor:Go,focusTree:Uo,openFile:ir,refresh:Wo,refreshAfterDiscard:$o,requestConfirmation:Sr,requestNotice:ri,setGitStatus:jo,setVisible:yr,setWorkspace:Ko}}function jm(t){return Boolean(t&&t===t.trim()&&t!=="."&&t!==".."&&!t.includes("/")&&!t.includes("\\"))}function hu(t){let n=t.lastIndexOf("/");return n===-1?"":t.slice(0,n)}function fu(t,n){return t?`${t}/${n}`:n}function Di(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(1)} MB`}function mu(t){return{async loadDiff(n,s,a){let l=new URLSearchParams({workspacePath:n});if(s!==void 0)l.set("path",s);let d=await fetch(`${t}/diff?${l}`,{signal:a});if(d.ok)return d.text();throw Error(await pe(d,`Unable to load diff (${d.status})`))},async discard(n){let s=await fetch(`${t}/discard`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:n})});if(s.ok)return;throw Error(await pe(s,`Request failed (${s.status})`))},async loadCommit(n){try{let s=await fetch(`${t}/commit?hash=${encodeURIComponent(n)}`,{headers:{accept:"application/json"}});if(!s.ok)return;let a=await s.json();return su(a)?a:void 0}catch{return}},async loadHistory(n){try{let s=await fetch(`${t}/history?offset=${n}`,{headers:{accept:"application/json"}});if(!s.ok)return;let a=await s.json();return au(a)?a:void 0}catch{return}}}}var Ao=globalThis.navigator?.platform??globalThis.process?.platform,gu=Ao==="win32"||Ao?.startsWith("Win")?"windows":Ao==="darwin"||Ao?.startsWith("Mac")?"darwin":"linux";function vu(t,n=gu){return n==="darwin"?t.metaKey&&!t.ctrlKey:t.ctrlKey&&!t.metaKey}function yu(){let t=new Map,n=new Map,s=0;function a(I,v,_){if(f())return!1;let k={lineNumber:Math.max(_.start,_.end),metadata:{body:null,id:`review-comment-${++s}`,range:{..._}},side:Km(_)};return t.set(I,[...t.get(I)??[],k]),n.set(I,v),!0}function l(I,v){let _=v.trim();if(!_)return;return w(I,(k)=>({...k,metadata:{...k.metadata,body:_}}))}function d(I){for(let[v,_]of t){let k=_.filter((T)=>T.metadata.id!==I);if(k.length===_.length)continue;if(k.length>0)t.set(v,k);else t.delete(v),n.delete(v);return v}return}function h(I,v){let _=[];for(let k of t.keys()){if(!I.has(k)&&v?.has(k))continue;if(I.get(k)===n.get(k))continue;t.delete(k),n.delete(k),_.push(k)}return _}function f(){for(let I of t.values())if(I.some((v)=>v.metadata.body===null))return!0;return!1}function g(){let I=[];for(let[v,_]of t)for(let k of _){let T=k.metadata.body;if(T===null)continue;I.push({body:T,endLine:k.metadata.range.end,endSide:k.metadata.range.endSide??k.metadata.range.side??k.side,path:v,startLine:k.metadata.range.start,startSide:k.metadata.range.side??k.side})}return I}function b(){t.clear(),n.clear()}function w(I,v){for(let[_,k]of t){let T=k.findIndex((R)=>R.metadata.id===I);if(T<0)continue;return t.set(_,k.with(T,v(k[T]))),_}return}return{add:a,annotations:t,hasDraft:f,reconcileFiles:h,remove:d,reset:b,save:l,savedComments:g}}function Km(t){return t.endSide??t.side??"additions"}var Um=navigator.userAgent.includes("Macintosh")?"darwin":"linux";function wu(t){let n=yu(),s,a=!1;t.submitButton.addEventListener("click",()=>void w()),I();function l(k,T){let R=k.fileDiff.name;if(n.add(R,bu(k.fileDiff),T))b(R)}function d(k){if(!("side"in k))return;let{metadata:T}=k,R=document.createElement("div");R.className="review-comment-wrapper",R.dataset.reviewCommentId=T.id;let B=document.createElement("div");B.className="review-comment-card",R.append(B);let F=document.createElement("p");if(F.className="review-comment-label",F.textContent=Gm(T.range,k.side),B.append(F),T.body===null)h(B,T.id);else f(B,T.id,T.body);return R}function h(k,T){let R=document.createElement("textarea");R.className="textarea review-comment-input",R.placeholder="Leave a comment for the agent…",R.setAttribute("aria-label","Review comment");let B=document.createElement("div");B.className="review-comment-actions";let F=pa("Add comment");F.disabled=!0;let D=pa("Cancel","outline"),N=()=>{let H=n.save(T,R.value);if(!H)return;b(H),t.clearSelection()};F.addEventListener("click",N),D.addEventListener("click",()=>g(T)),R.addEventListener("input",()=>{F.disabled=R.value.trim()===""}),R.addEventListener("keydown",(H)=>{if(H.key==="Escape")H.preventDefault(),g(T);else if(H.key==="Enter"&&vu(H,Um))H.preventDefault(),N()}),B.append(F,D),k.append(R,B),setTimeout(()=>R.focus(),0)}function f(k,T,R){let B=document.createElement("p");B.className="review-comment-body",B.textContent=R;let F=document.createElement("div");F.className="review-comment-actions";let D=pa("Remove","ghost");D.classList.add("error-foreground"),D.addEventListener("click",()=>g(T)),F.append(D),k.append(B,F)}function g(k){let T=n.remove(k);if(!T)return;t.clearSelection(),b(T)}function b(k){s=void 0,I(),t.onAnnotationsChange(k)}async function w(){let k=n.savedComments();if(k.length===0||n.hasDraft()||a)return;a=!0,s=void 0,I();let T=await t.submit(k).catch(()=>!1);if(a=!1,!T){s="Couldn’t send",I();return}n.reset(),I(),t.onSubmitted()}function I(){let k=n.savedComments().length,T=n.hasDraft();t.submitButton.hidden=k===0&&!T,t.submitButton.disabled=k===0||T||a,t.submitButton.textContent=a?"Sending…":`Submit review${k>0?` (${k})`:""}`,t.status.hidden=!s,t.status.textContent=s??""}function v(k,T){if(n.reconcileFiles(new Map(k.values().filter((B)=>n.annotations.has(B.fileDiff.name)).map((B)=>[B.fileDiff.name,bu(B.fileDiff)]).toArray()),T).length===0)return;t.clearSelection(),s="Changes updated; outdated comments removed",I()}function _(){n.reset(),s=void 0,I()}return{add:l,annotations:n.annotations,canAdd:()=>!n.hasDraft(),reconcileItems:v,render:d,reset:_}}function pa(t,n){let s=document.createElement("button");if(s.type="button",s.className="btn",s.dataset.size="xs",n)s.dataset.variant=n;return s.textContent=t,s}function bu(t){return JSON.stringify(t)}function Gm(t,n){let s=t.side??n,a=t.endSide??t.side??n,l=(f)=>f==="additions"?"new":"old";if(s!==a)return`${l(s)} line ${t.start} to ${l(a)} line ${t.end}`;let d=Math.min(t.start,t.end),h=Math.max(t.start,t.end);return d===h?`${l(s)} line ${d}`:`${l(s)} lines ${d}–${h}`}function Su({commits:t,getCommitDetail:n,history:s,loading:a,onSelectCommit:l,onSelectCommitPath:d,revision:h,selection:f}){let g=s.scrollTop;if(s.replaceChildren(),t.length===0){let w=document.createElement("p");w.className="review-history-message",w.textContent=h==="git-unloaded"?"Loading history…":"No commits yet",s.append(w);return}let b;for(let w of t){if(w.pushed!==b)s.append(Xm(w.pushed)),b=w.pushed;let I=f.kind==="commit"&&f.hash===w.hash,v=document.createElement("div"),_=document.createElement("button");_.type="button",_.className="review-commit",_.setAttribute("aria-pressed",String(I)),_.title=w.subject,_.addEventListener("click",()=>l(w.hash));let k=document.createElement("span");k.className="review-commit-subject",k.textContent=w.subject||"Untitled commit";let T=document.createElement("span");T.className="fine-print review-commit-meta";let R=document.createElement("span");R.className="review-commit-hash",R.textContent=w.shortHash;let B=document.createElement("span");B.className="review-commit-author",B.textContent=w.author;let F=document.createElement("time");if(F.className="formatted-date",F.dateTime=w.authoredAt,F.title=Cu(w.authoredAt),F.textContent=Qm(w.authoredAt),T.append(R,B,F),_.append(k,T),v.append(_),I){let D=n(w.hash);if(D)v.append(Ym(w.hash,D.changes,f.path,d))}s.append(v)}if(a){let w=document.createElement("p");w.className="fine-print review-history-loading",w.textContent="Loading older commits…",s.append(w)}s.scrollTop=g}function Iu(t,n){t.replaceChildren(),t.hidden=!1;let s=document.createElement("div");s.className="review-detail-heading";let a=document.createElement("div");a.className="review-detail-subject",a.textContent=n.commit.subject||"Untitled commit";let l=ru(n.changes),d=document.createElement("span");d.className="review-detail-totals";let h=document.createElement("span");h.className="review-additions",h.textContent=`+${l.additions}`;let f=document.createElement("span");f.className="review-deletions",f.textContent=`-${l.deletions}`,d.append(h,f),s.append(a,d);let g=document.createElement("div");g.className="fine-print review-detail-meta";let b=document.createElement("span");b.className="review-detail-hash",b.textContent=n.commit.shortHash;let w=document.createElement("span");w.className="review-detail-author",w.textContent=n.commit.author;let I=document.createElement("time");I.className="formatted-date",I.dateTime=n.commit.authoredAt,I.title=Cu(n.commit.authoredAt),I.textContent=I.title,g.append(b,w,I),t.append(s,g)}function ku(t){t.hidden=!0,t.replaceChildren()}function Xm(t){let n=document.createElement("div");n.className="fine-print review-push-group";let s=document.createElement("span");s.textContent=t===null?"No upstream":t?"Pushed":"Not pushed";let a=document.createElement("span");return a.className="review-push-rule",n.append(s,a),n}function Ym(t,n,s,a){let l=document.createElement("div");l.className="review-commit-files";for(let d of n){let h=document.createElement("button");h.type="button",h.className="fine-print review-commit-file",h.setAttribute("aria-pressed",String(s===d.path)),h.title=d.path,h.addEventListener("click",()=>a(t,d.path));let f=document.createElement("span");f.className="review-commit-file-status",f.textContent=Jm(d.status);let g=document.createElement("span");g.className="review-commit-file-path",g.textContent=d.path,h.append(f,g),l.append(h)}return l}function Cu(t,n){return Xe(new Date(t),n)}function Qm(t,n=new Date,s){return Ke(new Date(t),n,s)}function Jm(t){if(t==="added")return"A";if(t==="deleted")return"D";if(t==="renamed")return"R";if(t==="untracked")return"U";return"M"}function Mi(t){return t==="git-unloaded"}function xu(t,n){return t.workspacePath!==n.workspacePath||t.revision!==n.revision}function _u(t,n,s){if(t[0]?.hash!==s[0]?.hash)return{commits:[...s],hasMore:s.length===Ur,reset:!0};let l=new Set(s.map(({hash:d})=>d));return{commits:[...s,...t.slice(Ur).filter(({hash:d})=>!l.has(d))],hasMore:n,reset:!1}}function Eu(t,n){if(t.kind==="commit"&&n[0])return{kind:"working",path:n[0].path};return t}function Tu(t,n,s,a){if(n){if(s[0])return{kind:"working",path:s[0].path};if(a[0])return{hash:a[0].hash,kind:"commit"};return{kind:"working"}}if(t.kind!=="working")return t;return{kind:"working",path:s.some(({path:l})=>l===t.path)?t.path:s[0]?.path}}function Pu(t,n){let s=new Set(t.map(({hash:l})=>l)),a=n.filter(({hash:l})=>!s.has(l));return{commits:[...t,...a],hasMore:n.length===Ur&&a.length>0}}var Zm=10,e1=2,t1=new Set(["ArrowDown","ArrowUp","Home","End"]),Ru=document.body.dataset.codeThemeLight,Du=document.body.dataset.codeThemeDark;if(Ru&&Du)ct({dark:Du,light:Ru});var n1=document.body.dataset.workspaceReviewEndpoint??"",r1=document.body.dataset.workspaceFilesEndpoint??"",Bo=mu(n1);window.addEventListener("pi-ui-code-theme-changed",(t)=>{if(!(t instanceof CustomEvent)||!Me(t.detail))return;let n=t.detail;if(ct(n),Bt)ah().setRenderOptions({theme:n}).then(ei).catch((s)=>console.error("Failed to update workspace theme",s))});var i1=Ee("app"),o1=document.querySelectorAll("[data-workspace-mode]"),wa=Ee("review-tree"),xn=Ee("review-history"),Hu=Ee("review-detail-header"),Yr=Ee("review-diff-view"),s1=Ee("workspace-file-tree"),Mu=Ee("workspace-file-view"),Au=Ee("review-empty"),Vu=Lt("review-mode-all"),Ou=Lt("review-mode-selected"),qu=Lt("review-layout-split"),zu=Lt("review-layout-stacked"),ma=Lt("review-wrap"),Wu=Ee("workspace-review"),a1=Ee("workspace-shell"),l1=Lt("review-submit-comments"),c1=Ee("review-comment-status"),d1=Ee("workspace-review-data-region"),u1=Ee("workspace-review-data"),In=JSON.parse(u1.textContent??"");if(!ne(In)||!ue(In.filesRevision)||!ue(In.treeRevision)||!ce(In.workspacePath)||!ca(In.snapshot))throw Error("Invalid initial workspace review state");var Ho=iu(In.preferences),{workspacePath:kn,filesRevision:Nu,treeRevision:Fu,snapshot:me}=In,gr=[...me.commits],Qr=me.commits.length===Ur,Jr=!1,Lo=0,tn=Ho.mode??"selected",Se={kind:"working",path:me.changes[0]?.path},ga=Ho.layout,Xr=Ho.wrap??!0,$u=0,va=new Map,Bt,ya,Zn=wu({clearSelection:()=>Bt?.clearSelectedLines(),onAnnotationsChange:A1,onSubmitted(){if(en=ih(en),Se.kind==="working")sn=en,er=Li(sn),Bt?.clearSelectedLines(),vr();window.piUi.messageScroll.scrollBottom()},status:c1,submit:M1,submitButton:l1}),en=[],Ai,Sa,Qn,Ni,sn=en,er=Li(sn),No=me.revision!=="git-unloaded",Vo=new Map,Fo=new Map,ba=0,jt=pu({endpoint:r1,initialGitStatus:me.changes,initialWorkspacePath:kn}),Ia=Ho.tab,Cn=S1(Ia,me.isGitRepository),an=R1(i1,!0,(t)=>{if(jt.setVisible(t&&Cn==="files"),t&&Cn==="git")dh();else Zr()});for(let t of o1)t.addEventListener("click",()=>{let n=t.dataset.workspaceMode;if(n==="files"||n==="git"&&me.isGitRepository)Bi(n)});var nn=new Ri({...nu,composition:{contextMenu:{enabled:!0,render:T1,triggerMode:"right-click"}},gitStatus:me.changes,paths:me.changes.map(({path:t})=>t),onSelectionChange(t){let n=t.length===1?t[0]:void 0;if(n&&!nn.getItem(n)?.isDirectory())Ju(n,!0)}}),ka=Mo(nn,"git",()=>kn);nn.render({containerWrapper:wa});_1();window.piUi.workspaceReview={...an,focusEditor:x1,focusFiles:I1,focusGit:k1};xn.addEventListener("scroll",qo,{passive:!0});xn.addEventListener("keydown",C1);Vu.addEventListener("click",()=>Yu("all"));Ou.addEventListener("click",()=>Yu("selected"));qu.addEventListener("click",()=>Qu("split"));zu.addEventListener("click",()=>Qu("unified"));ma.addEventListener("click",()=>{Xr=!Xr,ma.setAttribute("aria-pressed",String(Xr)),Hi({wrap:Xr}),ei()});var Fi=ti(),ju=()=>getComputedStyle(Wu).getPropertyValue("--review-side-by-side").trim()==="1",Lu=ju(),Ca=new ResizeObserver(()=>{let t=ju();if(Lu&&!t&&an.isOpen())an.close();Lu=t;let n=ti();if(_a(n),n===Fi)return;Fi=n,ei()});Ca.observe(Yr);Ca.observe(a1);var Ku=new MutationObserver(ei);Ku.observe(document.documentElement,{attributeFilter:["class"],attributes:!0});function Uu(){try{let t=document.getElementById("workspace-review-data"),n=JSON.parse(t?.textContent??"");if(ne(n)&&ue(n.filesRevision)&&ue(n.treeRevision)&&ce(n.workspacePath)&&ca(n.snapshot)){let s=n.workspacePath===kn&&n.filesRevision!==Nu,a=n.treeRevision!==Fu;if(Nu=n.filesRevision,Fu=n.treeRevision,s)nh();if(h1(n.workspacePath,n.snapshot),s){if(jt.refresh(a),Se.kind==="working")Oo(Se.path)}}}catch{}}var Gu=new MutationObserver(Uu);Gu.observe(d1,{characterData:!0,childList:!0,subtree:!0});xa();_a();ma.setAttribute("aria-pressed",String(Xr));Xu(me);Uu();window.addEventListener("pagehide",()=>{Gu.disconnect(),Ca.disconnect(),Ku.disconnect(),ka.save(),nn.cleanUp(),jt.cleanUp(),Bt?.cleanUp(),Zr(),os()},{once:!0});function h1(t,n){if(!xu({revision:me.revision,workspacePath:kn},{revision:n.revision,workspacePath:t}))return;if(t!==kn)ka.save(),kn=t,jt.setWorkspace(kn),ba++,Lo++,gr=[],Qr=!1,Jr=!1,Vo.clear(),Fo.clear(),va.clear(),Zn.reset(),No=!1,Se={kind:"working"};Xu(n)}function Xu(t){let n=Mi(me.revision)||!No,s=n?void 0:me.changes.map(({path:d})=>d),a=me.isGitRepository,l=_u(gr,Qr,t.commits);if(me=t,jt.setGitStatus(me.changes),gr=l.commits,Qr=l.hasMore,l.reset)Lo++,Jr=!1;if(!me.isGitRepository)Cn="files";else if(!a&&Ia!=="files")Cn="git";if(jt.setVisible(an.isOpen()&&Cn==="files"),nh(),ka.sync(s,me.changes.map(({path:d})=>d)),nn.setGitStatus(me.changes),Mi(me.revision)){No=!1,Fn(),Bt?.setItems([]),Qn=void 0,Jn("Loading Git data…");return}if(Se=Tu(Se,n,th(),me.commits),n)No=!0;if(Fn(),an.isOpen()&&Cn==="git")requestAnimationFrame(qo);if(Se.kind==="commit")Zu(Se.hash,Se.path);else Oo(Se.path)}function Yu(t){if(tn=t,xa(),Hi({mode:tn}),tn==="selected"&&!Se.path)Se.path=sn[0]?.fileDiff.name;Fn(),vr()}function Qu(t){ga=t,Fi=ti(),_a(Fi),Hi({layout:ga}),ei()}function Ju(t,n=!1){if(n&&Ni&&tn==="all")tn="selected",xa(),Hi({mode:tn});if(Oo(t),Fn(),t&&!n)nn.scrollToPath(t,{focus:!1,offset:"nearest"});if(t)eh(t)}function Oo(t){Se={kind:"working",path:t},sn=en,er=Li(sn),w1(),vr()}async function Zu(t,n){Zr(),Qn=void 0,Se={hash:t,kind:"commit",path:n},m1(),Fn();let s=Vo.get(t);if(s){Bu(s,n);return}Jn("Loading commit…");let a=await f1(t);if(Se.kind!=="commit"||Se.hash!==t)return;if(!a){Jn("Unable to load commit");return}Bu(a,n)}function Bu(t,n){sn=t.items,er=Li(sn),Se={hash:t.detail.commit.hash,kind:"commit",path:n&&er.has(n)?n:sn[0]?.fileDiff.name},b1(t.detail),Fn(),vr()}function f1(t){let n=Fo.get(t);if(n)return n;let s=ba,a=Bo.loadCommit(t).then((l)=>{if(!l)return;let d={detail:l,items:rh(l.changes,l.patch,l.commit.hash)};if(s!==ba)return;return Vo.set(t,d),d}).finally(()=>Fo.delete(t));return Fo.set(t,a),a}function p1(t,n){if(Se.kind!=="commit"||Se.hash!==t)return;if(Se.path=n,Fn(),tn==="selected")vr();else eh(n)}function eh(t){let n=er.get(t);if(n&&Bt)Bt.scrollTo({type:"item",id:n.id,align:"start",behavior:"smooth-auto"})}function th(){let t=new Set(me.changes.map(({path:a})=>a)),n=nn.getVisibleRows(0,nn.getVisibleCount()).find((a)=>a.kind==="file"&&t.has(a.path))?.path;if(!n||n===me.changes[0]?.path)return me.changes;let s=me.changes.find(({path:a})=>a===n);return s?[s,...me.changes.filter(({path:a})=>a!==n)]:me.changes}function m1(){for(let t of nn.getSelectedPaths())nn.getItem(t)?.deselect()}function Zr(){Ai?.abort(),Ai=void 0,Sa=void 0,Ni=void 0}function nh(){Zr(),en=[],Zn.reconcileItems([],new Set(me.changes.map((t)=>t.path)))}async function g1(t){Zr(),Sa=t;let n=new AbortController;if(Ai=n,Qn!==t)Qn=void 0,Bt?.setItems([]),Jn("Loading diff…");let s=tn==="selected"?Se.path:void 0,a=me.changes.filter((l)=>s===void 0||l.path===s);try{let l=await Bo.loadDiff(kn,s,n.signal);if(n.signal.aborted)return;let d=rh(a,l,"working");Zn.reconcileItems(d,new Set(me.changes.map((h)=>h.path))),en=ih(d),Qn=t}catch(l){if(n.signal.aborted)return;en=[],Qn=void 0,Bt?.setItems([]),Ni=Error.isError(l)?l.message:"Unable to load diff"}finally{if(!n.signal.aborted)Ai=void 0,Oo(Se.path)}}function vr(){if(!an.isOpen()||Cn!=="git")return;if(Se.kind==="working"&&me.changes.length>0&&!Mi(me.revision)){let n=JSON.stringify([kn,tn,tn==="selected"?Se.path:null]);if(Sa!==n){g1(n);return}if(Ai||Ni){if(Qn!==n)Jn(Ni??"Loading diff…");return}}let t=tn==="all"?sn:Se.path&&er.has(Se.path)?[er.get(Se.path)]:[];if(t.length===0){Qn=void 0,Bt?.setItems([]),Jn(D1());return}if(Jn(),!Bt){Fi=ti();let n=sh();Bt=new Ut(n,ah()),ya=n.enableGutterUtility,Bt.setup(Yr)}else if(ya!==oh())ei();Bt.setItems(t)}function rh(t,n,s){let a=new Map;for(let l of Ht(n))for(let d of l.files)a.set(d.name,d);return t.map((l)=>{let d=a.get(l.path)??v1(l),h=`${s}:${l.path}`,f=JSON.stringify({...d,cacheKey:void 0}),g=va.get(h),b=g?.content===f?g.version:++$u;return va.set(h,{content:f,version:b}),{fileDiff:{...d,cacheKey:`pi-ui:${h}:${b}`},id:`diff:${h}`,type:"diff",version:b}})}function ih(t){return t.map((n)=>({...n,annotations:Zn.annotations.get(n.fileDiff.name)}))}function Li(t){return new Map(t.map((n)=>[n.fileDiff.name,n]))}function v1(t){return{additionLines:[],deletionLines:[],hunks:[],isPartial:!0,name:t.path,splitLineCount:0,type:t.status==="added"||t.status==="untracked"?"new":t.status==="deleted"?"deleted":t.status==="renamed"?"rename-pure":"change",unifiedLineCount:0}}function Fn(){Su({commits:gr,getCommitDetail:(t)=>Vo.get(t)?.detail,history:xn,loading:Jr,onSelectCommit:(t)=>void Zu(t),onSelectCommitPath:p1,revision:me.revision,selection:Se})}function qo(){if(!an.isOpen()||Jr||!Qr||xn.scrollHeight-xn.scrollTop-xn.clientHeight>120)return;y1()}async function y1(){Jr=!0;let t=Lo;Fn();let n=await Bo.loadHistory(gr.length);if(t!==Lo)return;if(n){let s=Pu(gr,n);gr=s.commits,Qr=s.hasMore}else Qr=!1;Jr=!1,Fn(),requestAnimationFrame(qo)}function b1(t){Iu(Hu,t)}function w1(){ku(Hu)}function oh(){return Se.kind==="working"&&Zn.canAdd()}function ei(){if(!Bt)return;let t=sh();Bt.setOptions(t),ya=t.enableGutterUtility}function sh(){let t=oh();return{diffIndicators:"none",enableGutterUtility:t,enableLineSelection:t,onGutterUtilityClick(n,s){if(s.item.type==="diff")Zn.add(s.item,n)},pointerEventsOnScroll:!0,renderAnnotation:Zn.render,diffStyle:ti(),hunkSeparators:"simple",itemMetrics:{diffHeaderHeight:36,paddingBottom:0,spacing:0},layout:{gap:e1,paddingBottom:Zm,paddingTop:0},lineHoverHighlight:"both",overflow:Xr?"wrap":"scroll",stickyHeaders:!0,theme:ye(),themeType:document.documentElement.classList.contains("dark")?"dark":"light",unsafeCSS:`
|
|
1303
1303
|
:host {
|
|
1304
1304
|
--diffs-bg: var(--surface-code);
|
|
1305
1305
|
--diffs-dark-bg: var(--surface-code);
|
|
@@ -1358,4 +1358,4 @@ import{u,U,C,Ne,j,ae,E,ze,L,p,Je,et,He,V,Ue,m,be,Gt,A,Ze,Z,Ht,tt,nt,at,rt,it,x,U
|
|
|
1358
1358
|
min-width: 0;
|
|
1359
1359
|
}
|
|
1360
1360
|
|
|
1361
|
-
`}}function
|
|
1361
|
+
`}}function ah(){return is({highlighterOptions:{langs:["text"],preferredHighlighter:"shiki-js",theme:ye(),useTokenTransformer:!0},poolOptions:{poolSize:1,totalASTLRUCacheSize:100,workerFactory:()=>new Worker(new URL("../pierre-worker.js",import.meta.url),{type:"module"})}})}function S1(t,n){return n&&t!=="files"?"git":"files"}function Bi(t){if(t===Cn||t==="git"&&!me.isGitRepository)return;if(Cn=t,Ia=t,Hi({tab:t}),!an.isOpen())return;if(jt.setVisible(t==="files"),t==="git")dh();else Zr()}async function hb(t,n){if(n!==kn)throw Error("The workspace changed. Open the file link again.");an.open(),Bi("files"),await jt.openFile(t),zo(()=>jt.focusEditor())}function I1(){an.open(),Bi("files"),zo(()=>jt.focusTree())}function k1(){if(!me.isGitRepository)return;an.open(),Bi("git"),zo(()=>{if(Se.kind==="commit"||me.changes.length===0){ch();return}let t=nn.getSelectedPaths()[0]??nn.getFocusedPath()??me.changes[0]?.path;if(t)nn.scrollToPath(t,{focus:!0});fa(wa)})}function lh(){return[...xn.querySelectorAll(".review-commit")]}function ch(){let t=xn.querySelector('.review-commit[aria-pressed="true"]')??lh()[0];(t??xn).focus({preventScroll:!0}),t?.scrollIntoView({block:"nearest"})}function C1(t){if(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||!t1.has(t.code))return;let n=lh();if(n.length===0)return;let s=t.target instanceof HTMLButtonElement?n.indexOf(t.target):-1,a=s;if(t.code==="ArrowDown")a=Math.min(s+1,n.length-1);if(t.code==="ArrowUp")a=s<0?n.length-1:Math.max(0,s-1);if(t.code==="Home")a=0;if(t.code==="End")a=n.length-1;let l=n[a];if(!l)return;t.preventDefault(),l.click(),requestAnimationFrame(ch)}function x1(){an.open(),zo(()=>{if(Cn==="files")jt.focusEditor();else Yr.focus({preventScroll:!0})})}function zo(t){requestAnimationFrame(()=>requestAnimationFrame(t))}function _1(){Wu.addEventListener("keydown",(t)=>{if(t.defaultPrevented||t.isComposing||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||t.code!=="KeyJ"&&t.code!=="KeyK")return;let n=t.composedPath();if(n.some(E1))return;let s=t.code==="KeyJ"?"ArrowDown":"ArrowUp";if(n.includes(xn)){t.preventDefault(),n[0]?.dispatchEvent(new KeyboardEvent("keydown",{bubbles:!0,code:s,key:s}));return}if(n.some((l)=>l===wa||l===s1)){t.preventDefault(),n[0]?.dispatchEvent(new KeyboardEvent("keydown",{bubbles:!0,code:s,composed:!0,key:s}));return}let a=n.includes(Mu)?Mu:n.includes(Yr)?Yr:void 0;if(!a)return;t.preventDefault(),a.scrollBy({behavior:"smooth",top:t.code==="KeyJ"?100:-100})})}function E1(t){return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLElement&&t.isContentEditable}function T1(t,n){if(t.kind!=="file")return null;let s=document.createElement("div");s.className="workspace-tree-context-menu",s.setAttribute("role","menu");let a=document.createElement("button");a.type="button",a.className="workspace-tree-context-menu-item",a.setAttribute("role","menuitem"),a.textContent="Open in editor",a.addEventListener("click",()=>{n.close({restoreFocus:!1}),Bi("files"),jt.openFile(t.path)});let l=document.createElement("button");return l.type="button",l.className="workspace-tree-context-menu-item workspace-tree-context-menu-item-destructive",l.setAttribute("role","menuitem"),l.textContent="Discard changes",l.addEventListener("click",()=>{n.close({restoreFocus:!1}),P1(t.path)}),s.append(a,l),s}async function P1(t){let n=me.changes.find((a)=>a.path===t);if(!n)return;if(!await jt.requestConfirmation({title:"Discard changes?",description:n.status==="untracked"?`${t} is untracked and will be permanently deleted. This action cannot be undone.`:`All changes to ${t} will be permanently discarded. This action cannot be undone.`,action:"Discard"}))return;try{await Bo.discard(t),jt.refreshAfterDiscard(t)}catch(a){await jt.requestNotice("Could not discard changes",String(a).replace(/^Error: /,""))}}function dh(){let t=Eu(Se,th());if(t!==Se&&t.kind==="working")Ju(t.path);if(me.revision==="git-unloaded")Jn("Loading Git data…");else requestAnimationFrame(()=>{vr(),qo()})}function R1(t,n,s){let a=n,l=!1,d=()=>{let g=document.querySelector('[data-pi-ui-action="review"]');if(!g)return;g.inert=!a},h=(g)=>{t.dispatchEvent(new CustomEvent("pi-ui-workspace-review-open",{detail:{open:a&&g}}))},f=(g)=>{if(g&&!a){h(!1);return}let b=l;if(l=g,l!==b)s(l)};return d(),f(t.classList.contains("review-open")),{applyOpen:f,close:()=>h(!1),isAvailable:()=>a,isOpen:()=>l,open:()=>h(!0),setAvailable(g){if(a=g,d(),!a)h(!1)}}}function xa(){Vu.setAttribute("aria-pressed",String(tn==="all")),Ou.setAttribute("aria-pressed",String(tn==="selected"))}function ti(){if(Yr.clientWidth<720)return"unified";return ga??"split"}function _a(t=ti()){let n=t==="split";qu.setAttribute("aria-pressed",String(n)),zu.setAttribute("aria-pressed",String(!n))}function D1(){if(Mi(me.revision))return"Loading Git data…";if(!me.isGitRepository)return"Open a Git repository";if(Se.kind==="commit")return"This commit has no file changes";if(me.changes.length===0)return"Working tree clean";return"No changes to display"}function Jn(t){if(Au.hidden=!t,t)Au.textContent=t}function M1(t){let{promise:n,resolve:s}=Promise.withResolvers(),a=setTimeout(()=>s(!1),1e4);return window.addEventListener("pi-ui-workspace-review-submitted",()=>{clearTimeout(a),s(!0)},{once:!0}),document.body.dispatchEvent(new CustomEvent("pi-ui-workspace-review-submit",{detail:{comments:t}})),n}function Hi(t){document.body.dispatchEvent(new CustomEvent("pi-ui-workspace-review-preferences",{detail:t}))}function A1(t){let n=en.findIndex((s)=>s.fileDiff.name===t);if(n<0)return;if(en=en.with(n,{...en[n],annotations:Zn.annotations.get(t),version:++$u}),Se.kind==="working")sn=en,er=Li(sn),vr()}export{hb as openLinkedWorkspaceFile};
|