"use strict";var T=Object.create;var n=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var H=Object.getPrototypeOf;var O=Object.prototype.hasOwnProperty;var p=(e,r)=>n(e,"name",{value:r,configurable:true});var S=(e,r)=>{for(var t in r)n(e,t,{get:r[t],enumerable:true})};var v=(e,r,t,i)=>{if(r&&typeof r==="object"||typeof r==="function"){for(let s of A(r))if(!O.call(e,s)&&s!==t)n(e,s,{get:()=>r[s],enumerable:!(i=u(r,s))||i.enumerable})}return e};var g=(e,r,t)=>(t=e!=null?T(H(e)):{},v(r||!e||!e.__esModule?n(t,"default",{value:e,enumerable:true}):t,e));var E=e=>v(n({},"__esModule",{value:true}),e);var R={};S(R,{server:()=>P});module.exports=E(R);var m=require("node:path");var d=g(require("@adonisjs/fold"));var c=require("@adonisjs/ignitor");var o=require("fs-extra");var _=require("../config");var l=require("../environment");process.env.ENV_PATH=(0,m.join)(__dirname,"env.ini");async function L(e){try{await(0,o.stat)(e)}catch{const r=(0,m.join)(__dirname,"database","template.sqlite");const t=await(0,o.readFile)(r);await(0,o.writeFile)(e,t);if(l.isWindows){const i=await(0,o.stat)(e);await(0,o.chmod)(e,i.mode|146)}}}p(L,"ensureDB");const P=p(async(e,r,t)=>{const i=(0,m.join)(e,"server.sqlite");await L(i);process.env.DB_PATH=i;process.env.USER_PATH=e;process.env.HOST=_.LOCAL_HOSTNAME;process.env.PORT=r.toString();process.env.FERDIUM_LOCAL_TOKEN=t;return new Promise((s,w)=>{let a=false;c.hooks.after.httpServer(()=>{if(!a){s();a=true}});new c.Ignitor(d.default).appRoot(__dirname).fireHttpServer().catch(f=>{console.error(f);if(!a){a=true;w(f)}})})},"server");
