import View from"./view.mjs";import sessions from"../../sessions.mjs";export default class QuitView extends View{route="/quit";_methods=["get","post"];_template="quit";#s=!1;async handlePost(s,t){if(!sessions.authenticateAdmin(s,t).success)return t.status(403).send({status:"failed"});s.body?.defer?(this.#s=!0,t.status(202).send({status:"success"}),globalThis.setTimeout(()=>{this.#t()},6e4)):(t.send({status:"success"}),t.once("finish",()=>this.#t()))}async handleGet(s,t){if(!this.#s)return t.redirect(foundry.utils.getRoute(s.baseUrl));const e=QuitView._getStaticContent({setup:!0}),i={bodyClass:`auth flexcol theme-${config.options.cssTheme}`,layout:"setup",scripts:e.scripts,styles:e.styles};t.render(this._template,i)}#t(){config.app?config.app.quit():process.exit()}}