import { m as $e, F as Er, c as Rr, a as Pr, b as Mr, P as _e, d as ur, e as Ue, f as Ar, u as br, g as Ne, h as Lr, i as Ie, _ as Br, j as xr, k as fr, s as Dr, l as Tr, v as Or, n as Fr, E as Nr, o as je, B as fe, T as Ee, p as Re, q as Ae, r as He, t as Ye, w as qe, x as Ze, y as Je, z as Xe, C as Qe, D as Vr, G as pr, S as gr, H as mr, I as Wr, J as Kr, K as Ve, L as zr, M as Gr, N as Ur, __tla as __tla_0 } from "./App-BLnEEK_h.js";
import { g as he, c as e, m as le, h as yr, b as h, j as z, k as Fe, a as Le, l as wr, u as $r, e as i, n as jr, p as te, t as n, o as er, i as t, L as rr, f as ne, q as re, F as Pe, v as Oe } from "./Logo1am-CaBWyNpM.js";
import { s as tr, P as nr } from "./request-fingerprint-BANtRL63.js";
import { v as Hr, w as Yr, __tla as __tla_1 } from "./cardano-e2kMgYtl.js";
let Pn, Mn, An;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    var qr = {};
    Br(qr, {
        Description: ()=>fr,
        ErrorMessage: ()=>xr,
        Item: ()=>sr,
        ItemControl: ()=>or,
        ItemDescription: ()=>kr,
        ItemIndicator: ()=>lr,
        ItemInput: ()=>ir,
        ItemLabel: ()=>dr,
        Label: ()=>Sr,
        RadioGroup: ()=>Zr,
        Root: ()=>cr,
        useRadioGroupContext: ()=>ar
    });
    var _r = wr();
    function ar() {
        const r = $r(_r);
        if (r === void 0) throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");
        return r;
    }
    var Cr = wr();
    function Be() {
        const r = $r(Cr);
        if (r === void 0) throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");
        return r;
    }
    function sr(r) {
        const a = br(), o = ar(), l = `${a.generateId("item")}-${yr()}`, d = $e({
            id: l
        }, r), [c, s] = he(d, [
            "value",
            "disabled",
            "onPointerDown"
        ]), [v, y] = h(), [f, I] = h(), [R, T] = h(), [A, k] = h(), [g, u] = h(!1), $ = z(()=>o.isDefaultValue(c.value)), M = z(()=>o.isSelectedValue(c.value)), G = z(()=>c.disabled || a.isDisabled() || !1), J = (ue)=>{
            Ie(ue, c.onPointerDown), g() && ue.preventDefault();
        }, X = z(()=>({
                ...a.dataset(),
                "data-disabled": G() ? "" : void 0,
                "data-checked": M() ? "" : void 0
            })), ce = {
            value: ()=>c.value,
            dataset: X,
            isDefault: $,
            isSelected: M,
            isDisabled: G,
            inputId: v,
            labelId: f,
            descriptionId: R,
            inputRef: A,
            select: ()=>o.setSelectedValue(c.value),
            generateId: Lr(()=>s.id),
            registerInput: Ne(y),
            registerLabel: Ne(I),
            registerDescription: Ne(T),
            setIsFocused: u,
            setInputRef: k
        };
        return e(Cr.Provider, {
            value: ce,
            get children () {
                return e(_e, le({
                    as: "div",
                    role: "group",
                    onPointerDown: J
                }, X, s));
            }
        });
    }
    function or(r) {
        const a = Be(), o = $e({
            id: a.generateId("control")
        }, r), [l, d] = he(o, [
            "onClick",
            "onKeyDown"
        ]);
        return e(_e, le({
            as: "div",
            onClick: (v)=>{
                Ie(v, l.onClick), a.select(), a.inputRef()?.focus();
            },
            onKeyDown: (v)=>{
                Ie(v, l.onKeyDown), v.key === Nr.Space && (a.select(), a.inputRef()?.focus());
            }
        }, ()=>a.dataset(), d));
    }
    function kr(r) {
        const a = Be(), o = $e({
            id: a.generateId("description")
        }, r);
        return Fe(()=>Le(a.registerDescription(o.id))), e(_e, le({
            as: "div"
        }, ()=>a.dataset(), o));
    }
    function lr(r) {
        const a = Be(), o = $e({
            id: a.generateId("indicator")
        }, r), [l, d] = he(o, [
            "ref",
            "forceMount"
        ]), [c, s] = h(), { present: v } = Dr({
            show: ()=>l.forceMount || a.isSelected(),
            element: ()=>c() ?? null
        });
        return e(i, {
            get when () {
                return v();
            },
            get children () {
                return e(_e, le({
                    as: "div",
                    ref (y) {
                        var f = Ue(s, l.ref);
                        typeof f == "function" && f(y);
                    }
                }, ()=>a.dataset(), d));
            }
        });
    }
    function ir(r) {
        const a = br(), o = ar(), l = Be(), d = $e({
            id: l.generateId("input")
        }, r), [c, s] = he(d, [
            "ref",
            "style",
            "aria-labelledby",
            "aria-describedby",
            "onChange",
            "onFocus",
            "onBlur"
        ]), v = ()=>[
                c["aria-labelledby"],
                l.labelId(),
                c["aria-labelledby"] != null && s["aria-label"] != null ? s.id : void 0
            ].filter(Boolean).join(" ") || void 0, y = ()=>[
                c["aria-describedby"],
                l.descriptionId(),
                o.ariaDescribedBy()
            ].filter(Boolean).join(" ") || void 0, [f, I] = h(!1), R = (k)=>{
            if (Ie(k, c.onChange), k.stopPropagation(), !f()) {
                o.setSelectedValue(l.value());
                const g = k.target;
                g.checked = l.isSelected();
            }
            I(!1);
        }, T = (k)=>{
            Ie(k, c.onFocus), l.setIsFocused(!0);
        }, A = (k)=>{
            Ie(k, c.onBlur), l.setIsFocused(!1);
        };
        return Fe(jr([
            ()=>l.isSelected(),
            ()=>l.value()
        ], (k)=>{
            if (!k[0] && k[1] === l.value()) return;
            I(!0);
            const g = l.inputRef();
            g?.dispatchEvent(new Event("input", {
                bubbles: !0,
                cancelable: !0
            })), g?.dispatchEvent(new Event("change", {
                bubbles: !0,
                cancelable: !0
            }));
        }, {
            defer: !0
        })), Fe(()=>Le(l.registerInput(s.id))), e(_e, le({
            as: "input",
            ref (k) {
                var g = Ue(l.setInputRef, c.ref);
                typeof g == "function" && g(k);
            },
            type: "radio",
            get name () {
                return a.name();
            },
            get value () {
                return l.value();
            },
            get checked () {
                return l.isSelected();
            },
            get required () {
                return a.isRequired();
            },
            get disabled () {
                return l.isDisabled();
            },
            get readonly () {
                return a.isReadOnly();
            },
            get style () {
                return Tr({
                    ...Or
                }, c.style);
            },
            get "aria-labelledby" () {
                return v();
            },
            get "aria-describedby" () {
                return y();
            },
            onChange: R,
            onFocus: T,
            onBlur: A
        }, ()=>l.dataset(), s));
    }
    function dr(r) {
        const a = Be(), o = $e({
            id: a.generateId("label")
        }, r);
        return Fe(()=>Le(a.registerLabel(o.id))), e(_e, le({
            as: "label",
            get for () {
                return a.inputId();
            }
        }, ()=>a.dataset(), o));
    }
    function Sr(r) {
        return e(Fr, le({
            as: "span"
        }, r));
    }
    function cr(r) {
        let a;
        const o = `radiogroup-${yr()}`, l = $e({
            id: o,
            orientation: "vertical"
        }, r), [d, c, s] = he(l, [
            "ref",
            "value",
            "defaultValue",
            "onChange",
            "orientation",
            "aria-labelledby",
            "aria-describedby"
        ], Er), [v, y] = Rr({
            value: ()=>d.value,
            defaultValue: ()=>d.defaultValue,
            onChange: (u)=>d.onChange?.(u)
        }), { formControlContext: f } = Pr(c);
        Mr(()=>a, ()=>y(d.defaultValue ?? ""));
        const I = ()=>f.getAriaLabelledBy(ur(c.id), s["aria-label"], d["aria-labelledby"]), R = ()=>f.getAriaDescribedBy(d["aria-describedby"]), T = (u)=>u === r.defaultValue, A = (u)=>u === v(), g = {
            ariaDescribedBy: R,
            isDefaultValue: T,
            isSelectedValue: A,
            setSelectedValue: (u)=>{
                if (!(f.isReadOnly() || f.isDisabled()) && (y(u), a)) for (const $ of a.querySelectorAll("[type='radio']")){
                    const M = $;
                    M.checked = A(M.value);
                }
            }
        };
        return e(Ar.Provider, {
            value: f,
            get children () {
                return e(_r.Provider, {
                    value: g,
                    get children () {
                        return e(_e, le({
                            as: "div",
                            ref (u) {
                                var $ = Ue((M)=>a = M, d.ref);
                                typeof $ == "function" && $(u);
                            },
                            role: "radiogroup",
                            get id () {
                                return ur(c.id);
                            },
                            get "aria-invalid" () {
                                return f.validationState() === "invalid" || void 0;
                            },
                            get "aria-required" () {
                                return f.isRequired() || void 0;
                            },
                            get "aria-disabled" () {
                                return f.isDisabled() || void 0;
                            },
                            get "aria-readonly" () {
                                return f.isReadOnly() || void 0;
                            },
                            get "aria-orientation" () {
                                return d.orientation;
                            },
                            get "aria-labelledby" () {
                                return I();
                            },
                            get "aria-describedby" () {
                                return R();
                            }
                        }, ()=>f.dataset(), s));
                    }
                });
            }
        });
    }
    var Zr = Object.assign(cr, {
        Description: fr,
        ErrorMessage: xr,
        Item: sr,
        ItemControl: or,
        ItemDescription: kr,
        ItemIndicator: lr,
        ItemInput: ir,
        ItemLabel: dr,
        Label: Sr
    }), Jr = n('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="size-2.5 fill-current text-current"><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0">');
    const ze = (r)=>{
        const [a, o] = he(r, [
            "class"
        ]);
        return e(cr, le({
            get class () {
                return je("grid gap-2", a.class);
            }
        }, o));
    }, ye = (r)=>{
        const [a, o] = he(r, [
            "class",
            "children"
        ]);
        return e(sr, le({
            get class () {
                return je("flex items-center space-x-2", a.class);
            }
        }, o, {
            get children () {
                return [
                    e(ir, {}),
                    e(or, {
                        class: "aspect-square size-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-[1px] focus-visible:ring-ring focus-visible:ring-offset-[1px] disabled:cursor-not-allowed disabled:opacity-50",
                        get children () {
                            return e(lr, {
                                class: "flex h-full items-center justify-center ",
                                get children () {
                                    return Jr();
                                }
                            });
                        }
                    }),
                    te(()=>a.children)
                ];
            }
        }));
    }, we = (r)=>{
        const [a, o] = he(r, [
            "class"
        ]);
        return e(dr, le({
            get class () {
                return je("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", a.class);
            }
        }, o));
    };
    function Ge(r) {
        const a = [];
        let o = 0;
        if (r.length === 0) return {
            score: 0,
            label: "",
            isAcceptable: !1,
            feedback: []
        };
        r.length < 8 ? a.push("At least 8 characters required") : o += 2;
        const l = /[a-z]/.test(r), d = /[A-Z]/.test(r), c = /[0-9]/.test(r), s = /[^a-zA-Z0-9]/.test(r), v = [
            l,
            d,
            c,
            s
        ].filter(Boolean).length;
        v >= 3 ? o += 2 : v >= 2 && (o += 1), !d && !s && a.push("Add uppercase letters or special characters"), c || a.push("Add a number");
        const y = r.toLowerCase();
        [
            "password",
            "12345678",
            "qwerty",
            "letmein",
            "welcome",
            "monkey",
            "dragon",
            "master"
        ].some((T)=>y.includes(T)) && (o = Math.max(0, o - 2), a.push("Avoid common passwords")), /(.)\1{3,}/.test(r) && (o = Math.max(0, o - 1), a.push("Avoid repeated characters"));
        const I = Math.min(4, Math.max(0, o));
        return {
            score: I,
            label: [
                "Very weak",
                "Weak",
                "Fair",
                "Good",
                "Strong"
            ][I],
            isAcceptable: r.length >= 8 && I >= 2,
            feedback: a
        };
    }
    var Xr = n('<div class="font-medium text-foreground">Preview Network'), Qr = n('<div class="type-text-sm text-content-muted">Test network for development'), We = n('<label class="flex items-center gap-4 rounded-lg border border-[var(--border-primary)] p-4 transition-colors hover:border-[var(--fg-quaternary-hover)] cursor-pointer">'), et = n('<div class="font-medium text-foreground">Preprod Network'), rt = n('<div class="type-text-sm text-content-muted">Pre-production network'), tt = n('<div class="font-medium text-foreground">Mainnet'), nt = n('<div class="type-text-sm text-content-muted">Coming soon'), at = n('<label class="flex items-center gap-4 rounded-lg border border-[var(--border-primary)] p-4 opacity-50 cursor-not-allowed">'), st = n('<div class="bg-[var(--bg-primary)] rounded-none p-6"><h2 class="type-text-lg font-semibold text-foreground mb-1">Select Network</h2><p class="type-text-sm text-content-muted mb-6">Choose which network you want to connect to.'), ot = n('<div class="font-medium text-foreground">24-Word Recovery Phrase'), lt = n('<div class="type-text-sm text-content-muted">Industry standard BIP-39 mnemonic phrase'), it = n('<div class="bg-[var(--bg-primary)] rounded-none p-6"><h2 class="type-text-lg font-semibold text-foreground mb-1">Recovery Method</h2><p class="type-text-sm text-content-muted mb-6">Select how you want to backup and recover your wallet.'), dt = n('<svg class="w-4 h-4 mr-2 text-[var(--fg-success-secondary)]"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M20 6 9 17l-5-5">'), ct = n('<div class="type-text-xs text-[var(--text-warning-primary)] text-center mb-3">Clipboard will be cleared in <!>s'), ut = n('<div class="bg-[var(--bg-primary)] rounded-none p-6"><h2 class="type-text-lg font-semibold text-foreground mb-1">Your Recovery Phrase</h2><p class="type-text-sm text-content-muted mb-4">Write down these 24 words in order and store them safely. Never share them with anyone.</p><div class="p-3 rounded-none bg-[var(--bg-warning-primary)] border border-[color:color-mix(in_srgb,var(--warning-foreground)_30%,transparent)] mb-5"><div class="flex items-start gap-3"><svg class="w-4 h-4 text-[var(--fg-warning-primary)] shrink-0 mt-0.5"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M12 9v4M12 17h.01M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path></svg><div class="type-text-sm uppercase tracking-wide text-[var(--text-warning-primary)]"><strong>THIS IS THE ONLY WAY TO RECOVER YOUR WALLET.</strong> IF YOU LOSE THIS PHRASE, YOUR FUNDS ARE GONE FOREVER. 1AM CANNOT RECOVER IT FOR YOU. NO ONE CAN.</div></div></div><div class="type-text-xs rounded-none border border-[var(--border-secondary)] bg-[var(--bg-secondary-subtle)] px-3 py-2 uppercase tracking-wide text-[var(--text-tertiary)] mb-3">DO NOT SCREENSHOT OR SCREEN-RECORD THIS PAGE. WRITE THESE WORDS DOWN ON PAPER AND STORE THEM SECURELY.</div><div class="grid grid-cols-3 gap-3 mb-5"></div><label class="flex items-start gap-3 rounded-none border border-[var(--border-primary)] p-4 transition-colors hover:border-[var(--fg-quaternary-hover)] cursor-pointer"><div class=mt-0.5><input type=checkbox class="h-4 w-4 rounded border-input text-foreground focus:ring-foreground"></div><div><div class="type-text-sm font-medium text-foreground">I have saved my recovery phrase</div><div class="type-text-xs text-content-muted mt-0.5">I understand that if I lose this phrase, I will permanently lose access to my wallet and all funds in it.'), pt = n('<svg class="w-4 h-4"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><rect x=9 y=9 width=13 height=13 rx=2></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1">'), gt = n('<div class="p-3 rounded-none bg-[var(--bg-success-primary)] border border-[color:color-mix(in_srgb,var(--success-foreground)_30%,transparent)] flex items-center gap-2"><svg class="w-4 h-4 text-[var(--fg-success-secondary)]"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M20 6 9 17l-5-5"></path></svg><span class="type-text-sm text-[var(--text-success-primary)]">All words match! Set a password to finish.'), mt = n(`<div class="p-3 rounded-none bg-[var(--bg-error-primary)] border border-[var(--border-error-subtle)] flex items-center gap-2"><svg class="w-4 h-4 text-[var(--fg-error-secondary)]"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M18 6 6 18M6 6l12 12"></path></svg><span class="type-text-sm text-[var(--text-error-primary)]">Some words don't match. Please check and try again.`), ht = n('<div class="bg-[var(--bg-primary)] rounded-none px-6 pb-5 pt-3"><h2 class="type-text-lg font-semibold text-foreground mb-0.5">Confirm Your Phrase</h2><p class="type-text-sm text-[var(--text-tertiary)] mb-3">Paste your 24 words to confirm you saved them.</p><div class="grid grid-cols-3 gap-2 mb-5">'), vt = n(`<div class="p-3 rounded-none bg-[var(--bg-error-primary)] border border-[var(--border-error-subtle)] flex items-center gap-2 mb-3"><svg class="w-4 h-4 text-[var(--fg-error-secondary)] shrink-0"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M18 6 6 18M6 6l12 12"></path></svg><span class="type-text-sm text-[var(--text-error-primary)]">Passwords don't match`), bt = n('<div class="p-3 rounded-none bg-[var(--bg-warning-primary)] border border-[color:color-mix(in_srgb,var(--warning-foreground)_30%,transparent)] flex items-center gap-2 mb-3"><svg class="w-4 h-4 text-[var(--fg-warning-primary)] shrink-0"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M12 9v4M12 17h.01M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path></svg><span class="type-text-sm text-[var(--text-warning-primary)]">Passwords match, but you still need at least 8 characters and a stronger mix of characters before you can create the wallet.'), xt = n('<div class="p-3 rounded-none bg-[var(--bg-success-primary)] border border-[color:color-mix(in_srgb,var(--success-foreground)_30%,transparent)] flex items-center gap-2 mb-3"><svg class="w-4 h-4 text-[var(--fg-success-secondary)]"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M20 6 9 17l-5-5"></path></svg><span class="type-text-sm text-[var(--text-success-primary)]">Password set! Click "Create Wallet" to finish.'), ft = n(`<div class="bg-[var(--bg-primary)] rounded-none p-6"><h2 class="type-text-lg font-semibold text-foreground mb-1">Set Password</h2><p class="type-text-sm text-content-muted mb-5">Choose a strong password to encrypt your wallet. You'll need this each time you open the extension.</p><div class="space-y-3 mb-5"></div><div class="p-3 rounded-none bg-[var(--bg-warning-primary)] border border-[color:color-mix(in_srgb,var(--warning-foreground)_30%,transparent)]"><div class="flex items-start gap-2"><svg class="w-4 h-4 text-[var(--fg-warning-primary)] shrink-0 mt-0.5"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M12 9v4M12 17h.01M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path></svg><span class="type-text-xs text-[var(--text-warning-primary)]">If you forget this password, you can only recover using your seed phrase.`), yt = n('<svg class="w-4 h-4"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M19 12H5M12 19l-7-7 7-7">'), wt = n('<svg class="w-4 h-4"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M5 12h14M12 5l7 7-7 7">'), $t = n('<div class="relative flex min-h-screen flex-col bg-background"><div class="absolute inset-0 opacity-[0.08]"style="background-image:linear-gradient(color-mix(in srgb, var(--border-secondary) 72%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--border-secondary) 72%, transparent) 1px, transparent 1px);background-size:40px 40px"></div><header class="relative z-10 flex-none h-20 bg-header border-b border-header-border"><div class="h-full max-w-6xl mx-auto px-6 border-x border-header-divider flex items-center justify-between"><div class="flex items-center gap-4"><span class="type-text-xs uppercase tracking-[0.24em] text-header-muted">CREATE WALLET</span></div><div class="hidden md:flex items-center gap-3 text-[10px] font-semibold uppercase tracking-[0.22em] text-header-muted"></div></div></header><main class="relative z-10 flex flex-1 overflow-y-auto px-6"><div class="w-full max-w-6xl mx-auto self-stretch border-x border-[var(--border-secondary)]"><div class="w-full px-0 py-6 md:py-8"><div class="max-w-3xl mx-auto border border-[var(--border-secondary)] bg-[var(--bg-primary)]"><div class="border-b border-[var(--border-secondary)] px-5 py-3.5"><div class="flex items-center gap-2"></div></div><div class="px-5 pb-5 pt-4 md:px-5 md:pb-5 md:pt-4"></div><div class="border-t border-[var(--border-secondary)] px-5 py-3.5"><div class="flex justify-between gap-4"></div><div class="mt-3 text-center"><p class="text-[11px] text-content-muted-light">Need help? <a href=mailto:team@1am.xyz class="underline transition-colors hover:text-content-muted">team@1am.xyz'), hr = n("<div>"), _t = n('<svg class="w-3.5 h-3.5"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2.5><path d="M20 6 9 17l-5-5">'), Ct = n('<div class="flex items-center gap-2"><div></div><span>'), kt = n('<div class="type-text-sm flex items-center gap-2 rounded-none border border-[var(--border-primary)] bg-[var(--bg-secondary)] px-3 py-2"><span class="type-text-xs w-6 text-right text-content-muted-light">.</span><span class="font-mono font-medium text-foreground">'), St = n('<svg class="w-4 h-4 mr-2"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><rect x=9 y=9 width=13 height=13 rx=2 ry=2></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1">'), It = n('<div class="flex items-center gap-1.5"><span class="type-text-xs w-5 text-right text-content-muted-light">.'), Et = n('<span class="type-text-xs text-content-muted">'), Rt = n('<div class=mb-3><div class="flex gap-1 mb-1.5"></div><div class="flex items-center justify-between"><span>'), Pt = n('<div class="w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin">');
    function Mt() {
        const r = new Set;
        for(; r.size < 4;){
            const a = new Uint32Array(1);
            crypto.getRandomValues(a), r.add(a[0] % 24);
        }
        return Array.from(r).sort((a, o)=>a - o);
    }
    Pn = ()=>{
        const [r, a] = h(2), [o, l] = h("mainnet"), [d, c] = h("24-word");
        let s = [];
        const [v, y] = h([]), [f, I] = h(!1), [R, T] = h(""), [A, k] = h(""), [g, u] = h(!1), [$, M] = h(!1), [G, J] = h(Array(24).fill("")), X = z(()=>{
            const m = G();
            return s.length !== 24 ? !1 : m.every((B, p)=>B.trim().toLowerCase() === s[p]?.toLowerCase());
        }), [ce, ue] = h([]), [Ce, ke] = h({}), _ = ()=>{
            s = Vr(), y([
                ...s
            ]);
        };
        z(()=>{
            const m = ce(), B = Ce();
            return m.length !== 4 || s.length !== 24 ? !1 : m.every((p)=>{
                const C = B[p], w = s[p];
                if (!C || !w || C.trim().length === 0) return !1;
                const D = new TextEncoder().encode(C.toLowerCase().trim()), F = new TextEncoder().encode(w.toLowerCase());
                if (D.length !== F.length) return !1;
                let b = 0;
                for(let E = 0; E < D.length; E++)b |= D[E] ^ F[E];
                return b === 0;
            });
        });
        const W = z(()=>Ge(R())), O = z(()=>W().isAcceptable && R() === A()), [K, Y] = h(0);
        let L = null;
        const ae = async ()=>{
            try {
                await navigator.clipboard.writeText(s.join(" "));
            } catch  {
                return;
            }
            I(!0), Y(60), setTimeout(()=>I(!1), 2e3), L && clearInterval(L), L = setInterval(()=>{
                Y((m)=>m <= 1 ? (L && clearInterval(L), L = null, navigator.clipboard.writeText("").catch(()=>{}), 0) : m - 1);
            }, 1e3);
        }, H = (m)=>{
            m.key === "Enter" && pe() && !g() && (m.preventDefault(), ve());
        };
        er(()=>{
            window.addEventListener("keydown", H), _();
        }), Le(()=>{
            window.removeEventListener("keydown", H), L && (clearInterval(L), L = null, navigator.clipboard.writeText("").catch(()=>{})), s.fill(""), s = [], y([]);
        });
        const pe = z(()=>{
            switch(r()){
                case 0:
                    return o() !== null;
                case 1:
                    return d() !== null;
                case 2:
                    return v().length === 24 && $();
                case 3:
                    return X();
                case 4:
                    return O();
                default:
                    return !1;
            }
        }), ve = ()=>{
            if (r() === 2 && (ue(Mt()), ke({})), r() === 3 && (y([]), ke({})), r() === 4 && O()) {
                Me();
                return;
            }
            a((m)=>Math.min(m + 1, 4));
        }, be = ()=>{
            if (r() <= 2) {
                window.location.href = Ae.runtime.getURL("/fullpage.html?mode=welcome");
                return;
            }
            a((m)=>m - 1);
        }, Me = async ()=>{
            u(!0);
            try {
                if (await He() === "locked" && !window.confirm(`A wallet already exists. Creating a new one will PERMANENTLY REPLACE it. Make sure you have your existing recovery phrase backed up.

Continue?`)) {
                    u(!1);
                    return;
                }
                const B = s.join(" "), p = Ye(B), C = qe(p, 0), w = {
                    seed: p,
                    nightExternalKey: Buffer.from(C.nightExternalKey).toString("base64"),
                    zswapKeys: Buffer.from(C.zswapKeys).toString("base64"),
                    dustKeys: Buffer.from(C.dustKeys).toString("base64"),
                    wallets: [
                        {
                            id: 0,
                            seed: p,
                            mnemonic: B
                        }
                    ],
                    mnemonic: B,
                    walletKind: "password"
                };
                await tr({
                    environment: o(),
                    proofServerUrl: nr.proofstation.url,
                    dustSponsorship: !0,
                    proofServerMode: "proofstation",
                    sidePanelEnabled: !1,
                    showDropdownAddresses: !1,
                    cardanoEnabled: !0
                });
                const D = new TextEncoder().encode(R());
                T(""), k(""), await Ze(D, w), await Je({
                    wallets: [
                        {
                            id: 0,
                            name: "Wallet 1",
                            accounts: [
                                {
                                    index: 0,
                                    name: "Account 1"
                                }
                            ],
                            activeAccountIndex: 0,
                            nextAccountIndex: 1
                        }
                    ],
                    activeId: 0,
                    nextId: 1,
                    walletKind: "password"
                });
                const { key: F, salt: b } = await Xe(D);
                await Qe(F, b), D.fill(0), s.fill(""), s = [], y([]), window.location.href = Ae.runtime.getURL("/fullpage.html");
            } catch  {
                u(!1);
            }
        }, se = [
            "Backup",
            "Verify",
            "Password"
        ];
        return (()=>{
            var m = $t(), B = m.firstChild, p = B.nextSibling, C = p.firstChild, w = C.firstChild, D = w.firstChild, F = p.nextSibling, b = F.firstChild, E = b.firstChild, Q = E.firstChild, ge = Q.firstChild, Se = ge.firstChild, q = ge.nextSibling, De = q.nextSibling, xe = De.firstChild;
            return t(w, e(rr, {
                class: "h-8 w-auto",
                animated: !0
            }), D), t(Se, e(Pe, {
                each: se,
                children: (x, N)=>{
                    const S = ()=>r() - 2;
                    return [
                        e(i, {
                            get when () {
                                return N() > 0;
                            },
                            get children () {
                                var Z = hr();
                                return ne(()=>re(Z, `flex-1 h-px ${N() <= S() ? "bg-[var(--bg-primary-solid)]" : "bg-[var(--border-primary)]"}`)), Z;
                            }
                        }),
                        (()=>{
                            var Z = Ct(), V = Z.firstChild, P = V.nextSibling;
                            return t(V, e(i, {
                                get when () {
                                    return N() < S();
                                },
                                get fallback () {
                                    return N() + 1;
                                },
                                get children () {
                                    return _t();
                                }
                            })), t(P, x), ne((U)=>{
                                var de = `w-7 h-7 rounded-full flex items-center justify-center type-text-xs font-medium ${N() < S() || N() === S() ? "bg-[var(--bg-primary-solid)] text-[var(--fg-white)]" : "bg-[var(--bg-secondary)] text-content-muted-light border border-[var(--border-primary)]"}`, ie = `type-text-xs uppercase tracking-wide hidden sm:inline ${N() <= S() ? "text-[var(--text-primary)] font-medium" : "text-content-muted-light"}`;
                                return de !== U.e && re(V, U.e = de), ie !== U.t && re(P, U.t = ie), U;
                            }, {
                                e: void 0,
                                t: void 0
                            }), Z;
                        })()
                    ];
                }
            })), t(q, e(i, {
                get when () {
                    return r() === 0;
                },
                get children () {
                    var x = st(), N = x.firstChild;
                    return N.nextSibling, t(x, e(ze, {
                        get value () {
                            return o();
                        },
                        onChange: l,
                        class: "space-y-3",
                        get children () {
                            return [
                                (()=>{
                                    var S = We();
                                    return t(S, e(ye, {
                                        value: "preview",
                                        get children () {
                                            return e(we, {
                                                class: "flex-1 cursor-pointer",
                                                get children () {
                                                    return [
                                                        Xr(),
                                                        Qr()
                                                    ];
                                                }
                                            });
                                        }
                                    })), S;
                                })(),
                                (()=>{
                                    var S = We();
                                    return t(S, e(ye, {
                                        value: "preprod",
                                        get children () {
                                            return e(we, {
                                                class: "flex-1 cursor-pointer",
                                                get children () {
                                                    return [
                                                        et(),
                                                        rt()
                                                    ];
                                                }
                                            });
                                        }
                                    })), S;
                                })(),
                                (()=>{
                                    var S = at();
                                    return t(S, e(ye, {
                                        value: "mainnet",
                                        disabled: !0,
                                        get children () {
                                            return e(we, {
                                                class: "flex-1",
                                                get children () {
                                                    return [
                                                        tt(),
                                                        nt()
                                                    ];
                                                }
                                            });
                                        }
                                    })), S;
                                })()
                            ];
                        }
                    }), null), x;
                }
            }), null), t(q, e(i, {
                get when () {
                    return r() === 1;
                },
                get children () {
                    var x = it(), N = x.firstChild;
                    return N.nextSibling, t(x, e(ze, {
                        get value () {
                            return d();
                        },
                        onChange: c,
                        class: "space-y-3",
                        get children () {
                            var S = We();
                            return t(S, e(ye, {
                                value: "24-word",
                                get children () {
                                    return e(we, {
                                        class: "flex-1 cursor-pointer",
                                        get children () {
                                            return [
                                                ot(),
                                                lt()
                                            ];
                                        }
                                    });
                                }
                            })), S;
                        }
                    }), null), x;
                }
            }), null), t(q, e(i, {
                get when () {
                    return r() === 2;
                },
                get children () {
                    var x = ut(), N = x.firstChild, S = N.nextSibling, Z = S.nextSibling, V = Z.nextSibling, P = V.nextSibling, U = P.nextSibling, de = U.firstChild, ie = de.firstChild;
                    return t(P, e(Pe, {
                        get each () {
                            return v();
                        },
                        children: (j, ee)=>(()=>{
                                var oe = kt(), me = oe.firstChild, Te = me.firstChild, Ir = me.nextSibling;
                                return t(me, ()=>ee() + 1, Te), t(Ir, j), oe;
                            })()
                    })), t(x, e(fe, {
                        variant: "secondary",
                        class: "mb-5 w-full rounded-none border border-[var(--border-primary)]",
                        onClick: ae,
                        title: "Copy to clipboard",
                        "aria-label": "Copy to clipboard",
                        get children () {
                            return e(i, {
                                get when () {
                                    return f();
                                },
                                get fallback () {
                                    return [
                                        St(),
                                        "COPY TO CLIPBOARD"
                                    ];
                                },
                                get children () {
                                    return [
                                        dt(),
                                        "COPIED!"
                                    ];
                                }
                            });
                        }
                    }), U), t(x, e(i, {
                        get when () {
                            return K() > 0;
                        },
                        get children () {
                            var j = ct(), ee = j.firstChild, oe = ee.nextSibling;
                            return oe.nextSibling, t(j, K, oe), j;
                        }
                    }), U), ie.addEventListener("change", (j)=>M(j.currentTarget.checked)), ne(()=>ie.checked = $()), x;
                }
            }), null), t(q, e(i, {
                get when () {
                    return r() === 3;
                },
                get children () {
                    var x = ht(), N = x.firstChild, S = N.nextSibling, Z = S.nextSibling;
                    return t(Z, e(Pe, {
                        get each () {
                            return G();
                        },
                        children: (V, P)=>e(Ee, {
                                get children () {
                                    var U = It(), de = U.firstChild, ie = de.firstChild;
                                    return t(de, ()=>P() + 1, ie), t(U, e(Re, {
                                        type: "text",
                                        value: V,
                                        onInput: (j)=>{
                                            const ee = [
                                                ...G()
                                            ];
                                            ee[P()] = j.currentTarget.value, J(ee);
                                        },
                                        onPaste: (j)=>{
                                            const ee = j.clipboardData?.getData("text");
                                            if (ee) {
                                                const oe = ee.trim().split(/\s+/);
                                                oe.length === 24 && (j.preventDefault(), J(oe));
                                            }
                                        },
                                        get class () {
                                            return `h-11 py-0 rounded-none type-text-sm font-mono ${V.trim() ? V.trim().toLowerCase() === s[P()]?.toLowerCase() ? "bg-[var(--bg-success-primary)] border-[color:color-mix(in_srgb,var(--success-foreground)_30%,transparent)] text-[var(--text-primary)]" : "bg-[var(--bg-error-primary)] border-[var(--border-error-subtle)] text-[var(--text-primary)]" : "bg-bg-primary border-[var(--border-primary)] text-[var(--text-primary)]"}`;
                                        },
                                        get placeholder () {
                                            return `Word ${P() + 1}`;
                                        },
                                        autocomplete: "off",
                                        spellcheck: !1
                                    }), null), U;
                                }
                            })
                    })), t(x, e(fe, {
                        variant: "secondary",
                        class: "mb-4 w-full rounded-none border border-[var(--border-primary)]",
                        onClick: async ()=>{
                            const P = (await navigator.clipboard.readText()).trim().split(/\s+/);
                            P.length === 24 && J(P);
                        },
                        get children () {
                            return [
                                pt(),
                                "PASTE ALL 24 WORDS"
                            ];
                        }
                    }), null), t(x, e(i, {
                        get when () {
                            return X();
                        },
                        get children () {
                            return gt();
                        }
                    }), null), t(x, e(i, {
                        get when () {
                            return te(()=>!X())() && G().every((V)=>V.trim().length > 0);
                        },
                        get children () {
                            return mt();
                        }
                    }), null), x;
                }
            }), null), t(q, e(i, {
                get when () {
                    return r() === 4;
                },
                get children () {
                    var x = ft(), N = x.firstChild, S = N.nextSibling, Z = S.nextSibling, V = Z.nextSibling;
                    return t(Z, e(Ee, {
                        get value () {
                            return R();
                        },
                        onChange: T,
                        get children () {
                            return e(Re, {
                                type: "password",
                                placeholder: "Password (min 8 characters)",
                                class: "h-11 type-text-sm border-[var(--border-primary)] bg-[var(--bg-primary)] text-foreground placeholder:text-content-muted-light",
                                autofocus: !0
                            });
                        }
                    }), null), t(Z, e(Ee, {
                        get value () {
                            return A();
                        },
                        onChange: k,
                        get children () {
                            return e(Re, {
                                type: "password",
                                placeholder: "Confirm password",
                                class: "h-11 type-text-sm border-[var(--border-primary)] bg-[var(--bg-primary)] text-foreground placeholder:text-content-muted-light"
                            });
                        }
                    }), null), t(x, e(i, {
                        get when () {
                            return R().length > 0;
                        },
                        get children () {
                            return (()=>{
                                const P = W(), U = [
                                    "bg-[var(--bg-error-solid)]",
                                    "bg-[var(--fg-error-secondary)]",
                                    "bg-[var(--fg-warning-secondary)]",
                                    "bg-[var(--fg-success-secondary)]",
                                    "bg-[var(--bg-success-solid)]"
                                ], de = [
                                    "text-[var(--text-error-primary)]",
                                    "text-[var(--text-error-primary)]",
                                    "text-[var(--text-warning-primary)]",
                                    "text-[var(--text-success-primary)]",
                                    "text-[var(--text-success-primary)]"
                                ];
                                return (()=>{
                                    var ie = Rt(), j = ie.firstChild, ee = j.nextSibling, oe = ee.firstChild;
                                    return t(j, ()=>[
                                            0,
                                            1,
                                            2,
                                            3
                                        ].map((me)=>(()=>{
                                                var Te = hr();
                                                return ne(()=>re(Te, `h-1 flex-1 rounded-full ${me < P.score ? U[P.score] : "bg-[var(--border-primary)]"}`)), Te;
                                            })())), t(oe, ()=>P.label), t(ee, e(i, {
                                        get when () {
                                            return te(()=>!P.isAcceptable)() && P.feedback.length > 0;
                                        },
                                        get children () {
                                            var me = Et();
                                            return t(me, ()=>P.feedback[0]), me;
                                        }
                                    }), null), ne(()=>re(oe, `type-text-xs font-medium ${de[P.score]}`)), ie;
                                })();
                            })();
                        }
                    }), V), t(x, e(i, {
                        get when () {
                            return te(()=>A().length > 0)() && R() !== A();
                        },
                        get children () {
                            return vt();
                        }
                    }), V), t(x, e(i, {
                        get when () {
                            return te(()=>A().length > 0 && R() === A())() && !W().isAcceptable;
                        },
                        get children () {
                            return bt();
                        }
                    }), V), t(x, e(i, {
                        get when () {
                            return O();
                        },
                        get children () {
                            return xt();
                        }
                    }), V), x;
                }
            }), null), t(xe, e(fe, {
                variant: "outline",
                class: "h-12 rounded-none px-6 type-text-sm font-semibold text-fg-secondary hover:bg-bg-primary-hover hover:text-fg-primary",
                onClick: be,
                get children () {
                    return [
                        yt(),
                        "Back"
                    ];
                }
            }), null), t(xe, e(fe, {
                variant: "submit",
                size: "submit",
                class: "h-12 rounded-none px-8 normal-case tracking-normal",
                onClick: ve,
                get disabled () {
                    return !pe() || g();
                },
                get children () {
                    return e(i, {
                        get when () {
                            return !g();
                        },
                        get fallback () {
                            return [
                                Pt(),
                                "Creating..."
                            ];
                        },
                        get children () {
                            return [
                                te(()=>r() === 4 ? "Create Wallet" : "Continue"),
                                e(i, {
                                    get when () {
                                        return r() !== 4;
                                    },
                                    get children () {
                                        return wt();
                                    }
                                })
                            ];
                        }
                    });
                }
            }), null), m;
        })();
    };
    var At = n('<div class="font-medium text-foreground">Preview Network'), Lt = n('<div class="type-text-sm text-content-muted">Test network for development'), vr = n('<label class="flex items-center gap-4 rounded-lg border border-[var(--border-primary)] p-4 transition-colors hover:border-[var(--fg-quaternary-hover)] cursor-pointer">'), Bt = n('<div class="font-medium text-foreground">Preprod Network'), Dt = n('<div class="type-text-sm text-content-muted">Pre-production network'), Tt = n('<div class="font-medium text-foreground">Mainnet'), Ot = n('<div class="type-text-sm text-content-muted">Coming soon'), Ft = n('<label class="flex items-center gap-4 rounded-lg border border-[var(--border-primary)] p-4 opacity-50 cursor-not-allowed">'), Nt = n('<div class="bg-[var(--bg-primary)] rounded-none p-6"><h2 class="type-text-lg font-semibold text-foreground mb-1">Select Network</h2><p class="type-text-sm text-content-muted mb-6">Choose which network you want to connect to.'), Vt = n('<svg class="w-4 h-4 text-[var(--fg-success-secondary)]"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M20 6 9 17l-5-5">'), Wt = n('<span class="type-text-sm text-[var(--text-success-primary)]">Valid seed phrase! Set a password to continue.'), Ke = n("<div>"), Kt = n('<div class="p-3 rounded-none bg-[var(--bg-error-primary)] border border-[var(--border-error-subtle)] flex items-center gap-2"><svg class="w-4 h-4 text-[var(--fg-error-secondary)]"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M18 6 6 18M6 6l12 12"></path></svg><span class="type-text-sm text-[var(--text-error-primary)]">'), zt = n('<div class="bg-[var(--bg-primary)] rounded-none p-6"><h2 class="type-text-lg font-semibold text-foreground mb-1">Enter Your Recovery Phrase</h2><p class="type-text-sm text-content-muted mb-4">Enter the 24-word recovery phrase for the wallet you want to restore.</p><div class="p-3 rounded-none bg-[var(--bg-warning-primary)] border border-[color:color-mix(in_srgb,var(--warning-foreground)_30%,transparent)] mb-5"><div class="flex items-start gap-3"><svg class="w-4 h-4 text-[var(--fg-warning-primary)] shrink-0 mt-0.5"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M12 9v4M12 17h.01M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path></svg><span class="type-text-sm uppercase tracking-wide text-[var(--text-warning-primary)]">Never share your seed phrase with anyone. Make sure no one is watching your screen.</span></div></div><div class="grid grid-cols-3 gap-2 mb-5">'), Gt = n(`<div class="p-3 rounded-none bg-[var(--bg-error-primary)] border border-[var(--border-error-subtle)] flex items-center gap-2 mb-3"><svg class="w-4 h-4 text-[var(--fg-error-secondary)] shrink-0"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M18 6 6 18M6 6l12 12"></path></svg><span class="type-text-sm text-[var(--text-error-primary)]">Passwords don't match`), Ut = n('<div class="p-3 rounded-none bg-[var(--bg-warning-primary)] border border-[color:color-mix(in_srgb,var(--warning-foreground)_30%,transparent)] flex items-center gap-2 mb-3"><svg class="w-4 h-4 text-[var(--fg-warning-primary)] shrink-0"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M12 9v4M12 17h.01M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path></svg><span class="type-text-sm text-[var(--text-warning-primary)]">Passwords match, but you still need at least 12 characters and a stronger mix of characters before you can recover the wallet.'), jt = n('<div class="p-3 rounded-none bg-[var(--bg-success-primary)] border border-[color:color-mix(in_srgb,var(--success-foreground)_30%,transparent)] flex items-center gap-2 mb-3"><svg class="w-4 h-4 text-[var(--fg-success-secondary)]"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M20 6 9 17l-5-5"></path></svg><span class="type-text-sm text-[var(--text-success-primary)]">Password set. Click "Recover Wallet" to restore this wallet on this device.'), Ht = n('<div class="p-3 rounded-none bg-[var(--bg-error-primary)] border border-[var(--border-error-subtle)] flex items-center gap-2 mb-3"><span class="type-text-sm text-[var(--text-error-primary)]">'), Yt = n('<div class="bg-[var(--bg-primary)] rounded-none p-6"><h2 class="type-text-lg font-semibold text-foreground mb-1">Set Local Password</h2><p class="type-text-sm text-content-muted mb-5">Choose a password to unlock this recovered wallet on this device.</p><div class="space-y-3 mb-5"></div><div class="p-3 rounded-none bg-[var(--bg-warning-primary)] border border-[color:color-mix(in_srgb,var(--warning-foreground)_30%,transparent)]"><div class="flex items-start gap-2"><svg class="w-4 h-4 text-[var(--fg-warning-primary)] shrink-0 mt-0.5"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M12 9v4M12 17h.01M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path></svg><span class="type-text-xs text-[var(--text-warning-primary)]">If you forget this password, you can only recover using your seed phrase.'), qt = n('<svg class="w-4 h-4"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M19 12H5M12 19l-7-7 7-7">'), Zt = n('<svg class="w-4 h-4"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M5 12h14M12 5l7 7-7 7">'), Jt = n('<div class="relative flex min-h-screen flex-col bg-background"><div class="absolute inset-0 opacity-[0.08]"style="background-image:linear-gradient(color-mix(in srgb, var(--border-secondary) 72%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--border-secondary) 72%, transparent) 1px, transparent 1px);background-size:40px 40px"></div><header class="relative z-10 flex-none h-20 bg-header border-b border-header-border"><div class="h-full max-w-6xl mx-auto px-6 border-x border-header-divider flex items-center justify-between"><div class="flex items-center gap-4"><span class="type-text-xs uppercase tracking-[0.24em] text-header-muted">RECOVER WALLET</span></div><div class="hidden md:flex items-center gap-3 text-[10px] font-semibold uppercase tracking-[0.22em] text-header-muted"></div></div></header><main class="relative z-10 flex flex-1 overflow-y-auto px-6"><div class="w-full max-w-6xl mx-auto self-stretch border-x border-[var(--border-secondary)]"><div class="w-full px-0 py-6 md:py-8"><div class="max-w-3xl mx-auto border border-[var(--border-secondary)] bg-[var(--bg-primary)]"><div class="border-b border-[var(--border-secondary)] px-5 py-3.5"><div class="flex items-center gap-2"></div></div><div class="p-5 md:p-5"></div><div class="border-t border-[var(--border-secondary)] px-5 py-3.5"><div class="flex justify-between gap-4"></div><div class="mt-3 text-center"><p class="text-[11px] text-content-muted-light">Need help? <a href=mailto:team@1am.xyz class="underline transition-colors hover:text-content-muted">team@1am.xyz'), Xt = n('<svg class="w-3.5 h-3.5"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2.5><path d="M20 6 9 17l-5-5">'), Qt = n('<div class="flex items-center gap-2"><div></div><span>'), en = n('<div class="flex items-center gap-1.5"><span class="type-text-xs w-5 text-right text-content-muted-light">.'), rn = n('<svg class="w-4 h-4 text-[var(--fg-error-secondary)]"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M18 6 6 18M6 6l12 12">'), tn = n('<span class="type-text-sm text-[var(--text-error-primary)]">Invalid seed phrase. Please check your words and try again.'), nn = n('<span class="type-text-xs text-content-muted">'), an = n('<div class=mb-3><div class="flex gap-1 mb-1.5"></div><div class="flex items-center justify-between"><span>'), sn = n('<div class="w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin">');
    let on, ln, dn;
    Mn = ()=>{
        const [r, a] = h(1), [o, l] = h("mainnet"), [d, c] = h(Array(24).fill("")), [s, v] = h(""), [y, f] = h(""), [I, R] = h(!1), [T, A] = h(null), k = z(()=>d().every((_)=>_.trim().length > 0)), g = z(()=>{
            if (!k()) return !1;
            const _ = pr(d().map((W)=>W.trim().toLowerCase()));
            return Hr(_, Yr);
        }), u = z(()=>Ge(s())), $ = z(()=>u().isAcceptable && s() === y()), M = (_, W)=>{
            c((O)=>{
                const K = [
                    ...O
                ];
                return K[_] = W, K;
            });
        }, G = (_, W)=>{
            const O = W.clipboardData?.getData("text")?.trim();
            if (!O) return;
            const K = O.split(/\s+/);
            K.length > 1 && (W.preventDefault(), c((Y)=>{
                const L = [
                    ...Y
                ];
                return K.forEach((ae, H)=>{
                    _ + H < 24 && (L[_ + H] = ae);
                }), L;
            }));
        }, J = (_)=>{
            _.key === "Enter" && X() && !I() && (_.preventDefault(), ce());
        };
        er(()=>{
            window.addEventListener("keydown", J);
        }), Le(()=>{
            window.removeEventListener("keydown", J), c(Array(24).fill("")), v(""), f("");
        });
        const X = z(()=>{
            switch(r()){
                case 0:
                    return o() !== null;
                case 1:
                    return g();
                case 2:
                    return $();
                default:
                    return !1;
            }
        }), ce = ()=>{
            if (r() === 2 && $()) {
                Ce();
                return;
            }
            a((_)=>Math.min(_ + 1, 2));
        }, ue = ()=>{
            if (r() <= 1) {
                window.location.href = Ae.runtime.getURL("/fullpage.html?mode=welcome");
                return;
            }
            a((_)=>_ - 1);
        }, Ce = async ()=>{
            R(!0), A(null);
            try {
                if (!g()) throw new Error("Invalid recovery phrase");
                if (!Ge(s()).isAcceptable) throw new Error("Password does not meet strength requirements");
                if (s() !== y()) throw new Error("Passwords do not match");
                if (await He() === "locked" && !window.confirm(`A wallet already exists. Recovering will PERMANENTLY REPLACE it. Make sure you have your existing recovery phrase backed up.

Continue?`)) {
                    R(!1);
                    return;
                }
                const O = pr(d().map((H)=>H.trim().toLowerCase())), K = Ye(O), Y = qe(K, 0), L = {
                    seed: K,
                    nightExternalKey: Buffer.from(Y.nightExternalKey).toString("base64"),
                    zswapKeys: Buffer.from(Y.zswapKeys).toString("base64"),
                    dustKeys: Buffer.from(Y.dustKeys).toString("base64"),
                    wallets: [
                        {
                            id: 0,
                            seed: K,
                            mnemonic: O
                        }
                    ],
                    mnemonic: O,
                    walletKind: "password"
                };
                await tr({
                    environment: o(),
                    proofServerUrl: nr.proofstation.url,
                    dustSponsorship: !0,
                    proofServerMode: "proofstation",
                    sidePanelEnabled: !1,
                    showDropdownAddresses: !1,
                    cardanoEnabled: !0
                });
                const ae = new TextEncoder().encode(s());
                v(""), f("");
                try {
                    await Ze(ae, L), await Je({
                        wallets: [
                            {
                                id: 0,
                                name: "Wallet 1",
                                accounts: [
                                    {
                                        index: 0,
                                        name: "Account 1"
                                    }
                                ],
                                activeAccountIndex: 0,
                                nextAccountIndex: 1
                            }
                        ],
                        activeId: 0,
                        nextId: 1,
                        walletKind: "password"
                    });
                    const { key: H, salt: pe } = await Xe(ae);
                    await Qe(H, pe);
                } finally{
                    ae.fill(0);
                }
                c(Array(24).fill("")), window.location.href = Ae.runtime.getURL("/fullpage.html");
            } catch (_) {
                A(_ instanceof Error ? _.message : "Failed to recover wallet. Please check your seed phrase."), R(!1);
            }
        }, ke = [
            "Seed Phrase",
            "Password"
        ];
        return (()=>{
            var _ = Jt(), W = _.firstChild, O = W.nextSibling, K = O.firstChild, Y = K.firstChild, L = Y.firstChild, ae = O.nextSibling, H = ae.firstChild, pe = H.firstChild, ve = pe.firstChild, be = ve.firstChild, Me = be.firstChild, se = be.nextSibling, m = se.nextSibling, B = m.firstChild;
            return t(Y, e(rr, {
                class: "h-8 w-auto",
                animated: !0
            }), L), t(Me, e(Pe, {
                each: ke,
                children: (p, C)=>[
                        e(i, {
                            get when () {
                                return C() > 0;
                            },
                            get children () {
                                var w = Ke();
                                return ne(()=>re(w, `flex-1 h-px ${C() <= r() - 1 ? "bg-[var(--bg-primary-solid)]" : "bg-[var(--border-primary)]"}`)), w;
                            }
                        }),
                        (()=>{
                            var w = Qt(), D = w.firstChild, F = D.nextSibling;
                            return t(D, e(i, {
                                get when () {
                                    return C() < r() - 1;
                                },
                                get fallback () {
                                    return C() + 1;
                                },
                                get children () {
                                    return Xt();
                                }
                            })), t(F, p), ne((b)=>{
                                var E = `w-7 h-7 rounded-full flex items-center justify-center type-text-xs font-medium ${C() < r() - 1 || C() === r() - 1 ? "bg-[var(--bg-primary-solid)] text-[var(--fg-white)]" : "bg-[var(--bg-secondary)] text-content-muted-light border border-[var(--border-primary)]"}`, Q = `type-text-xs uppercase tracking-wide ${C() <= r() - 1 ? "text-[var(--text-primary)] font-medium" : "text-content-muted-light"}`;
                                return E !== b.e && re(D, b.e = E), Q !== b.t && re(F, b.t = Q), b;
                            }, {
                                e: void 0,
                                t: void 0
                            }), w;
                        })()
                    ]
            })), t(se, e(i, {
                get when () {
                    return r() === 0;
                },
                get children () {
                    var p = Nt(), C = p.firstChild;
                    return C.nextSibling, t(p, e(ze, {
                        get value () {
                            return o();
                        },
                        onChange: l,
                        class: "space-y-3",
                        get children () {
                            return [
                                (()=>{
                                    var w = vr();
                                    return t(w, e(ye, {
                                        value: "preview",
                                        get children () {
                                            return e(we, {
                                                class: "flex-1 cursor-pointer",
                                                get children () {
                                                    return [
                                                        At(),
                                                        Lt()
                                                    ];
                                                }
                                            });
                                        }
                                    })), w;
                                })(),
                                (()=>{
                                    var w = vr();
                                    return t(w, e(ye, {
                                        value: "preprod",
                                        get children () {
                                            return e(we, {
                                                class: "flex-1 cursor-pointer",
                                                get children () {
                                                    return [
                                                        Bt(),
                                                        Dt()
                                                    ];
                                                }
                                            });
                                        }
                                    })), w;
                                })(),
                                (()=>{
                                    var w = Ft();
                                    return t(w, e(ye, {
                                        value: "mainnet",
                                        disabled: !0,
                                        get children () {
                                            return e(we, {
                                                class: "flex-1",
                                                get children () {
                                                    return [
                                                        Tt(),
                                                        Ot()
                                                    ];
                                                }
                                            });
                                        }
                                    })), w;
                                })()
                            ];
                        }
                    }), null), p;
                }
            }), null), t(se, e(i, {
                get when () {
                    return r() === 1;
                },
                get children () {
                    var p = zt(), C = p.firstChild, w = C.nextSibling, D = w.nextSibling, F = D.nextSibling;
                    return t(F, e(Pe, {
                        get each () {
                            return Array(24);
                        },
                        children: (b, E)=>e(Ee, {
                                get children () {
                                    var Q = en(), ge = Q.firstChild, Se = ge.firstChild;
                                    return t(ge, ()=>E() + 1, Se), t(Q, e(Re, {
                                        type: "text",
                                        get placeholder () {
                                            return `Word ${E() + 1}`;
                                        },
                                        get value () {
                                            return d()[E()];
                                        },
                                        onInput: (q)=>M(E(), q.currentTarget.value),
                                        onPaste: (q)=>G(E(), q),
                                        class: "h-9 rounded-none type-text-sm bg-[var(--bg-primary)] font-mono border-[var(--border-primary)] text-foreground placeholder:text-content-muted-light"
                                    }), null), Q;
                                }
                            })
                    })), t(p, e(i, {
                        get when () {
                            return k();
                        },
                        get children () {
                            var b = Ke();
                            return t(b, e(i, {
                                get when () {
                                    return g();
                                },
                                get fallback () {
                                    return [
                                        rn(),
                                        tn()
                                    ];
                                },
                                get children () {
                                    return [
                                        Vt(),
                                        Wt()
                                    ];
                                }
                            })), ne(()=>re(b, `p-3 rounded-none flex items-center gap-2 mb-4 ${g() ? "bg-[var(--bg-success-primary)] border border-[color:color-mix(in_srgb,var(--success-foreground)_30%,transparent)]" : "bg-[var(--bg-error-primary)] border border-[var(--border-error-subtle)]"}`)), b;
                        }
                    }), null), t(p, e(i, {
                        get when () {
                            return T();
                        },
                        get children () {
                            var b = Kt(), E = b.firstChild, Q = E.nextSibling;
                            return t(Q, T), b;
                        }
                    }), null), p;
                }
            }), null), t(se, e(i, {
                get when () {
                    return r() === 2;
                },
                get children () {
                    var p = Yt(), C = p.firstChild, w = C.nextSibling, D = w.nextSibling, F = D.nextSibling;
                    return t(D, e(Ee, {
                        get value () {
                            return s();
                        },
                        onChange: v,
                        get children () {
                            return e(Re, {
                                type: "password",
                                placeholder: "Password (min 12 characters)",
                                class: "h-11 rounded-none type-text-sm border-[var(--border-primary)] bg-[var(--bg-primary)] text-foreground placeholder:text-content-muted-light",
                                autofocus: !0
                            });
                        }
                    }), null), t(D, e(Ee, {
                        get value () {
                            return y();
                        },
                        onChange: f,
                        get children () {
                            return e(Re, {
                                type: "password",
                                placeholder: "Confirm password",
                                class: "h-11 rounded-none type-text-sm border-[var(--border-primary)] bg-[var(--bg-primary)] text-foreground placeholder:text-content-muted-light"
                            });
                        }
                    }), null), t(p, e(i, {
                        get when () {
                            return s().length > 0;
                        },
                        get children () {
                            return (()=>{
                                const b = u(), E = [
                                    "bg-[var(--bg-error-solid)]",
                                    "bg-[var(--fg-error-secondary)]",
                                    "bg-[var(--fg-warning-secondary)]",
                                    "bg-[var(--fg-success-secondary)]",
                                    "bg-[var(--bg-success-solid)]"
                                ], Q = [
                                    "text-[var(--text-error-primary)]",
                                    "text-[var(--text-error-primary)]",
                                    "text-[var(--text-warning-primary)]",
                                    "text-[var(--text-success-primary)]",
                                    "text-[var(--text-success-primary)]"
                                ];
                                return (()=>{
                                    var ge = an(), Se = ge.firstChild, q = Se.nextSibling, De = q.firstChild;
                                    return t(Se, ()=>[
                                            0,
                                            1,
                                            2,
                                            3
                                        ].map((xe)=>(()=>{
                                                var x = Ke();
                                                return ne(()=>re(x, `h-1 flex-1 rounded-full ${xe < b.score ? E[b.score] : "bg-[var(--border-primary)]"}`)), x;
                                            })())), t(De, ()=>b.label), t(q, e(i, {
                                        get when () {
                                            return te(()=>!b.isAcceptable)() && b.feedback.length > 0;
                                        },
                                        get children () {
                                            var xe = nn();
                                            return t(xe, ()=>b.feedback[0]), xe;
                                        }
                                    }), null), ne(()=>re(De, `type-text-xs font-medium ${Q[b.score]}`)), ge;
                                })();
                            })();
                        }
                    }), F), t(p, e(i, {
                        get when () {
                            return te(()=>y().length > 0)() && s() !== y();
                        },
                        get children () {
                            return Gt();
                        }
                    }), F), t(p, e(i, {
                        get when () {
                            return te(()=>y().length > 0 && s() === y())() && !u().isAcceptable;
                        },
                        get children () {
                            return Ut();
                        }
                    }), F), t(p, e(i, {
                        get when () {
                            return $();
                        },
                        get children () {
                            return jt();
                        }
                    }), F), t(p, e(i, {
                        get when () {
                            return T();
                        },
                        get children () {
                            var b = Ht(), E = b.firstChild;
                            return t(E, T), b;
                        }
                    }), F), p;
                }
            }), null), t(B, e(fe, {
                variant: "outline",
                class: "h-12 rounded-none px-6 type-text-sm font-semibold text-fg-secondary hover:bg-bg-primary-hover hover:text-fg-primary",
                onClick: ue,
                get children () {
                    return [
                        qt(),
                        "Back"
                    ];
                }
            }), null), t(B, e(fe, {
                variant: "submit",
                size: "submit",
                class: "h-12 rounded-none px-8 normal-case tracking-normal",
                onClick: ce,
                get disabled () {
                    return !X() || I();
                },
                get children () {
                    return e(i, {
                        get when () {
                            return !I();
                        },
                        get fallback () {
                            return [
                                sn(),
                                "Recovering..."
                            ];
                        },
                        get children () {
                            return [
                                te(()=>r() === 2 ? "Recover Wallet" : "Continue"),
                                e(i, {
                                    get when () {
                                        return r() !== 2;
                                    },
                                    get children () {
                                        return Zt();
                                    }
                                })
                            ];
                        }
                    });
                }
            }), null), _;
        })();
    };
    on = {
        path: "M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701"
    };
    ln = {
        path: "M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"
    };
    dn = {
        path: "M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"
    };
    var cn = n('<svg viewBox="0 0 24 24"aria-hidden=true><path fill=#4285F4 d="M21.65 12.23c0-.72-.06-1.25-.2-1.81H12.2v3.49h5.43c-.11.87-.71 2.17-2.04 3.05l-.02.12 2.98 2.26.21.02c1.92-1.74 3.03-4.29 3.03-7.13Z"></path><path fill=#34A853 d="M12.2 21.75c2.66 0 4.9-.86 6.53-2.34l-3.17-2.4c-.85.58-1.99.99-3.36.99-2.6 0-4.8-1.71-5.59-4.08l-.11.01-3.1 2.35-.04.1c1.62 3.17 4.94 5.37 8.84 5.37Z"></path><path fill=#FBBC05 d="M6.61 13.92a5.9 5.9 0 0 1-.33-1.92c0-.67.12-1.31.31-1.92l-.01-.13-3.13-2.39-.1.05A9.58 9.58 0 0 0 2.4 12c0 1.54.37 2.99 1.02 4.27l3.19-2.35Z"></path><path fill=#EA4335 d="M12.2 6c1.73 0 2.9.73 3.56 1.34l2.6-2.49C16.75 3.4 14.87 2.5 12.2 2.5c-3.9 0-7.22 2.2-8.84 5.37l3.24 2.47C7.4 7.71 9.6 6 12.2 6Z">'), un = n('<span class="flex h-8 w-8 items-center justify-center rounded-sm border border-[#DADCE0] bg-white">'), pn = n('<span><svg class="h-4 w-4"aria-hidden=true><path>'), gn = n('<div class="border border-[var(--border-secondary)] bg-[var(--bg-secondary)] px-4 py-3"><p class="font-mono text-[11px] uppercase tracking-[0.18em] text-content-muted-light">This wallet was created with <span class=text-foreground>'), mn = n('<div class="border border-[var(--border-secondary)] bg-[var(--bg-secondary)] px-4 py-3"><div class="flex items-center gap-3 text-sm text-content-muted"><span class="animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full"></span>Finishing your previous social sign-in...'), hn = n('<div class="border border-[var(--text-error-primary)]/30 bg-[var(--text-error-primary)]/8 px-4 py-3 text-sm text-[var(--text-error-primary)]">'), vn = n('<div class="relative min-h-screen flex flex-col bg-background"><div class="absolute inset-0 opacity-[0.08]"style="background-image:linear-gradient(color-mix(in srgb, var(--border-secondary) 72%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--border-secondary) 72%, transparent) 1px, transparent 1px);background-size:40px 40px"></div><header class="relative z-10 flex-none h-20 bg-header border-b border-header-border"><div class="h-full max-w-6xl mx-auto px-6 border-x border-header-divider flex items-center justify-between"></div></header><main class="relative z-10 flex flex-1 items-center px-6"><div class="w-full max-w-6xl mx-auto self-stretch border-x border-[var(--border-secondary)] flex items-center"><div class="w-full px-0 py-8 md:py-12 -translate-y-[10%]"><div class="border-b border-[var(--border-secondary)] bg-[var(--bg-primary)]"><div class="grid border-t border-[var(--border-secondary)] border-b border-[var(--border-secondary)] md:grid-cols-[minmax(0,1.35fr)_minmax(360px,0.65fr)]"><section class="relative overflow-hidden border-b border-[var(--border-secondary)] p-8 md:border-b-0 md:border-r md:p-12"><div aria-hidden=true class="pointer-events-none absolute inset-0"style="background-image:var(--color-diagonal-pattern);opacity:calc(var(--shielded-pattern-opacity, 0.68) * 0.45)"></div><div class="relative flex flex-col gap-8"><div class="flex items-center gap-2 px-2 py-1.5 w-fit bg-[var(--bg-primary)] border-y border-[var(--border-secondary)]"><span class="w-2 h-2 rounded-full bg-[var(--fg-brand-secondary)]"></span><span class="text-[12px] md:text-sm font-medium uppercase text-content-muted"></span></div><div class="max-w-2xl space-y-4"><h1 class="type-display-md md:type-display-lg font-semibold text-foreground uppercase leading-none"></h1><p class="max-w-xl type-text-sm md:type-text-md uppercase tracking-[0.14em] text-content-muted-dark">AUTHENTICATE ONCE, RESTORE THE SAME 1AM WALLET ANYWHERE</p><p class="max-w-xl type-text-sm text-content-muted"></p><p class="max-w-xl type-text-sm text-content-muted">Your Midnight and Cardano wallet still runs through the normal 1AM engine underneath, and your recovery phrase remains exportable after re-authentication.</p></div></div></section><aside class="flex flex-col justify-between bg-[var(--bg-primary)]"><div class="border-b border-[var(--border-secondary)] p-8 md:p-10 space-y-2"><p class="type-text-xs uppercase tracking-[0.22em] text-content-muted-light"></p><p class="type-text-sm text-content-muted"></p></div><div class="p-8 md:p-10 space-y-3"></div></aside></div><div class="grid gap-0 md:grid-cols-[minmax(0,1.35fr)_minmax(360px,0.65fr)]"><div class="px-8 py-5 md:px-12 md:py-6 border-b md:border-b-0 md:border-r border-[var(--border-secondary)] flex items-center"><p class="text-[11px] uppercase tracking-[0.18em] text-content-muted-light">Social login restores the same wallet keys. Local labels, settings, and caches stay on this device.</p></div><div class="px-8 py-5 md:px-10 md:py-6 text-left flex items-center"><p class="w-full text-[11px] text-content-muted-light">By continuing, you agree to our <a href=https://1am.xyz/terms target=_blank rel="noopener noreferrer"class="underline transition-colors hover:text-content-muted">Terms of Service</a> and <a href=https://1am.xyz/privacy target=_blank rel="noopener noreferrer"class="underline transition-colors hover:text-content-muted">Privacy Policy'), bn = n('<div class="border border-[var(--text-error-primary)]/30 bg-[var(--text-error-primary)]/8 px-4 py-3 text-sm text-[var(--text-error-primary)]">Social wallets are not configured yet on this build.'), xn = n("<span> "), fn = n('<span class="animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full">');
    let yn, wn, $n, _n, Cn, kn;
    yn = [
        "google",
        "apple",
        "discord",
        "x"
    ];
    wn = {
        google: {
            path: "",
            color: "#4285F4"
        },
        apple: {
            path: on.path,
            color: "#FFFFFF"
        },
        discord: {
            path: ln.path,
            color: "#FFFFFF"
        },
        x: {
            path: dn.path,
            color: "#FFFFFF"
        }
    };
    $n = (r, a)=>({
            wallets: [
                {
                    id: 0,
                    name: "Wallet 1",
                    accounts: [
                        {
                            index: 0,
                            name: "Account 1"
                        }
                    ],
                    activeAccountIndex: 0,
                    nextAccountIndex: 1
                }
            ],
            activeId: 0,
            nextId: 1,
            walletKind: "social-web3auth",
            socialAuth: {
                provider: "web3auth",
                loginProvider: r,
                userId: a,
                createdAt: Date.now()
            }
        });
    _n = (r, a, o)=>{
        const l = Ye(r), d = qe(l, 0);
        return {
            seed: l,
            nightExternalKey: Buffer.from(d.nightExternalKey).toString("base64"),
            zswapKeys: Buffer.from(d.zswapKeys).toString("base64"),
            dustKeys: Buffer.from(d.dustKeys).toString("base64"),
            wallets: [
                {
                    id: 0,
                    seed: l,
                    mnemonic: r
                }
            ],
            mnemonic: r,
            walletKind: "social-web3auth",
            socialAuth: {
                provider: "web3auth",
                loginProvider: a,
                userId: o,
                createdAt: Date.now()
            }
        };
    };
    Cn = (r)=>(()=>{
            var a = cn();
            return ne(()=>Oe(a, "class", r.class)), a;
        })();
    kn = (r)=>{
        const a = wn[r.provider];
        if (r.provider === "google") return (()=>{
            var l = un();
            return t(l, e(Cn, {
                class: "h-5 w-5"
            })), l;
        })();
        const o = r.provider === "discord" ? "bg-[#5865F2]" : "bg-[#111111]";
        return (()=>{
            var l = pn(), d = l.firstChild, c = d.firstChild;
            return re(l, `flex h-8 w-8 items-center justify-center rounded-sm ${o}`), ne((s)=>{
                var v = a.viewBox ?? "0 0 24 24", y = a.color, f = a.path;
                return v !== s.e && Oe(d, "viewBox", s.e = v), y !== s.t && Oe(d, "fill", s.t = y), f !== s.a && Oe(c, "d", s.a = f), s;
            }, {
                e: void 0,
                t: void 0,
                a: void 0
            }), l;
        })();
    };
    An = (r)=>{
        const [a, o] = h(!1), [l, d] = h(null), [c, s] = h(null), [v, y] = h(null), [f, I] = h(r.mode === "unlock"), R = z(()=>r.mode === "create" ? "SIGN IN TO 1AM" : "UNLOCK YOUR WALLET"), T = z(()=>r.mode === "create" ? "Use a social account to create or restore the same 1AM wallet on every device." : "Re-authenticate with the same social account to restore access on this device."), A = async (g)=>{
            const u = await Kr(g);
            try {
                if (r.mode === "create") {
                    if (await He() === "locked" && !window.confirm("A wallet already exists on this device. Continuing will permanently replace it with this social wallet. Make sure you have a recovery path for the current wallet before continuing.")) return;
                    const J = _n(u.mnemonic, g.loginProvider, g.userId);
                    await tr({
                        environment: "mainnet",
                        proofServerUrl: nr.proofstation.url,
                        dustSponsorship: !0,
                        proofServerMode: "proofstation",
                        sidePanelEnabled: !1,
                        showDropdownAddresses: !1,
                        cardanoEnabled: !0
                    }), await Ze(u.vaultUnlockKey, J), await Je($n(g.loginProvider, g.userId));
                }
                const { key: $, salt: M } = await Xe(u.vaultUnlockKey);
                await Qe($, M), Ve(), window.location.href = Ae.runtime.getURL("/fullpage.html");
            } finally{
                u.vaultUnlockKey.fill(0);
            }
        }, k = async (g)=>{
            d(g), o(!0), s(null);
            try {
                const u = await Wr(g);
                if (!u) return;
                await A(u);
            } catch (u) {
                const $ = u instanceof Error ? u.message : "Unable to continue with social authentication.";
                r.mode === "unlock" && /Wrong password/i.test($) ? s("That social account does not match the wallet stored on this device. Sign in with the same account you used to create it.") : s($);
            } finally{
                d(null), o(!1), I(!1);
            }
        };
        return er(async ()=>{
            const u = (await zr()).socialAuth?.loginProvider ?? null, $ = Gr();
            if (r.mode === "unlock" && y(u), !mr) {
                I(!1);
                return;
            }
            if (r.mode === "create" && !$) {
                I(!1);
                return;
            }
            try {
                const M = r.mode === "create" ? $ : u, G = await Ur(M ?? void 0);
                if (!G) {
                    r.mode === "create" && $ && Ve();
                    return;
                }
                if (r.mode === "create" && !$) return;
                await A(G);
            } catch (M) {
                s(M instanceof Error ? M.message : "Unable to restore your social wallet session."), r.mode === "create" && Ve();
            } finally{
                I(!1);
            }
        }), (()=>{
            var g = vn(), u = g.firstChild, $ = u.nextSibling, M = $.firstChild, G = $.nextSibling, J = G.firstChild, X = J.firstChild, ce = X.firstChild, ue = ce.firstChild, Ce = ue.firstChild, ke = Ce.firstChild, _ = ke.nextSibling, W = _.firstChild, O = W.firstChild, K = O.nextSibling, Y = W.nextSibling, L = Y.firstChild, ae = L.nextSibling, H = ae.nextSibling, pe = Ce.nextSibling, ve = pe.firstChild, be = ve.firstChild, Me = be.nextSibling, se = ve.nextSibling;
            return t(M, e(rr, {
                class: "h-8 w-auto",
                animated: !0
            })), t(K, ()=>r.mode === "create" ? "SOCIAL WALLET" : "SOCIAL UNLOCK"), t(L, R), t(H, T), t(be, ()=>r.mode === "create" ? "CHOOSE A PROVIDER" : "VERIFY YOUR IDENTITY"), t(Me, ()=>r.mode === "create" ? "Pick one supported social account to continue." : "Use the same provider you used when creating this wallet."), t(se, e(i, {
                get when () {
                    return te(()=>r.mode === "unlock")() && v();
                },
                get children () {
                    var m = gn(), B = m.firstChild, p = B.firstChild, C = p.nextSibling;
                    return t(C, (()=>{
                        var w = te(()=>!!v());
                        return ()=>w() ? gr[v()] : "";
                    })()), m;
                }
            }), null), t(se, e(i, {
                when: mr,
                get fallback () {
                    return bn();
                },
                get children () {
                    return e(Pe, {
                        each: yn,
                        children: (m)=>e(fe, {
                                variant: "secondary",
                                class: "w-full h-14 rounded-none border border-[var(--border-secondary)] px-4 text-left type-text-sm font-semibold uppercase tracking-wide text-fg-primary justify-start gap-3 disabled:opacity-40",
                                onClick: ()=>void k(m),
                                get disabled () {
                                    return a() || r.mode === "unlock" && !!v() && v() !== m;
                                },
                                get children () {
                                    return [
                                        e(i, {
                                            get when () {
                                                return l() !== m;
                                            },
                                            get fallback () {
                                                return fn();
                                            },
                                            get children () {
                                                return e(kn, {
                                                    provider: m
                                                });
                                            }
                                        }),
                                        (()=>{
                                            var B = xn(), p = B.firstChild;
                                            return t(B, ()=>r.mode === "create" ? "Continue with" : "Unlock with", p), t(B, ()=>gr[m], null), B;
                                        })()
                                    ];
                                }
                            })
                    });
                }
            }), null), t(se, e(i, {
                get when () {
                    return f();
                },
                get children () {
                    return mn();
                }
            }), null), t(se, e(i, {
                get when () {
                    return c();
                },
                get children () {
                    var m = hn();
                    return t(m, c), m;
                }
            }), null), g;
        })();
    };
});
export { Pn as C, Mn as R, An as S, __tla };
