TOPVERSE_Official/.output/public/_nuxt/client-db.4ae767c1.js

2 lines
19 KiB
JavaScript
Raw Normal View History

2023-05-30 00:33:57 +08:00
import{am as R,z as K,T as Y,ap as T}from"./entry.c3abd651.js";import{g as W,a as $,b as I,s as b,c as j,w as B,d as J,f as H}from"./query.79ebe04e.js";import{p as q}from"./index.a6ef77ff.js";import{u as D}from"./preview.bfc27fc9.js";import"./index.500b5a03.js";import"./utils.5e77fdb8.js";const G="memory",Z=()=>{const r=new Map;return{name:G,options:{},hasItem(t){return r.has(t)},getItem(t){return r.get(t)||null},getItemRaw(t){return r.get(t)||null},setItem(t,n){r.set(t,n)},setItemRaw(t,n){r.set(t,n)},removeItem(t){r.delete(t)},getKeys(){return Array.from(r.keys())},clear(){r.clear()},dispose(){r.clear()}}};function F(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function g(r,...t){try{return F(r(...t))}catch(n){return Promise.reject(n)}}function V(r){const t=typeof r;return r===null||t!=="object"&&t!=="function"}function Q(r){const t=Object.getPrototypeOf(r);return!t||t.isPrototypeOf(Object)}function z(r){if(V(r))return String(r);if(Q(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return z(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function L(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const _="base64:";function X(r){if(typeof r=="string")return r;L();const t=Buffer.from(r).toString("base64");return _+t}function k(r){return typeof r!="string"||!r.startsWith(_)?r:(L(),Buffer.from(r.slice(_.length),"base64"))}const ee=["hasItem","getItem","getItemRaw","setItem","setItemRaw","removeItem","getMeta","setMeta","removeMeta","getKeys","clear","mount","unmount"];function te(r,t){if(t=v(t),!t)return r;const n={...r};for(const i of ee)n[i]=(s="",...c)=>r[i](t+s,...c);return n.getKeys=(i="",...s)=>r.getKeys(t+i,...s).then(c=>c.map(u=>u.slice(t.length))),n}function p(r){return r?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function v(r){return r=p(r),r?r+":":""}const re="memory",ne=()=>{const r=new Map;return{name:re,options:{},hasItem(t){return r.has(t)},getItem(t){return r.get(t)||null},getItemRaw(t){return r.get(t)||null},setItem(t,n){r.set(t,n)},setItemRaw(t,n){r.set(t,n)},removeItem(t){r.delete(t)},getKeys(){return Array.from(r.keys())},clear(){r.clear()},dispose(){r.clear()}}};function ie(r={}){const t={mounts:{"":r.driver||ne()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=e=>{for(const a of t.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):void 0,mountpoint:o,driver:t.mounts[o]})),s=(e,a)=>{if(t.watching){a=p(a);for(const o of t.watchListeners)o(e,a)}},c=async()=>{if(!t.watching){t.watching=!0;for(const e in t.mounts)t.unwatch[e]=await P(t.mounts[e],s,e)}},u=async()=>{if(t.watching){for(const e in t.unwatch)await t.unwatch[e]();t.unwatch={},t.watching=!1}},h={hasItem(e,a={}){e=p(e);const{relativeKey:o,driver:f}=n(e);return g(f.hasItem,o,a)},getItem(e,a={}){e=p(e);const{relativeKey:o,driver:f}=n(e);return g(f.getItem,o,a).then(m=>R(m))},getItemRaw(e,a={}){e=p(e);const{relativeKey:o,driver:f}=n(e);return f.getItemRaw?g(f.getItemRaw,o,a):g(f.getItem,o,a).then(m=>k(m))},async setItem(e,a,o={}){if(a===void 0)return h.removeItem(e);e=p(e);const{relativeKey:f,driver:m}=n(e);m.setItem&&(await g(m.setItem,f,z(a),o),m.watch||s("update",e))},async setItemRaw(e,a,o={}){if(a===void 0)return h.removeItem(e,o);e=p(e);const{relativeKey:f,driver:m}=n(e);if(m.setItemRaw)await g(m.setItemRaw,f,a,o);else if(m.setItem)await g(m.setItem,f,X(a),o);else return;m.watch||s("update",e)},async removeItem(e,a={}){typeof a=="boolean"&&(a={removeMata:a}),e=p(e);const{relativeKey:o,driver:f}=n(e);f.removeItem&&(await g(f.removeItem,o,a),a.removeMata&&await g(f.removeItem,o+"$",a),f.watch||s("remove",e))},async getMeta(e,a={}){typeof a=="boolean"&&(a={nativeOnly:a}),e=p(e);const{relativeKey:o,driver:f}=n(e),m=Object.create(null);if(f.getMeta&&Object.assign(m,await g(f.getMe