module.exports=[845824,e=>{"use strict";let T=`
PRAGMA journal_mode = WAL;
PRAGMA synchronous = NORMAL;
PRAGMA temp_store = MEMORY;
PRAGMA mmap_size = 30000000;
PRAGMA cache_size = -64000;
PRAGMA foreign_keys = ON;
PRAGMA busy_timeout = 5000;
`;e.s(["PRAGMA_SQL",0,T,"TABLES",0,{_meta:{columns:{key:"TEXT PRIMARY KEY",value:"TEXT NOT NULL"}},settings:{columns:{id:"INTEGER PRIMARY KEY CHECK (id = 1)",data:"TEXT NOT NULL"}},providerConnections:{columns:{id:"TEXT PRIMARY KEY",provider:"TEXT NOT NULL",authType:"TEXT NOT NULL",name:"TEXT",email:"TEXT",priority:"INTEGER",isActive:"INTEGER DEFAULT 1",data:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_pc_provider ON providerConnections(provider)","CREATE INDEX IF NOT EXISTS idx_pc_provider_active ON providerConnections(provider, isActive)","CREATE INDEX IF NOT EXISTS idx_pc_priority ON providerConnections(provider, priority)"]},providerNodes:{columns:{id:"TEXT PRIMARY KEY",type:"TEXT",name:"TEXT",data:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_pn_type ON providerNodes(type)"]},proxyPools:{columns:{id:"TEXT PRIMARY KEY",isActive:"INTEGER DEFAULT 1",testStatus:"TEXT",data:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_pp_active ON proxyPools(isActive)","CREATE INDEX IF NOT EXISTS idx_pp_status ON proxyPools(testStatus)"]},apiKeys:{columns:{id:"TEXT PRIMARY KEY",key:"TEXT UNIQUE NOT NULL",name:"TEXT",machineId:"TEXT",isActive:"INTEGER DEFAULT 1",createdAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_ak_key ON apiKeys(key)"]},combos:{columns:{id:"TEXT PRIMARY KEY",name:"TEXT UNIQUE NOT NULL",kind:"TEXT",models:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_combo_name ON combos(name)"]},kv:{columns:{scope:"TEXT NOT NULL",key:"TEXT NOT NULL",value:"TEXT NOT NULL"},primaryKey:"PRIMARY KEY (scope, key)",indexes:["CREATE INDEX IF NOT EXISTS idx_kv_scope ON kv(scope)"]},usageHistory:{columns:{id:"INTEGER PRIMARY KEY AUTOINCREMENT",timestamp:"TEXT NOT NULL",provider:"TEXT",model:"TEXT",connectionId:"TEXT",apiKey:"TEXT",endpoint:"TEXT",promptTokens:"INTEGER DEFAULT 0",completionTokens:"INTEGER DEFAULT 0",cost:"REAL DEFAULT 0",status:"TEXT",tokens:"TEXT",meta:"TEXT"},indexes:["CREATE INDEX IF NOT EXISTS idx_uh_ts ON usageHistory(timestamp DESC)","CREATE INDEX IF NOT EXISTS idx_uh_provider ON usageHistory(provider)","CREATE INDEX IF NOT EXISTS idx_uh_model ON usageHistory(model)","CREATE INDEX IF NOT EXISTS idx_uh_conn ON usageHistory(connectionId)"]},usageDaily:{columns:{dateKey:"TEXT PRIMARY KEY",data:"TEXT NOT NULL"}},requestDetails:{columns:{id:"TEXT PRIMARY KEY",timestamp:"TEXT NOT NULL",provider:"TEXT",model:"TEXT",connectionId:"TEXT",status:"TEXT",data:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_rd_ts ON requestDetails(timestamp DESC)","CREATE INDEX IF NOT EXISTS idx_rd_provider ON requestDetails(provider)","CREATE INDEX IF NOT EXISTS idx_rd_model ON requestDetails(model)","CREATE INDEX IF NOT EXISTS idx_rd_conn ON requestDetails(connectionId)"]}},"buildCreateTableSql",0,function(e,T){let E=Object.entries(T.columns).map(([e,T])=>`${e} ${T}`);return T.primaryKey&&E.push(T.primaryKey),`CREATE TABLE IF NOT EXISTS ${e} (${E.join(", ")})`}])},227359,e=>{"use strict";var T=e.i(845824);async function E(E){let{Database:t}=await e.A(802178),i=new t(E,{create:!0});i.exec(T.PRAGMA_SQL);let s=new Map;function o(e){let T=s.get(e);return T||(T=i.prepare(e),s.set(e,T)),T}let r=setInterval(()=>{try{i.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},6e4);function N(){try{i.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}try{s.clear()}catch{}try{i.close()}catch{}}"function"==typeof r.unref&&r.unref();let n=()=>N();return process.once("beforeExit",n),process.once("SIGINT",()=>{n(),process.exit(0)}),process.once("SIGTERM",()=>{n(),process.exit(0)}),{driver:"bun:sqlite",run(e,T=[]){let E=o(e).run(...T);return{changes:Number(E.changes??0),lastInsertRowid:Number(E.lastInsertRowid??0)}},get:(e,T=[])=>o(e).get(...T),all:(e,T=[])=>o(e).all(...T),exec:e=>i.exec(e),transaction:e=>i.transaction(e)(),checkpoint(){try{i.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},close(){clearInterval(r),N()},raw:i}}e.s(["createBunSqliteAdapter",0,E])},802178,e=>{e.v(T=>Promise.all(["server/chunks/[externals]_bun_sqlite_0rwspvz._.js"].map(T=>e.l(T))).then(()=>T(567551)))}];

//# sourceMappingURL=%5Broot-of-the-server%5D__08l9~gp._.js.map