"use strict";exports.id=4840,exports.ids=[4840],exports.modules={94840:(a,b,c)=>{c.d(b,{withUpdateSnapshot:()=>i});var d=c(73024),e=c(76760),f=c.n(e),g=c(8118),h=c(53905);async function i(a,b,c,e){let i;if("project"===a){if(!c)throw Error("project-scoped update requires rootId");let a=await (0,h.Zn)(c);if(!a)throw Error(`unknown rootId: ${c}`);i=a.path}let l=(0,g.Od)(a,b,i);if(!await j(l))return e();let m=`${l}.bak.${Date.now().toString(36)}`;await d.promises.rename(l,m);let n=!1;try{let a=await e(),b=f().join(m,"data"),c=f().join(l,"data");return await j(b)&&(await d.promises.mkdir(c,{recursive:!0}),await k(b,c)),n=!0,a}finally{n?await d.promises.rm(m,{recursive:!0,force:!0}).catch(()=>{}):(await d.promises.rm(l,{recursive:!0,force:!0}).catch(()=>{}),await d.promises.rename(m,l).catch(()=>{}))}}async function j(a){try{return await d.promises.access(a),!0}catch{return!1}}async function k(a,b){for(let c of(await d.promises.mkdir(b,{recursive:!0}),await d.promises.readdir(a,{withFileTypes:!0}))){let e=f().join(a,c.name),g=f().join(b,c.name);c.isDirectory()?await k(e,g):c.isFile()&&await d.promises.copyFile(e,g)}}}};