import { e as ar, f as ue, a as e, m as ee, c as m, g as Be, h as Sr, j as Se, S as i, k as F, l as sr, u as or, n as ce, t as n, o as ze, i as t, L as lr, b as te, p as X, F as Ie, M as Ne, q as Ir, r as Rr } from "./Logo1am-CSacEOt-.js";
import { m as he, F as Er, c as Pr, a as Mr, b as Ar, P as ve, d as er, e as je, f as Lr, u as ir, g as Br, v as Dr, s as Tr, h as _e, E as Or, i as Ve, j as Nr, _ as Vr, k as dr, l as cr, n as Wr, o as Ue, B as $e, T as Ce, p as ke, q as Fr, r as De, t as ur, w as pr, x as gr, y as mr, D as hr, z as vr, A as fr, C as xr, G as br, H as yr, I as rr, J as Gr, K as Kr, L as zr, W as jr, M as Ur, N as Hr, __tla as __tla_0 } from "./App-CBFr3ZEW.js";
import { s as qr, a as Yr, __tla as __tla_1 } from "./fullpage-D5jkHqEd.js";
Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    var Zr = {};
    Vr(Zr, {
        Description: ()=>cr,
        ErrorMessage: ()=>dr,
        Item: ()=>qe,
        ItemControl: ()=>Ye,
        ItemDescription: ()=>_r,
        ItemIndicator: ()=>Ze,
        ItemInput: ()=>Je,
        ItemLabel: ()=>Qe,
        Label: ()=>Cr,
        RadioGroup: ()=>Jr,
        Root: ()=>Xe,
        useRadioGroupContext: ()=>He
    });
    var wr = sr();
    function He() {
        const r = or(wr);
        if (r === void 0) throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");
        return r;
    }
    var $r = sr();
    function Re() {
        const r = or($r);
        if (r === void 0) throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");
        return r;
    }
    function qe(r) {
        const a = ir(), s = He(), l = `${a.generateId("item")}-${ar()}`, g = he({
            id: l
        }, r), [d, o] = ue(g, [
            "value",
            "disabled",
            "onPointerDown"
        ]), [y, $] = m(), [v, P] = m(), [R, D] = m(), [V, _] = m(), [S, E] = m(!1), G = F(()=>s.isDefaultValue(d.value)), Z = F(()=>s.isSelectedValue(d.value)), ne = F(()=>d.disabled || a.isDisabled() || !1), le = (xe)=>{
            _e(xe, d.onPointerDown), S() && xe.preventDefault();
        }, ae = F(()=>({
                ...a.dataset(),
                "data-disabled": ne() ? "" : void 0,
                "data-checked": Z() ? "" : void 0
            })), fe = {
            value: ()=>d.value,
            dataset: ae,
            isDefault: G,
            isSelected: Z,
            isDisabled: ne,
            inputId: y,
            labelId: v,
            descriptionId: R,
            inputRef: V,
            select: ()=>s.setSelectedValue(d.value),
            generateId: Nr(()=>o.id),
            registerInput: Ve($),
            registerLabel: Ve(P),
            registerDescription: Ve(D),
            setIsFocused: E,
            setInputRef: _
        };
        return e($r.Provider, {
            value: fe,
            get children () {
                return e(ve, ee({
                    as: "div",
                    role: "group",
                    onPointerDown: le
                }, ae, o));
            }
        });
    }
    function Ye(r) {
        const a = Re(), s = he({
            id: a.generateId("control")
        }, r), [l, g] = ue(s, [
            "onClick",
            "onKeyDown"
        ]);
        return e(ve, ee({
            as: "div",
            onClick: (y)=>{
                _e(y, l.onClick), a.select(), a.inputRef()?.focus();
            },
            onKeyDown: (y)=>{
                _e(y, l.onKeyDown), y.key === Or.Space && (a.select(), a.inputRef()?.focus());
            }
        }, ()=>a.dataset(), g));
    }
    function _r(r) {
        const a = Re(), s = he({
            id: a.generateId("description")
        }, r);
        return Be(()=>Se(a.registerDescription(s.id))), e(ve, ee({
            as: "div"
        }, ()=>a.dataset(), s));
    }
    function Ze(r) {
        const a = Re(), s = he({
            id: a.generateId("indicator")
        }, r), [l, g] = ue(s, [
            "ref",
            "forceMount"
        ]), [d, o] = m(), { present: y } = Tr({
            show: ()=>l.forceMount || a.isSelected(),
            element: ()=>d() ?? null
        });
        return e(i, {
            get when () {
                return y();
            },
            get children () {
                return e(ve, ee({
                    as: "div",
                    ref ($) {
                        var v = je(o, l.ref);
                        typeof v == "function" && v($);
                    }
                }, ()=>a.dataset(), g));
            }
        });
    }
    function Je(r) {
        const a = ir(), s = He(), l = Re(), g = he({
            id: l.generateId("input")
        }, r), [d, o] = ue(g, [
            "ref",
            "style",
            "aria-labelledby",
            "aria-describedby",
            "onChange",
            "onFocus",
            "onBlur"
        ]), y = ()=>[
                d["aria-labelledby"],
                l.labelId(),
                d["aria-labelledby"] != null && o["aria-label"] != null ? o.id : void 0
            ].filter(Boolean).join(" ") || void 0, $ = ()=>[
                d["aria-describedby"],
                l.descriptionId(),
                s.ariaDescribedBy()
            ].filter(Boolean).join(" ") || void 0, [v, P] = m(!1), R = (_)=>{
            if (_e(_, d.onChange), _.stopPropagation(), !v()) {
                s.setSelectedValue(l.value());
                const S = _.target;
                S.checked = l.isSelected();
            }
            P(!1);
        }, D = (_)=>{
            _e(_, d.onFocus), l.setIsFocused(!0);
        }, V = (_)=>{
            _e(_, d.onBlur), l.setIsFocused(!1);
        };
        return Be(Sr([
            ()=>l.isSelected(),
            ()=>l.value()
        ], (_)=>{
            if (!_[0] && _[1] === l.value()) return;
            P(!0);
            const S = l.inputRef();
            S?.dispatchEvent(new Event("input", {
                bubbles: !0,
                cancelable: !0
            })), S?.dispatchEvent(new Event("change", {
                bubbles: !0,
                cancelable: !0
            }));
        }, {
            defer: !0
        })), Be(()=>Se(l.registerInput(o.id))), e(ve, ee({
            as: "input",
            ref (_) {
                var S = je(l.setInputRef, d.ref);
                typeof S == "function" && S(_);
            },
            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 Br({
                    ...Dr
                }, d.style);
            },
            get "aria-labelledby" () {
                return y();
            },
            get "aria-describedby" () {
                return $();
            },
            onChange: R,
            onFocus: D,
            onBlur: V
        }, ()=>l.dataset(), o));
    }
    function Qe(r) {
        const a = Re(), s = he({
            id: a.generateId("label")
        }, r);
        return Be(()=>Se(a.registerLabel(s.id))), e(ve, ee({
            as: "label",
            get for () {
                return a.inputId();
            }
        }, ()=>a.dataset(), s));
    }
    function Cr(r) {
        return e(Wr, ee({
            as: "span"
        }, r));
    }
    function Xe(r) {
        let a;
        const s = `radiogroup-${ar()}`, l = he({
            id: s,
            orientation: "vertical"
        }, r), [g, d, o] = ue(l, [
            "ref",
            "value",
            "defaultValue",
            "onChange",
            "orientation",
            "aria-labelledby",
            "aria-describedby"
        ], Er), [y, $] = Pr({
            value: ()=>g.value,
            defaultValue: ()=>g.defaultValue,
            onChange: (E)=>g.onChange?.(E)
        }), { formControlContext: v } = Mr(d);
        Ar(()=>a, ()=>$(g.defaultValue ?? ""));
        const P = ()=>v.getAriaLabelledBy(er(d.id), o["aria-label"], g["aria-labelledby"]), R = ()=>v.getAriaDescribedBy(g["aria-describedby"]), D = (E)=>E === r.defaultValue, V = (E)=>E === y(), S = {
            ariaDescribedBy: R,
            isDefaultValue: D,
            isSelectedValue: V,
            setSelectedValue: (E)=>{
                if (!(v.isReadOnly() || v.isDisabled()) && ($(E), a)) for (const G of a.querySelectorAll("[type='radio']")){
                    const Z = G;
                    Z.checked = V(Z.value);
                }
            }
        };
        return e(Lr.Provider, {
            value: v,
            get children () {
                return e(wr.Provider, {
                    value: S,
                    get children () {
                        return e(ve, ee({
                            as: "div",
                            ref (E) {
                                var G = je((Z)=>a = Z, g.ref);
                                typeof G == "function" && G(E);
                            },
                            role: "radiogroup",
                            get id () {
                                return er(d.id);
                            },
                            get "aria-invalid" () {
                                return v.validationState() === "invalid" || void 0;
                            },
                            get "aria-required" () {
                                return v.isRequired() || void 0;
                            },
                            get "aria-disabled" () {
                                return v.isDisabled() || void 0;
                            },
                            get "aria-readonly" () {
                                return v.isReadOnly() || void 0;
                            },
                            get "aria-orientation" () {
                                return g.orientation;
                            },
                            get "aria-labelledby" () {
                                return P();
                            },
                            get "aria-describedby" () {
                                return R();
                            }
                        }, ()=>v.dataset(), o));
                    }
                });
            }
        });
    }
    var Jr = Object.assign(Xe, {
        Description: cr,
        ErrorMessage: dr,
        Item: qe,
        ItemControl: Ye,
        ItemDescription: _r,
        ItemIndicator: Ze,
        ItemInput: Je,
        ItemLabel: Qe,
        Label: Cr
    }), Qr = 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 Ge = (r)=>{
        const [a, s] = ue(r, [
            "class"
        ]);
        return e(Xe, ee({
            get class () {
                return Ue("grid gap-2", a.class);
            }
        }, s));
    }, ge = (r)=>{
        const [a, s] = ue(r, [
            "class",
            "children"
        ]);
        return e(qe, ee({
            get class () {
                return Ue("flex items-center space-x-2", a.class);
            }
        }, s, {
            get children () {
                return [
                    e(Je, {}),
                    e(Ye, {
                        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(Ze, {
                                class: "flex h-full items-center justify-center ",
                                get children () {
                                    return Qr();
                                }
                            });
                        }
                    }),
                    ce(()=>a.children)
                ];
            }
        }));
    }, me = (r)=>{
        const [a, s] = ue(r, [
            "class"
        ]);
        return e(Qe, ee({
            get class () {
                return Ue("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", a.class);
            }
        }, s));
    };
    function Ke(r) {
        const a = [];
        let s = 0;
        if (r.length === 0) return {
            score: 0,
            label: "",
            isAcceptable: !1,
            feedback: []
        };
        r.length < 8 ? a.push("At least 8 characters required") : r.length >= 12 ? s += 2 : s += 1;
        const l = /[a-z]/.test(r), g = /[A-Z]/.test(r), d = /[0-9]/.test(r), o = /[^a-zA-Z0-9]/.test(r), y = [
            l,
            g,
            d,
            o
        ].filter(Boolean).length;
        y >= 3 ? s += 2 : y >= 2 && (s += 1), !g && !o && a.push("Add uppercase letters or special characters"), d || a.push("Add a number");
        const $ = r.toLowerCase();
        [
            "password",
            "12345678",
            "qwerty",
            "letmein",
            "welcome",
            "monkey",
            "dragon",
            "master"
        ].some((D)=>$.includes(D)) && (s = Math.max(0, s - 2), a.push("Avoid common passwords")), /(.)\1{3,}/.test(r) && (s = Math.max(0, s - 1), a.push("Avoid repeated characters"));
        const P = Math.min(4, Math.max(0, s));
        return {
            score: P,
            label: [
                "Very weak",
                "Weak",
                "Fair",
                "Good",
                "Strong"
            ][P],
            isAcceptable: r.length >= 8 && P >= 2,
            feedback: a
        };
    }
    var Xr = n('<div class="font-medium text-foreground">Preview Network'), et = 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">'), rt = n('<div class="font-medium text-foreground">Preprod Network'), tt = n('<div class="type-text-sm text-content-muted">Pre-production network'), nt = n('<div class="font-medium text-foreground">Mainnet'), at = n('<div class="type-text-sm text-content-muted">Coming soon'), st = n('<label class="flex items-center gap-4 rounded-lg border border-[var(--border-primary)] p-4 opacity-50 cursor-not-allowed">'), ot = 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.'), lt = n('<div class="font-medium text-foreground">24-Word Recovery Phrase'), it = n('<div class="type-text-sm text-content-muted">Industry standard BIP-39 mnemonic phrase'), dt = 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.'), ct = 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">'), ut = n('<div class="type-text-xs text-[var(--text-warning-primary)] text-center mb-3">Clipboard will be cleared in <!>s'), pt = 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.'), gt = 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">'), mt = 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.'), ht = 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.`), vt = 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">'), ft = 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`), 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.'), bt = 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'), tr = 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">.'), Rt = n('<span class="type-text-xs text-content-muted">'), Et = 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, s)=>a - s);
    }
    const At = ()=>{
        const [r, a] = m(2), [s, l] = m("mainnet"), [g, d] = m("24-word");
        let o = [];
        const [y, $] = m([]), [v, P] = m(!1), [R, D] = m(""), [V, _] = m(""), [S, E] = m(!1), [G, Z] = m(!1), [ne, le] = m(Array(24).fill("")), ae = F(()=>{
            const C = ne();
            return o.length !== 24 ? !1 : C.every((H, u)=>H.trim().toLowerCase() === o[u]?.toLowerCase());
        }), [fe, xe] = m([]), [Te, Ee] = m({}), f = ()=>{
            o = Fr(), $([
                ...o
            ]);
        };
        F(()=>{
            const C = fe(), H = Te();
            return C.length !== 4 || o.length !== 24 ? !1 : C.every((u)=>{
                const x = H[u], h = o[u];
                if (!x || !h || x.trim().length === 0) return !1;
                const I = new TextEncoder().encode(x.toLowerCase().trim()), L = new TextEncoder().encode(h.toLowerCase());
                if (I.length !== L.length) return !1;
                let c = 0;
                for(let w = 0; w < I.length; w++)c |= I[w] ^ L[w];
                return c === 0;
            });
        });
        const j = F(()=>Ke(R())), T = F(()=>j().isAcceptable && R() === V()), [W, J] = m(0);
        let A = null;
        const se = async ()=>{
            try {
                await navigator.clipboard.writeText(o.join(" "));
            } catch  {
                return;
            }
            P(!0), J(60), setTimeout(()=>P(!1), 2e3), A && clearInterval(A), A = setInterval(()=>{
                J((C)=>C <= 1 ? (A && clearInterval(A), A = null, navigator.clipboard.writeText("").catch(()=>{}), 0) : C - 1);
            }, 1e3);
        }, U = (C)=>{
            C.key === "Enter" && be() && !S() && (C.preventDefault(), Pe());
        };
        ze(()=>{
            window.addEventListener("keydown", U), f();
        }), Se(()=>{
            window.removeEventListener("keydown", U), A && (clearInterval(A), A = null, navigator.clipboard.writeText("").catch(()=>{})), o.fill(""), o = [], $([]);
        });
        const be = F(()=>{
            switch(r()){
                case 0:
                    return s() !== null;
                case 1:
                    return g() !== null;
                case 2:
                    return y().length === 24 && G();
                case 3:
                    return ae();
                case 4:
                    return T();
                default:
                    return !1;
            }
        }), Pe = ()=>{
            if (r() === 2 && (xe(Mt()), Ee({})), r() === 3 && ($([]), Ee({})), r() === 4 && T()) {
                Oe();
                return;
            }
            a((C)=>Math.min(C + 1, 4));
        }, Me = ()=>{
            if (r() <= 2) {
                window.location.href = De.runtime.getURL("/fullpage.html?mode=welcome");
                return;
            }
            a((C)=>C - 1);
        }, Oe = async ()=>{
            E(!0);
            try {
                if (await ur() === "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?`)) {
                    E(!1);
                    return;
                }
                const H = o.join(" "), u = pr(H), x = gr(u, 0), h = {
                    seed: u,
                    nightExternalKey: Buffer.from(x.nightExternalKey).toString("base64"),
                    zswapKeys: Buffer.from(x.zswapKeys).toString("base64"),
                    dustKeys: Buffer.from(x.dustKeys).toString("base64"),
                    wallets: [
                        {
                            id: 0,
                            seed: u,
                            mnemonic: H
                        }
                    ],
                    mnemonic: H
                };
                await mr({
                    environment: s(),
                    proofServerUrl: vr.proofstation.url,
                    proofStationApiKey: hr,
                    dustSponsorship: !0,
                    proofServerMode: "proofstation"
                });
                const I = new TextEncoder().encode(R());
                D(""), _(""), await fr(I, h), await xr({
                    wallets: [
                        {
                            id: 0,
                            name: "Wallet 1",
                            accounts: [
                                {
                                    index: 0,
                                    name: "Account 1"
                                }
                            ],
                            activeAccountIndex: 0,
                            nextAccountIndex: 1
                        }
                    ],
                    activeId: 0,
                    nextId: 1
                });
                const { key: L, salt: c } = await br(I);
                await yr(L, c), I.fill(0), o.fill(""), o = [], $([]), window.location.href = De.runtime.getURL("/fullpage.html");
            } catch  {
                E(!1);
            }
        }, ye = [
            "Backup",
            "Verify",
            "Password"
        ];
        return (()=>{
            var C = $t(), H = C.firstChild, u = H.nextSibling, x = u.firstChild, h = x.firstChild, I = h.firstChild, L = u.nextSibling, c = L.firstChild, w = c.firstChild, q = w.firstChild, ie = q.firstChild, we = ie.firstChild, K = ie.nextSibling, Ae = K.nextSibling, pe = Ae.firstChild;
            return t(h, e(lr, {
                class: "h-8 w-auto",
                animated: !0
            }), I), t(we, e(Ie, {
                each: ye,
                children: (p, M)=>{
                    const b = ()=>r() - 2;
                    return [
                        e(i, {
                            get when () {
                                return M() > 0;
                            },
                            get children () {
                                var z = tr();
                                return te(()=>X(z, `flex-1 h-px ${M() <= b() ? "bg-[var(--bg-primary-solid)]" : "bg-[var(--border-primary)]"}`)), z;
                            }
                        }),
                        (()=>{
                            var z = Ct(), B = z.firstChild, k = B.nextSibling;
                            return t(B, e(i, {
                                get when () {
                                    return M() < b();
                                },
                                get fallback () {
                                    return M() + 1;
                                },
                                get children () {
                                    return _t();
                                }
                            })), t(k, p), te((O)=>{
                                var oe = `w-7 h-7 rounded-full flex items-center justify-center type-text-xs font-medium ${M() < b() || M() === b() ? "bg-[var(--bg-primary-solid)] text-[var(--fg-white)]" : "bg-[var(--bg-secondary)] text-content-muted-light border border-[var(--border-primary)]"}`, re = `type-text-xs uppercase tracking-wide hidden sm:inline ${M() <= b() ? "text-[var(--text-primary)] font-medium" : "text-content-muted-light"}`;
                                return oe !== O.e && X(B, O.e = oe), re !== O.t && X(k, O.t = re), O;
                            }, {
                                e: void 0,
                                t: void 0
                            }), z;
                        })()
                    ];
                }
            })), t(K, e(i, {
                get when () {
                    return r() === 0;
                },
                get children () {
                    var p = ot(), M = p.firstChild;
                    return M.nextSibling, t(p, e(Ge, {
                        get value () {
                            return s();
                        },
                        onChange: l,
                        class: "space-y-3",
                        get children () {
                            return [
                                (()=>{
                                    var b = We();
                                    return t(b, e(ge, {
                                        value: "preview",
                                        get children () {
                                            return e(me, {
                                                class: "flex-1 cursor-pointer",
                                                get children () {
                                                    return [
                                                        Xr(),
                                                        et()
                                                    ];
                                                }
                                            });
                                        }
                                    })), b;
                                })(),
                                (()=>{
                                    var b = We();
                                    return t(b, e(ge, {
                                        value: "preprod",
                                        get children () {
                                            return e(me, {
                                                class: "flex-1 cursor-pointer",
                                                get children () {
                                                    return [
                                                        rt(),
                                                        tt()
                                                    ];
                                                }
                                            });
                                        }
                                    })), b;
                                })(),
                                (()=>{
                                    var b = st();
                                    return t(b, e(ge, {
                                        value: "mainnet",
                                        disabled: !0,
                                        get children () {
                                            return e(me, {
                                                class: "flex-1",
                                                get children () {
                                                    return [
                                                        nt(),
                                                        at()
                                                    ];
                                                }
                                            });
                                        }
                                    })), b;
                                })()
                            ];
                        }
                    }), null), p;
                }
            }), null), t(K, e(i, {
                get when () {
                    return r() === 1;
                },
                get children () {
                    var p = dt(), M = p.firstChild;
                    return M.nextSibling, t(p, e(Ge, {
                        get value () {
                            return g();
                        },
                        onChange: d,
                        class: "space-y-3",
                        get children () {
                            var b = We();
                            return t(b, e(ge, {
                                value: "24-word",
                                get children () {
                                    return e(me, {
                                        class: "flex-1 cursor-pointer",
                                        get children () {
                                            return [
                                                lt(),
                                                it()
                                            ];
                                        }
                                    });
                                }
                            })), b;
                        }
                    }), null), p;
                }
            }), null), t(K, e(i, {
                get when () {
                    return r() === 2;
                },
                get children () {
                    var p = pt(), M = p.firstChild, b = M.nextSibling, z = b.nextSibling, B = z.nextSibling, k = B.nextSibling, O = k.nextSibling, oe = O.firstChild, re = oe.firstChild;
                    return t(k, e(Ie, {
                        get each () {
                            return y();
                        },
                        children: (N, Y)=>(()=>{
                                var Q = kt(), de = Q.firstChild, Le = de.firstChild, kr = de.nextSibling;
                                return t(de, ()=>Y() + 1, Le), t(kr, N), Q;
                            })()
                    })), t(p, e($e, {
                        variant: "secondary",
                        class: "mb-5 w-full rounded-none border border-[var(--border-primary)]",
                        onClick: se,
                        title: "Copy to clipboard",
                        "aria-label": "Copy to clipboard",
                        get children () {
                            return e(i, {
                                get when () {
                                    return v();
                                },
                                get fallback () {
                                    return [
                                        St(),
                                        "COPY TO CLIPBOARD"
                                    ];
                                },
                                get children () {
                                    return [
                                        ct(),
                                        "COPIED!"
                                    ];
                                }
                            });
                        }
                    }), O), t(p, e(i, {
                        get when () {
                            return W() > 0;
                        },
                        get children () {
                            var N = ut(), Y = N.firstChild, Q = Y.nextSibling;
                            return Q.nextSibling, t(N, W, Q), N;
                        }
                    }), O), re.addEventListener("change", (N)=>Z(N.currentTarget.checked)), te(()=>re.checked = G()), p;
                }
            }), null), t(K, e(i, {
                get when () {
                    return r() === 3;
                },
                get children () {
                    var p = vt(), M = p.firstChild, b = M.nextSibling, z = b.nextSibling;
                    return t(z, e(Ie, {
                        get each () {
                            return ne();
                        },
                        children: (B, k)=>e(Ce, {
                                get children () {
                                    var O = It(), oe = O.firstChild, re = oe.firstChild;
                                    return t(oe, ()=>k() + 1, re), t(O, e(ke, {
                                        type: "text",
                                        value: B,
                                        onInput: (N)=>{
                                            const Y = [
                                                ...ne()
                                            ];
                                            Y[k()] = N.currentTarget.value, le(Y);
                                        },
                                        onPaste: (N)=>{
                                            const Y = N.clipboardData?.getData("text");
                                            if (Y) {
                                                const Q = Y.trim().split(/\s+/);
                                                Q.length === 24 && (N.preventDefault(), le(Q));
                                            }
                                        },
                                        get class () {
                                            return `h-11 py-0 rounded-none type-text-sm font-mono ${B.trim() ? B.trim().toLowerCase() === o[k()]?.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 ${k() + 1}`;
                                        },
                                        autocomplete: "off",
                                        spellcheck: !1
                                    }), null), O;
                                }
                            })
                    })), t(p, e($e, {
                        variant: "secondary",
                        class: "mb-4 w-full rounded-none border border-[var(--border-primary)]",
                        onClick: async ()=>{
                            const k = (await navigator.clipboard.readText()).trim().split(/\s+/);
                            k.length === 24 && le(k);
                        },
                        get children () {
                            return [
                                gt(),
                                "PASTE ALL 24 WORDS"
                            ];
                        }
                    }), null), t(p, e(i, {
                        get when () {
                            return ae();
                        },
                        get children () {
                            return mt();
                        }
                    }), null), t(p, e(i, {
                        get when () {
                            return ce(()=>!ae())() && ne().every((B)=>B.trim().length > 0);
                        },
                        get children () {
                            return ht();
                        }
                    }), null), p;
                }
            }), null), t(K, e(i, {
                get when () {
                    return r() === 4;
                },
                get children () {
                    var p = bt(), M = p.firstChild, b = M.nextSibling, z = b.nextSibling, B = z.nextSibling;
                    return t(z, e(Ce, {
                        get value () {
                            return R();
                        },
                        onChange: D,
                        get children () {
                            return e(ke, {
                                type: "password",
                                placeholder: "Password (min 8 characters)",
                                class: "h-11 type-text-sm border-[var(--border-primary)] text-[var(--text-primary)] placeholder:text-content-muted-light",
                                autofocus: !0
                            });
                        }
                    }), null), t(z, e(Ce, {
                        get value () {
                            return V();
                        },
                        onChange: _,
                        get children () {
                            return e(ke, {
                                type: "password",
                                placeholder: "Confirm password",
                                class: "h-11 type-text-sm border-[var(--border-primary)] text-[var(--text-primary)] placeholder:text-content-muted-light"
                            });
                        }
                    }), null), t(p, e(i, {
                        get when () {
                            return R().length > 0;
                        },
                        get children () {
                            return (()=>{
                                const k = j(), O = [
                                    "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)]"
                                ], oe = [
                                    "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 re = Et(), N = re.firstChild, Y = N.nextSibling, Q = Y.firstChild;
                                    return t(N, ()=>[
                                            0,
                                            1,
                                            2,
                                            3
                                        ].map((de)=>(()=>{
                                                var Le = tr();
                                                return te(()=>X(Le, `h-1 flex-1 rounded-full ${de < k.score ? O[k.score] : "bg-[var(--border-primary)]"}`)), Le;
                                            })())), t(Q, ()=>k.label), t(Y, e(i, {
                                        get when () {
                                            return ce(()=>!k.isAcceptable)() && k.feedback.length > 0;
                                        },
                                        get children () {
                                            var de = Rt();
                                            return t(de, ()=>k.feedback[0]), de;
                                        }
                                    }), null), te(()=>X(Q, `type-text-xs font-medium ${oe[k.score]}`)), re;
                                })();
                            })();
                        }
                    }), B), t(p, e(i, {
                        get when () {
                            return ce(()=>V().length > 0)() && R() !== V();
                        },
                        get children () {
                            return ft();
                        }
                    }), B), t(p, e(i, {
                        get when () {
                            return T();
                        },
                        get children () {
                            return xt();
                        }
                    }), B), p;
                }
            }), null), t(pe, e($e, {
                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: Me,
                get children () {
                    return [
                        yt(),
                        "Back"
                    ];
                }
            }), null), t(pe, e($e, {
                variant: "submit",
                size: "submit",
                class: "h-12 rounded-none px-8 normal-case tracking-normal",
                onClick: Pe,
                get disabled () {
                    return !be() || S();
                },
                get children () {
                    return e(i, {
                        get when () {
                            return !S();
                        },
                        get fallback () {
                            return [
                                Pt(),
                                "Creating..."
                            ];
                        },
                        get children () {
                            return [
                                ce(()=>r() === 4 ? "Create Wallet" : "Continue"),
                                e(i, {
                                    get when () {
                                        return r() !== 4;
                                    },
                                    get children () {
                                        return wt();
                                    }
                                })
                            ];
                        }
                    });
                }
            }), null), C;
        })();
    };
    var Lt = n('<div class="font-medium text-foreground">Preview Network'), Bt = n('<div class="type-text-sm text-content-muted">Test network for development'), nr = 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">'), Dt = n('<div class="font-medium text-foreground">Preprod Network'), Tt = n('<div class="type-text-sm text-content-muted">Pre-production network'), Ot = n('<div class="font-medium text-foreground">Mainnet'), Nt = n('<div class="type-text-sm text-content-muted">Coming soon'), Vt = n('<label class="flex items-center gap-4 rounded-lg border border-[var(--border-primary)] p-4 opacity-50 cursor-not-allowed">'), Wt = 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.'), Ft = 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">'), Gt = n('<span class="type-text-sm text-[var(--text-success-primary)]">Valid seed phrase! Set a password to continue.'), Fe = 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">'), jt = 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-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)]">'), qt = 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.'), 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">'), 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'), Qt = 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">'), Xt = 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">');
    const on = ()=>{
        const [r, a] = m(1), [s, l] = m("mainnet"), [g, d] = m(Array(24).fill("")), [o, y] = m(""), [$, v] = m(""), [P, R] = m(!1), [D, V] = m(null), _ = F(()=>g().every((f)=>f.trim().length > 0)), S = F(()=>{
            if (!_()) return !1;
            const f = rr(g().map((j)=>j.trim().toLowerCase()));
            return Gr(f, Kr);
        }), E = F(()=>Ke(o())), G = F(()=>E().isAcceptable && o() === $()), Z = (f, j)=>{
            d((T)=>{
                const W = [
                    ...T
                ];
                return W[f] = j, W;
            });
        }, ne = (f, j)=>{
            const T = j.clipboardData?.getData("text")?.trim();
            if (!T) return;
            const W = T.split(/\s+/);
            W.length > 1 && (j.preventDefault(), d((J)=>{
                const A = [
                    ...J
                ];
                return W.forEach((se, U)=>{
                    f + U < 24 && (A[f + U] = se);
                }), A;
            }));
        }, le = (f)=>{
            f.key === "Enter" && ae() && !P() && (f.preventDefault(), fe());
        };
        ze(()=>{
            window.addEventListener("keydown", le);
        }), Se(()=>{
            window.removeEventListener("keydown", le), d(Array(24).fill("")), y(""), v("");
        });
        const ae = F(()=>{
            switch(r()){
                case 0:
                    return s() !== null;
                case 1:
                    return S();
                case 2:
                    return G();
                default:
                    return !1;
            }
        }), fe = ()=>{
            if (r() === 2 && G()) {
                Te();
                return;
            }
            a((f)=>Math.min(f + 1, 2));
        }, xe = ()=>{
            if (r() <= 1) {
                window.location.href = De.runtime.getURL("/fullpage.html?mode=welcome");
                return;
            }
            a((f)=>f - 1);
        }, Te = async ()=>{
            R(!0), V(null);
            try {
                if (!S()) throw new Error("Invalid recovery phrase");
                if (!Ke(o()).isAcceptable) throw new Error("Password does not meet strength requirements");
                if (o() !== $()) throw new Error("Passwords do not match");
                if (await ur() === "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 T = rr(g().map((U)=>U.trim().toLowerCase())), W = pr(T), J = gr(W, 0), A = {
                    seed: W,
                    nightExternalKey: Buffer.from(J.nightExternalKey).toString("base64"),
                    zswapKeys: Buffer.from(J.zswapKeys).toString("base64"),
                    dustKeys: Buffer.from(J.dustKeys).toString("base64"),
                    wallets: [
                        {
                            id: 0,
                            seed: W,
                            mnemonic: T
                        }
                    ],
                    mnemonic: T
                };
                await mr({
                    environment: s(),
                    proofServerUrl: vr.proofstation.url,
                    proofStationApiKey: hr,
                    dustSponsorship: !0,
                    proofServerMode: "proofstation"
                });
                const se = new TextEncoder().encode(o());
                y(""), v("");
                try {
                    await fr(se, A), await xr({
                        wallets: [
                            {
                                id: 0,
                                name: "Wallet 1",
                                accounts: [
                                    {
                                        index: 0,
                                        name: "Account 1"
                                    }
                                ],
                                activeAccountIndex: 0,
                                nextAccountIndex: 1
                            }
                        ],
                        activeId: 0,
                        nextId: 1
                    });
                    const { key: U, salt: be } = await br(se);
                    await yr(U, be);
                } finally{
                    se.fill(0);
                }
                d(Array(24).fill("")), window.location.href = De.runtime.getURL("/fullpage.html");
            } catch (f) {
                V(f instanceof Error ? f.message : "Failed to recover wallet. Please check your seed phrase."), R(!1);
            }
        }, Ee = [
            "Seed Phrase",
            "Password"
        ];
        return (()=>{
            var f = Jt(), j = f.firstChild, T = j.nextSibling, W = T.firstChild, J = W.firstChild, A = J.firstChild, se = T.nextSibling, U = se.firstChild, be = U.firstChild, Pe = be.firstChild, Me = Pe.firstChild, Oe = Me.firstChild, ye = Me.nextSibling, C = ye.nextSibling, H = C.firstChild;
            return t(J, e(lr, {
                class: "h-8 w-auto",
                animated: !0
            }), A), t(Oe, e(Ie, {
                each: Ee,
                children: (u, x)=>[
                        e(i, {
                            get when () {
                                return x() > 0;
                            },
                            get children () {
                                var h = Fe();
                                return te(()=>X(h, `flex-1 h-px ${x() <= r() - 1 ? "bg-[var(--bg-primary-solid)]" : "bg-[var(--border-primary)]"}`)), h;
                            }
                        }),
                        (()=>{
                            var h = Xt(), I = h.firstChild, L = I.nextSibling;
                            return t(I, e(i, {
                                get when () {
                                    return x() < r() - 1;
                                },
                                get fallback () {
                                    return x() + 1;
                                },
                                get children () {
                                    return Qt();
                                }
                            })), t(L, u), te((c)=>{
                                var w = `w-7 h-7 rounded-full flex items-center justify-center type-text-xs font-medium ${x() < r() - 1 || x() === 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 ${x() <= r() - 1 ? "text-[var(--text-primary)] font-medium" : "text-content-muted-light"}`;
                                return w !== c.e && X(I, c.e = w), q !== c.t && X(L, c.t = q), c;
                            }, {
                                e: void 0,
                                t: void 0
                            }), h;
                        })()
                    ]
            })), t(ye, e(i, {
                get when () {
                    return r() === 0;
                },
                get children () {
                    var u = Wt(), x = u.firstChild;
                    return x.nextSibling, t(u, e(Ge, {
                        get value () {
                            return s();
                        },
                        onChange: l,
                        class: "space-y-3",
                        get children () {
                            return [
                                (()=>{
                                    var h = nr();
                                    return t(h, e(ge, {
                                        value: "preview",
                                        get children () {
                                            return e(me, {
                                                class: "flex-1 cursor-pointer",
                                                get children () {
                                                    return [
                                                        Lt(),
                                                        Bt()
                                                    ];
                                                }
                                            });
                                        }
                                    })), h;
                                })(),
                                (()=>{
                                    var h = nr();
                                    return t(h, e(ge, {
                                        value: "preprod",
                                        get children () {
                                            return e(me, {
                                                class: "flex-1 cursor-pointer",
                                                get children () {
                                                    return [
                                                        Dt(),
                                                        Tt()
                                                    ];
                                                }
                                            });
                                        }
                                    })), h;
                                })(),
                                (()=>{
                                    var h = Vt();
                                    return t(h, e(ge, {
                                        value: "mainnet",
                                        disabled: !0,
                                        get children () {
                                            return e(me, {
                                                class: "flex-1",
                                                get children () {
                                                    return [
                                                        Ot(),
                                                        Nt()
                                                    ];
                                                }
                                            });
                                        }
                                    })), h;
                                })()
                            ];
                        }
                    }), null), u;
                }
            }), null), t(ye, e(i, {
                get when () {
                    return r() === 1;
                },
                get children () {
                    var u = zt(), x = u.firstChild, h = x.nextSibling, I = h.nextSibling, L = I.nextSibling;
                    return t(L, e(Ie, {
                        get each () {
                            return Array(24);
                        },
                        children: (c, w)=>e(Ce, {
                                get children () {
                                    var q = en(), ie = q.firstChild, we = ie.firstChild;
                                    return t(ie, ()=>w() + 1, we), t(q, e(ke, {
                                        type: "text",
                                        get placeholder () {
                                            return `Word ${w() + 1}`;
                                        },
                                        get value () {
                                            return g()[w()];
                                        },
                                        onInput: (K)=>Z(w(), K.currentTarget.value),
                                        onPaste: (K)=>ne(w(), K),
                                        class: "h-9 rounded-none type-text-sm bg-bg-primary font-mono border-[var(--border-primary)] text-[var(--text-primary)] placeholder:text-content-muted-light"
                                    }), null), q;
                                }
                            })
                    })), t(u, e(i, {
                        get when () {
                            return _();
                        },
                        get children () {
                            var c = Fe();
                            return t(c, e(i, {
                                get when () {
                                    return S();
                                },
                                get fallback () {
                                    return [
                                        rn(),
                                        tn()
                                    ];
                                },
                                get children () {
                                    return [
                                        Ft(),
                                        Gt()
                                    ];
                                }
                            })), te(()=>X(c, `p-3 rounded-none flex items-center gap-2 mb-4 ${S() ? "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)]"}`)), c;
                        }
                    }), null), t(u, e(i, {
                        get when () {
                            return D();
                        },
                        get children () {
                            var c = Kt(), w = c.firstChild, q = w.nextSibling;
                            return t(q, D), c;
                        }
                    }), null), u;
                }
            }), null), t(ye, e(i, {
                get when () {
                    return r() === 2;
                },
                get children () {
                    var u = qt(), x = u.firstChild, h = x.nextSibling, I = h.nextSibling, L = I.nextSibling;
                    return t(I, e(Ce, {
                        get value () {
                            return o();
                        },
                        onChange: y,
                        get children () {
                            return e(ke, {
                                type: "password",
                                placeholder: "Password (min 8 characters)",
                                class: "h-11 rounded-none type-text-sm border-[var(--border-primary)] text-[var(--text-primary)] placeholder:text-content-muted-light",
                                autofocus: !0
                            });
                        }
                    }), null), t(I, e(Ce, {
                        get value () {
                            return $();
                        },
                        onChange: v,
                        get children () {
                            return e(ke, {
                                type: "password",
                                placeholder: "Confirm password",
                                class: "h-11 rounded-none type-text-sm border-[var(--border-primary)] text-[var(--text-primary)] placeholder:text-content-muted-light"
                            });
                        }
                    }), null), t(u, e(i, {
                        get when () {
                            return o().length > 0;
                        },
                        get children () {
                            return (()=>{
                                const c = E(), w = [
                                    "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 ie = an(), we = ie.firstChild, K = we.nextSibling, Ae = K.firstChild;
                                    return t(we, ()=>[
                                            0,
                                            1,
                                            2,
                                            3
                                        ].map((pe)=>(()=>{
                                                var p = Fe();
                                                return te(()=>X(p, `h-1 flex-1 rounded-full ${pe < c.score ? w[c.score] : "bg-[var(--border-primary)]"}`)), p;
                                            })())), t(Ae, ()=>c.label), t(K, e(i, {
                                        get when () {
                                            return ce(()=>!c.isAcceptable)() && c.feedback.length > 0;
                                        },
                                        get children () {
                                            var pe = nn();
                                            return t(pe, ()=>c.feedback[0]), pe;
                                        }
                                    }), null), te(()=>X(Ae, `type-text-xs font-medium ${q[c.score]}`)), ie;
                                })();
                            })();
                        }
                    }), L), t(u, e(i, {
                        get when () {
                            return ce(()=>$().length > 0)() && o() !== $();
                        },
                        get children () {
                            return jt();
                        }
                    }), L), t(u, e(i, {
                        get when () {
                            return G();
                        },
                        get children () {
                            return Ut();
                        }
                    }), L), t(u, e(i, {
                        get when () {
                            return D();
                        },
                        get children () {
                            var c = Ht(), w = c.firstChild;
                            return t(w, D), c;
                        }
                    }), L), u;
                }
            }), null), t(H, e($e, {
                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: xe,
                get children () {
                    return [
                        Yt(),
                        "Back"
                    ];
                }
            }), null), t(H, e($e, {
                variant: "submit",
                size: "submit",
                class: "h-12 rounded-none px-8 normal-case tracking-normal",
                onClick: fe,
                get disabled () {
                    return !ae() || P();
                },
                get children () {
                    return e(i, {
                        get when () {
                            return !P();
                        },
                        get fallback () {
                            return [
                                sn(),
                                "Recovering..."
                            ];
                        },
                        get children () {
                            return [
                                ce(()=>r() === 2 ? "Recover Wallet" : "Continue"),
                                e(i, {
                                    get when () {
                                        return r() !== 2;
                                    },
                                    get children () {
                                        return Zt();
                                    }
                                })
                            ];
                        }
                    });
                }
            }), null), f;
        })();
    }, ln = ()=>{
        const a = new URLSearchParams(window.location.search).get("mode");
        return ze(async ()=>{
            const s = await zr();
            document.documentElement.setAttribute("data-theme", s.theme || "light"), qr();
        }), Se(()=>{
            Yr();
        }), e(Ir, {
            get fallback () {
                return e(Ur, {});
            },
            get children () {
                return [
                    e(Ne, {
                        when: a === "welcome",
                        get children () {
                            return e(jr, {
                                fullpage: !0
                            });
                        }
                    }),
                    e(Ne, {
                        when: a === "create",
                        get children () {
                            return e(At, {});
                        }
                    }),
                    e(Ne, {
                        when: a === "recover",
                        get children () {
                            return e(on, {});
                        }
                    })
                ];
            }
        });
    };
    window.Buffer = Hr.Buffer;
    window.__ONE_AM_SHELL__ = "fullpage";
    const dn = document.getElementById("root");
    Rr(()=>e(ln, {}), dn);
});
