import{u as l,r as i,g,j as r}from"./index-CgQG7qql.js";const p=window.pneumaDesktop;function u(){const o=l(t=>t.setEditing),[e,n]=i.useState(!1),[s,a]=i.useState(!1),d=i.useCallback(async()=>{a(!0);try{(await fetch(`${g()}/api/session/editing`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({editing:!0})})).ok&&(o(!0),p?.setEditing?.(!0))}catch(t){console.error("Failed to switch to editing:",t)}finally{a(!1)}},[o]);return r.jsx("div",{onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),style:{position:"fixed",top:0,left:0,right:0,height:48,zIndex:9999,display:"flex",alignItems:"flex-start",justifyContent:"flex-end",padding:"10px 12px 0",pointerEvents:"auto"},children:r.jsxs("button",{onClick:d,disabled:s,style:{height:26,paddingLeft:8,paddingRight:10,borderRadius:7,background:e?"rgba(255,255,255,0.08)":"transparent",border:e?"1px solid rgba(255,255,255,0.12)":"1px solid transparent",color:e?"rgba(255,255,255,0.6)":"transparent",cursor:e?"pointer":"default",fontSize:11,fontWeight:500,display:"flex",alignItems:"center",gap:4,transition:"all 0.25s ease",WebkitAppRegion:"no-drag",backdropFilter:e?"blur(12px)":"none"},onMouseEnter:t=>{e&&(t.currentTarget.style.color="#f97316",t.currentTarget.style.background="rgba(249,115,22,0.12)",t.currentTarget.style.borderColor="rgba(249,115,22,0.3)")},onMouseLeave:t=>{e&&(t.currentTarget.style.color="rgba(255,255,255,0.6)",t.currentTarget.style.background="rgba(255,255,255,0.08)",t.currentTarget.style.borderColor="rgba(255,255,255,0.12)")},title:"Edit dashboard",children:[s?r.jsx("div",{style:{width:12,height:12,border:"1.5px solid rgba(249,115,22,0.3)",borderTopColor:"#f97316",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}):r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{opacity:e?1:0,transition:"opacity 0.25s"},children:r.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"})}),r.jsx("span",{style:{opacity:e?1:0,transition:"opacity 0.25s"},children:"Edit"})]})})}export{u as default};
