1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{46029:(e,t,a)=>{Promise.resolve().then(a.bind(a,41307))},41307:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>el});var r=a(95155),s=a(12115),n=a(73264),i=a(91290),l=a(53408),o=a(43463),c=a(69795);let d=(0,l.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function x(e){let{className:t,variant:a="default",size:s="default",asChild:n=!1,...l}=e,x=n?i.DX:"button";return(0,r.jsx)(x,{"data-slot":"button","data-variant":a,"data-size":s,className:function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,c.QP)((0,o.$)(t))}(d({variant:a,size:s,className:t})),...l})}var m=a(65236),p=a(35620);let h=[{id:"protocol",label:"Home"},{id:"dashboard",label:"Dashboard",requiresAuth:!0,requiresVault:!0},{id:"create",label:"Create",requiresAuth:!0,requiresNoVault:!0},{id:"access",label:"Access",requiresAuth:!0},{id:"architecture",label:"Architecture"},{id:"about",label:"About"}];function v(e){let{activeTab:t,onTabChange:a}=e,{accountId:s,isConnected:i,isLoading:l,connect:o,disconnect:c,vaultStatus:d}=(0,n.y)(),v=null!==d&&d.is_initialized,u=h.filter(e=>(!e.requiresAuth||!!i)&&("dashboard"===e.id?!!v&&(null==d||!d.owner_id||!s||d.owner_id===s):(!e.requiresVault||!!v)&&(!e.requiresNoVault||!v)));return(0,r.jsx)("header",{className:"sticky top-0 z-50 w-full border-b border-[var(--border)]",style:{backgroundColor:"rgba(0,0,0,0.92)",backdropFilter:"blur(12px)"},children:(0,r.jsxs)("div",{className:"max-w-[1200px] mx-auto flex h-14 items-center justify-between px-8",children:[(0,r.jsxs)("button",{onClick:()=>a("protocol"),className:"flex items-center gap-2.5 hover:opacity-70 transition-opacity",children:[(0,r.jsx)("span",{className:"w-2 h-2 rounded-full bg-[var(--accent)]"}),(0,r.jsx)("span",{className:"text-[15px] font-semibold tracking-tight text-[var(--text)]",children:"KeepAlive"})]}),(0,r.jsx)("nav",{className:"hidden md:flex items-center gap-1",children:u.map(e=>(0,r.jsx)("button",{onClick:()=>a(e.id),className:"px-4 py-1.5 text-[14px] transition-colors ".concat(t===e.id?"text-[var(--text)] font-medium":"text-[var(--text-muted)] hover:text-[var(--text)]"),children:e.label},e.id))}),(0,r.jsx)("div",{className:"flex items-center gap-3",children:l?(0,r.jsx)("div",{className:"h-3.5 w-3.5 animate-spin rounded-full border border-[var(--border)] border-t-[var(--text-muted)]"}):i?(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{className:"text-[14px] font-mono text-[var(--text)]",children:s}),(0,r.jsx)(x,{variant:"ghost",size:"sm",onClick:c,className:"text-[var(--text-dim)] hover:text-[var(--text)] h-8 w-8 p-0",children:(0,r.jsx)(m.A,{className:"h-3.5 w-3.5"})})]}):(0,r.jsxs)("button",{onClick:o,className:"flex items-center gap-2 px-4 py-2 border border-[var(--border)] hover:border-[var(--border-hover)] text-[var(--text)] text-[13px] font-medium transition-colors",children:[(0,r.jsx)(p.A,{className:"h-3.5 w-3.5"}),"Connect"]})})]})})}var u=a(99053),b=a(23888);function f(){let{connect:e,isConnected:t}=(0,n.y)();return(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsxs)("div",{className:"relative min-h-[100vh] flex items-center justify-center px-8 overflow-hidden pb-0 pt-24",children:[(0,r.jsx)("div",{className:"absolute top-[35%] left-1/2 -translate-x-1/2 -translate-y-1/2 w-[700px] h-[700px] rounded-full pointer-events-none",style:{background:"radial-gradient(circle, rgba(255,255,255,0.03) 0%, transparent 70%)",filter:"blur(80px)"}}),(0,r.jsxs)("div",{className:"max-w-[1000px] w-full text-center relative z-10 flex flex-col items-center",children:[(0,r.jsxs)("h1",{className:"animate-reveal text-[clamp(3.5rem,7vw,5.5rem)] font-extrabold leading-[1.0] tracking-tight mb-8",children:[(0,r.jsx)("span",{className:"block",style:{background:"linear-gradient(180deg, #ffffff 0%, #7171
17a 100%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"},children:"Preserve your legacy."}),(0,r.jsx)("span",{className:"block",style:{background:"linear-gradient(180deg, #ffffff 20%, #71717a 100%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"},children:"Automate your inheritance."})]}),(0,r.jsx)("p",{className:"animate-reveal delay-1 text-[18px] text-gray-400 leading-relaxed max-w-[580px] mx-auto mb-12",children:"Ensure your digital assets are securely transferred to your beneficiaries if you ever go silent. An automated inheritance protocol, built on NEAR."}),(0,r.jsxs)("div",{className:"animate-reveal delay-2 mb-16 flex items-center justify-center gap-4",children:[t?(0,r.jsxs)("button",{onClick:()=>{let e=new CustomEvent("sentinel:navigate",{detail:"dashboard"});window.dispatchEvent(e)},className:"group inline-flex items-center gap-3 px-12 py-4 bg-white text-black text-[15px] font-bold tracking-wide transition-all hover:bg-gray-200",style:{boxShadow:"0 0 40px rgba(255,255,255,0.08)"},children:["Open Dashboard",(0,r.jsx)(u.A,{className:"w-4 h-4 transition-transform group-hover:translate-x-0.5"})]}):(0,r.jsxs)("button",{onClick:e,className:"group inline-flex items-center gap-3 px-12 py-4 bg-white text-black text-[15px] font-bold tracking-wide transition-all hover:bg-gray-200",style:{boxShadow:"0 0 40px rgba(255,255,255,0.08)"},children:["Launch KeepAlive",(0,r.jsx)(u.A,{className:"w-4 h-4 transition-transform group-hover:translate-x-0.5"})]}),(0,r.jsx)("button",{onClick:()=>{let e=new CustomEvent("sentinel:navigate",{detail:"architecture"});window.dispatchEvent(e)},className:"inline-flex items-center gap-2 px-8 py-4 border border-white/[0.15] text-white/70 text-[15px] font-medium tracking-wide transition-all hover:border-white/30 hover:text-white",children:"Architecture"})]}),(0,r.jsx)("div",{className:"animate-reveal delay-3 w-full max-w-[820px]",style:{WebkitMaskImage:"linear-gradient(to bottom, black 50%, transparent 100%)",maskImage:"linear-gradient(to bottom, black 50%, transparent 100%)"},children:(0,r.jsxs)("div",{className:"w-full border border-white/[0.08] bg-[#111111]/95 backdrop-blur-md overflow-hidden",style:{boxShadow:"0 12px 60px rgba(0,0,0,0.5)"},children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-3.5 border-b border-white/[0.06]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-2 h-2 rounded-full bg-white/60 animate-pulse-dot"}),(0,r.jsxs)("span",{className:"text-[11px] font-mono text-gray-400 tracking-wider",children:["SWITCH STATUS: ",(0,r.jsx)("span",{className:"text-white font-bold",children:"ACTIVE"})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[10px] font-mono text-gray-600 px-3 py-1 border border-white/[0.06]",children:"Refresh"}),(0,r.jsx)("span",{className:"text-[10px] font-mono text-red-400/60 px-3 py-1 border border-red-400/10",children:"Reset Vault"})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-[1.2fr_1fr]",children:[(0,r.jsxs)("div",{className:"p-6 pr-4",children:[(0,r.jsx)("div",{className:"text-center mb-6 pt-4",children:(0,r.jsxs)("div",{className:"flex items-baseline justify-center gap-1",children:[(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("span",{className:"text-[48px] font-bold font-mono text-white leading-none",children:"24"}),(0,r.jsx)("p",{className:"text-[9px] font-mono text-gray-600 tracking-wider mt-1",children:"HOURS"})]}),(0,r.jsx)("span",{className:"text-[32px] font-mono text-gray-600 mx-1",children:":"}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("span",{className:"text-[48px] font-bold font-mono text-white leading-none",children:"00"}),(0,r.jsx)("p",{className:"text-[9px] font-mono text-gray-600 tracking-wider mt-1",children:"MINUTES"})]}),(0,r.jsx)("span",{className:"text-[32px] font-mono text-gray-600 mx-1",children:":"}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("span",{className:"text-[48px] font-bold font-mono text-white leading-none",children:"00"}),(0,r.jsx)("p",{className:"text-[9px] font-mono text-gray-600 tracking-wider mt-1",children:"SECONDS"})]})]})}),(0,r.jsxs)("div",{className:"flex justify-between text-[9px] font-mono text-gray-600 tracking-wider mb-3 border-t border-white/[0.04] pt-3",children:[(0,r.jsx)("span",{children:"TRIGGER"}),(0,r.jsx)("span",{children:"RESET"})]}),(0,r.jsxs)("div",{className:"border border-white/[0.08] bg-white/[0.02] p-4 flex items-center gap-4",children:[(0,r.jsx)("div",{className:"w-9 h-9 border border-white/[0.08] flex items-center justify-center flex-shrink-0",children:(0,r.jsx)(b.A,{className:"w-4 h-4 text-gray-400"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-[13px] font-semibold text-white",children:"Ping"}),(0,r.jsx)("p",{className:"text-[11px] text-gray-500",children:"Send a heartbeat to reset your countdown timer."})]}),(0,r.jsx)("span",{className:"text-gray-600 text-[14px]",children:"âº"})]})]}),(0,r.jsxs)("div",{className:"border-l border-white/[0.06] p-5 space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[9px] font-mono text-gray-600 tracking-wider mb-2",children:"VAULT BALANCE"}),(0,r.jsxs)("p",{className:"text-[28px] font-bold font-mono text-white leading-none",children:["0.0000 ",(0,r.jsx)("span",{className:"text-[14px] text-gray-500",children:"NEAR"})]}),(0,r.jsxs)("div",{className:"flex gap-2 mt-3",children:[(0,r.jsx)("div",{className:"flex-1 border border-white/[0.08] bg-white/[0.02] px-3 py-2 text-[11px] font-mono text-gray-600",children:"0.0"}),(0,r.jsx)("div",{className:"px-4 py-2 border border-white/[0.08] text-[11px] font-mono text-white",children:"Deposit"})]}),(0,r.jsx)("div",{className:"border border-white/[0.06] text-center py-2 mt-2 text-[11px] font-mono text-gray-500",children:"Withdraw All"})]}),(0,r.jsxs)("div",{className:"space-y-0 border-t border-white/[0.06] pt-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between py-2.5",children:[(0,r.jsx)("span",{className:"text-[12px] text-gray-400",children:"Interval"}),(0,r.jsx)("span",{className:"text-[12px] font-mono font-bold text-white",children:"1d"})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between py-2.5",children:[(0,r.jsx)("span",{className:"text-[12px] text-gray-400",children:"Grace Period"}),(0,r.jsx)("span",{className:"text-[12px] font-mono font-bold text-red-400",children:"1d"})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between py-2.5",children:[(0,r.jsx)("span",{className:"text-[12px] text-gray-400",children:"Beneficiary"}),(0,r.jsx)("span",{className:"text-[12px] font-mono font-bold text-white",children:"firmmask5591.near"})]})]}),(0,r.jsxs)("div",{className:"border-t border-white/[0.06] pt-3",children:[(0,r.jsx)("p",{className:"text-[13px] font-semibold text-white mb-2",children:"Secret Payload"}),(0,r.jsx)("div",{className:"border border-white/[0.06] text-center py-2 text-[11px] font-mono text-gray-500",children:"Reveal"})]})]})]})]})})]})]}),(0,r.jsx)("div",{className:"border-t border-b border-white/[0.06] bg-white/[0.02]",children:(0,r.jsxs)("div",{className:"px-8 py-6 flex items-center justify-center gap-0",children:[(0,r.jsx)("span",{className:"text-[11px] font-mono font-bold text-gray-400 tracking-[0.3em] uppercase mr-6",children:"Powered By"}),(0,r.jsx)("div",{className:"w-[1px] h-4 bg-white/[0.12] mr-6"}),["NEAR PROTOCOL","NOVA IPFS","AES-256-GCM","WEB CRYPTO API","NEXT.JS","TELEGRAM BOT"].map((e,t,a)=>(0,r.jsxs)("span",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-[12px] font-mono font-bold text-gray-400 hover:text-white transition-colors cursor-default tracking-wide",children:e}),t<a.length-1&&(0,r.jsx)("span",{className:"text-gray-600 mx-5",children:"\xb7"})]},e))]})}),(0,r.jsx)("div",{id:"how-it-works",className:"border-t border-white/[0.06]",children:(0,r.jsx)("div",{className:"max-w-[1200px] mx-auto px-8 py-28",children:(0,r.jsxs)("div",{className:"grid md:grid-cols-[1fr_1.4fr] gap-16 items-start",children:[(0,r.jsxs)("div",{className:"animate-reveal sticky top-28",children:[(0,r.jsx)("span",{className:"text-[11px] font-mono text-gray-500 tracking-[0.25em] uppercase",children:"How it works"}),(0,r.jsxs)("h2",{className:"text-[clamp(2.2rem,4vw,3.2rem)] font-bold text-white mt-4 leading-[1.1]",children:["Deposit.",(0,r.jsx)("br",{}),"Heartbeat.",(0,r.jsx)("br",{}),"Inherit."]}),(0,r.jsx)("div",{className:"w-10 h-[2px] bg-white/20 mt-6"})]}),(0,r.jsxs)("div",{className:"space-y-0",children:[[{step:"01",title:"Lock Assets",desc:"Deposit NEAR into your personal smart contract vault. Add an optional, zero-knowledge encrypted message or private keys for your beneficiary."},{step:"02",title:"Prove You're Alive",desc:"Ping the contract periodically to reset your custom timer. A Telegram bot will warn
1you before the grace period expires."},{step:"03",title:"Autonomous Execution",desc:"If the timer hits zero, the smart contract trustlessly transfers your entire vault balance and reveals the encrypted payload to your designated heir."}].map((e,t)=>(0,r.jsxs)("div",{className:"animate-reveal delay-".concat(t+1," group border-t border-white/[0.08] py-12 flex gap-8 items-start cursor-default hover:bg-white/[0.02] transition-colors duration-500 px-6 -mx-6"),children:[(0,r.jsx)("span",{className:"text-[14px] font-mono text-gray-500 pt-1 flex-shrink-0",children:e.step}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"text-[24px] font-bold text-white mb-3 group-hover:text-gray-100 transition-colors tracking-tight",children:e.title}),(0,r.jsx)("p",{className:"text-[16px] text-gray-400 leading-[1.8] max-w-[500px]",children:e.desc})]}),(0,r.jsx)("span",{className:"text-gray-600 text-[20px] pt-1 opacity-0 group-hover:opacity-100 transition-opacity duration-300 -translate-x-4 group-hover:translate-x-0 transform ease-out",children:"â"})]},t)),(0,r.jsx)("div",{className:"border-t border-white/[0.08]"})]})]})})})]})}var g=a(26336),j=a(66889),N=a(48686),y=a(98867),w=a(35765),k=a(14505);async function A(e){let t=new TextEncoder().encode(e),a=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),r=crypto.getRandomValues(new Uint8Array(12)),s=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},a,t),n=await crypto.subtle.exportKey("raw",a);return{ciphertext:C(s),key:C(n),iv:C(r.buffer)}}async function E(e,t,a){let r=I(e),s=I(t),n=I(a),i=await crypto.subtle.importKey("raw",s,{name:"AES-GCM",length:256},!1,["decrypt"]),l=await crypto.subtle.decrypt({name:"AES-GCM",iv:n},i,r);return new TextDecoder().decode(l)}function _(e){var t,a;let r=e.trim().replace(/^"|"$/g,"");if(!r.startsWith("E2E:NOVA:"))return null;let s=r.replace("E2E:NOVA:","").split("|"),n=s[0],i=null===(t=s.find(e=>e.startsWith("KEY:")))||void 0===t?void 0:t.replace("KEY:",""),l=null===(a=s.find(e=>e.startsWith("IV:")))||void 0===a?void 0:a.replace("IV:","");return n&&i&&l&&n&&i&&l?{cid:n,key:i,iv:l}:null}function S(e){var t,a;if(!e.startsWith("E2E:LOCAL:"))return null;let r=e.replace("E2E:LOCAL:","").split("|"),s=r[0],n=null===(t=r.find(e=>e.startsWith("KEY:")))||void 0===t?void 0:t.replace("KEY:",""),i=null===(a=r.find(e=>e.startsWith("IV:")))||void 0===a?void 0:a.replace("IV:","");return s&&n&&i?{ciphertext:s,key:n,iv:i}:null}function C(e){let t=new Uint8Array(e),a="";for(let e=0;e<t.byteLength;e++)a+=String.fromCharCode(t[e]);return btoa(a)}function I(e){let t=atob(e),a=new Uint8Array(t.length);for(let e=0;e<t.length;e++)a[e]=t.charCodeAt(e);return a.buffer}async function T(e){console.log("\uD83D\uDD10 NOVA: uploading via server proxy /api/nova/upload");let t=await fetch("/api/nova/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e})});if(!t.ok)throw Error((await t.json().catch(()=>({error:t.statusText}))).error||"NOVA upload failed");let{cid:a}=await t.json();if(!a)throw Error("Upload returned no CID");return console.log("â
NOVA upload OK, CID:",a),"NOVA:".concat(a)}async function R(e){if(!e.startsWith("NOVA:"))return e;let t=e.replace("NOVA:",""),a=await fetch("/api/nova/retrieve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cid:t})});if(!a.ok)throw Error((await a.json().catch(()=>({error:a.statusText}))).error||"NOVA retrieve failed");let{data:r}=await a.json();if(!r)throw Error("Retrieved empty data from NOVA");return r}let P={interval:[{label:"2m",ms:12e4},{label:"5m",ms:3e5},{label:"1h",ms:36e5},{label:"24h",ms:864e5},{label:"7d",ms:6048e5},{label:"30d",ms:2592e6}],grace:[{label:"1m",ms:6e4},{label:"5m",ms:3e5},{label:"1h",ms:36e5},{label:"12h",ms:432e5},{label:"24h",ms:864e5},{label:"48h",ms:1728e5}]};function O(e){return e>=864e5?"".concat((e/864e5).toFixed(e%864e5==0?0:1),"d"):e>=36e5?"".concat((e/36e5).toFixed(e%36e5==0?0:1),"h"):"".concat(Math.round(e/6e4),"m")}function V(e){return Math.round(Math.exp(Math.log(6e4)+e/100*(Math.log(2592e6)-Math.log(6e4))))}function M(e){return(Math.log(e)-Math.log(6e4))/(Math.log(2592e6)-Math.log(6e4))*100}function D(){let{setupVault:e,isTransactionPending:t,accountId:a,vaultStatus:i}
1=(0,n.y)(),[l,o]=(0,s.useState)(""),[c,d]=(0,s.useState)(864e5),[x,m]=(0,s.useState)(864e5),[p,h]=(0,s.useState)(""),[v,u]=(0,s.useState)(!1),[b,f]=(0,s.useState)(!1),[E,_]=(0,s.useState)(!1),[S,C]=(0,s.useState)(null),I=(null==i?void 0:i.telegram_chat_id)&&""!==i.telegram_chat_id,R=async()=>{if(!l.trim()){C("Beneficiary address is required");return}if(!p.trim()){C("Secret payload is required");return}C(null),_(!0);try{let r;if(p.trim()){var t;let{ciphertext:e,key:a,iv:s}=await A(p);t=(await T(e)).replace("NOVA:",""),r="E2E:NOVA:".concat(t,"|KEY:").concat(a,"|IV:").concat(s)}await e(l.trim(),c,x,r);try{let e=await fetch("/api/agent/register-vault",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wallet_id:a})});if(e.ok)console.log("â
Agent registration successful");else{let t=await e.json();console.warn("â ï¸ Agent registration warning:",t.error||e.statusText)}}catch(e){console.warn("â ï¸ Agent registration failed to reach proxy:",e)}}catch(e){console.error("Vault setup failed:",e),C(e instanceof Error?e.message:"Failed to initialize vault")}finally{_(!1)}},D=l.trim()&&p.trim();return null!==i&&i.is_initialized&&!E?(0,r.jsxs)("div",{className:"max-w-[680px] mx-auto px-6 py-20 text-center animate-reveal",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-[var(--accent-dim)] border border-[var(--accent)]/20 mb-6",children:(0,r.jsx)(g.A,{className:"w-8 h-8 text-[var(--accent)]"})}),(0,r.jsx)("h1",{className:"text-[28px] font-bold text-[var(--text)] mb-3",children:"Vault Active"}),(0,r.jsx)("p",{className:"text-[15px] text-[var(--text-muted)] mb-10 max-w-[400px] mx-auto",children:"You already have an active KeepAlive vault. Manage your heartbeat and funds in the dashboard."}),(0,r.jsx)("button",{onClick:()=>{window.dispatchEvent(new CustomEvent("sentinel:navigate",{detail:"dashboard"}))},className:"px-8 py-3.5 bg-[var(--text)] text-black font-semibold hover:opacity-90 transition-opacity",children:"Go to Dashboard"})]}):(0,r.jsxs)("div",{className:"max-w-[680px] mx-auto px-6 py-14",children:[(0,r.jsxs)("div",{className:"text-center mb-10 animate-reveal",children:[(0,r.jsx)("h1",{className:"text-[28px] font-bold text-[var(--text)] mb-2",children:"Configure KeepAlive"}),(0,r.jsx)("p",{className:"text-[15px] text-[var(--text-muted)]",children:"Set the parameters for your automated inheritance vault."})]}),(0,r.jsxs)("div",{className:"border border-[var(--border)] bg-[var(--surface)] animate-reveal delay-1",children:[(0,r.jsxs)("div",{className:"p-7 border-b border-[var(--border)]",children:[(0,r.jsxs)("label",{className:"text-[11px] font-mono text-[var(--text-dim)] tracking-widest uppercase mb-3 flex items-center gap-1",children:[(0,r.jsx)("span",{className:"text-[var(--accent)]",children:"*"})," Beneficiary Address"]}),(0,r.jsx)("input",{type:"text",value:l,onChange:e=>{o(e.target.value),C(null)},placeholder:"receiver.near",className:"w-full bg-[var(--bg)] border border-[var(--border)] px-4 py-3.5 text-[14px] font-mono text-[var(--text)] placeholder:text-[var(--text-dim)] focus:outline-none focus:border-[var(--border-hover)]"})]}),(0,r.jsxs)("div",{className:"p-7 border-b border-[var(--border)]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsxs)("label",{className:"text-[11px] font-mono text-[var(--text-dim)] tracking-widest uppercase flex items-center gap-1.5",children:[(0,r.jsx)(j.A,{className:"w-3.5 h-3.5"})," Heartbeat Interval"]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[14px] font-mono font-semibold text-[var(--text)]",children:O(c)}),(0,r.jsx)("button",{onClick:()=>u(!v),className:"text-[10px] font-mono px-2 py-0.5 border transition-colors ".concat(v?"border-[var(--accent)]/30 text-[var(--accent)]":"border-[var(--border)] text-[var(--text-dim)] hover:text-[var(--text-muted)]"),children:v?"PRESETS":"CUSTOM"})]})]}),v?(0,r.jsxs)("div",{children:[(0,r.jsx)("input",{type:"range",min:0,max:100,step:.5,value:M(c),onChange:e=>d(V(Number(e.target.value))),className:"w-full h-1 appearance-none cursor-pointer bg-[var(--border)] accent-[var(--accent)]",style:{background:"linear-gradient(to right, var(--accent) ".concat(M(c),"%, var(--border) ").concat(M(c),"%)")}}),(0,r.jsxs)("div",{className:"flex justify-between text-[9px] font-mono text-[var(--text-dim)] mt-1.5",children:[(0,r.jsx)("span",{children:"1 min"}),(0,r.jsx)("span",{children:"30 days"})]})]}):(0,r.jsx)("div",{className:"flex border border-[var(--border)]",children:P.interval.map((e,t)=>(0,r.jsx)("button",{onClick:()=>d(e.ms),className:"flex-1 py-2.5 text-[13px] font-mono transition-colors ".concat(c===e.ms?"bg-[var(--text)] text-black font-semibold":"text-[var(--text-muted)] hover:text-[var(--text)]"," ").concat(t>0?"border-l border-[var(--border)]":""),children:e.label},t))})]}),(0,r.jsxs)("div",{className:"p-7 border-b border-[var(--border)]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsxs)("label",{className:"text-[11px] font-mono text-[var(--text-dim)] tracking-widest uppercase flex items-center gap-1.5",children:[(0,r.jsx)(N.A,{className:"w-3.5 h-3.5"})," Grace Period"]}
1),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[14px] font-mono font-semibold text-[var(--amber)]",children:O(x)}),(0,r.jsx)("button",{onClick:()=>f(!b),className:"text-[10px] font-mono px-2 py-0.5 border transition-colors ".concat(b?"border-[var(--amber)]/30 text-[var(--amber)]":"border-[var(--border)] text-[var(--text-dim)] hover:text-[var(--text-muted)]"),children:b?"PRESETS":"CUSTOM"})]})]}),b?(0,r.jsxs)("div",{children:[(0,r.jsx)("input",{type:"range",min:0,max:100,step:.5,value:M(x),onChange:e=>m(V(Number(e.target.value))),className:"w-full h-1 appearance-none cursor-pointer bg-[var(--border)]",style:{background:"linear-gradient(to right, var(--amber) ".concat(M(x),"%, var(--border) ").concat(M(x),"%)")}}),(0,r.jsxs)("div",{className:"flex justify-between text-[9px] font-mono text-[var(--text-dim)] mt-1.5",children:[(0,r.jsx)("span",{children:"1 min"}),(0,r.jsx)("span",{children:"30 days"})]})]}):(0,r.jsx)("div",{className:"flex border border-[var(--border)]",children:P.grace.map((e,t)=>(0,r.jsx)("button",{onClick:()=>m(e.ms),className:"flex-1 py-2.5 text-[13px] font-mono transition-colors ".concat(x===e.ms?"bg-[var(--amber)] text-white font-semibold":"text-[var(--text-muted)] hover:text-[var(--text)]"," ").concat(t>0?"border-l border(--border)]":""),children:e.label},t))})]}),(0,r.jsxs)("div",{className:"p-7 border-b border-[var(--border)]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsxs)("label",{className:"text-[11px] font-mono text-[var(--text-dim)] tracking-widest uppercase flex items-center gap-1.5",children:[(0,r.jsx)(N.A,{className:"w-3.5 h-3.5"})," Encrypted Payload"]}),(0,r.jsx)("span",{className:"text-[9px] font-mono px-1.5 py-0.5 border border-[var(--accent)]/20 text-[var(--accent)]",children:"AES-256-GCM"})]}),(0,r.jsx)("textarea",{value:p,onChange:e=>{h(e.target.value),C(null)},rows:3,placeholder:"Enter seed phrases, private notes, or coordinates here. Encrypted locally before it ever leaves your browser.",className:"w-full bg-[var(--bg)] border border-[var(--border)] px-4 py-3.5 text-[13px] font-mono text-[var(--text)] placeholder:text-[var(--text-dim)] focus:outline-none focus:border-[var(--border-hover)] resize-none"})]}),(0,r.jsxs)("div",{className:"p-7 border-b border-[var(--border)]",children:[(0,r.jsx)("label",{className:"text-[11px] font-mono text-[var(--text-dim)] tracking-widest uppercase mb-3 block",children:"Telegram Notifications (optional)"}),I?(0,r.jsxs)("div",{className:"flex items-center justify-between p-4 border border-[var(--accent)]/20 bg-[var(--accent-dim)]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)(y.A,{className:"w-4 h-4 text-[var(--accent)]"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[13px] font-medium text-[var(--text)]",children:"Telegram Connected"}),(0,r.jsx)("p",{className:"text-[11px] text-[var(--text-dim)]",children:"You'll receive alerts when your timer expires."})]})]}),(0,r.jsxs)("a",{href:"https://t.me/keepalive_near_bot?start=".concat(a),target:"_blank",rel:"noopener noreferrer",className:"text-[11px] font-mono text-[var(--text-dim)] hover:text-[var(--text)] transition-colors flex items-center gap-1",children:["Open Bot ",(0,r.jsx)(w.A,{className:"w-3 h-3"})]})]}):(0,r.jsxs)("a",{href:"https://t.me/keepalive_near_bot?start=".concat(a),target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-4 border border-[var(--border)] hover:border-[var(--border-hover)] transition-colors group",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("span",{className:"text-[16px]",children:"\uD83D\uDCF1"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[13px] font-medium text-[var(--text)]",children:"Connect Telegram Bot"}),(0,r.jsx)("p",{className:"text-[11px] text-[var(--text-dim)]",children:"Receive instant alerts when your vault timer is running low."})]})]}),(0,r.jsx)(w.A,{className:"w-4 h-4 text-[var(--text-dim)] group-hover:text-[var(--text-muted)] transition-colors"})]})]}),(0,r.jsxs)("div",{className:"p-7",children:[(0,r.jsx)("button",{onClick:R,disabled:!D||t||E,className:"w-full py-4 text-[15px] font-semibold transition-all flex items-center justify-center gap-2 ".concat(!D||t||E?"bg-[var(--border)] text-[var(--text-dim)] cursor-not-allowed grayscale":"bg-[var(--text)] text-black hover:opacity-90 grayscale-0"),children:t||E?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k.A,{className:"w-4 h-4 animate-spin"}),E?"Encrypting...":"Signing..."]}):(0,r.jsx)(r.Fragment,{children:"Initialize Vault"})}),S&&(0,r.jsx)("p",{className:"mt-3 text-[11px] font-mono text-red-500 text-center animate-shake",children:S})]})]})]})}var L=a(92598),G=a(23920);function W(){let{revealPayload:e,isTransactionPending:t,accountId:a}=(0,n.y)();(0,s.useEffect)(()=>{let e=new URLSearchParams(window.location.search),t=e.get("transactionHashes"),a=e.get("errorCode");if(a){x("Transaction failed: ".concat(decodeURIComponent(a))),window.history.replaceState({},"",window.location.pathname);return}t&&(p(!0),setTimeout(()=>{p(!1),x("Transaction completed. Click 'Reveal Payload' again to decrypt."),window.history.replaceState({},"",window.location.pathname)},1e3))},[]);
1let[i,l]=(0,s.useState)(""),[o,c]=(0,s.useState)(null),[d,x]=(0,s.useState)(""),[m,p]=(0,s.useState)(!1),[h,v]=(0,s.useState)(!1),u=async()=>{x(""),c(null),p(!0);try{let t=i.trim()||void 0,a=new Promise((e,t)=>setTimeout(()=>t(Error("Wallet interaction timed out. Please approve the transaction.")),12e4)),r=await Promise.race([e(t),a]);if(r){let e=r,a="",s=S(r);if(s)try{e=await E(s.ciphertext,s.key,s.iv)}catch(e){console.error("Local decryption failed:",e),a="Decryption failed. Showing raw metadata."}else{let t=_(r);if(t)try{let a=await R("NOVA:".concat(t.cid));e=await E(a,t.key,t.iv)}catch(e){console.error("Nova retrieval/decryption failed:",e),a="Failed to retrieve from Nova/IPFS. Using metadata."}}c(e),a&&x(a),t&&sessionStorage.setItem("revealed_".concat(t),e)}else x("No payload found for this vault, or the vault has not triggered yet.")}catch(e){console.error("Reveal failed:",e),x(e instanceof Error?e.message:"Failed to reveal payload.")}finally{p(!1)}};return(0,s.useState)(()=>{{let e=localStorage.getItem("last_revealed_owner");if(e){let t=sessionStorage.getItem("revealed_".concat(e));t&&(c(t),l(e))}}}),(0,r.jsxs)("div",{className:"max-w-[500px] mx-auto px-6 py-14",children:[(0,r.jsxs)("div",{className:"mb-8 animate-reveal",children:[(0,r.jsx)("p",{className:"text-[11px] font-mono text-[var(--text-dim)] tracking-widest uppercase mb-2",children:"Beneficiary Access"}),(0,r.jsx)("h2",{className:"text-[22px] font-bold text-[var(--text)]",children:"Retrieve Inherited Payload"}),(0,r.jsx)("p",{className:"text-[13px] text-[var(--text-muted)] mt-2",children:"If a vault owner's switch has triggered, you can access the encrypted payload they left for you."})]}),(0,r.jsxs)("div",{className:"border border-[var(--border)] bg-[var(--surface)] animate-reveal delay-1",children:[(0,r.jsxs)("div",{className:"p-6",children:[(0,r.jsx)("label",{className:"text-[10px] font-mono text-[var(--text-dim)] tracking-widest uppercase mb-2 block",children:"Vault Creator Account ID"}),(0,r.jsx)("input",{type:"text",value:i,onChange:e=>l(e.target.value),placeholder:"e.g. vault-owner.near",className:"w-full bg-[var(--bg)] border border-[var(--border)] px-4 py-3 text-[13px] font-mono text-[var(--text)] placeholder:text-[var(--text-dim)] focus:outline-none focus:border-[var(--border-hover)]"})]}),(0,r.jsxs)("div",{className:"p-6 border-t border-[var(--border)]",children:[(0,r.jsx)("button",{onClick:u,disabled:m||t,className:"w-full flex items-center justify-center gap-2 py-3 bg-[var(--text)] text-black text-[13px] font-semibold hover:opacity-90 transition-opacity disabled:opacity-30",children:m?(0,r.jsx)(k.A,{className:"w-4 h-4 animate-spin"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L.A,{className:"w-3.5 h-3.5"}),"Reveal Payload"]})}),m&&(0,r.jsx)("div",{className:"mt-2 text-center",children:(0,r.jsx)("button",{onClick:()=>window.location.reload(),className:"text-[10px] text-[var(--text-dim)] underline hover:text-[var(--text)]",children:"Stuck loading? Check for result"})})]})]}),o&&(0,r.jsxs)("div",{className:"mt-4 border border-[var(--border)] bg-[var(--surface)] p-5 animate-reveal",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("span",{className:"text-[10px] font-mono text-[var(--accent)] tracking-widest uppercase",children:"Decrypted Payload"}),(0,r.jsxs)("button",{onClick:()=>{o&&(navigator.clipboard.writeText(o),v(!0),setTimeout(()=>v(!1),2e3))},className:"text-[10px] font-mono text-[var(--text-dim)] hover:text-[var(--text)] transition-colors flex items-center gap-1",children:[h?(0,r.jsx)(y.A,{className:"w-3 h-3"}):(0,r.jsx)(G.A,{className:"w-3 h-3"}),h?"Copied":"Copy"]})]}),(0,r.jsx)("div",{className:"bg-[var(--bg)] border border-[var(--border)] p-4 text-[12px] font-mono text-[var(--text-muted)] break-all",children:o})]}),d&&(0,r.jsx)("div",{className:"mt-4 border border-red-900/40 bg-red-950/20 p-4 text-[12px] text-red-400/80 animate-reveal",children:d})]})}var z=a(42640),F=a(21773),B=a(45686),K=a(46967),Y=a(92823),H=a(62455);function U(){let{accountId:e,vaultStatus:t,ping:a,deposit:i,withdraw:l,revealPayload:o,resetVault:c,isTransactionPending:d,refreshStatus:x,isSyncing:m}
1=(0,n.y)(),[p,h]=(0,s.useState)("00"),[v,u]=(0,s.useState)("00"),[f,g]=(0,s.useState)("00"),[N,y]=(0,s.useState)(100),[A,C]=(0,s.useState)(""),[I,T]=(0,s.useState)(null),[P,O]=(0,s.useState)(!1),[V,M]=(0,s.useState)(!1),[D,W]=(0,s.useState)(!1),[U,q]=(0,s.useState)(null),[J,X]=(0,s.useState)(!1),$=(0,s.useRef)(!1),Q=(0,s.useRef)(null);(0,s.useEffect)(()=>{$.current=!1,Q.current&&(clearInterval(Q.current),Q.current=null)},[t]),(0,s.useEffect)(()=>{if(!t)return;let e=Date.now(),a=t.is_warning_active,r=a?Number(t.warning_grace_remaining_ms):Number(t.time_remaining_ms),s=a?Number(t.grace_period_ms):Number(t.heartbeat_interval_ms),n=()=>{let a=Math.max(0,r-(Date.now()-e)),n=Math.floor(a/36e5),i=Math.floor(a%36e5/6e4),l=Math.floor(a%6e4/1e3);h(String(n).padStart(2,"0")),u(String(i).padStart(2,"0")),g(String(l).padStart(2,"0")),y(s>0?Math.min(100,(s-a)/s*100):0);let o=!t.is_expired&&!t.is_yielding&&!t.is_emergency&&!t.is_completed;if(a<=0&&o&&!$.current&&!m){console.log("Timer hit zero - starting auto-refresh poll..."),$.current=!0,x();let e=0;Q.current=setInterval(()=>{e++,console.log("Auto-refresh poll attempt ".concat(e)),x(!0),e>=5&&Q.current&&clearInterval(Q.current)},2e3)}};n();let i=setInterval(n,1e3);return()=>{clearInterval(i),Q.current&&clearInterval(Q.current)}},[t,x,m]),(0,s.useEffect)(()=>{if(!e)return;let t=async()=>{try{let t=await fetch("/api/agent/register-vault");if(t.ok){let a=(await t.json()).vaults||[];q(a.includes(e))}}catch(e){console.warn("Could not fetch agent status")}};t();let a=setInterval(t,6e4);return()=>clearInterval(a)},[e]);let Z=async()=>{if(e){X(!0);try{(await fetch("/api/agent/register-vault",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wallet_id:e})})).ok&&(q(!0),x())}catch(e){console.error("Agent check failed",e)}finally{X(!1)}}},ee=e=>{let t=Number(e);return t>=864e5?"".concat(Math.round(t/864e5),"d"):t>=36e5?"".concat(Math.round(t/36e5),"h"):"".concat(Math.round(t/6e4),"m")},[et,ea]=(0,s.useState)(null),er=async()=>{M(!0),ea(null);try{let t=new Promise((e,t)=>setTimeout(()=>t(Error("Wallet interaction timed out. Please approve the transaction.")),12e4)),a=await Promise.race([o(),t]);if(a){let t=a.trim().replace(/^"|"$/g,""),r=t,s="",n=S(t);if(n)try{r=await E(n.ciphertext,n.key,n.iv)}catch(e){console.error("Local decryption failed:",e),s="Local decryption error. Check your key/IV."}else{let e=_(t);if(e)try{let t=await R("NOVA:".concat(e.cid));r=await E(t,e.key,e.iv)}catch(e){console.error("Nova retrieval/decryption failed:",e),s=e instanceof Error?e.message:"Nova retrieval failed."}}T(r),s&&ea(s),O(!0),e&&sessionStorage.setItem("revealed_".concat(e),JSON.stringify({secret:r,error:s}))}else throw Error("Unable to decrypt payload. You may not be authorized.")}catch(e){console.error("Reveal failed:",e),ea(e instanceof Error?e.message:"Failed to reveal payload")}finally{M(!1)}};(0,s.useEffect)(()=>{if(e){let t=sessionStorage.getItem("revealed_".concat(e));if(t)try{let{secret:e,error:a}=JSON.parse(t);T(e),a&&ea(a),O(!0)}catch(e){}}},[e]);let es=async()=>{if(A)try{await i(A),C("")}catch(e){console.error("Deposit failed",e)}},[en,ei]=(0,s.useState)(!1),el=async()=>{if(confirm("Are you sure? This will delete your vault and return funds.")){ei(!0);try{await c()}catch(e){console.error("Reset failed:",e),alert("Failed to reset vault. Please try again.")}finally{ei(!1)}}};if(!t)return null;let eo=t.is_completed?"COMPLETED":t.is_emergency?"EMERGENCY":t.is_yielding?"YIELDING":t.is_warning_active?"WARNING":t.is_expired?"EXPIRED":"ACTIVE",ec="ACTIVE"===eo?"var(--accent)":"WARNING"===eo?"var(--warn)":"var(--danger)";return(0,r.jsxs)("div",{className:"max-w-[1200px] mx-auto px-8 py-8",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-6 animate-reveal",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("span",{className:"w-2 h-2 rounded-full animate-pulse-dot",style:{backgroundColor:ec}}),(0,r.jsxs)("span",{className:"text-[13px] font-mono text-[var(--text-muted)] tracking-widest uppercase",children:["Switch Status: ",(0,r.jsx)("span",{style:{color:ec},children:eo})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-0.5 border border-[var(--accent)]/20 bg-[var(--accent-dim)] rounded-full ml-4",children:[(0,r.jsx)(z.A,{className:"w-2.5 h-2.5 text-[var(--accent)]"}),(0,r.jsx)("span",{className:"text-[9px] font-mono text-[var(--accent)] font-bold tracking-tight uppercase",children:"Vault Owner"})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("button",{onClick:()=>x(),disabled:d||m,className:"flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-mono text-[var(--text-dim)] hover:text-[var(--text-muted)] border border-[var(--border)] hover:border-[var(--border-hover)] transition-colors disabled:opacity-30",title:"Refresh vault state",children:[(0,r.jsx)(F.A,{className:"w-3 h-3 ".concat(m?"animate-spin":"")}),m?"Syncing...":"Refresh"]}),(0,r.jsxs)("button",{onClick:el,disabled:d||en,className:"flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-mono text-red-400/60 hover:text-red-400 border border-red-900/30 hover:border-red-800/50 transition-colors disabled:opacity-30",title:"Delete vault and return funds",children:[en?(0,r.jsx)(k.A,{className:"w-3 h-3 animate-spin"}):(0,r.jsx)(B.A,{className:"w-3 h-3"}),en?"Resetting...":"Reset Vault"]})]})]}),(0,r.jsxs)("div",{className:"grid lg:grid-cols-[1fr_380px] gap-5",children:[(0,r.jsxs)("div",{className:"border border-[var(--border)] bg-[var(--surface)] p-10 animate-reveal delay-1",children:[(0,r.jsxs)("div",{className:"flex items-baseline justify-center gap-2 mb-8",children:[(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("span",{className:"text-[80px] font-bold tracking-tight leading-none font-mono text-[var(--text)] animate-ticker",children:p}),(0,r.jsx)("p",{className:"text-[11px] font-mono text-[var(--text-dim)] mt-2 tracking-widest uppercase",children:"Hours"})]}),(0,r.jsx)("span",{className:"text-[48px] font-light text-[var(--text-dim)] mx-2",children:":"}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("span",{className:"text-[80px] font-bold tracking-tight leading-none font-mono text-[var(--text)]",children:v}),(0,r.jsx)("p",{className:"text-[11px] font-mono text-[var(--text-dim)] mt-2 tracking-widest uppercase",children:"Minutes"})]}),(0,r.jsx)("span",{className:"text-[48px] font-light text-[var(--text-dim)] mx-2",children:":"}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("span",{className:"text-[80px] font-bold tracking-tight leading-none font-mono text-[var(--text)]",children:f}),(0,r.jsx)("p",{className:"text-[11px] font-mono text-[var(--text-dim)] mt-2 tracking-widest uppercase",children:"Seconds"})]})]}),(0,r.jsx)("div",{className:"relative h-[3px] bg-[var(--border)] rounded-full mb-2",children:(0,r.jsx)("div",{className:"absolute top-0 left-0 h-full rounded-full transition-all duration-1000",style:{width:"".concat(N,"%"),backgroundColor:ec}})}),(0,r.jsxs)("div",{className:"flex justify-between text-[11px] font-mono text-[var(--text-dim)]",children:[(0,r.jsx)("span",{children:"TRIGGER"}),(0,r.jsx)("span",{children:"RESET"})]}),(0,r.jsxs)("button",{onClick:a,disabled:d,className:"mt-10 w-full flex items-center justify-between px-6 py-5 border border-[var(--border)] hover:border-[var(--accent)]/30 transition-all group bg-[var(--bg)]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)("div",{className:"w-10 h-10 border border-[var(--border)] group-hover:border-[var(--accent)]/30 flex items-center justify-center transition-colors",children:(0,r.jsx)(b.A,{className:"w-5 h-5 text-[var(--text-muted)] group-hover:text-[var(--accent)] transition-colors"})}),(0,r.jsxs)("div",{className:"text-left",children:[(0,r.jsx)("p",{className:"text-[15px] font-semibold text-[var(--text)]",children:"Ping"}),(0,r.jsx)("p",{className:"text-[13px] text-[var(--text-dim)]",children:"Send a heartbeat to reset your countdown timer."})]})]}),d?(0,r.jsx)(k.A,{className:"w-4 h-4 text-[var(--text-dim)] animate-spin"}):(0,r.jsx)(K.A,{className:"w-4 h-4 text-[var(--text-dim)] group-hover:text-[var(--text)] transition-colors"})]})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,r.jsxs)("div",{className:"border border-[var(--border)] bg-[var(--surface)] p-6 animate-reveal delay-2",children:[(0,r.jsx)("p",{className:"text-[11px] font-mono text-[var(--text-dim)] tracking-widest uppercase mb-3",children:"Vault Balance"}),(0,r.jsxs)("p",{className:"text-[36px] font-bold text-[var(--text)] tracking-tight",children:[(e=>{let t=Number(BigInt(e||"0"))/1e24;return t.toFixed(t<.01?4:2)})(t.vault_balance),(0,r.jsx)("span",{className:"text-[16px] font-normal text-[var(--text-muted)] ml-2",children:"NEAR"})]}),(0,r.jsxs)("div",{className:"flex gap-2 mt-5",children:[(0,r.jsx)("input",{type:"text",value:A,onChange:e=>C(e.target.value),placeholder:"0.0",className:"flex-1 bg-[var(--bg)] border border-[var(--border)] px-4 py-2.5 text-[13px] font-mono text-[var(--text)] placeholder:text-[var(--text-dim)] focus:outline-none focus:border-[var(--border-hover)] min-w-0"}),(0,r.jsx)("button",{onClick:es,disabled:d||!A,className:"px-5 py-2.5 bg-[var(--text)] text-black text-[13px] font-semibold hover:opacity-90 transition-opacity disabled:opacity-30",children:"Deposit"})]}),(0,r.jsx)("button",{onClick:()=>l(),disabled:d,className:"w-full mt-3 px-4 py-2.5 border border-[var(--border)] text-[13px] text-[var(--text-muted)] hover:text-[var(--text)] hover:border-[var(--border-hover)] transition-colors disabled:opacity-30",children:"Withdraw All"})]}),(0,r.jsx)("div",{className:"border border-[var(--border)] bg-[var(--surface)] animate-reveal delay-3",children:[{icon:j.A,label:"Heartbeat Interval",value:ee(t.heartbeat_interval_ms),color:"var(--text)"}
1,{icon:z.A,label:"Grace Period",value:ee(t.grace_period_ms),color:"var(--amber)"},{icon:Y.A,label:"Assigned Beneficiary",value:t.beneficiary_id,color:"var(--text)"},{icon:H.A,label:"Monitoring Agent",value:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-1.5 h-1.5 rounded-full ".concat(U?"bg-[var(--success)] shadow-[0_0_8px_var(--success)]":"bg-[var(--text-dim)]")}),(0,r.jsx)("span",{className:"text-[11px] font-mono ".concat(U?"text-[var(--text)]":"text-[var(--text-dim)]"),children:U?"Active":"Inactive"}),!U&&(0,r.jsx)("button",{onClick:Z,disabled:J,className:"ml-2 px-2 py-0.5 text-[9px] bg-[var(--surface-light)] hover:bg-[var(--surface-lighter)] text-[var(--text-dim)] hover:text-[var(--text)] rounded border border-[var(--border)] transition-colors",children:J?"...":"Activate"}),U&&(0,r.jsx)("button",{onClick:Z,disabled:J,title:"Force agent check",className:"ml-1 text-[var(--text-dim)] hover:text-[var(--accent)] transition-colors",children:(0,r.jsx)(F.A,{className:"w-3 h-3 ".concat(J?"animate-spin":"")})})]}),color:"var(--text)"}].map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 ".concat(t>0?"border-t border-[var(--border)]":""),children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(e.icon,{className:"w-4 h-4 text-[var(--text-dim)]"}),(0,r.jsx)("span",{className:"text-[14px] text-[var(--text-muted)]",children:e.label})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-[14px] font-mono font-medium",style:{color:e.color},children:e.value}),"action"in e&&e.action]})]},t))}),(0,r.jsxs)("div",{className:"border border-[var(--border)] bg-[var(--surface)] p-6 animate-reveal delay-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)("p",{className:"text-[14px] font-semibold text-[var(--text)]",children:"Secret Payload"}),P&&I&&(0,r.jsxs)("button",{onClick:()=>{I&&(navigator.clipboard.writeText(I),W(!0),setTimeout(()=>W(!1),2e3))},className:"flex items-center gap-1 text-[11px] font-mono text-[var(--text-dim)] hover:text-[var(--text)] transition-colors",children:[(0,r.jsx)(G.A,{className:"w-3 h-3"}),D?"Copied":"Copy"]})]}),P&&I?(0,r.jsx)("div",{className:"bg-[var(--bg)] border border-[var(--border)] p-4 text-[12px] font-mono text-[var(--text-muted)] break-all leading-relaxed",children:I}):(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsx)("button",{onClick:er,disabled:V,className:"w-full flex items-center justify-center gap-2 py-3 border border-[var(--border)] text-[13px] text-[var(--text-muted)] hover:text-[var(--text)] hover:border-[var(--border-hover)] transition-colors disabled:opacity-50",children:V?(0,r.jsx)(k.A,{className:"w-3.5 h-3.5 animate-spin"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L.A,{className:"w-3.5 h-3.5"}),"Reveal"]})}),et&&(0,r.jsx)("p",{className:"text-[10px] text-red-500 font-mono text-center animate-shake",children:et})]})]}),(0,r.jsxs)("a",{href:"https://t.me/keepalive_near_bot?start=".concat(e),target:"_blank",rel:"noopener noreferrer",className:"border border-[var(--border)] bg-[var(--surface)] p-5 flex items-center justify-between group hover:border-[var(--border-hover)] transition-colors animate-reveal delay-5",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{className:"text-[16px]",children:"\uD83D\uDCF1"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[13px] font-medium text-[var(--text)]",children:"Telegram Alerts"}),(0,r.jsx)("p",{className:"text-[11px] text-[var(--text-dim)]",children:(null==t?void 0:t.telegram_chat_id)?"Connected â receiving alerts":"Get notified when your timer runs low"})]})]}),(0,r.jsx)(w.A,{className:"w-3.5 h-3.5 text-[var(--text-dim)] group-hover:text-[var(--text-muted)] transition-colors"})]})]})]})]})}let q=[{id:"transfer",label:"Fund Transfer"},{id:"encryption",label:"E2E Encryption"},{id:"pulse",label:"Pulse States"},{id:"methods",label:"Contract API"}];function J(){let[e,t]=(0,s.useState)("transfer");return(0,r.jsxs)("div",{className:"max-w-[960px] mx-auto px-6 py-14",children:[(0,r.jsxs)("div",{className:"mb-10 animate-reveal",children:[(0,r.jsx)("p",{className:"text-[11px] font-mono text-[var(--text-dim)] tracking-widest uppercase mb-2",children:"Protocol Architecture"}),(0,r.jsx)("h1",{className:"text-[28px] font-bold text-[var(--text)]",children:"How KeepAlive Works"})]}),(0,r.jsx)("div",{className:"flex border-b border-[var(--border)] mb-10 animate-reveal delay-1",children:q.map(a=>(0,r.jsx)("button",{onClick:()=>t(a.id),className:"px-4 py-2.5 text-[12px] font-mono transition-colors border-b-2 -mb-px ".concat(e===a.id?"border-[var(--text)] text-[var(--text)]":"border-transparent text-[var(--text-muted)] hover:text-[var(--text)]"),children:a.label},a.id))}),(0,r.jsxs)("div",{className:"animate-fade",children:["transfer"===e&&(0,r.jsx)($,{}),"encryption"===e&&(0,r.jsx)(Z,{}),"pulse"===e&&(0,r.jsx)(ee,{}),"methods"===e&&(0,r.jsx)(et,{})]})]})}
1function X(){let[e,t]=(0,s.useState)("7x#9fB@!kL$2mN&p"),a="0123456789abcdef#@$%!?&*<>{}";return(0,s.useEffect)(()=>{let e=setInterval(()=>{let e="";for(let t=0;t<17;t++)e+=a[Math.floor(Math.random()*a.length)];t(e)},80);return()=>clearInterval(e)},[]),(0,r.jsx)("span",{className:"font-mono text-white/40",children:e})}function $(){let e=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,[a,r]=(0,s.useState)(e),n="0123456789abcdef@#$%&*!?><{}[]";return(0,s.useEffect)(()=>{let a=0,s=2*e.length,i=setInterval(()=>{let t=Math.floor(Math.min(++a/s,1)*e.length),l="";for(let a=0;a<e.length;a++)a<t?l+=e[a]:l+=n[Math.floor(Math.random()*n.length)];r(l),a>=s&&(clearInterval(i),r(e))},t);return()=>clearInterval(i)},[e]),a}("aes256:7f3a9b2c...e8d1",60),[t,a]=(0,s.useState)(0),n=[{step:"01",title:"Client-Side Secret",subtitle:"Your browser only",color:"#888",content:(0,r.jsxs)("div",{className:"bg-black/80 border border-[var(--border)] p-4 font-mono text-[13px]",children:[(0,r.jsx)("span",{className:"text-[9px] text-[var(--text-dim)] tracking-widest uppercase",children:"payload input"}),(0,r.jsxs)("div",{className:"text-[var(--text)] mt-2",children:[(0,r.jsx)("span",{className:"text-[var(--text-dim)]",children:"> "}),"my_secret_seed_phrase_2024",(0,r.jsx)("span",{className:"inline-block w-[2px] h-[14px] bg-[var(--text-muted)] ml-0.5 align-middle",style:{animation:"blink-cursor 1s step-end infinite"}})]})]})},{step:"02",title:"E2E Encryption",subtitle:"AES-256-GCM \xb7 Web Crypto API",color:"#888",content:(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{className:"flex-1 bg-black/50 border border-white/6 p-3",children:[(0,r.jsx)("p",{className:"text-[9px] font-mono text-[var(--text-dim)] uppercase tracking-widest mb-1",children:"Plaintext"}),(0,r.jsx)("p",{className:"font-mono text-[13px] text-[var(--text)]",children:"my_secret_seed..."})]}),(0,r.jsx)("div",{className:"text-[var(--text-muted)] text-[18px]",children:"â"}),(0,r.jsxs)("div",{className:"flex-1 bg-black/70 border border-white/6 p-3",children:[(0,r.jsx)("p",{className:"text-[9px] font-mono text-[var(--text-dim)] uppercase tracking-widest mb-1",children:"Ciphertext"}),(0,r.jsx)("p",{className:"font-mono text-[13px]",children:(0,r.jsx)(X,{})})]})]}),(0,r.jsx)("div",{className:"bg-white/[0.03] border border-white/[0.08] p-3 text-center",children:(0,r.jsx)("p",{className:"text-[12px] font-mono font-bold text-white/50 tracking-wider",children:"SERVER SEES ONLY GIBBERISH"})})]})},{step:"03",title:"Decentralized Storage",subtitle:"NOVA IPFS Network",color:"#888",content:(0,r.jsxs)("div",{className:"relative bg-black/40 border border-white/6 p-5 overflow-hidden",children:[(0,r.jsx)("div",{className:"absolute inset-0 overflow-hidden",children:Array.from({length:16}).map((e,t)=>(0,r.jsx)("div",{className:"absolute rounded-full bg-white/40",style:{width:t%3==0?5:3,height:t%3==0?5:3,left:"".concat(8+5.5*t%84,"%"),top:"".concat(12+19*t%76,"%"),animation:"pulse-dot ".concat(2+t%3,"s ease-in-out infinite"),animationDelay:"".concat(.15*t,"s")}},t))}),(0,r.jsxs)("div",{className:"relative text-center py-2",children:[(0,r.jsx)("p",{className:"text-[20px] font-bold font-mono text-white mb-1",style:{textShadow:"0 0 20px rgba(255,255,255,0.15)"},children:"NOVA"}),(0,r.jsx)("p",{className:"text-[11px] text-[var(--text-muted)]",children:"Encrypted shards distributed across IPFS peers"}),(0,r.jsx)("div",{className:"flex items-center justify-center gap-4 mt-3",children:["shard_0x7f","shard_0xa3","shard_0x1b"].map((e,t)=>(0,r.jsx)("span",{className:"text-[9px] font-mono px-2 py-0.5 border border-white/10 text-[var(--text-muted)]",children:e},t))})]})]})},{step:"04",title:"Smart Contract Lock",subtitle:"NEAR Protocol \xb7 On-chain",color:"#888",content:(0,r.jsx)("div",{className:"relative bg-black/40 border border-white/6 p-5",children:(0,r.jsxs)("div",{className:"flex items-center gap-6",children:[(0,r.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,r.jsx)("div",{className:"w-20 h-20 border border-white/10 rounded-xl flex items-center justify-center",style:{boxShadow:"0 0 20px rgba(255,255,255,0.04)"},children:(0,r.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.5)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}),(0,r.jsx)("div",{className:"absolute inset-0 border border-white/[0.06] rounded-xl",style:{animation:"pulse-ring 2.5s ease-out infinite"}})]}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-white/60 animate-pulse-dot"}),(0,r.jsx)("span",{className:"text-[10px] font-mono text-[var(--text-muted)]",children:"HEARTBEAT ACTIVE"})]}),(0,r.jsx)(Q,{})]}),(0,r.jsxs)("div",{className:"text-right",children:[(0,r.jsx)("p",{className:"text-[9px] font-mono text-[var(--text-dim)] uppercase tracking-widest",children:"Locked Value"}),(0,r.jsxs)("p",{className:"text-[28px] font-bold font-mono text-white leading-none",style:{textShadow:"0 0 16px rgba(255,255,255,0.1)"},children:["1,500 ",(0,r.jsx)("span",{className:"text-[16px] text-[var(--text-muted)]",children:"NEAR"})]})]})]}),(0,r.jsx)("p",{className:"text-[11px] text-[var(--text-dim)]",children:"Timer guards the vault. Miss a heartbeat â funds auto-transfer to beneficiary."})]})]})})},{step:"05",title:"Inheritance Delivered",subtitle:"Trustless \xb7 Automatic \xb7 Irreversible",color:"#34d399",content:(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"bg-black/60 border border-[var(--accent)]/20 p-5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)("p",{className:"text-[9px] font-mono text-[var(--accent)] uppercase tracking-widest",children:"Assets Transferred"}),(0,r.jsx)("span",{className:"text-[9px] font-mono text-[var(--text-dim)]",children:"TX: 8f3a...d1b2"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)("p",{className:"text-[36px] font-bold font-mono text-[var(--accent)] leading-none",children:"+1,500"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[16px] font-semibold text-[var(--text)]",children:"NEAR"}),(0,r.jsx)("p",{className:"text-[12px] font-mono text-[var(--text-muted)]",children:"â alice.near"})]})]})]}),(0,r.jsxs)("div",{className:"bg-black/40 border border-[var(--border)] p-4",children:[(0,r.jsx)("p",{className:"text-[9px] font-mono text-[var(--text-dim)] uppercase tracking-widest mb-2",children:"Attached Secrets Revealed"}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)("p",{className:"font-mono text-[11px] text-[var(--text-dim)] line-through",children:e})}),(0,r.jsx)("span",{className:"text-[var(--text-dim)]",children:"â"}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)("p",{className:"font-mono text-[11px] text-[var(--accent)]",children:"my_secret_seed_phrase"})})]}),(0,r.jsx)("p",{className:"text-[10px] text-[var(--text-dim)] mt-2",children:"Private keys, instructions, or farewell messages â decrypted client-side via NOVA."})]})]})}];return(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[14px] text-[var(--text-muted)] mb-10 max-w-[600px]",children:"Watch your data travel through the KeepAlive pipeline â from secret input to trustless inheritance."}),(0,r.jsx)("div",{className:"border-t border-white/[0.06]",children:n.map((e,s)=>{let i=t===s;return n.length,(0,r.jsxs)("div",{className:"animate-reveal delay-".concat(s+1," border-b border-white/[0.06]"),children:[(0,r.jsxs)("button",{onClick:()=>a(i?-1:s),className:"w-full flex items-center gap-5 py-5 px-2 text-left cursor-pointer group transition-colors duration-300 hover:bg-white/[0.02]",children:[(0,r.jsx)("span",{className:"text-[15px] font-mono font-bold transition-colors duration-300 ".concat(i?"text-white":"text-gray-600"),children:e.step}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("h3",{className:"text-[17px] font-semibold transition-colors duration-300 ".concat(i?"text-white":"text-gray-300 group-hover:text-white"),children:e.title}),(0,r.jsx)("p",{className:"text-[11px] font-mono transition-colors duration-300 ".concat(i?"text-gray-400":"text-[var(--text-dim)]"),children:e.subt
1itle})]}),(0,r.jsx)("span",{className:"text-[20px] font-light text-gray-500 transition-transform duration-300 select-none ".concat(i?"rotate-45":"rotate-0"),children:"+"})]}),(0,r.jsx)("div",{className:"grid transition-all duration-500 ease-in-out",style:{gridTemplateRows:i?"1fr":"0fr",opacity:i?1:0},children:(0,r.jsx)("div",{className:"overflow-hidden",children:(0,r.jsx)("div",{className:"px-2 pb-6 pt-1 ".concat(""),children:e.content})})})]},s)})}),(0,r.jsxs)("div",{className:"grid md:grid-cols-2 gap-px bg-[var(--border)] mt-10",children:[(0,r.jsxs)("div",{className:"bg-[var(--bg)] p-6",children:[(0,r.jsx)("p",{className:"text-[10px] font-mono text-[var(--accent)] tracking-widest uppercase mb-2",children:"Normal Operation"}),(0,r.jsxs)("p",{className:"text-[13px] text-[var(--text-muted)] leading-relaxed",children:["Owner regularly calls ",(0,r.jsx)("code",{className:"text-[var(--text)] bg-[var(--surface)] px-1",children:"ping()"})," to reset the countdown. This proves activity and keeps the vault alive."]})]}),(0,r.jsxs)("div",{className:"bg-[var(--bg)] p-6",children:[(0,r.jsx)("p",{className:"text-[10px] font-mono text-red-400 tracking-widest uppercase mb-2",children:"Triggered Transfer"}),(0,r.jsx)("p",{className:"text-[13px] text-[var(--text-muted)] leading-relaxed",children:"If the owner goes silent: Warning â Grace â Yield â Transfer. The contract autonomously sends funds + secrets to the beneficiary."})]})]})]})}function Q(){let[e,t]=(0,s.useState)("23:59:47");return(0,s.useEffect)(()=>{let e=23,a=59,r=47,s=setInterval(()=>{--r<0&&(r=59,a--),a<0&&(a=59,e--),e<0&&(e=23,a=59,r=59),t("".concat(String(e).padStart(2,"0"),":").concat(String(a).padStart(2,"0"),":").concat(String(r).padStart(2,"0")))},1e3);return()=>clearInterval(s)},[]),(0,r.jsx)("p",{className:"text-[28px] font-bold font-mono text-white leading-none",style:{textShadow:"0 0 16px rgba(255,255,255,0.1)"},children:e})}function Z(){return(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-[13px] text-[var(--text-muted)] mb-8 max-w-[600px]",children:["End-to-end encryption pipeline. The server and smart contract ",(0,r.jsx)("strong",{className:"text-[var(--text)]",children:"never see plaintext data"}),". All cryptographic operations happen in the user's browser."]}),(0,r.jsx)("div",{className:"border border-[var(--border)]",children:[{stage:"1",label:"User Input",detail:"Plaintext secret entered in browser",side:"CLIENT"},{stage:"2",label:"Key Generation",detail:"AES-256-GCM key + random IV generated via Web Crypto API",side:"CLIENT"},{stage:"3",label:"Encrypt",detail:"crypto.subtle.encrypt() â plaintext â ciphertext",side:"CLIENT"},{stage:"4",label:"Package",detail:"Format: E2E:LOCAL:<cipher>|KEY:<b64>|IV:<b64>",side:"CLIENT"},{stage:"5",label:"Store",detail:"Encrypted payload stored in smart contract secure_payload field",side:"ON-CHAIN"},{stage:"6",label:"Access Control",detail:"reveal_payload() â owner always, benef
1iciary only if is_completed=true",side:"ON-CHAIN"},{stage:"7",label:"Decrypt",detail:"Beneficiary retrieves payload â browser decrypts with key + IV",side:"CLIENT"}].map((e,t)=>(0,r.jsxs)("div",{className:"flex animate-reveal delay-".concat(t+1," ").concat(t>0?"border-t border-[var(--border)]":""),children:[(0,r.jsx)("div",{className:"w-16 flex items-center justify-center border-r border-[var(--border)] bg-[var(--surface)]",children:(0,r.jsx)("span",{className:"text-[18px] font-bold text-[var(--text-dim)] font-mono",children:e.stage})}),(0,r.jsxs)("div",{className:"flex-1 px-6 py-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-1",children:[(0,r.jsx)("span",{className:"text-[13px] font-semibold text-[var(--text)]",children:e.label}),(0,r.jsx)("span",{className:"text-[8px] font-mono px-1.5 py-0.5 tracking-wider ".concat("CLIENT"===e.side?"border border-[var(--accent)]/20 text-[var(--accent)]":"border border-[var(--border)] text-[var(--text-dim)]"),children:e.side})]}),(0,r.jsx)("p",{className:"text-[12px] text-[var(--text-muted)]",children:e.detail})]})]},t))}),(0,r.jsxs)("div",{className:"mt-4 border border-[var(--border)] bg-[var(--surface)] p-6",children:[(0,r.jsx)("p",{className:"text-[10px] font-mono text-[var(--accent)] tracking-widest uppercase mb-2",children:"Zero-Knowledge Guarantee"}),(0,r.jsx)("p",{className:"text-[12px] text-[var(--text-muted)] leading-relaxed",children:"At no point does the NEAR smart contract, NOVA IPFS, or any intermediary have access to plaintext data. The encryption key is embedded in the payload string itself â readable only by someone with browser-level access to that specific vault entry. This is a trustless, client-side encryption scheme."})]})]})}function ee(){return(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-[13px] text-[var(--text-muted)] mb-8 max-w-[600px]",children:["The ",(0,r.jsx)("code",{className:"text-[var(--text)] bg-[var(--surface)] px-1",children:"check_pulse()"})," contract method determines the vault's lifecycle state. Each state has specific rules about what actions are permitted."]}),(0,r.jsx)("div",{className:"space-y-1",children:[{name:"ALIVE",color:"var(--accent)",desc:"Owner is pinging regularly. Timer resets with each heartbeat. This is the normal operating state.",trigger:"ping() called before interval expires"},{name:"EXPIRED",color:"var(--warn)",desc:"Heartbeat interval exceeded. The owner has not pinged within the required timeframe. Warning phase begins.",trigger:"now > last_active + heartbeat_interval"},{name:"WARNING_TRIGGERED",color:"var(--warn)",desc:"A warning has been issued. The Telegram bot notifies the owner. Grace period countdown starts.",trigger:"trigger_warning() called by agent"},{name:"WARNING_GRACE_PERIOD",color:"#f59e0b",desc:"Owner has one last chance to respond with a ping. If they ping now, the vault returns to ALIVE and the warning is cleared.",trigger:"now < warning_triggered_at + grace_period"},{name:"YIELD_INITIATED",color:"var(--danger)",desc:"Grace period expired. The vault enters a yield state awaiting agent verification before executing the transfer.",trigger:"check_pulse() called after grace expires"},{name:"TRANSFER_COMPLETE",color:"#7f1d1d",desc:"Agent confirmed inactivity. Vault balance has been transferred to the beneficiary. Encrypted payload is now accessible by the beneficiary.",trigger:"resume_pulse(confirm_death=true)"}].map((e,t)=>(0,r.jsxs)("div",{className:"flex border border-[var(--border)] animate-reveal delay-".concat(t+1),children:[(0,r.jsx)("div",{className:"w-1 flex-shrink-0",style:{backgroundColor:e.color}}),(0,r.jsxs)("div",{className:"flex-1 p-5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("span",{className:"text-[14px] font-mono font-bold text-[var(--text)]",children:e.name}),(0,r.jsx)("span",{className:"text-[9px] font-mono text-[var(--text-dim)] max-w-[50%] text-right",children:e.trigger})]}),(0,r.jsx)("p",{className:"text-[12px] text-[var(--text-muted)] leading-relaxed",children:e.desc})]})]},t))}),(0,r.jsxs)("div",{className:"mt-8 border border-[var(--border)] bg-[var(--surface)] p-6 text-center",children:[(0,r.jsx)("p",{className:"text-[10px] font-mono text-[var(--text-dim)] tracking-widest uppercase mb-4",children:"State Transitions"}),(0,r.jsx)("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:["ALIVE","â","EXPIRED","â","WARNING","â","GRACE","â","YIELD","â","TRANSFER"].map((e,t)=>"â"===e?(0,r.jsx)("span",{className:"text-[var(--text-dim)] text-[12px]",children:"â"},t):(0,r.jsx)("span",{className:"px-2 py-1 border border-[var(--border)] text-[10px] font-mono text-[var(--text-muted)]",children:e},t))}),(0,r.jsxs)("p",{className:"text-[10px] text-[var(--text-dim)] mt-3",children:["At any point before YIELD, the owner can call ",(0,r.jsx)("code",{className:"text-[var(--text)]",children:"ping()"})," to return to ALIVE."]})]})]})}function et(){return(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[13px] text-[var(--text-muted)] mb-8 max-w-[600px]",children:"Complete smart contract API reference. The contract is deployed on NEAR Protocol and all state transitions are trustless and verifiable."}),(0,r.jsxs)("div",{className:"border border-[var(--border)] overflow-hidden",children:[(0,r.jsxs)("div",{className:"grid grid-cols-[140px_80px_1fr_1fr] bg-[var(--surface)] border-b border-[var(--border)] px-4 py-2",children:[(0,r.jsx)("span",{className:"text-[9px] font-mono text-[var(--text-dim)] tracking-widest uppercase",children:"Method"}),(0,r.jsx)("span",{className:"text-[9px] font-mono text-[var(--text-dim)] tracking-widest uppercase",children:"Type"}),(0,r.jsx)("span",{className:"text-[9px] font-mono text-[var(--text-dim)] tracking-widest uppercase",children:"Parameters"}),(0,r.jsx)("span",{className:"text-[9px] font-mono text-[var(--text-dim)] tracking-widest uppercase",children:"Description"})]}
1),[{name:"setup_vault",type:"call",params:"beneficiary, interval_ms?, grace_period_ms?, secure_payload?",desc:"Create a new vault"},{name:"ping",type:"call",params:"(none)",desc:"Reset heartbeat timer â prove you're alive"},{name:"deposit",type:"call (payable)",params:"attached NEAR",desc:"Add funds to vault balance"},{name:"withdraw",type:"call",params:"amount?",desc:"Withdraw NEAR from vault"},{name:"reveal_payload",type:"call",params:"account_id",desc:"Access encrypted payload (auth-gated)"},{name:"trigger_warning",type:"call",params:"account_id",desc:"Issue warning after interval expires"},{name:"check_pulse",type:"call",params:"account_id",desc:"Check if grace period has expired, initiate yield"},{name:"resume_pulse",type:"call",params:"account_id, confirm_death",desc:"Finalize transfer or cancel yield"},{name:"reset_vault",type:"call",params:"(none)",desc:"Delete vault and return funds to owner"},{name:"get_vault",type:"view",params:"account_id",desc:"Read vault status and all computed fields"},{name:"get_all_vaults",type:"view",params:"(none)",desc:"List all vault owner account IDs"}].map((e,t)=>(0,r.jsxs)("div",{className:"grid grid-cols-[140px_80px_1fr_1fr] px-4 py-3 animate-reveal delay-".concat(Math.min(t+1,8)," ").concat(t>0?"border-t border-[var(--border)]":""),children:[(0,r.jsx)("span",{className:"text-[11px] font-mono text-[var(--text)]",children:e.name}),(0,r.jsx)("span",{className:"text-[10px] font-mono ".concat("view"===e.type?"text-[var(--accent)]":"text-[var(--text-muted)]"),children:e.type}),(0,r.jsx)("span",{className:"text-[10px] font-mono text-[var(--text-dim)]",children:e.params}),(0,r.jsx)("span",{className:"text-[11px] text-[var(--text-muted)]",children:e.desc})]},t))]})]})}var ea=a(21626),er=a(86122),es=a(93467),en=a(28283);function ei(){return(0,r.jsxs)("div",{className:"max-w-[640px] mx-auto px-6 py-14",children:[(0,r.jsxs)("div",{className:"mb-10 animate-reveal",children:[(0,r.jsx)("p",{className:"text-[11px] font-mono text-[var(--text-dim)] tracking-widest uppercase mb-2",children:"About"}),(0,r.jsx)("h1",{className:"text-[28px] font-bold text-[var(--text)]",children:"KeepAlive Protocol"})]}),(0,r.jsxs)("div",{className:"space-y-4 text-[14px] text-[var(--text-muted)] leading-relaxed animate-reveal delay-1",children:[(0,r.jsxs)("p",{children:[(0,r.jsx)("strong",{className:"text-[var(--text)]",children:"KeepAlive"})," is an automated inheritance protocol. It ensures your crypto assets are securely transferred to a designated beneficiary if you ever become inactive â no intermediaries, no custodians, no trust required."]}),(0,r.jsxs)("p",{children:["You deposit funds into a personal smart contract vault and periodically confirm you're still active. If the countdown expires, the protocol autonomously transfers your entire balance to your heir. Optionally, attach encrypted messages via ",(0,r.jsx)("strong",{className:"text-[var(--text)]",children:"NOVA"})," â decrypted only after the transfer triggers."]})]}),(0,r.jsxs)("div",{className:"mt-10 border-t border-[var(--border)] pt-8 animate-reveal delay-2",children:[(0,r.jsx)("p",{className:"text-[10px] font-mono text-[var(--text-dim)] tracking-widest uppercase mb-5",children:"Links"}),(0,r.jsx)("div",{className:"space-y-1",children:[{icon:ea.A,label:"GitHub Repository",url:"https://github.com/EfuzeGI/KeepAlive-Protocol"},{icon:er.A,label:"Smart Contract on NearBlocks",url:"https://nearblocks.io/address/keepalive.near"},{icon:es.A,label:"NOVA SDK Documentation",url:"https://nova-sdk.com"},{icon:en.A,label:"Telegram Bot (@keepalive_near_bot)",url:"https://t.me/keepalive_near_bot"}].map((e,t)=>(0,r.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 px-3 py-2.5 text-[14px] text-[var(--text)] hover:bg-[var(--surface)] transition-colors group rounded-sm",children:[(0,r.jsx)(e.icon,{className:"w-4 h-4 text-[var(--text-dim)] group-hover:text-[var(--text-muted)]"}),e.label,(0,r.jsx)(w.A,{className:"w-3 h-3 text-[var(--text-dim)] group-hover:text-[var(--text-muted)] ml-auto"})]},t))})]}),(0,r.jsx)("div",{className:"mt-10 border-t border-[var(--border)] pt-6 animate-reveal delay-3",children:(0,r.jsx)("p",{className:"text-[11px] text-[var(--text-dim)]",children:"KeepAlive Protocol â Trustless Digital Inheritance"})})]})}function el(){let{isConnected:e,vaultStatus:t,isSyncing:a,isLoading:i}
1=(0,n.y)(),[l,o]=(0,s.useState)("protocol"),c=null!==t&&t.is_initialized;(0,s.useEffect)(()=>{let e=e=>{let t=e.detail;"dashboard"===t?o(c?"dashboard":"create"):"architecture"===t&&o("architecture")};return window.addEventListener("sentinel:navigate",e),()=>window.removeEventListener("sentinel:navigate",e)},[c]),(0,s.useEffect)(()=>{e&&"protocol"===l&&o(c?"dashboard":"create")},[e,c]),(0,s.useEffect)(()=>{e||"dashboard"!==l&&"create"!==l&&"access"!==l||o("protocol"),"dashboard"===l&&!c&&e&&o("create"),"create"===l&&c&&e&&o("dashboard")},[e,c,l]);let d=e&&(i||a&&!t);return(0,r.jsxs)("div",{className:"min-h-screen flex flex-col",style:{backgroundColor:"var(--bg)"},children:[(0,r.jsx)(v,{activeTab:l,onTabChange:o}),(0,r.jsx)("main",{className:"flex-1",children:(()=>{if("architecture"===l)return(0,r.jsx)(J,{});if("about"===l)return(0,r.jsx)(ei,{});if(d)return(0,r.jsx)("div",{className:"min-h-[70vh] flex items-center justify-center",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,r.jsx)(k.A,{className:"w-4 h-4 text-[var(--text-dim)] animate-spin"}),(0,r.jsx)("p",{className:"text-[var(--text-dim)] text-[11px] font-mono",children:"Syncing vault data..."})]})});switch(l){case"protocol":default:return(0,r.jsx)(f,{});case"dashboard":return(0,r.jsx)(U,{});case"create":return(0,r.jsx)("div",{children:(0,r.jsx)(D,{})});case"access":return(0,r.jsx)(W,{})}})()})]})}}},e=>{var t=t=>e(e.s=t);e.O(0,[118,268,712,567,545,882,418,3,368,441,517,358],()=>t(46029)),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.