import{anasR,zasK,QasU,aqasY}from"./entry.a42f0781.js";import{gasT,aas$,basI,sasW,casj,wasb,dasB,fasJ}from"./query.31e9d059.js";import{pasH}from"./index.a6ef77ff.js";import{uasM}from"./preview.000d6083.js";import"./index.c0f9b2a4.js";import"./utils.4ea42d84.js";constq="memory",G=()=>{constr=newMap;return{name:q,options:{},hasItem(t){returnr.has(t)},getItem(t){returnr.get(t)||null},getItemRaw(t){returnr.get(t)||null},setItem(t,n){r.set(t,n)},setItemRaw(t,n){r.set(t,n)},removeItem(t){r.delete(t)},getKeys(){returnArray.from(r.keys())},clear(){r.clear()},dispose(){r.clear()}}};functionZ(r){return!r||typeofr.then!="function"?Promise.resolve(r):r}functiong(r,...t){try{returnZ(r(...t))}catch(n){returnPromise.reject(n)}}functionF(r){constt=typeofr;returnr===null||t!=="object"&&t!=="function"}functionV(r){constt=Object.getPrototypeOf(r);return!t||t.isPrototypeOf(Object)}functionD(r){if(F(r))returnString(r);if(V(r)||Array.isArray(r))returnJSON.stringify(r);if(typeofr.toJSON=="function")returnD(r.toJSON());thrownewError("[unstorage] Cannot stringify value!")}functionz(){if(typeofBuffer===void0)thrownewTypeError("[unstorage] Buffer is not supported!")}const_="base64:";functionQ(r){if(typeofr=="string")returnr;z();constt=Buffer.from(r).toString("base64");return_+t}functionX(r){returntypeofr!="string"||!r.startsWith(_)?r:(z(),Buffer.from(r.slice(_.length),"base64"))}constk=["hasItem","getItem","getItemRaw","setItem","setItemRaw","removeItem","getMeta","setMeta","removeMeta","getKeys","clear","mount","unmount"];functionee(r,t){if(t=v(t),!t)returnr;constn={...r};for(constiofk)n[i]=(s="",...c)=>r[i](t+s,...c);returnn.getKeys=(i="",...s)=>r.getKeys(t+i,...s).then(c=>c.map(u=>u.slice(t.length))),n}functionp(r){returnr?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}functionv(r){returnr=p(r),r?r+":":""}constte="memory",re=()=>{constr=newMap;return{name:te,options:{},hasItem(t){returnr.has(t)},getItem(t){returnr.get(t)||null},getItemRaw(t){returnr.get(t)||null},setItem(t,n){r.set(t,n)},setItemRaw(t,n){r.set(t,n)},removeItem(t){r.delete(t)},getKeys(){returnArray.from(r.keys())},clear(){r.clear()},dispose(){r.clear()}}};functionne(r={}){constt={mounts:{"":r.driver||re()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=e=>{for(constaoft.mountpoints)if(e.startsWith(a))return{base:a,relativeKey:e.slice(a.length),driver:t.mounts[a]};return{base:"",relativeKey:e,driver:t.mounts[""]}},i=(e,a)=>t.mountpoints.filter(o=>o.startsWith(e)||a&&e.startsWith(o)).map(o=>({relativeBase:e.length>o.length?e.slice(o.length):void0,mountpoint:o,driver:t.mounts[o]})),s=(e,a)=>{if(t.watching){a=p(a);for(constooft.watchListeners)o(e,a)}},c=async()=>{if(!t.watching){t.watching=!0;for(consteint.mounts)t.unwatch[e]=awaitP(t.mounts[e],s,e)}},u=async()=>{if(t.watching){for(consteint.unwatch)awaitt.unwatch[e]();t.unwatch={},t.watching=!1}},h={hasItem(e,a={}){e=p(e);const{relativeKey:o,driver:f}=n(e);returng(f.hasItem,o,a)},getItem(e,a={}){e=p(e);const{relativeKey:o,driver:f}=n(e);returng(f.getItem,o,a).then(m=>R(m))},getItemRaw(e,a={}){e=p(e);const{relativeKey:o,driver:f}=n(e);returnf.getItemRaw?g(f.getItemRaw,o,a):g(f.getItem,o,a).then(m=>X(m))},asyncsetItem(e,a,o={}){if(a===void0)returnh.removeItem(e);e=p(e);const{relativeKey:f,driver:m}=n(e);m.setItem&&(awaitg(m.setItem,f,D(a),o),m.watch||s("update",e))},asyncsetItemRaw(e,a,o={}){if(a===void0)returnh.removeItem(e,o);e=p(e);const{relativeKey:f,driver:m}=n(e);if(m.setItemRaw)awaitg(m.setItemRaw,f,a,o);elseif(m.setItem)awaitg(m.setItem,f,Q(a),o);elsereturn;m.watch||s("update",e)},asyncremoveItem(e,a={}){typeofa=="boolean"&&(a={removeMata:a}),e=p(e);const{relativeKey:o,driver:f}=n(e);f.removeItem&&(awaitg(f.removeItem,o,a),a.removeMata&&awaitg(f.removeItem,o+"$",a),f.watch||s("remove",e))},asyncgetMeta(e,a={}){typeofa=="boolean"&&(a={nativeOnly:a}),e=p(e);const{relativeKey:o,driver:f}=n(e),m=Object.create(null);if(f.getMeta&&Object.assign(m,awaitg(f.getMeta