import{c as g,j as e,R as c}from"./client-CBvt1tWS.js";import{b as a}from"./browser-polyfill-CZ_dLIqp.js";import{g as m,s as p}from"./settings-Bo6W9Drl.js";function j(){const[s,o]=c.useState(null),[l,r]=c.useState("");c.useEffect(()=>{m().then(o)},[]);const n=(t,h)=>{o(i=>i&&{...i,[t]:h})},d=async()=>{s&&(await p(s),r("Saved"),window.setTimeout(()=>r(""),1200))},u=async()=>{const t=a.runtime.getURL("src/config/index.html");await a.tabs.create({url:t})},x=async()=>{const t=a.runtime.getURL("src/history/index.html");await a.tabs.create({url:t})};return s?e.jsxs("div",{className:"container",children:[e.jsx("h1",{children:"Gomdown Helper"}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"RPC Secret"}),e.jsx("input",{type:"text",value:s.motrixAPIkey,onChange:t=>n("motrixAPIkey",t.target.value),placeholder:"aria2 rpc secret"})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"RPC Port"}),e.jsx("input",{type:"number",value:s.motrixPort,onChange:t=>n("motrixPort",Number(t.target.value||16800))})]}),e.jsxs("label",{className:"toggle",children:["Extension Enabled",e.jsx("input",{type:"checkbox",checked:s.extensionStatus,onChange:t=>n("extensionStatus",t.target.checked)})]}),e.jsxs("label",{className:"toggle",children:["Use Native Host",e.jsx("input",{type:"checkbox",checked:s.useNativeHost,onChange:t=>n("useNativeHost",t.target.checked)})]}),e.jsxs("label",{className:"toggle",children:["Activate gdown App",e.jsx("input",{type:"checkbox",checked:s.activateAppOnDownload,onChange:t=>n("activateAppOnDownload",t.target.checked)})]}),e.jsx("button",{onClick:d,children:"Save"}),e.jsx("button",{onClick:u,children:"Settings"}),e.jsx("button",{onClick:x,children:"History"}),e.jsx("div",{className:"status",children:l})]}):e.jsx("div",{className:"container",children:"Loading..."})}g.createRoot(document.getElementById("root")).render(e.jsx(c.StrictMode,{children:e.jsx(j,{})}));
