import{d as L,j as N,X as P,E as V,c as o,a as t,t as c,f as l,F as b,n as h,e as f,a4 as k,r as d,q as A,C as E,L as J,at as O,o as n}from"./index-CU1_ljpG.js";const j={class:"h-full overflow-y-auto p-6"},B={key:0,class:"text-sm text-slate-400"},F={key:1,class:"text-sm text-rose-300"},T={key:2,class:"space-y-6"},U={class:"space-y-3 rounded-lg border border-slate-800 bg-slate-900/70 p-4"},$={class:"block"},q=["value"],R=["value"],X={key:0,class:"text-sm text-slate-400"},z={class:"flex items-center gap-2 text-sm text-slate-200"},G=["checked"],H={class:"space-y-3 rounded-lg border border-slate-800 bg-slate-900/70 p-4"},K={class:"block"},Q=["value"],W=["value"],Y={key:0,class:"text-sm text-slate-400"},Z={class:"flex items-center gap-2 text-sm text-slate-200"},ee=["checked"],te={class:"block"},se={class:"flex items-center gap-3"},ae=["value"],oe={class:"w-12 text-right text-sm text-slate-300"},re=L({__name:"UserSettingsMediaView",setup(ne){const r=N(),{preferredCameraDeviceId:_,autoStartCameraOnJoin:y,preferredMicrophoneDeviceId:w,autoStartMicOnJoin:C,micInputLevel:x}=P(r),u=d(!0),i=d(null),p=d([]),m=d([]);function g(s,e,a){return s.label?s.label:a==="camera"?`Camera ${e+1}`:`Microphone ${e+1}`}async function I(){u.value=!0,i.value=null,r.hydrate();try{await Promise.all([A().catch(()=>{}),E().catch(()=>{})]);const[s,e]=await Promise.all([J(),O()]);p.value=s,m.value=e}catch(s){i.value=s instanceof Error?s.message:"Failed to load camera or microphone devices"}finally{u.value=!1}}function M(s){const e=s.target.value;r.setPreferredCameraDeviceId(e===""?null:e)}function S(s){const e=s.target.value;r.setPreferredMicrophoneDeviceId(e===""?null:e)}function D(s){const e=Number(s.target.value);r.setMicInputLevel(e)}return V(()=>{I()}),(s,e)=>(n(),o("section",j,[e[11]||(e[11]=t("header",{class:"mb-4"},[t("p",{class:"text-xs uppercase tracking-wide text-slate-400"},"User settings"),t("h1",{class:"mt-1 text-2xl font-semibold text-slate-100"},"Media")],-1)),u.value?(n(),o("p",B,"Loading media settings...")):i.value?(n(),o("p",F,c(i.value),1)):(n(),o("div",T,[t("div",U,[e[5]||(e[5]=t("p",{class:"text-xs uppercase tracking-wide text-slate-400"},"Video",-1)),t("label",$,[e[3]||(e[3]=t("span",{class:"mb-1 block text-xs uppercase tracking-wide text-slate-400"},"Camera",-1)),t("select",{class:"w-full rounded-md border border-slate-700 bg-slate-950 px-3 py-2 text-sm text-slate-100 outline-none focus:border-blue-400",value:l(_)??"",onChange:M},[e[2]||(e[2]=t("option",{value:""},"System default",-1)),(n(!0),o(b,null,h(p.value,(a,v)=>(n(),o("option",{key:a.deviceId,value:a.deviceId},c(g(a,v,"camera")),9,R))),128))],40,q)]),p.value.length===0?(n(),o("p",X," No camera devices found. ")):f("",!0),t("label",z,[t("input",{type:"checkbox",class:"h-4 w-4 rounded border-slate-600 bg-slate-950",checked:l(y),onChange:e[0]||(e[0]=a=>l(r).setAutoStartCameraOnJoin(a.target.checked))},null,40,G),e[4]||(e[4]=k(" Start camera when joining a video session ",-1))])]),t("div",H,[e[10]||(e[10]=t("p",{class:"text-xs uppercase tracking-wide text-slate-400"},"Audio",-1)),t("label",K,[e[7]||(e[7]=t("span",{class:"mb-1 block text-xs uppercase tracking-wide text-slate-400"},"Microphone",-1)),t("select",{class:"w-full rounded-md border border-slate-700 bg-slate-950 px-3 py-2 text-sm text-slate-100 outline-none focus:border-blue-400",value:l(w)??"",onChange:S},[e[6]||(e[6]=t("option",{value:""},"System default",-1)),(n(!0),o(b,null,h(m.value,(a,v)=>(n(),o("option",{key:a.deviceId,value:a.deviceId},c(g(a,v,"microphone")),9,W))),128))],40,Q)]),m.value.length===0?(n(),o("p",Y," No microphone devices found. ")):f("",!0),t("label",Z,[t("input",{type:"checkbox",class:"h-4 w-4 rounded border-slate-600 bg-slate-950",checked:l(C),onChange:e[1]||(e[1]=a=>l(r).setAutoStartMicOnJoin(a.target.checked))},null,40,ee),e[8]||(e[8]=k(" Start microphone when joining a voice session ",-1))]),t("label",te,[e[9]||(e[9]=t("span",{class:"mb-1 block text-xs uppercase tracking-wide text-slate-400"}," Microphone input level ",-1)),t("div",se,[t("input",{type:"range",min:"0",max:"100",step:"1",class:"w-full accent-blue-400",value:l(x),onInput:D},null,40,ae),t("span",oe,c(l(x))+"%",1)])])])]))]))}});export{re as default};
//# sourceMappingURL=UserSettingsMediaView-BnCXksEL.js.map
