@velastack/patterns 0.14.3 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- package/dist/chunks/_page-Cg7LjaOE.js +5 -0
- package/dist/chunks/{_page-44USwLXO.js.map → _page-Cg7LjaOE.js.map} +1 -1
- package/dist/chunks/auth-pages-DSBqKjO0.js +311 -0
- package/dist/chunks/auth-pages-DSBqKjO0.js.map +1 -0
- package/dist/chunks/{collections-B_-NTtLW.js → collections-D2_2cxWD.js} +70 -73
- package/dist/chunks/collections-D2_2cxWD.js.map +1 -0
- package/dist/chunks/{constants-CTp-0HKk.js → constants-DbpctM1D.js} +21 -21
- package/dist/chunks/constants-DbpctM1D.js.map +1 -0
- package/dist/chunks/{currency.server-DOX4Rzyb.js → currency.server-CFrwmYra.js} +4 -4
- package/dist/chunks/{currency.server-DOX4Rzyb.js.map → currency.server-CFrwmYra.js.map} +1 -1
- package/dist/chunks/{env-vars-BbS_mWyP.js → env-vars-Dm3Xy4rl.js} +4 -4
- package/dist/chunks/{env-vars-BbS_mWyP.js.map → env-vars-Dm3Xy4rl.js.map} +1 -1
- package/dist/chunks/{generate-CKuUg3p-.js → generate-BDGmczK8.js} +2 -2
- package/dist/chunks/{generate-CKuUg3p-.js.map → generate-BDGmczK8.js.map} +1 -1
- package/dist/chunks/{generate-Bwkx_usZ.js → generate-BMWoD9E2.js} +4 -4
- package/dist/chunks/{generate-Bwkx_usZ.js.map → generate-BMWoD9E2.js.map} +1 -1
- package/dist/chunks/{generate-4iujJNAW.js → generate-BRTIGlqT.js} +5 -5
- package/dist/chunks/{generate-4iujJNAW.js.map → generate-BRTIGlqT.js.map} +1 -1
- package/dist/chunks/{generate-DYq5Oj58.js → generate-BrO9MOgL.js} +2 -2
- package/dist/chunks/{generate-DYq5Oj58.js.map → generate-BrO9MOgL.js.map} +1 -1
- package/dist/chunks/{generate-BJY8AtAp.js → generate-BvQ6VwYH.js} +5 -5
- package/dist/chunks/{generate-BJY8AtAp.js.map → generate-BvQ6VwYH.js.map} +1 -1
- package/dist/chunks/{generate-B4uDCW5D.js → generate-Cs_fdfD7.js} +4 -4
- package/dist/chunks/{generate-B4uDCW5D.js.map → generate-Cs_fdfD7.js.map} +1 -1
- package/dist/chunks/{generate-JkvSNTy-.js → generate-DZ9kT3iC.js} +31 -188
- package/dist/chunks/generate-DZ9kT3iC.js.map +1 -0
- package/dist/chunks/{generate.runtime-D9OC1RXu.js → generate.runtime-1eTnPFmA.js} +3 -3
- package/dist/chunks/{generate.runtime-D9OC1RXu.js.map → generate.runtime-1eTnPFmA.js.map} +1 -1
- package/dist/chunks/{generate.runtime-27KTIg_o.js → generate.runtime-B-H2F-sH.js} +48 -53
- package/dist/chunks/generate.runtime-B-H2F-sH.js.map +1 -0
- package/dist/chunks/{generate.runtime-DhSH1o8H.js → generate.runtime-B4mQEW54.js} +3 -3
- package/dist/chunks/{generate.runtime-DhSH1o8H.js.map → generate.runtime-B4mQEW54.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BFX_8erf.js → generate.runtime-B4rG6gSK.js} +10 -9
- package/dist/chunks/{generate.runtime-BFX_8erf.js.map → generate.runtime-B4rG6gSK.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DuAYqKxl.js → generate.runtime-B9nVU5iO.js} +2 -2
- package/dist/chunks/{generate.runtime-DuAYqKxl.js.map → generate.runtime-B9nVU5iO.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D6l6uLiY.js → generate.runtime-BC1GJUXE.js} +2 -2
- package/dist/chunks/{generate.runtime-D6l6uLiY.js.map → generate.runtime-BC1GJUXE.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Duw_JI_b.js → generate.runtime-BJwSyslL.js} +2 -2
- package/dist/chunks/{generate.runtime-Duw_JI_b.js.map → generate.runtime-BJwSyslL.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CBVcsole.js → generate.runtime-Bda2_WK7.js} +2 -2
- package/dist/chunks/{generate.runtime-CBVcsole.js.map → generate.runtime-Bda2_WK7.js.map} +1 -1
- package/dist/chunks/{generate.runtime-sjFAWbZc.js → generate.runtime-BkQPchHe.js} +7 -7
- package/dist/chunks/{generate.runtime-sjFAWbZc.js.map → generate.runtime-BkQPchHe.js.map} +1 -1
- package/dist/chunks/{generate.runtime-bsuqrKOm.js → generate.runtime-BuQASx9Y.js} +2 -2
- package/dist/chunks/{generate.runtime-bsuqrKOm.js.map → generate.runtime-BuQASx9Y.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D77ueFKY.js → generate.runtime-BvHK8IN-.js} +118 -134
- package/dist/chunks/generate.runtime-BvHK8IN-.js.map +1 -0
- package/dist/chunks/{generate.runtime-BXNBWGYr.js → generate.runtime-C1HlZnLC.js} +2 -2
- package/dist/chunks/{generate.runtime-BXNBWGYr.js.map → generate.runtime-C1HlZnLC.js.map} +1 -1
- package/dist/chunks/{generate.runtime-wiWdXXPi.js → generate.runtime-C62ChKGg.js} +6 -6
- package/dist/chunks/{generate.runtime-wiWdXXPi.js.map → generate.runtime-C62ChKGg.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B8-ORwxT.js → generate.runtime-CIOi-XSm.js} +6 -6
- package/dist/chunks/{generate.runtime-B8-ORwxT.js.map → generate.runtime-CIOi-XSm.js.map} +1 -1
- package/dist/chunks/{generate.runtime-nXjFqHyb.js → generate.runtime-CQ_U4YTJ.js} +4 -4
- package/dist/chunks/{generate.runtime-nXjFqHyb.js.map → generate.runtime-CQ_U4YTJ.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D0lI3Gt8.js → generate.runtime-CZA46Ghe.js} +5 -5
- package/dist/chunks/{generate.runtime-D0lI3Gt8.js.map → generate.runtime-CZA46Ghe.js.map} +1 -1
- package/dist/chunks/{generate.runtime-XT_JQlTk.js → generate.runtime-Cd742Yqf.js} +2 -2
- package/dist/chunks/{generate.runtime-XT_JQlTk.js.map → generate.runtime-Cd742Yqf.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BlEy2fFF.js → generate.runtime-CfCDLJ6Y.js} +3 -3
- package/dist/chunks/{generate.runtime-BlEy2fFF.js.map → generate.runtime-CfCDLJ6Y.js.map} +1 -1
- package/dist/chunks/{generate.runtime-RTGpwxcS.js → generate.runtime-CjLath7N.js} +6 -12
- package/dist/chunks/generate.runtime-CjLath7N.js.map +1 -0
- package/dist/chunks/{generate.runtime-UtkANHk1.js → generate.runtime-CnNtG_x5.js} +3 -3
- package/dist/chunks/{generate.runtime-UtkANHk1.js.map → generate.runtime-CnNtG_x5.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CCaCaXNu.js → generate.runtime-D8G8cwCr.js} +2 -2
- package/dist/chunks/{generate.runtime-CCaCaXNu.js.map → generate.runtime-D8G8cwCr.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Cm75waRD.js → generate.runtime-DBQvnQmR.js} +2 -2
- package/dist/chunks/{generate.runtime-Cm75waRD.js.map → generate.runtime-DBQvnQmR.js.map} +1 -1
- package/dist/chunks/{generate.runtime-PDnSxiek.js → generate.runtime-DE-vPcn4.js} +6 -6
- package/dist/chunks/{generate.runtime-PDnSxiek.js.map → generate.runtime-DE-vPcn4.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DLoYscQO.js → generate.runtime-DFSsgOmB.js} +3 -3
- package/dist/chunks/{generate.runtime-DLoYscQO.js.map → generate.runtime-DFSsgOmB.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DiEiFoxR.js → generate.runtime-DNjyaFml.js} +3 -3
- package/dist/chunks/{generate.runtime-DiEiFoxR.js.map → generate.runtime-DNjyaFml.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CuvdtjKc.js → generate.runtime-DQI69jkX.js} +2 -2
- package/dist/chunks/{generate.runtime-CuvdtjKc.js.map → generate.runtime-DQI69jkX.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B7XOa9_A.js → generate.runtime-DQUZRJH8.js} +3 -3
- package/dist/chunks/{generate.runtime-B7XOa9_A.js.map → generate.runtime-DQUZRJH8.js.map} +1 -1
- package/dist/chunks/generate.runtime-DR8z6DyZ.js +169 -0
- package/dist/chunks/generate.runtime-DR8z6DyZ.js.map +1 -0
- package/dist/chunks/{generate.runtime-XpYi9SlM.js → generate.runtime-Diix70x4.js} +3 -3
- package/dist/chunks/{generate.runtime-XpYi9SlM.js.map → generate.runtime-Diix70x4.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BU-4sjyu.js → generate.runtime-Doumu0TL.js} +110 -113
- package/dist/chunks/generate.runtime-Doumu0TL.js.map +1 -0
- package/dist/chunks/{generate.runtime-TQmspB4Z.js → generate.runtime-Dtum580c.js} +27 -34
- package/dist/chunks/generate.runtime-Dtum580c.js.map +1 -0
- package/dist/chunks/{generate.runtime-BROXlbeJ.js → generate.runtime-GmsldrGj.js} +3 -3
- package/dist/chunks/{generate.runtime-BROXlbeJ.js.map → generate.runtime-GmsldrGj.js.map} +1 -1
- package/dist/chunks/{generate.runtime-ZgLxGWuy.js → generate.runtime-lP4eoera.js} +3 -3
- package/dist/chunks/{generate.runtime-ZgLxGWuy.js.map → generate.runtime-lP4eoera.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Dm7IEo2h.js → generate.runtime-liAz2TOE.js} +5 -5
- package/dist/chunks/{generate.runtime-Dm7IEo2h.js.map → generate.runtime-liAz2TOE.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DxyQqNpu.js → generate.runtime-rxzMCECc.js} +5 -11
- package/dist/chunks/generate.runtime-rxzMCECc.js.map +1 -0
- package/dist/chunks/{generate.runtime-VMTLHWLk.js → generate.runtime-ufoTIUXA.js} +55 -60
- package/dist/chunks/generate.runtime-ufoTIUXA.js.map +1 -0
- package/dist/chunks/gitignore-2XpeEFmr.js +139 -0
- package/dist/chunks/gitignore-2XpeEFmr.js.map +1 -0
- package/dist/chunks/{i18n-mnzzcYhz.js → i18n-CxT1kz8Y.js} +3 -3
- package/dist/chunks/{i18n-mnzzcYhz.js.map → i18n-CxT1kz8Y.js.map} +1 -1
- package/dist/chunks/{modify-file-CgJIza72.js → modify-file-BX9-aZD1.js} +3 -3
- package/dist/chunks/{modify-file-CgJIza72.js.map → modify-file-BX9-aZD1.js.map} +1 -1
- package/dist/chunks/pocketbase-Dq9UdK_j.js +232 -0
- package/dist/chunks/pocketbase-Dq9UdK_j.js.map +1 -0
- package/dist/chunks/{providers-CDUFaOeQ.js → providers-2UgxXRJW.js} +3 -3
- package/dist/chunks/{providers-CDUFaOeQ.js.map → providers-2UgxXRJW.js.map} +1 -1
- package/dist/chunks/{providers-tjlFH5di.js → providers-DrK_hjSr.js} +2 -2
- package/dist/chunks/{providers-tjlFH5di.js.map → providers-DrK_hjSr.js.map} +1 -1
- package/dist/chunks/route-BDhlro0V.js +162 -0
- package/dist/chunks/route-BDhlro0V.js.map +1 -0
- package/dist/chunks/schema-2frI_BS2.js +116 -0
- package/dist/chunks/schema-2frI_BS2.js.map +1 -0
- package/dist/chunks/{shared-BjTRQ5QH.js → shared-BOFCKWJs.js} +3 -3
- package/dist/chunks/{shared-BjTRQ5QH.js.map → shared-BOFCKWJs.js.map} +1 -1
- package/dist/chunks/shared-DJ4KvhTb.js +1182 -0
- package/dist/chunks/shared-DJ4KvhTb.js.map +1 -0
- package/dist/chunks/{site-C8Wcg6LT.js → site-qASrdyUt.js} +3 -3
- package/dist/chunks/{site-C8Wcg6LT.js.map → site-qASrdyUt.js.map} +1 -1
- package/dist/chunks/{table-core-RvMjoXpT.js → table-core-s2xjYgRD.js} +3 -3
- package/dist/chunks/{table-core-RvMjoXpT.js.map → table-core-s2xjYgRD.js.map} +1 -1
- package/dist/chunks/test-setup-jqVMmL83.js +103 -0
- package/dist/chunks/test-setup-jqVMmL83.js.map +1 -0
- package/dist/chunks/{translations-CiJnl574.js → translations-B5hX0Qq-.js} +5 -2
- package/dist/chunks/{translations-CiJnl574.js.map → translations-B5hX0Qq-.js.map} +1 -1
- package/dist/chunks/{ui-CE-8llQS.js → ui-DZuwcswv.js} +3 -3
- package/dist/chunks/{ui-CE-8llQS.js.map → ui-DZuwcswv.js.map} +1 -1
- package/dist/chunks/{util-ILWdjRAd.js → util-mXrQ89nG.js} +8 -2
- package/dist/chunks/util-mXrQ89nG.js.map +1 -0
- package/dist/chunks/{whatsapp-DT10x76l.js → whatsapp-BytvTPlS.js} +2 -2
- package/dist/chunks/{whatsapp-DT10x76l.js.map → whatsapp-BytvTPlS.js.map} +1 -1
- package/dist/chunks/write-result-BhfLWAXf.js +539 -0
- package/dist/chunks/write-result-BhfLWAXf.js.map +1 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.js +2388 -3276
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunks/_page-44USwLXO.js +0 -5
- package/dist/chunks/auth-pages-BW3_yluN.js +0 -285
- package/dist/chunks/auth-pages-BW3_yluN.js.map +0 -1
- package/dist/chunks/collections-B_-NTtLW.js.map +0 -1
- package/dist/chunks/constants-CTp-0HKk.js.map +0 -1
- package/dist/chunks/generate-JkvSNTy-.js.map +0 -1
- package/dist/chunks/generate.runtime-27KTIg_o.js.map +0 -1
- package/dist/chunks/generate.runtime-BU-4sjyu.js.map +0 -1
- package/dist/chunks/generate.runtime-D77ueFKY.js.map +0 -1
- package/dist/chunks/generate.runtime-Dn0_y2iV.js +0 -161
- package/dist/chunks/generate.runtime-Dn0_y2iV.js.map +0 -1
- package/dist/chunks/generate.runtime-DxyQqNpu.js.map +0 -1
- package/dist/chunks/generate.runtime-RTGpwxcS.js.map +0 -1
- package/dist/chunks/generate.runtime-TQmspB4Z.js.map +0 -1
- package/dist/chunks/generate.runtime-VMTLHWLk.js.map +0 -1
- package/dist/chunks/pocketbase-S8lUt0nI.js +0 -219
- package/dist/chunks/pocketbase-S8lUt0nI.js.map +0 -1
- package/dist/chunks/test-setup-CpjhQSl-.js +0 -176
- package/dist/chunks/test-setup-CpjhQSl-.js.map +0 -1
- package/dist/chunks/util-ILWdjRAd.js.map +0 -1
- package/dist/chunks/write-result-BguSfKV-.js +0 -499
- package/dist/chunks/write-result-BguSfKV-.js.map +0 -1
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, C as o, Ct as s, D as c, Dt as l, E as u, Et as ee, F as te, Ft as ne, G as re, Gt as ie, H as ae, Ht as oe, I as se, It as ce, J as le, Jt as ue, K as de, Kt as fe, L as d, Lt as f, M as p, Mt as m, N as h, Nt as g, O as _, Ot as v, P as y, Pt as b, Q as x, Qt as S, R as C, Rt as w, S as T, St as E, T as D, Tt as O, U as k, Ut as A, V as j, Vt as M, W as N, Wt as P, X as F, Xt as I, Y as L, Yt as R, Z as z, Zt as B, _ as V, _n as pe, _t as me, a as he, an as ge, at as _e, b as ve, bt as ye, c as be, cn as xe, ct as Se, d as Ce, dn as we, dt as Te, en as Ee, et as De, f as Oe, fn as ke, ft as Ae, g as je, gn as Me, gt as Ne, h as Pe, hn as Fe, ht as Ie, i as Le, in as Re, it as ze, j as Be, jt as Ve, k as He, kt as Ue, l as We, ln as Ge, lt as Ke, m as qe, mn as Je, mt as Ye, n as Xe, nn as Ze, nt as Qe, o as $e, on as et, ot as tt, p as nt, pn as rt, pt as it, q as at, qt as ot, r as st, rn as ct, rt as lt, s as ut, sn as dt, st as ft, t as pt, tn as mt, tt as ht, u as gt, un as _t, ut as vt, v as yt, vn as bt, vt as xt, w as St, wt as Ct, x as wt, xt as Tt, y as Et, yn as Dt, yt as Ot, z as kt, zt as At } from "./_page-Cg7LjaOE.js";
|
|
2
|
+
import { t as jt } from "./modify-user-signup-ENhadGKH.js";
|
|
3
|
+
import H from "node:fs";
|
|
4
|
+
import U from "node:path";
|
|
5
|
+
import Mt from "prettier";
|
|
6
|
+
import Nt from "prettier-plugin-svelte";
|
|
7
|
+
// src/patterns/enable/whatsapp/originals/auth-1.1/base/src/lib/schemas/signup.ts?raw
|
|
8
|
+
var Pt = "import { z } from \"zod\";\n\nexport const signupSchema = z.object({\n email: z.email(),\n password: z.string(),\n passwordConfirm: z.string(),\n});\n", Ft = "import { redirect } from \"@sveltejs/kit\";\nimport { fail, superValidate } from \"sveltekit-superforms\";\nimport { zod4 } from \"sveltekit-superforms/adapters\";\nimport { setFlash } from \"sveltekit-flash-message/server\";\nimport { setPocketbaseErrors } from \"@velastack/pocketbase/form\";\nimport { dev } from \"$app/env\";\nimport { signupSchema } from \"#lib/schemas/signup.js\";\n\nexport const load = async ({ locals }) => {\n const authMethods = await locals.admin.collection(\"users\").listAuthMethods();\n\n if (locals.pb.authStore.isValid) {\n redirect(303, \"/dashboard\");\n }\n\n return { form: await superValidate(zod4(signupSchema)), authMethods };\n};\n\nexport const actions = {\n default: async ({ locals, request, cookies, url }) => {\n const form = await superValidate(request, zod4(signupSchema));\n\n if (!form.valid) {\n return fail(400, { form });\n }\n\n let user;\n\n try {\n user = await locals.admin.collection(\"users\").create({\n email: form.data.email,\n password: form.data.password,\n passwordConfirm: form.data.passwordConfirm,\n });\n } catch (error) {\n setPocketbaseErrors(form, error);\n return fail(400, { form });\n }\n\n await locals.pb.collection(\"users\").requestVerification(user.email);\n await locals.pb\n .collection(\"users\")\n .authWithPassword(form.data.email, form.data.password);\n\n // Follow only a same-site path (`/x`, not `//host` or `/\\host`):\n // `redirect()` throws on an external URL.\n const next = url.searchParams.get(\"redirect\");\n const redirectUrl =\n next && /^\\/(?![/\\\\])/.test(next) ? next : \"/dashboard\";\n const cookie = locals.pb.authStore.getCookie();\n cookies.set(\"pb_auth\", cookie, {\n path: \"/\",\n httpOnly: true,\n sameSite: \"lax\",\n secure: !dev,\n maxAge: 60 * 60 * 24 * 30,\n });\n\n setFlash(\n { type: \"toast\", message: \"We sent a confirmation link to your email.\" },\n cookies,\n );\n return redirect(303, redirectUrl);\n },\n};\n", It = "<script lang=\"ts\">\n import favicon from \"#lib/assets/favicon.svg\";\n import { site } from \"#lib/site.js\";\n\n import { untrack } from \"svelte\";\n import { Button } from \"#lib/components/ui/button/index.js\";\n import * as Card from \"#lib/components/ui/card/index.js\";\n import { superForm } from \"sveltekit-superforms\";\n import { zod4Client } from \"sveltekit-superforms/adapters\";\n import { signupSchema } from \"#lib/schemas/signup.js\";\n import * as Form from \"#lib/components/ui/form/index.js\";\n import { Input } from \"#lib/components/ui/input/index.js\";\n import PocketBase from \"pocketbase-sveltekit\";\n import { goto } from \"$app/navigation\";\n import { page } from \"$app/state\";\n\n let { data } = $props();\n let authMethods = $derived(data.authMethods);\n\n const redirect = page.url.searchParams.get(\"redirect\");\n const hasOAuth2 = $derived(\n authMethods.oauth2.enabled && authMethods.oauth2.providers.length > 0,\n );\n const hasAuthMethods = $derived(\n authMethods.password.enabled || authMethods.otp.enabled || hasOAuth2,\n );\n\n const form = superForm(\n untrack(() => data.form),\n {\n validators: zod4Client(signupSchema),\n },\n );\n\n const handleOAuth2 = (provider: string) => {\n const pb = new PocketBase(\"/\");\n\n pb.collection(\"users\")\n .authWithOAuth2({ provider, createData: {} })\n .then(() => goto(\"/dashboard\"));\n };\n\n const { form: formData } = form;\n<\/script>\n\n<div class=\"h-full flex flex-col items-center justify-center gap-6 p-6 md:p-10\">\n <div class=\"flex w-full max-w-sm flex-col gap-6\">\n <a href=\"/\" class=\"flex items-center gap-2 self-center font-medium\">\n <div\n class=\"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md\"\n >\n <img src={favicon} alt=\"logo\" class=\"size-4\" />\n </div>\n {site.name}\n </a>\n\n <div class=\"flex flex-col gap-6\">\n <Card.Root>\n {#if hasAuthMethods}\n <Card.Header class=\"text-center\">\n <Card.Title class=\"text-xl\">Create an account</Card.Title>\n {#if hasOAuth2}\n <Card.Description>Choose a sign up method</Card.Description>\n {:else}\n <Card.Description>Use your email to sign up</Card.Description>\n {/if}\n </Card.Header>\n {:else}\n <Card.Header class=\"text-center\">\n <Card.Title class=\"text-xl\">Signups are disabled</Card.Title>\n <Card.Description\n >Check back later for signup options</Card.Description\n >\n </Card.Header>\n {/if}\n <Card.Content>\n <form method=\"POST\">\n <div class=\"grid gap-6\">\n {#if hasOAuth2}\n <div class=\"flex flex-col gap-4\">\n {#each authMethods.oauth2.providers as provider}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => handleOAuth2(provider.name)}\n >\n <img\n src=\"/admin/_/images/oauth2/{provider.name}.svg\"\n class=\"size-5 bg-white p-0.5 rounded-sm\"\n alt=\"\"\n />\n Sign up with {provider.displayName}\n </Button>\n {/each}\n </div>\n {/if}\n\n {#if authMethods.password.enabled}\n {#if hasOAuth2}\n <div\n class=\"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t\"\n >\n <span\n class=\"bg-card text-muted-foreground relative z-10 px-2\"\n >\n Or continue with\n </span>\n </div>\n {/if}\n\n <div class=\"grid gap-2\">\n <Form.Field {form} name=\"email\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>Email</Form.Label>\n <Input\n {...props}\n type=\"email\"\n bind:value={$formData.email}\n required\n autocomplete=\"username\"\n autofocus\n />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n\n <Form.Field {form} name=\"password\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>Password</Form.Label>\n <Input\n {...props}\n type=\"password\"\n bind:value={$formData.password}\n required\n autocomplete=\"new-password\"\n minlength={8}\n />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n\n <Form.Field {form} name=\"passwordConfirm\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>Confirm Password</Form.Label>\n <Input\n {...props}\n type=\"password\"\n bind:value={$formData.passwordConfirm}\n required\n autocomplete=\"new-password\"\n minlength={8}\n />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n <Button type=\"submit\" class=\"w-full\">Create account</Button>\n </div>\n {/if}\n\n <div class=\"text-center text-sm\">\n Already have an account?\n <a\n href=\"/login{redirect\n ? `?redirect=${encodeURIComponent(redirect)}`\n : ''}\"\n class=\"underline underline-offset-4\"\n >\n Log in\n </a>\n </div>\n </div>\n </form>\n </Card.Content>\n </Card.Root>\n <div\n class=\"text-muted-foreground *:[a]:hover:text-primary *:[a]:underline *:[a]:underline-offset-4 text-balance text-center text-xs\"\n >\n By clicking continue, you agree to our <a href=\"/terms\"\n >Terms of Service</a\n >\n and <a href=\"/privacy\">Privacy Policy</a>.\n </div>\n </div>\n </div>\n</div>\n", Lt = "import { z } from \"zod\";\n\nexport const signupSchema = z.object({\n email: z.email(),\n password: z.string(),\n passwordConfirm: z.string(),\n});\n", Rt = "<script lang=\"ts\">\n import favicon from \"#lib/assets/favicon.svg\";\n import { site } from \"#lib/site.js\";\n\n import { Button } from \"#lib/components/ui/button/index.js\";\n import * as Card from \"#lib/components/ui/card/index.js\";\n import { Input } from \"#lib/components/ui/input/index.js\";\n import PocketBase from \"pocketbase-sveltekit\";\n import { goto } from \"$app/navigation\";\n import { page } from \"$app/state\";\n import { signupForm } from \"./form.remote\";\n\n let { data } = $props();\n let authMethods = $derived(data.authMethods);\n\n const redirect = page.url.searchParams.get(\"redirect\");\n const hasOAuth2 = $derived(\n authMethods.oauth2.enabled && authMethods.oauth2.providers.length > 0,\n );\n const hasAuthMethods = $derived(\n authMethods.password.enabled || authMethods.otp.enabled || hasOAuth2,\n );\n\n const handleOAuth2 = (provider: string) => {\n const pb = new PocketBase(\"/\");\n\n pb.collection(\"users\")\n .authWithOAuth2({ provider, createData: {} })\n .then(() => goto(\"/dashboard\"));\n };\n<\/script>\n\n<div class=\"h-full flex flex-col items-center justify-center gap-6 p-6 md:p-10\">\n <div class=\"flex w-full max-w-sm flex-col gap-6\">\n <a href=\"/\" class=\"flex items-center gap-2 self-center font-medium\">\n <div\n class=\"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md\"\n >\n <img src={favicon} alt=\"logo\" class=\"size-4\" />\n </div>\n {site.name}\n </a>\n\n <div class=\"flex flex-col gap-6\">\n <Card.Root>\n {#if hasAuthMethods}\n <Card.Header class=\"text-center\">\n <Card.Title class=\"text-xl\">Create an account</Card.Title>\n {#if hasOAuth2}\n <Card.Description>Choose a sign up method</Card.Description>\n {:else}\n <Card.Description>Use your email to sign up</Card.Description>\n {/if}\n </Card.Header>\n {:else}\n <Card.Header class=\"text-center\">\n <Card.Title class=\"text-xl\">Signups are disabled</Card.Title>\n <Card.Description\n >Check back later for signup options</Card.Description\n >\n </Card.Header>\n {/if}\n <Card.Content>\n <form {...signupForm}>\n <div class=\"grid gap-6\">\n {#if hasOAuth2}\n <div class=\"flex flex-col gap-4\">\n {#each authMethods.oauth2.providers as provider}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => handleOAuth2(provider.name)}\n >\n <img\n src=\"/admin/_/images/oauth2/{provider.name}.svg\"\n class=\"size-5 bg-white p-0.5 rounded-sm\"\n alt=\"\"\n />\n Sign up with {provider.displayName}\n </Button>\n {/each}\n </div>\n {/if}\n\n {#if authMethods.password.enabled}\n {#if hasOAuth2}\n <div\n class=\"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t\"\n >\n <span\n class=\"bg-card text-muted-foreground relative z-10 px-2\"\n >\n Or continue with\n </span>\n </div>\n {/if}\n\n <div class=\"grid gap-2\">\n <div class=\"space-y-2 col-span-1\">\n <label for=\"email\" class=\"text-sm font-medium\">Email</label>\n <Input\n id=\"email\"\n {...signupForm.fields.email.as(\"text\")}\n type=\"email\"\n required\n autocomplete=\"username\"\n autofocus\n />\n {#each signupForm.fields.email.issues() as issue}\n <p class=\"text-destructive text-sm\">{issue.message}</p>\n {/each}\n </div>\n\n <div class=\"space-y-2 col-span-1\">\n <label for=\"password\" class=\"text-sm font-medium\"\n >Password</label\n >\n <Input\n id=\"password\"\n {...signupForm.fields.password.as(\"text\")}\n type=\"password\"\n required\n autocomplete=\"new-password\"\n minlength={8}\n />\n {#each signupForm.fields.password.issues() as issue}\n <p class=\"text-destructive text-sm\">{issue.message}</p>\n {/each}\n </div>\n\n <div class=\"space-y-2 col-span-1\">\n <label for=\"passwordConfirm\" class=\"text-sm font-medium\"\n >Confirm Password</label\n >\n <Input\n id=\"passwordConfirm\"\n {...signupForm.fields.passwordConfirm.as(\"text\")}\n type=\"password\"\n required\n autocomplete=\"new-password\"\n minlength={8}\n />\n {#each signupForm.fields.passwordConfirm.issues() as issue}\n <p class=\"text-destructive text-sm\">{issue.message}</p>\n {/each}\n </div>\n\n {#if signupForm.result?.message}\n <div class=\"text-destructive text-sm font-medium -mt-2\">\n {signupForm.result.message}\n </div>\n {/if}\n\n <Button type=\"submit\" class=\"w-full\">Create account</Button>\n </div>\n {/if}\n\n <div class=\"text-center text-sm\">\n Already have an account?\n <a\n href=\"/login{redirect\n ? `?redirect=${encodeURIComponent(redirect)}`\n : ''}\"\n class=\"underline underline-offset-4\"\n >\n Log in\n </a>\n </div>\n </div>\n </form>\n </Card.Content>\n </Card.Root>\n <div\n class=\"text-muted-foreground *:[a]:hover:text-primary *:[a]:underline *:[a]:underline-offset-4 text-balance text-center text-xs\"\n >\n By clicking continue, you agree to our <a href=\"/terms\"\n >Terms of Service</a\n >\n and <a href=\"/privacy\">Privacy Policy</a>.\n </div>\n </div>\n </div>\n</div>\n", zt = "import { form, getRequestEvent } from \"$app/server\";\nimport { redirect } from \"@sveltejs/kit\";\nimport { setFlash } from \"sveltekit-flash-message/server\";\nimport { dev } from \"$app/env\";\nimport { signupSchema } from \"#lib/schemas/signup.js\";\n\nexport const signupForm = form(signupSchema, async (data) => {\n const { locals, cookies, url } = getRequestEvent();\n\n let user: { email: string };\n\n try {\n user = await locals.admin.collection(\"users\").create({\n email: data.email,\n password: data.password,\n passwordConfirm: data.passwordConfirm,\n });\n } catch (err: any) {\n const response = err?.response ?? {};\n const fieldError = response?.data\n ? Object.values(response.data)[0]\n : undefined;\n const message: string =\n (fieldError as any)?.message ??\n response?.message ??\n \"Failed to create account.\";\n return { message };\n }\n\n await locals.pb.collection(\"users\").requestVerification(user.email);\n await locals.pb\n .collection(\"users\")\n .authWithPassword(data.email, data.password);\n\n // Follow only a same-site path (`/x`, not `//host` or `/\\host`):\n // `redirect()` throws on an external URL.\n const next = url.searchParams.get(\"redirect\");\n const redirectUrl =\n next && /^\\/(?![/\\\\])/.test(next) ? next : \"/dashboard\";\n const cookie = locals.pb.authStore.getCookie();\n cookies.set(\"pb_auth\", cookie, {\n path: \"/\",\n httpOnly: true,\n sameSite: \"lax\",\n secure: !dev,\n maxAge: 60 * 60 * 24 * 30,\n });\n\n setFlash(\n { type: \"toast\", message: \"We sent a confirmation link to your email.\" },\n cookies,\n );\n redirect(303, redirectUrl);\n});\n", Bt = "<script lang=\"ts\">\n import favicon from \"#lib/assets/favicon.svg\";\n import { site } from \"#lib/site.js\";\n\n import { untrack } from \"svelte\";\n import { Button } from \"#lib/components/ui/button/index.js\";\n import { superForm } from \"sveltekit-superforms\";\n import { zod4Client } from \"sveltekit-superforms/adapters\";\n import { signupSchema } from \"#lib/schemas/signup.js\";\n import * as Form from \"#lib/components/ui/form/index.js\";\n import { Input } from \"#lib/components/ui/input/index.js\";\n import PocketBase from \"pocketbase-sveltekit\";\n import { goto } from \"$app/navigation\";\n import { page } from \"$app/state\";\n\n let { data } = $props();\n let authMethods = $derived(data.authMethods);\n\n const redirect = page.url.searchParams.get(\"redirect\");\n const hasOAuth2 = $derived(\n authMethods.oauth2.enabled && authMethods.oauth2.providers.length > 0,\n );\n const hasAuthMethods = $derived(\n authMethods.password.enabled || authMethods.otp.enabled || hasOAuth2,\n );\n\n const form = superForm(\n untrack(() => data.form),\n {\n validators: zod4Client(signupSchema),\n },\n );\n\n const handleOAuth2 = (provider: string) => {\n const pb = new PocketBase(\"/\");\n\n pb.collection(\"users\")\n .authWithOAuth2({ provider, createData: {} })\n .then(() => goto(\"/dashboard\"));\n };\n\n const { form: formData } = form;\n<\/script>\n\n<div class=\"grid h-full lg:grid-cols-2\">\n <div class=\"bg-muted relative hidden lg:block\">\n <img\n src={favicon}\n alt=\"\"\n class=\"absolute inset-0 m-auto size-32 opacity-20\"\n />\n </div>\n <div class=\"flex flex-col gap-4 p-6 md:p-10\">\n <div class=\"flex justify-center gap-2 md:justify-start\">\n <a href=\"/\" class=\"flex items-center gap-2 font-medium\">\n <div\n class=\"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md\"\n >\n <img src={favicon} alt=\"logo\" class=\"size-4\" />\n </div>\n {site.name}\n </a>\n </div>\n <div class=\"flex flex-1 items-center justify-center\">\n <div class=\"w-full max-w-sm\">\n <form method=\"POST\">\n <div class=\"grid gap-6\">\n <div class=\"flex flex-col items-center gap-2 text-center\">\n {#if hasAuthMethods}\n <h1 class=\"text-2xl font-bold\">Create an account</h1>\n <p class=\"text-muted-foreground text-sm text-balance\">\n {hasOAuth2\n ? \"Choose a sign up method\"\n : \"Use your email to sign up\"}\n </p>\n {:else}\n <h1 class=\"text-2xl font-bold\">Signups are disabled</h1>\n <p class=\"text-muted-foreground text-sm text-balance\">\n Check back later for signup options\n </p>\n {/if}\n </div>\n\n {#if hasOAuth2}\n <div class=\"flex flex-col gap-4\">\n {#each authMethods.oauth2.providers as provider}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => handleOAuth2(provider.name)}\n >\n <img\n src=\"/admin/_/images/oauth2/{provider.name}.svg\"\n class=\"size-5 bg-white p-0.5 rounded-sm\"\n alt=\"\"\n />\n Sign up with {provider.displayName}\n </Button>\n {/each}\n </div>\n {/if}\n\n {#if authMethods.password.enabled}\n {#if hasOAuth2}\n <div\n class=\"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t\"\n >\n <span\n class=\"bg-background text-muted-foreground relative z-10 px-2\"\n >\n Or continue with\n </span>\n </div>\n {/if}\n\n <div class=\"grid gap-2\">\n <Form.Field {form} name=\"email\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>Email</Form.Label>\n <Input\n {...props}\n type=\"email\"\n bind:value={$formData.email}\n required\n autocomplete=\"username\"\n autofocus\n />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n\n <Form.Field {form} name=\"password\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>Password</Form.Label>\n <Input\n {...props}\n type=\"password\"\n bind:value={$formData.password}\n required\n autocomplete=\"new-password\"\n minlength={8}\n />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n\n <Form.Field {form} name=\"passwordConfirm\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>Confirm Password</Form.Label>\n <Input\n {...props}\n type=\"password\"\n bind:value={$formData.passwordConfirm}\n required\n autocomplete=\"new-password\"\n minlength={8}\n />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n <Button type=\"submit\" class=\"w-full\">Create account</Button>\n </div>\n {/if}\n\n <div class=\"text-center text-sm\">\n Already have an account?\n <a\n href=\"/login{redirect\n ? `?redirect=${encodeURIComponent(redirect)}`\n : ''}\"\n class=\"underline underline-offset-4\"\n >\n Log in\n </a>\n </div>\n </div>\n </form>\n </div>\n </div>\n <div\n class=\"text-muted-foreground *:[a]:hover:text-primary *:[a]:underline *:[a]:underline-offset-4 text-balance text-center text-xs\"\n >\n By clicking continue, you agree to our <a href=\"/terms\"\n >Terms of Service</a\n >\n and <a href=\"/privacy\">Privacy Policy</a>.\n </div>\n </div>\n</div>\n", Vt = "import { fail, superValidate, message } from \"sveltekit-superforms\";\nimport { zod4 } from \"sveltekit-superforms/adapters\";\nimport { loginSchema } from \"#lib/schemas/login.js\";\nimport { redirect } from \"@sveltejs/kit\";\nimport { dev } from \"$app/env\";\n\nexport const load = async ({ locals }) => {\n if (locals.pb.authStore.isValid) {\n redirect(303, \"/dashboard\");\n }\n\n const authMethods = await locals.admin.collection(\"users\").listAuthMethods();\n\n const type: \"password\" | \"otp\" | \"oauth2\" = authMethods.otp.enabled\n ? \"otp\"\n : authMethods.password.enabled\n ? \"password\"\n : \"oauth2\";\n\n return {\n form: await superValidate(\n zod4(loginSchema.default({ type, email: \"\", password: \"\" })),\n ),\n authMethods,\n };\n};\n\nexport const actions = {\n default: async ({ locals, request, cookies, url }) => {\n const form = await superValidate(request, zod4(loginSchema));\n\n if (!form.valid) {\n return fail(400, { form });\n }\n\n // Follow only a same-site path (`/x`, not `//host` or `/\\host`):\n // `redirect()` throws on an external URL.\n const next = url.searchParams.get(\"redirect\");\n const redirectParam = next && /^\\/(?![/\\\\])/.test(next) ? next : null;\n if (form.data.type === \"otp\") {\n const req = await locals.pb\n .collection(\"users\")\n .requestOTP(form.data.email);\n return redirect(\n 303,\n `/otp/${req.otpId}${redirectParam ? `?redirect=${encodeURIComponent(redirectParam)}` : \"\"}`,\n );\n } else if (form.data.type === \"password\") {\n try {\n await locals.pb\n .collection(\"users\")\n .authWithPassword(form.data.email, form.data.password);\n } catch (error: any) {\n return message(\n form,\n { type: \"error\", text: error.response.message },\n { status: 400 },\n );\n }\n }\n\n const redirectUrl = redirectParam ?? \"/dashboard\";\n const cookie = locals.pb.authStore.getCookie();\n cookies.set(\"pb_auth\", cookie, {\n path: \"/\",\n httpOnly: true,\n sameSite: \"lax\",\n secure: !dev,\n maxAge: 60 * 60 * 24 * 30,\n });\n\n redirect(303, redirectUrl);\n },\n};\n", Ht = "import { redirect } from \"@sveltejs/kit\";\nimport { fail, message, superValidate } from \"sveltekit-superforms\";\nimport { zod4 } from \"sveltekit-superforms/adapters\";\nimport { setFlash } from \"sveltekit-flash-message/server\";\nimport { setPocketbaseErrors } from \"@velastack/pocketbase/form\";\nimport { dev } from \"$app/env\";\nimport { signupSchema } from \"#lib/schemas/signup.js\";\n\nexport const load = async ({ locals }) => {\n const authMethods = await locals.admin.collection(\"users\").listAuthMethods();\n\n if (locals.pb.authStore.isValid) {\n redirect(303, \"/dashboard\");\n }\n\n const type: \"password\" | \"otp\" =\n !authMethods.password.enabled && authMethods.otp.enabled\n ? \"otp\"\n : \"password\";\n\n return {\n form: await superValidate(\n zod4(\n signupSchema.default({\n type,\n email: \"\",\n password: \"\",\n passwordConfirm: \"\",\n }),\n ),\n ),\n authMethods,\n };\n};\n\nexport const actions = {\n default: async ({ locals, request, cookies, url }) => {\n const form = await superValidate(request, zod4(signupSchema));\n\n if (!form.valid) {\n return fail(400, { form });\n }\n\n // Follow only a same-site path (`/x`, not `//host` or `/\\host`):\n // `redirect()` throws on an external URL.\n const next = url.searchParams.get(\"redirect\");\n const redirectParam = next && /^\\/(?![/\\\\])/.test(next) ? next : null;\n const redirectQuery = redirectParam\n ? `?redirect=${encodeURIComponent(redirectParam)}`\n : \"\";\n\n if (form.data.type === \"otp\") {\n // PocketBase only sends codes to existing accounts, so create it first,\n // with a password nobody knows (a reset sets a real one). Checking the\n // code marks the email verified.\n const password = crypto.randomUUID();\n try {\n await locals.admin.collection(\"users\").create({\n email: form.data.email,\n password,\n passwordConfirm: password,\n });\n } catch (error: any) {\n // An existing account gets a code too, the same as logging in with one.\n if (error.response?.data?.email?.code !== \"validation_not_unique\") {\n setPocketbaseErrors(form, error);\n return fail(400, { form });\n }\n }\n\n let otpId: string;\n try {\n ({ otpId } = await locals.pb\n .collection(\"users\")\n .requestOTP(form.data.email));\n } catch (error: any) {\n return message(\n form,\n {\n type: \"error\",\n text: error.response?.message ?? \"Failed to send the code.\",\n },\n { status: 400 },\n );\n }\n // A new account has no name yet: ask for one once the code checks out.\n const welcome = `/welcome${redirectQuery}`;\n return redirect(\n 303,\n `/otp/${otpId}?redirect=${encodeURIComponent(welcome)}`,\n );\n }\n\n let user;\n\n try {\n user = await locals.admin.collection(\"users\").create({\n email: form.data.email,\n password: form.data.password,\n passwordConfirm: form.data.passwordConfirm,\n });\n } catch (error) {\n setPocketbaseErrors(form, error);\n return fail(400, { form });\n }\n\n await locals.pb.collection(\"users\").requestVerification(user.email!);\n await locals.pb\n .collection(\"users\")\n .authWithPassword(form.data.email, form.data.password);\n\n const redirectUrl = redirectParam ?? \"/dashboard\";\n const cookie = locals.pb.authStore.getCookie();\n cookies.set(\"pb_auth\", cookie, {\n path: \"/\",\n httpOnly: true,\n sameSite: \"lax\",\n secure: !dev,\n maxAge: 60 * 60 * 24 * 30,\n });\n\n setFlash(\n { type: \"toast\", message: \"We sent a confirmation link to your email.\" },\n cookies,\n );\n return redirect(303, redirectUrl);\n },\n};\n", Ut = "import { form, getRequestEvent } from \"$app/server\";\nimport { redirect } from \"@sveltejs/kit\";\nimport { dev } from \"$app/env\";\nimport { loginSchema } from \"#lib/schemas/login.js\";\n\nexport const loginForm = form(loginSchema, async (data) => {\n const { locals, cookies, url } = getRequestEvent();\n\n // Follow only a same-site path (`/x`, not `//host` or `/\\host`):\n // `redirect()` throws on an external URL.\n const next = url.searchParams.get(\"redirect\");\n const redirectParam = next && /^\\/(?![/\\\\])/.test(next) ? next : null;\n if (data.type === \"otp\") {\n const req = await locals.pb.collection(\"users\").requestOTP(data.email);\n redirect(\n 303,\n `/otp/${req.otpId}${redirectParam ? `?redirect=${encodeURIComponent(redirectParam)}` : \"\"}`,\n );\n } else if (data.type === \"password\") {\n try {\n await locals.pb\n .collection(\"users\")\n .authWithPassword(data.email, data.password ?? \"\");\n } catch (err: any) {\n return {\n message: (err.response?.message as string) ?? \"Failed to authenticate.\",\n };\n }\n }\n\n const redirectUrl = redirectParam ?? \"/dashboard\";\n const cookie = locals.pb.authStore.getCookie();\n cookies.set(\"pb_auth\", cookie, {\n path: \"/\",\n httpOnly: true,\n sameSite: \"lax\",\n secure: !dev,\n maxAge: 60 * 60 * 24 * 30,\n });\n\n redirect(303, redirectUrl);\n});\n", Wt = "import { form, getRequestEvent } from \"$app/server\";\nimport { redirect } from \"@sveltejs/kit\";\nimport { setFlash } from \"sveltekit-flash-message/server\";\nimport { dev } from \"$app/env\";\nimport { signupSchema } from \"#lib/schemas/signup.js\";\n\n/** The first field error, or the response message, of a PocketBase error. */\nfunction errorMessage(err: any, fallback: string): string {\n const response = err?.response ?? {};\n const fieldError = response?.data\n ? Object.values(response.data)[0]\n : undefined;\n return (fieldError as any)?.message ?? response?.message ?? fallback;\n}\n\nexport const signupForm = form(signupSchema, async (data) => {\n const { locals, cookies, url } = getRequestEvent();\n\n // Follow only a same-site path (`/x`, not `//host` or `/\\host`):\n // `redirect()` throws on an external URL.\n const next = url.searchParams.get(\"redirect\");\n const redirectParam = next && /^\\/(?![/\\\\])/.test(next) ? next : null;\n const redirectQuery = redirectParam\n ? `?redirect=${encodeURIComponent(redirectParam)}`\n : \"\";\n\n const { email } = data;\n\n if (data.type === \"otp\") {\n // PocketBase only sends codes to existing accounts, so create it first,\n // with a password nobody knows (a reset sets a real one). Checking the\n // code marks the email verified.\n const password = crypto.randomUUID();\n try {\n await locals.admin.collection(\"users\").create({\n email,\n password,\n passwordConfirm: password,\n });\n } catch (err: any) {\n // An existing account gets a code too, the same as logging in with one.\n if (err?.response?.data?.email?.code !== \"validation_not_unique\") {\n return { message: errorMessage(err, \"Failed to create account.\") };\n }\n }\n\n let otpId: string;\n try {\n ({ otpId } = await locals.pb.collection(\"users\").requestOTP(email));\n } catch (err: any) {\n return { message: errorMessage(err, \"Failed to send the code.\") };\n }\n // A new account has no name yet: ask for one once the code checks out.\n const welcome = `/welcome${redirectQuery}`;\n redirect(303, `/otp/${otpId}?redirect=${encodeURIComponent(welcome)}`);\n }\n\n try {\n await locals.admin.collection(\"users\").create({\n email,\n password: data.password,\n passwordConfirm: data.passwordConfirm,\n });\n } catch (err: any) {\n return { message: errorMessage(err, \"Failed to create account.\") };\n }\n\n await locals.pb.collection(\"users\").requestVerification(email);\n await locals.pb\n .collection(\"users\")\n .authWithPassword(email, data.password ?? \"\");\n\n const redirectUrl = redirectParam ?? \"/dashboard\";\n const cookie = locals.pb.authStore.getCookie();\n cookies.set(\"pb_auth\", cookie, {\n path: \"/\",\n httpOnly: true,\n sameSite: \"lax\",\n secure: !dev,\n maxAge: 60 * 60 * 24 * 30,\n });\n\n setFlash(\n { type: \"toast\", message: \"We sent a confirmation link to your email.\" },\n cookies,\n );\n redirect(303, redirectUrl);\n});\n", Gt = "import { fail, superValidate, message } from \"sveltekit-superforms\";\nimport { zod4 } from \"sveltekit-superforms/adapters\";\nimport { setPocketbaseErrors } from \"@velastack/pocketbase/form\";\nimport { loginSchema } from \"#lib/schemas/login.js\";\nimport {\n requestWhatsAppOTP,\n whatsappAuthMethod,\n} from \"#lib/server/whatsapp.js\";\nimport { redirect } from \"@sveltejs/kit\";\nimport { dev } from \"$app/env\";\n\nexport const load = async ({ locals }) => {\n if (locals.pb.authStore.isValid) {\n redirect(303, \"/dashboard\");\n }\n\n const authMethods = await locals.admin.collection(\"users\").listAuthMethods();\n const whatsapp = whatsappAuthMethod(authMethods);\n\n const type: \"password\" | \"otp\" | \"oauth2\" | \"whatsapp\" = authMethods.otp\n .enabled\n ? \"otp\"\n : authMethods.password.enabled\n ? \"password\"\n : whatsapp.enabled\n ? \"whatsapp\"\n : \"oauth2\";\n\n return {\n form: await superValidate(\n zod4(\n loginSchema.default({ type, email: \"\", password: \"\", phone: \"\" }),\n ),\n ),\n authMethods,\n whatsapp,\n };\n};\n\nexport const actions = {\n default: async ({ locals, request, cookies, url }) => {\n const form = await superValidate(request, zod4(loginSchema));\n\n if (!form.valid) {\n return fail(400, { form });\n }\n\n // Follow only a same-site path (`/x`, not `//host` or `/\\host`):\n // `redirect()` throws on an external URL.\n const next = url.searchParams.get(\"redirect\");\n const redirectParam = next && /^\\/(?![/\\\\])/.test(next) ? next : null;\n const redirectQuery = redirectParam\n ? `?redirect=${encodeURIComponent(redirectParam)}`\n : \"\";\n if (form.data.type === \"otp\") {\n const req = await locals.pb\n .collection(\"users\")\n .requestOTP(form.data.email);\n return redirect(303, `/otp/${req.otpId}${redirectQuery}`);\n } else if (form.data.type === \"whatsapp\") {\n let otpId: string;\n try {\n ({ otpId } = await requestWhatsAppOTP(locals.pb, form.data.phone));\n } catch (error: any) {\n // An invalid number goes on the field; the rest (WhatsApp auth\n // disabled, rate limited) on the form.\n if (Object.keys(error.response?.data ?? {}).length) {\n setPocketbaseErrors(form, error);\n return fail(400, { form });\n }\n return message(\n form,\n {\n type: \"error\",\n text: error.response?.message ?? \"Failed to send the code.\",\n },\n { status: 400 },\n );\n }\n return redirect(303, `/whatsapp/${otpId}${redirectQuery}`);\n } else if (form.data.type === \"password\") {\n try {\n await locals.pb\n .collection(\"users\")\n .authWithPassword(form.data.email, form.data.password);\n } catch (error: any) {\n return message(\n form,\n { type: \"error\", text: error.response.message },\n { status: 400 },\n );\n }\n }\n\n const redirectUrl = redirectParam ?? \"/dashboard\";\n const cookie = locals.pb.authStore.getCookie();\n cookies.set(\"pb_auth\", cookie, {\n path: \"/\",\n httpOnly: true,\n sameSite: \"lax\",\n secure: !dev,\n maxAge: 60 * 60 * 24 * 30,\n });\n\n redirect(303, redirectUrl);\n },\n};\n", Kt = "import { redirect } from \"@sveltejs/kit\";\nimport { fail, message, superValidate } from \"sveltekit-superforms\";\nimport { zod4 } from \"sveltekit-superforms/adapters\";\nimport { setFlash } from \"sveltekit-flash-message/server\";\nimport { setPocketbaseErrors } from \"@velastack/pocketbase/form\";\nimport { dev } from \"$app/env\";\nimport { signupSchema } from \"#lib/schemas/signup.js\";\nimport {\n requestWhatsAppOTP,\n whatsappAuthMethod,\n} from \"#lib/server/whatsapp.js\";\n\nexport const load = async ({ locals }) => {\n const authMethods = await locals.admin.collection(\"users\").listAuthMethods();\n\n if (locals.pb.authStore.isValid) {\n redirect(303, \"/dashboard\");\n }\n\n const whatsapp = whatsappAuthMethod(authMethods);\n const whatsappSignup = whatsapp.enabled && whatsapp.allowSignup === true;\n\n const type: \"password\" | \"otp\" | \"whatsapp\" = authMethods.password.enabled\n ? \"password\"\n : authMethods.otp.enabled\n ? \"otp\"\n : whatsappSignup\n ? \"whatsapp\"\n : \"password\";\n\n return {\n form: await superValidate(\n zod4(\n signupSchema.default({\n type,\n email: \"\",\n password: \"\",\n passwordConfirm: \"\",\n phone: \"\",\n }),\n ),\n ),\n authMethods,\n whatsappSignup,\n };\n};\n\nexport const actions = {\n default: async ({ locals, request, cookies, url }) => {\n const form = await superValidate(request, zod4(signupSchema));\n\n if (!form.valid) {\n return fail(400, { form });\n }\n\n // Follow only a same-site path (`/x`, not `//host` or `/\\host`):\n // `redirect()` throws on an external URL.\n const next = url.searchParams.get(\"redirect\");\n const redirectParam = next && /^\\/(?![/\\\\])/.test(next) ? next : null;\n const redirectQuery = redirectParam\n ? `?redirect=${encodeURIComponent(redirectParam)}`\n : \"\";\n\n if (form.data.type === \"whatsapp\") {\n // The account is created when the code is checked.\n let otpId: string;\n try {\n ({ otpId } = await requestWhatsAppOTP(locals.pb, form.data.phone));\n } catch (error: any) {\n // An invalid number goes on the field; the rest (WhatsApp auth\n // disabled, rate limited) on the form.\n if (Object.keys(error.response?.data ?? {}).length) {\n setPocketbaseErrors(form, error);\n return fail(400, { form });\n }\n return message(\n form,\n {\n type: \"error\",\n text: error.response?.message ?? \"Failed to send the code.\",\n },\n { status: 400 },\n );\n }\n return redirect(303, `/whatsapp/${otpId}${redirectQuery}`);\n }\n\n if (form.data.type === \"otp\") {\n // PocketBase only sends codes to existing accounts, so create it first,\n // with a password nobody knows (a reset sets a real one). Checking the\n // code marks the email verified.\n const password = crypto.randomUUID();\n try {\n await locals.admin.collection(\"users\").create({\n email: form.data.email,\n password,\n passwordConfirm: password,\n });\n } catch (error: any) {\n // An existing account gets a code too, the same as logging in with one.\n if (error.response?.data?.email?.code !== \"validation_not_unique\") {\n setPocketbaseErrors(form, error);\n return fail(400, { form });\n }\n }\n\n let otpId: string;\n try {\n ({ otpId } = await locals.pb\n .collection(\"users\")\n .requestOTP(form.data.email));\n } catch (error: any) {\n return message(\n form,\n {\n type: \"error\",\n text: error.response?.message ?? \"Failed to send the code.\",\n },\n { status: 400 },\n );\n }\n // A new account has no name yet: ask for one once the code checks out.\n const welcome = `/welcome${redirectQuery}`;\n return redirect(\n 303,\n `/otp/${otpId}?redirect=${encodeURIComponent(welcome)}`,\n );\n }\n\n let user;\n\n try {\n user = await locals.admin.collection(\"users\").create({\n email: form.data.email,\n password: form.data.password,\n passwordConfirm: form.data.passwordConfirm,\n });\n } catch (error) {\n setPocketbaseErrors(form, error);\n return fail(400, { form });\n }\n\n await locals.pb.collection(\"users\").requestVerification(user.email!);\n await locals.pb\n .collection(\"users\")\n .authWithPassword(form.data.email, form.data.password);\n\n const redirectUrl = redirectParam ?? \"/dashboard\";\n const cookie = locals.pb.authStore.getCookie();\n cookies.set(\"pb_auth\", cookie, {\n path: \"/\",\n httpOnly: true,\n sameSite: \"lax\",\n secure: !dev,\n maxAge: 60 * 60 * 24 * 30,\n });\n\n setFlash(\n { type: \"toast\", message: \"We sent a confirmation link to your email.\" },\n cookies,\n );\n return redirect(303, redirectUrl);\n },\n};\n", qt = "import { form, getRequestEvent } from \"$app/server\";\nimport { redirect } from \"@sveltejs/kit\";\nimport { dev } from \"$app/env\";\nimport { loginSchema } from \"#lib/schemas/login.js\";\nimport { requestWhatsAppOTP } from \"#lib/server/whatsapp.js\";\n\nexport const loginForm = form(loginSchema, async (data) => {\n const { locals, cookies, url } = getRequestEvent();\n\n // Follow only a same-site path (`/x`, not `//host` or `/\\host`):\n // `redirect()` throws on an external URL.\n const next = url.searchParams.get(\"redirect\");\n const redirectParam = next && /^\\/(?![/\\\\])/.test(next) ? next : null;\n const redirectQuery = redirectParam\n ? `?redirect=${encodeURIComponent(redirectParam)}`\n : \"\";\n if (data.type === \"otp\") {\n const req = await locals.pb\n .collection(\"users\")\n .requestOTP(data.email ?? \"\");\n redirect(303, `/otp/${req.otpId}${redirectQuery}`);\n } else if (data.type === \"whatsapp\") {\n let otpId: string;\n try {\n ({ otpId } = await requestWhatsAppOTP(locals.pb, data.phone ?? \"\"));\n } catch (err: any) {\n // An invalid number comes back as a field error, the rest (WhatsApp\n // auth disabled, rate limited) as the response message.\n const response = err?.response ?? {};\n const fieldError = response?.data\n ? Object.values(response.data)[0]\n : undefined;\n const message: string =\n (fieldError as any)?.message ??\n response?.message ??\n \"Failed to send the code.\";\n return { message };\n }\n redirect(303, `/whatsapp/${otpId}${redirectQuery}`);\n } else if (data.type === \"password\") {\n try {\n await locals.pb\n .collection(\"users\")\n .authWithPassword(data.email ?? \"\", data.password ?? \"\");\n } catch (err: any) {\n return {\n message: (err.response?.message as string) ?? \"Failed to authenticate.\",\n };\n }\n }\n\n const redirectUrl = redirectParam ?? \"/dashboard\";\n const cookie = locals.pb.authStore.getCookie();\n cookies.set(\"pb_auth\", cookie, {\n path: \"/\",\n httpOnly: true,\n sameSite: \"lax\",\n secure: !dev,\n maxAge: 60 * 60 * 24 * 30,\n });\n\n redirect(303, redirectUrl);\n});\n", Jt = "import { form, getRequestEvent } from \"$app/server\";\nimport { redirect } from \"@sveltejs/kit\";\nimport { setFlash } from \"sveltekit-flash-message/server\";\nimport { dev } from \"$app/env\";\nimport { signupSchema } from \"#lib/schemas/signup.js\";\nimport { requestWhatsAppOTP } from \"#lib/server/whatsapp.js\";\n\n/** The first field error, or the response message, of a PocketBase error. */\nfunction errorMessage(err: any, fallback: string): string {\n const response = err?.response ?? {};\n const fieldError = response?.data\n ? Object.values(response.data)[0]\n : undefined;\n return (fieldError as any)?.message ?? response?.message ?? fallback;\n}\n\nexport const signupForm = form(signupSchema, async (data) => {\n const { locals, cookies, url } = getRequestEvent();\n\n // Follow only a same-site path (`/x`, not `//host` or `/\\host`):\n // `redirect()` throws on an external URL.\n const next = url.searchParams.get(\"redirect\");\n const redirectParam = next && /^\\/(?![/\\\\])/.test(next) ? next : null;\n const redirectQuery = redirectParam\n ? `?redirect=${encodeURIComponent(redirectParam)}`\n : \"\";\n\n if (data.type === \"whatsapp\") {\n // The account is created when the code is checked.\n let otpId: string;\n try {\n ({ otpId } = await requestWhatsAppOTP(locals.pb, data.phone ?? \"\"));\n } catch (err: any) {\n return { message: errorMessage(err, \"Failed to send the code.\") };\n }\n redirect(303, `/whatsapp/${otpId}${redirectQuery}`);\n }\n\n const email = data.email ?? \"\";\n\n if (data.type === \"otp\") {\n // PocketBase only sends codes to existing accounts, so create it first,\n // with a password nobody knows (a reset sets a real one). Checking the\n // code marks the email verified.\n const password = crypto.randomUUID();\n try {\n await locals.admin.collection(\"users\").create({\n email,\n password,\n passwordConfirm: password,\n });\n } catch (err: any) {\n // An existing account gets a code too, the same as logging in with one.\n if (err?.response?.data?.email?.code !== \"validation_not_unique\") {\n return { message: errorMessage(err, \"Failed to create account.\") };\n }\n }\n\n let otpId: string;\n try {\n ({ otpId } = await locals.pb.collection(\"users\").requestOTP(email));\n } catch (err: any) {\n return { message: errorMessage(err, \"Failed to send the code.\") };\n }\n // A new account has no name yet: ask for one once the code checks out.\n const welcome = `/welcome${redirectQuery}`;\n redirect(303, `/otp/${otpId}?redirect=${encodeURIComponent(welcome)}`);\n }\n\n try {\n await locals.admin.collection(\"users\").create({\n email,\n password: data.password,\n passwordConfirm: data.passwordConfirm,\n });\n } catch (err: any) {\n return { message: errorMessage(err, \"Failed to create account.\") };\n }\n\n await locals.pb.collection(\"users\").requestVerification(email);\n await locals.pb\n .collection(\"users\")\n .authWithPassword(email, data.password ?? \"\");\n\n const redirectUrl = redirectParam ?? \"/dashboard\";\n const cookie = locals.pb.authStore.getCookie();\n cookies.set(\"pb_auth\", cookie, {\n path: \"/\",\n httpOnly: true,\n sameSite: \"lax\",\n secure: !dev,\n maxAge: 60 * 60 * 24 * 30,\n });\n\n setFlash(\n { type: \"toast\", message: \"We sent a confirmation link to your email.\" },\n cookies,\n );\n redirect(303, redirectUrl);\n});\n", Yt = "import { z } from \"zod\";\n\n// A flat shape (rather than a discriminated union) keeps\n// `loginForm.fields.password` addressable in the page regardless of mode.\nexport const loginSchema = z\n .object({\n type: z.enum([\"password\", \"otp\", \"oauth2\", \"whatsapp\"]),\n email: z.email().optional(),\n password: z.string().optional(),\n phone: z.string().optional(),\n })\n .refine((data) => data.type === \"whatsapp\" || !!data.email, {\n message: \"Email is required\",\n path: [\"email\"],\n })\n .refine((data) => data.type !== \"password\" || !!data.password, {\n message: \"Password is required\",\n path: [\"password\"],\n })\n .refine((data) => data.type !== \"whatsapp\" || !!data.phone, {\n message: \"WhatsApp number is required\",\n path: [\"phone\"],\n });\n", Xt = "import { z } from \"zod\";\n\n// Flat, like the login schema, so every field stays addressable in the page.\nexport const signupSchema = z\n .object({\n type: z.enum([\"password\", \"otp\", \"whatsapp\"]),\n email: z.email().optional(),\n password: z.string().optional(),\n passwordConfirm: z.string().optional(),\n phone: z.string().optional(),\n })\n .refine((data) => data.type === \"whatsapp\" || !!data.email, {\n message: \"Email is required\",\n path: [\"email\"],\n })\n .refine((data) => data.type !== \"password\" || !!data.password, {\n message: \"Password is required\",\n path: [\"password\"],\n })\n .refine((data) => data.type !== \"whatsapp\" || !!data.phone, {\n message: \"WhatsApp number is required\",\n path: [\"phone\"],\n });\n", Zt = "import { redirect } from \"@sveltejs/kit\";\nimport { whatsappAuthMethod } from \"#lib/server/whatsapp.js\";\n\nexport const load = async ({ locals }) => {\n if (locals.pb.authStore.isValid) {\n redirect(303, \"/dashboard\");\n }\n\n const authMethods = await locals.admin.collection(\"users\").listAuthMethods();\n\n return { authMethods, whatsapp: whatsappAuthMethod(authMethods) };\n};\n", Qt = "<script lang=\"ts\">\n import favicon from \"#lib/assets/favicon.svg\";\n import { site } from \"#lib/site.js\";\n\n import { Button } from \"#lib/components/ui/button/index.js\";\n import * as Card from \"#lib/components/ui/card/index.js\";\n import { Input } from \"#lib/components/ui/input/index.js\";\n import PocketBase from \"pocketbase-sveltekit\";\n import { goto } from \"$app/navigation\";\n import { page } from \"$app/state\";\n import { loginForm } from \"./form.remote\";\n\n let { data } = $props();\n let authMethods = $derived(data.authMethods);\n let whatsapp = $derived(data.whatsapp);\n\n const redirect = page.url.searchParams.get(\"redirect\");\n const hasOAuth2 = $derived(\n authMethods.oauth2.enabled && authMethods.oauth2.providers.length > 0,\n );\n const hasEmail = $derived(\n authMethods.password.enabled || authMethods.otp.enabled,\n );\n const hasAuthMethods = $derived(hasEmail || whatsapp.enabled || hasOAuth2);\n // Where \"Continue with email\" goes back to from WhatsApp.\n const emailType = $derived(authMethods.otp.enabled ? \"otp\" : \"password\");\n\n type Mode = \"password\" | \"otp\" | \"oauth2\" | \"whatsapp\";\n const initialType: Mode = $derived(\n authMethods.otp.enabled\n ? \"otp\"\n : authMethods.password.enabled\n ? \"password\"\n : whatsapp.enabled\n ? \"whatsapp\"\n : \"oauth2\",\n );\n let mode = $state<Mode>(\"password\");\n $effect(() => {\n mode = initialType;\n });\n\n const handleOAuth2 = (provider: string) => {\n const pb = new PocketBase(\"/\");\n\n pb.collection(\"users\")\n .authWithOAuth2({ provider, createData: {} })\n .then(() => goto(\"/dashboard\"));\n };\n<\/script>\n\n<div class=\"h-full flex flex-col items-center justify-center gap-6 p-6 md:p-10\">\n <div class=\"flex w-full max-w-sm flex-col gap-6\">\n <a href=\"/\" class=\"flex items-center gap-2 self-center font-medium\">\n <div\n class=\"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md\"\n >\n <img src={favicon} alt=\"logo\" class=\"size-4\" />\n </div>\n {site.name}\n </a>\n\n <div class=\"flex flex-col gap-6\">\n <Card.Root>\n {#if hasAuthMethods}\n <Card.Header class=\"text-center\">\n <Card.Title class=\"text-xl\">Welcome back</Card.Title>\n {#if hasOAuth2 || (hasEmail && whatsapp.enabled)}\n <Card.Description>Choose a login method</Card.Description>\n {:else if whatsapp.enabled}\n <Card.Description\n >Use your WhatsApp number to login</Card.Description\n >\n {:else}\n <Card.Description>Use your email to login</Card.Description>\n {/if}\n </Card.Header>\n {:else}\n <Card.Header class=\"text-center\">\n <Card.Title class=\"text-xl\">Login is disabled</Card.Title>\n <Card.Description\n >Check back later for login options</Card.Description\n >\n </Card.Header>\n {/if}\n <Card.Content>\n <form {...loginForm}>\n <div class=\"grid gap-6\">\n {#if hasOAuth2}\n <div class=\"flex flex-col gap-4\">\n {#each authMethods.oauth2.providers as provider}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => handleOAuth2(provider.name)}\n >\n <img\n src=\"/admin/_/images/oauth2/{provider.name}.svg\"\n class=\"size-5 bg-white p-0.5 rounded-sm\"\n alt=\"\"\n />\n Login with {provider.displayName}\n </Button>\n {/each}\n </div>\n {/if}\n\n {#if hasEmail || whatsapp.enabled}\n {#if hasOAuth2}\n <div\n class=\"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t\"\n >\n <span\n class=\"bg-card text-muted-foreground relative z-10 px-2\"\n >\n Or continue with\n </span>\n </div>\n {/if}\n\n <div class=\"grid gap-2\">\n {#if mode === \"whatsapp\" && whatsapp.enabled}\n <div class=\"space-y-2 col-span-1\">\n <label for=\"phone\" class=\"text-sm font-medium\"\n >WhatsApp number</label\n >\n <Input\n id=\"phone\"\n {...loginForm.fields.phone.as(\"text\")}\n type=\"tel\"\n required\n autocomplete=\"tel\"\n placeholder=\"+1 616 555 0123\"\n autofocus\n />\n {#each loginForm.fields.phone.issues() as issue}\n <p class=\"text-destructive text-sm\">{issue.message}</p>\n {/each}\n </div>\n\n {#if loginForm.result?.message}\n <div class=\"text-destructive text-sm font-medium -mt-2\">\n {loginForm.result.message}\n </div>\n {/if}\n\n <Button type=\"submit\" class=\"w-full\"\n >Send code on WhatsApp</Button\n >\n {#if hasEmail}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => (mode = emailType)}\n type=\"button\">Continue with email</Button\n >\n {/if}\n {:else if hasEmail}\n <div class=\"space-y-2 col-span-1\">\n <label for=\"email\" class=\"text-sm font-medium\"\n >Email</label\n >\n <Input\n id=\"email\"\n {...loginForm.fields.email.as(\"text\")}\n type=\"email\"\n required\n autocomplete=\"username\"\n autofocus\n />\n {#each loginForm.fields.email.issues() as issue}\n <p class=\"text-destructive text-sm\">{issue.message}</p>\n {/each}\n </div>\n\n {#if mode === \"password\" && authMethods.password.enabled}\n <div class=\"space-y-2 col-span-1\">\n <div class=\"grid grid-cols-[1fr_auto] gap-2\">\n <label for=\"password\" class=\"text-sm font-medium\"\n >Password</label\n >\n <Input\n id=\"password\"\n {...loginForm.fields.password.as(\"text\")}\n type=\"password\"\n required\n autocomplete=\"current-password\"\n class=\"col-span-2\"\n />\n <a\n href=\"/reset\"\n class=\"col-start-2 row-start-1 text-sm underline-offset-4 hover:underline\"\n >Forgot your password?</a\n >\n </div>\n {#each loginForm.fields.password.issues() as issue}\n <p class=\"text-destructive text-sm\">\n {issue.message}\n </p>\n {/each}\n </div>\n\n {#if loginForm.result?.message}\n <div class=\"text-destructive text-sm font-medium -mt-2\">\n {loginForm.result.message}\n </div>\n {/if}\n\n <Button type=\"submit\" class=\"w-full\">Login</Button>\n {#if authMethods.otp.enabled}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => (mode = \"otp\")}\n type=\"button\"\n >Use one-time code instead</Button\n >\n {/if}\n {:else if mode === \"otp\" && authMethods.otp.enabled}\n <Button type=\"submit\" class=\"w-full\"\n >Send one-time code</Button\n >\n {#if authMethods.password.enabled}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => (mode = \"password\")}\n type=\"button\"\n >Continue with password</Button\n >\n {/if}\n {/if}\n\n {#if whatsapp.enabled}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => (mode = \"whatsapp\")}\n type=\"button\">Continue with WhatsApp</Button\n >\n {/if}\n {/if}\n </div>\n\n <input {...loginForm.fields.type.as(\"hidden\", mode)} />\n {/if}\n\n <div class=\"text-center text-sm\">\n Don't have an account?\n <a\n href=\"/signup{redirect\n ? `?redirect=${encodeURIComponent(redirect)}`\n : ''}\"\n class=\"underline underline-offset-4\">Sign up</a\n >\n </div>\n </div>\n </form>\n </Card.Content>\n </Card.Root>\n <div\n class=\"text-muted-foreground *:[a]:hover:text-primary *:[a]:underline *:[a]:underline-offset-4 text-balance text-center text-xs\"\n >\n By clicking continue, you agree to our <a href=\"/terms\"\n >Terms of Service</a\n >\n and <a href=\"/privacy\">Privacy Policy</a>.\n </div>\n </div>\n </div>\n</div>\n", $t = "import { form, getRequestEvent } from \"$app/server\";\nimport { redirect } from \"@sveltejs/kit\";\nimport { dev } from \"$app/env\";\nimport { getTokenPayload } from \"pocketbase-sveltekit\";\nimport { loginSchema } from \"#lib/schemas/login.js\";\nimport { requestWhatsAppOTP } from \"#lib/server/whatsapp.js\";\n\nexport const loginForm = form(loginSchema, async (data) => {\n const { locals, cookies, url } = getRequestEvent();\n\n // Follow only a same-site path (`/x`, not `//host` or `/\\host`):\n // `redirect()` throws on an external URL.\n const next = url.searchParams.get(\"redirect\");\n const redirectParam = next && /^\\/(?![/\\\\])/.test(next) ? next : null;\n const redirectQuery = redirectParam\n ? `?redirect=${encodeURIComponent(redirectParam)}`\n : \"\";\n if (data.type === \"otp\") {\n const req = await locals.pb\n .collection(\"users\")\n .requestOTP(data.email ?? \"\");\n redirect(303, `/otp/${req.otpId}${redirectQuery}`);\n } else if (data.type === \"whatsapp\") {\n let otpId: string;\n try {\n ({ otpId } = await requestWhatsAppOTP(locals.pb, data.phone ?? \"\"));\n } catch (err: any) {\n // An invalid number comes back as a field error, the rest (WhatsApp\n // auth disabled, rate limited) as the response message.\n const response = err?.response ?? {};\n const fieldError = response?.data\n ? Object.values(response.data)[0]\n : undefined;\n const message: string =\n (fieldError as any)?.message ??\n response?.message ??\n \"Failed to send the code.\";\n return { message };\n }\n redirect(303, `/whatsapp/${otpId}${redirectQuery}`);\n } else if (data.type === \"password\") {\n try {\n await locals.pb\n .collection(\"users\")\n .authWithPassword(data.email ?? \"\", data.password ?? \"\");\n } catch (err: any) {\n // A wrong email or password is a 400. Anything else is not the\n // visitor's doing, and the page alone would not tell them apart.\n if (err.status !== 400) console.error(\"Failed to sign in:\", err);\n return {\n message: (err.response?.message as string) ?? \"Failed to authenticate.\",\n };\n }\n }\n\n const redirectUrl = redirectParam ?? \"/dashboard\";\n const cookie = locals.pb.authStore.getCookie();\n cookies.set(\"pb_auth\", cookie, {\n path: \"/\",\n httpOnly: true,\n sameSite: \"lax\",\n secure: !dev,\n // The cookie goes when its token does: PocketBase turns away every\n // request that carries an expired token, sign-in included.\n expires: new Date(getTokenPayload(locals.pb.authStore.token).exp * 1000),\n });\n\n redirect(303, redirectUrl);\n});\n", en = "import { redirect } from \"@sveltejs/kit\";\nimport { whatsappAuthMethod } from \"#lib/server/whatsapp.js\";\n\nexport const load = async ({ locals }) => {\n const authMethods = await locals.admin.collection(\"users\").listAuthMethods();\n\n if (locals.pb.authStore.isValid) {\n redirect(303, \"/dashboard\");\n }\n\n const whatsapp = whatsappAuthMethod(authMethods);\n\n return {\n authMethods,\n whatsappSignup: whatsapp.enabled && whatsapp.allowSignup === true,\n };\n};\n", tn = "<script lang=\"ts\">\n import favicon from \"#lib/assets/favicon.svg\";\n import { site } from \"#lib/site.js\";\n\n import { Button } from \"#lib/components/ui/button/index.js\";\n import * as Card from \"#lib/components/ui/card/index.js\";\n import { Input } from \"#lib/components/ui/input/index.js\";\n import PocketBase from \"pocketbase-sveltekit\";\n import { goto } from \"$app/navigation\";\n import { page } from \"$app/state\";\n import { signupForm } from \"./form.remote\";\n\n let { data } = $props();\n let authMethods = $derived(data.authMethods);\n let whatsappSignup = $derived(data.whatsappSignup);\n\n const redirect = page.url.searchParams.get(\"redirect\");\n const hasOAuth2 = $derived(\n authMethods.oauth2.enabled && authMethods.oauth2.providers.length > 0,\n );\n const hasEmail = $derived(\n authMethods.password.enabled || authMethods.otp.enabled,\n );\n const hasAuthMethods = $derived(hasEmail || whatsappSignup || hasOAuth2);\n // Where \"Continue with email\" goes back to from WhatsApp.\n const emailType = $derived(\n authMethods.password.enabled ? \"password\" : \"otp\",\n );\n\n type Mode = \"password\" | \"otp\" | \"whatsapp\";\n const initialType: Mode = $derived(\n authMethods.password.enabled\n ? \"password\"\n : authMethods.otp.enabled\n ? \"otp\"\n : whatsappSignup\n ? \"whatsapp\"\n : \"password\",\n );\n let mode = $state<Mode>(\"password\");\n $effect(() => {\n mode = initialType;\n });\n\n const handleOAuth2 = (provider: string) => {\n const pb = new PocketBase(\"/\");\n\n pb.collection(\"users\")\n .authWithOAuth2({ provider, createData: {} })\n .then(() => goto(\"/dashboard\"));\n };\n<\/script>\n\n<div class=\"h-full flex flex-col items-center justify-center gap-6 p-6 md:p-10\">\n <div class=\"flex w-full max-w-sm flex-col gap-6\">\n <a href=\"/\" class=\"flex items-center gap-2 self-center font-medium\">\n <div\n class=\"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md\"\n >\n <img src={favicon} alt=\"logo\" class=\"size-4\" />\n </div>\n {site.name}\n </a>\n\n <div class=\"flex flex-col gap-6\">\n <Card.Root>\n {#if hasAuthMethods}\n <Card.Header class=\"text-center\">\n <Card.Title class=\"text-xl\">Create an account</Card.Title>\n {#if hasOAuth2 || (hasEmail && whatsappSignup)}\n <Card.Description>Choose a sign up method</Card.Description>\n {:else if whatsappSignup}\n <Card.Description\n >Use your WhatsApp number to sign up</Card.Description\n >\n {:else}\n <Card.Description>Use your email to sign up</Card.Description>\n {/if}\n </Card.Header>\n {:else}\n <Card.Header class=\"text-center\">\n <Card.Title class=\"text-xl\">Signups are disabled</Card.Title>\n <Card.Description\n >Check back later for signup options</Card.Description\n >\n </Card.Header>\n {/if}\n <Card.Content>\n <form {...signupForm}>\n <div class=\"grid gap-6\">\n {#if hasOAuth2}\n <div class=\"flex flex-col gap-4\">\n {#each authMethods.oauth2.providers as provider}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => handleOAuth2(provider.name)}\n >\n <img\n src=\"/admin/_/images/oauth2/{provider.name}.svg\"\n class=\"size-5 bg-white p-0.5 rounded-sm\"\n alt=\"\"\n />\n Sign up with {provider.displayName}\n </Button>\n {/each}\n </div>\n {/if}\n\n {#if hasEmail || whatsappSignup}\n {#if hasOAuth2}\n <div\n class=\"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t\"\n >\n <span\n class=\"bg-card text-muted-foreground relative z-10 px-2\"\n >\n Or continue with\n </span>\n </div>\n {/if}\n\n <div class=\"grid gap-2\">\n {#if mode === \"whatsapp\" && whatsappSignup}\n <div class=\"space-y-2 col-span-1\">\n <label for=\"phone\" class=\"text-sm font-medium\"\n >WhatsApp number</label\n >\n <Input\n id=\"phone\"\n {...signupForm.fields.phone.as(\"text\")}\n type=\"tel\"\n required\n autocomplete=\"tel\"\n placeholder=\"+1 616 555 0123\"\n autofocus\n />\n {#each signupForm.fields.phone.issues() as issue}\n <p class=\"text-destructive text-sm\">{issue.message}</p>\n {/each}\n </div>\n\n {#if signupForm.result?.message}\n <div class=\"text-destructive text-sm font-medium -mt-2\">\n {signupForm.result.message}\n </div>\n {/if}\n\n <Button type=\"submit\" class=\"w-full\"\n >Send code on WhatsApp</Button\n >\n {#if hasEmail}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => (mode = emailType)}\n type=\"button\">Continue with email</Button\n >\n {/if}\n {:else if hasEmail}\n <div class=\"space-y-2 col-span-1\">\n <label for=\"email\" class=\"text-sm font-medium\"\n >Email</label\n >\n <Input\n id=\"email\"\n {...signupForm.fields.email.as(\"text\")}\n type=\"email\"\n required\n autocomplete=\"username\"\n autofocus\n />\n {#each signupForm.fields.email.issues() as issue}\n <p class=\"text-destructive text-sm\">{issue.message}</p>\n {/each}\n </div>\n\n {#if mode === \"password\" && authMethods.password.enabled}\n <div class=\"space-y-2 col-span-1\">\n <label for=\"password\" class=\"text-sm font-medium\"\n >Password</label\n >\n <Input\n id=\"password\"\n {...signupForm.fields.password.as(\"text\")}\n type=\"password\"\n required\n autocomplete=\"new-password\"\n minlength={8}\n />\n {#each signupForm.fields.password.issues() as issue}\n <p class=\"text-destructive text-sm\">\n {issue.message}\n </p>\n {/each}\n </div>\n\n <div class=\"space-y-2 col-span-1\">\n <label for=\"passwordConfirm\" class=\"text-sm font-medium\"\n >Confirm Password</label\n >\n <Input\n id=\"passwordConfirm\"\n {...signupForm.fields.passwordConfirm.as(\"text\")}\n type=\"password\"\n required\n autocomplete=\"new-password\"\n minlength={8}\n />\n {#each signupForm.fields.passwordConfirm.issues() as issue}\n <p class=\"text-destructive text-sm\">\n {issue.message}\n </p>\n {/each}\n </div>\n\n {#if signupForm.result?.message}\n <div class=\"text-destructive text-sm font-medium -mt-2\">\n {signupForm.result.message}\n </div>\n {/if}\n\n <Button type=\"submit\" class=\"w-full\">Create account</Button\n >\n {#if authMethods.otp.enabled}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => (mode = \"otp\")}\n type=\"button\"\n >Use one-time code instead</Button\n >\n {/if}\n {:else if mode === \"otp\" && authMethods.otp.enabled}\n {#if signupForm.result?.message}\n <div class=\"text-destructive text-sm font-medium -mt-2\">\n {signupForm.result.message}\n </div>\n {/if}\n\n <Button type=\"submit\" class=\"w-full\"\n >Send one-time code</Button\n >\n {#if authMethods.password.enabled}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => (mode = \"password\")}\n type=\"button\"\n >Continue with password</Button\n >\n {/if}\n {/if}\n\n {#if whatsappSignup}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => (mode = \"whatsapp\")}\n type=\"button\">Continue with WhatsApp</Button\n >\n {/if}\n {/if}\n </div>\n\n <input {...signupForm.fields.type.as(\"hidden\", mode)} />\n {/if}\n\n <div class=\"text-center text-sm\">\n Already have an account?\n <a\n href=\"/login{redirect\n ? `?redirect=${encodeURIComponent(redirect)}`\n : ''}\"\n class=\"underline underline-offset-4\"\n >\n Log in\n </a>\n </div>\n </div>\n </form>\n </Card.Content>\n </Card.Root>\n <div\n class=\"text-muted-foreground *:[a]:hover:text-primary *:[a]:underline *:[a]:underline-offset-4 text-balance text-center text-xs\"\n >\n By clicking continue, you agree to our <a href=\"/terms\"\n >Terms of Service</a\n >\n and <a href=\"/privacy\">Privacy Policy</a>.\n </div>\n </div>\n </div>\n</div>\n", nn = "import { form, getRequestEvent } from \"$app/server\";\nimport { redirect } from \"@sveltejs/kit\";\nimport { setFlash } from \"sveltekit-flash-message/server\";\nimport { dev } from \"$app/env\";\nimport { getTokenPayload } from \"pocketbase-sveltekit\";\nimport { signupSchema } from \"#lib/schemas/signup.js\";\nimport { requestWhatsAppOTP } from \"#lib/server/whatsapp.js\";\n\n/** The first field error, or the response message, of a PocketBase error. */\nfunction errorMessage(err: any, fallback: string): string {\n const response = err?.response ?? {};\n const fieldError = response?.data\n ? Object.values(response.data)[0]\n : undefined;\n return (fieldError as any)?.message ?? response?.message ?? fallback;\n}\n\nexport const signupForm = form(signupSchema, async (data) => {\n const { locals, cookies, url } = getRequestEvent();\n\n // Follow only a same-site path (`/x`, not `//host` or `/\\host`):\n // `redirect()` throws on an external URL.\n const next = url.searchParams.get(\"redirect\");\n const redirectParam = next && /^\\/(?![/\\\\])/.test(next) ? next : null;\n const redirectQuery = redirectParam\n ? `?redirect=${encodeURIComponent(redirectParam)}`\n : \"\";\n\n if (data.type === \"whatsapp\") {\n // The account is created when the code is checked.\n let otpId: string;\n try {\n ({ otpId } = await requestWhatsAppOTP(locals.pb, data.phone ?? \"\"));\n } catch (err: any) {\n return { message: errorMessage(err, \"Failed to send the code.\") };\n }\n redirect(303, `/whatsapp/${otpId}${redirectQuery}`);\n }\n\n const email = data.email ?? \"\";\n\n if (data.type === \"otp\") {\n // PocketBase only sends codes to existing accounts, so create it first,\n // with a password nobody knows (a reset sets a real one). Checking the\n // code marks the email verified.\n const password = crypto.randomUUID();\n try {\n await locals.admin.collection(\"users\").create({\n email,\n password,\n passwordConfirm: password,\n });\n } catch (err: any) {\n // An existing account gets a code too, the same as logging in with one.\n if (err?.response?.data?.email?.code !== \"validation_not_unique\") {\n return { message: errorMessage(err, \"Failed to create account.\") };\n }\n }\n\n let otpId: string;\n try {\n ({ otpId } = await locals.pb.collection(\"users\").requestOTP(email));\n } catch (err: any) {\n return { message: errorMessage(err, \"Failed to send the code.\") };\n }\n // A new account has no name yet: ask for one once the code checks out.\n const welcome = `/welcome${redirectQuery}`;\n redirect(303, `/otp/${otpId}?redirect=${encodeURIComponent(welcome)}`);\n }\n\n try {\n await locals.admin.collection(\"users\").create({\n email,\n password: data.password,\n passwordConfirm: data.passwordConfirm,\n });\n } catch (err: any) {\n return { message: errorMessage(err, \"Failed to create account.\") };\n }\n\n await locals.pb.collection(\"users\").requestVerification(email);\n await locals.pb\n .collection(\"users\")\n .authWithPassword(email, data.password ?? \"\");\n\n const redirectUrl = redirectParam ?? \"/dashboard\";\n const cookie = locals.pb.authStore.getCookie();\n cookies.set(\"pb_auth\", cookie, {\n path: \"/\",\n httpOnly: true,\n sameSite: \"lax\",\n secure: !dev,\n // The cookie goes when its token does: PocketBase turns away every\n // request that carries an expired token, sign-in included.\n expires: new Date(getTokenPayload(locals.pb.authStore.token).exp * 1000),\n });\n\n setFlash(\n { type: \"toast\", message: \"We sent a confirmation link to your email.\" },\n cookies,\n );\n redirect(303, redirectUrl);\n});\n", rn = "<script lang=\"ts\">\n import favicon from \"#lib/assets/favicon.svg\";\n import { site } from \"#lib/site.js\";\n\n import { untrack } from \"svelte\";\n import { Button } from \"#lib/components/ui/button/index.js\";\n import { superForm } from \"sveltekit-superforms\";\n import { zod4Client } from \"sveltekit-superforms/adapters\";\n import { loginSchema } from \"#lib/schemas/login.js\";\n import * as Form from \"#lib/components/ui/form/index.js\";\n import { Input } from \"#lib/components/ui/input/index.js\";\n import PocketBase from \"pocketbase-sveltekit\";\n import { goto } from \"$app/navigation\";\n import { page } from \"$app/state\";\n\n let { data } = $props();\n let authMethods = $derived(data.authMethods);\n let whatsapp = $derived(data.whatsapp);\n\n const redirect = page.url.searchParams.get(\"redirect\");\n const hasOAuth2 = $derived(\n authMethods.oauth2.enabled && authMethods.oauth2.providers.length > 0,\n );\n const hasEmail = $derived(\n authMethods.password.enabled || authMethods.otp.enabled,\n );\n const hasAuthMethods = $derived(hasEmail || whatsapp.enabled || hasOAuth2);\n // Where \"Continue with email\" goes back to from WhatsApp.\n const emailType = $derived(authMethods.otp.enabled ? \"otp\" : \"password\");\n\n const form = superForm(\n untrack(() => data.form),\n {\n validators: zod4Client(loginSchema),\n },\n );\n\n const handleOAuth2 = (provider: string) => {\n const pb = new PocketBase(\"/\");\n\n pb.collection(\"users\")\n .authWithOAuth2({ provider, createData: {} })\n .then(() => goto(\"/dashboard\"));\n };\n\n const { form: formData, message } = form;\n<\/script>\n\n<div class=\"grid h-full lg:grid-cols-2\">\n <div class=\"flex flex-col gap-4 p-6 md:p-10\">\n <div class=\"flex justify-center gap-2 md:justify-start\">\n <a href=\"/\" class=\"flex items-center gap-2 font-medium\">\n <div\n class=\"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md\"\n >\n <img src={favicon} alt=\"logo\" class=\"size-4\" />\n </div>\n {site.name}\n </a>\n </div>\n <div class=\"flex flex-1 items-center justify-center\">\n <div class=\"w-full max-w-sm\">\n <form method=\"POST\">\n <div class=\"grid gap-6\">\n <div class=\"flex flex-col items-center gap-2 text-center\">\n {#if hasAuthMethods}\n <h1 class=\"text-2xl font-bold\">Welcome back</h1>\n <p class=\"text-muted-foreground text-sm text-balance\">\n {hasOAuth2 || (hasEmail && whatsapp.enabled)\n ? \"Choose a login method\"\n : whatsapp.enabled\n ? \"Use your WhatsApp number to login\"\n : \"Use your email to login\"}\n </p>\n {:else}\n <h1 class=\"text-2xl font-bold\">Login is disabled</h1>\n <p class=\"text-muted-foreground text-sm text-balance\">\n Check back later for login options\n </p>\n {/if}\n </div>\n\n {#if hasOAuth2}\n <div class=\"flex flex-col gap-4\">\n {#each authMethods.oauth2.providers as provider}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => handleOAuth2(provider.name)}\n >\n <img\n src=\"/admin/_/images/oauth2/{provider.name}.svg\"\n class=\"size-5 bg-white p-0.5 rounded-sm\"\n alt=\"\"\n />\n Login with {provider.displayName}\n </Button>\n {/each}\n </div>\n {/if}\n\n {#if hasEmail || whatsapp.enabled}\n {#if hasOAuth2}\n <div\n class=\"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t\"\n >\n <span\n class=\"bg-background text-muted-foreground relative z-10 px-2\"\n >\n Or continue with\n </span>\n </div>\n {/if}\n\n <div class=\"grid gap-2\">\n {#if $formData.type === \"whatsapp\" && whatsapp.enabled}\n <Form.Field {form} name=\"phone\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>WhatsApp number</Form.Label>\n <Input\n {...props}\n type=\"tel\"\n bind:value={$formData.phone}\n required\n autocomplete=\"tel\"\n placeholder=\"+1 616 555 0123\"\n autofocus\n />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n\n {#if $message && $message.type === \"error\"}\n <div class=\"text-destructive text-sm font-medium -mt-2\">\n {$message.text}\n </div>\n {/if}\n\n <Button type=\"submit\" class=\"w-full\"\n >Send code on WhatsApp</Button\n >\n {#if hasEmail}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => ($formData.type = emailType as \"whatsapp\")}\n >Continue with email</Button\n >\n {/if}\n {:else if hasEmail && $formData.type !== \"whatsapp\"}\n <Form.Field {form} name=\"email\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>Email</Form.Label>\n <Input\n {...props}\n type=\"email\"\n bind:value={$formData.email}\n required\n autocomplete=\"username\"\n autofocus\n />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n\n {#if $formData.type === \"password\" && authMethods.password.enabled}\n <Form.Field {form} name=\"password\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <div class=\"grid grid-cols-[1fr_auto] gap-2\">\n <Form.Label>Password</Form.Label>\n <Input\n {...props}\n type=\"password\"\n bind:value={$formData.password}\n required\n autocomplete=\"current-password\"\n class=\"col-span-2\"\n />\n <a\n href=\"/reset\"\n class=\"col-start-2 row-start-1 text-sm underline-offset-4 hover:underline\"\n >Forgot your password?</a\n >\n </div>\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n\n {#if $message && $message.type === \"error\"}\n <div class=\"text-destructive text-sm font-medium -mt-2\">\n {$message.text}\n </div>\n {/if}\n\n <Button type=\"submit\" class=\"w-full\">Login</Button>\n {#if authMethods.otp.enabled}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => ($formData.type = \"otp\" as \"password\")}\n >Use one-time code instead</Button\n >\n {/if}\n {:else if $formData.type === \"otp\" && authMethods.otp.enabled}\n <Button type=\"submit\" class=\"w-full\"\n >Send one-time code</Button\n >\n {#if authMethods.password.enabled}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => ($formData.type = \"password\" as \"otp\")}\n >Continue with password</Button\n >\n {/if}\n {/if}\n\n {#if whatsapp.enabled}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() =>\n ($formData.type = \"whatsapp\" as \"password\")}\n >Continue with WhatsApp</Button\n >\n {/if}\n {/if}\n </div>\n\n <input type=\"hidden\" name=\"type\" bind:value={$formData.type} />\n {/if}\n\n <div class=\"text-center text-sm\">\n Don't have an account?\n <a\n href=\"/signup{redirect\n ? `?redirect=${encodeURIComponent(redirect)}`\n : ''}\"\n class=\"underline underline-offset-4\">Sign up</a\n >\n </div>\n </div>\n </form>\n </div>\n </div>\n <div\n class=\"text-muted-foreground *:[a]:hover:text-primary *:[a]:underline *:[a]:underline-offset-4 text-balance text-center text-xs\"\n >\n By clicking continue, you agree to our <a href=\"/terms\"\n >Terms of Service</a\n >\n and <a href=\"/privacy\">Privacy Policy</a>.\n </div>\n </div>\n <div class=\"bg-muted relative hidden lg:block\">\n <img\n src={favicon}\n alt=\"\"\n class=\"absolute inset-0 m-auto size-32 opacity-20\"\n />\n </div>\n</div>\n", an = "<script lang=\"ts\">\n import favicon from \"#lib/assets/favicon.svg\";\n import { site } from \"#lib/site.js\";\n\n import { untrack } from \"svelte\";\n import { Button } from \"#lib/components/ui/button/index.js\";\n import { superForm } from \"sveltekit-superforms\";\n import { zod4Client } from \"sveltekit-superforms/adapters\";\n import { signupSchema } from \"#lib/schemas/signup.js\";\n import * as Form from \"#lib/components/ui/form/index.js\";\n import { Input } from \"#lib/components/ui/input/index.js\";\n import PocketBase from \"pocketbase-sveltekit\";\n import { goto } from \"$app/navigation\";\n import { page } from \"$app/state\";\n\n let { data } = $props();\n let authMethods = $derived(data.authMethods);\n let whatsappSignup = $derived(data.whatsappSignup);\n\n const redirect = page.url.searchParams.get(\"redirect\");\n const hasOAuth2 = $derived(\n authMethods.oauth2.enabled && authMethods.oauth2.providers.length > 0,\n );\n const hasEmail = $derived(\n authMethods.password.enabled || authMethods.otp.enabled,\n );\n const hasAuthMethods = $derived(hasEmail || whatsappSignup || hasOAuth2);\n // Where \"Continue with email\" goes back to from WhatsApp.\n const emailType = $derived(authMethods.password.enabled ? \"password\" : \"otp\");\n\n const form = superForm(\n untrack(() => data.form),\n {\n validators: zod4Client(signupSchema),\n },\n );\n\n const handleOAuth2 = (provider: string) => {\n const pb = new PocketBase(\"/\");\n\n pb.collection(\"users\")\n .authWithOAuth2({ provider, createData: {} })\n .then(() => goto(\"/dashboard\"));\n };\n\n const { form: formData, message } = form;\n<\/script>\n\n<div class=\"grid h-full lg:grid-cols-2\">\n <div class=\"bg-muted relative hidden lg:block\">\n <img\n src={favicon}\n alt=\"\"\n class=\"absolute inset-0 m-auto size-32 opacity-20\"\n />\n </div>\n <div class=\"flex flex-col gap-4 p-6 md:p-10\">\n <div class=\"flex justify-center gap-2 md:justify-start\">\n <a href=\"/\" class=\"flex items-center gap-2 font-medium\">\n <div\n class=\"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md\"\n >\n <img src={favicon} alt=\"logo\" class=\"size-4\" />\n </div>\n {site.name}\n </a>\n </div>\n <div class=\"flex flex-1 items-center justify-center\">\n <div class=\"w-full max-w-sm\">\n <form method=\"POST\">\n <div class=\"grid gap-6\">\n <div class=\"flex flex-col items-center gap-2 text-center\">\n {#if hasAuthMethods}\n <h1 class=\"text-2xl font-bold\">Create an account</h1>\n <p class=\"text-muted-foreground text-sm text-balance\">\n {hasOAuth2 || (hasEmail && whatsappSignup)\n ? \"Choose a sign up method\"\n : whatsappSignup\n ? \"Use your WhatsApp number to sign up\"\n : \"Use your email to sign up\"}\n </p>\n {:else}\n <h1 class=\"text-2xl font-bold\">Signups are disabled</h1>\n <p class=\"text-muted-foreground text-sm text-balance\">\n Check back later for signup options\n </p>\n {/if}\n </div>\n\n {#if hasOAuth2}\n <div class=\"flex flex-col gap-4\">\n {#each authMethods.oauth2.providers as provider}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => handleOAuth2(provider.name)}\n >\n <img\n src=\"/admin/_/images/oauth2/{provider.name}.svg\"\n class=\"size-5 bg-white p-0.5 rounded-sm\"\n alt=\"\"\n />\n Sign up with {provider.displayName}\n </Button>\n {/each}\n </div>\n {/if}\n\n {#if hasEmail || whatsappSignup}\n {#if hasOAuth2}\n <div\n class=\"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t\"\n >\n <span\n class=\"bg-background text-muted-foreground relative z-10 px-2\"\n >\n Or continue with\n </span>\n </div>\n {/if}\n\n <div class=\"grid gap-2\">\n {#if $formData.type === \"whatsapp\" && whatsappSignup}\n <Form.Field {form} name=\"phone\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>WhatsApp number</Form.Label>\n <Input\n {...props}\n type=\"tel\"\n bind:value={$formData.phone}\n required\n autocomplete=\"tel\"\n placeholder=\"+1 616 555 0123\"\n autofocus\n />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n\n {#if $message && $message.type === \"error\"}\n <div class=\"text-destructive text-sm font-medium -mt-2\">\n {$message.text}\n </div>\n {/if}\n\n <Button type=\"submit\" class=\"w-full\"\n >Send code on WhatsApp</Button\n >\n {#if hasEmail}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => ($formData.type = emailType as \"whatsapp\")}\n >Continue with email</Button\n >\n {/if}\n {:else if hasEmail && $formData.type !== \"whatsapp\"}\n <Form.Field {form} name=\"email\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>Email</Form.Label>\n <Input\n {...props}\n type=\"email\"\n bind:value={$formData.email}\n required\n autocomplete=\"username\"\n autofocus\n />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n\n {#if $formData.type === \"password\" && authMethods.password.enabled}\n <Form.Field {form} name=\"password\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>Password</Form.Label>\n <Input\n {...props}\n type=\"password\"\n bind:value={$formData.password}\n required\n autocomplete=\"new-password\"\n minlength={8}\n />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n\n <Form.Field\n {form}\n name=\"passwordConfirm\"\n class=\"col-span-1\"\n >\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>Confirm Password</Form.Label>\n <Input\n {...props}\n type=\"password\"\n bind:value={$formData.passwordConfirm}\n required\n autocomplete=\"new-password\"\n minlength={8}\n />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n <Button type=\"submit\" class=\"w-full\">Create account</Button>\n {#if authMethods.otp.enabled}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => ($formData.type = \"otp\" as \"password\")}\n >Use one-time code instead</Button\n >\n {/if}\n {:else if $formData.type === \"otp\" && authMethods.otp.enabled}\n {#if $message && $message.type === \"error\"}\n <div class=\"text-destructive text-sm font-medium -mt-2\">\n {$message.text}\n </div>\n {/if}\n\n <Button type=\"submit\" class=\"w-full\"\n >Send one-time code</Button\n >\n {#if authMethods.password.enabled}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() => ($formData.type = \"password\" as \"otp\")}\n >Continue with password</Button\n >\n {/if}\n {/if}\n\n {#if whatsappSignup}\n <Button\n variant=\"outline\"\n class=\"w-full\"\n onclick={() =>\n ($formData.type = \"whatsapp\" as \"password\")}\n >Continue with WhatsApp</Button\n >\n {/if}\n {/if}\n </div>\n\n <input type=\"hidden\" name=\"type\" bind:value={$formData.type} />\n {/if}\n\n <div class=\"text-center text-sm\">\n Already have an account?\n <a\n href=\"/login{redirect\n ? `?redirect=${encodeURIComponent(redirect)}`\n : ''}\"\n class=\"underline underline-offset-4\"\n >\n Log in\n </a>\n </div>\n </div>\n </form>\n </div>\n </div>\n <div\n class=\"text-muted-foreground *:[a]:hover:text-primary *:[a]:underline *:[a]:underline-offset-4 text-balance text-center text-xs\"\n >\n By clicking continue, you agree to our <a href=\"/terms\"\n >Terms of Service</a\n >\n and <a href=\"/privacy\">Privacy Policy</a>.\n </div>\n </div>\n</div>\n";
|
|
9
|
+
// src/patterns/enable/whatsapp/modifies/modify-by-original.ts
|
|
10
|
+
async function W(e, t) {
|
|
11
|
+
try {
|
|
12
|
+
return await Mt.format(e, {
|
|
13
|
+
filepath: t,
|
|
14
|
+
plugins: [Nt]
|
|
15
|
+
});
|
|
16
|
+
} catch {
|
|
17
|
+
return e;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
async function on(e, t, n, r = []) {
|
|
21
|
+
if (!H.existsSync(e)) return {
|
|
22
|
+
filePath: e,
|
|
23
|
+
outcome: { kind: "missing" }
|
|
24
|
+
};
|
|
25
|
+
let i = H.readFileSync(e, "utf8");
|
|
26
|
+
if (n.test(i)) return {
|
|
27
|
+
filePath: e,
|
|
28
|
+
outcome: { kind: "done" }
|
|
29
|
+
};
|
|
30
|
+
let a = await W(i, e), o = r.find((e) => e.detect(i));
|
|
31
|
+
o && (a = o.strip(a));
|
|
32
|
+
for (let { original: n, template: r } of t) if (await W(n, e) === a) return {
|
|
33
|
+
filePath: e,
|
|
34
|
+
outcome: {
|
|
35
|
+
kind: "write",
|
|
36
|
+
template: r,
|
|
37
|
+
overlay: o
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
filePath: e,
|
|
42
|
+
outcome: { kind: "customized" }
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function sn(e, t) {
|
|
46
|
+
let n = /* @__PURE__ */ new Map(), r = e.filter((e) => e.outcome.kind === "customized" || e.outcome.kind === "missing");
|
|
47
|
+
for (let { filePath: i, outcome: a } of e) if (a.kind === "missing") n.set(i, {
|
|
48
|
+
status: "not-found",
|
|
49
|
+
message: t(i)
|
|
50
|
+
});
|
|
51
|
+
else if (a.kind === "customized") n.set(i, {
|
|
52
|
+
status: "failed",
|
|
53
|
+
message: t(i)
|
|
54
|
+
});
|
|
55
|
+
else if (a.kind === "done") n.set(i, {
|
|
56
|
+
status: "success",
|
|
57
|
+
changed: !1
|
|
58
|
+
});
|
|
59
|
+
else if (r.length > 0) {
|
|
60
|
+
let e = r.map((e) => U.basename(U.dirname(e.filePath)) + "/" + U.basename(e.filePath)).join(", ");
|
|
61
|
+
n.set(i, {
|
|
62
|
+
status: "failed",
|
|
63
|
+
message: `Left as is, along with ${e}, which has changes of its own.\n${t(i)}`
|
|
64
|
+
});
|
|
65
|
+
} else H.writeFileSync(i, a.template, "utf8"), a.overlay?.apply(i), n.set(i, {
|
|
66
|
+
status: "success",
|
|
67
|
+
changed: !0
|
|
68
|
+
});
|
|
69
|
+
return n;
|
|
70
|
+
}
|
|
71
|
+
// src/patterns/enable/whatsapp/modifies/auth-pages.ts
|
|
72
|
+
var G = (e, t) => Object.fromEntries(Object.entries(e).map(([e, n]) => [e.slice(t.length), n])), K = {
|
|
73
|
+
base: G(/* #__PURE__ */ Object.assign({
|
|
74
|
+
"../../auth/creates/src/lib/components/app-sidebar.svelte": Dt,
|
|
75
|
+
"../../auth/creates/src/lib/components/nav-main.svelte": bt,
|
|
76
|
+
"../../auth/creates/src/lib/components/nav-user.svelte": pe,
|
|
77
|
+
"../../auth/creates/src/lib/components/user-avatar.svelte": Me,
|
|
78
|
+
"../../auth/creates/src/lib/schemas/changeEmail.ts": Fe,
|
|
79
|
+
"../../auth/creates/src/lib/schemas/changePassword.ts": Je,
|
|
80
|
+
"../../auth/creates/src/lib/schemas/confirmEmailChange.ts": rt,
|
|
81
|
+
"../../auth/creates/src/lib/schemas/confirmReset.ts": ke,
|
|
82
|
+
"../../auth/creates/src/lib/schemas/login.ts": we,
|
|
83
|
+
"../../auth/creates/src/lib/schemas/otp.ts": _t,
|
|
84
|
+
"../../auth/creates/src/lib/schemas/profile.ts": Ge,
|
|
85
|
+
"../../auth/creates/src/lib/schemas/reset.ts": xe,
|
|
86
|
+
"../../auth/creates/src/lib/schemas/signup.ts": dt,
|
|
87
|
+
"../../auth/creates/src/lib/schemas/welcome.ts": et,
|
|
88
|
+
"../../auth/creates/src/lib/user.ts": ge,
|
|
89
|
+
"../../auth/creates/src/routes/(app)/+layout.server.ts": Re,
|
|
90
|
+
"../../auth/creates/src/routes/(app)/+layout.svelte": ct,
|
|
91
|
+
"../../auth/creates/src/routes/(app)/dashboard/+page.svelte": "",
|
|
92
|
+
"../../auth/creates/src/routes/(app)/dashboard/+page.ts": Ze,
|
|
93
|
+
"../../auth/creates/src/routes/(app)/dashboard/server.test.ts": mt,
|
|
94
|
+
"../../auth/creates/src/routes/(app)/settings/+layout.server.ts": Ee,
|
|
95
|
+
"../../auth/creates/src/routes/(app)/settings/+page.server.ts": t,
|
|
96
|
+
"../../auth/creates/src/routes/(app)/settings/+page.svelte": S,
|
|
97
|
+
"../../auth/creates/src/routes/(app)/settings/+page.ts": B,
|
|
98
|
+
"../../auth/creates/src/routes/(public)/(auth)/confirm-email-change/[token]/+page.server.ts": I,
|
|
99
|
+
"../../auth/creates/src/routes/(public)/(auth)/confirm-email-change/[token]/+page.svelte": R,
|
|
100
|
+
"../../auth/creates/src/routes/(public)/(auth)/confirm-email-change/[token]/+page.ts": ue,
|
|
101
|
+
"../../auth/creates/src/routes/(public)/(auth)/confirm-email-change/[token]/server.test.ts": ot,
|
|
102
|
+
"../../auth/creates/src/routes/(public)/(auth)/confirm-reset/[token]/+page.server.ts": fe,
|
|
103
|
+
"../../auth/creates/src/routes/(public)/(auth)/confirm-reset/[token]/+page.svelte": ie,
|
|
104
|
+
"../../auth/creates/src/routes/(public)/(auth)/confirm-reset/[token]/+page.ts": P,
|
|
105
|
+
"../../auth/creates/src/routes/(public)/(auth)/confirm-reset/[token]/server.test.ts": A,
|
|
106
|
+
"../../auth/creates/src/routes/(public)/(auth)/confirm-verification/[token]/+server.ts": oe,
|
|
107
|
+
"../../auth/creates/src/routes/(public)/(auth)/confirm-verification/[token]/server.test.ts": M,
|
|
108
|
+
"../../auth/creates/src/routes/(public)/(auth)/login/+page.server.ts": a,
|
|
109
|
+
"../../auth/creates/src/routes/(public)/(auth)/login/+page.svelte": At,
|
|
110
|
+
"../../auth/creates/src/routes/(public)/(auth)/login/+page.ts": w,
|
|
111
|
+
"../../auth/creates/src/routes/(public)/(auth)/login/server.test.ts": f,
|
|
112
|
+
"../../auth/creates/src/routes/(public)/(auth)/logout/+server.ts": ce,
|
|
113
|
+
"../../auth/creates/src/routes/(public)/(auth)/logout/server.test.ts": ne,
|
|
114
|
+
"../../auth/creates/src/routes/(public)/(auth)/otp/[token]/+page.server.ts": b,
|
|
115
|
+
"../../auth/creates/src/routes/(public)/(auth)/otp/[token]/+page.svelte": g,
|
|
116
|
+
"../../auth/creates/src/routes/(public)/(auth)/otp/[token]/+page.ts": m,
|
|
117
|
+
"../../auth/creates/src/routes/(public)/(auth)/otp/[token]/server.test.ts": Ve,
|
|
118
|
+
"../../auth/creates/src/routes/(public)/(auth)/reset/+page.server.ts": r,
|
|
119
|
+
"../../auth/creates/src/routes/(public)/(auth)/reset/+page.svelte": Ue,
|
|
120
|
+
"../../auth/creates/src/routes/(public)/(auth)/reset/+page.ts": v,
|
|
121
|
+
"../../auth/creates/src/routes/(public)/(auth)/reset/server.test.ts": l,
|
|
122
|
+
"../../auth/creates/src/routes/(public)/(auth)/signup/+page.server.ts": ee,
|
|
123
|
+
"../../auth/creates/src/routes/(public)/(auth)/signup/+page.svelte": O,
|
|
124
|
+
"../../auth/creates/src/routes/(public)/(auth)/signup/+page.ts": Ct,
|
|
125
|
+
"../../auth/creates/src/routes/(public)/(auth)/signup/server.test.ts": s,
|
|
126
|
+
"../../auth/creates/src/routes/(public)/(auth)/welcome/+page.server.ts": E,
|
|
127
|
+
"../../auth/creates/src/routes/(public)/(auth)/welcome/+page.svelte": Tt,
|
|
128
|
+
"../../auth/creates/src/routes/(public)/(auth)/welcome/+page.ts": ye,
|
|
129
|
+
"../../auth/creates/src/routes/(public)/(auth)/welcome/server.test.ts": Ot
|
|
130
|
+
}), "../../auth/creates/"),
|
|
131
|
+
split: G(/* #__PURE__ */ Object.assign({
|
|
132
|
+
"../../auth/variants/split/src/routes/(public)/(auth)/login/+page.svelte": xt,
|
|
133
|
+
"../../auth/variants/split/src/routes/(public)/(auth)/signup/+page.svelte": me
|
|
134
|
+
}), "../../auth/variants/split/"),
|
|
135
|
+
remote: G(/* #__PURE__ */ Object.assign({
|
|
136
|
+
"../../auth-remote/creates/src/lib/components/app-sidebar.svelte": Ne,
|
|
137
|
+
"../../auth-remote/creates/src/lib/components/nav-main.svelte": Ie,
|
|
138
|
+
"../../auth-remote/creates/src/lib/components/nav-user.svelte": Ye,
|
|
139
|
+
"../../auth-remote/creates/src/lib/components/user-avatar.svelte": it,
|
|
140
|
+
"../../auth-remote/creates/src/lib/schemas/changeEmail.ts": Ae,
|
|
141
|
+
"../../auth-remote/creates/src/lib/schemas/changePassword.ts": Te,
|
|
142
|
+
"../../auth-remote/creates/src/lib/schemas/confirmEmailChange.ts": vt,
|
|
143
|
+
"../../auth-remote/creates/src/lib/schemas/confirmReset.ts": Ke,
|
|
144
|
+
"../../auth-remote/creates/src/lib/schemas/login.ts": Se,
|
|
145
|
+
"../../auth-remote/creates/src/lib/schemas/otp.ts": ft,
|
|
146
|
+
"../../auth-remote/creates/src/lib/schemas/profile.ts": tt,
|
|
147
|
+
"../../auth-remote/creates/src/lib/schemas/reset.ts": _e,
|
|
148
|
+
"../../auth-remote/creates/src/lib/schemas/signup.ts": ze,
|
|
149
|
+
"../../auth-remote/creates/src/lib/schemas/welcome.ts": lt,
|
|
150
|
+
"../../auth-remote/creates/src/lib/user.ts": Qe,
|
|
151
|
+
"../../auth-remote/creates/src/routes/(app)/+layout.server.ts": ht,
|
|
152
|
+
"../../auth-remote/creates/src/routes/(app)/+layout.svelte": De,
|
|
153
|
+
"../../auth-remote/creates/src/routes/(app)/dashboard/+page.svelte": "",
|
|
154
|
+
"../../auth-remote/creates/src/routes/(app)/dashboard/+page.ts": e,
|
|
155
|
+
"../../auth-remote/creates/src/routes/(app)/dashboard/server.test.ts": x,
|
|
156
|
+
"../../auth-remote/creates/src/routes/(app)/settings/+layout.server.ts": z,
|
|
157
|
+
"../../auth-remote/creates/src/routes/(app)/settings/+page.server.ts": F,
|
|
158
|
+
"../../auth-remote/creates/src/routes/(app)/settings/+page.svelte": L,
|
|
159
|
+
"../../auth-remote/creates/src/routes/(app)/settings/+page.ts": le,
|
|
160
|
+
"../../auth-remote/creates/src/routes/(app)/settings/form.remote.ts": at,
|
|
161
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/confirm-email-change/[token]/+page.server.ts": de,
|
|
162
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/confirm-email-change/[token]/+page.svelte": re,
|
|
163
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/confirm-email-change/[token]/+page.ts": N,
|
|
164
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/confirm-email-change/[token]/form.remote.ts": k,
|
|
165
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/confirm-email-change/[token]/server.test.ts": ae,
|
|
166
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/confirm-reset/[token]/+page.server.ts": j,
|
|
167
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/confirm-reset/[token]/+page.svelte": i,
|
|
168
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/confirm-reset/[token]/+page.ts": kt,
|
|
169
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/confirm-reset/[token]/form.remote.ts": C,
|
|
170
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/confirm-reset/[token]/server.test.ts": d,
|
|
171
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/confirm-verification/[token]/+server.ts": se,
|
|
172
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/confirm-verification/[token]/server.test.ts": te,
|
|
173
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/login/+page.server.ts": y,
|
|
174
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/login/+page.svelte": h,
|
|
175
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/login/+page.ts": p,
|
|
176
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/login/form.remote.ts": Be,
|
|
177
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/login/server.test.ts": n,
|
|
178
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/logout/+server.ts": He,
|
|
179
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/logout/server.test.ts": _,
|
|
180
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/otp/[token]/+page.server.ts": c,
|
|
181
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/otp/[token]/+page.svelte": u,
|
|
182
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/otp/[token]/+page.ts": D,
|
|
183
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/otp/[token]/form.remote.ts": St,
|
|
184
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/otp/[token]/server.test.ts": o,
|
|
185
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/reset/+page.server.ts": T,
|
|
186
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/reset/+page.svelte": wt,
|
|
187
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/reset/+page.ts": ve,
|
|
188
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/reset/form.remote.ts": Et,
|
|
189
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/reset/server.test.ts": yt,
|
|
190
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/signup/+page.server.ts": V,
|
|
191
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/signup/+page.svelte": je,
|
|
192
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/signup/+page.ts": Pe,
|
|
193
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/signup/form.remote.ts": qe,
|
|
194
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/signup/server.test.ts": nt,
|
|
195
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/welcome/+page.server.ts": Oe,
|
|
196
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/welcome/+page.svelte": Ce,
|
|
197
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/welcome/+page.ts": gt,
|
|
198
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/welcome/form.remote.ts": We,
|
|
199
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/welcome/next-url.ts": be,
|
|
200
|
+
"../../auth-remote/creates/src/routes/(public)/(auth)/welcome/server.test.ts": ut
|
|
201
|
+
}), "../../auth-remote/creates/")
|
|
202
|
+
}, q = G(/* #__PURE__ */ Object.assign({
|
|
203
|
+
"../originals/auth-1.1/base/src/lib/schemas/signup.ts": Pt,
|
|
204
|
+
"../originals/auth-1.1/base/src/routes/(public)/(auth)/signup/+page.server.ts": Ft,
|
|
205
|
+
"../originals/auth-1.1/base/src/routes/(public)/(auth)/signup/+page.svelte": It,
|
|
206
|
+
"../originals/auth-1.1/remote/src/lib/schemas/signup.ts": Lt,
|
|
207
|
+
"../originals/auth-1.1/remote/src/routes/(public)/(auth)/signup/+page.svelte": Rt,
|
|
208
|
+
"../originals/auth-1.1/remote/src/routes/(public)/(auth)/signup/form.remote.ts": zt,
|
|
209
|
+
"../originals/auth-1.1/split/src/routes/(public)/(auth)/signup/+page.svelte": Bt,
|
|
210
|
+
"../originals/auth-1.3/base/src/routes/(public)/(auth)/login/+page.server.ts": Vt,
|
|
211
|
+
"../originals/auth-1.3/base/src/routes/(public)/(auth)/signup/+page.server.ts": Ht,
|
|
212
|
+
"../originals/auth-1.3/remote/src/routes/(public)/(auth)/login/form.remote.ts": Ut,
|
|
213
|
+
"../originals/auth-1.3/remote/src/routes/(public)/(auth)/signup/form.remote.ts": Wt,
|
|
214
|
+
"../originals/whatsapp-1.0/base/src/routes/(public)/(auth)/login/+page.server.ts": Gt,
|
|
215
|
+
"../originals/whatsapp-1.0/base/src/routes/(public)/(auth)/signup/+page.server.ts": Kt,
|
|
216
|
+
"../originals/whatsapp-1.0/remote/src/routes/(public)/(auth)/login/form.remote.ts": qt,
|
|
217
|
+
"../originals/whatsapp-1.0/remote/src/routes/(public)/(auth)/signup/form.remote.ts": Jt
|
|
218
|
+
}), "../originals/");
|
|
219
|
+
function J(e) {
|
|
220
|
+
let t = /* @__PURE__ */ new Map();
|
|
221
|
+
for (let [n, r] of Object.entries(q)) {
|
|
222
|
+
let i = n.slice(0, n.indexOf("/"));
|
|
223
|
+
if (!i.startsWith(`${e}-`)) continue;
|
|
224
|
+
let a = t.get(i) ?? {};
|
|
225
|
+
a[n.slice(i.length + 1)] = r, t.set(i, a);
|
|
226
|
+
}
|
|
227
|
+
return [...t.values()];
|
|
228
|
+
}
|
|
229
|
+
var Y = {
|
|
230
|
+
stock: J("auth"),
|
|
231
|
+
whatsapp: J("whatsapp")
|
|
232
|
+
}, cn = G(/* #__PURE__ */ Object.assign({
|
|
233
|
+
"../templates/base/src/lib/schemas/login.ts": $e,
|
|
234
|
+
"../templates/base/src/lib/schemas/signup.ts": he,
|
|
235
|
+
"../templates/base/src/routes/(public)/(auth)/login/+page.server.ts": Le,
|
|
236
|
+
"../templates/base/src/routes/(public)/(auth)/login/+page.svelte": st,
|
|
237
|
+
"../templates/base/src/routes/(public)/(auth)/signup/+page.server.ts": Xe,
|
|
238
|
+
"../templates/base/src/routes/(public)/(auth)/signup/+page.svelte": pt,
|
|
239
|
+
"../templates/remote/src/lib/schemas/login.ts": Yt,
|
|
240
|
+
"../templates/remote/src/lib/schemas/signup.ts": Xt,
|
|
241
|
+
"../templates/remote/src/routes/(public)/(auth)/login/+page.server.ts": Zt,
|
|
242
|
+
"../templates/remote/src/routes/(public)/(auth)/login/+page.svelte": Qt,
|
|
243
|
+
"../templates/remote/src/routes/(public)/(auth)/login/form.remote.ts": $t,
|
|
244
|
+
"../templates/remote/src/routes/(public)/(auth)/signup/+page.server.ts": en,
|
|
245
|
+
"../templates/remote/src/routes/(public)/(auth)/signup/+page.svelte": tn,
|
|
246
|
+
"../templates/remote/src/routes/(public)/(auth)/signup/form.remote.ts": nn,
|
|
247
|
+
"../templates/split/src/routes/(public)/(auth)/login/+page.svelte": rn,
|
|
248
|
+
"../templates/split/src/routes/(public)/(auth)/signup/+page.svelte": an
|
|
249
|
+
}), "../templates/"), X = /["']whatsapp["']|whatsappAuthMethod|requestWhatsAppOTP/, Z = "src/routes/(public)/(auth)";
|
|
250
|
+
function ln(e) {
|
|
251
|
+
let t = (t) => [
|
|
252
|
+
`${Z}/${t}/+page.svelte`,
|
|
253
|
+
`${Z}/${t}/+page.server.ts`,
|
|
254
|
+
...e === "remote" ? [`${Z}/${t}/form.remote.ts`] : [],
|
|
255
|
+
`src/lib/schemas/${t}.ts`
|
|
256
|
+
];
|
|
257
|
+
return {
|
|
258
|
+
login: t("login"),
|
|
259
|
+
signup: t("signup")
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function Q(e) {
|
|
263
|
+
return H.existsSync(U.join(e, Z, "login", "form.remote.ts")) ? "remote" : "superforms";
|
|
264
|
+
}
|
|
265
|
+
var un = {
|
|
266
|
+
superforms: ["base", "split"],
|
|
267
|
+
remote: ["remote"]
|
|
268
|
+
};
|
|
269
|
+
function $(e, t, n) {
|
|
270
|
+
return e[`${t}/${n}`] ?? (t === "split" ? e[`base/${n}`] : void 0);
|
|
271
|
+
}
|
|
272
|
+
function dn(e, t) {
|
|
273
|
+
return K[e][t] ?? (e === "split" ? K.base[t] : void 0);
|
|
274
|
+
}
|
|
275
|
+
function fn(e, t, n) {
|
|
276
|
+
let r = [], i = /* @__PURE__ */ new Set();
|
|
277
|
+
for (let a of un[e]) {
|
|
278
|
+
let e = $(cn, a, t), o = dn(a, t);
|
|
279
|
+
if (!e || !o) continue;
|
|
280
|
+
let [s, c, l] = n === "enable" ? [
|
|
281
|
+
o,
|
|
282
|
+
e,
|
|
283
|
+
Y.stock
|
|
284
|
+
] : [
|
|
285
|
+
e,
|
|
286
|
+
o,
|
|
287
|
+
Y.whatsapp
|
|
288
|
+
], u = [s, ...l.map((e) => $(e, a, t))];
|
|
289
|
+
for (let e of u) e && !i.has(e) && (i.add(e), r.push({
|
|
290
|
+
original: e,
|
|
291
|
+
template: c
|
|
292
|
+
}));
|
|
293
|
+
}
|
|
294
|
+
return r;
|
|
295
|
+
}
|
|
296
|
+
var pn = {
|
|
297
|
+
detect: (e) => e.includes("linkStripeCustomer"),
|
|
298
|
+
strip: (e) => e.replace(/^import \{ linkStripeCustomer \} from "#lib\/workflows\/link-stripe-customer\.js";\n/m, "").replace(/^[ \t]*\/\/ Queued here, done in the background[^\n]*\n[ \t]*\/\/ and the key means[^\n]*\n[ \t]*await linkStripeCustomer\.run\([\s\S]*?\n[ \t]*\);\n\n?/m, ""),
|
|
299
|
+
apply: jt
|
|
300
|
+
};
|
|
301
|
+
async function mn(e, t, n) {
|
|
302
|
+
let r = Q(e), i = t === "enable" ? X : RegExp(`^(?![\\s\\S]*(${X.source}))`), a = /* @__PURE__ */ new Map();
|
|
303
|
+
for (let o of Object.values(ln(r))) {
|
|
304
|
+
let s = await Promise.all(o.map((n) => on(U.join(e, n), fn(r, n, t), i, n.endsWith("signup/+page.server.ts") ? [pn] : [])));
|
|
305
|
+
for (let [e, t] of sn(s, n)) a.set(e, t);
|
|
306
|
+
}
|
|
307
|
+
return a;
|
|
308
|
+
}
|
|
309
|
+
export { Q as detectMode, mn as swapAuthPages };
|
|
310
|
+
|
|
311
|
+
//# sourceMappingURL=auth-pages-DSBqKjO0.js.map
|