import{r as s,g as h,j as e}from"./index-CgQG7qql.js";function x({onClose:o}){const[n,l]=s.useState({}),[b,d]=s.useState(!1),i=s.useRef(null);s.useEffect(()=>{fetch(`${h()}/api/app-settings`).then(t=>t.json()).then(l).catch(()=>{})},[]),s.useEffect(()=>{const t=r=>{i.current&&!i.current.contains(r.target)&&o()};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[o]);const c=new URLSearchParams(location.search),p=parseInt(c.get("w")||"",10)||1080,u=parseInt(c.get("h")||"",10)||800,a=s.useCallback(async t=>{const r={...n,...t};l(r),d(!0);try{await fetch(`${h()}/api/app-settings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{}d(!1)},[n]),g={width:64,height:26,borderRadius:5,background:"rgba(255,255,255,0.06)",border:"1px solid rgba(255,255,255,0.12)",color:"#e4e4e7",fontSize:12,textAlign:"center",outline:"none"};return e.jsxs("div",{ref:i,style:{position:"absolute",top:"100%",right:0,marginTop:6,zIndex:1e4,width:220,padding:14,borderRadius:10,background:"rgba(24,24,27,0.95)",border:"1px solid rgba(255,255,255,0.1)",backdropFilter:"blur(16px)",boxShadow:"0 8px 32px rgba(0,0,0,0.5)",display:"flex",flexDirection:"column",gap:12,fontSize:12,color:"#a1a1aa"},children:[e.jsx("div",{style:{fontWeight:600,color:"#e4e4e7",fontSize:11,textTransform:"uppercase",letterSpacing:"0.05em"},children:"App Settings"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{children:"Window"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("input",{type:"number",value:n.windowWidth??p,onChange:t=>a({windowWidth:parseInt(t.target.value,10)||p}),style:g}),e.jsx("span",{style:{color:"#52525b"},children:"x"}),e.jsx("input",{type:"number",value:n.windowHeight??u,onChange:t=>a({windowHeight:parseInt(t.target.value,10)||u}),style:g})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{children:"Resizable"}),e.jsx("button",{onClick:()=>a({resizable:!n.resizable}),style:{width:36,height:20,borderRadius:10,border:"none",cursor:"pointer",background:n.resizable?"#f97316":"rgba(255,255,255,0.12)",position:"relative",transition:"background 0.2s"},children:e.jsx("div",{style:{width:16,height:16,borderRadius:8,background:"#fff",position:"absolute",top:2,left:n.resizable?18:2,transition:"left 0.2s"}})})]}),b&&e.jsx("div",{style:{fontSize:10,color:"#52525b"},children:"Saving..."})]})}export{x as default};
