import{j as e,r as c,B as u,G as _,c as x}from"./GitHubIcon-DnWgqK1U.chunk.js";import{g,s as b}from"./storage-DjahtsqZ.chunk.js";const f="_wrapper_v3h83_5",j="_label_v3h83_9",v="_input_v3h83_19",l={wrapper:f,label:j,input:v},N=({label:o,id:t,className:a,...r})=>e.jsxs("div",{className:l.wrapper,children:[o&&e.jsx("label",{htmlFor:t,className:l.label,children:o}),e.jsx("input",{id:t,className:`${l.input} ${a||""}`.trim(),...r})]}),k="_wrapper_oetqd_5",w="_checkbox_oetqd_21",S="_text_oetqd_29",h={wrapper:k,checkbox:w,text:S},y=({label:o,id:t,checked:a,onChange:r,...i})=>e.jsxs("label",{htmlFor:t,className:h.wrapper,children:[e.jsx("input",{type:"checkbox",id:t,className:h.checkbox,checked:a,onChange:r,...i}),e.jsx("span",{className:h.text,children:o})]}),E="_options_1hb5m_27",L="_header_1hb5m_32",C="_form_1hb5m_51",$="_section_1hb5m_59",q="_actions_1hb5m_63",B="_status_1hb5m_72",G="_footer_1hb5m_90",I="_githubLink_1hb5m_95",s={options:E,header:L,form:C,section:$,actions:q,status:B,footer:G,githubLink:I},z=()=>{const[o,t]=c.useState(""),[a,r]=c.useState(!1),[i,m]=c.useState(!1);c.useEffect(()=>{g(["username","enableLogging"]).then(n=>{t(n.username),r(n.enableLogging)})},[]);const d=async n=>{n.preventDefault(),await b({username:o,enableLogging:a}),m(!0),setTimeout(()=>m(!1),2e3)};return e.jsxs("div",{className:s.options,children:[e.jsxs("header",{className:s.header,children:[e.jsx("h1",{children:"Extension Settings"}),e.jsx("p",{children:"Configure your extension preferences"})]}),e.jsxs("form",{onSubmit:d,className:s.form,children:[e.jsx("div",{className:s.section,children:e.jsx(N,{label:"Your Name",id:"username",name:"username",placeholder:"Enter your name",spellCheck:!1,autoComplete:"off",value:o,onChange:n=>t(n.target.value)})}),e.jsx("div",{className:s.section,children:e.jsx(y,{id:"logging",name:"logging",label:"Show the features enabled on each page in the console",checked:a,onChange:n=>r(n.target.checked)})}),e.jsxs("div",{className:s.actions,children:[e.jsx(u,{type:"submit",variant:"primary",size:"large",children:"Save Settings"}),i&&e.jsx("span",{className:s.status,children:"Settings saved"})]})]}),e.jsx("footer",{className:s.footer,children:e.jsxs("a",{href:"https://github.com/abhijithvijayan/web-extension-starter",target:"_blank",rel:"noopener noreferrer",className:s.githubLink,children:[e.jsx(_,{size:18}),e.jsx("span",{children:"View on GitHub"})]})})]})},p=document.getElementById("options-root");if(!p)throw new Error("Could not find root container to mount the app");const F=x.createRoot(p);F.render(e.jsx(c.StrictMode,{children:e.jsx(z,{})}));