"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7130],{67130:(e,t,a)=>{a.r(t),a.d(t,{default:()=>o});var n=a(95155),r=a(12115);let i={position:"fixed",top:12,right:12,zIndex:9999,maxWidth:340,padding:"10px 12px",borderRadius:10,background:"#141414",color:"#EDE7DD",border:"1px solid #2A2A2A",boxShadow:"0 6px 24px rgba(0,0,0,0.35)",fontSize:13,lineHeight:1.4},d={display:"flex",gap:8,alignItems:"center",marginTop:8},s={padding:"5px 10px",borderRadius:7,border:"1px solid #3A3A3A",background:"#C1440E",color:"#fff",cursor:"pointer",fontSize:12},l={...s,background:"transparent",color:"#9A9A9A",borderColor:"#2A2A2A"};function o(){let[e,t]=(0,r.useState)(null),[a,o]=(0,r.useState)(!1),[p,c]=(0,r.useState)(!1),[u,h]=(0,r.useState)(null);if((0,r.useEffect)(()=>{let e=!0;return fetch("/api/system/update").then(e=>e.ok?e.json():null).then(a=>{e&&a&&t(a)}).catch(()=>{}),()=>{e=!1}},[]),a||!e||!e.behind)return null;async function b(){c(!0);try{let e=await fetch("/api/system/update",{method:"POST",headers:{"content-type":"application/json"},body:"{}"}),t=await e.json().catch(()=>({}));h(t.ok?t.message||"Updated. Restart to apply.":t.error||"Update failed.")}catch(e){h("Update failed.")}finally{c(!1)}}return(0,n.jsx)("div",{style:i,role:"status","aria-live":"polite",children:u?(0,n.jsx)("div",{children:u}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("strong",{children:["madarX OS v",e.latest]})," is available (you have v",e.current,")."]}),(0,n.jsxs)("div",{style:d,children:[(0,n.jsx)("button",{type:"button",style:s,onClick:b,disabled:p,children:p?"Updating…":"Update now"}),(0,n.jsx)("button",{type:"button",style:l,onClick:()=>o(!0),disabled:p,children:"Later"})]})]})})}}}]);